电梯调整等
This commit is contained in:
@@ -541,7 +541,11 @@ namespace Tnb.WarehouseMgr
|
||||
Logger.Information($"未成功解锁起点库位{wmsDistaskH.startlocation_code}");
|
||||
}
|
||||
|
||||
int unlockEndRow = await _db.Updateable<BasLocation>().SetColumns(r => r.is_lock == 0).Where(r => r.location_code == wmsDistaskH.endlocation_code).ExecuteCommandAsync();
|
||||
int unlockEndRow = await _db.Updateable<BasLocation>().SetColumns(r => new BasLocation
|
||||
{
|
||||
is_lock = 0,
|
||||
task_nums = r.task_nums - 1,
|
||||
}).Where(r => r.location_code == wmsDistaskH.endlocation_code).ExecuteCommandAsync();
|
||||
if (unlockEndRow > 0)
|
||||
Logger.Information($"成功解锁终点库位{wmsDistaskH.endlocation_code}");
|
||||
else
|
||||
@@ -668,7 +672,11 @@ namespace Tnb.WarehouseMgr
|
||||
Logger.Information($"未成功解锁起点库位{wmsDistaskH.startlocation_code}");
|
||||
}
|
||||
|
||||
int unlockEndRow = await _db.Updateable<BasLocation>().SetColumns(r => r.is_lock == 0).Where(r => r.location_code == wmsDistaskH.endlocation_code).ExecuteCommandAsync();
|
||||
int unlockEndRow = await _db.Updateable<BasLocation>().SetColumns(r => new BasLocation
|
||||
{
|
||||
is_lock = 0,
|
||||
task_nums = r.task_nums - 1,
|
||||
}).Where(r => r.location_code == wmsDistaskH.endlocation_code).ExecuteCommandAsync();
|
||||
if (unlockEndRow > 0)
|
||||
Logger.Information($"成功解锁终点库位{wmsDistaskH.endlocation_code}");
|
||||
else
|
||||
|
||||
@@ -1484,17 +1484,17 @@ namespace Tnb.WarehouseMgr
|
||||
|
||||
#region 电梯第三次改动
|
||||
// 到暂存区的未完成任务
|
||||
List<WmsDistaskH> wmsdistasks_agvElevator = await _db.Queryable<WmsDistaskH>()
|
||||
List<WmsDistaskH> wmsdistasks_agvElevator = await db.Queryable<WmsDistaskH>()
|
||||
.InnerJoin<BasLocation>((a, b) => a.endlocation_id == b.id)
|
||||
.Where((a, b) => a.status != WmsWareHouseConst.TASK_BILL_STATUS_COMPLE_ID && a.status != WmsWareHouseConst.TASK_BILL_STATUS_CANCEL_ID
|
||||
&& b.region_id == WmsWareHouseConst.REGION_CPOutstockCache_ID)
|
||||
.ToListAsync();
|
||||
// 到暂存区的未完成预任务
|
||||
List<WmsPretaskH> wmspretasks_agvElevator = await _db.Queryable<WmsPretaskH>()
|
||||
List<WmsPretaskH> wmspretasks_agvElevator = await db.Queryable<WmsPretaskH>()
|
||||
.InnerJoin<BasLocation>((a, b) => a.endlocation_id == b.id)
|
||||
.InnerJoin<WmsAreaH>((a, b, c) => a.area_id == c.id)
|
||||
.Where((a, b) => a.status != WmsWareHouseConst.PRETASK_BILL_STATUS_COMPLE_ID && a.status != WmsWareHouseConst.PRETASK_BILL_STATUS_CANCEL_ID
|
||||
&& b.region_id == WmsWareHouseConst.REGION_CPOutstockCache_ID)
|
||||
&& b.region_id == WmsWareHouseConst.REGION_CPOutstockCache_ID && b.is_use == "0")
|
||||
.Select((a, b, c) => new WmsPretaskH
|
||||
{
|
||||
move_num = c.move_num,
|
||||
@@ -1512,7 +1512,6 @@ namespace Tnb.WarehouseMgr
|
||||
normalPreTasks = normalPreTasks.Concat(cacheLocTasks).ToList();
|
||||
#endregion
|
||||
|
||||
|
||||
if (s_elevatortaskWCSRequestDic.Count > 0)
|
||||
{
|
||||
for (int index_agvElevatorTasks = 0; index_agvElevatorTasks < agvElevatorTasks.Count; index_agvElevatorTasks++)
|
||||
@@ -1551,6 +1550,9 @@ namespace Tnb.WarehouseMgr
|
||||
|
||||
preTasks = normalPreTasks.Concat(agvElevatorTasks).Concat(elePreTasks).ToList();
|
||||
|
||||
if (preTasks.Count() == 0)
|
||||
return;
|
||||
|
||||
|
||||
//一楼中储仓CTU
|
||||
|
||||
@@ -2374,6 +2376,12 @@ namespace Tnb.WarehouseMgr
|
||||
Logger.Information($"通知WCS电梯{devName}下行接口调用成功");
|
||||
}
|
||||
|
||||
List<WmsCarryH> carryHs = await db.Queryable<WmsCarryH>().Where(r => disTasks.Select(r => r.carry_id).Contains(r.id)).ToListAsync();
|
||||
carryHs.ForEach(r => {
|
||||
r.location_id = disTask.endlocation_id;
|
||||
r.location_code = disTask.endlocation_code;
|
||||
});
|
||||
await db.Updateable(carryHs).ExecuteCommandAsync();
|
||||
#region 电梯第三次改动
|
||||
|
||||
// 一托下的时候切换首选电梯
|
||||
@@ -3229,7 +3237,7 @@ namespace Tnb.WarehouseMgr
|
||||
BasLocation endlocation = await _db.Queryable<BasLocation>().InnerJoin<WmsPointH>((a, b) => a.id == b.location_id).Where((a, b) => b.id == pEndId).FirstAsync();
|
||||
|
||||
// 后续可整理成配置表
|
||||
#region 第二次改动弃用
|
||||
#region 电梯第三次次改动弃用
|
||||
//if (startlocation.wh_id == WmsWareHouseConst.WAREHOUSE_CP_ID && endlocation.wh_id == WmsWareHouseConst.WAREHOUSE_CPCRK_ID)
|
||||
//{
|
||||
// WmsElevatorH wmsElevatorH = await _db.Queryable<WmsElevatorH>().Where(it => it.elevator_group == "2" && it.enabled == 1).OrderBy(r => r.task_nums).FirstAsync();
|
||||
|
||||
@@ -169,18 +169,21 @@ namespace Tnb.WarehouseMgr
|
||||
CarryCodeUnbindCodeInput carryCodeUnbindCodeInput = new CarryCodeUnbindCodeInput();
|
||||
carryCodeUnbindCodeInput.carry_code_id = wmsCarryCode.id;
|
||||
await _wmsCarryUnbindService.CarryCodeUnbindCode(carryCodeUnbindCodeInput, _db);
|
||||
await _db.Updateable<WmsCarryH>().SetColumns(r => r.carry_status == "0").Where(r => r.id == wmsCarryH.id).ExecuteCommandAsync();
|
||||
|
||||
}
|
||||
await _db.Updateable<WmsTempCode>().SetColumns(r => r.codeqty == wmsCarryCode.codeqty)
|
||||
.Where(r => r.barcode == wmsCarryCode.barcode).ExecuteCommandAsync();
|
||||
}
|
||||
|
||||
// 如果没有条码 设置载具状态为空闲
|
||||
List<WmsCarryCode> _wmsCarryCodes = _db.Queryable<WmsCarryCode>().Where(r => r.carry_id == wmsCarryH.id).ToList();
|
||||
await _db.Updateable<WmsCarryH>().SetColumns(r => r.carry_status == (_wmsCarryCodes.Count == 0 ? "0" : r.carry_status)).Where(r => r.id == wmsCarryH.id).ExecuteCommandAsync();
|
||||
|
||||
switch (carryLoc.wh_id)
|
||||
{
|
||||
case WmsWareHouseConst.WAREHOUSE_YCL_ID:
|
||||
{
|
||||
|
||||
|
||||
await _db.Updateable(wmsCarryCodes).ExecuteCommandAsync();
|
||||
|
||||
await _wareHouseService.s_taskExecuteSemaphore_YCLInstock.WaitAsync();
|
||||
|
||||
@@ -81,10 +81,10 @@ namespace Tnb.WarehouseMgr
|
||||
try
|
||||
{
|
||||
await _db.Ado.BeginTranAsync();
|
||||
if (_db.Queryable<WmsTempCode>().Where(it => input.BillId == it.require_id).Any())
|
||||
{
|
||||
throw new AppFriendlyException("条码已生成", 500);
|
||||
};
|
||||
//if (_db.Queryable<WmsTempCode>().Where(it => input.BillId == it.require_id).Any())
|
||||
//{
|
||||
// throw new AppFriendlyException("条码已生成", 500);
|
||||
//};
|
||||
WmsOutsourceD WmsOutsourceD = await _db.Queryable<WmsOutsourceD>().Where(it => input.BillId == it.id).FirstAsync();
|
||||
WmsOutsourceH WmsOutsourceH = await _db.Queryable<WmsOutsourceH>().Where(it => WmsOutsourceD.fk_wms_outsource_order_id == it.id).FirstAsync();
|
||||
|
||||
|
||||
@@ -320,10 +320,10 @@ namespace Tnb.WarehouseMgr
|
||||
try
|
||||
{
|
||||
await _db.Ado.BeginTranAsync();
|
||||
if (_db.Queryable<WmsTempCode>().Where(it => input.BillId == it.require_id).Any())
|
||||
{
|
||||
throw new AppFriendlyException("条码已生成", 500);
|
||||
};
|
||||
//if (_db.Queryable<WmsTempCode>().Where(it => input.BillId == it.require_id).Any())
|
||||
//{
|
||||
// throw new AppFriendlyException("条码已生成", 500);
|
||||
//};
|
||||
WmsPurchaseD WmsPurchaseD = await _db.Queryable<WmsPurchaseD>().Where(it => input.BillId == it.id).FirstAsync();
|
||||
WmsPurchaseH WmsPurchaseH = await _db.Queryable<WmsPurchaseH>().Where(it => WmsPurchaseD.bill_id == it.id).FirstAsync();
|
||||
|
||||
|
||||
@@ -207,10 +207,10 @@ namespace Tnb.WarehouseMgr
|
||||
try
|
||||
{
|
||||
await _db.Ado.BeginTranAsync();
|
||||
if (_db.Queryable<WmsTempCode>().Where(it => input.BillId == it.require_id).Any())
|
||||
{
|
||||
throw new AppFriendlyException("条码已生成", 500);
|
||||
};
|
||||
//if (_db.Queryable<WmsTempCode>().Where(it => input.BillId == it.require_id).Any())
|
||||
//{
|
||||
// throw new AppFriendlyException("条码已生成", 500);
|
||||
//};
|
||||
WmsRawmatTransferinstockD WmsRawmatTransferinstockD = await _db.Queryable<WmsRawmatTransferinstockD>().Where(it => input.BillId == it.id).FirstAsync();
|
||||
WmsRawmatTransferinstockH WmsRawmatTransferinstockH = await _db.Queryable<WmsRawmatTransferinstockH>().Where(it => WmsRawmatTransferinstockD.bill_id == it.id).FirstAsync();
|
||||
|
||||
|
||||
@@ -224,21 +224,25 @@ namespace Tnb.WarehouseMgr
|
||||
{
|
||||
#region 电梯第三次改动 延迟预任务生成
|
||||
// 3-1 第三次改动
|
||||
var YCLInnerTransfer = await _db.Queryable<BasFactoryConfig>().Where(p => p.key == "floor3CurInCacheLocation").FirstAsync();
|
||||
Logger.Information($"当前发货区: {YCLInnerTransfer.value}");
|
||||
if (YCLInnerTransfer.value == null || (YCLInnerTransfer.value != "3楼发货左" && YCLInnerTransfer.value != "3楼发货右"))
|
||||
{
|
||||
throw new AppFriendlyException($"工厂配置->三楼出库暂存区当前入库分区 项配置错误!需要配置值为【3楼发货左】或【3楼发货右】", 500);
|
||||
}
|
||||
List<BasLocation> locations = await _db.Queryable<BasLocation>()
|
||||
endLocation = null;
|
||||
// 正常情况下交替入,如果左右两侧缓存数量不一致 优先补充托盘数量少那一侧
|
||||
List<BasLocation> locations_left = await _db.Queryable<BasLocation>()
|
||||
.InnerJoin<WmsElevatorcacheArea>((a, b) => a.id == b.location_id)
|
||||
.Where((a, b) => b.name == YCLInnerTransfer.value).OrderBy("a.is_lock,a.is_use,a.carry_count+a.task_nums,a.location_code").ToListAsync();
|
||||
|
||||
endLocation = locations.FirstOrDefault();
|
||||
|
||||
await _db.Updateable<BasFactoryConfig>().SetColumns(r => r.value == (YCLInnerTransfer.value == "3楼发货左" ? "3楼发货右" : "3楼发货左"))
|
||||
.Where(r => r.key == "floor3CurInCacheLocation").ExecuteCommandAsync();
|
||||
.Where((a, b) => b.name == "3楼发货左").OrderBy("a.is_lock,a.is_use,a.carry_count+a.task_nums,a.location_code").ToListAsync();
|
||||
List<BasLocation> locations_right = await _db.Queryable<BasLocation>()
|
||||
.InnerJoin<WmsElevatorcacheArea>((a, b) => a.id == b.location_id)
|
||||
.Where((a, b) => b.name == "3楼发货右").OrderBy("a.is_lock,a.is_use,a.carry_count+a.task_nums,a.location_code").ToListAsync();
|
||||
decimal leftQty = locations_left.Sum(r => r.carry_count + r.task_nums);
|
||||
decimal rightQty = locations_right.Sum(r => r.carry_count + r.task_nums);
|
||||
if (leftQty <= rightQty)
|
||||
endLocation = locations_left.FirstOrDefault();
|
||||
else
|
||||
endLocation = locations_right.FirstOrDefault();
|
||||
|
||||
if (endLocation == null)
|
||||
{
|
||||
throw new AppFriendlyException($"载具{carry.carry_code}无法选到缓存区库位,请检查电梯缓存分区配置表", 500);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
//人工发货
|
||||
|
||||
@@ -114,12 +114,12 @@ namespace Tnb.WarehouseMgr
|
||||
// 自动发货
|
||||
if (!input.isManual)
|
||||
{
|
||||
endLocations = await _db.Queryable<BasLocation>().Where(r => _wareHouseService.GetFloor1OutstockLocation().Contains(r.id) && r.is_lock == 0 && r.is_use == "0").ToListAsync();
|
||||
//endLocations = await _db.Queryable<BasLocation>().Where(r => _wareHouseService.GetFloor1OutstockLocation().Contains(r.id) && r.is_lock == 0 && r.is_use == "0").ToListAsync();
|
||||
|
||||
if (endLocations.Count < items_pretask.Count)
|
||||
{
|
||||
throw new AppFriendlyException("一楼没有足够的未锁定且空闲的出库工位", 500);
|
||||
}
|
||||
//if (endLocations.Count < items_pretask.Count)
|
||||
//{
|
||||
// throw new AppFriendlyException("一楼没有足够的未锁定且空闲的出库工位", 500);
|
||||
//}
|
||||
}
|
||||
//人工发货
|
||||
else
|
||||
@@ -145,18 +145,28 @@ namespace Tnb.WarehouseMgr
|
||||
// 自动发货
|
||||
if (!input.isManual)
|
||||
{
|
||||
endLocation = await _db.Queryable<BasLocation>().Where(r => _wareHouseService.GetFloor1OutstockLocation().Contains(r.id) && r.is_lock == 0 && r.is_use == "0").OrderBy("is_lock, task_nums, location_code").FirstAsync();
|
||||
#region 电梯第三次改动 延迟预任务生成
|
||||
// 3-1 第三次改动
|
||||
endLocation = null;
|
||||
// 正常情况下交替入,如果左右两侧缓存数量不一致 优先补充托盘数量少那一侧
|
||||
List<BasLocation> locations_left = await _db.Queryable<BasLocation>()
|
||||
.InnerJoin<WmsElevatorcacheArea>((a, b) => a.id == b.location_id)
|
||||
.Where((a, b) => b.name == "3楼发货左").OrderBy("a.is_lock,a.is_use,a.carry_count+a.task_nums,a.location_code").ToListAsync();
|
||||
List<BasLocation> locations_right = await _db.Queryable<BasLocation>()
|
||||
.InnerJoin<WmsElevatorcacheArea>((a, b) => a.id == b.location_id)
|
||||
.Where((a, b) => b.name == "3楼发货右").OrderBy("a.is_lock,a.is_use,a.carry_count+a.task_nums,a.location_code").ToListAsync();
|
||||
decimal leftQty = locations_left.Sum(r => r.carry_count + r.task_nums);
|
||||
decimal rightQty = locations_right.Sum(r => r.carry_count + r.task_nums);
|
||||
if (leftQty <= rightQty)
|
||||
endLocation = locations_left.FirstOrDefault();
|
||||
else
|
||||
endLocation = locations_right.FirstOrDefault();
|
||||
|
||||
if (endLocation == null)
|
||||
{
|
||||
throw new AppFriendlyException("一楼没有足够的未锁定且空闲的出库工位", 500);
|
||||
}
|
||||
List<BasLocation> endLocations_temp = await _db.Queryable<BasLocation>().Where(r => r.region_id == WmsWareHouseConst.REGION_CPOutstockCache_ID && r.is_lock == 0 && r.is_use == "0").ToListAsync();
|
||||
|
||||
if (endLocations_temp.Count < items_pretask.Count)
|
||||
{
|
||||
throw new AppFriendlyException($"三楼发货时,没有可用的暂存库位可以使用,需要下发任务{items_pretask.Count}条,可用的暂存库位只有{endLocations_temp.Count}条", 500);
|
||||
throw new AppFriendlyException($"载具{carry.carry_code}无法选到缓存区库位,请检查电梯缓存分区配置表", 500);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
//人工发货
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user