e63a78ef588a49336c7b33c339e31fe90410e703.svn-base 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426
  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 UIM020090:FrmBase
  15. {
  16. private string yardAddr = "";//上料钢卷垛位
  17. private string l_coilNo = "";//冷轧卷号
  18. private int coil_no_index = -1;//冷轧卷在轧制计划的下标位置
  19. public UIM020090()
  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 = "queryCalPlan2";
  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 = "queryAddClassInf2";
  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. /*
  192. if (index > 0)
  193. {
  194. string statusCd = uGrid.Rows[index - 1].Cells["STATUS_CD"].Text.Trim();
  195. if ("计划中".Equals(statusCd))
  196. {
  197. MessageBox.Show("必须按照连退计划顺序上料,请确认后重新选择!");
  198. return;
  199. }
  200. }
  201. */
  202. string coilNo = uGrid.ActiveRow.Cells["C_COIL_NO"].Text.Trim();
  203. this.textBox3.Text = coilNo;
  204. string calNo = uGrid.ActiveRow.Cells["CAL_SEQ"].Text.Trim().Substring(0, uGrid.ActiveRow.Cells["CAL_SEQ"].Text.Trim().IndexOf('-'));
  205. textBox1.Text = calNo;
  206. yardAddr = uGrid.ActiveRow.Cells["YARD_ADDR"].Text.Trim();
  207. l_coilNo = uGrid.ActiveRow.Cells["L_COIL_NO"].Text.Trim();
  208. coil_no_index = uGrid.ActiveRow.VisibleIndex;
  209. dataSet2.Tables[0].Clear();
  210. DataRow dr = dataSet2.Tables[0].NewRow();
  211. dr["COIL_NO"] = coilNo;
  212. dr["COIL_LEN"] = uGrid.ActiveRow.Cells["COIL_LEN"].Text.Trim();
  213. dr["COIL_WGT"] = uGrid.ActiveRow.Cells["COIL_WGT"].Text.Trim();
  214. dr["LEN_DET"] = 1;
  215. dr["YARD_ADDR"] = yardAddr;
  216. this.textBox2.Text = yardAddr;
  217. dataSet2.Tables[0].Rows.Add(dr);
  218. }
  219. /// <summary>
  220. /// 酸轧上吊销
  221. /// </summary>
  222. /// <param name="sender"></param>
  223. /// <param name="e"></param>
  224. private void pictureBox1_Click(object sender, EventArgs e)
  225. {
  226. if ("".Equals(this.textBox3.Text.Trim()))
  227. {
  228. MessageBox.Show("请选择需要吊销的钢卷!");
  229. return;
  230. }
  231. if (0 > this.ultraComboEditor2.SelectedIndex)
  232. {
  233. MessageBox.Show("请选择吊销类型!");
  234. return;
  235. }
  236. if (null == this.ultraDateTimeEditor2.Value)
  237. {
  238. MessageBox.Show("请选择吊销时间!");
  239. return;
  240. }
  241. if ("".Equals(textBox2.Text.Trim()))
  242. {
  243. MessageBox.Show("请输入吊销后堆放的位置!");
  244. return;
  245. }
  246. if (ultraGrid1.Rows[coil_no_index].Cells["STATUS_CD"].Text.ToString().Equals("计划中"))
  247. {
  248. MessageBox.Show("钢卷还未上料,不能吊销!");
  249. return;
  250. }
  251. else if (!ultraGrid1.Rows[coil_no_index].Cells["STATUS_CD"].Text.ToString().Equals("上鞍座") && !ultraGrid1.Rows[coil_no_index].Cells["STATUS_CD"].Text.ToString().Equals("预备吊销钢卷"))
  252. {
  253. MessageBox.Show("钢卷已经生产,不能吊销!");
  254. return;
  255. }
  256. //钢卷入库
  257. string coilNo = textBox3.Text.Trim();
  258. string yardAddr = textBox2.Text.Trim();
  259. string calNo = textBox1.Text.Trim();
  260. try
  261. {
  262. string stock = yardAddr.Substring(0, 1);
  263. yardAddr = yardAddr.Substring(2);
  264. string row = yardAddr.Substring(0, yardAddr.IndexOf('-') - 1);
  265. if (row.Length < 2)
  266. {
  267. row = "0" + row;
  268. }
  269. string fl = yardAddr.Substring(yardAddr.IndexOf('-') - 1,1);
  270. string col = yardAddr.Substring(yardAddr.IndexOf('-')+1);
  271. if (col.Length < 2)
  272. {
  273. col = "0" + col;
  274. }
  275. yardAddr = stock + "-" + row + fl + "-" + col;
  276. }
  277. catch (Exception ex)
  278. {
  279. MessageBox.Show("垛位输入错误,请重新输入!");
  280. textBox2.Focus();
  281. return;
  282. }
  283. string entryShift = this.UserInfo.GetUserOrder();
  284. string entryGroup = this.UserInfo.GetUserGroup();
  285. string reg_id = this.UserInfo.GetUserID();
  286. string entryDtime = ultraDateTimeEditor2.DateTime.ToString("yyyyMMdd");
  287. MessageBox.Show("请确认退卷信息:钢卷号:"+coilNo );
  288. if (MessageBox.Show("您确认要退卷吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes)
  289. {
  290. CoreClientParam ccp = new CoreClientParam();
  291. System.Data.DataTable dt = new System.Data.DataTable();
  292. ccp.ServerName = "UIM.UIM02.UIM020030";
  293. ccp.MethodName = "selectCoilYard";
  294. ccp.ServerParams = new object[] { yardAddr };
  295. ccp.SourceDataTable = dt;
  296. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  297. if (dt.Rows.Count > 0 && !string.IsNullOrEmpty(dt.Rows[0]["COIL_NO"].ToString()))
  298. {
  299. MessageBox.Show("该垛位上已有钢卷,请重新输入垛位信息!");
  300. return;
  301. }
  302. else
  303. {
  304. CoreClientParam ccp2 = new CoreClientParam();
  305. ccp2.ServerName = "UIM.UIM02.UIM020030";
  306. ccp2.MethodName = "saveCoilYard";
  307. ccp2.ServerParams = new object[] { calNo, coilNo, yardAddr, entryShift, entryGroup, entryDtime, reg_id, "C" };
  308. this.ExecuteNonQuery(ccp2, CoreInvokeType.Internal);
  309. if (0 == ccp2.ReturnCode)
  310. {
  311. MessageBox.Show("退回成功");
  312. DoQuery();
  313. }
  314. }
  315. }
  316. //修改轧制计划、取消取样标识
  317. }
  318. private void UIM020030_Load(object sender, EventArgs e)
  319. {
  320. this.ultraComboEditor2.SelectedIndex = 0;
  321. this.ultraComboEditor6.SelectedIndex = 0;
  322. this.ultraComboEditor6.Text = "";
  323. this.ultraGrid2.DisplayLayout.ValueLists.Add("List1");
  324. this.ultraGrid2.DisplayLayout.ValueLists["List1"].ValueListItems.Add(1, "合格");
  325. this.ultraGrid2.DisplayLayout.ValueLists["List1"].ValueListItems.Add(2, "不合格");
  326. this.ultraGrid2.DisplayLayout.ValueLists["List1"].DisplayStyle = Infragistics.Win.ValueListDisplayStyle.DisplayText;
  327. this.ultraGrid2.DisplayLayout.Bands[0].Columns[3].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.DropDownList;
  328. this.ultraGrid2.DisplayLayout.Bands[0].Columns[3].ValueList = this.ultraGrid2.DisplayLayout.ValueLists["List1"];
  329. }
  330. private void ultraComboEditor2_ValueChanged(object sender, EventArgs e)
  331. {
  332. if (0 == this.ultraComboEditor2.SelectedIndex)
  333. {
  334. this.ultraComboEditor6.ReadOnly = true;
  335. this.ultraComboEditor6.Text = "";
  336. }
  337. else
  338. {
  339. this.ultraComboEditor6.ReadOnly = false;
  340. }
  341. }
  342. private void ultraGrid3_CellChange(object sender, Infragistics.Win.UltraWinGrid.CellEventArgs e)
  343. {
  344. if (e.Cell.Column.Key == "SELECT_ITEM" && Convert.ToBoolean(e.Cell.Text))
  345. {
  346. if (MessageBox.Show("是否确认添加班组信息?","提示",MessageBoxButtons.YesNo) == DialogResult.Yes)
  347. {
  348. string coilNo = e.Cell.Row.Cells["C_COIL_NO"].Text;
  349. /*for循环控制单选*/
  350. int i = this.ultraGrid3.Rows.Count;
  351. for (int j = 0; j < i; j++)
  352. {
  353. if (this.ultraGrid3.Rows[j].Cells["C_COIL_NO"].Text != coilNo)
  354. {
  355. this.ultraGrid3.Rows[j].Cells["SELECT_ITEM"].Value = false;
  356. }
  357. }
  358. string trnfRegId = this.UserInfo.GetUserID();
  359. string trnfShift = this.UserInfo.GetUserOrder();
  360. string trnfGroup = this.UserInfo.GetUserGroup();
  361. string trnfDTime = this.ultraDateTimeEditor1.DateTime.ToString("yyyyMMdd");
  362. CoreClientParam ccp3 = new CoreClientParam();
  363. System.Data.DataTable dt1 = new System.Data.DataTable();
  364. ccp3.ServerName = "UIM.UIM02.UIM020030";
  365. ccp3.MethodName = "insertInformation";
  366. ccp3.ServerParams = new object[] { trnfRegId, trnfShift, trnfGroup, trnfDTime, coilNo };
  367. this.ExecuteNonQuery(ccp3, CoreInvokeType.Internal);
  368. if (0 != ccp3.ReturnCode)
  369. {
  370. MessageBox.Show("插入失败");
  371. return;
  372. }
  373. else
  374. {
  375. MessageBox.Show("插入成功");
  376. }
  377. }
  378. DoQuery();
  379. }
  380. }
  381. }
  382. }