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 Infragistics.Win.UltraWinGrid; using Core.StlMes.Client.Mcp.Common; using Core.Mes.Client.Comm.Server; using Core.Mes.Client.Comm.Control; using com.steering.mes.mcp.entity; using Core.StlMes.Client.Mcp.CollarMaterial; using Core.Mes.Client.Comm.Tool; using System.Collections; using Core.StlMes.Client.Mcp.Control; using Core.StlMes.Client.Mcp.Entity; using Core.StlMes.Client.Mcp.Report; namespace Core.StlMes.Client.Mcp.Coupling { public partial class FrmSandBlast : FrmBase { private string departm = "";//获取部门ID private string[] plineCode = null;//获取产线代码 private string PsGx = "";//喷砂工序 private string PsName = "";//喷砂工序名称 private string LiXian = ""; private string StrMemo = "";//备注 private string[] plineCodes; private int CutPiece = 0; private int sandPiece = 0; public FrmSandBlast() { InitializeComponent(); } protected override void OnLoad(EventArgs e) { base.OnLoad(e); ////禁控件过滤 //this.coupWoIdPlanControl1.Grid.DisplayLayout.Override.AllowRowFiltering = Infragistics.Win.DefaultableBoolean.False; ////设置计划区控件只读 ////this.coupWoIdPlanControl1.SetAllColumnsActiveOnly(); //coupWoIdPlanControl1.Ob = this.ob; } private void FrmSandBlast_Load(object sender, EventArgs e) { EntityHelper.ShowGridCaption(ultraGridWoId.DisplayLayout.Bands[0]); EntityHelper.ShowGridCaption(ultraGrid1.DisplayLayout.Bands[0]); departm = UserInfo.GetDeptid(); //plineCode = McpBaseHelper.GetPCodePline(departm, this.ob); plineCodes = comm.GetPlineCode(this.ValidDataPurviewIds, "H", ob); ProTime.Value = DateTime.Today; //获取工序 DataTable dt2 = ServerHelper.GetData("com.steering.mes.mcp.common.PlanService.getQueryGX", new object[] { "700308" }, this.ob); if (dt2.Rows.Count > 0) { PsGx = dt2.Rows[0]["BASECODE"].ToString(); PsName = dt2.Rows[0]["BASENAME"].ToString(); } txtBz.Value = this.UserInfo.GetUserOrder(); txtBC.Value = this.UserInfo.GetUserGroup(); txtUser.Text = this.UserInfo.GetUserName(); //获取废品原因 DataTable dt = ServerHelper.GetData("com.steering.mes.mcp.coup.CoupCutService.getCutResultFp", new object[] { "7007" }, this.ob); cmbReason.DataSource = dt; cmbReason.ValueMember = "BASENAME"; YdmBaseClass.SetComboItemHeight(cmbReason); //获取喷料 DataTable dt1 = ServerHelper.GetData("com.steering.mes.mcp.coup.CoupCutService.getCutResultFp", new object[] { "7005" }, this.ob); cmbSpray.DataSource = dt1; cmbSpray.ValueMember = "BASENAME"; YdmBaseClass.SetComboItemHeight(cmbSpray); //获取喷砂设备 DataTable dt3 = ServerHelper.GetData("com.steering.mes.mcp.coup.CoupCutService.getCutResultFp", new object[] { "7006" }, this.ob); cmbEquipment.DataSource = dt3; cmbEquipment.ValueMember = "BASENAME"; YdmBaseClass.SetComboItemHeight(cmbEquipment); } public override void ToolBar_Click(object sender, string ToolbarKey) { switch (ToolbarKey) { case "DoQuery": QuerySinglePlan(); break; case "DoSave": DoSave(); break; case "DoDelete": DoDelete(); break; case "DoUpdate": DoUpdate(); break; case "DoComplete": DoComplete(); break; case "UnDoComplete": UnDoComplete(); break; case "Offline"://离线 Offline(); break; case "unOffline"://撤销离线 unOffline(); break; case "Confirm": confirm();//确认 break; case "CancelConfirm": cancelConfirm(); break; case "DoClose": this.Close(); break; } } /// /// 取消确认 /// private void cancelConfirm() { ultraGrid1.UpdateData(); UltraGridRow uRow = this.ultraGrid1.ActiveRow; if (uRow == null) { MessageUtil.ShowTips("无喷砂实绩!"); return; } UltraGridRow row = this.ultraGridWoId.ActiveRow; if (row == null) { MessageUtil.ShowTips("无工单信息,不允许此操作!"); } ArrayList list1 = new ArrayList(); int UpdaCount = 0; foreach (UltraGridRow ugr in ultraGrid1.Rows) { if (Convert.ToBoolean(ugr.Cells["CHK"].Text) == true) { if (ugr.Cells["CONFIRM"].Value.ToString().Equals("0")) { MessageUtil.ShowTips("选中有没确认实绩,不允许取消确认!"); return; } UpdaCount += 1; ArrayList list = new ArrayList(); list.Add(ugr.Cells["RESULT_NO"].Text.ToString()); list.Add(UserInfo.GetUserName()); list.Add(DateTime.Now.ToString()); list1.Add(list); } } if (UpdaCount == 0) { MessageUtil.ShowTips("请选择喷砂实绩数据!"); return; } 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.coup.FrmSandBlast"; ccp.MethodName = "getCancelConfirm"; ccp.ServerParams = new object[] { list1 }; ccp = ob.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 confirm() { ultraGrid1.UpdateData(); UltraGridRow uRow = this.ultraGrid1.ActiveRow; if (uRow == null) { MessageUtil.ShowTips("无喷砂实绩!"); return; } UltraGridRow row = this.ultraGridWoId.ActiveRow; if (row == null) { MessageUtil.ShowTips("无工单信息,不允许此操作!"); } ArrayList list1 = new ArrayList(); int UpdaCount = 0; foreach (UltraGridRow ugr in ultraGrid1.Rows) { if (Convert.ToBoolean(ugr.Cells["CHK"].Text) == true) { if (ugr.Cells["CONFIRM"].Value.ToString().Equals("1")) { MessageUtil.ShowTips("选中有已确认实绩,不允许再次确认!"); return; } UpdaCount += 1; ArrayList list = new ArrayList(); list.Add(ugr.Cells["RESULT_NO"].Text.ToString()); list.Add(UserInfo.GetUserName()); list.Add(DateTime.Now.ToString()); list1.Add(list); } } if (UpdaCount == 0) { MessageUtil.ShowTips("请选择喷砂实绩数据!"); return; } 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.coup.FrmSandBlast"; ccp.MethodName = "getConfirm"; ccp.ServerParams = new object[] { list1 }; ccp = ob.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 Offline() { string _strat = ""; //UltraGridRow row1 = ultraGrid1.ActiveRow; //if (row1 == null) //{ // MessageUtil.ShowTips("没有喷砂实绩不能离线!"); // return; //} OffLineCut frm = new OffLineCut(); frm.ShowDialog(); LiXian = frm.StrNum; _strat = frm.Strat; StrMemo = frm.StrMemo; if (_strat.Equals("2")) return; if (LiXian.Equals("") || LiXian.Equals("0")) { MessageUtil.ShowTips("离线支数不能为空!"); return; } UltraGridRow row = ultraGridWoId.ActiveRow; if (row == null) return; if (row.Cells["ZyBillStatus"].Value.ToString() == "生产完成") { MessageUtil.ShowTips("此炉次计划整体已生产完成,不允许此操作!"); return; } string woId = row.Cells["WoId"].Value.ToString(); //查询切断实绩支数和 DataTable dt = ServerHelper.GetData("com.steering.mes.mcp.coup.CoupCutService.getCutResult", new object[] { row.Cells["WoId"].Value.ToString() }, this.ob); //VrpLoadingResultEntity result1 = new VrpLoadingResultEntity(); //this.planExpanQuery1.Value = result; string pronum = "";//锯切支数 string cutnum = "";//锯切个数 if (dt.Rows.Count > 0) { pronum = dt.Rows[0]["PRO_NUM"].ToString(); cutnum = dt.Rows[0]["CUT_NUM"].ToString(); } else { pronum = "0"; cutnum = "0"; } if (!row.Cells["Ifsplit"].Value.Equals("1")) { if (Convert.ToInt32(LiXian) > Convert.ToInt32(cutnum) - Convert.ToInt32(sandPiece) - Convert.ToInt32(offlinePiece.Value)) { MessageUtil.ShowTips("离线个数不能大于锯切个数减去已经喷砂和离线个数的差!"); return; } } offlinePiece.Value = Convert.ToInt32(LiXian) + Convert.ToInt32(offlinePiece.Value); //DataTable dt = ServerHelper.GetData("com.steering.mes.mcp.common.PlanService.getQueryWoIdDetails", new object[] { woId, zYgNo }, this.ob); //if (dt.Rows[0]["BLAST_STATUS"].ToString().Equals("生产完成")) //{ // MessageUtil.ShowTips("此工单喷砂工序点已结炉,不允许此操作!"); // return; //} //DataTable dt = ServerHelper.GetData("com.steering.mes.mcp.common.PlanService.getQueryCouplingcominfo", new object[] { woId, PsGx }, this.ob); //if (dt.Rows[0]["STATION_STATUS"].ToString().Equals("2")) //{ // MessageUtil.ShowTips("此工单工序点已结炉,不允许此操作!"); // return; //} string time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); ArrayList list = new ArrayList(); list.Add(LiXian); list.Add(row.Cells["WoId"].Text.ToString()); list.Add(row.Cells["HeatPlanNo"].Text.ToString()); list.Add(row.Cells["JudgeStoveNo"].Text.ToString()); list.Add(row.Cells["BatchNo"].Text.ToString()); list.Add(row.Cells["PlineCode"].Text.ToString()); list.Add(row.Cells["PlineName"].Text.ToString()); list.Add(this.UserInfo.GetUserName()); list.Add(this.UserInfo.GetUserOrder()); list.Add(this.UserInfo.GetUserGroup()); list.Add(time); list.Add(""); list.Add(StrMemo); list.Add(row.Cells["BatchGroudNo"].Value.ToString()); 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.coup.CoupThreadingService"; //ccp.MethodName = "lixianThreadingResult"; ccp.ServerName = "com.steering.mes.mcp.coup.CoupCutService"; ccp.MethodName = "lixianThreadingResult"; ccp.ServerParams = new object[] { list, PsGx,PsName }; ccp = ob.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(); DoClean(); } } } //撤销离线 private void unOffline() { ultraGrid1.UpdateData(); UltraGridRow uRow = this.ultraGrid1.ActiveRow; if (uRow == null) { MessageUtil.ShowTips("喷砂实绩无数据!"); return; } UltraGridRow row = this.ultraGridWoId.ActiveRow; if (uRow == null) { MessageUtil.ShowTips("无工单信息,不允许此操作!"); } if (row.Cells["ZyBillStatus"].Value.ToString() == "生产完成") { MessageUtil.ShowTips("此炉次计划整体已生产完成,不允许此操作!"); return; } string woId = row.Cells["WoId"].Value.ToString(); //DataTable dt = ServerHelper.GetData("com.steering.mes.mcp.common.PlanService.getQueryWoIdDetails", new object[] { woId, zYgNo }, this.ob); //if (dt.Rows[0]["BLAST_STATUS"].ToString().Equals("生产完成")) //{ // MessageUtil.ShowTips("此工单工序点已结炉,不允许此操作!"); // return; //} //DataTable dt = ServerHelper.GetData("com.steering.mes.mcp.common.PlanService.getQueryCouplingcominfo", new object[] { woId, PsGx }, this.ob); //if (dt.Rows[0]["STATION_STATUS"].ToString().Equals("2")) //{ // MessageUtil.ShowTips("此工单工序点已结炉,不允许此操作!"); // return; //} //if(!QueryStatusGd(row.Cells["WO_ID"].Value.ToString(), row.Cells["ZY_PLAN_ID"].Value.ToString())) return; ArrayList list1 = new ArrayList(); int UpdaCount = 0; foreach (UltraGridRow ugr in ultraGrid1.Rows) { if (Convert.ToBoolean(ugr.Cells["CHK"].Text) == true) { UpdaCount += 1; ArrayList list = new ArrayList(); list.Add(ugr.Cells["RESULT_NO"].Text.ToString()); list.Add(ugr.Cells["OFF_NUM"].Text.ToString()); list1.Add(list); } } if (UpdaCount == 0) { MessageUtil.ShowTips("请选择离线数据!"); return; } 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.coup.CoupCutService"; ccp.MethodName = "unlixianThreadingResult"; ccp.ServerParams = new object[] { list1, row.Cells["WoId"].Text.ToString(), PsGx }; 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) return; MessageUtil.ShowTips(ccp.ReturnInfo); if (ccp.ReturnInfo.Equals("撤销离线成功!")) { QuerySinglePlan(); } } private void QuerySinglePlan() { string woId = ""; string[] starts = { }; string judgeStoveNo = ""; string plnNo = ""; #region 条件 if (chkStarts.Checked) { if (string.IsNullOrEmpty(cmbStarts.Text.Trim())) { MessageUtil.ShowTips("请选择工单状态!"); return; } else { starts = (cmbStarts.Value as List).Select(p => p.ToString().Trim()).ToArray(); } } if (chkwoId.Checked) { if (chkwoId.Checked && string.IsNullOrEmpty(txtWoId.Text.Trim())) { MessageUtil.ShowTips("请输入工单号!"); return; } else { woId = txtWoId.Text.ToString().Trim(); } } else { woId = ""; } if (chkPlnNo.Checked) { if (chkPlnNo.Checked && string.IsNullOrEmpty(txtPlnNo.Text.Trim())) { MessageUtil.ShowTips("请输入炉次计划号!"); return; } else { plnNo = txtPlnNo.Text.ToString().Trim(); } } else { plnNo = ""; } if (chkJuNo.Checked) { if (chkJuNo.Checked && string.IsNullOrEmpty(txtJudgeStoveNO.Text.Trim())) { MessageUtil.ShowTips("请输入炉号!"); return; } else { judgeStoveNo = txtJudgeStoveNO.Text.ToString().Trim(); } } else { judgeStoveNo = ""; } #endregion List listSource = EntityHelper.GetData ("com.steering.mes.mcp.coup.CoupLoadingService.getQueryWoId1", new object[] { woId, plnNo, judgeStoveNo, starts, plineCodes }, this.ob); plnZyJgWorkbillEntitySource.DataSource = listSource; //GridHelper.RefreshAndAutoSize(ultraGridWoId); // List listSource1 = EntityHelper.GetData //("com.steering.mes.mcp.coup.CoupLoadingService.ulgetQueryWoId", new object[] { woId, plnNo, judgeStoveNo, starts, plineCode[0].ToString() }, this.ob); // bindingSource1.DataSource = listSource1; // GridHelper.RefreshAndAutoSize(ultraGrid1); } private void ultraGridWoId_AfterRowActivate(object sender, EventArgs e) { UltraGridRow row = ultraGridWoId.ActiveRow; if (row == null) return; //string planNO = row.Cells["HeatPlanNo"].Value.ToString(); string plinCode = row.Cells["PlineCode"].Value.ToString(); string woId = row.Cells["WoId"].Value.ToString(); //查询切断实绩支数和 DataTable dtCut = ServerHelper.GetData("com.steering.mes.mcp.coup.CoupCutService.getCutResultPiece", new object[] { row.Cells["WoId"].Value.ToString() }, this.ob); string pronum = ""; if (dtCut.Rows.Count > 0) { pronum = dtCut.Rows[0]["PRO_NUM"].ToString(); } else { pronum = "0"; } CutPiece = Convert.ToInt32(pronum); //查询喷砂实绩支数和 DataTable dtThread = ServerHelper.GetData("com.steering.mes.mcp.coup.FrmSandBlast.getSandblastResult", new object[] { row.Cells["WoId"].Value.ToString() }, this.ob); if (dtThread.Rows.Count > 0) { sandPiece = Convert.ToInt32(dtThread.Rows[0]["PRO_NUM"].ToString()); } else { sandPiece = 0; } //if (CutPiece - threadNum <= 0) //{ // numPieces.Value = 0; // sandPiece = 0; //} //else //{ // numPieces.Value = CutPiece - threadNum; // sandPiece = CutPiece - threadNum; //} getCoupSandBlast(woId); } /// /// 接箍加工计划详情 /// /// //private void getCoupProcessPlan(string woId, string planNo) //{ // DataTable dt = ServerHelper.GetData("com.steering.mes.mcp.common.PlanService.getQueryWoIdDetails", new object[] { woId, planNo }, this.ob); // if (dt != null && dt.Rows.Count > 0) // { // this.coupWoIdPlanControl1.Value.PlineName = dt.Rows[0]["PLINE_NAME"].ToString(); // this.coupWoIdPlanControl1.Value.CutMachGrpNm = dt.Rows[0]["CUT_MACH_GRP_NM"].ToString(); // this.coupWoIdPlanControl1.Value.Memo = dt.Rows[0]["MEMO"].ToString(); // this.coupWoIdPlanControl1.Value.ZyPlanId = dt.Rows[0]["ZY_PLAN_ID"].ToString(); // this.coupWoIdPlanControl1.Value.IfMonitorJg = dt.Rows[0]["IF_MONITOR_JG"].ToString(); // this.coupWoIdPlanControl1.Value.LoadPieces = dt.Rows[0]["LOAD_PIECES"].ToString(); // this.coupWoIdPlanControl1.Value.LoadWeight = dt.Rows[0]["LOAD_WEIGHT"].ToString(); // this.coupWoIdPlanControl1.Value.ProPlanId = dt.Rows[0]["PRO_PLAN_ID"].ToString(); // this.coupWoIdPlanControl1.Value.Steelname = dt.Rows[0]["STEELNAME"].ToString(); // this.coupWoIdPlanControl1.Value.Gradename = dt.Rows[0]["GRADENAME"].ToString(); // this.coupWoIdPlanControl1.Value.JglDesc = dt.Rows[0]["JGL_DESC"].ToString(); // this.coupWoIdPlanControl1.Value.CodeJg = dt.Rows[0]["CODE_JG"].ToString(); // this.coupWoIdPlanControl1.Value.ModelDesc = dt.Rows[0]["MODEL_DESC"].ToString(); // this.coupWoIdPlanControl1.Value.SpecJgDesc = dt.Rows[0]["SPEC_JG_DESC"].ToString(); // this.coupWoIdPlanControl1.Value.StyleJg = dt.Rows[0]["STYLE_JG"].ToString(); // this.coupWoIdPlanControl1.Value.PlanJgNum = dt.Rows[0]["PLAN_JG_NUM"].ToString(); // this.coupWoIdPlanControl1.Value.CsJgNum = dt.Rows[0]["CS_JG_NUM"].ToString(); // this.coupWoIdPlanControl1.Value.XqJgNum = dt.Rows[0]["XQ_JG_NUM"].ToString(); // this.coupWoIdPlanControl1.Value.InstoreNum = dt.Rows[0]["INSTORE_NUM"].ToString(); // this.coupWoIdPlanControl1.Value.BlWlDesc = dt.Rows[0]["BL_WL_DESC"].ToString(); // //this.coupWoIdPlanControl1.Value.LoadWeight = ""; // this.coupWoIdPlanControl1.UpdateData(); // } //} /// /// 查询喷砂实绩 /// /// private void getCoupSandBlast(string woId) { DataTable dt = ServerHelper.GetData("com.steering.mes.mcp.coup.FrmSandBlast.getCoupSandBlast", new object[] { woId }, this.ob); GridHelper.CopyDataToDatatable(ref dt, ref dataTable1, true); foreach (UltraGridRow urg in ultraGrid1.Rows) { if (urg.Cells["CONFIRM"].Value.Equals("1")) { urg.Appearance.BackColor = Color.LightGreen; } } } /// /// 判断状态 /// /// /// private bool QueryStatusGd(string woId, string planNO) { //DataTable dt = ServerHelper.GetData("com.steering.mes.mcp.common.PlanService.getQueryWoIdDetails", new object[] { woId, planNO }, this.ob); //if (dt.Rows[0]["ZY_BILL_STATUS"].ToString().Equals("生产完成")) //{ // MessageUtil.ShowTips("此工单已生产完成,不允许此操作!"); // return false; //} //if (dt.Rows[0]["BLAST_STATUS"].ToString().Equals("生产完成")) //{ // MessageUtil.ShowTips("此工单喷砂工序点已结炉,不允许此操作!"); // return false; //} return true; } /// /// 保存 /// private void DoSave() { UltraGridRow row = this.ultraGridWoId.ActiveRow; if (row == null) { MessageUtil.ShowTips("无工单信息,不允许此操作!"); return; } if (!row.Cells["zyBillStatus"].Value.ToString().Equals("生产中")) { MessageUtil.ShowTips("此工单不是生产中,不允许此操作!"); return; } string zYgNo = row.Cells["HeatPlanNo"].Value.ToString(); string woId = row.Cells["WoId"].Value.ToString(); //DataTable dt = ServerHelper.GetData("com.steering.mes.mcp.common.PlanService.getQueryWoIdDetails", new object[] { woId, zYgNo }, this.ob); //if (dt.Rows[0]["BLAST_STATUS"].ToString().Equals("生产完成")) //{ // MessageUtil.ShowTips("此工单喷砂工序点已结炉,不允许此操作!"); // return; //} ////if(!QueryStatusGd(row.Cells["WO_ID"].Value.ToString(), row.Cells["ZY_PLAN_ID"].Value.ToString())) return; //if (row.Cells["IF_OUT_BLAST"].Text.ToString().Equals("无喷砂")) //{ // MessageUtil.ShowTips("不需要进行此工序!"); // return; //} if (Convert.ToInt32(numPieces.Value.ToString()) != Convert.ToInt32(numQualified.Value.ToString()) + Convert.ToInt32(numRejected.Value.ToString())) { MessageBox.Show("喷标个数=合格个数+废品总个数,请查验 ", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (txtBC.Value == null || txtBC.Value == "") { MessageUtil.ShowTips("班次不能为空!"); return; } if (txtBz.Value == null || txtBz.Value == "") { MessageUtil.ShowTips("班组不能为空!"); return; } if (!row.Cells["Ifsplit"].Value.Equals("1")) { if (Convert.ToInt32(numPieces.Value) > CutPiece) { MessageUtil.ShowTips("喷砂个数大于加工最大可切个数!"); return; } } CouplingSandblastResultEntity sand = new CouplingSandblastResultEntity(); sand.SprayCount = numPieces.Value.ToString(); sand.QualiriedPcs = numQualified.Value.ToString(); sand.RejectedPcs = numRejected.Value.ToString(); sand.RejectedReason = cmbReason.Text.Trim(); sand.SprayMaterial = cmbSpray.Text.ToString(); sand.ColOperator = cmbOperator.Text.Trim(); sand.ColShift = txtBC.Value.ToString(); sand.ColGroup = txtBz.Value.ToString(); sand.ColUser = txtUser.Text.ToString(); sand.SprayThick = numLength.Value.ToString(); sand.SprayEquipment = cmbEquipment.Text.ToString(); sand.SprayPressure = numPressure.Value.ToString(); sand.Memo = txtMemo.Text.ToString(); sand.CreateTime = ProTime.Value.ToString(); //sand.IfAllOutWork = row.Cells["IF_ALL_OUT_WORK"].Text.ToString(); //sand.ZyPlanId = row.Cells["ZY_PLAN_ID"].Text.ToString(); //sand.PlineCode = row.Cells["PLINE_CODE"].Text.ToString(); //sand.WoId = row.Cells["WO_ID"].Text.ToString(); //double PlnCount = 0;//计划个数 //double CutCount = 0;//实际个数 //DataTable dt1 = ServerHelper.GetData("com.steering.mes.mcp.coup.PhosphateResultService.queryPlanJg", new Object[] { row.Cells["ZY_PLAN_ID"].Text.ToString() }, ob); //if (dt1.Rows.Count > 0) //{ // PlnCount = Double.Parse(dt1.Rows[0]["BLAST_PLN_NUM"].ToString()); // CutCount = Double.Parse(dt1.Rows[0]["BLAST_OK_NUM"].ToString()); //} //// + Double.Parse(numQualified.Value.ToString()) //if (CutCount > PlnCount) //{ // if (MessageUtil.ShowYesNoAndQuestion("实际喷砂个数超过计划喷砂个数是否新增!") == DialogResult.No) { return; } //} 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.coup.FrmSandBlast"; ccp.MethodName = "addSandResult"; ccp.ServerParams = new object[] { sand, PsGx, woId }; ccp = ob.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(); DoClean(); } } } /// /// 修改 /// private void DoUpdate() { UltraGridRow row = this.ultraGridWoId.ActiveRow; if (row == null) { MessageUtil.ShowTips("无工单信息,不允许此操作!"); return; } if (!row.Cells["zyBillStatus"].Value.ToString().Equals("生产中")) { MessageUtil.ShowTips("此工单不是生产中,不允许此操作!"); return; } UltraGridRow urg = this.ultraGrid1.ActiveRow; if (urg == null) { MessageUtil.ShowTips("无喷砂实绩,不允许此操作!"); return; } if(urg.Cells["IF_ALL_OUT_WORK"].Value.ToString().Equals("是")) { MessageUtil.ShowTips("此工序已经离线,不允许此操作!"); return; } string zYgNo = row.Cells["HeatPlanNo"].Value.ToString(); string woId = row.Cells["WoId"].Value.ToString(); //DataTable dt = ServerHelper.GetData("com.steering.mes.mcp.common.PlanService.getQueryWoIdDetails", new object[] { woId, zYgNo }, this.ob); //if (dt.Rows[0]["BLAST_STATUS"].ToString().Equals("生产完成")) //{ // MessageUtil.ShowTips("此工单喷砂工序点已结炉,不允许此操作!"); // return; //} // if(!QueryStatusGd(row.Cells["WO_ID"].Value.ToString(), row.Cells["ZY_PLAN_ID"].Value.ToString())) return; string time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); if (Convert.ToInt32(numPieces.Value.ToString()) != Convert.ToInt32(numQualified.Value.ToString()) + Convert.ToInt32(numRejected.Value.ToString())) { MessageBox.Show("喷标个数=合格个数+废品总个数,请查验 ", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } CouplingSandblastResultEntity sand = new CouplingSandblastResultEntity(); sand.SprayCount = numPieces.Value.ToString(); sand.QualiriedPcs = numQualified.Value.ToString(); sand.RejectedPcs = numRejected.Value.ToString(); sand.RejectedReason = cmbReason.Text.Trim(); sand.SprayMaterial = cmbSpray.Text.ToString(); sand.ColOperator = cmbOperator.Text.Trim(); sand.ColShift = txtBC.Value.ToString(); sand.ColGroup = txtBz.Value.ToString(); sand.UpdateName = this.UserInfo.GetUserName(); sand.SprayThick = numLength.Value.ToString(); sand.SprayEquipment = cmbEquipment.Text.ToString(); sand.SprayPressure = numPressure.Value.ToString(); sand.Memo = txtMemo.Text.ToString(); sand.UpdateTime = time; //sand.ZyPlanId = urg.Cells["ZY_PLAN_ID"].Text.ToString(); //sand.PlineCode = urg.Cells["PLINE_CODE"].Text.ToString(); sand.ResultNo = urg.Cells["RESULT_NO"].Text.ToString(); //sand.WoId = urg.Cells["WO_ID"].Text.ToString(); //double PlnCount = 0;//计划个数 //double CutCount = 0;//实际个数 //DataTable dt1 = ServerHelper.GetData("com.steering.mes.mcp.coup.PhosphateResultService.queryPlanJg", new Object[] { row.Cells["ZY_PLAN_ID"].Text.ToString() }, ob); //if (dt1.Rows.Count > 0) //{ // PlnCount = Double.Parse(dt1.Rows[0]["BLAST_PLN_NUM"].ToString()); // CutCount = Double.Parse(dt1.Rows[0]["BLAST_OK_NUM"].ToString()); //} //// + Double.Parse(numQualified.Value.ToString()) //if (CutCount > PlnCount) //{ // if (MessageUtil.ShowYesNoAndQuestion("实际喷砂个数超过计划喷砂个数是否修改!") == DialogResult.No) { return; } //} 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.coup.FrmSandBlast"; ccp.MethodName = "updateSandResult"; ccp.ServerParams = new object[] { sand, PsGx, woId }; ccp = ob.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(); DoClean(); } } } /// /// 删除 /// private void DoDelete() { ultraGrid1.UpdateData(); UltraGridRow uRow = this.ultraGrid1.ActiveRow; if (uRow == null) { MessageUtil.ShowTips("无喷砂实绩!"); return; } if (uRow.Cells["CONFIRM"].Value.ToString().Equals("1")) { MessageUtil.ShowTips("选中的喷砂实绩已经确认,不允许删除!"); return; } UltraGridRow row = this.ultraGridWoId.ActiveRow; if (row == null) { MessageUtil.ShowTips("无工单信息,不允许此操作!"); } if (!row.Cells["zyBillStatus"].Value.ToString().Equals("生产中")) { MessageUtil.ShowTips("此工单不是生产中,不允许此操作!"); return; } string zYgNo = row.Cells["HeatPlanNo"].Value.ToString(); string woId = row.Cells["WoId"].Value.ToString(); string plinCode = row.Cells["PlineCode"].Value.ToString(); // DataTable dt = ServerHelper.GetData("com.steering.mes.mcp.common.PlanService.getQueryWoIdDetails", new object[] { woId, zYgNo }, this.ob); // if (dt.Rows[0]["BLAST_STATUS"].ToString().Equals("生产完成")) // { // MessageUtil.ShowTips("此工单喷砂工序点已结炉,不允许此操作!"); // return; // } //// if(!QueryStatusGd(uRow.Cells["WO_ID"].Value.ToString(), uRow.Cells["ZY_PLAN_ID"].Value.ToString())) return; ArrayList list1 = new ArrayList(); int UpdaCount = 0; foreach (UltraGridRow ugr in ultraGrid1.Rows) { if (Convert.ToBoolean(ugr.Cells["CHK"].Text) == true) { if (ugr.Cells["IF_ALL_OUT_WORK"].Value.ToString().Equals("是")) { MessageUtil.ShowTips("此工序已经离线,不允许此操作!"); return; } if (ugr.Cells["OFF_NUM"].Text != "0" && ugr.Cells["OFF_NUM"].Text != "") { MessageUtil.ShowTips("存在离线支数,不允许此操作!"); return; } UpdaCount += 1; ArrayList list = new ArrayList(); list.Add(ugr.Cells["RESULT_NO"].Text.ToString()); list.Add(ugr.Cells["REJECTED_PCS"].Text.ToString()); list1.Add(list); } } if (UpdaCount == 0) { MessageUtil.ShowTips("请选择喷砂数据!"); return; } 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.coup.FrmSandBlast"; ccp.MethodName = "deleteSandResult"; ccp.ServerParams = new object[] { list1, PsGx, woId ,plinCode}; ccp = ob.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) { if (ccp.ReturnInfo.Equals("删除成功!")) { MessageUtil.ShowTips(ccp.ReturnInfo); QuerySinglePlan(); DoClean(); } else { MessageUtil.ShowTips(ccp.ReturnInfo); } } } /// /// 结炉 /// private void DoComplete() { UltraGridRow uRow = this.ultraGridWoId.ActiveRow; if (uRow == null) { MessageUtil.ShowTips("请选择需要结炉的工单号!"); return; } //string zYgNo = uRow.Cells["ZY_PLAN_ID"].Value.ToString(); string woId = uRow.Cells["WoId"].Value.ToString(); //DataTable dt = ServerHelper.GetData("com.steering.mes.mcp.common.PlanService.getQueryWoIdDetails", new object[] { woId, zYgNo }, this.ob); //if (dt.Rows[0]["BLAST_STATUS"].ToString().Equals("生产完成")) //{ // MessageUtil.ShowTips("此工单喷砂工序点已结炉,不允许此操作!"); // return; //} //if (dt.Rows[0]["ZY_BILL_STATUS"].ToString().Equals("生产完成")) //{ // MessageUtil.ShowTips("此工单状态已生产完成,不允许此操作!"); // return; //} //ArrayList list = new ArrayList(); //list.Add(zYgNo); //list.Add(PsGx); //list.Add(woId); if (MessageUtil.ShowYesNoAndQuestion("是否结炉?") == DialogResult.No) { return; } CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "com.steering.mes.mcp.coup.FrmSandBlast"; ccp.MethodName = "doBeside"; ccp.ServerParams = new object[] { PsGx,woId }; ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal); if (ccp.ReturnCode != -1) { MessageUtil.ShowTips(ccp.ReturnInfo); if (ccp.ReturnInfo.Equals("结炉成功!")) { QuerySinglePlan(); } } } /// /// 撤销结炉 /// private void UnDoComplete() { UltraGridRow uRow = this.ultraGridWoId.ActiveRow; if (uRow == null) { MessageUtil.ShowTips("请选择需要结炉的作业工单号!"); return; } //string zYgNo = uRow.Cells["ZY_PLAN_ID"].Value.ToString(); string woId = uRow.Cells["WoId"].Value.ToString(); //DataTable dt = ServerHelper.GetData("com.steering.mes.mcp.common.PlanService.getQueryWoIdDetails", new object[] { woId, zYgNo }, this.ob); //if (!dt.Rows[0]["BLAST_STATUS"].ToString().Equals("生产完成")) //{ // MessageUtil.ShowTips("此工单喷砂工序点未结炉,不允许此操作!"); // return; //} if (dt.Rows[0]["ZY_BILL_STATUS"].ToString().Equals("生产完成")) //{ // MessageUtil.ShowTips("此工单状态已生产完成,不允许此操作!"); // return; //} //ArrayList list = new ArrayList(); //list.Add(zYgNo); //list.Add(PsGx); //list.Add(woId); if (MessageUtil.ShowYesNoAndQuestion("是否撤销结炉?") == DialogResult.No) { return; } CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "com.steering.mes.mcp.coup.FrmSandBlast"; ccp.MethodName = "undoBeside"; ccp.ServerParams = new object[] { PsGx,woId }; ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal); if (ccp.ReturnCode != -1) { MessageUtil.ShowTips(ccp.ReturnInfo); if (ccp.ReturnInfo.Equals("撤销结炉成功!")) { QuerySinglePlan(); } } } /// /// 清空 /// private void DoClean() { numPieces.Value =0; numQualified.Value = 0; numRejected.Value = 0; cmbReason.Text =""; cmbSpray.Text =""; cmbOperator.Text = ""; txtBz.Value = this.UserInfo.GetUserOrder(); txtBC.Value = this.UserInfo.GetUserGroup(); txtUser.Text = this.UserInfo.GetUserName(); numLength.Value = 0; cmbEquipment.Text =""; numPressure.Value = 0; txtMemo.Text = ""; } private void numRejected_ValueChanged(object sender, EventArgs e) { if (numRejected.Value==null||numRejected.Value.ToString().Equals("0")) { cmbReason.Enabled = false; } else { cmbReason.Enabled = true; } } private void ultraGrid1_AfterRowActivate(object sender, EventArgs e) { UltraGridRow ugr = this.ultraGrid1.ActiveRow; if (ugr == null) return; //if (ugr.Cells["IF_ALL_OUT_WORK"].Value.ToString().Equals("否")) //{ //numPieces.Value = ugr.Cells["SPRAY_COUNT"].Text.ToString(); //numQualified.Value = ugr.Cells["QUALIRIED_PCS"].Text.ToString(); //numRejected.Value = ugr.Cells["REJECTED_PCS"].Text.ToString(); //cmbReason.Text = ugr.Cells["REJECTED_REASON"].Text.ToString(); //cmbSpray.Text = ugr.Cells["SPRAY_MATERIAL"].Text.ToString(); //cmbOperator.Text = ugr.Cells["COL_OPERATOR"].Text.ToString(); //txtBC.Text = ugr.Cells["COL_SHIFT"].Text.ToString(); //txtBz.Text = ugr.Cells["COL_GROUP"].Text.ToString(); //txtUser.Text = ugr.Cells["COL_USER"].Text.ToString(); //numLength.Value = ugr.Cells["SPRAY_THICK"].Text.ToString(); //cmbEquipment.Text = ugr.Cells["SPRAY_EQUIPMENT"].Text.ToString(); //numPressure.Value = ugr.Cells["SPRAY_PRESSURE"].Text.ToString(); //txtMemo.Text = ugr.Cells["MEMO"].Text.ToString(); //} //else //{ // DoClean(); //} } /// /// 按回车键触发查询按钮 /// /// /// private void ContPublic_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { QuerySinglePlan(); } } private void chkStarts_CheckedChanged(object sender, EventArgs e) { if (chkStarts.Checked) { cmbStarts.Enabled = true; } else { cmbStarts.Enabled = false; } if (chkJuNo.Checked) { txtJudgeStoveNO.Enabled = true; } else { txtJudgeStoveNO.Enabled = false; } if (chkPlnNo.Checked) { txtPlnNo.Enabled = true; } else { txtPlnNo.Enabled = false; } if (chkwoId.Checked) { txtWoId.Enabled = true; } else { txtWoId.Enabled = false; } } private void craftImg_EditorButtonClick(object sender, Infragistics.Win.UltraWinEditors.EditorButtonEventArgs e) { UltraGridRow row = ultraGridWoId.ActiveRow; if (row == null) return; string orderNo = row.Cells["OrderNoSeq"].Text.ToString(); string strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilCouplingProcess2.cpt" + "&ORDER_NO=" + orderNo; FrmRepExcel down = new FrmRepExcel(ob, strurl); down.Text = "接箍二级工艺"; down.Visible = false; down.Size = new Size(740, this.Height); down.WindowState = FormWindowState.Maximized; down.ShowDialog(); } private void ultraGrid1_CellChange(object sender, CellEventArgs e) { UltraGridRow ugr = this.ultraGrid1.ActiveRow; if (ugr == null) return; numPieces.Value = ugr.Cells["SPRAY_COUNT"].Text.ToString(); numQualified.Value = ugr.Cells["QUALIRIED_PCS"].Text.ToString(); numRejected.Value = ugr.Cells["REJECTED_PCS"].Text.ToString(); cmbReason.Text = ugr.Cells["REJECTED_REASON"].Text.ToString(); cmbSpray.Text = ugr.Cells["SPRAY_MATERIAL"].Text.ToString(); cmbOperator.Text = ugr.Cells["COL_OPERATOR"].Text.ToString(); txtBC.Text = ugr.Cells["COL_SHIFT"].Text.ToString(); txtBz.Text = ugr.Cells["COL_GROUP"].Text.ToString(); txtUser.Text = ugr.Cells["COL_USER"].Text.ToString(); numLength.Value = ugr.Cells["SPRAY_THICK"].Text.ToString(); cmbEquipment.Text = ugr.Cells["SPRAY_EQUIPMENT"].Text.ToString(); numPressure.Value = ugr.Cells["SPRAY_PRESSURE"].Text.ToString(); txtMemo.Text = ugr.Cells["MEMO"].Text.ToString(); } private void numRejected_Click(object sender, EventArgs e) { if(numRejected.Value.Equals("0")) { numRejected.Value = null; } } private void numPieces_AfterEnterEditMode(object sender, EventArgs e) { this.BeginInvoke(new MethodInvoker(this.numPieces.SelectAll)); } private void numQualified_AfterEnterEditMode(object sender, EventArgs e) { this.BeginInvoke(new MethodInvoker(this.numQualified.SelectAll)); } private void numRejected_AfterEnterEditMode(object sender, EventArgs e) { this.BeginInvoke(new MethodInvoker(this.numRejected.SelectAll)); } private void numLength_AfterEnterEditMode(object sender, EventArgs e) { this.BeginInvoke(new MethodInvoker(this.numLength.SelectAll)); } private void numPressure_AfterEnterEditMode(object sender, EventArgs e) { this.BeginInvoke(new MethodInvoker(this.numPressure.SelectAll)); } } }