调整,wms进出库代码逻辑
This commit is contained in:
@@ -121,7 +121,7 @@ namespace Tnb.WarehouseMgr
|
|||||||
x.bill_d_id = instockD.id;
|
x.bill_d_id = instockD.id;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
return await _update(instockD, stockCodes!);
|
return await Update(instockD, stockCodes!);
|
||||||
}
|
}
|
||||||
|
|
||||||
var isOk = input.inoutStockType switch
|
var isOk = input.inoutStockType switch
|
||||||
@@ -723,7 +723,7 @@ namespace Tnb.WarehouseMgr
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task<bool> _update<T1, T2>(T1 entity, List<T2> entities) where T1 : BaseEntity<string>, new() where T2 : BaseEntity<string>, new()
|
private async Task<bool> Update<T1, T2>(T1 entity, List<T2> entities) where T1 : BaseEntity<string>, new() where T2 : BaseEntity<string>, new()
|
||||||
{
|
{
|
||||||
var isOk = false;
|
var isOk = false;
|
||||||
try
|
try
|
||||||
|
|||||||
@@ -254,14 +254,17 @@ namespace Tnb.WarehouseMgr
|
|||||||
List<WmsInstockD> instockds = input.instockds.Adapt<List<WmsInstockD>>();
|
List<WmsInstockD> instockds = input.instockds.Adapt<List<WmsInstockD>>();
|
||||||
//入库申请条码明细表
|
//入库申请条码明细表
|
||||||
List<WmsInstockCode> instockcodes = input.instockcodes.Adapt<List<WmsInstockCode>>();
|
List<WmsInstockCode> instockcodes = input.instockcodes.Adapt<List<WmsInstockCode>>();
|
||||||
|
|
||||||
|
var loc = await _db.Queryable<BasLocation>().SingleAsync(it => it.location_code == input.instock.location_code);
|
||||||
//如果数据不全,
|
//如果数据不全,
|
||||||
if ((instock?.carry_id.IsNullOrWhiteSpace() ?? true) || (instock?.location_id.IsNullOrWhiteSpace() ?? true) || instockds?.Count < 1 || instockcodes?.Count < 1)
|
if ((instock?.carry_id.IsNullOrWhiteSpace() ?? true) || loc.IsNull() || instockds?.Count < 1 || instockcodes?.Count < 1)
|
||||||
{
|
{
|
||||||
//报错, 提示数据不全。
|
//报错, 提示数据不全。
|
||||||
throw new AppFriendlyException("数据不全!", 500);
|
throw new AppFriendlyException("数据不全!", 500);
|
||||||
}
|
}
|
||||||
// 生成入库申请数据,添加其他数据 主表
|
// 生成入库申请数据,添加其他数据 主表
|
||||||
instock.id = SnowflakeIdHelper.NextId();
|
instock.id = SnowflakeIdHelper.NextId();
|
||||||
|
instock.location_id = loc.id;
|
||||||
instock.biz_type = WmsWareHouseConst.BIZTYPE_WMSINSTOCK_ID;
|
instock.biz_type = WmsWareHouseConst.BIZTYPE_WMSINSTOCK_ID;
|
||||||
instock.bill_code = _billRullService.GetBillNumber(WmsWareHouseConst.WMS_INSTOCK_ENCODE).GetAwaiter().GetResult();
|
instock.bill_code = _billRullService.GetBillNumber(WmsWareHouseConst.WMS_INSTOCK_ENCODE).GetAwaiter().GetResult();
|
||||||
instock.generate_type = "1";// 自动
|
instock.generate_type = "1";// 自动
|
||||||
|
|||||||
@@ -296,14 +296,17 @@ namespace Tnb.WarehouseMgr
|
|||||||
WmsOutstockH outstock = input.outstock.Adapt<WmsOutstockH>();
|
WmsOutstockH outstock = input.outstock.Adapt<WmsOutstockH>();
|
||||||
//出库申请明细表
|
//出库申请明细表
|
||||||
List<WmsOutstockD> outstockDs = input.outstockDs.Adapt<List<WmsOutstockD>>();
|
List<WmsOutstockD> outstockDs = input.outstockDs.Adapt<List<WmsOutstockD>>();
|
||||||
|
|
||||||
|
var loc = await _db.Queryable<BasLocation>().SingleAsync(it => it.location_code == input.outstock.location_code);
|
||||||
//如果数据不全,
|
//如果数据不全,
|
||||||
if ((outstock?.location_id.IsNullOrWhiteSpace() ?? true) || outstockDs?.Count < 1)
|
if (loc.IsNull() || outstockDs?.Count < 1)
|
||||||
{
|
{
|
||||||
//报错, 提示数据不全。
|
//报错, 提示数据不全。
|
||||||
throw new AppFriendlyException("数据不全!", 500);
|
throw new AppFriendlyException("数据不全!", 500);
|
||||||
}
|
}
|
||||||
// 生成入库申请数据,添加其他数据 主表
|
// 生成入库申请数据,添加其他数据 主表
|
||||||
outstock.id = SnowflakeIdHelper.NextId();
|
outstock.id = SnowflakeIdHelper.NextId();
|
||||||
|
outstock.location_id = loc.id;
|
||||||
outstock.biz_type = WmsWareHouseConst.BIZTYPE_WMSOUTSTOCK_ID;
|
outstock.biz_type = WmsWareHouseConst.BIZTYPE_WMSOUTSTOCK_ID;
|
||||||
outstock.bill_code = _billRullService.GetBillNumber(WmsWareHouseConst.WMS_OUTSTOCK_ENCODE).GetAwaiter().GetResult();
|
outstock.bill_code = _billRullService.GetBillNumber(WmsWareHouseConst.WMS_OUTSTOCK_ENCODE).GetAwaiter().GetResult();
|
||||||
outstock.generate_type = "1";// 自动
|
outstock.generate_type = "1";// 自动
|
||||||
|
|||||||
@@ -135,12 +135,12 @@ namespace Tnb.WarehouseMgr
|
|||||||
{
|
{
|
||||||
var leftCarrys = carrys[..6];
|
var leftCarrys = carrys[..6];
|
||||||
var rightCarrys = carrys[6..];
|
var rightCarrys = carrys[6..];
|
||||||
await _genPreTask(leftCarrys, locIds, firstLocationId, singleSorting.id, singleSorting.bill_code, preTasks);
|
await InnerGenPreTask(leftCarrys, locIds, firstLocationId, singleSorting.id, singleSorting.bill_code, preTasks);
|
||||||
await _genPreTask(rightCarrys, locIds, secondLocationId, singleSorting.id, singleSorting.bill_code, preTasks);
|
await InnerGenPreTask(rightCarrys, locIds, secondLocationId, singleSorting.id, singleSorting.bill_code, preTasks);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
await _genPreTask(carrys, locIds, firstLocationId, singleSorting.id, singleSorting.bill_code, preTasks);
|
await InnerGenPreTask(carrys, locIds, firstLocationId, singleSorting.id, singleSorting.bill_code, preTasks);
|
||||||
}
|
}
|
||||||
List<WmsPretaskCode> pretaskCodes = new();
|
List<WmsPretaskCode> pretaskCodes = new();
|
||||||
foreach (var pt in preTasks)
|
foreach (var pt in preTasks)
|
||||||
@@ -175,7 +175,7 @@ namespace Tnb.WarehouseMgr
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task _genPreTask(WmsCarryH[] carrys, List<string> locIds, string eLocationId, string requireId, string requireCode, List<WmsPretaskH> preTasks)
|
private async Task InnerGenPreTask(WmsCarryH[] carrys, List<string> locIds, string eLocationId, string requireId, string requireCode, List<WmsPretaskH> preTasks)
|
||||||
{
|
{
|
||||||
var loc = await _db.Queryable<BasLocation>().SingleAsync(it => it.id == eLocationId);
|
var loc = await _db.Queryable<BasLocation>().SingleAsync(it => it.id == eLocationId);
|
||||||
foreach (var carry in carrys)
|
foreach (var carry in carrys)
|
||||||
|
|||||||
Reference in New Issue
Block a user