二楼物料呼叫取任务单添加条件

This commit is contained in:
2024-06-26 16:56:52 +08:00
parent ade240d8cf
commit c1c9000e0c
4 changed files with 31 additions and 21 deletions

View File

@@ -443,6 +443,7 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
Dictionary<string, string[]> getdic = new Dictionary<string, string[]>(); Dictionary<string, string[]> getdic = new Dictionary<string, string[]>();
getdic.Add("YCLCKBGW", new string[] { "CP8", "AllowPutEmptyBox1" }); getdic.Add("YCLCKBGW", new string[] { "CP8", "AllowPutEmptyBox1" });
await db_BGWCarrySupplementtimer.Ado.BeginTranAsync();
foreach (var key in getdic.Keys) foreach (var key in getdic.Keys)
{ {
var strs = getdic.Where(p => p.Key == key).First().Value; var strs = getdic.Where(p => p.Key == key).First().Value;
@@ -525,11 +526,14 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
_ = _wareHouseService.GenTaskExecute(); _ = _wareHouseService.GenTaskExecute();
} }
} }
await db_BGWCarrySupplementtimer.Ado.CommitTranAsync();
} }
catch (Exception ex) catch (Exception ex)
{ {
Console.WriteLine("【BGWCarrySupplement】" + ex.Message); Console.WriteLine("【BGWCarrySupplement】" + ex.Message);
LoggerBGWCarrySupplement.LogInformation($"【BGWCarrySupplementtimer】 八工位空托盘补充发生异常:{ex}"); LoggerBGWCarrySupplement.LogInformation($"【BGWCarrySupplementtimer】 八工位空托盘补充发生异常:{ex}");
await db_BGWCarrySupplementtimer.Ado.RollbackTranAsync();
} }
finally finally
{ {
@@ -558,6 +562,7 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
Dictionary<string, string[]> getdic = new Dictionary<string, string[]>(); Dictionary<string, string[]> getdic = new Dictionary<string, string[]>();
getdic.Add("SGW-YCL", new string[] { "CP3-5", "AllowGetFullBox" }); getdic.Add("SGW-YCL", new string[] { "CP3-5", "AllowGetFullBox" });
await db_YCLGLDPJInstocktimer.Ado.BeginTranAsync();
foreach (var key in getdic.Keys) foreach (var key in getdic.Keys)
{ {
var strs = getdic.Where(p => p.Key == key).First().Value; var strs = getdic.Where(p => p.Key == key).First().Value;
@@ -612,11 +617,13 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
_ = _wareHouseService.GenTaskExecute(); _ = _wareHouseService.GenTaskExecute();
} }
} }
await db_YCLGLDPJInstocktimer.Ado.CommitTranAsync();
} }
catch (Exception ex) catch (Exception ex)
{ {
Console.WriteLine("【YCLGLDPJInstock】" + ex.Message); Console.WriteLine("【YCLGLDPJInstock】" + ex.Message);
LoggerYCLGLDPJInstock.LogInformation($"【YCLGLDPJInstock】 三工位叠盘机空托入库发生异常:{ex}"); LoggerYCLGLDPJInstock.LogInformation($"【YCLGLDPJInstock】 三工位叠盘机空托入库发生异常:{ex}");
await db_YCLGLDPJInstocktimer.Ado.RollbackTranAsync();
} }
finally finally
{ {
@@ -645,6 +652,7 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
Dictionary<string, string[]> getdic = new Dictionary<string, string[]>(); Dictionary<string, string[]> getdic = new Dictionary<string, string[]>();
getdic.Add("未定", new string[] { "CP3-3", "AllowGetFullBox" }); getdic.Add("未定", new string[] { "CP3-3", "AllowGetFullBox" });
await db_YCLWXDPJInstocktimer.Ado.BeginTranAsync();
foreach (var key in getdic.Keys) foreach (var key in getdic.Keys)
{ {
var strs = getdic.Where(p => p.Key == key).First().Value; var strs = getdic.Where(p => p.Key == key).First().Value;
@@ -696,10 +704,12 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
_ = _wareHouseService.GenTaskExecute(); _ = _wareHouseService.GenTaskExecute();
} }
} }
await db_YCLWXDPJInstocktimer.Ado.CommitTranAsync();
} }
catch (Exception ex) catch (Exception ex)
{ {
LoggerYCLGLDPJInstock.LogInformation($"【YCLWXDPJInstock】 外协叠盘机空托入库发生异常:{ex}"); LoggerYCLGLDPJInstock.LogInformation($"【YCLWXDPJInstock】 外协叠盘机空托入库发生异常:{ex}");
await db_YCLWXDPJInstocktimer.Ado.RollbackTranAsync();
} }
finally finally
{ {
@@ -1041,7 +1051,7 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
return; return;
} }
//await db.BeginTranAsync(); await db_Floor2timer送空托到上升降区.Ado.BeginTranAsync();
// 料架区 // 料架区
foreach (WmsMechanicalArmH wmsMechanicalArmH in WmsMechanicalArmHs) foreach (WmsMechanicalArmH wmsMechanicalArmH in WmsMechanicalArmHs)
{ {
@@ -1096,14 +1106,14 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
throw new Exception($"【送空托到上升降区】 未成功生成预任务 起点{startLocation.location_code} 终点{wmsMechanicalArmH.location_code} 料架 {wmsMechanicalArmH.rackcode}"); throw new Exception($"【送空托到上升降区】 未成功生成预任务 起点{startLocation.location_code} 终点{wmsMechanicalArmH.location_code} 料架 {wmsMechanicalArmH.rackcode}");
} }
} }
//await db.CommitTranAsync(); await db_Floor2timer送空托到上升降区.Ado.CommitTranAsync();
} }
} }
catch (Exception ex) catch (Exception ex)
{ {
LoggerFloor2RackDelivery.LogInformation($"【送空托到上升降区】 {ex.Message}"); LoggerFloor2RackDelivery.LogInformation($"【送空托到上升降区】 {ex.Message}");
LoggerFloor2RackDelivery.LogInformation($"【送空托到上升降区】 {ex.StackTrace}"); LoggerFloor2RackDelivery.LogInformation($"【送空托到上升降区】 {ex.StackTrace}");
//await db.RollbackTranAsync(); await db_Floor2timer送空托到上升降区.Ado.RollbackTranAsync();
} }
finally finally
{ {
@@ -1164,7 +1174,7 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
return; return;
} }
//await db.BeginTranAsync(); await db_Floor2timer送满托到下升降区.Ado.BeginTranAsync();
// 料架区 // 料架区
foreach (WmsMechanicalArmH wmsMechanicalArmH in WmsMechanicalArmHs) foreach (WmsMechanicalArmH wmsMechanicalArmH in WmsMechanicalArmHs)
{ {
@@ -1251,14 +1261,14 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
continue; continue;
} }
} }
//await db.CommitTranAsync(); await db_Floor2timer送满托到下升降区.Ado.CommitTranAsync();
} }
} }
catch (Exception ex) catch (Exception ex)
{ {
LoggerFloor2RackDelivery.LogInformation($"【送满托到下升降区】 {ex.Message}"); LoggerFloor2RackDelivery.LogInformation($"【送满托到下升降区】 {ex.Message}");
LoggerFloor2RackDelivery.LogInformation($"【送满托到下升降区】 {ex.StackTrace}"); LoggerFloor2RackDelivery.LogInformation($"【送满托到下升降区】 {ex.StackTrace}");
//await db.RollbackTranAsync(); await db_Floor2timer送满托到下升降区.Ado.RollbackTranAsync();
} }
finally finally
{ {
@@ -1310,6 +1320,7 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
//await db.BeginTranAsync(); //await db.BeginTranAsync();
// 读取上升降机的左右料架区配置 // 读取上升降机的左右料架区配置
await db_Floor2timer移走上升降区未生成预任务且满托的料架.Ado.BeginTranAsync();
List<WmsMechanicalArmH> WmsMechanicalArmHs = db_Floor2timer移走上升降区未生成预任务且满托的料架.Queryable<WmsMechanicalArmH>().Where(r => r.stackingcount == r.maxnum && r.maxnum != 0 && !string.IsNullOrEmpty(r.rackcode) && r.iscreatepretask == 0 && configs_upMachine.Contains(r.name) && r.mechanicalconfirm == 1).ToList(); List<WmsMechanicalArmH> WmsMechanicalArmHs = db_Floor2timer移走上升降区未生成预任务且满托的料架.Queryable<WmsMechanicalArmH>().Where(r => r.stackingcount == r.maxnum && r.maxnum != 0 && !string.IsNullOrEmpty(r.rackcode) && r.iscreatepretask == 0 && configs_upMachine.Contains(r.name) && r.mechanicalconfirm == 1).ToList();
@@ -1354,14 +1365,14 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
LoggerFloor2RackDelivery.LogInformation($"【移走上升降区满托的料架】 成功生成预任务 {result}"); LoggerFloor2RackDelivery.LogInformation($"【移走上升降区满托的料架】 成功生成预任务 {result}");
} }
//await db.CommitTranAsync(); await db_Floor2timer移走上升降区未生成预任务且满托的料架.Ado.CommitTranAsync();
} }
} }
catch (Exception ex) catch (Exception ex)
{ {
LoggerFloor2RackDelivery.LogInformation($"【移走上升降区未生成预任务且满托的料架】 {ex.Message}"); LoggerFloor2RackDelivery.LogInformation($"【移走上升降区未生成预任务且满托的料架】 {ex.Message}");
LoggerFloor2RackDelivery.LogInformation($"【移走上升降区未生成预任务且满托的料架】 {ex.StackTrace}"); LoggerFloor2RackDelivery.LogInformation($"【移走上升降区未生成预任务且满托的料架】 {ex.StackTrace}");
//await db.RollbackTranAsync(); await db_Floor2timer移走上升降区未生成预任务且满托的料架.Ado.RollbackTranAsync();
} }
finally finally
{ {
@@ -1414,6 +1425,7 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
//await db.BeginTranAsync(); //await db.BeginTranAsync();
// 读取下升降机的左右料架区配置 // 读取下升降机的左右料架区配置
await db_Floor2timer移走下升降区未生成预任务且空托的料架.Ado.BeginTranAsync();
List<WmsMechanicalArmH> WmsMechanicalArmHs = db_Floor2timer移走下升降区未生成预任务且空托的料架.Queryable<WmsMechanicalArmH>().Where(r => !string.IsNullOrEmpty(r.rackcode) && r.iscreatepretask == 0 && configs_upMachine.Contains(r.name)).ToList(); List<WmsMechanicalArmH> WmsMechanicalArmHs = db_Floor2timer移走下升降区未生成预任务且空托的料架.Queryable<WmsMechanicalArmH>().Where(r => !string.IsNullOrEmpty(r.rackcode) && r.iscreatepretask == 0 && configs_upMachine.Contains(r.name)).ToList();
foreach (WmsMechanicalArmH wmsMechanicalArmH in WmsMechanicalArmHs) foreach (WmsMechanicalArmH wmsMechanicalArmH in WmsMechanicalArmHs)
@@ -1461,14 +1473,14 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
continue; continue;
} }
} }
//await db.CommitTranAsync(); await db_Floor2timer移走下升降区未生成预任务且空托的料架.Ado.CommitTranAsync();
} }
} }
catch (Exception ex) catch (Exception ex)
{ {
LoggerFloor2RackDelivery.LogInformation($"【移走下升降区空托的料架】 {ex.Message}"); LoggerFloor2RackDelivery.LogInformation($"【移走下升降区空托的料架】 {ex.Message}");
LoggerFloor2RackDelivery.LogInformation($"【移走下升降区空托的料架】 {ex.StackTrace}"); LoggerFloor2RackDelivery.LogInformation($"【移走下升降区空托的料架】 {ex.StackTrace}");
//await db.RollbackTranAsync(); await db_Floor2timer移走下升降区未生成预任务且空托的料架.Ado.RollbackTranAsync();
} }
finally finally
{ {

View File

@@ -599,9 +599,9 @@ namespace Tnb.WarehouseMgr
} }
catch (Exception ex) catch (Exception ex)
{ {
Logger.Error("【TaskCallback】 任务状态上报出现错误", ex); Logger.Error("【TaskCallback】 任务状态上报出现错误", ex.Message);
Logger.Error("【TaskCallback】 任务状态上报错误堆栈信息", ex.StackTrace); Logger.Error("【TaskCallback】 任务状态上报错误堆栈信息", ex.StackTrace);
return await ToApiResult(HttpStatusCode.InternalServerError, "请重试!"); return await ToApiResult(HttpStatusCode.InternalServerError, "请重试!" + ex.Message);
throw; throw;
} }
finally finally

