FrmOutSourPerfor.cs 35 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849
  1. using Core.Mes.Client.Comm.Control;
  2. using Core.Mes.Client.Comm.Server;
  3. using Core.Mes.Client.Comm.Tool;
  4. using Core.StlMes.Client.Mcp.CollarMaterial;
  5. using Core.StlMes.Client.Mcp.Common;
  6. using Core.StlMes.Client.Mcp.Control;
  7. using Core.StlMes.Client.Mcp.Entity;
  8. using CoreFS.CA06;
  9. using Infragistics.Win.UltraWinGrid;
  10. using System;
  11. using System.Collections;
  12. using System.Collections.Generic;
  13. using System.ComponentModel;
  14. using System.Data;
  15. using System.Drawing;
  16. using System.Linq;
  17. using System.Text;
  18. using System.Windows.Forms;
  19. namespace Core.StlMes.Client.Mcp.Coupling
  20. {
  21. public partial class FrmOutSourPerfor : FrmBase
  22. {
  23. private string departm = "";//获取部门ID
  24. private string[] plineCode = null;//获取产线代码
  25. public FrmOutSourPerfor()
  26. {
  27. InitializeComponent();
  28. this.IsLoadUserView = true;
  29. }
  30. protected override void OnLoad(EventArgs e)
  31. {
  32. base.OnLoad(e);
  33. //禁控件过滤
  34. this.coupWoIdPlanControl1.Grid.DisplayLayout.Override.AllowRowFiltering = Infragistics.Win.DefaultableBoolean.False;
  35. //设置计划区控件只读
  36. //this.coupWoIdPlanControl1.SetAllColumnsActiveOnly();
  37. coupWoIdPlanControl1.Ob = this.ob;
  38. }
  39. private void FrmOutSourPerfor_Load(object sender, EventArgs e)
  40. {
  41. departm = UserInfo.GetDeptid();
  42. plineCode = McpBaseHelper.GetPCodePline(departm, this.ob);
  43. //McpBaseHelper.InitPlineUnit(cmbCname, plineCode, this.ob,"H");
  44. EntityHelper.ShowGridCaption<CouplingComInfoEntity>(ultraGrid1.DisplayLayout.Bands[0]);
  45. txtBC.Value = this.UserInfo.GetUserOrder();
  46. txtBz.Value = this.UserInfo.GetUserGroup();
  47. //PipeManageClass.setUltraGridColumnInput(ultraGrid1, new string[] { "ProNum" });//支数
  48. }
  49. public override void ToolBar_Click(object sender, string ToolbarKey)
  50. {
  51. switch (ToolbarKey)
  52. {
  53. case "DoQuery":
  54. QuerySinglePlan();
  55. break;
  56. case "DoSave":
  57. DoSave();
  58. break;
  59. case "DoUpdate":
  60. DoUpdate();
  61. break;
  62. case "DoDelete":
  63. DoDelete();
  64. break;
  65. case "DoBeside"://结炉
  66. DoBeside();
  67. break;
  68. case "UndoBeside"://撤销结炉
  69. UndoBeside();
  70. break;
  71. case "DoClose":
  72. this.Close();
  73. break;
  74. }
  75. }
  76. /// <summary>
  77. /// 工序结炉
  78. /// </summary>
  79. private void DoBeside()
  80. {
  81. UltraGridRow uRow = this.ultraGridWoId.ActiveRow;
  82. if (uRow == null) return;
  83. UltraGridRow row = this.ultraGrid1.ActiveRow;
  84. if (row == null) { MessageUtil.ShowTips("无委外实绩!"); return; }
  85. //string zYgNo = row.Cells["WO_ID"].Value.ToString();
  86. //FrmOutPrce outPrce = new FrmOutPrce(this.ob, zYgNo,true);
  87. //outPrce.AutoSize = true;
  88. //outPrce.MaximumSize = new Size(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height);
  89. //outPrce.Text = "委外工序";
  90. //outPrce.ShowDialog();
  91. //QuerySinglePlan();
  92. ArrayList list1 = new ArrayList();
  93. int UpdaCount = 0;
  94. foreach (UltraGridRow ugr in ultraGrid1.Rows)
  95. {
  96. if (Convert.ToBoolean(ugr.Cells["CHECK"].Text) == true)
  97. {
  98. UpdaCount += 1;
  99. ArrayList list = new ArrayList();
  100. list.Add(ugr.Cells["ResultNo"].Text.ToString());
  101. list.Add(ugr.Cells["WoId"].Text.ToString());
  102. list.Add(ugr.Cells["ZyPlanId"].Text.ToString());
  103. list.Add(ugr.Cells["StationCode"].Text.ToString());
  104. list.Add(ugr.Cells["StationDesc"].Text.ToString());
  105. list1.Add(list);
  106. }
  107. }
  108. //double PlnCount = 0;//计划个数
  109. //double CutCount = 0;//实际个数
  110. //DataTable dt = ServerHelper.GetData("com.steering.mes.mcp.coup.PhosphateResultService.queryPlanJg", new Object[] { uRow.Cells["ZY_PLAN_ID"].Text.ToString() }, ob);
  111. //if (dt.Rows.Count > 0)
  112. //{
  113. // PlnCount = Double.Parse(dt.Rows[0]["PLAN_LATHE_NUM"].ToString());
  114. // CutCount = Double.Parse(dt.Rows[0]["LATHE_OK_NUM"].ToString());
  115. //}
  116. // + Double.Parse(numQualified.Value.ToString())
  117. //if (CutCount > PlnCount)
  118. //{
  119. // if (MessageUtil.ShowYesNoAndQuestion("实际车丝个数超过计划车丝个数是否结炉!") == DialogResult.Yes) { return; }
  120. //}
  121. if (UpdaCount == 0) { MessageUtil.ShowTips("请选择委外实绩数据!"); return; }
  122. if (MessageUtil.ShowYesNoAndQuestion("是否结炉?") == DialogResult.No)
  123. {
  124. return;
  125. }
  126. CoreClientParam ccp = new CoreClientParam();
  127. try
  128. {
  129. this.Cursor = Cursors.WaitCursor; //控制鼠标的样式为等待
  130. if (Constant.WaitingForm == null)
  131. {
  132. Constant.WaitingForm = new WaitingForm();
  133. }
  134. Constant.WaitingForm.ShowToUser = true;
  135. Constant.WaitingForm.Show();
  136. Constant.WaitingForm.Update();
  137. ccp.ServerName = "com.steering.mes.mcp.coup.FrmOutSourPerfor";
  138. ccp.MethodName = "doBeside";
  139. ccp.ServerParams = new object[] { list1 };
  140. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  141. this.Cursor = Cursors.Default;
  142. Constant.WaitingForm.ShowToUser = false;
  143. Constant.WaitingForm.Close();
  144. Constant.WaitingForm = null;
  145. }
  146. catch (Exception ex)
  147. {
  148. this.Cursor = Cursors.Default;
  149. Constant.WaitingForm.ShowToUser = false;
  150. Constant.WaitingForm.Close();
  151. Constant.WaitingForm = null;
  152. }
  153. if (ccp.ReturnCode == -1) return;
  154. MessageUtil.ShowTips(ccp.ReturnInfo);
  155. if (ccp.ReturnInfo.Equals("结炉成功!"))
  156. {
  157. QuerySinglePlan();
  158. }
  159. }
  160. /// <summary>
  161. /// 撤销结炉
  162. /// </summary>
  163. private void UndoBeside()
  164. {
  165. UltraGridRow uRow = this.ultraGridWoId.ActiveRow;
  166. if (uRow == null) return;
  167. UltraGridRow row = this.ultraGrid1.ActiveRow;
  168. if (row == null) { MessageUtil.ShowTips("无委外实绩!"); return; }
  169. //string zYgNo = row.Cells["WO_ID"].Value.ToString();
  170. //FrmOutPrce outPrce = new FrmOutPrce(this.ob, zYgNo, false);
  171. //outPrce.AutoSize = true;
  172. //outPrce.MaximumSize = new Size(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height);
  173. //outPrce.Text = "委外工序";
  174. //outPrce.ShowDialog();
  175. //QuerySinglePlan();
  176. ArrayList list1 = new ArrayList();
  177. int UpdaCount = 0;
  178. foreach (UltraGridRow ugr in ultraGrid1.Rows)
  179. {
  180. if (Convert.ToBoolean(ugr.Cells["CHECK"].Text) == true)
  181. {
  182. UpdaCount += 1;
  183. ArrayList list = new ArrayList();
  184. list.Add(ugr.Cells["ResultNo"].Text.ToString());
  185. list.Add(ugr.Cells["WoId"].Text.ToString());
  186. list.Add(ugr.Cells["ZyPlanId"].Text.ToString());
  187. list.Add(ugr.Cells["StationCode"].Text.ToString());
  188. list.Add(ugr.Cells["StationDesc"].Text.ToString());
  189. list1.Add(list);
  190. }
  191. }
  192. //double PlnCount = 0;//计划个数
  193. //double CutCount = 0;//实际个数
  194. //DataTable dt = ServerHelper.GetData("com.steering.mes.mcp.coup.PhosphateResultService.queryPlanJg", new Object[] { uRow.Cells["ZY_PLAN_ID"].Text.ToString() }, ob);
  195. //if (dt.Rows.Count > 0)
  196. //{
  197. // PlnCount = Double.Parse(dt.Rows[0]["PLAN_LATHE_NUM"].ToString());
  198. // CutCount = Double.Parse(dt.Rows[0]["LATHE_OK_NUM"].ToString());
  199. //}
  200. // + Double.Parse(numQualified.Value.ToString())
  201. //if (CutCount > PlnCount)
  202. //{
  203. // if (MessageUtil.ShowYesNoAndQuestion("实际车丝个数超过计划车丝个数是否结炉!") == DialogResult.Yes) { return; }
  204. //}
  205. if (UpdaCount == 0) { MessageUtil.ShowTips("请选择委外实绩数据!"); return; }
  206. if (MessageUtil.ShowYesNoAndQuestion("是否撤销结炉?") == DialogResult.No)
  207. {
  208. return;
  209. }
  210. CoreClientParam ccp = new CoreClientParam();
  211. try
  212. {
  213. this.Cursor = Cursors.WaitCursor; //控制鼠标的样式为等待
  214. if (Constant.WaitingForm == null)
  215. {
  216. Constant.WaitingForm = new WaitingForm();
  217. }
  218. Constant.WaitingForm.ShowToUser = true;
  219. Constant.WaitingForm.Show();
  220. Constant.WaitingForm.Update();
  221. ccp.ServerName = "com.steering.mes.mcp.coup.FrmOutSourPerfor";
  222. ccp.MethodName = "undoBeside";
  223. ccp.ServerParams = new object[] { list1 };
  224. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  225. this.Cursor = Cursors.Default;
  226. Constant.WaitingForm.ShowToUser = false;
  227. Constant.WaitingForm.Close();
  228. Constant.WaitingForm = null;
  229. }
  230. catch (Exception ex)
  231. {
  232. this.Cursor = Cursors.Default;
  233. Constant.WaitingForm.ShowToUser = false;
  234. Constant.WaitingForm.Close();
  235. Constant.WaitingForm = null;
  236. }
  237. if (ccp.ReturnCode == -1) return;
  238. MessageUtil.ShowTips(ccp.ReturnInfo);
  239. if (ccp.ReturnInfo.Equals("撤销结炉成功!"))
  240. {
  241. QuerySinglePlan();
  242. }
  243. }
  244. /// <summary>
  245. /// 简单查询
  246. /// </summary>
  247. private void QuerySinglePlan()
  248. {
  249. string woId = "";
  250. string starts = "";
  251. string judgeStoveNo = "";
  252. string plnNo = "";
  253. #region 条件
  254. if (chkStarts.Checked)
  255. {
  256. if (string.IsNullOrEmpty(cmbStarts.Text.Trim()))
  257. {
  258. MessageUtil.ShowTips("请选择工单状态!");
  259. return;
  260. }
  261. else
  262. {
  263. starts = cmbStarts.Value.ToString();
  264. }
  265. }
  266. if (chkwoId.Checked && string.IsNullOrEmpty(txtWoId.Text.Trim()))
  267. {
  268. MessageUtil.ShowTips("请输入工单号!");
  269. return;
  270. }
  271. else
  272. {
  273. woId = txtWoId.Text.ToString().Trim();
  274. }
  275. if (chkPlnNo.Checked && string.IsNullOrEmpty(txtPlnNo.Text.Trim()))
  276. {
  277. MessageUtil.ShowTips("请输入炉次计划号!");
  278. return;
  279. }
  280. else
  281. {
  282. plnNo = txtPlnNo.Text.ToString().Trim();
  283. }
  284. if (chkJuNo.Checked && string.IsNullOrEmpty(txtJudgeStoveNO.Text.Trim()))
  285. {
  286. MessageUtil.ShowTips("请输入炉号!");
  287. return;
  288. }
  289. else
  290. {
  291. judgeStoveNo = txtJudgeStoveNO.Text.ToString().Trim();
  292. }
  293. #endregion
  294. ArrayList list = new ArrayList();
  295. list.Add(woId);
  296. list.Add(plnNo);
  297. list.Add(judgeStoveNo);
  298. list.Add(starts);
  299. DataTable dt = ServerHelper.GetData("com.steering.mes.mcp.common.PlanService.getQueryWoId", new object[] { list, plineCode[0].ToString() }, this.ob);
  300. GridHelper.CopyDataToDatatable(ref dt, ref dtProcessPlan, true);
  301. GridHelper.RefreshAndAutoSize(ultraGridWoId);
  302. DataTable dt1 = ServerHelper.GetData("com.steering.mes.mcp.common.PlanService.ulgetQueryWoId", new object[] { list, plineCode[0].ToString() }, this.ob);
  303. GridHelper.CopyDataToDatatable(ref dt1, ref dataTable2, true);
  304. GridHelper.RefreshAndAutoSize(ultraGrid3);
  305. }
  306. private void DoSave()
  307. {
  308. UltraGridRow urg = this.ultraGridWoId.ActiveRow;
  309. if (urg == null)
  310. {
  311. MessageUtil.ShowTips("无工单信息,不允许此操作!");
  312. return;
  313. }
  314. if (urg.Cells["ZY_BILL_STATUS"].Value.ToString() == "生产完成")
  315. {
  316. MessageUtil.ShowTips("此工单已生产完成,不允许此操作!");
  317. return;
  318. }
  319. if (cmbGx.Text.Trim() == "") { MessageUtil.ShowTips("工序点不能为空!"); return; }
  320. if (numQualified.Value.ToString() == "0") { MessageUtil.ShowTips("个数不能为空或为零!"); return; }
  321. string gx = "";
  322. string xh = "";
  323. if (cmbGx.Text.Trim().Equals("锯切")) { gx = "700302"; }
  324. if (cmbGx.Text.Trim().Equals("粗加工")) { gx = "700303"; }
  325. if (cmbGx.Text.Trim().Equals("压印")) { gx = "700304"; }
  326. if (cmbGx.Text.Trim().Equals("车丝")) { gx = "700305"; }
  327. if (cmbGx.Text.Trim().Equals("喷砂")) { gx = "700308"; }
  328. if (cmbGx.Text.Trim().Equals("镀铜")) { gx = "700310"; }
  329. if (cmbGx.Text.Trim().Equals("磷化")) { gx = "700310"; }
  330. if (cmbGx.Text.Trim().Equals("喷标")) { gx = "700311"; }
  331. if (cmbGx.Text.Trim().Equals("螺纹检验")) { gx = "700306"; }
  332. if (cmbGx.Text.Trim().Equals("探伤")) { gx = "700307"; }
  333. DataTable dt2 = ServerHelper.GetData("com.steering.mes.mcp.common.PlanService.getQueryGX", new object[] { gx }, this.ob);
  334. if (dt2.Rows.Count > 0)
  335. {
  336. xh = dt2.Rows[0]["MEMO"].ToString();
  337. }
  338. ArrayList list = new ArrayList();
  339. list.Add(gx);
  340. list.Add(cmbGx.Text.ToString());
  341. list.Add(numQualified.Value.ToString());
  342. list.Add(txtBC.Value.ToString());
  343. list.Add(txtBz.Value.ToString());
  344. list.Add(urg.Cells["ZY_PLAN_ID"].Text.ToString());
  345. list.Add(this.UserInfo.GetUserName());
  346. list.Add(urg.Cells["PLINE_CODE"].Text.ToString());
  347. list.Add(urg.Cells["WO_ID"].Text.ToString());
  348. list.Add(xh);
  349. //double PlnCount = 0;//计划个数
  350. //double CutCount = 0;//实际个数
  351. //DataTable dt = ServerHelper.GetData("com.steering.mes.mcp.coup.PhosphateResultService.queryPlanJg", new Object[] { uRow.Cells["ZY_PLAN_ID"].Text.ToString() }, ob);
  352. //if (dt.Rows.Count > 0)
  353. //{
  354. // PlnCount = Double.Parse(dt.Rows[0]["PLAN_LATHE_NUM"].ToString());
  355. // CutCount = Double.Parse(dt.Rows[0]["LATHE_OK_NUM"].ToString());
  356. //}
  357. //// + Double.Parse(numQualified.Value.ToString())
  358. //if (CutCount > PlnCount)
  359. //{
  360. // if (MessageUtil.ShowYesNoAndQuestion("实际车丝个数超过计划车丝个数是否结炉!") == DialogResult.Yes) { return; }
  361. //}
  362. if (MessageUtil.ShowYesNoAndQuestion("是否保存记录?") == DialogResult.No)
  363. {
  364. return;
  365. }
  366. CoreClientParam ccp = new CoreClientParam();
  367. try
  368. {
  369. this.Cursor = Cursors.WaitCursor; //控制鼠标的样式为等待
  370. if (Constant.WaitingForm == null)
  371. {
  372. Constant.WaitingForm = new WaitingForm();
  373. }
  374. Constant.WaitingForm.ShowToUser = true;
  375. Constant.WaitingForm.Show();
  376. Constant.WaitingForm.Update();
  377. ccp.ServerName = "com.steering.mes.mcp.coup.FrmOutSourPerfor";
  378. ccp.MethodName = "addThreadingResult";
  379. ccp.ServerParams = new object[] { list };
  380. ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  381. this.Cursor = Cursors.Default;
  382. Constant.WaitingForm.ShowToUser = false;
  383. Constant.WaitingForm.Close();
  384. Constant.WaitingForm = null;
  385. }
  386. catch (Exception ex)
  387. {
  388. this.Cursor = Cursors.Default;
  389. Constant.WaitingForm.ShowToUser = false;
  390. Constant.WaitingForm.Close();
  391. Constant.WaitingForm = null;
  392. }
  393. if (ccp.ReturnCode != -1)
  394. {
  395. MessageUtil.ShowTips(ccp.ReturnInfo);
  396. if (ccp.ReturnInfo.Equals("保存成功!"))
  397. {
  398. QuerySinglePlan();
  399. }
  400. }
  401. }
  402. /// <summary>
  403. /// 修改
  404. /// </summary>
  405. private void DoUpdate()
  406. {
  407. ultraGridWoId.UpdateData();
  408. UltraGridRow uRow = this.ultraGridWoId.ActiveRow;
  409. if (uRow == null)
  410. {
  411. MessageUtil.ShowTips("无工单信息,不允许此操作!");
  412. }
  413. UltraGridRow row = this.ultraGrid1.ActiveRow;
  414. if (row == null) { MessageUtil.ShowTips("无委外数据!"); return; }
  415. ArrayList list1 = new ArrayList();
  416. int UpdaCount = 0;
  417. foreach (UltraGridRow ugr in ultraGrid1.Rows)
  418. {
  419. if (Convert.ToBoolean(ugr.Cells["CHECK"].Text) == true)
  420. {
  421. UpdaCount += 1;
  422. ArrayList list = new ArrayList();
  423. if (row.Cells["OfflineNum"].Text.ToString() != "")
  424. {
  425. //if (int.Parse(numQualified.Value.ToString()) > int.Parse(row.Cells["OfflineNum"].Value.ToString()))
  426. //{
  427. // MessageUtil.ShowTips("委外回报个数不能大于离线个数!");
  428. // return;
  429. //}
  430. }
  431. list.Add(ugr.Cells["ResultNo"].Text.ToString());
  432. list.Add(ugr.Cells["WoId"].Text.ToString());
  433. list.Add(ugr.Cells["ZyPlanId"].Text.ToString());
  434. list.Add(ugr.Cells["ProNum"].Text.Trim().ToString());
  435. list.Add(ugr.Cells["ProShift"].Value.ToString());
  436. list.Add(ugr.Cells["ProGroup"].Value.ToString());
  437. list.Add(ugr.Cells["StationCode"].Text.ToString());
  438. list.Add(ugr.Cells["StationDesc"].Text.ToString());
  439. list1.Add(list);
  440. }
  441. }
  442. //double PlnCount = 0;//计划个数
  443. //double CutCount = 0;//实际个数
  444. //DataTable dt = ServerHelper.GetData("com.steering.mes.mcp.coup.PhosphateResultService.queryPlanJg", new Object[] { uRow.Cells["ZY_PLAN_ID"].Text.ToString() }, ob);
  445. //if (dt.Rows.Count > 0)
  446. //{
  447. // PlnCount = Double.Parse(dt.Rows[0]["PLAN_LATHE_NUM"].ToString());
  448. // CutCount = Double.Parse(dt.Rows[0]["LATHE_OK_NUM"].ToString());
  449. //}
  450. // + Double.Parse(numQualified.Value.ToString())
  451. //if (CutCount > PlnCount)
  452. //{
  453. // if (MessageUtil.ShowYesNoAndQuestion("实际车丝个数超过计划车丝个数是否结炉!") == DialogResult.Yes) { return; }
  454. //}
  455. if (UpdaCount == 0) { MessageUtil.ShowTips("请选择委外实绩数据!"); return; }
  456. if (MessageUtil.ShowYesNoAndQuestion("是否修改委外实绩记录?") == DialogResult.No)
  457. {
  458. return;
  459. }
  460. CoreClientParam ccp = new CoreClientParam();
  461. try
  462. {
  463. this.Cursor = Cursors.WaitCursor; //控制鼠标的样式为等待
  464. if (Constant.WaitingForm == null)
  465. {
  466. Constant.WaitingForm = new WaitingForm();
  467. }
  468. Constant.WaitingForm.ShowToUser = true;
  469. Constant.WaitingForm.Show();
  470. Constant.WaitingForm.Update();
  471. ccp.ServerName = "com.steering.mes.mcp.coup.FrmOutSourPerfor";
  472. ccp.MethodName = "updateThreadingResult";
  473. ccp.ServerParams = new object[] { list1, uRow.Cells["WO_ID"].Text.ToString() };
  474. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  475. this.Cursor = Cursors.Default;
  476. Constant.WaitingForm.ShowToUser = false;
  477. Constant.WaitingForm.Close();
  478. Constant.WaitingForm = null;
  479. }
  480. catch (Exception ex)
  481. {
  482. this.Cursor = Cursors.Default;
  483. Constant.WaitingForm.ShowToUser = false;
  484. Constant.WaitingForm.Close();
  485. Constant.WaitingForm = null;
  486. }
  487. if (ccp.ReturnCode == -1) return;
  488. MessageUtil.ShowTips(ccp.ReturnInfo);
  489. if (ccp.ReturnInfo.Equals("修改成功!"))
  490. {
  491. QuerySinglePlan();
  492. }
  493. }
  494. /// <summary>
  495. /// 删除
  496. /// </summary>
  497. private void DoDelete()
  498. {
  499. ultraGridWoId.UpdateData();
  500. UltraGridRow uRow = this.ultraGridWoId.ActiveRow;
  501. if (uRow == null)
  502. {
  503. MessageUtil.ShowTips("无工单信息,不允许此操作!");
  504. }
  505. UltraGridRow row = this.ultraGrid1.ActiveRow;
  506. if (row == null) { MessageUtil.ShowTips("无委外实绩数据!"); return; }
  507. ArrayList list1 = new ArrayList();
  508. int UpdaCount = 0;
  509. foreach (UltraGridRow ugr in ultraGrid1.Rows)
  510. {
  511. if (Convert.ToBoolean(ugr.Cells["CHECK"].Text) == true)
  512. {
  513. UpdaCount += 1;
  514. ArrayList list = new ArrayList();
  515. list.Add(ugr.Cells["ResultNo"].Text.ToString());
  516. list.Add(ugr.Cells["WoId"].Text.ToString());
  517. list.Add(ugr.Cells["ZyPlanId"].Text.ToString());
  518. list.Add(ugr.Cells["StationCode"].Text.ToString());
  519. list.Add(ugr.Cells["StationDesc"].Text.ToString());
  520. list1.Add(list);
  521. }
  522. }
  523. if (UpdaCount == 0) { MessageUtil.ShowTips("请选择委外实绩数据!"); return; }
  524. if (MessageUtil.ShowYesNoAndQuestion("是否删除委外实绩记录?") == DialogResult.No)
  525. {
  526. return;
  527. }
  528. CoreClientParam ccp = new CoreClientParam();
  529. try
  530. {
  531. this.Cursor = Cursors.WaitCursor; //控制鼠标的样式为等待
  532. if (Constant.WaitingForm == null)
  533. {
  534. Constant.WaitingForm = new WaitingForm();
  535. }
  536. Constant.WaitingForm.ShowToUser = true;
  537. Constant.WaitingForm.Show();
  538. Constant.WaitingForm.Update();
  539. ccp.ServerName = "com.steering.mes.mcp.coup.FrmOutSourPerfor";
  540. ccp.MethodName = "deleteThreadingResult";
  541. ccp.ServerParams = new object[] { list1, uRow.Cells["WO_ID"].Text.ToString() };
  542. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  543. this.Cursor = Cursors.Default;
  544. Constant.WaitingForm.ShowToUser = false;
  545. Constant.WaitingForm.Close();
  546. Constant.WaitingForm = null;
  547. }
  548. catch (Exception ex)
  549. {
  550. this.Cursor = Cursors.Default;
  551. Constant.WaitingForm.ShowToUser = false;
  552. Constant.WaitingForm.Close();
  553. Constant.WaitingForm = null;
  554. }
  555. if (ccp.ReturnCode == -1) return;
  556. MessageUtil.ShowTips(ccp.ReturnInfo);
  557. if (ccp.ReturnInfo.Equals("删除成功!"))
  558. {
  559. QuerySinglePlan();
  560. }
  561. }
  562. private void ultraGridWoId_AfterRowActivate(object sender, EventArgs e)
  563. {
  564. UltraGridRow row = ultraGridWoId.ActiveRow;
  565. if (row == null) return;
  566. string zYgNo = row.Cells["ZY_PLAN_ID"].Value.ToString();
  567. string woId = row.Cells["WO_ID"].Value.ToString();
  568. string plNo = row.Cells["PLINE_CODE"].Value.ToString();
  569. this.getCoupProcessPlan(zYgNo, woId);
  570. getCoupThreadingResult(zYgNo, woId);
  571. }
  572. /// <summary>
  573. /// 委外工序实绩查询
  574. /// </summary>
  575. /// <param name="planNo"></param>
  576. private void getCoupThreadingResult(string planNo,string woId)
  577. {
  578. List<CouplingComInfoEntity> listSource = EntityHelper.GetData<CouplingComInfoEntity>
  579. ("com.steering.mes.mcp.coup.FrmOutSourPerfor.doQueryLoadResult", new object[] { planNo, woId }, this.ob);
  580. CouplingComInfoEntitSource.DataSource = listSource;
  581. }
  582. /// <summary>
  583. /// 接箍加工计划详情
  584. /// </summary>
  585. /// <param name="planNo"></param>
  586. private void getCoupProcessPlan(string planNO, string woId)
  587. {
  588. DataTable dt = ServerHelper.GetData("com.steering.mes.mcp.common.PlanService.getQueryWoIdDetails", new object[] { woId, planNO }, this.ob);
  589. if (dt != null && dt.Rows.Count > 0)
  590. {
  591. this.coupWoIdPlanControl1.Value.PlineName = dt.Rows[0]["PLINE_NAME"].ToString();
  592. this.coupWoIdPlanControl1.Value.CutMachGrpNm = dt.Rows[0]["CUT_MACH_GRP_NM"].ToString();
  593. this.coupWoIdPlanControl1.Value.Memo = dt.Rows[0]["MEMO"].ToString();
  594. this.coupWoIdPlanControl1.Value.ZyPlanId = dt.Rows[0]["ZY_PLAN_ID"].ToString();
  595. this.coupWoIdPlanControl1.Value.IfMonitorJg = dt.Rows[0]["IF_MONITOR_JG"].ToString();
  596. this.coupWoIdPlanControl1.Value.LoadPieces = dt.Rows[0]["LOAD_PIECES"].ToString();
  597. this.coupWoIdPlanControl1.Value.LoadWeight = dt.Rows[0]["LOAD_WEIGHT"].ToString();
  598. this.coupWoIdPlanControl1.Value.ProPlanId = dt.Rows[0]["PRO_PLAN_ID"].ToString();
  599. this.coupWoIdPlanControl1.Value.Steelname = dt.Rows[0]["STEELNAME"].ToString();
  600. this.coupWoIdPlanControl1.Value.Gradename = dt.Rows[0]["GRADENAME"].ToString();
  601. this.coupWoIdPlanControl1.Value.JglDesc = dt.Rows[0]["JGL_DESC"].ToString();
  602. this.coupWoIdPlanControl1.Value.CodeJg = dt.Rows[0]["CODE_JG"].ToString();
  603. this.coupWoIdPlanControl1.Value.ModelDesc = dt.Rows[0]["MODEL_DESC"].ToString();
  604. this.coupWoIdPlanControl1.Value.SpecJgDesc = dt.Rows[0]["SPEC_JG_DESC"].ToString();
  605. this.coupWoIdPlanControl1.Value.StyleJg = dt.Rows[0]["STYLE_JG"].ToString();
  606. this.coupWoIdPlanControl1.Value.PlanJgNum = dt.Rows[0]["PLAN_JG_NUM"].ToString();
  607. this.coupWoIdPlanControl1.Value.CsJgNum = dt.Rows[0]["CS_JG_NUM"].ToString();
  608. this.coupWoIdPlanControl1.Value.XqJgNum = dt.Rows[0]["XQ_JG_NUM"].ToString();
  609. this.coupWoIdPlanControl1.Value.InstoreNum = dt.Rows[0]["INSTORE_NUM"].ToString();
  610. this.coupWoIdPlanControl1.Value.BlWlDesc = dt.Rows[0]["BL_WL_DESC"].ToString();
  611. //this.coupWoIdPlanControl1.Value.LoadWeight = "";
  612. this.coupWoIdPlanControl1.UpdateData();
  613. if (dt.Rows[0]["IF_ALL_OUT_WORK"].ToString().Equals("是"))
  614. {
  615. cmbGx.Items.Clear();
  616. cmbGx.Items.Add("");
  617. cmbGx.Items.Add("锯切");
  618. if (dt.Rows[0]["IF_NEED_CJG"].ToString().Equals("是"))
  619. {
  620. cmbGx.Items.Add("粗加工");
  621. }
  622. if (dt.Rows[0]["IF_IMPRESS"].ToString().Equals("是"))
  623. {
  624. cmbGx.Items.Add("压印");
  625. }
  626. cmbGx.Items.Add("车丝");
  627. if (dt.Rows[0]["IF_BLAST"].ToString().Equals("是"))
  628. {
  629. cmbGx.Items.Add("喷砂");
  630. }
  631. if (dt.Rows[0]["COAT_TYPE"].ToString().Equals("镀铜"))
  632. {
  633. if (dt.Rows[0]["IF_PLATE_CU"].ToString().Equals("是"))
  634. {
  635. cmbGx.Items.Add("镀铜");
  636. }
  637. }
  638. else if (dt.Rows[0]["COAT_TYPE"].ToString().Equals("磷化"))
  639. {
  640. if (dt.Rows[0]["IF_PHOSPHATING"].ToString().Equals("是"))
  641. {
  642. cmbGx.Items.Add("磷化");
  643. }
  644. }
  645. cmbGx.Items.Add("喷标");
  646. cmbGx.Items.Add("螺纹检验");
  647. cmbGx.Items.Add("探伤");
  648. }
  649. else
  650. {
  651. cmbGx.Items.Clear();
  652. cmbGx.Items.Add("");
  653. if (dt.Rows[0]["IF_OUT_CUT"].ToString().Equals("是"))
  654. {
  655. cmbGx.Items.Add("锯切");
  656. }
  657. if (dt.Rows[0]["IF_NEED_CJG"].ToString().Equals("是"))
  658. {
  659. if (dt.Rows[0]["IF_OUT_CJG"].ToString().Equals("是"))
  660. {
  661. cmbGx.Items.Add("粗加工");
  662. }
  663. }
  664. if (dt.Rows[0]["IF_IMPRESS"].ToString().Equals("是"))
  665. {
  666. if (dt.Rows[0]["IF_OUT_IMPRESS"].ToString().Equals("是"))
  667. {
  668. cmbGx.Items.Add("压印");
  669. }
  670. }
  671. if (dt.Rows[0]["IF_OUT_LATHE"].ToString().Equals("是"))
  672. {
  673. cmbGx.Items.Add("车丝");
  674. }
  675. if (dt.Rows[0]["IF_BLAST"].ToString().Equals("是"))
  676. {
  677. if (dt.Rows[0]["IF_OUT_BLAST"].ToString().Equals("是"))
  678. {
  679. cmbGx.Items.Add("喷砂");
  680. }
  681. }
  682. if (dt.Rows[0]["COAT_TYPE"].ToString().Equals("镀铜"))
  683. {
  684. if (dt.Rows[0]["IF_PLATE_CU"].ToString().Equals("是"))
  685. {
  686. if (dt.Rows[0]["IF_OUT_COAT"].ToString().Equals("是"))
  687. {
  688. cmbGx.Items.Add("镀铜");
  689. }
  690. }
  691. }
  692. else if (dt.Rows[0]["COAT_TYPE"].ToString().Equals("磷化"))
  693. {
  694. if (dt.Rows[0]["IF_PHOSPHATING"].ToString().Equals("是"))
  695. {
  696. if (dt.Rows[0]["IF_OUT_COAT"].ToString().Equals("是"))
  697. {
  698. cmbGx.Items.Add("磷化");
  699. }
  700. }
  701. }
  702. if (dt.Rows[0]["IF_OUT_COPPER"].ToString().Equals("是"))
  703. {
  704. cmbGx.Items.Add("喷标");
  705. }
  706. if (dt.Rows[0]["IF_OUT_THREAD"].ToString().Equals("是"))
  707. {
  708. cmbGx.Items.Add("螺纹检验");
  709. }
  710. if (dt.Rows[0]["IF_OUT_DETECT"].ToString().Equals("是"))
  711. {
  712. cmbGx.Items.Add("探伤");
  713. }
  714. }
  715. PipeManageClass.SetComboItemHeight(cmbGx);
  716. }
  717. }
  718. private void DoRemove()
  719. {
  720. numQualified.Value = "0";
  721. // cmbGx.v =;
  722. txtBC.Value = this.UserInfo.GetUserOrder();
  723. txtBz.Value = this.UserInfo.GetUserGroup();
  724. }
  725. private void ultraGrid1_AfterSelectChange(object sender, AfterSelectChangeEventArgs e)
  726. {
  727. try
  728. {
  729. ultraGrid1.UpdateData();
  730. foreach (UltraGridRow row in ultraGridWoId.Rows)
  731. {
  732. row.Cells["CHECK"].Value = row.Selected;
  733. }
  734. }
  735. catch { }
  736. }
  737. private void chkStarts_CheckedChanged(object sender, EventArgs e)
  738. {
  739. if (chkStarts.Checked) { cmbStarts.Enabled = true; } else { cmbStarts.Enabled = false; }
  740. if (chkJuNo.Checked) { txtJudgeStoveNO.Enabled = true; } else { txtJudgeStoveNO.Enabled = false; }
  741. if (chkPlnNo.Checked) { txtPlnNo.Enabled = true; } else { txtPlnNo.Enabled = false; }
  742. if (chkwoId.Checked) { txtWoId.Enabled = true; } else { txtWoId.Enabled = false; }
  743. }
  744. private void ContPublic_KeyDown(object sender, KeyEventArgs e)
  745. {
  746. if (e.KeyCode == Keys.Enter)
  747. {
  748. QuerySinglePlan();
  749. }
  750. }
  751. private void cmbGx_ValueChanged(object sender, EventArgs e)
  752. {
  753. if (cmbGx.Text.Trim().Equals(""))
  754. {
  755. numQualified.Enabled = false;
  756. }
  757. else
  758. {
  759. numQualified.Enabled = true;
  760. }
  761. }
  762. private void ultraGrid1_CellChange(object sender, CellEventArgs e)
  763. {
  764. if (e.Cell.Column.Key.Equals("ProNum"))
  765. {
  766. if (e.Cell.Row.Cells["ProNum"].Value == null)
  767. {
  768. e.Cell.Row.Cells["ProNum"].Value = "0";
  769. }
  770. else
  771. {
  772. ultraGrid1.UpdateData();
  773. string ProNum = e.Cell.Row.Cells["ProNum"].Value.ToString();
  774. if (!StringUtil.IsInt(ProNum) || ProNum == "0")
  775. {
  776. e.Cell.Row.Cells["ProNum"].Value = "0";
  777. }
  778. }
  779. }
  780. }
  781. }
  782. }