Commit 719b241527a54999070d3138f4a2bea7ee277fdf
1 parent
e559bcc8
盘盈增加库存数据调整优化
Showing
2 changed files
with
32 additions
and
9 deletions
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/stocktaking/cycleCountDetail/service/impl/CycleCountDetailServiceImpl.java
... | ... | @@ -367,7 +367,7 @@ public class CycleCountDetailServiceImpl extends ServiceImpl<CycleCountDetailMap |
367 | 367 | |
368 | 368 | cycleCountDetailChild.setChildStatus(QuantityConstant.CYCLECOUNT_STATUS_REGISTERED); |
369 | 369 | cycleCountDetailChild.setSystemQty(BigDecimal.ZERO); |
370 | - cycleCountDetailChild.setGapQty(BigDecimal.ZERO.subtract(countedQty)); | |
370 | + cycleCountDetailChild.setGapQty(countedQty); | |
371 | 371 | cycleCountDetailChild.setCountedQty(countedQty); |
372 | 372 | cycleCountDetailChildServiceImpl.save(cycleCountDetailChild); |
373 | 373 | |
... | ... |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/task/taskHeader/service/impl/TaskHeaderServiceImpl.java
... | ... | @@ -1565,18 +1565,41 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea |
1565 | 1565 | { |
1566 | 1566 | if (!child.getChildStatus().equals(QuantityConstant.CYCLECOUNT_STATUS_REGISTERED)) |
1567 | 1567 | { |
1568 | - throw new ServiceException("当前任务里面还有没有进行登记的数据,不能完成让我"); | |
1568 | + throw new ServiceException("当前任务里面还有没有进行登记的数据,不能完成任务"); | |
1569 | 1569 | } |
1570 | - InventoryDetail inventoryDetail = inventoryDetailService.getById(child.getInventoryDetaiId()); | |
1571 | - if (inventoryDetail==null) | |
1570 | + | |
1571 | + | |
1572 | + if (child.getInventoryDetaiId()!=null) | |
1572 | 1573 | { |
1573 | - return Result.error("盘点还没完成 库存明细单据就不存在了 可能出现了问题或者所容器没成功"); | |
1574 | + InventoryDetail inventoryDetail = inventoryDetailService.getById(child.getInventoryDetaiId()); | |
1575 | + if (inventoryDetail==null) | |
1576 | + { | |
1577 | + throw new ServiceException("盘点还没完成 库存明细单据就不存在了 可能出现了问题或者所容器没成功"); | |
1578 | + } | |
1579 | + inventoryHeader.setTotalQty(inventoryHeader.getTotalQty().add(child.getGapQty())); | |
1580 | + inventoryDetail.setQty(child.getCountedQty()); | |
1581 | + inventoryDetailService.updateById(inventoryDetail); | |
1582 | + }else | |
1583 | + { | |
1584 | + InventoryDetail inventoryDetail=new InventoryDetail(); | |
1585 | + inventoryDetail.setInventoryHeaderId(inventoryHeader.getId()); | |
1586 | + inventoryDetail.setWarehouseCode(inventoryHeader.getWarehouseCode()); | |
1587 | + inventoryDetail.setCompanyCode(inventoryHeader.getCompanyCode()); | |
1588 | + inventoryDetail.setZoneCode(inventoryHeader.getZoneCode()); | |
1589 | + inventoryDetail.setContainerCode(inventoryHeader.getContainerCode()); | |
1590 | + inventoryDetail.setLocationCode(inventoryHeader.getLocationCode()); | |
1591 | + inventoryDetail.setMaterialCode(child.getMaterialCode()); | |
1592 | + inventoryDetail.setMaterialName(child.getMaterialName()); | |
1593 | + inventoryDetail.setMaterialSpec(child.getMaterialSpec()); | |
1594 | + inventoryDetail.setMaterialUnit(child.getMaterialUnit()); | |
1595 | + inventoryDetail.setQty(child.getCountedQty()); | |
1596 | + inventoryDetail.setTaskQty(BigDecimal.ZERO); | |
1597 | + inventoryDetail.setInventoryStatus(child.getInventoryStatus()); | |
1598 | + inventoryDetail.setBatch(child.getBatch()); | |
1599 | + inventoryDetailService.save(inventoryDetail); | |
1600 | + child.setInventoryDetaiId(inventoryDetail.getId()); | |
1574 | 1601 | } |
1575 | 1602 | |
1576 | - inventoryHeader.setTotalQty(inventoryHeader.getTotalQty().add(child.getGapQty())); | |
1577 | - | |
1578 | - inventoryDetail.setQty(child.getCountedQty()); | |
1579 | - inventoryDetailService.updateById(inventoryDetail); | |
1580 | 1603 | |
1581 | 1604 | child.setChildStatus(QuantityConstant.CYCLECOUNT_STATUS_COMPLETED); |
1582 | 1605 | if (child.getGapQty().compareTo(BigDecimal.ZERO) == 1) |
... | ... |