PC原材料调拨出库与PDA签收逻辑完善
This commit is contained in:
@@ -3692,22 +3692,33 @@ namespace Tnb.WarehouseMgr
|
||||
{
|
||||
try
|
||||
{
|
||||
if (string.IsNullOrEmpty(input.biz_type))
|
||||
throw new AppFriendlyException("业务类型不可为空", 500);
|
||||
if (string.IsNullOrEmpty(input.source_id))
|
||||
throw new AppFriendlyException("来源单据id不可为空", 500);
|
||||
if (string.IsNullOrEmpty(input.warehouse_code))
|
||||
{
|
||||
throw new AppFriendlyException("出库仓库不可为空", 500);
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(input.material_id))
|
||||
{
|
||||
throw new AppFriendlyException("物料id不可为空", 500);
|
||||
}
|
||||
if (string.IsNullOrEmpty(input.code_batch))
|
||||
{
|
||||
throw new AppFriendlyException("批号不可为空", 500);
|
||||
}
|
||||
|
||||
BasWarehouse basWarehouse = await _db.Queryable<BasWarehouse>().Where(r => r.whcode == input.warehouse_code).FirstAsync();
|
||||
|
||||
// 下发数量
|
||||
decimal? qty = 0;
|
||||
switch (input.biz_type)
|
||||
{
|
||||
case WmsWareHouseConst.BIZTYPE_WmsRawmatTransferoutstock_ID:
|
||||
{
|
||||
WmsRawmatTransferoutstockD wmsRawmatTransferoutstockD = await _db.Queryable<WmsRawmatTransferoutstockD>().Where(r => r.id == input.source_id).FirstAsync();
|
||||
if (wmsRawmatTransferoutstockD == null)
|
||||
throw new AppFriendlyException($"来源单据{input.source_id}不存在", 500);
|
||||
qty = wmsRawmatTransferoutstockD.qty - wmsRawmatTransferoutstockD.actual_qty;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
switch (basWarehouse.id)
|
||||
{
|
||||
case WmsWareHouseConst.WAREHOUSE_YCL_ID:
|
||||
@@ -3743,23 +3754,58 @@ namespace Tnb.WarehouseMgr
|
||||
})
|
||||
.ToListAsync();
|
||||
|
||||
var wmsCarryCodesSum = wmsCarryCodes.GroupBy(r => new { r.carry_id, r.material_id, r.code_batch }).Select(g =>
|
||||
|
||||
var wmsCarryCodesOrderByQty = wmsCarryCodes.GroupBy(r => new { r.carry_id, r.material_id, r.code_batch })
|
||||
.Select(g =>
|
||||
{
|
||||
var list = g.ToList();
|
||||
decimal sumqty = g.Sum(r => r.qty);
|
||||
|
||||
var newg = new
|
||||
{
|
||||
carry_id = list[0].carry_id,
|
||||
carry_code = list[0].carry_code,
|
||||
material_id = list[0].material_id,
|
||||
material_code = list[0].material_code,
|
||||
material_name = list[0].material_name,
|
||||
material_specification = list[0].material_specification,
|
||||
barcode = list[0].barcode,
|
||||
code_batch = list[0].code_batch,
|
||||
qty = sumqty
|
||||
};
|
||||
return newg;
|
||||
});
|
||||
|
||||
|
||||
bool isFindSortCarry = false;
|
||||
var wmsCarryCodesSum = wmsCarryCodesOrderByQty.OrderBy(r => r.qty).Select(g =>
|
||||
{
|
||||
var list = g.ToList();
|
||||
decimal sumqty = g.qty;
|
||||
|
||||
decimal? remainQty = qty - sumqty;
|
||||
|
||||
// 首次小于0则需要分拣
|
||||
if (remainQty < 0 && !isFindSortCarry)
|
||||
isFindSortCarry = true;
|
||||
else
|
||||
isFindSortCarry = false;
|
||||
|
||||
var newg = new
|
||||
{
|
||||
carry_id = list[0].carry_id,
|
||||
carry_code = list[0].carry_code,
|
||||
material_id = list[0].material_id,
|
||||
material_code = list[0].material_code,
|
||||
material_name = list[0].material_name,
|
||||
material_specification = list[0].material_specification,
|
||||
barcode = list[0].barcode,
|
||||
code_batch = list[0].code_batch,
|
||||
qty = g.Sum(r => r.qty)
|
||||
carry_id = g.carry_id,
|
||||
carry_code = g.carry_code,
|
||||
material_id = g.material_id,
|
||||
material_code = g.material_code,
|
||||
material_name = g.material_name,
|
||||
material_specification = g.material_specification,
|
||||
barcode = g.barcode,
|
||||
code_batch = g.code_batch,
|
||||
qty = sumqty,
|
||||
sign_qty = isFindSortCarry ? qty : sumqty,
|
||||
isSortCarry = isFindSortCarry, // 是否为分拣载具
|
||||
isSelect = isFindSortCarry || remainQty > 0, // 是否勾选
|
||||
};
|
||||
|
||||
qty -= sumqty;
|
||||
return newg;
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user