From ed759e7c1729c30b2ef1f59e8da780078c22cbc1 Mon Sep 17 00:00:00 2001 From: "ruoxing.wang" <88384874@qq.com> Date: Fri, 23 May 2025 13:05:49 +0800 Subject: [PATCH] 1 --- InjectionPC/FrmMain2408.cs | 74 ++++++++++++++++++++++++++++++++++---- 1 file changed, 68 insertions(+), 6 deletions(-) diff --git a/InjectionPC/FrmMain2408.cs b/InjectionPC/FrmMain2408.cs index 688405f..744f74a 100644 --- a/InjectionPC/FrmMain2408.cs +++ b/InjectionPC/FrmMain2408.cs @@ -1048,6 +1048,9 @@ namespace InjectionPC } string errMsg = string.Empty; + + + bool saveRst = SaveInfo(md, true, mould, false, 0, IsOne, IsSupply, ManufacturerName, filename214, ref errMsg);//PLC来信号,IsSame == "0"时插入 if (saveRst == false) { @@ -2248,7 +2251,19 @@ namespace InjectionPC { inBoxBll.UpdateBoxCount(boxCode, 1, false); - BoxBarCodeReAddAndPrint(dt.Rows[0]); + + DataRow dr = dt.Rows[0]; + if (string.IsNullOrEmpty(dr["BatchNo"].ToString())) + { + string[] boxArray = boxCode.Split('.'); + if (boxArray.Length > 1 && boxArray[1].Length == 6) + { + dr["BatchNo"] = boxArray[1]; + } + } + BoxBarCodeReAddAndPrint(dr); + + InitPackageInfo(); //试试打印数量是否更新 int count3 = 0; @@ -2299,7 +2314,7 @@ namespace InjectionPC md.OneBarCode = newOneCode; md.BarCode = newBarCode; md.BoxNo = barCodeRow["BoxNo"].ToString(); - + md.PlanID = planID; md.Des1 = barCodeRow["Des1"].ToString(); md.PrintType = 2; @@ -3377,8 +3392,8 @@ namespace InjectionPC //打印箱码 PrintBoxCode(dt.Rows[0], realCount, mould, isHandPrint); - // _lastBoxNo = lbPackageCodeL.Text; - lbPackageCodeL.Text = ""; + // _lastBoxNo = lbPackageCodeL.Text; + lbPackageCode.Text = ""; } } else @@ -3656,8 +3671,51 @@ namespace InjectionPC int standCount = int.Parse(boxRow["StandardQty"].ToString()); if(boxCount>= standCount) { - lbPackageCode.Text = ""; - CheckPackageCode(partCode, autoPrint, mould, partName, isHandPrint); + if (!string.IsNullOrEmpty(pkgCode)) + { + LocalDBService local = new LocalDBService(SqlHelper.GetConnSting()); + try + { + local.BeginTrans(); + _wmsBll.SaveInterface(local, pkgCode, "", Program.station); + local.Commit(); + + string realCountStr = packageTable.Rows[0]["BoxCount"].ToString(); + int realCount = 0; + int.TryParse(realCountStr, out realCount); + + PrintBoxCode(packageTable.Rows[0], realCount, mould, isHandPrint); + lbPackageCode.Text = ""; + CheckPackageCode(partCode, autoPrint, mould, partName, isHandPrint); + return; + } + catch(Exception e) + { + if (local != null) + { + local.Rollback(); + } + + LogHelper.WriteLog("CheckPackageCode方法检测到满箱,自动wms接口报工时出错,错误原因:"+e.Message); + + } + finally + { + if (local != null) + { + local.EndTrans(); + } + } + + + + } + + + + + //会死循环 + //CheckPackageCode(partCode, autoPrint, mould, partName, isHandPrint); } } @@ -4732,6 +4790,10 @@ namespace InjectionPC //发送前,检查当前箱码, 为空或者箱码数量等于标包,情况箱码,重新生成新的箱码 250420 CheckPackageCode(md.PartNo, isAutoPrint, mould, md.Des1, isHandPrint); + if(string.IsNullOrEmpty( md.BatchNo)) + { + md.BatchNo = GetBatch(true); + } bool rst = SaveBarCode(md, Program.tableName, isAutoPrint, mould, isHandPrint, ref errMsg, handPrint); return rst;