Merge remote-tracking branch 'origin/dev' into dev
# Conflicts: # WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsOutsourceD.cs # WarehouseMgr/Tnb.WarehouseMgr/WmsOutsourceService.cs
This commit is contained in:
@@ -208,7 +208,7 @@ namespace Tnb.WarehouseMgr
|
||||
.Where(x => x.id == item.outsource_order_d_id)
|
||||
.ExecuteCommandAsync();
|
||||
}
|
||||
|
||||
|
||||
List<WmsInstockD> instockDs = new();
|
||||
if (purchaseDs?.Count > 0)
|
||||
{
|
||||
@@ -251,7 +251,29 @@ namespace Tnb.WarehouseMgr
|
||||
}
|
||||
await _db.Insertable(instockDs).ExecuteCommandAsync();
|
||||
|
||||
List<WmsOutsourceD> dList = input.details;
|
||||
|
||||
List<WmsOutsourceD> dList = await _db.Queryable<WmsOutsourceD>().Where(x => x.fk_wms_outsource_order_id == purchaseDs.First().fk_wms_outsource_order_id).OrderBy(x => x.id).ToListAsync();
|
||||
|
||||
List<WmsOutsourceOrderD> wmsOutsourceOrderDs = await _db.Queryable<WmsOutsourceOrderD>().Where(r => dList.Select(x => x.erp_outsource_order_d_pk).Contains(r.erp_line_pk)).OrderBy(x => x.id).ToListAsync();
|
||||
foreach (var item in dList)
|
||||
{
|
||||
decimal? outsource_arriveqty = input.details.Where(r => r.id == item.id).ToList()[0].outsource_arriveqty;
|
||||
item.actual_quantity += outsource_arriveqty;
|
||||
if (item.actual_quantity > item.outsource_quantity)
|
||||
{
|
||||
throw Oops.Bah($"委外收货单明细行物料{item.matcode} 批次{item.code_batch} 到货数量不能超过采购数量!");
|
||||
}
|
||||
WmsOutsourceOrderD wmsOutsourceOrderD = wmsOutsourceOrderDs.Where(r => r.erp_line_pk == item.erp_outsource_order_d_pk).ToList()[0];
|
||||
wmsOutsourceOrderD.actual_quantity += outsource_arriveqty;
|
||||
if (wmsOutsourceOrderD.actual_quantity > wmsOutsourceOrderD.outsource_quantity)
|
||||
{
|
||||
throw Oops.Bah($"采购订单明细行物料{wmsOutsourceOrderD.matcode} 批次{wmsOutsourceOrderD.code_batch} 到货数量不能超过采购数量!");
|
||||
}
|
||||
}
|
||||
await _db.Updateable(dList).UpdateColumns(r => r.actual_quantity).ExecuteCommandAsync();
|
||||
await _db.Updateable(wmsOutsourceOrderDs).UpdateColumns(r => r.actual_quantity).ExecuteCommandAsync();
|
||||
|
||||
|
||||
List<String> materialIds = purchaseDs.Select(x => x.matcode_id).Distinct().ToList();
|
||||
List<String> unitCodes = purchaseDs.Select(x => x.unit_id).Distinct().ToList();
|
||||
List<DictionaryDataEntity> unitDatas = await _db.Queryable<DictionaryTypeEntity>()
|
||||
@@ -331,6 +353,7 @@ namespace Tnb.WarehouseMgr
|
||||
// ["nastnum"] = item.purchase_arriveqty,
|
||||
["nnum"] = item.bind_qty,
|
||||
// ["nplanastnum"] = 0,
|
||||
["nplannum"] = item.outsource_arriveqty,
|
||||
["nplannum"] = item.outsource_quantity,
|
||||
["pk_apfinanceorg"] = erpOrg.corpoid,
|
||||
["pk_apfinanceorg_v"] = erpOrg.corpvid,
|
||||
|
||||
Reference in New Issue
Block a user