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; using CoreFS.CA06; using Core.Mes.Client.Comm.Server; using Core.Mes.Client.Comm.Control; using Core.StlMes.Client.Mcp; using com.steering.mes.mcp.entity; using Infragistics.Win.UltraWinGrid; using Core.StlMes.Client.Mcp.Control; using Core.StlMes.Client.Mcp.Common; using Core.StlMes.Client.Mcp.Entity; using Core.Mes.Client.Comm.Tool; using Core.StlMes.Client.Mcp.CollarMaterial; using Infragistics.Win; using Core.StlMes.Client.Mcp.Coupling; using Core.Mes.Client.Comm.Format; using Core.StlMes.Client.Mcp.Report; namespace Core.StlMes.Client.Coup { public partial class FrmCutResult : FrmBase { private string departm = "";//获取部门ID private string[] plineCode = null;//获取产线代码 private string cutGx = "";//锯切工序 private string cutName = "";//工序名称 private string embGx = "";//压印工序 public string LiXian = ""; private string StrMemo = "";//备注 //private string rouGx = "";//粗加工工序 private int LoadingPiece = 0;//上料支数 private int CutPiece = 0;//最大可切支数 private string[] plineCodes; private int jgPiece = 0;//箍个数 public FrmCutResult() { InitializeComponent(); this.IsLoadUserView = true; } 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 FrmCutResult_Load(object sender, EventArgs e) { EntityHelper.ShowGridCaption(ultraGridWoId.DisplayLayout.Bands[0]); EntityHelper.ShowGridCaption(ultraGrid1.DisplayLayout.Bands[0]); EntityHelper.ShowGridCaption(ultraGrid2.DisplayLayout.Bands[0]); departm = UserInfo.GetDeptid(); //plineCode = McpBaseHelper.GetPCodePline(departm, this.ob); plineCodes = comm.GetPlineCode(this.ValidDataPurviewIds, "H", ob); ProTime.Value = DateTime.Today; //McpBaseHelper.InitPlineUnit(cmbCname, plineCode, this.ob); //获取废品原因 DataTable dt1 = ServerHelper.GetData("com.steering.mes.mcp.coup.CoupCutService.getCutResultFp", new object[] { "7002" }, this.ob); cmbReason.DataSource = dt1; cmbReason.ValueMember = "BASENAME"; YdmBaseClass.SetComboItemHeight(cmbReason); txtBz.Value = UserInfo.GetUserGroup(); txtBC.Value = UserInfo.GetUserOrder(); txtUser.Text = UserInfo.GetUserName(); //获取锯切工序 DataTable dt2 = ServerHelper.GetData("com.steering.mes.mcp.common.PlanService.getQueryGX", new object[] { "700302" }, this.ob); if (dt2.Rows.Count > 0) { cutGx = dt2.Rows[0]["BASECODE"].ToString(); cutName = dt2.Rows[0]["BASENAME"].ToString(); } //获取压印工序 DataTable dt3 = ServerHelper.GetData("com.steering.mes.mcp.common.PlanService.getQueryGX", new object[] { "700304" }, this.ob); if (dt3.Rows.Count > 0) { embGx = dt3.Rows[0]["BASECODE"].ToString(); } //获取粗加工工序 //DataTable dt4 = ServerHelper.GetData("com.steering.mes.mcp.common.PlanService.getQueryGX", new object[] { "700303" }, this.ob); //if (dt4.Rows.Count > 0) //{ // rouGx = dt4.Rows[0]["BASECODE"].ToString(); //} } //private void init() //{ // //foreach (UltraGridRow ugr in ultraGridWoId.Rows) // //{ // //ArrayList pram = new ArrayList(); // //pram.Add(ugr.Cells["PLINE_NO"].Text.Trim()); // //pram.Add(ugr.Cells["PROCESS_NO"].Value.ToString()); // //pram.Add(ugr.Cells["MACHINE_GROUP"].Text.ToString()); // DataTable dt2 = ServerHelper.GetData("com.steering.mes.mcp.coup.CoupCutService.doQuerybianhao", new object[] { "4064" }, this.ob); // ///comm.FilComboboxAdd(quanxian, dt2, "BASECODE", "BASENAME", "validflag NOT in ('0')", false, "全部", ""); // cmbJcCode.DataSource = dt2; // cmbJcCode.ValueMember = "BASENAME"; // YdmBaseClass.SetComboItemHeight(cmbJcCode); // // } //} public override void ToolBar_Click(object sender, string ToolbarKey) { switch (ToolbarKey) { case "DoQuery": QuerySinglePlan(); break; case "DoSave": DoSave(); break; case "DoUpdate": DoUpdate(); break; case "DoDelete": DoDelete(); break; case "DoBeside"://结炉 DoBeside(); break; case "UndoBeside"://撤销结炉 UndoBeside(); 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() { ultraGrid2.UpdateData(); UltraGridRow uRow = this.ultraGrid2.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 ultraGrid2.Rows) { if (Convert.ToBoolean(ugr.Cells["CHECK"].Text) == true) { if (ugr.Cells["Confirm"].Value.ToString().Equals("0")) { MessageUtil.ShowTips("选中有没确认实绩,不允许取消确认!"); return; } UpdaCount += 1; ArrayList list = new ArrayList(); list.Add(ugr.Cells["ResultNo"].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.CoupCutService"; 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() { ultraGrid2.UpdateData(); UltraGridRow uRow = this.ultraGrid2.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 ultraGrid2.Rows) { if (Convert.ToBoolean(ugr.Cells["CHECK"].Text) == true) { if (ugr.Cells["Confirm"].Value.ToString().Equals("1")) { MessageUtil.ShowTips("选中有已确认实绩,不允许再次确认!"); return; } UpdaCount += 1; ArrayList list = new ArrayList(); list.Add(ugr.Cells["ResultNo"].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.CoupCutService"; 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 row = ultraGridWoId.ActiveRow; if (row == null) return; if (row.Cells["ZyBillStatus"].Value.ToString() == "生产完成") { MessageUtil.ShowTips("此炉次计划整体已生产完成,不允许此操作!"); return; } OffLineCut frm = new OffLineCut(); frm.ShowDialog(); LiXian = frm.StrNum; _strat = frm.Strat; StrMemo = frm.StrMemo; if (_strat.Equals("")) return; if (LiXian.Equals("") || LiXian.Equals("0")) { MessageUtil.ShowTips("离线支数不能为空!"); return; } //查询切断实绩支数和 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"; } UltraGridRow row1 = ultraGrid2.ActiveRow; if (row1 == null) { MessageUtil.ShowTips("锯切前离线请在上料界面离线!"); return; } offlinePiece.Value = Convert.ToInt32(LiXian) + Convert.ToInt32(offlinePiece.Value); //string zYgNo = row.Cells["ZY_PLAN_ID"].Value.ToString(); string woId = row.Cells["WoId"].Value.ToString(); //DataTable dt = ServerHelper.GetData("com.steering.mes.mcp.common.PlanService.getQueryCouplingcominfo", new object[] { woId, cutGx }, this.ob); //if (dt.Rows[0]["STATION_STATUS"].ToString().Equals("2")) //{ // MessageUtil.ShowTips("此工单工序点已结炉,不允许此操作!"); // return; //} //if (row1.Cells["OffNum"].Value.ToString() == "") //{ // row1.Cells["OffNum"].Value = "0"; //} //if (int.Parse(row1.Cells["QualifiedNumber"].Value.ToString()) < int.Parse(LiXian) + int.Parse(row1.Cells["OffNum"].Value.ToString())) //{ // 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.CoupCutService"; ccp.MethodName = "lixianThreadingResult"; ccp.ServerParams = new object[] { list, cutGx,cutName }; 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 unOffline() { ultraGrid2.UpdateData(); UltraGridRow uRow = this.ultraGrid2.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 = uRow.Cells["WoId"].Value.ToString(); offlinePiece.Value = Convert.ToInt32(offlinePiece.Value) - Convert.ToInt32(LiXian); //DataTable dt = ServerHelper.GetData("com.steering.mes.mcp.common.PlanService.getQueryWoIdDetails", new object[] { woId, zYgNo }, this.ob); //if (dt.Rows[0]["CUT_STATUS"].ToString().Equals("生产完成")) //{ // MessageUtil.ShowTips("此工单工序点已结炉,不允许此操作!"); // return; //} //DataTable dt = ServerHelper.GetData("com.steering.mes.mcp.common.PlanService.getQueryCouplingcominfo", new object[] { woId, cutGx }, 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 ultraGrid2.Rows) { if (Convert.ToBoolean(ugr.Cells["CHECK"].Text) == true) { UpdaCount += 1; ArrayList list = new ArrayList(); list.Add(ugr.Cells["ResultNo"].Text.ToString()); list.Add(ugr.Cells["OffNum"].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(), cutGx }; 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 DoBeside() { UltraGridRow uRow = this.ultraGridWoId.ActiveRow; if (uRow == null) { MessageUtil.ShowTips("请选择需要结炉的工单号!"); return; } //if (jgPiece - int.Parse(numRejected.Value.ToString()) - int.Parse(praloPcs.Value.ToString()) > int.Parse(numQualified.Value.ToString())) //{ // 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 }, this.ob); //if (dt.Rows[0]["CUT_STATUS"].ToString().Equals("生产完成")) //{ // MessageUtil.ShowTips("此工单工序点已结炉,不允许此操作!"); // return; //} //if (dt.Rows[0]["ZY_BILL_STATUS"].ToString().Equals("生产完成")) //{ // MessageUtil.ShowTips("此工单状态已生产完成,不允许此操作!"); // return; //} if (MessageUtil.ShowYesNoAndQuestion("是否结炉?") == DialogResult.No) { return; } CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "com.steering.mes.mcp.coup.CoupCutService"; ccp.MethodName = "doBeside"; ccp.ServerParams = new object[] { cutGx,embGx, woId }; ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal); if (ccp.ReturnCode != -1) { MessageUtil.ShowTips(ccp.ReturnInfo); if (ccp.ReturnInfo.Equals("结炉成功!")) { QuerySinglePlan(); } } } /// /// 撤销结炉 /// private void UndoBeside() { 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]["CUT_STATUS"].ToString().Equals("生产完成")) //{ // MessageUtil.ShowTips("此工单工序点未结炉,不允许此操作!"); // return; //} //if (dt.Rows[0]["ZY_BILL_STATUS"].ToString().Equals("生产完成")) //{ // MessageUtil.ShowTips("此工单状态生产完成,不允许此操作!"); // return; //} if (MessageUtil.ShowYesNoAndQuestion("是否撤销结炉?") == DialogResult.No) { return; } CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "com.steering.mes.mcp.coup.CoupCutService"; ccp.MethodName = "undoBeside"; ccp.ServerParams = new object[] { cutGx, embGx, woId }; ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal); if (ccp.ReturnCode != -1) { MessageUtil.ShowTips(ccp.ReturnInfo); if (ccp.ReturnInfo.Equals("撤销结炉成功!")) { QuerySinglePlan(); } } } /// /// 查询作业计划 /// private void QuerySinglePlan() { string woId = ""; //string starts = ""; string judgeStoveNo = ""; string plnNo = ""; string[] starts = { }; #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 zYgNo = row.Cells["HeatPlanNo"].Value.ToString(); string woId = row.Cells["WoId"].Value.ToString(); string plineCode = row.Cells["PlineCode"].Value.ToString(); string demandCopper = row.Cells["demandCopper"].Text.ToString(); //getJGCutPlan(woId,zYgNo); if (demandCopper.Contains("压印")) { cmbEmbossed.Value = 1;//压印 } else { cmbEmbossed.Value = 0;//压印 } string[] lathCutNm = row.Cells["LatheCutNm"].Text.ToString().Replace(" ","").Split(','); //获取切管机床编号 DataTable dt = ServerHelper.GetData("com.steering.mes.mcp.coup.CoupCutService.getMachine", new object[] { plineCode, lathCutNm }, this.ob); cmbJcCode.DataSource = dt; cmbJcCode.DisplayMember = "MACHINE_NAME"; cmbJcCode.ValueMember = "MACHINE_NO"; YdmBaseClass.SetComboItemHeight(cmbJcCode); //cutControl1.PlinCode = row.Cells["PLINE_CODE"].Text.ToString(); //cutControl1.CutMachGroup = row.Cells["CUT_MACH_GRP_NM"].Text.ToString(); //cmbRoughmach.Text = row.Cells["IF_NEED_CJG"].Text.ToString();//粗加工 //查询工单的离线支数 DataTable dt1 = ServerHelper.GetData("com.steering.mes.mcp.coup.CoupLoadingService.getQueryOfflinePiece", new object[] { row.Cells["WoId"].Value }, this.ob); if (dt1.Rows.Count > 0) { if (dt1.Rows[0]["OFFLINE_NUM_BJ"].ToString() == null || dt1.Rows[0]["OFFLINE_NUM_BJ"].ToString() == "") { offlinePiece.Value = 0; } else { offlinePiece.Value = Convert.ToInt64(dt1.Rows[0]["OFFLINE_NUM_BJ"].ToString()); } } //查询该工单上料支数 DataTable dt2 = ServerHelper.GetData("com.steering.mes.mcp.coup.CoupLoadingService.getLoadResult1", new object[] { row.Cells["WoId"].Value }, this.ob); if(dt2.Rows.Count > 0) { if(dt2.Rows[0]["PRO_NUM"].ToString() == null||dt2.Rows[0]["PRO_NUM"].ToString() == "") { LoadingPiece = 0; } else { LoadingPiece = Convert.ToInt32(dt2.Rows[0]["PRO_NUM"].ToString()); } } //int singLenCutNum = (int)(double.Parse(row.Cells["AimlengthBl"].Value.ToString()) / ((double.Parse(row.Cells["Aimlength"].Value.ToString()) + 15) / 1000)) - 2; //if (Convert.ToInt32(row.Cells["RealBlNum"].Value.ToString()) - Convert.ToInt32(offlinePiece.Value)>0) //{ // numPieces.Value = Convert.ToInt32(row.Cells["RealBlNum"].Value.ToString()) - Convert.ToInt32(offlinePiece.Value); //} //else //{ // numPieces.Value = ""; //} // numQualified.Value = int.Parse(numPieces.Value.ToString()) * int.Parse(row.Cells["SingleCutNun"].Value.ToString()); // LoadingPiece = Convert.ToInt32(numPieces.Value); // CutPiece = Convert.ToInt32(numQualified.Value); //numQualified.Value = int.Parse(row.Cells["RealBlNum"].Value.ToString()) * singLenCutNum; //cmbJcCode.Text = row.Cells["LatheGrpNm"].Text.ToString(); //获取锯切实绩 this.getCoupCutResult(woId); } /// ///工单详细 /// /// private void getJGCutPlan(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 getCoupCutResult(string woId) { List listSource1 = EntityHelper.GetData ("com.steering.mes.mcp.coup.CoupCutService.getCutResultByPlanNo", new object[] { woId }, this.ob); CouplingCutResultBindSource.DataSource = listSource1; GridHelper.RefreshAndAutoSize(ultraGrid2); foreach (UltraGridRow urg in ultraGrid2.Rows) { if (urg.Cells["Confirm"].Value.Equals("1")) { urg.Appearance.BackColor = Color.LightGreen; } } } /// /// 判断状态 /// /// /// private void QueryStatusGd() { UltraGridRow row = this.ultraGridWoId.ActiveRow; string woId = row.Cells["WoId"].Value.ToString(); DataTable dt = ServerHelper.GetData("com.steering.mes.mcp.coup.CoupLoadingService.getQueryWoIdDetails", new object[] { woId }, this.ob); //if (dt.Rows[0]["CUT_STATUS"].ToString().Equals("生产完成")) //{ // MessageUtil.ShowTips("此工单工序点已结炉,不允许此操作!"); // return; //} //DataTable dt = ServerHelper.GetData("com.steering.mes.mcp.common.PlanService.getQueryWoIdDetails", new object[] { woId, planNO }, this.ob); if (dt.Rows[0]["zyBillStatus"].ToString().Equals("生产完成")) { MessageUtil.ShowTips("此工单已生产完成,不允许此操作!"); return; } //return true; } /// /// 作业实绩保存 /// private void DoSave() { UltraGridRow row = this.ultraGridWoId.ActiveRow; if (row == null) { MessageUtil.ShowTips("无工单信息,不允许此操作!"); return; } if (row.Cells["zyBillStatus"].Value.ToString() == "生产完成") { MessageUtil.ShowTips("此工单已生产完成,不允许此操作!"); return; } if (row.Cells["IfAllOutWork"].Value.ToString().Equals("是")) { MessageUtil.ShowTips("此工单已全工序委外离线,不允许此操作!"); return; } //if (row.Cells["IfOutCut"].Value.ToString().Equals("是")) //{ // MessageUtil.ShowTips("此工单本工序委外离线,不允许此操作!"); // return; //} ////QueryStatusGd(); //string woId = row.Cells["WoId"].Value.ToString(); //DataTable dt = ServerHelper.GetData("com.steering.mes.mcp.common.PlanService.getQueryWoIdDetails", new object[] { woId }, this.ob); //if (dt.Rows[0]["CUT_STATUS"].ToString().Equals("生产完成")) //{ // MessageUtil.ShowTips("此工单工序点已结炉,不允许此操作!"); // return; //} //if(!QueryStatusGd(row.Cells["WO_ID"].Value.ToString(), row.Cells["ZY_PLAN_ID"].Value.ToString())) return; //if (cmbJcCode.Text.Trim() == "") //{ // MessageUtil.ShowTips("机床编号不能为空!"); // return; //} //if (cmbOperator.Text.Trim() == "") //{ // MessageUtil.ShowTips("操作人不能为空!"); // return; //} string zPieces = ""; string fPieces = ""; string gPieces = ""; if (numPieces.Value == null || numPieces.Value.Equals("")) { zPieces = "0"; } else { zPieces = numPieces.Value.ToString(); } if (numQualified.Value == null || numQualified.Value.Equals("")) { gPieces = "0"; } else { gPieces = numQualified.Value.ToString(); } if (numRejected.Value == null || numRejected.Value.Equals("")) { fPieces = "0"; } else { fPieces = numRejected.Value.ToString(); } if (gPieces =="0") { MessageUtil.ShowTips("切管个数不能为空!"); return; } if (int.Parse(gPieces) < int.Parse(fPieces)) { MessageUtil.ShowTips("废品个数不能大于切管个数!"); return; } if (txtBC.Value.Equals("")) { MessageUtil.ShowTips("班次不能为空!"); return; } if (txtBz.Value.Equals("")) { MessageUtil.ShowTips("班组不能为空!"); return; } //查询切断实绩支数和 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 = ""; if (dt.Rows.Count > 0) { pronum = dt.Rows[0]["PRO_NUM"].ToString(); } else { pronum = "0"; } //if (Convert.ToInt32(numPieces.Value) + Convert.ToInt32(pronum) > LoadingPiece) //{ // MessageUtil.ShowTips("加工支数不能大于上料支数!"); // return; //} //if(Convert.ToInt32(numQualified.Value)>CutPiece) //{ // MessageUtil.ShowTips("切管个数不能大于加工最大可切个数!"); //} ArrayList list = new ArrayList(); CouplingCutResultEntity cut = new CouplingCutResultEntity(); cut.MachineNo = cmbJcCode.Text.Trim(); cut.CutPieces = numPieces.Value == null ? 0 : Convert.ToDecimal(numPieces.Value.ToString()); cut.QualifiedNumber = numQualified.Value == null ? 0 :Convert.ToDecimal(numQualified.Value.ToString()); cut.RejectedPcs = numRejected.Value == null ? 0 : Convert.ToDecimal(numRejected.Value.ToString()); cut.PraloPcs = Convert.ToDecimal(praloPcs.Value.ToString()); cut.RejectedReason = cmbReason.Text.Trim(); cut.LvalidLength = numLength.Value == null ? 0 : Convert.ToDecimal(numLength.Value.ToString()); cut.ColOperator = cmbOperator.Text.Trim(); cut.ColShift = txtBC.Value.ToString(); cut.ColGroup = txtBz.Value.ToString(); cut.ColUser = txtUser.Text.ToString(); cut.IsEmbossed = cmbEmbossed.Value.ToString(); cut.EmbCount = Convert.ToDecimal(numEmbossed.Value.ToString()); cut.EmbContent = txtEmbossed.Text.Trim(); cut.PlineCode = row.Cells["PlineCode"].Text.ToString(); cut.PlineName = row.Cells["PlineName"].Text.ToString(); cut.WoId = row.Cells["WoId"].Text.ToString(); cut.ColTime = ProTime.Value.ToString("yyyy-MM-dd HH:mm:ss"); cut.CreateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); cut.Memo = txtMemo.Text.Trim(); list.Add(JSONFormat.Format(cut)); //cut.IsRemaining //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]["CUT_PLN_NUMB"].ToString()); // CutCount = Double.Parse(dt1.Rows[0]["CUT_OK_NUM"].ToString()); //} //// + Double.Parse(numQualified.Value.ToString()) //if (CutCount > PlnCount) //{ // if (MessageUtil.ShowYesNoAndQuestion("实际锯切个数超过计划锯切个数是否新增!") == DialogResult.No) { return; } //} string machineNo = ""; if (!cmbJcCode.Text.ToString().Trim().Equals("")) { machineNo = cmbJcCode.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.coup.CoupCutService"; ccp.MethodName = "addCutResult"; ccp.ServerParams = new object[] { list, cutGx, embGx, machineNo }; 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() { ultraGrid2.UpdateData(); UltraGridRow uRow = this.ultraGrid2.ActiveRow; if (uRow == null) { MessageUtil.ShowTips("锯切实绩无数据!"); return; } if (uRow.Cells["IfAllOutWork"].Value.ToString().Equals("是")) { MessageUtil.ShowTips("此工序已经离线,不允许此操作!"); return; } UltraGridRow row = this.ultraGridWoId.ActiveRow; if (row == null) { MessageUtil.ShowTips("无工单信息,不允许此操作!"); } if (!row.Cells["ZyBillStatus"].Value.ToString().Equals("生产中")) { MessageUtil.ShowTips("此工单不是生产中,不允许此操作!"); return; } string zPieces = ""; string fPieces = ""; string gPieces = ""; if (numPieces.Value == null || numPieces.Value.Equals("")) { zPieces = "0"; } else { zPieces = numPieces.Value.ToString(); } if (numQualified.Value == null || numQualified.Value.Equals("")) { gPieces = "0"; } else { gPieces = numQualified.Value.ToString(); } if (numRejected.Value == null || numRejected.Value.Equals("")) { fPieces = "0"; } else { fPieces = numRejected.Value.ToString(); } //string zYgNo = uRow.Cells["ZY_PLAN_ID"].Value.ToString(); //string woId = uRow.Cells["WO_ID"].Value.ToString(); //DataTable dt = ServerHelper.GetData("com.steering.mes.mcp.common.PlanService.getQueryWoIdDetails", new object[] { woId, zYgNo }, this.ob); //if (dt.Rows[0]["CUT_STATUS"].ToString().Equals("生产完成")) //{ // MessageUtil.ShowTips("此工单工序点已结炉,不允许此操作!"); // return; //} //if(!QueryStatusGd(row.Cells["WO_ID"].Value.ToString(), row.Cells["ZY_PLAN_ID"].Value.ToString())) return; if (double.Parse(gPieces) < double.Parse(fPieces)) { MessageUtil.ShowTips("废品个数不能大于锯切个数!"); return; } ArrayList list = new ArrayList(); list.Add(uRow.Cells["ResultNo"].Text.ToString()); list.Add(gPieces);//加工个数 list.Add(zPieces);//加工支数 list.Add(fPieces); list.Add(cmbReason.Text.ToString()); list.Add(txtBC.Value.ToString()); list.Add(txtBz.Value.ToString()); list.Add(cmbJcCode.Text.Trim()); list.Add(numLength.Value.ToString() == null ? "0" : numLength.Value.ToString()); list.Add(cmbOperator.Text.Trim()); list.Add(txtEmbossed.Text.Trim()); list.Add(numEmbossed.Value.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]["CUT_PLN_NUMB"].ToString()); // CutCount = Double.Parse(dt1.Rows[0]["CUT_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.CoupCutService"; ccp.MethodName = "updateCutResult"; ccp.ServerParams = new object[] { list, cutGx, embGx, row.Cells["WoId"].Text.ToString() }; 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 DoDelete() { this.ultraGrid2.UpdateData(); IQueryable checkMagRows = this.ultraGrid2.Rows.AsQueryable().Where(" CHECK = 'True'"); if (checkMagRows.Count() == 0) { MessageUtil.ShowTips("请选择需要撤销锯切的信息!"); return; } UltraGridRow uRow = this.ultraGrid2.ActiveRow; if (uRow == null) return; if (uRow.Cells["Confirm"].Value.Equals("1")) { MessageUtil.ShowTips("选中的锯切实绩已经确认,不允许删除!"); return; } UltraGridRow row = this.ultraGridWoId.ActiveRow; if (!row.Cells["ZyBillStatus"].Value.ToString().Equals("生产中")) { MessageUtil.ShowTips("此工单不是生产中,不允许此操作!"); return; } ArrayList list = new ArrayList(); foreach (UltraGridRow rows in checkMagRows) { CouplingCutResultEntity matBcEntity = (CouplingCutResultEntity)rows.ListObject; string matEntity = JSONFormat.Format(matBcEntity); list.Add(matEntity); } 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 = "deleteCutResult"; ccp.ServerParams = new object[] { list, row.Cells["WoId"].Text.ToString(), cutGx }; 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(); DoClean(); } } /// /// 按回车键触发查询按钮 /// /// /// private void ContPublic_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { QuerySinglePlan(); } } /// /// 托选 /// /// /// private void ultraGrid2_AfterSelectChange(object sender, AfterSelectChangeEventArgs e) { try { ultraGrid2.UpdateData(); foreach (UltraGridRow row in ultraGrid2.Rows) { row.Cells["CHC"].Value = row.Selected; } } catch { } } /// /// 机床编号改变事件 /// /// /// ///查询操作工,根据机床编号 private void cmbJcCode_TextChanged(object sender, EventArgs e) { UltraGridRow row = this.ultraGridWoId.ActiveRow; if (row == null) return; string[] lathCutNm = row.Cells["LatheCutNm"].Text.ToString().Replace(" ", "").Split(','); DataTable dt = ServerHelper.GetData("com.steering.mes.mcp.coup.CoupCutService.getMachUser", new object[] { cmbJcCode.Text.ToString(), lathCutNm }, this.ob); cmbOperator.DataSource = dt; cmbOperator.DisplayMember = "MACHINE_USER1"; cmbOperator.ValueMember = "MACHINE_USER1"; YdmBaseClass.SetComboItemHeight(cmbOperator); } /// /// 废品 /// /// /// private void numRejected_ValueChanged(object sender, EventArgs e) { string zPieces = ""; string fPieces = ""; string gPieces = ""; //if (cmbEmbossed.Text.ToString().Equals("是")) //{ // numEmbossed.Value = double.Parse(numQualified.Value.ToString()); //} UltraGridRow uRow = this.ultraGridWoId.ActiveRow; if (uRow == null) return; if (numPieces.Text == null || numPieces.Text.Equals("")) { zPieces = "0"; } else { zPieces = numPieces.Value.ToString(); } if (numQualified.Text == null || numQualified.Text.Equals("")) { gPieces = "0"; } else { gPieces = numQualified.Value.ToString(); } if (numRejected.Text == null || numRejected.Text.Equals("")) { fPieces = "0"; } else { fPieces = numRejected.Value.ToString(); } jgPiece = int.Parse(zPieces) * int.Parse(uRow.Cells["SingleCutNun"].Value.ToString()); if (jgPiece - int.Parse(fPieces) < int.Parse(gPieces)) { praloPcs.Text = ("-" + (int.Parse(fPieces) + int.Parse(gPieces) - jgPiece)).ToString().Trim(); } else { praloPcs.Text = (jgPiece - int.Parse(fPieces) - int.Parse(gPieces)).ToString().Trim(); } if (numRejected.Value==null||numRejected.Value.ToString().Equals("")) { cmbReason.Enabled = false; } else { cmbReason.Enabled = true; } if (cmbEmbossed.Text.ToString().Equals("是")) { if (int.Parse(numQualified.Value.ToString())< 0) { numEmbossed.Value = 0; } else { numEmbossed.Value = int.Parse(numQualified.Value.ToString()); } } } private void DoClean() { cmbJcCode.Text = ""; cmbOperator.Text = ""; numPieces.Text = ""; numQualified.Text = ""; numRejected.Text = ""; cmbReason.Text = ""; txtBC.Value = this.UserInfo.GetUserOrder(); txtBz.Value = this.UserInfo.GetUserGroup(); numLength.Text = "0.00"; numEmbossed.Value = 0; txtEmbossed.Text = ""; txtMemo.Text = ""; } private void numQualified_ValueChanged(object sender, EventArgs e) { string zPieces = ""; string fPieces = ""; string gPieces = ""; //if (cmbEmbossed.Text.ToString().Equals("是")) //{ // if (numQualified.Value.ToString() == null || numQualified.Value.ToString().Equals("")) // { // numEmbossed.Value = 0; // } // else // { // numEmbossed.Value = double.Parse(numQualified.Value.ToString()); // } //} UltraGridRow uRow = this.ultraGridWoId.ActiveRow; if (uRow == null) return; if (numPieces.Text == null || numPieces.Text.Equals("")) { zPieces = "0"; } else { zPieces = numPieces.Value.ToString(); } if (numQualified.Text == null || numQualified.Text.Equals("")) { gPieces = "0"; } else { gPieces = numQualified.Value.ToString(); } if (numRejected.Text == null || numRejected.Text.Equals("")) { fPieces = "0"; } else { fPieces = numRejected.Value.ToString(); } jgPiece = int.Parse(zPieces) * int.Parse(uRow.Cells["SingleCutNun"].Value.ToString()); if (jgPiece - int.Parse(fPieces) < int.Parse(gPieces)) { praloPcs.Text = ("-" + (int.Parse(fPieces) + int.Parse(gPieces) - jgPiece)).ToString().Trim(); } else { praloPcs.Text = (jgPiece - int.Parse(fPieces) - int.Parse(gPieces)).ToString().Trim(); } if(cmbEmbossed.Text.Equals("是")) { if (numQualified.Text == null || numQualified.Text.Equals("")) { numEmbossed.Value = "0"; } else { numEmbossed.Value = numQualified.Value.ToString(); } } else { numEmbossed.Value = "0"; } } /// /// /// /// /// private void ultraGrid2_AfterRowActivate(object sender, EventArgs e) { UltraGridRow uRow = this.ultraGrid2.ActiveRow; if (uRow == null) return; //if (uRow.Cells["IfAllOutWork"].Value.ToString().Equals("/")) //{ //cmbJcCode.Text = uRow.Cells["MachineNo"].Value.ToString(); //numPieces.Value = uRow.Cells["CutPieces"].Value.ToString(); //numQualified.Value = uRow.Cells["QualifiedNumber"].Value.ToString(); //numRejected.Value = uRow.Cells["RejectedPcs"].Value.ToString(); //cmbReason.Text = uRow.Cells["RejectedReason"].Value.ToString(); //numLength.Value = uRow.Cells["LvalidLength"].Value.ToString(); //cmbOperator.Text = uRow.Cells["ColOperator"].Value.ToString(); //txtBC.Text = uRow.Cells["ColShift"].Value.ToString(); //txtBz.Text = uRow.Cells["ColGroup"].Value.ToString(); //txtUser.Text = uRow.Cells["ColUser"].Value.ToString(); //cmbEmbossed.Text = uRow.Cells["IsEmbossed"].Value.ToString(); //numEmbossed.Value = uRow.Cells["EmbCount"].Value.ToString(); //txtEmbossed.Text = uRow.Cells["EmbContent"].Value.ToString(); //} } 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 numPieces_ValueChanged(object sender, EventArgs e) { string gPieces = ""; string zPieces = ""; string fPieces = ""; UltraGridRow row = ultraGridWoId.ActiveRow; if (row == null) return; if (numPieces.Text == null || numPieces.Text.Equals("")) { zPieces = "0"; } else { zPieces = numPieces.Value.ToString(); } if (numQualified.Text == null || numQualified.Text.Equals("")) { gPieces = "0"; } else { gPieces = numQualified.Value.ToString(); } if (numRejected.Text == null || numRejected.Text.Equals("")) { fPieces = "0"; } else { fPieces = numRejected.Value.ToString(); } jgPiece = int.Parse(zPieces) * int.Parse(row.Cells["SingleCutNun"].Value.ToString()); if (jgPiece - int.Parse(fPieces) < int.Parse(gPieces)) { praloPcs.Text = ("-" + (int.Parse(fPieces) + int.Parse(gPieces) - jgPiece)).ToString().Trim(); } else { praloPcs.Text = (jgPiece - int.Parse(fPieces) - int.Parse(gPieces)).ToString().Trim(); } } private void cmbEmbossed_TextChanged(object sender, EventArgs e) { if (cmbEmbossed.Text.Equals("是")) { numEmbossed.Enabled = true; txtEmbossed.Enabled = true; } else { numEmbossed.Enabled = false; txtEmbossed.Enabled = false; } } private void ultraGrid2_CellChange(object sender, CellEventArgs e) { UltraGridRow uRow = this.ultraGrid2.ActiveRow; if (uRow == null) return; if (Convert.ToBoolean(uRow.Cells["CHECK"].Text) == true) { cmbJcCode.Text = uRow.Cells["MachineNo"].Value.ToString(); numPieces.Value = uRow.Cells["CutPieces"].Value.ToString(); numQualified.Value = uRow.Cells["QualifiedNumber"].Value.ToString(); numRejected.Value = uRow.Cells["RejectedPcs"].Value.ToString(); cmbReason.Text = uRow.Cells["RejectedReason"].Value.ToString(); numLength.Value = uRow.Cells["LvalidLength"].Value.ToString(); cmbOperator.Text = uRow.Cells["ColOperator"].Value.ToString(); txtBC.Text = uRow.Cells["ColShift"].Value.ToString(); txtBz.Text = uRow.Cells["ColGroup"].Value.ToString(); txtUser.Text = uRow.Cells["ColUser"].Value.ToString(); cmbEmbossed.Text = uRow.Cells["IsEmbossed"].Value.ToString(); numEmbossed.Value = uRow.Cells["EmbCount"].Value.ToString(); txtEmbossed.Text = uRow.Cells["EmbContent"].Value.ToString(); } else { DoClean(); } } 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 numEmbossed_AfterEnterEditMode(object sender, EventArgs e) { this.BeginInvoke(new MethodInvoker(this.numEmbossed.SelectAll)); } private void cmbOperator_TextChanged(object sender, EventArgs e) { txtBz.Text = ""; DataTable dt = ServerHelper.GetData("com.steering.mes.mcp.coup.CoupCutService.getMatProBz", new object[] { cmbOperator.Text.ToString() }, this.ob); if(dt.Rows.Count>0) { txtBz.DataSource = dt; txtBz.DisplayMember = "PRO_BZ_NAME"; txtBz.ValueMember = "PRO_BZ"; txtBz.SelectedIndex = 0; YdmBaseClass.SetComboItemHeight(txtBz); } } } }