FrmBalanceDetailAccept.cs 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Text;
  7. using System.Windows.Forms;
  8. using System.Threading;
  9. using System.Collections;
  10. using System.Reflection;
  11. using CoreFS.CA06;
  12. namespace Core.StlMes.Client.Sale.UI.Balance.BalanceDetail
  13. {
  14. public partial class FrmBalanceDetailAccept : Core.StlMes.Client.Sale.Common.FrmStyleBase.FrmUIBase
  15. {
  16. DataSet dsMain = new DataSet();
  17. Core.StlMes.Client.Sale.BLL.SaleBusinessMgt.Trans.YdmZcLoadVehicleMatMgt ydmZcLoadVehicleMatMgt = null;
  18. public FrmBalanceDetailAccept()
  19. {
  20. InitializeComponent();
  21. }
  22. private void FrmBalanceDetailAccept_Load(object sender, EventArgs e)
  23. {
  24. this.checkBox1.Checked = true;
  25. ydmZcLoadVehicleMatMgt = new Core.StlMes.Client.Sale.BLL.SaleBusinessMgt.Trans.YdmZcLoadVehicleMatMgt(this.ob);
  26. dsMain = base.GetDataSetByColumnName(this.GetGrid1DataStructTg(),
  27. new Hashtable(), this.GetColumnAndCaption());
  28. this.ultraGrid1.DataSource = dsMain;
  29. HidenColumn();
  30. base.SetGridStyle(ref this.ultraGrid1);
  31. }
  32. public override void ToolBar_Click(object sender, string ToolbarKey)
  33. {
  34. switch (ToolbarKey)
  35. {
  36. case ToolbarKey_Query:
  37. {
  38. if (this.checkBox1.Checked)
  39. this.Query();
  40. else
  41. this.QueryVirtual();
  42. break;
  43. }
  44. case "Accept":
  45. {
  46. this.Accept();
  47. break;
  48. }
  49. case ToolbarKey_Close:
  50. {
  51. this.Close();
  52. break;
  53. }
  54. }
  55. }
  56. private void Query()
  57. {
  58. // this.dsMain.Clear();
  59. dsMain = base.GetDataSetByColumnName(this.GetGrid1DataStructTg(),
  60. new Hashtable(), this.GetColumnAndCaption());
  61. this.ultraGrid1.DataSource = this.dsMain;
  62. HidenColumn();
  63. base.SetGridStyle(ref this.ultraGrid1);
  64. // 获取所有关闭的提单
  65. DataSet ds = this.ydmZcLoadVehicleMatMgt.GetCanAcceptMatInfo();
  66. // 如果有查询条件,在原有记录中模糊查找
  67. if (this.textBox7.Text.Length > 0)
  68. ds = Util.UtilDataSet.GetDataSetWithRowFilterWithApproximateMatch(ds, this._BILL_NO, this.textBox7.Text.Trim());
  69. // 分组数据显示
  70. ds = Util.UtilDataSet.GetDateSetByGroupColumnAndStaticsColumnName(ds,
  71. this.GetGroupByName(), this.GetShowName(), this.GetStaticsName());
  72. // 填充数据到数据源显示
  73. Util.UtilDataSet.SetDataSetByMergeSameColumnName(ref dsMain,ds);
  74. SetRoudWgt();
  75. }
  76. private void HidenColumn()
  77. {
  78. try
  79. {
  80. foreach (string s in GetHideName())
  81. {
  82. this.ultraGrid1.DisplayLayout.Bands[0].Columns[s].Hidden = true;
  83. }
  84. }
  85. catch
  86. {
  87. }
  88. }
  89. private void SetRoudWgt()
  90. {
  91. try
  92. {
  93. foreach (DataRow dr in dsMain.Tables[0].Rows)
  94. {
  95. dr[_ACT_WEIGHT] = Math.Round(Convert.ToDouble(dr[_ACT_WEIGHT]), 4);
  96. }
  97. }
  98. catch
  99. { }
  100. }
  101. private void QueryVirtual()
  102. {
  103. DataSet dsShow = base.GetDataSetByColumnName(this.GetGrid1DataStructTgVirtualBillno(),
  104. new Hashtable(), this.GetColumnAndCaption());
  105. // 获取所有关闭的提单
  106. DataSet ds = this.ydmZcLoadVehicleMatMgt.GetUnAcceptVirtulYdmZcBillM();
  107. // 如果有查询条件,在原有记录中模糊查找
  108. if (this.textBox7.Text.Length > 0)
  109. ds = Util.UtilDataSet.GetDataSetWithRowFilterWithApproximateMatch(ds, this._BILL_NO, this.textBox7.Text.Trim());
  110. // 填充数据到数据源显示
  111. Util.UtilDataSet.SetDataSetByMergeSameColumnName(ref dsShow, ds);
  112. this.ultraGrid1.DataSource = dsShow;
  113. }
  114. private void Accept()
  115. {
  116. if (this.ultraGrid1.Rows.Count == 0)
  117. return;
  118. if (this.ultraGrid1.Rows.Count == 1)
  119. this.ultraGrid1.Rows[0].Selected = true;
  120. // this.ultraGrid1.ActiveRow.Selected = true;
  121. ArrayList listBillNo = new ArrayList();
  122. string billNo = "";
  123. if (this.ultraGrid1.Selected.Rows.Count == 0)
  124. {
  125. Core.StlMes.Client.Sale.Util.MessageUtil.ShowError("请选择需要接收的行");
  126. return;
  127. }
  128. foreach (Infragistics.Win.UltraWinGrid.UltraGridRow ugr in this.ultraGrid1.Selected.Rows)
  129. {
  130. billNo = ugr.Cells[_BILL_NO].Value.ToString();
  131. if (!listBillNo.Contains(billNo))
  132. {
  133. listBillNo.Add(billNo);
  134. }
  135. }
  136. string errMsg = "";
  137. foreach (string s in listBillNo)
  138. {
  139. this.ydmZcLoadVehicleMatMgt.AcceptSignle(s,out errMsg);
  140. if (errMsg.Length > 0)
  141. {
  142. return;
  143. }
  144. else
  145. {
  146. DataRow[] drs = this.dsMain.Tables[0].Select(string.Format(" BILL_NO = '{0}' ",s));
  147. foreach (DataRow dr in drs)
  148. {
  149. this.dsMain.Tables[0].Rows.Remove(dr);
  150. }
  151. }
  152. }
  153. Core.StlMes.Client.Sale.Util.MessageUtil.ShowTips("操作成功");
  154. if (this.checkBox1.Checked)
  155. this.Query();
  156. else
  157. this.QueryVirtual();
  158. }
  159. private string[] GetKeys()
  160. {
  161. try
  162. {
  163. return base.QueryStrings;
  164. }
  165. catch
  166. {
  167. return new string[] { };
  168. }
  169. }
  170. private string[] GetGrid1DataStructTg()
  171. {
  172. return new string[]
  173. {
  174. this._BILL_NO,
  175. // this._BILL_NO_XH,
  176. this._ORDER_NO,
  177. this._ORDER_SEQ,
  178. this._ORDER_SEQ_NO,
  179. this._ACT_COUNT,
  180. this._ACT_WEIGHT,
  181. _ACT_THEORY_WEIGHT,
  182. this._STEELNAME,
  183. this._GRADENAME,
  184. this._STD_STYLE_DESC,
  185. this._SPEC_NAME,
  186. this._MODEL_DESC,
  187. this._PLINE_NAME,
  188. this._ACT_DIMATER,
  189. this._ACT_HEIGHT
  190. // this._ACT_LEN
  191. };
  192. }
  193. private string[] GetGrid1DataStructTgVirtualBillno()
  194. {
  195. return new string[]
  196. {
  197. this._BILL_NO,
  198. // this._BILL_NO_XH,
  199. this._ORDER_NO,
  200. this._ORDER_SEQ,
  201. "DELIVERY_NO",
  202. "PLAN_WT",
  203. "PLAN_NUM",
  204. "SPEC_NAME",
  205. "STATION_NM",
  206. "SPCL_LN_NM",
  207. "SALE_ORG_DESC",
  208. "CUSTOMER_NM",
  209. "RECEIV_NM",
  210. "STEELNAME",
  211. "MEMO"
  212. };
  213. }
  214. private List<string> GetGroupByName()
  215. {
  216. List<string> list = new List<string>();
  217. list.Add(_BILL_NO);
  218. // list.Add(_BILL_NO_XH);
  219. list.Add(_ORDER_NO);
  220. list.Add(_ORDER_SEQ);
  221. list.Add(_ORDER_SEQ_NO);
  222. return list;
  223. }
  224. private List<string> GetStaticsName()
  225. {
  226. List<string> list = new List<string>();
  227. list.Add(this._ACT_COUNT);
  228. list.Add(this._ACT_WEIGHT);
  229. list.Add(_ACT_THEORY_WEIGHT);
  230. return list;
  231. }
  232. private List<string> GetShowName()
  233. {
  234. List<string> list = new List<string>(GetGrid1DataStructTg());
  235. return list;
  236. }
  237. private List<string> GetHideName()
  238. {
  239. List<string> list = new List<string>(new string[]{ this._GRADENAME,
  240. this._STD_STYLE_DESC,
  241. this._SPEC_NAME,_PLINE_NAME});
  242. return list;
  243. }
  244. private string[] GetGrid1DataStruct()
  245. {
  246. return new string[]
  247. {
  248. "ASKPLAN_ID",
  249. "TRANSTYPE",
  250. "PICKSTORAGETIME",
  251. "QUANTITY",
  252. "WEIGHT",
  253. "TRAINWAGON",
  254. "SHIPNO",
  255. "BUYERCODE",
  256. "STATIONCODE",
  257. "INCEPTCORPCODE",
  258. "ACCEPT_STATUS"
  259. }
  260. ;
  261. }
  262. private string[] GetGrid2DataStruct()
  263. {
  264. return new string[]
  265. {
  266. "SERIALNUMBER",
  267. "ORDERNO",
  268. "PLY",
  269. "WIDTH",
  270. "LENGTH",
  271. "WEIGHT",
  272. "STEELCODE",
  273. "STOVENO",
  274. }
  275. ;
  276. }
  277. private Hashtable GetColumnAndCaption()
  278. {
  279. if (GetKeys().Length > 0)
  280. {
  281. if (this.GetKeys()[0] == "0")
  282. return GetColumnAndCaptionForSlab();
  283. else
  284. return GetColumnAndCaptionForTube();
  285. }
  286. return GetColumnAndCaptionForTube();
  287. }
  288. /// <summary>
  289. /// 钢管重命名
  290. /// </summary>
  291. /// <returns></returns>
  292. private Hashtable GetColumnAndCaptionForTube()
  293. {
  294. Hashtable hs = new Hashtable();
  295. hs.Add("QUANTITY", "支数");
  296. hs.Add("WEIGHT", "重量");
  297. hs.Add("SHIPNO", "船号");
  298. hs.Add("PLY", "壁厚");
  299. hs.Add("WIDTH", "外径");
  300. hs.Add("ACCEPT_STATUS", "接收结果");
  301. hs.Add("SERIALNUMBER", "序号");
  302. hs.Add(_BILL_NO, "提单号");
  303. hs.Add(_BILL_NO_XH, "序号");
  304. hs.Add(_ORDER_NO, "合同号");
  305. hs.Add(_ORDER_SEQ, "行号");
  306. hs.Add(_ORDER_SEQ_NO, "交货行");
  307. hs.Add(_ACT_COUNT, "支数");
  308. hs.Add(_ACT_WEIGHT, "重量");
  309. hs.Add(_ACT_THEORY_WEIGHT, "理论重量");
  310. hs.Add(_STEELNAME, "钢级(牌号)");
  311. hs.Add(_GRADENAME, "钢种名称");
  312. hs.Add(_STD_STYLE_DESC, "标准类别");
  313. hs.Add(_SPEC_NAME, "产品规格");
  314. hs.Add(_MODEL_DESC, "扣型");
  315. hs.Add(_PLINE_NAME, "产线");
  316. hs.Add(_ACT_DIMATER, "外径");
  317. hs.Add(_ACT_HEIGHT, "壁厚");
  318. hs.Add(_ACT_LEN, "长度");
  319. hs.Add("STATION_NM", "到站");
  320. hs.Add("SPCL_LN_NM", "专用线");
  321. hs.Add("SALE_ORG_DESC", "销售组织");
  322. hs.Add("CUSTOMER_NM", "订货单位");
  323. hs.Add("RECEIV_NM", "收货单位");
  324. hs.Add("PLAN_NUM", "支数");
  325. hs.Add("PLAN_WT", "重量");
  326. hs.Add("MEMO", "备注");
  327. hs.Add("DELIVERY_NO", "交货行");
  328. return hs;
  329. }
  330. /// <summary>
  331. /// 其他
  332. /// </summary>
  333. /// <returns></returns>
  334. private Hashtable GetColumnAndCaptionForSlab()
  335. {
  336. Hashtable hs = new Hashtable();
  337. hs.Add("QUANTITY", "支数");
  338. hs.Add("WEIGHT", "重量");
  339. hs.Add("SHIPNO", "船号");
  340. hs.Add("ACCEPT_STATUS", "接收结果");
  341. hs.Add("SERIALNUMBER", "序号");
  342. return hs;
  343. }
  344. protected override Hashtable GetGridColumnLength()
  345. {
  346. Hashtable hs = new Hashtable();
  347. hs.Add("SHIPNO",80);
  348. hs.Add(_BILL_NO, 120);
  349. hs.Add(_BILL_NO_XH, 80);
  350. hs.Add(_ORDER_NO, 100);
  351. hs.Add(_ORDER_SEQ, 60);
  352. hs.Add(_ORDER_SEQ_NO, 60);
  353. hs.Add(_ACT_COUNT, 60);
  354. hs.Add(_ACT_WEIGHT, 60);
  355. hs.Add(_ACT_THEORY_WEIGHT, 60);
  356. hs.Add(_STEELNAME, 80);
  357. hs.Add(_GRADENAME, 80);
  358. hs.Add(_STD_STYLE_DESC, 120);
  359. hs.Add(_SPEC_NAME,120);
  360. hs.Add(_MODEL_DESC, 80);
  361. hs.Add(_PLINE_NAME, 80);
  362. hs.Add(_ACT_DIMATER, 60);
  363. hs.Add(_ACT_HEIGHT, 60);
  364. hs.Add(_ACT_LEN, 60);
  365. return hs;
  366. }
  367. private string _LOADVEHICLE_SQE = "LOADVEHICLE_SQE";
  368. private string _LOADVEHICLE_NO = "LOADVEHICLE_NO";
  369. private string _BILL_NO = "BILL_NO";
  370. private string _BILL_NO_XH = "BILL_NO_XH";
  371. private string _TALLYSHEET_NO = "TALLYSHEET_NO";
  372. private string _VEHICLE_NO = "VEHICLE_NO";
  373. private string _ORDER_NO = "ORDER_NO";
  374. private string _ORDER_SEQ = "ORDER_SEQ";
  375. private string _ORDER_SEQ_NO = "ORDER_SEQ_NO";
  376. private string _PRO_ORDER_NO = "PRO_ORDER_NO";
  377. private string _MAT_NO = "MAT_NO";
  378. private string _LOT_NO = "LOT_NO";
  379. private string _JUDGE_STOVE_NO = "JUDGE_STOVE_NO";
  380. private string _BATCH_NO = "BATCH_NO";
  381. private string _GROUP_NO = "GROUP_NO";
  382. private string _STOVE_NO = "STOVE_NO";
  383. private string _MATERIAL_NO = "MATERIAL_NO";
  384. private string _MATERIAL_NAME = "MATERIAL_NAME";
  385. private string _PRODUCCODE = "PRODUCCODE";
  386. private string _PRODUCNAME = "PRODUCNAME";
  387. private string _STD_CODE = "STD_CODE";
  388. private string _STD_NAME = "STD_NAME";
  389. private string _GRADECODE = "GRADECODE";
  390. private string _GRADENAME = "GRADENAME";
  391. private string _STEELCODE = "STEELCODE";
  392. private string _STEELNAME = "STEELNAME";
  393. private string _STD_STYLE = "STD_STYLE";
  394. private string _STD_STYLE_DESC = "STD_STYLE_DESC";
  395. private string _SPEC_CODE = "SPEC_CODE";
  396. private string _SPEC_NAME = "SPEC_NAME";
  397. private string _MODEL_CODE = "MODEL_CODE";
  398. private string _MODEL_DESC = "MODEL_DESC";
  399. private string _PROCESS_CDOE = "PROCESS_CDOE";
  400. private string _PROCESS_DESC = "PROCESS_DESC";
  401. private string _PLINE_CODE = "PLINE_CODE";
  402. private string _PLINE_NAME = "PLINE_NAME";
  403. private string _ACT_DIMATER = "ACT_DIMATER";
  404. private string _ACT_HEIGHT = "ACT_HEIGHT";
  405. private string _ACT_LEN = "ACT_LEN";
  406. private string _ACT_LEN_MIN = "ACT_LEN_MIN";
  407. private string _ACT_LEN_MAX = "ACT_LEN_MAX";
  408. private string _ACT_COUNT = "ACT_COUNT";
  409. private string _ACT_WEIGHT = "ACT_WEIGHT";
  410. private string _ACT_THEORY_WEIGHT = "ACT_THEORY_WEIGHT";
  411. private string _JUDGE_RESULT_CODE = "JUDGE_RESULT_CODE";
  412. private string _PRO_BC = "PRO_BC";
  413. private string _PRO_BZ = "PRO_BZ";
  414. private string _RPO_TIME = "RPO_TIME";
  415. private string _SEN_BC = "SEN_BC";
  416. private string _SEN_BZ = "SEN_BZ";
  417. private string _SEN_TIME = "SEN_TIME";
  418. private string _ZBS_BH = "ZBS_BH";
  419. private string _SALE_ORG = "SALE_ORG";
  420. private string _SALE_ORG_DESC = "SALE_ORG_DESC";
  421. private string _SALE_AREA = "SALE_AREA";
  422. private string _STORAGE_TYPE_NO = "STORAGE_TYPE_NO";
  423. private string _STORAGE_TYPE_NAME = "STORAGE_TYPE_NAME";
  424. private string _MANAGEMENT_NO = "MANAGEMENT_NO";
  425. private string _MANAGEMENT_NAME = "MANAGEMENT_NAME";
  426. private string _UPLOAD_WEB_FLAG = "UPLOAD_WEB_FLAG";
  427. private string _STORAGE_NO = "STORAGE_NO";
  428. private string _LOCATION_NO = "LOCATION_NO";
  429. private string _LARY_NO = "LARY_NO";
  430. private string _LOC_NO = "LOC_NO";
  431. private string _TRANS_TPE = "TRANS_TPE";
  432. private string _RECEIV_NO = "RECEIV_NO";
  433. private string _RECEIV_NM = "RECEIV_NM";
  434. private string _STATION_NO = "STATION_NO";
  435. private string _STATION_NM = "STATION_NM";
  436. private string _SPCL_LN_NO = "SPCL_LN_NO";
  437. private string _SPCL_LN_NM = "SPCL_LN_NM";
  438. private string _PORT = "PORT";
  439. private string _PLANT = "PLANT";
  440. private string _PLANT_DESC = "PLANT_DESC";
  441. private string _VSTEL = "VSTEL";
  442. private string _VSTEL_DESC = "VSTEL_DESC";
  443. private string _CARRY_COMPANY_CODE = "CARRY_COMPANY_CODE";
  444. private string _CARRY_COMPANY_NAME = "CARRY_COMPANY_NAME";
  445. private string _OUT_STOCK_CODE = "OUT_STOCK_CODE";
  446. private string _DELIVY_PLACE_CODE = "DELIVY_PLACE_CODE";
  447. private string _DELIVY_PLACE_NAME = "DELIVY_PLACE_NAME";
  448. private string _STLMT_UNIT_NO = "STLMT_UNIT_NO";
  449. private string _STLMT_UNIT_NM = "STLMT_UNIT_NM";
  450. private string _DELIVY_TIME = "DELIVY_TIME";
  451. private string _MEMO = "MEMO";
  452. private string _VALIDFLAG = "VALIDFLAG";
  453. private string _CREATE_NAME = "CREATE_NAME";
  454. private string _CREATE_TIME = "CREATE_TIME";
  455. private string _UPDATE_NAME = "UPDATE_NAME";
  456. private string _UPDATE_TIME = "UPDATE_TIME";
  457. private string _DELETE_NAME = "DELETE_NAME";
  458. private string _DELETE_TIME = "DELETE_TIME";
  459. }
  460. }