原材料仓内转移、出入库策略调整
This commit is contained in:
@@ -542,5 +542,10 @@
|
||||
/// 原材料仓内转移策略
|
||||
/// </summary>
|
||||
public const string POLICY_YCLINSTOCK = "WISP202407250001";
|
||||
|
||||
/// <summary>
|
||||
/// 原材料仓出库策略
|
||||
/// </summary>
|
||||
public const string POLICY_YCLOUTSTOCK = "WOSP202407250002";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,5 +49,8 @@
|
||||
|
||||
// 是否过滤载具占用状态
|
||||
public bool filter_carry_status { get; set; } = true;
|
||||
|
||||
// 策略编号
|
||||
public string PolicyCode { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,13 +40,6 @@ namespace Tnb.WarehouseMgr.Interfaces
|
||||
/// <returns></returns>
|
||||
Task<List<WmsCarryH>> OutStockStrategy([FromQuery] OutStockStrategyQuery input);
|
||||
/// <summary>
|
||||
/// 原材料仓出库策略
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="AppFriendlyException"></exception>
|
||||
Task<List<WmsCarryH>> OutStockStrategyYCL([FromQuery] OutStockStrategyQuery input);
|
||||
/// <summary>
|
||||
/// 缓存仓出库策略
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
|
||||
@@ -344,7 +344,7 @@ namespace Tnb.WarehouseMgr
|
||||
{
|
||||
Logger.Error($"【UnloadConfirm】 根据参数,sourceName:{input.sourceName},taskCode:{input.taskCode},未找到匹配的电梯任务");
|
||||
}
|
||||
if (s_elevatorMap.TryGetValue(elevator.device_id, out object? elevatorCode))
|
||||
if (elevator != null && s_elevatorMap.TryGetValue(elevator.device_id, out object? elevatorCode))
|
||||
{
|
||||
if (!TimedTaskBackgroundService.elevatorStatus[elevatorCode.ToString()])
|
||||
{
|
||||
|
||||
@@ -485,51 +485,6 @@ namespace Tnb.WarehouseMgr
|
||||
return input.Size > 0 ? items.Take(input.Size).ToList() : items;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 原材料仓出库策略
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="AppFriendlyException"></exception>
|
||||
public async Task<List<WmsCarryH>> OutStockStrategyYCL([FromQuery] OutStockStrategyQuery input)
|
||||
{
|
||||
Expressionable<WmsCarryH, WmsCarryCode, BasLocation> whereExprable = Expressionable.Create<WmsCarryH, WmsCarryCode, BasLocation>()
|
||||
.And((a, b, c) => a.is_lock == 0 && c.is_lock == 0)
|
||||
.And((a, b, c) => !string.IsNullOrEmpty(a.location_id))
|
||||
.And((a, b, c) => c.is_type == ((int)EnumLocationType.存储库位).ToString())
|
||||
.And((a, b, c) => a.out_status == "0")
|
||||
.And((a, b, c) => c.wh_id == input.warehouse_id)
|
||||
.AndIF(!string.IsNullOrEmpty(input.material_id), (a, b, c) => b.material_id == input.material_id)
|
||||
.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);
|
||||
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();
|
||||
_ = whereExprable.And(carryStatusFilterExp);
|
||||
Expression<Func<WmsCarryH, WmsCarryCode, BasLocation, bool>> whereExpr = whereExprable.ToExpression();
|
||||
|
||||
SqlSugarClient cyDb = _db.CopyNew();
|
||||
WmsInstockPolicies policy = await cyDb.Queryable<WmsInstockPolicies>().Where(it => it.status == 1).FirstAsync();
|
||||
if (policy == null)
|
||||
{
|
||||
throw new AppFriendlyException("没有可用策略", 500);
|
||||
}
|
||||
|
||||
List<WmsCarryH> items = await cyDb.Queryable<WmsCarryH>().LeftJoin<WmsCarryCode>((a, b) => a.id == b.carry_id)
|
||||
.LeftJoin<BasLocation>((a, b, c) => a.location_id == c.id)
|
||||
.Where(whereExpr)
|
||||
//.OrderByIF((a,b,c)=>SqlFunc.IsNullOrEmpty())
|
||||
.OrderBy(policy.policy)
|
||||
|
||||
.Select<WmsCarryH>()
|
||||
.ToListAsync();
|
||||
|
||||
items = items.DistinctBy(r => r.id).ToList();
|
||||
return input.Size > 0 ? items.Take(input.Size).ToList() : items;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 缓存仓出库策略
|
||||
/// </summary>
|
||||
|
||||
@@ -219,15 +219,18 @@ namespace Tnb.WarehouseMgr
|
||||
throw new AppFriendlyException("批号不可为空", 500);
|
||||
}
|
||||
|
||||
//入库取终点 //出库起点
|
||||
OutStockStrategyQuery inStockStrategyInput = new()
|
||||
OutStockStrategyQuery outStockStrategyInput = new()
|
||||
{
|
||||
warehouse_id = WmsWareHouseConst.WAREHOUSE_YCL_ID,
|
||||
material_id = input.material_id,
|
||||
code_batch = input.code_batch,
|
||||
Size = input.palletCount
|
||||
Size = input.palletCount,
|
||||
Region_id = WmsWareHouseConst.REGION_Purchase_ID,
|
||||
PolicyCode = WmsWareHouseConst.POLICY_YCLOUTSTOCK,
|
||||
AvoidBusyPassage = true
|
||||
};
|
||||
List<WmsCarryH> items = await _wareHouseService.OutStockStrategyYCL(inStockStrategyInput);
|
||||
|
||||
List<WmsCarryH> items = await _wareHouseService.OutStockStrategy(outStockStrategyInput);
|
||||
|
||||
decimal qty = _db.Queryable<WmsCarryCode>().Where(r => items.Select(a => a.id).Contains(r.carry_id) && r.material_id == input.material_id && r.code_batch == input.code_batch).Sum(r => r.codeqty);
|
||||
|
||||
@@ -332,9 +335,10 @@ namespace Tnb.WarehouseMgr
|
||||
|
||||
await _db.Ado.BeginTranAsync();
|
||||
|
||||
//入库取终点 //出库起点
|
||||
OutStockStrategyQuery inStockStrategyInput = new() { warehouse_id = WmsWareHouseConst.WAREHOUSE_YCL_ID, material_id = wmsMaterialTransferD.material_id, code_batch = input.code_batch, Size = input.palletCount };
|
||||
List<WmsCarryH> items = await _wareHouseService.OutStockStrategyYCL(inStockStrategyInput);
|
||||
OutStockStrategyQuery outStockStrategyInput = new() { warehouse_id = WmsWareHouseConst.WAREHOUSE_YCL_ID, material_id = wmsMaterialTransferD.material_id,
|
||||
code_batch = input.code_batch, Size = input.palletCount,Region_id = WmsWareHouseConst.REGION_Purchase_ID,PolicyCode = WmsWareHouseConst.POLICY_YCLOUTSTOCK,
|
||||
AvoidBusyPassage = true};
|
||||
List<WmsCarryH> items = await _wareHouseService.OutStockStrategy(outStockStrategyInput);
|
||||
|
||||
if (items.Count == 0)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user