| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328 |
- using Core.Mes.Client.Comm.Control;
- using Core.Mes.Client.Comm.Format;
- using Core.Mes.Client.Comm.Server;
- using Core.Mes.Client.Comm.Tool;
- using Core.StlMes.Client.Mcp.Treatment.Entity;
- using CoreFS.CA06;
- using Infragistics.Win;
- using Infragistics.Win.UltraWinGrid;
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.IO;
- using System.Linq;
- using System.Text;
- using System.Windows.Forms;
- namespace Core.StlMes.Client.Mcp.Treatment.HeatTreatment
- {
- public partial class FrmControlShift : FrmBase
- {
- public FrmControlShift()
- {
- InitializeComponent();
- }
- private string[] plineCode = null;
- private string fileName = "";//路径
- private void FrmControlShift_Load(object sender, EventArgs e)
- {
- EntityHelper.ShowGridCaption<HttControlShiftEntity>(ultraGrid1.DisplayLayout.Bands[0]);
- plineCode = Core.StlMes.Client.Mcp.Treatment.HeatTreatment.comm.GetPlineCode(ValidDataPurviewIds, CustomInfo, ob);
- comm.InitDropPlinePower(CustomInfo, txtPline, this.ValidDataPurviewIds, this.ob);
- }
- /// <summary>
- /// 重写基类方法
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="ToolbarKey"></param>
- public override void ToolBar_Click(object sender, string ToolbarKey)
- {
- switch (ToolbarKey)
- {
- case "DoQuery":
- QuerySinglePlan();
- break;
- case "DoSave":
- doSave();
- break;
- case "DoUpdate":
- doUpdate();
- break;
- case "CancelSignature":
- cancelSignature();
- break;
-
- case "Close":
- this.Close();
- break;
- }
- }
- private void QuerySinglePlan()
- {
- List<HttControlShiftEntity> listSource = EntityHelper.GetData<HttControlShiftEntity>(
- "com.steering.mes.mcp.heatTreatment.HttControlShift.doQuery", new object[] { plineCode }, this.ob);
- HttControlShiftEntitybindingSource1.DataSource = listSource;
- GridHelper.RefreshAndAutoSize(this.ultraGrid1);
- foreach (UltraGridRow ugr in ultraGrid1.Rows)
- {
- ugr.Cells["PlineCode"].Appearance.BackColor = Color.Transparent;
- ugr.Cells["PlineCode"].Appearance.BackHatchStyle = BackHatchStyle.Default;
- ugr.Cells["PlineCode"].Activation = Infragistics.Win.UltraWinGrid.Activation.ActivateOnly;
- ugr.Cells["proBc"].Appearance.BackColor = Color.Transparent;
- ugr.Cells["proBc"].Appearance.BackHatchStyle = BackHatchStyle.Default;
- ugr.Cells["proBc"].Activation = Infragistics.Win.UltraWinGrid.Activation.ActivateOnly;
- }
- }
- /// <summary>
- /// 新增
- /// </summary>
- private void doSave()
- {
- this.ultraGrid1.UpdateData();
- ArrayList list = new ArrayList();
- IQueryable<UltraGridRow> checkRows = this.ultraGrid1.Rows.AsQueryable().Where(" CHK = 'True'");
- if (checkRows.Count() == 0)
- {
- MessageUtil.ShowTips("请勾选要新增的信息");
- return;
- }
- foreach (UltraGridRow row in checkRows)
- {
- HttControlShiftEntity hsEntity = (HttControlShiftEntity)row.ListObject;
- if (hsEntity.PlineCode.Equals(""))
- {
- MessageUtil.ShowTips("产线不能为空");
- return;
- }
- if (hsEntity.ProBc.Equals(""))
- {
- MessageUtil.ShowTips("班次不能为空");
- return;
- }
- //else if (hsEntity.ProBc.Equals("早"))
- //{
- // hsEntity.ProBc = "1";
- //}
- //else if (hsEntity.ProBc.Equals("中"))
- //{
- // hsEntity.ProBc = "2";
- //}
- //else if (hsEntity.ProBc.Equals("晚"))
- //{
- // hsEntity.ProBc = "3";
- //}
- if (hsEntity.LastBc.Equals(""))
- {
- MessageUtil.ShowTips("上一班次不能为空");
- return;
- }
- //else if (hsEntity.LastBc.Equals("早"))
- //{
- // hsEntity.LastBc = "1";
- //}
- //else if (hsEntity.LastBc.Equals("中"))
- //{
- // hsEntity.LastBc = "2";
- //}
- //else if (hsEntity.LastBc.Equals("晚"))
- //{
- // hsEntity.LastBc = "3";
- //}
-
- string httEntity = JSONFormat.Format(hsEntity);
- list.Add(httEntity);
- DataTable dt = ServerHelper.GetData("com.steering.mes.mcp.heatTreatment.HttControlShift.getSameData", new object[] { hsEntity.PlineCode, hsEntity.ProBc}, ob);
- if (dt.Rows.Count > 0) { MessageUtil.ShowTips("已存在数据,不能进行此操作!"); return; }
- }
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.mes.mcp.heatTreatment.HttControlShift";
- ccp.MethodName = "doSave";
- ccp.ServerParams = new object[] { list };
- ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp.ReturnCode != -1)
- {
- if (ccp.ReturnInfo.Equals("新增成功!"))
- {
- QuerySinglePlan();
- MessageUtil.ShowTips(ccp.ReturnInfo);
- }
- else
- {
- MessageUtil.ShowTips(ccp.ReturnInfo);
- }
- }
- }
- /// <summary>
- /// 修改
- /// </summary>
- private void doUpdate()
- {
- this.ultraGrid1.UpdateData();
- ArrayList list = new ArrayList();
- IQueryable<UltraGridRow> checkRows = this.ultraGrid1.Rows.AsQueryable().Where(" CHK = 'True'");
- if (checkRows.Count() == 0)
- {
- MessageUtil.ShowTips("请勾选要修改的信息");
- return;
- }
- foreach (UltraGridRow row in checkRows)
- {
- HttControlShiftEntity hsEntity = (HttControlShiftEntity)row.ListObject;
- if (hsEntity.PlineCode.Equals(""))
- {
- MessageUtil.ShowTips("产线不能为空");
- return;
- }
- if (hsEntity.ProBc.Equals(""))
- {
- MessageUtil.ShowTips("班次不能为空");
- return;
- }
- //else if (hsEntity.ProBc.Equals("早"))
- //{
- // hsEntity.ProBc = "1";
- //}
- //else if (hsEntity.ProBc.Equals("中"))
- //{
- // hsEntity.ProBc = "2";
- //}
- //else if (hsEntity.ProBc.Equals("晚"))
- //{
- // hsEntity.ProBc = "3";
- //}
- if (hsEntity.LastBc.Equals(""))
- {
- MessageUtil.ShowTips("上一班次不能为空");
- return;
- }
- //else if (hsEntity.LastBc.Equals("早"))
- //{
- // hsEntity.LastBc = "1";
- //}
- //else if (hsEntity.LastBc.Equals("中"))
- //{
- // hsEntity.LastBc = "2";
- //}
- //else if (hsEntity.LastBc.Equals("晚"))
- //{
- // hsEntity.LastBc = "3";
- //}
- string httEntity = JSONFormat.Format(hsEntity);
- list.Add(httEntity);
-
- }
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.mes.mcp.heatTreatment.HttControlShift";
- ccp.MethodName = "doUpdate";
- ccp.ServerParams = new object[] { list };
- ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp.ReturnCode != -1)
- {
- if (ccp.ReturnInfo.Equals("修改成功!"))
- {
- QuerySinglePlan();
- MessageUtil.ShowTips(ccp.ReturnInfo);
- }
- else
- {
- MessageUtil.ShowTips(ccp.ReturnInfo);
- }
- }
- }
- /// <summary>
- /// 删除
- /// </summary>
- private void cancelSignature()
- {
- this.ultraGrid1.UpdateData();
- ArrayList list = new ArrayList();
- IQueryable<UltraGridRow> checkRows = this.ultraGrid1.Rows.AsQueryable().Where(" CHK = 'True'");
- if (checkRows.Count() == 0)
- {
- MessageUtil.ShowTips("请勾选要删除的信息");
- return;
- }
- foreach (UltraGridRow row in checkRows)
- {
- HttControlShiftEntity hsEntity = (HttControlShiftEntity)row.ListObject;
- if (hsEntity.PlineCode.Equals(""))
- {
- MessageUtil.ShowTips("产线不能为空");
- return;
- }
- if (hsEntity.ProBc.Equals(""))
- {
- MessageUtil.ShowTips("班次不能为空");
- return;
- }
- else if (hsEntity.ProBc.Equals("早"))
- {
- hsEntity.ProBc = "1";
- }
- else if (hsEntity.ProBc.Equals("中"))
- {
- hsEntity.ProBc = "2";
- }
- else if (hsEntity.ProBc.Equals("晚"))
- {
- hsEntity.ProBc = "3";
- }
- if (hsEntity.LastBc.Equals(""))
- {
- MessageUtil.ShowTips("上一班次不能为空");
- return;
- }
- else if (hsEntity.LastBc.Equals("早"))
- {
- hsEntity.LastBc = "1";
- }
- else if (hsEntity.LastBc.Equals("中"))
- {
- hsEntity.LastBc = "2";
- }
- else if (hsEntity.LastBc.Equals("晚"))
- {
- hsEntity.LastBc = "3";
- }
- string httEntity = JSONFormat.Format(hsEntity);
- list.Add(httEntity);
- }
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.mes.mcp.heatTreatment.HttControlShift";
- ccp.MethodName = "doDelete";
- ccp.ServerParams = new object[] { list };
- ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp.ReturnCode != -1)
- {
- if (ccp.ReturnInfo.Equals("删除成功!"))
- {
- QuerySinglePlan();
- MessageUtil.ShowTips(ccp.ReturnInfo);
- }
- else
- {
- MessageUtil.ShowTips(ccp.ReturnInfo);
- }
- }
- }
-
- private void ultraGrid1_CellChange(object sender, CellEventArgs e)
- {
- if (e.Cell.Column.Key == "PlineCode")
- {
- e.Cell.Row.Cells["PlineName"].Value = e.Cell.Text;
- }
- }
- }
- }
|