Commit 31fce74f5cccea019ffd0e13e81ed90323fe704d
Merge branch 'develop' of http://www.huahengrobot.com:90/wms/wms4.git into develop
Showing
2 changed files
with
100 additions
and
164 deletions
ant-design-vue-jeecg/src/components/tools/HeaderNotice.vue
@@ -228,6 +228,7 @@ export default { | @@ -228,6 +228,7 @@ export default { | ||
228 | websocketOnmessage: function (e) { | 228 | websocketOnmessage: function (e) { |
229 | console.log("-----接收消息-------", e.data); | 229 | console.log("-----接收消息-------", e.data); |
230 | var data = eval("(" + e.data + ")"); //解析对象 | 230 | var data = eval("(" + e.data + ")"); //解析对象 |
231 | + this.openNotification(data) | ||
231 | if (data.cmd == "topic") { | 232 | if (data.cmd == "topic") { |
232 | //系统通知 | 233 | //系统通知 |
233 | this.loadData(); | 234 | this.loadData(); |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/task/taskHeader/service/impl/TaskHeaderServiceImpl.java
@@ -1121,27 +1121,10 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea | @@ -1121,27 +1121,10 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea | ||
1121 | throw new JeecgBootException("完成入库任务时,保存库存交易失败"); | 1121 | throw new JeecgBootException("完成入库任务时,保存库存交易失败"); |
1122 | } | 1122 | } |
1123 | 1123 | ||
1124 | - if (StringUtils.isNotEmpty(fromLocationCode) && !fromLocationCode.equals(toLocationCode)) { | ||
1125 | - success = | ||
1126 | - locationService.updateContainerCodeAndStatus(fromLocationCode, QuantityConstant.EMPTY_STRING, QuantityConstant.STATUS_LOCATION_EMPTY, warehouseCode); | ||
1127 | - if (!success) { | ||
1128 | - throw new JeecgBootException("完成入库任务时,更新源库位失败"); | ||
1129 | - } | ||
1130 | - } | ||
1131 | - | ||
1132 | - success = locationService.updateContainerCodeAndStatus(toLocationCode, containerCode, QuantityConstant.STATUS_LOCATION_EMPTY, warehouseCode); | ||
1133 | - if (!success) { | ||
1134 | - throw new JeecgBootException("完成入库任务时,更新库位失败"); | ||
1135 | - } | ||
1136 | - | ||
1137 | - success = taskHeaderService.updateStatusById(QuantityConstant.TASK_STATUS_COMPLETED, taskHeader.getId()); | ||
1138 | - if (!success) { | ||
1139 | - throw new JeecgBootException("完成入库任务时,更新任务失败"); | ||
1140 | - } | ||
1141 | - success = containerService.updateLocationCodeAndStatus(containerCode, toLocationCode, QuantityConstant.STATUS_CONTAINER_EMPTY, | ||
1142 | - taskHeader.getContainerFillStatus(), warehouseCode); | ||
1143 | - if (!success) { | ||
1144 | - throw new JeecgBootException("完成入库任务时,更新容器失败"); | 1124 | + Result result = taskHeaderService.completeTaskUnLockContainerAndLocation(taskHeader.getContainerFillStatus(), taskType, containerCode, fromLocationCode, |
1125 | + toLocationCode, warehouseCode); | ||
1126 | + if (!result.isSuccess()) { | ||
1127 | + throw new JeecgBootException(result.getMessage()); | ||
1145 | } | 1128 | } |
1146 | if (!taskHeaderService.combineInventoryDetail(taskHeader)) { | 1129 | if (!taskHeaderService.combineInventoryDetail(taskHeader)) { |
1147 | throw new JeecgBootException("合并入库库存失败"); | 1130 | throw new JeecgBootException("合并入库库存失败"); |
@@ -1159,6 +1142,10 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea | @@ -1159,6 +1142,10 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea | ||
1159 | if (!inventoryHeaderService.updateInventoryContainerStatusByContainerCode(containerCode, warehouseCode)) { | 1142 | if (!inventoryHeaderService.updateInventoryContainerStatusByContainerCode(containerCode, warehouseCode)) { |
1160 | throw new JeecgBootException("完成入库任务时,更新托盘状态失败"); | 1143 | throw new JeecgBootException("完成入库任务时,更新托盘状态失败"); |
1161 | } | 1144 | } |
1145 | + success = taskHeaderService.updateStatusById(QuantityConstant.TASK_STATUS_COMPLETED, taskHeader.getId()); | ||
1146 | + if (!success) { | ||
1147 | + throw new JeecgBootException("完成出库任务,保存任务头失败"); | ||
1148 | + } | ||
1162 | receiptDetaiList = receiptDetaiList.stream().filter(t -> t.getStatus().equals(QuantityConstant.RECEIPT_HEADER_COMPLETED)).collect(Collectors.toList()); | 1149 | receiptDetaiList = receiptDetaiList.stream().filter(t -> t.getStatus().equals(QuantityConstant.RECEIPT_HEADER_COMPLETED)).collect(Collectors.toList()); |
1163 | LogRecordContext.putVariable("taskHeader", taskHeader); | 1150 | LogRecordContext.putVariable("taskHeader", taskHeader); |
1164 | LogRecordContext.putVariable("extraJsonString1", JSON.toJSONString(taskDetailList)); | 1151 | LogRecordContext.putVariable("extraJsonString1", JSON.toJSONString(taskDetailList)); |
@@ -1309,44 +1296,10 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea | @@ -1309,44 +1296,10 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea | ||
1309 | if (!success) { | 1296 | if (!success) { |
1310 | throw new JeecgBootException("完成出库任务,保存库存详情失败"); | 1297 | throw new JeecgBootException("完成出库任务,保存库存详情失败"); |
1311 | } | 1298 | } |
1312 | - taskHeader.setStatus(QuantityConstant.TASK_STATUS_COMPLETED); | ||
1313 | - success = taskHeaderService.updateStatusById(QuantityConstant.TASK_STATUS_COMPLETED, taskHeader.getId()); | ||
1314 | - if (!success) { | ||
1315 | - throw new JeecgBootException("完成出库任务,保存任务头失败"); | ||
1316 | - } | ||
1317 | - if (taskType == QuantityConstant.TASK_TYPE_WHOLESHIPMENT) { | ||
1318 | - success = | ||
1319 | - locationService.updateContainerCodeAndStatus(fromLocationCode, QuantityConstant.EMPTY_STRING, QuantityConstant.STATUS_LOCATION_EMPTY, warehouseCode); | ||
1320 | - if (!success) { | ||
1321 | - throw new JeecgBootException("完成整盘出库任务,更新源库位失败"); | ||
1322 | - } | ||
1323 | - success = containerService.updateLocationCodeAndStatus(containerCode, QuantityConstant.EMPTY_STRING, QuantityConstant.STATUS_CONTAINER_EMPTY, | ||
1324 | - QuantityConstant.STATUS_CONTAINER_FILL_EMPTY, warehouseCode); | ||
1325 | - if (!success) { | ||
1326 | - throw new JeecgBootException("完成整盘出库任务,更新容器失败"); | ||
1327 | - } | ||
1328 | - } else if (taskType == QuantityConstant.TASK_TYPE_SORTINGSHIPMENT) { | ||
1329 | - if (!fromLocationCode.equals(toLocationCode)) { | ||
1330 | - success = locationService.updateContainerCodeAndStatus(fromLocationCode, QuantityConstant.EMPTY_STRING, QuantityConstant.STATUS_LOCATION_EMPTY, | ||
1331 | - warehouseCode); | ||
1332 | - if (!success) { | ||
1333 | - throw new JeecgBootException("完成分拣出库任务,更新源库位失败"); | ||
1334 | - } | ||
1335 | - success = locationService.updateContainerCodeAndStatus(toLocationCode, containerCode, QuantityConstant.STATUS_LOCATION_EMPTY, warehouseCode); | ||
1336 | - if (!success) { | ||
1337 | - throw new JeecgBootException("完成分拣出库任务,更新目标库位失败"); | ||
1338 | - } | ||
1339 | - } else { | ||
1340 | - success = locationService.updateStatus(fromLocationCode, QuantityConstant.STATUS_LOCATION_EMPTY, warehouseCode); | ||
1341 | - if (!success) { | ||
1342 | - throw new JeecgBootException("完成分拣出库任务,更新源库位失败"); | ||
1343 | - } | ||
1344 | - } | ||
1345 | - success = containerService.updateLocationCodeAndStatus(containerCode, toLocationCode, QuantityConstant.STATUS_CONTAINER_EMPTY, | ||
1346 | - inventoryDetailList.size() == 0 ? QuantityConstant.STATUS_CONTAINER_FILL_EMPTY : QuantityConstant.STATUS_CONTAINER_FILL_SOME, warehouseCode); | ||
1347 | - if (!success) { | ||
1348 | - throw new JeecgBootException("完成分拣出库任务,更新容器失败"); | ||
1349 | - } | 1299 | + Result result = taskHeaderService.completeTaskUnLockContainerAndLocation(taskHeader.getContainerFillStatus(), taskType, containerCode, fromLocationCode, |
1300 | + toLocationCode, warehouseCode); | ||
1301 | + if (!result.isSuccess()) { | ||
1302 | + throw new JeecgBootException(result.getMessage()); | ||
1350 | } | 1303 | } |
1351 | ShipmentContainerHeader shipmentContainerHeader = shipmentContainerHeaderService.getById(taskHeader.getShipmentContainerHeaderId()); | 1304 | ShipmentContainerHeader shipmentContainerHeader = shipmentContainerHeaderService.getById(taskHeader.getShipmentContainerHeaderId()); |
1352 | if (shipmentContainerHeader == null) { | 1305 | if (shipmentContainerHeader == null) { |
@@ -1378,6 +1331,10 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea | @@ -1378,6 +1331,10 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea | ||
1378 | throw new JeecgBootException("完成出库任务,更新库存状态失败"); | 1331 | throw new JeecgBootException("完成出库任务,更新库存状态失败"); |
1379 | } | 1332 | } |
1380 | } | 1333 | } |
1334 | + success = taskHeaderService.updateStatusById(QuantityConstant.TASK_STATUS_COMPLETED, taskHeader.getId()); | ||
1335 | + if (!success) { | ||
1336 | + throw new JeecgBootException("完成出库任务,保存任务头失败"); | ||
1337 | + } | ||
1381 | // 操作记录添加 | 1338 | // 操作记录添加 |
1382 | shipmentDetailList = shipmentDetailList.stream().filter(t -> t.getStatus().equals(QuantityConstant.SHIPMENT_HEADER_COMPLETED)).collect(Collectors.toList()); | 1339 | shipmentDetailList = shipmentDetailList.stream().filter(t -> t.getStatus().equals(QuantityConstant.SHIPMENT_HEADER_COMPLETED)).collect(Collectors.toList()); |
1383 | LogRecordContext.putVariable("taskHeader", taskHeader); | 1340 | LogRecordContext.putVariable("taskHeader", taskHeader); |
@@ -1654,8 +1611,15 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea | @@ -1654,8 +1611,15 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea | ||
1654 | String toLocationCode, String warehouseCode) { | 1611 | String toLocationCode, String warehouseCode) { |
1655 | Result result = null; | 1612 | Result result = null; |
1656 | boolean success = false; | 1613 | boolean success = false; |
1657 | - if (StringUtils.isEmpty(toLocationCode) && taskType == QuantityConstant.TASK_TYPE_OVER_STATION) { | ||
1658 | - return Result.error("完成任务时, 目标库位号为空"); | 1614 | + if (StringUtils.isEmpty(toLocationCode) && taskType != QuantityConstant.TASK_TYPE_OVER_STATION) { |
1615 | + return Result.error("任务类型" + taskType + "完成任务时, 目标库位号为空"); | ||
1616 | + } | ||
1617 | + if (StringUtils.isEmpty(containerCode)) { | ||
1618 | + return Result.error("任务类型" + taskType + "完成任务时, 容器号为空"); | ||
1619 | + } | ||
1620 | + Container container = containerService.getContainerByCode(containerCode, warehouseCode); | ||
1621 | + if (container == null) { | ||
1622 | + return Result.error("任务类型" + taskType + "完成任务时, 没有找到托盘" + containerCode); | ||
1659 | } | 1623 | } |
1660 | switch (taskType) { | 1624 | switch (taskType) { |
1661 | case QuantityConstant.TASK_TYPE_WHOLERECEIPT: | 1625 | case QuantityConstant.TASK_TYPE_WHOLERECEIPT: |
@@ -1674,6 +1638,9 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea | @@ -1674,6 +1638,9 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea | ||
1674 | case QuantityConstant.TASK_TYPE_WHOLESHIPMENT: | 1638 | case QuantityConstant.TASK_TYPE_WHOLESHIPMENT: |
1675 | case QuantityConstant.TASK_TYPE_EMPTYSHIPMENT: | 1639 | case QuantityConstant.TASK_TYPE_EMPTYSHIPMENT: |
1676 | case QuantityConstant.TASK_TYPE_MANY_EMPTYSHIPMENT: | 1640 | case QuantityConstant.TASK_TYPE_MANY_EMPTYSHIPMENT: |
1641 | + if (StringUtils.isEmpty(fromLocationCode)) { | ||
1642 | + return Result.error("任务类型" + taskType + "完成任务时, 起始库位号为空"); | ||
1643 | + } | ||
1677 | success = containerService.updateLocationCodeAndStatus(containerCode, toLocationCode, QuantityConstant.STATUS_CONTAINER_EMPTY, | 1644 | success = containerService.updateLocationCodeAndStatus(containerCode, toLocationCode, QuantityConstant.STATUS_CONTAINER_EMPTY, |
1678 | QuantityConstant.STATUS_CONTAINER_FILL_EMPTY, warehouseCode); | 1645 | QuantityConstant.STATUS_CONTAINER_FILL_EMPTY, warehouseCode); |
1679 | break; | 1646 | break; |
@@ -1681,13 +1648,24 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea | @@ -1681,13 +1648,24 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea | ||
1681 | case QuantityConstant.TASK_TYPE_CYCLECOUNT: | 1648 | case QuantityConstant.TASK_TYPE_CYCLECOUNT: |
1682 | case QuantityConstant.TASK_TYPE_TRANSFER: | 1649 | case QuantityConstant.TASK_TYPE_TRANSFER: |
1683 | case QuantityConstant.TASK_TYPE_CHECK_OUT: | 1650 | case QuantityConstant.TASK_TYPE_CHECK_OUT: |
1651 | + if (StringUtils.isEmpty(fromLocationCode)) { | ||
1652 | + return Result.error("任务类型" + taskType + "完成任务时, 起始库位号为空"); | ||
1653 | + } | ||
1684 | InventoryHeader inventoryHeader = inventoryHeaderService.getInventoryHeaderByContainerCode(containerCode, warehouseCode); | 1654 | InventoryHeader inventoryHeader = inventoryHeaderService.getInventoryHeaderByContainerCode(containerCode, warehouseCode); |
1685 | if (inventoryHeader != null) { | 1655 | if (inventoryHeader != null) { |
1686 | - success = containerService.updateLocationCodeAndStatus(containerCode, toLocationCode, QuantityConstant.STATUS_CONTAINER_EMPTY, | ||
1687 | - QuantityConstant.STATUS_CONTAINER_FILL_SOME, warehouseCode); | 1656 | + if (fromLocationCode.equals(toLocationCode)) { |
1657 | + success = containerService.updateStatus(containerCode, QuantityConstant.STATUS_CONTAINER_EMPTY, warehouseCode); | ||
1658 | + } else { | ||
1659 | + success = containerService.updateLocationCodeAndStatus(containerCode, toLocationCode, QuantityConstant.STATUS_CONTAINER_EMPTY, | ||
1660 | + QuantityConstant.STATUS_CONTAINER_FILL_SOME, warehouseCode); | ||
1661 | + } | ||
1688 | } else { | 1662 | } else { |
1689 | - success = containerService.updateLocationCodeAndStatus(containerCode, toLocationCode, QuantityConstant.STATUS_CONTAINER_EMPTY, | ||
1690 | - QuantityConstant.STATUS_CONTAINER_FILL_EMPTY, warehouseCode); | 1663 | + if (fromLocationCode.equals(toLocationCode)) { |
1664 | + success = containerService.updateStatus(containerCode, QuantityConstant.STATUS_CONTAINER_EMPTY, warehouseCode); | ||
1665 | + } else { | ||
1666 | + success = containerService.updateLocationCodeAndStatus(containerCode, toLocationCode, QuantityConstant.STATUS_CONTAINER_EMPTY, | ||
1667 | + QuantityConstant.STATUS_CONTAINER_FILL_EMPTY, warehouseCode); | ||
1668 | + } | ||
1691 | } | 1669 | } |
1692 | break; | 1670 | break; |
1693 | case QuantityConstant.TASK_TYPE_OVER_STATION: | 1671 | case QuantityConstant.TASK_TYPE_OVER_STATION: |
@@ -1696,20 +1674,30 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea | @@ -1696,20 +1674,30 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea | ||
1696 | break; | 1674 | break; |
1697 | } | 1675 | } |
1698 | if (!success) { | 1676 | if (!success) { |
1699 | - throw new JeecgBootException("完成任务时,更新容器失败"); | 1677 | + throw new JeecgBootException("任务类型" + taskType + "完成任务时, 更新容器失败"); |
1700 | } | 1678 | } |
1701 | if (StringUtils.isNotEmpty(fromLocationCode) && !fromLocationCode.equals(toLocationCode)) { | 1679 | if (StringUtils.isNotEmpty(fromLocationCode) && !fromLocationCode.equals(toLocationCode)) { |
1680 | + Location toLocation = locationService.getLocationByCode(fromLocationCode, warehouseCode); | ||
1681 | + if (toLocation == null) { | ||
1682 | + return Result.error("完成任务时," + toLocationCode + "目标库位不存在"); | ||
1683 | + } | ||
1702 | success = | 1684 | success = |
1703 | locationService.updateContainerCodeAndStatus(fromLocationCode, QuantityConstant.EMPTY_STRING, QuantityConstant.STATUS_LOCATION_EMPTY, warehouseCode); | 1685 | locationService.updateContainerCodeAndStatus(fromLocationCode, QuantityConstant.EMPTY_STRING, QuantityConstant.STATUS_LOCATION_EMPTY, warehouseCode); |
1704 | if (!success) { | 1686 | if (!success) { |
1705 | - throw new JeecgBootException("完成任务时,更新源库位失败"); | 1687 | + throw new JeecgBootException("任务类型" + taskType + "完成任务时,更新源库位失败"); |
1706 | } | 1688 | } |
1707 | } | 1689 | } |
1708 | - success = locationService.updateContainerCodeAndStatus(toLocationCode, containerCode, QuantityConstant.STATUS_LOCATION_EMPTY, warehouseCode); | ||
1709 | - if (!success) { | ||
1710 | - throw new JeecgBootException("完成任务时,更新库位失败"); | 1690 | + if (StringUtils.isNotEmpty(toLocationCode)) { |
1691 | + Location toLocation = locationService.getLocationByCode(toLocationCode, warehouseCode); | ||
1692 | + if (toLocation == null) { | ||
1693 | + return Result.error("任务类型" + taskType + "完成任务时, " + toLocationCode + "目标库位不存在"); | ||
1694 | + } | ||
1695 | + success = locationService.updateContainerCodeAndStatus(toLocationCode, containerCode, QuantityConstant.STATUS_LOCATION_EMPTY, warehouseCode); | ||
1696 | + if (!success) { | ||
1697 | + throw new JeecgBootException("任务类型" + taskType + "完成任务时,更新库位失败"); | ||
1698 | + } | ||
1711 | } | 1699 | } |
1712 | - return Result.OK("完成任务成功"); | 1700 | + return Result.OK("任务类型" + taskType + "完成任务成功"); |
1713 | } | 1701 | } |
1714 | 1702 | ||
1715 | /** | 1703 | /** |
@@ -1733,27 +1721,16 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea | @@ -1733,27 +1721,16 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea | ||
1733 | if (StringUtils.isEmpty(toLocationCode)) { | 1721 | if (StringUtils.isEmpty(toLocationCode)) { |
1734 | return Result.error("完成空托盘入库任务时, 目标库位号为空"); | 1722 | return Result.error("完成空托盘入库任务时, 目标库位号为空"); |
1735 | } | 1723 | } |
1736 | - Container container = containerService.getContainerByCode(containerCode, warehouseCode); | ||
1737 | - if (container == null) { | ||
1738 | - return Result.error("完成空托盘入库任务时, 没有找到托盘" + containerCode); | ||
1739 | - } | ||
1740 | - Location toLocation = locationService.getLocationByCode(toLocationCode, warehouseCode); | ||
1741 | - if (toLocation == null) { | ||
1742 | - return Result.error("完成空托盘入库任务时," + toLocationCode + "目标库位不存在"); | ||
1743 | - } | ||
1744 | - boolean success = containerService.updateLocationCodeAndStatus(containerCode, toLocationCode, QuantityConstant.STATUS_CONTAINER_EMPTY, warehouseCode); | ||
1745 | - if (!success) { | ||
1746 | - throw new JeecgBootException("完成空托盘入库任务时, 更新容器的库位号和状态失败"); | 1724 | + Result result = taskHeaderService.completeTaskUnLockContainerAndLocation(taskHeader.getContainerFillStatus(), QuantityConstant.TASK_TYPE_EMPTYRECEIPT, |
1725 | + containerCode, QuantityConstant.EMPTY_STRING, toLocationCode, warehouseCode); | ||
1726 | + if (!result.isSuccess()) { | ||
1727 | + throw new JeecgBootException(result.getMessage()); | ||
1747 | } | 1728 | } |
1748 | - success = locationService.updateContainerCodeAndStatus(toLocationCode, containerCode, QuantityConstant.STATUS_LOCATION_EMPTY, warehouseCode); | 1729 | + boolean success = taskHeaderService.updateStatusById(QuantityConstant.TASK_STATUS_COMPLETED, taskHeader.getId()); |
1749 | if (!success) { | 1730 | if (!success) { |
1750 | - throw new JeecgBootException("完成空托盘入库任务时, 更新库位的容器编码和状态失败"); | 1731 | + throw new JeecgBootException("完成空托盘出库任务时, 更新任务失败"); |
1751 | } | 1732 | } |
1752 | - success = taskHeaderService.updateStatusById(QuantityConstant.TASK_STATUS_COMPLETED, taskHeader.getId()); | ||
1753 | log.info("完成空托入库任务"); | 1733 | log.info("完成空托入库任务"); |
1754 | - if (!success) { | ||
1755 | - throw new JeecgBootException("完成空托盘入库任务时, 更新任务失败"); | ||
1756 | - } | ||
1757 | return Result.OK("完成空托盘入库成功"); | 1734 | return Result.OK("完成空托盘入库成功"); |
1758 | } | 1735 | } |
1759 | 1736 | ||
@@ -1787,7 +1764,7 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea | @@ -1787,7 +1764,7 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea | ||
1787 | // 1.先拿到盘点单主单据 | 1764 | // 1.先拿到盘点单主单据 |
1788 | CycleCountDetail cycleCountDetail = cycleCountDetailService.getById(taskHeader.getShipmentContainerHeaderId()); | 1765 | CycleCountDetail cycleCountDetail = cycleCountDetailService.getById(taskHeader.getShipmentContainerHeaderId()); |
1789 | 1766 | ||
1790 | - if ((cycleCountDetail.getCountedQty().add(cycleCountDetail.getGapQty())).compareTo(BigDecimal.ZERO) == 0) { | 1767 | + if (cycleCountDetail.getGapQty().compareTo(BigDecimal.ZERO) == 0) { |
1791 | return Result.error("盘点单据系统实盘数量跟差异数量0,不能完成 单据号" + cycleCountDetail.getCycleCountHeadCode()); | 1768 | return Result.error("盘点单据系统实盘数量跟差异数量0,不能完成 单据号" + cycleCountDetail.getCycleCountHeadCode()); |
1792 | } | 1769 | } |
1793 | 1770 | ||
@@ -2042,17 +2019,12 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea | @@ -2042,17 +2019,12 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea | ||
2042 | if (port == null) { | 2019 | if (port == null) { |
2043 | return Result.error("完成空托盘出库任务时," + toPortCode + "目标出库口不存在"); | 2020 | return Result.error("完成空托盘出库任务时," + toPortCode + "目标出库口不存在"); |
2044 | } | 2021 | } |
2045 | - boolean success = | ||
2046 | - containerService.updateLocationCodeAndStatus(containerCode, QuantityConstant.EMPTY_STRING, QuantityConstant.STATUS_CONTAINER_EMPTY, warehouseCode); | ||
2047 | - if (!success) { | ||
2048 | - throw new JeecgBootException("完成空托盘出库任务时, 更新容器的库位号和状态失败"); | ||
2049 | - } | ||
2050 | - success = | ||
2051 | - locationService.updateContainerCodeAndStatus(fromLocationCode, QuantityConstant.EMPTY_STRING, QuantityConstant.STATUS_LOCATION_EMPTY, warehouseCode); | ||
2052 | - if (!success) { | ||
2053 | - throw new JeecgBootException("完成空托盘出库任务时, 更新库位的容器编码和状态失败"); | 2022 | + Result result = taskHeaderService.completeTaskUnLockContainerAndLocation(taskHeader.getContainerFillStatus(), QuantityConstant.TASK_TYPE_EMPTYRECEIPT, |
2023 | + containerCode, fromLocationCode, QuantityConstant.EMPTY_STRING, warehouseCode); | ||
2024 | + if (!result.isSuccess()) { | ||
2025 | + throw new JeecgBootException(result.getMessage()); | ||
2054 | } | 2026 | } |
2055 | - success = taskHeaderService.updateStatusById(QuantityConstant.TASK_STATUS_COMPLETED, taskHeader.getId()); | 2027 | + boolean success = taskHeaderService.updateStatusById(QuantityConstant.TASK_STATUS_COMPLETED, taskHeader.getId()); |
2056 | log.info("完成空托盘出库任务" + taskHeader.getId()); | 2028 | log.info("完成空托盘出库任务" + taskHeader.getId()); |
2057 | if (!success) { | 2029 | if (!success) { |
2058 | throw new JeecgBootException("完成空托盘出库任务时, 更新任务失败"); | 2030 | throw new JeecgBootException("完成空托盘出库任务时, 更新任务失败"); |
@@ -2119,24 +2091,6 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea | @@ -2119,24 +2091,6 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea | ||
2119 | throw new JeecgBootException("完成移库任务时,保存库存交易失败"); | 2091 | throw new JeecgBootException("完成移库任务时,保存库存交易失败"); |
2120 | } | 2092 | } |
2121 | } | 2093 | } |
2122 | - taskHeader.setStatus(QuantityConstant.TASK_STATUS_COMPLETED); | ||
2123 | - success = taskHeaderService.updateById(taskHeader); | ||
2124 | - if (!success) { | ||
2125 | - throw new JeecgBootException("完成移库任务时, 更新任务失败"); | ||
2126 | - } | ||
2127 | - success = containerService.updateLocationCodeAndStatus(containerCode, toLocationCode, QuantityConstant.STATUS_CONTAINER_EMPTY, warehouseCode); | ||
2128 | - if (!success) { | ||
2129 | - throw new JeecgBootException("完成移库任务时, 更新容器状态失败"); | ||
2130 | - } | ||
2131 | - success = | ||
2132 | - locationService.updateContainerCodeAndStatus(fromLocationCode, QuantityConstant.EMPTY_STRING, QuantityConstant.STATUS_LOCATION_EMPTY, warehouseCode); | ||
2133 | - if (!success) { | ||
2134 | - throw new JeecgBootException("完成移库任务时, 更新起始库位状态失败"); | ||
2135 | - } | ||
2136 | - success = locationService.updateContainerCodeAndStatus(toLocationCode, containerCode, QuantityConstant.STATUS_LOCATION_EMPTY, warehouseCode); | ||
2137 | - if (!success) { | ||
2138 | - throw new JeecgBootException("完成移库任务时, 更新目标库位状态失败"); | ||
2139 | - } | ||
2140 | LambdaUpdateWrapper<InventoryHeader> inventoryHeaderLambdaUpdateWrapper = Wrappers.lambdaUpdate(); | 2094 | LambdaUpdateWrapper<InventoryHeader> inventoryHeaderLambdaUpdateWrapper = Wrappers.lambdaUpdate(); |
2141 | inventoryHeaderLambdaUpdateWrapper.eq(InventoryHeader::getWarehouseCode, warehouseCode).eq(InventoryHeader::getContainerCode, containerCode) | 2095 | inventoryHeaderLambdaUpdateWrapper.eq(InventoryHeader::getWarehouseCode, warehouseCode).eq(InventoryHeader::getContainerCode, containerCode) |
2142 | .eq(InventoryHeader::getLocationCode, fromLocationCode); | 2096 | .eq(InventoryHeader::getLocationCode, fromLocationCode); |
@@ -2154,6 +2108,16 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea | @@ -2154,6 +2108,16 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea | ||
2154 | throw new JeecgBootException("完成移库任务时, 更新库存详情失败"); | 2108 | throw new JeecgBootException("完成移库任务时, 更新库存详情失败"); |
2155 | } | 2109 | } |
2156 | } | 2110 | } |
2111 | + Result result = taskHeaderService.completeTaskUnLockContainerAndLocation(taskHeader.getContainerFillStatus(), QuantityConstant.TASK_TYPE_OVER_STATION, | ||
2112 | + containerCode, fromLocationCode, toLocationCode, warehouseCode); | ||
2113 | + if (!result.isSuccess()) { | ||
2114 | + throw new JeecgBootException(result.getMessage()); | ||
2115 | + } | ||
2116 | + taskHeader.setStatus(QuantityConstant.TASK_STATUS_COMPLETED); | ||
2117 | + success = taskHeaderService.updateStatusById(QuantityConstant.TASK_STATUS_COMPLETED, taskHeader.getId()); | ||
2118 | + if (!success) { | ||
2119 | + throw new JeecgBootException("完成移库任务时, 更新任务失败"); | ||
2120 | + } | ||
2157 | log.info("完成移库任务" + taskHeader.getId()); | 2121 | log.info("完成移库任务" + taskHeader.getId()); |
2158 | return Result.OK("完成移库任务成功"); | 2122 | return Result.OK("完成移库任务成功"); |
2159 | } | 2123 | } |
@@ -2218,42 +2182,12 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea | @@ -2218,42 +2182,12 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea | ||
2218 | if (!success) { | 2182 | if (!success) { |
2219 | throw new JeecgBootException("完成出库查看任务时,更新库存头失败"); | 2183 | throw new JeecgBootException("完成出库查看任务时,更新库存头失败"); |
2220 | } | 2184 | } |
2221 | - if (fromLocationCode.equals(toLocationCode)) { | ||
2222 | - success = containerService.updateStatus(containerCode, QuantityConstant.STATUS_CONTAINER_EMPTY, warehouseCode); | ||
2223 | - } else { | ||
2224 | - success = containerService.updateLocationCodeAndStatus(containerCode, toLocationCode, QuantityConstant.STATUS_CONTAINER_EMPTY, warehouseCode); | ||
2225 | - } | ||
2226 | - if (!success) { | ||
2227 | - throw new JeecgBootException("完成出库查看任务时,更新容器状态失败"); | ||
2228 | - } | ||
2229 | - } else { | ||
2230 | - if (fromLocationCode.equals(toLocationCode)) { | ||
2231 | - success = containerService.updateStatus(containerCode, QuantityConstant.STATUS_CONTAINER_EMPTY, warehouseCode); | ||
2232 | - } else { | ||
2233 | - success = containerService.updateLocationCodeAndStatus(containerCode, toLocationCode, QuantityConstant.STATUS_CONTAINER_EMPTY, warehouseCode); | ||
2234 | - } | ||
2235 | - if (!success) { | ||
2236 | - throw new JeecgBootException("完成出库查看任务时,更新容器状态失败"); | ||
2237 | - } | ||
2238 | } | 2185 | } |
2239 | 2186 | ||
2240 | - if (!fromLocationCode.equals(toLocationCode)) { | ||
2241 | - success = | ||
2242 | - locationService.updateContainerCodeAndStatus(fromLocationCode, QuantityConstant.EMPTY_STRING, QuantityConstant.STATUS_LOCATION_EMPTY, warehouseCode); | ||
2243 | - if (!success) { | ||
2244 | - throw new JeecgBootException("完成出库查看任务时,更新源库位失败"); | ||
2245 | - } | ||
2246 | - } else { | ||
2247 | - success = locationService.updateStatus(fromLocationCode, QuantityConstant.STATUS_LOCATION_EMPTY, warehouseCode); | ||
2248 | - if (!success) { | ||
2249 | - throw new JeecgBootException("完成出库查看任务时,更新源库位失败"); | ||
2250 | - } | ||
2251 | - } | ||
2252 | - if (StringUtils.isNotEmpty(fromLocationCode) && !fromLocationCode.equals(toLocationCode)) { | ||
2253 | - success = locationService.updateContainerCodeAndStatus(toLocationCode, containerCode, QuantityConstant.STATUS_LOCATION_EMPTY, warehouseCode); | ||
2254 | - if (!success) { | ||
2255 | - throw new JeecgBootException("完成出库查看任务时,更新目标库位失败"); | ||
2256 | - } | 2187 | + Result result = taskHeaderService.completeTaskUnLockContainerAndLocation(taskHeader.getContainerFillStatus(), QuantityConstant.TASK_TYPE_EMPTYRECEIPT, |
2188 | + containerCode, fromLocationCode, toLocationCode, warehouseCode); | ||
2189 | + if (!result.isSuccess()) { | ||
2190 | + throw new JeecgBootException(result.getMessage()); | ||
2257 | } | 2191 | } |
2258 | taskHeader.setStatus(QuantityConstant.TASK_STATUS_COMPLETED); | 2192 | taskHeader.setStatus(QuantityConstant.TASK_STATUS_COMPLETED); |
2259 | success = taskHeaderService.updateStatusById(QuantityConstant.TASK_STATUS_COMPLETED, taskHeader.getId()); | 2193 | success = taskHeaderService.updateStatusById(QuantityConstant.TASK_STATUS_COMPLETED, taskHeader.getId()); |
@@ -2301,16 +2235,21 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea | @@ -2301,16 +2235,21 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea | ||
2301 | if (toPort == null) { | 2235 | if (toPort == null) { |
2302 | return Result.error("创建跨站任务时,目标站台为空"); | 2236 | return Result.error("创建跨站任务时,目标站台为空"); |
2303 | } | 2237 | } |
2238 | + Result result = taskHeaderService.completeTaskUnLockContainerAndLocation(taskHeader.getContainerFillStatus(), QuantityConstant.TASK_TYPE_OVER_STATION, | ||
2239 | + containerCode, QuantityConstant.EMPTY_STRING, QuantityConstant.EMPTY_STRING, warehouseCode); | ||
2240 | + if (!result.isSuccess()) { | ||
2241 | + throw new JeecgBootException(result.getMessage()); | ||
2242 | + } | ||
2304 | taskHeader.setStatus(QuantityConstant.TASK_STATUS_COMPLETED); | 2243 | taskHeader.setStatus(QuantityConstant.TASK_STATUS_COMPLETED); |
2305 | boolean success = taskHeaderService.updateStatusById(QuantityConstant.TASK_STATUS_COMPLETED, taskHeader.getId()); | 2244 | boolean success = taskHeaderService.updateStatusById(QuantityConstant.TASK_STATUS_COMPLETED, taskHeader.getId()); |
2306 | if (!success) { | 2245 | if (!success) { |
2307 | throw new JeecgBootException("创建跨站任务时, 更新任务失败"); | 2246 | throw new JeecgBootException("创建跨站任务时, 更新任务失败"); |
2308 | } | 2247 | } |
2309 | - success = containerService.updateStatus(containerCode, QuantityConstant.STATUS_CONTAINER_EMPTY, warehouseCode); | 2248 | +// success = containerService.updateStatus(containerCode, QuantityConstant.STATUS_CONTAINER_EMPTY, warehouseCode); |
2249 | +// if (!success) { | ||
2250 | +// throw new JeecgBootException("创建跨站任务时, 更新容器状态失败"); | ||
2251 | +// } | ||
2310 | log.info("完成跨站任务" + taskHeader.getId()); | 2252 | log.info("完成跨站任务" + taskHeader.getId()); |
2311 | - if (!success) { | ||
2312 | - throw new JeecgBootException("创建跨站任务时, 更新容器状态失败"); | ||
2313 | - } | ||
2314 | return Result.OK("完成跨站任务成功"); | 2253 | return Result.OK("完成跨站任务成功"); |
2315 | } | 2254 | } |
2316 | 2255 | ||
@@ -2343,21 +2282,17 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea | @@ -2343,21 +2282,17 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea | ||
2343 | if (toLocation == null) { | 2282 | if (toLocation == null) { |
2344 | return Result.error("完成空托盘组入库任务时,没有找到库位" + toLocationCode); | 2283 | return Result.error("完成空托盘组入库任务时,没有找到库位" + toLocationCode); |
2345 | } | 2284 | } |
2285 | + Result result = taskHeaderService.completeTaskUnLockContainerAndLocation(taskHeader.getContainerFillStatus(), QuantityConstant.TASK_TYPE_MANY_EMPTYRECEIPT, | ||
2286 | + containerCode, QuantityConstant.EMPTY_STRING, toLocationCode, warehouseCode); | ||
2287 | + if (!result.isSuccess()) { | ||
2288 | + throw new JeecgBootException(result.getMessage()); | ||
2289 | + } | ||
2346 | taskHeader.setStatus(QuantityConstant.TASK_STATUS_COMPLETED); | 2290 | taskHeader.setStatus(QuantityConstant.TASK_STATUS_COMPLETED); |
2347 | boolean success = taskHeaderService.updateStatusById(QuantityConstant.TASK_STATUS_COMPLETED, taskHeader.getId()); | 2291 | boolean success = taskHeaderService.updateStatusById(QuantityConstant.TASK_STATUS_COMPLETED, taskHeader.getId()); |
2348 | if (!success) { | 2292 | if (!success) { |
2349 | throw new JeecgBootException("完成空托盘组入库任务时, 更新任务失败"); | 2293 | throw new JeecgBootException("完成空托盘组入库任务时, 更新任务失败"); |
2350 | } | 2294 | } |
2351 | - success = containerService.updateLocationCodeAndStatus(containerCode, toLocationCode, QuantityConstant.STATUS_LOCATION_EMPTY, | ||
2352 | - QuantityConstant.STATUS_CONTAINER_FILL_MANY, warehouseCode); | ||
2353 | - if (!success) { | ||
2354 | - throw new JeecgBootException("完成空托盘组入库任务时, 更新容器失败"); | ||
2355 | - } | ||
2356 | - success = locationService.updateContainerCodeAndStatus(toLocationCode, containerCode, QuantityConstant.STATUS_LOCATION_EMPTY, warehouseCode); | ||
2357 | log.info("完成空托盘组入库任务" + taskHeader.getId()); | 2295 | log.info("完成空托盘组入库任务" + taskHeader.getId()); |
2358 | - if (!success) { | ||
2359 | - throw new JeecgBootException("完成空托盘组入库任务时, 更新库位失败"); | ||
2360 | - } | ||
2361 | return Result.ok("完成空托盘组入库任务成功"); | 2296 | return Result.ok("完成空托盘组入库任务成功"); |
2362 | } | 2297 | } |
2363 | 2298 |