UIL020020.cs 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  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 System.Collections;
  10. using PrintSolution.LabelPrinter;
  11. using CoreFS.CA06;
  12. using Infragistics.Win.UltraWinGrid;
  13. using INI;
  14. namespace Core.LZMes.Client.UIL.UIL02
  15. {
  16. public partial class UIL020020 : FrmBase
  17. {
  18. private ZebraPrinter printer = new ZebraPrinter();
  19. private string iniVersions = "5"; //初始化从配置文件中加载的打印版本号
  20. public UIL020020()
  21. {
  22. InitializeComponent();
  23. }
  24. System.Data.DataSet Del_Weight_Data = new DataSet();
  25. private void Form2_Load(object sender, EventArgs e)
  26. {
  27. /* printer.Addr = "172.16.50.210";
  28. printer.LableVersion = 5;*/
  29. string Current = System.IO.Directory.GetCurrentDirectory();//获取当前根目录
  30. Ini ini = new Ini(Current + "/CoreFS.ini");
  31. // 读取ini
  32. string labPrinterAddr = ini.ReadValue("LABPRINTERADDR", "6");
  33. //labPrinterAddr = "172.16.50.200";//测试代码20161014
  34. printer.Addr = labPrinterAddr;
  35. //string version = ini.ReadValue("LABPRINTERADDR", "Version");
  36. string version = "5";
  37. printer.LableVersion = int.Parse(version);
  38. }
  39. public override void ToolBar_Click(object sender, string ToolbarKey)
  40. {
  41. switch (ToolbarKey)
  42. {
  43. case "Query":
  44. this.DoQuery();
  45. break;
  46. case "Print":
  47. this.DoPrint();
  48. break;
  49. }
  50. }
  51. public void DoQuery()
  52. {
  53. this.dataSet2.Tables[0].Clear();
  54. string dilv_dirno = textBox3.Text.Trim();
  55. if ("".Equals(dilv_dirno))
  56. {
  57. MessageBox.Show("请输入发货指示号查询!", "提示");
  58. return;
  59. }
  60. ArrayList al = new ArrayList();
  61. al.Add("UIL020020_1.SELECT");
  62. al.Add(dilv_dirno);
  63. CoreClientParam ccp1 = new CoreClientParam();
  64. ccp1.ServerName = "UIB.COM.ComDBQuery";
  65. ccp1.MethodName = "doSimpleQuery";
  66. ccp1.ServerParams = new object[] { al };
  67. ccp1.SourceDataTable = this.dataSet2.Tables[0];
  68. this.ExecuteQueryToDataTable(ccp1, CoreInvokeType.Internal);
  69. }
  70. private void DoPrint()
  71. {
  72. try
  73. {
  74. if (dataSet2 != null && dataSet2.Tables.Count > 0 && dataSet2.Tables[0].Rows.Count > 0)
  75. {
  76. Del_Weight_Data = dataSet2;//Weight_Data.Clone();
  77. foreach (System.Data.DataRow row in dataSet2.Tables[0].Rows)
  78. {
  79. //string sql = "SELECT COILIDLZ FROM L2_CALTHKDATA WHERE COILIDLZ='" + FixDBManager.CheckNullStr(row["COILIDLZ"]) + "'";
  80. // param = new Hashtable();
  81. ColdCoilLable coilLabel = new ColdCoilLable();
  82. coilLabel.rollNo = string.Empty;
  83. coilLabel.specification = FixDBManager.CheckNullStr(row["SPEC_ABBSYM"]);
  84. coilLabel.steelGrade = FixDBManager.CheckNullStr(row["STL_GRD"]); ;//SPEC_STL_GRD
  85. coilLabel.dimension = FixDBManager.CheckNullStr(row["T_K"]);
  86. coilLabel.coilNo = FixDBManager.CheckNullStr(row["OLD_SAMPL_NO"]);
  87. coilLabel.weight = FixDBManager.CheckNullStr(row["ACT_WGT"]);
  88. coilLabel.heatNo = FixDBManager.CheckNullStr(row["CHARGE_NO"]);
  89. coilLabel.prodDate = FixDBManager.CheckNullStr(row["MILL_DTIME"]);
  90. coilLabel.contractNo = FixDBManager.CheckNullStr(row["ORD_NO"]);//ORD
  91. coilLabel.prodName = FixDBManager.CheckNullStr(row["ORD_USE_TP"]);
  92. coilLabel.custName = FixDBManager.CheckNullStr(row["ORDCUST_CD"]);
  93. coilLabel.licenseNo = string.Empty;
  94. coilLabel.licenseMark = string.Empty;
  95. //coilLabel.checker = string.Empty;
  96. coilLabel.checker = FixDBManager.CheckNullStr(row["FAC_STL_GRD"]);//销售备注
  97. coilLabel.barcode = coilLabel.coilNo;
  98. printer.printLable(coilLabel);//PRINTING
  99. printer.printLable(coilLabel);//PRINTING
  100. }
  101. }
  102. }
  103. catch (System.Exception ex)
  104. {
  105. System.Diagnostics.EventLog.WriteEntry(Weight_DBManager.LogName + "-热轧", "拷贝酸轧二级接口数据失败:" + ex.ToString(), System.Diagnostics.EventLogEntryType.Error);
  106. }
  107. }
  108. }
  109. }