增加报错代码
This commit is contained in:
@@ -87,10 +87,10 @@ namespace Tnb.WarehouseMgr
|
|||||||
if (sPoint != null && ePoint != null)
|
if (sPoint != null && ePoint != null)
|
||||||
{
|
{
|
||||||
var points = await _wareHouseService.PathAlgorithms(sPoint.id, ePoint.id);
|
var points = await _wareHouseService.PathAlgorithms(sPoint.id, ePoint.id);
|
||||||
//根据获取的路径点生成预任务,生成顺序必须预路径算法返回的起终点的顺序一致(预任务顺序)
|
|
||||||
if (points?.Count > 0)
|
|
||||||
{
|
|
||||||
if (points.Count <= 2) throw new AppFriendlyException("该路径不存在", 500);
|
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 =>
|
var preTasks = points.Where(it => !it.location_id.IsNullOrEmpty()).GroupBy(g => g.area_code).Select(it =>
|
||||||
{
|
{
|
||||||
var sPoint = it.FirstOrDefault();
|
var sPoint = it.FirstOrDefault();
|
||||||
@@ -153,6 +153,10 @@ namespace Tnb.WarehouseMgr
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
throw new AppFriendlyException("起始库位不可用或无可用的目标库位",500);
|
||||||
|
}
|
||||||
|
|
||||||
await _db.Ado.CommitTranAsync();
|
await _db.Ado.CommitTranAsync();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -89,25 +89,23 @@ namespace Tnb.WarehouseMgr
|
|||||||
WmsPointH? ePoint = null;
|
WmsPointH? ePoint = null;
|
||||||
if (input.data.ContainsKey(nameof(WmsPointH.location_id)))
|
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());
|
ePoint = await _db.Queryable<WmsPointH>().FirstAsync(it => it.location_id == input.data[nameof(WmsPointH.location_id)].ToString() && it.is_lock == 0);
|
||||||
}
|
}
|
||||||
int i = 0;
|
|
||||||
|
|
||||||
|
|
||||||
//根据每个载具的起始库位做路径运算
|
//根据每个载具的起始库位做路径运算
|
||||||
for (i = 0; i < setQty.qty; i++)
|
for (int i = 0; i < setQty.qty; i++)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (carrys?.Count > 0)
|
if (carrys?.Count > 0)
|
||||||
|
{
|
||||||
sPoint = await _db.Queryable<WmsPointH>().FirstAsync(it => it.location_id == carrys[i].location_id);
|
sPoint = await _db.Queryable<WmsPointH>().FirstAsync(it => it.location_id == carrys[i].location_id);
|
||||||
|
}
|
||||||
var isOk = false;
|
var isOk = false;
|
||||||
if (sPoint != null && ePoint != null)
|
if (sPoint != null && ePoint != null)
|
||||||
{
|
{
|
||||||
var points = await _wareHouseService.PathAlgorithms(sPoint.id, ePoint.id);
|
var points = await _wareHouseService.PathAlgorithms(sPoint.id, ePoint.id);
|
||||||
//根据获取的路径点生成预任务,生成顺序必须预路径算法返回的起终点的顺序一致(预任务顺序)
|
|
||||||
if (points?.Count > 0)
|
|
||||||
{
|
|
||||||
if (points.Count <= 2) throw new AppFriendlyException("该路径不存在", 500);
|
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 =>
|
var preTasks = points.Where(it => !it.location_id.IsNullOrEmpty()).GroupBy(g => g.area_code).Select(it =>
|
||||||
{
|
{
|
||||||
var sPoint = it.FirstOrDefault();
|
var sPoint = it.FirstOrDefault();
|
||||||
@@ -142,7 +140,6 @@ namespace Tnb.WarehouseMgr
|
|||||||
preTasks[^1].is_sign = 0; // 修改最后一个元素的是否签收值
|
preTasks[^1].is_sign = 0; // 修改最后一个元素的是否签收值
|
||||||
}
|
}
|
||||||
isOk = await _wareHouseService.GenPreTask(preTasks, null!);
|
isOk = await _wareHouseService.GenPreTask(preTasks, null!);
|
||||||
|
|
||||||
}
|
}
|
||||||
if (isOk)
|
if (isOk)
|
||||||
{
|
{
|
||||||
@@ -174,6 +171,10 @@ namespace Tnb.WarehouseMgr
|
|||||||
it => new BasLocation { is_lock = 1 });
|
it => new BasLocation { is_lock = 1 });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
throw new AppFriendlyException("无可出库的空载具或目标库位不存在或者目标库位被锁", 500);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -132,6 +132,8 @@ namespace Tnb.WarehouseMgr
|
|||||||
public async Task KittingOutByIsToBeShipped()
|
public async Task KittingOutByIsToBeShipped()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
var kittingOuts = await _db.Queryable<WmsKittingoutH>()
|
var kittingOuts = await _db.Queryable<WmsKittingoutH>()
|
||||||
.Where(a => a.status == WmsWareHouseConst.BILLSTATUS_TOBESHIPPED_ID)
|
.Where(a => a.status == WmsWareHouseConst.BILLSTATUS_TOBESHIPPED_ID)
|
||||||
.OrderBy(a => a.seq)
|
.OrderBy(a => a.seq)
|
||||||
@@ -144,7 +146,6 @@ namespace Tnb.WarehouseMgr
|
|||||||
var locs = await _db.Queryable<BasLocation>().Where(it => it.id == koGrp.Key && it.is_use == ((int)EnumCarryStatus.空闲).ToString() && it.is_lock == 0).ToListAsync();
|
var locs = await _db.Queryable<BasLocation>().Where(it => it.id == koGrp.Key && it.is_use == ((int)EnumCarryStatus.空闲).ToString() && it.is_lock == 0).ToListAsync();
|
||||||
if (locs?.Count > 0)
|
if (locs?.Count > 0)
|
||||||
{
|
{
|
||||||
|
|
||||||
var arr = koGrp.ToArray();
|
var arr = koGrp.ToArray();
|
||||||
var ko = arr[^arr.Length];
|
var ko = arr[^arr.Length];
|
||||||
var carry = await _db.Queryable<WmsCarryH>().SingleAsync(it => it.id == ko.carry_id);
|
var carry = await _db.Queryable<WmsCarryH>().SingleAsync(it => it.id == ko.carry_id);
|
||||||
@@ -155,9 +156,9 @@ namespace Tnb.WarehouseMgr
|
|||||||
if (sPoint != null && ePoint != null)
|
if (sPoint != null && ePoint != null)
|
||||||
{
|
{
|
||||||
var points = await _warehouseService.PathAlgorithms(sPoint.id, ePoint.id);
|
var points = await _warehouseService.PathAlgorithms(sPoint.id, ePoint.id);
|
||||||
|
if (points.Count <= 2) throw new AppFriendlyException("该路径不存在", 500);
|
||||||
if (points?.Count > 0)
|
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 preTasks = points.Where(it => !it.location_id.IsNullOrEmpty()).GroupBy(g => g.area_code).Select(it =>
|
||||||
{
|
{
|
||||||
var sPoint = it.FirstOrDefault();
|
var sPoint = it.FirstOrDefault();
|
||||||
@@ -194,8 +195,21 @@ namespace Tnb.WarehouseMgr
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
throw new AppFriendlyException("无可用的载具", 500);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
throw new AppFriendlyException("无可用的库位", 500);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user