FrmStoreSummary.cs 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677
  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.Server;
  11. using Core.Mes.Client.Comm.Control;
  12. using System.Collections;
  13. using Core.Mes.Client.Comm.Tool;
  14. using Core.StlMes.Client.YdmBcPipeManage.Entity;
  15. namespace Core.StlMes.Client.YdmBcPipeManage
  16. {
  17. public partial class FrmStoreSummary : FrmBase
  18. {
  19. public FrmStoreSummary()
  20. {
  21. InitializeComponent();
  22. }
  23. ArrayList alistChecked = null;
  24. private string[] arr = null;//仓库权限
  25. private string[] belongArr = null;//所属权权限
  26. private void FrmStoreSummary_Load(object sender, EventArgs e)
  27. {
  28. DateTime now = DateTime.Now;
  29. DateTime dt1 = new DateTime(now.Year, now.Month, 1);//当月第一天
  30. DateTime dt2 = dt1.AddMonths(1).AddDays(-1);//当月最后一天
  31. this.RegStartTime.Value = DateTime.Parse(dt1.ToString("yyyy-MM-dd") + " 00:00:00");
  32. this.RegEndTime.Value = DateTime.Parse(dt2.ToString("yyyy-MM-dd") + " 23:59:59");
  33. //getStoreAll();
  34. DateTime d1 = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1);
  35. dataYearMoth.Value = DateTime.Parse(DateTime.Now.ToString("yyyy-MM"));
  36. InitBindColumn();
  37. arr = BaseMethod.WarehousePermissionsStore(this.ValidDataPurviewIds, ob);
  38. belongArr = this.ValidDataPurviewIds;
  39. EntityHelper.ShowGridCaption<MatBcMEntity3>(ultraGrid1.DisplayLayout.Bands[0]);
  40. ultraGrid1.DisplayLayout.Bands[0].Columns["OrderTypDesc"].Hidden = false;
  41. try
  42. {
  43. alistChecked = new ArrayList();
  44. alistChecked.Add("StoveNo");
  45. alistChecked.Add("JudgeStoveNo");
  46. alistChecked.Add("MaterialName");
  47. alistChecked.Add("ProcessDesc");
  48. //alistChecked.Add("FixLen");
  49. }
  50. catch { }
  51. try
  52. {
  53. ArrayList alist = new ArrayList();
  54. alist.Add("ActCount");
  55. alist.Add("ActWeight");
  56. alist.Add("ActLen");
  57. CommonMethod.GeneralCheckedListboxItems(ref this.myCheckedListBox1, ref this.ultraGrid1, alist, alistChecked);
  58. }
  59. catch { }
  60. }
  61. /// <summary>
  62. /// 字段绑定
  63. /// </summary>
  64. private void InitBindColumn()
  65. {
  66. //材料状态
  67. this.ultraGrid1.DisplayLayout.ValueLists[0].ValueListItems.Add("80150101", "材料产出等待");
  68. this.ultraGrid1.DisplayLayout.ValueLists[0].ValueListItems.Add("80150102", "材料管理封锁");
  69. this.ultraGrid1.DisplayLayout.ValueLists[0].ValueListItems.Add("80150103", "材料质量封锁");
  70. this.ultraGrid1.DisplayLayout.ValueLists[0].ValueListItems.Add("80150104", "材料可编计划");
  71. this.ultraGrid1.DisplayLayout.ValueLists[0].ValueListItems.Add("80150105", "材料已编计划");
  72. this.ultraGrid1.DisplayLayout.ValueLists[0].ValueListItems.Add("80150106", "材料为余材");
  73. this.ultraGrid1.DisplayLayout.ValueLists[0].ValueListItems.Add("80150201", "材料产出等待(未综合判定)");
  74. this.ultraGrid1.DisplayLayout.ValueLists[0].ValueListItems.Add("80150202", "材料产出(已综合判定");
  75. this.ultraGrid1.DisplayLayout.ValueLists[0].ValueListItems.Add("80150203", "材料为余材(已综合判定)");
  76. this.ultraGrid1.DisplayLayout.ValueLists[0].ValueListItems.Add("80150204", "材料脱单余材(销售组织脱单)");
  77. this.ultraGrid1.DisplayLayout.ValueLists[0].ValueListItems.Add("80150301", "材料可编计划(发运控制)");
  78. this.ultraGrid1.DisplayLayout.ValueLists[0].ValueListItems.Add("80150302", "材料已编计划(发运控制)");
  79. this.ultraGrid1.DisplayLayout.ValueLists[0].ValueListItems.Add("80150303", "销售出厂");
  80. //材料类别
  81. this.ultraGrid1.DisplayLayout.ValueLists[1].ValueListItems.Add("801401", "在制品");
  82. this.ultraGrid1.DisplayLayout.ValueLists[1].ValueListItems.Add("801402", "成品");
  83. this.ultraGrid1.DisplayLayout.ValueLists[1].ValueListItems.Add("801403", "商品");
  84. DataTable ds = ClsLoad.GetValueListDataTable("8014", this.ob);
  85. this.ultraGrid1.DisplayLayout.Bands[0].Columns["ProductFlag"].ValueList = ClsLoad.GeneralValuelist(ref ds, "BASECODE", "BASENAME");
  86. string[] arr = new string[3] { "801501", "801502", "801503" };
  87. DataTable dt = ClsLoad.GetValueListDataTable(arr, this.ob);
  88. this.ultraGrid1.DisplayLayout.Bands[0].Columns["MatStatus"].ValueList = ClsLoad.GeneralValuelist(ref dt, "BASECODE", "BASENAME");
  89. }
  90. /// <summary>
  91. /// 获取仓库
  92. /// </summary>
  93. //private void getStoreAll()
  94. //{
  95. // string storeNo = "800201";
  96. // string[] arr = BaseMethod.WarehousePermissions(this.CustomInfo, this.ValidDataPurviewIds, this.ob);
  97. // DataTable dt = ServerHelper.GetData("com.steering.pss.ydm.Stuffmanage.FrmStuffBase.getStoreAll", new object[] { storeNo, arr }, this.ob);
  98. // if (dt.Rows.Count > 0)
  99. // {
  100. // cmbStorgeNo.DataSource = dt;
  101. // cmbStorgeNo.DisplayMember = "STORAGE_NAME";
  102. // cmbStorgeNo.ValueMember = "STORAGE_NO";
  103. // }
  104. //}
  105. /// <summary>
  106. /// 重写基类方法
  107. /// </summary>
  108. /// <param name="sender"></param>
  109. /// <param name="ToolbarKey"></param>
  110. public override void ToolBar_Click(object sender, string ToolbarKey)
  111. {
  112. switch (ToolbarKey)
  113. {
  114. case "Query":
  115. QueryData();
  116. break;
  117. case "Export":
  118. ExportData();
  119. break;
  120. case "Close":
  121. this.Close();
  122. break;
  123. }
  124. }
  125. /// <summary>
  126. /// 查询
  127. /// </summary>
  128. private void QueryData()
  129. {
  130. List<MatBcMEntity3> listSource = null;
  131. if (chkStoveNo.Checked && string.IsNullOrEmpty(this.txtStoveNo.Text.Trim()))
  132. {
  133. MessageUtil.ShowTips("请输入熔炼炉号!");
  134. this.txtStoveNo.Focus();
  135. return;
  136. }
  137. if (chkJudgeNo.Checked && string.IsNullOrEmpty(this.txtJudgeNo.Text.Trim()))
  138. {
  139. MessageUtil.ShowTips("请输入判定炉号!");
  140. this.txtJudgeNo.Focus();
  141. return;
  142. }
  143. if (this.chkFlagStoveNo.Checked && string.IsNullOrEmpty(this.txtFlagStoveNo.Text.Trim()))
  144. {
  145. MessageUtil.ShowTips("请输入标识炉号!");
  146. this.txtJudgeNo.Focus();
  147. return;
  148. }
  149. string stoveNo = "";
  150. string judgeNo = "";
  151. string flagStoveNo = "";
  152. string orderNo = "";
  153. string dtStartTime = "";
  154. string dtEndTime = "";
  155. ArrayList list = new ArrayList();
  156. string strSql = "";
  157. string strGroup = "";
  158. string strOut = "";
  159. string bathYear = "";
  160. if (chkStoveNo.Checked)
  161. {
  162. stoveNo = this.txtStoveNo.Text.Trim();
  163. strOut += " AND T1.STOVE_NO = '" + stoveNo + "'";
  164. }
  165. if(chkJudgeNo.Checked)
  166. {
  167. judgeNo = this.txtJudgeNo.Text.Trim();
  168. strOut += " AND T1.JUDGE_STOVE_NO = '" + judgeNo + "'";
  169. }
  170. if(chkFlagStoveNo.Checked)
  171. {
  172. flagStoveNo = this.txtFlagStoveNo.Text.Trim();
  173. strOut += " AND T1.FLAG_STOVE_NO_ZG = '" + flagStoveNo + "'";
  174. }
  175. if (chkOrder.Checked)
  176. {
  177. orderNo = this.txtOrder.Text.Trim();
  178. strOut += " AND T1.PRO_ORDER_NO LIKE '%" + orderNo + "%'";
  179. }
  180. if(chkRegTime.Checked)
  181. {
  182. dtStartTime = this.RegStartTime.Value.ToString();
  183. dtEndTime = this.RegEndTime.Value.ToString();
  184. strOut += " AND T1.INSTOCK_TIME >= to_date('" + dtStartTime + "', 'yyyy-MM-dd HH24:mi:ss') and T1.INSTOCK_TIME < =to_date('" + dtEndTime + "', 'yyyy-MM-dd HH24:mi:ss')";
  185. }
  186. if(chkYearMoth.Checked)
  187. {
  188. bathYear = this.dataYearMoth.Value.ToString("yyyyMM");
  189. strOut += " AND T1.BAL_YEAR_MONTH = '" + bathYear + "'";
  190. }
  191. string strKey = "";
  192. CheckBox item;
  193. for (int i = 0; i < this.myCheckedListBox1.Controls.Count; i++)
  194. {
  195. try
  196. {
  197. item = this.myCheckedListBox1.Controls[i] as CheckBox;
  198. if (item != null && item.Checked)
  199. {
  200. strKey = item.Name;
  201. if (strKey.Equals("StoveNo"))
  202. {
  203. strSql += (string.IsNullOrEmpty(strSql) ? "" : ",") + "T1.STOVE_NO";
  204. strGroup += (string.IsNullOrEmpty(strGroup) ? "" : ",") + "T1.STOVE_NO";
  205. }
  206. else if (strKey.Equals("FlagStoveNoZg"))
  207. {
  208. strSql += (string.IsNullOrEmpty(strSql) ? "" : ",") + "T1.FLAG_STOVE_NO_ZG";
  209. strGroup += (string.IsNullOrEmpty(strGroup) ? "" : ",") + "T1.FLAG_STOVE_NO_ZG";
  210. }
  211. else if (strKey.Equals("JudgeStoveNo"))
  212. {
  213. strSql += (string.IsNullOrEmpty(strSql) ? "" : ",") + "T1.JUDGE_STOVE_NO";
  214. strGroup += (string.IsNullOrEmpty(strGroup) ? "" : ",") + "T1.JUDGE_STOVE_NO";
  215. }
  216. else if (strKey.Equals("BatchNo"))
  217. {
  218. strSql += (string.IsNullOrEmpty(strSql) ? "" : ",") + "t1.BATCH_NO";
  219. strGroup += (string.IsNullOrEmpty(strGroup) ? "" : ",") + "t1.BATCH_NO";
  220. }
  221. else if (strKey.Equals("BatchGroudNo"))
  222. {
  223. strSql += (string.IsNullOrEmpty(strSql) ? "" : ",") + "t1.Batch_Groud_No";
  224. strGroup += (string.IsNullOrEmpty(strGroup) ? "" : ",") + "t1.Batch_Groud_No";
  225. }
  226. else if (strKey.Equals("MaterialName"))
  227. {
  228. strSql += (string.IsNullOrEmpty(strSql) ? "" : ",") + "t1.MATERIAL_NAME";
  229. strGroup += (string.IsNullOrEmpty(strGroup) ? "" : ",") + "t1.MATERIAL_NAME";
  230. }
  231. else if (strKey.Equals("Producname"))
  232. {
  233. strSql += (string.IsNullOrEmpty(strSql) ? "" : ",") + "t1.PRODUCNAME";
  234. strGroup += (string.IsNullOrEmpty(strGroup) ? "" : ",") + "t1.PRODUCNAME";
  235. }
  236. else if (strKey.Equals("Gradename"))
  237. {
  238. strSql += (string.IsNullOrEmpty(strSql) ? "" : ",") + "t1.GRADENAME";
  239. strGroup += (string.IsNullOrEmpty(strGroup) ? "" : ",") + "t1.GRADENAME";
  240. }
  241. else if (strKey.Equals("Steelname"))
  242. {
  243. strSql += (string.IsNullOrEmpty(strSql) ? "" : ",") + "t1.STEELNAME";
  244. strGroup += (string.IsNullOrEmpty(strGroup) ? "" : ",") + "t1.STEELNAME";
  245. }
  246. else if (strKey.Equals("StdName"))
  247. {
  248. strSql += (string.IsNullOrEmpty(strSql) ? "" : ",") + "t1.STD_NAME";
  249. strGroup += (string.IsNullOrEmpty(strGroup) ? "" : ",") + "t1.STD_NAME";
  250. }
  251. else if (strKey.Equals("StdStyleDesc"))
  252. {
  253. strSql += (string.IsNullOrEmpty(strSql) ? "" : ",") + "t1.STD_STYLE_DESC";
  254. strGroup += (string.IsNullOrEmpty(strGroup) ? "" : ",") + "t1.STD_STYLE_DESC";
  255. }
  256. else if (strKey.Equals("SpecName"))
  257. {
  258. strSql += (string.IsNullOrEmpty(strSql) ? "" : ",") + "t1.SPEC_NAME";
  259. strGroup += (string.IsNullOrEmpty(strGroup) ? "" : ",") + "t1.SPEC_NAME";
  260. }
  261. else if (strKey.Equals("ModelDesc"))
  262. {
  263. strSql += (string.IsNullOrEmpty(strSql) ? "" : ",") + "t1.MODEL_DESC";
  264. strGroup += (string.IsNullOrEmpty(strGroup) ? "" : ",") + "t1.MODEL_DESC";
  265. }
  266. else if (strKey.Equals("JudgeStdDes"))
  267. {
  268. strSql += (string.IsNullOrEmpty(strSql) ? "" : ",") + "t1.JUDGE_STD_DES";
  269. strGroup += (string.IsNullOrEmpty(strGroup) ? "" : ",") + "t1.JUDGE_STD_DES";
  270. }
  271. else if (strKey.Equals("ActDimater"))
  272. {
  273. strSql += (string.IsNullOrEmpty(strSql) ? "" : ",") + "t1.ACT_DIMATER";
  274. strGroup += (string.IsNullOrEmpty(strGroup) ? "" : ",") + "t1.ACT_DIMATER";
  275. }
  276. else if (strKey.Equals("ActHeight"))
  277. {
  278. strSql += (string.IsNullOrEmpty(strSql) ? "" : ",") + "t1.ACT_HEIGHT";
  279. strGroup += (string.IsNullOrEmpty(strGroup) ? "" : ",") + "t1.ACT_HEIGHT";
  280. }
  281. else if (strKey.Equals("ActLenMin"))
  282. {
  283. strSql += (string.IsNullOrEmpty(strSql) ? "" : ",") + "t1.ACT_LEN_MIN";
  284. strGroup += (string.IsNullOrEmpty(strGroup) ? "" : ",") + "t1.ACT_LEN_MIN";
  285. }
  286. else if (strKey.Equals("ActLenMax"))
  287. {
  288. strSql += (string.IsNullOrEmpty(strSql) ? "" : ",") + "t1.ACT_LEN_MAX";
  289. strGroup += (string.IsNullOrEmpty(strGroup) ? "" : ",") + "t1.ACT_LEN_MAX";
  290. }
  291. //else if (strKey.Equals("ActLen"))
  292. //{
  293. // strSql += (string.IsNullOrEmpty(strSql) ? "" : ",") + "t1.ACT_LEN";
  294. // strGroup += (string.IsNullOrEmpty(strGroup) ? "" : ",") + "t1.ACT_LEN";
  295. //}
  296. else if (strKey.Equals("BelongName"))
  297. {
  298. strSql += (string.IsNullOrEmpty(strSql) ? "" : ",") + "T1.BELONG_NAME";
  299. strGroup += (string.IsNullOrEmpty(strGroup) ? "" : ",") + "T1.BELONG_NAME";
  300. }
  301. else if (strKey.Equals("JudgeResultCode"))
  302. {
  303. strSql += (string.IsNullOrEmpty(strSql) ? "" : ",") + "(SELECT T2.BASENAME FROM COM_BASE_INFO T2 WHERE T2.BASECODE = T1.JUDGE_RESULT_CODE )JUDGE_RESULT_CODE";
  304. strGroup += (string.IsNullOrEmpty(strGroup) ? "" : ",") + "T1.JUDGE_RESULT_CODE";
  305. }
  306. else if (strKey.Equals("InstockTimeS"))
  307. {
  308. strSql += (string.IsNullOrEmpty(strSql) ? "" : ",") + "MAX(TO_CHAR(T1.INSTOCK_TIME,'YYYY-MM-DD'))INSTOCK_TIME_S";
  309. //strGroup += (string.IsNullOrEmpty(strGroup) ? "" : ",") + "T1.JUDGE_RESULT_CODE";
  310. }
  311. else if (strKey.Equals("InstockTime"))
  312. {
  313. strSql += (string.IsNullOrEmpty(strSql) ? "" : ",") + "MAX(TO_CHAR(T1.INSTOCK_TIME,'YYYY-MM-DD HH24:MI:SS'))INSTOCK_TIME";
  314. //strGroup += (string.IsNullOrEmpty(strGroup) ? "" : ",") + "T1.JUDGE_RESULT_CODE";
  315. }
  316. else if (strKey.Equals("JudgeResultTime"))
  317. {
  318. strSql += (string.IsNullOrEmpty(strSql) ? "" : ",") + "MAX(TO_CHAR(T1.JUDGE_RESULT_TIME,'YYYY-MM-DD HH24:MI:SS'))JUDGE_RESULT_TIME";
  319. }
  320. else if (strKey.Equals("BalYearMonth"))
  321. {
  322. strSql += (string.IsNullOrEmpty(strSql) ? "" : ",") + "MAX(T1.BAL_YEAR_MONTH)BAL_YEAR_MONTH";
  323. }
  324. else if (strKey.Equals("ProductFlag"))
  325. {
  326. strSql += (string.IsNullOrEmpty(strSql) ? "" : ",") + "T1.PRODUCT_FLAG";
  327. strGroup += (string.IsNullOrEmpty(strGroup) ? "" : ",") + "T1.PRODUCT_FLAG";
  328. }
  329. else if (strKey.Equals("MatStatus"))
  330. {
  331. strSql += (string.IsNullOrEmpty(strSql) ? "" : ",") + "T1.MAT_STATUS";
  332. strGroup += (string.IsNullOrEmpty(strGroup) ? "" : ",") + "T1.MAT_STATUS";
  333. }
  334. else if (strKey.Equals("PlineName"))
  335. {
  336. strSql += (string.IsNullOrEmpty(strSql) ? "" : ",") + "T1.PLINE_NAME";
  337. strGroup += (string.IsNullOrEmpty(strGroup) ? "" : ",") + "T1.PLINE_NAME";
  338. }
  339. else if (strKey.Equals("QcmStaus"))
  340. {
  341. strSql += (string.IsNullOrEmpty(strSql) ? "" : ",") + "DECODE(T1.QCM_STAUS,'00','合格','11','待处理','22','废品')QCM_STAUS";
  342. strGroup += (string.IsNullOrEmpty(strGroup) ? "" : ",") + "T1.QCM_STAUS";
  343. }
  344. else if (strKey.Equals("StorageName"))
  345. {
  346. strSql += (string.IsNullOrEmpty(strSql) ? "" : ",") + "(SELECT T3.STORAGE_NAME FROM YDM_BS_STORAGE T3 WHERE T3.STORAGE_NO = T2.STORAGE_NO)STORAGE_NAME";
  347. strGroup += (string.IsNullOrEmpty(strGroup) ? "" : ",") + "T2.STORAGE_NO";
  348. }
  349. else if (strKey.Equals("LocationName"))
  350. {
  351. strSql += (string.IsNullOrEmpty(strSql) ? "" : ",") + "(SELECT T4.LOCATION_NAME FROM YDM_BS_LOCATION T4 WHERE T4.LOCATION_NO = T2.LOCATION_NO)LOCATION_NAME";
  352. strGroup += (string.IsNullOrEmpty(strGroup) ? "" : ",") + "T2.LOCATION_NO";
  353. }
  354. //else if (strKey.Equals("LocationName"))
  355. //{
  356. // strSql += (string.IsNullOrEmpty(strSql) ? "" : ",") + " T2.LOCATION_NO";
  357. // strGroup += (string.IsNullOrEmpty(strGroup) ? "" : ",") + "T2.LOCATION_NO";
  358. //}
  359. //else if (strKey.Equals("LaryNo"))
  360. //{
  361. // strSql += (string.IsNullOrEmpty(strSql) ? "" : ",") + "T2.LARY_NO";
  362. // strGroup += (string.IsNullOrEmpty(strGroup) ? "" : ",") + "T2.LARY_NO";
  363. //}
  364. else if (strKey.Equals("InputMaterialName"))
  365. {
  366. strSql += (string.IsNullOrEmpty(strSql) ? "" : ",") + "T1.INPUT_MATERIAL_NAME";
  367. strGroup += (string.IsNullOrEmpty(strGroup) ? "" : ",") + "T1.INPUT_MATERIAL_NAME";
  368. }
  369. else if (strKey.Equals("ProcessDesc"))
  370. {
  371. strSql += (string.IsNullOrEmpty(strSql) ? "" : ",") + "T1.PROCESS_DESC";
  372. strGroup += (string.IsNullOrEmpty(strGroup) ? "" : ",") + "T1.PROCESS_DESC";
  373. }
  374. else if (strKey.Equals("NextProcessDesc"))
  375. {
  376. strSql += (string.IsNullOrEmpty(strSql) ? "" : ",") + "T1.NEXT_PROCESS_DESC";
  377. strGroup += (string.IsNullOrEmpty(strGroup) ? "" : ",") + "T1.NEXT_PROCESS_DESC";
  378. }
  379. else if (strKey.Equals("Target"))
  380. {
  381. strSql += (string.IsNullOrEmpty(strSql) ? "" : ",") + "T1.TARGET";
  382. strGroup += (string.IsNullOrEmpty(strGroup) ? "" : ",") + "T1.TARGET";
  383. }
  384. else if (strKey.Equals("JudgeResult"))
  385. {
  386. strSql += (string.IsNullOrEmpty(strSql) ? "" : ",") + "T1.JUDGE_RESULT";
  387. strGroup += (string.IsNullOrEmpty(strGroup) ? "" : ",") + "T1.JUDGE_RESULT";
  388. }
  389. else if (strKey.Equals("JudgeTolresult"))
  390. {
  391. strSql += (string.IsNullOrEmpty(strSql) ? "" : ",") + "T1.JUDGE_TOLRESULT";
  392. strGroup += (string.IsNullOrEmpty(strGroup) ? "" : ",") + "T1.JUDGE_TOLRESULT";
  393. }
  394. else if (strKey.Equals("ProOrderNo"))
  395. {
  396. strSql += (string.IsNullOrEmpty(strSql) ? "" : ",") + "T1.PRO_ORDER_NO";
  397. strGroup += (string.IsNullOrEmpty(strGroup) ? "" : ",") + "T1.PRO_ORDER_NO";
  398. }
  399. else if (strKey.Equals("QcmMemo"))
  400. {
  401. strSql += (string.IsNullOrEmpty(strSql) ? "" : ",") + "MAX((SELECT T.MEMO FROM QCM_GP_JUDGE_APPLY T WHERE T.JUGDE_APPLY_CODE || T.JUGDE_APPLY_SQE = T1.JUGDE_APPLY_CODE GROUP BY T.JUGDE_APPLY_CODE,T.JUGDE_APPLY_SQE,T.MEMO))QCM_MEMO";
  402. //strGroup += (string.IsNullOrEmpty(strGroup) ? "" : ",") + "S1.ORDER_NO,S1.ORDER_SEQ";
  403. }
  404. else if (strKey.Equals("JudgeMemo"))
  405. {
  406. strSql += (string.IsNullOrEmpty(strSql) ? "" : ",") + "MAX((SELECT T.JUDGE_MEMO FROM QCM_GP_JUDGE_APPLY T WHERE T.JUGDE_APPLY_CODE || T.JUGDE_APPLY_SQE = T1.JUGDE_APPLY_CODE GROUP BY T.JUGDE_APPLY_CODE,T.JUGDE_APPLY_SQE,T.JUDGE_MEMO))JUDGE_MEMO";
  407. //strGroup += (string.IsNullOrEmpty(strGroup) ? "" : ",") + "S1.ORDER_NO,S1.ORDER_SEQ";
  408. }else if(strKey.Equals("Memo"))
  409. {
  410. strSql += (string.IsNullOrEmpty(strSql) ? "" : ",") + "T1.MEMO";
  411. strGroup += (string.IsNullOrEmpty(strGroup) ? "" : ",") + "T1.MEMO";
  412. }
  413. else if (strKey.Equals("Pipmemo"))
  414. {
  415. strSql += (string.IsNullOrEmpty(strSql) ? "" : ",") + "T1.PIPMEMO";
  416. strGroup += (string.IsNullOrEmpty(strGroup) ? "" : ",") + "T1.PIPMEMO";
  417. }
  418. else if (strKey.Equals("Memo1"))
  419. {
  420. strSql += (string.IsNullOrEmpty(strSql) ? "" : ",") + "T1.MEMO1";
  421. strGroup += (string.IsNullOrEmpty(strGroup) ? "" : ",") + "T1.MEMO1";
  422. }
  423. else if (strKey.Equals("LoadPline") || strKey.Equals("IsApplyFlag"))
  424. {
  425. }
  426. else if(strKey.Equals("InBc"))
  427. {
  428. strSql += (string.IsNullOrEmpty(strSql) ? "" : ",") + "DECODE(T1.IN_BC,'0','常白班','1','早','2','中','3','夜')IN_BC";
  429. strGroup += (string.IsNullOrEmpty(strGroup) ? "" : ",") + "T1.IN_BC";
  430. }
  431. else if (strKey.Equals("InBz"))
  432. {
  433. strSql += (string.IsNullOrEmpty(strSql) ? "" : ",") + "DECODE(T1.IN_BZ,'1','甲','2','乙','3','丙','4','丁')IN_BZ";
  434. strGroup += (string.IsNullOrEmpty(strGroup) ? "" : ",") + "T1.IN_BZ";
  435. }
  436. else if (strKey.Equals("CustomerNm"))
  437. {
  438. strSql += (string.IsNullOrEmpty(strSql) ? "" : ",") + "(SELECT T2.CUSTOMER_NM FROM SLM_ORDER_HEAD T2 WHERE T2.ORD_PK = T1.ORD_PK)CUSTOMER_NM";
  439. strGroup += (string.IsNullOrEmpty(strGroup) ? "" : ",") + "T1.ORD_PK";
  440. }
  441. else if (strKey.Equals("OrderTypDesc"))
  442. {
  443. strSql += (string.IsNullOrEmpty(strSql) ? "" : ",") + "( SELECT ORDER_TYP_DESC FROM SLM_ORDER_HEAD WHERE ORDER_NO = T1.ORDER_NO and VALIDFLAG = '1' AND ROWNUM = 1 )ORDER_TYP_DESC";
  444. strGroup += (string.IsNullOrEmpty(strGroup) ? "" : ",") + "t1.ORDER_NO";
  445. }
  446. else
  447. {
  448. strSql += (string.IsNullOrEmpty(strSql) ? "t1." : ",t1.") + strKey;
  449. strGroup += (string.IsNullOrEmpty(strGroup) ? "t1." : ",t1.") + strKey;
  450. }
  451. }
  452. }
  453. catch { }
  454. }
  455. strSql += (string.IsNullOrEmpty(strSql) ? "" : ",");
  456. strGroup = (string.IsNullOrEmpty(strGroup) ? "" : "group by ") + strGroup;
  457. string _sql = strOut + strGroup;
  458. list.Add(strSql);
  459. list.Add(strOut);
  460. list.Add(strGroup);
  461. switch (this.CustomInfo)
  462. {
  463. case "STORAGE_NO":
  464. listSource = EntityHelper.GetData<MatBcMEntity3>(
  465. "com.steering.ydm.bc.report.FrmBcStoreSummary.queryData", new object[] { list, arr }, this.ob);
  466. break;
  467. case "BELONG_CODE":
  468. listSource = EntityHelper.GetData<MatBcMEntity3>(
  469. "com.steering.ydm.bc.report.FrmBcStoreSummary.queryDataBelong", new object[] { list, belongArr }, this.ob);
  470. break;
  471. case"A":
  472. if(!chkJudgeNo.Checked && !chkFlagStoveNo.Checked)
  473. {
  474. MessageUtil.ShowTips("请输入判断炉号或者标识炉号查询!");
  475. return;
  476. }
  477. listSource = EntityHelper.GetData<MatBcMEntity3>(
  478. "com.steering.ydm.bc.report.FrmBcStoreSummary.queryDataAll", new object[] { list }, this.ob);
  479. break;
  480. case "":
  481. listSource = EntityHelper.GetData<MatBcMEntity3>(
  482. "com.steering.ydm.bc.report.FrmBcStoreSummary.queryDataAll", new object[] { list }, this.ob);
  483. break;
  484. }
  485. matBcMEntity3BindingSource.DataSource = listSource;
  486. bool bContains = false, bChecked = false;
  487. for (int i = 0; i < this.ultraGrid1.DisplayLayout.Bands[0].Columns.Count; i++)
  488. {
  489. try
  490. {
  491. bContains = false;
  492. strKey = this.ultraGrid1.DisplayLayout.Bands[0].Columns[i].Key;
  493. for (int j = 0; j < this.myCheckedListBox1.Controls.Count; j++)
  494. {
  495. try
  496. {
  497. item = this.myCheckedListBox1.Controls[j] as CheckBox;
  498. if (item.Name.Equals(strKey))
  499. {
  500. bContains = true;
  501. bChecked = item.Checked;
  502. break;
  503. }
  504. }
  505. catch { }
  506. }
  507. if (bContains)
  508. {
  509. this.ultraGrid1.DisplayLayout.Bands[0].Columns[i].Hidden = !bChecked;
  510. }
  511. }
  512. catch { }
  513. }
  514. this.SetStaticsInfo();
  515. CommonMethod.SetGridSumArea(this.ultraGrid1);
  516. }
  517. private void SetStaticsInfo()
  518. {
  519. try
  520. {
  521. if (this.ultraGrid1.Rows.Count == 0)
  522. {
  523. this.ultraGrid1.DisplayLayout.Bands[0].Summaries.Clear();
  524. }
  525. else
  526. {
  527. ArrayList alist = new ArrayList();
  528. alist.Add("ActCount");
  529. alist.Add("ActWeight");
  530. alist.Add("ActLen");
  531. CommonMethod.SetStaticsInfoSum(ref this.ultraGrid1, alist, true);
  532. }
  533. }
  534. catch { }
  535. }
  536. /// <summary>
  537. /// 导出
  538. /// </summary>
  539. private void ExportData()
  540. {
  541. GridHelper.ulGridToExcel(ultraGrid1, "钢管库存汇总");
  542. }
  543. /// <summary>
  544. /// 全选
  545. /// </summary>
  546. /// <param name="sender"></param>
  547. /// <param name="e"></param>
  548. private void myLinkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
  549. {
  550. this.myCheckedListBox1.CheckAll();
  551. }
  552. /// <summary>
  553. /// 清除
  554. /// </summary>
  555. /// <param name="sender"></param>
  556. /// <param name="e"></param>
  557. private void myLinkLabel2_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
  558. {
  559. this.myCheckedListBox1.UnCheckAll();
  560. }
  561. /// <summary>
  562. /// 默认
  563. /// </summary>
  564. /// <param name="sender"></param>
  565. /// <param name="e"></param>
  566. private void myLinkLabel3_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
  567. {
  568. CheckBox items;
  569. for (int i = 0; i < this.myCheckedListBox1.Controls.Count; i++)
  570. {
  571. try
  572. {
  573. items = this.myCheckedListBox1.Controls[i] as CheckBox;
  574. if (alistChecked.Contains(items.Name))
  575. {
  576. items.Checked = true;
  577. }
  578. else
  579. {
  580. items.Checked = false;
  581. }
  582. }
  583. catch { }
  584. }
  585. }
  586. private void cbx_GroupBy_CheckedChanged(object sender, EventArgs e)
  587. {
  588. CommonMethod.SetGridGroupBy(ref this.ultraGrid1, cbx_GroupBy.Checked);
  589. CommonMethod.SetGridSumArea(this.ultraGrid1);
  590. }
  591. private void chkStoveNo_CheckedChanged(object sender, EventArgs e)
  592. {
  593. this.txtStoveNo.Enabled = this.chkStoveNo.Checked;
  594. }
  595. private void chkJudgeNo_CheckedChanged(object sender, EventArgs e)
  596. {
  597. this.txtJudgeNo.Enabled = this.chkJudgeNo.Checked;
  598. }
  599. private void txtStoveNo_KeyDown(object sender, KeyEventArgs e)
  600. {
  601. if (e.KeyValue == 13)
  602. {
  603. QueryData();
  604. }
  605. }
  606. private void txtJudgeNo_KeyDown(object sender, KeyEventArgs e)
  607. {
  608. if (e.KeyValue == 13)
  609. {
  610. QueryData();
  611. }
  612. }
  613. private void txtOrder_KeyDown(object sender, KeyEventArgs e)
  614. {
  615. if (e.KeyValue == 13)
  616. {
  617. QueryData();
  618. }
  619. }
  620. private void chkOrder_CheckedChanged(object sender, EventArgs e)
  621. {
  622. this.txtOrder.Enabled = this.chkOrder.Checked;
  623. }
  624. private void chkFlagStoveNo_CheckedChanged(object sender, EventArgs e)
  625. {
  626. this.txtFlagStoveNo.Enabled = this.chkFlagStoveNo.Checked;
  627. }
  628. private void chkRegTime_CheckedChanged(object sender, EventArgs e)
  629. {
  630. this.RegStartTime.Enabled = this.RegEndTime.Enabled = this.chkRegTime.Checked;
  631. }
  632. private void chkYearMoth_CheckedChanged(object sender, EventArgs e)
  633. {
  634. dataYearMoth.Enabled = this.chkYearMoth.Checked;
  635. }
  636. }
  637. }