Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
2024-06-29 14:00:46 +08:00
13 changed files with 209 additions and 77 deletions

View File

@@ -96,7 +96,7 @@ namespace Tnb.ProductionMgr
private readonly ISqlSugarClient db_BGWCarrySupplementtimer;
private readonly ISqlSugarClient db_YCLGLDPJInstocktimer;
private readonly ISqlSugarClient db_YCLWXDPJInstocktimer;
private readonly ISqlSugarClient db_Floor2UpMachinecodetimer;
private ISqlSugarClient db_Floor2UpMachinecodetimer;
private readonly ISqlSugarClient db_Floor2timer送空托到上升降区;
private readonly ISqlSugarClient db_Floor2timer送满托到下升降区;
private readonly ISqlSugarClient db_Floor2timer移走上升降区未生成预任务且满托的料架;
@@ -518,7 +518,7 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
if (!result_createPretask)
{
LoggerBGWCarrySupplement.LogWarning($"【BGWCarrySupplementtimer】 {startLocation.location_code} 到 {endLocation.location_code} 预任务生成失败 ");
continue;
throw new Exception($"【BGWCarrySupplementtimer】 {startLocation.location_code} 到 {endLocation.location_code} 预任务生成失败");
}
LoggerBGWCarrySupplement.LogInformation($"【BGWCarrySupplementtimer】 {startLocation.location_code} 到 {endLocation.location_code} 预任务生成成功");
@@ -611,7 +611,7 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
if (!result_createPretask)
{
LoggerYCLGLDPJInstock.LogWarning($"【YCLGLDPJInstock】 {startLocation.location_code} 到 {endLocation.location_code} 预任务生成失败");
continue;
throw new Exception($"【YCLGLDPJInstock】 {startLocation.location_code} 到 {endLocation.location_code} 预任务生成失败");
}
LoggerYCLGLDPJInstock.LogWarning($"【YCLGLDPJInstock】 {startLocation.location_code} 到 {endLocation.location_code} 预任务生成成功");
@@ -699,7 +699,7 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
if (!result_createPretask)
{
LoggerYCLGLDPJInstock.LogWarning($"【YCLWXDPJInstock】 {startLocation.location_code} 到 {endLocation.location_code} 预任务生成失败");
continue;
throw new Exception($"【YCLWXDPJInstock】 {startLocation.location_code} 到 {endLocation.location_code} 预任务生成失败");
}
LoggerYCLGLDPJInstock.LogWarning($"【YCLWXDPJInstock】 {startLocation.location_code} 到 {endLocation.location_code} 预任务生成成功");
@@ -941,6 +941,21 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
// 料箱信息
WmsCarryH LX = db_Floor2UpMachinecodetimer.Queryable<WmsCarryH>().Where(r => r.carry_code == barcode).ToList()[0];
// 绑定料箱到料架
CarryBindInput carryBindInput = new();
carryBindInput.carry_id = target.rackid;
carryBindInput.carry_code = target.rackcode;
carryBindInput.membercarry_id = LX.id;
carryBindInput.membercarry_code = LX.carry_code;
carryBindInput.carrystd_id = rack.carrystd_id;
carryBindInput.source_code = target.outbill;
Tnb.WarehouseMgr.Entities.Dto.Outputs.Result bindResult = await _wmsCarryBindService.CarryBind(carryBindInput);
if (bindResult.code != JNPF.Common.Enums.HttpStatusCode.OK)
{
throw new Exception(bindResult.msg);
}
// 开始码垛
bool result_开始码垛 = await Floor2UpDownMachinecode_SetTag(MechanicalArmConsts., target.stackingposition.ToString());
LoggerFloor2UpDownMachine.LogInformation($@"【上升降机】码垛结果 {result_开始码垛}");
@@ -964,22 +979,18 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
}).Where(r => r.id == WmsMaterialTransfer.id).ExecuteCommandAsync();
LoggerFloor2UpDownMachine.LogInformation($@"【上升降机】回写转库单的剩余可绑定料架数量");
// 绑定料箱到料架
CarryBindInput carryBindInput = new();
carryBindInput.carry_id = target.rackid;
carryBindInput.carry_code = target.rackcode;
carryBindInput.membercarry_id = LX.id;
carryBindInput.membercarry_code = LX.carry_code;
carryBindInput.carrystd_id = rack.carrystd_id;
carryBindInput.source_code = target.outbill;
await _wmsCarryBindService.CarryBind(carryBindInput);
await db_Floor2UpMachinecodetimer.Ado.CommitTranAsync();
}
}
catch (Exception ex)
{
// 测试代码 无问题后期删
if (ex.Message.Contains("Connection is busy"))
{
db_Floor2UpMachinecodetimer = db_Floor2UpMachinecodetimer.CopyNew();
}
LoggerFloor2UpDownMachine.LogError(ex.ToString());
LoggerFloor2UpDownMachine.LogError(ex.StackTrace);
await db_Floor2UpMachinecodetimer.Ado.RollbackTranAsync();
@@ -987,6 +998,9 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
finally
{
s_taskExecuteFloor2UpMachinecodetimer.Release();
if (!db_Floor2UpMachinecodetimer.Ado.Transaction.IsNull())
await db_Floor2UpMachinecodetimer.Ado.CommitTranAsync();
stopwatch.Stop();
Console.WriteLine($"{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")} 结束执行Floor2UpMachinecode {stopwatch.ElapsedMilliseconds} ms");
LoggerTimer.LogInformation($"{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")} 结束执行Floor2UpMachinecode {stopwatch.ElapsedMilliseconds} ms");
@@ -1121,6 +1135,8 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
finally
{
s_task送空托到上升降区.Release();
if (!db_Floor2timer送空托到上升降区.Ado.Transaction.IsNull())
await db_Floor2timer送空托到上升降区.Ado.CommitTranAsync();
_wareHouseService.GenTaskExecute();
stopwatch.Stop();
Console.WriteLine($"{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")} 结束执行送空托到上升降区 {stopwatch.ElapsedMilliseconds} ms");
@@ -1190,13 +1206,15 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
.Where((a, b, c, d) => a.wh_id == "33780009364245" && a.is_use == "1" && a.is_lock == 0 && a.is_type == "0" && !string.IsNullOrEmpty(c.id)
&& b.carrystd_id == WmsWareHouseConst.CARRY_LJSTD_ID).OrderBy((a, b, c, d) => d.id).Select((a, b, c, d) => new // 关联载具物料明细表
{
wmsCarryH = b,
basLocation = a,
WmsCarryCode_id = d.id
}).ToList().GroupBy(r => r.basLocation.location_code).Select(r =>
{
var item = r.FirstOrDefault();
// 前面通过OrderBy(d => d.id)对WmsCarryCode_id进行了排序 那么如果第一行有数据则说明存在非空料箱
if (!string.IsNullOrEmpty(item.WmsCarryCode_id))
// 空载具入库: 前面通过OrderBy(d => d.id)对WmsCarryCode_id进行了排序 那么如果第一行有数据则说明存在非空料箱
// 没有物料且没有退料标记的不满足出库条件
if (!string.IsNullOrEmpty(item.WmsCarryCode_id) && (item.wmsCarryH.need_return == 0 || item.wmsCarryH.need_return == null))
{
return new BasLocation();
}
@@ -1257,11 +1275,16 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
LoggerFloor2RackDelivery.LogInformation($"【送满托到下升降区】 开始生成预任务 起点{startLocation.location_code} 终点{wmsMechanicalArmH.location_code} 料架 {targetCarry.carry_code}");
await db_Floor2timer送满托到下升降区.Updateable<WmsCarryH>().SetColumns(r => new WmsCarryH
{
need_return = 0
}).Where(r => r.id == targetCarry.id).ExecuteCommandAsync();
bool result = await createPretask(startLocation.id, wmsMechanicalArmH.location_id, targetCarry.id, targetCarry.carry_code, LoggerFloor2RackDelivery, db_Floor2timer送满托到下升降区);
if (!result)
{
LoggerFloor2RackDelivery.LogInformation($"【送满托到下升降区】 未成功生成预任务 起点{startLocation.location_code} 终点{wmsMechanicalArmH.location_code} 料架 {targetCarry.carry_code}");
continue;
throw new Exception($"【送满托到下升降区】 未成功生成预任务 起点{startLocation.location_code} 终点{wmsMechanicalArmH.location_code} 料架 {targetCarry.carry_code}");
}
}
await db_Floor2timer送满托到下升降区.Ado.CommitTranAsync();
@@ -1276,6 +1299,8 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
finally
{
s_task送满托到下升降区.Release();
if (!db_Floor2timer送满托到下升降区.Ado.Transaction.IsNull())
await db_Floor2timer送满托到下升降区.Ado.CommitTranAsync();
_wareHouseService.GenTaskExecute();
stopwatch.Stop();
Console.WriteLine($"{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")} 结束执行送满托到下升降区 {stopwatch.ElapsedMilliseconds} ms");
@@ -1380,6 +1405,8 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
finally
{
s_task移走上升降区未生成预任务且满托的料架.Release();
if (!db_Floor2timer移走上升降区未生成预任务且满托的料架.Ado.Transaction.IsNull())
await db_Floor2timer移走上升降区未生成预任务且满托的料架.Ado.CommitTranAsync();
_wareHouseService.GenTaskExecute();
stopwatch.Stop();
Console.WriteLine($"{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")} 结束执行移走上升降区未生成预任务且满托的料架 {stopwatch.ElapsedMilliseconds} ms");
@@ -1459,7 +1486,11 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
carryBindInput.carry_code = wmsMechanicalArmH.rackcode;
carryBindInput.source_code = wmsMechanicalArmH.outbill;
await _wmsCarryUnbindService.CarryUnbind(carryBindInput);
Tnb.WarehouseMgr.Entities.Dto.Outputs.Result unbindResult = await _wmsCarryUnbindService.CarryUnbind(carryBindInput);
if (unbindResult.code != JNPF.Common.Enums.HttpStatusCode.OK)
{
throw new Exception(unbindResult.msg);
}
// 锁住终点库位
await db_Floor2timer移走下升降区未生成预任务且空托的料架.Updateable<BasLocation>(r => new BasLocation
@@ -1473,7 +1504,7 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
if (!result)
{
LoggerFloor2RackDelivery.LogInformation($"【移走下升降区空托的料架】 未成功生成预任务 起点{wmsMechanicalArmH.location_code} 终点{endLocation.location_code} 料架 {wmsMechanicalArmH.rackcode}");
continue;
throw new Exception($"【移走下升降区空托的料架】 未成功生成预任务 起点{wmsMechanicalArmH.location_code} 终点{endLocation.location_code} 料架 {wmsMechanicalArmH.rackcode}");
}
}
await db_Floor2timer移走下升降区未生成预任务且空托的料架.Ado.CommitTranAsync();
@@ -1488,6 +1519,8 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
finally
{
s_task移走下升降区未生成预任务且空托的料架.Release();
if (!db_Floor2timer移走下升降区未生成预任务且空托的料架.Ado.Transaction.IsNull())
await db_Floor2timer移走下升降区未生成预任务且空托的料架.Ado.CommitTranAsync();
_wareHouseService.GenTaskExecute();
stopwatch.Stop();
Console.WriteLine($"{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")} 结束执行移走下升降区未生成预任务且空托的料架 {stopwatch.ElapsedMilliseconds} ms");