Commit a5e8ff078379bdb37ab52e9eaa65a8afa2427ca7
1 parent
188ca5d6
完善入库流程
Showing
15 changed files
with
180 additions
and
75 deletions
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/api/mes/servuce/impl/MesServiceImpl.java
@@ -9,11 +9,13 @@ import java.util.stream.Collectors; | @@ -9,11 +9,13 @@ import java.util.stream.Collectors; | ||
9 | import javax.annotation.Resource; | 9 | import javax.annotation.Resource; |
10 | 10 | ||
11 | import org.jeecg.common.api.vo.Result; | 11 | import org.jeecg.common.api.vo.Result; |
12 | +import org.jeecg.common.exception.JeecgBootException; | ||
12 | import org.jeecg.modules.wms.api.mes.entity.*; | 13 | import org.jeecg.modules.wms.api.mes.entity.*; |
13 | import org.jeecg.modules.wms.api.mes.servuce.IMesService; | 14 | import org.jeecg.modules.wms.api.mes.servuce.IMesService; |
14 | import org.jeecg.modules.wms.config.address.service.IAddressService; | 15 | import org.jeecg.modules.wms.config.address.service.IAddressService; |
15 | import org.jeecg.modules.wms.config.container.entity.Container; | 16 | import org.jeecg.modules.wms.config.container.entity.Container; |
16 | import org.jeecg.modules.wms.config.container.service.IContainerService; | 17 | import org.jeecg.modules.wms.config.container.service.IContainerService; |
18 | +import org.jeecg.modules.wms.framework.service.IHuahengMultiHandlerService; | ||
17 | import org.jeecg.modules.wms.receipt.receiptContainerHeader.entity.ReceiptContainerHeader; | 19 | import org.jeecg.modules.wms.receipt.receiptContainerHeader.entity.ReceiptContainerHeader; |
18 | import org.jeecg.modules.wms.receipt.receiptContainerHeader.service.IReceiptContainerHeaderService; | 20 | import org.jeecg.modules.wms.receipt.receiptContainerHeader.service.IReceiptContainerHeaderService; |
19 | import org.jeecg.modules.wms.receipt.receiptHeader.entity.ReceiptDetail; | 21 | import org.jeecg.modules.wms.receipt.receiptHeader.entity.ReceiptDetail; |
@@ -42,7 +44,6 @@ import org.springframework.stereotype.Service; | @@ -42,7 +44,6 @@ import org.springframework.stereotype.Service; | ||
42 | import org.springframework.transaction.annotation.Transactional; | 44 | import org.springframework.transaction.annotation.Transactional; |
43 | 45 | ||
44 | import com.alibaba.fastjson.JSON; | 46 | import com.alibaba.fastjson.JSON; |
45 | -import org.jeecg.common.exception.JeecgBootException; | ||
46 | import com.baomidou.mybatisplus.core.toolkit.IdWorker; | 47 | import com.baomidou.mybatisplus.core.toolkit.IdWorker; |
47 | 48 | ||
48 | /** | 49 | /** |
@@ -77,6 +78,8 @@ public class MesServiceImpl implements IMesService { | @@ -77,6 +78,8 @@ public class MesServiceImpl implements IMesService { | ||
77 | private ITaskHeaderService taskHeaderService; | 78 | private ITaskHeaderService taskHeaderService; |
78 | @Resource | 79 | @Resource |
79 | private IContainerService containerService; | 80 | private IContainerService containerService; |
81 | + @Resource | ||
82 | + private IHuahengMultiHandlerService huahengMultiHandlerService; | ||
80 | 83 | ||
81 | /** | 84 | /** |
82 | * 要求入库单详情 必须是不重样的 | 85 | * 要求入库单详情 必须是不重样的 |
@@ -147,7 +150,7 @@ public class MesServiceImpl implements IMesService { | @@ -147,7 +150,7 @@ public class MesServiceImpl implements IMesService { | ||
147 | if (!success) { | 150 | if (!success) { |
148 | throw new JeecgBootException("MES下发入库信息,更新入库组盘头失败"); | 151 | throw new JeecgBootException("MES下发入库信息,更新入库组盘头失败"); |
149 | } | 152 | } |
150 | - return receiptContainerHeaderService.createReceiptTask(receiptContainerHeader, warehouseCode); | 153 | + return huahengMultiHandlerService.createReceiptTask(receiptContainerHeader, warehouseCode); |
151 | } | 154 | } |
152 | 155 | ||
153 | @Override | 156 | @Override |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/api/wcs/service/WcsServiceImpl.java
@@ -160,10 +160,7 @@ public class WcsServiceImpl implements WcsService { | @@ -160,10 +160,7 @@ public class WcsServiceImpl implements WcsService { | ||
160 | int allocationRule = Integer.parseInt(value); | 160 | int allocationRule = Integer.parseInt(value); |
161 | String materialAreaCode = null; | 161 | String materialAreaCode = null; |
162 | // 查询任务明细 | 162 | // 查询任务明细 |
163 | - LambdaQueryWrapper<TaskDetail> taskDetailLambdaQueryWrapper = Wrappers.lambdaQuery(); | ||
164 | - taskDetailLambdaQueryWrapper.eq(TaskDetail::getTaskHeaderId, taskNo); | ||
165 | - List<TaskDetail> taskDetailList = taskDetailService.list(taskDetailLambdaQueryWrapper); | ||
166 | - | 163 | + List<TaskDetail> taskDetailList = taskDetailService.getTaskDetailListByTaskId(Integer.parseInt(taskNo)); |
167 | if (taskDetailList.size() > 0) { | 164 | if (taskDetailList.size() > 0) { |
168 | String materialCode = taskDetailList.get(0).getMaterialCode(); | 165 | String materialCode = taskDetailList.get(0).getMaterialCode(); |
169 | if (StringUtils.isNotEmpty(materialCode)) { | 166 | if (StringUtils.isNotEmpty(materialCode)) { |
@@ -199,12 +196,12 @@ public class WcsServiceImpl implements WcsService { | @@ -199,12 +196,12 @@ public class WcsServiceImpl implements WcsService { | ||
199 | } | 196 | } |
200 | // 去重 | 197 | // 去重 |
201 | receiptContainerDetailList = receiptContainerDetailList.stream().distinct().collect(Collectors.toList()); | 198 | receiptContainerDetailList = receiptContainerDetailList.stream().distinct().collect(Collectors.toList()); |
202 | - | ||
203 | if (receiptContainerDetailList.size() > 0) { | 199 | if (receiptContainerDetailList.size() > 0) { |
204 | // 更新库位编码到组盘头表 | 200 | // 更新库位编码到组盘头表 |
205 | ReceiptContainerDetail receiptContainerDetail = receiptContainerDetailList.get(0); | 201 | ReceiptContainerDetail receiptContainerDetail = receiptContainerDetailList.get(0); |
206 | if (receiptContainerDetail != null) { | 202 | if (receiptContainerDetail != null) { |
207 | - ReceiptContainerHeader receiptContainerHeader = receiptContainerHeaderService.getById(receiptContainerDetail.getReceiptContainerId()); | 203 | + ReceiptContainerHeader receiptContainerHeader = new ReceiptContainerHeader(); |
204 | + receiptContainerHeader.setId(receiptContainerDetail.getReceiptContainerId()); | ||
208 | receiptContainerHeader.setToLocationCode(locationCode); | 205 | receiptContainerHeader.setToLocationCode(locationCode); |
209 | if (!receiptContainerHeaderService.updateById(receiptContainerHeader)) { | 206 | if (!receiptContainerHeaderService.updateById(receiptContainerHeader)) { |
210 | throw new JeecgBootException("分配库位时,更新入库组盘的库位号失败"); | 207 | throw new JeecgBootException("分配库位时,更新入库组盘的库位号失败"); |
@@ -241,6 +238,8 @@ public class WcsServiceImpl implements WcsService { | @@ -241,6 +238,8 @@ public class WcsServiceImpl implements WcsService { | ||
241 | } | 238 | } |
242 | } | 239 | } |
243 | 240 | ||
241 | + taskHeader = new TaskHeader(); | ||
242 | + taskHeader.setId(Integer.parseInt(taskNo)); | ||
244 | taskHeader.setZoneCode(location.getZoneCode()); | 243 | taskHeader.setZoneCode(location.getZoneCode()); |
245 | taskHeader.setPreTaskNo(preTaskNo); | 244 | taskHeader.setPreTaskNo(preTaskNo); |
246 | taskHeader.setWeight(Integer.parseInt(warecellDomain.getWeight())); | 245 | taskHeader.setWeight(Integer.parseInt(warecellDomain.getWeight())); |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/framework/controller/HuahengBaseController.java
@@ -3,10 +3,10 @@ package org.jeecg.modules.wms.framework.controller; | @@ -3,10 +3,10 @@ package org.jeecg.modules.wms.framework.controller; | ||
3 | import java.util.concurrent.TimeUnit; | 3 | import java.util.concurrent.TimeUnit; |
4 | 4 | ||
5 | import javax.annotation.Nonnull; | 5 | import javax.annotation.Nonnull; |
6 | +import javax.annotation.Resource; | ||
6 | 7 | ||
7 | import org.jeecg.common.api.vo.Result; | 8 | import org.jeecg.common.api.vo.Result; |
8 | import org.jeecg.utils.support.RedissonDistributedLocker; | 9 | import org.jeecg.utils.support.RedissonDistributedLocker; |
9 | -import org.springframework.beans.factory.annotation.Autowired; | ||
10 | 10 | ||
11 | import cn.hutool.core.date.SystemClock; | 11 | import cn.hutool.core.date.SystemClock; |
12 | import cn.hutool.core.util.StrUtil; | 12 | import cn.hutool.core.util.StrUtil; |
@@ -18,7 +18,7 @@ import lombok.extern.slf4j.Slf4j; | @@ -18,7 +18,7 @@ import lombok.extern.slf4j.Slf4j; | ||
18 | @Slf4j | 18 | @Slf4j |
19 | public class HuahengBaseController { | 19 | public class HuahengBaseController { |
20 | 20 | ||
21 | - @Autowired | 21 | + @Resource |
22 | private RedissonDistributedLocker redissonDistributedLocker; | 22 | private RedissonDistributedLocker redissonDistributedLocker; |
23 | 23 | ||
24 | public interface MultiProcessListener { | 24 | public interface MultiProcessListener { |
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.receipt.receiptContainerHeader.entity.ReceiptContainerHeader; | ||
4 | import org.jeecg.modules.wms.task.taskHeader.entity.TaskHeader; | 5 | import org.jeecg.modules.wms.task.taskHeader.entity.TaskHeader; |
5 | 6 | ||
6 | /** | 7 | /** |
@@ -9,4 +10,6 @@ import org.jeecg.modules.wms.task.taskHeader.entity.TaskHeader; | @@ -9,4 +10,6 @@ import org.jeecg.modules.wms.task.taskHeader.entity.TaskHeader; | ||
9 | public interface IHuahengMultiHandlerService { | 10 | public interface IHuahengMultiHandlerService { |
10 | 11 | ||
11 | Result sendTaskToWcs(TaskHeader taskHeader); | 12 | Result sendTaskToWcs(TaskHeader taskHeader); |
13 | + | ||
14 | + Result<TaskHeader> createReceiptTask(ReceiptContainerHeader receiptContainerHeader, String warehouseCode); | ||
12 | } | 15 | } |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/framework/service/impl/HuahengMultiHandlerServiceImpl.java
@@ -5,6 +5,8 @@ import javax.annotation.Resource; | @@ -5,6 +5,8 @@ import javax.annotation.Resource; | ||
5 | import org.jeecg.common.api.vo.Result; | 5 | import org.jeecg.common.api.vo.Result; |
6 | import org.jeecg.modules.wms.framework.controller.HuahengBaseController; | 6 | import org.jeecg.modules.wms.framework.controller.HuahengBaseController; |
7 | import org.jeecg.modules.wms.framework.service.IHuahengMultiHandlerService; | 7 | import org.jeecg.modules.wms.framework.service.IHuahengMultiHandlerService; |
8 | +import org.jeecg.modules.wms.receipt.receiptContainerHeader.entity.ReceiptContainerHeader; | ||
9 | +import org.jeecg.modules.wms.receipt.receiptContainerHeader.service.IReceiptContainerHeaderService; | ||
8 | import org.jeecg.modules.wms.task.taskHeader.entity.TaskHeader; | 10 | import org.jeecg.modules.wms.task.taskHeader.entity.TaskHeader; |
9 | import org.jeecg.modules.wms.task.taskHeader.service.ITaskHeaderService; | 11 | import org.jeecg.modules.wms.task.taskHeader.service.ITaskHeaderService; |
10 | import org.springframework.stereotype.Service; | 12 | import org.springframework.stereotype.Service; |
@@ -17,6 +19,8 @@ public class HuahengMultiHandlerServiceImpl extends HuahengBaseController implem | @@ -17,6 +19,8 @@ public class HuahengMultiHandlerServiceImpl extends HuahengBaseController implem | ||
17 | 19 | ||
18 | @Resource | 20 | @Resource |
19 | private ITaskHeaderService taskHeaderService; | 21 | private ITaskHeaderService taskHeaderService; |
22 | + @Resource | ||
23 | + private IReceiptContainerHeaderService receiptContainerHeaderService; | ||
20 | 24 | ||
21 | @Override | 25 | @Override |
22 | public Result sendTaskToWcs(TaskHeader taskHeader) { | 26 | public Result sendTaskToWcs(TaskHeader taskHeader) { |
@@ -33,4 +37,17 @@ public class HuahengMultiHandlerServiceImpl extends HuahengBaseController implem | @@ -33,4 +37,17 @@ public class HuahengMultiHandlerServiceImpl extends HuahengBaseController implem | ||
33 | }); | 37 | }); |
34 | return result; | 38 | return result; |
35 | } | 39 | } |
40 | + | ||
41 | + @Override | ||
42 | + public Result<TaskHeader> createReceiptTask(ReceiptContainerHeader receiptContainerHeader, String warehouseCode) { | ||
43 | + String lockKey = warehouseCode; | ||
44 | + Result result = handleMultiProcess("createReceiptTask", lockKey, new MultiProcessListener() { | ||
45 | + @Override | ||
46 | + public Result<?> doProcess() { | ||
47 | + Result result = receiptContainerHeaderService.createReceiptTask(receiptContainerHeader, warehouseCode); | ||
48 | + return result; | ||
49 | + } | ||
50 | + }); | ||
51 | + return result; | ||
52 | + } | ||
36 | } | 53 | } |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/inventory/inventoryHeader/service/IInventoryDetailService.java
@@ -3,8 +3,6 @@ package org.jeecg.modules.wms.inventory.inventoryHeader.service; | @@ -3,8 +3,6 @@ package org.jeecg.modules.wms.inventory.inventoryHeader.service; | ||
3 | import java.math.BigDecimal; | 3 | import java.math.BigDecimal; |
4 | import java.util.List; | 4 | import java.util.List; |
5 | 5 | ||
6 | -import javax.servlet.http.HttpServletRequest; | ||
7 | - | ||
8 | import org.jeecg.modules.wms.inventory.inventoryHeader.entity.InventoryDetail; | 6 | import org.jeecg.modules.wms.inventory.inventoryHeader.entity.InventoryDetail; |
9 | 7 | ||
10 | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | 8 | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
@@ -34,11 +32,12 @@ public interface IInventoryDetailService extends IService<InventoryDetail> { | @@ -34,11 +32,12 @@ public interface IInventoryDetailService extends IService<InventoryDetail> { | ||
34 | 32 | ||
35 | /** | 33 | /** |
36 | * 分页查询库存明细,组装容器填充度 | 34 | * 分页查询库存明细,组装容器填充度 |
37 | - * @author TanYibin | ||
38 | - * @createDate 2023年4月7日 | ||
39 | - * @param page | ||
40 | - * @param queryWrapper | 35 | + * @author TanYibin |
36 | + * @createDate 2023年4月7日 | ||
37 | + * @param page | ||
38 | + * @param queryWrapper | ||
41 | * @return | 39 | * @return |
42 | */ | 40 | */ |
43 | IPage<InventoryDetail> queryPage(Page<InventoryDetail> page, QueryWrapper<InventoryDetail> queryWrapper); | 41 | IPage<InventoryDetail> queryPage(Page<InventoryDetail> page, QueryWrapper<InventoryDetail> queryWrapper); |
42 | + | ||
44 | } | 43 | } |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/inventory/inventoryHeader/service/IInventoryHeaderService.java
@@ -28,4 +28,8 @@ public interface IInventoryHeaderService extends IService<InventoryHeader> { | @@ -28,4 +28,8 @@ public interface IInventoryHeaderService extends IService<InventoryHeader> { | ||
28 | InventoryHeader getInventoryHeaderByContainerCode(String containerCode, String warehouseCode); | 28 | InventoryHeader getInventoryHeaderByContainerCode(String containerCode, String warehouseCode); |
29 | 29 | ||
30 | boolean updateInventoryContainerStatusByContainerCode(String containerCode, String warehouseCode); | 30 | boolean updateInventoryContainerStatusByContainerCode(String containerCode, String warehouseCode); |
31 | + | ||
32 | + boolean updateInventoryLocationAndZoneById(String locationCode, String zoneCode, Integer id); | ||
33 | + | ||
34 | + boolean updateContainerStatusById(String containerStatus, Integer id); | ||
31 | } | 35 | } |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/inventory/inventoryHeader/service/impl/InventoryDetailServiceImpl.java
@@ -4,19 +4,13 @@ import java.math.BigDecimal; | @@ -4,19 +4,13 @@ import java.math.BigDecimal; | ||
4 | import java.math.RoundingMode; | 4 | import java.math.RoundingMode; |
5 | import java.util.List; | 5 | import java.util.List; |
6 | import java.util.Map; | 6 | import java.util.Map; |
7 | -import java.util.Set; | ||
8 | import java.util.function.Function; | 7 | import java.util.function.Function; |
9 | import java.util.stream.Collectors; | 8 | import java.util.stream.Collectors; |
10 | 9 | ||
11 | -import javax.servlet.http.HttpServletRequest; | ||
12 | - | ||
13 | -import org.jeecg.common.system.query.QueryGenerator; | ||
14 | import org.jeecg.modules.wms.config.container.entity.Container; | 10 | import org.jeecg.modules.wms.config.container.entity.Container; |
15 | import org.jeecg.modules.wms.config.container.service.IContainerService; | 11 | import org.jeecg.modules.wms.config.container.service.IContainerService; |
16 | import org.jeecg.modules.wms.config.containerCapacity.entity.ContainerCapacity; | 12 | import org.jeecg.modules.wms.config.containerCapacity.entity.ContainerCapacity; |
17 | import org.jeecg.modules.wms.config.containerCapacity.service.IContainerCapacityService; | 13 | import org.jeecg.modules.wms.config.containerCapacity.service.IContainerCapacityService; |
18 | -import org.jeecg.modules.wms.config.location.entity.Location; | ||
19 | -import org.jeecg.modules.wms.config.material.entity.Material; | ||
20 | import org.jeecg.modules.wms.inventory.inventoryHeader.entity.InventoryDetail; | 14 | import org.jeecg.modules.wms.inventory.inventoryHeader.entity.InventoryDetail; |
21 | import org.jeecg.modules.wms.inventory.inventoryHeader.mapper.InventoryDetailMapper; | 15 | import org.jeecg.modules.wms.inventory.inventoryHeader.mapper.InventoryDetailMapper; |
22 | import org.jeecg.modules.wms.inventory.inventoryHeader.service.IInventoryDetailService; | 16 | import org.jeecg.modules.wms.inventory.inventoryHeader.service.IInventoryDetailService; |
@@ -24,7 +18,6 @@ import org.jeecg.utils.StringUtils; | @@ -24,7 +18,6 @@ import org.jeecg.utils.StringUtils; | ||
24 | import org.springframework.beans.factory.annotation.Autowired; | 18 | import org.springframework.beans.factory.annotation.Autowired; |
25 | import org.springframework.stereotype.Service; | 19 | import org.springframework.stereotype.Service; |
26 | import org.springframework.util.CollectionUtils; | 20 | import org.springframework.util.CollectionUtils; |
27 | -import org.springframework.web.bind.annotation.RequestParam; | ||
28 | 21 | ||
29 | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | 22 | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
30 | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | 23 | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
@@ -120,9 +113,9 @@ public class InventoryDetailServiceImpl extends ServiceImpl<InventoryDetailMappe | @@ -120,9 +113,9 @@ public class InventoryDetailServiceImpl extends ServiceImpl<InventoryDetailMappe | ||
120 | 113 | ||
121 | /** | 114 | /** |
122 | * 计算库存明细托盘填充度 | 115 | * 计算库存明细托盘填充度 |
123 | - * @author TanYibin | ||
124 | - * @createDate 2023年4月7日 | ||
125 | - * @param inventoryDetailList | 116 | + * @author TanYibin |
117 | + * @createDate 2023年4月7日 | ||
118 | + * @param inventoryDetailList | ||
126 | */ | 119 | */ |
127 | private void calculateFillDensity(List<InventoryDetail> inventoryDetailList) { | 120 | private void calculateFillDensity(List<InventoryDetail> inventoryDetailList) { |
128 | // 根据仓库编码分组库存明细 | 121 | // 根据仓库编码分组库存明细 |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/inventory/inventoryHeader/service/impl/InventoryHeaderServiceImpl.java
1 | package org.jeecg.modules.wms.inventory.inventoryHeader.service.impl; | 1 | package org.jeecg.modules.wms.inventory.inventoryHeader.service.impl; |
2 | 2 | ||
3 | import java.io.Serializable; | 3 | import java.io.Serializable; |
4 | +import java.util.ArrayList; | ||
4 | import java.util.Collection; | 5 | import java.util.Collection; |
5 | import java.util.List; | 6 | import java.util.List; |
6 | 7 | ||
@@ -74,21 +75,44 @@ public class InventoryHeaderServiceImpl extends ServiceImpl<InventoryHeaderMappe | @@ -74,21 +75,44 @@ public class InventoryHeaderServiceImpl extends ServiceImpl<InventoryHeaderMappe | ||
74 | } | 75 | } |
75 | InventoryHeader inventoryHeader = inventoryHeaderService.getInventoryHeaderByContainerCode(containerCode, warehouseCode); | 76 | InventoryHeader inventoryHeader = inventoryHeaderService.getInventoryHeaderByContainerCode(containerCode, warehouseCode); |
76 | if (inventoryHeader != null) { | 77 | if (inventoryHeader != null) { |
77 | - inventoryHeader.setContainerStatus(container.getStatus()); | ||
78 | - boolean success = inventoryHeaderService.updateById(inventoryHeader); | 78 | + boolean success = inventoryHeaderService.updateContainerStatusById(container.getStatus(), inventoryHeader.getId()); |
79 | if (!success) { | 79 | if (!success) { |
80 | return success; | 80 | return success; |
81 | } | 81 | } |
82 | List<InventoryDetail> inventoryDetailList = inventoryDetailService.getInventoryDetailListByContainerCode(containerCode, warehouseCode); | 82 | List<InventoryDetail> inventoryDetailList = inventoryDetailService.getInventoryDetailListByContainerCode(containerCode, warehouseCode); |
83 | + List<InventoryDetail> inventoryDetailList1 = new ArrayList<>(); | ||
83 | if (inventoryDetailList.size() > 0) { | 84 | if (inventoryDetailList.size() > 0) { |
84 | for (InventoryDetail inventoryDetail : inventoryDetailList) { | 85 | for (InventoryDetail inventoryDetail : inventoryDetailList) { |
85 | inventoryDetail.setContainerStatus(container.getStatus()); | 86 | inventoryDetail.setContainerStatus(container.getStatus()); |
87 | + InventoryDetail inventoryDetail1 = new InventoryDetail(); | ||
88 | + inventoryDetail1.setId(inventoryDetail.getId()); | ||
89 | + inventoryDetail1.setContainerStatus(container.getStatus()); | ||
90 | + inventoryDetailList1.add(inventoryDetail1); | ||
86 | } | 91 | } |
87 | - success = inventoryDetailService.updateBatchById(inventoryDetailList); | 92 | + success = inventoryDetailService.updateBatchById(inventoryDetailList1); |
88 | } | 93 | } |
89 | return success; | 94 | return success; |
90 | } | 95 | } |
91 | return false; | 96 | return false; |
92 | } | 97 | } |
93 | 98 | ||
99 | + @Override | ||
100 | + public boolean updateInventoryLocationAndZoneById(String locationCode, String zoneCode, Integer id) { | ||
101 | + InventoryHeader inventoryHeader = new InventoryHeader(); | ||
102 | + inventoryHeader.setId(id); | ||
103 | + inventoryHeader.setLocationCode(locationCode); | ||
104 | + inventoryHeader.setZoneCode(zoneCode); | ||
105 | + boolean success = inventoryHeaderService.updateById(inventoryHeader); | ||
106 | + return success; | ||
107 | + } | ||
108 | + | ||
109 | + @Override | ||
110 | + public boolean updateContainerStatusById(String containerStatus, Integer id) { | ||
111 | + InventoryHeader inventoryHeader = new InventoryHeader(); | ||
112 | + inventoryHeader.setId(id); | ||
113 | + inventoryHeader.setContainerStatus(containerStatus); | ||
114 | + boolean success = inventoryHeaderService.updateById(inventoryHeader); | ||
115 | + return success; | ||
116 | + } | ||
117 | + | ||
94 | } | 118 | } |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/receipt/receiptContainerHeader/controller/ReceiptContainerHeaderController.java
@@ -24,6 +24,7 @@ import org.jeecg.modules.wms.config.port.entity.Port; | @@ -24,6 +24,7 @@ import org.jeecg.modules.wms.config.port.entity.Port; | ||
24 | import org.jeecg.modules.wms.config.port.service.IPortService; | 24 | import org.jeecg.modules.wms.config.port.service.IPortService; |
25 | import org.jeecg.modules.wms.config.zone.entity.Zone; | 25 | import org.jeecg.modules.wms.config.zone.entity.Zone; |
26 | import org.jeecg.modules.wms.config.zone.service.IZoneService; | 26 | import org.jeecg.modules.wms.config.zone.service.IZoneService; |
27 | +import org.jeecg.modules.wms.framework.service.IHuahengMultiHandlerService; | ||
27 | import org.jeecg.modules.wms.receipt.receiptContainerHeader.entity.ReceiptContainerDetail; | 28 | import org.jeecg.modules.wms.receipt.receiptContainerHeader.entity.ReceiptContainerDetail; |
28 | import org.jeecg.modules.wms.receipt.receiptContainerHeader.entity.ReceiptContainerHeader; | 29 | import org.jeecg.modules.wms.receipt.receiptContainerHeader.entity.ReceiptContainerHeader; |
29 | import org.jeecg.modules.wms.receipt.receiptContainerHeader.service.IReceiptContainerDetailService; | 30 | import org.jeecg.modules.wms.receipt.receiptContainerHeader.service.IReceiptContainerDetailService; |
@@ -77,6 +78,9 @@ public class ReceiptContainerHeaderController extends JeecgController<ReceiptCon | @@ -77,6 +78,9 @@ public class ReceiptContainerHeaderController extends JeecgController<ReceiptCon | ||
77 | @Autowired | 78 | @Autowired |
78 | private IPortService portService; | 79 | private IPortService portService; |
79 | 80 | ||
81 | + @Resource | ||
82 | + private IHuahengMultiHandlerService huahengMultiHandlerService; | ||
83 | + | ||
80 | /*---------------------------------主表处理-begin-------------------------------------*/ | 84 | /*---------------------------------主表处理-begin-------------------------------------*/ |
81 | 85 | ||
82 | /** | 86 | /** |
@@ -332,7 +336,8 @@ public class ReceiptContainerHeaderController extends JeecgController<ReceiptCon | @@ -332,7 +336,8 @@ public class ReceiptContainerHeaderController extends JeecgController<ReceiptCon | ||
332 | @ResponseBody | 336 | @ResponseBody |
333 | public Result createReceiptTask(@RequestBody ReceiptContainerHeader receiptContainerHeader, HttpServletRequest req) { | 337 | public Result createReceiptTask(@RequestBody ReceiptContainerHeader receiptContainerHeader, HttpServletRequest req) { |
334 | String warehouseCode = HuahengJwtUtil.getWarehouseCodeByToken(req); | 338 | String warehouseCode = HuahengJwtUtil.getWarehouseCodeByToken(req); |
335 | - return receiptContainerHeaderService.createReceiptTask(receiptContainerHeader, warehouseCode); | 339 | + Result result = huahengMultiHandlerService.createReceiptTask(receiptContainerHeader, warehouseCode); |
340 | + return result; | ||
336 | } | 341 | } |
337 | 342 | ||
338 | /** | 343 | /** |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/receipt/receiptContainerHeader/service/impl/ReceiptContainerHeaderServiceImpl.java
@@ -15,6 +15,7 @@ import org.jeecg.modules.wms.config.container.entity.Container; | @@ -15,6 +15,7 @@ import org.jeecg.modules.wms.config.container.entity.Container; | ||
15 | import org.jeecg.modules.wms.config.container.service.IContainerService; | 15 | import org.jeecg.modules.wms.config.container.service.IContainerService; |
16 | import org.jeecg.modules.wms.config.location.entity.Location; | 16 | import org.jeecg.modules.wms.config.location.entity.Location; |
17 | import org.jeecg.modules.wms.config.location.service.ILocationService; | 17 | import org.jeecg.modules.wms.config.location.service.ILocationService; |
18 | +import org.jeecg.modules.wms.config.parameterConfiguration.service.IParameterConfigurationService; | ||
18 | import org.jeecg.modules.wms.inventory.inventoryHeader.service.IInventoryHeaderService; | 19 | import org.jeecg.modules.wms.inventory.inventoryHeader.service.IInventoryHeaderService; |
19 | import org.jeecg.modules.wms.receipt.receiptContainerHeader.entity.ReceiptContainerDetail; | 20 | import org.jeecg.modules.wms.receipt.receiptContainerHeader.entity.ReceiptContainerDetail; |
20 | import org.jeecg.modules.wms.receipt.receiptContainerHeader.entity.ReceiptContainerHeader; | 21 | import org.jeecg.modules.wms.receipt.receiptContainerHeader.entity.ReceiptContainerHeader; |
@@ -76,6 +77,8 @@ public class ReceiptContainerHeaderServiceImpl extends ServiceImpl<ReceiptContai | @@ -76,6 +77,8 @@ public class ReceiptContainerHeaderServiceImpl extends ServiceImpl<ReceiptContai | ||
76 | private IReceiptHeaderService receiptHeaderService; | 77 | private IReceiptHeaderService receiptHeaderService; |
77 | @Resource | 78 | @Resource |
78 | private IInventoryHeaderService inventoryHeaderService; | 79 | private IInventoryHeaderService inventoryHeaderService; |
80 | + @Resource | ||
81 | + private IParameterConfigurationService parameterConfigurationService; | ||
79 | 82 | ||
80 | @Override | 83 | @Override |
81 | @Transactional | 84 | @Transactional |
@@ -224,6 +227,7 @@ public class ReceiptContainerHeaderServiceImpl extends ServiceImpl<ReceiptContai | @@ -224,6 +227,7 @@ public class ReceiptContainerHeaderServiceImpl extends ServiceImpl<ReceiptContai | ||
224 | } | 227 | } |
225 | ReceiptContainerHeader receiptContainerHeader1 = new ReceiptContainerHeader(); | 228 | ReceiptContainerHeader receiptContainerHeader1 = new ReceiptContainerHeader(); |
226 | receiptContainerHeader1.setId(receiptContainerHeader.getId()); | 229 | receiptContainerHeader1.setId(receiptContainerHeader.getId()); |
230 | + receiptContainerHeader1.setToPort(receiptContainerHeader.getToPort()); | ||
227 | receiptContainerHeader1.setStatus(QuantityConstant.RECEIPT_CONTAINER_TASK); | 231 | receiptContainerHeader1.setStatus(QuantityConstant.RECEIPT_CONTAINER_TASK); |
228 | success = this.updateById(receiptContainerHeader1); | 232 | success = this.updateById(receiptContainerHeader1); |
229 | if (!success) { | 233 | if (!success) { |
@@ -320,7 +324,6 @@ public class ReceiptContainerHeaderServiceImpl extends ServiceImpl<ReceiptContai | @@ -320,7 +324,6 @@ public class ReceiptContainerHeaderServiceImpl extends ServiceImpl<ReceiptContai | ||
320 | @OperationLog(bizId = "''", bizType = "'入库单追踪'", tag = "'入库任务取消'", extra = "#extraJsonString", msg = "'任务ID:' + #taskHeader.getId()", | 324 | @OperationLog(bizId = "''", bizType = "'入库单追踪'", tag = "'入库任务取消'", extra = "#extraJsonString", msg = "'任务ID:' + #taskHeader.getId()", |
321 | condition = "#receiptContainerDetailList.size() > 0", recordReturnValue = true) | 325 | condition = "#receiptContainerDetailList.size() > 0", recordReturnValue = true) |
322 | public boolean cancelReceiptTask(TaskHeader taskHeader) { | 326 | public boolean cancelReceiptTask(TaskHeader taskHeader) { |
323 | - log.info("开始取消入库任务"); | ||
324 | ReceiptContainerHeader receiptContainerHeader = getById(taskHeader.getReceiptContainerHeaderId()); | 327 | ReceiptContainerHeader receiptContainerHeader = getById(taskHeader.getReceiptContainerHeaderId()); |
325 | if (receiptContainerHeader == null) { | 328 | if (receiptContainerHeader == null) { |
326 | return false; | 329 | return false; |
@@ -329,11 +332,18 @@ public class ReceiptContainerHeaderServiceImpl extends ServiceImpl<ReceiptContai | @@ -329,11 +332,18 @@ public class ReceiptContainerHeaderServiceImpl extends ServiceImpl<ReceiptContai | ||
329 | if (receiptContainerStatus != QuantityConstant.RECEIPT_CONTAINER_TASK) { | 332 | if (receiptContainerStatus != QuantityConstant.RECEIPT_CONTAINER_TASK) { |
330 | throw new JeecgBootException("取消入库任务时, 任务状态不为生成任务状态"); | 333 | throw new JeecgBootException("取消入库任务时, 任务状态不为生成任务状态"); |
331 | } | 334 | } |
335 | + String value = parameterConfigurationService.getValueByCode(QuantityConstant.RULE_TASK_LOCATION); | ||
336 | + if (StringUtils.isEmpty(value)) { | ||
337 | + throw new JeecgBootException("取消入库任务时, 没有获取到配置属性"); | ||
338 | + } | ||
339 | + int taskLocationRule = Integer.parseInt(value); | ||
332 | receiptContainerHeader = new ReceiptContainerHeader(); | 340 | receiptContainerHeader = new ReceiptContainerHeader(); |
333 | receiptContainerHeader.setId(taskHeader.getReceiptContainerHeaderId()); | 341 | receiptContainerHeader.setId(taskHeader.getReceiptContainerHeaderId()); |
334 | receiptContainerHeader.setStatus(QuantityConstant.RECEIPT_CONTAINER_BUILD); | 342 | receiptContainerHeader.setStatus(QuantityConstant.RECEIPT_CONTAINER_BUILD); |
335 | // 取消任务后,不指定组盘库位 | 343 | // 取消任务后,不指定组盘库位 |
336 | - receiptContainerHeader.setToLocationCode(QuantityConstant.EMPTY_STRING); | 344 | + if (taskLocationRule == QuantityConstant.RULE_TASK_NOT_LOCATION) { |
345 | + receiptContainerHeader.setToLocationCode(QuantityConstant.EMPTY_STRING); | ||
346 | + } | ||
337 | boolean success = receiptContainerHeaderService.updateById(receiptContainerHeader); | 347 | boolean success = receiptContainerHeaderService.updateById(receiptContainerHeader); |
338 | if (!success) { | 348 | if (!success) { |
339 | throw new JeecgBootException("取消入库任务时, 更新入库组盘头失败"); | 349 | throw new JeecgBootException("取消入库任务时, 更新入库组盘头失败"); |
@@ -370,7 +380,6 @@ public class ReceiptContainerHeaderServiceImpl extends ServiceImpl<ReceiptContai | @@ -370,7 +380,6 @@ public class ReceiptContainerHeaderServiceImpl extends ServiceImpl<ReceiptContai | ||
370 | } | 380 | } |
371 | LogRecordContext.putVariable("receiptContainerDetailList", receiptContainerDetailList);// 操作日志收集 | 381 | LogRecordContext.putVariable("receiptContainerDetailList", receiptContainerDetailList);// 操作日志收集 |
372 | LogRecordContext.putVariable("extraJsonString", JSON.toJSONString(receiptContainerDetailList));// 操作日志收集 | 382 | LogRecordContext.putVariable("extraJsonString", JSON.toJSONString(receiptContainerDetailList));// 操作日志收集 |
373 | - log.info("完成取消入库任务"); | ||
374 | return true; | 383 | return true; |
375 | } | 384 | } |
376 | 385 |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/receipt/receiving/controller/ReceiveController.java
@@ -10,6 +10,7 @@ import javax.servlet.http.HttpServletRequest; | @@ -10,6 +10,7 @@ import javax.servlet.http.HttpServletRequest; | ||
10 | import org.jeecg.common.api.vo.Result; | 10 | import org.jeecg.common.api.vo.Result; |
11 | import org.jeecg.common.aspect.annotation.AutoLog; | 11 | import org.jeecg.common.aspect.annotation.AutoLog; |
12 | import org.jeecg.common.system.query.QueryGenerator; | 12 | import org.jeecg.common.system.query.QueryGenerator; |
13 | +import org.jeecg.modules.wms.framework.controller.HuahengBaseController; | ||
13 | import org.jeecg.modules.wms.receipt.receiptHeader.entity.ReceiptDetail; | 14 | import org.jeecg.modules.wms.receipt.receiptHeader.entity.ReceiptDetail; |
14 | import org.jeecg.modules.wms.receipt.receiptHeader.service.IReceiptDetailService; | 15 | import org.jeecg.modules.wms.receipt.receiptHeader.service.IReceiptDetailService; |
15 | import org.jeecg.modules.wms.receipt.receiving.domain.Receive; | 16 | import org.jeecg.modules.wms.receipt.receiving.domain.Receive; |
@@ -31,7 +32,7 @@ import lombok.extern.slf4j.Slf4j; | @@ -31,7 +32,7 @@ import lombok.extern.slf4j.Slf4j; | ||
31 | @RestController | 32 | @RestController |
32 | @RequestMapping("/receipt/receiveHeader") | 33 | @RequestMapping("/receipt/receiveHeader") |
33 | @Slf4j | 34 | @Slf4j |
34 | -public class ReceiveController { | 35 | +public class ReceiveController extends HuahengBaseController { |
35 | 36 | ||
36 | @Resource | 37 | @Resource |
37 | private IReceiptDetailService receiptDetailService; | 38 | private IReceiptDetailService receiptDetailService; |
@@ -80,7 +81,15 @@ public class ReceiveController { | @@ -80,7 +81,15 @@ public class ReceiveController { | ||
80 | @ResponseBody | 81 | @ResponseBody |
81 | public Result receiving(@RequestBody List<Receive> receiveList, HttpServletRequest req) { | 82 | public Result receiving(@RequestBody List<Receive> receiveList, HttpServletRequest req) { |
82 | String warehouseCode = HuahengJwtUtil.getWarehouseCodeByToken(req); | 83 | String warehouseCode = HuahengJwtUtil.getWarehouseCodeByToken(req); |
83 | - return receiveService.receiving(receiveList, warehouseCode); | 84 | + String lockKey = warehouseCode; |
85 | + Result result = handleMultiProcess("receiving", lockKey, new MultiProcessListener() { | ||
86 | + @Override | ||
87 | + public Result<?> doProcess() { | ||
88 | + Result result = receiveService.receiving(receiveList, warehouseCode); | ||
89 | + return result; | ||
90 | + } | ||
91 | + }); | ||
92 | + return result; | ||
84 | } | 93 | } |
85 | 94 | ||
86 | /** | 95 | /** |
@@ -93,7 +102,15 @@ public class ReceiveController { | @@ -93,7 +102,15 @@ public class ReceiveController { | ||
93 | @ResponseBody | 102 | @ResponseBody |
94 | public Result<TaskHeader> receivingAndCreateTask(@RequestBody List<Receive> receiveList, HttpServletRequest req) { | 103 | public Result<TaskHeader> receivingAndCreateTask(@RequestBody List<Receive> receiveList, HttpServletRequest req) { |
95 | String warehouseCode = HuahengJwtUtil.getWarehouseCodeByToken(req); | 104 | String warehouseCode = HuahengJwtUtil.getWarehouseCodeByToken(req); |
96 | - return receiveService.receivingAndCreateTask(receiveList, warehouseCode); | 105 | + String lockKey = warehouseCode; |
106 | + Result result = handleMultiProcess("receivingAndCreateTask", lockKey, new MultiProcessListener() { | ||
107 | + @Override | ||
108 | + public Result<?> doProcess() { | ||
109 | + Result result = receiveService.receivingAndCreateTask(receiveList, warehouseCode); | ||
110 | + return result; | ||
111 | + } | ||
112 | + }); | ||
113 | + return result; | ||
97 | } | 114 | } |
98 | 115 | ||
99 | } | 116 | } |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/task/taskHeader/entity/TaskHeader.java
@@ -9,7 +9,6 @@ import org.jeecg.common.aspect.annotation.Dict; | @@ -9,7 +9,6 @@ import org.jeecg.common.aspect.annotation.Dict; | ||
9 | import org.jeecgframework.poi.excel.annotation.Excel; | 9 | import org.jeecgframework.poi.excel.annotation.Excel; |
10 | 10 | ||
11 | import com.baomidou.mybatisplus.annotation.IdType; | 11 | import com.baomidou.mybatisplus.annotation.IdType; |
12 | -import com.baomidou.mybatisplus.annotation.TableField; | ||
13 | import com.baomidou.mybatisplus.annotation.TableId; | 12 | import com.baomidou.mybatisplus.annotation.TableId; |
14 | import com.baomidou.mybatisplus.annotation.TableName; | 13 | import com.baomidou.mybatisplus.annotation.TableName; |
15 | 14 | ||
@@ -116,7 +115,7 @@ public class TaskHeader implements Serializable { | @@ -116,7 +115,7 @@ public class TaskHeader implements Serializable { | ||
116 | @ApiModelProperty(value = "目标出入口") | 115 | @ApiModelProperty(value = "目标出入口") |
117 | private String toPortCode; | 116 | private String toPortCode; |
118 | @ApiModelProperty(value = "AGV关联任务ID") | 117 | @ApiModelProperty(value = "AGV关联任务ID") |
119 | - private int agvTaskId; | 118 | + private Integer agvTaskId; |
120 | @ApiModelProperty(value = "生成agv任务") | 119 | @ApiModelProperty(value = "生成agv任务") |
121 | private Integer sendAgv; | 120 | private Integer sendAgv; |
122 | @ApiModelProperty(value = "回传MES信息") | 121 | @ApiModelProperty(value = "回传MES信息") |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/task/taskHeader/service/ITaskHeaderService.java
@@ -295,4 +295,19 @@ public interface ITaskHeaderService extends IService<TaskHeader> { | @@ -295,4 +295,19 @@ public interface ITaskHeaderService extends IService<TaskHeader> { | ||
295 | * @return | 295 | * @return |
296 | */ | 296 | */ |
297 | Result cancelShipmentTask(TaskHeader taskHeader); | 297 | Result cancelShipmentTask(TaskHeader taskHeader); |
298 | + | ||
299 | + /** | ||
300 | + * 更新状态 | ||
301 | + * @param status | ||
302 | + * @param id | ||
303 | + * @return | ||
304 | + */ | ||
305 | + boolean updateStatusById(int status, int id); | ||
306 | + | ||
307 | + /** | ||
308 | + * 合并库存 | ||
309 | + * @param taskHeader | ||
310 | + * @return | ||
311 | + */ | ||
312 | + boolean combineInventoryDetail(TaskHeader taskHeader); | ||
298 | } | 313 | } |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/task/taskHeader/service/impl/TaskHeaderServiceImpl.java
@@ -33,7 +33,6 @@ import org.jeecg.modules.wms.inventory.inventoryHeader.service.IInventoryDetailS | @@ -33,7 +33,6 @@ import org.jeecg.modules.wms.inventory.inventoryHeader.service.IInventoryDetailS | ||
33 | import org.jeecg.modules.wms.inventory.inventoryHeader.service.IInventoryHeaderService; | 33 | import org.jeecg.modules.wms.inventory.inventoryHeader.service.IInventoryHeaderService; |
34 | import org.jeecg.modules.wms.inventory.inventoryTransaction.entity.InventoryTransaction; | 34 | import org.jeecg.modules.wms.inventory.inventoryTransaction.entity.InventoryTransaction; |
35 | import org.jeecg.modules.wms.inventory.inventoryTransaction.service.IInventoryTransactionService; | 35 | import org.jeecg.modules.wms.inventory.inventoryTransaction.service.IInventoryTransactionService; |
36 | -import org.jeecg.modules.wms.receipt.receiptContainerHeader.entity.ReceiptContainerHeader; | ||
37 | import org.jeecg.modules.wms.receipt.receiptContainerHeader.service.IReceiptContainerHeaderService; | 36 | import org.jeecg.modules.wms.receipt.receiptContainerHeader.service.IReceiptContainerHeaderService; |
38 | import org.jeecg.modules.wms.receipt.receiptHeader.entity.ReceiptDetail; | 37 | import org.jeecg.modules.wms.receipt.receiptHeader.entity.ReceiptDetail; |
39 | import org.jeecg.modules.wms.receipt.receiptHeader.entity.ReceiptHeader; | 38 | import org.jeecg.modules.wms.receipt.receiptHeader.entity.ReceiptHeader; |
@@ -73,6 +72,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | @@ -73,6 +72,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | ||
73 | 72 | ||
74 | import cn.monitor4all.logRecord.annotation.OperationLog; | 73 | import cn.monitor4all.logRecord.annotation.OperationLog; |
75 | import cn.monitor4all.logRecord.context.LogRecordContext; | 74 | import cn.monitor4all.logRecord.context.LogRecordContext; |
75 | +import lombok.extern.slf4j.Slf4j; | ||
76 | 76 | ||
77 | /** | 77 | /** |
78 | * @Description: 任务表 | 78 | * @Description: 任务表 |
@@ -80,6 +80,7 @@ import cn.monitor4all.logRecord.context.LogRecordContext; | @@ -80,6 +80,7 @@ import cn.monitor4all.logRecord.context.LogRecordContext; | ||
80 | * @Date: 2022-11-10 | 80 | * @Date: 2022-11-10 |
81 | * @Version: V1.0 | 81 | * @Version: V1.0 |
82 | */ | 82 | */ |
83 | +@Slf4j | ||
83 | @Service | 84 | @Service |
84 | public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHeader> implements ITaskHeaderService { | 85 | public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHeader> implements ITaskHeaderService { |
85 | 86 | ||
@@ -1092,8 +1093,9 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea | @@ -1092,8 +1093,9 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea | ||
1092 | recordReturnValue = true) | 1093 | recordReturnValue = true) |
1093 | public Result completeReceiptTask(TaskHeader taskHeader) { | 1094 | public Result completeReceiptTask(TaskHeader taskHeader) { |
1094 | if (taskHeader == null) { | 1095 | if (taskHeader == null) { |
1095 | - return Result.error("任务未找到,执行中止"); | 1096 | + return Result.error("入库任务未找到,执行中止"); |
1096 | } | 1097 | } |
1098 | + log.info("开始完成入库任务, 任务号" + taskHeader.getId()); | ||
1097 | String warehouseCode = taskHeader.getWarehouseCode(); | 1099 | String warehouseCode = taskHeader.getWarehouseCode(); |
1098 | String fromLocationCode = taskHeader.getFromLocationCode(); | 1100 | String fromLocationCode = taskHeader.getFromLocationCode(); |
1099 | String toLocationCode = taskHeader.getToLocationCode(); | 1101 | String toLocationCode = taskHeader.getToLocationCode(); |
@@ -1103,27 +1105,33 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea | @@ -1103,27 +1105,33 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea | ||
1103 | List<TaskDetail> taskDetailList = taskDetailService.getTaskDetailListByTaskId(taskHeader.getId()); | 1105 | List<TaskDetail> taskDetailList = taskDetailService.getTaskDetailListByTaskId(taskHeader.getId()); |
1104 | boolean success = false; | 1106 | boolean success = false; |
1105 | if (taskHeader.getStatus().equals(QuantityConstant.TASK_STATUS_COMPLETED)) { | 1107 | if (taskHeader.getStatus().equals(QuantityConstant.TASK_STATUS_COMPLETED)) { |
1106 | - return Result.ok("任务(" + taskHeader.getId() + ")任务已经是完成的!"); | 1108 | + return Result.ok("入库任务(" + taskHeader.getId() + ")已经是完成的!"); |
1107 | } | 1109 | } |
1108 | if (taskDetailList.isEmpty()) { | 1110 | if (taskDetailList.isEmpty()) { |
1109 | - throw new JeecgBootException("任务明细为空"); | 1111 | + throw new JeecgBootException("入库任务明细为空"); |
1110 | } | 1112 | } |
1111 | Location toLocation = locationService.getLocationByCode(toLocationCode, warehouseCode); | 1113 | Location toLocation = locationService.getLocationByCode(toLocationCode, warehouseCode); |
1112 | if (toLocation == null) { | 1114 | if (toLocation == null) { |
1113 | - throw new JeecgBootException("完成任务时,没有找到目的库位"); | 1115 | + throw new JeecgBootException("完成入库任务时,没有找到目的库位"); |
1114 | } | 1116 | } |
1115 | InventoryHeader inventoryHeader = inventoryHeaderService.getInventoryHeaderByContainerCode(containerCode, warehouseCode); | 1117 | InventoryHeader inventoryHeader = inventoryHeaderService.getInventoryHeaderByContainerCode(containerCode, warehouseCode); |
1116 | if (inventoryHeader != null) { | 1118 | if (inventoryHeader != null) { |
1117 | if (taskType == QuantityConstant.TASK_TYPE_SUPPLEMENTRECEIPT) { | 1119 | if (taskType == QuantityConstant.TASK_TYPE_SUPPLEMENTRECEIPT) { |
1118 | - inventoryHeader.setLocationCode(toLocationCode); | ||
1119 | - inventoryHeader.setZoneCode(zoneCode); | ||
1120 | - inventoryHeaderService.updateById(inventoryHeader); | 1120 | + if (!inventoryHeaderService.updateInventoryLocationAndZoneById(toLocationCode, zoneCode, inventoryHeader.getId())) { |
1121 | + throw new JeecgBootException("完成入库任务时,没有找到目的库位"); | ||
1122 | + } | ||
1121 | List<InventoryDetail> inventoryDetailList = inventoryDetailService.getInventoryDetailListByInventoryHeaderId(inventoryHeader.getId()); | 1123 | List<InventoryDetail> inventoryDetailList = inventoryDetailService.getInventoryDetailListByInventoryHeaderId(inventoryHeader.getId()); |
1122 | - for (InventoryDetail inventoryDetail : inventoryDetailList) { | ||
1123 | - inventoryDetail.setLocationCode(toLocationCode); | ||
1124 | - inventoryDetail.setZoneCode(zoneCode); | ||
1125 | - if (!inventoryDetailService.updateById(inventoryDetail)) { | ||
1126 | - throw new ServiceException("更新库存详情失败"); | 1124 | + if (inventoryDetailList.size() > 0) { |
1125 | + List<InventoryDetail> inventoryDetailList1 = new ArrayList<>(); | ||
1126 | + for (InventoryDetail inventoryDetail : inventoryDetailList) { | ||
1127 | + InventoryDetail inventoryDetail1 = new InventoryDetail(); | ||
1128 | + inventoryDetail1.setId(inventoryDetail.getId()); | ||
1129 | + inventoryDetail1.setLocationCode(toLocationCode); | ||
1130 | + inventoryDetail1.setZoneCode(zoneCode); | ||
1131 | + inventoryDetailList1.add(inventoryDetail1); | ||
1132 | + } | ||
1133 | + if (!inventoryDetailService.updateBatchById(inventoryDetailList1)) { | ||
1134 | + throw new ServiceException("完成入库任务时,更新库存详情失败"); | ||
1127 | } | 1135 | } |
1128 | } | 1136 | } |
1129 | } | 1137 | } |
@@ -1155,12 +1163,16 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea | @@ -1155,12 +1163,16 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea | ||
1155 | taskDetail.setReceiptCode(receiptDetail.getReceiptCode()); | 1163 | taskDetail.setReceiptCode(receiptDetail.getReceiptCode()); |
1156 | BigDecimal taskQty = receiptDetail.getTaskQty(); | 1164 | BigDecimal taskQty = receiptDetail.getTaskQty(); |
1157 | BigDecimal qty = receiptDetail.getQty(); | 1165 | BigDecimal qty = receiptDetail.getQty(); |
1166 | + int receiptId = receiptDetail.getReceiptId(); | ||
1167 | + ReceiptDetail receiptDetail1 = new ReceiptDetail(); | ||
1168 | + receiptDetail1.setId(receiptDetail.getId()); | ||
1169 | + receiptDetail1.setReceiptId(receiptId); | ||
1158 | if (taskQty.compareTo(qty) >= 0) { | 1170 | if (taskQty.compareTo(qty) >= 0) { |
1159 | - receiptDetail.setStatus(QuantityConstant.RECEIPT_HEADER_COMPLETED); | 1171 | + receiptDetail1.setStatus(QuantityConstant.RECEIPT_HEADER_COMPLETED); |
1160 | } else { | 1172 | } else { |
1161 | - receiptDetail.setStatus(QuantityConstant.RECEIPT_HEADER_SHELF); | 1173 | + receiptDetail1.setStatus(QuantityConstant.RECEIPT_HEADER_SHELF); |
1162 | } | 1174 | } |
1163 | - receiptDetaiList.add(receiptDetail); | 1175 | + receiptDetaiList.add(receiptDetail1); |
1164 | 1176 | ||
1165 | BigDecimal receiptQty = taskDetail.getQty(); | 1177 | BigDecimal receiptQty = taskDetail.getQty(); |
1166 | InventoryDetail inventoryDetail = new InventoryDetail(); | 1178 | InventoryDetail inventoryDetail = new InventoryDetail(); |
@@ -1229,8 +1241,7 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea | @@ -1229,8 +1241,7 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea | ||
1229 | throw new JeecgBootException("完成入库任务时,更新库位失败"); | 1241 | throw new JeecgBootException("完成入库任务时,更新库位失败"); |
1230 | } | 1242 | } |
1231 | 1243 | ||
1232 | - taskHeader.setStatus(QuantityConstant.TASK_STATUS_COMPLETED); | ||
1233 | - success = taskHeaderService.updateById(taskHeader); | 1244 | + success = taskHeaderService.updateStatusById(QuantityConstant.TASK_STATUS_COMPLETED, taskHeader.getId()); |
1234 | if (!success) { | 1245 | if (!success) { |
1235 | throw new JeecgBootException("完成入库任务时,更新任务失败"); | 1246 | throw new JeecgBootException("完成入库任务时,更新任务失败"); |
1236 | } | 1247 | } |
@@ -1239,7 +1250,7 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea | @@ -1239,7 +1250,7 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea | ||
1239 | if (!success) { | 1250 | if (!success) { |
1240 | throw new JeecgBootException("完成入库任务时,更新容器失败"); | 1251 | throw new JeecgBootException("完成入库任务时,更新容器失败"); |
1241 | } | 1252 | } |
1242 | - if (!combineInventoryDetail(taskHeader)) { | 1253 | + if (!taskHeaderService.combineInventoryDetail(taskHeader)) { |
1243 | throw new JeecgBootException("合并入库库存失败"); | 1254 | throw new JeecgBootException("合并入库库存失败"); |
1244 | } | 1255 | } |
1245 | if (!receiptDetailService.updateBatchById(receiptDetaiList)) { | 1256 | if (!receiptDetailService.updateBatchById(receiptDetaiList)) { |
@@ -1261,6 +1272,7 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea | @@ -1261,6 +1272,7 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea | ||
1261 | LogRecordContext.putVariable("extraJsonString1", JSON.toJSONString(taskDetailList)); | 1272 | LogRecordContext.putVariable("extraJsonString1", JSON.toJSONString(taskDetailList)); |
1262 | LogRecordContext.putVariable("receiptDetaiList", receiptDetaiList); | 1273 | LogRecordContext.putVariable("receiptDetaiList", receiptDetaiList); |
1263 | LogRecordContext.putVariable("extraJsonString2", JSON.toJSONString(receiptDetaiList)); | 1274 | LogRecordContext.putVariable("extraJsonString2", JSON.toJSONString(receiptDetaiList)); |
1275 | + log.info("完成入库任务, 任务号" + taskHeader.getId()); | ||
1264 | return Result.ok("完成入库任务"); | 1276 | return Result.ok("完成入库任务"); |
1265 | } | 1277 | } |
1266 | 1278 | ||
@@ -1287,7 +1299,7 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea | @@ -1287,7 +1299,7 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea | ||
1287 | String fromLocationCode = taskHeader.getFromLocationCode(); | 1299 | String fromLocationCode = taskHeader.getFromLocationCode(); |
1288 | String toLocationCode = taskHeader.getToLocationCode(); | 1300 | String toLocationCode = taskHeader.getToLocationCode(); |
1289 | String containerCode = taskHeader.getContainerCode(); | 1301 | String containerCode = taskHeader.getContainerCode(); |
1290 | -// String zoneCode = taskHeader.getZoneCode(); | 1302 | + String zoneCode = taskHeader.getZoneCode(); |
1291 | int taskType = taskHeader.getTaskType(); | 1303 | int taskType = taskHeader.getTaskType(); |
1292 | List<TaskDetail> taskDetailList = taskDetailService.getTaskDetailListByTaskId(taskHeader.getId()); | 1304 | List<TaskDetail> taskDetailList = taskDetailService.getTaskDetailListByTaskId(taskHeader.getId()); |
1293 | boolean success = false; | 1305 | boolean success = false; |
@@ -1468,6 +1480,7 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea | @@ -1468,6 +1480,7 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea | ||
1468 | return Result.ok("完成出库任务"); | 1480 | return Result.ok("完成出库任务"); |
1469 | } | 1481 | } |
1470 | 1482 | ||
1483 | + @Override | ||
1471 | @Transactional(rollbackFor = Exception.class) | 1484 | @Transactional(rollbackFor = Exception.class) |
1472 | public boolean combineInventoryDetail(TaskHeader taskHeader) { | 1485 | public boolean combineInventoryDetail(TaskHeader taskHeader) { |
1473 | boolean success = false; | 1486 | boolean success = false; |
@@ -1488,9 +1501,12 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea | @@ -1488,9 +1501,12 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea | ||
1488 | InventoryDetail inventoryDetail2 = inventoryDetailList.get(j); | 1501 | InventoryDetail inventoryDetail2 = inventoryDetailList.get(j); |
1489 | if (inventoryDetail1.getMaterialCode().equals(inventoryDetail2.getMaterialCode()) && inventoryDetail1.getBatch().equals(inventoryDetail2.getBatch()) | 1502 | if (inventoryDetail1.getMaterialCode().equals(inventoryDetail2.getMaterialCode()) && inventoryDetail1.getBatch().equals(inventoryDetail2.getBatch()) |
1490 | && inventoryDetail1.getLot().equals(inventoryDetail2.getLot()) && inventoryDetail1.getProject().equals(inventoryDetail2.getProject())) { | 1503 | && inventoryDetail1.getLot().equals(inventoryDetail2.getLot()) && inventoryDetail1.getProject().equals(inventoryDetail2.getProject())) { |
1504 | + // 属性一样的库存,相加合并。 | ||
1491 | BigDecimal totalQty = inventoryDetail1.getQty().add(inventoryDetail2.getQty()); | 1505 | BigDecimal totalQty = inventoryDetail1.getQty().add(inventoryDetail2.getQty()); |
1492 | - inventoryDetail1.setQty(totalQty); | ||
1493 | - success = inventoryDetailService.updateById(inventoryDetail1); | 1506 | + InventoryDetail inventoryDetail = new InventoryDetail(); |
1507 | + inventoryDetail.setId(inventoryDetail1.getId()); | ||
1508 | + inventoryDetail.setQty(totalQty); | ||
1509 | + success = inventoryDetailService.updateById(inventoryDetail); | ||
1494 | if (!success) { | 1510 | if (!success) { |
1495 | throw new JeecgBootException("合并库存时, 更新库存详情失败:" + inventoryDetail1.getId()); | 1511 | throw new JeecgBootException("合并库存时, 更新库存详情失败:" + inventoryDetail1.getId()); |
1496 | } | 1512 | } |
@@ -1512,6 +1528,9 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea | @@ -1512,6 +1528,9 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea | ||
1512 | if (container == null) { | 1528 | if (container == null) { |
1513 | throw new JeecgBootException("合并库存时, 没有找到容器, 容器编码为" + containerCode); | 1529 | throw new JeecgBootException("合并库存时, 没有找到容器, 容器编码为" + containerCode); |
1514 | } | 1530 | } |
1531 | + int inventoryId = inventoryHeader.getId(); | ||
1532 | + inventoryHeader = new InventoryHeader(); | ||
1533 | + inventoryHeader.setId(inventoryId); | ||
1515 | inventoryHeader.setTotalQty(totalQty); | 1534 | inventoryHeader.setTotalQty(totalQty); |
1516 | inventoryHeader.setTotalLines(totalLines); | 1535 | inventoryHeader.setTotalLines(totalLines); |
1517 | inventoryHeader.setContainerStatus(container.getStatus()); | 1536 | inventoryHeader.setContainerStatus(container.getStatus()); |
@@ -2206,25 +2225,12 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea | @@ -2206,25 +2225,12 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea | ||
2206 | @Override | 2225 | @Override |
2207 | @Transactional(rollbackFor = Exception.class) | 2226 | @Transactional(rollbackFor = Exception.class) |
2208 | public Result cancelReceiptTask(TaskHeader taskHeader) { | 2227 | public Result cancelReceiptTask(TaskHeader taskHeader) { |
2228 | + log.info("开始取消入库任务"); | ||
2209 | boolean success = receiptContainerHeaderService.cancelReceiptTask(taskHeader); | 2229 | boolean success = receiptContainerHeaderService.cancelReceiptTask(taskHeader); |
2210 | if (!success) { | 2230 | if (!success) { |
2211 | throw new JeecgBootException("取消入库任务时, 更新组盘头状态失败"); | 2231 | throw new JeecgBootException("取消入库任务时, 更新组盘头状态失败"); |
2212 | } | 2232 | } |
2213 | - String containerCode = taskHeader.getContainerCode(); | ||
2214 | - String warehouseCode = taskHeader.getWarehouseCode(); | ||
2215 | - ReceiptContainerHeader receiptContainerHeader = receiptContainerHeaderService.getUnCompleteReceiptContainerByCode(containerCode, warehouseCode); | ||
2216 | - String value = parameterConfigurationService.getValueByCode(QuantityConstant.RULE_TASK_LOCATION); | ||
2217 | - if (StringUtils.isEmpty(value)) { | ||
2218 | - throw new JeecgBootException("取消入库任务时, 没有获取到配置属性"); | ||
2219 | - } | ||
2220 | - int taskLocationRule = Integer.parseInt(value); | ||
2221 | - if (taskLocationRule == QuantityConstant.RULE_TASK_NOT_LOCATION) { | ||
2222 | - receiptContainerHeader.setToLocationCode(QuantityConstant.EMPTY_STRING); | ||
2223 | - success = receiptContainerHeaderService.updateById(receiptContainerHeader); | ||
2224 | - if (!success) { | ||
2225 | - throw new JeecgBootException("取消入库任务时, 更新组盘头状态失败!!"); | ||
2226 | - } | ||
2227 | - } | 2233 | + log.info("完成取消入库任务"); |
2228 | return Result.ok("取消入库任务成功"); | 2234 | return Result.ok("取消入库任务成功"); |
2229 | } | 2235 | } |
2230 | 2236 | ||
@@ -2243,6 +2249,15 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea | @@ -2243,6 +2249,15 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea | ||
2243 | return Result.ok("取消出库任务成功"); | 2249 | return Result.ok("取消出库任务成功"); |
2244 | } | 2250 | } |
2245 | 2251 | ||
2252 | + @Override | ||
2253 | + public boolean updateStatusById(int status, int id) { | ||
2254 | + TaskHeader taskHeader = new TaskHeader(); | ||
2255 | + taskHeader.setId(id); | ||
2256 | + taskHeader.setStatus(status); | ||
2257 | + boolean success = taskHeaderService.updateById(taskHeader); | ||
2258 | + return success; | ||
2259 | + } | ||
2260 | + | ||
2246 | /** | 2261 | /** |
2247 | * 取消任务,恢复容器和库位状态 | 2262 | * 取消任务,恢复容器和库位状态 |
2248 | * @param taskHeader | 2263 | * @param taskHeader |
@@ -2277,6 +2292,9 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea | @@ -2277,6 +2292,9 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea | ||
2277 | throw new JeecgBootException("取消任务时, 没有找到容器"); | 2292 | throw new JeecgBootException("取消任务时, 没有找到容器"); |
2278 | } | 2293 | } |
2279 | if (inventoryHeader != null) { | 2294 | if (inventoryHeader != null) { |
2295 | + Integer inventoryHeaderId = inventoryHeader.getId(); | ||
2296 | + inventoryHeader = new InventoryHeader(); | ||
2297 | + inventoryHeader.setId(inventoryHeaderId); | ||
2280 | inventoryHeader.setContainerStatus(QuantityConstant.STATUS_CONTAINER_EMPTY); | 2298 | inventoryHeader.setContainerStatus(QuantityConstant.STATUS_CONTAINER_EMPTY); |
2281 | success = inventoryHeaderService.updateById(inventoryHeader); | 2299 | success = inventoryHeaderService.updateById(inventoryHeader); |
2282 | if (!success) { | 2300 | if (!success) { |