| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799 |
- 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.Mes.Client.Comm.Tool;
- using Core.StlMes.Client.Mcp.Control;
- using Core.StlMes.Client.Mcp.VRP.Vrp;
- namespace Core.StlMes.Client.Htt
- {
- public partial class FrmVrpLoading : FrmBase
- {
- private string SlGx
- {
- get
- {
- if (plineCode == "C018")
- {
- return "650101";
- }
- else if (plineCode == "C021")
- {
- return "650401";
- }
- else if (plineCode == "C014")
- {
- return "650501";
- }
- else if (plineCode == "C013")
- {
- return "650601";
- }
- else if (plineCode == "C070")
- {
- return "650701";
- }
- return "650401";
- }
- }
- // private string SlGxname = "";
- private string departm = "";
- private string plineCode = "";
- private string[] plineCodes ;
- private string dingwei = "";
- public FrmVrpLoading()
- {
- InitializeComponent();
- this.IsLoadUserView = true;
- }
- protected override void OnLoad(EventArgs e)
- {
- base.OnLoad(e);
- this.planExpanQuery1.Grid.DisplayLayout.Override.AllowRowFiltering = Infragistics.Win.DefaultableBoolean.False;
- }
- public override void ToolBar_Click(object sender, string ToolbarKey)
- {
- //base.ToolBar_Click(sender, ToolbarKey);
- switch (ToolbarKey)
- {
- case "DoQuery":
- QuerySinglePlan();
- break;
- case "DoLoading":
- DoSave();
- break;
- case "DoReturn":
- DoReturn();
- break;
- case "DoUpdate":
- DoUpdate();
- break;
- case "DoBeside":
- DoBeside();
- break;
- case "CelBeside":
- DoCelBeside();
- break;
- case "DoClose":
- this.Close();
- break;
- case "Export":
- Mes.Client.Comm.Globals.ulGridToExcel(ultraGrid1, Text);
- break;
- }
- }
- private void DoCelBeside()
- {
- UltraGridRow row = ultraGrid1.ActiveRow;
- if (row == null) return;
- ArrayList list = new ArrayList();
- list.Add(row.Cells["HEAT_PLAN_NO"].Value.ToString());
- list.Add(row.Cells["PLINE_CODE"].Value.ToString());
- list.Add(SlGx);
- if (MessageUtil.ShowYesNoAndQuestion("是否撤销结炉?") == DialogResult.No)
- {
- return;
- }
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.mes.mcp.Vrp.FrmVrpLoading";
- ccp.MethodName = "undoBeside";
- ccp.ServerParams = new Object[] { list };
- ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp.ReturnCode != -1)
- {
- MessageUtil.ShowTips(ccp.ReturnInfo);
- if (ccp.ReturnInfo.Equals("撤销结炉成功!"))
- {
- QuerySinglePlan();
- initControl();
- }
- }
- }
- /// <summary>
- /// 工序结炉
- /// </summary>
- private void DoBeside()
- {
- UltraGridRow row = ultraGrid1.ActiveRow;
- if (row == null)
- {
- MessageUtil.ShowTips("请选择需要结炉的工单号!");
- return;
- }
- ArrayList list = new ArrayList();
- list.Add(row.Cells["HEAT_PLAN_NO"].Value.ToString());
- list.Add(row.Cells["PLINE_CODE"].Value.ToString());
- list.Add(SlGx);
- list.Add(row.Cells["JUDGE_STOVE_NO"].Value.ToString());
- list.Add(row.Cells["BATCH_NO"].Value.ToString());
- list.Add(row.Cells["BATCH_GROUD_NO"].Value.ToString());
- list.Add(row.Cells["JUGDE_APPLY_CODE"].Value.ToString());
- list.Add(row.Cells["NEXT_PROCESS_CODE"].Value.ToString());
- if (MessageUtil.ShowYesNoAndQuestion("是否结炉?") == DialogResult.No)
- {
- return;
- }
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.mes.mcp.Vrp.FrmVrpLoading";
- ccp.MethodName = "updateDoBeside";
- ccp.ServerParams = new Object[] { list };
- ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp.ReturnCode != -1)
- {
- MessageUtil.ShowTips(ccp.ReturnInfo);
- if (ccp.ReturnInfo.Equals("结炉成功!"))
- {
- QuerySinglePlan();
- initControl();
- }
- }
- }
- /// <summary>
- /// 简单查询
- /// </summary>
- private void QuerySinglePlan()
- {
- string starts = "";
- string plnNo = "";
- string judgeStoveNo = "";
- string loadStoveNo = "";
- #region 条件
- if (chkPlnNo.Checked)
- {
- if (string.IsNullOrEmpty(txtRollBatchId.Text.Trim()))
- {
- MessageUtil.ShowTips("请输入炉次计划号!");
- return;
- }
- else
- {
- plnNo = txtRollBatchId.Text.ToString().Trim();
- }
- }
- if (chkJuNo.Checked)
- {
- if (string.IsNullOrEmpty(txtZyBatchId.Text.Trim()))
- {
- MessageUtil.ShowTips("请输入炉号!");
- return;
- }
- else
- {
- judgeStoveNo = txtZyBatchId.Text.ToString().Trim();
- }
- }
- if (checkLoad.Checked)
- {
- if (string.IsNullOrEmpty(loadJudgeNo.Text.Trim()))
- {
- MessageUtil.ShowTips("请输入上料炉号!");
- return;
- }
- else
- {
- loadStoveNo = loadJudgeNo.Text.ToString().Trim();
- }
- }
- #endregion
- PlnZyDbkMEntity plan = new PlnZyDbkMEntity();
- plan.JudgeStoveNo = judgeStoveNo;//生产批次号
- plan.HeatPlanNo = plnNo;//组料炉批号
- plan.Planstatus = starts;
- plan.FeedHeatNo = loadStoveNo;
- string dobeside = "";
- string index = "";
- if (ultraOptionSet1.CheckedIndex.ToString() == "0")
- {
- index = "0";
- dobeside = ultraOptionSet1.CheckedItem.DataValue.ToString();
- }
- else if (ultraOptionSet1.CheckedIndex.ToString() == "1")
- {
- index = "1";
- dobeside = ultraOptionSet1.CheckedItem.DataValue.ToString();
- }
- else
- {
- index = "2";
- }
-
- string[] start = contorlPlanStatus1.statusArr;
- //查询镦拔扩计划
- DataTable dt = ServerHelper.GetData("com.steering.mes.mcp.Vrp.FrmVrpLoading.getQueryDbkPlan", new object[] { plan, plineCodes, dobeside,index,start }, this.ob);
- GridHelper.CopyDataToDatatable(ref dt, ref dataTable2, true);
- foreach (UltraGridRow urg in ultraGrid1.Rows)
- {
- if (urg.Cells["PLANSTATUS"].Text.Equals("生产中"))
- {
- urg.Cells["PLANSTATUS"].Appearance.BackColor = Color.LightGreen;
- }
- if (urg.Cells["PLANSTATUS"].Text.Equals("生产完成"))
- {
- urg.Cells["PLANSTATUS"].Appearance.BackColor = Color.Red;
- }
- if (urg.Cells["PLANSTATUS"].Text.Equals("关闭"))
- {
- urg.Cells["PLANSTATUS"].Appearance.BackColor = Color.Red;
- }
- if (urg.Cells["BESIDE_STATUS"].Text.Equals("上料结炉"))
- {
- urg.Cells["BESIDE_STATUS"].Appearance.BackColor = Color.LightGray;
- }
- }
- if (dt.Rows.Count > 0)
- {
- for (int i = 0; i < ultraGrid1.Rows.Count; i++)
- {
- if (ultraGrid1.Rows[i].Cells["HEAT_PLAN_SQE"].Value.ToString() == dingwei)
- {
- UltraGridRow row = ultraGrid1.Rows[i];
- row.Activate();
- }
- }
- }
- }
- //查询管号队列
- private void QueryPortVrp(string planNo)
- {
- //查询管号队列
- DataTable dt = ServerHelper.GetData("com.steering.mes.mcp.common.PlanService.getQueryDbkPortVrp", new object[] { planNo }, this.ob);
- GridHelper.CopyDataToDatatable(ref dt, ref dataTable3, true);
- foreach (UltraGridRow urg in ultraGrid3.Rows)
- {
- if (urg.Cells["MAT_STATUS"].Text.Equals("剔除"))
- {
- urg.Cells["MAT_STATUS"].Appearance.ForeColor = Color.Red;
- }
- }
- }
- /// <summary>
- /// 上料计划详情
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void ultraGrid1_AfterRowActivate(object sender, EventArgs e)
- {
- ultraGrid1.UpdateData();
- UltraGridRow row = ultraGrid1.ActiveRow;
- if (row == null) return;
- dingwei = row.Cells["HEAT_PLAN_SQE"].Value.ToString();
- string heatNo = row.Cells["HEAT_PLAN_NO"].Value.ToString();
- this.GetLoadResult(heatNo);
- plineCode = row.Cells["PLINE_CODE"].Value.ToString();
- VrpLoadingResultEntity result = new VrpLoadingResultEntity();
- if (row.Cells["IF_MONITOR_DBK"].Text.ToString().Equals("是"))
- {
- this.planExpanQuery1.Grid.DisplayLayout.Bands[0].Columns["Producer"].CellActivation = Infragistics.Win.UltraWinGrid.Activation.AllowEdit;
- this.planExpanQuery1.Grid.DisplayLayout.Bands[0].Columns["ProducerTime"].CellActivation = Infragistics.Win.UltraWinGrid.Activation.AllowEdit;
- }
- else
- {
- this.planExpanQuery1.Grid.DisplayLayout.Bands[0].Columns["Producer"].CellActivation = Infragistics.Win.UltraWinGrid.Activation.ActivateOnly;
- this.planExpanQuery1.Grid.DisplayLayout.Bands[0].Columns["ProducerTime"].CellActivation = Infragistics.Win.UltraWinGrid.Activation.ActivateOnly;
- }
- planExpanQuery1.JudNo = row.Cells["FEED_HEAT_NO"].Text.ToString();
- planExpanQuery1.BatchNo = row.Cells["BATCH_NO"].Text.ToString();
- planExpanQuery1.GroupNo = row.Cells["BATCH_GROUD_NO"].Text.ToString();
- planExpanQuery1.danum = row.Cells["MATERIAL_COUNT"].Value.ToString();
- planExpanQuery1.PlineCode = plineCode;
- planExpanQuery1.Ob = this.ob;
- string time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
- result.ProNum = row.Cells["ACT_COUNT"].Value.ToString();
- result.ProWt = row.Cells["ACT_WEIGHT"].Value.ToString();
- result.LoadShift = UserInfo.GetUserOrder();
- result.LoadGroup = UserInfo.GetUserGroup();
- result.LoadUser = UserInfo.GetUserName();
- result.LoadTime = time;
- result.ProducerTime = time;
- this.planExpanQuery1.Value = result;
- QueryPortVrp(heatNo);
- }
- /// <summary>
- /// 根据计划号查询上料实绩
- /// </summary>
- /// <param name="planNo"></param>
- private void GetLoadResult(string heatNo)
- {
- //查询上料实绩
- DataTable dt = ServerHelper.GetData("com.steering.mes.mcp.Vrp.FrmVrpLoading.getLoadResult", new object[] { heatNo }, this.ob);
- GridHelper.CopyDataToDatatable(ref dt, ref dtLoadRecord, true);
- ultraGridLoad.UpdateData();
- ultraGridLoad.ActiveRow = null;
- }
- /// <summary>
- /// 初始化控件
- /// </summary>
- private void initControl()
- {
- string time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
- VrpLoadingResultEntity result = new VrpLoadingResultEntity();
- result.ProNum = "";
- result.ProWt = "";
- result.LoadShift = UserInfo.GetUserOrder();
- result.LoadGroup = UserInfo.GetUserGroup();
- result.LoadUser = UserInfo.GetUserName();
- result.LoadTime = time;
- result.ProducerTime = time;
- this.planExpanQuery1.Value = result;
- }
- /// <summary>
- /// 上料实绩新增
- /// </summary>
- private void DoSave()
- {
- if (this.planExpanQuery1.ValidInput1())
- {
- UltraGridRow row = ultraGrid1.ActiveRow;
- if (row != null)
- {
- string groupNo = row.Cells["BATCH_GROUD_NO"].Value.ToString();
- string gxh="0";
- DataTable dt2 = ServerHelper.GetData("com.steering.mes.mcp.Vrp.FrmVrpLoading.getQueryOrderDbkS", new object[] { plineCode}, this.ob);
-
- if(dt2.Rows.Count>0)
- {
- gxh=dt2.Rows[0]["GX_PRO_SEQ"].ToString();
- }
- if (gxh != "")
- {
- if (row.Cells["EXE_STATUS"].Text.Equals("计划") && int.Parse(gxh) != int.Parse(row.Cells["GX_PRO_SEQ"].Text.ToString()))
- {
- MessageUtil.ShowTips("该炉计划不是当前上料行,不允许上料");
- return;
- }
- if (row.Cells["EXE_STATUS"].Text.ToString().Equals("生产完成"))
- {
- MessageUtil.ShowTips("该炉计划上料行已生产完成,不允许上料");
- return;
- }
- if (row.Cells["EXE_STATUS"].Text.ToString().Equals("关闭"))
- {
- MessageUtil.ShowTips("该炉计划上料行已关闭,不允许上料");
- return;
- }
- }
- //this.planExpanQuery1.UpdateData();
- VrpLoadingResultEntity result = this.planExpanQuery1.Value;
- result.HeatPlanNo = row.Cells["HEAT_PLAN_NO"].Value.ToString();
- //result.ProNum =row.Cells["PRO_NUM"].Value.ToString();
- if (result.ProNum.Equals("") || result.ProNum.Equals("0"))
- {
- MessageUtil.ShowTips("上料支数不能为空或零");
- return;
- }
- //查询上料实绩支数总和
- DataTable dt = ServerHelper.GetData("com.steering.mes.mcp.Vrp.FrmVrpLoading.getLoadResult1", new object[] { row.Cells["HEAT_PLAN_NO"].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";
- }
- /*
- * 2025 - 02 - 25 不合理 注释
- * if (double.Parse(pronum) + double.Parse(result.ProNum) > double.Parse(row.Cells["IN_NUM"].Value.ToString()))
- {
- //if (MessageUtil.ShowYesNoAndQuestion("上料实绩支数已经超过了计划支数,是否继续。") == DialogResult.No) return;
- MessageUtil.ShowTips("上料实绩支数已经超过了计划支数");
- return;
- }*/
- if (double.Parse(result.ProNum) > double.Parse(row.Cells["ACT_COUNT"].Value.ToString()))
- {
- 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.Vrp.FrmVrpLoading";
- ccp.MethodName = "saveLoadingResult";
- ccp.ServerParams = new Object[] { result, row.Cells["HEAT_PLAN_NO"].Value.ToString(), row.Cells["HEAT_PLAN_SQE"].Value.ToString(), SlGx, row.Cells["PLINE_CODE"].Value.ToString(), groupNo };
- 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();
- doOver();
- }
- }
- }
- }
- private void doOver()
- {
- ultraGrid1.UpdateData();
- UltraGridRow row = ultraGrid1.ActiveRow;
- if (row == null) return;
- DataTable dt1 = ServerHelper.GetData("com.steering.mes.mcp.Vrp.FrmVrpLoading.getquerymaternum", new object[] { row.Cells["HEAT_PLAN_NO"].Text.ToString() }, this.ob);
- if (dt1.Rows[0]["NUM"].ToString() == "0" || dt1.Rows[0]["WT"].ToString() == "0.000")
- {
- if (MessageUtil.ShowYesNoAndQuestion("待上料量或重量为0,是否结炉?") == DialogResult.No)
- {
- return;
- }
- else
- {
- DoBeside();
- }
- }
- }
- /// <summary>
- /// 撤销上料
- /// </summary>
- private void DoReturn()
- {
- UltraGridRow row = ultraGrid1.ActiveRow;
- UltraGridRow Rows = ultraGridLoad.ActiveRow;
- if (Rows == null)
- {
- if(ultraGridLoad.Rows.Count<=0) return;
- Rows = ultraGridLoad.Rows[0];
- }
- if (row == null) return;
- //this.instructionCardControl1.UpdateData();
- int delCount = 0;
- string outnum = row.Cells["OUTNUM_CUT"].Value.ToString();
- string groupNo = row.Cells["BATCH_GROUD_NO"].Value.ToString();
- // ArrayList list = new ArrayList();
- string time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
- //foreach (UltraGridRow ugr in ultraGridLoad.Rows)
- //{
- delCount += 1;
- ArrayList list1 = new ArrayList();
- list1.Add(Rows.Cells["RESULT_NO"].Value.ToString());
- list1.Add(row.Cells["FEED_HEAT_NO"].Value.ToString());
- list1.Add(row.Cells["BATCH_NO"].Value.ToString());
- list1.Add(Rows.Cells["PRO_NUM"].Value.ToString());
- list1.Add(this.UserInfo.GetUserName());
- list1.Add(time);
- //list.Add(list1);
- //}
- if (delCount == 0)
- {
- MessageUtil.ShowTips("请选择上料信息!");
- return;
- }
- //查询是否存在上料之后的数据
- DataTable dt = ServerHelper.GetData("com.steering.mes.mcp.Vrp.FrmVrpLoading.getQueryInfoPlan", new object[] { SlGx, row.Cells["HEAT_PLAN_NO"].Value.ToString() }, this.ob);
- if (dt.Rows.Count > 0)
- {
- 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.Vrp.FrmVrpLoading";
- ccp.MethodName = "returnLoadingResult";
- ccp.ServerParams = new Object[] { list1, row.Cells["HEAT_PLAN_NO"].Value.ToString(), row.Cells["PLINE_CODE"].Value.ToString(), SlGx,outnum,groupNo };
- 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();
- }
- }
- //<summary>
- //修改上料
- //</summary>
- private void DoUpdate()
- {
- UltraGridRow row = ultraGrid1.ActiveRow;
- UltraGridRow urg = ultraGridLoad.ActiveRow;
- if (urg == null) return;
- if (row == null) return;
- if (this.planExpanQuery1.ValidInput1())
- {
- this.planExpanQuery1.UpdateData();
- VrpLoadingResultEntity result = this.planExpanQuery1.Value;
- result.PlineCode = row.Cells["PLINE_CODE"].Value.ToString();
- //查询是否存在上料之后的工序
- DataTable dt = ServerHelper.GetData("com.steering.mes.mcp.Vrp.FrmVrpLoading.getQueryInfoPlan", new object[] { row.Cells["HEAT_PLAN_NO"].Value.ToString() }, this.ob);
- if (dt.Rows.Count > 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.Vrp.FrmVrpLoading";
- ccp.MethodName = "updateLoadingResult";
- ccp.ServerParams = new Object[] { result, urg.Cells["RESULT_NO"].Value.ToString(), row.Cells["HEAT_PLAN_NO"].Value.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 FrmVrpLoading_Load(object sender, EventArgs e)
- {
- string code = "";
- //cmbDate.Value = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd 00:00:00"));
- //cmbEndDate.Value = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd 23:59:59"));
- ///departm = UserInfo.GetDepartment();
- // plineCode = YdmBaseClass.GetPCode(departm, this.ob);//获取 用户 对应的产线
- plineCodes = comm.GetPlineCode(this.ValidDataPurviewIds, "E",ob);
-
- /* //获取工序
- DataTable dt2 = ServerHelper.GetData("com.steering.mes.mcp.common.PlanService.getQueryGX", new object[] { code }, this.ob);
- if (dt2.Rows.Count > 0)
- {
- SlGx = dt2.Rows[0]["BASECODE"].ToString();
- SlGxname = dt2.Rows[0]["BASENAME"].ToString();
- }*/
- QuerySinglePlan();
- initControl();
- }
- /// <summary>
- /// 上料
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void ultraGridLoad_AfterRowActivate(object sender, EventArgs e)
- {
- UltraGridRow urg = ultraGridLoad.ActiveRow;
- if (urg == null) return;
- VrpLoadingResultEntity result = new VrpLoadingResultEntity();
- result.LoadShift = urg.Cells["LOAD_SHIFT"].Value.ToString();
- result.LoadGroup = urg.Cells["LOAD_GROUP"].Value.ToString();
- result.LoadUser = urg.Cells["UPDATE_NAME"].Value.ToString() == "" ? this.UserInfo.GetUserName() : urg.Cells["UPDATE_NAME"].Value.ToString();
- result.ProNum = urg.Cells["PRO_NUM"].Value.ToString();
- result.ProWt = urg.Cells["PRO_WT"].Value.ToString();
- result.LoadTime = urg.Cells["LOAD_TIME"].Value.ToString();
- result.Producer = urg.Cells["PRODUCER"].Value.ToString();
- result.ProducerTime = urg.Cells["PRODUCER_TIME"].Value.ToString();
- this.planExpanQuery1.Value = result;
- }
- private void chkStarts_CheckedChanged(object sender, EventArgs e)
- {
- if (chkPlnNo.Checked) { txtRollBatchId.Enabled = true; } else { txtRollBatchId.Enabled = false; }
- if (chkJuNo.Checked) { txtZyBatchId.Enabled = true; } else { txtZyBatchId.Enabled = false; }
- if (checkLoad.Checked) { loadJudgeNo.Enabled = true; } else { loadJudgeNo.Enabled = false; }
- }
- /// <summary>
- /// 物料支数
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void ultraGridMat_AfterRowActivate(object sender, EventArgs e)
- {
- UltraGridRow urg = ultraGrid1.ActiveRow;
- string time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
- VrpLoadingResultEntity result = new VrpLoadingResultEntity();
- if (urg == null) { return; }
- result.ProNum = urg.Cells["ACT_COUNT"].Text.ToString();
- result.ProWt = urg.Cells["ACT_WEIGHT"].Value.ToString();
- result.LoadShift = UserInfo.GetUserOrder();
- result.LoadGroup = UserInfo.GetUserGroup();
- result.LoadUser = UserInfo.GetUserName();
- result.LoadTime = time;
- result.ProducerTime = time;
- //planExpanQuery1.JudNo = urg.Cells["JUDGE_STOVE_NO"].Text.ToString();
- //planExpanQuery1.BatchNo = urg.Cells["BATCH_NO"].Text.ToString();
- //planExpanQuery1.GroupNo = urg.Cells["BATCH_GROUD_NO"].Text.ToString();
- //planExpanQuery1.Ob = this.ob;
- this.planExpanQuery1.Value = result;
- }
- private void craftImg_EditorButtonClick(object sender, Infragistics.Win.UltraWinEditors.EditorButtonEventArgs e)
- {
- UltraGridRow row = ultraGrid1.ActiveRow;
- string craftPath = YdmBaseClass.getQueryCraftNoDBK(row.Cells["CRAFT_FILE_NO"].Text.ToString(), row.Cells["CRAFT_SEQ"].Text.ToString(), ob);
- if (e.Button.Key.ToLower().Equals("select"))
- {
- FormFileDown down = new FormFileDown(ob, craftPath);
- down.CtrlFileDown1.Button3.Visible = false;
- down.ShowDialog();
- }
- }
- private void BtOffline_Click(object sender, EventArgs e)
- {
- UltraGridRow row = ultraGrid1.ActiveRow;
- if (row == null) return;
- UltraGridRow row3 = ultraGrid3.ActiveRow;
- if (row3 == null) return;
- /* UltraGridRow row2 = ultraGridLoad.ActiveRow;
- if (row2 == null) return;*/
- string groupNo = row.Cells["BATCH_GROUD_NO"].Value.ToString();
- if (OfflineNum.Value.ToString().Equals("0"))
- {
- MessageUtil.ShowTips("请输入离线支数!");
- return;
- }
- if (txtReasion.Text.Trim().ToString().Equals(""))
- {
- MessageUtil.ShowTips("请输入离线原因!");
- return;
- }
- string time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
- ArrayList list = new ArrayList();
- list.Add(row.Cells["HEAT_PLAN_NO"].Value.ToString());
- list.Add(SlGx);
- list.Add("");
- list.Add(this.UserInfo.GetUserName());
- list.Add(time);
- list.Add(this.UserInfo.GetUserOrder());
- list.Add(this.UserInfo.GetUserGroup());
- list.Add(OfflineNum.Value.ToString());
- list.Add(row3.Cells["JUDGE_STOVE_NO"].Value.ToString());
- list.Add(row3.Cells["BATCH_NO"].Value.ToString());
- list.Add(txtReasion.Text.ToString());
- // list.Add(row2.Cells["RESULT_NO"].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.Vrp.FrmVrpLoading";
- ccp.MethodName = "offLineExpandResult";
- ccp.ServerParams = new Object[] { list, row.Cells["PLINE_CODE"].Value.ToString(), groupNo };
- ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- this.Cursor = Cursors.Default;
- Constant.WaitingForm.ShowToUser = false;
- Constant.WaitingForm.Close();
- Constant.WaitingForm = null;
- }
- catch (Exception ex)
- {
- this.Cursor = Cursors.Default;
- Constant.WaitingForm.ShowToUser = false;
- Constant.WaitingForm.Close();
- Constant.WaitingForm = null;
- }
- if (ccp.ReturnCode != -1)
- {
- MessageUtil.ShowTips(ccp.ReturnInfo);
- if (ccp.ReturnInfo.Equals("离线成功!"))
- {
- QuerySinglePlan();
- txtReasion.Clear();
- }
- }
- }
- }
- }
|