View File

@@ -2810,8 +2810,6 @@ namespace Tnb.WarehouseMgr
var db = _db; var db = _db;
if (dbConn != null) if (dbConn != null)
db = dbConn; db = dbConn;
else
db = _db.CopyNew();
{ {

View File

@@ -467,16 +467,16 @@ namespace Tnb.WarehouseMgr
// 获取任务单 // 获取任务单
List<PrdMoTask> organizeEntityCXs = _db.Queryable<PrdMoTask>().Where(r => r.workline_id == organizeEntityCX.Id && r.mo_task_status == DictConst.InProgressEnCode).ToList(); List<PrdMoTask> organizeEntityCXs = _db.Queryable<PrdMoTask>().Where(r => r.workline_id == organizeEntityCX.Id && r.mo_task_status == DictConst.InProgressEnCode && !string.IsNullOrEmpty(r.parent_id)).ToList();
if (organizeEntityCXs.Count > 1) if (organizeEntityCXs.Count > 1)
{ {
Logger.LogWarning($"【DistributeHCC】工位{organizeEntity.EnCode}的上级{organizeEntityCX.EnCode}对应的进行中的任务单不唯一,请检查!"); Logger.LogWarning($"【DistributeHCC】工位{organizeEntity.EnCode}的上级{organizeEntityCX.EnCode}对应的进行中的任务单不唯一(需要有parentid),请检查!");
throw new AppFriendlyException($"【DistributeHCC】工位{organizeEntity.EnCode}的上级{organizeEntityCX.EnCode}对应的进行中的任务单不唯一,请检查!", 500); throw new AppFriendlyException($"【DistributeHCC】工位{organizeEntity.EnCode}的上级{organizeEntityCX.EnCode}对应的进行中的任务单不唯一,请检查!", 500);
} }
if (organizeEntityCXs.Count == 0) if (organizeEntityCXs.Count == 0)
{ {
Logger.LogWarning($"【DistributeHCC】未找到工位{organizeEntity.EnCode}的上级{organizeEntityCX.EnCode}对应的进行中的任务单,请检查!"); Logger.LogWarning($"【DistributeHCC】未找到工位{organizeEntity.EnCode}的上级{organizeEntityCX.EnCode}对应的进行中的任务单(需要有parentid,请检查!");
throw new AppFriendlyException($"【DistributeHCC】未找到工位{organizeEntity.EnCode}的上级{organizeEntityCX.EnCode}对应的进行中的任务单,请检查!", 500); throw new AppFriendlyException($"【DistributeHCC】未找到工位{organizeEntity.EnCode}的上级{organizeEntityCX.EnCode}对应的进行中的任务单),请检查!", 500);
} }
PrdMoTask prdMoTask = organizeEntityCXs.First(); PrdMoTask prdMoTask = organizeEntityCXs.First();
@@ -782,15 +782,15 @@ namespace Tnb.WarehouseMgr
// 获取任务单 // 获取任务单
List<PrdMoTask> organizeEntityCXs = _db.Queryable<PrdMoTask>().Where(r => r.workline_id == organizeEntityCX.Id && r.mo_task_status == DictConst.InProgressEnCode).ToList(); List<PrdMoTask> organizeEntityCXs = _db.Queryable<PrdMoTask>().Where(r => r.workline_id == organizeEntityCX.Id && r.mo_task_status == DictConst.InProgressEnCode && !string.IsNullOrEmpty(r.parent_id)).ToList();
if (organizeEntityCXs.Count > 1) if (organizeEntityCXs.Count > 1)
{ {
Logger.LogWarning($"【CallRackToProductionLine】工位{organizeEntity.EnCode}的上级{organizeEntityCX.EnCode}对应的进行中的任务单不唯一,请检查!"); Logger.LogWarning($"【CallRackToProductionLine】工位{organizeEntity.EnCode}的上级{organizeEntityCX.EnCode}对应的进行中的任务单不唯一(需要有parentid),请检查!");
throw new AppFriendlyException($"【CallRackToProductionLine】工位{organizeEntity.EnCode}的上级{organizeEntityCX.EnCode}对应的进行中的任务单不唯一,请检查!", 500); throw new AppFriendlyException($"【CallRackToProductionLine】工位{organizeEntity.EnCode}的上级{organizeEntityCX.EnCode}对应的进行中的任务单不唯一,请检查!", 500);
} }
if (organizeEntityCXs.Count == 0) if (organizeEntityCXs.Count == 0)
{ {
Logger.LogWarning($"【CallRackToProductionLine】未找到工位{organizeEntity.EnCode}的上级{organizeEntityCX.EnCode}对应的进行中的任务单,请检查!"); Logger.LogWarning($"【CallRackToProductionLine】未找到工位{organizeEntity.EnCode}的上级{organizeEntityCX.EnCode}对应的进行中的任务单(需要有parentid),请检查!");
throw new AppFriendlyException($"【CallRackToProductionLine】未找到工位{organizeEntity.EnCode}的上级{organizeEntityCX.EnCode}对应的进行中的任务单,请检查!", 500); throw new AppFriendlyException($"【CallRackToProductionLine】未找到工位{organizeEntity.EnCode}的上级{organizeEntityCX.EnCode}对应的进行中的任务单,请检查!", 500);
} }
PrdMoTask prdMoTask = organizeEntityCXs.First(); PrdMoTask prdMoTask = organizeEntityCXs.First();