Commit edb4846f4d3cf72981f83983973ed0c6ae376d93
1 parent
81cf11ad
1. 生成任务,库存容器锁定
Showing
8 changed files
with
63 additions
and
32 deletions
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/config/container/service/IContainerService.java
@@ -33,7 +33,7 @@ public interface IContainerService extends IService<Container> { | @@ -33,7 +33,7 @@ public interface IContainerService extends IService<Container> { | ||
33 | /** | 33 | /** |
34 | * 判断系统是否已经有同样的库位号,如果有证明数据混乱了 | 34 | * 判断系统是否已经有同样的库位号,如果有证明数据混乱了 |
35 | */ | 35 | */ |
36 | - boolean havaLocationCodeByContainer(String locationCode, String warehouseCode); | 36 | + boolean havaLocationCodeByContainer(String locationCode, String containerCode, String warehouseCode); |
37 | 37 | ||
38 | List<Container> getContainerListByCodeList(List<String> containCodeList, String warehouseCode); | 38 | List<Container> getContainerListByCodeList(List<String> containCodeList, String warehouseCode); |
39 | } | 39 | } |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/config/container/service/impl/ContainerServiceImpl.java
@@ -100,7 +100,7 @@ public class ContainerServiceImpl extends ServiceImpl<ContainerMapper, Container | @@ -100,7 +100,7 @@ public class ContainerServiceImpl extends ServiceImpl<ContainerMapper, Container | ||
100 | } | 100 | } |
101 | boolean success = false; | 101 | boolean success = false; |
102 | if (StringUtils.isNotEmpty(locationCode)) { | 102 | if (StringUtils.isNotEmpty(locationCode)) { |
103 | - success = havaLocationCodeByContainer(locationCode, warehouseCode); | 103 | + success = havaLocationCodeByContainer(locationCode, containerCode, warehouseCode); |
104 | if (success) { | 104 | if (success) { |
105 | throw new JeecgBootException("容器表已经存在这个库位号,不能再写入"); | 105 | throw new JeecgBootException("容器表已经存在这个库位号,不能再写入"); |
106 | } | 106 | } |
@@ -133,9 +133,10 @@ public class ContainerServiceImpl extends ServiceImpl<ContainerMapper, Container | @@ -133,9 +133,10 @@ public class ContainerServiceImpl extends ServiceImpl<ContainerMapper, Container | ||
133 | } | 133 | } |
134 | 134 | ||
135 | @Override | 135 | @Override |
136 | - public boolean havaLocationCodeByContainer(String locationCode, String warehouseCode) { | 136 | + public boolean havaLocationCodeByContainer(String locationCode, String containerCode, String warehouseCode) { |
137 | LambdaQueryWrapper<Container> containerLambdaQueryWrapper = Wrappers.lambdaQuery(); | 137 | LambdaQueryWrapper<Container> containerLambdaQueryWrapper = Wrappers.lambdaQuery(); |
138 | - containerLambdaQueryWrapper.eq(Container::getLocationCode, locationCode).eq(Container::getWarehouseCode, warehouseCode); | 138 | + containerLambdaQueryWrapper.eq(Container::getLocationCode, locationCode).ne(Container::getCode, containerCode).eq(Container::getWarehouseCode, |
139 | + warehouseCode); | ||
139 | Container container = getOne(containerLambdaQueryWrapper); | 140 | Container container = getOne(containerLambdaQueryWrapper); |
140 | if (container == null) { | 141 | if (container == null) { |
141 | return false; | 142 | return false; |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/config/location/service/ILocationService.java
@@ -54,7 +54,7 @@ public interface ILocationService extends IService<Location> { | @@ -54,7 +54,7 @@ public interface ILocationService extends IService<Location> { | ||
54 | /** | 54 | /** |
55 | * 判断系统是否已经有同样的托盘号,如果有证明数据混乱了 | 55 | * 判断系统是否已经有同样的托盘号,如果有证明数据混乱了 |
56 | */ | 56 | */ |
57 | - boolean havaContainerCodeInLocation(String containerCode, String warehouseCode); | 57 | + boolean havaContainerCodeInLocation(String containerCode, String locationCode, String warehouseCode); |
58 | 58 | ||
59 | List<Location> getContainerInLocation(String containerCode, String containerStatus, String locationCode, String warehouseCode); | 59 | List<Location> getContainerInLocation(String containerCode, String containerStatus, String locationCode, String warehouseCode); |
60 | 60 |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/config/location/service/impl/LocationServiceImpl.java
@@ -114,7 +114,7 @@ public class LocationServiceImpl extends ServiceImpl<LocationMapper, Location> i | @@ -114,7 +114,7 @@ public class LocationServiceImpl extends ServiceImpl<LocationMapper, Location> i | ||
114 | boolean success = false; | 114 | boolean success = false; |
115 | // 如果这个托盘号已经在库位表里,那么不能再写入 | 115 | // 如果这个托盘号已经在库位表里,那么不能再写入 |
116 | if (StringUtils.isNotEmpty(containerCode)) { | 116 | if (StringUtils.isNotEmpty(containerCode)) { |
117 | - success = havaContainerCodeInLocation(containerCode, warehouseCode); | 117 | + success = havaContainerCodeInLocation(containerCode, locationCode, warehouseCode); |
118 | if (success) { | 118 | if (success) { |
119 | throw new JeecgBootException("库位表已经存在这个容器号,不能再写入"); | 119 | throw new JeecgBootException("库位表已经存在这个容器号,不能再写入"); |
120 | } | 120 | } |
@@ -359,9 +359,9 @@ public class LocationServiceImpl extends ServiceImpl<LocationMapper, Location> i | @@ -359,9 +359,9 @@ public class LocationServiceImpl extends ServiceImpl<LocationMapper, Location> i | ||
359 | } | 359 | } |
360 | 360 | ||
361 | @Override | 361 | @Override |
362 | - public boolean havaContainerCodeInLocation(String containerCode, String warehouseCode) { | 362 | + public boolean havaContainerCodeInLocation(String containerCode, String locationCode, String warehouseCode) { |
363 | LambdaQueryWrapper<Location> locationLambdaQueryWrapper = Wrappers.lambdaQuery(); | 363 | LambdaQueryWrapper<Location> locationLambdaQueryWrapper = Wrappers.lambdaQuery(); |
364 | - locationLambdaQueryWrapper.eq(Location::getContainerCode, containerCode).eq(Location::getWarehouseCode, warehouseCode); | 364 | + locationLambdaQueryWrapper.eq(Location::getContainerCode, containerCode).ne(Location::getCode, locationCode).eq(Location::getWarehouseCode, warehouseCode); |
365 | Location location = getOne(locationLambdaQueryWrapper); | 365 | Location location = getOne(locationLambdaQueryWrapper); |
366 | if (location == null) { | 366 | if (location == null) { |
367 | return false; | 367 | return false; |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/inventory/inventoryHeader/service/IInventoryHeaderService.java
1 | package org.jeecg.modules.wms.inventory.inventoryHeader.service; | 1 | package org.jeecg.modules.wms.inventory.inventoryHeader.service; |
2 | 2 | ||
3 | -import com.alipay.api.domain.Inventory; | ||
4 | -import com.baomidou.mybatisplus.extension.service.IService; | ||
5 | -import org.jeecg.modules.wms.inventory.inventoryHeader.entity.InventoryHeader; | ||
6 | -import org.springframework.beans.factory.annotation.Autowired; | ||
7 | import java.io.Serializable; | 3 | import java.io.Serializable; |
8 | import java.util.Collection; | 4 | import java.util.Collection; |
9 | -import java.util.List; | 5 | + |
6 | +import org.jeecg.modules.wms.inventory.inventoryHeader.entity.InventoryHeader; | ||
7 | + | ||
8 | +import com.baomidou.mybatisplus.extension.service.IService; | ||
10 | 9 | ||
11 | /** | 10 | /** |
12 | * @Description: 库存表 | 11 | * @Description: 库存表 |
@@ -27,4 +26,6 @@ public interface IInventoryHeaderService extends IService<InventoryHeader> { | @@ -27,4 +26,6 @@ public interface IInventoryHeaderService extends IService<InventoryHeader> { | ||
27 | public void delBatchMain(Collection<? extends Serializable> idList); | 26 | public void delBatchMain(Collection<? extends Serializable> idList); |
28 | 27 | ||
29 | InventoryHeader getInventoryHeaderByContainerCode(String containerCode, String warehouseCode); | 28 | InventoryHeader getInventoryHeaderByContainerCode(String containerCode, String warehouseCode); |
29 | + | ||
30 | + boolean updateInventoryContainerStatusByContainerCode(String containerCode, String warehouseCode); | ||
30 | } | 31 | } |
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 com.alipay.api.domain.Inventory; | ||
4 | -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | ||
5 | -import com.baomidou.mybatisplus.core.toolkit.Wrappers; | 3 | +import java.io.Serializable; |
4 | +import java.util.Collection; | ||
5 | + | ||
6 | +import javax.annotation.Resource; | ||
7 | + | ||
8 | +import org.jeecg.modules.wms.config.container.entity.Container; | ||
9 | +import org.jeecg.modules.wms.config.container.service.IContainerService; | ||
6 | import org.jeecg.modules.wms.inventory.inventoryHeader.entity.InventoryHeader; | 10 | import org.jeecg.modules.wms.inventory.inventoryHeader.entity.InventoryHeader; |
7 | import org.jeecg.modules.wms.inventory.inventoryHeader.mapper.InventoryDetailMapper; | 11 | import org.jeecg.modules.wms.inventory.inventoryHeader.mapper.InventoryDetailMapper; |
8 | import org.jeecg.modules.wms.inventory.inventoryHeader.mapper.InventoryHeaderMapper; | 12 | import org.jeecg.modules.wms.inventory.inventoryHeader.mapper.InventoryHeaderMapper; |
9 | import org.jeecg.modules.wms.inventory.inventoryHeader.service.IInventoryHeaderService; | 13 | import org.jeecg.modules.wms.inventory.inventoryHeader.service.IInventoryHeaderService; |
10 | -import org.springframework.stereotype.Service; | ||
11 | -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | ||
12 | import org.springframework.beans.factory.annotation.Autowired; | 14 | import org.springframework.beans.factory.annotation.Autowired; |
15 | +import org.springframework.stereotype.Service; | ||
13 | import org.springframework.transaction.annotation.Transactional; | 16 | import org.springframework.transaction.annotation.Transactional; |
14 | -import java.io.Serializable; | ||
15 | -import java.lang.ref.WeakReference; | ||
16 | -import java.util.List; | ||
17 | -import java.util.Collection; | 17 | + |
18 | +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | ||
19 | +import com.baomidou.mybatisplus.core.toolkit.Wrappers; | ||
20 | +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | ||
18 | 21 | ||
19 | /** | 22 | /** |
20 | * @Description: 库存表 | 23 | * @Description: 库存表 |
@@ -29,6 +32,10 @@ public class InventoryHeaderServiceImpl extends ServiceImpl<InventoryHeaderMappe | @@ -29,6 +32,10 @@ public class InventoryHeaderServiceImpl extends ServiceImpl<InventoryHeaderMappe | ||
29 | private InventoryHeaderMapper inventoryHeaderMapper; | 32 | private InventoryHeaderMapper inventoryHeaderMapper; |
30 | @Autowired | 33 | @Autowired |
31 | private InventoryDetailMapper inventoryDetailMapper; | 34 | private InventoryDetailMapper inventoryDetailMapper; |
35 | + @Resource | ||
36 | + private IContainerService containerService; | ||
37 | + @Resource | ||
38 | + private IInventoryHeaderService inventoryHeaderService; | ||
32 | 39 | ||
33 | @Override | 40 | @Override |
34 | @Transactional | 41 | @Transactional |
@@ -54,4 +61,19 @@ public class InventoryHeaderServiceImpl extends ServiceImpl<InventoryHeaderMappe | @@ -54,4 +61,19 @@ public class InventoryHeaderServiceImpl extends ServiceImpl<InventoryHeaderMappe | ||
54 | return inventoryHeader; | 61 | return inventoryHeader; |
55 | } | 62 | } |
56 | 63 | ||
64 | + @Override | ||
65 | + public boolean updateInventoryContainerStatusByContainerCode(String containerCode, String warehouseCode) { | ||
66 | + Container container = containerService.getContainerByCode(containerCode, warehouseCode); | ||
67 | + if (container == null) { | ||
68 | + return false; | ||
69 | + } | ||
70 | + InventoryHeader inventoryHeader = inventoryHeaderService.getInventoryHeaderByContainerCode(containerCode, warehouseCode); | ||
71 | + if (inventoryHeader != null) { | ||
72 | + inventoryHeader.setContainerStatus(container.getStatus()); | ||
73 | + boolean success = inventoryHeaderService.updateById(inventoryHeader); | ||
74 | + return success; | ||
75 | + } | ||
76 | + return false; | ||
77 | + } | ||
78 | + | ||
57 | } | 79 | } |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/receipt/receiptContainerHeader/service/impl/ReceiptContainerHeaderServiceImpl.java
@@ -9,10 +9,12 @@ import java.util.stream.Collectors; | @@ -9,10 +9,12 @@ 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.config.container.entity.Container; | 13 | import org.jeecg.modules.wms.config.container.entity.Container; |
13 | import org.jeecg.modules.wms.config.container.service.IContainerService; | 14 | import org.jeecg.modules.wms.config.container.service.IContainerService; |
14 | import org.jeecg.modules.wms.config.location.entity.Location; | 15 | import org.jeecg.modules.wms.config.location.entity.Location; |
15 | 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.inventory.inventoryHeader.service.IInventoryHeaderService; | ||
16 | import org.jeecg.modules.wms.receipt.receiptContainerHeader.entity.ReceiptContainerDetail; | 18 | import org.jeecg.modules.wms.receipt.receiptContainerHeader.entity.ReceiptContainerDetail; |
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.mapper.ReceiptContainerDetailMapper; | 20 | import org.jeecg.modules.wms.receipt.receiptContainerHeader.mapper.ReceiptContainerDetailMapper; |
@@ -33,7 +35,6 @@ import org.springframework.stereotype.Service; | @@ -33,7 +35,6 @@ import org.springframework.stereotype.Service; | ||
33 | import org.springframework.transaction.annotation.Transactional; | 35 | import org.springframework.transaction.annotation.Transactional; |
34 | 36 | ||
35 | import com.alibaba.fastjson.JSON; | 37 | import com.alibaba.fastjson.JSON; |
36 | -import org.jeecg.common.exception.JeecgBootException; | ||
37 | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | 38 | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
38 | import com.baomidou.mybatisplus.core.toolkit.Wrappers; | 39 | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
39 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | 40 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
@@ -70,6 +71,8 @@ public class ReceiptContainerHeaderServiceImpl extends ServiceImpl<ReceiptContai | @@ -70,6 +71,8 @@ public class ReceiptContainerHeaderServiceImpl extends ServiceImpl<ReceiptContai | ||
70 | private IReceiptDetailService receiptDetailService; | 71 | private IReceiptDetailService receiptDetailService; |
71 | @Resource | 72 | @Resource |
72 | private IReceiptHeaderService receiptHeaderService; | 73 | private IReceiptHeaderService receiptHeaderService; |
74 | + @Resource | ||
75 | + private IInventoryHeaderService inventoryHeaderService; | ||
73 | 76 | ||
74 | @Override | 77 | @Override |
75 | @Transactional | 78 | @Transactional |
@@ -208,6 +211,12 @@ public class ReceiptContainerHeaderServiceImpl extends ServiceImpl<ReceiptContai | @@ -208,6 +211,12 @@ public class ReceiptContainerHeaderServiceImpl extends ServiceImpl<ReceiptContai | ||
208 | if (!success) { | 211 | if (!success) { |
209 | throw new JeecgBootException("生成任务时,更新入库组盘头失败"); | 212 | throw new JeecgBootException("生成任务时,更新入库组盘头失败"); |
210 | } | 213 | } |
214 | + if (receiptContainerHeader.getTaskType() == QuantityConstant.TASK_TYPE_SUPPLEMENTRECEIPT) { | ||
215 | + success = inventoryHeaderService.updateInventoryContainerStatusByContainerCode(containerCode, warehouseCode); | ||
216 | + if (!success) { | ||
217 | + throw new JeecgBootException("生成任务时, 更新库存头失败"); | ||
218 | + } | ||
219 | + } | ||
211 | success = receiptDetailService.updateBatchById(receiptDetailList); | 220 | success = receiptDetailService.updateBatchById(receiptDetailList); |
212 | if (!success) { | 221 | if (!success) { |
213 | throw new JeecgBootException("更新入库单明细失败"); | 222 | throw new JeecgBootException("更新入库单明细失败"); |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/shipment/shipmentCombination/service/impl/ShipmentCombinationServiceImpl.java
@@ -15,7 +15,6 @@ import org.jeecg.modules.wms.config.material.entity.Material; | @@ -15,7 +15,6 @@ import org.jeecg.modules.wms.config.material.entity.Material; | ||
15 | import org.jeecg.modules.wms.config.material.service.IMaterialService; | 15 | import org.jeecg.modules.wms.config.material.service.IMaterialService; |
16 | import org.jeecg.modules.wms.config.parameterConfiguration.service.IParameterConfigurationService; | 16 | import org.jeecg.modules.wms.config.parameterConfiguration.service.IParameterConfigurationService; |
17 | import org.jeecg.modules.wms.inventory.inventoryHeader.entity.InventoryDetail; | 17 | import org.jeecg.modules.wms.inventory.inventoryHeader.entity.InventoryDetail; |
18 | -import org.jeecg.modules.wms.inventory.inventoryHeader.entity.InventoryHeader; | ||
19 | import org.jeecg.modules.wms.inventory.inventoryHeader.service.IInventoryDetailService; | 18 | import org.jeecg.modules.wms.inventory.inventoryHeader.service.IInventoryDetailService; |
20 | import org.jeecg.modules.wms.inventory.inventoryHeader.service.IInventoryHeaderService; | 19 | import org.jeecg.modules.wms.inventory.inventoryHeader.service.IInventoryHeaderService; |
21 | import org.jeecg.modules.wms.receipt.receiptContainerHeader.entity.ReceiptContainerHeader; | 20 | import org.jeecg.modules.wms.receipt.receiptContainerHeader.entity.ReceiptContainerHeader; |
@@ -41,6 +40,7 @@ import org.springframework.stereotype.Service; | @@ -41,6 +40,7 @@ import org.springframework.stereotype.Service; | ||
41 | import org.springframework.transaction.annotation.Transactional; | 40 | import org.springframework.transaction.annotation.Transactional; |
42 | 41 | ||
43 | import com.alibaba.fastjson.JSON; | 42 | import com.alibaba.fastjson.JSON; |
43 | +import com.aliyun.oss.ServiceException; | ||
44 | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | 44 | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
45 | import com.baomidou.mybatisplus.core.toolkit.Wrappers; | 45 | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
46 | 46 | ||
@@ -342,7 +342,9 @@ public class ShipmentCombinationServiceImpl implements IShipmentCombinationServi | @@ -342,7 +342,9 @@ public class ShipmentCombinationServiceImpl implements IShipmentCombinationServi | ||
342 | if (shipmentContainerHeader != null) { | 342 | if (shipmentContainerHeader != null) { |
343 | if (taskType != shipmentContainerHeader.getTaskType()) { | 343 | if (taskType != shipmentContainerHeader.getTaskType()) { |
344 | shipmentContainerHeader.setTaskType(taskType); | 344 | shipmentContainerHeader.setTaskType(taskType); |
345 | - shipmentContainerHeaderService.updateById(shipmentContainerHeader); | 345 | + if (!shipmentContainerHeaderService.updateById(shipmentContainerHeader)) { |
346 | + throw new ServiceException("更新出库组盘头任务类型失败"); | ||
347 | + } | ||
346 | } | 348 | } |
347 | } else { | 349 | } else { |
348 | shipmentContainerHeader = new ShipmentContainerHeader(); | 350 | shipmentContainerHeader = new ShipmentContainerHeader(); |
@@ -560,13 +562,9 @@ public class ShipmentCombinationServiceImpl implements IShipmentCombinationServi | @@ -560,13 +562,9 @@ public class ShipmentCombinationServiceImpl implements IShipmentCombinationServi | ||
560 | if (!success) { | 562 | if (!success) { |
561 | throw new JeecgBootException("生成出库任务时, 更新出库组盘头失败"); | 563 | throw new JeecgBootException("生成出库任务时, 更新出库组盘头失败"); |
562 | } | 564 | } |
563 | - InventoryHeader inventoryHeader = inventoryHeaderService.getInventoryHeaderByContainerCode(containerCode, warehouseCode); | ||
564 | - if (inventoryHeader != null) { | ||
565 | - inventoryHeader.setContainerStatus(container.getStatus()); | ||
566 | - success = inventoryHeaderService.updateById(inventoryHeader); | ||
567 | - if (!success) { | ||
568 | - throw new JeecgBootException("生成出库任务时, 更新库存头失败"); | ||
569 | - } | 565 | + success = inventoryHeaderService.updateInventoryContainerStatusByContainerCode(containerCode, warehouseCode); |
566 | + if (!success) { | ||
567 | + throw new JeecgBootException("生成出库任务时, 更新库存头失败"); | ||
570 | } | 568 | } |
571 | LogRecordContext.putVariable("taskHeader", taskHeader);// 操作日志收集 | 569 | LogRecordContext.putVariable("taskHeader", taskHeader);// 操作日志收集 |
572 | LogRecordContext.putVariable("shipmentContainerDetailList", shipmentContainerDetailList);// 操作日志收集 | 570 | LogRecordContext.putVariable("shipmentContainerDetailList", shipmentContainerDetailList);// 操作日志收集 |