29a6b6cf2493d448e45d7893ccd9eec03d45e779.svn-base 43 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098
  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.Collections;
  11. using Infragistics.Win.UltraWinGrid;
  12. using Infragistics.Win;
  13. namespace Core.LZMes.Client.QCM
  14. {
  15. public partial class QCM0201 : FrmBase
  16. {
  17. #region 初始化
  18. //Boolean textboxHasText = false;//判断输入框是否有文本
  19. private String v_line_no = "";//RZ1-热轧 ZB1-中板线 HB1-厚板线 LT1-连退
  20. public QCM0201()
  21. {
  22. InitializeComponent();
  23. }
  24. private void QCM0201_Load(object sender, EventArgs e)
  25. {
  26. //获取自定义参数
  27. if (!this.CustomInfo.Equals(""))
  28. {
  29. v_line_no = this.CustomInfo;
  30. }
  31. this.ultraGrid1.DisplayLayout.Bands[0].Columns["PHY_NAME_L_bj"].Header.Caption = "检验项目";
  32. this.ultraGrid4.DisplayLayout.Bands[0].Columns["PHY_NAME_L_bj"].Header.Caption = "检验项目";
  33. // dateTimePicker1.Value = DateTime.Now.Date.AddDays(-1);
  34. dateTimePicker2.Value = DateTime.Now.Date.AddDays(1);
  35. ValueList v = new ValueList();
  36. v.ValueListItems.Add("1", "是");
  37. v.ValueListItems.Add("0", "否");
  38. this.ultraGrid3.DisplayLayout.Bands[0].Columns["ISJUDGE"].ValueList = v.Clone();
  39. ValueList v1 = new ValueList();
  40. v1.ValueListItems.Add("0", "订单");
  41. v1.ValueListItems.Add("1", "人工");
  42. this.ultraGrid3.DisplayLayout.Bands[0].Columns["ITEM_FLAG"].ValueList = v1.Clone();
  43. this.ultraGrid6.DisplayLayout.Bands[0].Columns["ITEM_FLAG"].ValueList = v1.Clone();
  44. v1 = new ValueList();
  45. v1.ValueListItems.Add("0", "订单");
  46. v1.ValueListItems.Add("1", "人工复制");
  47. this.ultraGrid1.DisplayLayout.Bands[0].Columns["ITEM_FLAG"].ValueList = v1.Clone();
  48. this.ultraGrid4.DisplayLayout.Bands[0].Columns["ITEM_FLAG"].ValueList = v1.Clone();
  49. ValueList v2 = new ValueList();
  50. v2.ValueListItems.Add("A", "成分");
  51. v2.ValueListItems.Add("B", "材质");
  52. this.ultraGrid1.DisplayLayout.Bands[0].Columns["smp_catg"].ValueList = v2.Clone();
  53. this.ultraGrid4.DisplayLayout.Bands[0].Columns["smp_catg"].ValueList = v2.Clone();
  54. ValueList v3 = new ValueList();
  55. v3.ValueListItems.Add("", "");
  56. v3.ValueListItems.Add("A", "金相");
  57. v3.ValueListItems.Add("B", "重量偏差");
  58. v3.ValueListItems.Add("C", "金相&重量偏差");
  59. this.ultraGrid1.DisplayLayout.Bands[0].Columns["SEND_MEMO"].ValueList = v3.Clone();
  60. this.ultraGrid4.DisplayLayout.Bands[0].Columns["SEND_MEMO"].ValueList = v3.Clone();
  61. if (!this.checkBox1.Checked)
  62. {
  63. this.textBox1.Enabled = false;
  64. this.BATCH_NO2.Enabled = false;
  65. }
  66. this.DoQuery();
  67. }
  68. #endregion
  69. #region 功能
  70. public override void ToolBar_Click(object sender, string ToolbarKey)
  71. {
  72. switch (ToolbarKey)
  73. {
  74. case "Query":
  75. this.DoQuery();
  76. break;
  77. case "Send":
  78. this.DoSend();
  79. break;
  80. case "Unsend":
  81. this.DoUnsend();//撤销委托
  82. break;
  83. case "Add":
  84. this.AddBasePhy();//新增检验项
  85. break;
  86. case "AddArtificial":
  87. this.AddArtificial();//新增人工委托
  88. break;
  89. case "Update":
  90. this.DoUpdate();//修改取样材料号
  91. break;
  92. case "AddWt":
  93. this.DoAddWt();//新增复制单条委托
  94. break;
  95. case "DelWt":
  96. this.DoDelWt();//撤销复制单条委托
  97. break;
  98. case "DoDelete":
  99. this.DoDelete();//删除委托
  100. break;
  101. }
  102. }
  103. #endregion
  104. #region 功能方法
  105. #region 修改取样材料号
  106. private void DoUpdate()
  107. {
  108. try
  109. {
  110. // String plineCode = this.CustomInfo;
  111. CoreClientParam ccp = new CoreClientParam();
  112. ArrayList smpNo = new ArrayList();//试样号
  113. ArrayList specimenNo = new ArrayList();//取样编号
  114. ArrayList batchNo = new ArrayList();//轧批号
  115. ArrayList materialNo = new ArrayList();//取样材料号
  116. ArrayList send_memo = new ArrayList();//发送备注
  117. ArrayList inspectionLot = new ArrayList();//检验号
  118. ArrayList plineCode = new ArrayList();
  119. foreach (UltraGridRow ugr in this.ultraGrid1.Rows)
  120. {
  121. if (ugr.Cells["CHK"].Value.ToString().ToLower() == "true")
  122. {
  123. smpNo.Add(ugr.Cells["SMP_NO"].Value.ToString());
  124. specimenNo.Add(ugr.Cells["SPECIMEN_NO"].Value.ToString());
  125. batchNo.Add(ugr.Cells["BATCH_NO"].Value.ToString());
  126. materialNo.Add(ugr.Cells["MATERIAL_NO"].Value.ToString());
  127. send_memo.Add(ugr.Cells["SEND_MEMO"].Value.ToString());
  128. inspectionLot.Add(ugr.Cells["INSPECTION_LOT"].Value.ToString());
  129. plineCode.Add(ugr.Cells["PLINE_CODE"].Value.ToString());
  130. }
  131. }
  132. ccp.ServerName = "QCM.JHY01.JHY0102.UpdateInfo";
  133. ccp.MethodName = "updateMaterialNo";
  134. ccp.ServerParams = new object[] { smpNo, specimenNo, batchNo, materialNo, send_memo, inspectionLot, plineCode };
  135. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  136. }
  137. catch (Exception ex)
  138. {
  139. System.Diagnostics.Debug.WriteLine(ex.ToString());
  140. MessageBox.Show("系统出错【修改取样材料号】,请联系管理人员", "警告");
  141. }
  142. }
  143. #endregion
  144. #region 新增人工委托
  145. private void AddArtificial()
  146. {
  147. try
  148. {
  149. QCM0205 frmRbp = new QCM0205();
  150. frmRbp.StartPosition = FormStartPosition.CenterScreen;
  151. frmRbp.ob = this.ob;
  152. frmRbp.ShowDialog();
  153. this.DoQuery();
  154. }
  155. catch (Exception ex)
  156. {
  157. MessageBox.Show("操作过程出现异常!\n" + ex.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
  158. }
  159. }
  160. #endregion
  161. #region 新增检验项
  162. private void AddBasePhy()
  163. {
  164. try
  165. {
  166. UltraGridRow row = this.ultraGrid1.ActiveRow;
  167. if (row == null)
  168. {
  169. this.alert("检验委托为空!请选择检验委托数据!!!");
  170. return;
  171. }
  172. if (!row.Cells["SMP_CATG"].Text.ToString().Equals("材质"))
  173. {
  174. this.alert("只有材质数据才可以新增检验项!!!");
  175. return;
  176. }
  177. QCM0204 frmRbp = new QCM0204();
  178. frmRbp.StartPosition = FormStartPosition.CenterScreen;
  179. frmRbp.ob = this.ob;
  180. frmRbp.specimenNo = row.Cells["SPECIMEN_NO"].Value.ToString();
  181. frmRbp.smpNo = row.Cells["SMP_NO"].Value.ToString();
  182. frmRbp.plineCode = "GB";
  183. frmRbp.ShowDialog();
  184. this.DoQueryPrg(row);//右下角
  185. }
  186. catch (Exception ex)
  187. {
  188. MessageBox.Show("操作过程出现异常!\n" + ex.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
  189. }
  190. }
  191. #endregion
  192. #region 新增复制单条委托
  193. private void DoAddWt()
  194. {
  195. try
  196. {
  197. int num = 0;
  198. foreach (UltraGridRow ugr in this.ultraGrid1.Rows)
  199. {
  200. if (ugr.Cells["CHK"].Value.ToString().ToLower() == "true")
  201. {
  202. num = num + 1;
  203. }
  204. }
  205. if (num > 1)
  206. {
  207. this.alert("只能单条复制!为防止数据差错谢谢配合【谨慎复制】");
  208. return;
  209. }
  210. UltraGridRow row = this.ultraGrid1.ActiveRow;
  211. if (row == null)
  212. {
  213. this.alert("检验委托为空!请选择检验委托数据!!!");
  214. return;
  215. }
  216. String batchNo = row.Cells["BATCH_NO"].Value.ToString();//轧批号
  217. String designKey = row.Cells["DESIGN_KEY"].Value.ToString();//订单号
  218. String smpNo = row.Cells["SMP_NO"].Value.ToString();//试样号
  219. String specimenNo = row.Cells["SPECIMEN_NO"].Value.ToString();//取样编号
  220. String smpTypeName = row.Cells["SMP_TYPE_NAME"].Value.ToString();//取样类型
  221. if (MessageBox.Show("轧批号【" + batchNo + "】,确认复制当前委托一条?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
  222. {
  223. return;
  224. }
  225. CoreClientParam ccp = new CoreClientParam();
  226. ccp.ServerName = "QCM.JHY01.JHY0102.UpdateInfo";
  227. if (smpTypeName.Equals("初样"))
  228. {
  229. ccp.MethodName = "DoAddWtZy";
  230. }
  231. else if (smpTypeName.Equals("复样"))
  232. {
  233. ccp.MethodName = "DoAddWtFy";
  234. }
  235. ccp.ServerParams = new object[] { batchNo, designKey, smpNo, specimenNo, this.UserInfo.GetUserName() };
  236. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  237. if (ccp.ReturnCode != -1)
  238. {
  239. MessageBox.Show("复制委托成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.None);
  240. }
  241. this.DoQuery();
  242. }
  243. catch (Exception ex)
  244. {
  245. MessageBox.Show("操作过程出现异常!\n" + ex.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
  246. }
  247. }
  248. #endregion
  249. #region 撤销复制单条委托
  250. private void DoDelWt()
  251. {
  252. try
  253. {
  254. int num = 0;
  255. foreach (UltraGridRow ugr in this.ultraGrid1.Rows)
  256. {
  257. if (ugr.Cells["CHK"].Value.ToString().ToLower() == "true")
  258. {
  259. num = num + 1;
  260. }
  261. }
  262. if (num > 1)
  263. {
  264. this.alert("只能单条删除!为防止数据差错谢谢配合【谨慎删除】");
  265. return;
  266. }
  267. UltraGridRow row = this.ultraGrid1.ActiveRow;
  268. if (row == null)
  269. {
  270. this.alert("检验委托为空!请选择检验委托数据!!!");
  271. return;
  272. }
  273. String batchNo = row.Cells["BATCH_NO"].Value.ToString();//轧批号
  274. String designKey = row.Cells["DESIGN_KEY"].Value.ToString();//订单号
  275. String smpNo = row.Cells["SMP_NO"].Value.ToString();//试样号
  276. String specimenNo = row.Cells["SPECIMEN_NO"].Value.ToString();//取样编号
  277. String smpTypeName = row.Cells["SMP_TYPE_NAME"].Value.ToString();//取样类型
  278. String item_flag = row.Cells["ITEM_FLAG"].Value.ToString();//项目来源(0-订单,1-人工)
  279. if (MessageBox.Show("轧批号【" + batchNo + "】,确认撤销当前委托?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
  280. {
  281. return;
  282. }
  283. if (!item_flag.Equals("1"))
  284. {
  285. this.alert("只能撤销【人工复制】委托!当前选择的委托为系统生成!");
  286. return;
  287. }
  288. CoreClientParam ccp = new CoreClientParam();
  289. ccp.ServerName = "QCM.JHY01.JHY0102.UpdateInfo";
  290. if (smpTypeName.Equals("初样"))
  291. {
  292. ccp.MethodName = "DoDelWtZy";
  293. }
  294. else if (smpTypeName.Equals("复样"))
  295. {
  296. ccp.MethodName = "DoDelWtFy";
  297. }
  298. ccp.ServerParams = new object[] { batchNo, designKey, smpNo, specimenNo, this.UserInfo.GetUserName() };
  299. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  300. if (ccp.ReturnCode != -1)
  301. {
  302. MessageBox.Show("撤销复制委托成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.None);//ccp.ReturnInfo "发送成功" ccp.ReturnInfo
  303. }
  304. this.DoQuery();
  305. }
  306. catch (Exception ex)
  307. {
  308. MessageBox.Show("操作过程出现异常!\n" + ex.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
  309. }
  310. }
  311. #endregion
  312. #region 删除委托
  313. private void DoDelete()
  314. {
  315. try
  316. {
  317. UltraGridRow row = this.ultraGrid1.ActiveRow;
  318. if (row == null)
  319. {
  320. this.alert("检验委托为空!请选择检验委托数据!!!");
  321. return;
  322. }
  323. String batchNoViw = row.Cells["BATCH_NO"].Value.ToString();//轧批号
  324. ArrayList batchNo = new ArrayList();//轧批号
  325. ArrayList designKey = new ArrayList();//订单号
  326. ArrayList smpNo = new ArrayList();//试样号
  327. ArrayList specimenNo = new ArrayList();//取样编号
  328. ArrayList smpTypeName = new ArrayList();//取样类型
  329. foreach (UltraGridRow ugr in this.ultraGrid1.Rows)
  330. {
  331. if (ugr.Cells["CHK"].Value.ToString().ToLower() == "true")
  332. {
  333. batchNo.Add(ugr.Cells["BATCH_NO"].Value.ToString());//轧批号
  334. designKey.Add(ugr.Cells["DESIGN_KEY"].Value.ToString());//订单号
  335. smpNo.Add(ugr.Cells["SMP_NO"].Value.ToString());//试样号
  336. specimenNo.Add(ugr.Cells["SPECIMEN_NO"].Value.ToString());//取样编号
  337. smpTypeName.Add(ugr.Cells["SMP_TYPE_NAME"].Value.ToString());//取样类型
  338. if (ugr.Cells["SMP_TYPE_CODE"].Value.ToString().Equals("3"))
  339. {
  340. this.alert("件件取样暂时不支持删除!!!");
  341. return;
  342. }
  343. String item_flag = ugr.Cells["ITEM_FLAG"].Value.ToString();//项目来源(0-订单,1-人工)
  344. if (item_flag.Equals("1"))
  345. {
  346. this.alert("取样编号:" + ugr.Cells["SPECIMEN_NO"].Value.ToString()+"为【人工复制】委托,请选择[撤销复制委托]按钮!谢谢!");
  347. return;
  348. }
  349. }
  350. }
  351. if (MessageBox.Show("确认删除轧批号【" + batchNoViw + "】委托?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
  352. {
  353. return;
  354. }
  355. CoreClientParam ccp = new CoreClientParam();
  356. ccp.ServerName = "QCM.JHY01.JHY0102.UpdateInfo";
  357. ccp.MethodName = "DoDelete";
  358. ccp.ServerParams = new object[] { batchNo, designKey, smpNo, specimenNo, smpTypeName, this.UserInfo.GetUserName() };
  359. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  360. if (ccp.ReturnCode != -1)
  361. {
  362. MessageBox.Show("删除委托成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.None);
  363. }
  364. this.DoQuery();
  365. }
  366. catch (Exception ex)
  367. {
  368. MessageBox.Show("操作过程出现异常!\n" + ex.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
  369. }
  370. }
  371. #endregion
  372. #region 查询
  373. private void DoQuery()
  374. {
  375. try
  376. {
  377. String checkboxVal = "";
  378. String STARTTIME = this.dateTimePicker1.Value.ToString("yyyy-MM-dd");
  379. String ENDTIME = this.dateTimePicker2.Value.ToString("yyyy-MM-dd");
  380. String BATCH_NO = this.textBox1.Text.Trim();
  381. String BATCH_NO2 = this.BATCH_NO2.Text.Trim();
  382. String VALIDFLAG = "1";
  383. String CERT_INST_NAME = this.textBox2.Text.Trim();//认证机构
  384. String PLINE_NAME = this.PLINE_NAME.Text.Trim();
  385. String PLINE_CODE = v_line_no;
  386. String STEEL_NAME = this.txt_steel_name.Text.Trim();
  387. String SMP_CATG = this.cbx_smp_catg.Text.Trim();
  388. String heatNo = this.selheatNo.Text.Trim();
  389. if (PLINE_NAME.Equals("全部"))
  390. {
  391. PLINE_NAME = "";
  392. }
  393. if (CERT_INST_NAME.Equals("全部"))
  394. {
  395. CERT_INST_NAME = "";
  396. }
  397. if (SMP_CATG.Equals("全部"))
  398. {
  399. SMP_CATG = "";
  400. }
  401. else if (SMP_CATG.Equals("成分"))
  402. {
  403. SMP_CATG = "A";
  404. }
  405. else
  406. {
  407. SMP_CATG = "B";
  408. }
  409. if (this.CustomInfo == "BC2")
  410. {
  411. PLINE_NAME = "棒二线";
  412. }
  413. else if (this.CustomInfo == "GX")
  414. {
  415. PLINE_NAME = "高线";
  416. }
  417. else if (this.CustomInfo == "GB")
  418. {
  419. PLINE_NAME = "高棒线";
  420. }
  421. else if (this.CustomInfo == "RZ")
  422. {
  423. PLINE_NAME = "热轧";
  424. }
  425. else if (this.CustomInfo == "LT")
  426. {
  427. PLINE_NAME = "连退";
  428. }
  429. else if (this.CustomInfo == "HB")
  430. {
  431. PLINE_NAME = "厚板线";
  432. }
  433. else if (this.CustomInfo == "ZB")
  434. {
  435. PLINE_NAME = "中板线";
  436. }
  437. //轧批号 小框框 是否勾选
  438. if (this.checkBox1.Checked)
  439. {
  440. checkboxVal = "1";
  441. STARTTIME = "";
  442. ENDTIME = "";
  443. }
  444. else
  445. {
  446. BATCH_NO = "";
  447. BATCH_NO2 = "";
  448. }
  449. if (!string.IsNullOrEmpty(BATCH_NO2))
  450. {
  451. if (string.IsNullOrEmpty(BATCH_NO))
  452. {
  453. this.alert("请输入轧批号!!!");
  454. this.textBox1.Focus();
  455. return;
  456. }
  457. }
  458. CoreClientParam ccp = new CoreClientParam();
  459. this.dataSet1.Clear();
  460. ccp.ServerName = "QCM.JHY01.JHY0101.QuerryQltySample";
  461. ccp.MethodName = "getQltySampleInfo";
  462. ccp.SourceDataTable = this.dataSet1.Tables[0];
  463. Hashtable ht = new Hashtable();
  464. ht.Add("BATCH_NO", BATCH_NO);
  465. ht.Add("BATCH_NO2", BATCH_NO2);
  466. ht.Add("STARTTIME", STARTTIME);
  467. ht.Add("ENDTIME", ENDTIME);
  468. ht.Add("VALIDFLAG", VALIDFLAG);
  469. ht.Add("CERT_INST_NAME", CERT_INST_NAME);
  470. ht.Add("PLINE_NAME", PLINE_NAME);
  471. ht.Add("PLINE_CODE", PLINE_CODE);
  472. ht.Add("checkboxVal", checkboxVal);
  473. if (this.ultraTabControl1.Tabs[0].Selected)
  474. {
  475. ht.Add("STATUS", "0");
  476. }
  477. if (this.ultraTabControl1.SelectedTab.Text.Equals("委托记录"))
  478. {
  479. ht.Add("TAB_NAME", "1");
  480. }
  481. ht.Add("STEEL_NAME", STEEL_NAME);
  482. ht.Add("SMP_CATG", SMP_CATG);
  483. ht.Add("HEAT_NO", heatNo);
  484. ccp.ServerParams = new object[] { ht };
  485. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  486. foreach (UltraGridRow ugr in this.ultraGrid1.Rows)
  487. {
  488. switch (ugr.Cells["STATUS"].Text.ToString())
  489. {
  490. case "0":
  491. ugr.Cells["STATUS"].Value = "未发送";
  492. break;
  493. case "1":
  494. ugr.Cells["STATUS"].Value = "已引用";
  495. break;
  496. case "2":
  497. ugr.Cells["STATUS"].Value = "已接收";
  498. break;
  499. case "3":
  500. ugr.Cells["STATUS"].Value = "已完成";
  501. break;
  502. case "4":
  503. ugr.Cells["STATUS"].Value = "检化验系统退回";
  504. break;
  505. case "5":
  506. ugr.Cells["STATUS"].Value = "重判";
  507. break;
  508. case "7":
  509. ugr.Cells["STATUS"].Value = "确认接收样";
  510. break;
  511. }
  512. if (ugr.Cells["SMP_TYPE_NAME"].Value.ToString() == "复样")
  513. {
  514. ugr.Cells["SMP_TYPE_NAME"].Appearance.ForeColor = Color.Red;
  515. }
  516. }
  517. int num = this.ultraGrid1.Rows.Count();
  518. if (num <= 0)
  519. {
  520. this.dataSet2.Clear();
  521. this.dataSet3.Clear();
  522. }
  523. }
  524. catch (Exception ex)
  525. {
  526. System.Diagnostics.Debug.WriteLine(ex.ToString());
  527. MessageBox.Show("系统出错,请联系管理人员", "警告");
  528. }
  529. }
  530. #endregion
  531. #region 查找检验项目
  532. private void DoQueryPrg(UltraGridRow ugr)
  533. {
  534. try
  535. {
  536. this.dataSet3.Clear();
  537. String specimen_no = ugr.Cells["SPECIMEN_NO"].Value.ToString();
  538. CoreClientParam ccp = new CoreClientParam();
  539. ccp.ServerName = "QCM.JHY01.JHY0101.QuerryQltySample";
  540. ccp.MethodName = "getQltySampleItem";
  541. ccp.ServerParams = new object[] { specimen_no };
  542. ccp.SourceDataTable = this.dataSet3.Tables[0];
  543. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  544. }
  545. catch (Exception ex)
  546. {
  547. System.Diagnostics.Debug.WriteLine(ex.ToString());
  548. MessageBox.Show("系统出错,请联系管理人员", "警告");
  549. }
  550. }
  551. #endregion
  552. #region 查询订单信息
  553. private void DoQueryOrder(UltraGridRow ugr)
  554. {
  555. try
  556. {
  557. this.dataSet2.Clear();
  558. CoreClientParam ccp = new CoreClientParam();
  559. ccp.ServerName = "QCM.JHY01.JHY0101.QuerryQltySample";
  560. ccp.MethodName = "getQltySampleOrd";
  561. ccp.ServerParams = new object[] { ugr.Cells["SMP_NO"].Text.ToString() };
  562. ccp.SourceDataTable = this.dataSet2.Tables[0];
  563. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  564. foreach (UltraGridRow ugr2 in this.ultraGrid2.Rows)
  565. {
  566. ugr2.Cells["Column1"].Value = ugr2.Cells["THICK"].Value + "*" + ugr2.Cells["WIDTH"].Value + "*" + ugr2.Cells["LENGTH"].Value;
  567. }
  568. }
  569. catch (Exception ex)
  570. {
  571. System.Diagnostics.Debug.WriteLine(ex.ToString());
  572. MessageBox.Show("系统出错,请联系管理人员", "警告");
  573. }
  574. }
  575. #endregion
  576. #region 发送检验委托
  577. private void DoSend()
  578. {
  579. try
  580. {
  581. DoUpdate();//先修改取样材料号
  582. CoreClientParam ccp = new CoreClientParam();
  583. string SPECIMEN_NO = "";
  584. string fh = "";
  585. int num = 0;
  586. foreach (UltraGridRow ugr in this.ultraGrid1.Rows)
  587. {
  588. string specimeNo = "";
  589. if (ugr.Cells["CHK"].Value.ToString().ToLower() == "true")
  590. {
  591. specimeNo = ugr.Cells["SPECIMEN_NO"].Value.ToString();
  592. num = num + 1;
  593. if (num <= 1)
  594. {
  595. SPECIMEN_NO = specimeNo;
  596. fh = ",";
  597. }
  598. else
  599. {
  600. SPECIMEN_NO = SPECIMEN_NO + fh + specimeNo;
  601. }
  602. }
  603. }
  604. ccp.ServerName = "QCM.JHY01.JHY0102.Send2";
  605. ccp.MethodName = "SendLIMES";
  606. ccp.ServerParams = new object[] { SPECIMEN_NO, this.UserInfo.GetUserID(), this.UserInfo.GetUserName()," " };
  607. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  608. if (ccp.ReturnCode != -1)
  609. {
  610. MessageBox.Show("发送成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.None);//ccp.ReturnInfo "发送成功" ccp.ReturnInfo
  611. }
  612. this.DoQuery();
  613. int conut = this.ultraGrid1.Rows.Count();
  614. if (conut <= 0)
  615. {
  616. this.dataSet2.Clear();
  617. this.dataSet3.Clear();
  618. }
  619. }
  620. catch (Exception ex)
  621. {
  622. System.Diagnostics.Debug.WriteLine(ex.ToString());
  623. MessageBox.Show("系统出错,请联系管理人员", "警告");
  624. }
  625. }
  626. #endregion
  627. #region 撤销检验委托
  628. private void DoUnsend()
  629. {
  630. try
  631. {
  632. if (MessageBox.Show("确认撤销发送?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
  633. {
  634. return;
  635. }
  636. String zhyy = "MES撤回";
  637. CoreClientParam ccp = new CoreClientParam();
  638. string SPECIMEN_NO = "";
  639. string fh = "";
  640. int num = 0;
  641. foreach (UltraGridRow ugr in this.ultraGrid4.Rows)
  642. {
  643. string specimeNo = "";
  644. if (ugr.Cells["CHK"].Value.ToString().ToLower() == "true")
  645. {
  646. specimeNo = ugr.Cells["SPECIMEN_NO"].Value.ToString();
  647. num = num + 1;
  648. if (num <= 1)
  649. {
  650. SPECIMEN_NO = specimeNo;
  651. fh = ",";
  652. }
  653. else
  654. {
  655. SPECIMEN_NO = SPECIMEN_NO + fh + specimeNo;
  656. }
  657. }
  658. }
  659. ccp.ServerName = "QCM.JHY01.JHY0102.Send2";
  660. ccp.MethodName = "CancelLIMES";
  661. ccp.ServerParams = new object[] { SPECIMEN_NO, this.UserInfo.GetUserName(), zhyy };
  662. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  663. if (ccp.ReturnCode != -1)
  664. {
  665. MessageBox.Show("撤销发送成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.None);//ccp.ReturnInfo "发送成功" ccp.ReturnInfo
  666. }
  667. this.DoQuery();
  668. int conut = this.ultraGrid1.Rows.Count();
  669. if (conut <= 0)
  670. {
  671. this.dataSet2.Clear();
  672. this.dataSet3.Clear();
  673. }
  674. }
  675. catch (Exception ex)
  676. {
  677. System.Diagnostics.Debug.WriteLine(ex.ToString());
  678. MessageBox.Show("系统出错,请联系管理人员", "警告");
  679. }
  680. }
  681. #endregion
  682. #endregion
  683. #region 其它事件
  684. #region 查询下拉框 取样材料号
  685. private void ultraGrid1_AfterCellActivate(object sender, EventArgs e)
  686. {
  687. // this.dataSet4.Clear();
  688. //String heatNo = this.ultraGrid1.ActiveRow.Cells["HEAT_NO"].Value.ToString();
  689. //CoreClientParam ccp2 = new CoreClientParam();
  690. //ccp2.ServerName = "QCM.JHY01.JHY0101.QuerryQltySample";//调用java地址
  691. //ccp2.MethodName = "getBatchNo";//调用的方法
  692. //ccp2.ServerParams = new object[] { heatNo };
  693. //ccp2.SourceDataTable = this.dataSet4.Tables[0];
  694. //this.ExecuteQueryToDataTable(ccp2, CoreInvokeType.Internal);
  695. //ValueList VDEFECT_DESC2 = new ValueList();
  696. //for (int i = 0; i < ccp2.SourceDataTable.Rows.Count; i++)
  697. //{
  698. // VDEFECT_DESC2.ValueListItems.Add(ccp2.SourceDataTable.Rows[i]["BATCH_NO"].ToString(), ccp2.SourceDataTable.Rows[i]["BATCH_NO"].ToString());
  699. //}
  700. //this.ultraGrid1.DisplayLayout.Bands[0].Columns["BATCH_NO"].ValueList = VDEFECT_DESC2;
  701. this.dataSet4.Clear();
  702. String batchNo = this.ultraGrid1.ActiveRow.Cells["BATCH_NO"].Value.ToString();
  703. String plineCode = this.ultraGrid1.ActiveRow.Cells["PLINE_CODE"].Value.ToString();
  704. CoreClientParam ccp = new CoreClientParam();
  705. ccp.ServerName = "QCM.JHY01.JHY0101.QuerryQltySample";//调用java地址
  706. ccp.MethodName = "getBilletId";//调用的方法
  707. ccp.ServerParams = new object[] { batchNo, plineCode };
  708. ccp.SourceDataTable = this.dataSet4.Tables[0];
  709. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  710. ValueList VDEFECT_DESC = new ValueList();
  711. for (int i = 0; i < ccp.SourceDataTable.Rows.Count; i++)
  712. {
  713. VDEFECT_DESC.ValueListItems.Add(ccp.SourceDataTable.Rows[i]["MATERIAL_NO"].ToString(), ccp.SourceDataTable.Rows[i]["MATERIAL_NO"].ToString());
  714. }
  715. this.ultraGrid1.DisplayLayout.Bands[0].Columns["MATERIAL_NO"].ValueList = VDEFECT_DESC;
  716. }
  717. #endregion
  718. private void ultraGrid1_AfterRowActivate(object sender, EventArgs e)
  719. {
  720. int num = this.ultraGrid1.Rows.Count();
  721. if (num >= 1)
  722. {
  723. // this.DoQueryPrg(this.ultraGrid1.ActiveRow);//右下角
  724. // this.DoQueryOrder(this.ultraGrid1.ActiveRow);//左下角
  725. Infragistics.Win.UltraWinGrid.UltraGrid uGrid = (Infragistics.Win.UltraWinGrid.UltraGrid)sender;
  726. string specimen_no = uGrid.ActiveRow.Cells["SPECIMEN_NO"].Text.Trim();
  727. string smp_no = uGrid.ActiveRow.Cells["SMP_NO"].Text.Trim();
  728. this.dataSet3.Tables[0].Clear();
  729. this.dataSet2.Tables[0].Clear();
  730. CoreClientParam ccp = new CoreClientParam();
  731. ccp.ServerName = "QCM.JHY01.JHY0101.QuerryQltySample";
  732. ccp.MethodName = "getQltySampleItemNew";
  733. ccp.ServerParams = new object[] { specimen_no };
  734. ccp.SourceDataTable = this.dataSet3.Tables[0];
  735. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  736. CoreClientParam ccp1 = new CoreClientParam();
  737. ccp1.ServerName = "QCM.JHY01.JHY0101.QuerryQltySample";
  738. ccp1.MethodName = "getQltySampleOrdNew";
  739. ccp1.ServerParams = new object[] { smp_no };
  740. ccp1.SourceDataTable = this.dataSet2.Tables[0];
  741. this.ExecuteQueryToDataTable(ccp1, CoreInvokeType.Internal);
  742. //foreach (UltraGridRow ugr2 in this.ultraGrid2.Rows)
  743. //{
  744. // ugr2.Cells["Column1"].Value = ugr2.Cells["THICK"].Value + "*" + ugr2.Cells["WIDTH"].Value + "*" + ugr2.Cells["LENGTH"].Value;
  745. //}
  746. }
  747. else
  748. {
  749. this.dataSet2.Clear();
  750. this.dataSet3.Clear();
  751. }
  752. }
  753. #region 选择tab 显示相应按钮
  754. private void ultraTabControl1_SelectedTabChanged(object sender, Infragistics.Win.UltraWinTabControl.SelectedTabChangedEventArgs e)
  755. {
  756. if (this.ultraTabControl1.SelectedTab.Index == 0)
  757. {
  758. this.ToolBarItemEnable(this, "Send", true);
  759. this.ToolBarItemEnable(this, "Add", true);
  760. this.ToolBarItemEnable(this, "AddArtificial", true);
  761. this.ToolBarItemEnable(this, "Unsend", false);
  762. this.ToolBarItemEnable(this, "AddWt", true);
  763. this.ToolBarItemEnable(this, "DelWt", true);
  764. this.ToolBarItemEnable(this, "DoDelete", true);
  765. this.DoQuery();
  766. }
  767. else if (this.ultraTabControl1.SelectedTab.Index == 1)
  768. {
  769. this.ToolBarItemEnable(this, "Send", false);
  770. this.ToolBarItemEnable(this, "Add", false);
  771. this.ToolBarItemEnable(this, "AddArtificial", false);
  772. this.ToolBarItemEnable(this, "Unsend", true);
  773. this.ToolBarItemEnable(this, "AddWt", false);
  774. this.ToolBarItemEnable(this, "DelWt", false);
  775. this.ToolBarItemEnable(this, "DoDelete", false);
  776. this.DoQuery();
  777. }
  778. }
  779. #endregion
  780. private void ultraGrid4_AfterRowActivate(object sender, EventArgs e)
  781. {
  782. // this.DoQueryPrg(this.ultraGrid4.ActiveRow);
  783. // this.DoQueryOrder(this.ultraGrid4.ActiveRow);
  784. Infragistics.Win.UltraWinGrid.UltraGrid uGrid = (Infragistics.Win.UltraWinGrid.UltraGrid)sender;
  785. string specimen_no = uGrid.ActiveRow.Cells["SPECIMEN_NO"].Text.Trim();
  786. string smp_no = uGrid.ActiveRow.Cells["SMP_NO"].Text.Trim();
  787. this.dataSet3.Tables[0].Clear();
  788. this.dataSet2.Tables[0].Clear();
  789. CoreClientParam ccp = new CoreClientParam();
  790. ccp.ServerName = "QCM.JHY01.JHY0101.QuerryQltySample";
  791. ccp.MethodName = "getQltySampleItemNew";
  792. ccp.ServerParams = new object[] { specimen_no };
  793. ccp.SourceDataTable = this.dataSet3.Tables[0];
  794. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  795. CoreClientParam ccp1 = new CoreClientParam();
  796. ccp1.ServerName = "QCM.JHY01.JHY0101.QuerryQltySample";
  797. ccp1.MethodName = "getQltySampleOrdNew";
  798. ccp1.ServerParams = new object[] { smp_no };
  799. ccp1.SourceDataTable = this.dataSet2.Tables[0];
  800. this.ExecuteQueryToDataTable(ccp1, CoreInvokeType.Internal);
  801. //foreach (UltraGridRow ugr2 in this.ultraGrid2.Rows)
  802. //{
  803. // ugr2.Cells["Column1"].Value = ugr2.Cells["THICK"].Value + "*" + ugr2.Cells["WIDTH"].Value + "*" + ugr2.Cells["LENGTH"].Value;
  804. //}
  805. }
  806. private void ultraGrid1_CellChange(object sender, CellEventArgs e)
  807. {
  808. ultraGrid1.UpdateData();
  809. }
  810. private void ultraGrid1_AfterHeaderCheckStateChanged(object sender, AfterHeaderCheckStateChangedEventArgs e)
  811. {
  812. ultraGrid1.UpdateData();
  813. }
  814. private void ultraGrid4_AfterHeaderCheckStateChanged(object sender, AfterHeaderCheckStateChangedEventArgs e)
  815. {
  816. ultraGrid4.UpdateData();
  817. }
  818. private void ultraGrid4_CellChange(object sender, CellEventArgs e)
  819. {
  820. ultraGrid4.UpdateData();
  821. }
  822. #endregion
  823. #region 右下角 删除 名称
  824. private void ultraGrid3_InitializeRow(object sender, InitializeRowEventArgs e)
  825. {
  826. e.Row.Cells["deletebol"].Value = "删除";
  827. }
  828. #endregion
  829. #region 右下角 删除
  830. private void ultraGrid3_ClickCellButton(object sender, CellEventArgs e)
  831. {
  832. ultraGrid3.UpdateData();
  833. if (e.Cell.Column.Key == "deletebol")
  834. {
  835. if (MessageBox.Show("确定要删除这一项目?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Asterisk) == DialogResult.No)
  836. {
  837. return;
  838. }
  839. try
  840. {
  841. CoreClientParam ccp = new CoreClientParam();
  842. String seq = "";//检验项目流水号
  843. String specimenNo = "";//取样编号
  844. UltraGridRow row = ultraGrid3.ActiveRow;
  845. if (!row.Cells["ITEM_FLAG"].Value.ToString().Equals("1"))
  846. {
  847. MessageBox.Show("不能删除系统生成的项目,只能删除人工生成的项目!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
  848. return;
  849. }
  850. seq = row.Cells["SEQ"].Value.ToString();
  851. specimenNo = row.Cells["SPECIMEN_NO"].Value.ToString();
  852. ccp.ServerName = "QCM.JHY01.JHY0102.UpdateInfo";
  853. ccp.MethodName = "deleteInfo";
  854. ccp.ServerParams = new object[] { seq, specimenNo };
  855. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  856. if (ccp.ReturnCode != -1)
  857. {
  858. MessageBox.Show(ccp.ReturnInfo, "提示", MessageBoxButtons.OK, MessageBoxIcon.None);
  859. }
  860. this.DoQueryPrg(this.ultraGrid1.ActiveRow);
  861. }
  862. catch (Exception ex)
  863. {
  864. System.Diagnostics.Debug.WriteLine(ex.ToString());
  865. MessageBox.Show("系统出错,请联系管理人员", "警告");
  866. }
  867. }
  868. }
  869. #endregion
  870. #region 轧批号框勾选触发
  871. private void checkBox1_Click(object sender, EventArgs e)
  872. {
  873. if (this.checkBox1.Checked)
  874. {
  875. this.dateTimePicker1.Enabled = false;
  876. this.dateTimePicker2.Enabled = false;
  877. this.textBox1.Enabled = true;
  878. this.BATCH_NO2.Enabled = true;
  879. this.selheatNo.Enabled = true;
  880. }
  881. else
  882. {
  883. this.dateTimePicker1.Enabled = true;
  884. this.dateTimePicker2.Enabled = true;
  885. this.textBox1.Enabled = false;
  886. this.BATCH_NO2.Enabled = false;
  887. this.selheatNo.Enabled = false;
  888. }
  889. }
  890. #endregion
  891. #region 表中的列 值改变触发
  892. private void ultraGrid1_AfterCellUpdate(object sender, CellEventArgs e)
  893. {
  894. Boolean bl = true;
  895. if (this.CustomInfo == "GX" || this.CustomInfo == "BC2" || this.CustomInfo == "GB")
  896. {
  897. UltraGridRow row = this.ultraGrid1.ActiveRow;
  898. if (row == null || "".Equals(row))
  899. {
  900. return;
  901. }
  902. String sendMemoValeu = row.Cells["SEND_MEMO"].Value.ToString();
  903. if (sendMemoValeu.Equals("A") || sendMemoValeu.Equals("B") || sendMemoValeu.Equals("C"))
  904. {
  905. String BATCH_NO = row.Cells["BATCH_NO"].Value.ToString();
  906. String SPECIMEN_NO = row.Cells["SPECIMEN_NO"].Value.ToString();
  907. String phyname = row.Cells["PHY_NAME_L_bj"].Value.ToString();
  908. String sendMemo = row.Cells["SEND_MEMO"].Text.ToString();
  909. //金相
  910. if (sendMemoValeu.Equals("A"))
  911. {
  912. if (phyname.Contains(sendMemo))
  913. {
  914. bl = false;
  915. }
  916. if (bl)
  917. {
  918. this.alert("轧批号【" + BATCH_NO + "】取样编号【" + SPECIMEN_NO + "】不包含:【" + sendMemo + "】");
  919. }
  920. }
  921. //重量偏差
  922. if (sendMemoValeu.Equals("B"))
  923. {
  924. if (phyname.Contains("其他"))
  925. {
  926. bl = false;
  927. }
  928. if (bl)
  929. {
  930. this.alert("轧批号【" + BATCH_NO + "】取样编号【" + SPECIMEN_NO + "】不包含:【" + sendMemo + "】");
  931. }
  932. }
  933. //金相&重量偏差
  934. if (sendMemoValeu.Equals("C"))
  935. {
  936. if (phyname.Contains("其他") && phyname.Contains("金相"))
  937. {
  938. bl = false;
  939. }
  940. if (bl)
  941. {
  942. this.alert("轧批号【" + BATCH_NO + "】取样编号【" + SPECIMEN_NO + "】需包含:【" + sendMemo + "】两个项目,请检查是否包含!!!");
  943. }
  944. }
  945. }
  946. }
  947. }
  948. #endregion
  949. #region 轧批号
  950. //textbox获得焦点
  951. //private void textBox1_Enter(object sender, EventArgs e)
  952. //{
  953. // if (textboxHasText == false) {
  954. // this.textBox1.Text = "";
  955. // this.BATCH_NO2.Text = "";
  956. // }
  957. // this.textBox1.ForeColor = Color.Black;
  958. // this.BATCH_NO2.ForeColor = Color.Black;
  959. //}
  960. //textbox获得焦点
  961. //private void textBox1_Leave(object sender, EventArgs e)
  962. //{
  963. // if (textBox1.Text == "")
  964. // {
  965. // textBox1.Text = "输入轧批号后四位";
  966. // textBox1.ForeColor = Color.LightGray;
  967. // this.BATCH_NO2.Text = "输入轧批号后四位";
  968. // this.BATCH_NO2.ForeColor = Color.LightGray;
  969. // textboxHasText = false;
  970. // }
  971. // else
  972. // textboxHasText = true;
  973. //}
  974. #endregion
  975. }
  976. }