| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242 |
- using Core.Mes.Client.Comm.Control;
- using Core.Mes.Client.Comm.Tool;
- using Core.StlMes.Client.Mcp.Control;
- using CoreFS.CA06;
- using Infragistics.Win.UltraWinGrid;
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using System.Data;
- using System.Linq;
- using System.Windows.Forms;
- using Core.Mes.Client.Comm.Format;
- using Core.StlMes.Client.Mcp.Mch.Entity;
- namespace Core.StlMes.Client.Mcp.Mch.MchResult
- {
- public partial class FrmSetPline : FrmBase
- {
- public FrmSetPline()
- {
- InitializeComponent();
- }
- public override void ToolBar_Click(object sender, string ToolbarKey)
- {
- switch (ToolbarKey)
- {
- case "Query":
- query();
- break;
- case "DoSave":
- DoSave();
- break;
- case "DoReturn":
- DoReturn();
- break;
- case "Close":
- CloseFrm();
- break;
- }
- }
- private void query()
- {
- string pco = "";
-
- if (kreason.Text.ToString() != "" && kreason.Text.ToString() != null)
- {
- pco = kreason.Value.ToString();
- }
- mchComSetplineEntityBindingSource.DataSource = EntityHelper.GetData<MchComSetplineEntity>(
- "com.steering.mes.mcp.Mch.FrmSetPline.query",
- new object[] { pco },
- ob);
- GridHelper.RefreshAndAutoSize(ultraGrid1);
- }
- private void DoSave()
- {
- List<MchComSetplineEntity> list = mchComSetplineEntityBindingSource.DataSource as List<MchComSetplineEntity>;
- if(list==null) return;
- list = list.Where(p => p.Chk).ToList();
- if (!list.Any() ) { MessageUtil.ShowTips("请勾选要保存的数据!"); return; }
-
- CoreClientParam ccp = new CoreClientParam();
- try
- {
- this.Cursor = Cursors.WaitCursor; //控制鼠标的样式为等待
- if (Constant.WaitingForm == null)
- {
- Constant.WaitingForm = new WaitingForm();
- }
- Constant.WaitingForm.ShowToUser = true;
- Constant.WaitingForm.Show();
- Constant.WaitingForm.Update();
- ccp.ServerName = "com.steering.mes.mcp.Mch.FrmSetPline";
- ccp.MethodName = "addPlineGx";
- ccp.ServerParams = new Object[] {list.Select(JSONFormat.Format).ToList()};
- ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- this.Cursor = Cursors.Default;
- Constant.WaitingForm.ShowToUser = false;
- Constant.WaitingForm.Close();
- Constant.WaitingForm = null;
- }
- catch (Exception ex)
- {
- this.Cursor = Cursors.Default;
- Constant.WaitingForm.ShowToUser = false;
- Constant.WaitingForm.Close();
- Constant.WaitingForm = null;
- }
- if (ccp.ReturnCode != -1)
- {
- MessageUtil.ShowTips(ccp.ReturnInfo);
- ccp.ReturnInfo.Equals("保存成功!");
- query();
- }
-
- }
- private void DoReturn()
- {
- List<MchComSetplineEntity> list = mchComSetplineEntityBindingSource.DataSource as List<MchComSetplineEntity>;
- if (list == null) return;
- list = list.Where(p => p.Chk).ToList();
- if (!list.Any()) { MessageUtil.ShowTips("请选择要删除的信息行!"); return; }
- CoreClientParam ccp = new CoreClientParam();
- try
- {
- this.Cursor = Cursors.WaitCursor; //控制鼠标的样式为等待
- if (Constant.WaitingForm == null)
- {
- Constant.WaitingForm = new WaitingForm();
- }
- Constant.WaitingForm.ShowToUser = true;
- Constant.WaitingForm.Show();
- Constant.WaitingForm.Update();
- ccp.ServerName = "com.steering.mes.mcp.Mch.FrmSetPline";
- ccp.MethodName = "detPlineGx";
- ccp.ServerParams = new Object[] { list.Select(JSONFormat.Format).ToList() };
- ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- this.Cursor = Cursors.Default;
- Constant.WaitingForm.ShowToUser = false;
- Constant.WaitingForm.Close();
- Constant.WaitingForm = null;
- }
- catch (Exception ex)
- {
- this.Cursor = Cursors.Default;
- Constant.WaitingForm.ShowToUser = false;
- Constant.WaitingForm.Close();
- Constant.WaitingForm = null;
- }
- if (ccp.ReturnCode != -1)
- {
- MessageUtil.ShowTips(ccp.ReturnInfo);
- if (ccp.ReturnInfo.Equals("删除成功!"))
- {
- query();
- }
- }
- }
- private void CloseFrm()
- {
- this.Close();
- }
- private void FrmSetPline_Load(object sender, EventArgs e)
- {
- ArrayList list = new ArrayList();
- list.Add("G");
- YdmBaseClass.InitComboEditorWithParmName(kreason, "com.steering.mes.mcp.Mch.FrmCrackDetectResult.getQuerydirect","PLINE_NAME", this.ob, true, new object[] { list });
- }
- private void judgeNo_EditorButtonClick(object sender, Infragistics.Win.UltraWinEditors.EditorButtonEventArgs e)
- {
- MchComSetplineEntity urg = ultraGrid1.ActiveRow.ListObject as MchComSetplineEntity;
- if (urg == null) { return; }
- using (FrmSetPlineGx pCode = new FrmSetPlineGx(urg.StationCodes, this.ob))
- {
- pCode.ShowDialog();
- if (pCode.DialogResult == DialogResult.OK)
- {
- urg.StationCodes = pCode.Gxs;
- urg.StationNames = pCode.GxNames;
- urg.Chk = true;
- ultraGrid1.UpdateData();
- GridHelper.RefreshAndAutoSize(this.ultraGrid1);
- }
- }
- }
- private void kreason_TextChanged(object sender, EventArgs e)
- {
- query();
- }
- private void txtOffice_EditorButtonClick(object sender, Infragistics.Win.UltraWinEditors.EditorButtonEventArgs e)
- {
- /* string plinCode = "";
- string nation = "";
- UltraGridRow urg = ultraGrid1.ActiveRow;
- if (urg == null) { return; }
- nation = urg.Cells["STATION_NAMES"].Text.ToString();
- //if (urg.Cells["OFFLINE_PLACE"].Text.ToString() == "" || urg.Cells["OFFLINE_PLACE"].Text.ToString() == null)
- //{
- // MessageUtil.ShowTips("离线去向不能为空!");
- // return;
- //}
- if (urg.Cells["PLINE_NAME"].Text.ToString() == "" || urg.Cells["PLINE_NAME"].Text.ToString() == null)
- {
- if (kreason.Text.ToString() == "" || kreason.Text.ToString() == null)
- {
- MessageUtil.ShowTips("产线不能为空!");
- return;
- }
- else
- {
- plinCode = kreason.Text.ToString();
- }
- }
- else
- {
- plinCode = urg.Cells["PLINE_CODE"].Text.ToString();
- }
- FrmSetPlineOffice pCode = new FrmSetPlineOffice(plinCode,nation, this.ob);
- pCode.ShowDialog();
- //{
- // query();
- //}
- string off = "";
- ArrayList ppt = new ArrayList();
- if (Core.StlMes.Client.Mcp.Mch.MchResult.FrmSetPlineOffice.list!=null)
- {
- for(int i = 0;i<Core.StlMes.Client.Mcp.Mch.MchResult.FrmSetPlineOffice.list.Count;i++)
- {
- if (off == "")
- {
- off = Core.StlMes.Client.Mcp.Mch.MchResult.FrmSetPlineOffice.list[i].ToString();
- }
- else
- {
- off = off + ";" + Core.StlMes.Client.Mcp.Mch.MchResult.FrmSetPlineOffice.list[i].ToString();
- }
- }
- }
- urg.Cells["OFFLINE_PLACE"].Value = off;
- judgeNo.Text = pCode.plinegxlist;
- GridHelper.RefreshAndAutoSize(this.ultraGrid1);*/
- }
- private void ultraGrid1_CellChange(object sender, CellEventArgs e)
- {
- if (e.Cell.Column.Key == "Chk") return;
- e.Cell.Row.Cells["Chk"].Value = true;
- }
- }
- }
|