UIK020020.cs 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437
  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.Collections;
  9. using System.Windows.Forms;
  10. using CoreFS.CA06;
  11. namespace Core.LZMes.Client.UIK
  12. {
  13. public partial class UIK020020 : FrmBase
  14. {
  15. private string UPDATE_FLAG = "";
  16. public UIK020020()
  17. {
  18. InitializeComponent();
  19. }
  20. public override void ToolBar_Click(object sender, string ToolbarKey)
  21. {
  22. switch (ToolbarKey)
  23. {
  24. case "Query":
  25. this.DoQuery();
  26. break;
  27. case "Save":
  28. this.DoSave();
  29. break;
  30. case "Exit":
  31. this.Close();
  32. break;
  33. }
  34. }
  35. private void DoQuery()
  36. {
  37. try
  38. {
  39. string c_coilCold = this.ultraComboEditor1.Text.Trim();
  40. this.dataSet1.Tables[0].Clear();
  41. this.dataSet2.Tables[0].Clear();
  42. this.dataSet3.Tables[0].Clear();
  43. CoreClientParam ccp = new CoreClientParam();
  44. ccp.ServerName = "UIK.UIK02.UIK020020";
  45. ccp.MethodName = "queryAcidRollingResult";
  46. ccp.ServerParams = new Object[] { c_coilCold,textBox2.Text };
  47. ccp = this.ExecuteQuery(ccp, CoreInvokeType.Internal);
  48. ArrayList list = (ArrayList)ccp.ReturnObject;
  49. if (list != null && 0 < list.Count)
  50. {
  51. Hashtable ht = (Hashtable)list[0];
  52. DataRow dr = dataSet1.Tables[0].NewRow();
  53. for (int i = 0; i < dataSet1.Tables[0].Columns.Count; i++)
  54. {
  55. object obj = ht[dataSet1.Tables[0].Columns[i].ColumnName];
  56. if (null == obj)
  57. {
  58. continue;
  59. }
  60. if (obj.GetType().Equals(typeof(Hashtable)))
  61. {
  62. dr[i] = ((Hashtable)obj)["value"];
  63. }
  64. else
  65. {
  66. dr[i] = obj;
  67. }
  68. }
  69. dataSet1.Tables[0].Rows.Add(dr);
  70. ultraGrid1.Rows[0].Cells["L_COIL_NO"].Activation = Infragistics.Win.UltraWinGrid.Activation.NoEdit;
  71. //ultraGrid1.Rows[0].Cells["MILL_DTIME"].Activation = Infragistics.Win.UltraWinGrid.Activation.NoEdit;
  72. //ultraGrid1.Rows[0].Cells["SLEEVE"].Activation = Infragistics.Win.UltraWinGrid.Activation.NoEdit;
  73. //ultraGrid1.Rows[0].Cells["NO_DEFECT"].Activation = Infragistics.Win.UltraWinGrid.Activation.NoEdit;
  74. //ultraGrid1.Rows[0].Cells["NO_STRIP"].Activation = Infragistics.Win.UltraWinGrid.Activation.NoEdit;
  75. //带钢数
  76. int noStrip = int.Parse(((Hashtable)ht["NO_STRIP"])["value"].ToString());
  77. for (int i = 0; i < 3; i++)
  78. {
  79. dr = dataSet2.Tables[0].NewRow();
  80. for (int j = 0; j < dataSet2.Tables[0].Columns.Count; j++)
  81. {
  82. object obj = ht[dataSet2.Tables[0].Columns[j].ColumnName + (i + 1)];
  83. if (null == obj)
  84. {
  85. obj = ht[dataSet2.Tables[0].Columns[j].ColumnName + "_" + (i + 1)];
  86. }
  87. if (null == obj)
  88. {
  89. continue;
  90. }
  91. if (obj.GetType().Equals(typeof(Hashtable)))
  92. {
  93. dr[j] = ((Hashtable)obj)["value"];
  94. }
  95. else
  96. {
  97. dr[j] = obj;
  98. }
  99. }
  100. dataSet2.Tables[0].Rows.Add(dr);
  101. }
  102. //缺陷数
  103. int noDefect = int.Parse(((Hashtable)ht["NO_DEFECT"])["value"].ToString());
  104. for (int i = 0; i < 20; i++)
  105. {
  106. dr = dataSet3.Tables[0].NewRow();
  107. for (int j = 0; j < dataSet3.Tables[0].Columns.Count; j++)
  108. {
  109. object obj = ht[dataSet3.Tables[0].Columns[j].ColumnName + (i + 1)];
  110. if (null == obj)
  111. {
  112. obj = ht[dataSet3.Tables[0].Columns[j].ColumnName + "_" + (i + 1)];
  113. }
  114. if (null == obj)
  115. {
  116. continue;
  117. }
  118. if (obj.GetType().Equals(typeof(Hashtable)))
  119. {
  120. dr[j] = ((Hashtable)obj)["value"];
  121. }
  122. else
  123. {
  124. dr[j] = obj;
  125. }
  126. }
  127. dataSet3.Tables[0].Rows.Add(dr);
  128. }
  129. UPDATE_FLAG = "U";
  130. }
  131. else
  132. {
  133. dataTable1.Rows.Add(dataTable1.NewRow());
  134. ultraGrid1.Rows[0].Cells["L_COIL_NO"].Activation = Infragistics.Win.UltraWinGrid.Activation.AllowEdit;
  135. //ultraGrid1.Rows[0].Cells["MILL_DTIME"].Activation = Infragistics.Win.UltraWinGrid.Activation.AllowEdit;
  136. //ultraGrid1.Rows[0].Cells["SLEEVE"].Activation = Infragistics.Win.UltraWinGrid.Activation.AllowEdit;
  137. //ultraGrid1.Rows[0].Cells["NO_DEFECT"].Activation = Infragistics.Win.UltraWinGrid.Activation.AllowEdit;
  138. //ultraGrid1.Rows[0].Cells["NO_STRIP"].Activation = Infragistics.Win.UltraWinGrid.Activation.AllowEdit;
  139. for (int i = 0; i < 3; i++)
  140. {
  141. dataTable2.Rows.Add(dataTable2.NewRow());
  142. }
  143. for (int i = 0; i < 20; i++)
  144. {
  145. dataTable3.Rows.Add(dataTable3.NewRow());
  146. }
  147. UPDATE_FLAG = "A";
  148. }
  149. }
  150. catch (Exception ex)
  151. {
  152. MessageBox.Show(ex.Message);
  153. }
  154. }
  155. /// <summary>
  156. /// 修改酸轧实绩
  157. /// </summary>
  158. private void DoSave()
  159. {
  160. try
  161. {
  162. ultraGrid1.Update();
  163. ultraGrid2.Update();
  164. ultraGrid3.Update();
  165. gscoil();
  166. Infragistics.Win.UltraWinGrid.RowsCollection rs = this.ultraGrid1.Rows;
  167. if (rs.Count > 0)
  168. {
  169. string coilNo = rs[0].Cells["L_COIL_NO"].Text.Trim();
  170. string actWgt = rs[0].Cells["ACT_WGT"].Text.Trim();
  171. string coilLen = rs[0].Cells["COIL_LEN"].Text.Trim();
  172. string coilWth = rs[0].Cells["COIL_WTH"].Text.Trim();
  173. string coilThk = rs[0].Cells["COIL_THK"].Text.Trim();
  174. string coilIndia = rs[0].Cells["COIL_INDIA"].Text.Trim();
  175. string coilOutdia = rs[0].Cells["COIL_OUTDIA"].Text.Trim();
  176. string regId = this.UserInfo.GetUserID();
  177. if (coilNo.Equals(""))
  178. {
  179. MessageBox.Show("卷号不能为空!");
  180. return;
  181. }
  182. //if (actWgt.Equals(""))
  183. //{
  184. // MessageBox.Show("重量不能为空!");
  185. // return;
  186. //}
  187. if (coilWth.Equals(""))
  188. {
  189. MessageBox.Show("宽度不能为空!");
  190. return;
  191. }
  192. if (coilThk.Equals(""))
  193. {
  194. MessageBox.Show("厚度不能为空!");
  195. return;
  196. }
  197. CoreClientParam ccp = new CoreClientParam();
  198. ccp.ServerName = "UIK.UIK02.UIK020020";
  199. if (UPDATE_FLAG.Equals("U"))
  200. {
  201. ccp.MethodName = "updateAcidRollingResult";
  202. ccp.ServerParams = new Object[] { coilNo, actWgt, coilLen, coilWth, coilThk, coilIndia, coilOutdia, regId };
  203. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  204. }
  205. else if (UPDATE_FLAG.Equals("A"))
  206. {
  207. //查询冷卷号是否存在
  208. CoreClientParam ccp1 = new CoreClientParam();
  209. ccp1.ServerName = "UIK.UIK02.UIK020020";
  210. ccp1.MethodName = "queryCoilExist";
  211. ccp1.ServerParams = new Object[] { coilNo };//需要考虑分卷情况判断父卷号是否存在,如果新增的冷卷号与系统将在生成的冷卷号冲突怎么处理
  212. ccp1 = this.ExecuteQuery(ccp1, CoreInvokeType.Internal);
  213. int count = 0;
  214. if (ccp1.ReturnObject != null)
  215. {
  216. count = int.Parse(ccp1.ReturnObject.ToString());
  217. if (count > 0)
  218. {
  219. MessageBox.Show("冷卷号在系统中已存在,请确认后再进行操作!");
  220. return;
  221. }
  222. string millDtime = DateTime.Now.ToString("yyyyMMddHHmmss");
  223. string sleeve = rs[0].Cells["SLEEVE"].Text.Trim();
  224. string noDefect = rs[0].Cells["NO_DEFECT"].Text.Trim();
  225. string nostrip = rs[0].Cells["NO_STRIP"].Text.Trim();
  226. //if (millDtime.Equals(""))
  227. //{
  228. // MessageBox.Show("轧制时间不能为空!");
  229. // return;
  230. //}
  231. if (sleeve.Equals(""))
  232. {
  233. MessageBox.Show("是否带套筒不能为空!");
  234. return;
  235. }
  236. if (noDefect.Equals(""))
  237. {
  238. MessageBox.Show("缺陷数量不能为空!");
  239. return;
  240. }
  241. if (nostrip.Equals(""))
  242. {
  243. MessageBox.Show("热卷数量不能为空!");
  244. return;
  245. }
  246. //冷卷信息
  247. string[] lCoilInfo = new string[] { coilNo,millDtime,actWgt,coilLen,coilWth,coilThk,coilIndia,coilOutdia,sleeve,nostrip,noDefect};
  248. //热卷信息
  249. Infragistics.Win.UltraWinGrid.RowsCollection rs2 = this.ultraGrid2.Rows;
  250. if (rs2[0].Cells["H_COIL_NO"].Text.Trim().Equals(""))
  251. {
  252. MessageBox.Show("热卷号不能为空!");
  253. return;
  254. }
  255. ArrayList hCoilInfo = new ArrayList();
  256. for (int i = 0; i < rs2.Count; i++)
  257. {
  258. string ordNo = rs2[i].Cells["ORDER_NO"].Text.Trim();//订单号
  259. string alloy = rs2[i].Cells["ALLOY"].Text.Trim();//牌号
  260. string length = rs2[i].Cells["LENGTH"].Text.Trim();//长度
  261. string tcmWidth = rs2[i].Cells["TCM_WIDTH"].Text.Trim();//宽度
  262. string plWidth = rs2[i].Cells["PL_WIDTH"].Text.Trim();//酸洗宽度
  263. string thickEx = rs2[i].Cells["THICK_EX"].Text.Trim();//出口厚度
  264. string cplBegin = rs2[i].Cells["CPL_BEGIN"].Text.Trim();//酸洗开始时间
  265. string cplEnd = rs2[i].Cells["CPL_END"].Text.Trim();//酸洗结束时间
  266. string plSpeedMax = rs2[i].Cells["PL_SPEED_MAX"].Text.Trim();//最大速度
  267. string plSpeedMin = rs2[i].Cells["PL_SPEED_MIN"].Text.Trim();//最小速度
  268. string plSpeedAvg = rs2[i].Cells["PL_SPEED_AVE"].Text.Trim();//平均速度
  269. string rollingBegin = rs2[i].Cells["ROLLING_BEGIN"].Text.Trim();//轧制开始时间
  270. string rollingEnd = rs2[i].Cells["ROLLING_END"].Text.Trim();//轧制结束时间
  271. string thickStep = rs2[i].Cells["THICK_SETP"].Text.Trim();//厚度设置值
  272. string thickMin = rs2[i].Cells["THICK_MIN"].Text.Trim();//厚度最小值
  273. string thickMax = rs2[i].Cells["THICK_MAX"].Text.Trim();//厚度最大值
  274. string thickLmin = rs2[i].Cells["THICK_LMIN"].Text.Trim();//厚度限制最小值
  275. string thickLmax = rs2[i].Cells["THICK_LMAX"].Text.Trim();//厚度限制最大值
  276. string tcmSpeed = rs2[i].Cells["TCM_SPEED"].Text.Trim();//轧制平均速度
  277. string thinkClass1 = rs2[i].Cells["THINK_CLASS1"].Text.Trim();//种类1
  278. string thinkClass2 = rs2[i].Cells["THINK_CLASS2"].Text.Trim();//种类2
  279. string thinkClass3 = rs2[i].Cells["THINK_CLASS3"].Text.Trim();//种类3
  280. string thinkClass4 = rs2[i].Cells["THINK_CLASS4"].Text.Trim();//种类4
  281. string thinkClass5 = rs2[i].Cells["THINK_CLASS5"].Text.Trim();//种类5
  282. string flatenessClass1 = rs2[i].Cells["FLATENESS_CLASS1"].Text.Trim();//表面1
  283. string flatenessClass2 = rs2[i].Cells["FLATENESS_CLASS2"].Text.Trim();//表面2
  284. string flatenessClass3 = rs2[i].Cells["FLATENESS_CLASS3"].Text.Trim();//表面3
  285. string flatenessClass4 = rs2[i].Cells["FLATENESS_CLASS4"].Text.Trim();//表面4
  286. string flatenessClass5 = rs2[i].Cells["FLATENESS_CLASS5"].Text.Trim();//表面5
  287. string hCoilNo = rs2[i].Cells["H_COIL_NO"].Text.Trim();//热轧卷号
  288. hCoilInfo.Add( new string[] {ordNo,alloy,length,cplBegin,cplEnd,plWidth,plSpeedMax
  289. ,plSpeedMin,plSpeedAvg,rollingBegin,rollingEnd,tcmWidth,thickEx,thickStep,thickMin,thickMax
  290. ,thickLmax,thickLmin,tcmSpeed,thinkClass1,thinkClass2,thinkClass3,thinkClass4
  291. ,thinkClass5,flatenessClass1,flatenessClass2,flatenessClass3,flatenessClass4
  292. ,flatenessClass5,hCoilNo });
  293. }
  294. //缺陷信息
  295. Infragistics.Win.UltraWinGrid.RowsCollection rs3 = this.ultraGrid3.Rows;
  296. ArrayList defectInfo = new ArrayList();
  297. for (int i = 0; i < rs3.Count; i++)
  298. {
  299. string area = rs3[i].Cells["AREA"].Text.Trim();//区域标识
  300. string defectType = rs3[i].Cells["DEFECT_TYPE"].Text.Trim();//缺陷代码
  301. string defectPosition = rs3[i].Cells["DEFECT_POSITION"].Text.Trim();//缺陷边 T/B
  302. string intensity = rs3[i].Cells["INTENSITY"].Text.Trim();//缺陷等级
  303. string startPos = rs3[i].Cells["START_POS"].Text.Trim();//开始位置
  304. string endPos = rs3[i].Cells["END_POS"].Text.Trim();//结束位置
  305. defectInfo.Add(new string[] {area,defectType,defectPosition,intensity,startPos,endPos });
  306. }
  307. //新增实绩信息
  308. ccp.MethodName = "addAcidRollingResult";
  309. ArrayList listParam = new ArrayList();
  310. listParam.Add(lCoilInfo);
  311. listParam.Add(hCoilInfo);
  312. listParam.Add(defectInfo);
  313. ccp.ServerParams = new Object[] { listParam,regId };
  314. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  315. if (ccp.ReturnCode != 0)
  316. {
  317. MessageBox.Show("酸轧实绩新增失败,请确认数据是否输入正确后再点击保存!");
  318. return;
  319. }
  320. this.ultraComboEditor1.Text = coilNo;
  321. }
  322. }
  323. this.DoQuery();
  324. }
  325. }
  326. catch (Exception ex)
  327. {
  328. MessageBox.Show(ex.Message);
  329. }
  330. }
  331. private void UIK020020_Load(object sender, EventArgs e)
  332. {
  333. CoreClientParam ccp = new CoreClientParam();
  334. ccp.ServerName = "UIK.UIK02.UIK020020";
  335. ccp.MethodName = "queryLastCoilNos";
  336. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  337. ArrayList list = (ArrayList)(ccp.ReturnObject);
  338. if (list != null)
  339. {
  340. int listSize = list.Count;
  341. Infragistics.Win.ValueListItem[] valueListItems = new Infragistics.Win.ValueListItem[listSize];
  342. for (int i = 0; i < listSize; i++)
  343. {
  344. Infragistics.Win.ValueListItem item = new Infragistics.Win.ValueListItem();
  345. string param = list[i].ToString();
  346. item.DataValue = param;
  347. item.DisplayText = param; ;
  348. valueListItems[i] = item;
  349. }
  350. this.ultraComboEditor1.Items.AddRange(valueListItems);
  351. }
  352. }
  353. private void button1_Click(object sender, EventArgs e)
  354. {
  355. string c_coilCold = this.ultraComboEditor1.Text.Trim();
  356. string noDefect="";
  357. CoreClientParam ccp = new CoreClientParam();
  358. ccp.ServerName = "UIK.UIK02.UIK020020";
  359. ccp.MethodName = "queryOriCoil";
  360. ccp.ServerParams = new Object[] { c_coilCold };
  361. ccp = this.ExecuteQuery(ccp, CoreInvokeType.Internal);
  362. ArrayList list = (ArrayList)ccp.ReturnObject;
  363. if (list != null && 0 < list.Count)
  364. {
  365. Hashtable ht = (Hashtable)list[0];
  366. noDefect = ht["COIL_NO"].ToString();
  367. }
  368. Infragistics.Win.UltraWinGrid.RowsCollection rs2 = this.ultraGrid2.Rows;
  369. rs2[0].Cells["H_COIL_NO"].Value = noDefect;
  370. }
  371. private void gscoil()
  372. {
  373. //string c_coilCold = this.ultraComboEditor1.Text.Trim();
  374. Infragistics.Win.UltraWinGrid.RowsCollection rs1= this.ultraGrid1.Rows;
  375. string coilNo = rs1[0].Cells["L_COIL_NO"].Text.Trim();
  376. if (coilNo.Equals(""))
  377. {
  378. MessageBox.Show("酸轧卷号不能为空!");
  379. return;
  380. }
  381. string noDefect = "";
  382. CoreClientParam ccp = new CoreClientParam();
  383. ccp.ServerName = "UIK.UIK02.UIK020020";
  384. ccp.MethodName = "queryOriCoil";
  385. ccp.ServerParams = new Object[] { coilNo };
  386. ccp = this.ExecuteQuery(ccp, CoreInvokeType.Internal);
  387. ArrayList list = (ArrayList)ccp.ReturnObject;
  388. if (list != null && 0 < list.Count)
  389. {
  390. Hashtable ht = (Hashtable)list[0];
  391. noDefect = ht["COIL_NO"].ToString();
  392. }
  393. Infragistics.Win.UltraWinGrid.RowsCollection rs2 = this.ultraGrid2.Rows;
  394. rs2[0].Cells["H_COIL_NO"].Value = noDefect;
  395. }
  396. }
  397. }