调整wareHouseService部分代码

This commit is contained in:
alex
2023-07-14 11:07:07 +08:00
parent 1eaae0a983
commit cc6010be4e
2 changed files with 34 additions and 29 deletions

View File

@@ -99,34 +99,37 @@ namespace Tnb.WarehouseMgr
{
var points = await _wareHouseService.PathAlgorithms(sPoint.id, ePoint.id);
//根据获取的路径点生成预任务,生成顺序必须预路径算法返回的起终点的顺序一致(预任务顺序)
if (points?.Count <= 2) throw new AppFriendlyException("该路径不存在", 500);
if (points?.Count > 0)
{
if (points.Count <= 2) throw new AppFriendlyException("该路径不存在", 500);
var preTasks = points.Where(it => !it.location_id.IsNullOrEmpty()).GroupBy(g => g.area_code).Select(it =>
{
var sPoint = it.FirstOrDefault();
var ePoint = it.LastOrDefault();
WmsPretaskH preTask = new();
preTask.org_id = _userManager.User.OrganizeId;
preTask.startlocation_id = sPoint?.location_id!;
preTask.startlocation_code = sPoint?.location_code!;
preTask.endlocation_id = ePoint?.location_id!;
preTask.endlocation_code = ePoint?.location_code!;
preTask.start_floor = sPoint?.floor.ToString();
preTask.end_floor = ePoint?.floor.ToString();
preTask.bill_code = _billRullService.GetBillNumber(WmsWareHouseConst.WMS_PRETASK_H_ENCODE).GetAwaiter().GetResult();
preTask.status = WmsWareHouseConst.PRETASK_BILL_STATUS_DXF_ID;
preTask.biz_type = input.data[nameof(WmsPretaskH.biz_type)]?.ToString()!;
preTask.task_type = WmsWareHouseConst.WMS_PRETASK_INSTOCK_TYPE_ID;
preTask.carry_id = input.data[nameof(preTask.carry_id)]?.ToString()!;
preTask.carry_code = input.data[nameof(preTask.carry_code)]?.ToString()!;
preTask.area_id = sPoint?.area_id!;
preTask.area_code = it.Key;
preTask.require_id = input.data[nameof(WmsHandleH.require_id)].ToString();
preTask.require_code = input.data[nameof(WmsHandleH.require_code)]?.ToString()!;
preTask.create_id = _userManager.UserId;
preTask.create_time = DateTime.Now;
WmsPretaskH preTask = new()
{
org_id = _userManager.User.OrganizeId,
startlocation_id = sPoint?.location_id ?? "",
startlocation_code = sPoint?.location_code ?? "",
endlocation_id = ePoint?.location_id ?? "",
endlocation_code = ePoint?.location_code ?? "",
start_floor = sPoint?.floor.ToString(),
end_floor = ePoint?.floor.ToString(),
bill_code = _billRullService.GetBillNumber(WmsWareHouseConst.WMS_PRETASK_H_ENCODE).GetAwaiter().GetResult(),
status = WmsWareHouseConst.PRETASK_BILL_STATUS_DXF_ID,
biz_type = input.data[nameof(WmsPretaskH.biz_type)]?.ToString() ?? "",
task_type = WmsWareHouseConst.WMS_PRETASK_INSTOCK_TYPE_ID,
carry_id = input.data[nameof(preTask.carry_id)]?.ToString() ?? "",
carry_code = input.data[nameof(preTask.carry_code)]?.ToString() ?? "",
area_id = sPoint?.area_id ?? "",
area_code = it.Key,
require_id = input.data[nameof(WmsHandleH.require_id)].ToString(),
require_code = input.data[nameof(WmsHandleH.require_code)]?.ToString(),
create_id = _userManager.UserId,
create_time = DateTime.Now,
};
return preTask;
}).ToList();
//生成预任务条码信息
@@ -297,7 +300,7 @@ namespace Tnb.WarehouseMgr
}
}
await _db.Updateable(instockDetails).ExecuteCommandAsync();
var allInstockDetails = await _db.Queryable<WmsInstockD>().Where(it=>it.bill_id ==input.requireId).ToListAsync();
var allInstockDetails = await _db.Queryable<WmsInstockD>().Where(it => it.bill_id == input.requireId).ToListAsync();
if (allInstockDetails.All(x => x.line_status == WmsWareHouseConst.BILLSTATUS_COMPLETE_ID))
{
await _db.Updateable<WmsInstockH>().SetColumns(it => new WmsInstockH { status = WmsWareHouseConst.BILLSTATUS_COMPLETE_ID }).Where(it => it.id == input.requireId).ExecuteCommandAsync();