rev:出库时明细缺少校验

This commit is contained in:
zhangzq
2024-11-27 11:11:55 +08:00
parent afb82b7e44
commit eba8a2048e

View File

@@ -83,8 +83,7 @@ public class PdaIOService {
for (PdaFormOutDtl dtl : dtls) {
BigDecimal now_assign_qty = dtl.getNow_assign_qty();
if (now_assign_qty==null || now_assign_qty.intValue()==0){
continue;
// throw new BadRequestException("出库申请失败:当前"+dtl.getMaterial_name()+"明细申请数量为0");
throw new BadRequestException("出库申请失败:当前"+dtl.getMaterial_name()+"明细申请数量为0");
}
StIvtIostorinvdtl ivtDtl = new StIvtIostorinvdtl();
ivtDtl.setSource_form_id(dtl.getId());
@@ -94,16 +93,23 @@ public class PdaIOService {
if (StringUtils.isEmpty(productArea) || !"A1A2A3".contains(productArea)){
throw new BadRequestException("出库申请失败:明细数据车间字段未指定或不正确");
}
String storCode = dtl.getStor_code();
if (StringUtils.isEmpty(storCode)){
throw new BadRequestException("出库申请失败:明细数据仓库字段未指定");
}
HashMap map = MapOf.of("end_struct_code", "", "start_struct_code", "", "order", "", "product_area", productArea);
ivtDtl.setForm_data(new JSONObject(map));
ivtDtl.setQty(now_assign_qty);
ivtDtl.setPcsn(dtl.getPcsn());
ivtDtl.setStor_code(dtl.getStor_code());//pdaFormOutMst.getStor_code()
ivtDtl.setStor_code(storCode);//pdaFormOutMst.getStor_code()
ivtDtl.setId(IdUtil.getStringId());
ivtDtl.setInv_id(mst.getId());
ivtDtl.setStatus(StatusEnum.FORM_STATUS.code("生成"));
list.add(ivtDtl);
}
if (CollectionUtils.isEmpty(list)){
throw new BadRequestException("出库申请失败:出库入明细不能为空");
}
iStIvtIostorinvdtlService.saveBatch(list);
iStIvtIostorinvService.save(mst);
for (StIvtIostorinvdtl stIvtIostorinvdtl : list) {