diff --git a/ProductionMgr/Tnb.ProductionMgr/RedisBackGround.cs b/ProductionMgr/Tnb.ProductionMgr/RedisBackGround.cs index dce07bc8..8367207b 100644 --- a/ProductionMgr/Tnb.ProductionMgr/RedisBackGround.cs +++ b/ProductionMgr/Tnb.ProductionMgr/RedisBackGround.cs @@ -376,7 +376,7 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA { if (db_Scantimer.Queryable().Where(p => p.carry_id == carry.id && p.status != WmsWareHouseConst.TASK_BILL_STATUS_COMPLE_ID).Any()) { - Logger.LogInformation($"【ScanInStock】 八工位 {key} 托盘 {carry.id} 对应的执行任务状态(status)不是26126860808229(已完成),此时不能执行入库"); + Logger.LogInformation($"【ScanInStock】 八工位 {key} 托盘 {carry.carry_code} 对应的执行任务状态(status)不是26126860808229(已完成),此时不能执行入库"); continue; } @@ -402,6 +402,10 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA input.data.Add("id", null); _wmsPDAScanInStock.ScanInStockByRedis(input).Wait(); } + else + { + Logger.LogInformation($"【ScanInStock】 八工位 {key} 托盘 {carry.carry_code} 未绑定物料条码!"); + } } } } diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/CarryMaterialBindInput.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/CarryMaterialBindInput.cs index 8572cd3b..223ccca6 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/CarryMaterialBindInput.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/CarryMaterialBindInput.cs @@ -9,6 +9,7 @@ namespace Tnb.WarehouseMgr.Entities.Dto.Inputs public class CarryMaterialBindInput { public string? carrycode { get; set; } + public string? create_id { get; set; } public List details { get; set; } } public class CarryMaterialDetail diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/WmsElevatorUnlockInput.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/WmsElevatorUnlockInput.cs new file mode 100644 index 00000000..f01f2af9 --- /dev/null +++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/WmsElevatorUnlockInput.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tnb.WarehouseMgr.Entities.Dto.Inputs +{ + public class WmsElevatorUnlockInput + { + public string? elevator_id { get; set; } + } +} diff --git a/WarehouseMgr/Tnb.WarehouseMgr/DeviceProviderService.cs b/WarehouseMgr/Tnb.WarehouseMgr/DeviceProviderService.cs index 237c32fe..8a04e662 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/DeviceProviderService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/DeviceProviderService.cs @@ -85,22 +85,34 @@ namespace Tnb.WarehouseMgr { Logger.Information($"【LoadConfirm】接收到WCS取货确认信号.................. {JsonConvert.SerializeObject(input)}"); - var dis = _db.Queryable().Where(P => P.bill_code == input.taskCode).First(); - if (dis.area_code == "ZSCJ001") + try { - var flag = await _wareHouseService.Check(dis.startlocation_code, "LOAD"); - if (flag) + var dis = _db.Queryable().Where(P => P.bill_code == input.taskCode).First(); + if (dis.area_code == "ZSCJ001") { - await _wareHouseService.SsxControl(dis, "LOAD"); - Logger.Information("【LoadConfirm】 " + dis.startlocation_code + "取货确认..................成功"); - return await ToApiResult(HttpStatusCode.OK, "成功"); - } - else - { - Logger.Information("【LoadConfirm】 " + dis.startlocation_code + "取货确认..................失败"); - return await ToApiResult(HttpStatusCode.InternalServerError, "失败"); + var flag = await _wareHouseService.Check(dis.startlocation_code, "LOAD"); + if (flag) + { + await _wareHouseService.SsxControl(dis, "LOAD"); + Logger.Information("【LoadConfirm】 " + dis.startlocation_code + "取货确认..................成功"); + return await ToApiResult(HttpStatusCode.OK, "成功"); + } + else + { + Logger.Information("【LoadConfirm】 " + dis.startlocation_code + "取货确认..................失败"); + return await ToApiResult(HttpStatusCode.InternalServerError, "失败"); + } } } + catch (Exception ex) + { + Logger.LogError(ex.Message); + Logger.LogError(ex.StackTrace); + return await ToApiResult(HttpStatusCode.InternalServerError, $"取货确认..................失败 原因是{ex.Message}"); + throw; + } + + /*var whereExp = Expressionable.Create() .And((a, b, c) => c.bill_code == input.taskCode) .And((a, b, c) => a.enabled == 1) @@ -533,6 +545,24 @@ namespace Tnb.WarehouseMgr } + [HttpPost] + public async Task WmsElevatorUnlock(WmsElevatorUnlockInput input) + { + try + { + Logger.Information($"【WmsElevatorUnlock】操作电梯{input.elevator_id}手动解锁"); + await _db.Updateable().SetColumns(r => r.is_use == (int)EnumElevatorUseStatus.空闲) + .Where(it => it.elevator_id == input.elevator_id).ExecuteCommandAsync(); + s_eleUseStatusDic[input.elevator_id] = (int)EnumElevatorUseStatus.空闲; + } + catch (Exception ex) + { + Logger.Error("【ElevatorConfirm】 申请进出电梯信号错误", ex); + return await ToApiResult(HttpStatusCode.InternalServerError, "请重试!"); + throw; + } + return await ToApiResult(HttpStatusCode.OK, "解锁成功"); + } /// /// 申请进出电梯 diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs index 58b86921..7c998fb5 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs @@ -403,8 +403,9 @@ namespace Tnb.WarehouseMgr .OrderBy(policy.policy) .Select() - .Distinct() .ToListAsync(); + + items = items.Distinct().ToList(); return input.Size > 0 ? items.Take(input.Size).ToList() : items; } @@ -555,17 +556,19 @@ namespace Tnb.WarehouseMgr strs = getdic.Where(p => p.Key == code).First().Value; bool flag = await _redisData.HashExists(strs[0], strs[1]); - Logger.Information($"【Check】 判断CTU是否可以取货1 {code} {action} flag:{flag} "); + Logger.Information($"【Check】{action} 判断CTU是否可以取货1 获取{code}的标签{strs[1]}是否存在 结果为:{flag} "); if (!flag) { - return false; + throw new Exception($"【Check】{action} 判断CTU是否可以取货1 获取{code}的标签{strs[1]}是否存在 结果为:{flag} "); } string data = _redisData.GetHash(strs[0], strs[1]).Result; JObject? res = JsonConvert.DeserializeObject(data); bool result = res != null && res["Value"] != null ? res.Value("Value") : false; - Logger.Information($"【Check】 判断CTU是否可以取货2 {code} {action} result:{result} "); + Logger.Information($"【Check】{action} 判断CTU是否可以取货2 获取{code}的标签{strs[1]}信号值 结果为:{result} "); if (!result) - return false; + { + throw new Exception($"【Check】{action} 判断CTU是否可以取货2 获取{code}的标签{strs[1]}信号值 结果为:{result} "); + } return true; } else if (action == "UNLOAD")//放货 @@ -578,14 +581,16 @@ namespace Tnb.WarehouseMgr Logger.Information($"【Check】 判断CTU是否可以取货1 {code} {action} flag:{flag} "); if (!flag) { - return false; + throw new Exception($"【Check】 判断CTU是否可以取货1 {code} {action} flag:{flag} "); } string data = _redisData.GetHash(strs[0], strs[1]).Result; JObject? res = JsonConvert.DeserializeObject(data); bool result = res != null && res["Value"] != null ? res.Value("Value") : false; Logger.Information($"【Check】 判断CTU是否可以取货2 {code} {action} result:{result} "); if (!result) - return false; + { + throw new Exception($"【Check】 判断CTU是否可以取货2 {code} {action} result:{result} "); + } return true; } return false; @@ -997,6 +1002,7 @@ namespace Tnb.WarehouseMgr for (int i = 0, cnt = items.Count; i < cnt; i++) { items[i].id = SnowflakeIdHelper.NextId(); + items[i].create_time = DateTime.Now; items[i].status = WmsWareHouseConst.TASK_BILL_STATUS_DZX_ID; } int moveNum = itGroup.First().move_num; diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryBindService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryBindService.cs index 1135673a..b046f132 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryBindService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryBindService.cs @@ -164,6 +164,8 @@ namespace Tnb.WarehouseMgr WmsCarryCode.id = SnowflakeIdHelper.NextId(); WmsCarryCode.carry_id = carry.id; WmsCarryCode.is_out = 0; + WmsCarryCode.id = input.create_id; + WmsCarryCode.create_time = DateTime.Now; WmsCarryCodes.Add(WmsCarryCode); } int rows = 0; @@ -171,7 +173,7 @@ namespace Tnb.WarehouseMgr rows = await _db.Insertable(WmsCarryCodes).ExecuteCommandAsync(); if (rows == 0) { - throw new Exception($"接收到{input.details.Count}个条码 但是成功绑定的条码数量为0个!"); + throw new Exception($"物料列表为空,不能提交绑定,可能的原因;1.需要检查扫码设置(新PDA) 2.未扫到有效的二维码 详细信息:接收到{input.details.Count}个条码 但是成功绑定的条码数量为0个!"); } } catch (PostgresException ex)