using Core.Mes.Client.Comm.Control; using Core.Mes.Client.Comm.Format; using Core.Mes.Client.Comm.Tool; using Core.StlMes.Client.Lims.Port.封装类.方法; using Core.StlMes.Client.Lims.Port.数据管理.实体类; 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.Linq; using System.Text; using System.Windows.Forms; namespace Core.StlMes.Client.Lims.Port { public partial class FrmHttBatchSampleNew : FrmBase { public FrmHttBatchSampleNew() { InitializeComponent(); } private string plineCode = "";//产线 List dtPlanM = null;//检验计划主信息 List dtPlanDetial = null;//检验计划从信息 List dtPlanM1 = null;//分批详细方案 int minBatchNum = 0;//最小分批数量 private Color color1 = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(255)))), ((int)(((byte)(192))))); private Color color2 = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(224)))), ((int)(((byte)(192))))); private string batchNoZ = "";//性能批号产线标识 private void FrmMilBatchSampleNew_Load(object sender, EventArgs e) { DateTime now = DateTime.Now; DateTime dt1 = new DateTime(now.Year, now.Month, 1);//当月第一天 DateTime dt2 = dt1.AddMonths(1).AddDays(-1);//当月最后一天 this.RegStartTime.Value = DateTime.Parse(dt1.ToString("yyyy-MM-dd") + " 00:00:00"); this.RegEndTime.Value = DateTime.Parse(dt2.ToString("yyyy-MM-dd") + " 23:59:59"); EntityHelper.ShowGridCaption(this.ultraGrid1.DisplayLayout.Bands[0]); EntityHelper.ShowGridCaption(this.ultraGrid2.DisplayLayout.Bands[0]); EntityHelper.ShowGridCaption(this.ultraGrid3.DisplayLayout.Bands[0]); EntityHelper.ShowGridCaption(this.ultraGrid8.DisplayLayout.Bands[0]); EntityHelper.ShowGridCaption(this.ultraGrid5.DisplayLayout.Bands[0]); EntityHelper.ShowGridCaption(this.ultraGrid6.DisplayLayout.Bands[0]); EntityHelper.ShowGridCaption(this.ultraGrid7.DisplayLayout.Bands[0]); EntityHelper.ShowGridCaption(this.ultraGrid9.DisplayLayout.Bands[0]); EntityHelper.ShowGridCaption(this.ultraGrid10.DisplayLayout.Bands[0]); EntityHelper.ShowGridCaption(this.ultraGrid12.DisplayLayout.Bands[0]); EntityHelper.ShowGridCaption(this.ultraGrid13.DisplayLayout.Bands[0]); EntityHelper.ShowGridCaption(this.ultraGrid15.DisplayLayout.Bands[0]); EntityHelper.ShowGridCaption(this.ultraGrid16.DisplayLayout.Bands[0]); EntityHelper.ShowGridCaption(this.ultraGrid17.DisplayLayout.Bands[0]); EntityHelper.ShowGridCaption(this.ultraGrid19.DisplayLayout.Bands[0]); EntityHelper.ShowGridCaption(this.ultraGrid20.DisplayLayout.Bands[0]); plineCode = PublicPort.GetPCode(this.ValidDataPurviewIds, ob); cmbSampleType.SelectedIndex = 0; initPostion(); } /// /// 加载基础取样位置 /// private void initPostion() { DataTable ds = PublicServer.GetData("com.steering.mes.port.vrp.FrmHttBatchSaplmeNew.doQueryPostion", new object[] { }, ob); if (ds != null && ds.Rows.Count > 0) { cmbPostion.DataSource = ds; cmbPostion.ValueMember = "BASECODE"; cmbPostion1.DataSource = ds; cmbPostion1.ValueMember = "BASECODE"; cmbPiecePostion.DataSource = ds; cmbPiecePostion.ValueMember = "BASECODE"; } } /// /// 重写基类方法 /// /// /// public override void ToolBar_Click(object sender, string ToolbarKey) { switch (ToolbarKey) { case "Query": doQueryPlan(); break; case "QueryRepeate": doQueryRepeate(); break; case "BatchSeting": batchSeting(); break; case "CancelBatchSeting": cancelBatchSeting(); break; case "OprocessBatch": oprocessBatch(); break; case "CancelOprocessBatch": cancelBatch(); break; case "GetSample": getSample(); break; case"GetSamplePipece": getSamplePipece(); break; case"ComfrimComplete": comfrimComplete(); break; case "CancelGetSample": cancelGetSample(); break; case"Approval": approval(); break; case "Confirm": confirm(); break; case "CancelConfirm": cancelConfirm(); break; case"MergerConfrim": mergerConfrim(); break; case "ReGetSample": reGetSample(); break; case "CancelReGetSample": cancelReGetSample(); break; case "RepeateFrim": repeateFrim(); break; case "CancelRepeateFrim": cancelRepeateFrim(); break; case "Print": printTrust(); break; case "PrintLable": printLable(); break; case "PrintReLable": printReLable(); break; case "PrintRe": printReTrust(); break; case "Close": close(); break; } } /// /// 撤销复取样 /// private void cancelReGetSample() { this.ultraGrid15.UpdateData(); this.ultraGrid17.UpdateData(); UltraGridRow uRow = this.ultraGrid15.ActiveRow; List lists = portHttBatchSampleResultEntityBindingSource2.DataSource as List; if (uRow == null || lists.Count <= 0) { return; } PipeCheckconsignNoqualifiedEntity milPlans = (PipeCheckconsignNoqualifiedEntity)uRow.ListObject; string milPlanEntity = JSONFormat.Format(milPlans); List portMilEntity = lists.Where(p => p.ResamplePipeLenA != "" || p.ResamplePipeLenB != "" || p.ResamplePipeLenC != "" || p.ResamplePipeLenD != "" || p.ResamplePipeLenM != "" || p.ResamplePipeLenE != "" || p.ResamplePipeLenF != "" || p.ResamplePipeLenP != "" || p.ResamplePipeLenQ != "").Select(JSONFormat.Format).ToList(); CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "com.steering.mes.port.vrp.FrmHttBatchSaplmeNew"; ccp.MethodName = "cancelReGetSample"; ccp.ServerParams = new object[] { milPlanEntity, portMilEntity }; ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal); if (ccp.ReturnCode != -1) { if (ccp.ReturnInfo.Equals("撤销成功!")) { doQueryRepeate(); MessageUtil.ShowTips(ccp.ReturnInfo); } else { MessageUtil.ShowTips(ccp.ReturnInfo); } } } /// /// 复取样 /// private void reGetSample() { this.ultraGrid15.UpdateData(); this.ultraGrid17.UpdateData(); UltraGridRow uRow = this.ultraGrid15.ActiveRow; List lists = portHttBatchSampleResultEntityBindingSource2.DataSource as List; if (uRow == null || lists.Count <= 0) { return; } if (lists.Any(p => p.Chk == true && p.ResamplePipeLenA == "" && p.ResamplePipeLenB == "" && p.ResamplePipeLenC == "" && p.ResamplePipeLenD == "" && p.ResamplePipeLenE == "" && p.ResamplePipeLenF == "" && p.ResamplePipeLenP == "" && p.ResamplePipeLenQ == "" && p.ResamplePipeLenM == "")) { MessageUtil.ShowTips("还有已选做样管未输入样管长度的管材,不允许进行复取样完成!"); return; } if (lists.Any(p => p.Chk == true && !StringUtil.IsInt32(p.ResamplePipeLenA) && !StringUtil.IsInt32(p.ResamplePipeLenB) && !StringUtil.IsInt32(p.ResamplePipeLenC) && !StringUtil.IsInt32(p.ResamplePipeLenD) && !StringUtil.IsInt32(p.ResamplePipeLenE) && !StringUtil.IsInt32(p.ResamplePipeLenF) && !StringUtil.IsInt32(p.ResamplePipeLenP) && !StringUtil.IsInt32(p.ResamplePipeLenQ)&& !StringUtil.IsInt32(p.ResamplePipeLenM))) { MessageUtil.ShowTips("样管长度单位为毫米,请输入整数!"); return; } PipeCheckconsignNoqualifiedEntity milPlans = (PipeCheckconsignNoqualifiedEntity)uRow.ListObject; string milPlanEntity = JSONFormat.Format(milPlans); List portMilEntity = lists.Where(p => p.Chk).Select(JSONFormat.Format).ToList(); CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "com.steering.mes.port.vrp.FrmHttBatchSaplmeNew"; ccp.MethodName = "reGetSample"; ccp.ServerParams = new object[] { milPlanEntity, portMilEntity, UserInfo.GetUserName(), UserInfo.GetUserGroup(), UserInfo.GetUserOrder() }; ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal); if (ccp.ReturnCode != -1) { if (ccp.ReturnInfo.Equals("复取样完成!")) { doQueryRepeate(); MessageUtil.ShowTips(ccp.ReturnInfo); } else { MessageUtil.ShowTips(ccp.ReturnInfo); } } } /// /// 委托完成 /// private void comfrimComplete() { this.ultraGrid1.UpdateData(); UltraGridRow row = this.ultraGrid1.ActiveRow; if (row == null) return; PlnZyRclMEntity planEntity = (PlnZyRclMEntity)row.ListObject; string planTity = JSONFormat.Format(planEntity); CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "com.steering.mes.port.vrp.FrmHttBatchSaplmeNew"; ccp.MethodName = "comfrimComplete"; ccp.ServerParams = new object[] { planTity }; ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal); if (ccp.ReturnCode != -1) { if (ccp.ReturnInfo.Equals("委托完成!")) { doQueryPlan(); MessageUtil.ShowTips(ccp.ReturnInfo); } else { MessageUtil.ShowTips(ccp.ReturnInfo); } } } /// /// 拆批 /// private void approval() { this.ultraGrid3.UpdateData(); int startSeq = int.Parse(this.ultraSTART_PIPE_NO.Text); int endSeq = int.Parse(this.ultraEND_PIPE_NO.Text); if (startSeq > endSeq) { MessageUtil.ShowTips("起始序号不允许大于结束序号!"); return; } List list = portHttBatchSampleResultEntityBindingSource.DataSource as List; List a = list.Skip(startSeq - 1).Take(endSeq - startSeq + 1).ToList().Select(JSONFormat.Format).ToList(); if (MessageUtil.ShowYesNoAndQuestion("是否确定将序号" + startSeq + "至" + endSeq + "总共" + (endSeq - startSeq+1)+ "支管材进行拆批 ?") == DialogResult.No) { return; } CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "com.steering.mes.port.vrp.FrmHttBatchSaplmeNew"; ccp.MethodName = "approval"; ccp.ServerParams = new object[] { a }; ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal); if (ccp.ReturnCode != -1) { if (ccp.ReturnInfo.Equals("拆批成功!")) { doQueryPlan(); MessageUtil.ShowTips(ccp.ReturnInfo); } else { MessageUtil.ShowTips(ccp.ReturnInfo); } } } /// /// 查询复取样信息 /// private void doQueryRepeate() { string startTime = ""; string endTim = ""; string lotNo = ""; string judgeNo = ""; if (this.chkRegTime.Checked) { startTime = this.RegStartTime.Value.ToString(); endTim = this.RegEndTime.Value.ToString(); } if (chkLotNo.Checked && this.txtLotNo.Text.Trim() != "") { lotNo = this.txtLotNo.Text; } if (chkJudgeNo.Checked && this.txtJudgeNo.Text.Trim() != "") { judgeNo = this.txtJudgeNo.Text; } ArrayList parm = new ArrayList(); parm.Add(startTime); parm.Add(endTim); parm.Add(lotNo); parm.Add(judgeNo); if (ultraTabControl1.SelectedTab.Key == "4") { parm.Add("0"); } else if (ultraTabControl1.SelectedTab.Key == "5") { parm.Add("1"); } List listSource = EntityHelper.GetData( "com.steering.mes.port.mil.FrmMilBatchSampleNew.doQueryRepeate", new object[] { parm, plineCode }, this.ob); if (ultraTabControl1.SelectedTab.Key == "4") { pipeCheckconsignNoqualifiedEntityBindingSource.DataSource = listSource; } else if (ultraTabControl1.SelectedTab.Key == "5") { pipeCheckconsignNoqualifiedEntityBindingSource3.DataSource = listSource; } } /// /// 复取样委托 /// private void repeateFrim() { this.ultraGrid19.UpdateData(); this.ultraGrid20.UpdateData(); UltraGridRow uRow = this.ultraGrid19.ActiveRow; if (uRow == null) return; PipeCheckconsignNoqualifiedEntity pipeCheckEntity = (PipeCheckconsignNoqualifiedEntity)uRow.ListObject; string pipeTity = JSONFormat.Format(pipeCheckEntity); List> parmList = new List>(); foreach (UltraGridRow row in this.ultraGrid21.Rows) { List list = new List(); list.Add(row.Cells["PHY_BATCH_NO"].Text); list.Add(row.Cells["MAT_NO"].Text); list.Add(row.Cells["SAMPLE_PIPE_LEN"].Text); list.Add(row.Cells["SAMPLE_POSTION"].Text); for (int j = 5; j < dataTable5.Columns.Count; j++) { if (row.Cells[j].Value == "√") { list.Add(row.Cells[j].Column.Key); } } parmList.Add(list); } List> batchList = parmList.GroupBy(p => p[0]).Select(p => p.FirstOrDefault() ).ToList(); CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "com.steering.mes.port.vrp.FrmHttBatchSaplmeNew"; ccp.MethodName = "repeateFrim"; ccp.ServerParams = new object[] { pipeTity, parmList, batchList, UserInfo.GetUserName(), UserInfo.GetDepartment(), this.txtRemark2.Text.ToString().Trim() }; ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal); if (ccp.ReturnCode != -1) { if (ccp.ReturnInfo.Equals("复取样委托成功!")) { doQueryRepeate(); MessageUtil.ShowTips(ccp.ReturnInfo); } else { MessageUtil.ShowTips(ccp.ReturnInfo); } } } /// /// 撤销复取样委托 /// private void cancelRepeateFrim() { this.ultraGrid19.UpdateData(); UltraGridRow uRow = this.ultraGrid19.ActiveRow; if (uRow == null) return; PipeCheckconsignNoqualifiedEntity pipeNoTity = (PipeCheckconsignNoqualifiedEntity)uRow.ListObject; string pipeNoEntity = JSONFormat.Format(pipeNoTity); CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "com.steering.mes.port.vrp.FrmHttBatchSaplmeNew"; ccp.MethodName = "cancelRepeateFrim"; ccp.ServerParams = new object[] { pipeNoEntity }; ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal); if (ccp.ReturnCode != -1) { if (ccp.ReturnInfo.Equals("撤销复取样委托成功!")) { doQueryRepeate(); MessageUtil.ShowTips(ccp.ReturnInfo); } else { MessageUtil.ShowTips(ccp.ReturnInfo); } } } /// /// 打印复样标签 /// private void printReLable() { this.ultraGrid19.UpdateData(); UltraGridRow uRow = this.ultraGrid19.ActiveRow; if (uRow == null) return; string checkNo = "F" + uRow.Cells["CheckNo"].Text.Trim(); string strurl = ""; strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepEntrustLabelHTT.cpt" + "&CHECK_NO=" + checkNo; FrmRepExcel fBug = new FrmRepExcel(ob, strurl); fBug.AutoSize = true; fBug.MaximumSize = new Size(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height); fBug.WindowState = FormWindowState.Maximized; fBug.Text = "样管号标签"; fBug.Show(); } /// /// 标签 /// private void printLable() { this.ultraGrid12.UpdateData(); UltraGridRow uRow = this.ultraGrid12.ActiveRow; if (uRow == null) return; string checkNo = uRow.Cells["CheckNo"].Text.Trim(); string strurl = ""; strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepEntrustLabelHTT.cpt&&format=pdf&__embed__=true" + "&CHECK_NO=" + checkNo + "&JUDGE_STOVE_NO=" + uRow.Cells["JudgeStoveNo"].Text.Trim() + "&PROCESS_CODE=F"; FrmRepExcel fBug = new FrmRepExcel(ob, strurl); fBug.AutoSize = true; fBug.MaximumSize = new Size(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height); fBug.WindowState = FormWindowState.Maximized; fBug.Text = "样管号标签"; fBug.Show(); } /// /// 打印 /// private void printTrust() { this.ultraGrid12.UpdateData(); UltraGridRow uRow = this.ultraGrid12.ActiveRow; if (uRow == null) return; this.ultraGrid13.UpdateData(); UltraGridRow uRow2 = this.ultraGrid13.ActiveRow; if (uRow2 == null) return; string checkNo = uRow.Cells["CheckNo"].Text.Trim(); string orderNo = uRow2.Cells["OrderNo"].Text.Trim(); string strurl = ""; strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepLimsPortCheckConsignOrder.cpt&&format=pdf&__embed__=true" + "&CHECK_NO=" + checkNo + "&orderNo=" + orderNo; FrmRepExcel fBug = new FrmRepExcel(ob, strurl); fBug.AutoSize = true; fBug.MaximumSize = new Size(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height); fBug.WindowState = FormWindowState.Maximized; fBug.Text = "检验委托单"; fBug.Show(); } /// /// 打印复样委托单 /// private void printReTrust() { this.ultraGrid19.UpdateData(); UltraGridRow uRow = this.ultraGrid19.ActiveRow; if (uRow == null) return; this.ultraGrid20.UpdateData(); UltraGridRow uRow2 = this.ultraGrid20.ActiveRow; if (uRow2 == null) return; string checkNo = "F" + uRow.Cells["CheckNo"].Text.Trim(); string strurl = ""; strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepLimsPortCheckConsignOrder.cpt&&format=pdf&__embed__=true" + "&CHECK_NO=" + checkNo ; FrmRepExcel fBug = new FrmRepExcel(ob, strurl); fBug.AutoSize = true; fBug.MaximumSize = new Size(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height); fBug.WindowState = FormWindowState.Maximized; fBug.Text = "检验委托单"; fBug.Show(); } private void close() { this.Close(); } /// /// 分批取样完成 /// private void batchSeting() { this.ultraGrid1.UpdateData(); this.ultraGrid3.UpdateData(); UltraGridRow uRow = this.ultraGrid1.ActiveRow; List lists = portHttBatchSampleResultEntityBindingSource.DataSource as List; if (uRow == null || lists.Count <= 0) { return; } //if (lists.Any(p => p.PhyBatchNo == "")) //{ // MessageUtil.ShowTips("还有未分配批号管材,不允许进行分批完成!"); // return; //} if (lists.Any(p => p.Chk == true && p.SamplePipeLenA == "" && p.SamplePipeLenB == "" && p.SamplePipeLenC == "" && p.SamplePipeLenD == "" && p.SamplePipeLenM == "" && p.SamplePipeLenE == "" && p.SamplePipeLenF == "" && p.SamplePipeLenP == "" && p.SamplePipeLenQ == "")) { MessageUtil.ShowTips("还有已选做样管未输入样管长度的管材,不允许进行分批完成!"); return; } if (lists.Any(p => p.Chk == true && !StringUtil.IsInt32(p.SamplePipeLenA) && !StringUtil.IsInt32(p.SamplePipeLenB) && !StringUtil.IsInt32(p.SamplePipeLenC) && !StringUtil.IsInt32(p.SamplePipeLenD) && !StringUtil.IsInt32(p.SamplePipeLenM) && !StringUtil.IsInt32(p.SamplePipeLenE) && !StringUtil.IsInt32(p.SamplePipeLenF) && !StringUtil.IsInt32(p.SamplePipeLenP) && !StringUtil.IsInt32(p.SamplePipeLenQ))) { MessageUtil.ShowTips("样管长度单位为毫米,请输入整数!"); return; } PlnZyRclMEntity milPlans = (PlnZyRclMEntity)uRow.ListObject; string milPlanEntity = JSONFormat.Format(milPlans); List portMilEntity = lists.Select(JSONFormat.Format).ToList(); CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "com.steering.mes.port.vrp.FrmHttBatchSaplmeNew"; ccp.MethodName = "batchSeting"; ccp.ServerParams = new object[] { milPlanEntity, portMilEntity,UserInfo.GetUserName(),UserInfo.GetUserGroup(),UserInfo.GetUserOrder(),this.cmbSampleType.Value.ToString() }; ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal); if (ccp.ReturnCode != -1) { if (ccp.ReturnInfo.Equals("分批取样完成!")) { doQueryPlan(); MessageUtil.ShowTips(ccp.ReturnInfo); } else { MessageUtil.ShowTips(ccp.ReturnInfo); } } } /// /// 撤销分批取样 /// private void cancelBatchSeting() { this.ultraGrid5.UpdateData(); UltraGridRow uRow = this.ultraGrid5.ActiveRow; if (uRow == null) return; PlnZyRclMEntity milPlans = (PlnZyRclMEntity)uRow.ListObject; string milPlanEntity = JSONFormat.Format(milPlans); CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "com.steering.mes.port.vrp.FrmHttBatchSaplmeNew"; ccp.MethodName = "cancelBatchSeting"; ccp.ServerParams = new object[] { milPlanEntity}; ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal); if (ccp.ReturnCode != -1) { if (ccp.ReturnInfo.Equals("撤销成功!")) { doQueryPlan(); MessageUtil.ShowTips(ccp.ReturnInfo); } else { MessageUtil.ShowTips(ccp.ReturnInfo); } } } /// /// 分批完成 /// private void oprocessBatch() { this.ultraGrid1.UpdateData(); this.ultraGrid3.UpdateData(); UltraGridRow uRow = this.ultraGrid1.ActiveRow; List lists = portHttBatchSampleResultEntityBindingSource.DataSource as List; if (uRow == null || lists.Count <= 0) { return; } //if (lists.Any(p => p.PhyBatchNo == "")) //{ // MessageUtil.ShowTips("还有未分配批号管材,不允许进行分批完成!"); // return; //} PlnZyRclMEntity milPlans = (PlnZyRclMEntity)uRow.ListObject; string milPlanEntity = JSONFormat.Format(milPlans); List portMilEntity = lists.Select(JSONFormat.Format).ToList(); CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "com.steering.mes.port.vrp.FrmHttBatchSaplmeNew"; ccp.MethodName = "oprocessBatch"; ccp.ServerParams = new object[] { milPlanEntity, portMilEntity, UserInfo.GetUserName(), UserInfo.GetUserGroup(), UserInfo.GetUserOrder() }; ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal); if (ccp.ReturnCode != -1) { if (ccp.ReturnInfo.Equals("分批完成!")) { doQueryPlan(); MessageUtil.ShowTips(ccp.ReturnInfo); } else { MessageUtil.ShowTips(ccp.ReturnInfo); } } } /// /// 撤销分批 /// private void cancelBatch() { this.ultraGrid1.UpdateData(); this.ultraGrid3.UpdateData(); UltraGridRow uRow = this.ultraGrid1.ActiveRow; UltraGridRow row = this.ultraGrid4.ActiveRow; if (uRow == null || row == null) return; PlnZyRclMEntity milPlans = (PlnZyRclMEntity)uRow.ListObject; string milPlanEntity = JSONFormat.Format(milPlans); CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "com.steering.mes.port.vrp.FrmHttBatchSaplmeNew"; ccp.MethodName = "cancelBatch"; ccp.ServerParams = new object[] { milPlanEntity, row.Cells["PHY_BATCH_NO"].Text }; ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal); if (ccp.ReturnCode != -1) { if (ccp.ReturnInfo.Equals("撤销成功!")) { doQueryPlan(); MessageUtil.ShowTips(ccp.ReturnInfo); } else { MessageUtil.ShowTips(ccp.ReturnInfo); } } } /// /// 撤销取样完成 /// private void cancelGetSample() { this.ultraGrid5.UpdateData(); UltraGridRow uRow = this.ultraGrid5.ActiveRow; UltraGridRow row = this.ultraGrid8.ActiveRow; if (uRow == null || row == null) return; PlnZyRclMEntity milPlans = (PlnZyRclMEntity)uRow.ListObject; string milPlanEntity = JSONFormat.Format(milPlans); CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "com.steering.mes.port.vrp.FrmHttBatchSaplmeNew"; ccp.MethodName = "cancelGetSample"; ccp.ServerParams = new object[] { milPlanEntity,row.Cells["PHY_BATCH_NO"].Text }; ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal); if (ccp.ReturnCode != -1) { if (ccp.ReturnInfo.Equals("撤销成功!")) { doQueryPlan(); MessageUtil.ShowTips(ccp.ReturnInfo); } else { MessageUtil.ShowTips(ccp.ReturnInfo); } } } /// /// 取样完成 /// private void getSample() { this.ultraGrid1.UpdateData(); this.ultraGrid3.UpdateData(); UltraGridRow uRow = this.ultraGrid1.ActiveRow; List lists = portHttBatchSampleResultEntityBindingSource.DataSource as List; if (uRow == null || lists.Count <= 0) { return; } //if (lists.Any(p => p.PhyBatchNo == "")) //{ // MessageUtil.ShowTips("还有未进行分批的管材,不允许进行取样!"); // return; //} if (lists.Any(p => p.Chk == true && p.SamplePipeLenA == "" && p.SamplePipeLenB == "" && p.SamplePipeLenC == "" && p.SamplePipeLenD == "" && p.SamplePipeLenM == "" && p.SamplePipeLenE == "" && p.SamplePipeLenF == ""&&p.SamplePipeLenP == "" && p.SamplePipeLenQ == "")) { MessageUtil.ShowTips("还有已选做样管未输入样管长度的管材,不允许进行取样完成!"); return; } if (lists.Any(p => p.Chk == true && !StringUtil.IsInt32(p.SamplePipeLenA) && !StringUtil.IsInt32(p.SamplePipeLenB) && !StringUtil.IsInt32(p.SamplePipeLenC) && !StringUtil.IsInt32(p.SamplePipeLenD) && !StringUtil.IsInt32(p.SamplePipeLenM) && !StringUtil.IsInt32(p.SamplePipeLenE) && !StringUtil.IsInt32(p.SamplePipeLenF) && !StringUtil.IsInt32(p.SamplePipeLenP) && !StringUtil.IsInt32(p.SamplePipeLenQ))) { MessageUtil.ShowTips("样管长度单位为毫米,请输入整数!"); return; } PlnZyRclMEntity milPlans = (PlnZyRclMEntity)uRow.ListObject; string milPlanEntity = JSONFormat.Format(milPlans); List portMilEntity = lists.Where(p=>p.Chk).Select(JSONFormat.Format).ToList(); CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "com.steering.mes.port.vrp.FrmHttBatchSaplmeNew"; ccp.MethodName = "getSample"; ccp.ServerParams = new object[] { milPlanEntity, portMilEntity, UserInfo.GetUserName(), UserInfo.GetUserGroup(), UserInfo.GetUserOrder(),this.cmbSampleType.Value.ToString() }; ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal); if (ccp.ReturnCode != -1) { if (ccp.ReturnInfo.Equals("取样完成!")) { doQueryPlan(); MessageUtil.ShowTips(ccp.ReturnInfo); } else { MessageUtil.ShowTips(ccp.ReturnInfo); } } } /// /// 逐支取样 /// private void getSamplePipece() { this.ultraGrid1.UpdateData(); this.ultraGrid3.UpdateData(); UltraGridRow uRow = this.ultraGrid1.ActiveRow; List lists = portHttBatchSampleResultEntityBindingSource.DataSource as List; if (uRow == null || lists.Count <= 0) { return; } PlnZyRclMEntity milPlans = (PlnZyRclMEntity)uRow.ListObject; string milPlanEntity = JSONFormat.Format(milPlans); List portMilEntity = lists.Where(p => p.Chk).Select(JSONFormat.Format).ToList(); List batchList = lists.Select(p => p.PhyBatchNo).Distinct().ToList(); CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "com.steering.mes.port.vrp.FrmHttBatchSaplmeNew"; ccp.MethodName = "getSamplePipece"; ccp.ServerParams = new object[] { milPlanEntity, UserInfo.GetUserName(), UserInfo.GetUserGroup(), UserInfo.GetUserOrder(),this.cmbSampleType.Value.ToString() }; ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal); if (ccp.ReturnCode != -1) { if (ccp.ReturnInfo.Equals("逐支取样成功!")) { doQueryPlan(); MessageUtil.ShowTips(ccp.ReturnInfo); } else { MessageUtil.ShowTips(ccp.ReturnInfo); } } } /// /// 确认委托 /// private void confirm() { this.ultraGrid9.UpdateData(); this.ultraGrid10.UpdateData(); this.ultraGrid11.UpdateData(); this.ultraGrid18.UpdateData(); UltraGrid ug = null; DataTable dataTable = null; string craftSource = ""; if (ultraTabControl3.SelectedTab.Key == "0") { ug = ultraGrid11; dataTable = dataTable3; craftSource = "0"; } else if (ultraTabControl3.SelectedTab.Key == "1") { ug = ultraGrid18; dataTable = dataTable5; craftSource = "1"; } else if (ultraTabControl3.SelectedTab.Key == "2") { ug = ultraGrid23; dataTable = dataTable7; craftSource = "2"; } if (ultraGrid10.ActiveRow.Cells["Cic"].Text == "" && ultraGrid10.ActiveRow.Cells["IfProduct"].Text.Trim() == "1") { MessageUtil.ShowTips("缺少成分索引码,不能确认委托!"); return; } UltraGridRow uRow = ultraGrid9.ActiveRow; if (uRow == null) return; // List chemSource = EntityHelper.GetData( //"com.steering.mes.port.vrp.FrmHttBatchSaplmeNew.doQueryChem", new object[] { uRow.Cells["ProPlanId"].Text, uRow.Cells["GxPlanNo"].Text, uRow.Cells["JudgeStoveNo"].Text.Replace("-.*", "") }, this.ob);//查询成分详细信息 // List phySource = EntityHelper.GetData( //"com.steering.mes.port.vrp.FrmHttBatchSaplmeNew.doQueryPhy", new object[] { uRow.Cells["ProPlanId"].Text, uRow.Cells["GxPlanNo"].Text, uRow.Cells["JudgeStoveNo"].Text.Replace("-.*", "") }, this.ob);//查询理化详细信息 PlnZyRclMEntity milTity = (PlnZyRclMEntity)uRow.ListObject; milTity.CraftSource = craftSource; string milEntity = JSONFormat.Format(milTity); List> parmList = new List>(); foreach(UltraGridRow row in ug.Rows) { int m = 0; List list = new List(); list.Add(row.Cells["PHY_BATCH_NO"].Text); list.Add(row.Cells["MAT_NO"].Text); list.Add(row.Cells["SAMPLE_PIPE_LEN"].Text); list.Add(row.Cells["SAMPLE_POSTION"].Text); for (int j = 5; j < dataTable.Columns.Count; j++) { if (row.Cells[j].Value == "√") { list.Add(row.Cells[j].Column.Key); m = m + 1; } } if (m > 0) { parmList.Add(list); } } List> batchList = parmList.GroupBy(p => p[0]).Select(p => p.FirstOrDefault() ).ToList(); CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "com.steering.mes.port.vrp.FrmHttBatchSaplmeNew"; ccp.MethodName = "confirm"; ccp.ServerParams = new object[] { milEntity, parmList, batchList, UserInfo.GetUserName(), UserInfo.GetDepartment(),this.txtConMemo.Text.Trim() }; ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal); if (ccp.ReturnCode != -1) { if (ccp.ReturnInfo.Equals("委托成功!")) { doQueryPlan(); MessageUtil.ShowTips(ccp.ReturnInfo); } else { MessageUtil.ShowTips(ccp.ReturnInfo); } } } /// /// 并单委托 /// private void mergerConfrim() { this.ultraGrid9.UpdateData(); this.ultraGrid10.UpdateData(); this.ultraGrid11.UpdateData(); this.ultraGrid18.UpdateData(); UltraGrid ug = null; DataTable dataTable = null; string craftSource = ""; if (ultraTabControl3.SelectedTab.Key == "0") { ug = ultraGrid11; dataTable = dataTable3; craftSource = "0"; } else if (ultraTabControl3.SelectedTab.Key == "1") { ug = ultraGrid18; dataTable = dataTable5; craftSource = "1"; } UltraGridRow uRow = ultraGrid9.ActiveRow; if (uRow == null) return; PlnZyRclMEntity milTity = (PlnZyRclMEntity)uRow.ListObject; milTity.CraftSource = craftSource; string milEntity = JSONFormat.Format(milTity); List> parmList = new List>(); foreach (UltraGridRow row in ug.Rows) { int m = 0; List list = new List(); list.Add(row.Cells["PHY_BATCH_NO"].Text); list.Add(row.Cells["MAT_NO"].Text); list.Add(row.Cells["SAMPLE_PIPE_LEN"].Text); list.Add(row.Cells["SAMPLE_POSTION"].Text); for (int j = 5; j < dataTable.Columns.Count; j++) { if (row.Cells[j].Value == "√") { list.Add(row.Cells[j].Column.Key); m = m + 1; } } if (m > 0) { parmList.Add(list); } } List> batchList = parmList.GroupBy(p => p[0]).Select(p => p.FirstOrDefault() ).ToList(); CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "com.steering.mes.port.vrp.FrmHttBatchSaplmeNew"; ccp.MethodName = "mergerConfrim"; ccp.ServerParams = new object[] { milEntity, parmList, batchList, UserInfo.GetUserName(), UserInfo.GetDepartment() }; ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal); if (ccp.ReturnCode != -1) { if (ccp.ReturnInfo.Equals("委托成功!")) { doQueryPlan(); MessageUtil.ShowTips(ccp.ReturnInfo); } else { MessageUtil.ShowTips(ccp.ReturnInfo); } } } /// /// 取消确认 /// private void cancelConfirm() { this.ultraGrid14.UpdateData(); UltraGridRow uRow = this.ultraGrid12.ActiveRow; if (uRow == null) return; PlnZyRclMEntity milTity = (PlnZyRclMEntity)uRow.ListObject; string milPlanEntity = JSONFormat.Format(milTity); //ArrayList parmList = new ArrayList(); //IQueryable checkMag = this.ultraGrid14.Rows.AsQueryable().Where(" CHK = 'True'"); //if (checkMag.Count() == 0) //{ // return; //} //foreach (UltraGridRow row in checkMag) //{ // PortHttBatchSampleResultEntity portHttTity = new PortHttBatchSampleResultEntity(); // portHttTity.MatNo = row.Cells["MAT_NO"].Text; // portHttTity.PhyBatchNo = row.Cells["PHY_BATCH_NO"].Text; // portHttTity.CheckNo = row.Cells["CHECK_NO"].Text; // string portEntity = JSONFormat.Format(portHttTity); // parmList.Add(portEntity); //} CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "com.steering.mes.port.vrp.FrmHttBatchSaplmeNew"; ccp.MethodName = "cancelConfirm"; ccp.ServerParams = new object[] { milPlanEntity }; ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal); if (ccp.ReturnCode != -1) { if (ccp.ReturnInfo.Equals("撤销委托成功!")) { doQueryPlan(); MessageUtil.ShowTips(ccp.ReturnInfo); } else { MessageUtil.ShowTips(ccp.ReturnInfo); } } } /// /// 查询炉计划 /// private void doQueryPlan() { string startTime = ""; string endTim = ""; string lotNo = ""; string judgeNo = ""; List listSource = null; if (this.chkRegTime.Checked) { startTime = this.RegStartTime.Value.ToString(); endTim = this.RegEndTime.Value.ToString(); } if (chkLotNo.Checked && this.txtLotNo.Text.Trim() != "") { lotNo = this.txtLotNo.Text; } if (chkJudgeNo.Checked && this.txtJudgeNo.Text.Trim() != "") { judgeNo = this.txtJudgeNo.Text; } ArrayList parm = new ArrayList(); parm.Add(startTime); parm.Add(endTim); parm.Add(lotNo); parm.Add(judgeNo); if (this.ultraTabControl1.SelectedTab.Key == "0") { parm.Add("0"); listSource = EntityHelper.GetData( "com.steering.mes.port.vrp.FrmHttBatchSaplmeNew.doQueryPlan", new object[] { parm, plineCode }, this.ob); } else if (this.ultraTabControl1.SelectedTab.Key == "1") { parm.Add("2"); listSource = EntityHelper.GetData( "com.steering.mes.port.vrp.FrmHttBatchSaplmeNew.doQueryPlan", new object[] { parm, plineCode }, this.ob); } else if (this.ultraTabControl1.SelectedTab.Key == "2") { parm.Add("2"); listSource = EntityHelper.GetData( "com.steering.mes.port.vrp.FrmHttBatchSaplmeNew.doQueryPlan", new object[] { parm, plineCode }, this.ob); } else if (this.ultraTabControl1.SelectedTab.Key == "3") { parm.Add("3"); listSource = EntityHelper.GetData( "com.steering.mes.port.vrp.FrmHttBatchSaplmeNew.doQueryPipeBaseInfo", new object[] { parm, plineCode }, this.ob); } if (this.ultraTabControl1.SelectedTab.Key == "0") { plnZyRclMEntityBindingSource1.Clear(); portHttBatchSampleResultEntityBindingSource.Clear(); dataTable1.Clear(); plnZyRclMEntityBindingSource.DataSource = listSource; } else if (this.ultraTabControl1.SelectedTab.Key == "1") { plnZyRclMEntityBindingSource3.Clear(); portHttBatchSampleResultEntityBindingSource1.Clear(); dataTable2.Clear(); plnZyRclMEntityBindingSource2.DataSource = listSource; } else if (this.ultraTabControl1.SelectedTab.Key == "2") { plnZyRclMEntityBindingSource5.Clear(); dataTable3.Clear(); plnZyRclMEntityBindingSource4.DataSource = listSource; } else if (this.ultraTabControl1.SelectedTab.Key == "3") { plnZyRclMEntityBindingSource7.Clear(); dataTable4.Clear(); plnZyRclMEntityBindingSource6.DataSource = listSource; } } private void chkRegTime_CheckedChanged(object sender, EventArgs e) { this.RegStartTime.Enabled = this.RegEndTime.Enabled = this.chkRegTime.Checked; } private void chkLotNo_CheckedChanged(object sender, EventArgs e) { this.txtLotNo.Enabled = this.chkLotNo.Checked; } private void chkJudgeNo_CheckedChanged(object sender, EventArgs e) { this.txtJudgeNo.Enabled = this.chkJudgeNo.Checked; } private void ultraGrid1_AfterRowActivate(object sender, EventArgs e) { this.ultraGrid1.UpdateData(); UltraGridRow uRow = this.ultraGrid1.ActiveRow; batchNoZ = doQueryBacthPline(uRow); doQueryBasePlan(uRow); doQueryRack(uRow); dtPlanDetial = doQueryCheckPlanDetila(uRow); if (dtPlanDetial != null && dtPlanDetial.Count() > 0) { var s = dtPlanDetial.Where(p => p.Rate == "408601" || p.Rate == "408608").ToList(); if (s.Any()) { dtPlanM = doQueryCheckPlan(uRow, "1"); } else { dtPlanM = doQueryCheckPlan(uRow, "0"); } } ultraGrid3.Update(); ultraGrid3.DataBind(); ultraGrid3_CellChange(null, null); if (dtPlanM == null || dtPlanDetial == null || dtPlanM.Count == 0 || dtPlanDetial.Count == 0) { txt_BatchMax.Text = ""; txtBATCH_MIN.Text = this.txtPIPE_NUM.Text;//参考批数; return; } //bool isFlag = dtPlanDetial.Any(p => p.Rate == "408607" || p.Rate == "408608" || p.Rate == "408601"); //if (isFlag) //{ //} //else //{ // if (int.Parse(uRow.Cells["IsBatch"].Text) >= 1) // { // //txt_BatchMax.Text = this.ultraGrid4.Rows[0].Cells["NUM"].Text; // if (this.txt_BatchMax.Text == "") // { // txtBATCH_MIN.Text = this.txtPIPE_NUM.Text;//参考批数; // } // else // { // txtBATCH_MIN.Text = (Math.Ceiling(double.Parse(this.txtPIPE_NUM.Text) / int.Parse(this.txt_BatchMax.Text.ToString3()))).ToString(); // } // } // else // { minBatchNum = dtPlanDetial.Min(p => p.BatchCnt == null ? int.Parse(this.txtPIPE_NUM.Text) : (int)(p.BatchCnt));//检验计划最小分批数量 txt_BatchMax.Text = minBatchNum.ToString();//分批上限 txtREMARK.Text = dtPlanM.Select(p => p.Remark).Distinct().Aggregate((a, b) => a + " " + b); if (minBatchNum == 0) { txtBATCH_MIN.Text = "0"; } else { txtBATCH_MIN.Text = (Math.Ceiling(double.Parse(this.txtPIPE_NUM.Text) / minBatchNum)).ToString();//参考批数 } ultraGrid3.Update(); ultraGrid3.DataBind(); ultraGrid3_CellChange(null, null); //} //} } private string doQueryBacthPline(UltraGridRow uRow) { string ss = ""; DataTable ds = PublicServer.GetData("com.steering.mes.port.mil.FrmMilBatchSampleNew.doQueryBacthNo",new object[]{uRow.Cells["PlineCode"].Text},ob); if(ds.Rows.Count >0) { ss = ds.Rows[0][0].ToString(); } return ss; } private void initBindTable(UltraGridRow row) { List lists = portHttBatchSampleResultEntityBindingSource1.DataSource as List; DataTable ds = PublicServer.GetData("com.steering.mes.port.vrp.FrmHttBatchSaplmeNew.doQueryHeadNum", new object[] { row.Cells["HeatPlanNo"].Text, row.Cells["JudgeStoveNo"].Text }, ob); dataTable2.Rows.Clear(); if (lists == null || lists.Count() <= 0) return; foreach (var list in lists.Where(p => p.PhyBatchNo != "").GroupBy(p => p.PhyBatchNo)) { DataRow newRow; newRow = dataTable2.NewRow(); newRow["PHY_BATCH_NO"] = list.Key; newRow["START_SEQ"] = list.Min(p => int.Parse(p.Seq)); newRow["END_SEQ"] = list.Max(p => int.Parse(p.Seq)); newRow["NUM"] = list.Count(); newRow["SAMPLE_NUM"] = list.Count(p => p.SamplePipeLenA != "" || p.SamplePipeLenB != "" || p.SamplePipeLenC != "" || p.SamplePipeLenD != "" || p.SamplePipeLenM != "" || p.SamplePipeLenE != "" || p.SamplePipeLenF != "" || p.SamplePipeLenP != "" || p.SamplePipeLenQ != ""); if (ds.Rows.Count > 0) { for (int i = 0; i < ds.Rows.Count; i++) { if (ds.Rows[i]["BATCH_NO"].ToString() == list.Key) { newRow["HEAD_NUM"] = ds.Rows[i]["ACOUNT"].ToString(); } } } //newRow["HEAD_NUM"] = list.Sum(p => (p.SamplePipeLenA == "" ? 0 : 1) + (p.SamplePipeLenB == "" ? 0 : 1) + (p.SamplePipeLenC == "" ? 0 : 1) + (p.SamplePipeLenD == "" ? 0 : 1) + (p.SamplePipeLenM == "" ? 0 : 1) + (p.SamplePipeLenE == "" ? 0 : 1) + (p.SamplePipeLenF == "" ? 0 : 1) + (p.SamplePipeLenP == "" ? 0 : 1) + (p.SamplePipeLenQ == "" ? 0 : 1)); dataTable2.Rows.Add(newRow); } ultraGrid8.Update(); } /// /// 自动分批 /// /// /// private void btnAuto_Click(object sender, EventArgs e) { this.ultraGrid4.UpdateData(); List lists = portHttBatchSampleResultEntityBindingSource.DataSource as List; if (lists==null || lists.Count<=0) { MessageUtil.ShowTips("不存在有效管号队列,不允许进行分批!"); return; } if (dtPlanM.Count <= 0) { MessageUtil.ShowTips("检验计划未确认,不能自动分批!"); return; } int maxBacthNum = int.Parse(this.txt_BatchMax.Text);//分批上限 int maxBacth = dtPlanM.Max(p => p.BatchNo == null ? 1 : (int)(p.BatchNo));//取主表最大方案 string sampleLen = "";//样管长度 string sampleCount = "";//样管数量 //为批号赋值 for (int i = 0; i < int.Parse(this.txtBATCH_MIN.Text);i++) { var list = dtPlanM1.Where(p => p.BatchNo == (i+1 > maxBacth ? maxBacth : i+1)).ToList(); var listA = list.Where(p => p.Position == "401201").ToList(); var listB = list.Where(p => p.Position == "401202").ToList(); var listC = list.Where(p => p.Position == "401217").ToList(); var listD = list.Where(p => p.Position == "401218").ToList(); var listM = list.Where(p => p.Position == "401219").ToList(); var listE = list.Where(p => p.Position == "401220").ToList(); var listF = list.Where(p => p.Position == "401221").ToList(); var listP = list.Where(p => p.Position == "401222").ToList(); var listQ = list.Where(p => p.Position == "401223").ToList(); int m = 0; for (int k = 0; k < listA.Count; k++) { var crft = listA[k]; int a = (int)crft.SampleCount;//样管数量 for (int j = 0; j < a; j++,m++) { if (lists.Count > m + i * maxBacthNum) { lists[m + i * maxBacthNum].SamplePipeLenA = crft.SampleLength.ToString(); lists[m + i * maxBacthNum].PhyCodeGroup = crft.PhyCodeGroup.ToString(); lists[m + i * maxBacthNum].Chk = true; } } } m = 0; for (int k = 0; k < listB.Count; k++) { var crft = listB[k]; int a = (int)crft.SampleCount;//样管数量 for (int j = 0; j < a; j++, m++) { if (lists.Count > m + i * maxBacthNum) { lists[m + i * maxBacthNum].SamplePipeLenB = crft.SampleLength.ToString(); lists[m + i * maxBacthNum].PhyCodeGroupb = crft.PhyCodeGroup.ToString(); lists[m + i * maxBacthNum].Chk = true; } } } m = 0; for (int k = 0; k < listC.Count; k++) { var crft = listC[k]; int a = (int)crft.SampleCount;//样管数量 for (int j = 0; j < a; j++, m++) { if (lists.Count > m + i * maxBacthNum) { lists[m + i * maxBacthNum].SamplePipeLenC = crft.SampleLength.ToString(); lists[m + i * maxBacthNum].PhyCodeGroupc = crft.PhyCodeGroup.ToString(); lists[m + i * maxBacthNum].Chk = true; } } } m = 0; for (int k = 0; k < listD.Count; k++) { var crft = listD[k]; int a = (int)crft.SampleCount;//样管数量 for (int j = 0; j < a; j++, m++) { if (lists.Count > m + i * maxBacthNum) { lists[m + i * maxBacthNum].SamplePipeLenD = crft.SampleLength.ToString(); lists[m + i * maxBacthNum].PhyCodeGroupd = crft.PhyCodeGroup.ToString(); lists[m + i * maxBacthNum].Chk = true; } } } m = 0; for (int k = 0; k < listM.Count; k++) { var crft = listM[k]; int a = (int)crft.SampleCount;//样管数量 for (int j = 0; j < a; j++, m++) { if (lists.Count > m + i * maxBacthNum) { lists[m + i * maxBacthNum].SamplePipeLenD = crft.SampleLength.ToString(); lists[m + i * maxBacthNum].PhyCodeGroupd = crft.PhyCodeGroup.ToString(); lists[m + i * maxBacthNum].Chk = true; } } } m = 0; for (int k = 0; k < listE.Count; k++) { var crft = listE[k]; int a = (int)crft.SampleCount;//样管数量 for (int j = 0; j < a; j++, m++) { if (lists.Count > m + i * maxBacthNum) { lists[m + i * maxBacthNum].SamplePipeLenE = crft.SampleLength.ToString(); lists[m + i * maxBacthNum].PhyCodeGroupe = crft.PhyCodeGroup.ToString(); lists[m + i * maxBacthNum].Chk = true; } } } m = 0; for (int k = 0; k < listF.Count; k++) { var crft = listF[k]; int a = (int)crft.SampleCount;//样管数量 for (int j = 0; j < a; j++, m++) { if (lists.Count > m + i * maxBacthNum) { lists[m + i * maxBacthNum].SamplePipeLenF = crft.SampleLength.ToString(); lists[m + i * maxBacthNum].PhyCodeGroupf = crft.PhyCodeGroup.ToString(); lists[m + i * maxBacthNum].Chk = true; } } } m = 0; for (int k = 0; k < listP.Count; k++) { var crft = listP[k]; int a = (int)crft.SampleCount;//样管数量 for (int j = 0; j < a; j++, m++) { if (lists.Count > m + i * maxBacthNum) { lists[m + i * maxBacthNum].SamplePipeLenP = crft.SampleLength.ToString(); lists[m + i * maxBacthNum].PhyCodeGroupp = crft.PhyCodeGroup.ToString(); lists[m + i * maxBacthNum].Chk = true; } } } m = 0; for (int k = 0; k < listQ.Count; k++) { var crft = listQ[k]; int a = (int)crft.SampleCount;//样管数量 for (int j = 0; j < a; j++, m++) { if (lists.Count > m + i * maxBacthNum) { lists[m + i * maxBacthNum].SamplePipeLenQ = crft.SampleLength.ToString(); lists[m + i * maxBacthNum].PhyCodeGroupq = crft.PhyCodeGroup.ToString(); lists[m + i * maxBacthNum].Chk = true; } } } lists.Skip(i * maxBacthNum).Take((i + 1) * maxBacthNum).ToList().ForEach(p => p.PhyBatchNo = batchNoZ + (i + 1).ToString("000")); } ultraGrid3.Update(); ultraGrid3.DataBind(); ultraGrid3_CellChange(null, null); } /// /// 人工分批 /// /// /// private void btnConfirm_Click(object sender, EventArgs e) { this.ultraGrid4.UpdateData(); int sampleNum = 0; if (!StringUtil.IsInt32(this.txt_SampleNum.Text.Trim().ToString3())) { MessageUtil.ShowTips("样管数量需输入正整数!"); return; } else { sampleNum = int.Parse(this.txt_SampleNum.Text.Trim().ToString3()); } if (!StringUtil.IsInt32(txt_BatchMax.Text.ToString3()) || int.Parse(txt_BatchMax.Text.ToString3()) <= 0) { MessageUtil.ShowTips("人工分批输入的分批上限需为正整数!"); return; } List lists = portHttBatchSampleResultEntityBindingSource.DataSource as List; var m = lists.Where(p => p.PhyBatchNo == "").ToList();//判断是否还未分配性能批号集合数据 if (m.Count == 0) { return; } int Bathno = 1; for (int k = 0; k < int.Parse(this.txtBATCH_MIN.Text.ToString3()); k++) { int startSeq = int.Parse(ultraSTART_PIPE_NO.Text);//开始序号 int endSeq = int.Parse(ultraEND_PIPE_NO.Text);//结束序号 var lists1 = lists.Where(p => p.PhyBatchNo != "").ToList(); if (lists1.Any()) { Bathno = lists1.Max(p => int.Parse(p.PhyBatchNo.Substring(2, 3))) + 1; } m.Take(endSeq - startSeq + 1).ToList().ForEach(p => p.PhyBatchNo = batchNoZ + Bathno.ToString("000"));//赋值批号 m.Take(sampleNum).ToList().ForEach(p => p.Chk = true); ultraSTART_PIPE_NO.Text = m.First().Seq.ToString();//初始序号 跳过已赋值批号数据 ultraEND_PIPE_NO.Text = m.Take(int.Parse(txt_BatchMax.Text)).Last().Seq.ToString();//结束序号 ultraGrid3.Update(); ultraGrid3.DataBind(); ultraGrid3_CellChange(null, null); m = lists.Where(p => p.PhyBatchNo == "").ToList();//判断是否还未分配性能批号集合数据 if (m.Count == 0) { return; } } } /// /// 查询检验计划子表 /// /// /// private List doQueryCheckPlanDetila(UltraGridRow uRow) { List listSource = EntityHelper.GetData( "com.steering.mes.port.vrp.FrmHttBatchSaplmeNew.doQueryCheckPlanDetial", new object[] { uRow.Cells["OrdLnPk"].Text, uRow.Cells["CraftFileNo"].Text, uRow.Cells["CraftSeq"].Text }, this.ob);//查询检验计划主表 return listSource; } /// /// 查询检验计划主表 /// /// private List doQueryCheckPlan(UltraGridRow uRow,String flag) { List listSource = EntityHelper.GetData( "com.steering.mes.port.vrp.FrmHttBatchSaplmeNew.doQueryCheckPlan", new object[] { uRow.Cells["OrdLnPk"].Text, uRow.Cells["CraftFileNo"].Text, uRow.Cells["CraftSeq"].Text, flag }, this.ob);//查询检验计划主表 return listSource; } /// /// 查询炉计划基础信息 /// /// private void doQueryBasePlan(UltraGridRow row) { List listSource = EntityHelper.GetData( "com.steering.mes.port.vrp.FrmHttBatchSaplmeNew.doQueryBasePlan", new object[] { row.Cells["ZyBatchId"].Text, row.Cells["JudgeStoveNo"].Text, row.Cells["HeatPlanNo"].Text }, this.ob); if (this.ultraTabControl1.SelectedTab.Key == "0") { plnZyRclMEntityBindingSource1.DataSource = listSource; } else if (this.ultraTabControl1.SelectedTab.Key == "1") { plnZyRclMEntityBindingSource3.DataSource = listSource; } else if (this.ultraTabControl1.SelectedTab.Key == "2") { plnZyRclMEntityBindingSource5.DataSource = listSource; }else if(this.ultraTabControl1.SelectedTab.Key == "3") { plnZyRclMEntityBindingSource7.DataSource = listSource; } } /// /// 查询管号队列 /// /// private void doQueryRack(UltraGridRow row) { List lists1 = null; List listSource = null; if (this.ultraTabControl1.SelectedTab.Key == "0") { listSource = EntityHelper.GetData( "com.steering.mes.port.vrp.FrmHttBatchSaplmeNew.doQueryRackQ", new object[] { row.Cells["HeatPlanNo"].Text, row.Cells["JudgeStoveNo"].Text, row.Cells["IfMatchOdd"].Text, row.Cells["HeatPlanNoOld"].Text }, this.ob); portHttBatchSampleResultEntityBindingSource.DataSource = listSource; txtPIPE_NUM.Text = listSource.Count.ToString(); lists1 = portHttBatchSampleResultEntityBindingSource.DataSource as List; GridHelper.RefreshAndAutoSize(ultraGrid3); } else if (this.ultraTabControl1.SelectedTab.Key == "1") { listSource = EntityHelper.GetData( "com.steering.mes.port.vrp.FrmHttBatchSaplmeNew.doQueryRack", new object[] { row.Cells["HeatPlanNo"].Text, row.Cells["JudgeStoveNo"].Text, row.Cells["IfMatchOdd"].Text, row.Cells["HeatPlanNoOld"].Text }, this.ob); List lists = listSource as List; lists.Where(p => p.IsSamplePipe == "1").ToList().ForEach(p => p.Chk = true); portHttBatchSampleResultEntityBindingSource1.DataSource = lists; initBindTable(row); lists1 = portHttBatchSampleResultEntityBindingSource1.DataSource as List; } var k = lists1.Where(p => p.PhyBatchNo == "").ToList(); if (k.Count() == 0) { ultraSTART_PIPE_NO.Text = this.txtPIPE_NUM.Text; } else { ultraSTART_PIPE_NO.Text = k.First().Seq.ToString();//初始序号 跳过已赋值批号数据 } if (lists1.Count() > 0) { ultraEND_PIPE_NO.DataSource = lists1; ultraEND_PIPE_NO.DisplayMember = "Seq"; ultraEND_PIPE_NO.ValueMember = "Seq"; ultraEND_PIPE_NO.SelectedIndex = lists1.Count - 1; ultraSTART_PIPE_NO.DataSource = lists1; ultraSTART_PIPE_NO.DisplayMember = "Seq"; ultraSTART_PIPE_NO.ValueMember = "Seq"; } } private void txt_BatchMax_ValueChanged(object sender, EventArgs e) { UltraGridRow uRow = this.ultraGrid1.ActiveRow; if (uRow == null) return; if (!StringUtil.IsInt32(this.txt_BatchMax.Text.Trim())) { return; } doQueryRack(uRow); dataTable1.Clear(); if (int.Parse(this.txt_BatchMax.Text) == 0) { txtBATCH_MIN.Text = "0"; }else { txtBATCH_MIN.Text = (Math.Ceiling(double.Parse(this.txtPIPE_NUM.Text) / int.Parse(this.txt_BatchMax.Text))).ToString(); } if (dtPlanDetial.Count > 0) { //bool isBacthFlag = dtPlanDetial.Any(p => p.Rate == "408601" || p.Rate == "408608");//判断是否试样组有生产批 //if (isBacthFlag) //{ //} //else //{ int maxBacth = dtPlanM.Max(p => p.BatchNum == null ? 1 : (int)(p.BatchNum));//取主表最大方案 int batchNum = int.Parse(txtBATCH_MIN.Text);//实际批数 dtPlanM1 = dtPlanM.Where(p => p.BatchNum == (batchNum > maxBacth ? maxBacth : batchNum)).ToList();//取具体方案 //} List lists = portHttBatchSampleResultEntityBindingSource.DataSource as List; if (lists == null || lists.Count() == 0) { return; } var lists1 = lists.Where(p => p.PhyBatchNo == "").ToList(); if (lists1.Any()) { ultraSTART_PIPE_NO.Text = lists1.First().Seq.ToString(); ultraEND_PIPE_NO.Text = lists1.Take(int.Parse(txt_BatchMax.Text)).Last().Seq.ToString(); } else { ultraSTART_PIPE_NO.Text = (lists.Count()).ToString(); ultraEND_PIPE_NO.Text = (lists.Count()).ToString(); } /* ultraSTART_PIPE_NO.Text = lists.Where(p => p.BatchNo == "").First().Seq.ToString(); ultraEND_PIPE_NO.Text = lists.Where(p => p.BatchNo == "").Take(int.Parse(txt_BatchMax.Text)).Last().Seq.ToString();*/ } else { ultraSTART_PIPE_NO.Text = "1"; ultraEND_PIPE_NO.Text = this.txt_BatchMax.Text; } } private void ultraGrid3_CellChange(object sender, CellEventArgs e) { this.ultraGrid3.UpdateData(); dataTable1.Rows.Clear(); ultraGrid3.Update(); ultraGrid3.UpdateData(); List lists = portHttBatchSampleResultEntityBindingSource.DataSource as List; if (lists == null || lists.Count() <= 0) return; foreach (var list in lists.Where(p => p.PhyBatchNo != "").GroupBy(p => p.PhyBatchNo)) { DataRow newRow; newRow = dataTable1.NewRow(); newRow["PHY_BATCH_NO"] = list.Key; newRow["START_SEQ"] = list.Min(p => int.Parse(p.Seq)); newRow["END_SEQ"] = list.Max(p => int.Parse(p.Seq)); newRow["NUM"] = list.Count(); newRow["SAMPLE_NUM"] = list.Count(p => p.SamplePipeLenA != "" || p.SamplePipeLenB != "" || p.SamplePipeLenC != "" || p.SamplePipeLenD != "" || p.SamplePipeLenM != "" || p.SamplePipeLenE != "" || p.SamplePipeLenF != "" || p.SamplePipeLenP != "" || p.SamplePipeLenQ != ""); newRow["HEAD_NUM"] = list.Sum(p => (p.SamplePipeLenA == "" ? 0 : 1) + (p.SamplePipeLenB == "" ? 0 : 1) + (p.SamplePipeLenC == "" ? 0 : 1) + (p.SamplePipeLenD == "" ? 0 : 1) + (p.SamplePipeLenM == "" ? 0 : 1) + (p.SamplePipeLenE == "" ? 0 : 1) + (p.SamplePipeLenF == "" ? 0 : 1) + (p.SamplePipeLenP == "" ? 0 : 1) + (p.SamplePipeLenQ == "" ? 0 : 1)); dataTable1.Rows.Add(newRow); } ultraGrid4.Update(); if (e != null && (e.Cell.Column.Key == "SamplePipeLenA" || e.Cell.Column.Key == "SamplePipeLenB" || e.Cell.Column.Key == "SamplePipeLenC" || e.Cell.Column.Key == "SamplePipeLenD" || e.Cell.Column.Key == "SamplePipeLenM")) { if (e.Cell.Row.Cells["Chk"].Value.ToString() == "False") { MessageUtil.ShowTips("输入长度前,请勾选样管!"); return; } } if (e != null && e.Cell.Column.Key == "Chk") { if (e.Cell.Value.ToString() == "True") { e.Cell.Row.RowSelectorAppearance.BackColor = Color.Red; txtMatNo.Text = e.Cell.Row.Cells["MatNo"].Text; } else { e.Cell.Row.RowSelectorAppearance.BackColor = Color.Empty; } } } private void ultraGrid5_AfterRowActivate(object sender, EventArgs e) { this.ultraGrid5.UpdateData(); UltraGridRow uRow = this.ultraGrid5.ActiveRow; if (uRow == null) return; doQueryRack(uRow); doQueryBasePlan(uRow); } DataTable dtChem = new DataTable(); DataTable dtPhy = new DataTable(); private void ultraGrid9_AfterRowActivate(object sender, EventArgs e) { this.ultraGrid9.UpdateData(); UltraGridRow uRow = this.ultraGrid9.ActiveRow; if (uRow == null) return; doQuerySampleRack(uRow,"0");//查询正常样管信息 doQuerySampleRack(uRow,"1");//查询首日检样管信息 doQuerySampleRack(uRow, "2");//查询生产加样样管信息 doQueryBasePlan(uRow); doQueryPhyChem(uRow,"0");//查询正常样成分、理化项目明细 doQueryPhyChem(uRow,"1");//查询首日检成分、理化项目明细 doQueryPhyChem(uRow, "2");//查询生产加样成分、理化项目明细 initBaseInfo(uRow);//加载已委托检验单 } private void initBaseInfo(UltraGridRow row) { DataTable ds = PublicServer.GetData("com.steering.mes.port.vrp.FrmHttBatchSaplmeNew.initBaseInfo", new object[] { row.Cells["JudgeStoveNo"].Text, "F" }, ob); if (ds != null && ds.Rows.Count > 0) { //cmbCheckNo.DataSource = ds; //cmbCheckNo.ValueMember = "CHECK_NO_VALUE"; } } private void ultraGrid12_AfterRowActivate(object sender, EventArgs e) { this.ultraGrid12.UpdateData(); UltraGridRow uRow = this.ultraGrid12.ActiveRow; if (uRow == null) return; doQueryBasePlan(uRow); doQuerySampleNo(uRow);//查询试样号信息 } /// /// 查询试样号信息 /// /// private void doQuerySampleNo(UltraGridRow uRow) { while (dataTable4.Columns.Count > 5) { dataTable4.Columns.RemoveAt(5); } DataTable dtSample = PublicServer.GetData("com.steering.mes.port.vrp.FrmHttBatchSaplmeNew.doQueryDetialSampleNo", new Object[] { uRow.Cells["CheckNo"].Text }, ob); dataTable4.Rows.Clear(); dtSample.AsEnumerable().GroupBy(p => new { BatchNo = p["BATCH_NO"].ToString(), Sample = p["HEAD_MAT_NO"].ToString(),MatNo = p["MAT_NO"].ToString(),CheckNo = p["CHECK_NO"].ToString() }).ToList() .ForEach(p => { foreach (DataRow row in p) { if (!dataTable4.Columns.Contains(row["PHY_CODE_MAX"].ToString())) { DataColumn phyCloum = new DataColumn(); phyCloum.ColumnName = row["PHY_CODE_MAX"].ToString(); phyCloum.Caption = row["PHY_NAME_MAX"].ToString(); dataTable4.Columns.Add(phyCloum); } } DataRow dr = dataTable4.NewRow(); dr["PHY_BATCH_NO"] = p.Key.BatchNo; dr["HEAD_MAT_NO"] = p.Key.Sample; dr["SAMPLE_LEN"] = p.Max(q => q["SAMPLE_LEN"]); dr["MAT_NO"] = p.Key.MatNo; dr["CHECK_NO"] = p.Key.CheckNo; foreach (DataRow row in p) { dr[row["PHY_CODE_MAX"].ToString()] = row["SAMPLE_COUNT"].ToString(); } dataTable4.Rows.Add(dr); }); ultraGrid14.DataBind(); GridHelper.RefreshAndAutoSize(ultraGrid14); } /// /// 查询成分理化项目明细 /// /// private void doQueryPhyChem(UltraGridRow uRow,string sampleType) { DataTable dataTable = null; UltraGrid ug = null; string craftSource = ""; if (sampleType == "0") { dataTable = dataTable3; ug = ultraGrid11; craftSource = "0"; } else if (sampleType == "1") { dataTable = dataTable5; ug = ultraGrid18; craftSource = "2"; ultraLabel17.Text = ""; } else if (sampleType == "2") { dataTable = dataTable7; ug = ultraGrid23; craftSource = "0"; } while (dataTable.Columns.Count > 5) { dataTable.Columns.RemoveAt(5); } dtChem = PublicServer.GetData("com.steering.mes.port.vrp.FrmHttBatchSaplmeNew.doQueryChem", new Object[] { uRow.Cells["ProPlanId"].Text, uRow.Cells["GxPlanNo"].Text, BaseMethod.getJudgeStoveNo(uRow.Cells["JudgeStoveNo"].Text), craftSource, uRow.Cells["HeatPlanNo"].Text }, ob);//查询成分明细 if (dtChem.Rows.Count > 0) { DataColumn hxCloum = new DataColumn(); hxCloum.ColumnName = "HX"; hxCloum.Caption = "化学"; dataTable.Columns.Add(hxCloum); } dtPhy = PublicServer.GetData("com.steering.mes.port.vrp.FrmHttBatchSaplmeNew.doQueryPhy", new Object[] { uRow.Cells["ProPlanId"].Text, uRow.Cells["GxPlanNo"].Text,BaseMethod.getJudgeStoveNo(uRow.Cells["JudgeStoveNo"].Text) , craftSource,uRow.Cells["Pic"].Text }, ob);//查询理化明细 string[] phyMaxCode = null; ultraLabel4.Text = ""; List list = new List(); if (dtPhy.Rows.Count > 0) { dtPhy.AsEnumerable().Select(p => new { Code = p["PHY_CODE_MIN"].ToString(), Name = p["PHY_NAME_MIN"].ToString(), rate = p["RATE"].ToString(), rateName = p["DESC_RATE"].ToString(), common = p["COMMON"].ToString() }).Distinct().ToList() .ForEach(p => { DataColumn phyCloum = new DataColumn(); phyCloum.ColumnName = p.Code; phyCloum.Caption = p.Name; try { dataTable.Columns.Add(phyCloum); } catch { }; if (p.rate.Equals("408601") || p.rate.Equals("408608")) { ultraLabel4.Text = ultraLabel4.Text + p.Name + " 取样频次:" + p.rateName; list.Add(p.Code); } if (sampleType == "1") { if (p.common.Equals("1")) { ultraLabel17.Text = ultraLabel17.Text + p.Name + " (共样) "; } } }); } foreach (DataRow dr in dataTable.Rows) { string[] phyCodeGroup = dr["PHY_CODE_GROUP"].ToString().Split(','); for (int i = 5; i < dataTable.Columns.Count; i++) { if (phyCodeGroup.Contains(dataTable.Columns[i].ColumnName)) { dr[i] = "√"; } } } phyMaxCode = list.ToArray(); ug.DataBind(); GridHelper.RefreshAndAutoSize(ug); ultraLabel4.ForeColor = Color.Red; ultraLabel17.ForeColor = Color.Red; //if (phyMaxCode.Length > 0) //{ // doQueryPhyCodeMax(phyMaxCode, uRow.Cells["LotNo"].Text); //} } private void doQueryPhyCodeMax(string[] phyMaxCode, string lotNo) { List listSource = EntityHelper.GetData( "com.steering.mes.port.mil.FrmMilBatchSampleNew.doQueryPhyCodeMax", new object[] { lotNo, phyMaxCode }, this.ob); pipeCheckconsignDetailEntityBindingSource.DataSource = listSource; } /// /// 查询正常样管信息 /// private void doQuerySampleRack(UltraGridRow uRow, string sampleType) { DataTable dtBatchNo = null; if (sampleType == "0") { dtBatchNo = PublicServer.GetData("com.steering.mes.port.vrp.FrmHttBatchSaplmeNew.doQuerySampleInfo", new Object[] { uRow.Cells["ZyBatchId"].Text, uRow.Cells["JudgeStoveNo"].Text, sampleType }, ob); }else if(sampleType == "1") { dtBatchNo = PublicServer.GetData("com.steering.mes.port.vrp.FrmHttBatchSaplmeNew.doQuerySampleInfo", new Object[] { uRow.Cells["ZyBatchId"].Text, uRow.Cells["JudgeStoveNo"].Text, "1" }, ob); } else if (sampleType == "2") { dtBatchNo = PublicServer.GetData("com.steering.mes.port.vrp.FrmHttBatchSaplmeNew.doQuerySampleInfo", new Object[] { uRow.Cells["ZyBatchId"].Text, uRow.Cells["JudgeStoveNo"].Text, "2" }, ob); } if (sampleType == "0") { GridHelper.CopyDataToDatatable(dtBatchNo, dataTable3, true); } else if (sampleType == "1") { GridHelper.CopyDataToDatatable(dtBatchNo, dataTable5, true); } else if (sampleType == "2") { GridHelper.CopyDataToDatatable(dtBatchNo, dataTable7, true); } //DataTable dataTable = null; //UltraGrid ug = null; //if (sampleType == "0") //{ // dataTable = dataTable3; // ug = ultraGrid11; //} //else if (sampleType == "1") //{ // dataTable = dataTable5; // ug = ultraGrid18; //} //dataTable.Rows.Clear(); //foreach (DataRow row in dtBatchNo.Rows) //{ // if (row["SAMPLE_PIPE_LEN_A"] != null && row["SAMPLE_PIPE_LEN_A"].ToString() != "") // { // DataRow newRowA = dataTable.NewRow(); // newRowA["PHY_BATCH_NO"] = row["PHY_BATCH_NO"].ToString(); // newRowA["MAT_NO"] = row["MAT_NO"].ToString(); // newRowA["SAMPLE_PIPE_LEN"] = row["SAMPLE_PIPE_LEN_A"].ToString(); // newRowA["SAMPLE_POSTION"] = "A端"; // newRowA["PHY_CODE_GROUP"] = row["PHY_CODE_GROUP"].ToString(); // dataTable.Rows.Add(newRowA); // } // if (row["SAMPLE_PIPE_LEN_B"] != null && row["SAMPLE_PIPE_LEN_B"].ToString() != "") // { // DataRow newRowA = dataTable.NewRow(); // newRowA["PHY_BATCH_NO"] = row["PHY_BATCH_NO"].ToString(); // newRowA["MAT_NO"] = row["MAT_NO"].ToString(); // newRowA["SAMPLE_PIPE_LEN"] = row["SAMPLE_PIPE_LEN_B"].ToString(); // newRowA["SAMPLE_POSTION"] = "B端"; // newRowA["PHY_CODE_GROUP"] = row["PHY_CODE_GROUPB"].ToString(); // dataTable.Rows.Add(newRowA); // } // if (row["SAMPLE_PIPE_LEN_C"] != null && row["SAMPLE_PIPE_LEN_C"].ToString() != "") // { // DataRow newRowA = dataTable.NewRow(); // newRowA["PHY_BATCH_NO"] = row["PHY_BATCH_NO"].ToString(); // newRowA["MAT_NO"] = row["MAT_NO"].ToString(); // newRowA["SAMPLE_PIPE_LEN"] = row["SAMPLE_PIPE_LEN_C"].ToString(); // newRowA["SAMPLE_POSTION"] = "C端"; // newRowA["PHY_CODE_GROUP"] = row["PHY_CODE_GROUPC"].ToString(); // dataTable.Rows.Add(newRowA); // } // if (row["SAMPLE_PIPE_LEN_D"] != null && row["SAMPLE_PIPE_LEN_D"].ToString() != "") // { // DataRow newRowA = dataTable.NewRow(); // newRowA["PHY_BATCH_NO"] = row["PHY_BATCH_NO"].ToString(); // newRowA["MAT_NO"] = row["MAT_NO"].ToString(); // newRowA["SAMPLE_PIPE_LEN"] = row["SAMPLE_PIPE_LEN_D"].ToString(); // newRowA["SAMPLE_POSTION"] = "D端"; // newRowA["PHY_CODE_GROUP"] = row["PHY_CODE_GROUPD"].ToString(); // dataTable.Rows.Add(newRowA); // } // if (row["SAMPLE_PIPE_LEN_M"] != null && row["SAMPLE_PIPE_LEN_M"].ToString() != "") // { // DataRow newRowA = dataTable.NewRow(); // newRowA["PHY_BATCH_NO"] = row["PHY_BATCH_NO"].ToString(); // newRowA["MAT_NO"] = row["MAT_NO"].ToString(); // newRowA["SAMPLE_PIPE_LEN"] = row["SAMPLE_PIPE_LEN_M"].ToString(); // newRowA["SAMPLE_POSTION"] = "M端"; // newRowA["PHY_CODE_GROUP"] = row["PHY_CODE_GROUPM"].ToString(); // dataTable.Rows.Add(newRowA); // } // if (row["SAMPLE_PIPE_LEN_E"] != null && row["SAMPLE_PIPE_LEN_E"].ToString() != "") // { // DataRow newRowA = dataTable.NewRow(); // newRowA["PHY_BATCH_NO"] = row["PHY_BATCH_NO"].ToString(); // newRowA["MAT_NO"] = row["MAT_NO"].ToString(); // newRowA["SAMPLE_PIPE_LEN"] = row["SAMPLE_PIPE_LEN_E"].ToString(); // newRowA["SAMPLE_POSTION"] = "E端"; // newRowA["PHY_CODE_GROUP"] = row["PHY_CODE_GROUPE"].ToString(); // dataTable.Rows.Add(newRowA); // } // if (row["SAMPLE_PIPE_LEN_F"] != null && row["SAMPLE_PIPE_LEN_F"].ToString() != "") // { // DataRow newRowA = dataTable.NewRow(); // newRowA["PHY_BATCH_NO"] = row["PHY_BATCH_NO"].ToString(); // newRowA["MAT_NO"] = row["MAT_NO"].ToString(); // newRowA["SAMPLE_PIPE_LEN"] = row["SAMPLE_PIPE_LEN_F"].ToString(); // newRowA["SAMPLE_POSTION"] = "F端"; // newRowA["PHY_CODE_GROUP"] = row["PHY_CODE_GROUPF"].ToString(); // dataTable.Rows.Add(newRowA); // } // if (row["SAMPLE_PIPE_LEN_P"] != null && row["SAMPLE_PIPE_LEN_P"].ToString() != "") // { // DataRow newRowA = dataTable.NewRow(); // newRowA["PHY_BATCH_NO"] = row["PHY_BATCH_NO"].ToString(); // newRowA["MAT_NO"] = row["MAT_NO"].ToString(); // newRowA["SAMPLE_PIPE_LEN"] = row["SAMPLE_PIPE_LEN_P"].ToString(); // newRowA["SAMPLE_POSTION"] = "P端"; // newRowA["PHY_CODE_GROUP"] = row["PHY_CODE_GROUPP"].ToString(); // dataTable.Rows.Add(newRowA); // } // if (row["SAMPLE_PIPE_LEN_Q"] != null && row["SAMPLE_PIPE_LEN_Q"].ToString() != "") // { // DataRow newRowA = dataTable.NewRow(); // newRowA["PHY_BATCH_NO"] = row["PHY_BATCH_NO"].ToString(); // newRowA["MAT_NO"] = row["MAT_NO"].ToString(); // newRowA["SAMPLE_PIPE_LEN"] = row["SAMPLE_PIPE_LEN_Q"].ToString(); // newRowA["SAMPLE_POSTION"] = "Q端"; // newRowA["PHY_CODE_GROUP"] = row["PHY_CODE_GROUPQ"].ToString(); // dataTable.Rows.Add(newRowA); // } //} //GridHelper.RefreshAndAutoSize(ug); } private void ultraGrid11_ClickCell(object sender, ClickCellEventArgs e) { this.ultraGrid9.UpdateData(); UltraGridRow uRow = this.ultraGrid9.ActiveRow; if (uRow == null) return; string craftSource = ""; if (ultraTabControl3.SelectedTab.Key == "0") { craftSource = "0"; } else if (ultraTabControl3.SelectedTab.Key == "1") { craftSource = "2"; } else { craftSource = "0"; } if (e.Cell.Column.Key != "PHY_BATCH_NO" && e.Cell.Column.Key != "MAT_NO" && e.Cell.Column.Key != "SAMPLE_PIPE_LEN" && e.Cell.Column.Key != "SAMPLE_POSTION") { if (e.Cell.Text.Trim() == "") { DataTable ds = new DataTable(); if (e.Cell.Column.Key == "C0004" || e.Cell.Column.Key == "C0100" || e.Cell.Column.Key == "C0103" || e.Cell.Column.Key == "C0107") { if(ultraGrid11.DisplayLayout.Bands[0].Columns.Exists("C0030")){ ds = PublicServer.GetData("com.steering.mes.port.vrp.FrmHttBatchSaplmeNew.doQueryS", new object[] { craftSource, uRow.Cells["ProPlanId"].Text, uRow.Cells["GxPlanNo"].Text, uRow.Cells["JudgeStoveNo"].Text, "C0030", uRow.Cells["Pic"].Text }, ob); if (ds.Rows[0]["SSC_CONDITION"].ToString().Equals("409902")) { e.Cell.Row.Cells["C0030"].Value = "√"; } } if (ultraGrid11.DisplayLayout.Bands[0].Columns.Exists("C0033")) { ds = PublicServer.GetData("com.steering.mes.port.vrp.FrmHttBatchSaplmeNew.doQueryS", new object[] { craftSource, uRow.Cells["ProPlanId"].Text, uRow.Cells["GxPlanNo"].Text, uRow.Cells["JudgeStoveNo"].Text, "C0033", uRow.Cells["Pic"].Text }, ob); if (ds.Rows[0]["SSC_CONDITION"].ToString().Equals("409902")) { e.Cell.Row.Cells["C0033"].Value = "√"; } } if (ultraGrid11.DisplayLayout.Bands[0].Columns.Exists("C0133")) { ds = PublicServer.GetData("com.steering.mes.port.vrp.FrmHttBatchSaplmeNew.doQueryS", new object[] { craftSource, uRow.Cells["ProPlanId"].Text, uRow.Cells["GxPlanNo"].Text, uRow.Cells["JudgeStoveNo"].Text, "C0133", uRow.Cells["Pic"].Text }, ob); if (ds.Rows[0]["SSC_CONDITION"].ToString().Equals("409902")) { e.Cell.Row.Cells["C0133"].Value = "√"; } } } else if (e.Cell.Column.Key == "C0030") { ds = PublicServer.GetData("com.steering.mes.port.vrp.FrmHttBatchSaplmeNew.doQueryS", new object[] { craftSource, uRow.Cells["ProPlanId"].Text, uRow.Cells["GxPlanNo"].Text, uRow.Cells["JudgeStoveNo"].Text, "C0030", uRow.Cells["Pic"].Text }, ob); if (ds.Rows[0]["SSC_CONDITION"].ToString().Equals("409902")) { if (ultraGrid11.DisplayLayout.Bands[0].Columns.Exists("C0107")) { e.Cell.Row.Cells["C0107"].Value = "√"; } else if (ultraGrid11.DisplayLayout.Bands[0].Columns.Exists("C0103")) { e.Cell.Row.Cells["C0103"].Value = "√"; } else if (ultraGrid11.DisplayLayout.Bands[0].Columns.Exists("C0100")) { e.Cell.Row.Cells["C0100"].Value = "√"; } else if (ultraGrid11.DisplayLayout.Bands[0].Columns.Exists("C0004")) { e.Cell.Row.Cells["C0004"].Value = "√"; } } } else if (e.Cell.Column.Key == "C0033") { ds = PublicServer.GetData("com.steering.mes.port.vrp.FrmHttBatchSaplmeNew.doQueryS", new object[] { craftSource, uRow.Cells["ProPlanId"].Text, uRow.Cells["GxPlanNo"].Text, uRow.Cells["JudgeStoveNo"].Text, "C0033", uRow.Cells["Pic"].Text }, ob); if (ds.Rows[0]["SSC_CONDITION"].ToString().Equals("409902")) { if (ultraGrid11.DisplayLayout.Bands[0].Columns.Exists("C0107")) { e.Cell.Row.Cells["C0107"].Value = "√"; } else if (ultraGrid11.DisplayLayout.Bands[0].Columns.Exists("C0103")) { e.Cell.Row.Cells["C0103"].Value = "√"; } else if (ultraGrid11.DisplayLayout.Bands[0].Columns.Exists("C0100")) { e.Cell.Row.Cells["C0100"].Value = "√"; } else if (ultraGrid11.DisplayLayout.Bands[0].Columns.Exists("C0004")) { e.Cell.Row.Cells["C0004"].Value = "√"; } } } else if (e.Cell.Column.Key == "C0133") { ds = PublicServer.GetData("com.steering.mes.port.vrp.FrmHttBatchSaplmeNew.doQueryS", new object[] { craftSource, uRow.Cells["ProPlanId"].Text, uRow.Cells["GxPlanNo"].Text, uRow.Cells["JudgeStoveNo"].Text, "C0133", uRow.Cells["Pic"].Text }, ob); if (ds.Rows[0]["SSC_CONDITION"].ToString().Equals("409902")) { if (ultraGrid11.DisplayLayout.Bands[0].Columns.Exists("C0107")) { e.Cell.Row.Cells["C0107"].Value = "√"; } else if (ultraGrid11.DisplayLayout.Bands[0].Columns.Exists("C0103")) { e.Cell.Row.Cells["C0103"].Value = "√"; } else if (ultraGrid11.DisplayLayout.Bands[0].Columns.Exists("C0100")) { e.Cell.Row.Cells["C0100"].Value = "√"; } else if (ultraGrid11.DisplayLayout.Bands[0].Columns.Exists("C0004")) { e.Cell.Row.Cells["C0004"].Value = "√"; } } } e.Cell.Value = "√"; } else { DataTable ds = new DataTable(); if (e.Cell.Column.Key == "C0004" || e.Cell.Column.Key == "C0100" || e.Cell.Column.Key == "C0103" || e.Cell.Column.Key == "C0107") { if (ultraGrid11.DisplayLayout.Bands[0].Columns.Exists("C0030")) { ds = PublicServer.GetData("com.steering.mes.port.vrp.FrmHttBatchSaplmeNew.doQueryS", new object[] { craftSource, uRow.Cells["ProPlanId"].Text, uRow.Cells["GxPlanNo"].Text, uRow.Cells["JudgeStoveNo"].Text, "C0030", uRow.Cells["Pic"].Text }, ob); if (ds.Rows[0]["SSC_CONDITION"].ToString().Equals("409902")) { e.Cell.Row.Cells["C0030"].Value = ""; } } if (ultraGrid11.DisplayLayout.Bands[0].Columns.Exists("C0033")) { ds = PublicServer.GetData("com.steering.mes.port.vrp.FrmHttBatchSaplmeNew.doQueryS", new object[] { craftSource, uRow.Cells["ProPlanId"].Text, uRow.Cells["GxPlanNo"].Text, uRow.Cells["JudgeStoveNo"].Text, "C0033", uRow.Cells["Pic"].Text }, ob); if (ds.Rows[0]["SSC_CONDITION"].ToString().Equals("409902")) { e.Cell.Row.Cells["C0033"].Value = ""; } } if (ultraGrid11.DisplayLayout.Bands[0].Columns.Exists("C0133")) { ds = PublicServer.GetData("com.steering.mes.port.vrp.FrmHttBatchSaplmeNew.doQueryS", new object[] { craftSource, uRow.Cells["ProPlanId"].Text, uRow.Cells["GxPlanNo"].Text, uRow.Cells["JudgeStoveNo"].Text, "C0133", uRow.Cells["Pic"].Text }, ob); if (ds.Rows[0]["SSC_CONDITION"].ToString().Equals("409902")) { e.Cell.Row.Cells["C0133"].Value = ""; } } } else if (e.Cell.Column.Key == "C0030") { ds = PublicServer.GetData("com.steering.mes.port.vrp.FrmHttBatchSaplmeNew.doQueryS", new object[] { craftSource, uRow.Cells["ProPlanId"].Text, uRow.Cells["GxPlanNo"].Text, uRow.Cells["JudgeStoveNo"].Text, "C0030", uRow.Cells["Pic"].Text }, ob); if (ds.Rows[0]["SSC_CONDITION"].ToString().Equals("409902")) { if (ultraGrid11.DisplayLayout.Bands[0].Columns.Exists("C0107")) { e.Cell.Row.Cells["C0107"].Value = ""; } else if (ultraGrid11.DisplayLayout.Bands[0].Columns.Exists("C0103")) { e.Cell.Row.Cells["C0103"].Value = ""; } else if (ultraGrid11.DisplayLayout.Bands[0].Columns.Exists("C0100")) { e.Cell.Row.Cells["C0100"].Value = ""; } else if (ultraGrid11.DisplayLayout.Bands[0].Columns.Exists("C0004")) { e.Cell.Row.Cells["C0004"].Value = ""; } } } else if (e.Cell.Column.Key == "C0033") { ds = PublicServer.GetData("com.steering.mes.port.vrp.FrmHttBatchSaplmeNew.doQueryS", new object[] { craftSource, uRow.Cells["ProPlanId"].Text, uRow.Cells["GxPlanNo"].Text, uRow.Cells["JudgeStoveNo"].Text, "C0033", uRow.Cells["Pic"].Text }, ob); if (ds.Rows[0]["SSC_CONDITION"].ToString().Equals("409902")) { if (ultraGrid11.DisplayLayout.Bands[0].Columns.Exists("C0107")) { e.Cell.Row.Cells["C0107"].Value = ""; } else if (ultraGrid11.DisplayLayout.Bands[0].Columns.Exists("C0103")) { e.Cell.Row.Cells["C0103"].Value = ""; } else if (ultraGrid11.DisplayLayout.Bands[0].Columns.Exists("C0100")) { e.Cell.Row.Cells["C0100"].Value = ""; } else if (ultraGrid11.DisplayLayout.Bands[0].Columns.Exists("C0004")) { e.Cell.Row.Cells["C0004"].Value = ""; } } } else if (e.Cell.Column.Key == "C0133") { ds = PublicServer.GetData("com.steering.mes.port.vrp.FrmHttBatchSaplmeNew.doQueryS", new object[] { craftSource, uRow.Cells["ProPlanId"].Text, uRow.Cells["GxPlanNo"].Text, uRow.Cells["JudgeStoveNo"].Text, "C0133", uRow.Cells["Pic"].Text }, ob); if (ds.Rows[0]["SSC_CONDITION"].ToString().Equals("409902")) { if (ultraGrid11.DisplayLayout.Bands[0].Columns.Exists("C0107")) { e.Cell.Row.Cells["C0107"].Value = ""; } else if (ultraGrid11.DisplayLayout.Bands[0].Columns.Exists("C0103")) { e.Cell.Row.Cells["C0103"].Value = ""; } else if (ultraGrid11.DisplayLayout.Bands[0].Columns.Exists("C0100")) { e.Cell.Row.Cells["C0100"].Value = ""; } else if (ultraGrid11.DisplayLayout.Bands[0].Columns.Exists("C0004")) { e.Cell.Row.Cells["C0004"].Value = ""; } } } e.Cell.Value = ""; } } } private void FrmMilBatchSampleNew_Shown(object sender, EventArgs e) { if (toolMenu == null || toolMenu.Toolbars == null) return; if (toolMenu.Toolbars[0].Tools.Exists("CancelBatchSeting")) { toolMenu.Toolbars[0].Tools["CancelBatchSeting"].InstanceProps.Visible = DefaultableBoolean.False; } if (toolMenu.Toolbars[0].Tools.Exists("Confirm")) { toolMenu.Toolbars[0].Tools["Confirm"].InstanceProps.Visible = DefaultableBoolean.False; } if (toolMenu.Toolbars[0].Tools.Exists("CancelConfirm")) { toolMenu.Toolbars[0].Tools["CancelConfirm"].InstanceProps.Visible = DefaultableBoolean.False; } if (toolMenu.Toolbars[0].Tools.Exists("Print")) { toolMenu.Toolbars[0].Tools["Print"].InstanceProps.Visible = DefaultableBoolean.False; } if (toolMenu.Toolbars[0].Tools.Exists("PrintLable")) { toolMenu.Toolbars[0].Tools["PrintLable"].InstanceProps.Visible = DefaultableBoolean.False; } if (toolMenu.Toolbars[0].Tools.Exists("CancelGetSample")) { toolMenu.Toolbars[0].Tools["CancelGetSample"].InstanceProps.Visible = DefaultableBoolean.False; } if (toolMenu.Toolbars[0].Tools.Exists("QueryRepeate")) { toolMenu.Toolbars[0].Tools["QueryRepeate"].InstanceProps.Visible = DefaultableBoolean.False; } if (toolMenu.Toolbars[0].Tools.Exists("ReGetSample")) { toolMenu.Toolbars[0].Tools["ReGetSample"].InstanceProps.Visible = DefaultableBoolean.False; } if (toolMenu.Toolbars[0].Tools.Exists("CancelReGetSample")) { toolMenu.Toolbars[0].Tools["CancelReGetSample"].InstanceProps.Visible = DefaultableBoolean.False; } if (toolMenu.Toolbars[0].Tools.Exists("RepeateFrim")) { toolMenu.Toolbars[0].Tools["RepeateFrim"].InstanceProps.Visible = DefaultableBoolean.False; } if (toolMenu.Toolbars[0].Tools.Exists("CancelRepeateFrim")) { toolMenu.Toolbars[0].Tools["CancelRepeateFrim"].InstanceProps.Visible = DefaultableBoolean.False; } if (toolMenu.Toolbars[0].Tools.Exists("PrintRe")) { toolMenu.Toolbars[0].Tools["PrintRe"].InstanceProps.Visible = DefaultableBoolean.False; } if (toolMenu.Toolbars[0].Tools.Exists("PrintReLable")) { toolMenu.Toolbars[0].Tools["PrintReLable"].InstanceProps.Visible = DefaultableBoolean.False; } btnConfirm.Visible = false; btnAuto.Visible = false; buttonBatchNo.Visible = false; buttonGetSample.Visible = false; buttonSd.Visible = true; txt_BatchMax.ReadOnly = true; } private void ultraTabControl1_SelectedTabChanged(object sender, Infragistics.Win.UltraWinTabControl.SelectedTabChangedEventArgs e) { if (toolMenu == null || toolMenu.Toolbars == null) return; if (toolMenu.Toolbars[0].Tools.Exists("Query")) { toolMenu.Toolbars[0].Tools["Query"].InstanceProps.Visible = this.ultraTabControl1.SelectedTab.Index == 4 || this.ultraTabControl1.SelectedTab.Index == 5 ? DefaultableBoolean.False : DefaultableBoolean.True; } if (toolMenu.Toolbars[0].Tools.Exists("BatchSeting")) { toolMenu.Toolbars[0].Tools["BatchSeting"].InstanceProps.Visible = this.ultraTabControl1.SelectedTab.Index == 0 ? DefaultableBoolean.True : DefaultableBoolean.False; } if (toolMenu.Toolbars[0].Tools.Exists("CancelBatchSeting")) { toolMenu.Toolbars[0].Tools["CancelBatchSeting"].InstanceProps.Visible = this.ultraTabControl1.SelectedTab.Index == 1 ? DefaultableBoolean.True : DefaultableBoolean.False; } if (toolMenu.Toolbars[0].Tools.Exists("OprocessBatch")) { toolMenu.Toolbars[0].Tools["OprocessBatch"].InstanceProps.Visible = this.ultraTabControl1.SelectedTab.Index == 0 ? DefaultableBoolean.True : DefaultableBoolean.False; } if (toolMenu.Toolbars[0].Tools.Exists("CancelOprocessBatch")) { toolMenu.Toolbars[0].Tools["CancelOprocessBatch"].InstanceProps.Visible = this.ultraTabControl1.SelectedTab.Index == 0 ? DefaultableBoolean.True : DefaultableBoolean.False; } if (toolMenu.Toolbars[0].Tools.Exists("GetSample")) { toolMenu.Toolbars[0].Tools["GetSample"].InstanceProps.Visible = this.ultraTabControl1.SelectedTab.Index == 0 ? DefaultableBoolean.True : DefaultableBoolean.False; } if (toolMenu.Toolbars[0].Tools.Exists("Approval")) { toolMenu.Toolbars[0].Tools["Approval"].InstanceProps.Visible = this.ultraTabControl1.SelectedTab.Index == 0 ? DefaultableBoolean.True : DefaultableBoolean.False; } if (toolMenu.Toolbars[0].Tools.Exists("ComfrimComplete")) { toolMenu.Toolbars[0].Tools["ComfrimComplete"].InstanceProps.Visible = this.ultraTabControl1.SelectedTab.Index == 0 ? DefaultableBoolean.True : DefaultableBoolean.False; } if (toolMenu.Toolbars[0].Tools.Exists("CancelGetSample")) { toolMenu.Toolbars[0].Tools["CancelGetSample"].InstanceProps.Visible = this.ultraTabControl1.SelectedTab.Index == 1 ? DefaultableBoolean.True : DefaultableBoolean.False; } if (toolMenu.Toolbars[0].Tools.Exists("Confirm")) { toolMenu.Toolbars[0].Tools["Confirm"].InstanceProps.Visible = this.ultraTabControl1.SelectedTab.Index == 2 ? DefaultableBoolean.True : DefaultableBoolean.False; } if (toolMenu.Toolbars[0].Tools.Exists("CancelConfirm")) { toolMenu.Toolbars[0].Tools["CancelConfirm"].InstanceProps.Visible = this.ultraTabControl1.SelectedTab.Index == 3 ? DefaultableBoolean.True : DefaultableBoolean.False; } if (toolMenu.Toolbars[0].Tools.Exists("Print")) { toolMenu.Toolbars[0].Tools["Print"].InstanceProps.Visible = this.ultraTabControl1.SelectedTab.Index == 3 ? DefaultableBoolean.True : DefaultableBoolean.False; } if (toolMenu.Toolbars[0].Tools.Exists("PrintLable")) { toolMenu.Toolbars[0].Tools["PrintLable"].InstanceProps.Visible = this.ultraTabControl1.SelectedTab.Index == 3 ? DefaultableBoolean.True : DefaultableBoolean.False; } if (toolMenu.Toolbars[0].Tools.Exists("ReGetSample")) { toolMenu.Toolbars[0].Tools["ReGetSample"].InstanceProps.Visible = this.ultraTabControl1.SelectedTab.Index == 4 ? DefaultableBoolean.True : DefaultableBoolean.False; } if (toolMenu.Toolbars[0].Tools.Exists("CancelReGetSample")) { toolMenu.Toolbars[0].Tools["CancelReGetSample"].InstanceProps.Visible = this.ultraTabControl1.SelectedTab.Index == 4 ? DefaultableBoolean.True : DefaultableBoolean.False; } if (toolMenu.Toolbars[0].Tools.Exists("QueryRepeate")) { toolMenu.Toolbars[0].Tools["QueryRepeate"].InstanceProps.Visible = this.ultraTabControl1.SelectedTab.Index == 4 || this.ultraTabControl1.SelectedTab.Index == 5 ? DefaultableBoolean.True : DefaultableBoolean.False; } if (toolMenu.Toolbars[0].Tools.Exists("RepeateFrim")) { toolMenu.Toolbars[0].Tools["RepeateFrim"].InstanceProps.Visible = this.ultraTabControl1.SelectedTab.Index == 5 ? DefaultableBoolean.True : DefaultableBoolean.False; } if (toolMenu.Toolbars[0].Tools.Exists("CancelRepeateFrim")) { toolMenu.Toolbars[0].Tools["CancelRepeateFrim"].InstanceProps.Visible = this.ultraTabControl1.SelectedTab.Index == 5 ? DefaultableBoolean.True : DefaultableBoolean.False; } if (toolMenu.Toolbars[0].Tools.Exists("PrintRe")) { toolMenu.Toolbars[0].Tools["PrintRe"].InstanceProps.Visible = this.ultraTabControl1.SelectedTab.Index == 5 ? DefaultableBoolean.True : DefaultableBoolean.False; } if (toolMenu.Toolbars[0].Tools.Exists("PrintReLable")) { toolMenu.Toolbars[0].Tools["PrintReLable"].InstanceProps.Visible = this.ultraTabControl1.SelectedTab.Index == 5 ? DefaultableBoolean.True : DefaultableBoolean.False; } } /// /// 纯手工分批 /// /// /// private void buttonSd_Click(object sender, EventArgs e) { this.ultraGrid4.UpdateData(); UltraGridRow row = this.ultraGrid1.ActiveRow; if (row == null) return; List lists = portHttBatchSampleResultEntityBindingSource.DataSource as List; var m = lists.Where(p => p.PhyBatchNo == "").ToList();//判断是否还未分配性能批号集合数据 if (m.Count == 0) { return; } int Bathno = 1; int tsBatchNo = 0;//探伤最大批号 int pipeBatchNo = 0;//检验最大批号 int sampleNum = int.Parse(this.txt_SampleNum.Text.ToString3()); int startSeq = int.Parse(ultraSTART_PIPE_NO.Text);//开始序号 int endSeq = int.Parse(ultraEND_PIPE_NO.Text);//结束序号 if(this.txt_BatchMax.Text.Trim() != "") { if (endSeq - startSeq + 1 > int.Parse(this.txt_BatchMax.Text.ToString3())) { MessageUtil.ShowTips("分批数量不能大于工艺要求分批上限!"); return; } } var lists1 = lists.Where(p => p.PhyBatchNo != "").ToList(); if (lists1.Any()) { Bathno = lists1.Max(p => int.Parse(p.PhyBatchNo.Substring(2, 3))) + 1; } DataTable ds = PublicServer.GetData("com.steering.mes.port.vrp.FrmHttBatchSaplmeNew.doQueryMaxBatchNo", new object[] { row.Cells["HeatPlanNo"].Text, row.Cells["PlineCode"].Text }, ob);//查询探伤实绩最大的批号 if (ds.Rows.Count > 0) { tsBatchNo = int.Parse(ds.Rows[0][0].ToString()); } DataTable dsPipe = PublicServer.GetData("com.steering.mes.port.vrp.FrmHttBatchSaplmeNew.doQueryMaxBatchNoPipe", new object[] { row.Cells["JudgeStoveNo"].Text, row.Cells["PlineCode"].Text }, ob);//查询探检验最大的批号 if (dsPipe.Rows.Count > 0) { pipeBatchNo = int.Parse(dsPipe.Rows[0][0].ToString()); } if (pipeBatchNo > Bathno) { Bathno = pipeBatchNo; } //if (tsBatchNo > pipeBatchNo) //{ // if (tsBatchNo > Bathno) // { // Bathno = tsBatchNo; // } //} //else //{ // if (pipeBatchNo > Bathno) // { // Bathno = pipeBatchNo; // } //} m.Take(endSeq - startSeq + 1).ToList().ForEach(p => p.PhyBatchNo = batchNoZ + Bathno.ToString("000"));//赋值批号 //m.Take(sampleNum).ToList().ForEach(p => p.Chk = true); List lists2 = portHttBatchSampleResultEntityBindingSource.DataSource as List; var k = lists2.Where(p =>p.PhyBatchNo == "").ToList(); if (k.Count() > 0) { ultraSTART_PIPE_NO.Text = k.First().Seq.ToString();//初始序号 跳过已赋值批号数据 } else { ultraSTART_PIPE_NO.Text = (lists2.Count()).ToString(); } ultraEND_PIPE_NO.Text = (lists2.Count()).ToString();//结束序号 ultraGrid3.Update(); ultraGrid3.DataBind(); ultraGrid3_CellChange(null, null); for (int i = 0; i < this.ultraGrid3.Rows.Count();i++) { if (this.ultraGrid3.Rows[i].Cells["PhyBatchNo"].Value.ToString2() == "") return; if (ultraGrid3.Rows[0].Cells["SamplePipeLenA"].Value.ToString2() != "" || ultraGrid3.Rows[0].Cells["SamplePipeLenB"].Value.ToString2() != "" || ultraGrid3.Rows[0].Cells["SamplePipeLenC"].Value.ToString2() != "" || ultraGrid3.Rows[0].Cells["SamplePipeLenD"].Value.ToString2() != "" || ultraGrid3.Rows[0].Cells["SamplePipeLenM"].Value.ToString2() != "") { this.ultraGrid3.Rows[0].RowSelectorAppearance.BackColor = Color.Red; } if (i == 0) { this.ultraGrid3.Rows[0].Appearance.BackColor = color1; } else { PortHttBatchSampleResultEntity lastList = ultraGrid3.Rows[ultraGrid3.Rows[i - 1].Index].ListObject as PortHttBatchSampleResultEntity; if ((this.ultraGrid3.Rows[i].Cells["PhyBatchNo"].Value.ToString2() == lastList.PhyBatchNo)) { this.ultraGrid3.Rows[i].Appearance.BackColor = ultraGrid3.Rows[ultraGrid3.Rows[i - 1].Index].Appearance.BackColor; } else { this.ultraGrid3.Rows[i].Appearance.BackColor = ultraGrid3.Rows[ultraGrid3.Rows[i - 1].Index].Appearance.BackColor == color1 ? color2 : color1; } } } } /// /// 仅分批 /// /// /// private void buttonBatchNo_Click(object sender, EventArgs e) { this.ultraGrid4.UpdateData(); if (!StringUtil.IsInt32(txt_BatchMax.Text.ToString3()) || int.Parse(txt_BatchMax.Text.ToString3()) <= 0) { MessageUtil.ShowTips("人工分批输入的分批上限需为正整数!"); return; } List lists = portHttBatchSampleResultEntityBindingSource.DataSource as List; var m = lists.Where(p => p.PhyBatchNo == "").ToList();//判断是否还未分配性能批号集合数据 if (m.Count == 0) { return; } int Bathno = 1; int sampleNum = 0; for (int k = 0; k < int.Parse(this.txtBATCH_MIN.Text.ToString3()); k++) { int startSeq = int.Parse(ultraSTART_PIPE_NO.Text);//开始序号 int endSeq = int.Parse(ultraEND_PIPE_NO.Text);//结束序号 var lists1 = lists.Where(p => p.PhyBatchNo != "").ToList(); if (lists1.Any()) { Bathno = lists1.Max(p => int.Parse(p.PhyBatchNo.Substring(2, 3))) + 1; } m.Take(endSeq - startSeq + 1).ToList().ForEach(p => p.PhyBatchNo = batchNoZ + Bathno.ToString("000"));//赋值批号 m.Take(sampleNum).ToList().ForEach(p => p.Chk = true); ultraSTART_PIPE_NO.Text = m.First().Seq.ToString();//初始序号 跳过已赋值批号数据 ultraEND_PIPE_NO.Text = m.Take(int.Parse(txt_BatchMax.Text.ToString3())).Last().Seq.ToString();//结束序号 ultraGrid3.Update(); ultraGrid3.DataBind(); ultraGrid3_CellChange(null, null); m = lists.Where(p => p.PhyBatchNo == "").ToList();//判断是否还未分配性能批号集合数据 if (m.Count == 0) { return; } } } /// /// 逐支取样 /// /// /// private void pipeceButtonStd_Click(object sender, EventArgs e) { this.ultraGrid1.UpdateData(); this.ultraGrid3.UpdateData(); UltraGridRow uRow = this.ultraGrid1.ActiveRow; if (uRow == null) return; string len = ""; List lists = portHttBatchSampleResultEntityBindingSource.DataSource as List; var m = lists.Where(p => p.PhyBatchNo != "").ToList();//判断是否还未分配性能批号集合数据 if (m.Count == 0) { return; } if (this.txtPieceLen.Text == "") { MessageUtil.ShowTips("请输入逐支取样长度!"); return; } if (!StringUtil.IsInt(this.txtPieceLen.Text.Trim().ToString3())) { MessageUtil.ShowTips("逐支取样长度需输入正整数!"); return; } len = this.txtPieceLen.Text.Trim(); DataTable ds = PublicServer.GetData("com.steering.mes.port.vrp.FrmHttBatchSaplmeNew.doQueryPhyMaxPipece", new object[] { uRow.Cells["ProPlanId"].Text, uRow.Cells["GxPlanNo"].Text, uRow.Cells["JudgeStoveNo"].Text, this.cmbSampleType.Value.ToString() }, ob); if (ds.Rows.Count == 0) { MessageUtil.ShowTips("无逐支取样试样组,不允许一键取样!"); return; } var status = new List { }; status = this.cmbPiecePostion.CheckedItems.Select(p => p.DataValue.ToString()).ToList(); if (!status.Any()) status = new List { "401201", "401202", "401217", "401218", "401219", "401220", "401221", "401222", "401223" }; List listS = EntityHelper.GetData( "com.steering.mes.port.vrp.FrmHttBatchSaplmeNew.doQuerySampleMatNo", new object[] { uRow.Cells["JudgeStoveNo"].Text, this.cmbSampleType.Value.ToString() }, this.ob); for (int i = 0; i < lists.Count; i++) { var p = lists[i]; if (status.ToArray().Length == 1) { var listD = listS.Where(q => q.MatNo == p.MatNo).ToList(); if (listD.Any()) return; if (status.Contains("401201") || status.Contains("401202")) { if (i == 0) { p.SamplePipeLenA = len; } else { var LastlistD = listS.Where(q => q.MatNo == lists[i - 1].MatNo).ToList(); if (LastlistD.Any()) { if (LastlistD[0].Postion == "A") { p.SamplePipeLenB = len; } else { p.SamplePipeLenA = len; } } else { if (lists[i - 1].SamplePipeLenA == "") { p.SamplePipeLenA = len; } else { p.SamplePipeLenB = len; } } } } if (status.Contains("401217")) { p.SamplePipeLenC = len; } if (status.Contains("401218")) { p.SamplePipeLenD = len; } if (status.Contains("401219")) { p.SamplePipeLenM = len; } if (status.Contains("401220")) { p.SamplePipeLenE = len; } if (status.Contains("401221")) { p.SamplePipeLenF = len; } if (status.Contains("401222")) { p.SamplePipeLenP = len; } if (status.Contains("401223")) { p.SamplePipeLenQ = len; } } else { var listD = listS.Where(q => q.MatNo == p.MatNo).ToList(); if (listD.Any()) return; if (status.Contains("401201")) { p.SamplePipeLenA = len; } if (status.Contains("401202")) { p.SamplePipeLenB = len; } if (status.Contains("401217")) { p.SamplePipeLenC = len; } if (status.Contains("401218")) { p.SamplePipeLenD = len; } if (status.Contains("401219")) { p.SamplePipeLenM = len; } if (status.Contains("401220")) { p.SamplePipeLenE = len; } if (status.Contains("401221")) { p.SamplePipeLenF = len; } if (status.Contains("401222")) { p.SamplePipeLenP = len; } if (status.Contains("401223")) { p.SamplePipeLenQ = len; } } p.ChemResultCode = "1"; p.Chk = true; } ultraGrid3.Update(); ultraGrid3.DataBind(); ultraGrid3_CellChange(null, null); } /// /// 仅取样 /// /// /// private void buttonGetSample_Click(object sender, EventArgs e) { this.ultraGrid4.UpdateData(); int sampleNum = 0; List lists = portHttBatchSampleResultEntityBindingSource.DataSource as List; var m = lists.Where(p => p.PhyBatchNo != "").ToList();//判断是否还未分配性能批号集合数据 if (m.Count == 0) { return; } if (!StringUtil.IsInt32(this.txt_SampleNum.Text.Trim().ToString3())) { MessageUtil.ShowTips("样管数量需输入正整数!"); return; } if (int.Parse(this.txt_SampleNum.Text.Trim().ToString3()) <= 0) { MessageUtil.ShowTips("取样时每批样管数应大于0"); return; } else { sampleNum = int.Parse(this.txt_SampleNum.Text.Trim().ToString3()); } if (dtPlanM1 == null || dtPlanM1.Count() == 0) { foreach (var item in m.GroupBy(p => p.PhyBatchNo)) { item.Take(sampleNum).ToList().ForEach(p => p.Chk = true); } } else { int maxBacthNum = int.Parse(this.ultraGrid4.Rows[0].Cells["NUM"].Text);//分批上限 int maxBacth = dtPlanM.Max(p => p.BatchNo == null ? 1 : (int)(p.BatchNo));//取主表最大方案 for (int i = 0; i < m.GroupBy(p => p.PhyBatchNo).Count(); i++) { var list = dtPlanM1.Where(p => p.BatchNo == (i + 1 > maxBacth ? maxBacth : i + 1)).ToList(); var listA = list.Where(p => p.Position == "401201").ToList(); var listB = list.Where(p => p.Position == "401202").ToList(); var listC = list.Where(p => p.Position == "401217").ToList(); var listD = list.Where(p => p.Position == "401218").ToList(); int s = 0; for (int k = 0; k < listA.Count; k++) { var crft = list[k]; int a = (int)crft.SampleCount;//样管数量 for (int j = 0; j < a; j++, s++) { if (lists.Count > s + i * maxBacthNum) { lists[s + i * maxBacthNum].SamplePipeLenA = crft.SampleLength.ToString(); lists[s + i * maxBacthNum].PhyCodeGroup = crft.PhyCodeGroup.ToString(); lists[s + i * maxBacthNum].Chk = true; } } } s = 0; for (int k = 0; k < listB.Count; k++) { var crft = list[k]; int a = (int)crft.SampleCount;//样管数量 for (int j = 0; j < a; j++, s++) { if (lists.Count > s + i * maxBacthNum) { lists[s + i * maxBacthNum].SamplePipeLenB = crft.SampleLength.ToString(); lists[s + i * maxBacthNum].PhyCodeGroupb = crft.PhyCodeGroup.ToString(); lists[s + i * maxBacthNum].Chk = true; } } } s = 0; for (int k = 0; k < listC.Count; k++) { var crft = list[k]; int a = (int)crft.SampleCount;//样管数量 for (int j = 0; j < a; j++, s++) { if (lists.Count > s + i * maxBacthNum) { lists[s + i * maxBacthNum].SamplePipeLenC = crft.SampleLength.ToString(); lists[s + i * maxBacthNum].PhyCodeGroupc = crft.PhyCodeGroup.ToString(); lists[s + i * maxBacthNum].Chk = true; } } } s = 0; for (int k = 0; k < listD.Count; k++) { var crft = list[k]; int a = (int)crft.SampleCount;//样管数量 for (int j = 0; j < a; j++, s++) { if (lists.Count > s + i * maxBacthNum) { lists[s + i * maxBacthNum].SamplePipeLenD = crft.SampleLength.ToString(); lists[s + i * maxBacthNum].PhyCodeGroupd = crft.PhyCodeGroup.ToString(); lists[s + i * maxBacthNum].Chk = true; } } } } } ultraGrid3.Update(); ultraGrid3.DataBind(); ultraGrid3_CellChange(null, null); } private void txtBATCH_MIN_ValueChanged(object sender, EventArgs e) { if (txtBATCH_MIN.Text == "") return; if (dtPlanM == null || dtPlanDetial == null || dtPlanM.Count == 0 || dtPlanDetial.Count == 0) { return; } //bool isBacthFlag = dtPlanDetial.Any(p => p.Rate == "408601" || p.Rate == "408608");//判断是否试样组有生产批 //if (isBacthFlag) //{ //} //else //{ int maxBacth = dtPlanM.Max(p => p.BatchNum == null ? 1 : (int)(p.BatchNum));//取主表最大方案 int batchNum = int.Parse(txtBATCH_MIN.Text.ToString3());//实际批数 dtPlanM1 = dtPlanM.Where(p => p.BatchNum == (batchNum > maxBacth ? maxBacth : batchNum)).ToList();//取具体方案 //} } private void ultraTabControl2_SelectedTabChanged(object sender, Infragistics.Win.UltraWinTabControl.SelectedTabChangedEventArgs e) { if (ultraTabControl2.SelectedTab.Key == "0") { btnConfirm.Visible = false; btnAuto.Visible = false; buttonBatchNo.Visible = false; buttonGetSample.Visible = false; buttonSd.Visible = true; pipeceButtonStd.Visible = true; txt_BatchMax.ReadOnly = true; ultraLabel3.Visible = true; txtBatchCount.Visible = true; this.ultraSTART_PIPE_NO.ReadOnly = true; } else if (ultraTabControl2.SelectedTab.Key == "1") { btnConfirm.Visible = true; btnAuto.Visible = true; buttonBatchNo.Visible = true; buttonGetSample.Visible = true; buttonSd.Visible = false; pipeceButtonStd.Visible = false; txt_BatchMax.ReadOnly = false; ultraLabel3.Visible = false; txtBatchCount.Visible = false; this.ultraSTART_PIPE_NO.ReadOnly = true; } else if (ultraTabControl2.SelectedTab.Key == "2") { btnConfirm.Visible = false; btnAuto.Visible = false; buttonBatchNo.Visible = false; buttonGetSample.Visible = false; pipeceButtonStd.Visible = false; buttonSd.Visible = false; ultraLabel3.Visible = false; txtBatchCount.Visible = false; txt_BatchMax.ReadOnly = true; this.ultraSTART_PIPE_NO.ReadOnly = false; } } private void txtBatchCount_ValueChanged(object sender, EventArgs e) { List lists = portHttBatchSampleResultEntityBindingSource.DataSource as List; if (!StringUtil.IsInt32(txtBatchCount.Text.ToString3())) { MessageUtil.ShowTips("分批数量请输入整数!"); return; } if ((int.Parse(ultraSTART_PIPE_NO.Text.ToString3()) + Math.Abs(int.Parse(txtBatchCount.Text.ToString3())) - 1) > lists.Max(p => int.Parse(p.Seq))) { ultraEND_PIPE_NO.Text = lists.Max(p =>int.Parse(p.Seq)).ToString(); } else { ultraEND_PIPE_NO.Text = (int.Parse(ultraSTART_PIPE_NO.Text.ToString3()) + Math.Abs(int.Parse(txtBatchCount.Text.ToString3())) - 1).ToString(); } } private void ultraGrid3_InitializeRow(object sender, InitializeRowEventArgs e) { PortHttBatchSampleResultEntity portHttBatchSampleResultEntity = e.Row.ListObject as PortHttBatchSampleResultEntity; if (portHttBatchSampleResultEntity.PhyBatchNo == "") return; if (portHttBatchSampleResultEntity.IsSamplePipe == "1") { ultraGrid3.Rows[e.Row.Index].RowSelectorAppearance.BackColor = Color.Red; } if (e.Row.Index == 0) { e.Row.Appearance.BackColor = color1; } else { PortHttBatchSampleResultEntity lastList = ultraGrid3.Rows[e.Row.Index - 1].ListObject as PortHttBatchSampleResultEntity; if (portHttBatchSampleResultEntity.PhyBatchNo == lastList.PhyBatchNo) { e.Row.Appearance.BackColor = ultraGrid3.Rows[e.Row.Index - 1].Appearance.BackColor; } else { e.Row.Appearance.BackColor = ultraGrid3.Rows[e.Row.Index - 1].Appearance.BackColor == color1 ? color2 : color1; } } } private void txtLen_ValueChanged(object sender, EventArgs e) { if (!StringUtil.IsInt(this.txtLen.Text)) return; List list1 = null; //if (ultraTabControl3.SelectedTab.Key == "0") //{ list1 = portHttBatchSampleResultEntityBindingSource.DataSource as List; if (list1.Any()) { if (this.cmbPostion.Value.ToString().Equals("401201"))//A端 { list1.Where(p => p.MatNo == txtMatNo.Text).ToList().ForEach(p =>p.SamplePipeLenA = txtLen.Text); } else if (this.cmbPostion.Value.ToString().Equals("401202")) { list1.Where(p => p.MatNo == txtMatNo.Text).ToList().ForEach(p => p.SamplePipeLenB = txtLen.Text); } else if (this.cmbPostion.Value.ToString().Equals("401217")) { list1.Where(p => p.MatNo == txtMatNo.Text).ToList().ForEach(p => p.SamplePipeLenC = txtLen.Text); } else if (this.cmbPostion.Value.ToString().Equals("401218")) { list1.Where(p => p.MatNo == txtMatNo.Text).ToList().ForEach(p => p.SamplePipeLenD = txtLen.Text); } else if (this.cmbPostion.Value.ToString().Equals("401219")) { list1.Where(p => p.MatNo == txtMatNo.Text).ToList().ForEach(p => p.SamplePipeLenM = txtLen.Text); } else if (this.cmbPostion.Value.ToString().Equals("401220")) { list1.Where(p => p.MatNo == txtMatNo.Text).ToList().ForEach(p => p.SamplePipeLenE = txtLen.Text); } else if (this.cmbPostion.Value.ToString().Equals("401221")) { list1.Where(p => p.MatNo == txtMatNo.Text).ToList().ForEach(p => p.SamplePipeLenF = txtLen.Text); } else if (this.cmbPostion.Value.ToString().Equals("401222")) { list1.Where(p => p.MatNo == txtMatNo.Text).ToList().ForEach(p => p.SamplePipeLenP = txtLen.Text); } else if (this.cmbPostion.Value.ToString().Equals("401223")) { list1.Where(p => p.MatNo == txtMatNo.Text).ToList().ForEach(p => p.SamplePipeLenQ = txtLen.Text); } } ultraGrid3_CellChange(null, null); ultraGrid3.Refresh(); //} //else if (ultraTabControl3.SelectedTab.Key == "1") //{ // list1 = portHttBatchSampleResultEntityBindingSource2.DataSource as List; //} } private void ultraGrid15_AfterRowActivate(object sender, EventArgs e) { this.ultraGrid15.UpdateData(); UltraGridRow uRow = this.ultraGrid15.ActiveRow; if (uRow == null) return; List listSource = EntityHelper.GetData( "com.steering.mes.port.mil.FrmMilBatchSampleNew.doQueryRepeateInformation", new object[] { uRow.Cells["CheckNo"].Text, uRow.Cells["JudgeStoveNo"].Text }, this.ob); pipeCheckconsignNoqualifiedEntityBindingSource2.DataSource = listSource; List listSource1 = EntityHelper.GetData( "com.steering.mes.port.vrp.FrmHttBatchSaplmeNew.doQueryRepeatRack", new object[] { uRow.Cells["JudgeStoveNo"].Text }, this.ob); portHttBatchSampleResultEntityBindingSource2.DataSource = listSource1; foreach (UltraGridRow row in this.ultraGrid17.Rows) { if (row.Cells["IsSamplePipe"].Text == "1") { row.RowSelectorAppearance.BackColor = Color.Red; } } } private void ultraGrid19_AfterRowActivate(object sender, EventArgs e) { UltraGridRow uRow = this.ultraGrid19.ActiveRow; if (uRow == null) return; List listSource = EntityHelper.GetData( "com.steering.mes.port.mil.FrmMilBatchSampleNew.doQueryRepeateInformation", new object[] { uRow.Cells["CheckNo"].Text, uRow.Cells["JudgeStoveNo"].Text }, this.ob); pipeCheckconsignNoqualifiedEntityBindingSource4.DataSource = listSource; doQueryResampleRck(uRow); doQueryChemPhy(uRow); doQueryResampleNo(uRow);//复取样委托信息 } private void doQueryResampleNo(UltraGridRow uRow) { while (dataTable6.Columns.Count > 3) { dataTable6.Columns.RemoveAt(3); } DataTable dtSample = PublicServer.GetData("com.steering.mes.port.mil.FrmMilBatchSampleNew.doQueryReDetialSampleNo", new Object[] { uRow.Cells["CheckNo"].Text, "2", "F" }, ob); dataTable6.Rows.Clear(); dtSample.AsEnumerable().GroupBy(p => new { BatchNo = p["BATCH_NO"].ToString(), Sample = p["HEAD_MAT_NO"].ToString() }).ToList() .ForEach(p => { foreach (DataRow row in p) { if (!dataTable6.Columns.Contains(row["PHY_CODE_MAX"].ToString())) { DataColumn phyCloum = new DataColumn(); phyCloum.ColumnName = row["PHY_CODE_MAX"].ToString(); phyCloum.Caption = row["PHY_NAME_MAX"].ToString(); dataTable6.Columns.Add(phyCloum); } } DataRow dr = dataTable6.NewRow(); dr["PHY_BATCH_NO"] = p.Key.BatchNo; dr["HEAD_MAT_NO"] = p.Key.Sample; dr["SAMPLE_LEN"] = p.Max(q => q["SAMPLE_LEN"]); foreach (DataRow row in p) { dr[row["PHY_CODE_MAX"].ToString()] = row["SAMPLE_COUNT"].ToString(); } dataTable6.Rows.Add(dr); }); ultraGrid21.DataBind(); GridHelper.RefreshAndAutoSize(ultraGrid21); } private void doQueryChemPhy(UltraGridRow uRow) { while (dataTable5.Columns.Count > 5) { dataTable5.Columns.RemoveAt(5); } dtPhy = PublicServer.GetData("com.steering.mes.port.mil.FrmMilBatchSampleNew.doQueryReChemPhy", new Object[] { uRow.Cells["LotNo"].Text, uRow.Cells["JudgeStoveNo"].Text, uRow.Cells["CheckNo"].Text }, ob);//查询复取样试样组 List list = new List(); if (dtPhy.Rows.Count > 0) { dtPhy.AsEnumerable().Select(p => new { Code = p["PHY_CODE_MAX"].ToString(), Name = p["PHY_NAME_MAX"].ToString() }).Distinct().ToList() .ForEach(p => { DataColumn phyCloum = new DataColumn(); phyCloum.ColumnName = p.Code; phyCloum.Caption = p.Name; dataTable5.Columns.Add(phyCloum); }); } ultraGrid20.DataBind(); GridHelper.RefreshAndAutoSize(ultraGrid20); } private void doQueryResampleRck(UltraGridRow uRow) { DataTable dtBatchNo = PublicServer.GetData("com.steering.mes.port.vrp.FrmHttBatchSaplmeNew.doQueryResampleInfo", new Object[] { uRow.Cells["JudgeStoveNo"].Text, "F" + uRow.Cells["CheckNo"].Text }, ob); dataTable5.Rows.Clear(); foreach (DataRow row in dtBatchNo.Rows) { if (row["RESAMPLE_PIPE_LEN_A"] != null && row["RESAMPLE_PIPE_LEN_A"].ToString() != "") { DataRow newRowA = dataTable5.NewRow(); newRowA["PHY_BATCH_NO"] = row["PHY_BATCH_NO"].ToString(); newRowA["MAT_NO"] = row["MAT_NO"].ToString(); newRowA["SAMPLE_PIPE_LEN"] = row["RESAMPLE_PIPE_LEN_A"].ToString(); newRowA["SAMPLE_POSTION"] = "A端"; newRowA["PHY_CODE_GROUP"] = ""; dataTable5.Rows.Add(newRowA); } if (row["RESAMPLE_PIPE_LEN_B"] != null && row["RESAMPLE_PIPE_LEN_B"].ToString() != "") { DataRow newRowA = dataTable5.NewRow(); newRowA["PHY_BATCH_NO"] = row["PHY_BATCH_NO"].ToString(); newRowA["MAT_NO"] = row["MAT_NO"].ToString(); newRowA["SAMPLE_PIPE_LEN"] = row["RESAMPLE_PIPE_LEN_B"].ToString(); newRowA["SAMPLE_POSTION"] = "B端"; newRowA["PHY_CODE_GROUP"] = ""; dataTable5.Rows.Add(newRowA); } if (row["RESAMPLE_PIPE_LEN_C"] != null && row["RESAMPLE_PIPE_LEN_C"].ToString() != "") { DataRow newRowA = dataTable5.NewRow(); newRowA["PHY_BATCH_NO"] = row["PHY_BATCH_NO"].ToString(); newRowA["MAT_NO"] = row["MAT_NO"].ToString(); newRowA["SAMPLE_PIPE_LEN"] = row["RESAMPLE_PIPE_LEN_C"].ToString(); newRowA["SAMPLE_POSTION"] = "C端"; newRowA["PHY_CODE_GROUP"] = ""; dataTable5.Rows.Add(newRowA); } if (row["RESAMPLE_PIPE_LEN_D"] != null && row["RESAMPLE_PIPE_LEN_D"].ToString() != "") { DataRow newRowA = dataTable5.NewRow(); newRowA["PHY_BATCH_NO"] = row["PHY_BATCH_NO"].ToString(); newRowA["MAT_NO"] = row["MAT_NO"].ToString(); newRowA["SAMPLE_PIPE_LEN"] = row["RESAMPLE_PIPE_LEN_D"].ToString(); newRowA["SAMPLE_POSTION"] = "D端"; newRowA["PHY_CODE_GROUP"] = ""; dataTable5.Rows.Add(newRowA); } if (row["RESAMPLE_PIPE_LEN_E"] != null && row["RESAMPLE_PIPE_LEN_E"].ToString() != "") { DataRow newRowA = dataTable5.NewRow(); newRowA["PHY_BATCH_NO"] = row["PHY_BATCH_NO"].ToString(); newRowA["MAT_NO"] = row["MAT_NO"].ToString(); newRowA["SAMPLE_PIPE_LEN"] = row["RESAMPLE_PIPE_LEN_E"].ToString(); newRowA["SAMPLE_POSTION"] = "E端"; newRowA["PHY_CODE_GROUP"] = ""; dataTable5.Rows.Add(newRowA); } if (row["RESAMPLE_PIPE_LEN_F"] != null && row["RESAMPLE_PIPE_LEN_F"].ToString() != "") { DataRow newRowA = dataTable5.NewRow(); newRowA["PHY_BATCH_NO"] = row["PHY_BATCH_NO"].ToString(); newRowA["MAT_NO"] = row["MAT_NO"].ToString(); newRowA["SAMPLE_PIPE_LEN"] = row["RESAMPLE_PIPE_LEN_F"].ToString(); newRowA["SAMPLE_POSTION"] = "F端"; newRowA["PHY_CODE_GROUP"] = ""; dataTable5.Rows.Add(newRowA); } if (row["RESAMPLE_PIPE_LEN_P"] != null && row["RESAMPLE_PIPE_LEN_P"].ToString() != "") { DataRow newRowA = dataTable5.NewRow(); newRowA["PHY_BATCH_NO"] = row["PHY_BATCH_NO"].ToString(); newRowA["MAT_NO"] = row["MAT_NO"].ToString(); newRowA["SAMPLE_PIPE_LEN"] = row["RESAMPLE_PIPE_LEN_P"].ToString(); newRowA["SAMPLE_POSTION"] = "P端"; newRowA["PHY_CODE_GROUP"] = ""; dataTable5.Rows.Add(newRowA); } if (row["RESAMPLE_PIPE_LEN_Q"] != null && row["RESAMPLE_PIPE_LEN_Q"].ToString() != "") { DataRow newRowA = dataTable5.NewRow(); newRowA["PHY_BATCH_NO"] = row["PHY_BATCH_NO"].ToString(); newRowA["MAT_NO"] = row["MAT_NO"].ToString(); newRowA["SAMPLE_PIPE_LEN"] = row["RESAMPLE_PIPE_LEN_Q"].ToString(); newRowA["SAMPLE_POSTION"] = "Q端"; newRowA["PHY_CODE_GROUP"] = ""; dataTable5.Rows.Add(newRowA); } } GridHelper.RefreshAndAutoSize(ultraGrid20); } private void ultraGrid17_CellChange(object sender, CellEventArgs e) { this.ultraGrid17.UpdateData(); ultraGrid17.Update(); if (e.Cell.Column.Key == "Chk") { if (e.Cell.Value.ToString() == "True") { e.Cell.Row.RowSelectorAppearance.BackColor = Color.Red; txtMatNo1.Text = e.Cell.Row.Cells["MatNo"].Text; } else { e.Cell.Row.RowSelectorAppearance.BackColor = Color.Empty; } } } private void txtLen1_ValueChanged(object sender, EventArgs e) { if (!StringUtil.IsInt(this.txtLen1.Text)) return; List list1 = null; list1 = portHttBatchSampleResultEntityBindingSource2.DataSource as List; if (list1.Any()) { if (this.cmbPostion1.Value.ToString().Equals("401201"))//A端 { list1.Where(p => p.MatNo == txtMatNo1.Text).ToList().ForEach(p => p.ResamplePipeLenA = txtLen1.Text); } else if (this.cmbPostion1.Value.ToString().Equals("401202")) { list1.Where(p => p.MatNo == txtMatNo1.Text).ToList().ForEach(p => p.ResamplePipeLenB = txtLen1.Text); } else if (this.cmbPostion1.Value.ToString().Equals("401217")) { list1.Where(p => p.MatNo == txtMatNo1.Text).ToList().ForEach(p => p.ResamplePipeLenC = txtLen1.Text); } else if (this.cmbPostion1.Value.ToString().Equals("401218")) { list1.Where(p => p.MatNo == txtMatNo1.Text).ToList().ForEach(p => p.ResamplePipeLenD = txtLen1.Text); } else if (this.cmbPostion1.Value.ToString().Equals("401219")) { list1.Where(p => p.MatNo == txtMatNo1.Text).ToList().ForEach(p => p.ResamplePipeLenM = txtLen1.Text); } else if (this.cmbPostion1.Value.ToString().Equals("401220")) { list1.Where(p => p.MatNo == txtMatNo1.Text).ToList().ForEach(p => p.ResamplePipeLenE = txtLen1.Text); } else if (this.cmbPostion1.Value.ToString().Equals("401221")) { list1.Where(p => p.MatNo == txtMatNo1.Text).ToList().ForEach(p => p.ResamplePipeLenF = txtLen1.Text); } else if (this.cmbPostion1.Value.ToString().Equals("401222")) { list1.Where(p => p.MatNo == txtMatNo1.Text).ToList().ForEach(p => p.ResamplePipeLenP = txtLen1.Text); } else if (this.cmbPostion1.Value.ToString().Equals("401223")) { list1.Where(p => p.MatNo == txtMatNo1.Text).ToList().ForEach(p => p.ResamplePipeLenQ = txtLen1.Text); } } GridHelper.RefreshAndAutoSize(ultraGrid17); } private void ultraGrid21_ClickCell(object sender, ClickCellEventArgs e) { if (e.Cell.Column.Key != "PHY_BATCH_NO" && e.Cell.Column.Key != "MAT_NO" && e.Cell.Column.Key != "SAMPLE_PIPE_LEN" && e.Cell.Column.Key != "SAMPLE_POSTION") { if (e.Cell.Text.Trim() == "") { e.Cell.Value = "√"; } else { e.Cell.Value = ""; } } } private void ultraGrid18_ClickCell(object sender, ClickCellEventArgs e) { if (e.Cell.Column.Key != "PHY_BATCH_NO" && e.Cell.Column.Key != "MAT_NO" && e.Cell.Column.Key != "SAMPLE_PIPE_LEN" && e.Cell.Column.Key != "SAMPLE_POSTION") { if (e.Cell.Text.Trim() == "") { e.Cell.Value = "√"; } else { e.Cell.Value = ""; } } } private void ultraGrid8_AfterRowActivate(object sender, EventArgs e) { this.ultraGrid5.UpdateData(); this.ultraGrid8.UpdateData(); UltraGridRow uRow = this.ultraGrid5.ActiveRow; UltraGridRow row = this.ultraGrid8.ActiveRow; doQueryBatchRack(uRow,row); } /// /// 按批查管号队列 /// /// /// private void doQueryBatchRack(UltraGridRow uRow, UltraGridRow row) { List listSource = EntityHelper.GetData( "com.steering.mes.port.vrp.FrmHttBatchSaplmeNew.doQueryBatchRack", new object[] { uRow.Cells["HeatPlanNo"].Text, uRow.Cells["JudgeStoveNo"].Text, row.Cells["PHY_BATCH_NO"].Text }, this.ob); portHttBatchSampleResultEntityBindingSource1.DataSource = listSource; } private void ultraGrid23_ClickCell(object sender, ClickCellEventArgs e) { if (e.Cell.Column.Key != "PHY_BATCH_NO" && e.Cell.Column.Key != "MAT_NO" && e.Cell.Column.Key != "SAMPLE_PIPE_LEN" && e.Cell.Column.Key != "SAMPLE_POSTION") { if (e.Cell.Text.Trim() == "") { e.Cell.Value = "√"; } else { e.Cell.Value = ""; } } } private void btnGetCic_Click(object sender, EventArgs e) { if (ultraGrid10.ActiveRow.Cells["Cic"].Text.ToString().Trim().Length >0) { MessageUtil.ShowTips("已有CIC信息,不需要重新获取"); return; } if (ultraGrid10.ActiveRow.Cells["HeatPlanNo"].Text.ToString().Length < 1) { MessageUtil.ShowTips("未委托信息为空!"); return; } CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "com.steering.mes.port.vrp.FrmHttBatchSaplmeNew"; ccp.MethodName = "GetCIC"; ccp.ServerParams = new object[] { ultraGrid10.ActiveRow.Cells["HeatPlanNo"].Text }; ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal); if (ccp.ReturnCode != -1) { if (ccp.ReturnInfo.Equals("获取CIC成功!")) { doQueryPlan(); MessageUtil.ShowTips(ccp.ReturnInfo); } else { MessageUtil.ShowTips(ccp.ReturnInfo); } } } } }