From 27c2b9b931997d867908b9f705a40bebcbaaba7f Mon Sep 17 00:00:00 2001 From: liuwf Date: Fri, 19 Jan 2024 17:03:21 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8B=E7=BA=BF=E4=B8=9A=E5=8A=A1=E7=B1=BB?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Business/offLineBusiness.cs | 58 +++++++++++-------- 1 file changed, 34 insertions(+), 24 deletions(-) diff --git a/Aucma.Core.ProductOffLine/Business/offLineBusiness.cs b/Aucma.Core.ProductOffLine/Business/offLineBusiness.cs index fb73737f..01a71542 100644 --- a/Aucma.Core.ProductOffLine/Business/offLineBusiness.cs +++ b/Aucma.Core.ProductOffLine/Business/offLineBusiness.cs @@ -340,15 +340,16 @@ namespace Aucma.Core.ProductOffLine.Business #endregion //界面刷新 TempOffLineInfo.ProductRefreshFlag = true; - // 多码系统校验,是否需要待定,现场看情况 + // 多码系统校验,暂不启用 // bool flag = TestBarCode(TempOffLineInfo); // if (!flag) // { // return false; // } log.Info(TempOffLineInfo.ProductSNCode + ", 多码验证通过!"); - return true; - } + //2.上传条码系统 + return uploadSnSysytem(TempOffLineInfo); + } else { @@ -382,18 +383,33 @@ namespace Aucma.Core.ProductOffLine.Business TempOffLineInfo.ProductRefreshFlag = true; return false; } + + } + catch (Exception ex) + { + TempOffLineInfo.MsgInfo = "获取产品条码异常:" + ex.Message; + TempOffLineInfo.MsgAlarmFlag = true; + //界面刷新 + TempOffLineInfo.ProductRefreshFlag = true; + log.Info(BarCode + "条码验证异常:" + ex.Message.ToString()); + return false; + } + } - //2.上传条码系统 + public bool uploadSnSysytem(TempInfo TempOffLineInfo) + { + try + { if (!string.IsNullOrEmpty(TempOffLineInfo.ProductOrderNo)) { - // 条码系统保存接口 - string strSave = _productOffLineServices.SaveBarcodeInfo(BarCode.Trim(), "ILS_SORT", TempOffLineInfo.ProductOrderNo, 1); - // string strSave = "Y"; + // 条码系统保存接口 + string strSave = _productOffLineServices.SaveBarcodeInfo(TempOffLineInfo.ProductSNCode, "ILS_SORT", TempOffLineInfo.ProductOrderNo, 1); + // string strSave = "Y"; if (!string.IsNullOrEmpty(strSave)) { if (strSave == "Y") { - log.Info(BarCode + "上传条码成功:" + strSave); + log.Info(TempOffLineInfo.ProductSNCode + "上传条码成功:" + strSave); TempOffLineInfo.MsgInfo = TempOffLineInfo.MsgInfo + ",上传条码成功"; // mes查询订单数据, 异常处理:后期可能根据SN码查箱体码,查订单号并检查更新订单数据 @@ -414,22 +430,22 @@ namespace Aucma.Core.ProductOffLine.Business //界面刷新 TempOffLineInfo.ProductRefreshFlag = true; - + return true; } else { - log.Info(BarCode + "上传条码失败:" + strSave); + log.Info(TempOffLineInfo.ProductSNCode + "上传条码失败:" + strSave); TempOffLineInfo.MsgInfo = TempOffLineInfo.MsgInfo + ",上传条码失败" + strSave; - + if (strSave.Contains("条码重复")) { // 查询本地数据库是否有数据 - OffLineInfo offLineInfo = _offLineInfoServices.FirstAsync(x => x.ProductSNCode == BarCode).Result; + OffLineInfo offLineInfo = _offLineInfoServices.FirstAsync(x => x.ProductSNCode == TempOffLineInfo.ProductSNCode).Result; if (offLineInfo != null) { - log.Info(BarCode + "条码重复,本地已存在,放行"); + log.Info(TempOffLineInfo.ProductSNCode + "条码重复,本地已存在,放行"); TempOffLineInfo.MsgInfo = TempOffLineInfo.MsgInfo + "条码重复,本地已存在,放行"; //界面刷新 TempOffLineInfo.ProductRefreshFlag = true; @@ -442,7 +458,7 @@ namespace Aucma.Core.ProductOffLine.Business } else { - log.Info(BarCode + "条码重复,本地不存在,已插入,放行"); + log.Info(TempOffLineInfo.ProductSNCode + "条码重复,本地不存在,已插入,放行"); OffLineInfo info11 = MapperTwo(TempOffLineInfo); _offLineInfoServices.AddAsync(info11); return true; @@ -473,17 +489,11 @@ namespace Aucma.Core.ProductOffLine.Business return false; } } - catch (Exception ex) - { - TempOffLineInfo.MsgInfo = "获取产品条码异常:" + ex.Message; - TempOffLineInfo.MsgAlarmFlag = true; - //界面刷新 - TempOffLineInfo.ProductRefreshFlag = true; - log.Info(BarCode + "条码验证异常:" + ex.Message.ToString()); - return false; + catch (Exception ex) + { + log.Error(ex.Message.ToString()); + } } - } - #region plc交互 /// /// 下发plc放行信号,传进来扫码器编号,分垛方向A或者B,返回plc反馈结果