执行代码清理,修复warning
This commit is contained in:
@@ -71,15 +71,15 @@ namespace Tnb.WarehouseMgr
|
||||
var inStockStrategyInput = new InStockStrategyQuery { warehouse_id = input.data[nameof(InStockStrategyQuery.warehouse_id)].ToString(), Size = 1 };
|
||||
var endLocations = await _wareHouseService.InStockStrategy(inStockStrategyInput);*/
|
||||
//判断目标库位是否自动签收
|
||||
var loc = await _db.Queryable<BasLocation>().SingleAsync(it => it.id == input.data[nameof(WmsPointH.location_id)].ToString());
|
||||
BasLocation loc = await _db.Queryable<BasLocation>().SingleAsync(it => it.id == input.data[nameof(WmsPointH.location_id)].ToString());
|
||||
//出库取起点,获取所有符合输入的载具规格的载具
|
||||
var OutStockStrategyInput = new OutStockStrategyQuery
|
||||
OutStockStrategyQuery OutStockStrategyInput = new()
|
||||
{
|
||||
carrystd_id = input.data[nameof(OutStockStrategyQuery.carrystd_id)].ToString(),
|
||||
warehouse_id = input.data[nameof(OutStockStrategyQuery.warehouse_id)].ToString(),
|
||||
|
||||
};
|
||||
var carrys = await _wareHouseService.OutStockStrategy(OutStockStrategyInput);
|
||||
List<WmsCarryH>? carrys = await _wareHouseService.OutStockStrategy(OutStockStrategyInput);
|
||||
//var carrys = await _db.Queryable<WmsCarryH>().LeftJoin<BasLocation>((a, b) => a.location_id == b.id)
|
||||
// .Where((a, b) => a.carrystd_id == input.data[nameof(WmsEmptyOutstockH.carrystd_id)].ToString()
|
||||
// && a.carry_status == ((int)EnumCarryStatus.空闲).ToString() && a.is_lock == 0 && b.is_lock == 0 && b.is_type == ((int)EnumLocationType.存储库位).ToString())
|
||||
@@ -87,9 +87,12 @@ namespace Tnb.WarehouseMgr
|
||||
// 判断最终目标库位是否可以放置当前载具
|
||||
if (carrys?.Count > 0)
|
||||
{
|
||||
var curCarry = carrys[^carrys.Count];
|
||||
var isMatch = await IsCarryAndLocationMatchByCarryStd(curCarry, loc);
|
||||
if (!isMatch) throw new AppFriendlyException("该载具无法放置到目标库位", 500);
|
||||
WmsCarryH curCarry = carrys[^carrys.Count];
|
||||
bool isMatch = await IsCarryAndLocationMatchByCarryStd(curCarry, loc);
|
||||
if (!isMatch)
|
||||
{
|
||||
throw new AppFriendlyException("该载具无法放置到目标库位", 500);
|
||||
}
|
||||
|
||||
VisualDevEntity? templateEntity = await _visualDevService.GetInfoById(ModuleConsts.MODULE_WMSEMPTYOUTSTK_ID, true);
|
||||
await _runService.Create(templateEntity, input);
|
||||
@@ -97,7 +100,7 @@ namespace Tnb.WarehouseMgr
|
||||
}
|
||||
|
||||
|
||||
var setQty = await _db.Queryable<WmsEmptyOutstockH>().FirstAsync(it => it.bill_code == input.data[nameof(WmsEmptyOutstockH.bill_code)].ToString());
|
||||
WmsEmptyOutstockH setQty = await _db.Queryable<WmsEmptyOutstockH>().FirstAsync(it => it.bill_code == input.data[nameof(WmsEmptyOutstockH.bill_code)].ToString());
|
||||
WmsPointH? sPoint = null;
|
||||
WmsPointH? ePoint = null;
|
||||
if (input.data.ContainsKey(nameof(WmsPointH.location_id)))
|
||||
@@ -112,18 +115,21 @@ namespace Tnb.WarehouseMgr
|
||||
{
|
||||
sPoint = await _db.Queryable<WmsPointH>().FirstAsync(it => it.location_id == carrys[i].location_id);
|
||||
|
||||
var isOk = false;
|
||||
bool isOk = false;
|
||||
if (sPoint != null && ePoint != null)
|
||||
{
|
||||
var points = await _wareHouseService.PathAlgorithms(sPoint.id, ePoint.id);
|
||||
if (points.Count <= 2) throw new AppFriendlyException("该路径不存在", 500);
|
||||
List<WmsPointH> points = await _wareHouseService.PathAlgorithms(sPoint.id, ePoint.id);
|
||||
if (points.Count <= 2)
|
||||
{
|
||||
throw new AppFriendlyException("该路径不存在", 500);
|
||||
}
|
||||
//根据获取的路径点生成预任务,生成顺序必须预路径算法返回的起终点的顺序一致(预任务顺序)
|
||||
else
|
||||
{
|
||||
var preTasks = points.Where(it => !it.location_id.IsNullOrEmpty()).GroupBy(g => g.area_code).Select(it =>
|
||||
List<WmsPretaskH> preTasks = points.Where(it => !it.location_id.IsNullOrEmpty()).GroupBy(g => g.area_code).Select(it =>
|
||||
{
|
||||
var sPoint = it.FirstOrDefault();
|
||||
var ePoint = it.LastOrDefault();
|
||||
WmsPointH? sPoint = it.FirstOrDefault();
|
||||
WmsPointH? ePoint = it.LastOrDefault();
|
||||
|
||||
WmsPretaskH preTask = new()
|
||||
{
|
||||
@@ -186,11 +192,11 @@ namespace Tnb.WarehouseMgr
|
||||
create_id = _userManager.UserId,
|
||||
create_time = DateTime.Now
|
||||
};
|
||||
await _db.Insertable(wmsEmptyOutstockD)
|
||||
_ = await _db.Insertable(wmsEmptyOutstockD)
|
||||
.ExecuteCommandAsync();
|
||||
|
||||
//根据空载具出库Id,回更单据状态
|
||||
await _db.Updateable<WmsEmptyOutstockH>().SetColumns(it => new WmsEmptyOutstockH { status = WmsWareHouseConst.BILLSTATUS_ON_ID }).Where(it => it.id == preTaskUpInput.RquireId).ExecuteCommandAsync();
|
||||
_ = await _db.Updateable<WmsEmptyOutstockH>().SetColumns(it => new WmsEmptyOutstockH { status = WmsWareHouseConst.BILLSTATUS_ON_ID }).Where(it => it.id == preTaskUpInput.RquireId).ExecuteCommandAsync();
|
||||
await _wareHouseService.GenInStockTaskHandleAfter(preTaskUpInput,
|
||||
it => new WmsCarryH { is_lock = 1 },
|
||||
it => new BasLocation { is_lock = 1 });
|
||||
@@ -217,23 +223,30 @@ namespace Tnb.WarehouseMgr
|
||||
return Task.FromResult(true);
|
||||
}
|
||||
|
||||
public async override Task ModifyAsync(WareHouseUpInput input)
|
||||
public override async Task ModifyAsync(WareHouseUpInput input)
|
||||
{
|
||||
if (input == null) throw new ArgumentNullException(nameof(input));
|
||||
if (input == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(input));
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
await _db.Ado.BeginTranAsync();
|
||||
|
||||
//根据载具更新明细表状态
|
||||
var isOk = await _db.Updateable<WmsEmptyOutstockD>().SetColumns(it => new WmsEmptyOutstockD { status = WmsWareHouseConst.BILLSTATUS_COMPLETE_ID }).Where(it => it.bill_id == input.requireId && input.carryIds.Contains(it.carry_id)).ExecuteCommandHasChangeAsync();
|
||||
bool isOk = await _db.Updateable<WmsEmptyOutstockD>().SetColumns(it => new WmsEmptyOutstockD { status = WmsWareHouseConst.BILLSTATUS_COMPLETE_ID }).Where(it => it.bill_id == input.requireId && input.carryIds.Contains(it.carry_id)).ExecuteCommandHasChangeAsync();
|
||||
|
||||
var emptyCarrys = await _db.Queryable<WmsEmptyOutstockD>().Where(it => it.bill_id == input.requireId).ToListAsync();
|
||||
List<WmsEmptyOutstockD> emptyCarrys = await _db.Queryable<WmsEmptyOutstockD>().Where(it => it.bill_id == input.requireId).ToListAsync();
|
||||
// 判断所有明细是否都完成
|
||||
if (emptyCarrys?.Count > 0 && emptyCarrys.All(x => x.status == WmsWareHouseConst.BILLSTATUS_COMPLETE_ID))
|
||||
{
|
||||
isOk = await _db.Updateable<WmsEmptyOutstockH>().SetColumns(it => new WmsEmptyOutstockH { status = WmsWareHouseConst.BILLSTATUS_COMPLETE_ID }).Where(it => it.id == input.requireId).ExecuteCommandHasChangeAsync();
|
||||
}
|
||||
if (!isOk) throw Oops.Oh(ErrorCode.COM1001);
|
||||
if (!isOk)
|
||||
{
|
||||
throw Oops.Oh(ErrorCode.COM1001);
|
||||
}
|
||||
|
||||
await _db.Ado.CommitTranAsync();
|
||||
}
|
||||
@@ -252,10 +265,14 @@ namespace Tnb.WarehouseMgr
|
||||
[HttpPost]
|
||||
public async Task<dynamic> MESEmptyCarryOutStk(MESEmptyCarryOutStkInput input)
|
||||
{
|
||||
if (input.IsNull()) throw new ArgumentNullException("input");
|
||||
if (input.IsNull())
|
||||
{
|
||||
throw new ArgumentNullException("input");
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
var location = await _db.Queryable<BasLocation>().SingleAsync(it => it.location_code == input.location_code && it.is_type != EnumLocationType.存储库位.ToString()) ?? throw new AppFriendlyException("无此库位或为存储库位", 500);
|
||||
BasLocation location = await _db.Queryable<BasLocation>().SingleAsync(it => it.location_code == input.location_code && it.is_type != EnumLocationType.存储库位.ToString()) ?? throw new AppFriendlyException("无此库位或为存储库位", 500);
|
||||
Dictionary<string, object> dic = new()
|
||||
{
|
||||
[nameof(WmsEmptyOutstockH.id)] = SnowflakeIdHelper.NextId(),
|
||||
@@ -270,7 +287,7 @@ namespace Tnb.WarehouseMgr
|
||||
[nameof(WmsEmptyOutstockH.create_time)] = DateTime.Now
|
||||
};
|
||||
|
||||
VisualDevModelDataCrInput visualDevModelDataCrInput = new VisualDevModelDataCrInput
|
||||
VisualDevModelDataCrInput visualDevModelDataCrInput = new()
|
||||
{
|
||||
data = dic,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user