diff --git a/SlnMesnac.Business/ProdCompletionBusiness.cs b/SlnMesnac.Business/ProdCompletionBusiness.cs index 9cead97..fcacffe 100644 --- a/SlnMesnac.Business/ProdCompletionBusiness.cs +++ b/SlnMesnac.Business/ProdCompletionBusiness.cs @@ -468,26 +468,28 @@ namespace SlnMesnac.Business private void BindingBarCode(string bigBarcode, string epcStr, MesProductPlanDto productPlanDto) { List list = _mesPrdBarCodeService.GetUseBarCodeList(); - if (list == null || list.Count == 0) + if (list != null && list.Count > 0) { - _logger.LogError("托盘未找到可以绑定的小条码"); - return; - // throw new InvalidOperationException("托盘未找到可以绑定的小条码"); - } - - if (list.Where(x => x.PrintFlag == "1").ToList().Count < 40) - { - // 推送低级别报警 - AddAlarm(WarnStatusEnum.托盘绑定时已喷码数不足40); - } - foreach (var item in list) - { - item.PalletInfoCode = epcStr; - item.MesBarcodeInfo = bigBarcode; - item.BindTime = DateTime.Now; - item.BindStatus = 1; + if (list.Where(x => x.PrintFlag == "1").ToList().Count < 40) + { + // 推送低级别报警 + AddAlarm(WarnStatusEnum.托盘绑定时已喷码数不足40); + } + foreach (var item in list) + { + item.PalletInfoCode = epcStr; + item.MesBarcodeInfo = bigBarcode; + item.BindTime = DateTime.Now; + item.BindStatus = 1; + } + sqlSugarClient.AsTenant().GetConnection("mes").Updateable(list).ExecuteCommand(); } - sqlSugarClient.AsTenant().GetConnection("mes").Updateable(list).ExecuteCommand(); + //if (list == null || list.Count == 0) + //{ + // _logger.LogError("托盘未找到可以绑定的小条码"); + // return; + // // throw new InvalidOperationException("托盘未找到可以绑定的小条码"); + //} //托盘绑定大条码信息 BasePalletInfo palletInfo = sqlSugarClient.AsTenant().GetConnection("mes").Queryable().Where(x => x.PalletInfoCode == epcStr).First();