| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146 |
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Windows.Forms;
- using Core.Mes.Client.Comm.Format;
- using Core.Mes.Client.Comm.Server;
- using Core.Mes.Client.Comm.Tool;
- using Core.StlMes.Client.Mcp.Control;
- using Core.StlMes.Client.Mcp.VRP.Entity;
- using CoreFS.CA06;
- namespace Core.StlMes.Client.Mcp.VRP.Vrp
- {
- public partial class FrmChangeLength : FrmBase
- {
- private string _heatPlanID = "";
- public FrmChangeLength(string HeatPlanID, OpeBase _opeBase)
- {
- InitializeComponent();
- _heatPlanID = HeatPlanID;
- this.ob = _opeBase;
- Refresh();
- }
- private void utmMain_ToolClick(object sender, Infragistics.Win.UltraWinToolbars.ToolClickEventArgs e)
- {
- switch (e.Tool.Key)
- {
- case "Close": // ButtonTool
- // Place code here
- this.Close();
- break;
- case "ChangeLen": // ButtonTool
- // Place code here
- ugMain.UpdateData();
- List<ChangeLen> datasEntities = changeLenBindingSource.DataSource as List<ChangeLen>;
- if (datasEntities == null || !datasEntities.Any(p => p.check))
- {
- MessageBox.Show("请选择要修改的长度");
- return;
- }
- datasEntities = datasEntities.Where(p => p.check).ToList();
- if (datasEntities.Any(p => p.EditCount == null))
- {
- MessageBox.Show("请输入要修改的支数");
- return;
- }
- if (datasEntities.Any(p => p.EditLen == null))
- {
- MessageBox.Show("请输入要修改的长度");
- return;
- }
- if (datasEntities.Any(p => p.EditCount>p.OrCount))
- {
- MessageBox.Show("输入的支数不能大于原有的支数");
- 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.common.PlanService";
- ccp.MethodName = "ChangeLen";
- ccp.ServerParams = new Object[] { datasEntities.Select( JSONFormat.Format).ToList(),_heatPlanID, "E" };
- 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("修改成功!"))
- {
- Refresh();
- }
- }
-
- break;
- case "Refresh": // ButtonTool
- // Place code here
- Refresh();
- break;
- }
- }
- private void Refresh()
- {
- List<PortVrpBatchSampleResultEntity> listSource = EntityHelper.GetData<PortVrpBatchSampleResultEntity>(
- "com.steering.mes.mcp.common.PlanService.getQueryDbkPortVrp", new object[] {_heatPlanID}, this.ob);
- List<ChangeLen> datasEntities = listSource.Where(p => p.MatStatus == "合格").GroupBy(p => p.ActLen).Select(p =>
- {
- ChangeLen data = new ChangeLen
- {
- OrLen = p.Key,
- OrCount = p.Count()
- };
- return data;
- }).ToList();
- changeLenBindingSource.DataSource = datasEntities;
- }
- private void ugMain_CellChange(object sender, Infragistics.Win.UltraWinGrid.CellEventArgs e)
- {
- if(e.Cell.Column.Key =="check") return;
- e.Cell.Row.Cells["check"].Value = true;
- }
- }
- }
|