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.Mes.Client.Comm.Server; using Core.Mes.Client.Comm.Control; using Infragistics.Win.UltraWinGrid; using System.Collections; using com.steering.mes.mcp.entity; using Core.StlMes.Client.Mcp.Common; using Core.Mes.Client.Comm.Tool; using Core.StlMes.Client.Mcp; using Core.StlMes.Client.Mcp.CollarMaterial; using Core.StlMes.Client.Mcp.Control; using Core.StlMes.Client.Mcp.Entity; using Core.StlMes.Client.Mcp.BaseMethod; using Core.StlMes.Client.Mcp.Coupling; using Core.StlMes.Client.Mcp.Report; namespace Core.StlMes.Client.Coup { public partial class FrmCoupLoading : FrmBase { private string departm="";//获取部门ID private string[] plineCode = null;//获取产线代码 private string SlGx = "";//上料工序 private string SLGxName = "";//上料名称 public string LiXian = ""; private string StrMemo = "";//备注 private string[] plineCodes; public FrmCoupLoading() { 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 FrmCoupLoading_Load(object sender, EventArgs e) { EntityHelper.ShowGridCaption(ultraGridWoId.DisplayLayout.Bands[0]); EntityHelper.ShowGridCaption(ultraGrid1.DisplayLayout.Bands[0]); EntityHelper.ShowGridCaption(ultraGridLoad.DisplayLayout.Bands[0]); departm = UserInfo.GetDeptid(); //plineCode = McpBaseHelper.GetPCodePline(departm,this.ob); plineCodes = comm.GetPlineCode(this.ValidDataPurviewIds, "H", ob); //获取工序 DataTable dt2 = ServerHelper.GetData("com.steering.mes.mcp.common.PlanService.getQueryGX", new object[] { "700301" }, this.ob); if (dt2.Rows.Count > 0) { SlGx = dt2.Rows[0]["BASECODE"].ToString(); SLGxName = dt2.Rows[0]["BASENAME"].ToString(); } ProTime.Value = DateTime.Today; txtBC.Value = this.UserInfo.GetUserOrder(); txtBz.Value = this.UserInfo.GetUserGroup(); txtUser.Text = this.UserInfo.GetUserName(); BaseHelper.setOtherColumnReadOnly(ultraGridWoId, new string[] { "CHC", "CraftNoJg2" }); BaseHelper.setUltraGridColumnMaxInput(ultraGridWoId, new string[] { "PlanBlWt", "RealBlWt", "OutWt" }); BaseHelper.setUltraGridColumnBits(ultraGridWoId, new string[] { "PlanJgNum", "CsJgNum", "XqJgNum", "PlanBlNum", "RealBlNum", "OutNum" }); BaseHelper.InitCellPosition(ultraGridWoId, new string[] { "PlanBlWt", "RealBlWt", "OutWt", "PlanJgNum", "CsJgNum", "XqJgNum", "PlanBlNum", "RealBlNum", "OutNum" }); BaseHelper.GridColumnSum(ultraGridWoId, new string[] { "PlanBlWt", "RealBlWt", "OutWt" }); BaseHelper.GridColumnCount(ultraGridWoId, new string[] { "PlanJgNum", "CsJgNum", "XqJgNum", "PlanBlNum", "RealBlNum", "OutNum" }); } public override void ToolBar_Click(object sender, string ToolbarKey) { switch (ToolbarKey) { case "Query": QuerySinglePlan(); break; case "Save": Save(); break; case "Delete": DoDelete(); break; case"Back"://回库 doBack(); break; case "CancelBack"://撤销回库 CancelBack(); break; case "Offline"://离线 Offline(); break; case "unOffline": unOffline(); break; case "DoBeside"://结炉 DoBeside(); break; case "UndoBeside"://撤销结炉 UndoBeside(); break; case "Confirm": confirm();//确认 break; case"CancelConfirm": cancelConfirm(); break; case "Print": Print(); break; case "Close": this.Close(); break; } } /// /// 打印收料单 /// private void Print() { this.ultraGridWoId.UpdateData(); UltraGridRow uRow = this.ultraGridWoId.ActiveRow; if (uRow == null) return; string woId = uRow.Cells["WoId"].Text.Trim(); string strurl = ""; strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepJgConsignationForm.cpt" + "&WO_ID=" + woId; FrmRepExcel fBug = new FrmRepExcel(ob, strurl); fBug.AutoSize = true; fBug.MaximumSize = new Size(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height); fBug.WindowState = FormWindowState.Maximized; fBug.Text = "收料单"; fBug.Show(); } /// /// 取消确认 /// private void cancelConfirm() { ultraGridLoad.UpdateData(); UltraGridRow uRow = this.ultraGridLoad.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 ultraGridLoad.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.CoupLoadingService"; 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() { ultraGridLoad.UpdateData(); UltraGridRow uRow = this.ultraGridLoad.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 ultraGridLoad.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.CoupLoadingService"; 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; } if (row.Cells["FeedHeatNo"].Text.ToString() == "A21032378") { MessageUtil.ShowTips("天淮来料离线需要测试,请联系视拓!"); return; } if (row.Cells["FeedHeatNo"].Text.ToString() == "A21032381") { MessageUtil.ShowTips("天淮来料离线需要测试,请联系视拓!"); return; } if (row.Cells["FeedHeatNo"].Text.ToString() == "A21032548") { MessageUtil.ShowTips("天淮来料离线需要测试,请联系视拓!"); return; } UltraGridRow row1 = ultraGridLoad.ActiveRow; if (row1 == null) { MessageUtil.ShowTips("没有上料实绩不能离线!"); return; } OffLine frm = new OffLine(); 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.CoupLoadingService.getLoadResult1", new object[] { row.Cells["WoId"].Value.ToString() }, this.ob); string pronum = ""; if (dt.Rows.Count > 0) { pronum = dt.Rows[0]["PRO_NUM"].ToString(); } else { pronum = "0"; } string woId = row.Cells["WoId"].Value.ToString(); if (row1.Cells["OffNum"].Value.ToString() == "") { row1.Cells["OffNum"].Value = "0"; } if (int.Parse(pronum) < int.Parse(LiXian) + int.Parse(offlinePiece.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(row1.Cells["ResultNo"].Value.ToString()); list.Add(StrMemo); list.Add(row.Cells["BatchGroudNo"].Value.ToString()); list.Add(row.Cells["FeedHeatNo"].Text.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, SlGx, SLGxName }; 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() { 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 = row.Cells["WoId"].Value.ToString(); ArrayList list1 = new ArrayList(); int UpdaCount = 0; foreach (UltraGridRow ugr in ultraGridLoad.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(), SlGx }; 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; } //查询上料实绩支数总和 DataTable dt = ServerHelper.GetData("com.steering.mes.mcp.coup.CoupLoadingService.getLoadResult1", new object[] { uRow.Cells["WoId"].Value.ToString() }, this.ob); string pronum = ""; if (dt.Rows.Count > 0) { pronum = dt.Rows[0]["PRO_NUM"].ToString(); } else { pronum = "0"; } UltraGridRow Row = this.ultraGrid2.ActiveRow; if(Row!=null) { if (Convert.ToInt32(uRow.Cells["PlanBlNum"].Value) > Convert.ToInt32(pronum)) { MessageUtil.ShowTips("上料支数的和不能小于计划支数!"); return; } } string woId = uRow.Cells["WoId"].Value.ToString(); if (MessageUtil.ShowYesNoAndQuestion("是否结炉?") == DialogResult.No) { return; } CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "com.steering.mes.mcp.coup.CoupLoadingService"; ccp.MethodName = "doBeside"; ccp.ServerParams = new object[] { SlGx, 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.CoupLoadingService"; ccp.MethodName = "undoBeside"; ccp.ServerParams = new object[] { SlGx, 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 = ""; #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.getQueryWoId", 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, plineCodes }, this.ob); bindingSource1.DataSource = listSource1; GridHelper.RefreshAndAutoSize(ultraGrid1); } private void ultraGridWoId_AfterRowActivate(object sender, EventArgs e) { this.ultraGrid1AfterRowActivate(); } /// /// 上料计划详情 /// private void ultraGrid1AfterRowActivate() { UltraGridRow row = ultraGridWoId.ActiveRow; if (row != null) { string zYgNo = row.Cells["HeatPlanNo"].Value.ToString(); string woId = row.Cells["WoId"].Value.ToString(); string judNo = row.Cells["FeedHeatNo"].Value.ToString(); //string judNo = row.Cells["JudgeStoveNo"].Value.ToString(); string batchNo = row.Cells["BatchNo"].Value.ToString(); string batchNoGroup = row.Cells["BatchGroudNo"].Value.ToString(); //string plNo = row.Cells["BatchGroudNo"].Value.ToString(); //this.getJGCutPlan(woId,zYgNo); this.getMatZcM(judNo, batchNo, batchNoGroup); this.getCoupLing(woId); } if (row == null) { numPieces.Value = "0"; } else { numPieces.Value = row.Cells["PlanBlNum"].Text.ToString(); } } /// /// 查询物料信息 /// /// /// private void getMatZcM(string judNo, string batchNo, string batchNoGroup) { DataTable dt = ServerHelper.GetData("com.steering.mes.mcp.coup.CoupLoadingService.getMatZcMById", new object[] { judNo, batchNo, batchNoGroup }, this.ob); GridHelper.CopyDataToDatatable(ref dt, ref dtPipes, true); UltraGridColumn[] col = new UltraGridColumn[] { ultraGrid2.DisplayLayout.Bands[0].Columns["STD_NAME"]}; GridHelper.RefreshAndAutoSizeExceptColumns(ultraGrid2, col); } /// /// 查询上料信息 /// /// /// private void getCoupLing(string woId) { List listSource1 = EntityHelper.GetData ("com.steering.mes.mcp.coup.CoupLoadingService.getCoupLingById", new object[] {woId }, this.ob); CoupLoadResultEntitybindingSource.DataSource = listSource1; GridHelper.RefreshAndAutoSize(ultraGridLoad); foreach (UltraGridRow urg in ultraGridLoad.Rows) { if (urg.Cells["Confirm"].Value.Equals("1")) { urg.Appearance.BackColor = Color.LightGreen; } } } /// /// 接箍切断计划详细 /// /// //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 Save() { UltraGridRow row = ultraGridWoId.ActiveRow; if (row == null) { MessageUtil.ShowTips("无工单信息,请确认!"); return; } string woId=row.Cells["WoId"].Text.ToString(); UltraGridRow rowMat = ultraGrid2.ActiveRow; if (rowMat == null) { MessageUtil.ShowTips("无物料信息,请确认!"); return; } string datetime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); if (numPieces.Value.ToString() == "0") { MessageUtil.ShowTips("上料支数不能为零或空!"); return; } if(Convert.ToInt32(numPieces.Value)>Convert.ToInt32(rowMat.Cells["ACT_COUNT"].Value)) { MessageUtil.ShowTips("库存不足!"); return; } else { //查询上料实绩支数总和 DataTable dt = ServerHelper.GetData("com.steering.mes.mcp.coup.CoupLoadingService.getLoadResult1", 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) > Convert.ToInt32(row.Cells["PlanBlNum"].Value)) { MessageUtil.ShowTips("计划不足!"); return; } } //string woId = row.Cells["WO_ID"].Text.ToString(); //string planNo = row.Cells["ZY_PLAN_ID"].Text.ToString(); //DataTable dt = ServerHelper.GetData("com.steering.mes.mcp.coup.CoupLoadingService.getCoupCountById1", new object[] { planNo,woId,txtBC.Value.ToString() }, this.ob); //if(!dt.Rows[0]["COUNT"].ToString().Equals("0")) //{ // MessageUtil.ShowTips("该【" + woId + "】工单同一班次下已存在上料记录!"); // return; //} if(txtBC.Value==null||txtBC.Value=="") { MessageUtil.ShowTips("班次不能为空!"); return; } if(txtBz.Value == null||txtBz.Value=="") { MessageUtil.ShowTips("班组不能为空!"); return; } if(Convert.ToInt32(numPieces.Value)>Convert.ToInt32(row.Cells["PlanJgNum"].Value)) { MessageUtil.ShowTips("上料支数不能大于计划支数!"); return; } ArrayList list = new ArrayList(); list.Add(this.UserInfo.GetUserName()); list.Add(datetime); list.Add(txtBC.Value.ToString()); list.Add(txtBz.Value.ToString()); list.Add(numPieces.Value.ToString()); list.Add(ProTime.Value.ToString("yyyy-MM-dd")); list.Add(txtUser.Text.Trim()); list.Add(txtMemo.Text.Trim()); list.Add(txtPlace.Text.Trim()); list.Add(txtMach.Text.Trim()); list.Add(numFail.Text.Trim()); 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.CoupLoadingService"; ccp.MethodName = "saveLoadResult"; ccp.ServerParams = new object[] { list, SlGx, woId }; 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 doBack() { string _strat = ""; string backNum = ""; ultraGridWoId.UpdateData(); UltraGridRow row = ultraGridWoId.ActiveRow; if (row == null) { MessageUtil.ShowTips("无工单信息!"); return; } UltraGridRow rowMat = ultraGridLoad.ActiveRow; if (rowMat == null) { MessageUtil.ShowTips("无上料实绩记录!"); return; } if(rowMat.Cells["Confirm"].Value.Equals("1")) { MessageUtil.ShowTips("选中的上料实绩已经确认,不允许回库!"); return; } string datetime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); Oback frm = new Oback(); frm.ShowDialog(); backNum = frm.StrNum; _strat = frm.Strat; if (_strat.Equals("")) return; if (backNum.Equals("") || backNum.Equals("0")) { MessageUtil.ShowTips("回库支数不能为空!"); return; } ArrayList list1 = new ArrayList(); foreach (UltraGridRow item in ultraGridLoad.Rows) { if (Convert.ToBoolean(item.Cells["CHECK"].Text) == true) { if(int.Parse(backNum)>=int.Parse(item.Cells["LoadPieces"].Value.ToString())) { MessageUtil.ShowTips("回库支数不能大于等于上料支数!"); return; } ArrayList list = new ArrayList(); list.Add(item.Cells["ResultNo"].Text.ToString()); list.Add(backNum); list.Add(this.UserInfo.GetUserName()); list.Add(datetime); list.Add(item.Cells["WoId"].Text.ToString()); list1.Add(list); } } 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.CoupLoadingService"; ccp.MethodName = "doBackResult"; ccp.ServerParams = new object[] { list1, SlGx }; 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 CancelBack() { string _strat = ""; string backNum = ""; ultraGridWoId.UpdateData(); UltraGridRow row = ultraGridWoId.ActiveRow; if (row == null) { MessageUtil.ShowTips("无工单信息!"); return; } UltraGridRow rowMat = ultraGridLoad.ActiveRow; if (rowMat == null) { MessageUtil.ShowTips("无上料实绩记录!"); return; } if (rowMat.Cells["Confirm"].Value.Equals("1")) { MessageUtil.ShowTips("选中的上料实绩已经确认,不允许撤销回库!"); return; } int Data = 0; string count = ""; //查询工单回库多少支 DataTable dt = ServerHelper.GetData("com.steering.mes.mcp.coup.CoupLoadingService.getCoupBackPiece", new object[] { row.Cells["WoId"].Text.ToString() }, this.ob); if (!dt.Rows[0]["COUNT"].ToString().Equals("0")) { count = dt.Rows[0]["COUNT"].ToString(); } string datetime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); Oback frm = new Oback(); frm.ShowDialog(); backNum = frm.StrNum; _strat = frm.Strat; if (_strat.Equals("")) return; if (backNum.Equals("") || backNum.Equals("0")) { MessageUtil.ShowTips("撤销回库支数不能为空!"); return; } ArrayList list1 = new ArrayList(); foreach (UltraGridRow item in ultraGridLoad.Rows) { if (Convert.ToBoolean(item.Cells["CHECK"].Text) == true) { Data += 1; if (int.Parse(backNum) > int.Parse(count)) { MessageUtil.ShowTips("撤销回库支数不能大于回库支数!"); return; } ArrayList list = new ArrayList(); list.Add(item.Cells["ResultNo"].Text.ToString()); list.Add(backNum); list.Add(this.UserInfo.GetUserName()); list.Add(datetime); list.Add(item.Cells["WoId"].Text.ToString()); list1.Add(list); } } if (Data == 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.CoupLoadingService"; ccp.MethodName = "doCancelBackResult"; ccp.ServerParams = new object[] { list1, SlGx }; 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() { ultraGridWoId.UpdateData(); UltraGridRow row = ultraGridWoId.ActiveRow; if (row == null) { MessageUtil.ShowTips("无工单信息!"); return; } UltraGridRow rowMat = ultraGridLoad.ActiveRow; if (rowMat == null) { MessageUtil.ShowTips("无上料实绩记录!"); return; } if (rowMat.Cells["Confirm"].Value.Equals("1")) { MessageUtil.ShowTips("选中的上料实绩已经确认,不允许删除!"); return; } string datetime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); ArrayList list1 = new ArrayList(); foreach (UltraGridRow item in ultraGridLoad.Rows) { if (Convert.ToBoolean(item.Cells["CHECK"].Text) == true) { ArrayList list = new ArrayList(); list.Add(item.Cells["ResultNo"].Text.ToString()); list.Add(this.UserInfo.GetUserName()); list.Add(datetime); list.Add(this.UserInfo.GetUserOrder()); list.Add(this.UserInfo.GetUserGroup()); list.Add(row.Cells["FeedHeatNo"].Text.ToString()); list1.Add(list); } } 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.CoupLoadingService"; ccp.MethodName = "deleteLoadResult"; ccp.ServerParams = new object[] { list1, SlGx }; 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 ContPublic_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { QuerySinglePlan(); } } //private void ultraGrid2_AfterRowActivate(object sender, EventArgs e) //{ // UltraGridRow urg=ultraGrid2.ActiveRow; // if (urg == null) // { // numPieces.Value = "0"; // } // else // { // numPieces.Value = urg.Cells["ACT_COUNT"].Text.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 ultraGridLoad_AfterRowActivate(object sender, EventArgs e) { UltraGridRow rowMat = ultraGridLoad.ActiveRow; if (rowMat == null) return; //numPieces.Value = rowMat.Cells["LoadPieces"].Text.ToString(); //txtBC.Text = rowMat.Cells["LoadShift"].Text.ToString(); //txtBz.Text = rowMat.Cells["LoadGroup"].Text.ToString(); if (rowMat.Cells["ProTime"].Text.ToString().Equals("")) { ProTime.Value = DateTime.Today; } else { ProTime.Value = DateTime.Parse(rowMat.Cells["ProTime"].Text.ToString()); } txtUser.Value = rowMat.Cells["LoadUser"].Text.ToString(); //查询工单的离线支数 DataTable dt = ServerHelper.GetData("com.steering.mes.mcp.coup.CoupLoadingService.getQueryOfflinePiece", new object[] { rowMat.Cells["WoId"].Value }, this.ob); if (dt.Rows.Count > 0) { if (dt.Rows[0]["OFFLINE_NUM_BJ"].ToString() == null || dt.Rows[0]["OFFLINE_NUM_BJ"].ToString() == "") { offlinePiece.Value = 0; } else { offlinePiece.Value = Convert.ToInt64(dt.Rows[0]["OFFLINE_NUM_BJ"].ToString()); } } } private void craftImg_EditorButtonClick(object sender, Infragistics.Win.UltraWinEditors.EditorButtonEventArgs e) { //UltraGridRow row = ultraGridWoId.ActiveRow; //string craftPath = YdmBaseClass.getQueryCraftNoJG(row.Cells["CraftNoJg2"].Text.ToString(), row.Cells["CraftSeq2"].Text.ToString(), ob); //if (e.Button.Key.ToLower().Equals("select")) //{ // FormFileDown down = new FormFileDown(ob, craftPath); // down.CtrlFileDown1.Button3.Visible = false; // down.ShowDialog(); //} 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_AfterEnterEditMode(object sender, EventArgs e) { this.BeginInvoke(new MethodInvoker(this.numPieces.SelectAll)); } private void card_EditorButtonClick(object sender, Infragistics.Win.UltraWinEditors.EditorButtonEventArgs e) { UltraGridRow row = ultraGridLoad.ActiveRow; if (row == null) return; string woId = row.Cells["WoId"].Text.ToString(); string judgeNo = row.Cells["JudgeStoveNo"].Text.ToString(); string plinCode = row.Cells["PlineCode"].Text.ToString(); string strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=CouplingDeliveryCard.cpt" + "&woId=" + woId + "&judgeNo=" + judgeNo + "&plineCode=" +plinCode; FrmRepExcel down = new FrmRepExcel(ob, strurl); down.Text = "接箍传递卡"; down.Visible = false; down.Size = new Size(740, this.Height); down.WindowState = FormWindowState.Maximized; down.ShowDialog(); } } }