同步料架的载具位置,bug处理,日志完善

This commit is contained in:
2024-06-26 14:27:32 +08:00
parent 4ff5b9b9d7
commit 1089bd7f5a
4 changed files with 33 additions and 12 deletions

View File

@@ -213,7 +213,7 @@ namespace Tnb.ProductionMgr
{ {
LoggerSSX.LogInformation($@"【定时任务CheckGet】 {key}->{strs[0]} {strs[2]} LoggerSSX.LogInformation($@"【定时任务CheckGet】 {key}->{strs[0]} {strs[2]}
采集结果:{$@"(wms_distask_h) (carry_code){coderesult} 采集结果:{$@"(wms_distask_h) (carry_code){coderesult}
(status)(26126853976101) (extras) (status)(26126853976101) (extras) (WCS系统中存在载具{coderesult})
select extras,* from wms_distask_h select extras,* from wms_distask_h
where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STATUS_YXD_ID}' "}"); where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STATUS_YXD_ID}' "}");
@@ -510,7 +510,7 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
LoggerBGWCarrySupplement.LogInformation($"【BGWCarrySupplementtimer】锁定起点库位 开始生成 {startLocation.location_code} 到 {endLocation.location_code} 预任务 "); LoggerBGWCarrySupplement.LogInformation($"【BGWCarrySupplementtimer】锁定起点库位 开始生成 {startLocation.location_code} 到 {endLocation.location_code} 预任务 ");
bool result_createPretask = await createPretask(startLocation.id, endLocation.id, "", "", LoggerBGWCarrySupplement); bool result_createPretask = await createPretask(startLocation.id, endLocation.id, "", "", LoggerBGWCarrySupplement, db_BGWCarrySupplementtimer);
if (!result_createPretask) if (!result_createPretask)
{ {
LoggerBGWCarrySupplement.LogWarning($"【BGWCarrySupplementtimer】 {startLocation.location_code} 到 {endLocation.location_code} 预任务生成失败 "); LoggerBGWCarrySupplement.LogWarning($"【BGWCarrySupplementtimer】 {startLocation.location_code} 到 {endLocation.location_code} 预任务生成失败 ");
@@ -599,7 +599,7 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
//锁定终点库位 //锁定终点库位
await db_YCLGLDPJInstocktimer.Updateable<BasLocation>().SetColumns(r => new BasLocation { is_lock = 1 }).Where(r => r.id == endLocation.id).ExecuteCommandAsync(); await db_YCLGLDPJInstocktimer.Updateable<BasLocation>().SetColumns(r => new BasLocation { is_lock = 1 }).Where(r => r.id == endLocation.id).ExecuteCommandAsync();
bool result_createPretask = await createPretask(startLocation.id, endLocation.id, "", "", LoggerYCLGLDPJInstock); bool result_createPretask = await createPretask(startLocation.id, endLocation.id, "", "", LoggerYCLGLDPJInstock, db_YCLGLDPJInstocktimer);
if (!result_createPretask) if (!result_createPretask)
{ {
LoggerYCLGLDPJInstock.LogWarning($"【YCLGLDPJInstock】 {startLocation.location_code} 到 {endLocation.location_code} 预任务生成失败"); LoggerYCLGLDPJInstock.LogWarning($"【YCLGLDPJInstock】 {startLocation.location_code} 到 {endLocation.location_code} 预任务生成失败");
@@ -684,7 +684,7 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
//锁定终点库位 //锁定终点库位
await db_YCLWXDPJInstocktimer.Updateable<BasLocation>().SetColumns(r => new BasLocation { is_lock = 1 }).Where(r => r.id == endLocation.id).ExecuteCommandAsync(); await db_YCLWXDPJInstocktimer.Updateable<BasLocation>().SetColumns(r => new BasLocation { is_lock = 1 }).Where(r => r.id == endLocation.id).ExecuteCommandAsync();
bool result_createPretask = await createPretask(startLocation.id, endLocation.id, "", "", LoggerYCLGLDPJInstock); bool result_createPretask = await createPretask(startLocation.id, endLocation.id, "", "", LoggerYCLGLDPJInstock, db_YCLWXDPJInstocktimer);
if (!result_createPretask) if (!result_createPretask)
{ {
LoggerYCLGLDPJInstock.LogWarning($"【YCLWXDPJInstock】 {startLocation.location_code} 到 {endLocation.location_code} 预任务生成失败"); LoggerYCLGLDPJInstock.LogWarning($"【YCLWXDPJInstock】 {startLocation.location_code} 到 {endLocation.location_code} 预任务生成失败");
@@ -1089,7 +1089,7 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
LoggerFloor2RackDelivery.LogInformation($"【送空托到上升降区】 开始生成预任务 起点{startLocation.location_code} 终点{wmsMechanicalArmH.location_code} 料架 {targetCarry.carry_code}"); LoggerFloor2RackDelivery.LogInformation($"【送空托到上升降区】 开始生成预任务 起点{startLocation.location_code} 终点{wmsMechanicalArmH.location_code} 料架 {targetCarry.carry_code}");
bool result = await createPretask(startLocation.id, wmsMechanicalArmH.location_id, targetCarry.id, targetCarry.carry_code, LoggerFloor2RackDelivery); bool result = await createPretask(startLocation.id, wmsMechanicalArmH.location_id, targetCarry.id, targetCarry.carry_code, LoggerFloor2RackDelivery, db_Floor2timer送空托到上升降区);
if (!result) if (!result)
{ {
LoggerFloor2RackDelivery.LogInformation($"【送空托到上升降区】 未成功生成预任务 起点{startLocation.location_code} 终点{wmsMechanicalArmH.location_code} 料架 {targetCarry.carry_code}"); LoggerFloor2RackDelivery.LogInformation($"【送空托到上升降区】 未成功生成预任务 起点{startLocation.location_code} 终点{wmsMechanicalArmH.location_code} 料架 {targetCarry.carry_code}");
@@ -1244,7 +1244,7 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
LoggerFloor2RackDelivery.LogInformation($"【送满托到下升降区】 开始生成预任务 起点{startLocation.location_code} 终点{wmsMechanicalArmH.location_code} 料架 {targetCarry.carry_code}"); LoggerFloor2RackDelivery.LogInformation($"【送满托到下升降区】 开始生成预任务 起点{startLocation.location_code} 终点{wmsMechanicalArmH.location_code} 料架 {targetCarry.carry_code}");
bool result = await createPretask(startLocation.id, wmsMechanicalArmH.location_id, targetCarry.id, targetCarry.carry_code, LoggerFloor2RackDelivery); bool result = await createPretask(startLocation.id, wmsMechanicalArmH.location_id, targetCarry.id, targetCarry.carry_code, LoggerFloor2RackDelivery, db_Floor2timer送满托到下升降区);
if (!result) if (!result)
{ {
LoggerFloor2RackDelivery.LogInformation($"【送满托到下升降区】 未成功生成预任务 起点{startLocation.location_code} 终点{wmsMechanicalArmH.location_code} 料架 {targetCarry.carry_code}"); LoggerFloor2RackDelivery.LogInformation($"【送满托到下升降区】 未成功生成预任务 起点{startLocation.location_code} 终点{wmsMechanicalArmH.location_code} 料架 {targetCarry.carry_code}");
@@ -1345,7 +1345,7 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
LoggerFloor2RackDelivery.LogInformation($"【移走上升降区满托的料架】 开始执行预任务生成: 料架区为{wmsMechanicalArmH.name}{wmsMechanicalArmH.stackingposition} 料架为{wmsMechanicalArmH.rackcode}"); LoggerFloor2RackDelivery.LogInformation($"【移走上升降区满托的料架】 开始执行预任务生成: 料架区为{wmsMechanicalArmH.name}{wmsMechanicalArmH.stackingposition} 料架为{wmsMechanicalArmH.rackcode}");
bool result = await createPretask(wmsMechanicalArmH.location_id, endLocation.id, wmsMechanicalArmH.rackid, wmsMechanicalArmH.rackcode, LoggerFloor2RackDelivery); bool result = await createPretask(wmsMechanicalArmH.location_id, endLocation.id, wmsMechanicalArmH.rackid, wmsMechanicalArmH.rackcode, LoggerFloor2RackDelivery, db_Floor2timer移走上升降区未生成预任务且满托的料架);
if (!result) if (!result)
{ {
LoggerFloor2RackDelivery.LogError($"【移走上升降区满托的料架】 未成功生成预任务 起点{wmsMechanicalArmH.location_code} 终点{endLocation.location_code} 料架 {wmsMechanicalArmH.rackcode}"); LoggerFloor2RackDelivery.LogError($"【移走上升降区满托的料架】 未成功生成预任务 起点{wmsMechanicalArmH.location_code} 终点{endLocation.location_code} 料架 {wmsMechanicalArmH.rackcode}");
@@ -1454,7 +1454,7 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
LoggerFloor2RackDelivery.LogInformation($"【移走下升降区空托的料架】 开始执行预任务生成: 料架区为{wmsMechanicalArmH.name}{wmsMechanicalArmH.stackingposition} 料架为{wmsMechanicalArmH.rackcode}"); LoggerFloor2RackDelivery.LogInformation($"【移走下升降区空托的料架】 开始执行预任务生成: 料架区为{wmsMechanicalArmH.name}{wmsMechanicalArmH.stackingposition} 料架为{wmsMechanicalArmH.rackcode}");
bool result = await createPretask(wmsMechanicalArmH.location_id, endLocation.id, wmsMechanicalArmH.rackid, wmsMechanicalArmH.rackcode, LoggerFloor2RackDelivery); bool result = await createPretask(wmsMechanicalArmH.location_id, endLocation.id, wmsMechanicalArmH.rackid, wmsMechanicalArmH.rackcode, LoggerFloor2RackDelivery, db_Floor2timer移走下升降区未生成预任务且空托的料架);
if (!result) if (!result)
{ {
LoggerFloor2RackDelivery.LogInformation($"【移走下升降区空托的料架】 未成功生成预任务 起点{wmsMechanicalArmH.location_code} 终点{endLocation.location_code} 料架 {wmsMechanicalArmH.rackcode}"); LoggerFloor2RackDelivery.LogInformation($"【移走下升降区空托的料架】 未成功生成预任务 起点{wmsMechanicalArmH.location_code} 终点{endLocation.location_code} 料架 {wmsMechanicalArmH.rackcode}");
@@ -1481,7 +1481,7 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
} }
// 上下升降机生成预任务(补充料架、上升降机取货到料架、上升降机满托运走,下升降机拿货到输送线、下升降机空托运走) // 上下升降机生成预任务(补充料架、上升降机取货到料架、上升降机满托运走,下升降机拿货到输送线、下升降机空托运走)
private async Task<bool> createPretask(string startlocation_id, string endlocation_id, string carry_id, string carry_code, ILogger logger) private async Task<bool> createPretask(string startlocation_id, string endlocation_id, string carry_id, string carry_code, ILogger logger, ISqlSugarClient dbConn)
{ {
CommonCreatePretaskInput commonCreatePretaskInput = new CommonCreatePretaskInput(); CommonCreatePretaskInput commonCreatePretaskInput = new CommonCreatePretaskInput();
commonCreatePretaskInput.startlocation_id = startlocation_id; commonCreatePretaskInput.startlocation_id = startlocation_id;
@@ -1494,7 +1494,7 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
commonCreatePretaskInput.isExcuteMission = false; commonCreatePretaskInput.isExcuteMission = false;
logger.LogInformation($"开始执行 GenPreTask {JsonConvert.SerializeObject(commonCreatePretaskInput)}"); logger.LogInformation($"开始执行 GenPreTask {JsonConvert.SerializeObject(commonCreatePretaskInput)}");
var res = await _wareHouseService.CommonCreatePretask(commonCreatePretaskInput); var res = await _wareHouseService.CommonCreatePretask(commonCreatePretaskInput, dbConn);
if (res.code == JNPF.Common.Enums.HttpStatusCode.OK) if (res.code == JNPF.Common.Enums.HttpStatusCode.OK)
{ {
logger.LogInformation($"GenPreTask 结果 {JsonConvert.SerializeObject(res)}"); logger.LogInformation($"GenPreTask 结果 {JsonConvert.SerializeObject(res)}");

View File

@@ -20,6 +20,8 @@ namespace Tnb.WarehouseMgr
public async Task Do(WareHouseUpInput input) public async Task Do(WareHouseUpInput input)
{ {
if (string.IsNullOrEmpty(input.bizTypeId))
return;
if (_serviceMap.ContainsKey(input.bizTypeId)) if (_serviceMap.ContainsKey(input.bizTypeId))
{ {
await _serviceMap[input.bizTypeId].ModifyAsync(input); await _serviceMap[input.bizTypeId].ModifyAsync(input);

View File

@@ -2068,6 +2068,20 @@ namespace Tnb.WarehouseMgr
location_code = multiList[i].endlocation_code location_code = multiList[i].endlocation_code
}; };
string endLocId = multiList[i].endlocation_id; string endLocId = multiList[i].endlocation_id;
// 同步料架下的载具位置
if (carry.carrystd_id == WmsWareHouseConst.CARRY_LJSTD_ID)
{
List<WmsCarryH> carrys = _db.Queryable<WmsCarryD>().Where(r => r.carry_id == carry.id)
.InnerJoin<WmsCarryH>((a, b) => a.membercarry_id == b.id).Select((a, b) => b).ToList();
carrys.ForEach(r =>
{
r.location_id = carry.location_id;
r.location_code = carry.location_code;
carryIts.Add(r);
});
}
WmsCarryCode carryCode = new() WmsCarryCode carryCode = new()
{ {
warehouse_id = locWhIdMap.ContainsKey(endLocId) ? locWhIdMap[endLocId].ToString() : "", warehouse_id = locWhIdMap.ContainsKey(endLocId) ? locWhIdMap[endLocId].ToString() : "",
@@ -2796,7 +2810,10 @@ namespace Tnb.WarehouseMgr
var db = _db; var db = _db;
if (dbConn != null) if (dbConn != null)
db = dbConn; db = dbConn;
else
db = _db.CopyNew();
{ {
await s_taskCommonCreatePretask.WaitAsync(); await s_taskCommonCreatePretask.WaitAsync();
Logger.LogInformation($"【createPretask】 接收到请求 参数:{JsonConvert.SerializeObject(input)}"); Logger.LogInformation($"【createPretask】 接收到请求 参数:{JsonConvert.SerializeObject(input)}");
@@ -2885,7 +2902,6 @@ namespace Tnb.WarehouseMgr
WmsPointH? sPoint = it.FirstOrDefault(); WmsPointH? sPoint = it.FirstOrDefault();
WmsPointH? ePoint = it.LastOrDefault(); WmsPointH? ePoint = it.LastOrDefault();
preTask = new() preTask = new()
{ {
org_id = _userManager.User?.OrganizeId, org_id = _userManager.User?.OrganizeId,

View File

@@ -245,6 +245,7 @@ namespace Tnb.WarehouseMgr
await _runService.Create(templateEntity, visualDevModelCrInput); await _runService.Create(templateEntity, visualDevModelCrInput);
await _db.Ado.CommitTranAsync(); await _db.Ado.CommitTranAsync();
Logger.LogError($"【CarryBind】 {input.membercarry_code}成功绑定到{input.carry_code}");
} }
else else
{ {
@@ -256,6 +257,8 @@ namespace Tnb.WarehouseMgr
} }
catch (Exception ex) catch (Exception ex)
{ {
Logger.LogError($"【CarryBind】 {ex.Message}");
Logger.LogError($"【CarryBind】 {ex.StackTrace}");
await _db.Ado.RollbackTranAsync(); await _db.Ado.RollbackTranAsync();
return await ToApiResult(JNPF.Common.Enums.HttpStatusCode.InternalServerError, ex.Message); return await ToApiResult(JNPF.Common.Enums.HttpStatusCode.InternalServerError, ex.Message);
} }