FrmRunTimeRptZg.cs 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794
  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.Windows.Forms;
  9. using CoreFS.CA06;
  10. using Core.Mes.Client.Comm.Control;
  11. using Core.StlMes.Client.YdmPipeManage.Tool;
  12. using Core.Mes.Client.Comm.Tool;
  13. using Core.Mes.Client.Comm.Server;
  14. using System.Collections;
  15. using Core.StlMes.Client.YdmPipeManage;
  16. using Infragistics.Win;
  17. using Infragistics.Win.UltraWinGrid;
  18. using Core.StlMes.Client.YdmBase;
  19. namespace Core.StlMes.Client.YdmPipeReport
  20. {
  21. public partial class FrmRunTimeRptZg : FrmBase
  22. {
  23. public FrmRunTimeRptZg()
  24. {
  25. this.IsLoadUserView = true;
  26. InitializeComponent();
  27. }
  28. private Hashtable ShapeRelation = null;
  29. private string beglongCode = "";//部门ID
  30. private string[] arr = null;
  31. private void FrmRunTimeRptZg_Load(object sender, EventArgs e)
  32. {
  33. dtBathYear.Value = DateTime.Parse(DateTime.Now.ToString("yyyy-MM"));
  34. switch(this.CustomInfo)
  35. {
  36. case "STORAGE_NO":
  37. this.cmbStoreNo.Visible = true;
  38. this.ultraLabel1.Visible = true;
  39. BaseMethod.InitStorageCom(cmbStoreNo, dataTable3, this.ValidDataPurviewIds, this.ob);
  40. break;
  41. case "BELONG_CODE":
  42. this.cmbStoreNo.Visible = false;
  43. this.ultraLabel1.Visible = false;
  44. break;
  45. }
  46. }
  47. public override void ToolBar_Click(object sender, string ToolbarKey)
  48. {
  49. switch (ToolbarKey)
  50. {
  51. case"Query":
  52. queryData();
  53. break;
  54. case"Export":
  55. exportData();
  56. break;
  57. case "insertTal":
  58. insertTal();
  59. break;
  60. case"Close":
  61. this.Close();
  62. break;
  63. }
  64. }
  65. /// <summary>
  66. /// 结转
  67. /// </summary>
  68. private void insertInital()
  69. {
  70. UltraGridRow row = this.ultraGrid1.ActiveRow;
  71. string dtNowTim = DateTime.Now.ToString("yyyyMM");
  72. if (row == null || row.Index < 0)
  73. {
  74. MessageUtil.ShowWarning("无运行年月信息,无法结转!");
  75. return;
  76. }
  77. DataTable ds = ServerHelper.GetData("com.steering.pss.ydm.Report.FrmRunTimeRptZg.getIntalJZ", new object[] { dtNowTim}, ob);
  78. if (int.Parse(ds.Rows[0][0].ToString()) > 0)
  79. {
  80. MessageUtil.ShowTips("已存在结转数据,不允许重复结转!");
  81. return;
  82. }
  83. ArrayList parm = new ArrayList();
  84. if (MessageUtil.ShowYesNoAndQuestion("是否结转期初数据?") == DialogResult.No) return;
  85. try
  86. {
  87. this.Cursor = Cursors.WaitCursor; //控制鼠标的样式为等待
  88. if (Constant.WaitingForm == null)
  89. {
  90. Constant.WaitingForm = new WaitingForm();
  91. }
  92. Constant.WaitingForm.ShowToUser = true;
  93. Constant.WaitingForm.Show();
  94. Constant.WaitingForm.Update();
  95. foreach (UltraGridRow uRow in ultraGrid1.Rows)
  96. {
  97. //ArrayList ss = new ArrayList();
  98. //ss.Add(uRow.Cells["JUDGE_STOVE_NO"].Value.ToString());
  99. //ss.Add(uRow.Cells["BATCH_NO"].Value.ToString());
  100. //ss.Add(uRow.Cells["BATCH_GROUD_NO"].Value.ToString());
  101. //ss.Add(dtNowTim);
  102. //DataTable ds = ServerHelper.GetData("com.steering.pss.ydm.pipemanage.FrmPipeAdjust.selectYearMoth", new object[] { ss }, ob);
  103. //if (int.Parse(ds.Rows[0]["ACOUNT"].ToString()) > 0)
  104. //{
  105. // MessageUtil.ShowTips("此数据已进行结转转,不允许再次结转!");
  106. // return;
  107. //}
  108. ArrayList list = new ArrayList();
  109. list.Add(uRow.Cells["JUDGE_STOVE_NO"].Value.ToString());
  110. list.Add(uRow.Cells["BATCH_NO"].Value.ToString());
  111. list.Add(uRow.Cells["BATCH_GROUD_NO"].Value.ToString());
  112. list.Add(uRow.Cells["ACT_COUNT"].Value.ToString());
  113. list.Add(uRow.Cells["ACT_WEIGHT"].Value.ToString());
  114. list.Add(uRow.Cells["BAL_YEAR_MONTH"].Value.ToString());
  115. list.Add(this.UserInfo.GetUserName());
  116. list.Add(uRow.Cells["INITIAL_ID"].Value.ToString());
  117. list.Add(uRow.Cells["BELONG_CODE"].Value.ToString());
  118. list.Add(uRow.Cells["BELONG_NAME"].Value.ToString());
  119. parm.Add(list);
  120. }
  121. CoreClientParam ccp = new CoreClientParam();
  122. ccp.ServerName = "com.steering.pss.ydm.Report.FrmRunTimeRpt";
  123. ccp.MethodName = "insertInital";
  124. ccp.ServerParams = new object[] { parm };
  125. ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  126. if (ccp.ReturnCode != -1)
  127. {
  128. if (ccp.ReturnInfo.Equals("期初数据结转成功!"))
  129. {
  130. MessageUtil.ShowTips(ccp.ReturnInfo);
  131. }
  132. else
  133. {
  134. MessageUtil.ShowTips(ccp.ReturnInfo);
  135. }
  136. }
  137. this.Cursor = Cursors.Default;
  138. Constant.WaitingForm.ShowToUser = false;
  139. Constant.WaitingForm.Close();
  140. Constant.WaitingForm = null;
  141. }
  142. catch (Exception e)
  143. {
  144. this.Cursor = Cursors.Default;
  145. Constant.WaitingForm.ShowToUser = false;
  146. Constant.WaitingForm.Close();
  147. Constant.WaitingForm = null;
  148. }
  149. }
  150. private void SetStaticsInfoC()
  151. {
  152. try
  153. {
  154. if (this.ultraGrid1.Rows.Count == 0)
  155. {
  156. this.ultraGrid1.DisplayLayout.Bands[0].Summaries.Clear();
  157. }
  158. else
  159. {
  160. ArrayList alist = new ArrayList();
  161. alist.Add("ACT_COUNT");
  162. alist.Add("Act_Weight");
  163. CommonMethod.SetStaticsInfoSum(ref this.ultraGrid1, alist, true);
  164. }
  165. }
  166. catch { }
  167. }
  168. /// <summary>
  169. /// 结转期初数据
  170. /// </summary>
  171. private void insertTal()
  172. {
  173. string dtYear = this.dtBathYear.Value.ToString("yyyyMM");
  174. string dtNowTim = DateTime.Now.ToString("yyyyMM");
  175. if (!this.dtBathYear.Value.AddMonths(1).ToString("yyyyMM").Equals(dtNowTim))
  176. {
  177. MessageUtil.ShowTips("所选结转年月与当前所在月往后推一月不一致,请重新选择结转年月!");
  178. return;
  179. }
  180. UltraGridRow row = this.ultraGrid1.ActiveRow;
  181. if (row == null || row.Index < 0)
  182. {
  183. MessageUtil.ShowWarning("无库存信息,无法结转!");
  184. return;
  185. }
  186. string[] arr = new string[0];
  187. string departId = ClsBaseInfo.GetDepartIdBySectionId(this.UserInfo.GetDeptid(), this.ob);
  188. DataTable ds = new DataTable();
  189. switch (this.CustomInfo)
  190. {
  191. case "BELONG_CODE":
  192. ds = ServerHelper.GetData("com.steering.pss.ydm.Report.FrmRunTimeRptZg.getIntalJZB", new object[] { dtNowTim, departId }, ob);
  193. break;
  194. case "STORAGE_NO":
  195. List<string> arrlist = arr.ToList();
  196. IQueryable<UltraGridRow> checkMagRows = this.ultraGrid2.Rows.AsQueryable().Where(" CHK = 'True'");
  197. if (checkMagRows.Count() == 0)
  198. {
  199. MessageUtil.ShowTips("请选择对应的仓库!");
  200. return;
  201. }
  202. foreach (UltraGridRow uRow in checkMagRows)
  203. {
  204. arrlist.Add(uRow.Cells["STORAGE_NO"].Value.ToString());
  205. }
  206. arr = arrlist.ToArray();
  207. ds = ServerHelper.GetData("com.steering.pss.ydm.Report.FrmRunTimeRptZg.getIntalJZ", new object[] { dtNowTim, arr }, ob);
  208. break;
  209. }
  210. if (int.Parse(ds.Rows[0][0].ToString()) > 0)
  211. {
  212. MessageUtil.ShowTips("已存在结转数据,不允许重复结转!");
  213. return;
  214. }
  215. ArrayList parm = new ArrayList();
  216. if (MessageUtil.ShowYesNoAndQuestion("是否结转期初数据?") == DialogResult.No) return;
  217. try
  218. {
  219. this.Cursor = Cursors.WaitCursor; //控制鼠标的样式为等待
  220. if (Constant.WaitingForm == null)
  221. {
  222. Constant.WaitingForm = new WaitingForm();
  223. }
  224. Constant.WaitingForm.ShowToUser = true;
  225. Constant.WaitingForm.Show();
  226. Constant.WaitingForm.Update();
  227. foreach (UltraGridRow uRow in ultraGrid1.Rows)
  228. {
  229. if (int.Parse(uRow.Cells["END_COUNT"].Value.ToString()) > 0)
  230. {
  231. ArrayList list = new ArrayList();
  232. list.Add(uRow.Cells["JUDGE_STOVE_NO"].Value.ToString());
  233. list.Add(uRow.Cells["BATCH_NO"].Value.ToString());
  234. list.Add(uRow.Cells["BATCH_GROUD_NO"].Value.ToString());
  235. list.Add(uRow.Cells["END_COUNT"].Value.ToString());
  236. list.Add(uRow.Cells["END_AMOUNT"].Value.ToString());
  237. list.Add(this.dtBathYear.Value.AddMonths(1).ToString("yyyyMM"));
  238. list.Add(this.UserInfo.GetUserName());
  239. parm.Add(list);
  240. }
  241. }
  242. CoreClientParam ccp = new CoreClientParam();
  243. switch (this.CustomInfo)
  244. {
  245. case "BELONG_CODE":
  246. ccp.ServerName = "com.steering.pss.ydm.Report.FrmRunTimeRptZg";
  247. ccp.MethodName = "insertInitalBelog";
  248. ccp.ServerParams = new object[] { parm, departId, dtYear };
  249. break;
  250. case "STORAGE_NO":
  251. ccp.ServerName = "com.steering.pss.ydm.Report.FrmRunTimeRptZg";
  252. ccp.MethodName = "insertInital";
  253. ccp.ServerParams = new object[] { parm, arr, dtYear };
  254. break;
  255. }
  256. ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  257. if (ccp.ReturnCode != -1)
  258. {
  259. if (ccp.ReturnInfo.Equals("期初数据结转成功!"))
  260. {
  261. MessageUtil.ShowTips(ccp.ReturnInfo);
  262. }
  263. else
  264. {
  265. MessageUtil.ShowTips(ccp.ReturnInfo);
  266. }
  267. }
  268. this.Cursor = Cursors.Default;
  269. Constant.WaitingForm.ShowToUser = false;
  270. Constant.WaitingForm.Close();
  271. Constant.WaitingForm = null;
  272. }
  273. catch (Exception e)
  274. {
  275. this.Cursor = Cursors.Default;
  276. Constant.WaitingForm.ShowToUser = false;
  277. Constant.WaitingForm.Close();
  278. Constant.WaitingForm = null;
  279. }
  280. }
  281. /// <summary>
  282. /// 导出
  283. /// </summary>
  284. private void exportData()
  285. {
  286. GridHelper.ulGridToExcel(ultraGrid1, "炉批运行年月收发存汇总");
  287. }
  288. /// <summary>
  289. /// 查询
  290. /// </summary>
  291. private void queryData()
  292. {
  293. string yearMothTim = "";
  294. string stoveNo = "";
  295. arr = new string[0];
  296. switch (this.CustomInfo)
  297. {
  298. case "STORAGE_NO":
  299. List<string> arrlist = arr.ToList();
  300. IQueryable<UltraGridRow> checkMagRows = this.ultraGrid2.Rows.AsQueryable().Where(" CHK = 'True'");
  301. if (checkMagRows.Count() == 0)
  302. {
  303. MessageUtil.ShowTips("请选择对应的仓库!");
  304. return;
  305. }
  306. foreach (UltraGridRow uRow in checkMagRows)
  307. {
  308. arrlist.Add(uRow.Cells["STORAGE_NO"].Value.ToString());
  309. }
  310. arr = arrlist.ToArray();
  311. break;
  312. case "BELONG_CODE":
  313. beglongCode = ClsBaseInfo.GetDepartIdBySectionId(this.UserInfo.GetDeptid(), this.ob);
  314. break;
  315. }
  316. DataTable table1 = null;
  317. DataTable table2 = null;
  318. DataTable table3 = null;
  319. try
  320. {
  321. this.Cursor = Cursors.WaitCursor; //控制鼠标的样式为等待
  322. if (Constant.WaitingForm == null)
  323. {
  324. Constant.WaitingForm = new WaitingForm();
  325. }
  326. Constant.WaitingForm.ShowToUser = true;
  327. Constant.WaitingForm.Show();
  328. Constant.WaitingForm.Update();
  329. yearMothTim = this.dtBathYear.Value.ToString("yyyyMM");
  330. string strWhere1 = "", strWhere2 = "", strWhere3 = "", strWhere4 = "";
  331. switch(this.CustomInfo)
  332. {
  333. case "STORAGE_NO":
  334. //上期期初
  335. if (!this.GetOriginalLast(yearMothTim, strWhere1, out table1, arr))
  336. {
  337. }
  338. //本期入库量
  339. if (!this.GetThisIn(yearMothTim, strWhere1, out table2, arr))
  340. {
  341. //return;
  342. }
  343. //本期出库量
  344. if (!this.GetThisOut(yearMothTim, strWhere1, out table3, arr))
  345. {
  346. //return;
  347. }
  348. break;
  349. case "BELONG_CODE":
  350. //上期期初
  351. if (!this.GetOriginalLastB(yearMothTim, strWhere1, out table1, beglongCode))
  352. {
  353. }
  354. //本期入库量
  355. if (!this.GetThisInB(yearMothTim, strWhere1, out table2, beglongCode))
  356. {
  357. //return;
  358. }
  359. //本期出库量
  360. if (!this.GetThisOutB(yearMothTim, strWhere1, out table3, beglongCode))
  361. {
  362. //return;
  363. }
  364. break;
  365. }
  366. //调差
  367. //DataTable table4 = null;
  368. //if (!this.GetAdjust(yearMothTim, strWhere1, out table4, arr))
  369. //{
  370. //}
  371. DataTable table = new DataTable();
  372. string[] strMergeColumns = new string[] { "JUDGE_STOVE_NO", "BATCH_NO", "BATCH_GROUD_NO" };
  373. if (table1 != null)
  374. {
  375. table = table1.DefaultView.ToTable(true, strMergeColumns);
  376. if (table2 != null)
  377. {
  378. table.Merge(table2.DefaultView.ToTable(true, strMergeColumns));
  379. }
  380. if (table3 != null)
  381. {
  382. table.Merge(table3.DefaultView.ToTable(true, strMergeColumns));
  383. }
  384. }
  385. else
  386. {
  387. if (table2 != null)
  388. {
  389. table = table2.DefaultView.ToTable(true, strMergeColumns);
  390. if (table3 != null)
  391. {
  392. table.Merge(table3.DefaultView.ToTable(true, strMergeColumns));
  393. }
  394. }
  395. else
  396. {
  397. if (table3 != null)
  398. {
  399. table = table3.DefaultView.ToTable(true, strMergeColumns);
  400. //if (table4 != null)
  401. //{
  402. // table.Merge(table4.DefaultView.ToTable(true, strMergeColumns));
  403. //}
  404. }
  405. //else
  406. //{
  407. // if (table4 != null)
  408. // {
  409. // table = table4.DefaultView.ToTable(true, strMergeColumns);
  410. // }
  411. //}
  412. }
  413. }
  414. if (table != null)
  415. {
  416. table.DefaultView.Sort = "JUDGE_STOVE_NO, BATCH_NO, BATCH_GROUD_NO";
  417. table = table.DefaultView.ToTable(true, strMergeColumns);
  418. }
  419. else
  420. {
  421. return;
  422. }
  423. string strSort = "", strHeatNo = "", strBactchNo = "", strGroupNo = "";
  424. DataRow newrow;
  425. DataRow[] rows;
  426. this.dataTable1.Rows.Clear();
  427. decimal dWgt = 0.0M,dAjust = 0.0M;
  428. int dCount = 0;
  429. decimal dThisIn_Month = 0.0M, dThisOut_Month = 0.00M;
  430. int dThisIn_MonthCount = 0, dThisOut_MonthCount = 0;
  431. string strRowFilters = "";
  432. for (int i = 0; i < table.Rows.Count; i++)
  433. {
  434. newrow = this.dataTable1.NewRow();
  435. try
  436. {
  437. strHeatNo = Convert.ToString(table.Rows[i]["JUDGE_STOVE_NO"]);//炉号
  438. strBactchNo = Convert.ToString(table.Rows[i]["BATCH_NO"]);//批号
  439. strGroupNo = Convert.ToString(table.Rows[i]["BATCH_GROUD_NO"]);//组号
  440. strRowFilters = string.IsNullOrEmpty(strHeatNo) ? " JUDGE_STOVE_NO is null " : " JUDGE_STOVE_NO = '" + strHeatNo + "' ";
  441. strRowFilters += string.IsNullOrEmpty(strBactchNo) ? " and BATCH_NO is null " : " and BATCH_NO = '" + strBactchNo + "' ";
  442. strRowFilters += string.IsNullOrEmpty(strGroupNo) ? " and BATCH_GROUD_NO is null " : " and BATCH_GROUD_NO = '" + strGroupNo + "' ";
  443. try
  444. {
  445. table1.CaseSensitive = true;
  446. rows = table1.Select(strRowFilters);
  447. if (rows.Length > 0)
  448. {
  449. try
  450. {
  451. dWgt = decimal.Parse(Convert.ToString(rows[0]["WEIGHT"]));
  452. dCount = int.Parse(Convert.ToString(rows[0]["COUNT"]));
  453. }
  454. catch
  455. {
  456. dWgt = 0.0M;
  457. dCount = 0;
  458. }
  459. }
  460. else
  461. {
  462. dWgt = 0.0M;
  463. dCount = 0;
  464. }
  465. }
  466. catch
  467. {
  468. dWgt = 0.0M;
  469. dCount = 0;
  470. }
  471. try
  472. {
  473. table2.CaseSensitive = true;
  474. rows = table2.Select(strRowFilters);
  475. if (rows.Length > 0)
  476. {
  477. try
  478. {
  479. dThisIn_Month = decimal.Parse(Convert.ToString(rows[0]["WEIGHT_MONTH"]));
  480. dThisIn_MonthCount = int.Parse(Convert.ToString(rows[0]["WEIGHT_MONTHCOUNT"]));
  481. }
  482. catch
  483. {
  484. dThisIn_Month = 0.0M;
  485. dThisIn_MonthCount = 0;
  486. }
  487. }
  488. else
  489. {
  490. dThisIn_Month = 0.0M;
  491. dThisIn_MonthCount = 0;
  492. }
  493. }
  494. catch
  495. {
  496. dThisIn_Month = 0.0M;
  497. dThisIn_MonthCount = 0;
  498. }
  499. try
  500. {
  501. table3.CaseSensitive = true;
  502. rows = table3.Select(strRowFilters);
  503. if (rows.Length > 0)
  504. {
  505. try
  506. {
  507. dThisOut_Month = decimal.Parse(Convert.ToString(rows[0]["WEIGHT_MONTH"]));
  508. dThisOut_MonthCount = int.Parse(Convert.ToString(rows[0]["weight_monthcount"]));
  509. }
  510. catch
  511. {
  512. dThisOut_Month = 0.0M;
  513. dThisOut_MonthCount = 0;
  514. }
  515. }
  516. else
  517. {
  518. dThisOut_Month = 0.0M;
  519. dThisOut_MonthCount = 0;
  520. }
  521. }
  522. catch
  523. {
  524. dThisOut_Month = 0.0M;
  525. dThisOut_MonthCount = 0;
  526. }
  527. //try
  528. //{
  529. // table4.CaseSensitive = true;
  530. // rows = table4.Select(strRowFilters);
  531. // if (rows.Length > 0)
  532. // {
  533. // try
  534. // {
  535. // dAjust = decimal.Parse(Convert.ToString(rows[0]["AWEIGHT"]));
  536. // }
  537. // catch
  538. // {
  539. // dAjust = 0.0M;
  540. // }
  541. // }
  542. // else
  543. // {
  544. // dAjust = 0.0M;
  545. // }
  546. //}
  547. //catch
  548. //{
  549. // dAjust = 0.0M;
  550. //}
  551. try
  552. {
  553. newrow["JUDGE_STOVE_NO"] = strHeatNo;
  554. newrow["BATCH_NO"] = strBactchNo;
  555. newrow["BATCH_GROUD_NO"] = strGroupNo;
  556. newrow["ORIGINAL_AMOUNT"] = Convert.ToString(dWgt).Trim();
  557. newrow["ORIGINAL_COUNT"] = Convert.ToString(dCount).Trim();
  558. newrow["MONTH_1"] = dThisIn_Month.ToString().Trim();
  559. newrow["MONTH_1COUNT"] = dThisIn_MonthCount.ToString().Trim();
  560. newrow["MONTH_2"] = dThisOut_Month.ToString().Trim();
  561. newrow["MONTH_2COUNT"] = dThisOut_MonthCount.ToString().Trim();
  562. newrow["END_AMOUNT"] = Convert.ToString(dWgt + dThisIn_Month - dThisOut_Month + dAjust).Trim();
  563. newrow["END_COUNT"] = Convert.ToString(dCount + dThisIn_MonthCount - dThisOut_MonthCount).Trim();
  564. newrow["AWEIGHT"] = Convert.ToString(dAjust).Trim();
  565. try
  566. {
  567. if (ShapeRelation.Contains(strHeatNo))
  568. {
  569. strSort = ShapeRelation[strHeatNo].ToString();
  570. }
  571. else
  572. {
  573. strSort = "";
  574. }
  575. }
  576. catch
  577. {
  578. strSort = "";
  579. }
  580. this.dataSet1.Tables[0].Rows.Add(newrow);
  581. } catch { }
  582. }
  583. catch { }
  584. }
  585. this.SetStaticsInfo();
  586. CommonMethod.SetGridSumArea(this.ultraGrid1);
  587. this.Cursor = Cursors.Default;
  588. Constant.WaitingForm.ShowToUser = false;
  589. Constant.WaitingForm.Close();
  590. Constant.WaitingForm = null;
  591. }
  592. catch (Exception e)
  593. {
  594. this.Cursor = Cursors.Default;
  595. Constant.WaitingForm.ShowToUser = false;
  596. Constant.WaitingForm.Close();
  597. Constant.WaitingForm = null;
  598. }
  599. }
  600. private void SetStaticsInfo()
  601. {
  602. try
  603. {
  604. if (this.ultraGrid1.Rows.Count == 0)
  605. {
  606. this.ultraGrid1.DisplayLayout.Bands[0].Summaries.Clear();
  607. }
  608. else
  609. {
  610. ArrayList alist = new ArrayList();
  611. alist.Add("ORIGINAL_AMOUNT");
  612. alist.Add("ORIGINAL_COUNT");
  613. alist.Add("MONTH_1");
  614. alist.Add("MONTH_1COUNT");
  615. alist.Add("MONTH_2");
  616. alist.Add("MONTH_2COUNT");
  617. alist.Add("END_AMOUNT");
  618. alist.Add("END_COUNT");
  619. alist.Add("AWEIGHT");
  620. CommonMethod.SetStaticsInfoSum(ref this.ultraGrid1, alist, true);
  621. }
  622. }
  623. catch { }
  624. }
  625. //本期出库量
  626. private bool GetThisOut(string yearMothTim, string strWhere, out DataTable table, string[] arr)
  627. {
  628. table = null;
  629. DataSet set = new DataSet();
  630. DataTable ds = ServerHelper.GetData("com.steering.pss.ydm.Report.FrmRunTimeRptZg.getThisOut", new object[] { yearMothTim, strWhere, arr }, this.ob);
  631. if (ds != null && ds.Rows.Count > 0)
  632. {
  633. set.Tables.Add(ds);
  634. table = set.Tables[0];
  635. return true;
  636. }
  637. return false;
  638. }
  639. //本期出库量
  640. private bool GetThisOutB(string yearMothTim, string strWhere, out DataTable table, string belogCode)
  641. {
  642. table = null;
  643. DataSet set = new DataSet();
  644. DataTable ds = ServerHelper.GetData("com.steering.pss.ydm.Report.FrmRunTimeRptZg.getThisOutB", new object[] { yearMothTim, strWhere, belogCode }, this.ob);
  645. if (ds != null && ds.Rows.Count > 0)
  646. {
  647. set.Tables.Add(ds);
  648. table = set.Tables[0];
  649. return true;
  650. }
  651. return false;
  652. }
  653. //本期入库量
  654. private bool GetThisIn(string yearMothTim,string strWhere, out DataTable table, string[] arr)
  655. {
  656. table = null;
  657. DataSet set = new DataSet();
  658. DataTable ds = ServerHelper.GetData("com.steering.pss.ydm.Report.FrmRunTimeRptZg.getThisIn", new object[] { yearMothTim, strWhere, arr }, this.ob);
  659. if (ds != null && ds.Rows.Count > 0)
  660. {
  661. set.Tables.Add(ds);
  662. table = set.Tables[0];
  663. return true;
  664. }
  665. return false;
  666. }
  667. private bool GetThisInB(string yearMothTim, string strWhere, out DataTable table, string belogCode)
  668. {
  669. table = null;
  670. DataSet set = new DataSet();
  671. DataTable ds = ServerHelper.GetData("com.steering.pss.ydm.Report.FrmRunTimeRptZg.getThisInB", new object[] { yearMothTim, strWhere, belogCode }, this.ob);
  672. if (ds != null && ds.Rows.Count > 0)
  673. {
  674. set.Tables.Add(ds);
  675. table = set.Tables[0];
  676. return true;
  677. }
  678. return false;
  679. }
  680. //期初
  681. private bool GetOriginalLast(string yearMothTim, string strWhere, out DataTable table, string[] arr)
  682. {
  683. table = null;
  684. DataSet set = new DataSet();
  685. DataTable ds = ServerHelper.GetData("com.steering.pss.ydm.Report.FrmRunTimeRptZg.getOriginalLast", new object[] { yearMothTim, strWhere, arr }, this.ob);
  686. if (ds != null && ds.Rows.Count > 0)
  687. {
  688. set.Tables.Add(ds);
  689. table = set.Tables[0];
  690. return true;
  691. }
  692. return false;
  693. }
  694. //期初(所属权)
  695. private bool GetOriginalLastB(string yearMothTim, string strWhere, out DataTable table, string belogCode)
  696. {
  697. table = null;
  698. DataSet set = new DataSet();
  699. DataTable ds = ServerHelper.GetData("com.steering.pss.ydm.Report.FrmRunTimeRptZg.getOriginalLastB", new object[] { yearMothTim, strWhere, belogCode }, this.ob);
  700. if (ds != null && ds.Rows.Count > 0)
  701. {
  702. set.Tables.Add(ds);
  703. table = set.Tables[0];
  704. return true;
  705. }
  706. return false;
  707. }
  708. private void ultraPopupControlContainer1_Closed(object sender, EventArgs e)
  709. {
  710. this.ultraLabel3.Text = "";
  711. foreach (UltraGridRow uRow in this.ultraGrid2.Rows)
  712. {
  713. if (uRow.Cells["CHK"].Value.ToString() == "True")
  714. {
  715. this.ultraLabel3.Text += uRow.Cells["STORAGE_NAME"].Text + " ";
  716. }
  717. }
  718. }
  719. private void cmbStoreNo_AfterDropDown(object sender, EventArgs e)
  720. {
  721. Point p = ultraGroupBox1.PointToScreen(cmbStoreNo.Location);
  722. p.Y += 22;
  723. this.ultraPopupControlContainer1.Show(p);
  724. }
  725. }
  726. }