QCM0201LT.cs 58 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405
  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. using ThoughtWorks.QRCode.Codec;
  14. using System.Drawing.Printing;
  15. using System.IO;
  16. using System.Drawing.Imaging;
  17. using System.Drawing.Drawing2D;
  18. namespace Core.LZMes.Client.QCM
  19. {
  20. public partial class QCM0201LT : FrmBase
  21. {
  22. #region 初始化
  23. //Boolean textboxHasText = false;//判断输入框是否有文本
  24. private String v_line_no = "";//RZ1-热轧 ZB1-中板线 HB1-厚板线 LT1-连退
  25. Image image2;//二维码
  26. private String v_BATCH_NO = "";//轧批号
  27. private String PRINT_SEQV = "";//打印序号
  28. private int lennum = 0;//长度
  29. public QCM0201LT()
  30. {
  31. InitializeComponent();
  32. }
  33. private void QCM0201LT_Load(object sender, EventArgs e)
  34. {
  35. //获取自定义参数
  36. if (!this.CustomInfo.Equals(""))
  37. {
  38. v_line_no = this.CustomInfo;
  39. }
  40. this.ultraGrid1.DisplayLayout.Bands[0].Columns["PHY_NAME_L_bj"].Header.Caption = "检验项目";
  41. this.ultraGrid4.DisplayLayout.Bands[0].Columns["PHY_NAME_L_bj"].Header.Caption = "检验项目";
  42. // dateTimePicker1.Value = DateTime.Now.Date.AddDays(-1);
  43. dateTimePicker2.Value = DateTime.Now.Date.AddDays(1);
  44. ValueList v = new ValueList();
  45. v.ValueListItems.Add("1", "是");
  46. v.ValueListItems.Add("0", "否");
  47. this.ultraGrid3.DisplayLayout.Bands[0].Columns["ISJUDGE"].ValueList = v.Clone();
  48. ValueList v1 = new ValueList();
  49. v1.ValueListItems.Add("0", "订单");
  50. v1.ValueListItems.Add("1", "人工");
  51. this.ultraGrid3.DisplayLayout.Bands[0].Columns["ITEM_FLAG"].ValueList = v1.Clone();
  52. this.ultraGrid6.DisplayLayout.Bands[0].Columns["ITEM_FLAG"].ValueList = v1.Clone();
  53. v1 = new ValueList();
  54. v1.ValueListItems.Add("0", "订单");
  55. v1.ValueListItems.Add("1", "人工复制");
  56. this.ultraGrid1.DisplayLayout.Bands[0].Columns["ITEM_FLAG"].ValueList = v1.Clone();
  57. this.ultraGrid4.DisplayLayout.Bands[0].Columns["ITEM_FLAG"].ValueList = v1.Clone();
  58. ValueList v2 = new ValueList();
  59. v2.ValueListItems.Add("A", "成分");
  60. v2.ValueListItems.Add("B", "材质");
  61. this.ultraGrid1.DisplayLayout.Bands[0].Columns["smp_catg"].ValueList = v2.Clone();
  62. this.ultraGrid4.DisplayLayout.Bands[0].Columns["smp_catg"].ValueList = v2.Clone();
  63. ValueList v3 = new ValueList();
  64. v3.ValueListItems.Add("", "");
  65. v3.ValueListItems.Add("A", "金相");
  66. v3.ValueListItems.Add("B", "重量偏差");
  67. v3.ValueListItems.Add("C", "金相&重量偏差");
  68. this.ultraGrid1.DisplayLayout.Bands[0].Columns["SEND_MEMO"].ValueList = v3.Clone();
  69. this.ultraGrid4.DisplayLayout.Bands[0].Columns["SEND_MEMO"].ValueList = v3.Clone();
  70. if (!this.checkBox1.Checked)
  71. {
  72. this.textBox1.Enabled = false;
  73. this.BATCH_NO2.Enabled = false;
  74. }
  75. // this.DoQuery();
  76. }
  77. #endregion
  78. #region 功能
  79. public override void ToolBar_Click(object sender, string ToolbarKey)
  80. {
  81. switch (ToolbarKey)
  82. {
  83. case "Query":
  84. this.DoQuery();
  85. break;
  86. case "Send":
  87. this.DoSend();
  88. break;
  89. case "Unsend":
  90. this.DoUnsend();//撤销委托
  91. break;
  92. case "Add":
  93. this.AddBasePhy();//新增检验项
  94. break;
  95. case "AddArtificial":
  96. this.AddArtificial();//新增人工委托
  97. break;
  98. case "Update":
  99. this.DoUpdate();//修改取样材料号
  100. break;
  101. case "AddWt":
  102. this.DoAddWt();//新增复制单条委托
  103. break;
  104. case "DelWt":
  105. this.DoDelWt();//撤销复制单条委托
  106. break;
  107. case "DoDelete":
  108. this.DoDelete();//删除委托
  109. break;
  110. case "DoEject":
  111. this.DoEject();//卷板质量异常处理
  112. break;
  113. case "UpBatchNo":
  114. this.DoUpBatchNo();//复样 修改轧批号 (一炉5个轧批 1 2 3 4 5 取1号轧批委托 夹杂不合格 复 2 3轧批)
  115. break;
  116. case "UpRefBatchNo":
  117. this.DoUpRefBatchNo();//初样 修改指定的按炉引用 (一炉5个轧批 1 2 3 4 5 系统默认为 1 但是现场实际取的是3 所以要人工修改)
  118. break;
  119. case "doPrint":
  120. this.doPrint();//打印
  121. break;
  122. }
  123. }
  124. #region 打印
  125. private void doPrint()
  126. {
  127. RowsCollection rowsCollection = this.ultraGrid1.Rows;
  128. if (this.ultraTabControl1.Tabs[0].Selected) //检验委托
  129. {
  130. rowsCollection = this.ultraGrid1.Rows;
  131. }
  132. else if (this.ultraTabControl1.Tabs[1].Selected)
  133. {
  134. rowsCollection = this.ultraGrid4.Rows;
  135. }
  136. foreach (UltraGridRow ugr in rowsCollection)
  137. {
  138. if (ugr.Cells["CHK"].Value.ToString().ToLower() == "true")
  139. {
  140. String specimenNo = ugr.Cells["SPECIMEN_NO"].Value.ToString();//取样编号
  141. String materialNo = ugr.Cells["MATERIAL_NO"].Value.ToString();//子板号
  142. String batchNO = ugr.Cells["BATCH_NO"].Value.ToString();//轧批号
  143. String steelName = ugr.Cells["STEEL_NAME"].Value.ToString();//钢种
  144. String thck = ugr.Cells["THICK"].Value.ToString();//规格
  145. String phyNameLbj = ugr.Cells["PHY_NAME_L_bj"].Value.ToString();//项目
  146. String STATUS = ugr.Cells["STATUS"].Value.ToString();//发送状态
  147. String PRINT_SEQ = ugr.Cells["PRINT_SEQ"].Value.ToString();//打印序号
  148. if (STATUS.Equals("未发送"))
  149. {
  150. this.alert("当前委托还未发送!请先发送委托");
  151. return;
  152. }
  153. if (string.IsNullOrEmpty(specimenNo))
  154. {
  155. this.alert("未找到相应委托数据!请核实!!!");
  156. return;
  157. }
  158. if (string.IsNullOrEmpty(PRINT_SEQ))
  159. {
  160. PRINT_SEQ = "1";
  161. }
  162. v_BATCH_NO = batchNO;//轧批号 batchNO 换成子板号240126
  163. PRINT_SEQV = PRINT_SEQ;
  164. //二维码内容
  165. //" 子板:" + materialNo +"轧批:" + batchNO + " 钢种:" + steelName + " 规格:" + thck + " 项目:" + phyNameLbj+ " 序号:" + PRINT_SEQV
  166. String qrCodeContent = batchNO;
  167. QRCodeEncoder qrCodeEncoder = new QRCodeEncoder();
  168. qrCodeEncoder.QRCodeEncodeMode = QRCodeEncoder.ENCODE_MODE.BYTE;//二维码编码格式
  169. int num = qrCodeContent.Length;
  170. lennum = num;
  171. if (num <= 90)
  172. {
  173. qrCodeEncoder.QRCodeScale = 5;
  174. qrCodeEncoder.QRCodeVersion = 1;//设置二维码的版本,默认7
  175. }
  176. else
  177. {
  178. qrCodeEncoder.QRCodeScale = 6;//二维码大小比例4
  179. qrCodeEncoder.QRCodeVersion = 14;//设置二维码的版本,默认7 该值影响二维码最高数据容量 7大致对应40个汉字长度,内容超出择需提升该数值
  180. }
  181. //设置错误校验级别,默认中等,二维码被遮挡住一部分实际上也是能扫出内容的,这个效验级别的意思就是
  182. //当遮挡部分最大占整体多少时仍然可以被扫出来,M大概在20%左右,H为30%,级别越高相应的数据容量会缩小
  183. qrCodeEncoder.QRCodeErrorCorrect = QRCodeEncoder.ERROR_CORRECTION.M;
  184. System.Drawing.Image image = qrCodeEncoder.Encode(qrCodeContent, Encoding.UTF8);//生成二维码图片 第一个参数打印内容
  185. image2 = image;
  186. string FilePath = @"C:\二维码";
  187. if (!Directory.Exists(FilePath))
  188. {
  189. Directory.CreateDirectory(FilePath);//判断是否有相应文件夹
  190. }
  191. PrintDocument printDocument = new PrintDocument();
  192. printDocument.PrinterSettings.PrinterName = "Deli DL-888T";//打印机名
  193. printDocument.PrintPage += new PrintPageEventHandler(pdt_PrintPage);//设置字体
  194. try
  195. {
  196. if (!printDocument.PrinterSettings.IsValid)
  197. {
  198. MessageBox.Show("打印设置无效!", "出错", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
  199. return;
  200. }
  201. printDocument.Print();
  202. }
  203. catch (Exception ex)
  204. {
  205. MessageBox.Show("打印过程出现异常!\n" + ex.Message, "出错", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
  206. }
  207. finally
  208. {
  209. printDocument.Dispose();
  210. }
  211. //增加打印标识
  212. CoreClientParam ccp = new CoreClientParam();
  213. ccp.ServerName = "QCM.JHY01.JHY0102.UpdateInfo";
  214. ccp.MethodName = "doPrintLog";
  215. ccp.ServerParams = new object[] { specimenNo };
  216. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  217. //保存二维码
  218. //FilePath = @"C:\二维码\" + batchNO + "二维码.jpg";
  219. //System.IO.FileStream fs = new System.IO.FileStream(FilePath, System.IO.FileMode.Create, System.IO.FileAccess.Write, System.IO.FileShare.None);
  220. //image.Save(fs, System.Drawing.Imaging.ImageFormat.Jpeg);
  221. //fs.Close();
  222. image.Dispose();
  223. }
  224. }
  225. }
  226. void pdt_PrintPage(object sender, PrintPageEventArgs e)
  227. {
  228. Graphics grfx = e.Graphics;
  229. grfx.DrawString(PRINT_SEQV, new Font("宋体", 15), Brushes.Black, 30, 70);//打印内容、字体、颜色、X、Y
  230. grfx.DrawString(v_BATCH_NO, new Font("宋体", 14), Brushes.Black, 68, 130);//打印内容、字体、颜色、X、Y
  231. grfx.DrawImage(image2, 70, 15, 120, 110);//图片、X、Y、宽、高
  232. }
  233. #endregion
  234. #endregion
  235. #region 功能方法
  236. #region 初样 修改取样轧批号按炉初样比如:夹杂
  237. private void DoUpRefBatchNo()
  238. {
  239. try
  240. {
  241. CoreClientParam ccp = new CoreClientParam();
  242. ArrayList smpNo = new ArrayList();//试样号
  243. ArrayList specimenNo = new ArrayList();//取样编号
  244. ArrayList batchNo = new ArrayList();//轧批号
  245. ArrayList heatnNo = new ArrayList();//炉号
  246. ArrayList materialNo = new ArrayList();//取样材料号
  247. ArrayList send_memo = new ArrayList();//发送备注
  248. ArrayList inspectionLot = new ArrayList();//检验号
  249. ArrayList plineCode = new ArrayList();
  250. foreach (UltraGridRow ugr in this.ultraGrid1.Rows)
  251. {
  252. if (ugr.Cells["CHK"].Value.ToString().ToLower() == "true")
  253. {
  254. if (!ugr.Cells["SMP_TYPE_CODE"].Value.ToString().Equals("0") || !ugr.Cells["FREQ_CODE"].Value.ToString().Equals("D"))
  255. {
  256. this.alert("修改初样取样轧批号按钮是用来修改按炉取样的轧批,请谨慎操作!");
  257. return;
  258. }
  259. smpNo.Add(ugr.Cells["SMP_NO"].Value.ToString());
  260. specimenNo.Add(ugr.Cells["SPECIMEN_NO"].Value.ToString());
  261. batchNo.Add(ugr.Cells["BATCH_NO"].Value.ToString());
  262. heatnNo.Add(ugr.Cells["HEAT_NO"].Value.ToString());
  263. materialNo.Add(ugr.Cells["MATERIAL_NO"].Value.ToString());
  264. send_memo.Add(ugr.Cells["SEND_MEMO"].Value.ToString());
  265. inspectionLot.Add(ugr.Cells["INSPECTION_LOT"].Value.ToString());
  266. plineCode.Add(ugr.Cells["PLINE_CODE"].Value.ToString());
  267. }
  268. }
  269. ccp.ServerName = "QCM.JHY01.JHY0102.UpdateInfo";
  270. ccp.MethodName = "DoUpRefBatchNo";
  271. ccp.ServerParams = new object[] { smpNo, specimenNo, batchNo, heatnNo, materialNo, send_memo, inspectionLot, plineCode };
  272. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  273. if (ccp.ReturnCode != -1)
  274. {
  275. MessageBox.Show("修改成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.None);
  276. }
  277. this.DoQuery();
  278. }
  279. catch (Exception ex)
  280. {
  281. System.Diagnostics.Debug.WriteLine(ex.ToString());
  282. MessageBox.Show("系统出错【初样修改轧批号】,请联系管理人员", "警告");
  283. }
  284. }
  285. #endregion
  286. #region 复样 修改轧批号
  287. private void DoUpBatchNo()
  288. {
  289. try
  290. {
  291. CoreClientParam ccp = new CoreClientParam();
  292. ArrayList smpNo = new ArrayList();//试样号
  293. ArrayList specimenNo = new ArrayList();//取样编号
  294. ArrayList batchNo = new ArrayList();//轧批号
  295. ArrayList materialNo = new ArrayList();//取样材料号
  296. ArrayList send_memo = new ArrayList();//发送备注
  297. ArrayList inspectionLot = new ArrayList();//检验号
  298. ArrayList plineCode = new ArrayList();
  299. foreach (UltraGridRow ugr in this.ultraGrid1.Rows)
  300. {
  301. if (ugr.Cells["CHK"].Value.ToString().ToLower() == "true")
  302. {
  303. if ((!ugr.Cells["SMP_TYPE_CODE"].Value.ToString().Equals("1") && !ugr.Cells["SMP_TYPE_CODE"].Value.ToString().Equals("3")) || !ugr.Cells["FREQ_CODE"].Value.ToString().Equals("D"))
  304. {
  305. this.alert("修改复样轧批号按钮是用来修改按炉取样的轧批,请谨慎操作!");
  306. return;
  307. }
  308. smpNo.Add(ugr.Cells["SMP_NO"].Value.ToString());
  309. specimenNo.Add(ugr.Cells["SPECIMEN_NO"].Value.ToString());
  310. batchNo.Add(ugr.Cells["BATCH_NO"].Value.ToString());
  311. materialNo.Add(ugr.Cells["MATERIAL_NO"].Value.ToString());
  312. send_memo.Add(ugr.Cells["SEND_MEMO"].Value.ToString());
  313. inspectionLot.Add(ugr.Cells["INSPECTION_LOT"].Value.ToString());
  314. plineCode.Add(ugr.Cells["PLINE_CODE"].Value.ToString());
  315. }
  316. }
  317. ccp.ServerName = "QCM.JHY01.JHY0102.UpdateInfo";
  318. ccp.MethodName = "updateBatchNo";
  319. ccp.ServerParams = new object[] { smpNo, specimenNo, batchNo, materialNo, send_memo, inspectionLot, plineCode };
  320. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  321. if (ccp.ReturnCode != -1)
  322. {
  323. MessageBox.Show("修改成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.None);
  324. }
  325. this.DoQuery();
  326. }
  327. catch (Exception ex)
  328. {
  329. System.Diagnostics.Debug.WriteLine(ex.ToString());
  330. MessageBox.Show("系统出错【复样修改轧批号】,请联系管理人员", "警告");
  331. }
  332. }
  333. #endregion
  334. #region 修改取样材料号
  335. private void DoUpdate()
  336. {
  337. try
  338. {
  339. //String plineCode = this.CustomInfo;
  340. CoreClientParam ccp = new CoreClientParam();
  341. ArrayList smpNo = new ArrayList();//试样号
  342. ArrayList specimenNo = new ArrayList();//取样编号
  343. ArrayList batchNo = new ArrayList();//轧批号
  344. ArrayList materialNo = new ArrayList();//取样材料号
  345. ArrayList send_memo = new ArrayList();//发送备注
  346. ArrayList inspectionLot = new ArrayList();//检验号
  347. ArrayList plineCode = new ArrayList();
  348. foreach (UltraGridRow ugr in this.ultraGrid1.Rows)
  349. {
  350. if (ugr.Cells["CHK"].Value.ToString().ToLower() == "true")
  351. {
  352. smpNo.Add(ugr.Cells["SMP_NO"].Value.ToString());
  353. specimenNo.Add(ugr.Cells["SPECIMEN_NO"].Value.ToString());
  354. batchNo.Add(ugr.Cells["BATCH_NO"].Value.ToString());
  355. materialNo.Add(ugr.Cells["MATERIAL_NO"].Value.ToString());
  356. send_memo.Add(ugr.Cells["SEND_MEMO"].Value.ToString());
  357. inspectionLot.Add(ugr.Cells["INSPECTION_LOT"].Value.ToString());
  358. plineCode.Add(ugr.Cells["PLINE_CODE"].Value.ToString());
  359. }
  360. }
  361. ccp.ServerName = "QCM.JHY01.JHY0102.UpdateInfo";
  362. ccp.MethodName = "updateMaterialNo";
  363. ccp.ServerParams = new object[] { smpNo, specimenNo, batchNo, materialNo, send_memo, inspectionLot, plineCode };
  364. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  365. }
  366. catch (Exception ex)
  367. {
  368. System.Diagnostics.Debug.WriteLine(ex.ToString());
  369. MessageBox.Show("系统出错【修改取样材料号】,请联系管理人员", "警告");
  370. }
  371. }
  372. #endregion
  373. #region 新增人工委托
  374. private void AddArtificial()
  375. {
  376. try
  377. {
  378. QCM0205 frmRbp = new QCM0205();
  379. frmRbp.StartPosition = FormStartPosition.CenterScreen;
  380. frmRbp.ob = this.ob;
  381. frmRbp.plineCode = "LT1";
  382. frmRbp.ShowDialog();
  383. this.DoQuery();
  384. }
  385. catch (Exception ex)
  386. {
  387. MessageBox.Show("操作过程出现异常!\n" + ex.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
  388. }
  389. }
  390. #endregion
  391. #region 新增检验项
  392. private void AddBasePhy()
  393. {
  394. try
  395. {
  396. UltraGridRow row = this.ultraGrid1.ActiveRow;
  397. if (row == null)
  398. {
  399. this.alert("检验委托为空!请选择检验委托数据!!!");
  400. return;
  401. }
  402. if (!row.Cells["SMP_CATG"].Text.ToString().Equals("材质"))
  403. {
  404. this.alert("只有材质数据才可以新增检验项!!!");
  405. return;
  406. }
  407. QCM0204 frmRbp = new QCM0204();
  408. frmRbp.StartPosition = FormStartPosition.CenterScreen;
  409. frmRbp.ob = this.ob;
  410. frmRbp.specimenNo = row.Cells["SPECIMEN_NO"].Value.ToString();
  411. frmRbp.smpNo = row.Cells["SMP_NO"].Value.ToString();
  412. frmRbp.plineCode = "LT1";
  413. frmRbp.ShowDialog();
  414. this.DoQueryPrg(row);//右下角
  415. }
  416. catch (Exception ex)
  417. {
  418. MessageBox.Show("操作过程出现异常!\n" + ex.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
  419. }
  420. }
  421. #endregion
  422. #region 新增复制单条委托
  423. private void DoAddWt()
  424. {
  425. try
  426. {
  427. int num = 0;
  428. foreach (UltraGridRow ugr in this.ultraGrid1.Rows)
  429. {
  430. if (ugr.Cells["CHK"].Value.ToString().ToLower() == "true")
  431. {
  432. num = num + 1;
  433. }
  434. }
  435. if (num > 1)
  436. {
  437. this.alert("只能单条复制!为防止数据差错谢谢配合【谨慎复制】");
  438. return;
  439. }
  440. UltraGridRow row = this.ultraGrid1.ActiveRow;
  441. if (row == null)
  442. {
  443. this.alert("检验委托为空!请选择检验委托数据!!!");
  444. return;
  445. }
  446. String batchNo = row.Cells["BATCH_NO"].Value.ToString();//轧批号
  447. String designKey = row.Cells["DESIGN_KEY"].Value.ToString();//订单号
  448. String smpNo = row.Cells["SMP_NO"].Value.ToString();//试样号
  449. String specimenNo = row.Cells["SPECIMEN_NO"].Value.ToString();//取样编号
  450. String smpTypeName = row.Cells["SMP_TYPE_NAME"].Value.ToString();//取样类型
  451. if (MessageBox.Show("轧批号【" + batchNo + "】,确认复制当前委托一条?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
  452. {
  453. return;
  454. }
  455. CoreClientParam ccp = new CoreClientParam();
  456. ccp.ServerName = "QCM.JHY01.JHY0102.UpdateInfo";
  457. if (smpTypeName.Equals("初样"))
  458. {
  459. ccp.MethodName = "DoAddWtZy";
  460. }
  461. else if (smpTypeName.Equals("复样"))
  462. {
  463. ccp.MethodName = "DoAddWtFy";
  464. }
  465. ccp.ServerParams = new object[] { batchNo, designKey, smpNo, specimenNo, this.UserInfo.GetUserName() };
  466. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  467. if (ccp.ReturnCode != -1)
  468. {
  469. MessageBox.Show("复制委托成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.None);
  470. }
  471. this.DoQuery();
  472. }
  473. catch (Exception ex)
  474. {
  475. MessageBox.Show("操作过程出现异常!\n" + ex.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
  476. }
  477. }
  478. #endregion
  479. #region 撤销复制单条委托
  480. private void DoDelWt()
  481. {
  482. try
  483. {
  484. int num = 0;
  485. foreach (UltraGridRow ugr in this.ultraGrid1.Rows)
  486. {
  487. if (ugr.Cells["CHK"].Value.ToString().ToLower() == "true")
  488. {
  489. num = num + 1;
  490. }
  491. }
  492. if (num > 1)
  493. {
  494. this.alert("只能单条删除!为防止数据差错谢谢配合【谨慎删除】");
  495. return;
  496. }
  497. UltraGridRow row = this.ultraGrid1.ActiveRow;
  498. if (row == null)
  499. {
  500. this.alert("检验委托为空!请选择检验委托数据!!!");
  501. return;
  502. }
  503. String batchNo = row.Cells["BATCH_NO"].Value.ToString();//轧批号
  504. String designKey = row.Cells["DESIGN_KEY"].Value.ToString();//订单号
  505. String smpNo = row.Cells["SMP_NO"].Value.ToString();//试样号
  506. String specimenNo = row.Cells["SPECIMEN_NO"].Value.ToString();//取样编号
  507. String smpTypeName = row.Cells["SMP_TYPE_NAME"].Value.ToString();//取样类型
  508. String item_flag = row.Cells["ITEM_FLAG"].Value.ToString();//项目来源(0-订单,1-人工)
  509. if (MessageBox.Show("轧批号【" + batchNo + "】,确认撤销当前委托?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
  510. {
  511. return;
  512. }
  513. if (!item_flag.Equals("1"))
  514. {
  515. this.alert("只能撤销人工复制委托");
  516. return;
  517. }
  518. CoreClientParam ccp = new CoreClientParam();
  519. ccp.ServerName = "QCM.JHY01.JHY0102.UpdateInfo";
  520. if (smpTypeName.Equals("初样"))
  521. {
  522. ccp.MethodName = "DoDelWtZy";
  523. }
  524. else if (smpTypeName.Equals("复样"))
  525. {
  526. ccp.MethodName = "DoDelWtFy";
  527. }
  528. ccp.ServerParams = new object[] { batchNo, designKey, smpNo, specimenNo };
  529. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  530. if (ccp.ReturnCode != -1)
  531. {
  532. MessageBox.Show("撤销复制委托成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.None);//ccp.ReturnInfo "发送成功" ccp.ReturnInfo
  533. }
  534. this.DoQuery();
  535. }
  536. catch (Exception ex)
  537. {
  538. MessageBox.Show("操作过程出现异常!\n" + ex.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
  539. }
  540. }
  541. #endregion
  542. #region 删除委托
  543. private void DoDelete()
  544. {
  545. try
  546. {
  547. UltraGridRow row = this.ultraGrid1.ActiveRow;
  548. if (row == null)
  549. {
  550. this.alert("检验委托为空!请选择检验委托数据!!!");
  551. return;
  552. }
  553. String batchNoViw = row.Cells["BATCH_NO"].Value.ToString();//轧批号
  554. ArrayList batchNo = new ArrayList();//轧批号
  555. ArrayList designKey = new ArrayList();//订单号
  556. ArrayList smpNo = new ArrayList();//试样号
  557. ArrayList specimenNo = new ArrayList();//取样编号
  558. ArrayList smpTypeName = new ArrayList();//取样类型
  559. foreach (UltraGridRow ugr in this.ultraGrid1.Rows)
  560. {
  561. if (ugr.Cells["CHK"].Value.ToString().ToLower() == "true")
  562. {
  563. batchNo.Add(ugr.Cells["BATCH_NO"].Value.ToString());//轧批号
  564. designKey.Add(ugr.Cells["DESIGN_KEY"].Value.ToString());//订单号
  565. smpNo.Add(ugr.Cells["SMP_NO"].Value.ToString());//试样号
  566. specimenNo.Add(ugr.Cells["SPECIMEN_NO"].Value.ToString());//取样编号
  567. smpTypeName.Add(ugr.Cells["SMP_TYPE_NAME"].Value.ToString());//取样类型
  568. if (ugr.Cells["SMP_TYPE_CODE"].Value.ToString().Equals("3"))
  569. {
  570. this.alert("件件取样暂时不支持删除!!!");
  571. return;
  572. }
  573. }
  574. }
  575. if (MessageBox.Show("确认删除轧批号【" + batchNoViw + "】委托?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
  576. {
  577. return;
  578. }
  579. CoreClientParam ccp = new CoreClientParam();
  580. ccp.ServerName = "QCM.JHY01.JHY0102.UpdateInfo";
  581. ccp.MethodName = "DoDelete";
  582. ccp.ServerParams = new object[] { batchNo, designKey, smpNo, specimenNo, smpTypeName, this.UserInfo.GetUserName() };
  583. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  584. if (ccp.ReturnCode != -1)
  585. {
  586. MessageBox.Show("删除委托成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.None);
  587. }
  588. this.DoQuery();
  589. }
  590. catch (Exception ex)
  591. {
  592. MessageBox.Show("操作过程出现异常!\n" + ex.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
  593. }
  594. }
  595. #endregion
  596. #region 查询
  597. private void DoQuery()
  598. {
  599. try
  600. {
  601. String checkboxVal = "";
  602. String STARTTIME = this.dateTimePicker1.Value.ToString("yyyy-MM-dd");
  603. String ENDTIME = this.dateTimePicker2.Value.ToString("yyyy-MM-dd");
  604. String BATCH_NO = this.textBox1.Text.Trim();
  605. String BATCH_NO2 = this.BATCH_NO2.Text.Trim();
  606. String VALIDFLAG = "1";
  607. String CERT_INST_NAME = this.textBox2.Text.Trim();//认证机构
  608. String PLINE_NAME = this.PLINE_NAME.Text.Trim();
  609. String PLINE_CODE = v_line_no;
  610. String STEEL_NAME = this.txt_steel_name.Text.Trim();
  611. String SMP_CATG = this.cbx_smp_catg.Text.Trim();
  612. String heatNo = this.selheatNo.Text.Trim();
  613. if (PLINE_NAME.Equals("全部"))
  614. {
  615. PLINE_NAME = "";
  616. }
  617. if (CERT_INST_NAME.Equals("全部"))
  618. {
  619. CERT_INST_NAME = "";
  620. }
  621. if (SMP_CATG.Equals("全部"))
  622. {
  623. SMP_CATG = "";
  624. }
  625. else if (SMP_CATG.Equals("成分"))
  626. {
  627. SMP_CATG = "A";
  628. }
  629. else
  630. {
  631. SMP_CATG = "B";
  632. }
  633. if (this.CustomInfo == "BC2")
  634. {
  635. PLINE_NAME = "棒二线";
  636. }
  637. else if (this.CustomInfo == "GX")
  638. {
  639. PLINE_NAME = "高线";
  640. }
  641. else if (this.CustomInfo == "GB")
  642. {
  643. PLINE_NAME = "高棒线";
  644. }
  645. else if (this.CustomInfo == "RZ")
  646. {
  647. PLINE_NAME = "热轧";
  648. }
  649. else if (this.CustomInfo == "LT")
  650. {
  651. PLINE_NAME = "连退";
  652. }
  653. else if (this.CustomInfo == "HB")
  654. {
  655. PLINE_NAME = "厚板线";
  656. }
  657. else if (this.CustomInfo == "ZB")
  658. {
  659. PLINE_NAME = "中板线";
  660. }
  661. //轧批号 小框框 是否勾选
  662. if (this.checkBox1.Checked)
  663. {
  664. checkboxVal = "1";
  665. STARTTIME = "";
  666. ENDTIME = "";
  667. }
  668. else
  669. {
  670. BATCH_NO = "";
  671. BATCH_NO2 = "";
  672. }
  673. if (!string.IsNullOrEmpty(BATCH_NO2))
  674. {
  675. if (string.IsNullOrEmpty(BATCH_NO))
  676. {
  677. this.alert("请输入轧批号!!!");
  678. this.textBox1.Focus();
  679. return;
  680. }
  681. }
  682. CoreClientParam ccp = new CoreClientParam();
  683. if (this.ultraTabControl1.Tabs[0].Selected) //检验委托
  684. {
  685. this.dataSet1.Clear();
  686. ccp.ServerName = "QCM.JHY01.JHY0101.QuerryQltySample";
  687. ccp.MethodName = "getQltySampleInfo";
  688. ccp.SourceDataTable = this.dataSet1.Tables[0];
  689. }
  690. else if (this.ultraTabControl1.Tabs[1].Selected)
  691. {
  692. this.dataSet5.Clear();
  693. ccp.ServerName = "QCM.JHY01.JHY0101.QuerryQltySample";
  694. ccp.MethodName = "getQltySampleInfo";
  695. ccp.SourceDataTable = this.dataSet5.Tables[0];
  696. }
  697. Hashtable ht = new Hashtable();
  698. ht.Add("BATCH_NO", BATCH_NO);
  699. ht.Add("BATCH_NO2", BATCH_NO2);
  700. ht.Add("STARTTIME", STARTTIME);
  701. ht.Add("ENDTIME", ENDTIME);
  702. ht.Add("VALIDFLAG", VALIDFLAG);
  703. ht.Add("CERT_INST_NAME", CERT_INST_NAME);
  704. ht.Add("PLINE_NAME", PLINE_NAME);
  705. ht.Add("PLINE_CODE", PLINE_CODE);
  706. ht.Add("checkboxVal", checkboxVal);
  707. if (this.ultraTabControl1.Tabs[0].Selected)
  708. {
  709. ht.Add("STATUS", "0");
  710. }
  711. if (this.ultraTabControl1.Tabs[1].Selected)
  712. {
  713. ht.Add("TAB_NAME", "1");
  714. }
  715. ht.Add("STEEL_NAME", STEEL_NAME);
  716. ht.Add("SMP_CATG", SMP_CATG);
  717. ht.Add("HEAT_NO", heatNo);
  718. ccp.ServerParams = new object[] { ht };
  719. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  720. if (this.ultraTabControl1.Tabs[0].Selected) //检验委托
  721. {
  722. foreach (UltraGridRow ugr in this.ultraGrid1.Rows)
  723. {
  724. switch (ugr.Cells["STATUS"].Text.ToString())
  725. {
  726. case "0":
  727. ugr.Cells["STATUS"].Value = "未发送";
  728. break;
  729. case "1":
  730. ugr.Cells["STATUS"].Value = "已引用";
  731. break;
  732. case "2":
  733. ugr.Cells["STATUS"].Value = "已接收";
  734. break;
  735. case "3":
  736. ugr.Cells["STATUS"].Value = "已完成";
  737. break;
  738. case "4":
  739. ugr.Cells["STATUS"].Value = "检化验系统退回";
  740. break;
  741. case "5":
  742. ugr.Cells["STATUS"].Value = "重判";
  743. break;
  744. case "7":
  745. ugr.Cells["STATUS"].Value = "确认接收样";
  746. break;
  747. }
  748. if (ugr.Cells["SMP_TYPE_NAME"].Value.ToString() == "复样")
  749. {
  750. ugr.Cells["SMP_TYPE_NAME"].Appearance.ForeColor = Color.Red;
  751. }
  752. }
  753. int num = this.ultraGrid1.Rows.Count();
  754. if (num <= 0)
  755. {
  756. this.dataSet2.Clear();
  757. this.dataSet3.Clear();
  758. }
  759. }
  760. else if (this.ultraTabControl1.Tabs[1].Selected)
  761. {
  762. foreach (UltraGridRow ugr in this.ultraGrid4.Rows)
  763. {
  764. switch (ugr.Cells["STATUS"].Text.ToString())
  765. {
  766. case "0":
  767. ugr.Cells["STATUS"].Value = "未发送";
  768. break;
  769. case "1":
  770. ugr.Cells["STATUS"].Value = "已引用";
  771. break;
  772. case "2":
  773. ugr.Cells["STATUS"].Value = "已接收";
  774. break;
  775. case "3":
  776. ugr.Cells["STATUS"].Value = "已完成";
  777. break;
  778. case "4":
  779. ugr.Cells["STATUS"].Value = "检化验系统退回";
  780. break;
  781. case "5":
  782. ugr.Cells["STATUS"].Value = "重判";
  783. break;
  784. case "7":
  785. ugr.Cells["STATUS"].Value = "确认接收样";
  786. break;
  787. }
  788. if (ugr.Cells["SMP_TYPE_NAME"].Value.ToString() == "复样")
  789. {
  790. ugr.Cells["SMP_TYPE_NAME"].Appearance.ForeColor = Color.Red;
  791. }
  792. }
  793. int num = this.ultraGrid4.Rows.Count();
  794. if (num <= 0)
  795. {
  796. this.dataSet6.Clear();
  797. }
  798. }
  799. }
  800. catch (Exception ex)
  801. {
  802. System.Diagnostics.Debug.WriteLine(ex.ToString());
  803. MessageBox.Show("系统出错,请联系管理人员", "警告");
  804. }
  805. }
  806. #endregion
  807. #region 查找检验项目
  808. private void DoQueryPrg(UltraGridRow ugr)
  809. {
  810. try
  811. {
  812. this.dataSet3.Clear();
  813. String specimen_no = ugr.Cells["SPECIMEN_NO"].Value.ToString();
  814. CoreClientParam ccp = new CoreClientParam();
  815. ccp.ServerName = "QCM.JHY01.JHY0101.QuerryQltySample";
  816. ccp.MethodName = "getQltySampleItem";
  817. ccp.ServerParams = new object[] { specimen_no };
  818. ccp.SourceDataTable = this.dataSet3.Tables[0];
  819. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  820. }
  821. catch (Exception ex)
  822. {
  823. System.Diagnostics.Debug.WriteLine(ex.ToString());
  824. MessageBox.Show("系统出错,请联系管理人员", "警告");
  825. }
  826. }
  827. #endregion
  828. #region 查询订单信息
  829. private void DoQueryOrder(UltraGridRow ugr)
  830. {
  831. try
  832. {
  833. this.dataSet2.Clear();
  834. CoreClientParam ccp = new CoreClientParam();
  835. ccp.ServerName = "QCM.JHY01.JHY0101.QuerryQltySample";
  836. ccp.MethodName = "getQltySampleOrd";
  837. ccp.ServerParams = new object[] { ugr.Cells["SMP_NO"].Text.ToString() };
  838. ccp.SourceDataTable = this.dataSet2.Tables[0];
  839. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  840. //foreach (UltraGridRow ugr2 in this.ultraGrid2.Rows)
  841. //{
  842. // ugr2.Cells["Column1"].Value = ugr2.Cells["THICK"].Value + "*" + ugr2.Cells["WIDTH"].Value + "*" + ugr2.Cells["LENGTH"].Value;
  843. //}
  844. }
  845. catch (Exception ex)
  846. {
  847. System.Diagnostics.Debug.WriteLine(ex.ToString());
  848. MessageBox.Show("系统出错,请联系管理人员", "警告");
  849. }
  850. }
  851. #endregion
  852. #region 发送检验委托
  853. private void DoSend()
  854. {
  855. try
  856. {
  857. DoUpdate();//先修改取样材料号
  858. List<UltraGridRow> lists = new List<UltraGridRow>();
  859. CoreClientParam ccp = new CoreClientParam();
  860. string SPECIMEN_NO = "";
  861. string fh = "";
  862. int num = 0;
  863. foreach (UltraGridRow ugr in this.ultraGrid1.Rows)
  864. {
  865. string specimeNo = "";
  866. if (ugr.Cells["CHK"].Value.ToString().ToLower() == "true")
  867. {
  868. specimeNo = ugr.Cells["SPECIMEN_NO"].Value.ToString();
  869. num = num + 1;
  870. if (num <= 1)
  871. {
  872. SPECIMEN_NO = specimeNo;
  873. fh = ",";
  874. }
  875. else
  876. {
  877. SPECIMEN_NO = SPECIMEN_NO + fh + specimeNo;
  878. }
  879. lists.Add(ugr);
  880. }
  881. }
  882. ccp.ServerName = "QCM.JHY01.JHY0102.Send2";
  883. ccp.MethodName = "SendLIMES";
  884. ccp.ServerParams = new object[] { SPECIMEN_NO, this.UserInfo.GetUserID(), this.UserInfo.GetUserName(), " " };
  885. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  886. if (ccp.ReturnCode != -1)
  887. {
  888. for (int i = 0; i < lists.Count; i++)
  889. {
  890. lists[i].Delete(false);
  891. }
  892. MessageBox.Show("发送成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.None);//ccp.ReturnInfo "发送成功" ccp.ReturnInfo
  893. }
  894. //this.DoQuery();
  895. int conut = this.ultraGrid1.Rows.Count();
  896. if (conut <= 0)
  897. {
  898. this.dataSet2.Clear();
  899. this.dataSet3.Clear();
  900. }
  901. }
  902. catch (Exception ex)
  903. {
  904. System.Diagnostics.Debug.WriteLine(ex.ToString());
  905. MessageBox.Show("系统出错,请联系管理人员", "警告");
  906. }
  907. }
  908. #endregion
  909. #region 撤销检验委托
  910. private void DoUnsend()
  911. {
  912. try
  913. {
  914. if (MessageBox.Show("确认撤销发送?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
  915. {
  916. return;
  917. }
  918. List<UltraGridRow> lists = new List<UltraGridRow>();
  919. String zhyy = "MES撤回";
  920. CoreClientParam ccp = new CoreClientParam();
  921. string SPECIMEN_NO = "";
  922. string fh = "";
  923. int num = 0;
  924. foreach (UltraGridRow ugr in this.ultraGrid4.Rows)
  925. {
  926. string specimeNo = "";
  927. if (ugr.Cells["CHK"].Value.ToString().ToLower() == "true")
  928. {
  929. specimeNo = ugr.Cells["SPECIMEN_NO"].Value.ToString();
  930. num = num + 1;
  931. if (num <= 1)
  932. {
  933. SPECIMEN_NO = specimeNo;
  934. fh = ",";
  935. }
  936. else
  937. {
  938. SPECIMEN_NO = SPECIMEN_NO + fh + specimeNo;
  939. }
  940. lists.Add(ugr);
  941. }
  942. }
  943. ccp.ServerName = "QCM.JHY01.JHY0102.Send2";
  944. ccp.MethodName = "CancelLIMES";
  945. ccp.ServerParams = new object[] { SPECIMEN_NO, this.UserInfo.GetUserName(), zhyy };
  946. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  947. if (ccp.ReturnCode != -1)
  948. {
  949. for (int i = 0; i < lists.Count; i++)
  950. {
  951. lists[i].Delete(false);
  952. }
  953. MessageBox.Show("撤销发送成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.None);//ccp.ReturnInfo "发送成功" ccp.ReturnInfo
  954. }
  955. // this.DoQuery();
  956. int conut = this.ultraGrid4.Rows.Count();
  957. if (conut <= 0)
  958. {
  959. this.dataSet6.Clear();
  960. }
  961. }
  962. catch (Exception ex)
  963. {
  964. System.Diagnostics.Debug.WriteLine(ex.ToString());
  965. MessageBox.Show("系统出错,请联系管理人员", "警告");
  966. }
  967. }
  968. #endregion
  969. #region 卷板质量异常处理
  970. private void DoEject()
  971. {
  972. QCM0307 frmRbp = new QCM0307();
  973. frmRbp.StartPosition = FormStartPosition.CenterScreen;
  974. frmRbp.ob = this.ob;
  975. frmRbp.ShowDialog();
  976. }
  977. #endregion
  978. #endregion
  979. #region 其它事件
  980. #region 查询下拉框 取样材料号
  981. private void ultraGrid1_AfterCellActivate(object sender, EventArgs e)
  982. {
  983. //this.dataSet4.Clear();
  984. //String heatNo = this.ultraGrid1.ActiveRow.Cells["HEAT_NO"].Value.ToString();
  985. //CoreClientParam ccp2 = new CoreClientParam();
  986. //ccp2.ServerName = "QCM.JHY01.JHY0101.QuerryQltySample";//调用java地址
  987. //ccp2.MethodName = "getBatchNo";//调用的方法
  988. //ccp2.ServerParams = new object[] { heatNo };
  989. //ccp2.SourceDataTable = this.dataSet4.Tables[0];
  990. //this.ExecuteQueryToDataTable(ccp2, CoreInvokeType.Internal);
  991. //ValueList VDEFECT_DESC2 = new ValueList();
  992. //for (int i = 0; i < ccp2.SourceDataTable.Rows.Count; i++)
  993. //{
  994. // VDEFECT_DESC2.ValueListItems.Add(ccp2.SourceDataTable.Rows[i]["BATCH_NO"].ToString(), ccp2.SourceDataTable.Rows[i]["BATCH_NO"].ToString());
  995. //}
  996. //this.ultraGrid1.DisplayLayout.Bands[0].Columns["BATCH_NO"].ValueList = VDEFECT_DESC2;
  997. this.dataSet4.Clear();
  998. String batchNo = this.ultraGrid1.ActiveRow.Cells["BATCH_NO"].Value.ToString();
  999. String plineCode = this.ultraGrid1.ActiveRow.Cells["PLINE_CODE"].Value.ToString();
  1000. CoreClientParam ccp = new CoreClientParam();
  1001. ccp.ServerName = "QCM.JHY01.JHY0101.QuerryQltySample";//调用java地址
  1002. ccp.MethodName = "getBilletId";//调用的方法
  1003. ccp.ServerParams = new object[] { batchNo, plineCode };
  1004. ccp.SourceDataTable = this.dataSet4.Tables[0];
  1005. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  1006. ValueList VDEFECT_DESC = new ValueList();
  1007. for (int i = 0; i < ccp.SourceDataTable.Rows.Count; i++)
  1008. {
  1009. VDEFECT_DESC.ValueListItems.Add(ccp.SourceDataTable.Rows[i]["MATERIAL_NO"].ToString(), ccp.SourceDataTable.Rows[i]["MATERIAL_NO"].ToString());
  1010. }
  1011. this.ultraGrid1.DisplayLayout.Bands[0].Columns["MATERIAL_NO"].ValueList = VDEFECT_DESC;
  1012. }
  1013. #endregion
  1014. private void ultraGrid1_AfterRowActivate(object sender, EventArgs e)
  1015. {
  1016. int num = this.ultraGrid1.Rows.Count();
  1017. if (num >= 1)
  1018. {
  1019. // this.DoQueryPrg(this.ultraGrid1.ActiveRow);//右下角
  1020. // this.DoQueryOrder(this.ultraGrid1.ActiveRow);//左下角
  1021. Infragistics.Win.UltraWinGrid.UltraGrid uGrid = (Infragistics.Win.UltraWinGrid.UltraGrid)sender;
  1022. string specimen_no = uGrid.ActiveRow.Cells["SPECIMEN_NO"].Text.Trim();
  1023. string smp_no = uGrid.ActiveRow.Cells["SMP_NO"].Text.Trim();
  1024. this.dataSet3.Tables[0].Clear();
  1025. this.dataSet2.Tables[0].Clear();
  1026. CoreClientParam ccp = new CoreClientParam();
  1027. ccp.ServerName = "QCM.JHY01.JHY0101.QuerryQltySample";
  1028. ccp.MethodName = "getQltySampleItemNew";
  1029. ccp.ServerParams = new object[] { specimen_no };
  1030. ccp.SourceDataTable = this.dataSet3.Tables[0];
  1031. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  1032. //CoreClientParam ccp1 = new CoreClientParam();
  1033. //ccp1.ServerName = "QCM.JHY01.JHY0101.QuerryQltySample";
  1034. //ccp1.MethodName = "getQltySampleOrdNew";
  1035. //ccp1.ServerParams = new object[] { smp_no };
  1036. //ccp1.SourceDataTable = this.dataSet2.Tables[0];
  1037. //this.ExecuteQueryToDataTable(ccp1, CoreInvokeType.Internal);
  1038. //foreach (UltraGridRow ugr2 in this.ultraGrid2.Rows)
  1039. //{
  1040. // ugr2.Cells["Column1"].Value = ugr2.Cells["THICK"].Value + "*" + ugr2.Cells["WIDTH"].Value + "*" + ugr2.Cells["LENGTH"].Value;
  1041. //}
  1042. }
  1043. else
  1044. {
  1045. this.dataSet2.Clear();
  1046. this.dataSet3.Clear();
  1047. }
  1048. }
  1049. #region 选择tab 显示相应按钮
  1050. private void ultraTabControl1_SelectedTabChanged(object sender, Infragistics.Win.UltraWinTabControl.SelectedTabChangedEventArgs e)
  1051. {
  1052. if (this.ultraTabControl1.SelectedTab.Index == 0)
  1053. {
  1054. this.ToolBarItemEnable(this, "Send", true);
  1055. this.ToolBarItemEnable(this, "Add", true);
  1056. this.ToolBarItemEnable(this, "AddArtificial", true);
  1057. this.ToolBarItemEnable(this, "Unsend", false);
  1058. this.ToolBarItemEnable(this, "AddWt", true);
  1059. this.ToolBarItemEnable(this, "DelWt", true);
  1060. this.ToolBarItemEnable(this, "DoDelete", true);
  1061. this.ToolBarItemEnable(this, "doPrint", false);
  1062. // this.DoQuery();
  1063. }
  1064. else if (this.ultraTabControl1.SelectedTab.Index == 1)
  1065. {
  1066. this.ToolBarItemEnable(this, "Send", false);
  1067. this.ToolBarItemEnable(this, "Add", false);
  1068. this.ToolBarItemEnable(this, "AddArtificial", false);
  1069. this.ToolBarItemEnable(this, "Unsend", true);
  1070. this.ToolBarItemEnable(this, "AddWt", false);
  1071. this.ToolBarItemEnable(this, "DelWt", false);
  1072. this.ToolBarItemEnable(this, "DoDelete", false);
  1073. this.ToolBarItemEnable(this, "doPrint", true);
  1074. // this.DoQuery();
  1075. }
  1076. }
  1077. #endregion
  1078. private void ultraGrid4_AfterRowActivate(object sender, EventArgs e)
  1079. {
  1080. // this.DoQueryPrg(this.ultraGrid4.ActiveRow);
  1081. // this.DoQueryOrder(this.ultraGrid4.ActiveRow);
  1082. Infragistics.Win.UltraWinGrid.UltraGrid uGrid = (Infragistics.Win.UltraWinGrid.UltraGrid)sender;
  1083. string specimen_no = uGrid.ActiveRow.Cells["SPECIMEN_NO"].Text.Trim();
  1084. string smp_no = uGrid.ActiveRow.Cells["SMP_NO"].Text.Trim();
  1085. this.dataSet6.Tables[0].Clear();
  1086. //this.dataSet2.Tables[0].Clear();
  1087. CoreClientParam ccp = new CoreClientParam();
  1088. ccp.ServerName = "QCM.JHY01.JHY0101.QuerryQltySample";
  1089. ccp.MethodName = "getQltySampleItemNew";
  1090. ccp.ServerParams = new object[] { specimen_no };
  1091. ccp.SourceDataTable = this.dataSet6.Tables[0];
  1092. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  1093. //CoreClientParam ccp1 = new CoreClientParam();
  1094. //ccp1.ServerName = "QCM.JHY01.JHY0101.QuerryQltySample";
  1095. //ccp1.MethodName = "getQltySampleOrdNew";
  1096. //ccp1.ServerParams = new object[] { smp_no };
  1097. //ccp1.SourceDataTable = this.dataSet2.Tables[0];
  1098. //this.ExecuteQueryToDataTable(ccp1, CoreInvokeType.Internal);
  1099. //foreach (UltraGridRow ugr2 in this.ultraGrid2.Rows)
  1100. //{
  1101. // ugr2.Cells["Column1"].Value = ugr2.Cells["THICK"].Value + "*" + ugr2.Cells["WIDTH"].Value + "*" + ugr2.Cells["LENGTH"].Value;
  1102. //}
  1103. }
  1104. private void ultraGrid1_CellChange(object sender, CellEventArgs e)
  1105. {
  1106. ultraGrid1.UpdateData();
  1107. }
  1108. private void ultraGrid1_AfterHeaderCheckStateChanged(object sender, AfterHeaderCheckStateChangedEventArgs e)
  1109. {
  1110. ultraGrid1.UpdateData();
  1111. }
  1112. private void ultraGrid4_AfterHeaderCheckStateChanged(object sender, AfterHeaderCheckStateChangedEventArgs e)
  1113. {
  1114. ultraGrid4.UpdateData();
  1115. }
  1116. private void ultraGrid4_CellChange(object sender, CellEventArgs e)
  1117. {
  1118. ultraGrid4.UpdateData();
  1119. }
  1120. #endregion
  1121. #region 右下角 删除 名称
  1122. private void ultraGrid3_InitializeRow(object sender, InitializeRowEventArgs e)
  1123. {
  1124. e.Row.Cells["deletebol"].Value = "删除";
  1125. }
  1126. #endregion
  1127. #region 右下角 删除
  1128. private void ultraGrid3_ClickCellButton(object sender, CellEventArgs e)
  1129. {
  1130. ultraGrid3.UpdateData();
  1131. if (e.Cell.Column.Key == "deletebol")
  1132. {
  1133. if (MessageBox.Show("确定要删除这一项目?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Asterisk) == DialogResult.No)
  1134. {
  1135. return;
  1136. }
  1137. try
  1138. {
  1139. CoreClientParam ccp = new CoreClientParam();
  1140. String seq = "";//检验项目流水号
  1141. String specimenNo = "";//取样编号
  1142. UltraGridRow row = ultraGrid3.ActiveRow;
  1143. if (!row.Cells["ITEM_FLAG"].Value.ToString().Equals("1"))
  1144. {
  1145. MessageBox.Show("不能删除系统生成的项目,只能删除人工生成的项目!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
  1146. return;
  1147. }
  1148. seq = row.Cells["SEQ"].Value.ToString();
  1149. specimenNo = row.Cells["SPECIMEN_NO"].Value.ToString();
  1150. ccp.ServerName = "QCM.JHY01.JHY0102.UpdateInfo";
  1151. ccp.MethodName = "deleteInfo";
  1152. ccp.ServerParams = new object[] { seq, specimenNo };
  1153. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  1154. if (ccp.ReturnCode != -1)
  1155. {
  1156. MessageBox.Show(ccp.ReturnInfo, "提示", MessageBoxButtons.OK, MessageBoxIcon.None);
  1157. }
  1158. this.DoQueryPrg(this.ultraGrid1.ActiveRow);
  1159. }
  1160. catch (Exception ex)
  1161. {
  1162. System.Diagnostics.Debug.WriteLine(ex.ToString());
  1163. MessageBox.Show("系统出错,请联系管理人员", "警告");
  1164. }
  1165. }
  1166. }
  1167. #endregion
  1168. #region 轧批号框勾选触发
  1169. private void checkBox1_Click(object sender, EventArgs e)
  1170. {
  1171. if (this.checkBox1.Checked)
  1172. {
  1173. this.dateTimePicker1.Enabled = false;
  1174. this.dateTimePicker2.Enabled = false;
  1175. this.textBox1.Enabled = true;
  1176. this.BATCH_NO2.Enabled = true;
  1177. this.selheatNo.Enabled = true;
  1178. }
  1179. else
  1180. {
  1181. this.dateTimePicker1.Enabled = true;
  1182. this.dateTimePicker2.Enabled = true;
  1183. this.textBox1.Enabled = false;
  1184. this.BATCH_NO2.Enabled = false;
  1185. this.selheatNo.Enabled = false;
  1186. }
  1187. }
  1188. #endregion
  1189. #region 表中的列 值改变触发
  1190. private void ultraGrid1_AfterCellUpdate(object sender, CellEventArgs e)
  1191. {
  1192. Boolean bl = true;
  1193. if (this.CustomInfo == "GX")
  1194. {
  1195. UltraGridRow row = this.ultraGrid1.ActiveRow;
  1196. if (row == null || "".Equals(row))
  1197. {
  1198. return;
  1199. }
  1200. String sendMemoValeu = row.Cells["SEND_MEMO"].Value.ToString();
  1201. if (sendMemoValeu.Equals("A") || sendMemoValeu.Equals("B") || sendMemoValeu.Equals("C"))
  1202. {
  1203. String BATCH_NO = row.Cells["BATCH_NO"].Value.ToString();
  1204. String SPECIMEN_NO = row.Cells["SPECIMEN_NO"].Value.ToString();
  1205. String phyname = row.Cells["PHY_NAME_L_bj"].Value.ToString();
  1206. String sendMemo = row.Cells["SEND_MEMO"].Text.ToString();
  1207. //金相
  1208. if (sendMemoValeu.Equals("A"))
  1209. {
  1210. if (phyname.Contains(sendMemo))
  1211. {
  1212. bl = false;
  1213. }
  1214. if (bl)
  1215. {
  1216. this.alert("轧批号【" + BATCH_NO + "】取样编号【" + SPECIMEN_NO + "】不包含:【" + sendMemo + "】");
  1217. }
  1218. }
  1219. //重量偏差
  1220. if (sendMemoValeu.Equals("B"))
  1221. {
  1222. if (phyname.Contains("其他"))
  1223. {
  1224. bl = false;
  1225. }
  1226. if (bl)
  1227. {
  1228. this.alert("轧批号【" + BATCH_NO + "】取样编号【" + SPECIMEN_NO + "】不包含:【" + sendMemo + "】");
  1229. }
  1230. }
  1231. //金相&重量偏差
  1232. if (sendMemoValeu.Equals("C"))
  1233. {
  1234. if (phyname.Contains("其他") && phyname.Contains("金相"))
  1235. {
  1236. bl = false;
  1237. }
  1238. if (bl)
  1239. {
  1240. this.alert("轧批号【" + BATCH_NO + "】取样编号【" + SPECIMEN_NO + "】需包含:【" + sendMemo + "】两个项目,请检查是否包含!!!");
  1241. }
  1242. }
  1243. }
  1244. }
  1245. }
  1246. #endregion
  1247. #region 轧批号
  1248. //textbox获得焦点
  1249. //private void textBox1_Enter(object sender, EventArgs e)
  1250. //{
  1251. // if (textboxHasText == false) {
  1252. // this.textBox1.Text = "";
  1253. // this.BATCH_NO2.Text = "";
  1254. // }
  1255. // this.textBox1.ForeColor = Color.Black;
  1256. // this.BATCH_NO2.ForeColor = Color.Black;
  1257. //}
  1258. //textbox获得焦点
  1259. //private void textBox1_Leave(object sender, EventArgs e)
  1260. //{
  1261. // if (textBox1.Text == "")
  1262. // {
  1263. // textBox1.Text = "输入轧批号后四位";
  1264. // textBox1.ForeColor = Color.LightGray;
  1265. // this.BATCH_NO2.Text = "输入轧批号后四位";
  1266. // this.BATCH_NO2.ForeColor = Color.LightGray;
  1267. // textboxHasText = false;
  1268. // }
  1269. // else
  1270. // textboxHasText = true;
  1271. //}
  1272. #endregion
  1273. }
  1274. }