using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using CoreFS.CA06; using Core.StlMes.Client.Mcp.Control; using Core.Mes.Client.Comm.Server; using Core.Mes.Client.Comm.Tool; using Infragistics.Win.UltraWinGrid; using Core.Mes.Client.Comm.Control; using System.Collections; using com.steering.mes.mcp.entity; using Core.StlMes.Client.Mcp.Mch.MchResult; namespace Core.StlMes.Client.Mcp.Mch { public partial class FrmDetectResult : FrmBase { private string dingwei = ""; private string SlGx = "";//湿磁粉探伤工序 private string SlGxname = ""; private string plineCode = ""; private string[] plineCodes; private string departm = ""; private string storageNo = "";//仓库 public static string REsultno = ""; private string time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); public FrmDetectResult() { InitializeComponent(); this.IsLoadUserView = true; } private void FrmDetectResult_Load(object sender, EventArgs e) { //cmbDate.Value = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd 00:00:00")); //cmbEndDate.Value = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd 23:59:59")); departm = UserInfo.GetDepartment(); //plineCode = YdmBaseClass.GetPCode(departm, this.ob);//获取 用户 对应的产线 plineCodes = comm.GetPlineCode(this.ValidDataPurviewIds,"G",this.CustomInfo,ob); //获取工序 DataTable dt2 = ServerHelper.GetData("com.steering.mes.mcp.common.PlanService.getQueryGX", new object[] { "701302" }, this.ob); if (dt2.Rows.Count > 0) { SlGx = dt2.Rows[0]["BASECODE"].ToString(); SlGxname = dt2.Rows[0]["BASENAME"].ToString(); } frmDetectResultControl1.Ob = this.ob; frmDetectResultControl1.init(); frmDetectResultControl1.init1(); frmDetectResultControl1.type(); frmDetectResultControl1.species(); //查询仓库代码 DataTable dt = ServerHelper.GetData("com.steering.mes.mcp.common.PlanService.getStorageDep", new object[] { this.UserInfo.GetDeptid(), Core.Mes.Client.Comm.Server.ClsBaseInfo.GetDepartIdBySectionId(this.UserInfo.GetDeptid(), this.ob), "800202", "800304" }, this.ob); if (dt.Rows.Count > 0) { storageNo = dt.Rows[0]["STORAGE_NO"].ToString(); } QuerySinglePlan(); initControl(); } protected override void OnLoad(EventArgs e) { base.OnLoad(e); this.frmDetectResultControl1.Grid.DisplayLayout.Override.AllowRowFiltering = Infragistics.Win.DefaultableBoolean.False; } public override void ToolBar_Click(object sender, string ToolbarKey) { //base.ToolBar_Click(sender, ToolbarKey); switch (ToolbarKey) { case "DoQuery": QuerySinglePlan(); break; case "DoSave": DoSave(); break; case "DoReturn": DoReturn(); break; case "DoUpdate": DoUpdate(); break; case "DoBeside": DoBeside(); break; case "CelBeside": DoCelBeside(); break; case "doBesideQuery": DoBesideQuery(); break; case "doQueryOffice": DoQueryOffice(); break; case "doPrint": DoTransferPrint(); break; case "doInsert": DoInsert();//绝废录入 break; case "DoClose": this.Close(); break; } } /// /// 绝废录入 /// private void DoInsert() { UltraGridRow row = ultraGrid1.ActiveRow; if (row == null) return; string batchgroudno = row.Cells["BATCH_GROUD_NO"].Text.ToString(); string outnumcut = row.Cells["OUTNUM_CUT"].Text.ToString(); string linenum = row.Cells["num"].Text.ToString(); string plineName = row.Cells["PLINE_NAME"].Text.ToString(); string synum = row.Cells["snum"].Text.ToString(); string heartNo = row.Cells["HEAT_PLAN_NO"].Text.ToString(); DataTable dt1 = ServerHelper.GetData("com.steering.mes.mcp.Mch.FrmDetectResult.getQueryExpandResultStuts", new object[] { row.Cells["HEAT_PLAN_NO"].Text.ToString(), row.Cells["PLINE_CODE"].Text.ToString() }, this.ob); if (dt1.Rows.Count > 0) { if (dt1.Rows[0]["STATION_STATUS"].ToString() == "2") { MessageUtil.ShowTips("该工序已经结炉,不允许录入绝废支数!"); return; } } FrmScrapNumMeasureFail matfrm = new FrmScrapNumMeasureFail(heartNo, SlGx, SlGxname, batchgroudno, outnumcut, plineCodes, REsultno, linenum, plineName, this.ob); matfrm.ShowDialog(); this.ultraGrid1.UpdateData(); dingwei = row.Cells["HEAT_PLAN_NO"].Value.ToString(); QuerySinglePlan(); } /// ///传递卡打印 /// private void DoTransferPrint() { this.ultraGrid1.UpdateData(); string jugeNo = ""; string batchNo = ""; string groupNo = ""; string plinCode = ""; string heatNo = ""; //int count = 0; //ArrayList list = new ArrayList(); //foreach (UltraGridRow uRow in ultraGrid1.Rows) //{ // if (Convert.ToBoolean(uRow.Cells["CHK"].Text.ToString()) == true) // { // count += 1; UltraGridRow uRow = ultraGrid1.ActiveRow; if (uRow == null) { MessageUtil.ShowTips("请选择要打印的炉信息!"); return; } else { heatNo = uRow.Cells["HEAT_PLAN_NO"].Text.ToString(); //炉计划ID jugeNo = uRow.Cells["JUDGE_STOVE_NO"].Value.ToString(); //炉号 batchNo = uRow.Cells["BATCH_NO"].Value.ToString(); //批号 groupNo = uRow.Cells["BATCH_GROUD_NO"].Value.ToString(); //组号 plinCode = uRow.Cells["PLINE_CODE"].Value.ToString(); //产线 } // list.Add(jugeNo); // } // } //if (count == 0) //{ // MessageUtil.ShowTips("请选择需要打印的炉信息!"); // return; //} //string str = string.Join("','", (string[])list.ToArray(typeof(string))); string strurl = ""; if (plinCode.Equals("C021"))//镦粗 { strurl = "http://localhost:8075/webroot/decision/view/report?viewlet=MchDeliveryCard.cpt&heatNo=" + heatNo + "&judgeNo=" + jugeNo + "&plineCode=" + plinCode + "&groupNo=" + groupNo + "&batchNo=" + batchNo + "&abc=湿磁粉探伤"; //strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=MchDeliveryCard.cpt&T.HEAT_PLAN_NO=" + heatNo + "&T.JUDGE_STOVE_NO=" + jugeNo + "&T.PLINE_CODE=" + plinCode + "&T2.BATCH_GROUD_NO=" + batchNo + "&TT.STATION_DESC='上料'" ; } else { strurl = "http://localhost:8075/webroot/decision/view/report?viewlet=MchDeliveryCard.cpt&heatNo=" + heatNo + "&judgeNo=" + jugeNo + "&plineCode=" + plinCode + "&groupNo=" + groupNo + "&batchNo=" + batchNo + "&abc=湿磁粉探伤"; //strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=MchDeliveryCard.cpt&T.HEAT_PLAN_NO=" + heatNo + "&T.JUDGE_STOVE_NO=" + jugeNo + "&T.PLINE_CODE" + plinCode + "&T2.BATCH_GROUD_NO=" + batchNo + "&TT.STATION_DESC='上料'"; } FrmRepExcel fre = new FrmRepExcel(this.ob, strurl); fre.AutoSize = true; fre.MaximumSize = new Size(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height); fre.WindowState = FormWindowState.Maximized; fre.Show(); } private void DoQueryOffice() { string heatno = ""; string plinename = ""; UltraGridRow urg = ultraGrid1.ActiveRow; if (urg != null) { heatno = urg.Cells["HEAT_PLAN_NO"].Value.ToString(); plinename = urg.Cells["PLINE_NAME"].Text.ToString(); } FrmOfficeDirect matfrm = new FrmOfficeDirect(this.ob, urg, SlGxname); matfrm.ShowDialog(); } private void DoBesideQuery() { //DataTable dt = ServerHelper.GetData("com.steering.mes.mcp.Mch.FrmCrackDetectResult.getMchBugD", new object[] { txtZyBatchId.Text.ToString(), txtRollBatchId.Text.ToString(), plineCode, start }, this.ob); //GridHelper.CopyDataToDatatable(ref dt, ref dataTable2, true); string heatno = ""; string lotno = ""; string plinename = ""; UltraGridRow urg = ultraGrid1.ActiveRow; if (urg != null) { heatno = urg.Cells["HEAT_PLAN_NO"].Value.ToString(); lotno = urg.Cells["BATCH_NO"].Value.ToString(); plinename = urg.Cells["PLINE_NAME"].Text.ToString(); } FrmReason matfrm = new FrmReason(this.ob, urg, SlGxname); matfrm.ShowDialog(); } private void DoCelBeside() { UltraGridRow row = ultraGrid2.ActiveRow; if (row == null) return; ArrayList list = new ArrayList(); list.Add(row.Cells["HEAT_PLAN_NO"].Value.ToString()); list.Add(row.Cells["PLINE_CODE"].Value.ToString()); list.Add(SlGx); if (MessageUtil.ShowYesNoAndQuestion("是否撤销结炉?") == DialogResult.No) { return; } CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "com.steering.mes.mcp.Mch.FrmDetectResult"; ccp.MethodName = "undoBeside"; ccp.ServerParams = new Object[] { list }; ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal); if (ccp.ReturnCode != -1) { MessageUtil.ShowTips(ccp.ReturnInfo); if (ccp.ReturnInfo.Equals("撤销结炉成功!")) { dingwei = row.Cells["HEAT_PLAN_NO"].Value.ToString(); QuerySinglePlan(); initControl(); } } } /// /// 工序结炉 /// private void DoBeside() { UltraGridRow row = ultraGrid2.ActiveRow; if (row == null) { MessageUtil.ShowTips("请选择需要结炉的工单号!"); return; } ArrayList list = new ArrayList(); list.Add(row.Cells["HEAT_PLAN_NO"].Value.ToString()); list.Add(row.Cells["PLINE_CODE"].Value.ToString()); list.Add(SlGx); if (MessageUtil.ShowYesNoAndQuestion("是否结炉?") == DialogResult.No) { return; } CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "com.steering.mes.mcp.Mch.FrmDetectResult"; ccp.MethodName = "updateDoBeside"; ccp.ServerParams = new Object[] { list }; ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal); if (ccp.ReturnCode != -1) { MessageUtil.ShowTips(ccp.ReturnInfo); if (ccp.ReturnInfo.Equals("结炉成功!")) { dingwei = row.Cells["HEAT_PLAN_NO"].Value.ToString(); QuerySinglePlan(); initControl(); } } } /// /// 简单查询 /// private void QuerySinglePlan() { string starts = ""; string plnNo = ""; string judgeStoveNo = ""; string index = ""; string dobeside = ""; #region 条件 if (chkPlnNo.Checked) { if (string.IsNullOrEmpty(txtRollBatchId.Text.Trim())) { MessageUtil.ShowTips("请输入炉次计划号!"); return; } else { plnNo = txtRollBatchId.Text.ToString().Trim(); } } if (chkJuNo.Checked) { if (string.IsNullOrEmpty(txtZyBatchId.Text.Trim())) { MessageUtil.ShowTips("请输入炉号!"); return; } else { judgeStoveNo = txtZyBatchId.Text.ToString().Trim(); } } #endregion //string[] start = contorlPlanStatus1.statusArr; if (ultraOptionSet1.CheckedIndex.ToString() == "0") { index = "0"; dobeside = this.ultraOptionSet1.CheckedItem.DataValue.ToString(); } else { index = "1"; dobeside = this.ultraOptionSet1.CheckedItem.DataValue.ToString(); } DataTable dt = ServerHelper.GetData("com.steering.mes.mcp.common.PlanService.getSingleJGPlan", new object[] { judgeStoveNo, plnNo, plineCodes, dobeside, index }, this.ob); GridHelper.CopyDataToDatatable(ref dt, ref dataTable2, true); GridHelper.RefreshAndAutoSize(this.ultraGrid1); foreach (UltraGridRow urg in ultraGrid1.Rows) { if (urg.Cells["PLANSTATUS"].Text.Equals("生产中")) { urg.Cells["PLANSTATUS"].Appearance.BackColor = Color.LightGreen; } if (urg.Cells["PLANSTATUS"].Text.Equals("生产完成")) { urg.Cells["PLANSTATUS"].Appearance.BackColor = Color.Red; } if (urg.Cells["PLANSTATUS"].Text.Equals("关闭")) { urg.Cells["PLANSTATUS"].Appearance.BackColor = Color.Red; } if (urg.Cells["BESIDE_STATUS"].Text.Equals("湿磁粉探伤结束")) { urg.Cells["BESIDE_STATUS"].Appearance.BackColor = Color.LightGray; } } foreach (UltraGridRow urg in ultraGrid1.Rows) { if (urg != null) { urg.Cells["snum"].Appearance.BackColor = Color.OrangeRed; } } if (dt.Rows.Count > 0) { for (int i = 0; i < ultraGrid1.Rows.Count; i++) { if (ultraGrid1.Rows[i].Cells["HEAT_PLAN_NO"].Value.ToString() == dingwei) { UltraGridRow row = ultraGrid1.Rows[i]; row.Activate(); } } } dingwei = ""; } /// /// 上料计划详情 /// /// /// private void ultraGrid2_AfterRowActivate(object sender, EventArgs e) { this.getUltraGrid1AfterRowActivate(); } private void getUltraGrid1AfterRowActivate() { UltraGridRow urg = ultraGrid1.ActiveRow; if (urg == null) return; ultraGrid2.UpdateData(); UltraGridRow row = ultraGrid2.ActiveRow; if (row == null) return; string outnumcut = urg.Cells["OUTNUM_CUT"].Text.ToString(); string heatNo = row.Cells["HEAT_PLAN_NO"].Value.ToString(); frmDetectResultControl1.ResultNo = row.Cells["RESULT_NO"].Value.ToString(); string resultno = row.Cells["RESULT_NO"].Value.ToString(); REsultno = row.Cells["RESULT_NO"].Value.ToString(); //查询加工管号队列合格的支、吨 DataTable dt2 = ServerHelper.GetData("com.steering.mes.mcp.common.PlanService.getQueryRCLPortVrp2", new object[] { heatNo }, ob); MchMtResultEntity result = new MchMtResultEntity(); //if (row.Cells["IF_MONITOR_RCL"].Text.ToString().Equals("是")) //{ // this.instructionCardControl1.Grid.DisplayLayout.Bands[0].Columns["Producer"].CellActivation = Infragistics.Win.UltraWinGrid.Activation.AllowEdit; // this.instructionCardControl1.Grid.DisplayLayout.Bands[0].Columns["ProducerTime"].CellActivation = Infragistics.Win.UltraWinGrid.Activation.AllowEdit; //} //else //{ // this.instructionCardControl1.Grid.DisplayLayout.Bands[0].Columns["Producer"].CellActivation = Infragistics.Win.UltraWinGrid.Activation.ActivateOnly; // this.instructionCardControl1.Grid.DisplayLayout.Bands[0].Columns["ProducerTime"].CellActivation = Infragistics.Win.UltraWinGrid.Activation.ActivateOnly; //} //instructionCardControl1.JudNo = row.Cells["HEATNO_LAST"].Text.ToString(); //instructionCardControl1.BatchNo = row.Cells["ZG_BATCH_NO"].Text.ToString(); //instructionCardControl1.GroupNo = row.Cells["BATCH_GROUD_NO"].Text.ToString(); //instructionCardControl1.Ob = this.ob; //string time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); //result.ProNum = row.Cells["ACT_COUNT"].Text.ToString(); // result.ProWt = row.Cells["ACT_WEIGHT"].Text.ToString(); result.ProShift = UserInfo.GetUserOrder(); result.ProGroup = UserInfo.GetUserGroup(); //result.CreateUser = UserInfo.GetUserName(); //result.ColTime = time; result.CreateTime = row.Cells["CREATE_TIME"].Text.ToString(); result.CreateUser = row.Cells["CREATE_USER"].Text.ToString(); result.CtrStiCurInt = row.Cells["CTR_STI_CUR_INT"].Text.ToString(); result.DemagVol = row.Cells["DEMAG_VOL"].Text.ToString(); result.DubiousNum = row.Cells["DUBIOUS_NUM"].Text.ToString(); result.FailNum = row.Cells["FAIL_NUM"].Text.ToString(); result.FpassNum = row.Cells["FPASS_NUM"].Text.ToString(); result.FtestingNum = row.Cells["FTESTING_NUM"].Text.ToString(); result.HeatPlanNo = row.Cells["HEAT_PLAN_NO"].Text.ToString(); result.MagSuspLiqCon = row.Cells["MAG_SUSP_LIQ_CON"].Text.ToString(); result.MtNote = row.Cells["MT_NOTE"].Text.ToString(); result.MtType = row.Cells["MT_TYPE"].Text.ToString(); result.ProGroup = row.Cells["PRO_GROUP"].Value.ToString(); result.ProShift = row.Cells["PRO_SHIFT"].Text.ToString(); result.ShimMagIndic = row.Cells["SHIM_MAG_INDIC"].Text.ToString(); result.ShimMagType = row.Cells["SHIM_MAG_TYPE"].Text.ToString(); result.SignMan = row.Cells["SIGN_ISSUED"].Text.ToString(); result.SignManGrade = row.Cells["SIGN_MAN_GRADE"].Text.ToString(); result.TestingGrade1 = row.Cells["TESTING_GRADE1"].Text.ToString(); result.TestingGrade2 = row.Cells["TESTING_GRADE2"].Text.ToString(); result.TestingGrade3 = row.Cells["TESTING_GRADE3"].Text.ToString(); result.TestingGrade4 = row.Cells["TESTING_GRADE4"].Text.ToString(); result.TestingStandard1 = row.Cells["TESTING_STANDARD1"].Text.ToString(); result.TestingStandard2 = row.Cells["TESTING_STANDARD2"].Text.ToString(); result.TestingStandard3 = row.Cells["TESTING_STANDARD3"].Text.ToString(); result.TestingStandard4 = row.Cells["TESTING_STANDARD4"].Text.ToString(); result.TetNum = row.Cells["TET_NUM"].Text.ToString(); result.UpdateName = row.Cells["UPDATE_NAME"].Text.ToString(); result.UpdateTime = row.Cells["UPDATE_TIME"].Text.ToString(); result.ProNum = dt2.Rows[0]["ACT_COUNT"].ToString(); this.frmDetectResultControl1.Value = result; if(row.Cells["FAIL_NUM"].Value.ToString()=="0") { CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "com.steering.mes.mcp.Mch.FrmCrackDetectResult"; ccp.MethodName = "getqueryfailnum"; ccp.ServerParams = new Object[] { resultno }; ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal); } //查询实绩里不同分切数的加工支数 DataTable dt3 = ServerHelper.GetData("com.steering.mes.mcp.Mch.FrmDetectResult.getQueryNum", new object[] { heatNo, outnumcut }, ob); int num = 0; int fnum = 0; UltraGridRow uggr = ultraGrid2.ActiveRow; string outnum = uggr.Cells["OUTNUM_CUT"].Text.ToString(); foreach (UltraGridRow ugr in ultraGrid2.Rows) { if (ugr.Cells["OUTNUM_CUT"].Text.ToString() == outnum) { num = num + Convert.ToInt32(dt3.Rows[0]["TET_NUM"].ToString()); fnum = fnum + Convert.ToInt32(dt3.Rows[0]["FAIL_NUM"].ToString()); } } UltraGridRow uug = ultraGrid1.ActiveRow; if (uug != null) { uug.Cells["num"].Value = num; if (FrmScrapNumMeasureFail.CrNum != 0) { uug.Cells["snum"].Value = Convert.ToInt32(dt2.Rows[0]["ACT_COUNT"].ToString()) - num - Convert.ToInt32(FrmScrapNumMeasureFail.CrNum); } else { uug.Cells["snum"].Value = Convert.ToInt32(dt2.Rows[0]["ACT_COUNT"].ToString()) - num; } if (Convert.ToInt32(uug.Cells["snum"].Value) <= 0) { uug.Cells["snum"].Value = 0; } } frmDetectResultControl1.fenum = uug.Cells["snum"].Value.ToString(); } /// /// 根据计划号查询湿磁粉探伤实绩 /// /// public void GetLoadResult(string heatNo) { DataTable dt = ServerHelper.GetData("com.steering.mes.mcp.Mch.FrmDetectResult.getQueryExpandResult", new object[] { heatNo }, this.ob); GridHelper.CopyDataToDatatable(ref dt, ref dtLoadRecord, true); } /// /// 初始化控件 /// private void initControl() { ultraGrid1.UpdateData(); UltraGridRow row = ultraGrid1.ActiveRow; if (row == null) return; string outnumcut = row.Cells["OUTNUM_CUT"].Text.ToString(); string heatNo = row.Cells["HEAT_PLAN_NO"].Value.ToString(); //查询加工管号队列合格的支、吨 DataTable dt2 = ServerHelper.GetData("com.steering.mes.mcp.common.PlanService.getQueryRCLPortVrp3", new object[] { heatNo,outnumcut }, ob); MchMtResultEntity result = new MchMtResultEntity(); //string time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); //DataTable dt1 = ServerHelper.GetData("com.steering.mes.mcp.Mch.FrmMcpLoading.getTime", null, this.ob); result.ProShift = UserInfo.GetUserOrder(); result.ProGroup = UserInfo.GetUserGroup(); result.CreateUser = UserInfo.GetUserName(); //result.ColTime = time; result.CreateTime = time; result.ProducerTime = time; result.ProNum = dt2.Rows[0]["ACT_COUNT"].ToString(); this.frmDetectResultControl1.Value = result; } /// /// 湿磁粉探伤实绩保存 /// private void DoSave() { if (this.frmDetectResultControl1.ValidInput1()) { string batchgroudno = "";//组号 string outnumcut = "";//分切数 string lengthin = "";//长度 string lengthmaxin = "";//长度上限 string lengthminin = "";//长度下限 int synum = 0; ArrayList dname = new ArrayList(); ArrayList fname = new ArrayList(); if (Core.StlMes.Client.Mcp.Control.FrmScrap.dName != null) { dname = Core.StlMes.Client.Mcp.Control.FrmScrap.dName; } if (Core.StlMes.Client.Mcp.Control.FrmScrap.fName != null) { fname = Core.StlMes.Client.Mcp.Control.FrmScrap.fName; } ArrayList jfname = new ArrayList(); if (FrmScrapNumMeasureFail.CrName != null) { jfname = FrmScrapNumMeasureFail.CrName; } UltraGridRow row = ultraGrid1.ActiveRow; if (row != null) { synum = Convert.ToInt32(row.Cells["snum"].Text.ToString()); if (synum <= 0) { MessageUtil.ShowTips("剩余支数小于等于0,无法新增!"); return; } batchgroudno = row.Cells["BATCH_GROUD_NO"].Text.ToString(); outnumcut = row.Cells["OUTNUM_CUT"].Text.ToString(); lengthin = row.Cells["LENGTH_IN"].Text.ToString(); lengthminin = row.Cells["LENGTHMIN_IN"].Text.ToString(); lengthmaxin = row.Cells["LENGTHMAX_IN"].Text.ToString(); this.frmDetectResultControl1.UpdateData(); MchMtResultEntity result = this.frmDetectResultControl1.Value; if (result.ProNum == "" || result.ProNum == null) { result.ProNum = "0"; } if (result.FailNum == "" || result.FailNum == null) { result.FailNum = "0"; } if (result.DubiousNum == "" || result.DubiousNum == null) { result.DubiousNum = "0"; } if (result.FpassNum == "" || result.FpassNum == null) { result.FpassNum = "0"; } if (result.FtestingNum == "" || result.FtestingNum == null) { result.FtestingNum = "0"; } result.ZyBatchId = row.Cells["ZY_BATCH_ID"].Value.ToString(); result.HeatPlanNo = row.Cells["HEAT_PLAN_NO"].Value.ToString(); if (result.ProNum == "0") { MessageUtil.ShowTips("检验支数是零,不允许新增!"); return; } string tetnum = ""; foreach (UltraGridRow rgg in ultraGrid2.Rows) { if (rgg != null) { tetnum = Convert.ToString(Convert.ToInt32(rgg.Cells["TET_NUM"].Value.ToString()) + Convert.ToInt32(result.TetNum)); } } string heatNo = row.Cells["HEAT_PLAN_NO"].Value.ToString(); //查询加工管号队列合格的支、吨 int count = 0; double weghit = 0; DataTable dt2 = ServerHelper.GetData("com.steering.mes.mcp.common.PlanService.getQueryRCLPortVrp2", new object[] { heatNo }, ob); if (dt2.Rows.Count > 0) { count = int.Parse(dt2.Rows[0]["ACT_COUNT"].ToString()); weghit = Double.Parse(dt2.Rows[0]["ACT_WEIGHT"].ToString()); } if (int.Parse(result.ProNum) > count) { MessageUtil.ShowTips("合格支数不能超过管号队列合格的支数!"); return; } if (result.ProNum.Equals("0") && result.FailNum.Equals("0")) { MessageUtil.ShowTips("合格支数与废品支数都是零,无法新增!!"); return; } //查询探伤实绩合格支数的和 DataTable dt1 = ServerHelper.GetData("com.steering.mes.mcp.Mch.FrmDetectResult.getQueryExpandResult1", new object[] { row.Cells["HEAT_PLAN_NO"].Value.ToString() }, this.ob); //VrpLoadingResultEntity result1 = new VrpLoadingResultEntity(); //this.planExpanQuery1.Value = result; string pronum = ""; if (dt1.Rows.Count > 0) { pronum = dt1.Rows[0]["PRO_NUM"].ToString(); } else { pronum = "0"; } if (count == 0) { if (int.Parse(pronum) + int.Parse(result.ProNum) >= count) { MessageUtil.ShowTips("探伤实绩合格支数和作业实绩合格支数的和超过或等于管号队列合格支数,无法新增!!"); return; } } else { if (int.Parse(pronum) + int.Parse(result.ProNum) > count) { MessageUtil.ShowTips("探伤实绩合格支数和作业实绩合格支数的和超过管号队列合格支数,无法新增!!"); return; } } if (FrmScrapNumMeasureFail.CrNum != 0) { result.ProNum = Convert.ToString(int.Parse(result.ProNum) - FrmScrapNumMeasureFail.CrNum); if (result.ProWt == null || result.ProWt=="") { result.ProWt = "0.00"; } else { result.ProWt = Convert.ToString(FrmScrapNumMeasureFail.CrNum * (int.Parse(result.ProNum) / double.Parse(result.ProWt))); } } CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "com.steering.mes.mcp.Mch.FrmDetectResult"; ccp.MethodName = "saveExpandResult"; ccp.ServerParams = new Object[] { result, heatNo, SlGx, row.Cells["PLINE_CODE"].Value.ToString(), tetnum, batchgroudno, outnumcut, lengthin, lengthmaxin, lengthminin, dname, fname, jfname }; ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal); if (ccp.ReturnCode != -1) { MessageUtil.ShowTips(ccp.ReturnInfo); if (ccp.ReturnInfo.Equals("新增湿磁粉探伤成功!")) { dingwei = row.Cells["HEAT_PLAN_NO"].Value.ToString(); QuerySinglePlan(); initControl(); jfname.Clear(); fname.Clear(); FrmScrapNumMeasureFail.query(heatNo); } } } } } /// /// 撤销湿磁粉探伤 /// private void DoReturn() { int nnum = 0; UltraGridRow row = ultraGrid2.ActiveRow; UltraGridRow Rows = ultraGrid2.ActiveRow; if (Rows == null) return; if (row != null) { int detCount = 0; detCount = int.Parse(row.Cells["FAIL_NUM"].Text.ToString()); string outnumcut = row.Cells["OUTNUM_CUT"].Text.ToString(); int delCount = 0; ArrayList list = new ArrayList(); delCount += 1; ArrayList list1 = new ArrayList(); list1.Add(Rows.Cells["RESULT_NO"].Value.ToString()); list1.Add(Rows.Cells["ZY_BATCH_ID"].Value.ToString()); list1.Add(Rows.Cells["HEAT_PLAN_NO"].Value.ToString()); if (delCount == 0) { MessageUtil.ShowTips("请选择湿磁粉探伤信息!"); return; } string tetnum = ""; UltraGridRow urg = ultraGrid2.ActiveRow; if (urg != null) { tetnum = urg.Cells["TET_NUM"].Value.ToString(); } DataTable dt = ServerHelper.GetData("com.steering.mes.mcp.Mch.FrmDriftDiameterResult.getQueryJFailNum", new object[] { row.Cells["RESULT_NO"].Value.ToString(), row.Cells["HEAT_PLAN_NO"].Value.ToString(), row.Cells["PLINE_CODE"].Value.ToString() }, this.ob); if (dt.Rows.Count > 0) { nnum = int.Parse(dt.Rows[0]["FAIL_NUM"].ToString()); } CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "com.steering.mes.mcp.Mch.FrmDetectResult"; ccp.MethodName = "deleteVrpExpandResult"; ccp.ServerParams = new Object[] { list1, Rows.Cells["HEAT_PLAN_NO"].Value.ToString(), row.Cells["PLINE_CODE"].Value.ToString(), SlGx, tetnum, outnumcut, nnum,detCount }; ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal); if (ccp.ReturnCode != -1) { MessageUtil.ShowTips(ccp.ReturnInfo); if (ccp.ReturnInfo.Equals("删除湿磁粉探伤成功!")) { dingwei = row.Cells["HEAT_PLAN_NO"].Value.ToString(); QuerySinglePlan(); initControl(); } } this.getUltraGrid1AfterRowActivate(); } } /// /// 修改 /// private void DoUpdate() { UltraGridRow row = ultraGrid1.ActiveRow; UltraGridRow urg = ultraGrid2.ActiveRow; if (urg == null) return; if (row == null) return; if (this.frmDetectResultControl1.ValidInput1()) { this.frmDetectResultControl1.UpdateData(); MchMtResultEntity result = this.frmDetectResultControl1.Value; //ArrayList list1 = new ArrayList(); result.HeatPlanNo = urg.Cells["HEAT_PLAN_NO"].Value.ToString(); result.ResultNo = urg.Cells["RESULT_NO"].Value.ToString(); CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "com.steering.mes.mcp.Mch.FrmDetectResult"; ccp.MethodName = "updateVrpExpandResult"; ccp.ServerParams = new Object[] { result, urg.Cells["RESULT_NO"].Value.ToString(), row.Cells["PLINE_CODE"].Value.ToString(), SlGx }; ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal); if (ccp.ReturnCode != -1) { MessageUtil.ShowTips(ccp.ReturnInfo); } this.getUltraGrid1AfterRowActivate(); } } private void ultraGrid1_AfterRowActivate(object sender, EventArgs e) { ultraGrid1.UpdateData(); UltraGridRow urg = ultraGrid1.ActiveRow; if (urg == null) return; string outnumcut = urg.Cells["OUTNUM_CUT"].Text.ToString(); string heatNo = urg.Cells["HEAT_PLAN_NO"].Value.ToString(); frmDetectResultControl1.heatNo = urg.Cells["HEAT_PLAN_NO"].Value.ToString(); plineCode = urg.Cells["PLINE_CODE"].Value.ToString(); //查询加工管号队列合格的支、吨 DataTable dt2 = ServerHelper.GetData("com.steering.mes.mcp.common.PlanService.getQueryRCLPortVrp3", new object[] { heatNo,outnumcut }, ob); if (urg != null) { urg.Cells["snum"].Value = dt2.Rows[0]["ACT_COUNT"].ToString(); if (urg.Cells["num"].Value.ToString() == "" || urg.Cells["num"].Value.ToString() == null) { urg.Cells["num"].Value = "0"; } } frmDetectResultControl1.fenum = urg.Cells["snum"].Text.ToString(); MchMtResultEntity result = new MchMtResultEntity(); //string time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); //DataTable dt1 = ServerHelper.GetData("com.steering.mes.mcp.Mch.FrmMcpLoading.getTime", null, this.ob); //result.ProNum = row.Cells["ACT_COUNT"].Text.ToString(); // result.ProWt = row.Cells["ACT_WEIGHT"].Text.ToString(); result.ProShift = UserInfo.GetUserOrder(); result.ProGroup = UserInfo.GetUserGroup(); result.CreateUser = UserInfo.GetUserName(); //result.RroTime = time; result.CreateTime = time; result.TetNum = dt2.Rows[0]["ACT_COUNT"].ToString(); result.ProNum = dt2.Rows[0]["ACT_COUNT"].ToString(); this.frmDetectResultControl1.Value = result; this.GetLoadResult(heatNo); frmDetectResultControl1.Ob = this.ob; frmDetectResultControl1.init(urg.Cells["PLINE_NAME"].Text.ToString()); frmDetectResultControl1.plinCode = plineCode; frmDetectResultControl1.SlGx = SlGx; //查询管号队列 DataTable dt = ServerHelper.GetData("com.steering.mes.mcp.common.PlanService.getQueryJGPortVrphot", new object[] { heatNo }, this.ob); GridHelper.CopyDataToDatatable(ref dt, ref dataTable3, true); GridHelper.RefreshAndAutoSize(this.ultraGrid4); foreach (UltraGridRow urg1 in ultraGrid4.Rows) { if (urg1.Cells["MAT_STATUS"].Text.Equals("剔除")) { urg1.Cells["MAT_STATUS"].Appearance.ForeColor = Color.Red; } if (urg1.Cells["MAT_STATUS"].Text.Equals("绝废")) { urg1.Cells["MAT_STATUS"].Appearance.ForeColor = Color.Red; } } } private void chkStarts_CheckedChanged(object sender, EventArgs e) { if (chkPlnNo.Checked) { txtRollBatchId.Enabled = true; } else { txtRollBatchId.Enabled = false; } if (chkJuNo.Checked) { txtZyBatchId.Enabled = true; } else { txtZyBatchId.Enabled = false; } } private void BtOffline_Click(object sender, EventArgs e) { UltraGridRow row = ultraGrid1.ActiveRow; if (row == null) return; string batchgroudno = row.Cells["BATCH_GROUD_NO"].Text.ToString(); string outnumcut = row.Cells["OUTNUM_CUT"].Text.ToString(); UltraGridRow row3 = ultraGrid4.ActiveRow; if (row3 == null) return; MchMtResultEntity result = this.frmDetectResultControl1.Value; if (OfflineNum.Value.ToString().Equals("0")) { MessageUtil.ShowTips("请输入离线支数!"); return; } ArrayList list = new ArrayList(); list.Add(row.Cells["HEAT_PLAN_NO"].Value.ToString()); list.Add(SlGx); list.Add(SlGxname); list.Add(this.UserInfo.GetUserName()); list.Add(time); list.Add(this.UserInfo.GetUserOrder()); list.Add(this.UserInfo.GetUserGroup()); list.Add(OfflineNum.Value.ToString()); if (MessageUtil.ShowYesNoAndQuestion("是否离线?") == DialogResult.No) return; CoreClientParam ccp = new CoreClientParam(); try { this.Cursor = Cursors.WaitCursor; //控制鼠标的样式为等待 if (Constant.WaitingForm == null) { Constant.WaitingForm = new WaitingForm(); } Constant.WaitingForm.ShowToUser = true; Constant.WaitingForm.Show(); Constant.WaitingForm.Update(); ccp.ServerName = "com.steering.mes.mcp.Mch.FrmDetectResult"; ccp.MethodName = "offLineExpandResult"; ccp.ServerParams = new Object[] { result, list, row.Cells["PLINE_CODE"].Value.ToString(), storageNo, batchgroudno, outnumcut }; ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal); this.Cursor = Cursors.Default; Constant.WaitingForm.ShowToUser = false; Constant.WaitingForm.Close(); Constant.WaitingForm = null; } catch (Exception ex) { this.Cursor = Cursors.Default; Constant.WaitingForm.ShowToUser = false; Constant.WaitingForm.Close(); Constant.WaitingForm = null; } if (ccp.ReturnCode != -1) { MessageUtil.ShowTips(ccp.ReturnInfo); if (ccp.ReturnInfo.Equals("离线成功!")) { QuerySinglePlan(); } } } //工艺文件查询 private void craftImg_EditorButtonClick(object sender, Infragistics.Win.UltraWinEditors.EditorButtonEventArgs e) { UltraGridRow row = ultraGrid1.ActiveRow; string craftPath = YdmBaseClass.getQueryCraftNo(row.Cells["CRAFT_FILE_NO"].Text.ToString(),row.Cells["CRAFT_SEQ"].Text.ToString(), ob); if (e.Button.Key.ToLower().Equals("select")) { FormFileDown down = new FormFileDown(ob, craftPath); down.CtrlFileDown1.Button3.Visible = false; down.ShowDialog(); } } private void OfflineNum_EditorButtonClick(object sender, Infragistics.Win.UltraWinEditors.EditorButtonEventArgs e) { UltraGridRow row = ultraGrid1.ActiveRow; if (row == null) return; string batchgroudno = row.Cells["BATCH_GROUD_NO"].Text.ToString(); string outnumcut = row.Cells["OUTNUM_CUT"].Text.ToString(); string heno = row.Cells["HEAT_PLAN_NO"].Text.ToString(); string linenum = row.Cells["num"].Text.ToString(); string plineName = row.Cells["PLINE_NAME"].Text.ToString(); DataTable dt1 = ServerHelper.GetData("com.steering.mes.mcp.Mch.FrmDetectResult.getQueryExpandResultStuts", new object[] { heno, row.Cells["PLINE_CODE"].Text.ToString() }, this.ob); if (dt1.Rows.Count>0) { if (dt1.Rows[0]["STATION_STATUS"].ToString() == "2") { MessageUtil.ShowTips("该工序已经结炉,不允许录入离线数!"); return; } } UltraGridRow urg = ultraGrid2.ActiveRow; if (urg == null) return; UltraGridRow row3 = ultraGrid4.ActiveRow; if (row3 == null) return; MchMtResultEntity result = this.frmDetectResultControl1.Value; FrmScrapNumDetect matfrm = new FrmScrapNumDetect(result, heno, SlGx, SlGxname, batchgroudno, outnumcut, storageNo, plineCode, REsultno,linenum,plineName, this.ob); matfrm.ShowDialog(); this.ultraGrid1.UpdateData(); QuerySinglePlan(); } } }