生成电梯任务与判断一托延迟处理,生产入库调整
This commit is contained in:
@@ -2320,7 +2320,7 @@ namespace Tnb.ProductionMgr
|
||||
List<string> ids = prdVisionResultRecords.Select(x => x.id).ToList();
|
||||
|
||||
await db.Updateable<PrdVisionResultRecord>().SetColumns(x => x.status == 1).Where(x => ids.Contains(x.id)).ExecuteCommandAsync();
|
||||
await ReportInstock(new CheckCompleteInput()
|
||||
await ReportInstock(new CheckCompleteInput()
|
||||
{
|
||||
report_id = report.id,
|
||||
pqty = report.reported_qty.ParseToDecimal(),
|
||||
@@ -2397,15 +2397,14 @@ namespace Tnb.ProductionMgr
|
||||
wmsPrdInstockInput.type = prdMo.mo_type;
|
||||
wmsPrdInstockInput.create_id = report.create_id;
|
||||
wmsPrdInstockInput.prd_report_id = report.id;
|
||||
wmsPrdInstockInput.prdInstockDs = new List<WmsPrdInstockDInput>();
|
||||
wmsPrdInstockInput.prdInstockCodes = new List<WmsPrdInstockCodeInput>();
|
||||
wmsPrdInstockInput.prdInstockDs.Add(new WmsPrdInstockDInput()
|
||||
wmsPrdInstockInput.prdInstockD = new WmsPrdInstockDInput()
|
||||
{
|
||||
task_bill_code = prdMoTask.mo_task_code,
|
||||
warehouse_id = report.warehouse_id,
|
||||
startlocation_id = location.id,
|
||||
carry_id = wmsCarryH.id,
|
||||
});
|
||||
};
|
||||
|
||||
if (prdMoTask.schedule_type == 1)
|
||||
{
|
||||
|
||||
@@ -1941,7 +1941,6 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
|
||||
//WCS下发任务前会判断是否一托下 防止向WCS发送一托下指令和下发任务同步进行
|
||||
await s_elevatortaskWCSRequest.WaitAsync();
|
||||
|
||||
|
||||
var db_ElevatorTaskExceptionHandle = _wareHouseService.db_ElevatorTaskExceptionHandles[index];
|
||||
taskActions[index] = Task.Run(async () =>
|
||||
{
|
||||
@@ -1953,7 +1952,7 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
|
||||
.Where(r => r.area_code == area && r.act_end_date == null
|
||||
&& r.status != WmsWareHouseConst.TASK_BILL_STATUS_CANCEL_ID && r.status != WmsWareHouseConst.TASK_BILL_STATUS_COMPLE_ID).ToList();
|
||||
|
||||
LoggerElevatorTask.Information($"【ElevatorTaskExceptionHandle】检查到需要恢复/执行的电梯任务{elevatorTasks.Count}条 {string.Join(',', elevatorTasks.Select(x => x.bill_code))}");
|
||||
LoggerElevatorTask.Information($"【ElevatorTaskExceptionHandle】检查到需要恢复/执行的电梯{area}任务{elevatorTasks.Count}条 {string.Join(',', elevatorTasks.Select(x => x.bill_code))}");
|
||||
|
||||
if (elevatorTasks?.Count > 0)
|
||||
{
|
||||
@@ -1968,6 +1967,14 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
|
||||
var e = await _wareHouseService.FindElevatorFromPars(q);
|
||||
LoggerElevatorTask.Information($"【ElevatorTaskExceptionHandle】执行电梯任务时 根据任务单号获取电梯结果 {JsonConvert.SerializeObject(e)}");
|
||||
|
||||
// 存在叉车已放货完成电梯任务还没生成的情况,这种情况等待完成
|
||||
WmsElevatorH wmsElevator = await db_ElevatorTaskExceptionHandle.Queryable<WmsElevatorH>().Where(r => r.elevator_id == e.device_id).FirstAsync();
|
||||
if (wmsElevator.carry_count != elevatorTasks.Count)
|
||||
{
|
||||
throw new Exception($"电梯{e.elevator_code}内放货托盘为{wmsElevator.carry_count}托,已生成的电梯任务为{elevatorTasks.Count},需要等待电梯任务生成");
|
||||
}
|
||||
|
||||
|
||||
// 三、四号梯发货带两托货
|
||||
string[] doubleCarryRunElevators =
|
||||
{
|
||||
@@ -1976,7 +1983,7 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
|
||||
if (doubleCarryRunElevators.Contains(e.elevator_code) && wmsDistaskHs[0].end_floor == 1)
|
||||
{
|
||||
LoggerElevatorTask.Information($"【ElevatorTaskExceptionHandle】判断为三四号梯任务");
|
||||
LoggerElevatorTask.Information($"【ElevatorTaskExceptionHandle】现在有{group.Count()}托货");
|
||||
LoggerElevatorTask.Information($"【ElevatorTaskExceptionHandle】现在{e.elevator_code}有{group.Count()}托货");
|
||||
// 电梯内放置两托货呼叫电梯下
|
||||
if (group.Count() == 2)
|
||||
{
|
||||
@@ -1994,7 +2001,6 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
|
||||
else if (group.Count() == 1)
|
||||
{
|
||||
// 如果当前电梯没有执行中的任务 则呼叫电梯下
|
||||
|
||||
if (db_ElevatorTaskExceptionHandle.Queryable<WmsDistaskH>().Where(r => r.status != WmsWareHouseConst.TASK_BILL_STATUS_COMPLE_ID
|
||||
&& r.status != WmsWareHouseConst.TASK_BILL_STATUS_CANCEL_ID && r.endlocation_id == wmsDistaskHs[0].startlocation_id).Count() == 0)
|
||||
{
|
||||
@@ -2003,7 +2009,6 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
|
||||
wmsDistaskHs[0].device_id = e.device_id;
|
||||
}
|
||||
|
||||
|
||||
LoggerElevatorTask.Information($"【ElevatorTaskExceptionHandle】呼叫电梯 {e.elevator_code}");
|
||||
await _wareHouseService.ExecuteTargetFloorTask(wmsDistaskHs, db_ElevatorTaskExceptionHandle);
|
||||
LoggerElevatorTask.Information($"【ElevatorTaskExceptionHandle】呼叫电梯 {e.elevator_code}执行完成");
|
||||
@@ -2034,8 +2039,8 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
|
||||
}
|
||||
catch (ObjectDisposedException ex)
|
||||
{
|
||||
LoggerElevatorTask.LogError($"【ElevatorTaskExceptionHandle】 数据库连接异常:{ex.Message}");
|
||||
LoggerElevatorTask.LogError($"【ElevatorTaskExceptionHandle】 数据库连接异常:{ex.StackTrace}");
|
||||
LoggerElevatorTask.LogWarning($"【ElevatorTaskExceptionHandle】 数据库连接异常:{ex.Message}");
|
||||
LoggerElevatorTask.LogWarning($"【ElevatorTaskExceptionHandle】 数据库连接异常:{ex.StackTrace}");
|
||||
if (ex.Source == "Npgsql")
|
||||
db_ElevatorTaskExceptionHandle = _repository.AsSugarClient().CopyNew();
|
||||
}
|
||||
@@ -2373,15 +2378,7 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
|
||||
await db_Floor4MJX2MJC.Updateable<BasLocation>().SetColumns(r => new BasLocation { is_lock = 1 }).Where(r => r.id == startlocation.id).ExecuteCommandAsync();
|
||||
//锁定终点库位
|
||||
await db_Floor4MJX2MJC.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, wmsCarryH.id, wmsCarryH.carry_code, LoggerFloor4MJX2MJC, db_Floor4MJX2MJC);
|
||||
if (!result_createPretask)
|
||||
{
|
||||
LoggerFloor4MJX2MJC.LogWarning($"【四楼待灭菌线到灭菌仓】 {startlocation.location_code} 到 {endlocation.location_code} 预任务生成失败");
|
||||
throw new Exception($"【四楼待灭菌线到灭菌仓】 {startlocation.location_code} 到 {endlocation.location_code} 预任务生成失败");
|
||||
}
|
||||
LoggerFloor4MJX2MJC.LogInformation($"【四楼待灭菌线到灭菌仓】 {startlocation.location_code} 到 {endlocation.location_code} 预任务生成成功");
|
||||
|
||||
|
||||
DateTime dateTime = DateTime.Now;
|
||||
WmsSterilizationInstockH wmsSterilizationInstockH = new WmsSterilizationInstockH();
|
||||
wmsSterilizationInstockH.carry_id = wmsCarryH.id;
|
||||
@@ -2402,6 +2399,15 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
|
||||
else
|
||||
LoggerFloor4MJX2MJC.LogWarning($"【四楼待灭菌线到灭菌仓】 灭菌入库记录生成失败");
|
||||
|
||||
bool result_createPretask = await createPretask(startlocation.id, endlocation.id, wmsCarryH.id, wmsCarryH.carry_code, LoggerFloor4MJX2MJC, db_Floor4MJX2MJC, WmsWareHouseConst.BIZTYPE_WMSSTERILIZATIONINSTOCKCH_ID, "", wmsSterilizationInstockH.id);
|
||||
if (!result_createPretask)
|
||||
{
|
||||
LoggerFloor4MJX2MJC.LogWarning($"【四楼待灭菌线到灭菌仓】 {startlocation.location_code} 到 {endlocation.location_code} 预任务生成失败");
|
||||
throw new Exception($"【四楼待灭菌线到灭菌仓】 {startlocation.location_code} 到 {endlocation.location_code} 预任务生成失败");
|
||||
}
|
||||
LoggerFloor4MJX2MJC.LogInformation($"【四楼待灭菌线到灭菌仓】 {startlocation.location_code} 到 {endlocation.location_code} 预任务生成成功");
|
||||
|
||||
|
||||
}
|
||||
await db_Floor4MJX2MJC.Ado.CommitTranAsync();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user