Commit 059c12ea687c15264f5f490ea3ddf08b2b09d34c
Merge remote-tracking branch 'origin/develop' into develop
Showing
17 changed files
with
319 additions
and
218 deletions
ant-design-vue-jeecg/src/views/system/task/CircleTaskHeaderList.vue
@@ -142,11 +142,11 @@ | @@ -142,11 +142,11 @@ | ||
142 | 142 | ||
143 | <span slot="action" slot-scope="text, record"> | 143 | <span slot="action" slot-scope="text, record"> |
144 | <a v-if="record.status == 1" v-has="'taskHeader:executeTask'" @click="executeTask(record)">执行<a-divider type="vertical"/></a> | 144 | <a v-if="record.status == 1" v-has="'taskHeader:executeTask'" @click="executeTask(record)">执行<a-divider type="vertical"/></a> |
145 | - <a v-if="record.isEmptyOut == 1 && record.exceptionState == 1" v-has="'taskHeader:executeTask'" @click="handleEmptyOutTask(record)">修复空出数据 | 145 | + <a v-if="record.isEmptyOut == 1 && record.exceptionState == 1" v-has="'taskHeader:handleEmptyOutTask'" @click="handleEmptyOutTask(record)">修复空出数据 |
146 | <a-divider type="vertical"/></a> | 146 | <a-divider type="vertical"/></a> |
147 | - <a v-if="record.isPickupError == 1 && record.exceptionState == 1" v-has="'taskHeader:executeTask'" @click="handlePickupErrorTask(record)">修复取货错数据 | 147 | + <a v-if="record.isPickupError == 1 && record.exceptionState == 1" v-has="'taskHeader:handlePickupErrorTask'" @click="handlePickupErrorTask(record)">修复取货错数据 |
148 | <a-divider type="vertical"/></a> | 148 | <a-divider type="vertical"/></a> |
149 | - <a v-if="record.isDoubleIn == 1 && record.exceptionState == 1" v-has="'taskHeader:executeTask'" @click="handleDoubleInTask(record)">修复重入数据 | 149 | + <a v-if="record.isDoubleIn == 1 && record.exceptionState == 1" v-has="'taskHeader:handleDoubleInTask'" @click="handleDoubleInTask(record)">修复重入数据 |
150 | <a-divider type="vertical"/></a> | 150 | <a-divider type="vertical"/></a> |
151 | <a v-if="record.status <= 10" v-has="'taskHeader:cancelTask'" @click="cancelTask(record)">取消</a> | 151 | <a v-if="record.status <= 10" v-has="'taskHeader:cancelTask'" @click="cancelTask(record)">取消</a> |
152 | </span> | 152 | </span> |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/api/erp/service/impl/ErpServiceImpl.java
@@ -10,6 +10,7 @@ import java.util.stream.Collectors; | @@ -10,6 +10,7 @@ import java.util.stream.Collectors; | ||
10 | import javax.annotation.Resource; | 10 | import javax.annotation.Resource; |
11 | 11 | ||
12 | import org.jeecg.common.api.vo.Result; | 12 | import org.jeecg.common.api.vo.Result; |
13 | +import org.jeecg.common.exception.JeecgBootException; | ||
13 | import org.jeecg.modules.wms.api.erp.entity.*; | 14 | import org.jeecg.modules.wms.api.erp.entity.*; |
14 | import org.jeecg.modules.wms.api.erp.service.IErpService; | 15 | import org.jeecg.modules.wms.api.erp.service.IErpService; |
15 | import org.jeecg.modules.wms.config.address.service.IAddressService; | 16 | import org.jeecg.modules.wms.config.address.service.IAddressService; |
@@ -38,7 +39,6 @@ import org.springframework.stereotype.Service; | @@ -38,7 +39,6 @@ import org.springframework.stereotype.Service; | ||
38 | import org.springframework.transaction.annotation.Transactional; | 39 | import org.springframework.transaction.annotation.Transactional; |
39 | 40 | ||
40 | import com.alibaba.fastjson.JSON; | 41 | import com.alibaba.fastjson.JSON; |
41 | -import org.jeecg.common.exception.JeecgBootException; | ||
42 | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | 42 | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
43 | import com.baomidou.mybatisplus.core.toolkit.Wrappers; | 43 | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
44 | 44 | ||
@@ -399,6 +399,7 @@ public class ErpServiceImpl implements IErpService { | @@ -399,6 +399,7 @@ public class ErpServiceImpl implements IErpService { | ||
399 | } | 399 | } |
400 | 400 | ||
401 | @Override | 401 | @Override |
402 | + @Transactional(rollbackFor = Exception.class) | ||
402 | public Result backReceipt(ReceiptHeader receiptHeader) { | 403 | public Result backReceipt(ReceiptHeader receiptHeader) { |
403 | if (receiptHeader == null) { | 404 | if (receiptHeader == null) { |
404 | return Result.error("回传入库单, 入库单为空!!"); | 405 | return Result.error("回传入库单, 入库单为空!!"); |
@@ -436,6 +437,7 @@ public class ErpServiceImpl implements IErpService { | @@ -436,6 +437,7 @@ public class ErpServiceImpl implements IErpService { | ||
436 | } | 437 | } |
437 | 438 | ||
438 | @Override | 439 | @Override |
440 | + @Transactional(rollbackFor = Exception.class) | ||
439 | public Result backShipment(ShipmentHeader shipmentHeader) { | 441 | public Result backShipment(ShipmentHeader shipmentHeader) { |
440 | if (shipmentHeader == null) { | 442 | if (shipmentHeader == null) { |
441 | return Result.error("回传出库单, 出库单为空!!"); | 443 | return Result.error("回传出库单, 出库单为空!!"); |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/api/mobile/service/IMobileService.java
@@ -8,5 +8,6 @@ import org.jeecg.modules.wms.task.taskHeader.entity.TaskHeader; | @@ -8,5 +8,6 @@ import org.jeecg.modules.wms.task.taskHeader.entity.TaskHeader; | ||
8 | public interface IMobileService { | 8 | public interface IMobileService { |
9 | 9 | ||
10 | Result<TaskHeader> callBox(CallBoxBean bean, String warehouseCode); | 10 | Result<TaskHeader> callBox(CallBoxBean bean, String warehouseCode); |
11 | + | ||
11 | Result<TaskHeader> quickReceipt(QuickReceiptBean bean, String warehouseCode); | 12 | Result<TaskHeader> quickReceipt(QuickReceiptBean bean, String warehouseCode); |
12 | } | 13 | } |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/api/mobile/service/impl/MobileService.java
1 | package org.jeecg.modules.wms.api.mobile.service.impl; | 1 | package org.jeecg.modules.wms.api.mobile.service.impl; |
2 | 2 | ||
3 | +import java.util.ArrayList; | ||
4 | +import java.util.List; | ||
5 | + | ||
3 | import javax.annotation.Resource; | 6 | import javax.annotation.Resource; |
4 | 7 | ||
5 | import org.apache.commons.lang3.StringUtils; | 8 | import org.apache.commons.lang3.StringUtils; |
6 | import org.jeecg.common.api.vo.Result; | 9 | import org.jeecg.common.api.vo.Result; |
10 | +import org.jeecg.common.exception.JeecgBootException; | ||
7 | import org.jeecg.modules.wms.api.mobile.entity.CallBoxBean; | 11 | import org.jeecg.modules.wms.api.mobile.entity.CallBoxBean; |
8 | import org.jeecg.modules.wms.api.mobile.entity.QuickReceiptBean; | 12 | import org.jeecg.modules.wms.api.mobile.entity.QuickReceiptBean; |
9 | import org.jeecg.modules.wms.api.mobile.service.IMobileService; | 13 | import org.jeecg.modules.wms.api.mobile.service.IMobileService; |
10 | import org.jeecg.modules.wms.config.container.entity.Container; | 14 | import org.jeecg.modules.wms.config.container.entity.Container; |
11 | import org.jeecg.modules.wms.config.container.service.IContainerService; | 15 | import org.jeecg.modules.wms.config.container.service.IContainerService; |
12 | -import org.jeecg.modules.wms.config.location.entity.Location; | ||
13 | import org.jeecg.modules.wms.config.location.service.ILocationService; | 16 | import org.jeecg.modules.wms.config.location.service.ILocationService; |
17 | +import org.jeecg.modules.wms.config.parameterConfiguration.service.IParameterConfigurationService; | ||
14 | import org.jeecg.modules.wms.receipt.receiptHeader.entity.ReceiptDetail; | 18 | import org.jeecg.modules.wms.receipt.receiptHeader.entity.ReceiptDetail; |
15 | import org.jeecg.modules.wms.receipt.receiptHeader.entity.ReceiptHeader; | 19 | import org.jeecg.modules.wms.receipt.receiptHeader.entity.ReceiptHeader; |
16 | import org.jeecg.modules.wms.receipt.receiptHeader.service.IReceiptDetailService; | 20 | import org.jeecg.modules.wms.receipt.receiptHeader.service.IReceiptDetailService; |
@@ -24,11 +28,6 @@ import org.springframework.beans.factory.annotation.Autowired; | @@ -24,11 +28,6 @@ import org.springframework.beans.factory.annotation.Autowired; | ||
24 | import org.springframework.stereotype.Service; | 28 | import org.springframework.stereotype.Service; |
25 | import org.springframework.transaction.annotation.Transactional; | 29 | import org.springframework.transaction.annotation.Transactional; |
26 | 30 | ||
27 | -import org.jeecg.common.exception.JeecgBootException; | ||
28 | - | ||
29 | -import java.util.ArrayList; | ||
30 | -import java.util.List; | ||
31 | - | ||
32 | /** | 31 | /** |
33 | */ | 32 | */ |
34 | @Service | 33 | @Service |
@@ -51,56 +50,47 @@ public class MobileService implements IMobileService { | @@ -51,56 +50,47 @@ public class MobileService implements IMobileService { | ||
51 | 50 | ||
52 | @Resource | 51 | @Resource |
53 | private IReceiveService receiveService; | 52 | private IReceiveService receiveService; |
53 | + @Resource | ||
54 | + private IParameterConfigurationService parameterConfigurationService; | ||
54 | 55 | ||
55 | @Override | 56 | @Override |
56 | @Transactional(rollbackFor = Exception.class) | 57 | @Transactional(rollbackFor = Exception.class) |
57 | public Result<TaskHeader> callBox(CallBoxBean bean, String warehouseCode) { | 58 | public Result<TaskHeader> callBox(CallBoxBean bean, String warehouseCode) { |
59 | + String containerCode = bean.getContainerCode(); | ||
58 | if (StringUtils.isEmpty(bean.getContainerCode())) { | 60 | if (StringUtils.isEmpty(bean.getContainerCode())) { |
59 | - return Result.error("托盘号containerCode不能为空"); | 61 | + return Result.error("呼叫料盒,托盘号containerCode不能为空"); |
60 | } | 62 | } |
61 | 63 | ||
62 | if (StringUtils.isEmpty(bean.getLocationCode())) { | 64 | if (StringUtils.isEmpty(bean.getLocationCode())) { |
63 | - return Result.error("库位locationCode不能为空"); | 65 | + return Result.error("呼叫料盒, 库位locationCode不能为空"); |
64 | } | 66 | } |
65 | 67 | ||
66 | if (StringUtils.isEmpty(bean.getCompanyCode())) { | 68 | if (StringUtils.isEmpty(bean.getCompanyCode())) { |
67 | - return Result.error("货主companyCode不能为空"); | 69 | + return Result.error("呼叫料盒, 货主companyCode不能为空"); |
68 | } | 70 | } |
69 | 71 | ||
70 | - if(StringUtils.isEmpty(bean.getPort())){ | ||
71 | - return Result.error("出库口不能为空"); | 72 | + if (StringUtils.isEmpty(bean.getPort())) { |
73 | + return Result.error("呼叫料盒, 出库口不能为空"); | ||
72 | } | 74 | } |
73 | - | ||
74 | - Container container = containerService.getContainerByCode(bean.getContainerCode(), warehouseCode); | 75 | + Container container = containerService.getContainerByCode(containerCode, warehouseCode); |
75 | if (container == null) { | 76 | if (container == null) { |
76 | - return Result.error(bean.getContainerCode() + " " + warehouseCode + "容器不存在"); | 77 | + return Result.error("呼叫料盒,容器为空"); |
77 | } | 78 | } |
78 | - | ||
79 | - if (StringUtils.isEmpty(container.getLocationCode())) { | ||
80 | - return Result.error(bean.getContainerCode() + "容器不在库位上"); | 79 | + String fromLocationCode = container.getLocationCode(); |
80 | + String toLocationCode = QuantityConstant.EMPTY_STRING; | ||
81 | + String value = parameterConfigurationService.getValueByCode(QuantityConstant.RULE_TASK_LOCATION); | ||
82 | + int taskLocationRule = Integer.parseInt(value); | ||
83 | + if (taskLocationRule == QuantityConstant.RULE_TASK_SET_LOCATION) { | ||
84 | + toLocationCode = fromLocationCode; | ||
81 | } | 85 | } |
82 | - | ||
83 | - if (!container.getLocationCode().equals(bean.getLocationCode())) { | ||
84 | - return Result.error(bean.getContainerCode() + "容器不在库位[" + bean.getLocationCode() + "]上"); | ||
85 | - } | ||
86 | - | ||
87 | - Location loc = locationService.getLocationByCode(bean.getLocationCode(), warehouseCode); | ||
88 | - // 校验目标地址 | ||
89 | - if (loc == null) { | ||
90 | - return Result.error("目标库位不存在"); | ||
91 | - } | ||
92 | - if (!QuantityConstant.STATUS_LOCATION_EMPTY.equals(loc.getStatus())) { | ||
93 | - return Result.error("目标库位非空闲"); | ||
94 | - } | ||
95 | - // 判断托盘是否已经存在任务 | ||
96 | - TaskHeader taskHeader = taskHeaderService.getUnCompleteTaskByContainerCode(bean.getContainerCode(), warehouseCode); | ||
97 | - if (taskHeader != null) { | ||
98 | - return Result.error("容器已存在任务"); | 86 | + Result result = taskHeaderService.createTaskLockContainerAndLocation(bean.getType(), containerCode, fromLocationCode, toLocationCode, warehouseCode); |
87 | + if (!result.isSuccess()) { | ||
88 | + throw new JeecgBootException(result.getMessage()); | ||
99 | } | 89 | } |
100 | 90 | ||
101 | // 创建主任务 | 91 | // 创建主任务 |
102 | - taskHeader = new TaskHeader(); | ||
103 | - taskHeader.setWarehouseCode(loc.getWarehouseCode()); | 92 | + TaskHeader taskHeader = new TaskHeader(); |
93 | + taskHeader.setWarehouseCode(warehouseCode); | ||
104 | taskHeader.setCompanyCode(bean.getCompanyCode()); | 94 | taskHeader.setCompanyCode(bean.getCompanyCode()); |
105 | taskHeader.setToPortCode(bean.getPort()); | 95 | taskHeader.setToPortCode(bean.getPort()); |
106 | if (bean.getType() == QuantityConstant.TASK_TYPE_SUPPLEMENTRECEIPT) { | 96 | if (bean.getType() == QuantityConstant.TASK_TYPE_SUPPLEMENTRECEIPT) { |
@@ -112,14 +102,12 @@ public class MobileService implements IMobileService { | @@ -112,14 +102,12 @@ public class MobileService implements IMobileService { | ||
112 | taskHeader.setInnernalTaskType(QuantityConstant.TASK_INTENERTYPE_SHIPMENT); | 102 | taskHeader.setInnernalTaskType(QuantityConstant.TASK_INTENERTYPE_SHIPMENT); |
113 | taskHeader.setTaskType(QuantityConstant.TASK_TYPE_SORTINGSHIPMENT); | 103 | taskHeader.setTaskType(QuantityConstant.TASK_TYPE_SORTINGSHIPMENT); |
114 | } | 104 | } |
115 | - taskHeader.setContainerCode(container.getCode()); | 105 | + taskHeader.setContainerCode(containerCode); |
116 | taskHeader.setStatus(QuantityConstant.TASK_STATUS_BUILD); | 106 | taskHeader.setStatus(QuantityConstant.TASK_STATUS_BUILD); |
117 | - taskHeader.setFromLocationCode(loc.getCode()); | ||
118 | - if (taskHeaderService.save(taskHeader)) { | ||
119 | - // 锁定库位状态 | ||
120 | - locationService.updateStatus(loc.getCode(), QuantityConstant.STATUS_LOCATION_LOCK, warehouseCode); | ||
121 | - } else { | ||
122 | - throw new JeecgBootException("补充入库主表生成失败!"); | 107 | + taskHeader.setFromLocationCode(fromLocationCode); |
108 | + taskHeader.setToLocationCode(toLocationCode); | ||
109 | + if (!taskHeaderService.save(taskHeader)) { | ||
110 | + throw new JeecgBootException("呼叫料盒, 保存任务失败"); | ||
123 | } | 111 | } |
124 | 112 | ||
125 | return Result.OK("呼叫料盒成功", taskHeader); | 113 | return Result.OK("呼叫料盒成功", taskHeader); |
@@ -141,7 +129,7 @@ public class MobileService implements IMobileService { | @@ -141,7 +129,7 @@ public class MobileService implements IMobileService { | ||
141 | return Result.error("收货明细不能为空"); | 129 | return Result.error("收货明细不能为空"); |
142 | } | 130 | } |
143 | 131 | ||
144 | - //创建入库单 | 132 | + // 创建入库单 |
145 | ReceiptHeader receiptHeader = new ReceiptHeader(); | 133 | ReceiptHeader receiptHeader = new ReceiptHeader(); |
146 | receiptHeader.setType(bean.getReceiptType()); | 134 | receiptHeader.setType(bean.getReceiptType()); |
147 | receiptHeader.setCompanyCode(bean.getCompanyCode()); | 135 | receiptHeader.setCompanyCode(bean.getCompanyCode()); |
@@ -153,32 +141,32 @@ public class MobileService implements IMobileService { | @@ -153,32 +141,32 @@ public class MobileService implements IMobileService { | ||
153 | } else { | 141 | } else { |
154 | throw new JeecgBootException(rs1.getMessage()); | 142 | throw new JeecgBootException(rs1.getMessage()); |
155 | } | 143 | } |
156 | - | 144 | + List<ReceiptDetail> receiptDetailList = bean.getReceiptDetails(); |
157 | List<Receive> receiveList = new ArrayList<>(); | 145 | List<Receive> receiveList = new ArrayList<>(); |
158 | - for (ReceiptDetail d : bean.getReceiptDetails()) { | ||
159 | - d.setReceiptId(receiptHeader.getId()); | ||
160 | - Result rs2 = receiptDetailService.saveReceiptDetail(d); | ||
161 | - if(!rs2.isSuccess()) { | 146 | + for (ReceiptDetail receiptDetail : receiptDetailList) { |
147 | + receiptDetail.setReceiptId(receiptHeader.getId()); | ||
148 | + Result rs2 = receiptDetailService.saveReceiptDetail(receiptDetail); | ||
149 | + if (!rs2.isSuccess()) { | ||
162 | throw new JeecgBootException(rs2.getMessage()); | 150 | throw new JeecgBootException(rs2.getMessage()); |
163 | } | 151 | } |
164 | - Receive v = new Receive(); | ||
165 | - v.setId(d.getId()); | ||
166 | - v.setQty(d.getQty()); | ||
167 | - v.setTaskQty(d.getQty()); | ||
168 | - v.setInventoryStatus(d.getInventoryStatus()); | ||
169 | - v.setMaterialCode(d.getMaterialCode()); | ||
170 | - v.setMaterialName(d.getMaterialName()); | ||
171 | - v.setBatch(d.getBatch()); | ||
172 | - v.setMaterialSpec(d.getMaterialSpec()); | ||
173 | - v.setMaterialUnit(d.getMaterialUnit()); | ||
174 | - v.setContainerCode(bean.getContainerCode()); | ||
175 | - receiveList.add(v); | 152 | + Receive receive = new Receive(); |
153 | + receive.setId(receiptDetail.getId()); | ||
154 | + receive.setQty(receiptDetail.getQty()); | ||
155 | + receive.setTaskQty(receiptDetail.getQty()); | ||
156 | + receive.setInventoryStatus(receiptDetail.getInventoryStatus()); | ||
157 | + receive.setMaterialCode(receiptDetail.getMaterialCode()); | ||
158 | + receive.setMaterialName(receiptDetail.getMaterialName()); | ||
159 | + receive.setBatch(receiptDetail.getBatch()); | ||
160 | + receive.setMaterialSpec(receiptDetail.getMaterialSpec()); | ||
161 | + receive.setMaterialUnit(receiptDetail.getMaterialUnit()); | ||
162 | + receive.setContainerCode(bean.getContainerCode()); | ||
163 | + receiveList.add(receive); | ||
176 | } | 164 | } |
177 | 165 | ||
178 | Result<TaskHeader> rs3 = receiveService.receivingAndCreateTask(receiveList, warehouseCode); | 166 | Result<TaskHeader> rs3 = receiveService.receivingAndCreateTask(receiveList, warehouseCode); |
179 | - if(rs3.isSuccess()) { | 167 | + if (rs3.isSuccess()) { |
180 | return rs3; | 168 | return rs3; |
181 | - }else{ | 169 | + } else { |
182 | throw new JeecgBootException(rs3.getMessage()); | 170 | throw new JeecgBootException(rs3.getMessage()); |
183 | } | 171 | } |
184 | } | 172 | } |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/api/wcs/controller/WcsController.java
1 | package org.jeecg.modules.wms.api.wcs.controller; | 1 | package org.jeecg.modules.wms.api.wcs.controller; |
2 | 2 | ||
3 | -import java.net.SocketException; | ||
4 | - | ||
5 | import javax.annotation.Resource; | 3 | import javax.annotation.Resource; |
6 | import javax.servlet.http.HttpServletRequest; | 4 | import javax.servlet.http.HttpServletRequest; |
7 | 5 | ||
@@ -40,7 +38,7 @@ public class WcsController extends HuahengBaseController { | @@ -40,7 +38,7 @@ public class WcsController extends HuahengBaseController { | ||
40 | @ResponseBody | 38 | @ResponseBody |
41 | @ApiOperation("仓位分配") | 39 | @ApiOperation("仓位分配") |
42 | @ApiLogger(apiName = "仓位分配", from = "WCS") | 40 | @ApiLogger(apiName = "仓位分配", from = "WCS") |
43 | - @AccessLimit(seconds = 5, maxCount = 5) | 41 | + @AccessLimit(seconds = 5, maxCount = 10) |
44 | public Result warecellAllocation(@RequestBody WarecellDomain warecellDomain, HttpServletRequest req) { | 42 | public Result warecellAllocation(@RequestBody WarecellDomain warecellDomain, HttpServletRequest req) { |
45 | String warehouseCode = warecellDomain.getWarehouseCode(); | 43 | String warehouseCode = warecellDomain.getWarehouseCode(); |
46 | String taskNo = warecellDomain.getTaskNo(); | 44 | String taskNo = warecellDomain.getTaskNo(); |
@@ -51,7 +49,7 @@ public class WcsController extends HuahengBaseController { | @@ -51,7 +49,7 @@ public class WcsController extends HuahengBaseController { | ||
51 | if (StringUtils.isEmpty(taskNo)) { | 49 | if (StringUtils.isEmpty(taskNo)) { |
52 | return Result.error("仓位分配, 任务号为空"); | 50 | return Result.error("仓位分配, 任务号为空"); |
53 | } | 51 | } |
54 | - if (StringUtils.isEmpty(warecellDomain.getZoneCode())) { | 52 | + if (StringUtils.isEmpty(zoneCode)) { |
55 | return Result.error("仓位分配, 目的区域为空"); | 53 | return Result.error("仓位分配, 目的区域为空"); |
56 | } | 54 | } |
57 | if (StringUtils.isEmpty(warecellDomain.getHeight())) { | 55 | if (StringUtils.isEmpty(warecellDomain.getHeight())) { |
@@ -146,7 +144,7 @@ public class WcsController extends HuahengBaseController { | @@ -146,7 +144,7 @@ public class WcsController extends HuahengBaseController { | ||
146 | @ResponseBody | 144 | @ResponseBody |
147 | @ApiOperation("WCS任务完成") | 145 | @ApiOperation("WCS任务完成") |
148 | @ApiLogger(apiName = "WCS任务完成", from = "WCS") | 146 | @ApiLogger(apiName = "WCS任务完成", from = "WCS") |
149 | - @AccessLimit(seconds = 5, maxCount = 5) | 147 | + @AccessLimit(seconds = 5, maxCount = 10) |
150 | public Result completeTaskByWMS(@RequestBody TaskEntity taskEntity) { | 148 | public Result completeTaskByWMS(@RequestBody TaskEntity taskEntity) { |
151 | String taskNo = taskEntity.getTaskNo(); | 149 | String taskNo = taskEntity.getTaskNo(); |
152 | String lockKey = taskNo; | 150 | String lockKey = taskNo; |
@@ -182,7 +180,7 @@ public class WcsController extends HuahengBaseController { | @@ -182,7 +180,7 @@ public class WcsController extends HuahengBaseController { | ||
182 | @ResponseBody | 180 | @ResponseBody |
183 | @ApiOperation("到达拣选台") | 181 | @ApiOperation("到达拣选台") |
184 | @ApiLogger(apiName = "到达拣选台", from = "WCS") | 182 | @ApiLogger(apiName = "到达拣选台", from = "WCS") |
185 | - @AccessLimit(seconds = 5, maxCount = 5) | 183 | + @AccessLimit(seconds = 5, maxCount = 10) |
186 | public Result arrivedNotice(@RequestBody ArriveEntity arriveEntity) { | 184 | public Result arrivedNotice(@RequestBody ArriveEntity arriveEntity) { |
187 | String taskNo = arriveEntity.getTaskNo(); | 185 | String taskNo = arriveEntity.getTaskNo(); |
188 | String port = arriveEntity.getPort(); | 186 | String port = arriveEntity.getPort(); |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/api/wcs/service/LocationAllocationServiceImpl.java
@@ -25,7 +25,6 @@ import org.jeecg.utils.StringUtils; | @@ -25,7 +25,6 @@ import org.jeecg.utils.StringUtils; | ||
25 | import org.jeecg.utils.constant.QuantityConstant; | 25 | import org.jeecg.utils.constant.QuantityConstant; |
26 | import org.springframework.stereotype.Service; | 26 | import org.springframework.stereotype.Service; |
27 | import org.springframework.transaction.annotation.Transactional; | 27 | import org.springframework.transaction.annotation.Transactional; |
28 | -import org.springframework.util.StopWatch; | ||
29 | 28 | ||
30 | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | 29 | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
31 | import com.baomidou.mybatisplus.core.toolkit.Wrappers; | 30 | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
@@ -97,7 +96,7 @@ public class LocationAllocationServiceImpl implements LocationAllocationService | @@ -97,7 +96,7 @@ public class LocationAllocationServiceImpl implements LocationAllocationService | ||
97 | roadWays = locationList.stream().map(Location::getRoadWay).distinct().collect(toList()); | 96 | roadWays = locationList.stream().map(Location::getRoadWay).distinct().collect(toList()); |
98 | } | 97 | } |
99 | String value = parameterConfigurationService.getValueByCode(QuantityConstant.DOUBLE_FORK_RESERVE_LOCATION); | 98 | String value = parameterConfigurationService.getValueByCode(QuantityConstant.DOUBLE_FORK_RESERVE_LOCATION); |
100 | - int reserveNumber = 10; | 99 | + int reserveNumber = 4; |
101 | if (StringUtils.isNotEmpty(value)) { | 100 | if (StringUtils.isNotEmpty(value)) { |
102 | reserveNumber = Integer.parseInt(value); | 101 | reserveNumber = Integer.parseInt(value); |
103 | } | 102 | } |
@@ -106,7 +105,7 @@ public class LocationAllocationServiceImpl implements LocationAllocationService | @@ -106,7 +105,7 @@ public class LocationAllocationServiceImpl implements LocationAllocationService | ||
106 | if (StringUtils.isNotEmpty(value)) { | 105 | if (StringUtils.isNotEmpty(value)) { |
107 | searchNumber = Integer.parseInt(value); | 106 | searchNumber = Integer.parseInt(value); |
108 | } | 107 | } |
109 | - String lastString = "ORDER BY layer asc, id asc limit " + searchNumber; | 108 | + String lastString = "ORDER BY high asc, layer asc, id asc limit " + searchNumber; |
110 | List<Integer> removeRoadWays = new ArrayList<>(); | 109 | List<Integer> removeRoadWays = new ArrayList<>(); |
111 | // 寻找可用巷道,空闲的空库位低于设定值,那么这个巷道就不能用来分配库位 | 110 | // 寻找可用巷道,空闲的空库位低于设定值,那么这个巷道就不能用来分配库位 |
112 | for (Integer roadWay : roadWays) { | 111 | for (Integer roadWay : roadWays) { |
@@ -176,12 +175,13 @@ public class LocationAllocationServiceImpl implements LocationAllocationService | @@ -176,12 +175,13 @@ public class LocationAllocationServiceImpl implements LocationAllocationService | ||
176 | List<Location> locationList = locationService.getLocationListByZoneCode(zoneCode, warehouseCode); | 175 | List<Location> locationList = locationService.getLocationListByZoneCode(zoneCode, warehouseCode); |
177 | roadWays = locationList.stream().map(Location::getRoadWay).distinct().collect(toList()); | 176 | roadWays = locationList.stream().map(Location::getRoadWay).distinct().collect(toList()); |
178 | } | 177 | } |
178 | + String lastString = "ORDER BY high asc, layer asc, id asc limit 1"; | ||
179 | Integer roadWay = locationAllocationService.getRoadWay(roadWays, warehouseCode); | 179 | Integer roadWay = locationAllocationService.getRoadWay(roadWays, warehouseCode); |
180 | LambdaQueryWrapper<Location> locationLambdaQueryWrapper = Wrappers.lambdaQuery(); | 180 | LambdaQueryWrapper<Location> locationLambdaQueryWrapper = Wrappers.lambdaQuery(); |
181 | locationLambdaQueryWrapper.eq(Location::getZoneCode, zoneCode).eq(Location::getWarehouseCode, warehouseCode).eq(Location::getRoadWay, roadWay) | 181 | locationLambdaQueryWrapper.eq(Location::getZoneCode, zoneCode).eq(Location::getWarehouseCode, warehouseCode).eq(Location::getRoadWay, roadWay) |
182 | .eq(Location::getStatus, QuantityConstant.STATUS_LOCATION_EMPTY).ge(Location::getHigh, high) | 182 | .eq(Location::getStatus, QuantityConstant.STATUS_LOCATION_EMPTY).ge(Location::getHigh, high) |
183 | .eq(StringUtils.isNotEmpty(materialAreaCode), Location::getMaterialAreaCode, materialAreaCode).in(Location::getLocationTypeCode, locationTypeCodeList) | 183 | .eq(StringUtils.isNotEmpty(materialAreaCode), Location::getMaterialAreaCode, materialAreaCode).in(Location::getLocationTypeCode, locationTypeCodeList) |
184 | - .eq(Location::getContainerCode, QuantityConstant.EMPTY_STRING).last("ORDER BY layer asc, id asc limit 1"); | 184 | + .eq(Location::getContainerCode, QuantityConstant.EMPTY_STRING).last(lastString); |
185 | // 单伸位逻辑简单,只需要找到一个空闲库位 | 185 | // 单伸位逻辑简单,只需要找到一个空闲库位 |
186 | Location location = locationService.getOne(locationLambdaQueryWrapper); | 186 | Location location = locationService.getOne(locationLambdaQueryWrapper); |
187 | if (location == null) { | 187 | if (location == null) { |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/framework/service/IHuahengMultiHandlerService.java
1 | package org.jeecg.modules.wms.framework.service; | 1 | package org.jeecg.modules.wms.framework.service; |
2 | 2 | ||
3 | import org.jeecg.common.api.vo.Result; | 3 | import org.jeecg.common.api.vo.Result; |
4 | +import org.jeecg.modules.wms.api.mobile.entity.CallBoxBean; | ||
5 | +import org.jeecg.modules.wms.api.mobile.entity.QuickReceiptBean; | ||
4 | import org.jeecg.modules.wms.receipt.receiptContainerHeader.entity.ReceiptContainerHeader; | 6 | import org.jeecg.modules.wms.receipt.receiptContainerHeader.entity.ReceiptContainerHeader; |
7 | +import org.jeecg.modules.wms.receipt.receiptHeader.entity.ReceiptHeader; | ||
5 | import org.jeecg.modules.wms.shipment.shipmentCombination.entity.CombinationModel; | 8 | import org.jeecg.modules.wms.shipment.shipmentCombination.entity.CombinationModel; |
6 | import org.jeecg.modules.wms.shipment.shipmentContainerHeader.entity.ShipmentContainerHeader; | 9 | import org.jeecg.modules.wms.shipment.shipmentContainerHeader.entity.ShipmentContainerHeader; |
7 | import org.jeecg.modules.wms.shipment.shipmentHeader.entity.CombinationParam; | 10 | import org.jeecg.modules.wms.shipment.shipmentHeader.entity.CombinationParam; |
11 | +import org.jeecg.modules.wms.shipment.shipmentHeader.entity.ShipmentHeader; | ||
8 | import org.jeecg.modules.wms.task.taskHeader.entity.TaskHeader; | 12 | import org.jeecg.modules.wms.task.taskHeader.entity.TaskHeader; |
9 | 13 | ||
10 | /** | 14 | /** |
@@ -25,4 +29,12 @@ public interface IHuahengMultiHandlerService { | @@ -25,4 +29,12 @@ public interface IHuahengMultiHandlerService { | ||
25 | Result autoCombination(String shipmentCode, String warehouseCode); | 29 | Result autoCombination(String shipmentCode, String warehouseCode); |
26 | 30 | ||
27 | Result createShipmentTask(ShipmentContainerHeader shipmentContainerHeader, String warehouseCode, long shipmentOrder, int sequence, int sequenceNumber); | 31 | Result createShipmentTask(ShipmentContainerHeader shipmentContainerHeader, String warehouseCode, long shipmentOrder, int sequence, int sequenceNumber); |
32 | + | ||
33 | + Result callBox(CallBoxBean bean, String warehouseCode); | ||
34 | + | ||
35 | + Result quickReceipt(QuickReceiptBean bean, String warehouseCode); | ||
36 | + | ||
37 | + Result backReceipt(ReceiptHeader receiptHeader); | ||
38 | + | ||
39 | + Result backShipment(ShipmentHeader shipmentHeader); | ||
28 | } | 40 | } |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/framework/service/impl/HuahengMultiHandlerServiceImpl.java
@@ -5,18 +5,24 @@ import java.math.BigDecimal; | @@ -5,18 +5,24 @@ import java.math.BigDecimal; | ||
5 | import javax.annotation.Resource; | 5 | import javax.annotation.Resource; |
6 | 6 | ||
7 | import org.jeecg.common.api.vo.Result; | 7 | import org.jeecg.common.api.vo.Result; |
8 | +import org.jeecg.modules.wms.api.erp.service.IErpService; | ||
9 | +import org.jeecg.modules.wms.api.mobile.entity.CallBoxBean; | ||
10 | +import org.jeecg.modules.wms.api.mobile.entity.QuickReceiptBean; | ||
11 | +import org.jeecg.modules.wms.api.mobile.service.IMobileService; | ||
8 | import org.jeecg.modules.wms.framework.controller.HuahengBaseController; | 12 | import org.jeecg.modules.wms.framework.controller.HuahengBaseController; |
9 | import org.jeecg.modules.wms.framework.service.IHuahengMultiHandlerService; | 13 | import org.jeecg.modules.wms.framework.service.IHuahengMultiHandlerService; |
10 | import org.jeecg.modules.wms.inventory.inventoryHeader.entity.InventoryDetail; | 14 | import org.jeecg.modules.wms.inventory.inventoryHeader.entity.InventoryDetail; |
11 | import org.jeecg.modules.wms.inventory.inventoryHeader.service.IInventoryDetailService; | 15 | import org.jeecg.modules.wms.inventory.inventoryHeader.service.IInventoryDetailService; |
12 | import org.jeecg.modules.wms.receipt.receiptContainerHeader.entity.ReceiptContainerHeader; | 16 | import org.jeecg.modules.wms.receipt.receiptContainerHeader.entity.ReceiptContainerHeader; |
13 | import org.jeecg.modules.wms.receipt.receiptContainerHeader.service.IReceiptContainerHeaderService; | 17 | import org.jeecg.modules.wms.receipt.receiptContainerHeader.service.IReceiptContainerHeaderService; |
18 | +import org.jeecg.modules.wms.receipt.receiptHeader.entity.ReceiptHeader; | ||
14 | import org.jeecg.modules.wms.shipment.shipmentCombination.entity.CombinationModel; | 19 | import org.jeecg.modules.wms.shipment.shipmentCombination.entity.CombinationModel; |
15 | import org.jeecg.modules.wms.shipment.shipmentCombination.service.IShipmentCombinationService; | 20 | import org.jeecg.modules.wms.shipment.shipmentCombination.service.IShipmentCombinationService; |
16 | import org.jeecg.modules.wms.shipment.shipmentContainerHeader.entity.ShipmentContainerHeader; | 21 | import org.jeecg.modules.wms.shipment.shipmentContainerHeader.entity.ShipmentContainerHeader; |
17 | import org.jeecg.modules.wms.shipment.shipmentContainerHeader.service.IShipmentContainerHeaderService; | 22 | import org.jeecg.modules.wms.shipment.shipmentContainerHeader.service.IShipmentContainerHeaderService; |
18 | import org.jeecg.modules.wms.shipment.shipmentHeader.entity.CombinationParam; | 23 | import org.jeecg.modules.wms.shipment.shipmentHeader.entity.CombinationParam; |
19 | import org.jeecg.modules.wms.shipment.shipmentHeader.entity.ShipmentDetail; | 24 | import org.jeecg.modules.wms.shipment.shipmentHeader.entity.ShipmentDetail; |
25 | +import org.jeecg.modules.wms.shipment.shipmentHeader.entity.ShipmentHeader; | ||
20 | import org.jeecg.modules.wms.shipment.shipmentHeader.service.IShipmentDetailService; | 26 | import org.jeecg.modules.wms.shipment.shipmentHeader.service.IShipmentDetailService; |
21 | import org.jeecg.modules.wms.task.taskHeader.entity.TaskHeader; | 27 | import org.jeecg.modules.wms.task.taskHeader.entity.TaskHeader; |
22 | import org.jeecg.modules.wms.task.taskHeader.service.ITaskHeaderService; | 28 | import org.jeecg.modules.wms.task.taskHeader.service.ITaskHeaderService; |
@@ -41,6 +47,10 @@ public class HuahengMultiHandlerServiceImpl extends HuahengBaseController implem | @@ -41,6 +47,10 @@ public class HuahengMultiHandlerServiceImpl extends HuahengBaseController implem | ||
41 | private IInventoryDetailService inventoryDetailService; | 47 | private IInventoryDetailService inventoryDetailService; |
42 | @Resource | 48 | @Resource |
43 | private IShipmentContainerHeaderService shipmentContainerHeaderService; | 49 | private IShipmentContainerHeaderService shipmentContainerHeaderService; |
50 | + @Resource | ||
51 | + private IMobileService mobileService; | ||
52 | + @Resource | ||
53 | + private IErpService erpService; | ||
44 | 54 | ||
45 | @Override | 55 | @Override |
46 | @Transactional(rollbackFor = Exception.class) | 56 | @Transactional(rollbackFor = Exception.class) |
@@ -119,6 +129,7 @@ public class HuahengMultiHandlerServiceImpl extends HuahengBaseController implem | @@ -119,6 +129,7 @@ public class HuahengMultiHandlerServiceImpl extends HuahengBaseController implem | ||
119 | } | 129 | } |
120 | 130 | ||
121 | @Override | 131 | @Override |
132 | + @Transactional(rollbackFor = Exception.class) | ||
122 | public Result autoCombination(String shipmentCode, String warehouseCode) { | 133 | public Result autoCombination(String shipmentCode, String warehouseCode) { |
123 | Result result = handleMultiProcess("combination", new MultiProcessListener() { | 134 | Result result = handleMultiProcess("combination", new MultiProcessListener() { |
124 | @Override | 135 | @Override |
@@ -131,6 +142,7 @@ public class HuahengMultiHandlerServiceImpl extends HuahengBaseController implem | @@ -131,6 +142,7 @@ public class HuahengMultiHandlerServiceImpl extends HuahengBaseController implem | ||
131 | } | 142 | } |
132 | 143 | ||
133 | @Override | 144 | @Override |
145 | + @Transactional(rollbackFor = Exception.class) | ||
134 | public Result createShipmentTask(ShipmentContainerHeader shipmentContainerHeader, String warehouseCode, long shipmentOrder, int sequence, int sequenceNumber) { | 146 | public Result createShipmentTask(ShipmentContainerHeader shipmentContainerHeader, String warehouseCode, long shipmentOrder, int sequence, int sequenceNumber) { |
135 | Result result = handleMultiProcess("createShipmentTask", new MultiProcessListener() { | 147 | Result result = handleMultiProcess("createShipmentTask", new MultiProcessListener() { |
136 | @Override | 148 | @Override |
@@ -142,4 +154,58 @@ public class HuahengMultiHandlerServiceImpl extends HuahengBaseController implem | @@ -142,4 +154,58 @@ public class HuahengMultiHandlerServiceImpl extends HuahengBaseController implem | ||
142 | return result; | 154 | return result; |
143 | } | 155 | } |
144 | 156 | ||
157 | + @Override | ||
158 | + @Transactional(rollbackFor = Exception.class) | ||
159 | + public Result callBox(CallBoxBean bean, String warehouseCode) { | ||
160 | + String lockKey = warehouseCode; | ||
161 | + Result result = handleMultiProcess("callBox", lockKey, new MultiProcessListener() { | ||
162 | + @Override | ||
163 | + public Result<?> doProcess() { | ||
164 | + Result result = mobileService.callBox(bean, warehouseCode); | ||
165 | + return result; | ||
166 | + } | ||
167 | + }); | ||
168 | + return result; | ||
169 | + } | ||
170 | + | ||
171 | + @Override | ||
172 | + @Transactional(rollbackFor = Exception.class) | ||
173 | + public Result quickReceipt(QuickReceiptBean bean, String warehouseCode) { | ||
174 | + String lockKey = warehouseCode; | ||
175 | + Result result = handleMultiProcess("quickReceipt", lockKey, new MultiProcessListener() { | ||
176 | + @Override | ||
177 | + public Result<?> doProcess() { | ||
178 | + Result result = mobileService.quickReceipt(bean, warehouseCode); | ||
179 | + return result; | ||
180 | + } | ||
181 | + }); | ||
182 | + return result; | ||
183 | + } | ||
184 | + | ||
185 | + @Override | ||
186 | + @Transactional(rollbackFor = Exception.class) | ||
187 | + public Result backReceipt(ReceiptHeader receiptHeader) { | ||
188 | + Result result = handleMultiProcess("backReceipt", new MultiProcessListener() { | ||
189 | + @Override | ||
190 | + public Result<?> doProcess() { | ||
191 | + Result result = erpService.backReceipt(receiptHeader); | ||
192 | + return result; | ||
193 | + } | ||
194 | + }); | ||
195 | + return result; | ||
196 | + } | ||
197 | + | ||
198 | + @Override | ||
199 | + @Transactional(rollbackFor = Exception.class) | ||
200 | + public Result backShipment(ShipmentHeader shipmentHeader) { | ||
201 | + Result result = handleMultiProcess("backShipment", new MultiProcessListener() { | ||
202 | + @Override | ||
203 | + public Result<?> doProcess() { | ||
204 | + Result result = erpService.backShipment(shipmentHeader); | ||
205 | + return result; | ||
206 | + } | ||
207 | + }); | ||
208 | + return result; | ||
209 | + } | ||
210 | + | ||
145 | } | 211 | } |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/monitor/job/ErpTask.java
1 | package org.jeecg.modules.wms.monitor.job; | 1 | package org.jeecg.modules.wms.monitor.job; |
2 | 2 | ||
3 | -import java.util.HashMap; | ||
4 | import java.util.List; | 3 | import java.util.List; |
5 | -import java.util.Map; | ||
6 | 4 | ||
7 | import javax.annotation.Resource; | 5 | import javax.annotation.Resource; |
8 | 6 | ||
9 | -import org.apache.commons.collections.MapUtils; | ||
10 | import org.jeecg.modules.wms.api.erp.service.IErpService; | 7 | import org.jeecg.modules.wms.api.erp.service.IErpService; |
8 | +import org.jeecg.modules.wms.framework.service.IHuahengMultiHandlerService; | ||
11 | import org.jeecg.modules.wms.receipt.receiptHeader.entity.ReceiptHeader; | 9 | import org.jeecg.modules.wms.receipt.receiptHeader.entity.ReceiptHeader; |
12 | import org.jeecg.modules.wms.receipt.receiptHeader.service.IReceiptHeaderService; | 10 | import org.jeecg.modules.wms.receipt.receiptHeader.service.IReceiptHeaderService; |
13 | import org.jeecg.modules.wms.shipment.shipmentHeader.entity.ShipmentHeader; | 11 | import org.jeecg.modules.wms.shipment.shipmentHeader.entity.ShipmentHeader; |
14 | import org.jeecg.modules.wms.shipment.shipmentHeader.service.IShipmentHeaderService; | 12 | import org.jeecg.modules.wms.shipment.shipmentHeader.service.IShipmentHeaderService; |
15 | import org.jeecg.utils.constant.QuantityConstant; | 13 | import org.jeecg.utils.constant.QuantityConstant; |
16 | -import org.quartz.DisallowConcurrentExecution; | ||
17 | -import org.quartz.Job; | ||
18 | -import org.quartz.JobExecutionContext; | ||
19 | -import org.quartz.JobExecutionException; | ||
20 | -import org.quartz.PersistJobDataAfterExecution; | 14 | +import org.quartz.*; |
21 | 15 | ||
22 | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | 16 | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
23 | import com.baomidou.mybatisplus.core.toolkit.Wrappers; | 17 | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
@@ -42,6 +36,8 @@ public class ErpTask implements Job { | @@ -42,6 +36,8 @@ public class ErpTask implements Job { | ||
42 | 36 | ||
43 | @Resource | 37 | @Resource |
44 | private IErpService erpService; | 38 | private IErpService erpService; |
39 | + @Resource | ||
40 | + private IHuahengMultiHandlerService huahengMultiHandlerService; | ||
45 | 41 | ||
46 | @Override | 42 | @Override |
47 | public void execute(JobExecutionContext context) throws JobExecutionException { | 43 | public void execute(JobExecutionContext context) throws JobExecutionException { |
@@ -51,7 +47,7 @@ public class ErpTask implements Job { | @@ -51,7 +47,7 @@ public class ErpTask implements Job { | ||
51 | List<ReceiptHeader> receiptHeaderList = receiptHeaderService.list(receiptHeaderLambdaQueryWrapper); | 47 | List<ReceiptHeader> receiptHeaderList = receiptHeaderService.list(receiptHeaderLambdaQueryWrapper); |
52 | for (ReceiptHeader receiptHeader : receiptHeaderList) { | 48 | for (ReceiptHeader receiptHeader : receiptHeaderList) { |
53 | try { | 49 | try { |
54 | - erpService.backReceipt(receiptHeader); | 50 | + huahengMultiHandlerService.backReceipt(receiptHeader); |
55 | } catch (Exception e) { | 51 | } catch (Exception e) { |
56 | e.printStackTrace(); | 52 | e.printStackTrace(); |
57 | } | 53 | } |
@@ -63,7 +59,7 @@ public class ErpTask implements Job { | @@ -63,7 +59,7 @@ public class ErpTask implements Job { | ||
63 | List<ShipmentHeader> shipmentHeaderList = shipmentHeaderService.list(shipmentHeaderLambdaQueryWrapper); | 59 | List<ShipmentHeader> shipmentHeaderList = shipmentHeaderService.list(shipmentHeaderLambdaQueryWrapper); |
64 | for (ShipmentHeader shipmentHeader : shipmentHeaderList) { | 60 | for (ShipmentHeader shipmentHeader : shipmentHeaderList) { |
65 | try { | 61 | try { |
66 | - erpService.backShipment(shipmentHeader); | 62 | + huahengMultiHandlerService.backShipment(shipmentHeader); |
67 | } catch (Exception e) { | 63 | } catch (Exception e) { |
68 | e.printStackTrace(); | 64 | e.printStackTrace(); |
69 | } | 65 | } |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/receipt/receiptContainerHeader/service/impl/ReceiptContainerHeaderServiceImpl.java
@@ -137,7 +137,7 @@ public class ReceiptContainerHeaderServiceImpl extends ServiceImpl<ReceiptContai | @@ -137,7 +137,7 @@ public class ReceiptContainerHeaderServiceImpl extends ServiceImpl<ReceiptContai | ||
137 | // 锁定容器和库位 | 137 | // 锁定容器和库位 |
138 | Result result = taskHeaderService.createTaskLockContainerAndLocation(taskType, containerCode, fromLocationCode, toLocationCode, warehouseCode); | 138 | Result result = taskHeaderService.createTaskLockContainerAndLocation(taskType, containerCode, fromLocationCode, toLocationCode, warehouseCode); |
139 | if (!result.isSuccess()) { | 139 | if (!result.isSuccess()) { |
140 | - return result; | 140 | + throw new JeecgBootException(result.getMessage()); |
141 | } | 141 | } |
142 | TaskLockEntity taskLockEntity = (TaskLockEntity)result.getResult(); | 142 | TaskLockEntity taskLockEntity = (TaskLockEntity)result.getResult(); |
143 | String zoneCode = taskLockEntity.getZoneCode(); | 143 | String zoneCode = taskLockEntity.getZoneCode(); |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/receipt/receiptHeader/controller/ReceiptHeaderController.java
@@ -24,6 +24,7 @@ import org.jeecg.modules.wms.api.mobile.entity.CallBoxBean; | @@ -24,6 +24,7 @@ import org.jeecg.modules.wms.api.mobile.entity.CallBoxBean; | ||
24 | import org.jeecg.modules.wms.api.mobile.entity.QuickReceiptBean; | 24 | import org.jeecg.modules.wms.api.mobile.entity.QuickReceiptBean; |
25 | import org.jeecg.modules.wms.api.mobile.service.IMobileService; | 25 | import org.jeecg.modules.wms.api.mobile.service.IMobileService; |
26 | import org.jeecg.modules.wms.config.material.service.IMaterialService; | 26 | import org.jeecg.modules.wms.config.material.service.IMaterialService; |
27 | +import org.jeecg.modules.wms.framework.service.IHuahengMultiHandlerService; | ||
27 | import org.jeecg.modules.wms.receipt.receiptHeader.entity.ReceiptDetail; | 28 | import org.jeecg.modules.wms.receipt.receiptHeader.entity.ReceiptDetail; |
28 | import org.jeecg.modules.wms.receipt.receiptHeader.entity.ReceiptHeader; | 29 | import org.jeecg.modules.wms.receipt.receiptHeader.entity.ReceiptHeader; |
29 | import org.jeecg.modules.wms.receipt.receiptHeader.service.IReceiptDetailService; | 30 | import org.jeecg.modules.wms.receipt.receiptHeader.service.IReceiptDetailService; |
@@ -80,6 +81,8 @@ public class ReceiptHeaderController extends JeecgController<ReceiptHeader, IRec | @@ -80,6 +81,8 @@ public class ReceiptHeaderController extends JeecgController<ReceiptHeader, IRec | ||
80 | private IMaterialService materialService; | 81 | private IMaterialService materialService; |
81 | @Resource | 82 | @Resource |
82 | private IErpService erpService; | 83 | private IErpService erpService; |
84 | + @Resource | ||
85 | + private IHuahengMultiHandlerService huahengMultiHandlerService; | ||
83 | 86 | ||
84 | /*---------------------------------主表处理-begin-------------------------------------*/ | 87 | /*---------------------------------主表处理-begin-------------------------------------*/ |
85 | 88 | ||
@@ -357,7 +360,7 @@ public class ReceiptHeaderController extends JeecgController<ReceiptHeader, IRec | @@ -357,7 +360,7 @@ public class ReceiptHeaderController extends JeecgController<ReceiptHeader, IRec | ||
357 | @RequiresPermissions("receiptHeader:back") | 360 | @RequiresPermissions("receiptHeader:back") |
358 | @RequestMapping(value = "/backErpReceipt", method = {RequestMethod.PUT, RequestMethod.POST}) | 361 | @RequestMapping(value = "/backErpReceipt", method = {RequestMethod.PUT, RequestMethod.POST}) |
359 | public Result<?> backErpReceipt(@RequestBody ReceiptHeader receiptHeader) { | 362 | public Result<?> backErpReceipt(@RequestBody ReceiptHeader receiptHeader) { |
360 | - return erpService.backReceipt(receiptHeader); | 363 | + return huahengMultiHandlerService.backReceipt(receiptHeader); |
361 | } | 364 | } |
362 | 365 | ||
363 | @AutoLog(value = "PDA入库-快速入库") | 366 | @AutoLog(value = "PDA入库-快速入库") |
@@ -368,9 +371,8 @@ public class ReceiptHeaderController extends JeecgController<ReceiptHeader, IRec | @@ -368,9 +371,8 @@ public class ReceiptHeaderController extends JeecgController<ReceiptHeader, IRec | ||
368 | public Result<?> quickReceipt(@RequestBody QuickReceiptBean bean, HttpServletRequest req) { | 371 | public Result<?> quickReceipt(@RequestBody QuickReceiptBean bean, HttpServletRequest req) { |
369 | String warehouseCode = HuahengJwtUtil.getWarehouseCodeByToken(req); | 372 | String warehouseCode = HuahengJwtUtil.getWarehouseCodeByToken(req); |
370 | bean.setWarehouseCode(warehouseCode); | 373 | bean.setWarehouseCode(warehouseCode); |
371 | - | ||
372 | - return mobileService.quickReceipt(bean, warehouseCode); | ||
373 | - | 374 | + Result result = huahengMultiHandlerService.quickReceipt(bean, warehouseCode); |
375 | + return result; | ||
374 | } | 376 | } |
375 | 377 | ||
376 | @AutoLog(value = "PDA入库-呼叫料盒") | 378 | @AutoLog(value = "PDA入库-呼叫料盒") |
@@ -382,6 +384,7 @@ public class ReceiptHeaderController extends JeecgController<ReceiptHeader, IRec | @@ -382,6 +384,7 @@ public class ReceiptHeaderController extends JeecgController<ReceiptHeader, IRec | ||
382 | String warehouseCode = HuahengJwtUtil.getWarehouseCodeByToken(req); | 384 | String warehouseCode = HuahengJwtUtil.getWarehouseCodeByToken(req); |
383 | // 补充入库类型 | 385 | // 补充入库类型 |
384 | bean.setType(QuantityConstant.TASK_TYPE_SUPPLEMENTRECEIPT); | 386 | bean.setType(QuantityConstant.TASK_TYPE_SUPPLEMENTRECEIPT); |
385 | - return mobileService.callBox(bean, warehouseCode); | 387 | + Result result = huahengMultiHandlerService.callBox(bean, warehouseCode); |
388 | + return result; | ||
386 | } | 389 | } |
387 | } | 390 | } |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/shipment/shipmentCombination/service/impl/ShipmentCombinationServiceImpl.java
@@ -512,7 +512,7 @@ public class ShipmentCombinationServiceImpl implements IShipmentCombinationServi | @@ -512,7 +512,7 @@ public class ShipmentCombinationServiceImpl implements IShipmentCombinationServi | ||
512 | // 锁定容器、库位 | 512 | // 锁定容器、库位 |
513 | Result result = taskHeaderService.createTaskLockContainerAndLocation(taskType, containerCode, fromLocationCode, toLocationCode, warehouseCode); | 513 | Result result = taskHeaderService.createTaskLockContainerAndLocation(taskType, containerCode, fromLocationCode, toLocationCode, warehouseCode); |
514 | if (!result.isSuccess()) { | 514 | if (!result.isSuccess()) { |
515 | - return result; | 515 | + throw new JeecgBootException(result.getMessage()); |
516 | } | 516 | } |
517 | TaskLockEntity taskLockEntity = (TaskLockEntity)result.getResult(); | 517 | TaskLockEntity taskLockEntity = (TaskLockEntity)result.getResult(); |
518 | String zoneCode = taskLockEntity.getZoneCode(); | 518 | String zoneCode = taskLockEntity.getZoneCode(); |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/shipment/shipmentHeader/controller/ShipmentHeaderController.java
@@ -24,6 +24,7 @@ import org.jeecg.common.util.oConvertUtils; | @@ -24,6 +24,7 @@ import org.jeecg.common.util.oConvertUtils; | ||
24 | import org.jeecg.modules.wms.api.erp.service.IErpService; | 24 | import org.jeecg.modules.wms.api.erp.service.IErpService; |
25 | import org.jeecg.modules.wms.api.mobile.entity.CallBoxBean; | 25 | import org.jeecg.modules.wms.api.mobile.entity.CallBoxBean; |
26 | import org.jeecg.modules.wms.api.mobile.service.IMobileService; | 26 | import org.jeecg.modules.wms.api.mobile.service.IMobileService; |
27 | +import org.jeecg.modules.wms.framework.service.IHuahengMultiHandlerService; | ||
27 | import org.jeecg.modules.wms.inventory.inventoryHeader.entity.InventoryDetail; | 28 | import org.jeecg.modules.wms.inventory.inventoryHeader.entity.InventoryDetail; |
28 | import org.jeecg.modules.wms.inventory.inventoryHeader.service.IInventoryDetailService; | 29 | import org.jeecg.modules.wms.inventory.inventoryHeader.service.IInventoryDetailService; |
29 | import org.jeecg.modules.wms.shipment.shipmentHeader.entity.ShipmentDetail; | 30 | import org.jeecg.modules.wms.shipment.shipmentHeader.entity.ShipmentDetail; |
@@ -40,16 +41,7 @@ import org.jeecgframework.poi.excel.entity.ExportParams; | @@ -40,16 +41,7 @@ import org.jeecgframework.poi.excel.entity.ExportParams; | ||
40 | import org.jeecgframework.poi.excel.entity.ImportParams; | 41 | import org.jeecgframework.poi.excel.entity.ImportParams; |
41 | import org.jeecgframework.poi.excel.view.JeecgEntityExcelView; | 42 | import org.jeecgframework.poi.excel.view.JeecgEntityExcelView; |
42 | import org.springframework.beans.factory.annotation.Autowired; | 43 | import org.springframework.beans.factory.annotation.Autowired; |
43 | -import org.springframework.web.bind.annotation.DeleteMapping; | ||
44 | -import org.springframework.web.bind.annotation.GetMapping; | ||
45 | -import org.springframework.web.bind.annotation.PathVariable; | ||
46 | -import org.springframework.web.bind.annotation.PostMapping; | ||
47 | -import org.springframework.web.bind.annotation.RequestBody; | ||
48 | -import org.springframework.web.bind.annotation.RequestMapping; | ||
49 | -import org.springframework.web.bind.annotation.RequestMethod; | ||
50 | -import org.springframework.web.bind.annotation.RequestParam; | ||
51 | -import org.springframework.web.bind.annotation.ResponseBody; | ||
52 | -import org.springframework.web.bind.annotation.RestController; | 44 | +import org.springframework.web.bind.annotation.*; |
53 | import org.springframework.web.multipart.MultipartFile; | 45 | import org.springframework.web.multipart.MultipartFile; |
54 | import org.springframework.web.multipart.MultipartHttpServletRequest; | 46 | import org.springframework.web.multipart.MultipartHttpServletRequest; |
55 | import org.springframework.web.servlet.ModelAndView; | 47 | import org.springframework.web.servlet.ModelAndView; |
@@ -89,6 +81,8 @@ public class ShipmentHeaderController extends JeecgController<ShipmentHeader, IS | @@ -89,6 +81,8 @@ public class ShipmentHeaderController extends JeecgController<ShipmentHeader, IS | ||
89 | private IErpService erpService; | 81 | private IErpService erpService; |
90 | @Resource | 82 | @Resource |
91 | private IInventoryDetailService inventoryDetailService; | 83 | private IInventoryDetailService inventoryDetailService; |
84 | + @Resource | ||
85 | + private IHuahengMultiHandlerService huahengMultiHandlerService; | ||
92 | 86 | ||
93 | /*---------------------------------主表处理-begin-------------------------------------*/ | 87 | /*---------------------------------主表处理-begin-------------------------------------*/ |
94 | 88 | ||
@@ -378,7 +372,7 @@ public class ShipmentHeaderController extends JeecgController<ShipmentHeader, IS | @@ -378,7 +372,7 @@ public class ShipmentHeaderController extends JeecgController<ShipmentHeader, IS | ||
378 | @RequiresPermissions("shipmentHeader:back") | 372 | @RequiresPermissions("shipmentHeader:back") |
379 | @RequestMapping(value = "/backErpShipment", method = {RequestMethod.PUT, RequestMethod.POST}) | 373 | @RequestMapping(value = "/backErpShipment", method = {RequestMethod.PUT, RequestMethod.POST}) |
380 | public Result<?> backErpShipment(@RequestBody ShipmentHeader shipmentHeader) { | 374 | public Result<?> backErpShipment(@RequestBody ShipmentHeader shipmentHeader) { |
381 | - return erpService.backShipment(shipmentHeader); | 375 | + return huahengMultiHandlerService.backShipment(shipmentHeader); |
382 | } | 376 | } |
383 | 377 | ||
384 | @AutoLog(value = "PDA出库-呼叫料盒") | 378 | @AutoLog(value = "PDA出库-呼叫料盒") |
@@ -390,6 +384,7 @@ public class ShipmentHeaderController extends JeecgController<ShipmentHeader, IS | @@ -390,6 +384,7 @@ public class ShipmentHeaderController extends JeecgController<ShipmentHeader, IS | ||
390 | String warehouseCode = HuahengJwtUtil.getWarehouseCodeByToken(req); | 384 | String warehouseCode = HuahengJwtUtil.getWarehouseCodeByToken(req); |
391 | // 补充入库类型 | 385 | // 补充入库类型 |
392 | bean.setType(QuantityConstant.TASK_TYPE_SORTINGSHIPMENT); | 386 | bean.setType(QuantityConstant.TASK_TYPE_SORTINGSHIPMENT); |
393 | - return mobileService.callBox(bean, warehouseCode); | 387 | + Result result = huahengMultiHandlerService.callBox(bean, warehouseCode); |
388 | + return result; | ||
394 | } | 389 | } |
395 | } | 390 | } |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/stocktaking/cycleCountDetail/service/impl/CycleCountDetailServiceImpl.java
@@ -227,7 +227,7 @@ public class CycleCountDetailServiceImpl extends ServiceImpl<CycleCountDetailMap | @@ -227,7 +227,7 @@ public class CycleCountDetailServiceImpl extends ServiceImpl<CycleCountDetailMap | ||
227 | Result result = taskHeaderService.createTaskLockContainerAndLocation(QuantityConstant.TASK_TYPE_CYCLECOUNT, containerCode, fromLocationCode, toLocationCode, | 227 | Result result = taskHeaderService.createTaskLockContainerAndLocation(QuantityConstant.TASK_TYPE_CYCLECOUNT, containerCode, fromLocationCode, toLocationCode, |
228 | warehouseCode); | 228 | warehouseCode); |
229 | if (!result.isSuccess()) { | 229 | if (!result.isSuccess()) { |
230 | - return result; | 230 | + throw new JeecgBootException(result.getMessage()); |
231 | } | 231 | } |
232 | TaskLockEntity taskLockEntity = (TaskLockEntity)result.getResult(); | 232 | TaskLockEntity taskLockEntity = (TaskLockEntity)result.getResult(); |
233 | String zoneCode = taskLockEntity.getZoneCode(); | 233 | String zoneCode = taskLockEntity.getZoneCode(); |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/stocktaking/cycleCountHeader/service/impl/CycleCountHeaderServiceImpl.java
1 | package org.jeecg.modules.wms.stocktaking.cycleCountHeader.service.impl; | 1 | package org.jeecg.modules.wms.stocktaking.cycleCountHeader.service.impl; |
2 | 2 | ||
3 | -import org.jeecg.common.exception.JeecgBootException; | ||
4 | -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | ||
5 | -import com.baomidou.mybatisplus.core.toolkit.Wrappers; | 3 | +import java.text.SimpleDateFormat; |
4 | +import java.util.Comparator; | ||
5 | +import java.util.Date; | ||
6 | +import java.util.List; | ||
7 | +import java.util.stream.Collectors; | ||
8 | + | ||
9 | +import javax.annotation.Resource; | ||
10 | + | ||
6 | import org.jeecg.common.api.vo.Result; | 11 | import org.jeecg.common.api.vo.Result; |
7 | -import org.jeecg.modules.wms.config.receiptType.entity.ReceiptType; | ||
8 | -import org.jeecg.modules.wms.receipt.receiptHeader.entity.ReceiptHeader; | 12 | +import org.jeecg.common.exception.JeecgBootException; |
9 | import org.jeecg.modules.wms.stocktaking.cycleCountDetail.entity.CycleCountDetail; | 13 | import org.jeecg.modules.wms.stocktaking.cycleCountDetail.entity.CycleCountDetail; |
10 | import org.jeecg.modules.wms.stocktaking.cycleCountDetail.service.impl.CycleCountDetailServiceImpl; | 14 | import org.jeecg.modules.wms.stocktaking.cycleCountDetail.service.impl.CycleCountDetailServiceImpl; |
11 | import org.jeecg.modules.wms.stocktaking.cycleCountHeader.entity.CycleCountHeader; | 15 | import org.jeecg.modules.wms.stocktaking.cycleCountHeader.entity.CycleCountHeader; |
@@ -14,29 +18,21 @@ import org.jeecg.modules.wms.stocktaking.cycleCountHeader.service.ICycleCountHea | @@ -14,29 +18,21 @@ import org.jeecg.modules.wms.stocktaking.cycleCountHeader.service.ICycleCountHea | ||
14 | import org.jeecg.utils.StringUtils; | 18 | import org.jeecg.utils.StringUtils; |
15 | import org.jeecg.utils.constant.QuantityConstant; | 19 | import org.jeecg.utils.constant.QuantityConstant; |
16 | import org.springframework.stereotype.Service; | 20 | import org.springframework.stereotype.Service; |
17 | - | ||
18 | -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | ||
19 | import org.springframework.transaction.annotation.Transactional; | 21 | import org.springframework.transaction.annotation.Transactional; |
20 | 22 | ||
21 | -import javax.annotation.Resource; | ||
22 | -import java.text.SimpleDateFormat; | ||
23 | -import java.util.Comparator; | ||
24 | -import java.util.Date; | ||
25 | -import java.util.List; | ||
26 | -import java.util.stream.Collectors; | 23 | +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
24 | +import com.baomidou.mybatisplus.core.toolkit.Wrappers; | ||
25 | +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | ||
27 | 26 | ||
28 | /** | 27 | /** |
29 | * @Description: 盘点主表 | 28 | * @Description: 盘点主表 |
30 | - * @Author: jeecg-boot | ||
31 | - * @Date: 2023-01-30 | ||
32 | - * @Version: V1.0 | 29 | + * @Author: jeecg-boot |
30 | + * @Date: 2023-01-30 | ||
31 | + * @Version: V1.0 | ||
33 | */ | 32 | */ |
34 | @Service | 33 | @Service |
35 | public class CycleCountHeaderServiceImpl extends ServiceImpl<CycleCountHeaderMapper, CycleCountHeader> implements ICycleCountHeaderService { | 34 | public class CycleCountHeaderServiceImpl extends ServiceImpl<CycleCountHeaderMapper, CycleCountHeader> implements ICycleCountHeaderService { |
36 | 35 | ||
37 | - | ||
38 | - | ||
39 | - | ||
40 | @Resource | 36 | @Resource |
41 | private CycleCountDetailServiceImpl cycleCountDetailService; | 37 | private CycleCountDetailServiceImpl cycleCountDetailService; |
42 | 38 | ||
@@ -56,55 +52,54 @@ public class CycleCountHeaderServiceImpl extends ServiceImpl<CycleCountHeaderMap | @@ -56,55 +52,54 @@ public class CycleCountHeaderServiceImpl extends ServiceImpl<CycleCountHeaderMap | ||
56 | } | 52 | } |
57 | 53 | ||
58 | @Override | 54 | @Override |
55 | + @Transactional | ||
59 | public void updataHeaderStatus(String cycleCountHeaderCode) { | 56 | public void updataHeaderStatus(String cycleCountHeaderCode) { |
60 | - //查询明细单状态,然后更新主单状态 | ||
61 | - //执行中时,对比主单状态,比主单数值小的不改变主单,明细单大于主单状态时改变主单状态到和明细单相同 | ||
62 | - //完成时在全部单据都完成后才能修改主单状态为完成 | ||
63 | - //当其中一条明细有差异时,主单为有差异状态 | 57 | + // 查询明细单状态,然后更新主单状态 |
58 | + // 执行中时,对比主单状态,比主单数值小的不改变主单,明细单大于主单状态时改变主单状态到和明细单相同 | ||
59 | + // 完成时在全部单据都完成后才能修改主单状态为完成 | ||
60 | + // 当其中一条明细有差异时,主单为有差异状态 | ||
64 | CycleCountHeader cyclecountHeader = new CycleCountHeader(); | 61 | CycleCountHeader cyclecountHeader = new CycleCountHeader(); |
65 | cyclecountHeader.setCode(cycleCountHeaderCode); | 62 | cyclecountHeader.setCode(cycleCountHeaderCode); |
66 | // cyclecountHeader.setWarehouseCode(ShiroUtils.getWarehouseCode()); | 63 | // cyclecountHeader.setWarehouseCode(ShiroUtils.getWarehouseCode()); |
67 | LambdaQueryWrapper<CycleCountHeader> lamb = Wrappers.lambdaQuery(cyclecountHeader); | 64 | LambdaQueryWrapper<CycleCountHeader> lamb = Wrappers.lambdaQuery(cyclecountHeader); |
68 | cyclecountHeader = this.getOne(lamb); | 65 | cyclecountHeader = this.getOne(lamb); |
69 | - if(StringUtils.isNull(cyclecountHeader)){ | 66 | + if (StringUtils.isNull(cyclecountHeader)) { |
70 | throw new JeecgBootException("没有找到盘点主单!"); | 67 | throw new JeecgBootException("没有找到盘点主单!"); |
71 | } | 68 | } |
72 | CycleCountDetail temp = new CycleCountDetail(); | 69 | CycleCountDetail temp = new CycleCountDetail(); |
73 | temp.setCycleCountHeadCode(cyclecountHeader.getCode()); | 70 | temp.setCycleCountHeadCode(cyclecountHeader.getCode()); |
74 | temp.setWarehouseCode(cyclecountHeader.getWarehouseCode()); | 71 | temp.setWarehouseCode(cyclecountHeader.getWarehouseCode()); |
75 | - //temp.setCompanyCode(cyclecountHeader.getCompanyCode()); | 72 | + // temp.setCompanyCode(cyclecountHeader.getCompanyCode()); |
76 | LambdaQueryWrapper<CycleCountDetail> lam = Wrappers.lambdaQuery(temp); | 73 | LambdaQueryWrapper<CycleCountDetail> lam = Wrappers.lambdaQuery(temp); |
77 | List<CycleCountDetail> list = cycleCountDetailService.list(lam); | 74 | List<CycleCountDetail> list = cycleCountDetailService.list(lam); |
78 | - if(list.size() < 1){ | 75 | + if (list.size() < 1) { |
79 | throw new JeecgBootException("明细为空!"); | 76 | throw new JeecgBootException("明细为空!"); |
80 | } | 77 | } |
81 | - //当有子单的状态为100时触发主单的完成状态 | ||
82 | - //100状态只有全部完成才写入主单 | ||
83 | - long count100 = list.stream().filter(t-> t.getEnableStatus().equals(QuantityConstant.CYCLECOUNT_STATUS_COMPLETED)).count(); //明细已完成的条数 | ||
84 | - if(count100 == list.size() ){ | 78 | + // 当有子单的状态为100时触发主单的完成状态 |
79 | + // 100状态只有全部完成才写入主单 | ||
80 | + long count100 = list.stream().filter(t -> t.getEnableStatus().equals(QuantityConstant.CYCLECOUNT_STATUS_COMPLETED)).count(); // 明细已完成的条数 | ||
81 | + if (count100 == list.size()) { | ||
85 | cyclecountHeader.setStatusCyc(QuantityConstant.CYCLECOUNT_STATUS_COMPLETED); | 82 | cyclecountHeader.setStatusCyc(QuantityConstant.CYCLECOUNT_STATUS_COMPLETED); |
86 | this.updateById(cyclecountHeader); | 83 | this.updateById(cyclecountHeader); |
87 | } | 84 | } |
88 | - //有任何子单没有完成则主单不修改为100 | ||
89 | - //有到100的子单时,主单的状态一定是100的前一个状态,所以状态不变 | ||
90 | - if(count100 == 0){ | ||
91 | - //所有子单状态比较主单状态,只有在明细单大于主单状态时才更改主单状态 | 85 | + // 有任何子单没有完成则主单不修改为100 |
86 | + // 有到100的子单时,主单的状态一定是100的前一个状态,所以状态不变 | ||
87 | + if (count100 == 0) { | ||
88 | + // 所有子单状态比较主单状态,只有在明细单大于主单状态时才更改主单状态 | ||
92 | int headerStatus = cyclecountHeader.getStatusCyc(); | 89 | int headerStatus = cyclecountHeader.getStatusCyc(); |
93 | - long count = list.stream().filter(t->t.getEnableStatus() > headerStatus).count(); | ||
94 | - if(count > 0 ){ | ||
95 | - //stream流取出明细状态中最大的值,赋给主单状态 | ||
96 | - List<CycleCountDetail> cycleCountDetailList = list.stream().sorted( | ||
97 | - Comparator.comparing(CycleCountDetail::getEnableStatus).reversed()).collect(Collectors.toList()); | 90 | + long count = list.stream().filter(t -> t.getEnableStatus() > headerStatus).count(); |
91 | + if (count > 0) { | ||
92 | + // stream流取出明细状态中最大的值,赋给主单状态 | ||
93 | + List<CycleCountDetail> cycleCountDetailList = | ||
94 | + list.stream().sorted(Comparator.comparing(CycleCountDetail::getEnableStatus).reversed()).collect(Collectors.toList()); | ||
98 | cyclecountHeader.setStatusCyc(cycleCountDetailList.get(0).getEnableStatus()); | 95 | cyclecountHeader.setStatusCyc(cycleCountDetailList.get(0).getEnableStatus()); |
99 | this.updateById(cyclecountHeader); | 96 | this.updateById(cyclecountHeader); |
100 | } | 97 | } |
101 | 98 | ||
102 | } | 99 | } |
103 | 100 | ||
104 | - | ||
105 | } | 101 | } |
106 | 102 | ||
107 | - | ||
108 | @Transactional | 103 | @Transactional |
109 | public String createCode(String receiptType) { | 104 | public String createCode(String receiptType) { |
110 | String code = null; | 105 | String code = null; |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/task/taskHeader/controller/TaskHeaderController.java
@@ -598,7 +598,7 @@ public class TaskHeaderController extends HuahengBaseController { | @@ -598,7 +598,7 @@ public class TaskHeaderController extends HuahengBaseController { | ||
598 | } | 598 | } |
599 | String fromLocationCode = container.getLocationCode(); | 599 | String fromLocationCode = container.getLocationCode(); |
600 | if (StringUtils.isEmpty(fromLocationCode)) { | 600 | if (StringUtils.isEmpty(fromLocationCode)) { |
601 | - return Result.error("选择整出口, 起始库位号为空"); | 601 | + return Result.error("选择分拣口, 起始库位号为空"); |
602 | } | 602 | } |
603 | Location fromLocation = locationService.getLocationByCode(fromLocationCode, warehouseCode); | 603 | Location fromLocation = locationService.getLocationByCode(fromLocationCode, warehouseCode); |
604 | if (fromLocation == null) { | 604 | if (fromLocation == null) { |
@@ -656,7 +656,13 @@ public class TaskHeaderController extends HuahengBaseController { | @@ -656,7 +656,13 @@ public class TaskHeaderController extends HuahengBaseController { | ||
656 | @ResponseBody | 656 | @ResponseBody |
657 | @ApiLogger(apiName = "修复空出的数据", from = "WMS") | 657 | @ApiLogger(apiName = "修复空出的数据", from = "WMS") |
658 | public Result handleEmptyOut(@RequestParam(name = "id", required = true) String id) { | 658 | public Result handleEmptyOut(@RequestParam(name = "id", required = true) String id) { |
659 | - Result result = taskHeaderService.handleEmptyOut(id); | 659 | + Result result = handleMultiProcess("handleEmptyOut", new MultiProcessListener() { |
660 | + @Override | ||
661 | + public Result<?> doProcess() { | ||
662 | + Result result = taskHeaderService.handleEmptyOut(id); | ||
663 | + return result; | ||
664 | + } | ||
665 | + }); | ||
660 | return result; | 666 | return result; |
661 | } | 667 | } |
662 | 668 | ||
@@ -670,7 +676,13 @@ public class TaskHeaderController extends HuahengBaseController { | @@ -670,7 +676,13 @@ public class TaskHeaderController extends HuahengBaseController { | ||
670 | @ResponseBody | 676 | @ResponseBody |
671 | @ApiLogger(apiName = "修复重入的数据", from = "WMS") | 677 | @ApiLogger(apiName = "修复重入的数据", from = "WMS") |
672 | public Result handleDoubleIn(@RequestParam(name = "id", required = true) String id) { | 678 | public Result handleDoubleIn(@RequestParam(name = "id", required = true) String id) { |
673 | - Result result = taskHeaderService.handleDoubleIn(id); | 679 | + Result result = handleMultiProcess("handleDoubleIn", new MultiProcessListener() { |
680 | + @Override | ||
681 | + public Result<?> doProcess() { | ||
682 | + Result result = taskHeaderService.handleDoubleIn(id); | ||
683 | + return result; | ||
684 | + } | ||
685 | + }); | ||
674 | return result; | 686 | return result; |
675 | } | 687 | } |
676 | 688 | ||
@@ -684,7 +696,13 @@ public class TaskHeaderController extends HuahengBaseController { | @@ -684,7 +696,13 @@ public class TaskHeaderController extends HuahengBaseController { | ||
684 | @ResponseBody | 696 | @ResponseBody |
685 | @ApiLogger(apiName = "修复取货错的数据", from = "WMS") | 697 | @ApiLogger(apiName = "修复取货错的数据", from = "WMS") |
686 | public Result handlePickupError(@RequestParam(name = "id", required = true) String id) { | 698 | public Result handlePickupError(@RequestParam(name = "id", required = true) String id) { |
687 | - Result result = taskHeaderService.handlePickupError(id); | 699 | + Result result = handleMultiProcess("handlePickupError", new MultiProcessListener() { |
700 | + @Override | ||
701 | + public Result<?> doProcess() { | ||
702 | + Result result = taskHeaderService.handlePickupError(id); | ||
703 | + return result; | ||
704 | + } | ||
705 | + }); | ||
688 | return result; | 706 | return result; |
689 | } | 707 | } |
690 | 708 |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/task/taskHeader/service/impl/TaskHeaderServiceImpl.java
@@ -257,7 +257,7 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea | @@ -257,7 +257,7 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea | ||
257 | Result result = taskHeaderService.createTaskLockContainerAndLocation(QuantityConstant.TASK_TYPE_TRANSFER, containerCode, fromLocationCode, toLocationCode, | 257 | Result result = taskHeaderService.createTaskLockContainerAndLocation(QuantityConstant.TASK_TYPE_TRANSFER, containerCode, fromLocationCode, toLocationCode, |
258 | warehouseCode); | 258 | warehouseCode); |
259 | if (!result.isSuccess()) { | 259 | if (!result.isSuccess()) { |
260 | - return result; | 260 | + throw new JeecgBootException(result.getMessage()); |
261 | } | 261 | } |
262 | TaskLockEntity taskLockEntity = (TaskLockEntity)result.getResult(); | 262 | TaskLockEntity taskLockEntity = (TaskLockEntity)result.getResult(); |
263 | String zoneCode = taskLockEntity.getZoneCode(); | 263 | String zoneCode = taskLockEntity.getZoneCode(); |
@@ -308,7 +308,7 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea | @@ -308,7 +308,7 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea | ||
308 | Result result = taskHeaderService.createTaskLockContainerAndLocation(QuantityConstant.TASK_TYPE_CHECK_OUT, containerCode, fromLocationCode, toLocationCode, | 308 | Result result = taskHeaderService.createTaskLockContainerAndLocation(QuantityConstant.TASK_TYPE_CHECK_OUT, containerCode, fromLocationCode, toLocationCode, |
309 | warehouseCode); | 309 | warehouseCode); |
310 | if (!result.isSuccess()) { | 310 | if (!result.isSuccess()) { |
311 | - return result; | 311 | + throw new JeecgBootException(result.getMessage()); |
312 | } | 312 | } |
313 | TaskLockEntity taskLockEntity = (TaskLockEntity)result.getResult(); | 313 | TaskLockEntity taskLockEntity = (TaskLockEntity)result.getResult(); |
314 | String zoneCode = taskLockEntity.getZoneCode(); | 314 | String zoneCode = taskLockEntity.getZoneCode(); |
@@ -380,7 +380,7 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea | @@ -380,7 +380,7 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea | ||
380 | Result result = taskHeaderService.createTaskLockContainerAndLocation(QuantityConstant.TASK_TYPE_OVER_STATION, containerCode, QuantityConstant.EMPTY_STRING, | 380 | Result result = taskHeaderService.createTaskLockContainerAndLocation(QuantityConstant.TASK_TYPE_OVER_STATION, containerCode, QuantityConstant.EMPTY_STRING, |
381 | QuantityConstant.EMPTY_STRING, warehouseCode); | 381 | QuantityConstant.EMPTY_STRING, warehouseCode); |
382 | if (!result.isSuccess()) { | 382 | if (!result.isSuccess()) { |
383 | - return result; | 383 | + throw new JeecgBootException(result.getMessage()); |
384 | } | 384 | } |
385 | TaskHeader taskHeader = new TaskHeader(); | 385 | TaskHeader taskHeader = new TaskHeader(); |
386 | taskHeader.setWarehouseCode(warehouseCode); | 386 | taskHeader.setWarehouseCode(warehouseCode); |
@@ -476,7 +476,7 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea | @@ -476,7 +476,7 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea | ||
476 | Result result = taskHeaderService.createTaskLockContainerAndLocation(QuantityConstant.TASK_TYPE_MANY_EMPTYRECEIPT, containerCode, | 476 | Result result = taskHeaderService.createTaskLockContainerAndLocation(QuantityConstant.TASK_TYPE_MANY_EMPTYRECEIPT, containerCode, |
477 | QuantityConstant.EMPTY_STRING, toLocationCode, warehouseCode); | 477 | QuantityConstant.EMPTY_STRING, toLocationCode, warehouseCode); |
478 | if (!result.isSuccess()) { | 478 | if (!result.isSuccess()) { |
479 | - return result; | 479 | + throw new JeecgBootException(result.getMessage()); |
480 | } | 480 | } |
481 | TaskLockEntity taskLockEntity = (TaskLockEntity)result.getResult(); | 481 | TaskLockEntity taskLockEntity = (TaskLockEntity)result.getResult(); |
482 | String zoneCode = taskLockEntity.getZoneCode(); | 482 | String zoneCode = taskLockEntity.getZoneCode(); |
@@ -512,7 +512,7 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea | @@ -512,7 +512,7 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea | ||
512 | Result result = taskHeaderService.createTaskLockContainerAndLocation(QuantityConstant.TASK_TYPE_MANY_EMPTYSHIPMENT, containerCode, | 512 | Result result = taskHeaderService.createTaskLockContainerAndLocation(QuantityConstant.TASK_TYPE_MANY_EMPTYSHIPMENT, containerCode, |
513 | QuantityConstant.EMPTY_STRING, QuantityConstant.EMPTY_STRING, warehouseCode); | 513 | QuantityConstant.EMPTY_STRING, QuantityConstant.EMPTY_STRING, warehouseCode); |
514 | if (!result.isSuccess()) { | 514 | if (!result.isSuccess()) { |
515 | - return result; | 515 | + throw new JeecgBootException(result.getMessage()); |
516 | } | 516 | } |
517 | TaskLockEntity taskLockEntity = (TaskLockEntity)result.getResult(); | 517 | TaskLockEntity taskLockEntity = (TaskLockEntity)result.getResult(); |
518 | String zoneCode = taskLockEntity.getZoneCode(); | 518 | String zoneCode = taskLockEntity.getZoneCode(); |
@@ -912,7 +912,7 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea | @@ -912,7 +912,7 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea | ||
912 | Result result = taskHeaderService.createTaskLockContainerAndLocation(QuantityConstant.TASK_TYPE_EMPTYRECEIPT, containerCode, QuantityConstant.EMPTY_STRING, | 912 | Result result = taskHeaderService.createTaskLockContainerAndLocation(QuantityConstant.TASK_TYPE_EMPTYRECEIPT, containerCode, QuantityConstant.EMPTY_STRING, |
913 | toLocationCode, warehouseCode); | 913 | toLocationCode, warehouseCode); |
914 | if (!result.isSuccess()) { | 914 | if (!result.isSuccess()) { |
915 | - return result; | 915 | + throw new JeecgBootException(result.getMessage()); |
916 | } | 916 | } |
917 | TaskHeader taskHeader = new TaskHeader(); | 917 | TaskHeader taskHeader = new TaskHeader(); |
918 | taskHeader.setWarehouseCode(warehouseCode); | 918 | taskHeader.setWarehouseCode(warehouseCode); |
@@ -954,7 +954,7 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea | @@ -954,7 +954,7 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea | ||
954 | Result result = taskHeaderService.createTaskLockContainerAndLocation(QuantityConstant.TASK_TYPE_EMPTYSHIPMENT, containerCode, QuantityConstant.EMPTY_STRING, | 954 | Result result = taskHeaderService.createTaskLockContainerAndLocation(QuantityConstant.TASK_TYPE_EMPTYSHIPMENT, containerCode, QuantityConstant.EMPTY_STRING, |
955 | QuantityConstant.EMPTY_STRING, warehouseCode); | 955 | QuantityConstant.EMPTY_STRING, warehouseCode); |
956 | if (!result.isSuccess()) { | 956 | if (!result.isSuccess()) { |
957 | - return result; | 957 | + throw new JeecgBootException(result.getMessage()); |
958 | } | 958 | } |
959 | TaskLockEntity taskLockEntity = (TaskLockEntity)result.getResult(); | 959 | TaskLockEntity taskLockEntity = (TaskLockEntity)result.getResult(); |
960 | String zoneCode = taskLockEntity.getZoneCode(); | 960 | String zoneCode = taskLockEntity.getZoneCode(); |
@@ -1011,7 +1011,7 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea | @@ -1011,7 +1011,7 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea | ||
1011 | return Result.ok("入库任务(" + taskHeader.getId() + ")已经是完成的!"); | 1011 | return Result.ok("入库任务(" + taskHeader.getId() + ")已经是完成的!"); |
1012 | } | 1012 | } |
1013 | if (taskDetailList.isEmpty()) { | 1013 | if (taskDetailList.isEmpty()) { |
1014 | - throw new JeecgBootException("入库任务明细为空"); | 1014 | + throw new JeecgBootException("完成入库任务时, 入库任务明细为空"); |
1015 | } | 1015 | } |
1016 | Location toLocation = locationService.getLocationByCode(toLocationCode, warehouseCode); | 1016 | Location toLocation = locationService.getLocationByCode(toLocationCode, warehouseCode); |
1017 | if (toLocation == null) { | 1017 | if (toLocation == null) { |
@@ -1442,6 +1442,8 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea | @@ -1442,6 +1442,8 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea | ||
1442 | case QuantityConstant.TASK_TYPE_OVER_STATION: | 1442 | case QuantityConstant.TASK_TYPE_OVER_STATION: |
1443 | result = taskHeaderService.createOverStationTaskLockContainer(containerCode, warehouseCode); | 1443 | result = taskHeaderService.createOverStationTaskLockContainer(containerCode, warehouseCode); |
1444 | break; | 1444 | break; |
1445 | + default: | ||
1446 | + throw new JeecgBootException("创建任务时,没有匹配到这种任务类型" + taskType); | ||
1445 | } | 1447 | } |
1446 | return result; | 1448 | return result; |
1447 | } | 1449 | } |
@@ -1767,6 +1769,7 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea | @@ -1767,6 +1769,7 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea | ||
1767 | * 盘点完成,传入任务主单,查出任务明细,通过任务明细查找盘点的明细单, | 1769 | * 盘点完成,传入任务主单,查出任务明细,通过任务明细查找盘点的明细单, |
1768 | * 完成任务同时,修改盘点细单和主单的状态,完成后库存锁复位 | 1770 | * 完成任务同时,修改盘点细单和主单的状态,完成后库存锁复位 |
1769 | */ | 1771 | */ |
1772 | + log.info("开始完成盘点任务"); | ||
1770 | String warehouseCode = taskHeader.getWarehouseCode(); | 1773 | String warehouseCode = taskHeader.getWarehouseCode(); |
1771 | String containerCode = taskHeader.getContainerCode(); | 1774 | String containerCode = taskHeader.getContainerCode(); |
1772 | String fromLocationCode = taskHeader.getFromLocationCode(); | 1775 | String fromLocationCode = taskHeader.getFromLocationCode(); |
@@ -1778,44 +1781,52 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea | @@ -1778,44 +1781,52 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea | ||
1778 | if (StringUtils.isEmpty(toLocationCode)) { | 1781 | if (StringUtils.isEmpty(toLocationCode)) { |
1779 | return Result.error("完成盘点任务时,目标库位号为空"); | 1782 | return Result.error("完成盘点任务时,目标库位号为空"); |
1780 | } | 1783 | } |
1781 | -// LoginUser sysUser = (LoginUser)SecurityUtils.getSubject().getPrincipal(); | 1784 | + if (StringUtils.isEmpty(containerCode)) { |
1785 | + return Result.error("完成盘点任务时,托盘号为空"); | ||
1786 | + } | ||
1787 | + if (StringUtils.isEmpty(warehouseCode)) { | ||
1788 | + return Result.error("完成盘点任务时,仓库编码为空"); | ||
1789 | + } | ||
1782 | taskHeader.setStatus(QuantityConstant.TASK_STATUS_COMPLETED); | 1790 | taskHeader.setStatus(QuantityConstant.TASK_STATUS_COMPLETED); |
1783 | 1791 | ||
1784 | // 1.先拿到盘点单主单据 | 1792 | // 1.先拿到盘点单主单据 |
1785 | CycleCountDetail cycleCountDetail = cycleCountDetailService.getById(taskHeader.getShipmentContainerHeaderId()); | 1793 | CycleCountDetail cycleCountDetail = cycleCountDetailService.getById(taskHeader.getShipmentContainerHeaderId()); |
1786 | - | ||
1787 | - if (cycleCountDetail.getGapQty().compareTo(BigDecimal.ZERO) == 0) { | ||
1788 | - return Result.error("盘点单据系统实盘数量跟差异数量0,不能完成 单据号" + cycleCountDetail.getCycleCountHeadCode()); | 1794 | + if (cycleCountDetail == null) { |
1795 | + return Result.error("完成盘点任务时,盘点单详情为空" + taskHeader.getShipmentContainerHeaderId()); | ||
1789 | } | 1796 | } |
1797 | +// if (cycleCountDetail.getGapQty().compareTo(BigDecimal.ZERO) == 0) { | ||
1798 | +// return Result.error("完成盘点任务时,盘点单据系统实盘数量跟差异数量0,不能完成 单据号" + cycleCountDetail.getCycleCountHeadCode()); | ||
1799 | +// } | ||
1790 | 1800 | ||
1791 | // 2.盘点单主单据查明细单据list | 1801 | // 2.盘点单主单据查明细单据list |
1792 | LambdaQueryWrapper<CycleCountDetailChild> childLambdaQueryWrapper = new LambdaQueryWrapper<CycleCountDetailChild>(); | 1802 | LambdaQueryWrapper<CycleCountDetailChild> childLambdaQueryWrapper = new LambdaQueryWrapper<CycleCountDetailChild>(); |
1793 | childLambdaQueryWrapper.eq(CycleCountDetailChild::getCycleCountDetailid, cycleCountDetail.getId()); | 1803 | childLambdaQueryWrapper.eq(CycleCountDetailChild::getCycleCountDetailid, cycleCountDetail.getId()); |
1794 | List<CycleCountDetailChild> children = cycleCountDetailChildService.list(childLambdaQueryWrapper); | 1804 | List<CycleCountDetailChild> children = cycleCountDetailChildService.list(childLambdaQueryWrapper); |
1795 | - | 1805 | + if (children.size() == 0) { |
1806 | + return Result.error("完成盘点任务时,盘点单详情明细为空" + cycleCountDetail.getId()); | ||
1807 | + } | ||
1796 | // 3.单据list如果差异数量+生成入库单,差异数-生成出库单进行回传类型其他出库单 | 1808 | // 3.单据list如果差异数量+生成入库单,差异数-生成出库单进行回传类型其他出库单 |
1797 | - | ||
1798 | InventoryHeader inventoryHeader = inventoryHeaderService.getById(cycleCountDetail.getInventoryHeaderId()); | 1809 | InventoryHeader inventoryHeader = inventoryHeaderService.getById(cycleCountDetail.getInventoryHeaderId()); |
1799 | - | 1810 | + if (inventoryHeader == null) { |
1811 | + return Result.error("完成盘点任务时,没有找到库存头" + cycleCountDetail.getInventoryHeaderId()); | ||
1812 | + } | ||
1800 | int outboundOrderId = 0; | 1813 | int outboundOrderId = 0; |
1801 | String outboundOrderCode = null; | 1814 | String outboundOrderCode = null; |
1802 | int warehousingOrderId = 0; | 1815 | int warehousingOrderId = 0; |
1803 | String warehousingOrderCode = null; | 1816 | String warehousingOrderCode = null; |
1804 | - | ||
1805 | for (CycleCountDetailChild child : children) { | 1817 | for (CycleCountDetailChild child : children) { |
1806 | if (!child.getChildStatus().equals(QuantityConstant.CYCLECOUNT_STATUS_REGISTERED)) { | 1818 | if (!child.getChildStatus().equals(QuantityConstant.CYCLECOUNT_STATUS_REGISTERED)) { |
1807 | throw new JeecgBootException("当前任务里面还有没有进行登记的数据,不能完成任务"); | 1819 | throw new JeecgBootException("当前任务里面还有没有进行登记的数据,不能完成任务"); |
1808 | } | 1820 | } |
1809 | - | ||
1810 | if (child.getInventoryDetaiId() != null) { | 1821 | if (child.getInventoryDetaiId() != null) { |
1811 | InventoryDetail inventoryDetail = inventoryDetailService.getById(child.getInventoryDetaiId()); | 1822 | InventoryDetail inventoryDetail = inventoryDetailService.getById(child.getInventoryDetaiId()); |
1812 | if (inventoryDetail == null) { | 1823 | if (inventoryDetail == null) { |
1813 | throw new JeecgBootException("盘点还没完成 库存明细单据就不存在了 可能出现了问题或者所容器没成功"); | 1824 | throw new JeecgBootException("盘点还没完成 库存明细单据就不存在了 可能出现了问题或者所容器没成功"); |
1814 | } | 1825 | } |
1815 | - inventoryHeader.setLocationCode(toLocationCode); | ||
1816 | - inventoryHeader.setTotalQty(inventoryHeader.getTotalQty().add(child.getGapQty())); | ||
1817 | - inventoryDetail.setQty(child.getCountedQty()); | ||
1818 | - inventoryDetailService.updateById(inventoryDetail); | 1826 | + success = inventoryDetailService.updateQtyAndTaskQtyAndLocationCode(child.getCountedQty(), BigDecimal.ZERO, toLocationCode, inventoryDetail.getId()); |
1827 | + if (!success) { | ||
1828 | + throw new JeecgBootException("完成盘点任务时, 更新库存详情失败"); | ||
1829 | + } | ||
1819 | } else { | 1830 | } else { |
1820 | InventoryDetail inventoryDetail = new InventoryDetail(); | 1831 | InventoryDetail inventoryDetail = new InventoryDetail(); |
1821 | inventoryDetail.setInventoryHeaderId(inventoryHeader.getId()); | 1832 | inventoryDetail.setInventoryHeaderId(inventoryHeader.getId()); |
@@ -1832,7 +1843,10 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea | @@ -1832,7 +1843,10 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea | ||
1832 | inventoryDetail.setTaskQty(BigDecimal.ZERO); | 1843 | inventoryDetail.setTaskQty(BigDecimal.ZERO); |
1833 | inventoryDetail.setInventoryStatus(child.getInventoryStatus()); | 1844 | inventoryDetail.setInventoryStatus(child.getInventoryStatus()); |
1834 | inventoryDetail.setBatch(child.getBatch()); | 1845 | inventoryDetail.setBatch(child.getBatch()); |
1835 | - inventoryDetailService.save(inventoryDetail); | 1846 | + success = inventoryDetailService.save(inventoryDetail); |
1847 | + if (!success) { | ||
1848 | + throw new JeecgBootException("完成盘点任务时, 保存库存详情失败"); | ||
1849 | + } | ||
1836 | child.setInventoryDetaiId(inventoryDetail.getId()); | 1850 | child.setInventoryDetaiId(inventoryDetail.getId()); |
1837 | } | 1851 | } |
1838 | 1852 | ||
@@ -1845,12 +1859,15 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea | @@ -1845,12 +1859,15 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea | ||
1845 | receiptHeader.setType(QuantityConstant.RECEIPT_BILL_TYPE_QTR); | 1859 | receiptHeader.setType(QuantityConstant.RECEIPT_BILL_TYPE_QTR); |
1846 | receiptHeader.setRemark("盘盈 单号" + cycleCountDetail.getCycleCountHeadCode()); | 1860 | receiptHeader.setRemark("盘盈 单号" + cycleCountDetail.getCycleCountHeadCode()); |
1847 | Result result = receiptHeaderService.saveReceiptHeader(receiptHeader); | 1861 | Result result = receiptHeaderService.saveReceiptHeader(receiptHeader); |
1848 | - if (result.getCode() != 200) { | 1862 | + if (!result.isSuccess()) { |
1849 | return result; | 1863 | return result; |
1850 | } | 1864 | } |
1851 | receiptHeader.setFirstStatus(QuantityConstant.RECEIPT_HEADER_COMPLETED); | 1865 | receiptHeader.setFirstStatus(QuantityConstant.RECEIPT_HEADER_COMPLETED); |
1852 | receiptHeader.setLastStatus(QuantityConstant.RECEIPT_HEADER_COMPLETED); | 1866 | receiptHeader.setLastStatus(QuantityConstant.RECEIPT_HEADER_COMPLETED); |
1853 | - receiptHeaderService.updateById(receiptHeader); | 1867 | + success = receiptHeaderService.updateById(receiptHeader); |
1868 | + if (!success) { | ||
1869 | + throw new JeecgBootException("完成盘点任务时, 更新入库表单头失败"); | ||
1870 | + } | ||
1854 | // 生成入库单并且赋值给warehousingOrderId | 1871 | // 生成入库单并且赋值给warehousingOrderId |
1855 | warehousingOrderId = receiptHeader.getId(); | 1872 | warehousingOrderId = receiptHeader.getId(); |
1856 | warehousingOrderCode = receiptHeader.getCode(); | 1873 | warehousingOrderCode = receiptHeader.getCode(); |
@@ -1872,8 +1889,10 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea | @@ -1872,8 +1889,10 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea | ||
1872 | receiptDetail.setBatch(child.getBatch()); | 1889 | receiptDetail.setBatch(child.getBatch()); |
1873 | receiptDetail.setLot(child.getLot()); | 1890 | receiptDetail.setLot(child.getLot()); |
1874 | receiptDetail.setStatus(QuantityConstant.RECEIPT_HEADER_COMPLETED); | 1891 | receiptDetail.setStatus(QuantityConstant.RECEIPT_HEADER_COMPLETED); |
1875 | - receiptDetailService.save(receiptDetail); | ||
1876 | - | 1892 | + success = receiptDetailService.save(receiptDetail); |
1893 | + if (!success) { | ||
1894 | + throw new JeecgBootException("完成盘点任务时, 新增入库表单详情失败"); | ||
1895 | + } | ||
1877 | // 增加库存交易记录 | 1896 | // 增加库存交易记录 |
1878 | InventoryTransaction inventoryTransaction = new InventoryTransaction(); | 1897 | InventoryTransaction inventoryTransaction = new InventoryTransaction(); |
1879 | inventoryTransaction.setWarehouseCode(taskHeader.getWarehouseCode()); | 1898 | inventoryTransaction.setWarehouseCode(taskHeader.getWarehouseCode()); |
@@ -1891,14 +1910,19 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea | @@ -1891,14 +1910,19 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea | ||
1891 | inventoryTransaction.setQty(child.getCountedQty()); | 1910 | inventoryTransaction.setQty(child.getCountedQty()); |
1892 | inventoryTransaction.setBatch(child.getBatch()); | 1911 | inventoryTransaction.setBatch(child.getBatch()); |
1893 | inventoryTransaction.setLot(child.getLot()); | 1912 | inventoryTransaction.setLot(child.getLot()); |
1894 | - inventoryTransactionService.save(inventoryTransaction); | ||
1895 | - | 1913 | + success = inventoryTransactionService.save(inventoryTransaction); |
1914 | + if (!success) { | ||
1915 | + throw new JeecgBootException("完成盘点任务时, 新增库存交易详情失败"); | ||
1916 | + } | ||
1896 | } | 1917 | } |
1897 | 1918 | ||
1898 | if (child.getGapQty().compareTo(BigDecimal.ZERO) == -1) { | 1919 | if (child.getGapQty().compareTo(BigDecimal.ZERO) == -1) { |
1899 | 1920 | ||
1900 | if (child.getGapQty().abs().compareTo(child.getSystemQty()) > -1) { | 1921 | if (child.getGapQty().abs().compareTo(child.getSystemQty()) > -1) { |
1901 | - inventoryDetailService.removeById(child.getInventoryDetaiId()); | 1922 | + success = inventoryDetailService.removeById(child.getInventoryDetaiId()); |
1923 | + if (!success) { | ||
1924 | + throw new JeecgBootException("完成盘点任务时, 删除库存详情失败"); | ||
1925 | + } | ||
1902 | } | 1926 | } |
1903 | 1927 | ||
1904 | if (outboundOrderId == 0) { | 1928 | if (outboundOrderId == 0) { |
@@ -1908,12 +1932,15 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea | @@ -1908,12 +1932,15 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea | ||
1908 | shipmentHeader.setType(QuantityConstant.SHIPMENT_BILL_TYPE_QTC); | 1932 | shipmentHeader.setType(QuantityConstant.SHIPMENT_BILL_TYPE_QTC); |
1909 | shipmentHeader.setRemark("盘亏 单号" + cycleCountDetail.getCycleCountHeadCode()); | 1933 | shipmentHeader.setRemark("盘亏 单号" + cycleCountDetail.getCycleCountHeadCode()); |
1910 | Result result = shipmentHeaderService.saveShipmentHeader(shipmentHeader); | 1934 | Result result = shipmentHeaderService.saveShipmentHeader(shipmentHeader); |
1911 | - if (result.getCode() != 200) { | 1935 | + if (!result.isSuccess()) { |
1912 | return result; | 1936 | return result; |
1913 | } | 1937 | } |
1914 | shipmentHeader.setFirstStatus(QuantityConstant.RECEIPT_HEADER_COMPLETED); | 1938 | shipmentHeader.setFirstStatus(QuantityConstant.RECEIPT_HEADER_COMPLETED); |
1915 | shipmentHeader.setLastStatus(QuantityConstant.RECEIPT_HEADER_COMPLETED); | 1939 | shipmentHeader.setLastStatus(QuantityConstant.RECEIPT_HEADER_COMPLETED); |
1916 | - shipmentHeaderService.updateById(shipmentHeader); | 1940 | + success = shipmentHeaderService.updateById(shipmentHeader); |
1941 | + if (!success) { | ||
1942 | + throw new JeecgBootException("完成盘点任务时, 更新出库单详情失败"); | ||
1943 | + } | ||
1917 | // 生成出库单并且赋值给outboundOrderId | 1944 | // 生成出库单并且赋值给outboundOrderId |
1918 | outboundOrderId = shipmentHeader.getId(); | 1945 | outboundOrderId = shipmentHeader.getId(); |
1919 | outboundOrderCode = shipmentHeader.getCode(); | 1946 | outboundOrderCode = shipmentHeader.getCode(); |
@@ -1935,8 +1962,10 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea | @@ -1935,8 +1962,10 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea | ||
1935 | shipmentDetail.setBatch(child.getBatch()); | 1962 | shipmentDetail.setBatch(child.getBatch()); |
1936 | shipmentDetail.setLot(child.getLot()); | 1963 | shipmentDetail.setLot(child.getLot()); |
1937 | shipmentDetail.setStatus(QuantityConstant.RECEIPT_HEADER_COMPLETED); | 1964 | shipmentDetail.setStatus(QuantityConstant.RECEIPT_HEADER_COMPLETED); |
1938 | - shipmentDetailService.save(shipmentDetail); | ||
1939 | - | 1965 | + success = shipmentDetailService.save(shipmentDetail); |
1966 | + if (!success) { | ||
1967 | + throw new JeecgBootException("完成盘点任务时, 保存出库单详情失败"); | ||
1968 | + } | ||
1940 | InventoryTransaction inventoryTransaction = new InventoryTransaction(); | 1969 | InventoryTransaction inventoryTransaction = new InventoryTransaction(); |
1941 | inventoryTransaction.setWarehouseCode(taskHeader.getWarehouseCode()); | 1970 | inventoryTransaction.setWarehouseCode(taskHeader.getWarehouseCode()); |
1942 | inventoryTransaction.setCompanyCode(taskHeader.getCompanyCode()); | 1971 | inventoryTransaction.setCompanyCode(taskHeader.getCompanyCode()); |
@@ -1953,51 +1982,49 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea | @@ -1953,51 +1982,49 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea | ||
1953 | inventoryTransaction.setQty(child.getCountedQty()); | 1982 | inventoryTransaction.setQty(child.getCountedQty()); |
1954 | inventoryTransaction.setBatch(child.getBatch()); | 1983 | inventoryTransaction.setBatch(child.getBatch()); |
1955 | inventoryTransaction.setLot(child.getLot()); | 1984 | inventoryTransaction.setLot(child.getLot()); |
1956 | - inventoryTransactionService.save(inventoryTransaction); | 1985 | + success = inventoryTransactionService.save(inventoryTransaction); |
1986 | + if (!success) { | ||
1987 | + throw new JeecgBootException("完成盘点任务时, 保存出库单详情失败"); | ||
1988 | + } | ||
1989 | + } | ||
1990 | + success = cycleCountDetailChildService.updateById(child); | ||
1991 | + if (!success) { | ||
1992 | + throw new JeecgBootException("完成盘点任务时, 更新盘点详情失败"); | ||
1957 | } | 1993 | } |
1958 | - cycleCountDetailChildService.updateById(child); | ||
1959 | } | 1994 | } |
1960 | 1995 | ||
1961 | if (inventoryHeader.getTotalQty().compareTo(BigDecimal.ZERO) < 1) { | 1996 | if (inventoryHeader.getTotalQty().compareTo(BigDecimal.ZERO) < 1) { |
1962 | - inventoryHeaderService.removeById(inventoryHeader); | 1997 | + success = inventoryHeaderService.removeById(inventoryHeader); |
1998 | + if (!success) { | ||
1999 | + throw new JeecgBootException("完成盘点任务时, 删除库存头失败"); | ||
2000 | + } | ||
2001 | + } else { | ||
2002 | + success = inventoryHeaderService.updateLocationCodeById(toLocationCode, cycleCountDetail.getInventoryHeaderId()); | ||
2003 | + if (!success) { | ||
2004 | + throw new JeecgBootException("完成盘点任务时, 更新库存头失败"); | ||
2005 | + } | ||
1963 | } | 2006 | } |
1964 | 2007 | ||
1965 | - inventoryHeaderService.updateById(inventoryHeader); | ||
1966 | - | ||
1967 | - // 4.完成当前任务 | ||
1968 | - if (!taskHeaderService.saveOrUpdate(taskHeader)) { | ||
1969 | - throw new JeecgBootException("盘点任务单据状态更新失败!"); | ||
1970 | - } | ||
1971 | // 盘点明细状态 | 2008 | // 盘点明细状态 |
1972 | cycleCountDetail.setEnableStatus(QuantityConstant.CYCLECOUNT_STATUS_COMPLETED); | 2009 | cycleCountDetail.setEnableStatus(QuantityConstant.CYCLECOUNT_STATUS_COMPLETED); |
1973 | cycleCountDetail.setCompletedAt(new Date()); | 2010 | cycleCountDetail.setCompletedAt(new Date()); |
1974 | - cycleCountDetailService.updateById(cycleCountDetail); | 2011 | + success = cycleCountDetailService.updateById(cycleCountDetail); |
2012 | + if (!success) { | ||
2013 | + throw new JeecgBootException("完成盘点任务时, 更新盘点单详情失败"); | ||
2014 | + } | ||
1975 | // 更新主单状态 | 2015 | // 更新主单状态 |
1976 | cycleCountHeaderService.updataHeaderStatus(cycleCountDetail.getCycleCountHeadCode()); | 2016 | cycleCountHeaderService.updataHeaderStatus(cycleCountDetail.getCycleCountHeadCode()); |
1977 | 2017 | ||
1978 | - // 释放库位 | ||
1979 | - locationService.updateContainerCodeAndStatus(fromLocationCode, QuantityConstant.EMPTY_STRING, QuantityConstant.STATUS_LOCATION_EMPTY, warehouseCode); | ||
1980 | - | ||
1981 | - locationService.updateContainerCodeAndStatus(toLocationCode, containerCode, QuantityConstant.STATUS_LOCATION_EMPTY, warehouseCode); | ||
1982 | - | ||
1983 | -// // 还原容器状态 | ||
1984 | -// containerService.restoreContainer(cycleCountDetail.getContainerCode(), taskHeader.getWarehouseCode()); | ||
1985 | - List<InventoryDetail> inventoryDetailList = inventoryDetailService.getInventoryDetailListByContainerCode(containerCode, warehouseCode); | ||
1986 | - if (inventoryDetailList.size() != 0) { | ||
1987 | - if (fromLocationCode.equals(toLocationCode)) { | ||
1988 | - success = containerService.updateStatus(containerCode, QuantityConstant.STATUS_CONTAINER_EMPTY, warehouseCode); | ||
1989 | - } else { | ||
1990 | - success = containerService.updateLocationCodeAndStatus(containerCode, toLocationCode, QuantityConstant.STATUS_CONTAINER_EMPTY, warehouseCode); | ||
1991 | - } | ||
1992 | - if (!success) { | ||
1993 | - throw new JeecgBootException("完成出库查看任务时,更新容器状态失败"); | ||
1994 | - } | ||
1995 | - } else { | ||
1996 | - success = containerService.updateStatus(containerCode, QuantityConstant.STATUS_CONTAINER_EMPTY, warehouseCode); | ||
1997 | - if (!success) { | ||
1998 | - throw new JeecgBootException("完成出库查看任务时,更新容器状态失败"); | ||
1999 | - } | 2018 | + Result result = taskHeaderService.completeTaskUnLockContainerAndLocation(taskHeader.getContainerFillStatus(), QuantityConstant.TASK_TYPE_CHECK_OUT, |
2019 | + containerCode, fromLocationCode, toLocationCode, warehouseCode); | ||
2020 | + if (!result.isSuccess()) { | ||
2021 | + throw new JeecgBootException(result.getMessage()); | ||
2000 | } | 2022 | } |
2023 | + success = taskHeaderService.updateStatusById(QuantityConstant.TASK_STATUS_COMPLETED, taskHeader.getId()); | ||
2024 | + if (!success) { | ||
2025 | + throw new JeecgBootException("完成盘点任务时, 更新任务失败"); | ||
2026 | + } | ||
2027 | + log.info("完成盘点任务"); | ||
2001 | return Result.OK("完成盘点任务成功"); | 2028 | return Result.OK("完成盘点任务成功"); |
2002 | } | 2029 | } |
2003 | 2030 | ||
@@ -2045,10 +2072,10 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea | @@ -2045,10 +2072,10 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea | ||
2045 | throw new JeecgBootException(result.getMessage()); | 2072 | throw new JeecgBootException(result.getMessage()); |
2046 | } | 2073 | } |
2047 | boolean success = taskHeaderService.updateStatusById(QuantityConstant.TASK_STATUS_COMPLETED, taskHeader.getId()); | 2074 | boolean success = taskHeaderService.updateStatusById(QuantityConstant.TASK_STATUS_COMPLETED, taskHeader.getId()); |
2048 | - log.info("完成空托盘出库任务" + taskHeader.getId()); | ||
2049 | if (!success) { | 2075 | if (!success) { |
2050 | throw new JeecgBootException("完成空托盘出库任务时, 更新任务失败"); | 2076 | throw new JeecgBootException("完成空托盘出库任务时, 更新任务失败"); |
2051 | } | 2077 | } |
2078 | + log.info("完成空托盘出库任务" + taskHeader.getId()); | ||
2052 | return Result.OK("完成空托盘出库成功"); | 2079 | return Result.OK("完成空托盘出库成功"); |
2053 | } | 2080 | } |
2054 | 2081 |