FrmRunTimeRptCw.cs 37 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886
  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 FrmRunTimeRptCw : FrmBase
  22. {
  23. public FrmRunTimeRptCw()
  24. {
  25. this.IsLoadUserView = true;
  26. InitializeComponent();
  27. }
  28. private Hashtable ShapeRelation = null;
  29. private void FrmRunTimeRptCw_Load(object sender, EventArgs e)
  30. {
  31. dtBathYear.Value = DateTime.Parse(DateTime.Now.ToString("yyyy-MM"));
  32. YdmBaseClass.InitComboEditor(cmbStoreNo, "com.steering.pss.ydm.pipemanage.CorePipeInTemp.getStorageDetail", "STORAGE_NO", this.ob, false);
  33. }
  34. public override void ToolBar_Click(object sender, string ToolbarKey)
  35. {
  36. switch (ToolbarKey)
  37. {
  38. case"Query":
  39. queryData1();
  40. break;
  41. case"Query1":
  42. queryTal();
  43. break;
  44. case"Export":
  45. exportData();
  46. break;
  47. case "insertTal":
  48. insertTal();
  49. break;
  50. case "insertInital":
  51. insertInital();
  52. break;
  53. case"Close":
  54. this.Close();
  55. break;
  56. }
  57. }
  58. /// <summary>
  59. /// 结转
  60. /// </summary>
  61. private void insertInital()
  62. {
  63. UltraGridRow row = this.ultraGrid1.ActiveRow;
  64. string dtNowTim = DateTime.Now.AddMonths(1).ToString("yyyyMM");
  65. //if (row == null || row.Index < 0)
  66. //{
  67. // MessageUtil.ShowWarning("期初中转信息,无法结转!");
  68. // return;
  69. //}
  70. string[] arr = BaseMethod.InitPermissions(this.ValidDataPurviewIds, ob);
  71. //DataTable ds = ServerHelper.GetData("com.steering.pss.ydm.Report.FrmRunTimeRptCw.getIntalJZ", new object[] { dtNowTim, arr, this.CustomInfo }, ob);
  72. //if (int.Parse(ds.Rows[0][0].ToString()) > 0)
  73. //{
  74. // MessageUtil.ShowTips("已存在结转数据,不允许重复结转!");
  75. // return;
  76. //}
  77. ArrayList parm = new ArrayList();
  78. if (MessageUtil.ShowYesNoAndQuestion("是否结转期初数据?") == DialogResult.No) return;
  79. try
  80. {
  81. this.Cursor = Cursors.WaitCursor; //控制鼠标的样式为等待
  82. if (Constant.WaitingForm == null)
  83. {
  84. Constant.WaitingForm = new WaitingForm();
  85. }
  86. Constant.WaitingForm.ShowToUser = true;
  87. Constant.WaitingForm.Show();
  88. Constant.WaitingForm.Update();
  89. foreach (UltraGridRow uRow in ultraGrid1.Rows)
  90. {
  91. if (int.Parse(uRow.Cells["END_COUNT"].Text) > 0)
  92. {
  93. ArrayList list = new ArrayList();
  94. list.Add(uRow.Cells["JUDGE_STOVE_NO"].Value.ToString());
  95. list.Add(uRow.Cells["BATCH_NO"].Value.ToString());
  96. list.Add(uRow.Cells["BATCH_GROUD_NO"].Value.ToString());
  97. list.Add(uRow.Cells["END_COUNT"].Value.ToString());//支数
  98. list.Add(uRow.Cells["END_AMOUNT"].Value.ToString());//重量
  99. list.Add(uRow.Cells["PRODUCNAME"].Value.ToString());
  100. list.Add(uRow.Cells["STD_STYLE_DESC"].Value.ToString());
  101. list.Add(uRow.Cells["STEELNAME"].Value.ToString());
  102. list.Add(uRow.Cells["SPEC_NAME"].Value.ToString());
  103. list.Add(uRow.Cells["MODEL_DESC"].Value.ToString());
  104. list.Add(dtNowTim);
  105. list.Add(this.UserInfo.GetUserName());
  106. list.Add(uRow.Cells["BELONG_CODE"].Value.ToString());
  107. parm.Add(list);
  108. }
  109. }
  110. CoreClientParam ccp = new CoreClientParam();
  111. ccp.ServerName = "com.steering.pss.ydm.Report.FrmRunTimeRptCw";
  112. ccp.MethodName = "insertInital";
  113. ccp.ServerParams = new object[] { parm,this.dtBathYear.Value.ToString("yyyyMM"),arr,this.CustomInfo };
  114. ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  115. if (ccp.ReturnCode != -1)
  116. {
  117. if (ccp.ReturnInfo.Equals("期初数据结转成功!"))
  118. {
  119. MessageUtil.ShowTips(ccp.ReturnInfo);
  120. }
  121. else
  122. {
  123. MessageUtil.ShowTips(ccp.ReturnInfo);
  124. }
  125. }
  126. this.Cursor = Cursors.Default;
  127. Constant.WaitingForm.ShowToUser = false;
  128. Constant.WaitingForm.Close();
  129. Constant.WaitingForm = null;
  130. }
  131. catch (Exception e)
  132. {
  133. this.Cursor = Cursors.Default;
  134. Constant.WaitingForm.ShowToUser = false;
  135. Constant.WaitingForm.Close();
  136. Constant.WaitingForm = null;
  137. }
  138. }
  139. /// <summary>
  140. /// 查询中转过去的数据
  141. /// </summary>
  142. private void queryTal()
  143. {
  144. string yearMoth = this.dtBathYear.Value.ToString("yyyyMM");
  145. string heatNo = "";
  146. if (chkStove.Checked && string.IsNullOrEmpty(this.cmbStoveNo.Text.Trim()))
  147. {
  148. MessageUtil.ShowTips("请输入炉号!");
  149. this.cmbStoveNo.Focus();
  150. return;
  151. }
  152. if (chkStove.Checked)
  153. {
  154. heatNo = this.cmbStoveNo.Text.Trim();
  155. }
  156. string[] arr = BaseMethod.InitPermissions(this.ValidDataPurviewIds, ob);
  157. try {
  158. this.Cursor = Cursors.WaitCursor; //控制鼠标的样式为等待
  159. if (Constant.WaitingForm == null)
  160. {
  161. Constant.WaitingForm = new WaitingForm();
  162. }
  163. Constant.WaitingForm.ShowToUser = true;
  164. Constant.WaitingForm.Show();
  165. Constant.WaitingForm.Update();
  166. DataTable dt = ServerHelper.GetData("com.steering.pss.ydm.Report.FrmRunTimeRptCw.getTal", new object[] { yearMoth, heatNo, arr}, ob);
  167. GridHelper.CopyDataToDatatable(ref dt, ref dataTable2, true);
  168. this.SetStaticsInfoC();
  169. //CommonMethod.SetGridSumArea(this.ultraGrid2);
  170. this.Cursor = Cursors.Default;
  171. Constant.WaitingForm.ShowToUser = false;
  172. Constant.WaitingForm.Close();
  173. Constant.WaitingForm = null;
  174. }catch(Exception e)
  175. {
  176. this.Cursor = Cursors.Default;
  177. Constant.WaitingForm.ShowToUser = false;
  178. Constant.WaitingForm.Close();
  179. Constant.WaitingForm = null;
  180. }
  181. }
  182. private void SetStaticsInfoC()
  183. {
  184. //try
  185. //{
  186. // if (this.ultraGrid2.Rows.Count == 0)
  187. // {
  188. // this.ultraGrid2.DisplayLayout.Bands[0].Summaries.Clear();
  189. // }
  190. // else
  191. // {
  192. // ArrayList alist = new ArrayList();
  193. // alist.Add("ACT_COUNT");
  194. // alist.Add("Act_Weight");
  195. // CommonMethod.SetStaticsInfoSum(ref this.ultraGrid2, alist, true);
  196. // }
  197. //}
  198. //catch { }
  199. }
  200. /// <summary>
  201. /// 插入中转数据
  202. /// </summary>
  203. private void insertTal()
  204. {
  205. string dtYear = this.dtBathYear.Value.ToString("yyyyMM");
  206. string dtNowTim = DateTime.Now.ToString("yyyyMM");
  207. if (!this.dtBathYear.Value.AddMonths(1).ToString("yyyyMM").Equals(dtNowTim))
  208. {
  209. MessageUtil.ShowTips("所选结转年月与当前所在月往后推一月不一致,请重新选择结转年月!");
  210. return;
  211. }
  212. string[] arr = BaseMethod.InitPermissions(this.ValidDataPurviewIds, ob);
  213. DataTable ds = doQueryTalCount(arr);
  214. if (int.Parse(ds.Rows[0]["ACOUNT"].ToString()) > 0)
  215. {
  216. MessageUtil.ShowTips("已存在当前年月的中转数据了,不允许再进行中转!");
  217. return;
  218. }
  219. UltraGridRow row = this.ultraGrid1.ActiveRow;
  220. if (row == null || row.Index < 0)
  221. {
  222. MessageUtil.ShowWarning("无库存信息,无法中转!");
  223. return;
  224. }
  225. ArrayList parm = new ArrayList();
  226. if (MessageUtil.ShowYesNoAndQuestion("是否中转期初数据?") == DialogResult.No) return;
  227. try
  228. {
  229. this.Cursor = Cursors.WaitCursor; //控制鼠标的样式为等待
  230. if (Constant.WaitingForm == null)
  231. {
  232. Constant.WaitingForm = new WaitingForm();
  233. }
  234. Constant.WaitingForm.ShowToUser = true;
  235. Constant.WaitingForm.Show();
  236. Constant.WaitingForm.Update();
  237. foreach (UltraGridRow uRow in ultraGrid1.Rows)
  238. {
  239. //ArrayList ss = new ArrayList();
  240. //ss.Add(uRow.Cells["JUDGE_STOVE_NO"].Value.ToString());
  241. //ss.Add(uRow.Cells["BATCH_NO"].Value.ToString());
  242. //ss.Add(uRow.Cells["BATCH_GROUD_NO"].Value.ToString());
  243. //ss.Add(dtNowTim);
  244. //DataTable ds = ServerHelper.GetData("com.steering.pss.ydm.Report.FrmRunTimeRptCw.getIntal", new object[] { ss }, ob);
  245. //if (int.Parse(ds.Rows[0]["ACOUNT"].ToString()) > 0)
  246. //{
  247. // MessageUtil.ShowTips("此数据已进行中转,不允许再次中转!");
  248. // return;
  249. //}
  250. if (int.Parse(uRow.Cells["END_COUNT"].Value.ToString()) > 0)
  251. {
  252. ArrayList list = new ArrayList();
  253. list.Add(uRow.Cells["JUDGE_STOVE_NO"].Value.ToString());
  254. list.Add(uRow.Cells["BATCH_NO"].Value.ToString());
  255. list.Add(uRow.Cells["BATCH_GROUD_NO"].Value.ToString());
  256. list.Add(uRow.Cells["END_COUNT"].Value.ToString());
  257. list.Add(uRow.Cells["END_AMOUNT"].Value.ToString());
  258. list.Add(this.dtBathYear.Value.AddMonths(1).ToString("yyyyMM"));
  259. parm.Add(list);
  260. }
  261. }
  262. CoreClientParam ccp = new CoreClientParam();
  263. ccp.ServerName = "com.steering.pss.ydm.Report.FrmRunTimeRptCw";
  264. ccp.MethodName = "insertTal";
  265. ccp.ServerParams = new object[] { parm, arr };
  266. ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  267. if (ccp.ReturnCode != -1)
  268. {
  269. if (ccp.ReturnInfo.Equals("期初数据中转成功!"))
  270. {
  271. MessageUtil.ShowTips(ccp.ReturnInfo);
  272. }
  273. else
  274. {
  275. MessageUtil.ShowTips(ccp.ReturnInfo);
  276. }
  277. }
  278. this.Cursor = Cursors.Default;
  279. Constant.WaitingForm.ShowToUser = false;
  280. Constant.WaitingForm.Close();
  281. Constant.WaitingForm = null;
  282. }
  283. catch (Exception e)
  284. {
  285. this.Cursor = Cursors.Default;
  286. Constant.WaitingForm.ShowToUser = false;
  287. Constant.WaitingForm.Close();
  288. Constant.WaitingForm = null;
  289. }
  290. }
  291. /// <summary>
  292. /// 查询是否存在中转数据
  293. /// </summary>
  294. private DataTable doQueryTalCount(string[] arr)
  295. {
  296. DataTable ds = ServerHelper.GetData("com.steering.pss.ydm.Report.FrmRunTimeRptCw.doQueryTail", new object[] { DateTime.Now.ToString("yyyyMM"), arr }, ob);
  297. return ds;
  298. }
  299. /// <summary>
  300. /// 导出
  301. /// </summary>
  302. private void exportData()
  303. {
  304. GridHelper.ulGridToExcel(ultraGrid1, "出库结算收发存汇总");
  305. }
  306. /// <summary>
  307. /// 查询
  308. /// </summary>
  309. private void queryData1()
  310. {
  311. string yearMothTim = "";
  312. string[] arr = BaseMethod.InitPermissions(this.ValidDataPurviewIds, ob);
  313. try
  314. {
  315. this.Cursor = Cursors.WaitCursor; //控制鼠标的样式为等待
  316. if (Constant.WaitingForm == null)
  317. {
  318. Constant.WaitingForm = new WaitingForm();
  319. }
  320. Constant.WaitingForm.ShowToUser = true;
  321. Constant.WaitingForm.Show();
  322. Constant.WaitingForm.Update();
  323. yearMothTim = this.dtBathYear.Value.ToString("yyyyMM");
  324. string supplyUnit = this.CustomInfo;
  325. DataTable dt = ServerHelper.GetData("com.steering.pss.ydm.Report.FrmRunTimeRptCw.getQueryData1", new object[] { yearMothTim, arr, supplyUnit }, ob);
  326. GridHelper.CopyDataToDatatable(ref dt, ref this.dataTable1, true);
  327. this.SetStaticsInfo();
  328. CommonMethod.SetGridSumArea(this.ultraGrid1);
  329. this.Cursor = Cursors.Default;
  330. Constant.WaitingForm.ShowToUser = false;
  331. Constant.WaitingForm.Close();
  332. Constant.WaitingForm = null;
  333. }
  334. catch (Exception e)
  335. {
  336. this.Cursor = Cursors.Default;
  337. Constant.WaitingForm.ShowToUser = false;
  338. Constant.WaitingForm.Close();
  339. Constant.WaitingForm = null;
  340. }
  341. }
  342. /// <summary>
  343. /// 查询
  344. /// </summary>
  345. private void queryData()
  346. {
  347. string yearMothTim = "";
  348. string stoveNo = "";
  349. string[] arr = BaseMethod.InitPermissions(this.ValidDataPurviewIds, ob);
  350. if (chkStove.Checked && string.IsNullOrEmpty(this.cmbStoveNo.Text.Trim()))
  351. {
  352. MessageUtil.ShowTips("请输入炉号!");
  353. this.cmbStoveNo.Focus();
  354. return;
  355. }
  356. try
  357. {
  358. this.Cursor = Cursors.WaitCursor; //控制鼠标的样式为等待
  359. if (Constant.WaitingForm == null)
  360. {
  361. Constant.WaitingForm = new WaitingForm();
  362. }
  363. Constant.WaitingForm.ShowToUser = true;
  364. Constant.WaitingForm.Show();
  365. Constant.WaitingForm.Update();
  366. yearMothTim = this.dtBathYear.Value.ToString("yyyyMM");
  367. string strWhere1 = "", strWhere2 = "", strWhere3 = "", strWhere4 = "";
  368. if (this.chkStove.Checked)
  369. {
  370. strWhere1 += " and t.JUDGE_STOVE_NO like '%'||'" + this.cmbStoveNo.Value.ToString() + "'||'%'";
  371. strWhere2 += " and t.JUDGE_STOVE_NO like '%'||'" + this.cmbStoveNo.Value.ToString() + "'||'%'";
  372. strWhere3 += " and t.JUDGE_STOVE_NO like '%'||'" + this.cmbStoveNo.Value.ToString() + "'||'%'";
  373. strWhere4 += " and s.JUDGE_STOVE_NO like '%'||'" + this.cmbStoveNo.Value.ToString() + "'||'%'";
  374. }
  375. if (chkStoreNo.Checked)
  376. {
  377. strWhere1 += " and t.STORAGE_NO like '%'||'" + this.cmbStoreNo.Value.ToString() + "'||'%'";
  378. strWhere2 += " and t.STORAGE_NO like '%'||'" + this.cmbStoreNo.Value.ToString() + "'||'%'";
  379. strWhere3 += " and t.STORAGE_NO like '%'||'" + this.cmbStoreNo.Value.ToString() + "'||'%'";
  380. strWhere4 += " and s.STORAGE_NO like '%'||'" + this.cmbStoreNo.Value.ToString() + "'||'%'";
  381. }
  382. //上期期初
  383. DataTable table1 = null;
  384. if (!this.GetOriginalLast(yearMothTim, strWhere1, out table1, arr))
  385. {
  386. }
  387. //本期入库量
  388. DataTable table2 = null;
  389. if (!this.GetThisIn(yearMothTim, strWhere1, out table2, arr))
  390. {
  391. //return;
  392. }
  393. //本期出库量
  394. DataTable table3 = null;
  395. if (!this.GetThisOut(yearMothTim, strWhere1, out table3, arr))
  396. {
  397. //return;
  398. }
  399. //调差
  400. DataTable table4 = null;
  401. if (!this.GetAdjust(yearMothTim, strWhere1, out table4, arr))
  402. {
  403. }
  404. DataTable table = new DataTable();
  405. string[] strMergeColumns = new string[] { "JUDGE_STOVE_NO", "BATCH_NO", "BATCH_GROUD_NO" };
  406. if (table1 != null)
  407. {
  408. table = table1.DefaultView.ToTable(true, strMergeColumns);
  409. if (table2 != null)
  410. {
  411. table.Merge(table2.DefaultView.ToTable(true, strMergeColumns));
  412. }
  413. if (table3 != null)
  414. {
  415. table.Merge(table3.DefaultView.ToTable(true, strMergeColumns));
  416. }
  417. }
  418. else
  419. {
  420. if (table2 != null)
  421. {
  422. table = table2.DefaultView.ToTable(true, strMergeColumns);
  423. if (table3 != null)
  424. {
  425. table.Merge(table3.DefaultView.ToTable(true, strMergeColumns));
  426. }
  427. }
  428. else
  429. {
  430. if (table3 != null)
  431. {
  432. table = table3.DefaultView.ToTable(true, strMergeColumns);
  433. if (table4 != null)
  434. {
  435. table.Merge(table4.DefaultView.ToTable(true, strMergeColumns));
  436. }
  437. }
  438. else
  439. {
  440. if (table4 != null)
  441. {
  442. table = table4.DefaultView.ToTable(true, strMergeColumns);
  443. }
  444. }
  445. }
  446. }
  447. if (table != null)
  448. {
  449. table.DefaultView.Sort = "JUDGE_STOVE_NO, BATCH_NO, BATCH_GROUD_NO";
  450. table = table.DefaultView.ToTable(true, strMergeColumns);
  451. }
  452. else
  453. {
  454. return;
  455. }
  456. string strSort = "", strHeatNo = "", strBactchNo = "", strGroupNo = "", strPro = "", strStdStyle = "", strSteel = "",strSpec = "",strModel = "" ;
  457. DataRow newrow;
  458. DataRow[] rows;
  459. this.dataTable1.Rows.Clear();
  460. decimal dWgt = 0.0M,dAjust = 0.0M;
  461. int dCount = 0;
  462. decimal dThisIn_Month = 0.0M, dThisOut_Month = 0.00M;
  463. int dThisIn_MonthCount = 0, dThisOut_MonthCount = 0;
  464. string strRowFilters = "";
  465. for (int i = 0; i < table.Rows.Count; i++)
  466. {
  467. newrow = this.dataTable1.NewRow();
  468. try
  469. {
  470. strHeatNo = Convert.ToString(table.Rows[i]["JUDGE_STOVE_NO"]);//炉号
  471. strBactchNo = Convert.ToString(table.Rows[i]["BATCH_NO"]);//批号
  472. strGroupNo = Convert.ToString(table.Rows[i]["BATCH_GROUD_NO"]);//组号
  473. strPro = Convert.ToString(table.Rows[i]["PRODUCNAME"]);
  474. strStdStyle = Convert.ToString(table.Rows[i]["STD_STYLE_DESC"]);
  475. strSteel = Convert.ToString(table.Rows[i]["STEELNAME"]);
  476. strSpec = Convert.ToString(table.Rows[i]["SPEC_NAME"]);
  477. strModel = Convert.ToString(table.Rows[i]["MODEL_DESC"]);
  478. strRowFilters = string.IsNullOrEmpty(strHeatNo) ? " JUDGE_STOVE_NO is null " : " JUDGE_STOVE_NO = '" + strHeatNo + "' ";
  479. strRowFilters += string.IsNullOrEmpty(strBactchNo) ? " and BATCH_NO is null " : " and BATCH_NO = '" + strBactchNo + "' ";
  480. strRowFilters += string.IsNullOrEmpty(strGroupNo) ? " and BATCH_GROUD_NO is null " : " and BATCH_GROUD_NO = '" + strGroupNo + "' ";
  481. strRowFilters += string.IsNullOrEmpty(strGroupNo) ? " and PRODUCNAME is null " : " and PRODUCNAME = '" + strPro + "' ";
  482. strRowFilters += string.IsNullOrEmpty(strGroupNo) ? " and STD_STYLE_DESC is null " : " and STD_STYLE_DESC = '" + strStdStyle + "' ";
  483. strRowFilters += string.IsNullOrEmpty(strGroupNo) ? " and STEELNAME is null " : " and STEELNAME = '" + strSteel + "' ";
  484. strRowFilters += string.IsNullOrEmpty(strGroupNo) ? " and SPEC_NAME is null " : " and SPEC_NAME = '" + strSpec + "' ";
  485. strRowFilters += string.IsNullOrEmpty(strGroupNo) ? " and MODEL_DESC is null " : " and MODEL_DESC = '" + strModel + "' ";
  486. try
  487. {
  488. table1.CaseSensitive = true;
  489. rows = table1.Select(strRowFilters);
  490. if (rows.Length > 0)
  491. {
  492. try
  493. {
  494. dWgt = decimal.Parse(Convert.ToString(rows[0]["WEIGHT"]));
  495. dCount = int.Parse(Convert.ToString(rows[0]["COUNT"]));
  496. }
  497. catch
  498. {
  499. dWgt = 0.0M;
  500. dCount = 0;
  501. }
  502. }
  503. else
  504. {
  505. dWgt = 0.0M;
  506. dCount = 0;
  507. }
  508. }
  509. catch
  510. {
  511. dWgt = 0.0M;
  512. dCount = 0;
  513. }
  514. try
  515. {
  516. table2.CaseSensitive = true;
  517. rows = table2.Select(strRowFilters);
  518. if (rows.Length > 0)
  519. {
  520. try
  521. {
  522. dThisIn_Month = decimal.Parse(Convert.ToString(rows[0]["WEIGHT_MONTH"]));
  523. dThisIn_MonthCount = int.Parse(Convert.ToString(rows[0]["WEIGHT_MONTHCOUNT"]));
  524. }
  525. catch
  526. {
  527. dThisIn_Month = 0.0M;
  528. dThisIn_MonthCount = 0;
  529. }
  530. }
  531. else
  532. {
  533. dThisIn_Month = 0.0M;
  534. dThisIn_MonthCount = 0;
  535. }
  536. }
  537. catch
  538. {
  539. dThisIn_Month = 0.0M;
  540. dThisIn_MonthCount = 0;
  541. }
  542. try
  543. {
  544. table3.CaseSensitive = true;
  545. rows = table3.Select(strRowFilters);
  546. if (rows.Length > 0)
  547. {
  548. try
  549. {
  550. dThisOut_Month = decimal.Parse(Convert.ToString(rows[0]["WEIGHT_MONTH"]));
  551. dThisOut_MonthCount = int.Parse(Convert.ToString(rows[0]["weight_monthcount"]));
  552. }
  553. catch
  554. {
  555. dThisOut_Month = 0.0M;
  556. dThisOut_MonthCount = 0;
  557. }
  558. }
  559. else
  560. {
  561. dThisOut_Month = 0.0M;
  562. dThisOut_MonthCount = 0;
  563. }
  564. }
  565. catch
  566. {
  567. dThisOut_Month = 0.0M;
  568. dThisOut_MonthCount = 0;
  569. }
  570. try
  571. {
  572. table4.CaseSensitive = true;
  573. rows = table4.Select(strRowFilters);
  574. if (rows.Length > 0)
  575. {
  576. try
  577. {
  578. dAjust = decimal.Parse(Convert.ToString(rows[0]["AWEIGHT"]));
  579. }
  580. catch
  581. {
  582. dAjust = 0.0M;
  583. }
  584. }
  585. else
  586. {
  587. dAjust = 0.0M;
  588. }
  589. }
  590. catch
  591. {
  592. dAjust = 0.0M;
  593. }
  594. try
  595. {
  596. newrow["JUDGE_STOVE_NO"] = strHeatNo;
  597. newrow["BATCH_NO"] = strBactchNo;
  598. newrow["BATCH_GROUD_NO"] = strGroupNo;
  599. newrow["PRODUCNAME"] = strPro;
  600. newrow["STD_STYLE_DESC"] = strStdStyle;
  601. newrow["STEELNAME"] = strSteel;
  602. newrow["SPEC_NAME"] = strSpec;
  603. newrow["MODEL_DESC"] = strModel;
  604. newrow["ORIGINAL_AMOUNT"] = Convert.ToString(dWgt).Trim();
  605. newrow["ORIGINAL_COUNT"] = Convert.ToString(dCount).Trim();
  606. newrow["MONTH_1"] = dThisIn_Month.ToString().Trim();
  607. newrow["MONTH_1COUNT"] = dThisIn_MonthCount.ToString().Trim();
  608. newrow["MONTH_2"] = dThisOut_Month.ToString().Trim();
  609. newrow["MONTH_2COUNT"] = dThisOut_MonthCount.ToString().Trim();
  610. newrow["END_AMOUNT"] = Convert.ToString(dWgt + dThisIn_Month - dThisOut_Month + dAjust).Trim();
  611. newrow["END_COUNT"] = Convert.ToString(dCount + dThisIn_MonthCount - dThisOut_MonthCount).Trim();
  612. newrow["AWEIGHT"] = Convert.ToString(dAjust).Trim();
  613. try
  614. {
  615. if (ShapeRelation.Contains(strHeatNo))
  616. {
  617. strSort = ShapeRelation[strHeatNo].ToString();
  618. }
  619. else
  620. {
  621. strSort = "";
  622. }
  623. }
  624. catch
  625. {
  626. strSort = "";
  627. }
  628. this.dataSet1.Tables[0].Rows.Add(newrow);
  629. } catch { }
  630. }
  631. catch { }
  632. }
  633. this.SetStaticsInfo();
  634. CommonMethod.SetGridSumArea(this.ultraGrid1);
  635. this.Cursor = Cursors.Default;
  636. Constant.WaitingForm.ShowToUser = false;
  637. Constant.WaitingForm.Close();
  638. Constant.WaitingForm = null;
  639. }
  640. catch (Exception e)
  641. {
  642. this.Cursor = Cursors.Default;
  643. Constant.WaitingForm.ShowToUser = false;
  644. Constant.WaitingForm.Close();
  645. Constant.WaitingForm = null;
  646. }
  647. }
  648. private void SetStaticsInfo()
  649. {
  650. try
  651. {
  652. if (this.ultraGrid1.Rows.Count == 0)
  653. {
  654. this.ultraGrid1.DisplayLayout.Bands[0].Summaries.Clear();
  655. }
  656. else
  657. {
  658. ArrayList alist = new ArrayList();
  659. alist.Add("ORIGINAL_AMOUNT");
  660. alist.Add("ORIGINAL_COUNT");
  661. alist.Add("MONTH_1");
  662. alist.Add("MONTH_1COUNT");
  663. alist.Add("MONTH_2");
  664. alist.Add("MONTH_2COUNT");
  665. alist.Add("END_AMOUNT");
  666. alist.Add("END_COUNT");
  667. alist.Add("AWEIGHT");
  668. CommonMethod.SetStaticsInfoSum(ref this.ultraGrid1, alist, true);
  669. }
  670. }
  671. catch { }
  672. }
  673. //本期调差量
  674. private bool GetAdjust(string yearMothTim, string strWhere, out DataTable table, string[] arr)
  675. {
  676. table = null;
  677. DataSet set = new DataSet();
  678. DataTable ds = ServerHelper.GetData("com.steering.pss.ydm.Report.FrmRunTimeRptCw.getAdjust", new object[] { yearMothTim, strWhere, arr }, this.ob);
  679. if (ds != null && ds.Rows.Count > 0)
  680. {
  681. set.Tables.Add(ds);
  682. table = set.Tables[0];
  683. return true;
  684. }
  685. return false;
  686. }
  687. //本期出库量
  688. private bool GetThisOut(string yearMothTim, string strWhere, out DataTable table, string[] arr)
  689. {
  690. table = null;
  691. DataSet set = new DataSet();
  692. DataTable ds = ServerHelper.GetData("com.steering.pss.ydm.Report.FrmRunTimeRptCw.getThisOut", new object[] { yearMothTim, strWhere, arr }, this.ob);
  693. if (ds != null && ds.Rows.Count > 0)
  694. {
  695. set.Tables.Add(ds);
  696. table = set.Tables[0];
  697. return true;
  698. }
  699. return false;
  700. }
  701. //本期入库量
  702. private bool GetThisIn(string yearMothTim,string strWhere, out DataTable table, string[] arr)
  703. {
  704. table = null;
  705. DataSet set = new DataSet();
  706. DataTable ds = ServerHelper.GetData("com.steering.pss.ydm.Report.FrmRunTimeRptCw.getThisIn", new object[] { yearMothTim, strWhere, arr }, this.ob);
  707. if (ds != null && ds.Rows.Count > 0)
  708. {
  709. set.Tables.Add(ds);
  710. table = set.Tables[0];
  711. return true;
  712. }
  713. return false;
  714. }
  715. //期初
  716. private bool GetOriginalLast(string yearMothTim, string strWhere, out DataTable table, string[] arr)
  717. {
  718. table = null;
  719. DataSet set = new DataSet();
  720. DataTable ds = ServerHelper.GetData("com.steering.pss.ydm.Report.FrmRunTimeRptCw.getOriginalLast", new object[] { yearMothTim, strWhere, arr }, this.ob);
  721. if (ds != null && ds.Rows.Count > 0)
  722. {
  723. set.Tables.Add(ds);
  724. table = set.Tables[0];
  725. return true;
  726. }
  727. return false;
  728. }
  729. private void cmbStoveNo_KeyDown(object sender, KeyEventArgs e)
  730. {
  731. if (e.KeyValue == 13)
  732. {
  733. queryData();
  734. }
  735. }
  736. private void chkStove_CheckedChanged(object sender, EventArgs e)
  737. {
  738. this.cmbStoveNo.Enabled = chkStove.Checked;
  739. }
  740. private void ultraTabControl1_SelectedTabChanged(object sender, Infragistics.Win.UltraWinTabControl.SelectedTabChangedEventArgs e)
  741. {
  742. if (toolMenu == null)
  743. {
  744. return;
  745. }
  746. if (ultraTabControl1.SelectedTab.Key == "0")
  747. {
  748. if (toolMenu.Toolbars[0].Tools.Exists("Query1"))
  749. {
  750. toolMenu.Toolbars[0].Tools["Query1"].InstanceProps.Visible = DefaultableBoolean.False;
  751. }
  752. if (toolMenu.Toolbars[0].Tools.Exists("insertInital"))
  753. {
  754. toolMenu.Toolbars[0].Tools["insertInital"].InstanceProps.Visible = DefaultableBoolean.True;
  755. }
  756. if (toolMenu.Toolbars[0].Tools.Exists("Query"))
  757. {
  758. toolMenu.Toolbars[0].Tools["Query"].InstanceProps.Visible = DefaultableBoolean.True;
  759. }
  760. if (toolMenu.Toolbars[0].Tools.Exists("insertTal"))
  761. {
  762. toolMenu.Toolbars[0].Tools["insertTal"].InstanceProps.Visible = DefaultableBoolean.False;
  763. }
  764. if (toolMenu.Toolbars[0].Tools.Exists("Export"))
  765. {
  766. toolMenu.Toolbars[0].Tools["Export"].InstanceProps.Visible = DefaultableBoolean.True;
  767. }
  768. this.chkStoreNo.Visible = true;
  769. this.cmbStoreNo.Visible = true;
  770. }
  771. if (ultraTabControl1.SelectedTab.Key == "1")
  772. {
  773. if (toolMenu.Toolbars[0].Tools.Exists("Query"))
  774. {
  775. toolMenu.Toolbars[0].Tools["Query"].InstanceProps.Visible = DefaultableBoolean.False;
  776. }
  777. if (toolMenu.Toolbars[0].Tools.Exists("insertTal"))
  778. {
  779. toolMenu.Toolbars[0].Tools["insertTal"].InstanceProps.Visible = DefaultableBoolean.False;
  780. }
  781. if (toolMenu.Toolbars[0].Tools.Exists("Export"))
  782. {
  783. toolMenu.Toolbars[0].Tools["Export"].InstanceProps.Visible = DefaultableBoolean.False;
  784. }
  785. if (toolMenu.Toolbars[0].Tools.Exists("Query1"))
  786. {
  787. toolMenu.Toolbars[0].Tools["Query1"].InstanceProps.Visible = DefaultableBoolean.True;
  788. }
  789. if (toolMenu.Toolbars[0].Tools.Exists("insertInital"))
  790. {
  791. toolMenu.Toolbars[0].Tools["insertInital"].InstanceProps.Visible = DefaultableBoolean.True;
  792. }
  793. this.chkStoreNo.Visible = false;
  794. this.cmbStoreNo.Visible = false;
  795. }
  796. }
  797. private void FrmRunTimeRpt_Shown(object sender, EventArgs e)
  798. {
  799. if (toolMenu == null)
  800. {
  801. return;
  802. }
  803. if (toolMenu.Toolbars[0].Tools.Exists("Query1"))
  804. {
  805. toolMenu.Toolbars[0].Tools["Query1"].InstanceProps.Visible = DefaultableBoolean.False;
  806. }
  807. //if (toolMenu.Toolbars[0].Tools.Exists("insertInital"))
  808. //{
  809. // toolMenu.Toolbars[0].Tools["insertInital"].InstanceProps.Visible = DefaultableBoolean.False;
  810. //}
  811. if (toolMenu.Toolbars[0].Tools.Exists("Query"))
  812. {
  813. toolMenu.Toolbars[0].Tools["Query"].InstanceProps.Visible = DefaultableBoolean.True;
  814. }
  815. if (toolMenu.Toolbars[0].Tools.Exists("insertTal"))
  816. {
  817. toolMenu.Toolbars[0].Tools["insertTal"].InstanceProps.Visible = DefaultableBoolean.False;
  818. }
  819. if (toolMenu.Toolbars[0].Tools.Exists("Export"))
  820. {
  821. toolMenu.Toolbars[0].Tools["Export"].InstanceProps.Visible = DefaultableBoolean.True;
  822. }
  823. }
  824. private void chkStoreNo_CheckedChanged(object sender, EventArgs e)
  825. {
  826. this.cmbStoreNo.Enabled = this.chkStoreNo.Checked;
  827. }
  828. }
  829. }