diff --git a/BasicData/Tnb.BasicData.Entities/Entity/BasLocation.cs b/BasicData/Tnb.BasicData.Entities/Entity/BasLocation.cs index 3944284a..34c97eb5 100644 --- a/BasicData/Tnb.BasicData.Entities/Entity/BasLocation.cs +++ b/BasicData/Tnb.BasicData.Entities/Entity/BasLocation.cs @@ -130,4 +130,8 @@ public partial class BasLocation : BaseEntity /// 任务数 /// public int task_nums { get; set; } + /// + /// 通道 + /// + public string passage { get; set; } } diff --git a/ProductionMgr/Tnb.ProductionMgr/RedisBackGround.cs b/ProductionMgr/Tnb.ProductionMgr/RedisBackGround.cs index 15f2984a..91022ee0 100644 --- a/ProductionMgr/Tnb.ProductionMgr/RedisBackGround.cs +++ b/ProductionMgr/Tnb.ProductionMgr/RedisBackGround.cs @@ -857,14 +857,15 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA var DistaskH = db_SSXcodetimer.Queryable().Where(p => p.carry_code == result && p.status != WmsWareHouseConst.TASK_BILL_STATUS_COMPLE_ID).OrderByDescending(p => p.create_time).First(); if (DistaskH != null) { - LoggerSSX.LogInformation($"【定时任务SSXcode】DistaskH != null putdic.Keys.Contains(DistaskH.startlocation_code):{putdic.Keys.Contains(DistaskH.startlocation_code)} {result}"); + string target = putdic.Keys.Contains(DistaskH.startlocation_code) ? putdic.Where(p => p.Key == DistaskH.startlocation_code).First().Value.ToString() : "13"; + LoggerSSX.LogInformation($"【定时任务SSXcode】下升降机入中储仓任务{DistaskH.bill_code} 判定料箱{result} 去{target}线"); Dictionary dicCommand2 = new(StringComparer.OrdinalIgnoreCase) { ["DevName"] = key, ["token"] = _eleCtlCfg.token, ["TagName"] = strs[3], - ["Value"] = putdic.Keys.Contains(DistaskH.startlocation_code) ? putdic.Where(p => p.Key == DistaskH.startlocation_code).First().Value.ToString() : "13", + ["Value"] = target, }; HttpClientHelper.GetRequestAsync(_eleCtlCfg.WriteTagUrl, dicCommand2).Wait(); Dictionary dicCommand = new(StringComparer.OrdinalIgnoreCase) @@ -878,7 +879,7 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA } else { - LoggerSSX.LogInformation($"【定时任务SSXcode】DistaskH == null "); + LoggerSSX.LogInformation($"【定时任务SSXcode】找不到料箱对应的下升降机入中储仓任务 判定料箱{result} 去13线 "); Dictionary dicCommand2 = new(StringComparer.OrdinalIgnoreCase) { ["DevName"] = key, diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Consts/WmsWareHouseConst.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Consts/WmsWareHouseConst.cs index f5d98623..61d9a971 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Consts/WmsWareHouseConst.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Consts/WmsWareHouseConst.cs @@ -64,7 +64,15 @@ /// public const string WAREHOUSE_F2KTQ_ID = "35434202453013"; - + /// + /// 原材料缓存区 + /// + public const string REGION_YCLCache_ID = "35724362038549"; + /// + /// 采购存储区 + /// + public const string REGION_Purchase_ID = "26125793924133"; + /// /// 长管出库 /// diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs index b6235c55..bdc6008f 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs @@ -1895,7 +1895,7 @@ namespace Tnb.WarehouseMgr else if (distaskH.task_type == WmsWareHouseConst.WMS_PRETASK_OUTSTOCK_TYPE_ID || distaskH.task_type == WmsWareHouseConst.BIZTYPE_WMSTRANSFER_ID) { var orgdistaskHs = OriginDistaskH.Where(p => p.status == WmsWareHouseConst.TASK_BILL_STATUS_DZX_ID && p.task_type == WmsWareHouseConst.WMS_PRETASK_OUTSTOCK_TYPE_ID && p.endpoint_id == distaskH.endpoint_id).ToList(); - var newdistaskHs = NewdistaskHs = OriginDistaskH.Where(p => p.status == WmsWareHouseConst.TASK_BILL_STATUS_DZX_ID && p.task_type == WmsWareHouseConst.WMS_PRETASK_OUTSTOCK_TYPE_ID && p.endpoint_id == distaskH.endpoint_id).ToList(); + var newdistaskHs = NewdistaskHs.Where(p => p.status == WmsWareHouseConst.TASK_BILL_STATUS_DZX_ID && p.task_type == WmsWareHouseConst.WMS_PRETASK_OUTSTOCK_TYPE_ID && p.endpoint_id == distaskH.endpoint_id).ToList(); if ((orgdistaskHs.Count + newdistaskHs.Count) == 0) { var groups = _billRullService.GetBillNumber(WmsWareHouseConst.WMS_TASK_EXECUTE_ENCODE).Result; diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryBindService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryBindService.cs index e423721b..f7b15e51 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryBindService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryBindService.cs @@ -151,7 +151,47 @@ namespace Tnb.WarehouseMgr var result = data.Adapt(); return result; } + [HttpPost] + public async Task CarryMaterialBind(CarryMaterialBindInput input) + { + try + { + WmsCarryH? carry = await _db.Queryable().SingleAsync(it => it.carry_code == input.carrycode); + List WmsCarryCodes = new List(); + foreach (var detail in input.details) + { + var WmsCarryCode = detail.Adapt(); + WmsCarryCode.id = SnowflakeIdHelper.NextId(); + WmsCarryCode.carry_id = carry.id; + WmsCarryCode.is_out = 0; + WmsCarryCode.create_id = input.create_id; + WmsCarryCode.create_time = DateTime.Now; + WmsCarryCodes.Add(WmsCarryCode); + } + int rows = 0; + if (WmsCarryCodes.Count > 0) + rows = await _db.Insertable(WmsCarryCodes).ExecuteCommandAsync(); + if (rows == 0) + { + throw new Exception($"物料列表为空,不能提交绑定,可能的原因;1.需要检查扫码设置(新PDA) 2.未扫到有效的二维码 详细信息:接收到{input.details.Count}个条码 但是成功绑定的条码数量为0个!"); + } + } + catch (PostgresException ex) + { + Logger.LogError(ex.Message); + Logger.LogError(ex.StackTrace); + throw new AppFriendlyException($"绑定失败(1.可能是存在已被绑定的条码 2.存在其他与此载具编号相同的载具 3.存在字段传了空值) {ex.Message}", 500); + } + catch (Exception ex) + { + Logger.LogError(ex.Message); + Logger.LogError(ex.StackTrace); + throw new AppFriendlyException($"绑定失败 {ex.Message}", 500); + } + } + + [NonAction] public async Task CarryMaterialBind(CarryMaterialBindInput input, ISqlSugarClient dbConn = null) { var db = _db;