b6512e57c9e5c07e996bdf3d6b295c037dd401fc.svn-base 39 KB

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