BackLineOperate.cs 39 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996
  1. using com.steering.mes.zgmil.entity;
  2. using Core.Mes.Client.Comm.Control;
  3. using Core.Mes.Client.Comm.Server;
  4. using Core.StlMes.Client.ZGMil.Entity;
  5. using CoreFS.CA06;
  6. using Infragistics.Win.UltraWinGrid;
  7. using System;
  8. using System.Collections;
  9. using System.Collections.Generic;
  10. using System.ComponentModel;
  11. using System.Data;
  12. using System.Drawing;
  13. using System.Linq;
  14. using System.Text;
  15. using System.Windows.Forms;
  16. namespace Core.StlMes.Client.ZGMil.NodeResultQuery
  17. {
  18. public partial class BackLineOperate : FrmBase
  19. {
  20. private OpeBase ob;
  21. public OpeBase Ob
  22. {
  23. get { return ob; }
  24. set { ob = value; }
  25. }
  26. //工序状态:01-矫直1#,02-矫直2#,03-矫直3#,11-ET探伤,12-MT探伤,13-UT探伤
  27. private string node = "";
  28. private string test = "";
  29. private string colno = "0";//探伤台号
  30. private int BackLineNumAll = 0;//可下线支数
  31. private int BackLineNum1 = 0;//返线支数
  32. private int BackLineNum2 = 0;
  33. private int BackLineNum3 = 0;
  34. private int BackLineNum = 0;
  35. private int DelNum = 0;//剔除支数
  36. private string PlineCod = "";//产线代码
  37. private string heatno = "";//点击主计划的炉号
  38. private string heatnonew = "";
  39. private string stoveno = "";
  40. private string lotno = "";
  41. private string process = "";//工序
  42. private UltraGridRow ugr = null;
  43. private string labtext = "";
  44. private int backlinenumhas1 = 0;
  45. private int backlinenumhas2 = 0;
  46. private int backlinenumhas3 = 0;
  47. private int backlinenumBack1 = 0;
  48. private int backlinenumBack2 = 0;
  49. private int backlinenumBack3 = 0;
  50. private ArrayList liststraight = new ArrayList();
  51. private ArrayList listtest = new ArrayList();
  52. private ArrayList listqa = new ArrayList();
  53. MilOfflineReslutEntity milofflineresult = new MilOfflineReslutEntity();//下线实绩表实体类
  54. public BackLineOperate()
  55. {
  56. //InitializeComponent();
  57. }
  58. public BackLineOperate(string node, OpeBase _ob, string PlineCode, string stoveno, string lotno)
  59. {
  60. InitializeComponent();
  61. if (node.Length == 2)
  62. {
  63. this.node = node.Substring(0, 1);
  64. this.test = node.Substring(1, 1);
  65. }
  66. if (node.Length == 3)
  67. {
  68. this.node = node.Substring(0, 1);
  69. this.test = node.Substring(1, 1);
  70. this.colno = node.Substring(2, 1);
  71. }
  72. if (this.node.Equals("0"))
  73. {
  74. this.process = "JZ";
  75. }
  76. if (this.node.Equals("1"))
  77. {
  78. this.process = "TS";
  79. }
  80. this.Ob = _ob;
  81. this.PlineCod = PlineCode;
  82. this.stoveno = stoveno;
  83. this.lotno = lotno;
  84. if (this.node.Equals("0"))
  85. {
  86. this.Text = "矫直返线操作";
  87. }
  88. if (this.node.Equals("1"))
  89. {
  90. this.Text = "探伤返线操作";
  91. }
  92. if (this.PlineCod.Equals("C010"))
  93. {
  94. this.ultraLabel6.Visible = true;
  95. this.TxtBacklinNum3.Visible = true;
  96. this.TxtBacklinNum3.Enabled = true;
  97. this.TxtBacklinNum3.Text = "0";
  98. this.ultraLabel7.Visible = true;
  99. this.TxtBacklinNumHas3.Visible = true;
  100. this.TxtBacklinNumHas3.Enabled = true;
  101. this.TxtBacklinNumHas3.Text = "0";
  102. this.ultraLabel10.Visible = true;
  103. this.TxtBacklinNumBack3.Visible = true;
  104. this.TxtBacklinNumBack3.Enabled = true;
  105. this.TxtBacklinNumBack3.Text = "0";
  106. }
  107. else
  108. {
  109. this.ultraLabel6.Visible = false;
  110. this.TxtBacklinNum3.Visible = false;
  111. this.TxtBacklinNum3.Enabled = false;
  112. this.TxtBacklinNum3.Text = "0";
  113. this.ultraLabel7.Visible = false;
  114. this.TxtBacklinNumHas3.Visible = false;
  115. this.TxtBacklinNumHas3.Enabled = false;
  116. this.TxtBacklinNumHas3.Text = "0";
  117. this.ultraLabel10.Visible = false;
  118. this.TxtBacklinNumBack3.Visible = false;
  119. this.TxtBacklinNumBack3.Enabled = false;
  120. this.TxtBacklinNumBack3.Text = "0";
  121. }
  122. foreach (UltraGridColumn ugc in ultraRack.DisplayLayout.Bands[0].Columns)
  123. {
  124. ugc.CellActivation = Infragistics.Win.UltraWinGrid.Activation.ActivateOnly;
  125. }
  126. Query();
  127. }
  128. /// <summary>
  129. /// 查询主表
  130. /// </summary>
  131. private void Query()
  132. {
  133. DataTable dt = ServerHelper.GetData("com.steering.mes.zgmil.coup.FrmBackLine.GetOfflineResult", new object[] { node }, this.ob);
  134. if (dt.Rows.Count > 0)
  135. {
  136. GridHelper.CopyDataToDatatable(dt, dtPlan, true);
  137. }
  138. else
  139. {
  140. dtPlan.Rows.Clear();
  141. MessageBox.Show("未查询到可返线实绩", "提示:", MessageBoxButtons.OK,MessageBoxIcon.Warning);
  142. this.TxtHeatNo.Text = "";
  143. this.TxtHeatNo.Enabled = false;
  144. this.TxtTotalNum.Text = "0";
  145. this.TxtTotalNum.Enabled = false;
  146. this.TxtBackLineNumhas.Text = "0";
  147. this.TxtBackLineNumhas.Enabled = false;
  148. this.TxtBacklinNum1.Text = "0";
  149. this.TxtBacklinNum2.Text = "0";
  150. this.TxtBacklinNum3.Text = "0";
  151. this.TxtBacklinNumHas1.Text = "0";
  152. this.TxtBacklinNumHas1.Enabled = false;
  153. this.TxtBacklinNumHas2.Text = "0";
  154. this.TxtBacklinNumHas2.Enabled = false;
  155. this.TxtBacklinNumHas3.Text = "0";
  156. this.TxtBacklinNumHas3.Enabled = false;
  157. this.TxtBacklinNumBack1.Text = "0";
  158. this.TxtBacklinNumBack2.Text = "0";
  159. this.TxtBacklinNumBack3.Text = "0";
  160. //this.Dispose();
  161. //this.Close();
  162. }
  163. }
  164. /// <summary>
  165. /// 表格单击事件
  166. /// </summary>
  167. /// <param name="sender"></param>
  168. /// <param name="e"></param>
  169. private void ultraRack_AfterRowActivate(object sender, EventArgs e)
  170. {
  171. #region 原返线代码(废)
  172. //DataTable dt1 = ServerHelper.GetData("com.steering.mes.zgmil.coup.FrmOffLine.GetDelNum", new object[] { heatno, node }, this.ob);
  173. //if (dt1.Rows.Count > 0)
  174. //{
  175. // DelNum = int.Parse(dt1.Rows[0]["counts"].ToString());
  176. //}
  177. //else
  178. //{
  179. // DelNum = 0;
  180. //}
  181. //heatno = ugr.Cells["JUDGE_STOVE_NO"].Value.ToString();
  182. //if (test.Equals("1") || colno.Equals("1"))
  183. //{
  184. // if (!string.IsNullOrEmpty(ugr.Cells["OFFLINE_NUM1"].Value.ToString()))
  185. // {
  186. // BackLineNumAll = int.Parse(ugr.Cells["OFFLINE_NUM1"].Value.ToString());
  187. // }
  188. // else
  189. // {
  190. // BackLineNumAll = 0;
  191. // MessageBox.Show("炉号:【" + heatno + "】1#台下线支数为空,不允许返线", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  192. // }
  193. // if (!string.IsNullOrEmpty(ugr.Cells["BACKLINE_NUM1"].Value.ToString()))
  194. // {
  195. // BackLineNum = int.Parse(ugr.Cells["BACKLINE_NUM1"].Value.ToString());
  196. // BackLineNumAll = BackLineNumAll - BackLineNum;
  197. // }
  198. // else
  199. // {
  200. // BackLineNumAll = BackLineNumAll - 0;
  201. // }
  202. //}
  203. //if (test.Equals("2") || colno.Equals("2"))
  204. //{
  205. // if (!string.IsNullOrEmpty(ugr.Cells["OFFLINE_NUM2"].Value.ToString()))
  206. // {
  207. // BackLineNumAll = int.Parse(ugr.Cells["OFFLINE_NUM2"].Value.ToString());
  208. // }
  209. // else
  210. // {
  211. // BackLineNumAll = 0;
  212. // MessageBox.Show("炉号:【" + heatno + "】2#台下线支数为空,不允许返线", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  213. // }
  214. // if (!string.IsNullOrEmpty(ugr.Cells["BACKLINE_NUM2"].Value.ToString()))
  215. // {
  216. // BackLineNum = int.Parse(ugr.Cells["BACKLINE_NUM2"].Value.ToString());
  217. // BackLineNumAll = BackLineNumAll - BackLineNum;
  218. // }
  219. // else
  220. // {
  221. // BackLineNumAll = BackLineNumAll - 0;
  222. // }
  223. //}
  224. //if (test.Equals("3") || colno.Equals("3"))
  225. //{
  226. // if (!string.IsNullOrEmpty(ugr.Cells["OFFLINE_NUM3"].Value.ToString()))
  227. // {
  228. // BackLineNumAll = int.Parse(ugr.Cells["OFFLINE_NUM3"].Value.ToString());
  229. // }
  230. // else
  231. // {
  232. // BackLineNumAll = 0;
  233. // MessageBox.Show("炉号:【" + heatno + "】3#台下线支数为空,不允许返线", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  234. // }
  235. // if (!string.IsNullOrEmpty(ugr.Cells["BACKLINE_NUM3"].Value.ToString()))
  236. // {
  237. // BackLineNum = int.Parse(ugr.Cells["BACKLINE_NUM3"].Value.ToString());
  238. // BackLineNumAll = BackLineNumAll - BackLineNum;
  239. // }
  240. // else
  241. // {
  242. // BackLineNumAll = BackLineNumAll - 0;
  243. // }
  244. //}
  245. #endregion
  246. ugr = this.ultraRack.ActiveRow;
  247. if (!string.IsNullOrEmpty(ugr.Cells["OFFLINE_NUM"].Value.ToString()))
  248. {
  249. BackLineNumAll = Convert.ToInt16(ugr.Cells["OFFLINE_NUM"].Value.ToString());
  250. }
  251. else
  252. {
  253. BackLineNumAll = 0;
  254. }
  255. if (!string.IsNullOrEmpty(ugr.Cells["BACKLINE_NUM1"].Value.ToString()))
  256. {
  257. backlinenumhas1 = Convert.ToInt16(ugr.Cells["BACKLINE_NUM1"].Value.ToString());
  258. this.TxtBacklinNumHas1.Enabled = false;
  259. this.TxtBacklinNumHas1.Text = backlinenumhas1.ToString();
  260. }
  261. else
  262. {
  263. backlinenumhas1 = 0;
  264. this.TxtBacklinNumHas1.Enabled = false;
  265. this.TxtBacklinNumHas1.Text = backlinenumhas1.ToString();
  266. }
  267. if (!string.IsNullOrEmpty(ugr.Cells["BACKLINE_NUM2"].Value.ToString()))
  268. {
  269. backlinenumhas2 = Convert.ToInt16(ugr.Cells["BACKLINE_NUM2"].Value.ToString());
  270. this.TxtBacklinNumHas2.Enabled = false;
  271. this.TxtBacklinNumHas2.Text = backlinenumhas2.ToString();
  272. }
  273. else
  274. {
  275. backlinenumhas2 = 0;
  276. this.TxtBacklinNumHas2.Enabled = false;
  277. this.TxtBacklinNumHas2.Text = backlinenumhas2.ToString();
  278. }
  279. if (PlineCod.Equals("C010"))
  280. {
  281. if (!string.IsNullOrEmpty(ugr.Cells["BACKLINE_NUM3"].Value.ToString()))
  282. {
  283. backlinenumhas3 = Convert.ToInt16(ugr.Cells["BACKLINE_NUM3"].Value.ToString());
  284. this.TxtBacklinNumHas3.Visible = true;
  285. this.TxtBacklinNumHas3.Enabled = false;
  286. this.TxtBacklinNumHas3.Text = backlinenumhas3.ToString();
  287. }
  288. }
  289. else
  290. {
  291. backlinenumhas3 = 0;
  292. this.TxtBacklinNumHas3.Visible = false;
  293. this.TxtBacklinNumHas3.Enabled = false;
  294. this.TxtBacklinNumHas3.Text = backlinenumhas3.ToString();
  295. }
  296. BackLineNumAll = BackLineNumAll - backlinenumhas1 - backlinenumhas2 - backlinenumhas3;
  297. heatno = ugr.Cells["JUDGE_STOVE_NO"].Value.ToString();
  298. this.TxtHeatNo.Text = heatno.Substring(0,6);
  299. this.TxtHeatNo.Enabled = false;
  300. this.TxtTotalNum.Text = BackLineNumAll.ToString();
  301. this.TxtTotalNum.Enabled = false;
  302. this.TxtBackLineNumhas.Text = (backlinenumhas1 + backlinenumhas2 + backlinenumhas3).ToString();
  303. this.TxtBackLineNumhas.Enabled = false;
  304. #region 废代码
  305. //DataTable dthas = ServerHelper.GetData("com.steering.mes.zgmil.coup.FrmBackLine.GetCountHAS", new object[] { heatno, node,test,colno }, this.ob);
  306. //if (dthas.Rows.Count > 0)
  307. //{
  308. // this.TxtBackLineNumhas.Text = dthas.Rows[0]["counts"].ToString();
  309. // this.TxtBackLineNumhas.Enabled = false;
  310. //}
  311. //else
  312. //{
  313. // this.TxtBackLineNumhas.Text = "0";
  314. // this.TxtBackLineNumhas.Enabled = false;
  315. //}
  316. #endregion
  317. }
  318. public T ChangeEntity<T>(T t, string str, string value)
  319. {
  320. string heatno = "";
  321. System.Reflection.PropertyInfo[] pro = t.GetType().GetProperties();
  322. foreach (System.Reflection.PropertyInfo item in pro)
  323. {
  324. if (string.Compare(item.Name.ToString(), str, true) == 0)
  325. {
  326. if (str.Equals("judgeStoveNo"))
  327. {
  328. heatno = item.GetValue(t, null).ToString();
  329. heatno = heatno.Substring(0, 7) + (Convert.ToInt16(heatno.Substring(heatno.Length - 2, 2)) + 1).ToString();
  330. value = heatno;
  331. }
  332. item.SetValue(t, value, null);
  333. }
  334. }
  335. return t;
  336. }
  337. /// <summary>
  338. /// 修改炉号,炉号后缀加一
  339. /// </summary>
  340. /// <param name="heatno"></param>
  341. /// <returns></returns>
  342. public string Changheatno(string heatno)//待改
  343. {
  344. string strbefor = "";
  345. string strafter = "";
  346. strbefor = heatno.Substring(0, 7);
  347. strafter = (Convert.ToInt16(heatno.Substring(heatno.Length - 2, 2)) + 1).ToString();
  348. if (strafter.Length == 1)
  349. {
  350. strafter = "0" + strafter;
  351. }
  352. return strbefor + strafter;
  353. }
  354. /// <summary>
  355. /// 返回对应炉探伤管号队列
  356. /// </summary>
  357. /// <param name="num"></param>
  358. /// <param name="heatno"></param>
  359. /// <param name="testcolno"></param>
  360. /// <returns></returns>
  361. public ArrayList SetTestRack(int num1, int num2, int num3)
  362. {
  363. int numhas = 0;
  364. int num = num1 + num2 + num3;
  365. DataTable dt3 = ServerHelper.GetData("com.steering.mes.zgmil.coup.FrmBackLine.GetBackRack", new object[] { this.heatno, "1", "", "", num }, this.ob);
  366. ArrayList list = new ArrayList();
  367. for (int i = 0; i < dt3.Rows.Count; i++)
  368. {
  369. MilTestingRackEntity testrack = new MilTestingRackEntity();
  370. testrack = NativeMethod.GetTableToEntity(dt3, testrack, i);
  371. testrack.JudgeStoveNo = this.heatnonew;
  372. if (isInsert("3", this.test, heatnonew) == -1)
  373. {
  374. numhas = 0;
  375. }
  376. else
  377. {
  378. numhas=isInsert("3", this.test, heatnonew);
  379. }
  380. testrack.Seq = i + 1 + numhas;
  381. if (i < num1)
  382. {
  383. testrack.ColNo = "1";
  384. }
  385. else if (i < (num1 + num2))
  386. {
  387. testrack.ColNo = "2";
  388. }
  389. else if (i < (num1 + num2 + num3))
  390. {
  391. testrack.ColNo = "3";
  392. }
  393. list.Add(testrack);
  394. }
  395. #region
  396. //for (int i = 0; i < num; i++)
  397. //{
  398. // MilTestingRackEntity testrack = new MilTestingRackEntity();
  399. // testrack.JudgeStoveNo = heatno;
  400. // testrack.StoveNo = this.stoveno;
  401. // testrack.LotNo = this.lotno;
  402. // testrack.PlineCode = this.PlineCod;
  403. // testrack.ColMode = "0";
  404. // testrack.Seq = i + 1;
  405. // if (i < num1)
  406. // {
  407. // testrack.ColNo = "1";
  408. // }
  409. // else if (i < (num1 + num2))
  410. // {
  411. // testrack.ColNo = "2";
  412. // }
  413. // else if (i < (num1 + num2 + num3))
  414. // {
  415. // testrack.ColNo = "3";
  416. // }
  417. // list.Add(testrack);
  418. //}
  419. #endregion
  420. return list;
  421. }
  422. /// <summary>
  423. /// 返回对应炉矫直管号队列
  424. /// </summary>
  425. /// <param name="num1"></param>
  426. /// <param name="num2"></param>
  427. /// <param name="num3"></param>
  428. /// <param name="heatno"></param>
  429. /// <returns></returns>
  430. public ArrayList SetStraightRack(int num1, int num2, int num3)
  431. {
  432. int numhas = 0;
  433. int num = num1 + num2 + num3;
  434. DataTable dt3 = ServerHelper.GetData("com.steering.mes.zgmil.coup.FrmBackLine.GetBackRack", new object[] { this.heatno, "0", "", "", num }, this.ob);
  435. ArrayList list = new ArrayList();
  436. if (dt3.Rows.Count > 0)
  437. {
  438. for (int i = 0; i < dt3.Rows.Count; i++)
  439. {
  440. MilStraighRackEntity milstraight = new MilStraighRackEntity();
  441. milstraight = NativeMethod.GetTableToEntity(dt3, milstraight, i);
  442. milstraight.JudgeStoveNo = this.heatnonew;
  443. if (isInsert("3", this.test, heatnonew) == -1)
  444. {
  445. numhas = 0;
  446. }
  447. else
  448. {
  449. numhas = isInsert("3", this.test, heatnonew);
  450. }
  451. milstraight.Seq = i + 1 + numhas;
  452. if (i < num1)
  453. {
  454. milstraight.ColNo = "1";
  455. }
  456. else if (i < (num1 + num2))
  457. {
  458. milstraight.ColNo = "2";
  459. }
  460. else if (i < (num1 + num2 + num3))
  461. {
  462. milstraight.ColNo = "3";
  463. }
  464. if (this.node.Equals("0"))
  465. {
  466. milstraight.EndStraighteningTime = "";
  467. }
  468. if (this.node.Equals("1"))
  469. {
  470. milstraight.EndStraighteningTime = System.DateTime.Now.ToString();
  471. milstraight.ColGroup = UserInfo.GetUserGroup();
  472. milstraight.ColShift = UserInfo.GetUserOrder();
  473. //milstraight.ColUser = UserInfo.GetUserName();
  474. }
  475. list.Add(milstraight);
  476. }
  477. }
  478. else
  479. {
  480. for (int i = 0; i < num; i++)
  481. {
  482. MilStraighRackEntity milstraight = new MilStraighRackEntity();
  483. milstraight.JudgeStoveNo = heatnonew;
  484. milstraight.StoveNo = this.stoveno;
  485. milstraight.LotNo = this.lotno;
  486. milstraight.PlineCode = this.PlineCod;
  487. milstraight.ColMode = "0";
  488. if (isInsert("3", this.test, heatnonew) == -1)
  489. {
  490. numhas = 0;
  491. }
  492. else
  493. {
  494. numhas = isInsert("3", this.test, heatnonew);
  495. }
  496. milstraight.Seq = i + 1 + numhas;
  497. if (i < num1)
  498. {
  499. milstraight.ColNo = "1";
  500. }
  501. else if (i < (num1 + num2))
  502. {
  503. milstraight.ColNo = "2";
  504. }
  505. else if (i < (num1 + num2 + num3))
  506. {
  507. milstraight.ColNo = "3";
  508. }
  509. list.Add(milstraight);
  510. }
  511. }
  512. return list;
  513. }
  514. public ArrayList SetQaRack(int num1, int num2, int num3)
  515. {
  516. int numhas = 0;
  517. int num = num1 + num2 + num3;
  518. DataTable dt3 = ServerHelper.GetData("com.steering.mes.zgmil.coup.FrmBackLine.GetBackRack", new object[] { this.heatno, "2", "", "", num }, this.ob);
  519. ArrayList list = new ArrayList();
  520. for (int i = 0; i < dt3.Rows.Count; i++)
  521. {
  522. MilQaRackEntity Qa = new MilQaRackEntity();
  523. Qa = NativeMethod.GetTableToEntity(dt3, Qa, i);
  524. Qa.JudgeStoveNo = this.heatnonew;
  525. if (isInsert("3", this.test, heatnonew) == -1)
  526. {
  527. numhas = 0;
  528. }
  529. else
  530. {
  531. numhas = isInsert("3", this.test, heatnonew);
  532. }
  533. Qa.Seq = i + 1 + numhas;
  534. list.Add(Qa);
  535. }
  536. //for (int i = 0; i < num; i++)
  537. //{
  538. // MilQaRackEntity Qa = new MilQaRackEntity();
  539. // Qa.JudgeStoveNo = heatno;
  540. // Qa.StoveNo = this.stoveno;
  541. // Qa.LotNo = this.lotno;
  542. // Qa.PlineCode = this.PlineCod;
  543. // Qa.ColMode = "0";
  544. // Qa.Seq = i + 1;
  545. // list.Add(Qa);
  546. //}
  547. return list;
  548. }
  549. public T GetBackResultToEntity<T>(T t)
  550. {
  551. DataTable dt = ServerHelper.GetData("com.steering.mes.zgmil.coup.FrmBackLine.GetBackResult", new object[] { heatno, node, test }, this.ob);
  552. t = NativeMethod.GetTableToEntity(dt, t);
  553. return t;
  554. }
  555. public T GetBackResultToEntity<T>(T t, string str)
  556. {
  557. DataTable dt = ServerHelper.GetData("com.steering.mes.zgmil.coup.FrmBackLine.GetBackResult", new object[] { heatno, str, test }, this.ob);
  558. t = NativeMethod.GetTableToEntity(dt, t);
  559. return t;
  560. }
  561. public int isInsert(string node, string test, string heatno)
  562. {
  563. int result =-1;
  564. DataTable dt = ServerHelper.GetData("com.steering.mes.zgmil.coup.FrmBackLine.isInsertBack", new object[] {node,test, heatno }, this.ob);
  565. if (dt.Rows.Count > 0)
  566. {
  567. if (node.Equals("3"))
  568. {
  569. if (!string.IsNullOrEmpty(dt.Rows[0]["BRANCH"].ToString()))
  570. {
  571. result = Convert.ToInt16(dt.Rows[0]["BRANCH"].ToString());
  572. }
  573. }
  574. }
  575. return result;
  576. }
  577. /// <summary>
  578. /// 返线操作
  579. /// </summary>
  580. public void Backline()
  581. {
  582. heatnonew = Changheatno(heatno);
  583. if (string.IsNullOrEmpty(heatno) || ultraRack.ActiveRow == null)
  584. {
  585. MessageBox.Show("未选择计划行,不允许进行返线操作", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  586. return;
  587. }
  588. if (!string.IsNullOrEmpty(TxtBacklinNum1.Text.ToString().Replace("_", "")))
  589. {
  590. BackLineNum1 = Convert.ToInt16(this.TxtBacklinNum1.Text.ToString().Replace("_",""));
  591. }
  592. else
  593. {
  594. BackLineNum1 = 0;
  595. }
  596. if (!string.IsNullOrEmpty(TxtBacklinNum2.Text.ToString().Replace("_", "")))
  597. {
  598. BackLineNum2 = Convert.ToInt16(this.TxtBacklinNum2.Text.ToString().Replace("_", ""));
  599. }
  600. else
  601. {
  602. BackLineNum2 = 0;
  603. }
  604. if (!string.IsNullOrEmpty(TxtBacklinNum3.Text.ToString().Replace("_", "")))
  605. {
  606. BackLineNum3 = Convert.ToInt16(this.TxtBacklinNum3.Text.ToString().Replace("_", ""));
  607. }
  608. else
  609. {
  610. BackLineNum3 = 0;
  611. }
  612. BackLineNum = BackLineNum1 + BackLineNum2 + BackLineNum3;
  613. if (BackLineNum == 0)
  614. {
  615. MessageBox.Show("您未输入返线支数,或所有台子输入的返线支数均为0", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  616. return;
  617. }
  618. if (BackLineNum - BackLineNumAll > 0)
  619. {
  620. MessageBox.Show("输入的返线支数超过了可返线支数,请重新输入", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  621. return;
  622. }
  623. //1.修改下线实绩,2.修改主表下线状态3,修改对应实绩表返线支数4,,修改对应跟踪记录表下线状态
  624. //int count = ServerHelper.SetData("com.steering.mes.zgmil.coup.FrmBackLine.BackLine", new object[] { heatno, node, test, int.Parse(TxtBacklinNum.Text.ToString()),BackLineNumAll,DelNum,colno }, this.ob);
  625. //1.新增下线计划,2.新增管号队列,4.插入实绩表3.修改原管号队列4.修改下线实绩
  626. MilPlanEntity plan = new MilPlanEntity();
  627. DataTable dt1 = ServerHelper.GetData("com.steering.mes.zgmil.coup.FrmBackLine.GetBackPlan", new object[] { heatno }, this.ob);
  628. plan = NativeMethod.GetTableToEntity(dt1, plan);
  629. plan.JudgeStoveNo = heatnonew;
  630. plan.Branch = BackLineNum.ToString();
  631. if (node.Equals("0"))
  632. {
  633. plan.Status = "75";
  634. plan.NodeStatus = "70";
  635. plan.BackPlanFlag = "7";
  636. }
  637. if (node.Equals("1"))
  638. {
  639. plan.Status = "85";
  640. plan.NodeStatus = "80";
  641. plan.BackPlanFlag = "8";
  642. }
  643. DataTable dttime = ServerHelper.GetData("com.steering.mes.zgmil.coup.FrmBackLine.GetEndPlan", new object[] { node, PlineCod }, this.ob);
  644. if (dttime.Rows.Count > 0)
  645. {
  646. DateTime dt;
  647. DateTime dtfeed;
  648. if (!string.IsNullOrEmpty(dttime.Rows[0]["start_time"].ToString()))
  649. {
  650. dt = Convert.ToDateTime(dttime.Rows[0]["start_time"].ToString());
  651. }
  652. else
  653. {
  654. dt = DateTime.Now;
  655. }
  656. if (!string.IsNullOrEmpty(dttime.Rows[0]["feed_time"].ToString()))
  657. {
  658. dtfeed = Convert.ToDateTime(dttime.Rows[0]["feed_time"].ToString());
  659. }
  660. else
  661. {
  662. dtfeed = DateTime.Now;
  663. }
  664. DataTable ds = ServerHelper.GetData("com.steering.mes.zgmil.coup.FrmBackLine.doQueryStartTime", new object[] { PlineCod }, ob);
  665. if (ds.Rows.Count > 0)
  666. {
  667. plan.StartTime = DateTime.Parse(ds.Rows[0]["START_TIME"].ToString()).AddSeconds(1).ToString("yyyy/MM/dd HH:mm:ss");
  668. plan.FeedTime = DateTime.Parse(ds.Rows[0]["FEED_TIME"].ToString()).AddSeconds(1).ToString("yyyy/MM/dd HH:mm:ss");
  669. }
  670. else
  671. {
  672. plan.StartTime = dt.AddSeconds(1).ToString("yyyy/MM/dd HH:mm:ss");
  673. plan.FeedTime = dtfeed.AddSeconds(1).ToString("yyyy/MM/dd HH:mm:ss");
  674. }
  675. //plan.StartTime = dt.AddSeconds(1).ToString("yyyy/MM/dd hh:mm:ss");
  676. //plan.FeedTime = dtfeed.AddSeconds(1).ToString("yyyy/MM/dd hh:mm:ss");
  677. }
  678. MilStraighteningResultEntity milstra = new MilStraighteningResultEntity();
  679. MilMtResultEntity milmt = new MilMtResultEntity();
  680. MilEtResultEntity milet = new MilEtResultEntity();
  681. MilUlResulEntity milut = new MilUlResulEntity();
  682. //DataTable dt2 = ServerHelper.GetData("com.steering.mes.zgmil.coup.FrmBackLine.GetBackResult", new object[] { heatno, node, test }, this.ob);
  683. if (node.Equals("0"))
  684. {
  685. //milstra = NativeMethod.GetTableToEntity(dt2, milstra);
  686. milstra = this.GetBackResultToEntity(milstra);
  687. milstra.JudgeStoveNo = heatnonew;
  688. milstra.NodeFurFlag = "0";
  689. milstra.QualifiedNum = 0;
  690. milstra.QualifiedNum1 = 0;
  691. milstra.QualifiedNum2 = 0;
  692. milstra.QualifiedNum3 = 0;
  693. milstra.InMatNum = 0;
  694. milstra.KgFlag = "0";
  695. milstra.ColGroup = UserInfo.GetUserGroup();
  696. milstra.ColShift = UserInfo.GetUserOrder();
  697. milstra.ColUser = UserInfo.GetUserName();
  698. milstra.EndTime = "";
  699. }
  700. if (node.Equals("1"))
  701. {
  702. milstra = this.GetBackResultToEntity(milstra, "0");
  703. milstra.JudgeStoveNo = heatnonew;
  704. milstra.NodeFurFlag = "1";
  705. milstra.QualifiedNum = BackLineNum;
  706. milstra.QualifiedNum1=BackLineNum1;
  707. milstra.QualifiedNum2 = BackLineNum2;
  708. milstra.QualifiedNum3 = BackLineNum3;
  709. milstra.InMatNum = BackLineNum;
  710. milstra.KgFlag = "1";
  711. milstra.ColGroup = UserInfo.GetUserGroup();
  712. milstra.ColShift = UserInfo.GetUserOrder();
  713. milstra.ColUser = UserInfo.GetUserName();
  714. milstra.EndTime = System.DateTime.Now.ToString();
  715. if (test.Equals("1"))
  716. {
  717. //milet = NativeMethod.GetTableToEntity(dt2, milet);
  718. milet = this.GetBackResultToEntity(milet);
  719. milet.JudgeStoveNo = heatnonew;
  720. milet.ColGroup = UserInfo.GetUserGroup();
  721. milet.ColShift = UserInfo.GetUserOrder();
  722. milet.ColUser = UserInfo.GetUserName();
  723. }
  724. if (test.Equals("2"))
  725. {
  726. //milmt = NativeMethod.GetTableToEntity(dt2, milmt);
  727. milmt = this.GetBackResultToEntity(milmt);
  728. milmt.JudgeStoveNo = heatnonew;
  729. milmt.ColGroup = UserInfo.GetUserGroup();
  730. milmt.ColShift = UserInfo.GetUserOrder();
  731. milmt.ColUser = UserInfo.GetUserName();
  732. }
  733. if (test.Equals("3"))
  734. {
  735. //milut = NativeMethod.GetTableToEntity(dt2, milut);
  736. milut = this.GetBackResultToEntity(milut);
  737. milut.JudgeStoveNo = heatnonew;
  738. milut.ColGroup = UserInfo.GetUserGroup();
  739. milut.ColShift = UserInfo.GetUserOrder();
  740. milut.ColUser = UserInfo.GetUserName();
  741. }
  742. }
  743. this.listtest = this.SetTestRack(BackLineNum1, BackLineNum2, BackLineNum3);
  744. this.liststraight = this.SetStraightRack(BackLineNum1, BackLineNum2, BackLineNum3);
  745. this.listqa = this.SetQaRack(BackLineNum1, BackLineNum2, BackLineNum3);
  746. if (this.node.Equals("1"))
  747. {
  748. for(int i=0;i<listtest.Count;i++)
  749. {
  750. MilStraighRackEntity st= (MilStraighRackEntity)liststraight[i];
  751. MilTestingRackEntity tr = (MilTestingRackEntity)listtest[i];
  752. st.MatNo = tr.MatNo;
  753. st.ResultNo = tr.ResultNo;
  754. liststraight.RemoveAt(i);
  755. liststraight.Insert(i, st);
  756. }
  757. }
  758. //DataTable dt3 = ServerHelper.GetData("com.steering.mes.zgmil.coup.FrmBackLine.GetBackRack", new object[] { heatno, node, test, colno, int.Parse(TxtBacklinNum1.Text.ToString()) }, this.ob);
  759. ArrayList arr = new ArrayList();
  760. arr.Add(plan);
  761. arr.Add(milstra);
  762. arr.Add(milet);
  763. arr.Add(milmt);
  764. arr.Add(milut);
  765. arr.Add(liststraight);
  766. arr.Add(listtest);
  767. arr.Add(listqa);
  768. arr.Add(BackLineNum);
  769. arr.Add(BackLineNum1);
  770. arr.Add(BackLineNum2);
  771. arr.Add(BackLineNum3);
  772. int count = ServerHelper.SetData("com.steering.mes.zgmil.coup.FrmBackLine.BackLineNEW", new object[] { arr, heatno ,node, test,process }, this.ob);
  773. Query();
  774. foreach (UltraGridRow ugr in ultraRack.Rows)
  775. {
  776. if (ugr.Cells["JUDGE_STOVE_NO"].Value.ToString().Equals(heatno))
  777. {
  778. ultraRack.ActiveRow = ugr;
  779. }
  780. }
  781. }
  782. public void BackLineBack()
  783. {
  784. heatnonew = Changheatno(heatno);
  785. //backlinenumhas1 = 0;
  786. //backlinenumhas2 = 0;
  787. //backlinenumhas3 = 0;
  788. if (!string.IsNullOrEmpty(this.TxtBacklinNumBack1.Value.ToString3()))
  789. {
  790. backlinenumBack1 = int.Parse(this.TxtBacklinNumBack1.Value.ToString3());
  791. //if (backlinenumBack1 == 0)
  792. //{
  793. // MessageBox.Show("您输入的1#线回退支数为零支,请重新输入后再次操作。", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  794. // return;
  795. //}
  796. if(backlinenumBack1>this.backlinenumhas1)
  797. {
  798. MessageBox.Show("您输入的1#线回退支数大于可回退支数,请重新输入后再次操作。", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  799. return;
  800. }
  801. }
  802. else
  803. {
  804. backlinenumBack1 = 0;
  805. }
  806. if (!string.IsNullOrEmpty(this.TxtBacklinNumBack2.Value.ToString3()))
  807. {
  808. backlinenumBack2 = int.Parse(this.TxtBacklinNumBack2.Value.ToString3());
  809. //if (backlinenumBack2 == 0)
  810. //{
  811. // MessageBox.Show("您输入的2#线回退支数为零支,请重新输入后再次操作。", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  812. // return;
  813. //}
  814. if (backlinenumBack2 > this.backlinenumhas2)
  815. {
  816. MessageBox.Show("您输入的2#线回退支数大于可回退支数,请重新输入后再次操作。", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  817. return;
  818. }
  819. }
  820. else
  821. {
  822. backlinenumBack2 = 0;
  823. }
  824. if (this.PlineCod.Equals("C010"))
  825. {
  826. if (!string.IsNullOrEmpty(this.TxtBacklinNumBack3.Value.ToString3()))
  827. {
  828. backlinenumBack3 = int.Parse(this.TxtBacklinNumBack3.Value.ToString3());
  829. if (backlinenumBack3 > this.backlinenumhas3)
  830. {
  831. MessageBox.Show("您输入的3#线回退支数大于可回退支数,请重新输入后再次操作。", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  832. return;
  833. }
  834. }
  835. else
  836. {
  837. backlinenumBack3 = 0;
  838. }
  839. }
  840. else
  841. {
  842. backlinenumBack3 = 0;
  843. }
  844. int backlinenumafter1 = backlinenumhas1 - backlinenumBack1;
  845. int backlinenumafter2 = backlinenumhas2 - backlinenumBack2;
  846. int backlinenumafter3 = backlinenumhas3 - backlinenumBack3;
  847. int totalafter = backlinenumafter1 + backlinenumafter2 + backlinenumafter3;
  848. int totalbefor = backlinenumhas1 + backlinenumhas2 + backlinenumhas3;
  849. int count = ServerHelper.SetData("com.steering.mes.zgmil.coup.FrmBackLine.BackLineNEWBack", new object[] { heatnonew, heatno, process, node, test, totalbefor, backlinenumafter1, backlinenumafter2, backlinenumafter3, backlinenumBack1, backlinenumBack2, backlinenumBack3}, this.ob);
  850. if (totalafter == 0 && count > 0)
  851. {
  852. int coutt = ServerHelper.SetData("com.steering.mes.zgmil.coup.FrmBackLine.AfterBackLineNEWBack", new object[] { heatnonew, heatno, process, node, test }, this.ob);
  853. if (coutt > 0)
  854. {
  855. MessageBox.Show("返线回退成功。", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  856. return;
  857. }
  858. }
  859. else if (totalafter > 0 && count > 0)
  860. {
  861. MessageBox.Show("返线回退成功。", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  862. return;
  863. }
  864. else
  865. {
  866. MessageBox.Show("返线回退失败,请查找原因后重新回退。", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  867. return;
  868. }
  869. Query();
  870. foreach (UltraGridRow ugr in ultraRack.Rows)
  871. {
  872. if (ugr.Cells["JUDGE_STOVE_NO"].Value.ToString().Equals(heatno))
  873. {
  874. ultraRack.ActiveRow = ugr;
  875. }
  876. }
  877. }
  878. public void BackLineAll()
  879. {
  880. if (string.IsNullOrEmpty(heatno) || ultraRack.ActiveRow == null)
  881. {
  882. MessageBox.Show("未选择计划行,不允许进行返线操作", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
  883. return;
  884. }
  885. //1.修改下线实绩,2.修改主表下线状态3,修改对应实绩表返线支数4,,修改对应跟踪记录表下线状态
  886. int count = ServerHelper.SetData("com.steering.mes.zgmil.coup.FrmBackLine.BackLine", new object[] { heatno, node, test, BackLineNumAll, BackLineNumAll, DelNum, colno }, this.ob);
  887. Query();
  888. foreach (UltraGridRow ugr in ultraRack.Rows)
  889. {
  890. if (ugr.Cells["JUDGE_STOVE_NO"].Value.ToString().Equals(heatno))
  891. {
  892. ultraRack.ActiveRow = ugr;
  893. }
  894. }
  895. }
  896. private void ultraToolbarsManager1_ToolClick(object sender, Infragistics.Win.UltraWinToolbars.ToolClickEventArgs e)
  897. {
  898. switch (e.Tool.Key)
  899. {
  900. case "query":
  901. Query();
  902. break;
  903. case "backline":
  904. Backline();
  905. break;
  906. case "backlineall":
  907. BackLineAll();
  908. break;
  909. case "BacklineBack":
  910. BackLineBack();
  911. break;
  912. case "Close":
  913. this.Close();
  914. break;
  915. }
  916. }
  917. private void BackLineOperate_FormClosed(object sender, FormClosedEventArgs e)
  918. {
  919. this.DialogResult = DialogResult.OK;
  920. }
  921. }
  922. }