销售发货、调拨出库到人工出货区
This commit is contained in:
@@ -84,7 +84,14 @@
|
|||||||
/// 成品库出库暂存区
|
/// 成品库出库暂存区
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public const string REGION_CPOutstockCache_ID = "35948525263893";
|
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>
|
||||||
/// 长管出库
|
/// 长管出库
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -188,7 +195,6 @@
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public const string PRETASK_BILL_STATUS_CANCEL_ID = "26126842129701";
|
public const string PRETASK_BILL_STATUS_CANCEL_ID = "26126842129701";
|
||||||
|
|
||||||
//
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 任务单据状态-待执行Id
|
/// 任务单据状态-待执行Id
|
||||||
/// </summary>
|
/// </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>
|
||||||
/// 库房业务更新输入参数
|
/// 库房业务更新输入参数
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class FinishproductOutstockSortInput
|
public class FinishproductOutstockSignInput
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 分拣任务id
|
/// 载具编号
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string? source_id { get; set; }
|
public string? carry_code { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,11 +3,11 @@
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 库房业务更新输入参数
|
/// 库房业务更新输入参数
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class FinishproductOutstockSignInput
|
public class FinishproductOutstockSortInput
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 载具编号
|
/// 分拣任务id
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string? carry_code { get; set; }
|
public string? source_id { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,5 +21,9 @@
|
|||||||
/// 来源单据id
|
/// 来源单据id
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string? source_id { get; set; }
|
public string? source_id { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 是否发到人工出库区
|
||||||
|
/// </summary>
|
||||||
|
public bool isManual { get; set; } = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,5 +20,10 @@
|
|||||||
/// 来源单据id
|
/// 来源单据id
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string? source_id { get; set; }
|
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);
|
throw new AppFriendlyException($@"子表主键不能为空!", 500);
|
||||||
}
|
}
|
||||||
|
|
||||||
var wmsPurchaseOrdersDistinct = input.details.Select(r => new
|
//var wmsPurchaseOrdersDistinct = input.details.Select(r => new
|
||||||
{
|
//{
|
||||||
material_id = r.material_code,
|
// material_id = r.material_code,
|
||||||
code_batch = r.code_batch,
|
// code_batch = r.code_batch,
|
||||||
}).Distinct();
|
//}).Distinct();
|
||||||
if (wmsPurchaseOrdersDistinct.Count() < input.details.Count)
|
//if (wmsPurchaseOrdersDistinct.Count() < input.details.Count)
|
||||||
{
|
//{
|
||||||
_LoggerErp2Mes.LogWarning($@"【OutsourceOrderInput】表体存在物料和批号重复的明细!");
|
// _LoggerErp2Mes.LogWarning($@"【OutsourceOrderInput】表体存在物料和批号重复的明细!");
|
||||||
throw new AppFriendlyException($@"表体存在物料和批号重复的明细!", 500);
|
// throw new AppFriendlyException($@"表体存在物料和批号重复的明细!", 500);
|
||||||
}
|
//}
|
||||||
|
|
||||||
await db.Ado.BeginTranAsync();
|
await db.Ado.BeginTranAsync();
|
||||||
|
|
||||||
@@ -757,16 +757,16 @@ namespace Tnb.WarehouseMgr
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
var wmsMaterialTransferdsDistinct = input.details.Select(r => new
|
//var wmsMaterialTransferdsDistinct = input.details.Select(r => new
|
||||||
{
|
//{
|
||||||
material_id = r.material_code,
|
// material_id = r.material_code,
|
||||||
code_batch = r.code_batch,
|
// code_batch = r.code_batch,
|
||||||
}).Distinct();
|
//}).Distinct();
|
||||||
if (wmsMaterialTransferdsDistinct.Count() < input.details.Count)
|
//if (wmsMaterialTransferdsDistinct.Count() < input.details.Count)
|
||||||
{
|
//{
|
||||||
_LoggerErp2Mes.LogWarning($@"【MaterialTransfer】表体存在物料和批号重复的明细!");
|
// _LoggerErp2Mes.LogWarning($@"【MaterialTransfer】表体存在物料和批号重复的明细!");
|
||||||
throw new AppFriendlyException($@"表体存在物料和批号重复的明细!", 500);
|
// throw new AppFriendlyException($@"表体存在物料和批号重复的明细!", 500);
|
||||||
}
|
//}
|
||||||
|
|
||||||
await db.Ado.BeginTranAsync();
|
await db.Ado.BeginTranAsync();
|
||||||
|
|
||||||
@@ -1125,16 +1125,16 @@ namespace Tnb.WarehouseMgr
|
|||||||
throw new AppFriendlyException($@"子表主键不能为空!", 500);
|
throw new AppFriendlyException($@"子表主键不能为空!", 500);
|
||||||
}
|
}
|
||||||
|
|
||||||
var wmsPurchaseOrdersDistinct = input.details.Select(r => new
|
//var wmsPurchaseOrdersDistinct = input.details.Select(r => new
|
||||||
{
|
//{
|
||||||
material_id = r.material_code,
|
// material_id = r.material_code,
|
||||||
code_batch = r.code_batch,
|
// code_batch = r.code_batch,
|
||||||
}).Distinct();
|
//}).Distinct();
|
||||||
if (wmsPurchaseOrdersDistinct.Count() < input.details.Count)
|
//if (wmsPurchaseOrdersDistinct.Count() < input.details.Count)
|
||||||
{
|
//{
|
||||||
_LoggerErp2Mes.LogWarning($@"【TransferOutstock】表体存在物料和批号重复的明细!");
|
// _LoggerErp2Mes.LogWarning($@"【TransferOutstock】表体存在物料和批号重复的明细!");
|
||||||
throw new AppFriendlyException($@"表体存在物料和批号重复的明细!", 500);
|
// throw new AppFriendlyException($@"表体存在物料和批号重复的明细!", 500);
|
||||||
}
|
//}
|
||||||
await db.Ado.BeginTranAsync();
|
await db.Ado.BeginTranAsync();
|
||||||
string Code = "";
|
string Code = "";
|
||||||
switch (warehouse_instock.id)
|
switch (warehouse_instock.id)
|
||||||
@@ -1454,16 +1454,16 @@ namespace Tnb.WarehouseMgr
|
|||||||
throw new AppFriendlyException($@"子表主键不能为空!", 500);
|
throw new AppFriendlyException($@"子表主键不能为空!", 500);
|
||||||
}
|
}
|
||||||
|
|
||||||
var wmsTransferOrdersDistinct = input.details.Select(r => new
|
//var wmsTransferOrdersDistinct = input.details.Select(r => new
|
||||||
{
|
//{
|
||||||
material_id = r.material_code,
|
// material_id = r.material_code,
|
||||||
code_batch = r.code_batch,
|
// code_batch = r.code_batch,
|
||||||
}).Distinct();
|
//}).Distinct();
|
||||||
if (wmsTransferOrdersDistinct.Count() < input.details.Count)
|
//if (wmsTransferOrdersDistinct.Count() < input.details.Count)
|
||||||
{
|
//{
|
||||||
_LoggerErp2Mes.LogWarning($@"【TransferOrder】表体存在物料和批号重复的明细!");
|
// _LoggerErp2Mes.LogWarning($@"【TransferOrder】表体存在物料和批号重复的明细!");
|
||||||
throw new AppFriendlyException($@"表体存在物料和批号重复的明细!", 500);
|
// throw new AppFriendlyException($@"表体存在物料和批号重复的明细!", 500);
|
||||||
}
|
//}
|
||||||
|
|
||||||
|
|
||||||
await db.Ado.BeginTranAsync();
|
await db.Ado.BeginTranAsync();
|
||||||
@@ -1489,9 +1489,8 @@ namespace Tnb.WarehouseMgr
|
|||||||
_LoggerErp2Mes.LogWarning($@"【TransferOutstock】表头明细中组织{input.instockorg_id}在wms系统中未找到!");
|
_LoggerErp2Mes.LogWarning($@"【TransferOutstock】表头明细中组织{input.instockorg_id}在wms系统中未找到!");
|
||||||
throw new AppFriendlyException($@"表头明细中组织{input.instockorg_id}在wms系统中未找到!", 500);
|
throw new AppFriendlyException($@"表头明细中组织{input.instockorg_id}在wms系统中未找到!", 500);
|
||||||
}
|
}
|
||||||
|
|
||||||
var _erpExtendField = await db.Queryable<ErpExtendField>().InnerJoin<DictionaryDataEntity>((a, b) => a.table_id == b.Id)
|
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)
|
if (_erpExtendField != null)
|
||||||
{
|
{
|
||||||
wmsTransferOrderH.transaction_type = _erpExtendField.EnCode;
|
wmsTransferOrderH.transaction_type = _erpExtendField.EnCode;
|
||||||
@@ -1774,16 +1773,16 @@ namespace Tnb.WarehouseMgr
|
|||||||
throw new AppFriendlyException($@"子表主键不能为空!", 500);
|
throw new AppFriendlyException($@"子表主键不能为空!", 500);
|
||||||
}
|
}
|
||||||
|
|
||||||
var wmsRawmatOutstocksDistinct = input.details.Select(r => new
|
//var wmsRawmatOutstocksDistinct = input.details.Select(r => new
|
||||||
{
|
//{
|
||||||
material_id = r.material_code,
|
// material_id = r.material_code,
|
||||||
code_batch = r.code_batch,
|
// code_batch = r.code_batch,
|
||||||
}).Distinct();
|
//}).Distinct();
|
||||||
if (wmsRawmatOutstocksDistinct.Count() < input.details.Count)
|
//if (wmsRawmatOutstocksDistinct.Count() < input.details.Count)
|
||||||
{
|
//{
|
||||||
_LoggerErp2Mes.LogWarning($@"【RawmatOutstock】表体存在物料和批号重复的明细!");
|
// _LoggerErp2Mes.LogWarning($@"【RawmatOutstock】表体存在物料和批号重复的明细!");
|
||||||
throw new AppFriendlyException($@"表体存在物料和批号重复的明细!", 500);
|
// throw new AppFriendlyException($@"表体存在物料和批号重复的明细!", 500);
|
||||||
}
|
//}
|
||||||
|
|
||||||
await db.Ado.BeginTranAsync();
|
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.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.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.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()
|
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()
|
||||||
: (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<WmsCarrystd>((a, b, c, d) => d.id == b.carrystd_id)
|
||||||
.LeftJoin<WmsCarryCode>((a, b, c, d, e) => e.carry_id == b.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)
|
.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)))
|
&& ((!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(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))
|
.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<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<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)
|
.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(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(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))
|
.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, "成功");
|
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 s_taskExecuteSemaphore.WaitAsync();
|
||||||
await _db.Ado.BeginTranAsync();
|
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 };
|
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(inStockStrategyInput);
|
List<Tuple<string, WmsCarryH, WmsCarryCode, BasLocation>> items = await _wareHouseService.OutStockStrategy_saleRelease(outStockStrategyInput);
|
||||||
|
|
||||||
decimal canOutstockQty = items.Sum(r => r.Item3.codeqty).ParseToDecimal();
|
decimal canOutstockQty = items.Sum(r => r.Item3.codeqty).ParseToDecimal();
|
||||||
if (canOutstockQty < input.qty)
|
if (canOutstockQty < input.qty)
|
||||||
@@ -178,12 +178,28 @@ namespace Tnb.WarehouseMgr
|
|||||||
Logger.LogInformation($"【Distribute】 预计生成{items_pretask.Count}条预任务");
|
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();
|
List<BasLocation> endLocations = null;
|
||||||
|
// 自动发货
|
||||||
|
if (!input.isManual)
|
||||||
|
{
|
||||||
|
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)
|
if (endLocations.Count < items_pretask.Count)
|
||||||
{
|
{
|
||||||
throw new AppFriendlyException("一楼没有足够的未锁定且空闲的出库工位", 500);
|
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;
|
WmsCarryCode carryCode = item.Item3;
|
||||||
BasLocation startLocation = item.Item4;
|
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)
|
if (endLocation == null)
|
||||||
{
|
{
|
||||||
throw new AppFriendlyException("一楼没有足够的未锁定且空闲的出库工位", 500);
|
throw new AppFriendlyException("一楼没有足够的未锁定且空闲的出库工位", 500);
|
||||||
@@ -220,7 +258,6 @@ namespace Tnb.WarehouseMgr
|
|||||||
throw new AppFriendlyException($"库位{endLocation.location_code}未在点位表中维护对应点位", 500);
|
throw new AppFriendlyException($"库位{endLocation.location_code}未在点位表中维护对应点位", 500);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
string endLocationId = endLocation.id;
|
string endLocationId = endLocation.id;
|
||||||
|
|
||||||
// 在线开发
|
// 在线开发
|
||||||
|
|||||||
@@ -94,8 +94,8 @@ namespace Tnb.WarehouseMgr
|
|||||||
await s_taskExecuteSemaphore.WaitAsync();
|
await s_taskExecuteSemaphore.WaitAsync();
|
||||||
await _db.Ado.BeginTranAsync();
|
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 };
|
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(inStockStrategyInput);
|
List<Tuple<string, WmsCarryH, WmsCarryCode, BasLocation>> items = await _wareHouseService.OutStockStrategy_saleRelease(outStockStrategyInput);
|
||||||
|
|
||||||
decimal canOutstockQty = items.Sum(r => r.Item3.codeqty).ParseToDecimal();
|
decimal canOutstockQty = items.Sum(r => r.Item3.codeqty).ParseToDecimal();
|
||||||
if (canOutstockQty < input.qty)
|
if (canOutstockQty < input.qty)
|
||||||
@@ -108,14 +108,28 @@ namespace Tnb.WarehouseMgr
|
|||||||
|
|
||||||
Logger.LogInformation($"【Distribute】 预计生成{items_pretask.Count}条预任务");
|
Logger.LogInformation($"【Distribute】 预计生成{items_pretask.Count}条预任务");
|
||||||
|
|
||||||
|
List<BasLocation> endLocations = null;
|
||||||
List<BasLocation> endLocations = await _db.Queryable<BasLocation>().Where(r => _wareHouseService.GetFloor1OutstockLocation().Contains(r.id) && r.is_lock == 0 && r.is_use == "0").ToListAsync();
|
// 自动发货
|
||||||
|
if (!input.isManual)
|
||||||
|
{
|
||||||
|
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)
|
if (endLocations.Count < items_pretask.Count)
|
||||||
{
|
{
|
||||||
throw new AppFriendlyException("一楼没有足够的未锁定且空闲的出库工位", 500);
|
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)
|
foreach (Tuple<string, WmsCarryH, WmsCarryCode, BasLocation> item in items_pretask)
|
||||||
@@ -124,12 +138,31 @@ namespace Tnb.WarehouseMgr
|
|||||||
WmsCarryCode carryCode = item.Item3;
|
WmsCarryCode carryCode = item.Item3;
|
||||||
BasLocation startLocation = item.Item4;
|
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)
|
if (endLocation == null)
|
||||||
{
|
{
|
||||||
throw new AppFriendlyException("一楼没有足够的未锁定且空闲的出库工位", 500);
|
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 sPoint = null!;
|
||||||
WmsPointH ePoint = null!;
|
WmsPointH ePoint = null!;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user