原材料转库、出库签收

This commit is contained in:
2024-05-21 15:00:13 +08:00
parent ccb52b157d
commit c40ce51e77
13 changed files with 528 additions and 53 deletions

View File

@@ -227,6 +227,18 @@ namespace Tnb.WarehouseMgr
, WmsWareHouseConst.FinishproductOutstockStation3 };
}
/// <summary>
/// 是否为三工位库位
/// </summary>
/// <param name="location_id"></param>
/// <returns></returns>
public string[] GetFloor1SGWOutstockLocation()
{
return new string[3] { WmsWareHouseConst.Floor1SGWOutstockStation1 , WmsWareHouseConst.Floor1SGWOutstockStation2
, WmsWareHouseConst.Floor1SGWOutstockStation3 };
}
/// <summary>
/// 出库策略-销售出库下发
/// </summary>
@@ -1633,8 +1645,8 @@ namespace Tnb.WarehouseMgr
//更新电梯任务数量
_ = await _db.Updateable<WmsElevatorH>().SetColumns(it => new WmsElevatorH { task_nums = it.task_nums - 1}).Where(it => disTasks.Select(x => x.area_code).Contains(it.area_code)).ExecuteCommandAsync();
// 更新中储仓任务数量
_ = await _db.Updateable<BasLocation>().SetColumns(it => new BasLocation { task_nums = it.task_nums - 1 }).Where(it => disTasks.Where(r => r.startlocation_code.Contains("SSX-111-011") || r.startlocation_code.Contains("SSX-111-012")).Select(x => x.startlocation_code).Contains(it.location_code)).ExecuteCommandAsync();
// 更新任务数量
_ = await _db.Updateable<BasLocation>().SetColumns(it => new BasLocation { task_nums = it.task_nums - 1 }).Where(it => disTasks.Select(x => x.endlocation_code).Contains(it.location_code)).ExecuteCommandAsync();
//更新载具,锁定状态为未锁定,更新载具的库位当前任务的目标库位
@@ -1712,6 +1724,12 @@ namespace Tnb.WarehouseMgr
await _db.Updateable<WmsTransferInstockD>().SetColumns(r => r.qty == r.qty + wmsCarryCode.codeqty).Where(r => r.id == dt.require_id).ExecuteCommandAsync();
}
}
// 原材料转库单
else if (dt.biz_type == WmsWareHouseConst.BIZTYPE_WMSMATERIALTRANSFER_ID)
{
WmsCarryCode wmsCarryCode = await _db.Queryable<WmsCarryCode>().Where(r => r.carry_id == dt.carry_id).FirstAsync();
await _db.Updateable<WmsMaterialTransferD>().SetColumns(r => r.yzqty == r.yzqty + wmsCarryCode.codeqty).Where(r => r.id == dt.require_id).ExecuteCommandAsync();
}
List<WmsDistaskCode> disTaskCodes = await _db.Queryable<WmsDistaskCode>().Where(it => it.bill_id == dt.id).ToListAsync();
@@ -2312,7 +2330,7 @@ namespace Tnb.WarehouseMgr
bill_code = bill_code,
status = WmsWareHouseConst.PRETASK_BILL_STATUS_DXF_ID,
biz_type = WmsWareHouseConst.BIZTYPE_WMSEMPTYINSTOCK_ID,
task_type = "",
task_type = WmsWareHouseConst.WMS_PRETASK_INSTOCK_TYPE_ID,
carry_id = wmsCarryD.membercarry_id,
carry_code = wmsCarryD.membercarry_code,
area_id = sPoint?.area_id!,
@@ -2402,46 +2420,51 @@ namespace Tnb.WarehouseMgr
//根据获取的路径点生成预任务,生成顺序必须预路径算法返回的起终点的顺序一致(预任务顺序)
WmsPretaskH preTask = null;
string bill_code = _billRullService.GetBillNumber(WmsWareHouseConst.WMS_PRETASK_H_ENCODE).GetAwaiter().GetResult();
string carry_id = "";
string carry_code = "";
WmsCarryH wmsCarryH = null;
if (!string.IsNullOrEmpty(input.carry_id) && !string.IsNullOrEmpty(input.carry_code))
{
carry_id = input.carry_id;
carry_code = input.carry_code;
}
// 如果指定了carry_id
else if (!string.IsNullOrEmpty(input.carry_id))
{
wmsCarryH = _db.Queryable<WmsCarryH>().Where(r => r.id == input.carry_id).First();
}
// carry_code
else if (!string.IsNullOrEmpty(input.carry_code))
{
wmsCarryH = _db.Queryable<WmsCarryH>().Where(r => r.carry_code == input.carry_code).First();
}
// 如果carry_id和carry_code都没有指定随机取库位上载具记录的一条
else
{
wmsCarryH = _db.Queryable<BasLocation>().InnerJoin<WmsCarryH>((a, b) => a.id == b.location_id)
.Where((a, b) => a.id == sPoint.location_id).Select((a, b) => b).First();
}
if (wmsCarryH != null)
{
carry_id = wmsCarryH.id;
carry_code = wmsCarryH.carry_code;
}
if (string.IsNullOrEmpty(carry_id))
{
throw new AppFriendlyException("起点库位上没有载具", 500);
}
List<WmsPretaskH> preTasks = points.Where(it => !it.location_id.IsNullOrEmpty()).GroupBy(g => g.area_code).Select(it =>
{
WmsPointH? sPoint = it.FirstOrDefault();
WmsPointH? ePoint = it.LastOrDefault();
string carry_id = "";
string carry_code = "";
WmsCarryH wmsCarryH = null;
if (!string.IsNullOrEmpty(input.carry_id) && !string.IsNullOrEmpty(input.carry_code))
{
carry_id = input.carry_id;
carry_code = input.carry_code;
}
// 如果指定了carry_id
else if (!string.IsNullOrEmpty(input.carry_id))
{
wmsCarryH = _db.Queryable<WmsCarryH>().Where(r => r.id == input.carry_id).First();
}
// carry_code
else if (!string.IsNullOrEmpty(input.carry_code))
{
wmsCarryH = _db.Queryable<WmsCarryH>().Where(r => r.carry_code == input.carry_code).First();
}
// 如果carry_id和carry_code都没有指定随机取库位上载具记录的一条
else
{
wmsCarryH = _db.Queryable<BasLocation>().InnerJoin<WmsCarryH>((a, b) => a.id == b.location_id)
.Where((a, b) => a.id == sPoint.location_id).Select((a, b) => b).First();
}
if (wmsCarryH != null)
{
carry_id = wmsCarryH.id;
carry_code = wmsCarryH.carry_code;
}
if (string.IsNullOrEmpty(carry_id))
{
throw new AppFriendlyException("起点库位上没有载具", 500);
}
preTask = new()
{
@@ -2464,7 +2487,7 @@ namespace Tnb.WarehouseMgr
carry_code = carry_code,
area_id = sPoint?.area_id!,
area_code = it.Key,
require_id = "",
require_id = input.require_id,
require_code = "",
create_id = _userManager.UserId,
create_time = DateTime.Now
@@ -2491,7 +2514,7 @@ namespace Tnb.WarehouseMgr
}
finally
{
await GenTaskExecute();
GenTaskExecute();
}
}