UIJ040020.cs 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494
  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. namespace Core.LZMes.Client.UIJ
  12. {
  13. public partial class UIJ040020 : FrmBase
  14. {
  15. public UIJ040020()
  16. {
  17. InitializeComponent();
  18. }
  19. public override void ToolBar_Click(object sender, string ToolbarKey)
  20. {
  21. switch (ToolbarKey)
  22. {
  23. case "Query":
  24. this.DoQuery();
  25. break;
  26. case "Save":
  27. this.DoSave();
  28. break;
  29. case "Comfirm":
  30. this.DoComfirm();
  31. break;
  32. case "Exit":
  33. this.Close();
  34. break;
  35. }
  36. }
  37. private void UIJ040020_Load(object sender, EventArgs e)
  38. {
  39. initParam();
  40. }
  41. private void initParam()
  42. {
  43. try
  44. {
  45. CoreClientParam ccp = new CoreClientParam();
  46. ccp.ServerName = "UIJ.UIJ04.UIJ040020";
  47. ccp.MethodName = "queryTransUnits";
  48. ccp = this.ExecuteQuery(ccp, CoreInvokeType.Internal);
  49. ArrayList transList = (ArrayList)ccp.ReturnObject;
  50. int listSize = transList.Count;
  51. Infragistics.Win.ValueListItem[] valueListItems = new Infragistics.Win.ValueListItem[listSize];
  52. for (int i = 0; i < listSize; i++)
  53. {
  54. Infragistics.Win.ValueListItem item = new Infragistics.Win.ValueListItem();
  55. Hashtable ht = (Hashtable)transList[i];
  56. item.DataValue = ht["VALUE"].ToString();
  57. item.DisplayText = ht["LABEL"].ToString(); ;
  58. valueListItems[i] = item;
  59. }
  60. this.ultraComboEditor1.Items.AddRange(valueListItems);
  61. }
  62. catch (Exception e)
  63. {
  64. MessageBox.Show(e.Message);
  65. }
  66. }
  67. /// <summary>
  68. /// 查询装车计划
  69. /// </summary>
  70. private void DoQuery()
  71. {
  72. string shipProgCd = "03";
  73. string fromDate = this.ultraDateTimeEditor1.DateTime.ToString("yyyyMMdd");
  74. string toDate = this.ultraDateTimeEditor2.DateTime.ToString("yyyyMMdd");
  75. string shipDirNo = this.textBox1.Text.Trim();
  76. string curProgCd = "SFB";
  77. string laneTp = "";
  78. string entranceSeq = "";
  79. string shipCompNm = 0 > this.ultraComboEditor1.SelectedIndex ? "" : this.ultraComboEditor1.SelectedItem.DataValue.ToString();
  80. CoreClientParam ccp = new CoreClientParam();
  81. ccp.ServerName = "UIJ.UIJ04.UIJ040020";
  82. ccp.MethodName = "queryTransPlan";
  83. DataRowCollection drs = null;
  84. string dlivTp = "";
  85. switch (this.tabControl1.SelectedIndex)
  86. {
  87. case 0:
  88. dlivTp = "T";
  89. this.dataSet1.Tables[0].Clear();
  90. ccp.SourceDataTable = this.dataSet1.Tables[0];
  91. ccp.ServerParams = new Object[] { shipProgCd, fromDate, toDate, shipDirNo, curProgCd, shipCompNm, dlivTp, laneTp, entranceSeq };
  92. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  93. drs = dataSet1.Tables[0].Rows;
  94. for (int i = 0; i < drs.Count; i++)
  95. {
  96. ultraGrid1.Rows[i].Cells[0].Value = false;
  97. ultraGrid1.Rows[i].Cells[0].Column.CellActivation = Infragistics.Win.UltraWinGrid.Activation.AllowEdit;
  98. }
  99. dataSet5.Tables[0].Clear();
  100. dataSet3.Tables[0].Clear();
  101. break;
  102. case 1:
  103. dlivTp = "C";
  104. this.dataSet2.Tables[0].Clear();
  105. ccp.SourceDataTable = this.dataSet2.Tables[0];
  106. ccp.ServerParams = new Object[] { shipProgCd, fromDate, toDate, shipDirNo, curProgCd, shipCompNm, dlivTp, laneTp, entranceSeq };
  107. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  108. drs = dataSet2.Tables[0].Rows;
  109. for (int i = 0; i < drs.Count; i++)
  110. {
  111. ultraGrid4.Rows[i].Cells[0].Value = false;
  112. ultraGrid4.Rows[i].Cells[0].Column.CellActivation = Infragistics.Win.UltraWinGrid.Activation.AllowEdit;
  113. }
  114. dataSet4.Tables[0].Clear();
  115. dataSet6.Tables[0].Clear();
  116. break;
  117. default:
  118. return;
  119. }
  120. }
  121. /// <summary>
  122. /// 排车
  123. /// </summary>
  124. private void DoSave()
  125. {
  126. Infragistics.Win.UltraWinGrid.RowsCollection rs = null;
  127. ArrayList list = new ArrayList();
  128. string[] param = null;
  129. CoreClientParam ccp = new CoreClientParam();
  130. ccp.ServerName = "UIJ.UIJ04.UIJ040020";
  131. switch (this.tabControl1.SelectedIndex)
  132. {
  133. case 0://火车
  134. break;
  135. case 1://汽车
  136. rs = this.ultraGrid4.Rows;
  137. for (int i = 0; i < rs.Count; i++)
  138. {
  139. if ("TRUE".Equals(rs[i].Cells["CHK"].Text.ToUpperInvariant()))
  140. {
  141. param = new string[4];
  142. param[0] = rs[i].Cells["ALLOC_SEQ"].Value.ToString().Trim();
  143. param[1] = rs[i].Cells["TRANS_CAR_NO"].Value.ToString().Trim();
  144. param[2] = rs[i].Cells["DLIV_DIRNO"].Value.ToString().Trim();
  145. param[3] = rs[i].Cells["SHIP_DIRNO"].Value.ToString().Trim();
  146. list.Add(param);
  147. }
  148. }
  149. ccp.MethodName = "saveSHIPDIRCAR";
  150. ccp.ServerParams = new Object[] { list };
  151. this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  152. for (int i = 0; i < rs.Count; i++)
  153. {
  154. if ("TRUE".Equals(rs[i].Cells["CHK"].Text.ToUpperInvariant()))
  155. {
  156. //设置单元格禁用
  157. //rs[i].Cells["CHK"].Column.CellActivation = Infragistics.Win.UltraWinGrid.Activation.Disabled;
  158. }
  159. }
  160. queryDlivDirCoil("C");
  161. break;
  162. default:
  163. return;
  164. }
  165. }
  166. /// <summary>
  167. /// 确认装车操作
  168. /// </summary>
  169. private void DoComfirm()
  170. {
  171. if (DialogResult.Yes != MessageBox.Show("确认后不能进行排车操作,是否排车完毕?", "提示", MessageBoxButtons.YesNo))
  172. {
  173. return;
  174. }
  175. //用户名
  176. string regId = this.UserInfo.GetUserID();
  177. //超重是否继续装车标识
  178. bool top_wgt = false;
  179. //超数车辆数量
  180. int num_car = 0;
  181. Infragistics.Win.UltraWinGrid.RowsCollection rs = null;
  182. ArrayList list = new ArrayList();
  183. string[] param = null;
  184. CoreClientParam ccp = new CoreClientParam();
  185. ccp.ServerName = "UIJ.UIJ04.UIJ040020";
  186. switch (this.tabControl1.SelectedIndex)
  187. {
  188. case 0:
  189. break;
  190. case 1:
  191. rs = this.ultraGrid6.Rows;
  192. for (int i = 0; i < rs.Count; i++)
  193. {
  194. if (!"TRUE".Equals(rs[i].Cells["CHK"].Text.ToUpperInvariant()))
  195. {
  196. MessageBox.Show("第" + (i + 1) + "行的选择项没有选择,作为同一批次的车不同出现为空的现象!");
  197. return;
  198. }
  199. param = new string[7];
  200. param[0] = rs[i].Cells["ALLOC_SEQ"].Text.Trim();//排车顺序号
  201. param[1] = rs[i].Cells["TRANS_CAR_NO"].Text.Trim();//车厢号
  202. param[2] = rs[i].Cells["DLIV_DIRNO"].Text.Trim();//运输号
  203. param[3] = rs[i].Cells["SHIP_DIRNO"].Text.Trim();//发货指示号
  204. param[4] = rs[i].Cells["OLD_SAMPL_NO"].Text.Trim();//批次号
  205. param[5] = rs[i].Cells["COIL_NO"].Text.Trim();//钢卷号
  206. param[6] = rs[i].Cells["ACT_WGT"].Text.Trim();//钢卷重量
  207. list.Add(param);
  208. }
  209. ccp.MethodName = "saveDLIVDIRCAR";
  210. ccp.ServerParams = new Object[] { regId, list };
  211. this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  212. break;
  213. default:
  214. return;
  215. }
  216. }
  217. //汽车待装车计划
  218. private void label13_Click(object sender, EventArgs e)
  219. {
  220. string shipProgCd = "04";
  221. string fromDate = this.ultraDateTimeEditor1.DateTime.ToString("yyyyMMdd");
  222. string toDate = this.ultraDateTimeEditor2.DateTime.ToString("yyyyMMdd");
  223. string shipDirNo = this.textBox1.Text.Trim();
  224. string curProgCd = "SFB";
  225. string laneTp = "";
  226. string entranceSeq = "";
  227. string shipCompNm = 0 > this.ultraComboEditor1.SelectedIndex ? "" : this.ultraComboEditor1.SelectedItem.DataValue.ToString();
  228. string dlivTp = "C";
  229. this.dataSet2.Tables[0].Clear();
  230. CoreClientParam ccp = new CoreClientParam();
  231. ccp.ServerName = "UIJ.UIJ04.UIJ040020";
  232. ccp.MethodName = "queryTransPlan";
  233. ccp.SourceDataTable = this.dataSet2.Tables[0];
  234. ccp.ServerParams = new Object[] { shipProgCd, fromDate, toDate, shipDirNo, curProgCd, shipCompNm, dlivTp, laneTp, entranceSeq };
  235. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  236. DataRowCollection drs = dataSet2.Tables[0].Rows;
  237. for (int i = 0; i < drs.Count; i++)
  238. {
  239. ultraGrid4.Rows[i].Cells[0].Value = true;
  240. ultraGrid4.Rows[i].Cells[0].Column.CellActivation = Infragistics.Win.UltraWinGrid.Activation.Disabled;
  241. }
  242. queryDlivDirCoil(dlivTp);
  243. }
  244. /// <summary>
  245. /// 查询待装车钢卷 queryShipDir
  246. /// <param name="dlivTp"
  247. /// </summary>
  248. private void queryDlivDirCoil(string dlivTp)
  249. {
  250. if ("T".Equals(dlivTp.ToUpperInvariant()))
  251. {
  252. this.dataSet3.Tables[0].Clear();
  253. CoreClientParam ccp4 = new CoreClientParam();
  254. ccp4.ServerName = "UIJ.UIJ04.UIJ040020";
  255. ccp4.MethodName = "queryShipDir";
  256. ccp4.SourceDataTable = this.dataSet3.Tables[0];
  257. ccp4.ServerParams = new Object[] { dlivTp };
  258. this.ExecuteQueryToDataTable(ccp4, CoreInvokeType.Internal);
  259. DataRowCollection drs = dataSet3.Tables[0].Rows;
  260. for (int i = 0; i < drs.Count; i++)
  261. {
  262. ultraGrid2.Rows[i].Cells[0].Value = false;
  263. }
  264. }
  265. else
  266. {
  267. this.dataSet4.Tables[0].Clear();
  268. CoreClientParam ccp4 = new CoreClientParam();
  269. ccp4.ServerName = "UIJ.UIJ04.UIJ040020";
  270. ccp4.MethodName = "queryShipDir";
  271. ccp4.SourceDataTable = this.dataSet4.Tables[0];
  272. ccp4.ServerParams = new Object[] { dlivTp };
  273. this.ExecuteQueryToDataTable(ccp4, CoreInvokeType.Internal);
  274. DataRowCollection drs = dataSet4.Tables[0].Rows;
  275. for (int i = 0; i < drs.Count; i++)
  276. {
  277. ultraGrid6.Rows[i].Cells[0].Value = false;
  278. }
  279. }
  280. }
  281. /// <summary>
  282. /// 查询下达汽车排车计划时排车计划对应的钢卷信息 queryPlanCoil
  283. /// </summary>
  284. /// <param name="sender"></param>
  285. /// <param name="e"></param>
  286. private void ultraGrid6_DoubleClickRow(object sender, Infragistics.Win.UltraWinGrid.DoubleClickRowEventArgs e)
  287. {
  288. Infragistics.Win.UltraWinGrid.UltraGridRow uRow = this.ultraGrid6.ActiveRow;
  289. string dlivNo = uRow.Cells["DLIV_DIRNO"].Text.ToString().Trim();
  290. this.dataSet6.Tables[0].Clear();
  291. CoreClientParam ccp = new CoreClientParam();
  292. ccp.ServerName = "UIJ.UIJ04.UIJ040020";
  293. ccp.MethodName = "queryPlanCoil";
  294. ccp.SourceDataTable = this.dataSet6.Tables[0];
  295. ccp.ServerParams = new Object[] { dlivNo };
  296. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  297. }
  298. /// <summary>
  299. /// 取消火车待装车指示
  300. /// </summary>
  301. /// <param name="sender"></param>
  302. /// <param name="e"></param>
  303. private void label7_Click(object sender, EventArgs e)
  304. {
  305. Infragistics.Win.UltraWinGrid.RowsCollection rs = this.ultraGrid2.Rows;
  306. ArrayList list = new ArrayList();
  307. string[] param = null;
  308. for (int i = 0; i < rs.Count; i++)
  309. {
  310. if ("TRUE".Equals(rs[i].Cells["CHK"].Text.ToUpperInvariant()))
  311. {
  312. param = new string[2];
  313. param[0] = rs[i].Cells["DLIV_DIRNO"].Value.ToString().Trim();
  314. param[1] = rs[i].Cells["SHIP_DIRNO"].Value.ToString().Trim();
  315. bool flag = false;
  316. //去除重复的发运指示号
  317. foreach (string[] tmp in list)
  318. {
  319. if (param[0].Equals(tmp[0]) && param[1].Equals(tmp[1]))
  320. {
  321. flag = true;
  322. break;
  323. }
  324. }
  325. if (!flag)
  326. {
  327. list.Add(param);
  328. }
  329. }
  330. }
  331. if (DialogResult.Yes == MessageBox.Show("是否确认同一运输指示号(计划号)下的钢卷全部选择上?", "提示", MessageBoxButtons.YesNo))
  332. {
  333. CoreClientParam ccp = new CoreClientParam();
  334. ccp.ServerName = "UIJ.UIJ04.UIJ040020";
  335. ccp.MethodName = "returnSHIPDIRCAR";
  336. ccp.ServerParams = new Object[] { list };
  337. this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  338. dataSet3.Tables[0].Clear();
  339. dataSet5.Tables[0].Clear();
  340. this.DoQuery();
  341. }
  342. }
  343. /// <summary>
  344. /// 取消汽车待装车指示
  345. /// </summary>
  346. /// <param name="sender"></param>
  347. /// <param name="e"></param>
  348. private void label15_Click(object sender, EventArgs e)
  349. {
  350. Infragistics.Win.UltraWinGrid.RowsCollection rs = this.ultraGrid6.Rows;
  351. ArrayList list = new ArrayList();
  352. string[] param = null;
  353. for (int i = 0; i < rs.Count; i++)
  354. {
  355. if ("TRUE".Equals(rs[i].Cells["CHK"].Text.ToUpperInvariant()))
  356. {
  357. param = new string[2];
  358. param[0] = rs[i].Cells["DLIV_DIRNO"].Value.ToString().Trim();
  359. param[1] = rs[i].Cells["SHIP_DIRNO"].Value.ToString().Trim();
  360. bool flag = false;
  361. //去除重复的发运指示号
  362. foreach (string[] tmp in list)
  363. {
  364. if (param[0].Equals(tmp[0]) && param[1].Equals(tmp[1]))
  365. {
  366. flag = true;
  367. break;
  368. }
  369. }
  370. if (!flag)
  371. {
  372. list.Add(param);
  373. }
  374. }
  375. }
  376. if (DialogResult.Yes == MessageBox.Show("是否确认同一运输指示号(计划号)下的钢卷全部选择上?", "提示", MessageBoxButtons.YesNo))
  377. {
  378. CoreClientParam ccp = new CoreClientParam();
  379. ccp.ServerName = "UIJ.UIJ04.UIJ040020";
  380. ccp.MethodName = "returnSHIPDIRCAR";
  381. ccp.ServerParams = new Object[] { list };
  382. this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  383. dataSet4.Tables[0].Clear();
  384. dataSet6.Tables[0].Clear();
  385. this.DoQuery();
  386. }
  387. }
  388. /// <summary>
  389. /// 火车待装车计划
  390. /// </summary>
  391. /// <param name="sender"></param>
  392. /// <param name="e"></param>
  393. private void label10_Click(object sender, EventArgs e)
  394. {
  395. if (this.ultraComboEditor2.SelectedIndex < 0)
  396. {
  397. MessageBox.Show("火车入库道次不能为空,请选择相应的入库道次!");
  398. return;
  399. }
  400. if ("".Equals(this.textBox2.Text.Trim()))
  401. {
  402. MessageBox.Show("装车次数不能为空,请输入相应的装车次数信息!");
  403. return;
  404. }
  405. string shipProgCd = "04";
  406. string fromDate = this.ultraDateTimeEditor1.DateTime.ToString("yyyyMMdd");
  407. string toDate = this.ultraDateTimeEditor2.DateTime.ToString("yyyyMMdd");
  408. string shipDirNo = this.textBox1.Text.Trim();
  409. string curProgCd = "SFB";
  410. string laneTp = this.ultraComboEditor2.Value.ToString();
  411. string entranceSeq = this.textBox2.Text.Trim();
  412. string shipCompNm = 0 > this.ultraComboEditor1.SelectedIndex ? "" : this.ultraComboEditor1.SelectedItem.DataValue.ToString();
  413. string dlivTp = "T";
  414. this.dataSet1.Tables[0].Clear();
  415. CoreClientParam ccp = new CoreClientParam();
  416. ccp.ServerName = "UIJ.UIJ04.UIJ040020";
  417. ccp.MethodName = "queryTransPlan";
  418. ccp.SourceDataTable = this.dataSet1.Tables[0];
  419. ccp.ServerParams = new Object[] { shipProgCd, fromDate, toDate, shipDirNo, curProgCd, shipCompNm, dlivTp, laneTp, entranceSeq };
  420. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  421. DataRowCollection drs = dataSet1.Tables[0].Rows;
  422. for (int i = 0; i < drs.Count; i++)
  423. {
  424. ultraGrid2.Rows[i].Cells[0].Value = true;
  425. ultraGrid2.Rows[i].Cells[0].Column.CellActivation = Infragistics.Win.UltraWinGrid.Activation.Disabled;
  426. }
  427. queryDlivDirCoil(dlivTp);
  428. }
  429. /// <summary>
  430. /// 查询下达火车排车计划时排车计划对应的钢卷信息
  431. /// </summary>
  432. /// <param name="sender"></param>
  433. /// <param name="e"></param>
  434. private void ultraGrid2_DoubleClickRow(object sender, Infragistics.Win.UltraWinGrid.DoubleClickRowEventArgs e)
  435. {
  436. Infragistics.Win.UltraWinGrid.UltraGridRow uRow = this.ultraGrid2.ActiveRow;
  437. string dlivNo = uRow.Cells["DLIV_DIRNO"].Text.ToString().Trim();
  438. this.dataSet5.Tables[0].Clear();
  439. CoreClientParam ccp = new CoreClientParam();
  440. ccp.ServerName = "UIJ.UIJ04.UIJ040020";
  441. ccp.MethodName = "queryPlanCoil";
  442. ccp.SourceDataTable = this.dataSet5.Tables[0];
  443. ccp.ServerParams = new Object[] { dlivNo };
  444. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  445. }
  446. }
  447. }