Commit f6706f579860e3608b014096e3df4ada0d3fb7f9
1 parent
7d881f7c
托盘库位service方法优化
Signed-off-by: TanYibin <5491541@qq.com>
Showing
2 changed files
with
72 additions
and
55 deletions
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/config/container/service/impl/ContainerServiceImpl.java
@@ -6,6 +6,7 @@ import java.util.Calendar; | @@ -6,6 +6,7 @@ import java.util.Calendar; | ||
6 | import java.util.List; | 6 | import java.util.List; |
7 | 7 | ||
8 | import javax.annotation.Resource; | 8 | import javax.annotation.Resource; |
9 | +import javax.transaction.Transactional; | ||
9 | 10 | ||
10 | import org.jeecg.common.api.vo.Result; | 11 | import org.jeecg.common.api.vo.Result; |
11 | import org.jeecg.common.exception.JeecgBootException; | 12 | import org.jeecg.common.exception.JeecgBootException; |
@@ -15,6 +16,7 @@ import org.jeecg.modules.wms.config.container.service.IContainerService; | @@ -15,6 +16,7 @@ import org.jeecg.modules.wms.config.container.service.IContainerService; | ||
15 | import org.jeecg.modules.wms.config.containerType.service.IContainerTypeService; | 16 | import org.jeecg.modules.wms.config.containerType.service.IContainerTypeService; |
16 | import org.jeecg.utils.StringUtils; | 17 | import org.jeecg.utils.StringUtils; |
17 | import org.jeecg.utils.constant.QuantityConstant; | 18 | import org.jeecg.utils.constant.QuantityConstant; |
19 | +import org.springframework.beans.factory.annotation.Autowired; | ||
18 | import org.springframework.stereotype.Service; | 20 | import org.springframework.stereotype.Service; |
19 | 21 | ||
20 | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | 22 | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
@@ -33,10 +35,15 @@ public class ContainerServiceImpl extends ServiceImpl<ContainerMapper, Container | @@ -33,10 +35,15 @@ public class ContainerServiceImpl extends ServiceImpl<ContainerMapper, Container | ||
33 | 35 | ||
34 | @Resource | 36 | @Resource |
35 | IContainerTypeService containerTypeService; | 37 | IContainerTypeService containerTypeService; |
38 | + | ||
36 | @Resource | 39 | @Resource |
37 | ContainerMapper containerMapper; | 40 | ContainerMapper containerMapper; |
38 | 41 | ||
42 | + @Autowired | ||
43 | + IContainerService containerService; | ||
44 | + | ||
39 | @Override | 45 | @Override |
46 | + @Transactional | ||
40 | public Result<?> batchAddContainers(Container container, int number) { | 47 | public Result<?> batchAddContainers(Container container, int number) { |
41 | String containerTypeCode = container.getContainerTypeCode(); | 48 | String containerTypeCode = container.getContainerTypeCode(); |
42 | String warehouseCode = container.getWarehouseCode(); | 49 | String warehouseCode = container.getWarehouseCode(); |
@@ -44,16 +51,16 @@ public class ContainerServiceImpl extends ServiceImpl<ContainerMapper, Container | @@ -44,16 +51,16 @@ public class ContainerServiceImpl extends ServiceImpl<ContainerMapper, Container | ||
44 | List<Container> containerList = new ArrayList<>(); | 51 | List<Container> containerList = new ArrayList<>(); |
45 | for (int i = 0; i < number; i++) { | 52 | for (int i = 0; i < number; i++) { |
46 | startNumber++; | 53 | startNumber++; |
47 | - Container container1 = new Container(); | ||
48 | - container1.setContainerTypeCode(containerTypeCode); | 54 | + Container addcontainer = new Container(); |
55 | + addcontainer.setContainerTypeCode(containerTypeCode); | ||
49 | String code = String.format("%s%05d", containerTypeCode, startNumber); | 56 | String code = String.format("%s%05d", containerTypeCode, startNumber); |
50 | - container1.setCode(code); | ||
51 | - container1.setStatus(QuantityConstant.STATUS_CONTAINER_EMPTY); | ||
52 | - container1.setFillStatus(QuantityConstant.STATUS_CONTAINER_FILL_EMPTY); | ||
53 | - container1.setWarehouseCode(warehouseCode); | ||
54 | - containerList.add(container1); | 57 | + addcontainer.setCode(code); |
58 | + addcontainer.setStatus(QuantityConstant.STATUS_CONTAINER_EMPTY); | ||
59 | + addcontainer.setFillStatus(QuantityConstant.STATUS_CONTAINER_FILL_EMPTY); | ||
60 | + addcontainer.setWarehouseCode(warehouseCode); | ||
61 | + containerList.add(addcontainer); | ||
55 | } | 62 | } |
56 | - boolean success = saveBatch(containerList); | 63 | + boolean success = containerService.saveBatch(containerList); |
57 | if (success) { | 64 | if (success) { |
58 | return Result.OK("添加成功!"); | 65 | return Result.OK("添加成功!"); |
59 | } | 66 | } |
@@ -67,19 +74,21 @@ public class ContainerServiceImpl extends ServiceImpl<ContainerMapper, Container | @@ -67,19 +74,21 @@ public class ContainerServiceImpl extends ServiceImpl<ContainerMapper, Container | ||
67 | } | 74 | } |
68 | LambdaQueryWrapper<Container> containerLambdaQueryWrapper = Wrappers.lambdaQuery(); | 75 | LambdaQueryWrapper<Container> containerLambdaQueryWrapper = Wrappers.lambdaQuery(); |
69 | containerLambdaQueryWrapper.eq(Container::getCode, containCode).eq(Container::getWarehouseCode, warehouseCode); | 76 | containerLambdaQueryWrapper.eq(Container::getCode, containCode).eq(Container::getWarehouseCode, warehouseCode); |
70 | - Container container = this.getOne(containerLambdaQueryWrapper); | 77 | + Container container = containerService.getOne(containerLambdaQueryWrapper); |
71 | return container; | 78 | return container; |
72 | } | 79 | } |
73 | 80 | ||
74 | @Override | 81 | @Override |
82 | + @Transactional | ||
75 | public boolean updateStatus(String containerCode, String status, String warehouseCode) { | 83 | public boolean updateStatus(String containerCode, String status, String warehouseCode) { |
76 | LambdaUpdateWrapper<Container> updateWrapper = Wrappers.lambdaUpdate(); | 84 | LambdaUpdateWrapper<Container> updateWrapper = Wrappers.lambdaUpdate(); |
77 | updateWrapper.ne(Container::getStatus, status).eq(Container::getCode, containerCode).eq(Container::getWarehouseCode, warehouseCode).set(Container::getStatus, | 85 | updateWrapper.ne(Container::getStatus, status).eq(Container::getCode, containerCode).eq(Container::getWarehouseCode, warehouseCode).set(Container::getStatus, |
78 | status); | 86 | status); |
79 | - return update(updateWrapper); | 87 | + return containerService.update(updateWrapper); |
80 | } | 88 | } |
81 | 89 | ||
82 | @Override | 90 | @Override |
91 | + @Transactional | ||
83 | public boolean updateLocationCodeAndStatus(String containerCode, String locationCode, String status, String warehouseCode) { | 92 | public boolean updateLocationCodeAndStatus(String containerCode, String locationCode, String status, String warehouseCode) { |
84 | if (StringUtils.isNotEmpty(locationCode)) { | 93 | if (StringUtils.isNotEmpty(locationCode)) { |
85 | LambdaQueryWrapper<Container> containerLambdaQueryWrapper = Wrappers.lambdaQuery(); | 94 | LambdaQueryWrapper<Container> containerLambdaQueryWrapper = Wrappers.lambdaQuery(); |
@@ -93,15 +102,16 @@ public class ContainerServiceImpl extends ServiceImpl<ContainerMapper, Container | @@ -93,15 +102,16 @@ public class ContainerServiceImpl extends ServiceImpl<ContainerMapper, Container | ||
93 | LambdaUpdateWrapper<Container> updateWrapper = Wrappers.lambdaUpdate(); | 102 | LambdaUpdateWrapper<Container> updateWrapper = Wrappers.lambdaUpdate(); |
94 | updateWrapper.ne(Container::getStatus, status).eq(Container::getCode, containerCode).eq(Container::getWarehouseCode, warehouseCode) | 103 | updateWrapper.ne(Container::getStatus, status).eq(Container::getCode, containerCode).eq(Container::getWarehouseCode, warehouseCode) |
95 | .set(Container::getLocationCode, locationCode).set(Container::getStatus, status); | 104 | .set(Container::getLocationCode, locationCode).set(Container::getStatus, status); |
96 | - return update(updateWrapper); | 105 | + return containerService.update(updateWrapper); |
97 | } | 106 | } |
98 | 107 | ||
99 | @Override | 108 | @Override |
109 | + @Transactional | ||
100 | public boolean updateLocationCodeAndStatus(String containerCode, String locationCode, String status, String fillStatus, String warehouseCode) { | 110 | public boolean updateLocationCodeAndStatus(String containerCode, String locationCode, String status, String fillStatus, String warehouseCode) { |
101 | LambdaUpdateWrapper<Container> updateWrapper = Wrappers.lambdaUpdate(); | 111 | LambdaUpdateWrapper<Container> updateWrapper = Wrappers.lambdaUpdate(); |
102 | updateWrapper.ne(Container::getStatus, status).eq(Container::getCode, containerCode).eq(Container::getWarehouseCode, warehouseCode) | 112 | updateWrapper.ne(Container::getStatus, status).eq(Container::getCode, containerCode).eq(Container::getWarehouseCode, warehouseCode) |
103 | .set(Container::getLocationCode, locationCode).set(Container::getStatus, status).set(Container::getFillStatus, fillStatus); | 113 | .set(Container::getLocationCode, locationCode).set(Container::getStatus, status).set(Container::getFillStatus, fillStatus); |
104 | - return update(updateWrapper); | 114 | + return containerService.update(updateWrapper); |
105 | } | 115 | } |
106 | 116 | ||
107 | @Override | 117 | @Override |
@@ -122,16 +132,14 @@ public class ContainerServiceImpl extends ServiceImpl<ContainerMapper, Container | @@ -122,16 +132,14 @@ public class ContainerServiceImpl extends ServiceImpl<ContainerMapper, Container | ||
122 | public List<Container> getContainerListByStatus(String status, String warehouseCode) { | 132 | public List<Container> getContainerListByStatus(String status, String warehouseCode) { |
123 | LambdaQueryWrapper<Container> containerLambdaQueryWrapper = Wrappers.lambdaQuery(); | 133 | LambdaQueryWrapper<Container> containerLambdaQueryWrapper = Wrappers.lambdaQuery(); |
124 | containerLambdaQueryWrapper.eq(Container::getStatus, status).eq(Container::getWarehouseCode, warehouseCode); | 134 | containerLambdaQueryWrapper.eq(Container::getStatus, status).eq(Container::getWarehouseCode, warehouseCode); |
125 | - List<Container> containerList = list(containerLambdaQueryWrapper); | ||
126 | - return containerList; | 135 | + return list(containerLambdaQueryWrapper); |
127 | } | 136 | } |
128 | 137 | ||
129 | @Override | 138 | @Override |
130 | public List<Container> getContainerListByCodeList(List<String> containerCodeList, String warehouseCode) { | 139 | public List<Container> getContainerListByCodeList(List<String> containerCodeList, String warehouseCode) { |
131 | LambdaQueryWrapper<Container> containerLambdaQueryWrapper = Wrappers.lambdaQuery(); | 140 | LambdaQueryWrapper<Container> containerLambdaQueryWrapper = Wrappers.lambdaQuery(); |
132 | containerLambdaQueryWrapper.in(Container::getCode, containerCodeList).eq(Container::getWarehouseCode, warehouseCode); | 141 | containerLambdaQueryWrapper.in(Container::getCode, containerCodeList).eq(Container::getWarehouseCode, warehouseCode); |
133 | - List<Container> containerList = list(containerLambdaQueryWrapper); | ||
134 | - return containerList; | 142 | + return list(containerLambdaQueryWrapper); |
135 | } | 143 | } |
136 | 144 | ||
137 | private int getStartNumber(String containerTypeCode, String warehouseCode) { | 145 | private int getStartNumber(String containerTypeCode, String warehouseCode) { |
@@ -141,11 +149,9 @@ public class ContainerServiceImpl extends ServiceImpl<ContainerMapper, Container | @@ -141,11 +149,9 @@ public class ContainerServiceImpl extends ServiceImpl<ContainerMapper, Container | ||
141 | Container container = this.getOne(containerLambdaQueryWrapper); | 149 | Container container = this.getOne(containerLambdaQueryWrapper); |
142 | // 如果指定类型的最后的code存在,那么 code = 容器类型 + (排序号 + 1) | 150 | // 如果指定类型的最后的code存在,那么 code = 容器类型 + (排序号 + 1) |
143 | if (container != null && container.getCode() != null) { | 151 | if (container != null && container.getCode() != null) { |
144 | - Integer number = Integer.valueOf(container.getCode().substring(container.getCode().length() - 5, container.getCode().length())); | ||
145 | - return number; | ||
146 | - } else { | ||
147 | - return 0; | 152 | + return Integer.valueOf(container.getCode().substring(container.getCode().length() - 5, container.getCode().length())); |
148 | } | 153 | } |
154 | + return 0; | ||
149 | } | 155 | } |
150 | 156 | ||
151 | } | 157 | } |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/config/location/service/impl/LocationServiceImpl.java
1 | package org.jeecg.modules.wms.config.location.service.impl; | 1 | package org.jeecg.modules.wms.config.location.service.impl; |
2 | 2 | ||
3 | import java.text.MessageFormat; | 3 | import java.text.MessageFormat; |
4 | -import java.util.*; | 4 | +import java.util.ArrayList; |
5 | +import java.util.Collections; | ||
6 | +import java.util.Comparator; | ||
7 | +import java.util.HashMap; | ||
8 | +import java.util.HashSet; | ||
9 | +import java.util.List; | ||
10 | +import java.util.Map; | ||
11 | +import java.util.Set; | ||
5 | import java.util.function.Function; | 12 | import java.util.function.Function; |
6 | import java.util.stream.Collectors; | 13 | import java.util.stream.Collectors; |
7 | 14 | ||
@@ -13,7 +20,15 @@ import org.jeecg.common.exception.JeecgBootException; | @@ -13,7 +20,15 @@ import org.jeecg.common.exception.JeecgBootException; | ||
13 | import org.jeecg.modules.wms.config.address.service.IAddressService; | 20 | import org.jeecg.modules.wms.config.address.service.IAddressService; |
14 | import org.jeecg.modules.wms.config.container.entity.Container; | 21 | import org.jeecg.modules.wms.config.container.entity.Container; |
15 | import org.jeecg.modules.wms.config.container.service.IContainerService; | 22 | import org.jeecg.modules.wms.config.container.service.IContainerService; |
16 | -import org.jeecg.modules.wms.config.location.dto.*; | 23 | +import org.jeecg.modules.wms.config.location.dto.CompareContainerTaskDto; |
24 | +import org.jeecg.modules.wms.config.location.dto.CompareLocationDto; | ||
25 | +import org.jeecg.modules.wms.config.location.dto.CompareLocationTaskDto; | ||
26 | +import org.jeecg.modules.wms.config.location.dto.QueryCompareContainerTaskDto; | ||
27 | +import org.jeecg.modules.wms.config.location.dto.QueryCompareLocationDto; | ||
28 | +import org.jeecg.modules.wms.config.location.dto.QueryCompareLocationTaskDto; | ||
29 | +import org.jeecg.modules.wms.config.location.dto.WcsLocationDto; | ||
30 | +import org.jeecg.modules.wms.config.location.dto.WcsResultDto; | ||
31 | +import org.jeecg.modules.wms.config.location.dto.WcsTaskDto; | ||
17 | import org.jeecg.modules.wms.config.location.entity.BatchLocation; | 32 | import org.jeecg.modules.wms.config.location.entity.BatchLocation; |
18 | import org.jeecg.modules.wms.config.location.entity.Location; | 33 | import org.jeecg.modules.wms.config.location.entity.Location; |
19 | import org.jeecg.modules.wms.config.location.entity.LocationInfo; | 34 | import org.jeecg.modules.wms.config.location.entity.LocationInfo; |
@@ -31,6 +46,7 @@ import org.jeecg.utils.OkHttpUtils; | @@ -31,6 +46,7 @@ import org.jeecg.utils.OkHttpUtils; | ||
31 | import org.jeecg.utils.PageUtil; | 46 | import org.jeecg.utils.PageUtil; |
32 | import org.jeecg.utils.StringUtils; | 47 | import org.jeecg.utils.StringUtils; |
33 | import org.jeecg.utils.constant.QuantityConstant; | 48 | import org.jeecg.utils.constant.QuantityConstant; |
49 | +import org.springframework.beans.factory.annotation.Autowired; | ||
34 | import org.springframework.stereotype.Service; | 50 | import org.springframework.stereotype.Service; |
35 | import org.springframework.transaction.annotation.Transactional; | 51 | import org.springframework.transaction.annotation.Transactional; |
36 | 52 | ||
@@ -76,6 +92,9 @@ public class LocationServiceImpl extends ServiceImpl<LocationMapper, Location> i | @@ -76,6 +92,9 @@ public class LocationServiceImpl extends ServiceImpl<LocationMapper, Location> i | ||
76 | 92 | ||
77 | @Resource | 93 | @Resource |
78 | private IInventoryDetailService inventoryDetailService; | 94 | private IInventoryDetailService inventoryDetailService; |
95 | + | ||
96 | + @Autowired | ||
97 | + private ILocationService locationService; | ||
79 | 98 | ||
80 | @Override | 99 | @Override |
81 | public Location getLocationByCode(String locationCode, String warehouseCode) { | 100 | public Location getLocationByCode(String locationCode, String warehouseCode) { |
@@ -85,8 +104,7 @@ public class LocationServiceImpl extends ServiceImpl<LocationMapper, Location> i | @@ -85,8 +104,7 @@ public class LocationServiceImpl extends ServiceImpl<LocationMapper, Location> i | ||
85 | LambdaQueryWrapper<Location> locationLambdaQueryWrapper = Wrappers.lambdaQuery(); | 104 | LambdaQueryWrapper<Location> locationLambdaQueryWrapper = Wrappers.lambdaQuery(); |
86 | locationLambdaQueryWrapper.eq(Location::getCode, locationCode).eq(Location::getEnable, QuantityConstant.STATUS_ENABLE).eq(Location::getWarehouseCode, | 105 | locationLambdaQueryWrapper.eq(Location::getCode, locationCode).eq(Location::getEnable, QuantityConstant.STATUS_ENABLE).eq(Location::getWarehouseCode, |
87 | warehouseCode); | 106 | warehouseCode); |
88 | - Location location = this.getOne(locationLambdaQueryWrapper); | ||
89 | - return location; | 107 | + return locationService.getOne(locationLambdaQueryWrapper); |
90 | } | 108 | } |
91 | 109 | ||
92 | @Override | 110 | @Override |
@@ -94,8 +112,7 @@ public class LocationServiceImpl extends ServiceImpl<LocationMapper, Location> i | @@ -94,8 +112,7 @@ public class LocationServiceImpl extends ServiceImpl<LocationMapper, Location> i | ||
94 | LambdaQueryWrapper<Location> locationLambdaQueryWrapper = Wrappers.lambdaQuery(); | 112 | LambdaQueryWrapper<Location> locationLambdaQueryWrapper = Wrappers.lambdaQuery(); |
95 | locationLambdaQueryWrapper.eq(Location::getRow, row).eq(Location::getIcolumn, column).eq(Location::getLayer, layer) | 113 | locationLambdaQueryWrapper.eq(Location::getRow, row).eq(Location::getIcolumn, column).eq(Location::getLayer, layer) |
96 | .eq(Location::getEnable, QuantityConstant.STATUS_ENABLE).eq(Location::getWarehouseCode, warehouseCode); | 114 | .eq(Location::getEnable, QuantityConstant.STATUS_ENABLE).eq(Location::getWarehouseCode, warehouseCode); |
97 | - Location location = this.getOne(locationLambdaQueryWrapper); | ||
98 | - return location; | 115 | + return locationService.getOne(locationLambdaQueryWrapper); |
99 | } | 116 | } |
100 | 117 | ||
101 | @Override | 118 | @Override |
@@ -103,16 +120,16 @@ public class LocationServiceImpl extends ServiceImpl<LocationMapper, Location> i | @@ -103,16 +120,16 @@ public class LocationServiceImpl extends ServiceImpl<LocationMapper, Location> i | ||
103 | LambdaQueryWrapper<Location> locationLambdaQueryWrapper = Wrappers.lambdaQuery(); | 120 | LambdaQueryWrapper<Location> locationLambdaQueryWrapper = Wrappers.lambdaQuery(); |
104 | locationLambdaQueryWrapper.eq(Location::getZoneCode, zoneCode).eq(Location::getEnable, QuantityConstant.STATUS_ENABLE).eq(Location::getWarehouseCode, | 121 | locationLambdaQueryWrapper.eq(Location::getZoneCode, zoneCode).eq(Location::getEnable, QuantityConstant.STATUS_ENABLE).eq(Location::getWarehouseCode, |
105 | warehouseCode); | 122 | warehouseCode); |
106 | - List<Location> locationList = this.list(locationLambdaQueryWrapper); | ||
107 | - return locationList; | 123 | + return locationService.list(locationLambdaQueryWrapper); |
108 | } | 124 | } |
109 | 125 | ||
110 | @Override | 126 | @Override |
127 | + @Transactional | ||
111 | public boolean updateStatus(String locationCode, String status, String warehouseCode) { | 128 | public boolean updateStatus(String locationCode, String status, String warehouseCode) { |
112 | LambdaUpdateWrapper<Location> updateWrapper = Wrappers.lambdaUpdate(); | 129 | LambdaUpdateWrapper<Location> updateWrapper = Wrappers.lambdaUpdate(); |
113 | updateWrapper.ne(Location::getStatus, status).eq(Location::getCode, locationCode).eq(Location::getWarehouseCode, warehouseCode).set(Location::getStatus, | 130 | updateWrapper.ne(Location::getStatus, status).eq(Location::getCode, locationCode).eq(Location::getWarehouseCode, warehouseCode).set(Location::getStatus, |
114 | status); | 131 | status); |
115 | - return update(updateWrapper); | 132 | + return locationService.update(updateWrapper); |
116 | } | 133 | } |
117 | 134 | ||
118 | /** | 135 | /** |
@@ -120,6 +137,7 @@ public class LocationServiceImpl extends ServiceImpl<LocationMapper, Location> i | @@ -120,6 +137,7 @@ public class LocationServiceImpl extends ServiceImpl<LocationMapper, Location> i | ||
120 | * 更新库位时,先判断库位状态是不一致的才能更新 | 137 | * 更新库位时,先判断库位状态是不一致的才能更新 |
121 | */ | 138 | */ |
122 | @Override | 139 | @Override |
140 | + @Transactional | ||
123 | public boolean updateContainerCodeAndStatus(String locationCode, String containerCode, String status, String warehouseCode) { | 141 | public boolean updateContainerCodeAndStatus(String locationCode, String containerCode, String status, String warehouseCode) { |
124 | if (StringUtils.isNotEmpty(containerCode)) { | 142 | if (StringUtils.isNotEmpty(containerCode)) { |
125 | LambdaQueryWrapper<Location> locationLambdaQueryWrapper = Wrappers.lambdaQuery(); | 143 | LambdaQueryWrapper<Location> locationLambdaQueryWrapper = Wrappers.lambdaQuery(); |
@@ -133,19 +151,19 @@ public class LocationServiceImpl extends ServiceImpl<LocationMapper, Location> i | @@ -133,19 +151,19 @@ public class LocationServiceImpl extends ServiceImpl<LocationMapper, Location> i | ||
133 | LambdaUpdateWrapper<Location> updateWrapper = Wrappers.lambdaUpdate(); | 151 | LambdaUpdateWrapper<Location> updateWrapper = Wrappers.lambdaUpdate(); |
134 | updateWrapper.ne(Location::getStatus, status).eq(Location::getCode, locationCode).eq(Location::getWarehouseCode, warehouseCode) | 152 | updateWrapper.ne(Location::getStatus, status).eq(Location::getCode, locationCode).eq(Location::getWarehouseCode, warehouseCode) |
135 | .set(Location::getContainerCode, containerCode).set(Location::getStatus, status); | 153 | .set(Location::getContainerCode, containerCode).set(Location::getStatus, status); |
136 | - return update(updateWrapper); | 154 | + return locationService.update(updateWrapper); |
137 | } | 155 | } |
138 | 156 | ||
139 | @Override | 157 | @Override |
140 | public Location getNear(Location location) { | 158 | public Location getNear(Location location) { |
141 | int rowFlag = location.getRowFlag(); | 159 | int rowFlag = location.getRowFlag(); |
142 | - Location locaiton1 = null; | 160 | + Location nearlocaiton = null; |
143 | if (rowFlag == 1) { | 161 | if (rowFlag == 1) { |
144 | - locaiton1 = getInsideNear(location); | 162 | + nearlocaiton = getInsideNear(location); |
145 | } else { | 163 | } else { |
146 | - locaiton1 = getOutSideNear(location); | 164 | + nearlocaiton = getOutSideNear(location); |
147 | } | 165 | } |
148 | - return locaiton1; | 166 | + return nearlocaiton; |
149 | } | 167 | } |
150 | 168 | ||
151 | @Override | 169 | @Override |
@@ -155,10 +173,9 @@ public class LocationServiceImpl extends ServiceImpl<LocationMapper, Location> i | @@ -155,10 +173,9 @@ public class LocationServiceImpl extends ServiceImpl<LocationMapper, Location> i | ||
155 | .eq(Location::getRoadWay, location.getRoadWay()).eq(Location::getIcolumn, location.getIcolumn()).eq(Location::getLayer, location.getLayer()) | 173 | .eq(Location::getRoadWay, location.getRoadWay()).eq(Location::getIcolumn, location.getIcolumn()).eq(Location::getLayer, location.getLayer()) |
156 | .eq(Location::getLocationTypeCode, location.getLocationTypeCode()).eq(Location::getRowFlag, QuantityConstant.ROW_IN); | 174 | .eq(Location::getLocationTypeCode, location.getLocationTypeCode()).eq(Location::getRowFlag, QuantityConstant.ROW_IN); |
157 | List<Location> locationList = list(locationLambdaQueryWrapper); | 175 | List<Location> locationList = list(locationLambdaQueryWrapper); |
158 | - for (Location location1 : locationList) { | ||
159 | - int diff = Math.abs(location1.getRow().intValue() - location.getRow().intValue()); | ||
160 | - if (diff == 1) { | ||
161 | - return location1; | 176 | + for (Location insideLocation : locationList) { |
177 | + if (Math.abs(insideLocation.getRow().intValue() - location.getRow().intValue()) == 1) { | ||
178 | + return insideLocation; | ||
162 | } | 179 | } |
163 | } | 180 | } |
164 | return null; | 181 | return null; |
@@ -171,10 +188,9 @@ public class LocationServiceImpl extends ServiceImpl<LocationMapper, Location> i | @@ -171,10 +188,9 @@ public class LocationServiceImpl extends ServiceImpl<LocationMapper, Location> i | ||
171 | .eq(Location::getRoadWay, location.getRoadWay()).eq(Location::getIcolumn, location.getIcolumn()).eq(Location::getLayer, location.getLayer()) | 188 | .eq(Location::getRoadWay, location.getRoadWay()).eq(Location::getIcolumn, location.getIcolumn()).eq(Location::getLayer, location.getLayer()) |
172 | .eq(Location::getLocationTypeCode, location.getLocationTypeCode()).eq(Location::getRowFlag, QuantityConstant.ROW_OUT); | 189 | .eq(Location::getLocationTypeCode, location.getLocationTypeCode()).eq(Location::getRowFlag, QuantityConstant.ROW_OUT); |
173 | List<Location> locationList = list(locationLambdaQueryWrapper); | 190 | List<Location> locationList = list(locationLambdaQueryWrapper); |
174 | - for (Location location1 : locationList) { | ||
175 | - int diff = Math.abs(location1.getRow().intValue() - location.getRow().intValue()); | ||
176 | - if (diff == 1) { | ||
177 | - return location1; | 191 | + for (Location outSideLocation : locationList) { |
192 | + if (Math.abs(outSideLocation.getRow().intValue() - location.getRow().intValue()) == 1) { | ||
193 | + return outSideLocation; | ||
178 | } | 194 | } |
179 | } | 195 | } |
180 | return null; | 196 | return null; |
@@ -182,11 +198,11 @@ public class LocationServiceImpl extends ServiceImpl<LocationMapper, Location> i | @@ -182,11 +198,11 @@ public class LocationServiceImpl extends ServiceImpl<LocationMapper, Location> i | ||
182 | 198 | ||
183 | @Override | 199 | @Override |
184 | public Location getEmptyLocation(Location location) { | 200 | public Location getEmptyLocation(Location location) { |
185 | - Location location1 = getEmptyOutSideLocation(location); | ||
186 | - if (location1 == null) { | ||
187 | - location1 = getEmptyInsideLocation(location); | 201 | + Location emptyLocation = getEmptyOutSideLocation(location); |
202 | + if (emptyLocation == null) { | ||
203 | + emptyLocation = getEmptyInsideLocation(location); | ||
188 | } | 204 | } |
189 | - return location1; | 205 | + return emptyLocation; |
190 | } | 206 | } |
191 | 207 | ||
192 | @Override | 208 | @Override |
@@ -194,8 +210,7 @@ public class LocationServiceImpl extends ServiceImpl<LocationMapper, Location> i | @@ -194,8 +210,7 @@ public class LocationServiceImpl extends ServiceImpl<LocationMapper, Location> i | ||
194 | LambdaQueryWrapper<Location> locationLambdaQueryWrapper = Wrappers.lambdaQuery(); | 210 | LambdaQueryWrapper<Location> locationLambdaQueryWrapper = Wrappers.lambdaQuery(); |
195 | locationLambdaQueryWrapper.eq(Location::getRoadWay, roadWay).eq(Location::getWarehouseCode, warehouseCode) | 211 | locationLambdaQueryWrapper.eq(Location::getRoadWay, roadWay).eq(Location::getWarehouseCode, warehouseCode) |
196 | .eq(Location::getStatus, QuantityConstant.STATUS_LOCATION_EMPTY).eq(Location::getContainerCode, QuantityConstant.EMPTY_STRING); | 212 | .eq(Location::getStatus, QuantityConstant.STATUS_LOCATION_EMPTY).eq(Location::getContainerCode, QuantityConstant.EMPTY_STRING); |
197 | - int count = count(locationLambdaQueryWrapper); | ||
198 | - return count; | 213 | + return locationService.count(locationLambdaQueryWrapper); |
199 | } | 214 | } |
200 | 215 | ||
201 | @Override | 216 | @Override |
@@ -231,8 +246,7 @@ public class LocationServiceImpl extends ServiceImpl<LocationMapper, Location> i | @@ -231,8 +246,7 @@ public class LocationServiceImpl extends ServiceImpl<LocationMapper, Location> i | ||
231 | if (locationList == null || locationList.size() <= 0) { | 246 | if (locationList == null || locationList.size() <= 0) { |
232 | return null; | 247 | return null; |
233 | } | 248 | } |
234 | - Location location1 = locationList.get(0); | ||
235 | - return location1; | 249 | + return locationList.get(0); |
236 | } | 250 | } |
237 | 251 | ||
238 | @Override | 252 | @Override |
@@ -271,8 +285,7 @@ public class LocationServiceImpl extends ServiceImpl<LocationMapper, Location> i | @@ -271,8 +285,7 @@ public class LocationServiceImpl extends ServiceImpl<LocationMapper, Location> i | ||
271 | if (locationList == null || locationList.size() <= 0) { | 285 | if (locationList == null || locationList.size() <= 0) { |
272 | return null; | 286 | return null; |
273 | } | 287 | } |
274 | - Location location1 = locationList.get(0); | ||
275 | - return location1; | 288 | + return locationList.get(0); |
276 | } | 289 | } |
277 | 290 | ||
278 | @Override | 291 | @Override |
@@ -365,9 +378,7 @@ public class LocationServiceImpl extends ServiceImpl<LocationMapper, Location> i | @@ -365,9 +378,7 @@ public class LocationServiceImpl extends ServiceImpl<LocationMapper, Location> i | ||
365 | } | 378 | } |
366 | } | 379 | } |
367 | } | 380 | } |
368 | - | ||
369 | - boolean success = saveBatch(locationList); | ||
370 | - if (!success) { | 381 | + if (!locationService.saveBatch(locationList)) { |
371 | throw new JeecgBootException("批量增加库位失败"); | 382 | throw new JeecgBootException("批量增加库位失败"); |
372 | } | 383 | } |
373 | return Result.ok("批量增加库位成功"); | 384 | return Result.ok("批量增加库位成功"); |