执行代码清理,修复warning
This commit is contained in:
@@ -56,8 +56,8 @@ namespace Tnb.WarehouseMgr
|
||||
[HttpPost]
|
||||
public async Task RobotCallback(RobotCallBackInput input)
|
||||
{
|
||||
var carry = await _db.Queryable<WmsCarryH>().SingleAsync(it => it.id == input.carry_id);
|
||||
var subCarry = await _db.Queryable<WmsCarryH>().SingleAsync(it => it.id == input.membercarry_id);
|
||||
WmsCarryH carry = await _db.Queryable<WmsCarryH>().SingleAsync(it => it.id == input.carry_id);
|
||||
WmsCarryH subCarry = await _db.Queryable<WmsCarryH>().SingleAsync(it => it.id == input.membercarry_id);
|
||||
if (carry != null && subCarry != null)
|
||||
{
|
||||
VisualDevModelDataCrInput visualDevModelCrInput = new() { data = new Dictionary<string, object>() };
|
||||
@@ -75,12 +75,12 @@ namespace Tnb.WarehouseMgr
|
||||
carry.collocation_scheme_id = subCarry.collocation_scheme_id;
|
||||
carry.collocation_scheme_code = subCarry.collocation_scheme_code;
|
||||
carry.carry_status = ((int)EnumCarryStatus.齐套).ToString();
|
||||
await _db.Updateable(carry).UpdateColumns(it => new { it.collocation_scheme_id, it.collocation_scheme_code, it.carry_status }).ExecuteCommandAsync();
|
||||
_ = await _db.Updateable(carry).UpdateColumns(it => new { it.collocation_scheme_id, it.collocation_scheme_code, it.carry_status }).ExecuteCommandAsync();
|
||||
|
||||
|
||||
if (input.isLast)
|
||||
{
|
||||
var kittingout = await _db.Queryable<WmsKittingoutH>().FirstAsync(it => it.collocation_scheme_id == carry.collocation_scheme_id && it.status == WmsWareHouseConst.BILLSTATUS_CALLED_ID);
|
||||
WmsKittingoutH kittingout = await _db.Queryable<WmsKittingoutH>().FirstAsync(it => it.collocation_scheme_id == carry.collocation_scheme_id && it.status == WmsWareHouseConst.BILLSTATUS_CALLED_ID);
|
||||
if (kittingout != null)
|
||||
{
|
||||
|
||||
@@ -88,24 +88,26 @@ namespace Tnb.WarehouseMgr
|
||||
await Publish(nameof(IWmskittingOutService.KittingOutByIsToBeShipped));
|
||||
|
||||
|
||||
visualDevModelCrInput.data = new Dictionary<string, object>();
|
||||
visualDevModelCrInput.data[nameof(InStockStrategyQuery.warehouse_id)] = kittingout.warehouse_id;
|
||||
visualDevModelCrInput.data[nameof(WmsKittingInstock.carry_id)] = input.carry_id;
|
||||
visualDevModelCrInput.data[nameof(WmsKittingInstock.carry_code)] = input.carry_code;
|
||||
visualDevModelCrInput.data[nameof(WmsKittingInstock.collocation_scheme_id)] = carry!.collocation_scheme_id!;
|
||||
visualDevModelCrInput.data[nameof(WmsKittingInstock.collocation_scheme_code)] = carry!.collocation_scheme_code!;
|
||||
visualDevModelCrInput.data[nameof(WmsKittingInstock.seq)] = kittingout.seq;
|
||||
visualDevModelCrInput.data[nameof(WmsKittingInstock.biz_type)] = WmsWareHouseConst.BIZTYPE_WMSKITTINGINSTK_ID;
|
||||
visualDevModelCrInput.data[nameof(WmsKittingInstock.status)] = WmsWareHouseConst.BILLSTATUS_ADD_ID;
|
||||
visualDevModelCrInput.data[nameof(WmsKittingInstock.create_id)] = _userManager.UserId;
|
||||
visualDevModelCrInput.data[nameof(WmsKittingInstock.create_time)] = DateTime.Now;
|
||||
visualDevModelCrInput.data[nameof(WmsKittingInstock.location_id)] = carry!.location_id!;
|
||||
visualDevModelCrInput.data[nameof(WmsKittingInstock.bill_code)] = _billRullService.GetBillNumber("WmsKittingInStk").GetAwaiter().GetResult();
|
||||
visualDevModelCrInput.data[nameof(WmsKittingInstock.source_id)] = kittingout.id;
|
||||
visualDevModelCrInput.data[nameof(WmsKittingInstock.source_code)] = kittingout.bill_code;
|
||||
visualDevModelCrInput.data = new Dictionary<string, object>
|
||||
{
|
||||
[nameof(InStockStrategyQuery.warehouse_id)] = kittingout.warehouse_id,
|
||||
[nameof(WmsKittingInstock.carry_id)] = input.carry_id,
|
||||
[nameof(WmsKittingInstock.carry_code)] = input.carry_code,
|
||||
[nameof(WmsKittingInstock.collocation_scheme_id)] = carry!.collocation_scheme_id!,
|
||||
[nameof(WmsKittingInstock.collocation_scheme_code)] = carry!.collocation_scheme_code!,
|
||||
[nameof(WmsKittingInstock.seq)] = kittingout.seq,
|
||||
[nameof(WmsKittingInstock.biz_type)] = WmsWareHouseConst.BIZTYPE_WMSKITTINGINSTK_ID,
|
||||
[nameof(WmsKittingInstock.status)] = WmsWareHouseConst.BILLSTATUS_ADD_ID,
|
||||
[nameof(WmsKittingInstock.create_id)] = _userManager.UserId,
|
||||
[nameof(WmsKittingInstock.create_time)] = DateTime.Now,
|
||||
[nameof(WmsKittingInstock.location_id)] = carry!.location_id!,
|
||||
[nameof(WmsKittingInstock.bill_code)] = _billRullService.GetBillNumber("WmsKittingInStk").GetAwaiter().GetResult(),
|
||||
[nameof(WmsKittingInstock.source_id)] = kittingout.id,
|
||||
[nameof(WmsKittingInstock.source_code)] = kittingout.bill_code
|
||||
};
|
||||
|
||||
|
||||
var location = await _db.Queryable<BasLocation>().SingleAsync(it => it.id == kittingout.location_id);
|
||||
BasLocation? location = await _db.Queryable<BasLocation>().SingleAsync(it => it.id == kittingout.location_id);
|
||||
if (kittingout.location_id.IsNullOrWhiteSpace() || (location != null && location.is_type.ToEnum<EnumLocationType>() == EnumLocationType.存储库位))
|
||||
{
|
||||
//入库
|
||||
@@ -116,18 +118,18 @@ namespace Tnb.WarehouseMgr
|
||||
if (location != null && location.is_use == ((int)EnumCarryStatus.空闲).ToString() && location.is_lock == 0)
|
||||
{
|
||||
//出库
|
||||
var sPoint = await _db.Queryable<WmsPointH>().FirstAsync(it => it.location_id == carry.location_id);
|
||||
var ePoint = await _db.Queryable<WmsPointH>().FirstAsync(it => it.location_id == kittingout.location_id);
|
||||
WmsPointH sPoint = await _db.Queryable<WmsPointH>().FirstAsync(it => it.location_id == carry.location_id);
|
||||
WmsPointH ePoint = await _db.Queryable<WmsPointH>().FirstAsync(it => it.location_id == kittingout.location_id);
|
||||
if (sPoint != null && ePoint != null)
|
||||
{
|
||||
var kittingOutObj = new { requireId = kittingout.id, requireCode = kittingout.bill_code };
|
||||
var preTasks = await _genPreTask(sPoint, ePoint, carry, kittingOutObj);
|
||||
var carryCodes = await _db.Queryable<WmsCarryCode>().Where(it => it.carry_id == carry.id).ToListAsync();
|
||||
List<WmsPretaskH> preTasks = await _genPreTask(sPoint, ePoint, carry, kittingOutObj);
|
||||
List<WmsCarryCode> carryCodes = await _db.Queryable<WmsCarryCode>().Where(it => it.carry_id == carry.id).ToListAsync();
|
||||
List<WmsPretaskCode> pretaskCodes = new();
|
||||
foreach (var pt in preTasks)
|
||||
foreach (WmsPretaskH pt in preTasks)
|
||||
{
|
||||
var partCodes = carryCodes.FindAll(x => x.carry_id == pt.carry_id).Distinct().ToList();
|
||||
var curPreTaskCodes = partCodes.Adapt<List<WmsPretaskCode>>();
|
||||
List<WmsCarryCode> partCodes = carryCodes.FindAll(x => x.carry_id == pt.carry_id).Distinct().ToList();
|
||||
List<WmsPretaskCode> curPreTaskCodes = partCodes.Adapt<List<WmsPretaskCode>>();
|
||||
curPreTaskCodes.ForEach(x =>
|
||||
{
|
||||
x.id = SnowflakeIdHelper.NextId();
|
||||
@@ -136,12 +138,14 @@ namespace Tnb.WarehouseMgr
|
||||
});
|
||||
pretaskCodes.AddRange(curPreTaskCodes);
|
||||
}
|
||||
await _warehouseService.GenPreTask(preTasks, pretaskCodes);
|
||||
_ = await _warehouseService.GenPreTask(preTasks, pretaskCodes);
|
||||
kittingout.status = WmsWareHouseConst.BILLSTATUS_ON_ID;
|
||||
await _db.Updateable(kittingout).UpdateColumns(it => it.status).ExecuteCommandAsync();
|
||||
GenPreTaskUpInput genPreTaskAfterUpInput = new();
|
||||
genPreTaskAfterUpInput.CarryIds = preTasks.Select(x => x.carry_id).ToList();
|
||||
genPreTaskAfterUpInput.LocationIds = new List<string> { carry.location_id! };
|
||||
_ = await _db.Updateable(kittingout).UpdateColumns(it => it.status).ExecuteCommandAsync();
|
||||
GenPreTaskUpInput genPreTaskAfterUpInput = new()
|
||||
{
|
||||
CarryIds = preTasks.Select(x => x.carry_id).ToList(),
|
||||
LocationIds = new List<string> { carry.location_id! }
|
||||
};
|
||||
await _warehouseService.GenInStockTaskHandleAfter(genPreTaskAfterUpInput, it => new WmsCarryH { is_lock = 1 }, it => new BasLocation { is_lock = 1 });
|
||||
|
||||
await InvokeGenPretaskExcute();
|
||||
@@ -161,36 +165,42 @@ namespace Tnb.WarehouseMgr
|
||||
private async Task<List<WmsPretaskH>> _genPreTask(WmsPointH sPoint, WmsPointH ePoint, WmsCarryH carry, dynamic KittingOutObj)
|
||||
{
|
||||
List<WmsPretaskH> preTasks = new();
|
||||
var points = await _warehouseService.PathAlgorithms(sPoint.id, ePoint.id);
|
||||
List<WmsPointH> points = await _warehouseService.PathAlgorithms(sPoint.id, ePoint.id);
|
||||
//根据获取的路径点生成预任务,生成顺序必须预路径算法返回的起终点的顺序一致(预任务顺序)
|
||||
if (points.Count <= 2) throw new AppFriendlyException("该路径不存在", 500);
|
||||
if (points.Count <= 2)
|
||||
{
|
||||
throw new AppFriendlyException("该路径不存在", 500);
|
||||
}
|
||||
|
||||
if (points?.Count > 0)
|
||||
{
|
||||
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();
|
||||
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 = WmsWareHouseConst.BIZTYPE_WMSKITTINGOUTSTK_ID;
|
||||
preTask.task_type = WmsWareHouseConst.WMS_PRETASK_OUTSTOCK_TYPE_ID;
|
||||
preTask.carry_id = carry.id!;
|
||||
preTask.carry_code = carry.carry_code!;
|
||||
preTask.area_id = sPoint?.area_id!;
|
||||
preTask.area_code = it.Key;
|
||||
preTask.require_id = KittingOutObj.requireId;
|
||||
preTask.require_code = KittingOutObj.requireCode;
|
||||
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 = WmsWareHouseConst.BIZTYPE_WMSKITTINGOUTSTK_ID,
|
||||
task_type = WmsWareHouseConst.WMS_PRETASK_OUTSTOCK_TYPE_ID,
|
||||
carry_id = carry.id!,
|
||||
carry_code = carry.carry_code!,
|
||||
area_id = sPoint?.area_id!,
|
||||
area_code = it.Key,
|
||||
require_id = KittingOutObj.requireId,
|
||||
require_code = KittingOutObj.requireCode,
|
||||
create_id = _userManager.UserId,
|
||||
create_time = DateTime.Now
|
||||
};
|
||||
return preTask;
|
||||
}).ToList();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user