bd619816814ab12c617b42787df56db8d381fd0f.svn-base 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470
  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 System.Collections;
  10. using CoreFS.CA06;
  11. namespace Core.LZMes.Client.UIM
  12. {
  13. public partial class UIM060020 : FrmBase
  14. {
  15. //钢卷号
  16. private string COIL_NO = "";
  17. public UIM060020()
  18. {
  19. InitializeComponent();
  20. }
  21. private void ultraGrid1_InitializeLayout(object sender, Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs e)
  22. {
  23. }
  24. public override void ToolBar_Click(object sender, string ToolbarKey)
  25. {
  26. switch (ToolbarKey)
  27. {
  28. case "Query":
  29. this.DoQuery();
  30. break;
  31. case "Save":
  32. this.DoSave();
  33. break;
  34. case "Exit":
  35. this.Close();
  36. break;
  37. }
  38. }
  39. /// <summary>
  40. /// 查询钢卷在系统中的位置
  41. /// </summary>
  42. private void DoQuery()
  43. {
  44. try
  45. {
  46. this.dataSet1.Tables[0].Clear();
  47. string coilNo = this.textBox1.Text.Trim();
  48. //外购卷入库可以直接调用热送入库查询钢卷信息
  49. CoreClientParam ccp = new CoreClientParam();
  50. ccp.ServerName = "UIM.UIM010040";
  51. ccp.MethodName = "queryCoilStatus";
  52. ccp.ServerParams = new object[] { coilNo };
  53. ccp.SourceDataTable = this.dataSet1.Tables[0];
  54. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  55. COIL_NO = coilNo;
  56. }
  57. catch (Exception EX)
  58. {
  59. MessageBox.Show(EX.ToString());
  60. }
  61. }
  62. /// <summary>
  63. /// 原料库外购卷入库
  64. /// </summary>
  65. private void DoSave()
  66. {
  67. if (textBox1.Text.Trim().Equals(""))
  68. {
  69. MessageBox.Show("钢卷号不能为空,请输入钢卷号!");
  70. textBox1.Focus();
  71. return;
  72. }
  73. if (this.ultraComboEditor3.SelectedIndex < 0)
  74. {
  75. MessageBox.Show("标准号不能为空,请选择标准号!");
  76. this.ultraComboEditor3.Focus();
  77. return;
  78. }
  79. if (this.ultraComboEditor4.SelectedIndex < 0)
  80. {
  81. MessageBox.Show("标准牌号不能为空,请选择标准牌号!");
  82. this.ultraComboEditor4.Focus();
  83. return;
  84. }
  85. if (this.ultraComboEditor5.SelectedIndex < 0)
  86. {
  87. MessageBox.Show("订单用途不能为空,请选择订单用途!");
  88. this.ultraComboEditor5.Focus();
  89. return;
  90. }
  91. if (this.ultraComboEditor1.SelectedIndex < 0)
  92. {
  93. MessageBox.Show("交货状态不能为空,请选择交货状态!");
  94. this.ultraComboEditor1.Focus();
  95. return;
  96. }
  97. if (this.textBox11.Text.Trim().Equals(""))
  98. {
  99. MessageBox.Show("厚度不能为空,请输入厚度!");
  100. this.textBox11.Focus();
  101. return;
  102. }
  103. if (this.textBox9.Text.Trim().Equals(""))
  104. {
  105. MessageBox.Show("宽度不能为空,请输入宽度!");
  106. this.textBox9.Focus();
  107. return;
  108. }
  109. if (this.textBox13.Text.Trim().Equals(""))
  110. {
  111. MessageBox.Show("长度不能为空,请输入长度!");
  112. this.textBox13.Focus();
  113. return;
  114. }
  115. if (this.textBox12.Text.Trim().Equals(""))
  116. {
  117. MessageBox.Show("重量不能为空,请输入重量!");
  118. this.textBox12.Focus();
  119. return;
  120. }
  121. if (this.textBox14.Text.Trim().Equals(""))
  122. {
  123. MessageBox.Show("外径不能为空,请输入外径!");
  124. this.textBox14.Focus();
  125. return;
  126. }
  127. if (this.textBox15.Text.Trim().Equals(""))
  128. {
  129. MessageBox.Show("内径不能为空,请输入内径!");
  130. this.textBox15.Focus();
  131. return;
  132. }
  133. if (this.textBox4.Text.Trim().Equals(""))
  134. {
  135. MessageBox.Show("炉号不能为空,请输入炉号!");
  136. this.textBox4.Focus();
  137. return;
  138. }
  139. string coilNo = textBox1.Text.Trim();
  140. CoreClientParam ccp = new CoreClientParam();
  141. ccp.ServerName = "UIM.UIM06.UIM060020";
  142. ccp.MethodName = "queryColdCoilNo";
  143. ccp.ServerParams = new object[] { coilNo };
  144. ccp = this.ExecuteQuery(ccp, CoreInvokeType.Internal);
  145. if (ccp.ReturnObject != null)
  146. {
  147. int haveCoil = int.Parse(ccp.ReturnObject.ToString());
  148. if (haveCoil > 0)
  149. {
  150. MessageBox.Show("钢卷号在系统中已经存在,请重新输入!");
  151. textBox1.Focus();
  152. return;
  153. }
  154. }
  155. UIM060021 dlg = new UIM060021(this, 1);
  156. if (DialogResult.OK == dlg.ShowDialog(this))
  157. {
  158. string yardAddr = dlg.YARD_ADDR;//垛位
  159. string entryShift = this.UserInfo.GetUserGroup();//入库班次
  160. string entryGroup = this.UserInfo.GetUserOrder();//入库班组
  161. string entryDtime = this.ultraDateTimeEditor1.DateTime.ToString("yyyyMMddHHmmss");//入库时间
  162. string reg_id = this.UserInfo.GetUserID();//操作人
  163. //入库操作信息
  164. string[] entryInfo = new string[] { yardAddr, entryShift, entryGroup, entryDtime, reg_id };
  165. string specAbbssym = ultraComboEditor3.Value.ToString();
  166. string specStlGrd = ultraComboEditor4.Value.ToString();
  167. string ordUseTp = ultraComboEditor5.Value.ToString();
  168. string prodNm = ultraComboEditor1.Value.ToString();
  169. double thk = double.Parse(textBox11.Text.Trim());
  170. double wth = double.Parse(textBox9.Text.Trim());
  171. double len = double.Parse(textBox12.Text.Trim());
  172. double wgt = double.Parse(textBox13.Text.Trim());
  173. double outida = double.Parse(textBox14.Text.Trim());
  174. double india = double.Parse(textBox15.Text.Trim());
  175. string chargeNo = textBox4.Text.Trim();
  176. //牌号 规格 炉号备注等信息
  177. string[] coilInfo = new string[] { specAbbssym, specStlGrd, ordUseTp, prodNm
  178. , thk.ToString(), wth.ToString(), len.ToString(), wgt.ToString(), outida.ToString(), india.ToString()
  179. , chargeNo};
  180. ArrayList qltyList = new ArrayList();//材质信息
  181. int qltySize = dataSet1.Tables[0].Rows.Count;
  182. for (int i = 0; i < qltySize; i++)
  183. {
  184. Infragistics.Win.UltraWinGrid.UltraGridRow uRow = ultraGrid1.Rows[i];
  185. if (null != uRow.Cells["QLTY_VALUE1"].Text && !uRow.Cells["QLTY_VALUE1"].Text.Trim().Equals(""))
  186. {
  187. string[] param = new string[5];
  188. param[0] = uRow.Cells["QLTY_CD_CFNM"].Text;
  189. param[1] = uRow.Cells["QLTY_VALUE1"].Text.Trim();
  190. param[2] = uRow.Cells["QLTY_VALUE2"].Text.Trim();
  191. param[3] = uRow.Cells["QLTY_VALUE3"].Text.Trim();
  192. param[4] = uRow.Cells["QLTY_VALUE4"].Text.Trim();
  193. qltyList.Add(param);
  194. }
  195. }
  196. ArrayList chemList = new ArrayList();//材质信息
  197. int chemSize = dataSet2.Tables[0].Rows.Count;
  198. for (int i = 0; i < chemSize; i++)
  199. {
  200. Infragistics.Win.UltraWinGrid.UltraGridRow uRow = ultraGrid2.Rows[i];
  201. if (null != uRow.Cells["CHEM_DIS_VALUE"].Text && !uRow.Cells["CHEM_DIS_VALUE"].Text.Trim().Equals(""))
  202. {
  203. string[] param = new string[3];
  204. param[0] = uRow.Cells["CHEM_CD"].Text;
  205. param[1] = uRow.Cells["CHEM_DIS_VALUE"].Text.Trim();
  206. param[2] = uRow.Cells["REMARK"].Text.Trim();
  207. chemList.Add(param);
  208. }
  209. }
  210. CoreClientParam ccp1 = new CoreClientParam();
  211. ccp1.ServerName = "UIM.UIM06.UIM060020";
  212. ccp1.MethodName = "saveCoilYard";
  213. ccp1.ServerParams = new object[] { coilNo, entryInfo, coilInfo, qltyList, chemList };
  214. ccp1 = this.ExecuteNonQuery(ccp1, CoreInvokeType.Internal);
  215. }
  216. }
  217. private void UIM060020_Load(object sender, EventArgs e)
  218. {
  219. int size = 0;
  220. //标准号
  221. ArrayList specAbbsymList = this.queryCommFun("UIM.UIM06.UIM060020", "querySpecAbbsymList");
  222. size = specAbbsymList.Count;
  223. Infragistics.Win.ValueListItem[] valueListItems1 = new Infragistics.Win.ValueListItem[size];
  224. for (int i = 0; i < size; i++)
  225. {
  226. Infragistics.Win.ValueListItem item = new Infragistics.Win.ValueListItem();
  227. Hashtable ht = (Hashtable)specAbbsymList[i];
  228. item.DataValue = ht["SPEC_ABBSYM"].ToString();
  229. item.DisplayText = ht["SPEC_ABBSYM"].ToString(); ;
  230. valueListItems1[i] = item;
  231. }
  232. this.ultraComboEditor3.Items.AddRange(valueListItems1);
  233. //标准牌号
  234. ArrayList specStlGrdList = this.queryCommFun("UIM.UIM06.UIM060020", "querySpecStlGrdList");
  235. size = specStlGrdList.Count;
  236. Infragistics.Win.ValueListItem[] valueListItems2 = new Infragistics.Win.ValueListItem[size];
  237. for (int i = 0; i < size; i++)
  238. {
  239. Infragistics.Win.ValueListItem item = new Infragistics.Win.ValueListItem();
  240. Hashtable ht = (Hashtable)specStlGrdList[i];
  241. item.DataValue = ht["SPEC_STL_GRD"].ToString();
  242. item.DisplayText = ht["SPEC_STL_GRD"].ToString(); ;
  243. valueListItems2[i] = item;
  244. }
  245. this.ultraComboEditor4.Items.AddRange(valueListItems2);
  246. //订单用途
  247. ArrayList ordUseTyList = this.queryCommFun("UIM.UIM06.UIM060020", "queryOrdUseTyList");
  248. size = ordUseTyList.Count;
  249. Infragistics.Win.ValueListItem[] valueListItems3 = new Infragistics.Win.ValueListItem[size];
  250. for (int i = 0; i < size; i++)
  251. {
  252. Infragistics.Win.ValueListItem item = new Infragistics.Win.ValueListItem();
  253. Hashtable ht = (Hashtable)ordUseTyList[i];
  254. item.DataValue = ht["SM_CD"].ToString();
  255. item.DisplayText = ht["SM_CFNM"].ToString(); ;
  256. valueListItems3[i] = item;
  257. }
  258. this.ultraComboEditor5.Items.AddRange(valueListItems3);
  259. //交货状态
  260. ArrayList prodNmList = this.queryCommFun("UIM.UIM06.UIM060020", "queryProdNmList");
  261. size = prodNmList.Count;
  262. Infragistics.Win.ValueListItem[] valueListItems4 = new Infragistics.Win.ValueListItem[size];
  263. for (int i = 0; i < size; i++)
  264. {
  265. Infragistics.Win.ValueListItem item = new Infragistics.Win.ValueListItem();
  266. Hashtable ht = (Hashtable)prodNmList[i];
  267. item.DataValue = ht["PRDNM_CD"].ToString();
  268. item.DisplayText = ht["PRDNM_CD"].ToString(); ;
  269. valueListItems4[i] = item;
  270. }
  271. this.ultraComboEditor1.Items.AddRange(valueListItems4);
  272. //成份信息
  273. this.dataSet2.Tables[0].Clear();
  274. CoreClientParam ccp = new CoreClientParam();
  275. ccp.ServerName = "UIM.UIM06.UIM060020";
  276. ccp.MethodName = "queryChemList";
  277. ccp.SourceDataTable = this.dataSet2.Tables[0];
  278. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  279. }
  280. private ArrayList queryCommFun(string serverName, string methodName)
  281. {
  282. CoreClientParam ccp = new CoreClientParam();
  283. ccp.ServerName = serverName;
  284. ccp.MethodName = methodName;
  285. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  286. ArrayList list = (ArrayList)ccp.ReturnObject;
  287. return list;
  288. }
  289. private void label2_Click(object sender, EventArgs e)
  290. {
  291. if (this.ultraComboEditor3.SelectedIndex < 0)
  292. {
  293. MessageBox.Show("标准号不能为空,请选择标准号!");
  294. this.ultraComboEditor3.Focus();
  295. return;
  296. }
  297. if (this.ultraComboEditor4.SelectedIndex < 0)
  298. {
  299. MessageBox.Show("标准牍号不能为空,请选择标准牌号!");
  300. this.ultraComboEditor4.Focus();
  301. return;
  302. }
  303. if (this.ultraComboEditor5.SelectedIndex < 0)
  304. {
  305. MessageBox.Show("订单用途不能为空,请选择订单用途!");
  306. this.ultraComboEditor5.Focus();
  307. return;
  308. }
  309. if (this.ultraComboEditor1.SelectedIndex < 0)
  310. {
  311. MessageBox.Show("交货状态不能为空,请选择交货状态!");
  312. this.ultraComboEditor1.Focus();
  313. return;
  314. }
  315. if (this.textBox11.Text.Trim().Equals(""))
  316. {
  317. MessageBox.Show("厚度不能为空,请输入厚度!");
  318. this.textBox11.Focus();
  319. return;
  320. }
  321. double thk = 0;
  322. try
  323. {
  324. thk = double.Parse(textBox11.Text.Trim());
  325. }
  326. catch (Exception ex)
  327. {
  328. MessageBox.Show("厚度输入错误,请重新输入厚度!");
  329. this.textBox11.Focus();
  330. return;
  331. }
  332. string prdNmCd = this.ultraComboEditor1.Value.ToString();
  333. string specAbbsym = this.ultraComboEditor3.Value.ToString();
  334. string specStlGrd = this.ultraComboEditor4.Value.ToString();
  335. string ordUseTp = this.ultraComboEditor5.Value.ToString();
  336. this.dataSet1.Tables[0].Clear();
  337. CoreClientParam ccp = new CoreClientParam();
  338. ccp.ServerName = "UIM.UIM06.UIM060020";
  339. ccp.MethodName = "queryQltyList";
  340. ccp.ServerParams = new object[] { prdNmCd, specAbbsym, specStlGrd, ordUseTp, thk };
  341. ccp.SourceDataTable = this.dataSet1.Tables[0];
  342. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  343. }
  344. /// <summary>
  345. /// 查询区域中一行的垛位信息
  346. /// </summary>
  347. /// <param name="areayType"></param>
  348. /// <param name="areayNo"></param>
  349. /// <param name="yardCol"></param>
  350. internal void queryYardRows(int areaType, int areaNo, string yardCol)
  351. {
  352. this.dataSet4.Tables[0].Clear();
  353. CoreClientParam ccp = new CoreClientParam();
  354. ccp.ServerName = "UIM.UIM010070";
  355. ccp.MethodName = "queryYardRows";
  356. ccp.ServerParams = new object[] { areaType, areaNo, yardCol };
  357. ccp.SourceDataTable = this.dataSet4.Tables[0];
  358. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  359. }
  360. /// <summary>
  361. /// 查询区域中一行的垛位中钢卷信息
  362. /// </summary>
  363. /// <param name="areayType"></param>
  364. /// <param name="areayNo"></param>
  365. /// <param name="yardCol"></param>
  366. internal void queryYardRowCoils(int areaType, int areaNo, string yardCol)
  367. {
  368. this.dataSet3.Tables[0].Clear();
  369. CoreClientParam ccp = new CoreClientParam();
  370. ccp.ServerName = "UIM.UIM010070";
  371. ccp.MethodName = "queryYardRowCoils";
  372. ccp.ServerParams = new object[] { areaType, areaNo, yardCol };
  373. ccp.SourceDataTable = this.dataSet3.Tables[0];
  374. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  375. }
  376. internal int queryMinYardRow(int areaType, int areaNo, string yardCol)
  377. {
  378. int minRow = 1;
  379. CoreClientParam ccp = new CoreClientParam();
  380. ccp.ServerName = "UIM.UIM010070";
  381. ccp.MethodName = "queryMinYardRow";
  382. ccp.ServerParams = new object[] { areaType, areaNo, yardCol };
  383. ccp = this.ExecuteQuery(ccp, CoreInvokeType.Internal);
  384. if (ccp.ReturnObject != null)
  385. {
  386. minRow = int.Parse(ccp.ReturnObject.ToString());
  387. }
  388. return minRow;
  389. }
  390. /// <summary>
  391. /// 查询库存区域
  392. /// </summary>
  393. /// <param name="areaType"></param>
  394. /// <returns></returns>
  395. internal ArrayList queryYardAreas(int areaType)
  396. {
  397. CoreClientParam ccp = new CoreClientParam();
  398. ccp.ServerName = "UIM.UIM010040";
  399. ccp.MethodName = "queryYardAreas";
  400. ccp.ServerParams = new object[] { areaType };
  401. ccp = this.ExecuteQuery(ccp, CoreInvokeType.Internal);
  402. ArrayList retList = (ArrayList)ccp.ReturnObject;
  403. return retList;
  404. }
  405. /// <summary>
  406. /// 查询库存区分
  407. /// </summary>
  408. /// <param name="areaNo"></param>
  409. /// <returns></returns>
  410. internal ArrayList queryYardColsByArea(int areaNo)
  411. {
  412. CoreClientParam ccp = new CoreClientParam();
  413. ccp.ServerName = "UIM.UIM010040";
  414. ccp.MethodName = "queryYardColsByArea";
  415. ccp.ServerParams = new object[] { areaNo };
  416. ccp = this.ExecuteQuery(ccp, CoreInvokeType.Internal);
  417. ArrayList retList = (ArrayList)ccp.ReturnObject;
  418. return retList;
  419. }
  420. private void ultraGrid1_BeforeCellUpdate(object sender, Infragistics.Win.UltraWinGrid.BeforeCellUpdateEventArgs e)
  421. {
  422. Infragistics.Win.UltraWinGrid.UltraGrid grid = (Infragistics.Win.UltraWinGrid.UltraGrid)sender;
  423. string colKey = grid.ActiveCell.Column.Key;
  424. int index = grid.ActiveRow.Cells.IndexOf(colKey);
  425. if (index > 3 && (null == grid.ActiveRow.Cells[index - 1].Text || grid.ActiveRow.Cells[index - 1].Text.Trim().Equals("")))
  426. {
  427. MessageBox.Show("请按照实际值1、2、3、4的顺序输入材质信息!");
  428. return;
  429. }
  430. }
  431. }
  432. }