0cb4038931b28376279f67372b6f536c30b78430.svn-base 34 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.ComponentModel;
  5. using System.Data;
  6. using System.Drawing;
  7. using System.Linq;
  8. using System.Text;
  9. using System.IO;
  10. using System.Windows.Forms;
  11. using CoreFS.CA06;
  12. using PrintSolution.LabelPrinter;
  13. using INI;
  14. using Infragistics.Win.UltraWinGrid;
  15. using System.Reflection;
  16. namespace Core.LZMes.Client.UIL.UIL01
  17. {
  18. public partial class UIL010020 : FrmBase
  19. {
  20. private ZebraPrinter printer = new ZebraPrinter();
  21. private string iniVersions = "2"; //初始化从配置文件中加载的打印版本号
  22. public UIL010020()
  23. {
  24. InitializeComponent();
  25. }
  26. public override void ToolBar_Click(object sender, string ToolbarKey)
  27. {
  28. switch (ToolbarKey)
  29. {
  30. case "Query":
  31. this.DoQuery();
  32. break;
  33. case "Export":
  34. this.DoExport();
  35. break;
  36. case "Print":
  37. this.DoPrint();
  38. break;
  39. case "Save":
  40. this.DoSave();
  41. break;
  42. case "Exit":
  43. this.Close();
  44. break;
  45. }
  46. }
  47. /// <summary>
  48. /// 查询原料库库存数据
  49. /// </summary>
  50. private void DoQuery()
  51. {
  52. try
  53. {
  54. switch (CustomInfo)
  55. {
  56. case "1":
  57. this.ultraGrid1.DisplayLayout.Bands[0].Columns["CHK_Y"].Hidden = true;
  58. break;
  59. case "2":
  60. break;
  61. case "3":
  62. this.ultraGrid1.DisplayLayout.Bands[0].Columns["CHK_Y"].Hidden = true;
  63. break;
  64. case "4":
  65. this.ultraGrid1.DisplayLayout.Bands[0].Columns["CHK_Y"].Hidden = true;
  66. break;
  67. }
  68. this.dataSet1.Tables[0].Clear();
  69. string startTime = this.ultraDateTimeEditor1.Value != null ? this.ultraDateTimeEditor1.DateTime.ToString("yyyyMMdd") : "";//生产开始时间
  70. string endTime = this.ultraDateTimeEditor2.Value != null ? this.ultraDateTimeEditor2.DateTime.ToString("yyyyMMdd") : "";//生产结束时间
  71. string coilWthMin = this.textBox4.Text;//宽度最小值
  72. string coilWthMax = this.textBox5.Text;//宽度最大值
  73. string coilThkMin = this.textBox6.Text;//厚度最小值
  74. string coilThkMax = this.textBox7.Text;//厚度最大值
  75. string coilNo = this.textBox9.Text;//钢卷号
  76. string ordNo = this.textBox11.Text;//合同号
  77. string ordSeq = this.textBox3.Text;//订单号
  78. ArrayList list = new ArrayList();
  79. list.Add(startTime);
  80. list.Add(endTime);
  81. list.Add(coilThkMin);
  82. list.Add(coilThkMax);
  83. list.Add(coilWthMin);
  84. list.Add(coilWthMax);
  85. list.Add(ordNo);
  86. list.Add(ordSeq);
  87. list.Add(coilNo);
  88. list.Add(CustomInfo);
  89. CoreClientParam ccp = new CoreClientParam();
  90. ccp.ServerName = "UIL.UIL01.UIL010020";
  91. ccp.MethodName = "queryCoilList";
  92. ccp.ServerParams = new object[] { list };
  93. ccp.SourceDataTable = this.dataSet1.Tables[0];
  94. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  95. //打印标签后颜色区分 20131017
  96. //DataRowCollection drs = dataSet1.Tables[0].Rows; 存在漏洞不是每行都能选中!!!!!!
  97. Infragistics.Win.UltraWinGrid.RowsCollection drs = this.ultraGrid1.Rows;
  98. for (int i = 0; i < drs.Count; i++)
  99. {
  100. if (drs[i].Cells["PRINT_TP"].Value.ToString().Trim().Equals("Y".ToString()))
  101. {
  102. ultraGrid1.Rows[i].Appearance.BackColor = Color.FromArgb(192, 255, 192);
  103. }
  104. }
  105. //打印标签后颜色区分 20131017
  106. }
  107. catch (Exception EX)
  108. {
  109. MessageBox.Show(EX.ToString());
  110. }
  111. }
  112. private void DoSave() {
  113. try {
  114. string coilNo = string.Empty;
  115. string prog = string.Empty;
  116. switch (CustomInfo)
  117. {
  118. case "2":
  119. Hashtable paramHsmp = new Hashtable();
  120. this.ultraGrid1.UpdateData();
  121. string regID = this.UserInfo.GetUserID();
  122. if (regID == "")
  123. {
  124. System.Windows.Forms.MessageBox.Show("!");
  125. return;
  126. }
  127. Infragistics.Win.UltraWinGrid.RowsCollection rs = this.ultraGrid1.Rows;
  128. if (rs.Count > 0)
  129. {
  130. for (int i = 0; i < rs.Count; i++)
  131. {
  132. if (rs[i].Cells["CHK_Y"].Text.Trim() == "FALSE")
  133. {
  134. continue;
  135. }
  136. //else if (rs[i].Cells["CUR_PROG_CD"].Text.Trim() != "")
  137. //{
  138. // continue;
  139. //}
  140. else
  141. {
  142. paramHsmp = new Hashtable();
  143. coilNo = rs[i].Cells["COIL_NO"].Text.Trim();
  144. if (rs[i].Cells["CUR_PROG_CD"].Text.Trim().Equals("综合判定待机")) {
  145. prog="DED";
  146. }
  147. else if (rs[i].Cells["CUR_PROG_CD"].Text.Trim().Equals("重卷指示待机"))
  148. {
  149. prog = "DBA";
  150. }
  151. paramHsmp.Add("i1", coilNo);
  152. paramHsmp.Add("i2", prog);
  153. paramHsmp.Add("i3", regID);
  154. paramHsmp.Add("o4", "");
  155. CoreClientParam ccp = new CoreClientParam();
  156. ccp.ServerName = "UIB.COM.ComDBProcedure";
  157. ccp.MethodName = "doXmlProcedure";
  158. ccp.ServerParams = new Object[] { "UIL010020_01_CALL.CALL", paramHsmp };
  159. this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  160. //提示
  161. ArrayList all = ccp.ReturnObject as ArrayList;
  162. if (all[0].ToString() != "YY")//确认是否存在问题
  163. {
  164. MessageBox.Show(all[0].ToString(), "提示");
  165. return;
  166. }
  167. }
  168. }
  169. }
  170. this.DoQuery();
  171. break;
  172. }
  173. }
  174. catch (Exception Ey)
  175. {
  176. MessageBox.Show(Ey.ToString());
  177. }
  178. }
  179. private void DoExport()
  180. {
  181. try
  182. {
  183. if (this.saveFileDialog1.ShowDialog(this) == DialogResult.OK)
  184. {
  185. string fileName = this.saveFileDialog1.FileName;
  186. ultraGridExcelExporter1.Export(ultraGrid1, fileName);
  187. System.Diagnostics.Process.Start(fileName);
  188. }
  189. }
  190. catch (Exception EX)
  191. {
  192. MessageBox.Show(EX.ToString());
  193. }
  194. }
  195. private void DoPrint()
  196. {
  197. //酸轧功能条上的标签打印功能
  198. if (CustomInfo == "1" || CustomInfo == "4")
  199. {
  200. //若当前打印版本为3则改成配置文件版本号
  201. if (3 == printer.LableVersion)
  202. printer.LableVersion = int.Parse(iniVersions);
  203. printComFunc();
  204. }
  205. else //连退、重卷功能条上的打印功能,有特殊要求
  206. {
  207. printLTCOM();
  208. }
  209. }
  210. // 公共打印调用方法
  211. private void printComFunc()
  212. {
  213. try
  214. {
  215. ultraGrid1.UpdateData();
  216. //----20131018
  217. Hashtable param = new Hashtable();
  218. string line = string.Empty;
  219. string printid = this.UserInfo.GetUserID();
  220. string flag = string.Empty;
  221. foreach (Infragistics.Win.UltraWinGrid.UltraGridRow row in ultraGrid1.Rows)
  222. {
  223. if (Convert.ToBoolean(row.Cells["CHK"].Value))
  224. {
  225. //----20131018
  226. param = new Hashtable();
  227. ColdCoilLable coilLabel = new ColdCoilLable();
  228. coilLabel.rollNo = string.Empty;
  229. coilLabel.specification = row.Cells["SPEC_ABBSYM"].Value.ToString();
  230. coilLabel.steelGrade = row.Cells["SPEC_STL_GRD"].Value.ToString(); ;//SPEC_STL_GRD
  231. //if(Convert.ToBoolean(row.Cells["CHK_SIZE"].Value)){
  232. //coilLabel.dimension = row.Cells["COIL_SIZE"].Value.ToString();
  233. //}else{
  234. //coilLabel.dimension = row.Cells["ORD_SIZE"].Value.ToString();
  235. //}
  236. coilLabel.dimension = row.Cells["COIL_SIZE"].Value.ToString();
  237. coilLabel.coilNo = row.Cells["COIL_NO"].Value.ToString();
  238. coilLabel.weight = row.Cells["ACT_WGT"].Value.ToString();
  239. if (CustomInfo == "1")
  240. {
  241. coilLabel.heatNo = row.Cells["H_COIL_NO"].Value.ToString();
  242. }
  243. else
  244. {
  245. coilLabel.heatNo = row.Cells["HEAT_NO"].Value.ToString();
  246. }
  247. coilLabel.prodDate = row.Cells["MILL_DTIME"].Value.ToString();
  248. coilLabel.contractNo = row.Cells["ORD_NO"].Value.ToString();//ORD
  249. coilLabel.prodName = row.Cells["C_ORD_USE_TP"].Value.ToString();
  250. coilLabel.custName = row.Cells["ORDCUST_CD"].Value.ToString();
  251. coilLabel.licenseNo = string.Empty;
  252. coilLabel.licenseMark = string.Empty;
  253. coilLabel.checker = string.Empty;
  254. coilLabel.barcode = coilLabel.coilNo;
  255. if (row.Cells["PRINT_TP"].Text == "Y")
  256. {
  257. if (MessageBox.Show(row.Cells["COIL_NO"].Value.ToString() + "已打印,需要再次打印?",
  258. "提示", MessageBoxButtons.YesNo) == DialogResult.Yes)
  259. {
  260. switch (CustomInfo)
  261. {
  262. case "1":
  263. if (Convert.ToBoolean(row.Cells["CHK_SIZE"].Value))
  264. {
  265. coilLabel.dimension = row.Cells["COIL_SIZE"].Value.ToString();
  266. }
  267. else
  268. {
  269. coilLabel.dimension = row.Cells["ORD_SIZE"].Value.ToString();
  270. }
  271. coilLabel.steelGrade = row.Cells["SPEC_STL_GRD"].Value.ToString();
  272. coilLabel.labelHeadName = "FULL HARD COIL OF XINSTEEL";
  273. //coilLabel.contractNo = row.Cells["ORD_NO"].Value.ToString() + "-" + row.Cells["ORD_SEQ"].Value.ToString();
  274. // coilLabel.contractNo = string.Empty;
  275. line = "S";
  276. flag = "A";
  277. break;
  278. case "2":
  279. //printer.printLable(coilLabel);
  280. coilLabel.labelHeadName = "FULL HARD COIL OF XINSTEEL";
  281. line = "L";
  282. flag = "B";
  283. break;
  284. case "3":
  285. //coilLabel.dimension = string.Empty;
  286. coilLabel.labelHeadName = "FULL HARD COIL OF XINSTEEL";
  287. line = "C";
  288. flag = "D";
  289. break;
  290. case "4":
  291. if (Convert.ToBoolean(row.Cells["CHK_SIZE"].Value))
  292. {
  293. coilLabel.dimension = row.Cells["COIL_SIZE"].Value.ToString();
  294. }
  295. else
  296. {
  297. coilLabel.dimension = row.Cells["ORD_SIZE"].Value.ToString();
  298. }
  299. coilLabel.steelGrade = row.Cells["SPEC_STL_GRD"].Value.ToString();
  300. coilLabel.labelHeadName = "FULL HARD COIL OF XINSTEEL";
  301. //coilLabel.contractNo = row.Cells["ORD_NO"].Value.ToString() + "-" + row.Cells["ORD_SEQ"].Value.ToString();
  302. // coilLabel.contractNo = string.Empty;
  303. line = "S";
  304. flag = "A";
  305. break;
  306. }
  307. string coilno = row.Cells["COIL_NO"].Value.ToString();
  308. printer.printLable(coilLabel);
  309. UpdateColor(coilno, flag);
  310. //----20131018
  311. param.Add("i1", line);
  312. param.Add("i2", coilno);
  313. param.Add("i3", printid);
  314. param.Add("i4", "标签打印");
  315. param.Add("i5", "UIL010020");
  316. param.Add("i6", "打印后");
  317. param.Add("o7", "");
  318. PrintHistory(param);
  319. }
  320. }
  321. else if (row.Cells["PRINT_TP"].Text == "N")
  322. {
  323. switch (CustomInfo)
  324. {
  325. case "1":
  326. if (Convert.ToBoolean(row.Cells["CHK_SIZE"].Value))
  327. {
  328. coilLabel.dimension = row.Cells["COIL_SIZE"].Value.ToString();
  329. }
  330. else
  331. {
  332. coilLabel.dimension = row.Cells["ORD_SIZE"].Value.ToString();
  333. }
  334. coilLabel.steelGrade = row.Cells["SPEC_STL_GRD"].Value.ToString();
  335. coilLabel.labelHeadName = "FULL HARD COIL OF XINSTEEL";
  336. //coilLabel.contractNo = row.Cells["ORD_NO"].Value.ToString() + "-" + row.Cells["ORD_SEQ"].Value.ToString();
  337. //coilLabel.contractNo = string.Empty;
  338. line = "S";
  339. flag = "A";
  340. break;
  341. case "2":
  342. //printer.printLable(coilLabel);
  343. coilLabel.labelHeadName = "FULL HARD COIL OF XINSTEEL";
  344. line = "L";
  345. flag = "B";
  346. break;
  347. case "3":
  348. // coilLabel.dimension = string.Empty;
  349. coilLabel.labelHeadName = "FULL HARD COIL OF XINSTEEL";
  350. line = "C";
  351. flag = "D";
  352. break;
  353. case "4":
  354. if (Convert.ToBoolean(row.Cells["CHK_SIZE"].Value))
  355. {
  356. coilLabel.dimension = row.Cells["COIL_SIZE"].Value.ToString();
  357. }
  358. else
  359. {
  360. coilLabel.dimension = row.Cells["ORD_SIZE"].Value.ToString();
  361. }
  362. coilLabel.steelGrade = row.Cells["SPEC_STL_GRD"].Value.ToString();
  363. coilLabel.labelHeadName = "FULL HARD COIL OF XINSTEEL";
  364. //coilLabel.contractNo = row.Cells["ORD_NO"].Value.ToString() + "-" + row.Cells["ORD_SEQ"].Value.ToString();
  365. //coilLabel.contractNo = string.Empty;
  366. line = "S";
  367. flag = "A";
  368. break;
  369. }
  370. string coilno = row.Cells["COIL_NO"].Value.ToString();
  371. printer.printLable(coilLabel);
  372. UpdateColor(coilno, flag);
  373. //----20131018
  374. param.Add("i1", line);
  375. param.Add("i2", coilno);
  376. param.Add("i3", printid);
  377. param.Add("i4", "标签打印");
  378. param.Add("i5", "UIL010020");
  379. param.Add("i6", "打印后");
  380. param.Add("o7", "");
  381. PrintHistory(param);
  382. }
  383. }
  384. }
  385. this.DoQuery();
  386. }
  387. catch (Exception EX)
  388. {
  389. MessageBox.Show("打印异常:连接打印机失败,请点击\"打印\"按钮重新打印!");
  390. }
  391. }
  392. private void UpdateColor(string coilno,string flag) {
  393. CoreClientParam ccp1 = new CoreClientParam();
  394. ccp1.ServerName = "UIL.UIL01.UIL010020";
  395. ccp1.MethodName = "dateColor";
  396. ccp1.ServerParams = new object[] { coilno ,flag};
  397. ccp1.SourceDataTable = this.dataSet1.Tables[0];
  398. this.ExecuteQueryToDataTable(ccp1, CoreInvokeType.Internal);
  399. }
  400. //标签打印记录增加
  401. private void PrintHistory(Hashtable param)
  402. {
  403. CoreClientParam ccp4 = new CoreClientParam();
  404. ccp4.ServerName = "UIB.COM.ComDBProcedure";
  405. ccp4.MethodName = "doXmlProcedure";
  406. ccp4.ServerParams = new Object[] { "UIL010020_02_CALL.CALL", param };
  407. this.ExecuteNonQuery(ccp4, CoreInvokeType.Internal);
  408. //提示
  409. ArrayList all = ccp4.ReturnObject as ArrayList;
  410. if (all[0].ToString() != "YY")//确认是否存在问题
  411. {
  412. MessageBox.Show(all[0].ToString(), "提示");
  413. return;
  414. }
  415. }
  416. /***
  417. * 配置文件CoreFS.ini中内容
  418. #标签打印机地址
  419. [LABPRINTERADDR]
  420. #酸轧出口
  421. #1=10.10.76.211
  422. #连退出口
  423. #2=10.10.76.210
  424. #重卷出口
  425. #3=10.10.76.206
  426. #包装
  427. #4=10.10.76.209
  428. #成品发运
  429. #5=10.10.76.207
  430. #版本号
  431. Version=2
  432. */
  433. //初始化加载版本号,打印ip地址
  434. private void UIL010020_Load(object sender, EventArgs e)
  435. {
  436. try
  437. {
  438. string Current = Directory.GetCurrentDirectory();//获取当前根目录
  439. Ini ini = new Ini(Current + "/CoreFS.ini");
  440. // 读取ini
  441. string labPrinterAddr;//= ini.ReadValue("LABPRINTERADDR", CustomInfo);
  442. if (CustomInfo == "4")
  443. {
  444. labPrinterAddr = ini.ReadValue("LABPRINTERADDR", "7");//酸洗线界面ID为4,由于配置文件4被占用 更换为第7个IP
  445. }
  446. else
  447. {
  448. labPrinterAddr = ini.ReadValue("LABPRINTERADDR", CustomInfo);
  449. }
  450. if (labPrinterAddr == "") labPrinterAddr = "172.16.50.210";//测试代码
  451. printer.Addr = labPrinterAddr;
  452. iniVersions = ini.ReadValue("LABPRINTERADDR", "Version");
  453. iniVersions = "4";//测试代码
  454. if (CustomInfo == "1"||CustomInfo == "4")
  455. {
  456. liantuiPrint_button.Visible = false;
  457. iniVersions = "3";//测试代码 ;//酸扎界面采用版本2 20170525
  458. }
  459. printer.LableVersion = int.Parse(iniVersions);
  460. //MessageBox.Show(labPrinterAddr);
  461. }
  462. catch (Exception ej)
  463. {
  464. System.Diagnostics.Debug.WriteLine(ej.ToString());
  465. }
  466. }
  467. private void ultraButton1_Click(object sender, EventArgs e)
  468. {
  469. try
  470. {
  471. string directoryPath = "C:\\Temp\\ZBS\\";
  472. int indexFlag = 0;
  473. foreach (UltraGridRow ugr in this.ultraGrid1.Rows)
  474. {
  475. if (Convert.ToBoolean(ugr.Cells["CHK"].Text))
  476. {
  477. indexFlag++;
  478. CoreClientParam ccp = new CoreClientParam();
  479. ccp.ServerName = "UIB.UIB03.TestPrint";
  480. ccp.MethodName = "print";
  481. ccp.ServerParams = new object[] { "G00001", ugr.Cells["COIL_NO"].Text };
  482. CoreClientParam cx = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  483. byte[] byData = (byte[])cx.ReturnObject;
  484. System.DateTime dt = System.DateTime.Now;
  485. string TimeNow = string.Format("{0:yyyyMMddHHmmssffff}", dt);
  486. string sFile = directoryPath + "ABC" + ".xls";
  487. FileStream fs = new FileStream(sFile, FileMode.OpenOrCreate, FileAccess.Write);
  488. fs.Write(byData, 0, byData.Length);
  489. fs.Close();
  490. Microsoft.Office.Interop.Excel.Application app = new Microsoft.Office.Interop.Excel.Application();
  491. Microsoft.Office.Interop.Excel.Workbook workbook = app.Application.Workbooks.Add(sFile);
  492. Microsoft.Office.Interop.Excel._Worksheet ws = (Microsoft.Office.Interop.Excel._Worksheet)workbook.Worksheets[1];
  493. ws.PrintOut(1, 1, 1, false, Missing.Value, false, false, Missing.Value);//"HP LaserJet P1505"
  494. workbook.Saved = true;
  495. workbook.Close(Missing.Value, Missing.Value, Missing.Value);
  496. app.Quit();
  497. System.Runtime.InteropServices.Marshal.ReleaseComObject(ws);
  498. System.Runtime.InteropServices.Marshal.ReleaseComObject(app);
  499. app = null;
  500. GC.Collect();
  501. }
  502. }
  503. }
  504. catch (Exception ex)
  505. {
  506. System.Diagnostics.Debug.WriteLine(ex.ToString());
  507. }
  508. }
  509. //酸轧标签打印第三个版本,纸张纵向,数据横向
  510. private void ultraButton_print3_Click(object sender, EventArgs e)
  511. {
  512. printer.LableVersion = 3;
  513. printComFunc();
  514. }
  515. //连退标签打印功能
  516. private void liantuiPrint_button_Click(object sender, EventArgs e)
  517. {
  518. printLTCOM();
  519. }
  520. //连退标签打印功能
  521. private void printLTCOM()
  522. {
  523. //printer.LableVersion = 3;
  524. try
  525. {
  526. ultraGrid1.UpdateData();
  527. //----20131018
  528. Hashtable param = new Hashtable();
  529. string line = string.Empty;
  530. string printid = this.UserInfo.GetUserID();
  531. string flag = string.Empty;
  532. foreach (Infragistics.Win.UltraWinGrid.UltraGridRow row in ultraGrid1.Rows)
  533. {
  534. if (Convert.ToBoolean(row.Cells["CHK"].Value))
  535. {
  536. //----20131018
  537. param = new Hashtable();
  538. ColdCoilLable coilLabel = new ColdCoilLable();
  539. coilLabel.rollNo = string.Empty;
  540. coilLabel.specification = row.Cells["SPEC_ABBSYM"].Value.ToString();
  541. coilLabel.steelGrade = row.Cells["SPEC_STL_GRD"].Value.ToString(); ;//SPEC_STL_GRD
  542. coilLabel.dimension = row.Cells["COIL_SIZE"].Value.ToString();
  543. coilLabel.coilNo = row.Cells["COIL_NO"].Value.ToString();
  544. coilLabel.weight = row.Cells["ACT_WGT"].Value.ToString();
  545. coilLabel.heatNo = row.Cells["HEAT_NO"].Value.ToString();
  546. coilLabel.prodDate = row.Cells["MILL_DTIME"].Value.ToString();
  547. coilLabel.contractNo = row.Cells["ORD_NO"].Value.ToString();//ORD
  548. coilLabel.prodName = row.Cells["C_ORD_USE_TP"].Value.ToString();
  549. coilLabel.custName = row.Cells["ORDCUST_CD"].Value.ToString();
  550. coilLabel.licenseNo = string.Empty;
  551. coilLabel.licenseMark = string.Empty;
  552. coilLabel.checker = string.Empty;
  553. coilLabel.barcode = coilLabel.coilNo;
  554. if (row.Cells["PRINT_TP"].Text == "Y")
  555. {
  556. if (MessageBox.Show(row.Cells["COIL_NO"].Value.ToString() + "已打印,需要再次打印?",
  557. "提示", MessageBoxButtons.YesNo) == DialogResult.Yes)
  558. {
  559. switch (CustomInfo)
  560. {
  561. case "1":
  562. if (Convert.ToBoolean(row.Cells["CHK_SIZE"].Value))
  563. {
  564. coilLabel.dimension = row.Cells["COIL_SIZE"].Value.ToString();
  565. }
  566. else
  567. {
  568. coilLabel.dimension = row.Cells["ORD_SIZE"].Value.ToString();
  569. }
  570. coilLabel.steelGrade = row.Cells["SPEC_STL_GRD"].Value.ToString();
  571. coilLabel.labelHeadName = "ANNEALED COIL OF XINSTEEL";
  572. //coilLabel.contractNo = row.Cells["ORD_NO"].Value.ToString() + "-" + row.Cells["ORD_SEQ"].Value.ToString();
  573. // coilLabel.contractNo = string.Empty;
  574. line = "S";
  575. flag = "A";
  576. break;
  577. case "2":
  578. //printer.printLable(coilLabel);
  579. coilLabel.labelHeadName = "ANNEALED COIL OF XINSTEEL";
  580. line = "L";
  581. flag = "B";
  582. break;
  583. case "3":
  584. //coilLabel.dimension = string.Empty;
  585. coilLabel.labelHeadName = "ANNEALED COIL OF XINSTEEL";
  586. line = "C";
  587. flag = "D";
  588. break;
  589. }
  590. string coilno = row.Cells["COIL_NO"].Value.ToString();
  591. printer.printLable(coilLabel);
  592. UpdateColor(coilno, flag);
  593. //----20131018
  594. param.Add("i1", line);
  595. param.Add("i2", coilno);
  596. param.Add("i3", printid);
  597. param.Add("i4", "标签打印");
  598. param.Add("i5", "UIL010020");
  599. param.Add("i6", "打印后");
  600. param.Add("o7", "");
  601. PrintHistory(param);
  602. }
  603. }
  604. else if (row.Cells["PRINT_TP"].Text == "N")
  605. {
  606. switch (CustomInfo)
  607. {
  608. case "1":
  609. if (Convert.ToBoolean(row.Cells["CHK_SIZE"].Value))
  610. {
  611. coilLabel.dimension = row.Cells["COIL_SIZE"].Value.ToString();
  612. }
  613. else
  614. {
  615. coilLabel.dimension = row.Cells["ORD_SIZE"].Value.ToString();
  616. }
  617. coilLabel.steelGrade = row.Cells["SPEC_STL_GRD"].Value.ToString();
  618. coilLabel.labelHeadName = "ANNEALED COIL OF XINSTEEL";
  619. //coilLabel.contractNo = row.Cells["ORD_NO"].Value.ToString() + "-" + row.Cells["ORD_SEQ"].Value.ToString();
  620. //coilLabel.contractNo = string.Empty;
  621. line = "S";
  622. flag = "A";
  623. break;
  624. case "2":
  625. //printer.printLable(coilLabel);
  626. coilLabel.labelHeadName = "ANNEALED COIL OF XINSTEEL";
  627. line = "L";
  628. flag = "B";
  629. break;
  630. case "3":
  631. // coilLabel.dimension = string.Empty;
  632. coilLabel.labelHeadName = "ANNEALED COIL OF XINSTEEL";
  633. line = "C";
  634. flag = "D";
  635. break;
  636. }
  637. string coilno = row.Cells["COIL_NO"].Value.ToString();
  638. printer.printLable(coilLabel);
  639. UpdateColor(coilno, flag);
  640. //----20131018
  641. param.Add("i1", line);
  642. param.Add("i2", coilno);
  643. param.Add("i3", printid);
  644. param.Add("i4", "标签打印");
  645. param.Add("i5", "UIL010020");
  646. param.Add("i6", "打印后");
  647. param.Add("o7", "");
  648. PrintHistory(param);
  649. }
  650. }
  651. }
  652. this.DoQuery();
  653. }
  654. catch (Exception EX)
  655. {
  656. MessageBox.Show("打印异常:连接打印机失败,请点击\"打印\"按钮重新打印!");
  657. }
  658. }
  659. private void ultraCheckEditor1_CheckedChanged(object sender, EventArgs e)
  660. {
  661. if (this.ultraCheckEditor1.Checked == true)
  662. {
  663. this.liantuiPrint_button.Enabled = true;
  664. this.ultraButton_print3.Enabled = true;
  665. }
  666. if (this.ultraCheckEditor1.Checked == false)
  667. {
  668. this.liantuiPrint_button.Enabled = false;
  669. this.ultraButton_print3.Enabled = false;
  670. }
  671. }
  672. }
  673. }