FrmCutResult.cs 67 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.ComponentModel;
  5. using System.Data;
  6. using System.Drawing;
  7. using System.Linq;
  8. using System.Text;
  9. using System.Windows.Forms;
  10. using CoreFS.CA06;
  11. using Core.Mes.Client.Comm.Server;
  12. using Core.Mes.Client.Comm.Control;
  13. using Core.StlMes.Client.Mcp;
  14. using com.steering.mes.mcp.entity;
  15. using Infragistics.Win.UltraWinGrid;
  16. using Core.StlMes.Client.Mcp.Control;
  17. using Core.StlMes.Client.Mcp.Common;
  18. using Core.StlMes.Client.Mcp.Entity;
  19. using Core.Mes.Client.Comm.Tool;
  20. using Core.StlMes.Client.Mcp.CollarMaterial;
  21. using Infragistics.Win;
  22. using Core.StlMes.Client.Mcp.Coupling;
  23. using Core.Mes.Client.Comm.Format;
  24. using Core.StlMes.Client.Mcp.Report;
  25. namespace Core.StlMes.Client.Coup
  26. {
  27. public partial class FrmCutResult : FrmBase
  28. {
  29. private string departm = "";//获取部门ID
  30. private string[] plineCode = null;//获取产线代码
  31. private string cutGx = "";//锯切工序
  32. private string cutName = "";//工序名称
  33. private string embGx = "";//压印工序
  34. public string LiXian = "";
  35. private string StrMemo = "";//备注
  36. //private string rouGx = "";//粗加工工序
  37. private int LoadingPiece = 0;//上料支数
  38. private int CutPiece = 0;//最大可切支数
  39. private string[] plineCodes;
  40. private int jgPiece = 0;//箍个数
  41. public FrmCutResult()
  42. {
  43. InitializeComponent();
  44. this.IsLoadUserView = true;
  45. }
  46. protected override void OnLoad(EventArgs e)
  47. {
  48. base.OnLoad(e);
  49. //禁控件过滤
  50. //this.coupWoIdPlanControl1.Grid.DisplayLayout.Override.AllowRowFiltering = Infragistics.Win.DefaultableBoolean.False;
  51. //设置计划区控件只读
  52. //this.coupWoIdPlanControl1.SetAllColumnsActiveOnly();
  53. //coupWoIdPlanControl1.Ob = this.ob;
  54. }
  55. private void FrmCutResult_Load(object sender, EventArgs e)
  56. {
  57. EntityHelper.ShowGridCaption<PlnZyJgWorkbillEntity>(ultraGridWoId.DisplayLayout.Bands[0]);
  58. EntityHelper.ShowGridCaption<PlnZyJgWorkbillEntity>(ultraGrid1.DisplayLayout.Bands[0]);
  59. EntityHelper.ShowGridCaption<CouplingCutResultEntity>(ultraGrid2.DisplayLayout.Bands[0]);
  60. departm = UserInfo.GetDeptid();
  61. //plineCode = McpBaseHelper.GetPCodePline(departm, this.ob);
  62. plineCodes = comm.GetPlineCode(this.ValidDataPurviewIds, "H", ob);
  63. ProTime.Value = DateTime.Today;
  64. //McpBaseHelper.InitPlineUnit(cmbCname, plineCode, this.ob);
  65. //获取废品原因
  66. DataTable dt1 = ServerHelper.GetData("com.steering.mes.mcp.coup.CoupCutService.getCutResultFp", new object[] { "7002" }, this.ob);
  67. cmbReason.DataSource = dt1;
  68. cmbReason.ValueMember = "BASENAME";
  69. YdmBaseClass.SetComboItemHeight(cmbReason);
  70. txtBz.Value = UserInfo.GetUserGroup();
  71. txtBC.Value = UserInfo.GetUserOrder();
  72. txtUser.Text = UserInfo.GetUserName();
  73. //获取锯切工序
  74. DataTable dt2 = ServerHelper.GetData("com.steering.mes.mcp.common.PlanService.getQueryGX", new object[] { "700302" }, this.ob);
  75. if (dt2.Rows.Count > 0)
  76. {
  77. cutGx = dt2.Rows[0]["BASECODE"].ToString();
  78. cutName = dt2.Rows[0]["BASENAME"].ToString();
  79. }
  80. //获取压印工序
  81. DataTable dt3 = ServerHelper.GetData("com.steering.mes.mcp.common.PlanService.getQueryGX", new object[] { "700304" }, this.ob);
  82. if (dt3.Rows.Count > 0)
  83. {
  84. embGx = dt3.Rows[0]["BASECODE"].ToString();
  85. }
  86. //获取粗加工工序
  87. //DataTable dt4 = ServerHelper.GetData("com.steering.mes.mcp.common.PlanService.getQueryGX", new object[] { "700303" }, this.ob);
  88. //if (dt4.Rows.Count > 0)
  89. //{
  90. // rouGx = dt4.Rows[0]["BASECODE"].ToString();
  91. //}
  92. }
  93. //private void init()
  94. //{
  95. // //foreach (UltraGridRow ugr in ultraGridWoId.Rows)
  96. // //{
  97. // //ArrayList pram = new ArrayList();
  98. // //pram.Add(ugr.Cells["PLINE_NO"].Text.Trim());
  99. // //pram.Add(ugr.Cells["PROCESS_NO"].Value.ToString());
  100. // //pram.Add(ugr.Cells["MACHINE_GROUP"].Text.ToString());
  101. // DataTable dt2 = ServerHelper.GetData("com.steering.mes.mcp.coup.CoupCutService.doQuerybianhao", new object[] { "4064" }, this.ob);
  102. // ///comm.FilComboboxAdd(quanxian, dt2, "BASECODE", "BASENAME", "validflag NOT in ('0')", false, "全部", "");
  103. // cmbJcCode.DataSource = dt2;
  104. // cmbJcCode.ValueMember = "BASENAME";
  105. // YdmBaseClass.SetComboItemHeight(cmbJcCode);
  106. // // }
  107. //}
  108. public override void ToolBar_Click(object sender, string ToolbarKey)
  109. {
  110. switch (ToolbarKey)
  111. {
  112. case "DoQuery":
  113. QuerySinglePlan();
  114. break;
  115. case "DoSave":
  116. DoSave();
  117. break;
  118. case "DoUpdate":
  119. DoUpdate();
  120. break;
  121. case "DoDelete":
  122. DoDelete();
  123. break;
  124. case "DoBeside"://结炉
  125. DoBeside();
  126. break;
  127. case "UndoBeside"://撤销结炉
  128. UndoBeside();
  129. break;
  130. case "Offline"://离线
  131. Offline();
  132. break;
  133. case "unOffline":
  134. unOffline();
  135. break;
  136. case"Confirm":
  137. confirm();//确认
  138. break;
  139. case"CancelConfirm":
  140. cancelConfirm();
  141. break;
  142. case "DoClose":
  143. this.Close();
  144. break;
  145. }
  146. }
  147. ///
  148. /// 取消确认
  149. ///
  150. private void cancelConfirm()
  151. {
  152. ultraGrid2.UpdateData();
  153. UltraGridRow uRow = this.ultraGrid2.ActiveRow;
  154. if (uRow == null) { MessageUtil.ShowTips("无切管实绩!"); return; }
  155. UltraGridRow row = this.ultraGridWoId.ActiveRow;
  156. if (row == null)
  157. {
  158. MessageUtil.ShowTips("无工单信息,不允许此操作!");
  159. }
  160. ArrayList list1 = new ArrayList();
  161. int UpdaCount = 0;
  162. foreach (UltraGridRow ugr in ultraGrid2.Rows)
  163. {
  164. if (Convert.ToBoolean(ugr.Cells["CHECK"].Text) == true)
  165. {
  166. if (ugr.Cells["Confirm"].Value.ToString().Equals("0"))
  167. {
  168. MessageUtil.ShowTips("选中有没确认实绩,不允许取消确认!");
  169. return;
  170. }
  171. UpdaCount += 1;
  172. ArrayList list = new ArrayList();
  173. list.Add(ugr.Cells["ResultNo"].Text.ToString());
  174. list.Add(UserInfo.GetUserName());
  175. list.Add(DateTime.Now.ToString());
  176. list1.Add(list);
  177. }
  178. }
  179. if (UpdaCount == 0) { MessageUtil.ShowTips("请选择切管实绩数据!"); return; }
  180. if (MessageUtil.ShowYesNoAndQuestion("是否取消确认切管实绩?") == DialogResult.No)
  181. {
  182. return;
  183. }
  184. CoreClientParam ccp = new CoreClientParam();
  185. try
  186. {
  187. this.Cursor = Cursors.WaitCursor; //控制鼠标的样式为等待
  188. if (Constant.WaitingForm == null)
  189. {
  190. Constant.WaitingForm = new WaitingForm();
  191. }
  192. Constant.WaitingForm.ShowToUser = true;
  193. Constant.WaitingForm.Show();
  194. Constant.WaitingForm.Update();
  195. ccp.ServerName = "com.steering.mes.mcp.coup.CoupCutService";
  196. ccp.MethodName = "getCancelConfirm";
  197. ccp.ServerParams = new object[] { list1 };
  198. ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  199. this.Cursor = Cursors.Default;
  200. Constant.WaitingForm.ShowToUser = false;
  201. Constant.WaitingForm.Close();
  202. Constant.WaitingForm = null;
  203. }
  204. catch (Exception ex)
  205. {
  206. this.Cursor = Cursors.Default;
  207. Constant.WaitingForm.ShowToUser = false;
  208. Constant.WaitingForm.Close();
  209. Constant.WaitingForm = null;
  210. }
  211. if (ccp.ReturnCode != -1)
  212. {
  213. MessageUtil.ShowTips(ccp.ReturnInfo);
  214. if (ccp.ReturnInfo.Equals("取消确认成功!"))
  215. {
  216. QuerySinglePlan();
  217. }
  218. }
  219. }
  220. ///
  221. /// 确认
  222. ///
  223. private void confirm()
  224. {
  225. ultraGrid2.UpdateData();
  226. UltraGridRow uRow = this.ultraGrid2.ActiveRow;
  227. if (uRow == null) { MessageUtil.ShowTips("无切管实绩!"); return; }
  228. UltraGridRow row = this.ultraGridWoId.ActiveRow;
  229. if (row == null)
  230. {
  231. MessageUtil.ShowTips("无工单信息,不允许此操作!");
  232. }
  233. ArrayList list1 = new ArrayList();
  234. int UpdaCount = 0;
  235. foreach (UltraGridRow ugr in ultraGrid2.Rows)
  236. {
  237. if (Convert.ToBoolean(ugr.Cells["CHECK"].Text) == true)
  238. {
  239. if (ugr.Cells["Confirm"].Value.ToString().Equals("1"))
  240. {
  241. MessageUtil.ShowTips("选中有已确认实绩,不允许再次确认!");
  242. return;
  243. }
  244. UpdaCount += 1;
  245. ArrayList list = new ArrayList();
  246. list.Add(ugr.Cells["ResultNo"].Text.ToString());
  247. list.Add(UserInfo.GetUserName());
  248. list.Add(DateTime.Now.ToString());
  249. list1.Add(list);
  250. }
  251. }
  252. if (UpdaCount == 0) { MessageUtil.ShowTips("请选择切管实绩数据!"); return; }
  253. if (MessageUtil.ShowYesNoAndQuestion("是否确认切管实绩?") == DialogResult.No)
  254. {
  255. return;
  256. }
  257. CoreClientParam ccp = new CoreClientParam();
  258. try
  259. {
  260. this.Cursor = Cursors.WaitCursor; //控制鼠标的样式为等待
  261. if (Constant.WaitingForm == null)
  262. {
  263. Constant.WaitingForm = new WaitingForm();
  264. }
  265. Constant.WaitingForm.ShowToUser = true;
  266. Constant.WaitingForm.Show();
  267. Constant.WaitingForm.Update();
  268. ccp.ServerName = "com.steering.mes.mcp.coup.CoupCutService";
  269. ccp.MethodName = "getConfirm";
  270. ccp.ServerParams = new object[] { list1 };
  271. ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  272. this.Cursor = Cursors.Default;
  273. Constant.WaitingForm.ShowToUser = false;
  274. Constant.WaitingForm.Close();
  275. Constant.WaitingForm = null;
  276. }
  277. catch (Exception ex)
  278. {
  279. this.Cursor = Cursors.Default;
  280. Constant.WaitingForm.ShowToUser = false;
  281. Constant.WaitingForm.Close();
  282. Constant.WaitingForm = null;
  283. }
  284. if (ccp.ReturnCode != -1)
  285. {
  286. MessageUtil.ShowTips(ccp.ReturnInfo);
  287. if (ccp.ReturnInfo.Equals("确认成功!"))
  288. {
  289. QuerySinglePlan();
  290. }
  291. }
  292. }
  293. /// <summary>
  294. /// 离线
  295. /// </summary>
  296. private void Offline()
  297. {
  298. string _strat = "";
  299. UltraGridRow row = ultraGridWoId.ActiveRow;
  300. if (row == null) return;
  301. if (row.Cells["ZyBillStatus"].Value.ToString() == "生产完成")
  302. {
  303. MessageUtil.ShowTips("此炉次计划整体已生产完成,不允许此操作!");
  304. return;
  305. }
  306. OffLineCut frm = new OffLineCut();
  307. frm.ShowDialog();
  308. LiXian = frm.StrNum;
  309. _strat = frm.Strat;
  310. StrMemo = frm.StrMemo;
  311. if (_strat.Equals("")) return;
  312. if (LiXian.Equals("") || LiXian.Equals("0")) { MessageUtil.ShowTips("离线支数不能为空!"); return; }
  313. //查询切断实绩支数和
  314. DataTable dt = ServerHelper.GetData("com.steering.mes.mcp.coup.CoupCutService.getCutResult", new object[] { row.Cells["WoId"].Value.ToString() }, this.ob);
  315. //VrpLoadingResultEntity result1 = new VrpLoadingResultEntity();
  316. //this.planExpanQuery1.Value = result;
  317. string pronum = "";//锯切支数
  318. string cutnum = "";//锯切个数
  319. if (dt.Rows.Count > 0)
  320. {
  321. pronum = dt.Rows[0]["PRO_NUM"].ToString();
  322. cutnum = dt.Rows[0]["CUT_NUM"].ToString();
  323. }
  324. else
  325. {
  326. pronum = "0";
  327. cutnum = "0";
  328. }
  329. UltraGridRow row1 = ultraGrid2.ActiveRow;
  330. if (row1 == null)
  331. {
  332. MessageUtil.ShowTips("锯切前离线请在上料界面离线!");
  333. return;
  334. }
  335. offlinePiece.Value = Convert.ToInt32(LiXian) + Convert.ToInt32(offlinePiece.Value);
  336. //string zYgNo = row.Cells["ZY_PLAN_ID"].Value.ToString();
  337. string woId = row.Cells["WoId"].Value.ToString();
  338. //DataTable dt = ServerHelper.GetData("com.steering.mes.mcp.common.PlanService.getQueryCouplingcominfo", new object[] { woId, cutGx }, this.ob);
  339. //if (dt.Rows[0]["STATION_STATUS"].ToString().Equals("2"))
  340. //{
  341. // MessageUtil.ShowTips("此工单工序点已结炉,不允许此操作!");
  342. // return;
  343. //}
  344. //if (row1.Cells["OffNum"].Value.ToString() == "")
  345. //{
  346. // row1.Cells["OffNum"].Value = "0";
  347. //}
  348. //if (int.Parse(row1.Cells["QualifiedNumber"].Value.ToString()) < int.Parse(LiXian) + int.Parse(row1.Cells["OffNum"].Value.ToString()))
  349. //{
  350. // MessageUtil.ShowTips("离线个数不能大于切管合格个数!");
  351. // return;
  352. //}
  353. string time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
  354. ArrayList list = new ArrayList();
  355. list.Add(LiXian);
  356. list.Add(row.Cells["WoId"].Text.ToString());
  357. list.Add(row.Cells["HeatPlanNo"].Text.ToString());
  358. list.Add(row.Cells["JudgeStoveNo"].Text.ToString());
  359. list.Add(row.Cells["BatchNo"].Text.ToString());
  360. list.Add(row.Cells["PlineCode"].Text.ToString());
  361. list.Add(row.Cells["PlineName"].Text.ToString());
  362. list.Add(this.UserInfo.GetUserName());
  363. list.Add(this.UserInfo.GetUserOrder());
  364. list.Add(this.UserInfo.GetUserGroup());
  365. list.Add(time);
  366. list.Add("");
  367. list.Add(StrMemo);
  368. list.Add(row.Cells["BatchGroudNo"].Value.ToString());
  369. CoreClientParam ccp = new CoreClientParam();
  370. try
  371. {
  372. this.Cursor = Cursors.WaitCursor; //控制鼠标的样式为等待
  373. if (Constant.WaitingForm == null)
  374. {
  375. Constant.WaitingForm = new WaitingForm();
  376. }
  377. Constant.WaitingForm.ShowToUser = true;
  378. Constant.WaitingForm.Show();
  379. Constant.WaitingForm.Update();
  380. ccp.ServerName = "com.steering.mes.mcp.coup.CoupCutService";
  381. ccp.MethodName = "lixianThreadingResult";
  382. ccp.ServerParams = new object[] { list, cutGx,cutName };
  383. ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  384. this.Cursor = Cursors.Default;
  385. Constant.WaitingForm.ShowToUser = false;
  386. Constant.WaitingForm.Close();
  387. Constant.WaitingForm = null;
  388. }
  389. catch (Exception ex)
  390. {
  391. this.Cursor = Cursors.Default;
  392. Constant.WaitingForm.ShowToUser = false;
  393. Constant.WaitingForm.Close();
  394. Constant.WaitingForm = null;
  395. }
  396. if (ccp.ReturnCode != -1)
  397. {
  398. MessageUtil.ShowTips(ccp.ReturnInfo);
  399. if (ccp.ReturnInfo.Equals("离线成功!"))
  400. {
  401. QuerySinglePlan();
  402. }
  403. }
  404. }
  405. /// <summary>
  406. /// 撤销离线
  407. /// </summary>
  408. private void unOffline()
  409. {
  410. ultraGrid2.UpdateData();
  411. UltraGridRow uRow = this.ultraGrid2.ActiveRow;
  412. if (uRow == null) { MessageUtil.ShowTips("切管实绩无数据!"); return; }
  413. UltraGridRow row = this.ultraGridWoId.ActiveRow;
  414. if (uRow == null)
  415. {
  416. MessageUtil.ShowTips("无工单信息,不允许此操作!");
  417. }
  418. if (row.Cells["ZyBillStatus"].Value.ToString() == "生产完成")
  419. {
  420. MessageUtil.ShowTips("此炉次计划整体已生产完成,不允许此操作!");
  421. return;
  422. }
  423. string woId = uRow.Cells["WoId"].Value.ToString();
  424. offlinePiece.Value = Convert.ToInt32(offlinePiece.Value) - Convert.ToInt32(LiXian);
  425. //DataTable dt = ServerHelper.GetData("com.steering.mes.mcp.common.PlanService.getQueryWoIdDetails", new object[] { woId, zYgNo }, this.ob);
  426. //if (dt.Rows[0]["CUT_STATUS"].ToString().Equals("生产完成"))
  427. //{
  428. // MessageUtil.ShowTips("此工单工序点已结炉,不允许此操作!");
  429. // return;
  430. //}
  431. //DataTable dt = ServerHelper.GetData("com.steering.mes.mcp.common.PlanService.getQueryCouplingcominfo", new object[] { woId, cutGx }, this.ob);
  432. //if (dt.Rows[0]["STATION_STATUS"].ToString().Equals("2"))
  433. //{
  434. // MessageUtil.ShowTips("此工单工序点已结炉,不允许此操作!");
  435. // return;
  436. //}
  437. //if(!QueryStatusGd(row.Cells["WO_ID"].Value.ToString(), row.Cells["ZY_PLAN_ID"].Value.ToString())) return;
  438. ArrayList list1 = new ArrayList();
  439. int UpdaCount = 0;
  440. foreach (UltraGridRow ugr in ultraGrid2.Rows)
  441. {
  442. if (Convert.ToBoolean(ugr.Cells["CHECK"].Text) == true)
  443. {
  444. UpdaCount += 1;
  445. ArrayList list = new ArrayList();
  446. list.Add(ugr.Cells["ResultNo"].Text.ToString());
  447. list.Add(ugr.Cells["OffNum"].Text.ToString());
  448. list1.Add(list);
  449. }
  450. }
  451. if (UpdaCount == 0) { MessageUtil.ShowTips("请选择离线数据!"); return; }
  452. if (MessageUtil.ShowYesNoAndQuestion("是否撤销离线?") == DialogResult.No)
  453. {
  454. return;
  455. }
  456. CoreClientParam ccp = new CoreClientParam();
  457. try
  458. {
  459. this.Cursor = Cursors.WaitCursor; //控制鼠标的样式为等待
  460. if (Constant.WaitingForm == null)
  461. {
  462. Constant.WaitingForm = new WaitingForm();
  463. }
  464. Constant.WaitingForm.ShowToUser = true;
  465. Constant.WaitingForm.Show();
  466. Constant.WaitingForm.Update();
  467. ccp.ServerName = "com.steering.mes.mcp.coup.CoupCutService";
  468. ccp.MethodName = "unlixianThreadingResult";
  469. ccp.ServerParams = new object[] { list1, row.Cells["WoId"].Text.ToString(), cutGx };
  470. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  471. this.Cursor = Cursors.Default;
  472. Constant.WaitingForm.ShowToUser = false;
  473. Constant.WaitingForm.Close();
  474. Constant.WaitingForm = null;
  475. }
  476. catch (Exception ex)
  477. {
  478. this.Cursor = Cursors.Default;
  479. Constant.WaitingForm.ShowToUser = false;
  480. Constant.WaitingForm.Close();
  481. Constant.WaitingForm = null;
  482. }
  483. if (ccp.ReturnCode == -1) return;
  484. MessageUtil.ShowTips(ccp.ReturnInfo);
  485. if (ccp.ReturnInfo.Equals("撤销离线成功!"))
  486. {
  487. QuerySinglePlan();
  488. }
  489. }
  490. /// <summary>
  491. /// 结炉
  492. /// </summary>
  493. private void DoBeside()
  494. {
  495. UltraGridRow uRow = this.ultraGridWoId.ActiveRow;
  496. if (uRow == null)
  497. {
  498. MessageUtil.ShowTips("请选择需要结炉的工单号!");
  499. return;
  500. }
  501. //if (jgPiece - int.Parse(numRejected.Value.ToString()) - int.Parse(praloPcs.Value.ToString()) > int.Parse(numQualified.Value.ToString()))
  502. //{
  503. // MessageUtil.ShowTips("数据不平!");
  504. // return;
  505. //}
  506. //string zYgNo = uRow.Cells["ZY_PLAN_ID"].Value.ToString();
  507. string woId = uRow.Cells["WoId"].Value.ToString();
  508. //DataTable dt = ServerHelper.GetData("com.steering.mes.mcp.common.PlanService.getQueryWoIdDetails", new object[] { woId }, this.ob);
  509. //if (dt.Rows[0]["CUT_STATUS"].ToString().Equals("生产完成"))
  510. //{
  511. // MessageUtil.ShowTips("此工单工序点已结炉,不允许此操作!");
  512. // return;
  513. //}
  514. //if (dt.Rows[0]["ZY_BILL_STATUS"].ToString().Equals("生产完成"))
  515. //{
  516. // MessageUtil.ShowTips("此工单状态已生产完成,不允许此操作!");
  517. // return;
  518. //}
  519. if (MessageUtil.ShowYesNoAndQuestion("是否结炉?") == DialogResult.No)
  520. {
  521. return;
  522. }
  523. CoreClientParam ccp = new CoreClientParam();
  524. ccp.ServerName = "com.steering.mes.mcp.coup.CoupCutService";
  525. ccp.MethodName = "doBeside";
  526. ccp.ServerParams = new object[] { cutGx,embGx, woId };
  527. ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  528. if (ccp.ReturnCode != -1)
  529. {
  530. MessageUtil.ShowTips(ccp.ReturnInfo);
  531. if (ccp.ReturnInfo.Equals("结炉成功!"))
  532. {
  533. QuerySinglePlan();
  534. }
  535. }
  536. }
  537. /// <summary>
  538. /// 撤销结炉
  539. /// </summary>
  540. private void UndoBeside()
  541. {
  542. UltraGridRow uRow = this.ultraGridWoId.ActiveRow;
  543. if (uRow == null)
  544. {
  545. MessageUtil.ShowTips("请选择需要撤销结炉的工单号!");
  546. return;
  547. }
  548. //string zYgNo = uRow.Cells["ZY_PLAN_ID"].Value.ToString();
  549. string woId = uRow.Cells["WoId"].Value.ToString();
  550. //DataTable dt = ServerHelper.GetData("com.steering.mes.mcp.common.PlanService.getQueryWoIdDetails", new object[] { woId, zYgNo }, this.ob);
  551. //if (!dt.Rows[0]["CUT_STATUS"].ToString().Equals("生产完成"))
  552. //{
  553. // MessageUtil.ShowTips("此工单工序点未结炉,不允许此操作!");
  554. // return;
  555. //}
  556. //if (dt.Rows[0]["ZY_BILL_STATUS"].ToString().Equals("生产完成"))
  557. //{
  558. // MessageUtil.ShowTips("此工单状态生产完成,不允许此操作!");
  559. // return;
  560. //}
  561. if (MessageUtil.ShowYesNoAndQuestion("是否撤销结炉?") == DialogResult.No)
  562. {
  563. return;
  564. }
  565. CoreClientParam ccp = new CoreClientParam();
  566. ccp.ServerName = "com.steering.mes.mcp.coup.CoupCutService";
  567. ccp.MethodName = "undoBeside";
  568. ccp.ServerParams = new object[] { cutGx, embGx, woId };
  569. ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  570. if (ccp.ReturnCode != -1)
  571. {
  572. MessageUtil.ShowTips(ccp.ReturnInfo);
  573. if (ccp.ReturnInfo.Equals("撤销结炉成功!"))
  574. {
  575. QuerySinglePlan();
  576. }
  577. }
  578. }
  579. /// <summary>
  580. /// 查询作业计划
  581. /// </summary>
  582. private void QuerySinglePlan()
  583. {
  584. string woId = "";
  585. //string starts = "";
  586. string judgeStoveNo = "";
  587. string plnNo = "";
  588. string[] starts = { };
  589. #region 条件
  590. if (chkStarts.Checked)
  591. {
  592. if (string.IsNullOrEmpty(cmbStarts.Text.Trim()))
  593. {
  594. MessageUtil.ShowTips("请选择工单状态!");
  595. return;
  596. }
  597. else
  598. {
  599. starts = (cmbStarts.Value as List<object>).Select(p => p.ToString().Trim()).ToArray();
  600. }
  601. }
  602. if (chkwoId.Checked)
  603. {
  604. if (chkwoId.Checked && string.IsNullOrEmpty(txtWoId.Text.Trim()))
  605. {
  606. MessageUtil.ShowTips("请输入工单号!");
  607. return;
  608. }
  609. else
  610. {
  611. woId = txtWoId.Text.ToString().Trim();
  612. }
  613. }
  614. else
  615. {
  616. woId = "";
  617. }
  618. if (chkPlnNo.Checked)
  619. {
  620. if (chkPlnNo.Checked && string.IsNullOrEmpty(txtPlnNo.Text.Trim()))
  621. {
  622. MessageUtil.ShowTips("请输入炉次计划号!");
  623. return;
  624. }
  625. else
  626. {
  627. plnNo = txtPlnNo.Text.ToString().Trim();
  628. }
  629. }
  630. else
  631. {
  632. plnNo = "";
  633. }
  634. if (chkJuNo.Checked)
  635. {
  636. if (chkJuNo.Checked && string.IsNullOrEmpty(txtJudgeStoveNO.Text.Trim()))
  637. {
  638. MessageUtil.ShowTips("请输入炉号!");
  639. return;
  640. }
  641. else
  642. {
  643. judgeStoveNo = txtJudgeStoveNO.Text.ToString().Trim();
  644. }
  645. }
  646. else
  647. {
  648. judgeStoveNo = "";
  649. }
  650. #endregion
  651. List<PlnZyJgWorkbillEntity> listSource = EntityHelper.GetData<PlnZyJgWorkbillEntity>
  652. ("com.steering.mes.mcp.coup.CoupLoadingService.getQueryWoId1", new object[] { woId, plnNo, judgeStoveNo, starts, plineCodes }, this.ob);
  653. plnZyJgWorkbillEntitySource.DataSource = listSource;
  654. //GridHelper.RefreshAndAutoSize(ultraGridWoId);
  655. // List<PlnZyJgWorkbillEntity> listSource1 = EntityHelper.GetData<PlnZyJgWorkbillEntity>
  656. //("com.steering.mes.mcp.coup.CoupLoadingService.ulgetQueryWoId", new object[] { woId, plnNo, judgeStoveNo, starts, plineCode[0].ToString() }, this.ob);
  657. // bindingSource1.DataSource = listSource1;
  658. // GridHelper.RefreshAndAutoSize(ultraGrid1);
  659. }
  660. /// <summary>
  661. /// 作业计划详情
  662. /// </summary>
  663. private void ultraGridWoId_AfterRowActivate(object sender, EventArgs e)
  664. {
  665. UltraGridRow row = ultraGridWoId.ActiveRow;
  666. if (row == null) return;
  667. //获取上料实绩;
  668. string zYgNo = row.Cells["HeatPlanNo"].Value.ToString();
  669. string woId = row.Cells["WoId"].Value.ToString();
  670. string plineCode = row.Cells["PlineCode"].Value.ToString();
  671. string demandCopper = row.Cells["demandCopper"].Text.ToString();
  672. //getJGCutPlan(woId,zYgNo);
  673. if (demandCopper.Contains("压印"))
  674. {
  675. cmbEmbossed.Value = 1;//压印
  676. }
  677. else
  678. {
  679. cmbEmbossed.Value = 0;//压印
  680. }
  681. string[] lathCutNm = row.Cells["LatheCutNm"].Text.ToString().Replace(" ","").Split(',');
  682. //获取切管机床编号
  683. DataTable dt = ServerHelper.GetData("com.steering.mes.mcp.coup.CoupCutService.getMachine", new object[] { plineCode, lathCutNm }, this.ob);
  684. cmbJcCode.DataSource = dt;
  685. cmbJcCode.DisplayMember = "MACHINE_NAME";
  686. cmbJcCode.ValueMember = "MACHINE_NO";
  687. YdmBaseClass.SetComboItemHeight(cmbJcCode);
  688. //cutControl1.PlinCode = row.Cells["PLINE_CODE"].Text.ToString();
  689. //cutControl1.CutMachGroup = row.Cells["CUT_MACH_GRP_NM"].Text.ToString();
  690. //cmbRoughmach.Text = row.Cells["IF_NEED_CJG"].Text.ToString();//粗加工
  691. //查询工单的离线支数
  692. DataTable dt1 = ServerHelper.GetData("com.steering.mes.mcp.coup.CoupLoadingService.getQueryOfflinePiece", new object[] { row.Cells["WoId"].Value }, this.ob);
  693. if (dt1.Rows.Count > 0)
  694. {
  695. if (dt1.Rows[0]["OFFLINE_NUM_BJ"].ToString() == null || dt1.Rows[0]["OFFLINE_NUM_BJ"].ToString() == "")
  696. {
  697. offlinePiece.Value = 0;
  698. }
  699. else
  700. {
  701. offlinePiece.Value = Convert.ToInt64(dt1.Rows[0]["OFFLINE_NUM_BJ"].ToString());
  702. }
  703. }
  704. //查询该工单上料支数
  705. DataTable dt2 = ServerHelper.GetData("com.steering.mes.mcp.coup.CoupLoadingService.getLoadResult1", new object[] { row.Cells["WoId"].Value }, this.ob);
  706. if(dt2.Rows.Count > 0)
  707. {
  708. if(dt2.Rows[0]["PRO_NUM"].ToString() == null||dt2.Rows[0]["PRO_NUM"].ToString() == "")
  709. {
  710. LoadingPiece = 0;
  711. }
  712. else
  713. {
  714. LoadingPiece = Convert.ToInt32(dt2.Rows[0]["PRO_NUM"].ToString());
  715. }
  716. }
  717. //int singLenCutNum = (int)(double.Parse(row.Cells["AimlengthBl"].Value.ToString()) / ((double.Parse(row.Cells["Aimlength"].Value.ToString()) + 15) / 1000)) - 2;
  718. //if (Convert.ToInt32(row.Cells["RealBlNum"].Value.ToString()) - Convert.ToInt32(offlinePiece.Value)>0)
  719. //{
  720. // numPieces.Value = Convert.ToInt32(row.Cells["RealBlNum"].Value.ToString()) - Convert.ToInt32(offlinePiece.Value);
  721. //}
  722. //else
  723. //{
  724. // numPieces.Value = "";
  725. //}
  726. // numQualified.Value = int.Parse(numPieces.Value.ToString()) * int.Parse(row.Cells["SingleCutNun"].Value.ToString());
  727. // LoadingPiece = Convert.ToInt32(numPieces.Value);
  728. // CutPiece = Convert.ToInt32(numQualified.Value);
  729. //numQualified.Value = int.Parse(row.Cells["RealBlNum"].Value.ToString()) * singLenCutNum;
  730. //cmbJcCode.Text = row.Cells["LatheGrpNm"].Text.ToString();
  731. //获取锯切实绩
  732. this.getCoupCutResult(woId);
  733. }
  734. /// <summary>
  735. ///工单详细
  736. /// </summary>
  737. /// <param name="planNO"></param>
  738. private void getJGCutPlan(string woId, string planNO)
  739. {
  740. //DataTable dt = ServerHelper.GetData("com.steering.mes.mcp.common.PlanService.getQueryWoIdDetails", new object[] {woId,planNO }, this.ob);
  741. //if (dt != null && dt.Rows.Count > 0)
  742. //{
  743. // this.coupWoIdPlanControl1.Value.PlineName = dt.Rows[0]["PLINE_NAME"].ToString();
  744. // this.coupWoIdPlanControl1.Value.CutMachGrpNm = dt.Rows[0]["CUT_MACH_GRP_NM"].ToString();
  745. // this.coupWoIdPlanControl1.Value.Memo = dt.Rows[0]["MEMO"].ToString();
  746. // this.coupWoIdPlanControl1.Value.ZyPlanId = dt.Rows[0]["ZY_PLAN_ID"].ToString();
  747. // this.coupWoIdPlanControl1.Value.IfMonitorJg = dt.Rows[0]["IF_MONITOR_JG"].ToString();
  748. // this.coupWoIdPlanControl1.Value.LoadPieces = dt.Rows[0]["LOAD_PIECES"].ToString();
  749. // this.coupWoIdPlanControl1.Value.LoadWeight = dt.Rows[0]["LOAD_WEIGHT"].ToString();
  750. // this.coupWoIdPlanControl1.Value.ProPlanId = dt.Rows[0]["PRO_PLAN_ID"].ToString();
  751. // this.coupWoIdPlanControl1.Value.Steelname = dt.Rows[0]["STEELNAME"].ToString();
  752. // this.coupWoIdPlanControl1.Value.Gradename = dt.Rows[0]["GRADENAME"].ToString();
  753. // this.coupWoIdPlanControl1.Value.JglDesc = dt.Rows[0]["JGL_DESC"].ToString();
  754. // this.coupWoIdPlanControl1.Value.CodeJg = dt.Rows[0]["CODE_JG"].ToString();
  755. // this.coupWoIdPlanControl1.Value.ModelDesc = dt.Rows[0]["MODEL_DESC"].ToString();
  756. // this.coupWoIdPlanControl1.Value.SpecJgDesc = dt.Rows[0]["SPEC_JG_DESC"].ToString();
  757. // this.coupWoIdPlanControl1.Value.StyleJg = dt.Rows[0]["STYLE_JG"].ToString();
  758. // this.coupWoIdPlanControl1.Value.PlanJgNum = dt.Rows[0]["PLAN_JG_NUM"].ToString();
  759. // this.coupWoIdPlanControl1.Value.CsJgNum = dt.Rows[0]["CS_JG_NUM"].ToString();
  760. // this.coupWoIdPlanControl1.Value.XqJgNum = dt.Rows[0]["XQ_JG_NUM"].ToString();
  761. // this.coupWoIdPlanControl1.Value.InstoreNum = dt.Rows[0]["INSTORE_NUM"].ToString();
  762. // this.coupWoIdPlanControl1.Value.BlWlDesc = dt.Rows[0]["BL_WL_DESC"].ToString();
  763. // //this.coupWoIdPlanControl1.Value.LoadWeight = "";
  764. // this.coupWoIdPlanControl1.UpdateData();
  765. //}
  766. }
  767. /// <summary>
  768. /// 查询接箍切断实绩
  769. /// </summary>
  770. /// <param name="planNO"></param>
  771. private void getCoupCutResult(string woId)
  772. {
  773. List<CouplingCutResultEntity> listSource1 = EntityHelper.GetData<CouplingCutResultEntity>
  774. ("com.steering.mes.mcp.coup.CoupCutService.getCutResultByPlanNo", new object[] { woId }, this.ob);
  775. CouplingCutResultBindSource.DataSource = listSource1;
  776. GridHelper.RefreshAndAutoSize(ultraGrid2);
  777. foreach (UltraGridRow urg in ultraGrid2.Rows)
  778. {
  779. if (urg.Cells["Confirm"].Value.Equals("1"))
  780. {
  781. urg.Appearance.BackColor = Color.LightGreen;
  782. }
  783. }
  784. }
  785. /// <summary>
  786. /// 判断状态
  787. /// </summary>
  788. /// <param name="woId"></param>
  789. /// <param name="planNO"></param>
  790. private void QueryStatusGd()
  791. {
  792. UltraGridRow row = this.ultraGridWoId.ActiveRow;
  793. string woId = row.Cells["WoId"].Value.ToString();
  794. DataTable dt = ServerHelper.GetData("com.steering.mes.mcp.coup.CoupLoadingService.getQueryWoIdDetails", new object[] { woId }, this.ob);
  795. //if (dt.Rows[0]["CUT_STATUS"].ToString().Equals("生产完成"))
  796. //{
  797. // MessageUtil.ShowTips("此工单工序点已结炉,不允许此操作!");
  798. // return;
  799. //}
  800. //DataTable dt = ServerHelper.GetData("com.steering.mes.mcp.common.PlanService.getQueryWoIdDetails", new object[] { woId, planNO }, this.ob);
  801. if (dt.Rows[0]["zyBillStatus"].ToString().Equals("生产完成"))
  802. {
  803. MessageUtil.ShowTips("此工单已生产完成,不允许此操作!");
  804. return;
  805. }
  806. //return true;
  807. }
  808. /// <summary>
  809. /// 作业实绩保存
  810. /// </summary>
  811. private void DoSave()
  812. {
  813. UltraGridRow row = this.ultraGridWoId.ActiveRow;
  814. if (row == null)
  815. {
  816. MessageUtil.ShowTips("无工单信息,不允许此操作!");
  817. return;
  818. }
  819. if (row.Cells["zyBillStatus"].Value.ToString() == "生产完成")
  820. {
  821. MessageUtil.ShowTips("此工单已生产完成,不允许此操作!");
  822. return;
  823. }
  824. if (row.Cells["IfAllOutWork"].Value.ToString().Equals("是"))
  825. {
  826. MessageUtil.ShowTips("此工单已全工序委外离线,不允许此操作!");
  827. return;
  828. }
  829. //if (row.Cells["IfOutCut"].Value.ToString().Equals("是"))
  830. //{
  831. // MessageUtil.ShowTips("此工单本工序委外离线,不允许此操作!");
  832. // return;
  833. //}
  834. ////QueryStatusGd();
  835. //string woId = row.Cells["WoId"].Value.ToString();
  836. //DataTable dt = ServerHelper.GetData("com.steering.mes.mcp.common.PlanService.getQueryWoIdDetails", new object[] { woId }, this.ob);
  837. //if (dt.Rows[0]["CUT_STATUS"].ToString().Equals("生产完成"))
  838. //{
  839. // MessageUtil.ShowTips("此工单工序点已结炉,不允许此操作!");
  840. // return;
  841. //}
  842. //if(!QueryStatusGd(row.Cells["WO_ID"].Value.ToString(), row.Cells["ZY_PLAN_ID"].Value.ToString())) return;
  843. //if (cmbJcCode.Text.Trim() == "")
  844. //{
  845. // MessageUtil.ShowTips("机床编号不能为空!");
  846. // return;
  847. //}
  848. //if (cmbOperator.Text.Trim() == "")
  849. //{
  850. // MessageUtil.ShowTips("操作人不能为空!");
  851. // return;
  852. //}
  853. string zPieces = "";
  854. string fPieces = "";
  855. string gPieces = "";
  856. if (numPieces.Value == null || numPieces.Value.Equals(""))
  857. {
  858. zPieces = "0";
  859. }
  860. else
  861. {
  862. zPieces = numPieces.Value.ToString();
  863. }
  864. if (numQualified.Value == null || numQualified.Value.Equals(""))
  865. {
  866. gPieces = "0";
  867. }
  868. else
  869. {
  870. gPieces = numQualified.Value.ToString();
  871. }
  872. if (numRejected.Value == null || numRejected.Value.Equals(""))
  873. {
  874. fPieces = "0";
  875. }
  876. else
  877. {
  878. fPieces = numRejected.Value.ToString();
  879. }
  880. if (gPieces =="0")
  881. {
  882. MessageUtil.ShowTips("切管个数不能为空!");
  883. return;
  884. }
  885. if (int.Parse(gPieces) < int.Parse(fPieces))
  886. {
  887. MessageUtil.ShowTips("废品个数不能大于切管个数!");
  888. return;
  889. }
  890. if (txtBC.Value.Equals(""))
  891. {
  892. MessageUtil.ShowTips("班次不能为空!");
  893. return;
  894. }
  895. if (txtBz.Value.Equals(""))
  896. {
  897. MessageUtil.ShowTips("班组不能为空!");
  898. return;
  899. }
  900. //查询切断实绩支数和
  901. DataTable dt = ServerHelper.GetData("com.steering.mes.mcp.coup.CoupCutService.getCutResult", new object[] { row.Cells["WoId"].Value.ToString() }, this.ob);
  902. //VrpLoadingResultEntity result1 = new VrpLoadingResultEntity();
  903. //this.planExpanQuery1.Value = result;
  904. string pronum = "";
  905. if (dt.Rows.Count > 0)
  906. {
  907. pronum = dt.Rows[0]["PRO_NUM"].ToString();
  908. }
  909. else
  910. {
  911. pronum = "0";
  912. }
  913. //if (Convert.ToInt32(numPieces.Value) + Convert.ToInt32(pronum) > LoadingPiece)
  914. //{
  915. // MessageUtil.ShowTips("加工支数不能大于上料支数!");
  916. // return;
  917. //}
  918. //if(Convert.ToInt32(numQualified.Value)>CutPiece)
  919. //{
  920. // MessageUtil.ShowTips("切管个数不能大于加工最大可切个数!");
  921. //}
  922. ArrayList list = new ArrayList();
  923. CouplingCutResultEntity cut = new CouplingCutResultEntity();
  924. cut.MachineNo = cmbJcCode.Text.Trim();
  925. cut.CutPieces = numPieces.Value == null ? 0 : Convert.ToDecimal(numPieces.Value.ToString());
  926. cut.QualifiedNumber = numQualified.Value == null ? 0 :Convert.ToDecimal(numQualified.Value.ToString());
  927. cut.RejectedPcs = numRejected.Value == null ? 0 : Convert.ToDecimal(numRejected.Value.ToString());
  928. cut.PraloPcs = Convert.ToDecimal(praloPcs.Value.ToString());
  929. cut.RejectedReason = cmbReason.Text.Trim();
  930. cut.LvalidLength = numLength.Value == null ? 0 : Convert.ToDecimal(numLength.Value.ToString());
  931. cut.ColOperator = cmbOperator.Text.Trim();
  932. cut.ColShift = txtBC.Value.ToString();
  933. cut.ColGroup = txtBz.Value.ToString();
  934. cut.ColUser = txtUser.Text.ToString();
  935. cut.IsEmbossed = cmbEmbossed.Value.ToString();
  936. cut.EmbCount = Convert.ToDecimal(numEmbossed.Value.ToString());
  937. cut.EmbContent = txtEmbossed.Text.Trim();
  938. cut.PlineCode = row.Cells["PlineCode"].Text.ToString();
  939. cut.PlineName = row.Cells["PlineName"].Text.ToString();
  940. cut.WoId = row.Cells["WoId"].Text.ToString();
  941. cut.ColTime = ProTime.Value.ToString("yyyy-MM-dd HH:mm:ss");
  942. cut.CreateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
  943. cut.Memo = txtMemo.Text.Trim();
  944. list.Add(JSONFormat.Format(cut));
  945. //cut.IsRemaining
  946. //double PlnCount = 0;//计划切割个数
  947. //double CutCount = 0;//实际切割个数
  948. //DataTable dt1 = ServerHelper.GetData("com.steering.mes.mcp.coup.PhosphateResultService.queryPlanJg", new Object[] { row.Cells["ZY_PLAN_ID"].Text.ToString() }, ob);
  949. //if (dt1.Rows.Count > 0)
  950. //{
  951. // PlnCount = Double.Parse(dt1.Rows[0]["CUT_PLN_NUMB"].ToString());
  952. // CutCount = Double.Parse(dt1.Rows[0]["CUT_OK_NUM"].ToString());
  953. //}
  954. //// + Double.Parse(numQualified.Value.ToString())
  955. //if (CutCount > PlnCount)
  956. //{
  957. // if (MessageUtil.ShowYesNoAndQuestion("实际锯切个数超过计划锯切个数是否新增!") == DialogResult.No) { return; }
  958. //}
  959. string machineNo = "";
  960. if (!cmbJcCode.Text.ToString().Trim().Equals(""))
  961. {
  962. machineNo = cmbJcCode.Value.ToString();
  963. }
  964. if (MessageUtil.ShowYesNoAndQuestion("是否保存锯切记录?") == DialogResult.No)
  965. {
  966. return;
  967. }
  968. CoreClientParam ccp = new CoreClientParam();
  969. try
  970. {
  971. this.Cursor = Cursors.WaitCursor; //控制鼠标的样式为等待
  972. if (Constant.WaitingForm == null)
  973. {
  974. Constant.WaitingForm = new WaitingForm();
  975. }
  976. Constant.WaitingForm.ShowToUser = true;
  977. Constant.WaitingForm.Show();
  978. Constant.WaitingForm.Update();
  979. ccp.ServerName = "com.steering.mes.mcp.coup.CoupCutService";
  980. ccp.MethodName = "addCutResult";
  981. ccp.ServerParams = new object[] { list, cutGx, embGx, machineNo };
  982. ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  983. this.Cursor = Cursors.Default;
  984. Constant.WaitingForm.ShowToUser = false;
  985. Constant.WaitingForm.Close();
  986. Constant.WaitingForm = null;
  987. }
  988. catch (Exception ex)
  989. {
  990. this.Cursor = Cursors.Default;
  991. Constant.WaitingForm.ShowToUser = false;
  992. Constant.WaitingForm.Close();
  993. Constant.WaitingForm = null;
  994. }
  995. if (ccp.ReturnCode != -1)
  996. {
  997. MessageUtil.ShowTips(ccp.ReturnInfo);
  998. if (ccp.ReturnInfo.Equals("保存成功!"))
  999. {
  1000. QuerySinglePlan();
  1001. DoClean();
  1002. }
  1003. }
  1004. }
  1005. /// <summary>
  1006. /// 修改
  1007. /// </summary>
  1008. private void DoUpdate()
  1009. {
  1010. ultraGrid2.UpdateData();
  1011. UltraGridRow uRow = this.ultraGrid2.ActiveRow;
  1012. if (uRow == null) { MessageUtil.ShowTips("锯切实绩无数据!"); return; }
  1013. if (uRow.Cells["IfAllOutWork"].Value.ToString().Equals("是"))
  1014. {
  1015. MessageUtil.ShowTips("此工序已经离线,不允许此操作!");
  1016. return;
  1017. }
  1018. UltraGridRow row = this.ultraGridWoId.ActiveRow;
  1019. if (row == null)
  1020. {
  1021. MessageUtil.ShowTips("无工单信息,不允许此操作!");
  1022. }
  1023. if (!row.Cells["ZyBillStatus"].Value.ToString().Equals("生产中"))
  1024. {
  1025. MessageUtil.ShowTips("此工单不是生产中,不允许此操作!");
  1026. return;
  1027. }
  1028. string zPieces = "";
  1029. string fPieces = "";
  1030. string gPieces = "";
  1031. if (numPieces.Value == null || numPieces.Value.Equals(""))
  1032. {
  1033. zPieces = "0";
  1034. }
  1035. else
  1036. {
  1037. zPieces = numPieces.Value.ToString();
  1038. }
  1039. if (numQualified.Value == null || numQualified.Value.Equals(""))
  1040. {
  1041. gPieces = "0";
  1042. }
  1043. else
  1044. {
  1045. gPieces = numQualified.Value.ToString();
  1046. }
  1047. if (numRejected.Value == null || numRejected.Value.Equals(""))
  1048. {
  1049. fPieces = "0";
  1050. }
  1051. else
  1052. {
  1053. fPieces = numRejected.Value.ToString();
  1054. }
  1055. //string zYgNo = uRow.Cells["ZY_PLAN_ID"].Value.ToString();
  1056. //string woId = uRow.Cells["WO_ID"].Value.ToString();
  1057. //DataTable dt = ServerHelper.GetData("com.steering.mes.mcp.common.PlanService.getQueryWoIdDetails", new object[] { woId, zYgNo }, this.ob);
  1058. //if (dt.Rows[0]["CUT_STATUS"].ToString().Equals("生产完成"))
  1059. //{
  1060. // MessageUtil.ShowTips("此工单工序点已结炉,不允许此操作!");
  1061. // return;
  1062. //}
  1063. //if(!QueryStatusGd(row.Cells["WO_ID"].Value.ToString(), row.Cells["ZY_PLAN_ID"].Value.ToString())) return;
  1064. if (double.Parse(gPieces) < double.Parse(fPieces))
  1065. {
  1066. MessageUtil.ShowTips("废品个数不能大于锯切个数!");
  1067. return;
  1068. }
  1069. ArrayList list = new ArrayList();
  1070. list.Add(uRow.Cells["ResultNo"].Text.ToString());
  1071. list.Add(gPieces);//加工个数
  1072. list.Add(zPieces);//加工支数
  1073. list.Add(fPieces);
  1074. list.Add(cmbReason.Text.ToString());
  1075. list.Add(txtBC.Value.ToString());
  1076. list.Add(txtBz.Value.ToString());
  1077. list.Add(cmbJcCode.Text.Trim());
  1078. list.Add(numLength.Value.ToString() == null ? "0" : numLength.Value.ToString());
  1079. list.Add(cmbOperator.Text.Trim());
  1080. list.Add(txtEmbossed.Text.Trim());
  1081. list.Add(numEmbossed.Value.ToString());
  1082. //double PlnCount = 0;//计划切割个数
  1083. //double CutCount = 0;//实际切割个数
  1084. //DataTable dt1 = ServerHelper.GetData("com.steering.mes.mcp.coup.PhosphateResultService.queryPlanJg", new Object[] { row.Cells["ZY_PLAN_ID"].Text.ToString() }, ob);
  1085. //if (dt1.Rows.Count > 0)
  1086. //{
  1087. // PlnCount = Double.Parse(dt1.Rows[0]["CUT_PLN_NUMB"].ToString());
  1088. // CutCount = Double.Parse(dt1.Rows[0]["CUT_OK_NUM"].ToString());
  1089. //}
  1090. //// + Double.Parse(numQualified.Value.ToString())
  1091. //if (CutCount > PlnCount)
  1092. //{
  1093. // if (MessageUtil.ShowYesNoAndQuestion("实际锯切个数超过计划锯切个数是否修改!") == DialogResult.No) { return; }
  1094. //}
  1095. if (MessageUtil.ShowYesNoAndQuestion("是否修改锯切记录?") == DialogResult.No)
  1096. {
  1097. return;
  1098. }
  1099. CoreClientParam ccp = new CoreClientParam();
  1100. try
  1101. {
  1102. this.Cursor = Cursors.WaitCursor; //控制鼠标的样式为等待
  1103. if (Constant.WaitingForm == null)
  1104. {
  1105. Constant.WaitingForm = new WaitingForm();
  1106. }
  1107. Constant.WaitingForm.ShowToUser = true;
  1108. Constant.WaitingForm.Show();
  1109. Constant.WaitingForm.Update();
  1110. ccp.ServerName = "com.steering.mes.mcp.coup.CoupCutService";
  1111. ccp.MethodName = "updateCutResult";
  1112. ccp.ServerParams = new object[] { list, cutGx, embGx, row.Cells["WoId"].Text.ToString() };
  1113. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  1114. this.Cursor = Cursors.Default;
  1115. Constant.WaitingForm.ShowToUser = false;
  1116. Constant.WaitingForm.Close();
  1117. Constant.WaitingForm = null;
  1118. }
  1119. catch (Exception ex)
  1120. {
  1121. this.Cursor = Cursors.Default;
  1122. Constant.WaitingForm.ShowToUser = false;
  1123. Constant.WaitingForm.Close();
  1124. Constant.WaitingForm = null;
  1125. }
  1126. if (ccp.ReturnCode == -1) return;
  1127. MessageUtil.ShowTips(ccp.ReturnInfo);
  1128. if (ccp.ReturnInfo.Equals("修改锯切实绩成功!"))
  1129. {
  1130. QuerySinglePlan();
  1131. }
  1132. }
  1133. /// <summary>
  1134. /// 删除切割实绩
  1135. /// </summary>
  1136. private void DoDelete()
  1137. {
  1138. this.ultraGrid2.UpdateData();
  1139. IQueryable<UltraGridRow> checkMagRows = this.ultraGrid2.Rows.AsQueryable().Where(" CHECK = 'True'");
  1140. if (checkMagRows.Count() == 0)
  1141. {
  1142. MessageUtil.ShowTips("请选择需要撤销锯切的信息!");
  1143. return;
  1144. }
  1145. UltraGridRow uRow = this.ultraGrid2.ActiveRow;
  1146. if (uRow == null) return;
  1147. if (uRow.Cells["Confirm"].Value.Equals("1"))
  1148. {
  1149. MessageUtil.ShowTips("选中的锯切实绩已经确认,不允许删除!");
  1150. return;
  1151. }
  1152. UltraGridRow row = this.ultraGridWoId.ActiveRow;
  1153. if (!row.Cells["ZyBillStatus"].Value.ToString().Equals("生产中"))
  1154. {
  1155. MessageUtil.ShowTips("此工单不是生产中,不允许此操作!");
  1156. return;
  1157. }
  1158. ArrayList list = new ArrayList();
  1159. foreach (UltraGridRow rows in checkMagRows)
  1160. {
  1161. CouplingCutResultEntity matBcEntity = (CouplingCutResultEntity)rows.ListObject;
  1162. string matEntity = JSONFormat.Format(matBcEntity);
  1163. list.Add(matEntity);
  1164. }
  1165. if (MessageUtil.ShowYesNoAndQuestion("是否删除锯切记录?") == DialogResult.No)
  1166. {
  1167. return;
  1168. }
  1169. CoreClientParam ccp = new CoreClientParam();
  1170. try
  1171. {
  1172. this.Cursor = Cursors.WaitCursor; //控制鼠标的样式为等待
  1173. if (Constant.WaitingForm == null)
  1174. {
  1175. Constant.WaitingForm = new WaitingForm();
  1176. }
  1177. Constant.WaitingForm.ShowToUser = true;
  1178. Constant.WaitingForm.Show();
  1179. Constant.WaitingForm.Update();
  1180. ccp.ServerName = "com.steering.mes.mcp.coup.CoupCutService";
  1181. ccp.MethodName = "deleteCutResult";
  1182. ccp.ServerParams = new object[] { list, row.Cells["WoId"].Text.ToString(), cutGx };
  1183. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  1184. this.Cursor = Cursors.Default;
  1185. Constant.WaitingForm.ShowToUser = false;
  1186. Constant.WaitingForm.Close();
  1187. Constant.WaitingForm = null;
  1188. }
  1189. catch (Exception ex)
  1190. {
  1191. this.Cursor = Cursors.Default;
  1192. Constant.WaitingForm.ShowToUser = false;
  1193. Constant.WaitingForm.Close();
  1194. Constant.WaitingForm = null;
  1195. }
  1196. if (ccp.ReturnCode == -1) return;
  1197. MessageUtil.ShowTips(ccp.ReturnInfo);
  1198. if (ccp.ReturnInfo.Equals("删除锯切实绩成功!"))
  1199. {
  1200. QuerySinglePlan();
  1201. DoClean();
  1202. }
  1203. }
  1204. /// <summary>
  1205. /// 按回车键触发查询按钮
  1206. /// </summary>
  1207. /// <param name="sender"></param>
  1208. /// <param name="e"></param>
  1209. private void ContPublic_KeyDown(object sender, KeyEventArgs e)
  1210. {
  1211. if (e.KeyCode == Keys.Enter)
  1212. {
  1213. QuerySinglePlan();
  1214. }
  1215. }
  1216. /// <summary>
  1217. /// 托选
  1218. /// </summary>
  1219. /// <param name="sender"></param>
  1220. /// <param name="e"></param>
  1221. private void ultraGrid2_AfterSelectChange(object sender, AfterSelectChangeEventArgs e)
  1222. {
  1223. try
  1224. {
  1225. ultraGrid2.UpdateData();
  1226. foreach (UltraGridRow row in ultraGrid2.Rows)
  1227. {
  1228. row.Cells["CHC"].Value = row.Selected;
  1229. }
  1230. }
  1231. catch { }
  1232. }
  1233. /// <summary>
  1234. /// 机床编号改变事件
  1235. /// </summary>
  1236. /// <param name="sender"></param>
  1237. /// <param name="e"></param>
  1238. ///查询操作工,根据机床编号
  1239. private void cmbJcCode_TextChanged(object sender, EventArgs e)
  1240. {
  1241. UltraGridRow row = this.ultraGridWoId.ActiveRow;
  1242. if (row == null) return;
  1243. string[] lathCutNm = row.Cells["LatheCutNm"].Text.ToString().Replace(" ", "").Split(',');
  1244. DataTable dt = ServerHelper.GetData("com.steering.mes.mcp.coup.CoupCutService.getMachUser", new object[] { cmbJcCode.Text.ToString(), lathCutNm }, this.ob);
  1245. cmbOperator.DataSource = dt;
  1246. cmbOperator.DisplayMember = "MACHINE_USER1";
  1247. cmbOperator.ValueMember = "MACHINE_USER1";
  1248. YdmBaseClass.SetComboItemHeight(cmbOperator);
  1249. }
  1250. /// <summary>
  1251. /// 废品
  1252. /// </summary>
  1253. /// <param name="sender"></param>
  1254. /// <param name="e"></param>
  1255. private void numRejected_ValueChanged(object sender, EventArgs e)
  1256. {
  1257. string zPieces = "";
  1258. string fPieces = "";
  1259. string gPieces = "";
  1260. //if (cmbEmbossed.Text.ToString().Equals("是"))
  1261. //{
  1262. // numEmbossed.Value = double.Parse(numQualified.Value.ToString());
  1263. //}
  1264. UltraGridRow uRow = this.ultraGridWoId.ActiveRow;
  1265. if (uRow == null) return;
  1266. if (numPieces.Text == null || numPieces.Text.Equals(""))
  1267. {
  1268. zPieces = "0";
  1269. }
  1270. else
  1271. {
  1272. zPieces = numPieces.Value.ToString();
  1273. }
  1274. if (numQualified.Text == null || numQualified.Text.Equals(""))
  1275. {
  1276. gPieces = "0";
  1277. }
  1278. else
  1279. {
  1280. gPieces = numQualified.Value.ToString();
  1281. }
  1282. if (numRejected.Text == null || numRejected.Text.Equals(""))
  1283. {
  1284. fPieces = "0";
  1285. }
  1286. else
  1287. {
  1288. fPieces = numRejected.Value.ToString();
  1289. }
  1290. jgPiece = int.Parse(zPieces) * int.Parse(uRow.Cells["SingleCutNun"].Value.ToString());
  1291. if (jgPiece - int.Parse(fPieces) < int.Parse(gPieces))
  1292. {
  1293. praloPcs.Text = ("-" + (int.Parse(fPieces) + int.Parse(gPieces) - jgPiece)).ToString().Trim();
  1294. }
  1295. else
  1296. {
  1297. praloPcs.Text = (jgPiece - int.Parse(fPieces) - int.Parse(gPieces)).ToString().Trim();
  1298. }
  1299. if (numRejected.Value==null||numRejected.Value.ToString().Equals(""))
  1300. {
  1301. cmbReason.Enabled = false;
  1302. }
  1303. else
  1304. {
  1305. cmbReason.Enabled = true;
  1306. }
  1307. if (cmbEmbossed.Text.ToString().Equals("是"))
  1308. {
  1309. if (int.Parse(numQualified.Value.ToString())< 0)
  1310. {
  1311. numEmbossed.Value = 0;
  1312. }
  1313. else
  1314. {
  1315. numEmbossed.Value = int.Parse(numQualified.Value.ToString());
  1316. }
  1317. }
  1318. }
  1319. private void DoClean()
  1320. {
  1321. cmbJcCode.Text = "";
  1322. cmbOperator.Text = "";
  1323. numPieces.Text = "";
  1324. numQualified.Text = "";
  1325. numRejected.Text = "";
  1326. cmbReason.Text = "";
  1327. txtBC.Value = this.UserInfo.GetUserOrder();
  1328. txtBz.Value = this.UserInfo.GetUserGroup();
  1329. numLength.Text = "0.00";
  1330. numEmbossed.Value = 0;
  1331. txtEmbossed.Text = "";
  1332. txtMemo.Text = "";
  1333. }
  1334. private void numQualified_ValueChanged(object sender, EventArgs e)
  1335. {
  1336. string zPieces = "";
  1337. string fPieces = "";
  1338. string gPieces = "";
  1339. //if (cmbEmbossed.Text.ToString().Equals("是"))
  1340. //{
  1341. // if (numQualified.Value.ToString() == null || numQualified.Value.ToString().Equals(""))
  1342. // {
  1343. // numEmbossed.Value = 0;
  1344. // }
  1345. // else
  1346. // {
  1347. // numEmbossed.Value = double.Parse(numQualified.Value.ToString());
  1348. // }
  1349. //}
  1350. UltraGridRow uRow = this.ultraGridWoId.ActiveRow;
  1351. if (uRow == null) return;
  1352. if (numPieces.Text == null || numPieces.Text.Equals(""))
  1353. {
  1354. zPieces = "0";
  1355. }
  1356. else
  1357. {
  1358. zPieces = numPieces.Value.ToString();
  1359. }
  1360. if (numQualified.Text == null || numQualified.Text.Equals(""))
  1361. {
  1362. gPieces = "0";
  1363. }
  1364. else
  1365. {
  1366. gPieces = numQualified.Value.ToString();
  1367. }
  1368. if (numRejected.Text == null || numRejected.Text.Equals(""))
  1369. {
  1370. fPieces = "0";
  1371. }
  1372. else
  1373. {
  1374. fPieces = numRejected.Value.ToString();
  1375. }
  1376. jgPiece = int.Parse(zPieces) * int.Parse(uRow.Cells["SingleCutNun"].Value.ToString());
  1377. if (jgPiece - int.Parse(fPieces) < int.Parse(gPieces))
  1378. {
  1379. praloPcs.Text = ("-" + (int.Parse(fPieces) + int.Parse(gPieces) - jgPiece)).ToString().Trim();
  1380. }
  1381. else
  1382. {
  1383. praloPcs.Text = (jgPiece - int.Parse(fPieces) - int.Parse(gPieces)).ToString().Trim();
  1384. }
  1385. if(cmbEmbossed.Text.Equals("是"))
  1386. {
  1387. if (numQualified.Text == null || numQualified.Text.Equals(""))
  1388. {
  1389. numEmbossed.Value = "0";
  1390. }
  1391. else
  1392. {
  1393. numEmbossed.Value = numQualified.Value.ToString();
  1394. }
  1395. }
  1396. else
  1397. {
  1398. numEmbossed.Value = "0";
  1399. }
  1400. }
  1401. /// <summary>
  1402. ///
  1403. /// </summary>
  1404. /// <param name="sender"></param>
  1405. /// <param name="e"></param>
  1406. private void ultraGrid2_AfterRowActivate(object sender, EventArgs e)
  1407. {
  1408. UltraGridRow uRow = this.ultraGrid2.ActiveRow;
  1409. if (uRow == null) return;
  1410. //if (uRow.Cells["IfAllOutWork"].Value.ToString().Equals("/"))
  1411. //{
  1412. //cmbJcCode.Text = uRow.Cells["MachineNo"].Value.ToString();
  1413. //numPieces.Value = uRow.Cells["CutPieces"].Value.ToString();
  1414. //numQualified.Value = uRow.Cells["QualifiedNumber"].Value.ToString();
  1415. //numRejected.Value = uRow.Cells["RejectedPcs"].Value.ToString();
  1416. //cmbReason.Text = uRow.Cells["RejectedReason"].Value.ToString();
  1417. //numLength.Value = uRow.Cells["LvalidLength"].Value.ToString();
  1418. //cmbOperator.Text = uRow.Cells["ColOperator"].Value.ToString();
  1419. //txtBC.Text = uRow.Cells["ColShift"].Value.ToString();
  1420. //txtBz.Text = uRow.Cells["ColGroup"].Value.ToString();
  1421. //txtUser.Text = uRow.Cells["ColUser"].Value.ToString();
  1422. //cmbEmbossed.Text = uRow.Cells["IsEmbossed"].Value.ToString();
  1423. //numEmbossed.Value = uRow.Cells["EmbCount"].Value.ToString();
  1424. //txtEmbossed.Text = uRow.Cells["EmbContent"].Value.ToString();
  1425. //}
  1426. }
  1427. private void chkStarts_CheckedChanged(object sender, EventArgs e)
  1428. {
  1429. if (chkStarts.Checked) { cmbStarts.Enabled = true; } else { cmbStarts.Enabled = false; }
  1430. if (chkJuNo.Checked) { txtJudgeStoveNO.Enabled = true; } else { txtJudgeStoveNO.Enabled = false; }
  1431. if (chkPlnNo.Checked) { txtPlnNo.Enabled = true; } else { txtPlnNo.Enabled = false; }
  1432. if (chkwoId.Checked) { txtWoId.Enabled = true; } else { txtWoId.Enabled = false; }
  1433. }
  1434. private void craftImg_EditorButtonClick(object sender, Infragistics.Win.UltraWinEditors.EditorButtonEventArgs e)
  1435. {
  1436. UltraGridRow row = ultraGridWoId.ActiveRow;
  1437. if (row == null) return;
  1438. string orderNo = row.Cells["OrderNoSeq"].Text.ToString();
  1439. string strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilCouplingProcess2.cpt"
  1440. + "&ORDER_NO=" + orderNo;
  1441. FrmRepExcel down = new FrmRepExcel(ob, strurl);
  1442. down.Text = "接箍二级工艺";
  1443. down.Visible = false;
  1444. down.Size = new Size(740, this.Height);
  1445. down.WindowState = FormWindowState.Maximized;
  1446. down.ShowDialog();
  1447. }
  1448. /// <summary>
  1449. /// 输入加工支数
  1450. /// </summary>
  1451. /// <param name="sender"></param>
  1452. /// <param name="e"></param>
  1453. private void numPieces_ValueChanged(object sender, EventArgs e)
  1454. {
  1455. string gPieces = "";
  1456. string zPieces = "";
  1457. string fPieces = "";
  1458. UltraGridRow row = ultraGridWoId.ActiveRow;
  1459. if (row == null) return;
  1460. if (numPieces.Text == null || numPieces.Text.Equals(""))
  1461. {
  1462. zPieces = "0";
  1463. }
  1464. else
  1465. {
  1466. zPieces = numPieces.Value.ToString();
  1467. }
  1468. if (numQualified.Text == null || numQualified.Text.Equals(""))
  1469. {
  1470. gPieces = "0";
  1471. }
  1472. else
  1473. {
  1474. gPieces = numQualified.Value.ToString();
  1475. }
  1476. if (numRejected.Text == null || numRejected.Text.Equals(""))
  1477. {
  1478. fPieces = "0";
  1479. }
  1480. else
  1481. {
  1482. fPieces = numRejected.Value.ToString();
  1483. }
  1484. jgPiece = int.Parse(zPieces) * int.Parse(row.Cells["SingleCutNun"].Value.ToString());
  1485. if (jgPiece - int.Parse(fPieces) < int.Parse(gPieces))
  1486. {
  1487. praloPcs.Text = ("-" + (int.Parse(fPieces) + int.Parse(gPieces) - jgPiece)).ToString().Trim();
  1488. }
  1489. else
  1490. {
  1491. praloPcs.Text = (jgPiece - int.Parse(fPieces) - int.Parse(gPieces)).ToString().Trim();
  1492. }
  1493. }
  1494. private void cmbEmbossed_TextChanged(object sender, EventArgs e)
  1495. {
  1496. if (cmbEmbossed.Text.Equals("是"))
  1497. {
  1498. numEmbossed.Enabled = true;
  1499. txtEmbossed.Enabled = true;
  1500. }
  1501. else
  1502. {
  1503. numEmbossed.Enabled = false;
  1504. txtEmbossed.Enabled = false;
  1505. }
  1506. }
  1507. private void ultraGrid2_CellChange(object sender, CellEventArgs e)
  1508. {
  1509. UltraGridRow uRow = this.ultraGrid2.ActiveRow;
  1510. if (uRow == null) return;
  1511. if (Convert.ToBoolean(uRow.Cells["CHECK"].Text) == true)
  1512. {
  1513. cmbJcCode.Text = uRow.Cells["MachineNo"].Value.ToString();
  1514. numPieces.Value = uRow.Cells["CutPieces"].Value.ToString();
  1515. numQualified.Value = uRow.Cells["QualifiedNumber"].Value.ToString();
  1516. numRejected.Value = uRow.Cells["RejectedPcs"].Value.ToString();
  1517. cmbReason.Text = uRow.Cells["RejectedReason"].Value.ToString();
  1518. numLength.Value = uRow.Cells["LvalidLength"].Value.ToString();
  1519. cmbOperator.Text = uRow.Cells["ColOperator"].Value.ToString();
  1520. txtBC.Text = uRow.Cells["ColShift"].Value.ToString();
  1521. txtBz.Text = uRow.Cells["ColGroup"].Value.ToString();
  1522. txtUser.Text = uRow.Cells["ColUser"].Value.ToString();
  1523. cmbEmbossed.Text = uRow.Cells["IsEmbossed"].Value.ToString();
  1524. numEmbossed.Value = uRow.Cells["EmbCount"].Value.ToString();
  1525. txtEmbossed.Text = uRow.Cells["EmbContent"].Value.ToString();
  1526. }
  1527. else
  1528. {
  1529. DoClean();
  1530. }
  1531. }
  1532. private void numPieces_AfterEnterEditMode(object sender, EventArgs e)
  1533. {
  1534. this.BeginInvoke(new MethodInvoker(this.numPieces.SelectAll));
  1535. }
  1536. private void numQualified_AfterEnterEditMode(object sender, EventArgs e)
  1537. {
  1538. this.BeginInvoke(new MethodInvoker(this.numQualified.SelectAll));
  1539. }
  1540. private void numRejected_AfterEnterEditMode(object sender, EventArgs e)
  1541. {
  1542. this.BeginInvoke(new MethodInvoker(this.numRejected.SelectAll));
  1543. }
  1544. private void numLength_AfterEnterEditMode(object sender, EventArgs e)
  1545. {
  1546. this.BeginInvoke(new MethodInvoker(this.numLength.SelectAll));
  1547. }
  1548. private void numEmbossed_AfterEnterEditMode(object sender, EventArgs e)
  1549. {
  1550. this.BeginInvoke(new MethodInvoker(this.numEmbossed.SelectAll));
  1551. }
  1552. private void cmbOperator_TextChanged(object sender, EventArgs e)
  1553. {
  1554. txtBz.Text = "";
  1555. DataTable dt = ServerHelper.GetData("com.steering.mes.mcp.coup.CoupCutService.getMatProBz", new object[] { cmbOperator.Text.ToString() }, this.ob);
  1556. if(dt.Rows.Count>0)
  1557. {
  1558. txtBz.DataSource = dt;
  1559. txtBz.DisplayMember = "PRO_BZ_NAME";
  1560. txtBz.ValueMember = "PRO_BZ";
  1561. txtBz.SelectedIndex = 0;
  1562. YdmBaseClass.SetComboItemHeight(txtBz);
  1563. }
  1564. }
  1565. }
  1566. }