销售发货、调拨出库到人工出货区
This commit is contained in:
@@ -84,7 +84,14 @@
|
||||
/// 成品库出库暂存区
|
||||
/// </summary>
|
||||
public const string REGION_CPOutstockCache_ID = "35948525263893";
|
||||
|
||||
/// <summary>
|
||||
/// 成品库区
|
||||
/// </summary>
|
||||
public const string REGION_CPOutstock_ID = "28598002137877";
|
||||
/// <summary>
|
||||
/// 成品库人工出库区
|
||||
/// </summary>
|
||||
public const string REGION_CPManualOutstock_ID = "36539312699413";
|
||||
/// <summary>
|
||||
/// 长管出库
|
||||
/// </summary>
|
||||
@@ -188,7 +195,6 @@
|
||||
/// </summary>
|
||||
public const string PRETASK_BILL_STATUS_CANCEL_ID = "26126842129701";
|
||||
|
||||
//
|
||||
/// <summary>
|
||||
/// 任务单据状态-待执行Id
|
||||
/// </summary>
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
namespace Tnb.WarehouseMgr.Entities.Dto
|
||||
{
|
||||
/// <summary>
|
||||
/// 库房业务更新输入参数
|
||||
/// </summary>
|
||||
public class FinishproductOutstockSignAllInput
|
||||
{
|
||||
/// <summary>
|
||||
/// 区域
|
||||
/// </summary>
|
||||
public string? region_id { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -3,11 +3,11 @@
|
||||
/// <summary>
|
||||
/// 库房业务更新输入参数
|
||||
/// </summary>
|
||||
public class FinishproductOutstockSortInput
|
||||
public class FinishproductOutstockSignInput
|
||||
{
|
||||
/// <summary>
|
||||
/// 分拣任务id
|
||||
/// 载具编号
|
||||
/// </summary>
|
||||
public string? source_id { get; set; }
|
||||
public string? carry_code { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,11 +3,11 @@
|
||||
/// <summary>
|
||||
/// 库房业务更新输入参数
|
||||
/// </summary>
|
||||
public class FinishproductOutstockSignInput
|
||||
public class FinishproductOutstockSortInput
|
||||
{
|
||||
/// <summary>
|
||||
/// 载具编号
|
||||
/// 分拣任务id
|
||||
/// </summary>
|
||||
public string? carry_code { get; set; }
|
||||
public string? source_id { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,5 +21,9 @@
|
||||
/// 来源单据id
|
||||
/// </summary>
|
||||
public string? source_id { get; set; }
|
||||
/// <summary>
|
||||
/// 是否发到人工出库区
|
||||
/// </summary>
|
||||
public bool isManual { get; set; } = false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,5 +20,10 @@
|
||||
/// 来源单据id
|
||||
/// </summary>
|
||||
public string? source_id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否发到人工出库区
|
||||
/// </summary>
|
||||
public bool isManual { get; set; } = false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -555,16 +555,16 @@ namespace Tnb.WarehouseMgr
|
||||
throw new AppFriendlyException($@"子表主键不能为空!", 500);
|
||||
}
|
||||
|
||||
var wmsPurchaseOrdersDistinct = input.details.Select(r => new
|
||||
{
|
||||
material_id = r.material_code,
|
||||
code_batch = r.code_batch,
|
||||
}).Distinct();
|
||||
if (wmsPurchaseOrdersDistinct.Count() < input.details.Count)
|
||||
{
|
||||
_LoggerErp2Mes.LogWarning($@"【OutsourceOrderInput】表体存在物料和批号重复的明细!");
|
||||
throw new AppFriendlyException($@"表体存在物料和批号重复的明细!", 500);
|
||||
}
|
||||
//var wmsPurchaseOrdersDistinct = input.details.Select(r => new
|
||||
//{
|
||||
// material_id = r.material_code,
|
||||
// code_batch = r.code_batch,
|
||||
//}).Distinct();
|
||||
//if (wmsPurchaseOrdersDistinct.Count() < input.details.Count)
|
||||
//{
|
||||
// _LoggerErp2Mes.LogWarning($@"【OutsourceOrderInput】表体存在物料和批号重复的明细!");
|
||||
// throw new AppFriendlyException($@"表体存在物料和批号重复的明细!", 500);
|
||||
//}
|
||||
|
||||
await db.Ado.BeginTranAsync();
|
||||
|
||||
@@ -757,16 +757,16 @@ namespace Tnb.WarehouseMgr
|
||||
}
|
||||
|
||||
|
||||
var wmsMaterialTransferdsDistinct = input.details.Select(r => new
|
||||
{
|
||||
material_id = r.material_code,
|
||||
code_batch = r.code_batch,
|
||||
}).Distinct();
|
||||
if (wmsMaterialTransferdsDistinct.Count() < input.details.Count)
|
||||
{
|
||||
_LoggerErp2Mes.LogWarning($@"【MaterialTransfer】表体存在物料和批号重复的明细!");
|
||||
throw new AppFriendlyException($@"表体存在物料和批号重复的明细!", 500);
|
||||
}
|
||||
//var wmsMaterialTransferdsDistinct = input.details.Select(r => new
|
||||
//{
|
||||
// material_id = r.material_code,
|
||||
// code_batch = r.code_batch,
|
||||
//}).Distinct();
|
||||
//if (wmsMaterialTransferdsDistinct.Count() < input.details.Count)
|
||||
//{
|
||||
// _LoggerErp2Mes.LogWarning($@"【MaterialTransfer】表体存在物料和批号重复的明细!");
|
||||
// throw new AppFriendlyException($@"表体存在物料和批号重复的明细!", 500);
|
||||
//}
|
||||
|
||||
await db.Ado.BeginTranAsync();
|
||||
|
||||
@@ -1125,16 +1125,16 @@ namespace Tnb.WarehouseMgr
|
||||
throw new AppFriendlyException($@"子表主键不能为空!", 500);
|
||||
}
|
||||
|
||||
var wmsPurchaseOrdersDistinct = input.details.Select(r => new
|
||||
{
|
||||
material_id = r.material_code,
|
||||
code_batch = r.code_batch,
|
||||
}).Distinct();
|
||||
if (wmsPurchaseOrdersDistinct.Count() < input.details.Count)
|
||||
{
|
||||
_LoggerErp2Mes.LogWarning($@"【TransferOutstock】表体存在物料和批号重复的明细!");
|
||||
throw new AppFriendlyException($@"表体存在物料和批号重复的明细!", 500);
|
||||
}
|
||||
//var wmsPurchaseOrdersDistinct = input.details.Select(r => new
|
||||
//{
|
||||
// material_id = r.material_code,
|
||||
// code_batch = r.code_batch,
|
||||
//}).Distinct();
|
||||
//if (wmsPurchaseOrdersDistinct.Count() < input.details.Count)
|
||||
//{
|
||||
// _LoggerErp2Mes.LogWarning($@"【TransferOutstock】表体存在物料和批号重复的明细!");
|
||||
// throw new AppFriendlyException($@"表体存在物料和批号重复的明细!", 500);
|
||||
//}
|
||||
await db.Ado.BeginTranAsync();
|
||||
string Code = "";
|
||||
switch (warehouse_instock.id)
|
||||
@@ -1454,16 +1454,16 @@ namespace Tnb.WarehouseMgr
|
||||
throw new AppFriendlyException($@"子表主键不能为空!", 500);
|
||||
}
|
||||
|
||||
var wmsTransferOrdersDistinct = input.details.Select(r => new
|
||||
{
|
||||
material_id = r.material_code,
|
||||
code_batch = r.code_batch,
|
||||
}).Distinct();
|
||||
if (wmsTransferOrdersDistinct.Count() < input.details.Count)
|
||||
{
|
||||
_LoggerErp2Mes.LogWarning($@"【TransferOrder】表体存在物料和批号重复的明细!");
|
||||
throw new AppFriendlyException($@"表体存在物料和批号重复的明细!", 500);
|
||||
}
|
||||
//var wmsTransferOrdersDistinct = input.details.Select(r => new
|
||||
//{
|
||||
// material_id = r.material_code,
|
||||
// code_batch = r.code_batch,
|
||||
//}).Distinct();
|
||||
//if (wmsTransferOrdersDistinct.Count() < input.details.Count)
|
||||
//{
|
||||
// _LoggerErp2Mes.LogWarning($@"【TransferOrder】表体存在物料和批号重复的明细!");
|
||||
// throw new AppFriendlyException($@"表体存在物料和批号重复的明细!", 500);
|
||||
//}
|
||||
|
||||
|
||||
await db.Ado.BeginTranAsync();
|
||||
@@ -1489,9 +1489,8 @@ namespace Tnb.WarehouseMgr
|
||||
_LoggerErp2Mes.LogWarning($@"【TransferOutstock】表头明细中组织{input.instockorg_id}在wms系统中未找到!");
|
||||
throw new AppFriendlyException($@"表头明细中组织{input.instockorg_id}在wms系统中未找到!", 500);
|
||||
}
|
||||
|
||||
var _erpExtendField = await db.Queryable<ErpExtendField>().InnerJoin<DictionaryDataEntity>((a, b) => a.table_id == b.Id)
|
||||
.Where((a, b) => a.transaction_type_id == input.transaction_type).Select((a, b) => b).FirstAsync();
|
||||
.Where((a, b) => b.EnCode == input.transaction_type).Select((a, b) => b).FirstAsync();
|
||||
if (_erpExtendField != null)
|
||||
{
|
||||
wmsTransferOrderH.transaction_type = _erpExtendField.EnCode;
|
||||
@@ -1774,16 +1773,16 @@ namespace Tnb.WarehouseMgr
|
||||
throw new AppFriendlyException($@"子表主键不能为空!", 500);
|
||||
}
|
||||
|
||||
var wmsRawmatOutstocksDistinct = input.details.Select(r => new
|
||||
{
|
||||
material_id = r.material_code,
|
||||
code_batch = r.code_batch,
|
||||
}).Distinct();
|
||||
if (wmsRawmatOutstocksDistinct.Count() < input.details.Count)
|
||||
{
|
||||
_LoggerErp2Mes.LogWarning($@"【RawmatOutstock】表体存在物料和批号重复的明细!");
|
||||
throw new AppFriendlyException($@"表体存在物料和批号重复的明细!", 500);
|
||||
}
|
||||
//var wmsRawmatOutstocksDistinct = input.details.Select(r => new
|
||||
//{
|
||||
// material_id = r.material_code,
|
||||
// code_batch = r.code_batch,
|
||||
//}).Distinct();
|
||||
//if (wmsRawmatOutstocksDistinct.Count() < input.details.Count)
|
||||
//{
|
||||
// _LoggerErp2Mes.LogWarning($@"【RawmatOutstock】表体存在物料和批号重复的明细!");
|
||||
// throw new AppFriendlyException($@"表体存在物料和批号重复的明细!", 500);
|
||||
//}
|
||||
|
||||
await db.Ado.BeginTranAsync();
|
||||
// 判断是否重复传输
|
||||
|
||||
@@ -465,7 +465,8 @@ namespace Tnb.WarehouseMgr
|
||||
.AndIF(!string.IsNullOrEmpty(input.code_batch), (a, b, c) => b.code_batch == input.code_batch)
|
||||
.AndIF(!string.IsNullOrEmpty(input.material_specification), (a, b, c) => b.material_specification == input.material_specification)
|
||||
.AndIF(!string.IsNullOrEmpty(input.container_no), (a, b, c) => b.container_no == input.container_no)
|
||||
.AndIF(!string.IsNullOrEmpty(input.carrystd_id), (a, b, c) => a.carrystd_id == input.carrystd_id);
|
||||
.AndIF(!string.IsNullOrEmpty(input.carrystd_id), (a, b, c) => a.carrystd_id == input.carrystd_id)
|
||||
.AndIF(!string.IsNullOrEmpty(input.Region_id), (a, b, c) => c.region_id == input.Region_id);
|
||||
Expression<Func<WmsCarryH, WmsCarryCode, BasLocation, bool>> carryStatusFilterExp = !input.material_id.IsNullOrWhiteSpace()
|
||||
? (a, b, c) => a.carry_status == ((int)EnumCarryStatus.占用).ToString()
|
||||
: (a, b, c) => a.carry_status == ((int)EnumCarryStatus.空闲).ToString();
|
||||
|
||||
@@ -59,7 +59,7 @@ namespace Tnb.WarehouseMgr
|
||||
.LeftJoin<WmsCarrystd>((a, b, c, d) => d.id == b.carrystd_id)
|
||||
.LeftJoin<WmsCarryCode>((a, b, c, d, e) => e.carry_id == b.id)
|
||||
.LeftJoin<BasMaterial>((a, b, c, d, e, f) => f.id == e.material_id)
|
||||
.Where((a, b, c, d, e) => a.is_type == ((int)EnumLocationType.存储库位).ToString() && a.is_use == "1"
|
||||
.Where((a, b, c, d, e) => a.is_type == ((int)EnumLocationType.存储库位).ToString()
|
||||
&& ((!string.IsNullOrEmpty(b.carry_code) && b.carry_status != "0" && b.carry_status != "6") || string.IsNullOrEmpty(b.carry_code)))
|
||||
.WhereIF(!string.IsNullOrEmpty(warehouse_id), (a, b, c, d) => c.id == warehouse_id)
|
||||
.WhereIF(!string.IsNullOrEmpty(carry_code), (a, b, c, d) => b.carry_code.Contains(carry_code))
|
||||
@@ -101,7 +101,7 @@ namespace Tnb.WarehouseMgr
|
||||
.InnerJoin<WmsCarryCode>((a, b, c, d, e, f) => f.carry_id == e.membercarry_id)
|
||||
.InnerJoin<BasMaterial>((a, b, c, d, e, f, g) => g.id == f.material_id)
|
||||
.InnerJoin<WmsCarryH>((a, b, c, d, e, f, g, h) => h.id == e.membercarry_id)
|
||||
.Where((a, b, c, d, e) => a.is_type == ((int)EnumLocationType.存储库位).ToString() && a.is_use == "1" && b.carry_status != "0" && b.carry_status != "6")
|
||||
.Where((a, b, c, d, e) => a.is_type == ((int)EnumLocationType.存储库位).ToString() && b.carry_status != "0" && b.carry_status != "6")
|
||||
.WhereIF(!string.IsNullOrEmpty(warehouse_id), (a, b, c, d) => c.id == warehouse_id)
|
||||
.WhereIF(!string.IsNullOrEmpty(carry_code), (a, b, c, d, e, f, g, h) => b.carry_code.Contains(carry_code)|| h.carry_code.Contains(carry_code))
|
||||
.WhereIF(!string.IsNullOrEmpty(material_code), (a, b, c, d, e, f, g) => g.code.Contains(material_code))
|
||||
|
||||
@@ -464,6 +464,22 @@ namespace Tnb.WarehouseMgr
|
||||
return await ToApiResult(HttpStatusCode.OK, "成功");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 盘点签收(全部签收)
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost, NonUnify, AllowAnonymous]
|
||||
public async Task<Tnb.WarehouseMgr.Entities.Dto.Outputs.Result> FinishproductOutstockSignAll(FinishproductOutstockSignAllInput input)
|
||||
{
|
||||
Logger.LogInformation($"【FinishproductOutstockSign】载具签收 {input.region_id}");
|
||||
if (string.IsNullOrEmpty(input.region_id))
|
||||
{
|
||||
throw new AppFriendlyException("请选择区域", 500);
|
||||
}
|
||||
|
||||
|
||||
return await ToApiResult(HttpStatusCode.OK, "成功");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -163,8 +163,8 @@ namespace Tnb.WarehouseMgr
|
||||
await s_taskExecuteSemaphore.WaitAsync();
|
||||
await _db.Ado.BeginTranAsync();
|
||||
//入库取终点 //出库起点
|
||||
OutStockStrategyQuery inStockStrategyInput = new() { warehouse_id = WmsWareHouseConst.WAREHOUSE_CP_ID, material_id = wmsOutstockD.material_id, qty = input.qty, code_batch = wmsOutstockD.code_batch };
|
||||
List<Tuple<string, WmsCarryH, WmsCarryCode, BasLocation>> items = await _wareHouseService.OutStockStrategy_saleRelease(inStockStrategyInput);
|
||||
OutStockStrategyQuery outStockStrategyInput = new() { warehouse_id = WmsWareHouseConst.WAREHOUSE_CP_ID, material_id = wmsOutstockD.material_id, qty = input.qty, code_batch = wmsOutstockD.code_batch, Region_id = WmsWareHouseConst.REGION_CPOutstock_ID };
|
||||
List<Tuple<string, WmsCarryH, WmsCarryCode, BasLocation>> items = await _wareHouseService.OutStockStrategy_saleRelease(outStockStrategyInput);
|
||||
|
||||
decimal canOutstockQty = items.Sum(r => r.Item3.codeqty).ParseToDecimal();
|
||||
if (canOutstockQty < input.qty)
|
||||
@@ -178,11 +178,27 @@ namespace Tnb.WarehouseMgr
|
||||
Logger.LogInformation($"【Distribute】 预计生成{items_pretask.Count}条预任务");
|
||||
|
||||
|
||||
List<BasLocation> 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)
|
||||
List<BasLocation> endLocations = null;
|
||||
// 自动发货
|
||||
if (!input.isManual)
|
||||
{
|
||||
throw new AppFriendlyException("一楼没有足够的未锁定且空闲的出库工位", 500);
|
||||
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);
|
||||
}
|
||||
}
|
||||
//人工发货
|
||||
else
|
||||
{
|
||||
InStockStrategyQuery inStockStrategyInput = new() { warehouse_id = WmsWareHouseConst.WAREHOUSE_CP_ID, Size = items_pretask.Count, Region_id = WmsWareHouseConst.REGION_CPManualOutstock_ID };
|
||||
endLocations = await _wareHouseService.InStockStrategy(inStockStrategyInput);
|
||||
|
||||
if (endLocations.Count < items_pretask.Count)
|
||||
{
|
||||
throw new AppFriendlyException("三楼人工出库区没有足够的未锁定且空闲的出库工位", 500);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -193,8 +209,30 @@ namespace Tnb.WarehouseMgr
|
||||
WmsCarryCode carryCode = item.Item3;
|
||||
BasLocation startLocation = item.Item4;
|
||||
// 根据一楼工位任务数平均分配任务 确定一楼工位
|
||||
BasLocation 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();
|
||||
|
||||
BasLocation endLocation = null;
|
||||
// 自动发货
|
||||
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();
|
||||
|
||||
if (endLocation == null)
|
||||
{
|
||||
throw new AppFriendlyException("一楼没有足够的未锁定且空闲的出库工位", 500);
|
||||
}
|
||||
}
|
||||
//人工发货
|
||||
else
|
||||
{
|
||||
InStockStrategyQuery inStockStrategyInput = new() { warehouse_id = WmsWareHouseConst.WAREHOUSE_CP_ID, Size = 1, Region_id = WmsWareHouseConst.REGION_CPManualOutstock_ID };
|
||||
endLocations = await _wareHouseService.InStockStrategy(inStockStrategyInput);
|
||||
|
||||
if (endLocations.Count < 1)
|
||||
{
|
||||
throw new AppFriendlyException("三楼人工出库区没有足够的未锁定且空闲的出库工位", 500);
|
||||
}
|
||||
endLocation = endLocations[0];
|
||||
}
|
||||
if (endLocation == null)
|
||||
{
|
||||
throw new AppFriendlyException("一楼没有足够的未锁定且空闲的出库工位", 500);
|
||||
@@ -220,7 +258,6 @@ namespace Tnb.WarehouseMgr
|
||||
throw new AppFriendlyException($"库位{endLocation.location_code}未在点位表中维护对应点位", 500);
|
||||
}
|
||||
|
||||
|
||||
string endLocationId = endLocation.id;
|
||||
|
||||
// 在线开发
|
||||
|
||||
@@ -94,8 +94,8 @@ namespace Tnb.WarehouseMgr
|
||||
await s_taskExecuteSemaphore.WaitAsync();
|
||||
await _db.Ado.BeginTranAsync();
|
||||
//入库取终点 //出库起点
|
||||
OutStockStrategyQuery inStockStrategyInput = new() { warehouse_id = WmsWareHouseConst.WAREHOUSE_CP_ID, material_id = wmsOutstockD.material_id, qty = input.qty, code_batch = wmsOutstockD.pi_code };
|
||||
List<Tuple<string, WmsCarryH, WmsCarryCode, BasLocation>> items = await _wareHouseService.OutStockStrategy_saleRelease(inStockStrategyInput);
|
||||
OutStockStrategyQuery outStockStrategyInput = new() { warehouse_id = WmsWareHouseConst.WAREHOUSE_CP_ID, material_id = wmsOutstockD.material_id, qty = input.qty, code_batch = wmsOutstockD.pi_code, Region_id = WmsWareHouseConst.REGION_CPOutstock_ID };
|
||||
List<Tuple<string, WmsCarryH, WmsCarryCode, BasLocation>> items = await _wareHouseService.OutStockStrategy_saleRelease(outStockStrategyInput);
|
||||
|
||||
decimal canOutstockQty = items.Sum(r => r.Item3.codeqty).ParseToDecimal();
|
||||
if (canOutstockQty < input.qty)
|
||||
@@ -108,14 +108,28 @@ namespace Tnb.WarehouseMgr
|
||||
|
||||
Logger.LogInformation($"【Distribute】 预计生成{items_pretask.Count}条预任务");
|
||||
|
||||
|
||||
List<BasLocation> 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)
|
||||
List<BasLocation> endLocations = null;
|
||||
// 自动发货
|
||||
if (!input.isManual)
|
||||
{
|
||||
throw new AppFriendlyException("一楼没有足够的未锁定且空闲的出库工位", 500);
|
||||
}
|
||||
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);
|
||||
}
|
||||
}
|
||||
//人工发货
|
||||
else
|
||||
{
|
||||
InStockStrategyQuery inStockStrategyInput = new() { warehouse_id = WmsWareHouseConst.WAREHOUSE_CP_ID, Size = items_pretask.Count, Region_id = WmsWareHouseConst.REGION_CPManualOutstock_ID };
|
||||
endLocations = await _wareHouseService.InStockStrategy(inStockStrategyInput);
|
||||
|
||||
if (endLocations.Count < items_pretask.Count)
|
||||
{
|
||||
throw new AppFriendlyException("三楼人工出库区没有足够的未锁定且空闲的出库工位", 500);
|
||||
}
|
||||
}
|
||||
|
||||
// 预任务逻辑
|
||||
foreach (Tuple<string, WmsCarryH, WmsCarryCode, BasLocation> item in items_pretask)
|
||||
@@ -124,12 +138,31 @@ namespace Tnb.WarehouseMgr
|
||||
WmsCarryCode carryCode = item.Item3;
|
||||
BasLocation startLocation = item.Item4;
|
||||
// 根据一楼工位任务数平均分配任务 确定一楼工位
|
||||
BasLocation 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();
|
||||
|
||||
if (endLocation == null)
|
||||
BasLocation endLocation = null;
|
||||
// 自动发货
|
||||
if (!input.isManual)
|
||||
{
|
||||
throw new AppFriendlyException("一楼没有足够的未锁定且空闲的出库工位", 500);
|
||||
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();
|
||||
|
||||
if (endLocation == null)
|
||||
{
|
||||
throw new AppFriendlyException("一楼没有足够的未锁定且空闲的出库工位", 500);
|
||||
}
|
||||
}
|
||||
//人工发货
|
||||
else
|
||||
{
|
||||
InStockStrategyQuery inStockStrategyInput = new() { warehouse_id = WmsWareHouseConst.WAREHOUSE_CP_ID, Size = 1, Region_id = WmsWareHouseConst.REGION_CPManualOutstock_ID };
|
||||
endLocations = await _wareHouseService.InStockStrategy(inStockStrategyInput);
|
||||
|
||||
if (endLocations.Count < 1)
|
||||
{
|
||||
throw new AppFriendlyException("三楼人工出库区没有足够的未锁定且空闲的出库工位", 500);
|
||||
}
|
||||
endLocation = endLocations[0];
|
||||
}
|
||||
|
||||
WmsPointH sPoint = null!;
|
||||
WmsPointH ePoint = null!;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user