UIJ060010.cs 37 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Collections;
  9. using System.Windows.Forms;
  10. using CoreFS.CA06;
  11. using PrintSolution;
  12. using Infragistics.Win.UltraWinGrid;
  13. namespace Core.LZMes.Client.UIJ
  14. {
  15. public partial class UIJ060010 : FrmBase
  16. {
  17. #region
  18. public UIJ060010()
  19. {
  20. InitializeComponent();
  21. }
  22. public override void ToolBar_Click(object sender, string ToolbarKey)
  23. {
  24. switch (ToolbarKey)
  25. {
  26. case "Query":
  27. this.DoQuery();
  28. break;
  29. case "Save":
  30. this.DoSave();
  31. break;
  32. case "Comfirm":
  33. this.DoComfirm();
  34. break;
  35. case "Print":
  36. DoPrint();
  37. break;
  38. case "Exit":
  39. this.Close();
  40. break;
  41. }
  42. }
  43. #endregion
  44. private void UIJ060010_Load(object sender, EventArgs e)
  45. {
  46. initParam();
  47. this.tabControl1.SelectedIndex = 1;
  48. }
  49. private void initParam()
  50. {
  51. try
  52. {
  53. CoreClientParam ccp = new CoreClientParam();
  54. ccp.ServerName = "UIJ.UIJ06.UIJ060010";
  55. ccp.MethodName = "queryTransUnits";
  56. ccp = this.ExecuteQuery(ccp, CoreInvokeType.Internal);
  57. ArrayList transList = (ArrayList)ccp.ReturnObject;
  58. int listSize = transList.Count;
  59. Infragistics.Win.ValueListItem[] valueListItems = new Infragistics.Win.ValueListItem[listSize];
  60. for (int i = 0; i < listSize; i++)
  61. {
  62. Infragistics.Win.ValueListItem item = new Infragistics.Win.ValueListItem();
  63. Hashtable ht = (Hashtable)transList[i];
  64. item.DataValue = ht["VALUE"].ToString();
  65. item.DisplayText = ht["LABEL"].ToString(); ;
  66. valueListItems[i] = item;
  67. }
  68. this.ultraComboEditor1.Items.AddRange(valueListItems);
  69. }
  70. catch (Exception e)
  71. {
  72. MessageBox.Show(e.Message);
  73. }
  74. }
  75. /// <summary>
  76. /// 查询装车计划
  77. /// </summary>
  78. private void DoQuery()
  79. {
  80. string shipProgCd = "03";//发货指示状态
  81. string fromDate = this.ultraDateTimeEditor1.Value != null ? ultraDateTimeEditor1.DateTime.ToString("yyyyMMdd") : "";
  82. //this.ultraDateTimeEditor1.DateTime.ToString("yyyyMMdd");
  83. string toDate = this.ultraDateTimeEditor2.Value != null ? ultraDateTimeEditor2.DateTime.ToString("yyyyMMdd") : "";
  84. //this.ultraDateTimeEditor2.DateTime.ToString("yyyyMMdd");
  85. string shipDirNo = this.textBox1.Text.Trim();//发货指示号
  86. string curProgCd = "DFB";//物料进度
  87. string laneTp = "";//火车入库道次
  88. string entranceSeq = "";//装车次数
  89. string shipCompNm = 0 > this.ultraComboEditor1.SelectedIndex ? "" : this.ultraComboEditor1.SelectedItem.DataValue.ToString();//运输单位
  90. CoreClientParam ccp = new CoreClientParam();
  91. ccp.ServerName = "UIJ.UIJ06.UIJ060010";
  92. ccp.MethodName = "queryTransPlan";
  93. DataRowCollection drs = null;
  94. string dlivTp = "";//运输方式
  95. switch (this.tabControl1.SelectedIndex)
  96. {
  97. case 0:
  98. dlivTp = "T";
  99. this.dataSet1.Tables[0].Clear();
  100. ccp.SourceDataTable = this.dataSet1.Tables[0];
  101. ccp.ServerParams = new Object[] { shipProgCd, fromDate, toDate, shipDirNo, curProgCd, shipCompNm, dlivTp, laneTp, entranceSeq };
  102. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  103. drs = dataSet1.Tables[0].Rows;
  104. for (int i = 0; i < drs.Count; i++)
  105. {
  106. ultraGrid1.Rows[i].Cells[0].Value = false;
  107. ultraGrid1.Rows[i].Cells[0].Column.CellActivation = Infragistics.Win.UltraWinGrid.Activation.AllowEdit;
  108. }
  109. dataSet5.Tables[0].Clear();
  110. dataSet3.Tables[0].Clear();
  111. break;
  112. case 1:
  113. dlivTp = "C";
  114. this.dataSet2.Tables[0].Clear();
  115. ccp.SourceDataTable = this.dataSet2.Tables[0];
  116. ccp.ServerParams = new Object[] { shipProgCd, fromDate, toDate, shipDirNo, curProgCd, shipCompNm, dlivTp, laneTp, entranceSeq };
  117. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  118. drs = dataSet2.Tables[0].Rows;
  119. for (int i = 0; i < drs.Count; i++)
  120. {
  121. ultraGrid4.Rows[i].Cells[0].Value = false;
  122. ultraGrid4.Rows[i].Cells[0].Column.CellActivation = Infragistics.Win.UltraWinGrid.Activation.AllowEdit;
  123. }
  124. dataSet4.Tables[0].Clear();
  125. dataSet6.Tables[0].Clear();
  126. break;
  127. default:
  128. return;
  129. }
  130. }
  131. /// <summary>
  132. /// 排车
  133. /// </summary>
  134. private void DoSave()
  135. {
  136. Infragistics.Win.UltraWinGrid.RowsCollection rs = null;
  137. ArrayList list = new ArrayList();
  138. string[] param = null;
  139. CoreClientParam ccp = new CoreClientParam();
  140. ccp.ServerName = "UIJ.UIJ06.UIJ060010";
  141. switch (this.tabControl1.SelectedIndex)
  142. {
  143. case 0://火车
  144. label10.Focus();
  145. ultraGrid1.Update();
  146. rs = this.ultraGrid1.Rows;
  147. for (int i = 0; i < rs.Count; i++)
  148. {
  149. if ("TRUE".Equals(rs[i].Cells["CHK"].Text.ToUpperInvariant()))
  150. {
  151. param = new string[6];
  152. param[0] = rs[i].Cells["ALLOC_SEQ"].Value.ToString().Trim();
  153. param[1] = rs[i].Cells["TRANS_CAR_NO"].Value.ToString().Trim();
  154. param[2] = rs[i].Cells["LANE_TP"].Value.ToString().Trim();
  155. param[3] = rs[i].Cells["ENTERANCE_SEQ"].Value.ToString().Trim();
  156. param[4] = rs[i].Cells["DLIV_DIRNO"].Value.ToString().Trim();
  157. param[5] = rs[i].Cells["SHIP_DIRNO"].Value.ToString().Trim();
  158. list.Add(param);
  159. if (param[1] == null || param[1].Equals(""))
  160. {
  161. MessageBox.Show("车辆号不能为空,请确认后重新操作!");
  162. return;
  163. }
  164. if (param[2] == null || param[2].Equals(""))
  165. {
  166. MessageBox.Show("入库道次不能为空,请确认后重新操作!");
  167. return;
  168. }
  169. if (param[3] == null || param[3].Equals(""))
  170. {
  171. MessageBox.Show("装车次数不能为空,请确认后重新操作!");
  172. return;
  173. }
  174. }
  175. }
  176. ccp.MethodName = "saveSHIPTrain";
  177. ccp.ServerParams = new Object[] { list };
  178. this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  179. for (int i = 0; i < rs.Count; i++)
  180. {
  181. if ("TRUE".Equals(rs[i].Cells["CHK"].Text.ToUpperInvariant()))
  182. {
  183. //设置单元格禁用
  184. rs[i].Cells["CHK"].Column.CellActivation = Infragistics.Win.UltraWinGrid.Activation.Disabled;
  185. }
  186. }
  187. queryDlivDirCoil("T");
  188. break;
  189. case 1://汽车
  190. label13.Focus();
  191. ultraGrid4.Update();
  192. rs = this.ultraGrid4.Rows;
  193. for (int i = 0; i < rs.Count; i++)
  194. {
  195. if ("TRUE".Equals(rs[i].Cells["CHK"].Text.ToUpperInvariant()))
  196. {
  197. param = new string[4];
  198. param[0] = rs[i].Cells["ALLOC_SEQ"].Value.ToString().Trim();
  199. param[1] = rs[i].Cells["TRANS_CAR_NO"].Value.ToString().Trim();
  200. param[2] = rs[i].Cells["DLIV_DIRNO"].Value.ToString().Trim();
  201. param[3] = rs[i].Cells["SHIP_DIRNO"].Value.ToString().Trim();
  202. list.Add(param);
  203. if (param[1] == null || param[1].Equals(""))//param[0] == null || param[0].Equals("") ||
  204. {
  205. MessageBox.Show("车辆号不能为空,请确认后重新操作!");
  206. return;
  207. }
  208. }
  209. }
  210. ccp.MethodName = "saveSHIPDIRCAR";
  211. ccp.ServerParams = new Object[] { list };
  212. this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  213. for (int i = 0; i < rs.Count; i++)
  214. {
  215. if ("TRUE".Equals(rs[i].Cells["CHK"].Text.ToUpperInvariant()))
  216. {
  217. //设置单元格禁用
  218. rs[i].Cells["CHK"].Column.CellActivation = Infragistics.Win.UltraWinGrid.Activation.Disabled;
  219. }
  220. }
  221. queryDlivDirCoil("C");
  222. break;
  223. default:
  224. return;
  225. }
  226. }
  227. /// <summary>
  228. /// 确认装车操作
  229. /// </summary>
  230. private void DoComfirm()
  231. {
  232. if (DialogResult.Yes != MessageBox.Show("确认后不能进行排车操作,是否排车完毕?", "提示", MessageBoxButtons.YesNo))
  233. {
  234. return;
  235. }
  236. //用户名
  237. string regId = this.UserInfo.GetUserID();
  238. //超重是否继续装车标识
  239. bool top_wgt = false;
  240. //超数车辆数量
  241. int num_car = 0;
  242. Infragistics.Win.UltraWinGrid.RowsCollection rs = null;
  243. ArrayList list = new ArrayList();
  244. string[] param = null;
  245. CoreClientParam ccp = new CoreClientParam();
  246. ccp.ServerName = "UIJ.UIJ06.UIJ060010";
  247. switch (this.tabControl1.SelectedIndex)
  248. {
  249. case 0:
  250. rs = this.ultraGrid2.Rows;
  251. for (int i = 0; i < rs.Count; i++)
  252. {
  253. if (!"TRUE".Equals(rs[i].Cells["CHK"].Text.ToUpperInvariant()))
  254. {
  255. MessageBox.Show("第" + (i + 1) + "行的选择项没有选择,作为同一批次的车不能出现为空的现象!");
  256. return;
  257. }
  258. param = new string[8];
  259. param[0] = rs[i].Cells["ALLOC_SEQ"].Text.Trim();//排车顺序号
  260. param[1] = rs[i].Cells["TRANS_CAR_NO"].Text.Trim();//车厢号
  261. param[2] = rs[i].Cells["DLIV_DIRNO"].Text.Trim();//运输号
  262. param[3] = rs[i].Cells["SHIP_DIRNO"].Text.Trim();//发货指示号
  263. param[4] = rs[i].Cells["OLD_SAMPL_NO"].Text.Trim();//批次号
  264. param[5] = rs[i].Cells["COIL_NO"].Text.Trim();//钢卷号
  265. param[6] = rs[i].Cells["ACT_WGT"].Text.Trim();//钢卷重量
  266. param[7] = rs[i].Cells["CUR_LOAD_LOC"].Text.Trim();//垛位
  267. list.Add(param);
  268. }
  269. ccp.MethodName = "saveDLIVDIRCAR";
  270. ccp.ServerParams = new Object[] { regId, UserInfo.GetUserOrder(), UserInfo.GetUserGroup(), list };
  271. this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  272. break;
  273. case 1:
  274. rs = this.ultraGrid6.Rows;
  275. for (int i = 0; i < rs.Count; i++)
  276. {
  277. if (!"TRUE".Equals(rs[i].Cells["CHK"].Text.ToUpperInvariant()))
  278. {
  279. MessageBox.Show("第" + (i + 1) + "行的选择项没有选择,作为同一批次的车不能出现为空的现象!");
  280. return;
  281. }
  282. param = new string[8];
  283. param[0] = rs[i].Cells["ALLOC_SEQ"].Text.Trim();//排车顺序号
  284. param[1] = rs[i].Cells["TRANS_CAR_NO"].Text.Trim();//车厢号
  285. param[2] = rs[i].Cells["DLIV_DIRNO"].Text.Trim();//运输号
  286. param[3] = rs[i].Cells["SHIP_DIRNO"].Text.Trim();//发货指示号
  287. param[4] = rs[i].Cells["OLD_SAMPL_NO"].Text.Trim();//批次号
  288. param[5] = rs[i].Cells["COIL_NO"].Text.Trim();//钢卷号
  289. param[6] = rs[i].Cells["ACT_WGT"].Text.Trim();//钢卷重量
  290. param[7] = rs[i].Cells["CUR_LOAD_LOC"].Text.Trim();//垛位
  291. list.Add(param);
  292. }
  293. ccp.MethodName = "saveDLIVDIRCAR";
  294. ccp.ServerParams = new Object[] { regId, UserInfo.GetUserOrder(), UserInfo.GetUserGroup(), list };
  295. this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  296. break;
  297. default:
  298. return;
  299. }
  300. this.DoQuery();
  301. }
  302. //汽车待装车计划
  303. private void label13_Click(object sender, EventArgs e)
  304. {
  305. string shipProgCd = "04";
  306. string fromDate = this.ultraDateTimeEditor1.DateTime.ToString("yyyyMMdd");
  307. string toDate = this.ultraDateTimeEditor2.DateTime.ToString("yyyyMMdd");
  308. string shipDirNo = this.textBox1.Text.Trim();
  309. string curProgCd = "DFB";
  310. string laneTp = "";
  311. string entranceSeq = "";
  312. string shipCompNm = 0 > this.ultraComboEditor1.SelectedIndex ? "" : this.ultraComboEditor1.SelectedItem.DataValue.ToString();
  313. string dlivTp = "C";
  314. this.dataSet2.Tables[0].Clear();
  315. CoreClientParam ccp = new CoreClientParam();
  316. ccp.ServerName = "UIJ.UIJ06.UIJ060010";
  317. ccp.MethodName = "queryTransPlan";
  318. ccp.SourceDataTable = this.dataSet2.Tables[0];
  319. ccp.ServerParams = new Object[] { shipProgCd, fromDate, toDate, shipDirNo, curProgCd, shipCompNm, dlivTp, laneTp, entranceSeq };
  320. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  321. DataRowCollection drs = dataSet2.Tables[0].Rows;
  322. for (int i = 0; i < drs.Count; i++)
  323. {
  324. ultraGrid4.Rows[i].Cells[0].Value = true;
  325. ultraGrid4.Rows[i].Cells[0].Column.CellActivation = Infragistics.Win.UltraWinGrid.Activation.Disabled;
  326. }
  327. queryDlivDirCoil(dlivTp);
  328. }
  329. /// <summary>
  330. /// 查询待装车钢卷 queryShipDir
  331. /// <param name="dlivTp"
  332. /// </summary>
  333. public void queryDlivDirCoil(string dlivTp)
  334. {
  335. if ("T".Equals(dlivTp.ToUpperInvariant()))
  336. {
  337. this.dataSet3.Tables[0].Clear();
  338. CoreClientParam ccp4 = new CoreClientParam();
  339. ccp4.ServerName = "UIJ.UIJ06.UIJ060010";
  340. ccp4.MethodName = "queryShipDir";
  341. ccp4.SourceDataTable = this.dataSet3.Tables[0];
  342. ccp4.ServerParams = new Object[] { dlivTp };
  343. this.ExecuteQueryToDataTable(ccp4, CoreInvokeType.Internal);
  344. DataRowCollection drs = dataSet3.Tables[0].Rows;
  345. for (int i = 0; i < drs.Count; i++)
  346. {
  347. ultraGrid2.Rows[i].Cells[0].Value = false;
  348. }
  349. }
  350. else
  351. {
  352. this.dataSet4.Tables[0].Clear();
  353. CoreClientParam ccp4 = new CoreClientParam();
  354. ccp4.ServerName = "UIJ.UIJ06.UIJ060010";
  355. ccp4.MethodName = "queryShipDir";
  356. ccp4.SourceDataTable = this.dataSet4.Tables[0];
  357. ccp4.ServerParams = new Object[] { dlivTp };
  358. this.ExecuteQueryToDataTable(ccp4, CoreInvokeType.Internal);
  359. DataRowCollection drs = dataSet4.Tables[0].Rows;
  360. for (int i = 0; i < drs.Count; i++)
  361. {
  362. ultraGrid6.Rows[i].Cells[0].Value = false;
  363. }
  364. }
  365. }
  366. /// <summary>
  367. /// 查询下达汽车排车计划时排车计划对应的钢卷信息 queryPlanCoil
  368. /// </summary>
  369. /// <param name="sender"></param>
  370. /// <param name="e"></param>
  371. private void ultraGrid6_DoubleClickRow(object sender, Infragistics.Win.UltraWinGrid.DoubleClickRowEventArgs e)
  372. {
  373. Infragistics.Win.UltraWinGrid.UltraGridRow uRow = this.ultraGrid6.ActiveRow;
  374. string dlivNo = uRow.Cells["DLIV_DIRNO"].Text.ToString().Trim();
  375. this.dataSet6.Tables[0].Clear();
  376. CoreClientParam ccp = new CoreClientParam();
  377. ccp.ServerName = "UIJ.UIJ06.UIJ060010";
  378. ccp.MethodName = "queryPlanCoil";
  379. ccp.SourceDataTable = this.dataSet6.Tables[0];
  380. ccp.ServerParams = new Object[] { dlivNo };
  381. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  382. }
  383. /// <summary>
  384. /// 取消火车待装车指示
  385. /// </summary>
  386. /// <param name="sender"></param>
  387. /// <param name="e"></param>
  388. private void label7_Click(object sender, EventArgs e)
  389. {
  390. Infragistics.Win.UltraWinGrid.RowsCollection rs = this.ultraGrid2.Rows;
  391. ArrayList list = new ArrayList();
  392. string[] param = null;
  393. for (int i = 0; i < rs.Count; i++)
  394. {
  395. if ("TRUE".Equals(rs[i].Cells["CHK"].Text.ToUpperInvariant()))
  396. {
  397. param = new string[2];
  398. param[0] = rs[i].Cells["DLIV_DIRNO"].Value.ToString().Trim();
  399. param[1] = rs[i].Cells["SHIP_DIRNO"].Value.ToString().Trim();
  400. bool flag = false;
  401. //去除重复的发运指示号
  402. foreach (string[] tmp in list)
  403. {
  404. if (param[0].Equals(tmp[0]) && param[1].Equals(tmp[1]))
  405. {
  406. flag = true;
  407. break;
  408. }
  409. }
  410. if (!flag)
  411. {
  412. list.Add(param);
  413. }
  414. }
  415. }
  416. if (DialogResult.Yes == MessageBox.Show("是否确认同一运输指示号(计划号)下的钢卷全部选择上?", "提示", MessageBoxButtons.YesNo))
  417. {
  418. CoreClientParam ccp = new CoreClientParam();
  419. ccp.ServerName = "UIJ.UIJ06.UIJ060010";
  420. ccp.MethodName = "returnSHIPDIRCAR";
  421. ccp.ServerParams = new Object[] { list };
  422. this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  423. dataSet3.Tables[0].Clear();
  424. dataSet5.Tables[0].Clear();
  425. this.DoQuery();
  426. }
  427. }
  428. /// <summary>
  429. /// 取消汽车待装车指示
  430. /// </summary>
  431. /// <param name="sender"></param>
  432. /// <param name="e"></param>
  433. private void label15_Click(object sender, EventArgs e)
  434. {
  435. Infragistics.Win.UltraWinGrid.RowsCollection rs = this.ultraGrid6.Rows;
  436. ArrayList list = new ArrayList();
  437. string[] param = null;
  438. for (int i = 0; i < rs.Count; i++)
  439. {
  440. if ("TRUE".Equals(rs[i].Cells["CHK"].Text.ToUpperInvariant()))
  441. {
  442. param = new string[2];
  443. param[0] = rs[i].Cells["DLIV_DIRNO"].Value.ToString().Trim();
  444. param[1] = rs[i].Cells["SHIP_DIRNO"].Value.ToString().Trim();
  445. bool flag = false;
  446. //去除重复的发运指示号
  447. foreach (string[] tmp in list)
  448. {
  449. if (param[0].Equals(tmp[0]) && param[1].Equals(tmp[1]))
  450. {
  451. flag = true;
  452. break;
  453. }
  454. }
  455. if (!flag)
  456. {
  457. list.Add(param);
  458. }
  459. }
  460. }
  461. if (DialogResult.Yes == MessageBox.Show("是否确认同一运输指示号(计划号)下的钢卷全部选择上?", "提示", MessageBoxButtons.YesNo))
  462. {
  463. CoreClientParam ccp = new CoreClientParam();
  464. ccp.ServerName = "UIJ.UIJ06.UIJ060010";
  465. ccp.MethodName = "returnSHIPDIRCAR";
  466. ccp.ServerParams = new Object[] { list };
  467. this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  468. dataSet4.Tables[0].Clear();
  469. dataSet6.Tables[0].Clear();
  470. this.DoQuery();
  471. }
  472. }
  473. /// <summary>
  474. /// 火车待装车计划
  475. /// </summary>
  476. /// <param name="sender"></param>
  477. /// <param name="e"></param>
  478. private void label10_Click(object sender, EventArgs e)
  479. {
  480. if (this.ultraComboEditor2.SelectedIndex < 0)
  481. {
  482. MessageBox.Show("火车入库道次不能为空,请选择相应的入库道次!");
  483. return;
  484. }
  485. if ("".Equals(this.textBox2.Text.Trim()))
  486. {
  487. MessageBox.Show("装车次数不能为空,请输入相应的装车次数信息!");
  488. return;
  489. }
  490. string shipProgCd = "04";
  491. string fromDate = this.ultraDateTimeEditor1.DateTime.ToString("yyyyMMdd");
  492. string toDate = this.ultraDateTimeEditor2.DateTime.ToString("yyyyMMdd");
  493. string shipDirNo = this.textBox1.Text.Trim();
  494. string curProgCd = "DFB";
  495. string laneTp = this.ultraComboEditor2.Value.ToString();
  496. string entranceSeq = this.textBox2.Text.Trim();
  497. string shipCompNm = 0 > this.ultraComboEditor1.SelectedIndex ? "" : this.ultraComboEditor1.SelectedItem.DataValue.ToString();
  498. string dlivTp = "T";
  499. this.dataSet1.Tables[0].Clear();
  500. CoreClientParam ccp = new CoreClientParam();
  501. ccp.ServerName = "UIJ.UIJ06.UIJ060010";
  502. ccp.MethodName = "queryTransPlan";
  503. ccp.SourceDataTable = this.dataSet1.Tables[0];
  504. ccp.ServerParams = new Object[] { shipProgCd, fromDate, toDate, shipDirNo, curProgCd, shipCompNm, dlivTp, laneTp, entranceSeq };
  505. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  506. DataRowCollection drs = dataSet1.Tables[0].Rows;
  507. for (int i = 0; i < drs.Count; i++)
  508. {
  509. ultraGrid1.Rows[i].Cells[0].Value = true;
  510. ultraGrid1.Rows[i].Cells[0].Column.CellActivation = Infragistics.Win.UltraWinGrid.Activation.Disabled;
  511. }
  512. queryDlivDirCoil(dlivTp);
  513. }
  514. /// <summary>
  515. /// 查询下达火车排车计划时排车计划对应的钢卷信息
  516. /// </summary>
  517. /// <param name="sender"></param>
  518. /// <param name="e"></param>
  519. private void ultraGrid2_DoubleClickRow(object sender, Infragistics.Win.UltraWinGrid.DoubleClickRowEventArgs e)
  520. {
  521. Infragistics.Win.UltraWinGrid.UltraGridRow uRow = this.ultraGrid2.ActiveRow;
  522. string dlivNo = uRow.Cells["DLIV_DIRNO"].Text.ToString().Trim();
  523. this.dataSet5.Tables[0].Clear();
  524. CoreClientParam ccp = new CoreClientParam();
  525. ccp.ServerName = "UIJ.UIJ06.UIJ060010";
  526. ccp.MethodName = "queryPlanCoil";
  527. ccp.SourceDataTable = this.dataSet5.Tables[0];
  528. ccp.ServerParams = new Object[] { dlivNo };
  529. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  530. }
  531. /// <summary>
  532. /// 打印产品调运单
  533. /// </summary>
  534. private void DoPrint()
  535. {
  536. switch (this.tabControl1.SelectedIndex)
  537. {
  538. case 0:
  539. foreach (Infragistics.Win.UltraWinGrid.UltraGridRow uRow in this.ultraGrid1.Rows)
  540. {
  541. if (Convert.ToBoolean(uRow.Cells["CHK"].Value))
  542. {
  543. try
  544. {
  545. ArrayList param = new ArrayList();
  546. param.Add(uRow.Cells["TRANS_CAR_NO"].Value.ToString());//车辆号
  547. string dlivDirNo = uRow.Cells["DLIV_DIRNO"].Text.ToString().Trim();
  548. CoreClientParam ccp = new CoreClientParam();
  549. ccp.ServerName = "UIJ.UIJ06.UIJ060010";
  550. ccp.MethodName = "queryTransCoils";
  551. ccp.ServerParams = new Object[] { dlivDirNo };
  552. ccp = this.ExecuteQuery(ccp, CoreInvokeType.Internal);
  553. ArrayList coils = (ArrayList)ccp.ReturnObject;
  554. param.Add(coils.Count);//钢卷数
  555. double sumWeight = 0;
  556. foreach (object obj in coils)
  557. {
  558. Hashtable ht = (Hashtable)obj;
  559. sumWeight += Convert.ToDouble(((Hashtable)ht["ACT_WGT"])["value"].ToString().Trim());
  560. }
  561. param.Add(sumWeight / 1000);//钢卷总重量
  562. for (int i = 0; i < 10; i++)
  563. {
  564. if (i < coils.Count)
  565. {
  566. Hashtable ht = (Hashtable)coils[i];
  567. param.Add(ht["COIL_NO"].ToString());//卷号
  568. param.Add(ht["SPEC_STL_GRD"].ToString());//牌号
  569. param.Add(ht["ORD_SIZE"].ToString());//订单规格
  570. param.Add(((Hashtable)ht["ACT_WGT"])["value"].ToString().Trim());//重量
  571. param.Add(ht["CUR_LOAD_LOC"].ToString());//堆放位置
  572. }
  573. else
  574. {
  575. param.Add("");
  576. param.Add("");
  577. param.Add("");
  578. param.Add("");
  579. param.Add("");
  580. }
  581. }
  582. ExcelPrinter ePrinter = new ExcelPrinter("trans.xml", param);
  583. ePrinter.PageSetup.IsCustom = true;
  584. ePrinter.Orientation = 1;//横向打印
  585. ePrinter.printExcel();
  586. }
  587. catch (Exception ex)
  588. {
  589. MessageBox.Show("打印失败,请关闭程序后重新操作!");
  590. return;
  591. }
  592. }
  593. }
  594. break;
  595. case 1:
  596. foreach (Infragistics.Win.UltraWinGrid.UltraGridRow uRow in this.ultraGrid4.Rows)
  597. {
  598. if (Convert.ToBoolean(uRow.Cells["CHK"].Value))
  599. {
  600. try
  601. {
  602. ArrayList param = new ArrayList();
  603. param.Add(uRow.Cells["TRANS_CAR_NO"].Value.ToString());//车辆号
  604. string dlivDirNo = uRow.Cells["DLIV_DIRNO"].Text.ToString().Trim();
  605. CoreClientParam ccp = new CoreClientParam();
  606. ccp.ServerName = "UIJ.UIJ06.UIJ060010";
  607. ccp.MethodName = "queryTransCoils";
  608. ccp.ServerParams = new Object[] { dlivDirNo };
  609. ccp = this.ExecuteQuery(ccp, CoreInvokeType.Internal);
  610. ArrayList coils = (ArrayList)ccp.ReturnObject;
  611. param.Add(coils.Count);//钢卷数
  612. double sumWeight = 0;
  613. foreach (object obj in coils)
  614. {
  615. Hashtable ht = (Hashtable)obj;
  616. sumWeight += Convert.ToDouble(((Hashtable)ht["ACT_WGT"])["value"].ToString().Trim());
  617. }
  618. param.Add(sumWeight / 1000);//钢卷总重量
  619. for (int i = 0; i < 10; i++)
  620. {
  621. if (i < coils.Count)
  622. {
  623. Hashtable ht = (Hashtable)coils[i];
  624. param.Add(ht["COIL_NO"].ToString());//卷号
  625. param.Add(ht["SPEC_STL_GRD"].ToString());//牌号
  626. param.Add(ht["ORD_SIZE"].ToString());//订单规格
  627. param.Add(((Hashtable)ht["ACT_WGT"])["value"].ToString().Trim());//重量
  628. param.Add(ht["CUR_LOAD_LOC"].ToString());//堆放位置
  629. }
  630. else
  631. {
  632. param.Add("");
  633. param.Add("");
  634. param.Add("");
  635. param.Add("");
  636. param.Add("");
  637. }
  638. }
  639. ExcelPrinter ePrinter = new ExcelPrinter("trans.xml", param);
  640. ePrinter.PageSetup.IsCustom = true;
  641. ePrinter.Orientation = 1;//横向打印
  642. ePrinter.printExcel();
  643. }
  644. catch (Exception ex)
  645. {
  646. MessageBox.Show("打印失败,请关闭程序后重新操作!");
  647. return;
  648. }
  649. }
  650. }
  651. break;
  652. default:
  653. return;
  654. }
  655. }
  656. private void label3_Click(object sender, EventArgs e)
  657. {
  658. ArrayList coils = new ArrayList();
  659. string dlivDirNo = string.Empty;
  660. string ordNo = string.Empty;
  661. string ordSeq = string.Empty;
  662. ultraGrid6.UpdateData();
  663. Infragistics.Win.UltraWinGrid.RowsCollection rs = ultraGrid6.Rows;
  664. for (int i = 0; i < rs.Count; i++)
  665. {
  666. if (Convert.ToBoolean(rs[i].Cells["CHK"].Value))
  667. {
  668. if (string.IsNullOrEmpty(ordNo))
  669. {
  670. ordNo = rs[i].Cells["ORD_NO"].Value.ToString();
  671. ordSeq = rs[i].Cells["ORD_SEQ"].Value.ToString();
  672. }
  673. if (string.IsNullOrEmpty(dlivDirNo) || rs[i].Cells["DLIV_DIRNO"].Value.ToString().Equals(dlivDirNo))
  674. {
  675. coils.Add(rs[i].Cells["COIL_NO"].Value.ToString());
  676. dlivDirNo = rs[i].Cells["DLIV_DIRNO"].Value.ToString();
  677. }
  678. else
  679. {
  680. MessageBox.Show("只能对同一发运计划进行换卷!");
  681. return;
  682. }
  683. }
  684. }
  685. if (coils.Count == 0)
  686. {
  687. MessageBox.Show("请选择需要替换的钢卷!");
  688. return;
  689. }
  690. }
  691. #region 根据车辆号选择
  692. private void ultraGrid6_CellChange(object sender, Infragistics.Win.UltraWinGrid.CellEventArgs e)
  693. {
  694. try
  695. {
  696. if (e.Cell.Column.Key == "CHK")
  697. {
  698. e.Cell.Row.Update();
  699. if (e.Cell.Value.ToString().ToUpper() == "TRUE")
  700. {
  701. string vDLIV_DIRNO = e.Cell.Row.Cells["DLIV_DIRNO"].Text;
  702. Infragistics.Win.UltraWinGrid.RowsCollection rs = this.ultraGrid6.Rows;
  703. for (int i = 0; i < rs.Count; i++)
  704. {
  705. if (rs[i].Cells["DLIV_DIRNO"].Text == vDLIV_DIRNO)
  706. {
  707. rs[i].Cells["CHK"].Value = true;
  708. rs[i].Appearance.ForeColor = System.Drawing.Color.Blue;
  709. }
  710. else
  711. {
  712. rs[i].Cells["CHK"].Value = false;
  713. rs[i].Appearance.ForeColor = System.Drawing.Color.Black;
  714. }
  715. }
  716. }
  717. else
  718. {
  719. string vDLIV_DIRNO = e.Cell.Row.Cells["DLIV_DIRNO"].Text;
  720. Infragistics.Win.UltraWinGrid.RowsCollection rs = this.ultraGrid6.Rows;
  721. for (int i = 0; i < rs.Count; i++)
  722. {
  723. if (rs[i].Cells["DLIV_DIRNO"].Text == vDLIV_DIRNO)
  724. {
  725. rs[i].Cells["CHK"].Value = false;
  726. rs[i].Appearance.ForeColor = System.Drawing.Color.Black;
  727. }
  728. }
  729. }
  730. }
  731. }
  732. catch (Exception ex)
  733. {
  734. System.Diagnostics.Debug.WriteLine(ex.ToString());
  735. }
  736. }
  737. #endregion
  738. private void ultraGrid2_CellChange(object sender, Infragistics.Win.UltraWinGrid.CellEventArgs e)
  739. {
  740. try
  741. {
  742. if (e.Cell.Column.Key == "CHK")
  743. {
  744. e.Cell.Row.Update();
  745. if (e.Cell.Value.ToString().ToUpper() == "TRUE")
  746. {
  747. string vDLIV_DIRNO = e.Cell.Row.Cells["DLIV_DIRNO"].Text;
  748. Infragistics.Win.UltraWinGrid.RowsCollection rs = this.ultraGrid2.Rows;
  749. for (int i = 0; i < rs.Count; i++)
  750. {
  751. if (rs[i].Cells["DLIV_DIRNO"].Text == vDLIV_DIRNO)
  752. {
  753. rs[i].Cells["CHK"].Value = true;
  754. rs[i].Appearance.ForeColor = System.Drawing.Color.Blue;
  755. }
  756. }
  757. }
  758. else
  759. {
  760. string vDLIV_DIRNO = e.Cell.Row.Cells["DLIV_DIRNO"].Text;
  761. Infragistics.Win.UltraWinGrid.RowsCollection rs = this.ultraGrid2.Rows;
  762. for (int i = 0; i < rs.Count; i++)
  763. {
  764. if (rs[i].Cells["DLIV_DIRNO"].Text == vDLIV_DIRNO)
  765. {
  766. rs[i].Cells["CHK"].Value = false;
  767. rs[i].Appearance.ForeColor = System.Drawing.Color.Black;
  768. }
  769. }
  770. }
  771. }
  772. }
  773. catch (Exception ex)
  774. {
  775. System.Diagnostics.Debug.WriteLine(ex.ToString());
  776. }
  777. }
  778. }
  779. }