From 6e71de6ca74c80e0191624fcce64d05551e2655c Mon Sep 17 00:00:00 2001 From: zhouhongjun <565221961@qq.com> Date: Fri, 20 Jun 2025 10:06:55 +0800 Subject: [PATCH] =?UTF-8?q?2411=E5=92=8C2408=E5=A2=9E=E5=8A=A0=E8=A1=A5?= =?UTF-8?q?=E6=89=93=E7=99=BB=E5=BD=95=E9=AA=8C=E8=AF=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- InjectionPC/FrmMain2408.cs | 418 ++++++++++++++++++++++++++----------- InjectionPC/FrmMain2411.cs | 417 +++++++++++++++++++++++++----------- 2 files changed, 600 insertions(+), 235 deletions(-) diff --git a/InjectionPC/FrmMain2408.cs b/InjectionPC/FrmMain2408.cs index f14e60b..a88526c 100644 --- a/InjectionPC/FrmMain2408.cs +++ b/InjectionPC/FrmMain2408.cs @@ -30,6 +30,7 @@ using System.Net.NetworkInformation; using gregn6Lib; using MESClassLibrary; using MESClassLibrary.EFModel; +using System.Runtime.InteropServices.ComTypes; namespace InjectionPC { @@ -2404,12 +2405,12 @@ namespace InjectionPC /// private void label22_Click(object sender, EventArgs e) { - string code = "", filename = "", printName = "", ManufacturerName=""; - string IsSupply = "0"; - BarCodeModel md = new BarCodeModel(); - BarCodeBLL bll = new BarCodeBLL(); - ProductBLL pbll = new ProductBLL(); - PlasticBLL plbll = _plasticBLL; + //string code = "", filename = "", printName = "", ManufacturerName=""; + //string IsSupply = "0"; + //BarCodeModel md = new BarCodeModel(); + //BarCodeBLL bll = new BarCodeBLL(); + //ProductBLL pbll = new ProductBLL(); + //PlasticBLL plbll = _plasticBLL; try { if (glacialList1.SelectedItems.Count == 0) @@ -2419,125 +2420,132 @@ namespace InjectionPC } else { - GlacialComponents.Controls.GLItem gv; - gv = glacialList1.SelectedItems[0] as GlacialComponents.Controls.GLItem; - code = gv.Text; - DialogResult result = MessageBox.Show($"补打条码[{code}]将被新的替换,确定补打条码?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Information); - if (result == DialogResult.OK) - { - - bool exsitWms = _wmsBll.IsReadBarCodeInWms(code); - if (exsitWms) - { - MessageBox.Show($"条码[{code}]在WMS系统已处理,无法补打!"); - return; - } - - DataTable dt = bll.SearchInfoByBarCodeNew(code, Program.tableName); - if (dt == null || dt.Rows.Count == 0) - { - MessageBox.Show($"补打失败,条码[{code}]在表[{ Program.tableName}]中不存在!"); - return; - } - - - md.ID = Guid.NewGuid().ToString(); - //md.BarCode = code; - md.StationID = dt.Rows[0]["StationID"].ToString(); - md.StockNo = dt.Rows[0]["StockNo"].ToString(); - md.PartNo = dt.Rows[0]["PartNo"].ToString(); - md.BatchNo = dt.Rows[0]["BatchNo"].ToString(); - string newOneCode = string.Empty; - string newBarCode = string.Empty; - GetBarCode(md.StockNo, md.BatchNo, md.PartNo, ref newOneCode, ref newBarCode); - md.OneBarCode = newOneCode; - md.BarCode = newBarCode; - md.BoxNo = dt.Rows[0]["BoxNo"].ToString(); - if (gv.SubItems.Count > 1) - { - md.Des1 = gv.SubItems[1].Text; - } - - md.PrintType = 2; - - //DataTable pdt = pbll.SearchIsImportByPartNo(md.PartNo); - - DataTable pdt = pbll.SearchInfoByPartNo(md.PartNo); - if (pdt != null && pdt.Rows.Count > 0) - { - if (pdt.Rows[0]["isImport"].ToString() == "1") - { - md.Import = "国产料Kingfa"; - } - else - { - md.Import = ""; - } - - ManufacturerName = pdt.Rows[0]["ManufacturerName"].ToString().Trim(); - IsSupply = pdt.Rows[0]["IsSupply"].ToString(); - } - - md.AddMan = _currentUserName; - //补打条码 - string msg = bll.ReprintSave(md, Program.tableName, dt.Rows[0]["OneBarCode"].ToString(), dt.Rows[0]["BarCode"].ToString(), Program.station,"3"); - if (!string.IsNullOrEmpty(msg)) - { - MessageBox.Show($"补打失败,原因:" + msg); - return; - } - //if (bll.Add_Info_New(md, Program.tableName) == false) - //{ - // return; - //} - glacialList1.SelectedItems.Clear(); - initBarCode(); + _login = new FrmLogin(); + _login.RegisterLoginMethod(LoginReprint); + _login.ShowDialog(); - #region 打印条码 - //filename = System.AppDomain.CurrentDomain.BaseDirectory + "单个条码.grf"; - filename = ManufacturerName.Contains("蔚来") - ? AppDomain.CurrentDomain.BaseDirectory + - "wl.grf" - : AppDomain.CurrentDomain.BaseDirectory + - PrintMoudleName(IsSupply, "Print" + Program.station + "_3102"); //new - if (md.PartNo.Contains("A2146982300") || - md.PartNo.Contains("A2146982400")) - { - filename = AppDomain.CurrentDomain.BaseDirectory + - "Sill.grf"; - } - string partName = ""; - DataTable dt2 = pbll.SearchInfoByPartNo(md.PartNo); - if (dt2 != null && dt2.Rows.Count > 0) - { - partName = dt2.Rows[0]["ProductName"].ToString(); - } - else - { - partName = ""; - } + //GlacialComponents.Controls.GLItem gv; + //gv = glacialList1.SelectedItems[0] as GlacialComponents.Controls.GLItem; + //code = gv.Text; + //DialogResult result = MessageBox.Show($"补打条码[{code}]将被新的替换,确定补打条码?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Information); + //if (result == DialogResult.OK) + //{ - //DataTable dt4 = plbll.SearchInfo(md.PartNo, md.StationID); - //if (dt4 != null && dt4.Rows.Count > 0) - //{ - // printName = "Printer" + dt4.Rows[0]["PrinterNo"].ToString(); - //} - printName = "Printer" + _printNameDict[md.PartNo + md.StationID]; + // bool exsitWms = _wmsBll.IsReadBarCodeInWms(code); + // if (exsitWms) + // { + // MessageBox.Show($"条码[{code}]在WMS系统已处理,无法补打!"); + // return; + // } + + // DataTable dt = bll.SearchInfoByBarCodeNew(code, Program.tableName); + // if (dt == null || dt.Rows.Count == 0) + // { + // MessageBox.Show($"补打失败,条码[{code}]在表[{ Program.tableName}]中不存在!"); + // return; + // } + + + // md.ID = Guid.NewGuid().ToString(); + // //md.BarCode = code; + // md.StationID = dt.Rows[0]["StationID"].ToString(); + // md.StockNo = dt.Rows[0]["StockNo"].ToString(); + // md.PartNo = dt.Rows[0]["PartNo"].ToString(); + // md.BatchNo = dt.Rows[0]["BatchNo"].ToString(); + // string newOneCode = string.Empty; + // string newBarCode = string.Empty; + // GetBarCode(md.StockNo, md.BatchNo, md.PartNo, ref newOneCode, ref newBarCode); + // md.OneBarCode = newOneCode; + // md.BarCode = newBarCode; + // md.BoxNo = dt.Rows[0]["BoxNo"].ToString(); + // if (gv.SubItems.Count > 1) + // { + // md.Des1 = gv.SubItems[1].Text; + // } + + // md.PrintType = 2; + + // //DataTable pdt = pbll.SearchIsImportByPartNo(md.PartNo); + + // DataTable pdt = pbll.SearchInfoByPartNo(md.PartNo); + // if (pdt != null && pdt.Rows.Count > 0) + // { + // if (pdt.Rows[0]["isImport"].ToString() == "1") + // { + // md.Import = "国产料Kingfa"; + // } + // else + // { + // md.Import = ""; + // } + + // ManufacturerName = pdt.Rows[0]["ManufacturerName"].ToString().Trim(); + // IsSupply = pdt.Rows[0]["IsSupply"].ToString(); + // } + + // md.AddMan = _currentUserName; + // //补打条码 + // string msg = bll.ReprintSave(md, Program.tableName, dt.Rows[0]["OneBarCode"].ToString(), dt.Rows[0]["BarCode"].ToString(), Program.station,"3"); + // if (!string.IsNullOrEmpty(msg)) + // { + // MessageBox.Show($"补打失败,原因:" + msg); + // return; + // } + // //if (bll.Add_Info_New(md, Program.tableName) == false) + // //{ + // // return; + // //} + // glacialList1.SelectedItems.Clear(); + // initBarCode(); + + // #region 打印条码 + + // //filename = System.AppDomain.CurrentDomain.BaseDirectory + "单个条码.grf"; + // filename = ManufacturerName.Contains("蔚来") + // ? AppDomain.CurrentDomain.BaseDirectory + + // "wl.grf" + // : AppDomain.CurrentDomain.BaseDirectory + + // PrintMoudleName(IsSupply, "Print" + Program.station + "_3102"); //new + // if (md.PartNo.Contains("A2146982300") || + // md.PartNo.Contains("A2146982400")) + // { + // filename = AppDomain.CurrentDomain.BaseDirectory + + // "Sill.grf"; + // } + + // string partName = ""; + // DataTable dt2 = pbll.SearchInfoByPartNo(md.PartNo); + // if (dt2 != null && dt2.Rows.Count > 0) + // { + // partName = dt2.Rows[0]["ProductName"].ToString(); + // } + // else + // { + // partName = ""; + // } + + + // //DataTable dt4 = plbll.SearchInfo(md.PartNo, md.StationID); + // //if (dt4 != null && dt4.Rows.Count > 0) + // //{ + // // printName = "Printer" + dt4.Rows[0]["PrinterNo"].ToString(); + // //} + // printName = "Printer" + _printNameDict[md.PartNo + md.StationID]; - string reportName = ConfigurationManager.AppSettings[printName].ToString(); - DataTable headTable = GetPrintHeadTable(md.PartNo, partName, md.OneBarCode, md.BarCode); + // string reportName = ConfigurationManager.AppSettings[printName].ToString(); + // DataTable headTable = GetPrintHeadTable(md.PartNo, partName, md.OneBarCode, md.BarCode); - ReportHelper rp = new ReportHelper(filename, headTable, null, - (int)GRPaperOrientation.grpoPortrait, 1, reportName); - LogSysBLL.AddInfo(GetDateTime().ToString("yyyy/MM/dd HH:mm:ss") + md.OneBarCode, MethodBase.GetCurrentMethod()); - rp.Report.Print(false); + // ReportHelper rp = new ReportHelper(filename, headTable, null, + // (int)GRPaperOrientation.grpoPortrait, 1, reportName); + // LogSysBLL.AddInfo(GetDateTime().ToString("yyyy/MM/dd HH:mm:ss") + md.OneBarCode, MethodBase.GetCurrentMethod()); + // rp.Report.Print(false); - #endregion - } + // #endregion + //} } } catch (Exception ex) @@ -3112,7 +3120,183 @@ namespace InjectionPC MessageBox.Show("用户名或者密码错误"); } } - + + private void LoginReprint(string name, string pass) + { + string stationID = ""; + StationBLL sbll = new StationBLL(); + DataTable sdt = sbll.SearchInfoByNo(Program.station); + if (sdt != null && sdt.Rows.Count > 0) + { + stationID = sdt.Rows[0]["StationID"].ToString(); + } + sdt.Dispose(); + + + if (string.IsNullOrEmpty(stationID)) + { + MessageBox.Show("配置工位" + Program.station + "在系统中不存在."); + return; + } + + + OperatorBLL operatorBll = new OperatorBLL(); + DataTable operatorDt = operatorBll.SearchInfoByNameAndPsw(name, stationID, pass); + if (operatorDt != null && operatorDt.Rows.Count > 0) + { + string lmt = operatorDt.Rows[0]["Limit"].ToString(); + if (lmt == "allowhandprint") + { + + string code = "", filename = "", printName = "", ManufacturerName = ""; + string IsSupply = "0"; + BarCodeModel md = new BarCodeModel(); + BarCodeBLL bll = new BarCodeBLL(); + ProductBLL pbll = new ProductBLL(); + PlasticBLL plbll = _plasticBLL; + + GlacialComponents.Controls.GLItem gv; + gv = glacialList1.SelectedItems[0] as GlacialComponents.Controls.GLItem; + code = gv.Text; + DialogResult result = MessageBox.Show($"补打条码[{code}]将被新的替换,确定补打条码?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Information); + if (result == DialogResult.OK) + { + + bool exsitWms = _wmsBll.IsReadBarCodeInWms(code); + if (exsitWms) + { + MessageBox.Show($"条码[{code}]在WMS系统已处理,无法补打!"); + return; + } + + DataTable dt = bll.SearchInfoByBarCodeNew(code, Program.tableName); + if (dt == null || dt.Rows.Count == 0) + { + MessageBox.Show($"补打失败,条码[{code}]在表[{Program.tableName}]中不存在!"); + return; + } + + + md.ID = Guid.NewGuid().ToString(); + //md.BarCode = code; + md.StationID = dt.Rows[0]["StationID"].ToString(); + md.StockNo = dt.Rows[0]["StockNo"].ToString(); + md.PartNo = dt.Rows[0]["PartNo"].ToString(); + md.BatchNo = dt.Rows[0]["BatchNo"].ToString(); + string newOneCode = string.Empty; + string newBarCode = string.Empty; + GetBarCode(md.StockNo, md.BatchNo, md.PartNo, ref newOneCode, ref newBarCode); + md.OneBarCode = newOneCode; + md.BarCode = newBarCode; + md.BoxNo = dt.Rows[0]["BoxNo"].ToString(); + if (gv.SubItems.Count > 1) + { + md.Des1 = gv.SubItems[1].Text; + } + + md.PrintType = 2; + + //DataTable pdt = pbll.SearchIsImportByPartNo(md.PartNo); + + DataTable pdt = pbll.SearchInfoByPartNo(md.PartNo); + if (pdt != null && pdt.Rows.Count > 0) + { + if (pdt.Rows[0]["isImport"].ToString() == "1") + { + md.Import = "国产料Kingfa"; + } + else + { + md.Import = ""; + } + + ManufacturerName = pdt.Rows[0]["ManufacturerName"].ToString().Trim(); + IsSupply = pdt.Rows[0]["IsSupply"].ToString(); + } + + md.AddMan = _currentUserName; + //补打条码 + string msg = bll.ReprintSave(md, Program.tableName, dt.Rows[0]["OneBarCode"].ToString(), dt.Rows[0]["BarCode"].ToString(), Program.station, "3"); + if (!string.IsNullOrEmpty(msg)) + { + MessageBox.Show($"补打失败,原因:" + msg); + return; + } + //if (bll.Add_Info_New(md, Program.tableName) == false) + //{ + // return; + //} + glacialList1.SelectedItems.Clear(); + initBarCode(); + + #region 打印条码 + + //filename = System.AppDomain.CurrentDomain.BaseDirectory + "单个条码.grf"; + filename = ManufacturerName.Contains("蔚来") + ? AppDomain.CurrentDomain.BaseDirectory + + "wl.grf" + : AppDomain.CurrentDomain.BaseDirectory + + PrintMoudleName(IsSupply, "Print" + Program.station + "_3102"); //new + if (md.PartNo.Contains("A2146982300") || + md.PartNo.Contains("A2146982400")) + { + filename = AppDomain.CurrentDomain.BaseDirectory + + "Sill.grf"; + } + + string partName = ""; + DataTable dt2 = pbll.SearchInfoByPartNo(md.PartNo); + if (dt2 != null && dt2.Rows.Count > 0) + { + partName = dt2.Rows[0]["ProductName"].ToString(); + } + else + { + partName = ""; + } + + + //DataTable dt4 = plbll.SearchInfo(md.PartNo, md.StationID); + //if (dt4 != null && dt4.Rows.Count > 0) + //{ + // printName = "Printer" + dt4.Rows[0]["PrinterNo"].ToString(); + //} + printName = "Printer" + _printNameDict[md.PartNo + md.StationID]; + + string reportName = ConfigurationManager.AppSettings[printName].ToString(); + DataTable headTable = GetPrintHeadTable(md.PartNo, partName, md.OneBarCode, md.BarCode); + + + ReportHelper rp = new ReportHelper(filename, headTable, null, + (int)GRPaperOrientation.grpoPortrait, 1, reportName); + LogSysBLL.AddInfo(GetDateTime().ToString("yyyy/MM/dd HH:mm:ss") + md.OneBarCode, MethodBase.GetCurrentMethod()); + rp.Report.Print(false); + + #endregion + } + else + { + return; + } + + _login.Close(); + } + else + { + MessageBox.Show("登录用户手动打码权限"); + } + + } + else + { + //f7ce2efa-13ac-4daa-8c7e-8f6287889411 + //lbtip.Text = "用户名或者密码错误" + MessageBox.Show("用户名或者密码错误"); + } + } + + + /// /// 质量录入 /// diff --git a/InjectionPC/FrmMain2411.cs b/InjectionPC/FrmMain2411.cs index 6831540..19c8e95 100644 --- a/InjectionPC/FrmMain2411.cs +++ b/InjectionPC/FrmMain2411.cs @@ -2117,12 +2117,12 @@ namespace InjectionPC /// private void label22_Click(object sender, EventArgs e) { - string code = "", filename = "", printName = "", ManufacturerName = ""; - string IsSupply = "0"; - BarCodeModel md = new BarCodeModel(); - BarCodeBLL bll = new BarCodeBLL(); - ProductBLL pbll = new ProductBLL(); - PlasticBLL plbll = _plasticBLL; + //string code = "", filename = "", printName = "", ManufacturerName = ""; + //string IsSupply = "0"; + //BarCodeModel md = new BarCodeModel(); + //BarCodeBLL bll = new BarCodeBLL(); + //ProductBLL pbll = new ProductBLL(); + //PlasticBLL plbll = _plasticBLL; try { if (glacialList1.SelectedItems.Count == 0) @@ -2132,125 +2132,130 @@ namespace InjectionPC } else { - GlacialComponents.Controls.GLItem gv; - gv = glacialList1.SelectedItems[0] as GlacialComponents.Controls.GLItem; - code = gv.Text; - DialogResult result = MessageBox.Show($"补打条码[{code}]将被新的替换,确定补打条码?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Information); - if (result == DialogResult.OK) - { - - bool exsitWms = _wmsBll.IsReadBarCodeInWms(code); - if (exsitWms) - { - MessageBox.Show($"条码[{code}]在WMS系统已处理,无法补打!"); - return; - } - - DataTable dt = bll.SearchInfoByBarCodeNew(code, Program.tableName); - if (dt != null && dt.Rows.Count > 0) - { - md.ID = Guid.NewGuid().ToString(); - //md.BarCode = code; - md.StationID = dt.Rows[0]["StationID"].ToString(); - md.StockNo = dt.Rows[0]["StockNo"].ToString(); - md.PartNo = dt.Rows[0]["PartNo"].ToString(); - md.BatchNo = dt.Rows[0]["BatchNo"].ToString(); - string newOneCode = string.Empty; - string newBarCode = string.Empty; - GetBarCode(md.StockNo, md.BatchNo, md.PartNo, ref newOneCode, ref newBarCode); - md.OneBarCode = newOneCode; - md.BarCode = newBarCode; - md.BoxNo = dt.Rows[0]["BoxNo"].ToString(); - if (gv.SubItems.Count > 1) - { - md.Des1 = gv.SubItems[1].Text; - } - - md.PrintType = 2; - - //DataTable pdt = pbll.SearchIsImportByPartNo(md.PartNo); - - DataTable pdt = pbll.SearchInfoByPartNo(md.PartNo); - if (pdt != null && pdt.Rows.Count > 0) - { - if (pdt.Rows[0]["isImport"].ToString() == "1") - { - md.Import = "国产料Kingfa"; - } - else - { - md.Import = ""; - } - - ManufacturerName = pdt.Rows[0]["ManufacturerName"].ToString().Trim(); - IsSupply = pdt.Rows[0]["IsSupply"].ToString(); - } - } - else - { - MessageBox.Show($"补打失败,条码[{code}]在表[{ Program.tableName}]中不存在!"); - return; - } - md.AddMan = _currentUserName; - //补打条码 - string msg = bll.ReprintSave(md, Program.tableName, dt.Rows[0]["OneBarCode"].ToString(), dt.Rows[0]["BarCode"].ToString(),Program.station,"3"); - if (!string.IsNullOrEmpty(msg)) - { - MessageBox.Show($"补打失败,原因:" + msg); - return; - } - //if (bll.Add_Info_New(md, Program.tableName) == false) - //{ - // return; - //} - glacialList1.SelectedItems.Clear(); - initBarCode(); - - #region 打印条码 - - //filename = System.AppDomain.CurrentDomain.BaseDirectory + "单个条码.grf"; - filename = ManufacturerName.Contains("蔚来") - ? AppDomain.CurrentDomain.BaseDirectory + - "wl.grf" - : AppDomain.CurrentDomain.BaseDirectory + - PrintMoudleName(IsSupply); //new - if (md.PartNo.Contains("A2146982300") || - md.PartNo.Contains("A2146982400")) - { - filename = AppDomain.CurrentDomain.BaseDirectory + - "Sill.grf"; - } + _login = new FrmLogin(); + _login.RegisterLoginMethod(LoginReprint); + _login.ShowDialog(); - string partName = ""; - DataTable dt2 = pbll.SearchInfoByPartNo(md.PartNo); - if (dt2 != null && dt2.Rows.Count > 0) - { - partName = dt2.Rows[0]["ProductName"].ToString(); - } - else - { - partName = ""; - } + //GlacialComponents.Controls.GLItem gv; + //gv = glacialList1.SelectedItems[0] as GlacialComponents.Controls.GLItem; + //code = gv.Text; + //DialogResult result = MessageBox.Show($"补打条码[{code}]将被新的替换,确定补打条码?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Information); + //if (result == DialogResult.OK) + //{ - //DataTable dt4 = plbll.SearchInfo(md.PartNo, md.StationID); - //if (dt4 != null && dt4.Rows.Count > 0) - //{ - // printName = "Printer" + dt4.Rows[0]["PrinterNo"].ToString(); - //} - printName = "Printer" + _printNameDict[md.PartNo + md.StationID]; + // bool exsitWms = _wmsBll.IsReadBarCodeInWms(code); + // if (exsitWms) + // { + // MessageBox.Show($"条码[{code}]在WMS系统已处理,无法补打!"); + // return; + // } + + // DataTable dt = bll.SearchInfoByBarCodeNew(code, Program.tableName); + // if (dt != null && dt.Rows.Count > 0) + // { + // md.ID = Guid.NewGuid().ToString(); + // //md.BarCode = code; + // md.StationID = dt.Rows[0]["StationID"].ToString(); + // md.StockNo = dt.Rows[0]["StockNo"].ToString(); + // md.PartNo = dt.Rows[0]["PartNo"].ToString(); + // md.BatchNo = dt.Rows[0]["BatchNo"].ToString(); + // string newOneCode = string.Empty; + // string newBarCode = string.Empty; + // GetBarCode(md.StockNo, md.BatchNo, md.PartNo, ref newOneCode, ref newBarCode); + // md.OneBarCode = newOneCode; + // md.BarCode = newBarCode; + // md.BoxNo = dt.Rows[0]["BoxNo"].ToString(); + // if (gv.SubItems.Count > 1) + // { + // md.Des1 = gv.SubItems[1].Text; + // } + + // md.PrintType = 2; + + // //DataTable pdt = pbll.SearchIsImportByPartNo(md.PartNo); + + // DataTable pdt = pbll.SearchInfoByPartNo(md.PartNo); + // if (pdt != null && pdt.Rows.Count > 0) + // { + // if (pdt.Rows[0]["isImport"].ToString() == "1") + // { + // md.Import = "国产料Kingfa"; + // } + // else + // { + // md.Import = ""; + // } + + // ManufacturerName = pdt.Rows[0]["ManufacturerName"].ToString().Trim(); + // IsSupply = pdt.Rows[0]["IsSupply"].ToString(); + // } + // } + // else + // { + // MessageBox.Show($"补打失败,条码[{code}]在表[{ Program.tableName}]中不存在!"); + // return; + // } + // md.AddMan = _currentUserName; + // //补打条码 + // string msg = bll.ReprintSave(md, Program.tableName, dt.Rows[0]["OneBarCode"].ToString(), dt.Rows[0]["BarCode"].ToString(),Program.station,"3"); + // if (!string.IsNullOrEmpty(msg)) + // { + // MessageBox.Show($"补打失败,原因:" + msg); + // return; + // } + // //if (bll.Add_Info_New(md, Program.tableName) == false) + // //{ + // // return; + // //} + // glacialList1.SelectedItems.Clear(); + // initBarCode(); + + // #region 打印条码 + + // //filename = System.AppDomain.CurrentDomain.BaseDirectory + "单个条码.grf"; + // filename = ManufacturerName.Contains("蔚来") + // ? AppDomain.CurrentDomain.BaseDirectory + + // "wl.grf" + // : AppDomain.CurrentDomain.BaseDirectory + + // PrintMoudleName(IsSupply); //new + // if (md.PartNo.Contains("A2146982300") || + // md.PartNo.Contains("A2146982400")) + // { + // filename = AppDomain.CurrentDomain.BaseDirectory + + // "Sill.grf"; + // } + + // string partName = ""; + // DataTable dt2 = pbll.SearchInfoByPartNo(md.PartNo); + // if (dt2 != null && dt2.Rows.Count > 0) + // { + // partName = dt2.Rows[0]["ProductName"].ToString(); + // } + // else + // { + // partName = ""; + // } + + + // //DataTable dt4 = plbll.SearchInfo(md.PartNo, md.StationID); + // //if (dt4 != null && dt4.Rows.Count > 0) + // //{ + // // printName = "Printer" + dt4.Rows[0]["PrinterNo"].ToString(); + // //} + // printName = "Printer" + _printNameDict[md.PartNo + md.StationID]; - string reportName = ConfigurationManager.AppSettings[printName].ToString(); - DataTable headTable = GetPrintHeadTable(md.PartNo, partName, md.OneBarCode, md.BarCode); + // string reportName = ConfigurationManager.AppSettings[printName].ToString(); + // DataTable headTable = GetPrintHeadTable(md.PartNo, partName, md.OneBarCode, md.BarCode); - ReportHelper rp = new ReportHelper(filename, headTable, null, - (int)GRPaperOrientation.grpoPortrait, 1, reportName); - LogSysBLL.AddInfo(GetDateTime().ToString("yyyy/MM/dd HH:mm:ss") + md.OneBarCode, MethodBase.GetCurrentMethod()); - rp.Report.Print(false); + // ReportHelper rp = new ReportHelper(filename, headTable, null, + // (int)GRPaperOrientation.grpoPortrait, 1, reportName); + // LogSysBLL.AddInfo(GetDateTime().ToString("yyyy/MM/dd HH:mm:ss") + md.OneBarCode, MethodBase.GetCurrentMethod()); + // rp.Report.Print(false); - #endregion - } + // #endregion + //} } } catch (Exception ex) @@ -2869,6 +2874,182 @@ namespace InjectionPC MessageBox.Show("用户名或者密码错误"); } } + + private void LoginReprint(string name, string pass) + { + string stationID = ""; + StationBLL sbll = new StationBLL(); + DataTable sdt = sbll.SearchInfoByNo(Program.station); + if (sdt != null && sdt.Rows.Count > 0) + { + stationID = sdt.Rows[0]["StationID"].ToString(); + } + sdt.Dispose(); + + + if (string.IsNullOrEmpty(stationID)) + { + MessageBox.Show("配置工位" + Program.station + "在系统中不存在."); + return; + } + + + OperatorBLL operatorBll = new OperatorBLL(); + DataTable operatorDt = operatorBll.SearchInfoByNameAndPsw(name, stationID, pass); + if (operatorDt != null && operatorDt.Rows.Count > 0) + { + string lmt = operatorDt.Rows[0]["Limit"].ToString(); + if (lmt == "allowhandprint") + { + string code = "", filename = "", printName = "", ManufacturerName = ""; + string IsSupply = "0"; + BarCodeModel md = new BarCodeModel(); + BarCodeBLL bll = new BarCodeBLL(); + ProductBLL pbll = new ProductBLL(); + PlasticBLL plbll = _plasticBLL; + + + GlacialComponents.Controls.GLItem gv; + gv = glacialList1.SelectedItems[0] as GlacialComponents.Controls.GLItem; + code = gv.Text; + DialogResult result = MessageBox.Show($"补打条码[{code}]将被新的替换,确定补打条码?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Information); + if (result == DialogResult.OK) + { + + bool exsitWms = _wmsBll.IsReadBarCodeInWms(code); + if (exsitWms) + { + MessageBox.Show($"条码[{code}]在WMS系统已处理,无法补打!"); + return; + } + + DataTable dt = bll.SearchInfoByBarCodeNew(code, Program.tableName); + if (dt != null && dt.Rows.Count > 0) + { + md.ID = Guid.NewGuid().ToString(); + //md.BarCode = code; + md.StationID = dt.Rows[0]["StationID"].ToString(); + md.StockNo = dt.Rows[0]["StockNo"].ToString(); + md.PartNo = dt.Rows[0]["PartNo"].ToString(); + md.BatchNo = dt.Rows[0]["BatchNo"].ToString(); + string newOneCode = string.Empty; + string newBarCode = string.Empty; + GetBarCode(md.StockNo, md.BatchNo, md.PartNo, ref newOneCode, ref newBarCode); + md.OneBarCode = newOneCode; + md.BarCode = newBarCode; + md.BoxNo = dt.Rows[0]["BoxNo"].ToString(); + if (gv.SubItems.Count > 1) + { + md.Des1 = gv.SubItems[1].Text; + } + + md.PrintType = 2; + + //DataTable pdt = pbll.SearchIsImportByPartNo(md.PartNo); + + DataTable pdt = pbll.SearchInfoByPartNo(md.PartNo); + if (pdt != null && pdt.Rows.Count > 0) + { + if (pdt.Rows[0]["isImport"].ToString() == "1") + { + md.Import = "国产料Kingfa"; + } + else + { + md.Import = ""; + } + + ManufacturerName = pdt.Rows[0]["ManufacturerName"].ToString().Trim(); + IsSupply = pdt.Rows[0]["IsSupply"].ToString(); + } + } + else + { + MessageBox.Show($"补打失败,条码[{code}]在表[{Program.tableName}]中不存在!"); + return; + } + md.AddMan = _currentUserName; + //补打条码 + string msg = bll.ReprintSave(md, Program.tableName, dt.Rows[0]["OneBarCode"].ToString(), dt.Rows[0]["BarCode"].ToString(), Program.station, "3"); + if (!string.IsNullOrEmpty(msg)) + { + MessageBox.Show($"补打失败,原因:" + msg); + return; + } + //if (bll.Add_Info_New(md, Program.tableName) == false) + //{ + // return; + //} + glacialList1.SelectedItems.Clear(); + initBarCode(); + + #region 打印条码 + + //filename = System.AppDomain.CurrentDomain.BaseDirectory + "单个条码.grf"; + filename = ManufacturerName.Contains("蔚来") + ? AppDomain.CurrentDomain.BaseDirectory + + "wl.grf" + : AppDomain.CurrentDomain.BaseDirectory + + PrintMoudleName(IsSupply); //new + if (md.PartNo.Contains("A2146982300") || + md.PartNo.Contains("A2146982400")) + { + filename = AppDomain.CurrentDomain.BaseDirectory + + "Sill.grf"; + } + + string partName = ""; + DataTable dt2 = pbll.SearchInfoByPartNo(md.PartNo); + if (dt2 != null && dt2.Rows.Count > 0) + { + partName = dt2.Rows[0]["ProductName"].ToString(); + } + else + { + partName = ""; + } + + + //DataTable dt4 = plbll.SearchInfo(md.PartNo, md.StationID); + //if (dt4 != null && dt4.Rows.Count > 0) + //{ + // printName = "Printer" + dt4.Rows[0]["PrinterNo"].ToString(); + //} + printName = "Printer" + _printNameDict[md.PartNo + md.StationID]; + + string reportName = ConfigurationManager.AppSettings[printName].ToString(); + DataTable headTable = GetPrintHeadTable(md.PartNo, partName, md.OneBarCode, md.BarCode); + + + ReportHelper rp = new ReportHelper(filename, headTable, null, + (int)GRPaperOrientation.grpoPortrait, 1, reportName); + LogSysBLL.AddInfo(GetDateTime().ToString("yyyy/MM/dd HH:mm:ss") + md.OneBarCode, MethodBase.GetCurrentMethod()); + rp.Report.Print(false); + + #endregion + } + + + + + _login.Close(); + } + else + { + MessageBox.Show("登录用户手动打码权限"); + } + + } + else + { + //f7ce2efa-13ac-4daa-8c7e-8f6287889411 + //lbtip.Text = "用户名或者密码错误" + MessageBox.Show("用户名或者密码错误"); + } + } + + + /// /// 质量录入 ///