Merge branch 'dev' of https://git.tuotong-tech.com/tnb/tnb.server into dev
This commit is contained in:
@@ -136,75 +136,76 @@ namespace Tnb.WarehouseMgr
|
|||||||
await _db.Updateable<WmsCarryH>().SetColumns(it => new WmsCarryH { out_status = ((int)EnumOutStatus.全部出).ToString() }).Where(it => allOutIds.Contains(it.id)).ExecuteCommandAsync();
|
await _db.Updateable<WmsCarryH>().SetColumns(it => new WmsCarryH { out_status = ((int)EnumOutStatus.全部出).ToString() }).Where(it => allOutIds.Contains(it.id)).ExecuteCommandAsync();
|
||||||
await _db.Updateable<WmsCarryH>().SetColumns(it => new WmsCarryH { out_status = ((int)EnumOutStatus.分拣出).ToString() }).Where(it => sortingOutIds.Contains(it.id)).ExecuteCommandAsync();
|
await _db.Updateable<WmsCarryH>().SetColumns(it => new WmsCarryH { out_status = ((int)EnumOutStatus.分拣出).ToString() }).Where(it => sortingOutIds.Contains(it.id)).ExecuteCommandAsync();
|
||||||
}
|
}
|
||||||
}
|
var carrys = await _db.Queryable<WmsCarryH>().Where(it => carryIds.Contains(it.id)).ToListAsync();
|
||||||
else throw new AppFriendlyException($"请输入物料明细", 500);
|
if (carrys?.Count > 0)
|
||||||
var carrys = await _db.Queryable<WmsCarryH>().Where(it => carryIds.Contains(it.id)).ToListAsync();
|
|
||||||
if (carrys?.Count > 0)
|
|
||||||
{
|
|
||||||
List<WmsPretaskH> preTasks = new();
|
|
||||||
List<string> locIds = new();
|
|
||||||
foreach (var carry in carrys)
|
|
||||||
{
|
{
|
||||||
WmsPointH sPoint = null;
|
List<WmsPretaskH> preTasks = new();
|
||||||
WmsPointH ePoint = null;
|
List<string> locIds = new();
|
||||||
if (input.data.ContainsKey(nameof(WmsPointH.location_id)))
|
foreach (var carry in carrys)
|
||||||
{
|
{
|
||||||
sPoint = await _db.Queryable<WmsPointH>().FirstAsync(it => it.location_id == carry.location_id);
|
WmsPointH sPoint = null;
|
||||||
}
|
WmsPointH ePoint = null;
|
||||||
if (input.data.ContainsKey(nameof(WmsPointH.location_id)) && input.data[nameof(WmsPointH.location_id)].IsNotEmptyOrNull())
|
if (input.data.ContainsKey(nameof(WmsPointH.location_id)))
|
||||||
{
|
|
||||||
ePoint = await _db.Queryable<WmsPointH>().FirstAsync(it => it.location_id == input.data[nameof(WmsPointH.location_id)].ToString());
|
|
||||||
}
|
|
||||||
if (sPoint != null && ePoint != null)
|
|
||||||
{
|
|
||||||
var points = await _wareHouseService.PathAlgorithms(sPoint.id, ePoint.id);
|
|
||||||
locIds.AddRange(points.Select(x => x.location_id).ToList()!);
|
|
||||||
//根据获取的路径点生成预任务,生成顺序必须预路径算法返回的起终点的顺序一致(预任务顺序)
|
|
||||||
if (points?.Count > 0)
|
|
||||||
{
|
{
|
||||||
if (points.Count <= 2) throw new AppFriendlyException("该路径不存在", 500);
|
sPoint = await _db.Queryable<WmsPointH>().FirstAsync(it => it.location_id == carry.location_id);
|
||||||
var curPreTasks = points.Where(it => !it.location_id.IsNullOrEmpty()).GroupBy(g => g.area_code).Select(it =>
|
}
|
||||||
|
if (input.data.ContainsKey(nameof(WmsPointH.location_id)) && input.data[nameof(WmsPointH.location_id)].IsNotEmptyOrNull())
|
||||||
|
{
|
||||||
|
ePoint = await _db.Queryable<WmsPointH>().FirstAsync(it => it.location_id == input.data[nameof(WmsPointH.location_id)].ToString());
|
||||||
|
}
|
||||||
|
if (sPoint != null && ePoint != null)
|
||||||
|
{
|
||||||
|
var points = await _wareHouseService.PathAlgorithms(sPoint.id, ePoint.id);
|
||||||
|
locIds.AddRange(points.Select(x => x.location_id).ToList()!);
|
||||||
|
//根据获取的路径点生成预任务,生成顺序必须预路径算法返回的起终点的顺序一致(预任务顺序)
|
||||||
|
if (points?.Count > 0)
|
||||||
{
|
{
|
||||||
var sPoint = it.FirstOrDefault();
|
if (points.Count <= 2) throw new AppFriendlyException("该路径不存在", 500);
|
||||||
var ePoint = it.LastOrDefault();
|
var curPreTasks = 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 = WmsWareHouseConst.BIZTYPE_WMSOUTSTOCK_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 = input.data["ReturnIdentity"].ToString();
|
||||||
|
preTask.require_code = input.data[nameof(preTask.bill_code)]?.ToString()!;
|
||||||
|
preTask.create_id = _userManager.UserId;
|
||||||
|
preTask.create_time = DateTime.Now;
|
||||||
|
return preTask;
|
||||||
|
}).ToList();
|
||||||
|
if (loc.is_sign == 0)
|
||||||
|
{
|
||||||
|
curPreTasks[^1].is_sign = 0; // 修改最后一个元素的是否签收值
|
||||||
|
}
|
||||||
|
preTasks.AddRange(curPreTasks);
|
||||||
|
|
||||||
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_WMSOUTSTOCK_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 = input.data["ReturnIdentity"].ToString();
|
|
||||||
preTask.require_code = input.data[nameof(preTask.bill_code)]?.ToString()!;
|
|
||||||
preTask.create_id = _userManager.UserId;
|
|
||||||
preTask.create_time = DateTime.Now;
|
|
||||||
return preTask;
|
|
||||||
}).ToList();
|
|
||||||
if (loc.is_sign == 0)
|
|
||||||
{
|
|
||||||
curPreTasks[^1].is_sign = 0; // 修改最后一个元素的是否签收值
|
|
||||||
}
|
}
|
||||||
preTasks.AddRange(curPreTasks);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
var isOk = await _wareHouseService.GenPreTask(preTasks, null);
|
||||||
|
GenPreTaskUpInput genPreTaskAfterUpInput = new();
|
||||||
|
genPreTaskAfterUpInput.CarryIds = preTasks.Select(x => x.carry_id).ToList();
|
||||||
|
genPreTaskAfterUpInput.LocationIds = new HashSet<string>(locIds).ToList();
|
||||||
|
await _wareHouseService.GenInStockTaskHandleAfter(genPreTaskAfterUpInput, it => new WmsCarryH { is_lock = 1 }, it => new BasLocation { is_lock = 1 });
|
||||||
}
|
}
|
||||||
var isOk = await _wareHouseService.GenPreTask(preTasks, null);
|
|
||||||
GenPreTaskUpInput genPreTaskAfterUpInput = new();
|
|
||||||
genPreTaskAfterUpInput.CarryIds = preTasks.Select(x => x.carry_id).ToList();
|
|
||||||
genPreTaskAfterUpInput.LocationIds = new HashSet<string>(locIds).ToList();
|
|
||||||
await _wareHouseService.GenInStockTaskHandleAfter(genPreTaskAfterUpInput, it => new WmsCarryH { is_lock = 1 }, it => new BasLocation { is_lock = 1 });
|
|
||||||
}
|
}
|
||||||
|
else throw new AppFriendlyException($"请输入物料明细", 500);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user