UIM020030.cs 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424
  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 System.IO;
  11. using System.Collections;
  12. namespace Core.LZMes.Client.UIM.UIM02
  13. {
  14. public partial class UIM020030:FrmBase
  15. {
  16. private string yardAddr = "";//上料钢卷垛位
  17. private string l_coilNo = "";//冷轧卷号
  18. private int coil_no_index = -1;//冷轧卷在轧制计划的下标位置
  19. public UIM020030()
  20. {
  21. InitializeComponent();
  22. }
  23. public override void ToolBar_Click(object sender, string ToolbarKey)
  24. {
  25. switch (ToolbarKey)
  26. {
  27. case "Query":
  28. this.DoQuery();
  29. break;
  30. case "Save":
  31. this.DoSave();
  32. break;
  33. case "Exit":
  34. this.Close();
  35. break;
  36. case "Export":
  37. this.DoExport();
  38. break;
  39. }
  40. }
  41. /// <summary>
  42. /// 查询连退作业计划
  43. /// </summary>
  44. private void DoQuery()
  45. {
  46. this.dataSet1.Tables[0].Clear();
  47. this.dataSet3.Tables[0].Clear();
  48. CoreClientParam ccp = new CoreClientParam();
  49. ccp.ServerName = "UIM.UIM02.UIM020030";
  50. ccp.MethodName = "queryCalPlan";
  51. ccp.SourceDataTable = this.dataSet1.Tables[0];
  52. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  53. DataRowCollection drs = dataSet1.Tables[0].Rows;
  54. for (int i = 0; i < drs.Count; i++)
  55. {
  56. if (drs[i]["STATUS_CD"].ToString().Equals("上鞍座"))
  57. {
  58. ultraGrid1.Rows[i].Appearance.BackColor = Color.FromArgb(192, 255, 192);
  59. }
  60. else if (drs[i]["STATUS_CD"].ToString().Equals("吊销钢卷"))
  61. {
  62. ultraGrid1.Rows[i].Appearance.BackColor = Color.Red;
  63. }
  64. else if (drs[i]["STATUS_CD"].ToString().Equals("焊接"))
  65. {
  66. ultraGrid1.Rows[i].Appearance.BackColor = Color.SpringGreen;
  67. }
  68. else if (drs[i]["STATUS_CD"].ToString().Equals("生产完成"))
  69. {
  70. ultraGrid1.Rows[i].Appearance.BackColor = Color.Green;
  71. }
  72. else if (drs[i]["STATUS_CD"].ToString().Equals("预备吊销钢卷"))
  73. {
  74. ultraGrid1.Rows[i].Appearance.BackColor = Color.Pink;
  75. }
  76. }
  77. CoreClientParam ccp3 = new CoreClientParam();
  78. ccp3.ServerName = "UIM.UIM02.UIM020030";
  79. ccp3.MethodName = "queryAddClassInf";
  80. ccp3.SourceDataTable = this.dataSet3.Tables[0];
  81. this.ExecuteQueryToDataTable(ccp3, CoreInvokeType.Internal);
  82. }
  83. /// <summary>
  84. /// 连退上料操作
  85. /// </summary>
  86. private void DoSave()
  87. {
  88. if (null == this.ultraDateTimeEditor1.Value)
  89. {
  90. MessageBox.Show("上料时间为空,请选择相应的上料时间后再进行上料操作!");
  91. return;
  92. }
  93. string calNo = textBox1.Text.Trim();
  94. string coilNo = this.textBox3.Text.Trim();
  95. if ("".Equals(coilNo))
  96. {
  97. MessageBox.Show("上料钢卷为空,请选择相应的原料卷后再进行上料操作!");
  98. return;
  99. }
  100. if (string.IsNullOrEmpty(l_coilNo))
  101. {
  102. MessageBox.Show("连退计划还未下发,不能进行上料操作!");
  103. return;
  104. }
  105. CoreClientParam ccp = new CoreClientParam();
  106. System.Data.DataTable dt = new System.Data.DataTable();
  107. ccp.ServerName = "UIM.UIM02.UIM020030";
  108. ccp.MethodName = "isReceivedL2";
  109. ccp.ServerParams = new object[] { calNo,coilNo };
  110. ccp.SourceDataTable = dt;
  111. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  112. if (dt.Rows.Count <= 0)
  113. {
  114. CoreClientParam ccp1 = new CoreClientParam();
  115. ccp1.ServerName = "UIM.UIM02.UIM020030";
  116. ccp1.MethodName = "hasCoilOnYardAddr";
  117. ccp1.ServerParams = new Object[] { yardAddr };
  118. ccp1 = this.ExecuteQuery(ccp1, CoreInvokeType.Internal);
  119. int count = int.Parse(ccp1.ReturnObject.ToString());
  120. if (count > 0 && DialogResult.No == MessageBox.Show("选择的钢卷堆放位置上方有其他钢卷,是否继续上料?", "提示", MessageBoxButtons.YesNo))
  121. {
  122. return;
  123. }
  124. string trnfRegId = this.UserInfo.GetUserID();
  125. string trnfShift = this.UserInfo.GetUserOrder();
  126. string trnfGroup = this.UserInfo.GetUserGroup();
  127. string trnfDTime = this.ultraDateTimeEditor1.DateTime.ToString("yyyyMMdd");
  128. CoreClientParam ccp2 = new CoreClientParam();
  129. ccp2.ServerName = "UIM.UIM02.UIM020030";
  130. ccp2.MethodName = "outStockByCal";
  131. ccp2.ServerParams = new Object[] { calNo, coilNo, l_coilNo, "T", trnfRegId, trnfShift, trnfGroup, trnfDTime };
  132. this.ExecuteNonQuery(ccp2, CoreInvokeType.Internal);
  133. if (0 != ccp2.ReturnCode)
  134. {
  135. MessageBox.Show("上料失败");
  136. return;
  137. }
  138. else
  139. {
  140. MessageBox.Show("上料成功");
  141. }
  142. }
  143. else
  144. {
  145. string trnfRegId = this.UserInfo.GetUserID();
  146. string trnfShift = this.UserInfo.GetUserOrder();
  147. string trnfGroup = this.UserInfo.GetUserGroup();
  148. string trnfDTime = this.ultraDateTimeEditor1.DateTime.ToString("yyyyMMdd");
  149. CoreClientParam ccp3 = new CoreClientParam();
  150. System.Data.DataTable dt1 = new System.Data.DataTable();
  151. ccp3.ServerName = "UIM.UIM02.UIM020030";
  152. ccp3.MethodName = "insertInformation";
  153. ccp3.ServerParams = new object[] { trnfRegId, trnfShift, trnfGroup, trnfDTime,coilNo};
  154. this.ExecuteNonQuery(ccp3, CoreInvokeType.Internal);
  155. if (0 != ccp3.ReturnCode)
  156. {
  157. MessageBox.Show("插入失败");
  158. return;
  159. }
  160. else
  161. {
  162. MessageBox.Show("插入成功");
  163. }
  164. }
  165. //this.DoPrint();
  166. this.DoQuery();
  167. }
  168. /// <summary>
  169. /// 导出
  170. /// </summary>
  171. private void DoExport()
  172. {
  173. try
  174. {
  175. if (this.saveFileDialog1.ShowDialog(this) == DialogResult.OK)
  176. {
  177. string fileName = this.saveFileDialog1.FileName;
  178. ultraGridExcelExporter1.Export(ultraGrid1, fileName);
  179. System.Diagnostics.Process.Start(fileName);
  180. }
  181. }
  182. catch (Exception ex)
  183. {
  184. MessageBox.Show(ex.ToString());
  185. }
  186. }
  187. private void ultraGrid1_DoubleClickRow(object sender, Infragistics.Win.UltraWinGrid.DoubleClickRowEventArgs e)
  188. {
  189. Infragistics.Win.UltraWinGrid.UltraGrid uGrid = (Infragistics.Win.UltraWinGrid.UltraGrid)sender;
  190. int index = uGrid.ActiveRow.Index;
  191. if (index > 0)
  192. {
  193. string statusCd = uGrid.Rows[index - 1].Cells["STATUS_CD"].Text.Trim();
  194. if ("计划中".Equals(statusCd))
  195. {
  196. MessageBox.Show("必须按照连退计划顺序上料,请确认后重新选择!");
  197. return;
  198. }
  199. }
  200. string coilNo = uGrid.ActiveRow.Cells["C_COIL_NO"].Text.Trim();
  201. this.textBox3.Text = coilNo;
  202. string calNo = uGrid.ActiveRow.Cells["CAL_SEQ"].Text.Trim().Substring(0, uGrid.ActiveRow.Cells["CAL_SEQ"].Text.Trim().IndexOf('-'));
  203. textBox1.Text = calNo;
  204. yardAddr = uGrid.ActiveRow.Cells["YARD_ADDR"].Text.Trim();
  205. l_coilNo = uGrid.ActiveRow.Cells["L_COIL_NO"].Text.Trim();
  206. coil_no_index = uGrid.ActiveRow.VisibleIndex;
  207. dataSet2.Tables[0].Clear();
  208. DataRow dr = dataSet2.Tables[0].NewRow();
  209. dr["COIL_NO"] = coilNo;
  210. dr["COIL_LEN"] = uGrid.ActiveRow.Cells["COIL_LEN"].Text.Trim();
  211. dr["COIL_WGT"] = uGrid.ActiveRow.Cells["COIL_WGT"].Text.Trim();
  212. dr["LEN_DET"] = 1;
  213. dr["YARD_ADDR"] = yardAddr;
  214. this.textBox2.Text = yardAddr;
  215. dataSet2.Tables[0].Rows.Add(dr);
  216. }
  217. /// <summary>
  218. /// 酸轧上吊销
  219. /// </summary>
  220. /// <param name="sender"></param>
  221. /// <param name="e"></param>
  222. private void pictureBox1_Click(object sender, EventArgs e)
  223. {
  224. if ("".Equals(this.textBox3.Text.Trim()))
  225. {
  226. MessageBox.Show("请选择需要吊销的钢卷!");
  227. return;
  228. }
  229. if (0 > this.ultraComboEditor2.SelectedIndex)
  230. {
  231. MessageBox.Show("请选择吊销类型!");
  232. return;
  233. }
  234. if (null == this.ultraDateTimeEditor2.Value)
  235. {
  236. MessageBox.Show("请选择吊销时间!");
  237. return;
  238. }
  239. if ("".Equals(textBox2.Text.Trim()))
  240. {
  241. MessageBox.Show("请输入吊销后堆放的位置!");
  242. return;
  243. }
  244. if (ultraGrid1.Rows[coil_no_index].Cells["STATUS_CD"].Text.ToString().Equals("计划中"))
  245. {
  246. MessageBox.Show("钢卷还未上料,不能吊销!");
  247. return;
  248. }
  249. else if (!ultraGrid1.Rows[coil_no_index].Cells["STATUS_CD"].Text.ToString().Equals("上鞍座") && !ultraGrid1.Rows[coil_no_index].Cells["STATUS_CD"].Text.ToString().Equals("预备吊销钢卷"))
  250. {
  251. MessageBox.Show("钢卷已经生产,不能吊销!");
  252. return;
  253. }
  254. //钢卷入库
  255. string coilNo = textBox3.Text.Trim();
  256. string yardAddr = textBox2.Text.Trim();
  257. string calNo = textBox1.Text.Trim();
  258. try
  259. {
  260. string stock = yardAddr.Substring(0, 1);
  261. yardAddr = yardAddr.Substring(2);
  262. string row = yardAddr.Substring(0, yardAddr.IndexOf('-') - 1);
  263. if (row.Length < 2)
  264. {
  265. row = "0" + row;
  266. }
  267. string fl = yardAddr.Substring(yardAddr.IndexOf('-') - 1,1);
  268. string col = yardAddr.Substring(yardAddr.IndexOf('-')+1);
  269. if (col.Length < 2)
  270. {
  271. col = "0" + col;
  272. }
  273. yardAddr = stock + "-" + row + fl + "-" + col;
  274. }
  275. catch (Exception ex)
  276. {
  277. MessageBox.Show("垛位输入错误,请重新输入!");
  278. textBox2.Focus();
  279. return;
  280. }
  281. string entryShift = this.UserInfo.GetUserOrder();
  282. string entryGroup = this.UserInfo.GetUserGroup();
  283. string reg_id = this.UserInfo.GetUserID();
  284. string entryDtime = ultraDateTimeEditor2.DateTime.ToString("yyyyMMdd");
  285. MessageBox.Show("请确认退卷信息:钢卷号:"+coilNo );
  286. if (MessageBox.Show("您确认要退卷吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes)
  287. {
  288. CoreClientParam ccp = new CoreClientParam();
  289. System.Data.DataTable dt = new System.Data.DataTable();
  290. ccp.ServerName = "UIM.UIM02.UIM020030";
  291. ccp.MethodName = "selectCoilYard";
  292. ccp.ServerParams = new object[] { yardAddr };
  293. ccp.SourceDataTable = dt;
  294. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  295. if (dt.Rows.Count > 0 && !string.IsNullOrEmpty(dt.Rows[0]["COIL_NO"].ToString()))
  296. {
  297. MessageBox.Show("该垛位上已有钢卷,请重新输入垛位信息!");
  298. return;
  299. }
  300. else
  301. {
  302. CoreClientParam ccp2 = new CoreClientParam();
  303. ccp2.ServerName = "UIM.UIM02.UIM020030";
  304. ccp2.MethodName = "saveCoilYard";
  305. ccp2.ServerParams = new object[] { calNo, coilNo, yardAddr, entryShift, entryGroup, entryDtime, reg_id, "C" };
  306. this.ExecuteNonQuery(ccp2, CoreInvokeType.Internal);
  307. if (0 == ccp2.ReturnCode)
  308. {
  309. MessageBox.Show("退回成功");
  310. DoQuery();
  311. }
  312. }
  313. }
  314. //修改轧制计划、取消取样标识
  315. }
  316. private void UIM020030_Load(object sender, EventArgs e)
  317. {
  318. this.ultraComboEditor2.SelectedIndex = 0;
  319. this.ultraComboEditor6.SelectedIndex = 0;
  320. this.ultraComboEditor6.Text = "";
  321. this.ultraGrid2.DisplayLayout.ValueLists.Add("List1");
  322. this.ultraGrid2.DisplayLayout.ValueLists["List1"].ValueListItems.Add(1, "合格");
  323. this.ultraGrid2.DisplayLayout.ValueLists["List1"].ValueListItems.Add(2, "不合格");
  324. this.ultraGrid2.DisplayLayout.ValueLists["List1"].DisplayStyle = Infragistics.Win.ValueListDisplayStyle.DisplayText;
  325. this.ultraGrid2.DisplayLayout.Bands[0].Columns[3].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.DropDownList;
  326. this.ultraGrid2.DisplayLayout.Bands[0].Columns[3].ValueList = this.ultraGrid2.DisplayLayout.ValueLists["List1"];
  327. }
  328. private void ultraComboEditor2_ValueChanged(object sender, EventArgs e)
  329. {
  330. if (0 == this.ultraComboEditor2.SelectedIndex)
  331. {
  332. this.ultraComboEditor6.ReadOnly = true;
  333. this.ultraComboEditor6.Text = "";
  334. }
  335. else
  336. {
  337. this.ultraComboEditor6.ReadOnly = false;
  338. }
  339. }
  340. private void ultraGrid3_CellChange(object sender, Infragistics.Win.UltraWinGrid.CellEventArgs e)
  341. {
  342. if (e.Cell.Column.Key == "SELECT_ITEM" && Convert.ToBoolean(e.Cell.Text))
  343. {
  344. if (MessageBox.Show("是否确认添加班组信息?","提示",MessageBoxButtons.YesNo) == DialogResult.Yes)
  345. {
  346. string coilNo = e.Cell.Row.Cells["C_COIL_NO"].Text;
  347. /*for循环控制单选*/
  348. int i = this.ultraGrid3.Rows.Count;
  349. for (int j = 0; j < i; j++)
  350. {
  351. if (this.ultraGrid3.Rows[j].Cells["C_COIL_NO"].Text != coilNo)
  352. {
  353. this.ultraGrid3.Rows[j].Cells["SELECT_ITEM"].Value = false;
  354. }
  355. }
  356. string trnfRegId = this.UserInfo.GetUserID();
  357. string trnfShift = this.UserInfo.GetUserOrder();
  358. string trnfGroup = this.UserInfo.GetUserGroup();
  359. string trnfDTime = this.ultraDateTimeEditor1.DateTime.ToString("yyyyMMdd");
  360. CoreClientParam ccp3 = new CoreClientParam();
  361. System.Data.DataTable dt1 = new System.Data.DataTable();
  362. ccp3.ServerName = "UIM.UIM02.UIM020030";
  363. ccp3.MethodName = "insertInformation";
  364. ccp3.ServerParams = new object[] { trnfRegId, trnfShift, trnfGroup, trnfDTime, coilNo };
  365. this.ExecuteNonQuery(ccp3, CoreInvokeType.Internal);
  366. if (0 != ccp3.ReturnCode)
  367. {
  368. MessageBox.Show("插入失败");
  369. return;
  370. }
  371. else
  372. {
  373. MessageBox.Show("插入成功");
  374. }
  375. }
  376. DoQuery();
  377. }
  378. }
  379. }
  380. }