Commit 6c1650327a9719ed00d6d8497df537627b66483e
1 parent
bc37db1c
修改出库单详情数量后出库单头总数同步修改
Showing
1 changed file
with
19 additions
and
1 deletions
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 | @@ -253,7 +253,25 @@ public class ShipmentHeaderController extends JeecgController<ShipmentHeader, IS | ||
253 | @RequiresPermissions("shipmentDetail:edit") | 253 | @RequiresPermissions("shipmentDetail:edit") |
254 | @RequestMapping(value = "/editShipmentDetail", method = {RequestMethod.PUT, RequestMethod.POST}) | 254 | @RequestMapping(value = "/editShipmentDetail", method = {RequestMethod.PUT, RequestMethod.POST}) |
255 | public Result<String> editShipmentDetail(@RequestBody ShipmentDetail shipmentDetail) { | 255 | public Result<String> editShipmentDetail(@RequestBody ShipmentDetail shipmentDetail) { |
256 | - shipmentDetailService.updateById(shipmentDetail); | 256 | + if (shipmentDetail == null) { |
257 | + return Result.error("修改详情失败, 没有找到出库单详情"); | ||
258 | + } | ||
259 | + ShipmentHeader shipmentHeader = shipmentHeaderService.getById(shipmentDetail.getShipmentId()); | ||
260 | + if (shipmentHeader == null) { | ||
261 | + return Result.error("修改详情失败, 没有找到出库单"); | ||
262 | + } | ||
263 | + if (shipmentHeader.getFirstStatus().intValue() != QuantityConstant.SHIPMENT_HEADER_BUILD) { | ||
264 | + return Result.error("修改详情失败, 出库单必须是新建状态才能修改详情"); | ||
265 | + } | ||
266 | + boolean success = shipmentDetailService.updateById(shipmentDetail); | ||
267 | + if (!success) { | ||
268 | + throw new JeecgBootException("修改详情失败"); | ||
269 | + } | ||
270 | + success = shipmentHeaderService.updateShipmentHeader(shipmentDetail.getShipmentId()); | ||
271 | + if (!success) { | ||
272 | + throw new JeecgBootException("修改详情时,更新出库单头数量失败"); | ||
273 | + } | ||
274 | + LogRecordContext.putVariable("extraJsonString", JSON.toJSONString(Collections.singletonList(shipmentDetail)));// 操作日志收集 | ||
257 | return Result.OK("编辑成功!"); | 275 | return Result.OK("编辑成功!"); |
258 | } | 276 | } |
259 | 277 |