diff --git a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/shipment/shipmentHeader/controller/ShipmentHeaderController.java b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/shipment/shipmentHeader/controller/ShipmentHeaderController.java index 92d268c..236a4fc 100644 --- a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/shipment/shipmentHeader/controller/ShipmentHeaderController.java +++ b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/shipment/shipmentHeader/controller/ShipmentHeaderController.java @@ -253,7 +253,25 @@ public class ShipmentHeaderController extends JeecgController<ShipmentHeader, IS @RequiresPermissions("shipmentDetail:edit") @RequestMapping(value = "/editShipmentDetail", method = {RequestMethod.PUT, RequestMethod.POST}) public Result<String> editShipmentDetail(@RequestBody ShipmentDetail shipmentDetail) { - shipmentDetailService.updateById(shipmentDetail); + if (shipmentDetail == null) { + return Result.error("修改详情失败, 没有找到出库单详情"); + } + ShipmentHeader shipmentHeader = shipmentHeaderService.getById(shipmentDetail.getShipmentId()); + if (shipmentHeader == null) { + return Result.error("修改详情失败, 没有找到出库单"); + } + if (shipmentHeader.getFirstStatus().intValue() != QuantityConstant.SHIPMENT_HEADER_BUILD) { + return Result.error("修改详情失败, 出库单必须是新建状态才能修改详情"); + } + boolean success = shipmentDetailService.updateById(shipmentDetail); + if (!success) { + throw new JeecgBootException("修改详情失败"); + } + success = shipmentHeaderService.updateShipmentHeader(shipmentDetail.getShipmentId()); + if (!success) { + throw new JeecgBootException("修改详情时,更新出库单头数量失败"); + } + LogRecordContext.putVariable("extraJsonString", JSON.toJSONString(Collections.singletonList(shipmentDetail)));// 操作日志收集 return Result.OK("编辑成功!"); }