| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255 |
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Windows.Forms;
- using CoreFS.CA06;
- using PrintSolution.LabelPrinter;
- using INI;
- using System.IO;
- using System.Collections;
- namespace Core.LZMes.Client.UIM.UIM02
- {
- public partial class UIM020100 : FrmBase
- {
- private ZebraPrinter printer = new ZebraPrinter();
- public UIM020100()
- {
- InitializeComponent();
- }
- private void UIM020100_Load(object sender, EventArgs e)
- {
- try
- {
- string Current = Directory.GetCurrentDirectory();//获取当前根目录
- Ini ini = new Ini(Current + "/CoreFS.ini");
- // 读取ini
- string labPrinterAddr = ini.ReadValue("LABPRINTERADDR", "5");
- printer.Addr = labPrinterAddr;
- string version = ini.ReadValue("LABPRINTERADDR", "Version");
- printer.LableVersion = int.Parse(version);
- //MessageBox.Show(labPrinterAddr);
- }
- catch (Exception ej)
- {
- System.Diagnostics.Debug.WriteLine(ej.ToString());
- }
- }
- public override void ToolBar_Click(object sender, string ToolbarKey)
- {
- switch (ToolbarKey)
- {
- case "Query":
- this.DoQuery();
- break;
- //case "Export":
- // this.DoExport();
- // break;
- case "Print":
- this.DoPrint();
- break;
- }
- }
- //
- public void DoQuery() {
- try {
- this.dataSet1.Tables[0].Clear();
- string startTime = this.ultraDateTimeEditor1.Value != null ? this.ultraDateTimeEditor1.DateTime.ToString("yyyyMMdd") : "";//入库开始时间
- string entTime = this.ultraDateTimeEditor2.Value != null ? this.ultraDateTimeEditor2.DateTime.ToString("yyyyMMdd") : "";//入库结束时间
- string driveNum = this.ultraTextEditor1.Text.Trim();
- string ord = this.ultraTextEditor2.Text.Trim();
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "UIM.UIM02.UIM020100";
- ccp.MethodName = "queryCoil";
- ccp.ServerParams = new object[] { startTime, entTime, driveNum, ord };
- ccp.SourceDataTable = this.dataSet1.Tables[0];
- this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
- //DataRowCollection drs = dataSet1.Tables[0].Rows;
- //for (int i = 0; i < drs.Count; i++)
- //{
- // if (drs[i]["PRINT_TP"].ToString().Equals("Y"))
- // {
- // if (!drs[i]["ORG_ORD_NO"].ToString().Equals(drs[i]["ORD_NO"].ToString())
- // && !drs[i]["ORG_ORD_SEQ"].ToString().Equals(drs[i]["ORD_SEQ"].ToString()))
- // ultraGrid1.Rows[i].Appearance.BackColor = Color.FromArgb(192, 255, 192);
- // }
- //}
-
- }catch(Exception e){
- System.Diagnostics.Debug.WriteLine(e.ToString());
- }
- }
- public void DoPrint() {
- try
- {
- ultraGrid1.UpdateData();
- Hashtable param = new Hashtable();
- string printid = this.UserInfo.GetUserID();
- foreach (Infragistics.Win.UltraWinGrid.UltraGridRow row in ultraGrid1.Rows)
- {
- if (Convert.ToBoolean(row.Cells["CHK"].Value))
- {
- param = new Hashtable();
- ColdCoilLable coilLabel = new ColdCoilLable();
- coilLabel.rollNo = row.Cells["OLD_SAMPL_NO"].Value.ToString().Substring(0, 9); //string.Empty;
- coilLabel.specification = row.Cells["SPEC_ABBSYM"].Text;
- coilLabel.steelGrade = row.Cells["SPEC_STL_GRD"].Text;
- coilLabel.dimension = row.Cells["INSTR_COIL_THK"].Text + "*" + row.Cells["INSTR_COIL_WTH"].Text;
- coilLabel.coilNo = row.Cells["OLD_SAMPL_NO"].Text;
- coilLabel.weight = row.Cells["ACT_WGT"].Text;
- coilLabel.heatNo = row.Cells["CHARGE_NO"].Text;
- coilLabel.prodDate = row.Cells["MILL_DTIME"].Text;
- coilLabel.contractNo = string.Empty;
- coilLabel.licenseNo = string.Empty;
- coilLabel.licenseMark = string.Empty;
- coilLabel.checker = string.Empty;
- coilLabel.barcode = coilLabel.coilNo;
- if (row.Cells["PRINT_TP"].Text == "Y")
- {
- if (MessageBox.Show(row.Cells["OLD_SAMPL_NO"].Value.ToString() + "已打印,需要再次打印?",
- "提示", MessageBoxButtons.YesNo) == DialogResult.Yes)
- {
- string coilno =row.Cells["OLD_SAMPL_NO"].Text;
- printer.printLable(coilLabel);
- //20140507
- printer.printLable(coilLabel);
- UpdateColor(coilno, "B");
- param.Add("i1", "L");
- param.Add("i2", coilno);
- param.Add("i3", printid);
- param.Add("i4", "标签打印");
- param.Add("i5", "UIM020100");
- param.Add("i6", "打印后");
- param.Add("o7", "");
- PrintHistory(param);
- }
- }
- else if (row.Cells["PRINT_TP"].Text == "N")
- {
- string coilno = row.Cells["OLD_SAMPL_NO"].Text;
- printer.printLable(coilLabel);
- //20140507
- printer.printLable(coilLabel);
- UpdateColor(coilno,"B");
- param.Add("i1","L");
- param.Add("i2", coilno);
- param.Add("i3", printid);
- param.Add("i4", "标签打印");
- param.Add("i5", "UIM020100");
- param.Add("i6", "打印后");
- param.Add("o7", "");
- PrintHistory(param);
- }
- }
- }
- this.DoQuery();
- }
- catch (Exception EX)
- {
- MessageBox.Show("连接打印机失败,请点击\"打印\"按钮重新打印!");
- }
-
- }
- private void UpdateColor(string coilno,string flag) {
-
- CoreClientParam ccp1 = new CoreClientParam();
- ccp1.ServerName = "UIL.UIL01.UIL010020";
- ccp1.MethodName = "dateColor";
- ccp1.ServerParams = new object[] { coilno ,flag};
- ccp1.SourceDataTable = this.dataSet1.Tables[0];
- this.ExecuteQueryToDataTable(ccp1, CoreInvokeType.Internal);
-
- }
- //标签打印记录增加
- private void PrintHistory(Hashtable param)
- {
- CoreClientParam ccp4 = new CoreClientParam();
- ccp4.ServerName = "UIB.COM.ComDBProcedure";
- ccp4.MethodName = "doXmlProcedure";
- ccp4.ServerParams = new Object[] { "UIL010020_02_CALL.CALL", param };
- this.ExecuteNonQuery(ccp4, CoreInvokeType.Internal);
- //提示
- ArrayList all = ccp4.ReturnObject as ArrayList;
- if (all[0].ToString() != "YY")//确认是否存在问题
- {
- MessageBox.Show(all[0].ToString(), "提示");
- return;
- }
- }
- private void ultraGrid1_CellChange(object sender, Infragistics.Win.UltraWinGrid.CellEventArgs e)
- {
- try
- {
- if (e.Cell.Column.Key == "CHK")
- {
- e.Cell.Row.Update();
- if (e.Cell.Value.ToString().ToUpper() == "TRUE")
- {
- string vDLIV_DIRNO = e.Cell.Row.Cells["DLIV_DIRNO"].Text;
- Infragistics.Win.UltraWinGrid.RowsCollection rs = this.ultraGrid1.Rows;
- for (int i = 0; i < rs.Count; i++)
- {
- if (rs[i].Cells["DLIV_DIRNO"].Text == vDLIV_DIRNO)
- {
- rs[i].Cells["CHK"].Value = true;
- }
- else
- {
- rs[i].Cells["CHK"].Value = false;
- }
- }
- }
- else
- {
- string vDLIV_DIRNO = e.Cell.Row.Cells["DLIV_DIRNO"].Text;
- Infragistics.Win.UltraWinGrid.RowsCollection rs = this.ultraGrid1.Rows;
- for (int i = 0; i < rs.Count; i++)
- {
- if (rs[i].Cells["DLIV_DIRNO"].Text == vDLIV_DIRNO)
- {
- rs[i].Cells["CHK"].Value = false;
- }
- }
- }
- }
- }
- catch (Exception ex)
- {
- System.Diagnostics.Debug.WriteLine(ex.ToString());
- }
- }
-
-
-
-
- }
- }
|