|
|
@ -475,10 +475,8 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> i |
|
|
|
Set<String> dtlSet = new HashSet<>(); |
|
|
|
|
|
|
|
for (IOStorInvDis ioStorInvDis:ioStorInvDisList){ |
|
|
|
|
|
|
|
//添加需要更新的明细标识
|
|
|
|
dtlSet.add(ioStorInvDis.getIostorinvdtl_id()); |
|
|
|
|
|
|
|
//更新库存 减冻结加可用
|
|
|
|
List<JSONObject> updateIvtList = new ArrayList<>(); |
|
|
|
JSONObject jsonIvt = new JSONObject(); |
|
|
@ -491,7 +489,6 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> i |
|
|
|
jsonIvt.put("change_qty", ioStorInvDis.getPlan_qty()); |
|
|
|
updateIvtList.add(jsonIvt); |
|
|
|
iMdPbGroupPlateService.updateIvt(updateIvtList); |
|
|
|
|
|
|
|
//解锁库位
|
|
|
|
JSONObject unlock_map = new JSONObject(); |
|
|
|
unlock_map.put("struct_code", ioStorInvDis.getStruct_code()); |
|
|
@ -499,7 +496,6 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> i |
|
|
|
unlock_map.put("inv_id", null); |
|
|
|
unlock_map.put("inv_code", null); |
|
|
|
iStructattrService.updateStatusByCode("2",unlock_map); |
|
|
|
|
|
|
|
//删除出入库单分配表
|
|
|
|
ioStorInvDisMapper.deleteById(ioStorInvDis.getIostorinvdis_id()); |
|
|
|
|
|
|
@ -559,6 +555,7 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> i |
|
|
|
mater.setQty(unassign_qty); |
|
|
|
mater.setPcsn(pcsn); |
|
|
|
mater.setMaterial_code(material_code); |
|
|
|
mater.setMaterial_id(dtl.getMaterial_id()); |
|
|
|
List<StrategyMater> list = new ArrayList<>(); |
|
|
|
list.add(mater); |
|
|
|
//调用分配规则获取分配的库位:如果库存不足则直接报错
|
|
|
@ -759,7 +756,7 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> i |
|
|
|
double allocation_canuse_qty = 0; |
|
|
|
for (int i = 0; i < rows.size(); i++){ |
|
|
|
JSONObject ivt = rows.getJSONObject(i); |
|
|
|
double canuse_qty = ivt.getDoubleValue("canuse_qty"); |
|
|
|
double canuse_qty = ivt.getDoubleValue("qty"); |
|
|
|
//分配明细
|
|
|
|
IOStorInvDis ioStorInvDis = new IOStorInvDis(); |
|
|
|
ioStorInvDis.setIostorinvdis_id(IdUtil.getStringId()); |
|
|
@ -769,6 +766,7 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> i |
|
|
|
ioStorInvDis.setSect_id(ivt.getString("sect_id")); |
|
|
|
ioStorInvDis.setPcsn(ivt.getString("pcsn")); |
|
|
|
ioStorInvDis.setMaterial_id(dtl.getMaterial_id()); |
|
|
|
ioStorInvDis.setMaterial_code(dtl.getMaterial_code()); |
|
|
|
ioStorInvDis.setSect_name(ivt.getString("sect_name")); |
|
|
|
ioStorInvDis.setSect_code(ivt.getString("sect_code")); |
|
|
|
ioStorInvDis.setStruct_id(ivt.getString("struct_id")); |
|
|
@ -779,18 +777,6 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> i |
|
|
|
ioStorInvDis.setQty_unit_id(dtl.getQty_unit_id()); |
|
|
|
ioStorInvDis.setQty_unit_name(dtl.getQty_unit_name()); |
|
|
|
ioStorInvDis.setWork_status(IOSEnum.INBILL_DIS_STATUS.code("未生成")); |
|
|
|
|
|
|
|
// 未分配数量 - 该库位上的可用数量 < 0 目前做整出
|
|
|
|
// double canuse_qty = outAllocation.getCanuse_qty().doubleValue();
|
|
|
|
// if (unassign_qty-canuse_qty>=0){
|
|
|
|
// ioStorInvDis.setPlan_qty(BigDecimal.valueOf(canuse_qty));
|
|
|
|
// }else {
|
|
|
|
// ioStorInvDis.setPlan_qty(BigDecimal.valueOf(unassign_qty));
|
|
|
|
// }
|
|
|
|
// unassign_qty = unassign_qty-canuse_qty;
|
|
|
|
// if (unassign_qty<0){
|
|
|
|
// unassign_qty=0;
|
|
|
|
// }
|
|
|
|
if (unassign_qty <= 0){ |
|
|
|
throw new BadRequestException("已全部分配完,未分配数量为0"); |
|
|
|
} |
|
|
|