| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626 |
- 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<PlnZyJgWorkbillEntity>(ultraGridWoId.DisplayLayout.Bands[0]);
- EntityHelper.ShowGridCaption<PlnZyJgWorkbillEntity>(ultraGrid1.DisplayLayout.Bands[0]);
- EntityHelper.ShowGridCaption<CouplingCutResultEntity>(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();
- }
- }
- }
- /// <summary>
- /// 离线
- /// </summary>
- 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();
- }
- }
- }
- /// <summary>
- /// 撤销离线
- /// </summary>
- 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();
- }
- }
- /// <summary>
- /// 结炉
- /// </summary>
- 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();
- }
- }
- }
- /// <summary>
- /// 撤销结炉
- /// </summary>
- 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();
- }
- }
- }
- /// <summary>
- /// 查询作业计划
- /// </summary>
- 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<object>).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<PlnZyJgWorkbillEntity> listSource = EntityHelper.GetData<PlnZyJgWorkbillEntity>
- ("com.steering.mes.mcp.coup.CoupLoadingService.getQueryWoId1", new object[] { woId, plnNo, judgeStoveNo, starts, plineCodes }, this.ob);
- plnZyJgWorkbillEntitySource.DataSource = listSource;
-
- //GridHelper.RefreshAndAutoSize(ultraGridWoId);
- // List<PlnZyJgWorkbillEntity> listSource1 = EntityHelper.GetData<PlnZyJgWorkbillEntity>
- //("com.steering.mes.mcp.coup.CoupLoadingService.ulgetQueryWoId", new object[] { woId, plnNo, judgeStoveNo, starts, plineCode[0].ToString() }, this.ob);
- // bindingSource1.DataSource = listSource1;
- // GridHelper.RefreshAndAutoSize(ultraGrid1);
-
- }
- /// <summary>
- /// 作业计划详情
- /// </summary>
- 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);
- }
-
- /// <summary>
- ///工单详细
- /// </summary>
- /// <param name="planNO"></param>
- 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();
- //}
- }
- /// <summary>
- /// 查询接箍切断实绩
- /// </summary>
- /// <param name="planNO"></param>
- private void getCoupCutResult(string woId)
- {
- List<CouplingCutResultEntity> listSource1 = EntityHelper.GetData<CouplingCutResultEntity>
- ("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;
- }
- }
- }
- /// <summary>
- /// 判断状态
- /// </summary>
- /// <param name="woId"></param>
- /// <param name="planNO"></param>
- 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;
- }
- /// <summary>
- /// 作业实绩保存
- /// </summary>
- 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();
- }
- }
- }
- /// <summary>
- /// 修改
- /// </summary>
- 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();
- }
- }
- /// <summary>
- /// 删除切割实绩
- /// </summary>
- private void DoDelete()
- {
- this.ultraGrid2.UpdateData();
- IQueryable<UltraGridRow> 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();
- }
- }
-
- /// <summary>
- /// 按回车键触发查询按钮
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void ContPublic_KeyDown(object sender, KeyEventArgs e)
- {
- if (e.KeyCode == Keys.Enter)
- {
- QuerySinglePlan();
- }
- }
- /// <summary>
- /// 托选
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void ultraGrid2_AfterSelectChange(object sender, AfterSelectChangeEventArgs e)
- {
- try
- {
- ultraGrid2.UpdateData();
- foreach (UltraGridRow row in ultraGrid2.Rows)
- {
- row.Cells["CHC"].Value = row.Selected;
- }
- }
- catch { }
- }
- /// <summary>
- /// 机床编号改变事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- ///查询操作工,根据机床编号
- 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);
- }
- /// <summary>
- /// 废品
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- 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";
- }
- }
- /// <summary>
- ///
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- 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();
- }
- /// <summary>
- /// 输入加工支数
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- 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);
- }
-
- }
- }
- }
|