Commit f7e98874253bb05e3edb83c535eac2e048848f4c
1 parent
0fb2fcb5
feat:生成移库任务获取目标库位用库位分配方法
Showing
12 changed files
with
99 additions
and
110 deletions
src/main/java/com/huaheng/api/wcs/service/overrideHandle/OverrideHandleServiceImpl.java
... | ... | @@ -87,14 +87,11 @@ public class OverrideHandleServiceImpl implements OverrideHandleService { |
87 | 87 | @Override |
88 | 88 | @Transactional |
89 | 89 | public AjaxResult OverrideHandle(TaskFinishDomain taskFinishDomain) { |
90 | - | |
91 | 90 | String taskNo = taskFinishDomain.getTaskNo(); |
92 | - | |
93 | 91 | //1、判断非空字段 |
94 | 92 | if (StringUtils.isEmpty(taskNo)) { |
95 | 93 | return AjaxResult.error("任务号为空"); |
96 | 94 | } |
97 | - | |
98 | 95 | //2、根据任务号查找任务 |
99 | 96 | TaskHeader taskHeader = taskHeaderService.getById(taskNo); |
100 | 97 | if (taskHeader == null) { |
... | ... | @@ -105,45 +102,20 @@ public class OverrideHandleServiceImpl implements OverrideHandleService { |
105 | 102 | if (status == QuantityConstant.TASK_STATUS_COMPLETED) { |
106 | 103 | return AjaxResult.error("任务已完成"); |
107 | 104 | } |
108 | - | |
109 | 105 | //3、修改任务目的库位,修改入库组盘的库位,修改库位状态 |
110 | 106 | //修改原来目的库位的状态 |
111 | - LambdaQueryWrapper<Location> locationLam = Wrappers.lambdaQuery(); | |
112 | - locationLam.eq(Location::getCode, taskHeader.getToLocation()) | |
113 | - .eq(Location::getWarehouseCode, warehouseCode); | |
114 | - Location location = locationService.getOne(locationLam); | |
107 | + Location location = locationService.getLocationByCode(taskHeader.getToLocation()); | |
115 | 108 | if (location == null) { |
116 | 109 | return AjaxResult.error("此任务的原目的库位在系统中不存在"); |
117 | 110 | } |
118 | - /** | |
119 | - * 重入的库位由wms提供 | |
120 | - */ | |
121 | - String newLocationCode = null; | |
111 | + String newLocationCode; | |
122 | 112 | //重入的库位由wms提供 |
123 | 113 | //查询任务明细 |
124 | - String value = configService.getKey(QuantityConstant.RULE_ALLOCATION); | |
125 | - if (StringUtils.isEmpty(value)) { | |
126 | - return AjaxResult.error("未绑定定位规则"); | |
127 | - } | |
128 | - int allocationRule = Integer.parseInt(value); | |
129 | - List<String> locationTypeCodeList = new ArrayList<>(); | |
130 | - String locationType = location.getLocationType(); | |
131 | - if (StringUtils.isNotEmpty(locationType)) { | |
132 | - locationTypeCodeList.add(locationType); | |
133 | - } | |
134 | 114 | int high = location.getHigh(); |
135 | 115 | String area = location.getArea(); |
136 | 116 | String roadWay = location.getRoadway(); |
137 | - List<String> roadWays = new ArrayList<>(); | |
138 | - roadWays.add(roadWay); | |
139 | 117 | String containerCode = taskHeader.getContainerCode(); |
140 | 118 | List<TaskDetail> taskDetailList = taskDetailService.findByTaskId(taskHeader.getId()); |
141 | - String materialAreaCode = null; | |
142 | - if (taskDetailList != null && taskDetailList.size() > 0) { | |
143 | - String materialCode = taskDetailList.get(0).getMaterialCode(); | |
144 | - Material material = materialService.getMaterialByCode(materialCode, warehouseCode); | |
145 | - materialAreaCode = material.getMaterialAreaCode(); | |
146 | - } | |
147 | 119 | //是空托盘任务,值为1 |
148 | 120 | int taskType = taskHeader.getTaskType(); |
149 | 121 | int onlyEmptyContainer = 0; |
... | ... | @@ -164,7 +136,7 @@ public class OverrideHandleServiceImpl implements OverrideHandleService { |
164 | 136 | |
165 | 137 | int isSelfCreated = 0; |
166 | 138 | //是否自建单据库位 |
167 | - if (!taskDetailList.isEmpty()) { | |
139 | + if (taskDetailList != null && !taskDetailList.isEmpty()) { | |
168 | 140 | String materialCode = taskDetailList.get(0).getMaterialCode(); |
169 | 141 | Material material = materialService.getMaterialByCode(materialCode, "CS0001"); |
170 | 142 | if (material == null) { |
... | ... | @@ -175,34 +147,32 @@ public class OverrideHandleServiceImpl implements OverrideHandleService { |
175 | 147 | } |
176 | 148 | } |
177 | 149 | |
178 | - String locationCode = locationAllocationService.allocation(allocationRule, | |
179 | - locationTypeCodeList, high, area, roadWays, warehouseCode, containerCode, | |
180 | - materialAreaCode, frequencyLocation, onlyEmptyContainer, isSelfCreated, isFlammable); | |
150 | + String locationCode = locationAllocationService.allocation(high, area, roadWay, containerCode, frequencyLocation, onlyEmptyContainer, isSelfCreated, isFlammable); | |
181 | 151 | if (StringUtils.isEmpty(locationCode)) { |
182 | 152 | return AjaxResult.error("没有库位可分配"); |
183 | 153 | } |
184 | 154 | |
185 | - if (taskType == QuantityConstant.TASK_TYPE_WHOLERECEIPT || | |
186 | - taskType == QuantityConstant.TASK_TYPE_SUPPLEMENTRECEIPT) { | |
155 | + //入库 | |
156 | + if (taskType == QuantityConstant.TASK_TYPE_WHOLERECEIPT || taskType == QuantityConstant.TASK_TYPE_SUPPLEMENTRECEIPT) { | |
187 | 157 | //查询入库组盘明细 |
188 | 158 | List<ReceiptContainerDetail> receiptContainerDetailList = new ArrayList<>(); |
189 | 159 | if (taskDetailList != null) { |
190 | 160 | for (TaskDetail taskDetail : taskDetailList) { |
191 | - receiptContainerDetailList.add(receiptContainerDetailService. | |
192 | - getById(taskDetail.getAllocationId())); | |
161 | + receiptContainerDetailList.add(receiptContainerDetailService.getById(taskDetail.getAllocationId())); | |
193 | 162 | } |
194 | 163 | } |
195 | 164 | ReceiptContainerHeader receiptContainerHeader = receiptContainerHeaderService.getById(receiptContainerDetailList.get(0).getReceiptContainerId()); |
196 | 165 | LambdaUpdateWrapper<ReceiptContainerDetail> wrapper = Wrappers.lambdaUpdate(); |
197 | - wrapper.set(ReceiptContainerDetail::getLocationCode, locationCode) | |
198 | - .in(ReceiptContainerDetail::getId, receiptContainerDetailList.stream().map(ReceiptContainerDetail::getId).collect(Collectors.toList())); | |
166 | + wrapper | |
167 | + .set(ReceiptContainerDetail::getLocationCode, locationCode) | |
168 | + .in(ReceiptContainerDetail::getId, receiptContainerDetailList.stream() | |
169 | + .map(ReceiptContainerDetail::getId).collect(Collectors.toList())); | |
199 | 170 | receiptContainerDetailService.update(wrapper); |
200 | 171 | receiptContainerHeader.setToLocation(locationCode); |
201 | 172 | receiptContainerHeaderService.updateById(receiptContainerHeader); |
202 | 173 | } |
203 | 174 | newLocationCode = locationCode; |
204 | 175 | |
205 | - | |
206 | 176 | if (StringUtils.isEmpty(newLocationCode)) { |
207 | 177 | return AjaxResult.error("没有库位可以分配"); |
208 | 178 | } |
... | ... | @@ -222,12 +192,9 @@ public class OverrideHandleServiceImpl implements OverrideHandleService { |
222 | 192 | } |
223 | 193 | |
224 | 194 | //修改子任务 |
225 | - LambdaQueryWrapper<TaskDetail> taskDetailLam = Wrappers.lambdaQuery(); | |
226 | - taskDetailLam.eq(TaskDetail::getWarehouseCode, warehouseCode) | |
227 | - .eq(TaskDetail::getTaskId, taskHeader.getId()); | |
228 | - List<TaskDetail> taskDetails = taskDetailService.list(taskDetailLam); | |
195 | + List<TaskDetail> taskDetails = taskDetailService.list(new LambdaQueryWrapper<TaskDetail>().eq(TaskDetail::getTaskId, taskHeader.getId())); | |
229 | 196 | taskDetailList = new ArrayList<>(); |
230 | - if (taskDetails != null && taskDetails.size() > 0) { | |
197 | + if (taskDetails != null && !taskDetails.isEmpty()) { | |
231 | 198 | for (TaskDetail taskDetail : taskDetails) { |
232 | 199 | taskDetail.setToLocation(newLocationCode); |
233 | 200 | taskDetailList.add(taskDetail); |
... | ... |
src/main/java/com/huaheng/api/wcs/service/taskAssignService/TaskAssignServiceImpl.java
... | ... | @@ -149,14 +149,16 @@ public class TaskAssignServiceImpl implements TaskAssignService { |
149 | 149 | if (rowFlag == QuantityConstant.ROW_OUT) { |
150 | 150 | Location insideLocation = locationService.getInsideNear(location); |
151 | 151 | String insideLocationCode = insideLocation.getCode(); |
152 | + | |
153 | + //判断浅库位上是否有托盘,有托盘就要移库 | |
152 | 154 | if (StringUtils.isNotEmpty(insideLocation.getContainerCode())) { |
153 | - TaskHeader taskHeader2 = taskHeaderService.getOne(new LambdaQueryWrapper<TaskHeader>().eq(TaskHeader::getFromLocation, insideLocationCode).lt(TaskHeader::getStatus, QuantityConstant.TASK_STATUS_COMPLETED)); | |
155 | + //获取是否有未完成的任务 | |
156 | + TaskHeader taskHeader2 = taskHeaderService.getUndoneTaskByFromLocationCode(insideLocationCode); | |
154 | 157 | if (taskHeader2 != null) { |
155 | 158 | preTaskNo = taskHeader2.getId(); |
156 | 159 | } else { |
157 | - Location destinationLocation = null; | |
160 | + Location destinationLocation; | |
158 | 161 | if (insideLocation.getRoadway().equals("5")) { |
159 | - //分配库位 | |
160 | 162 | //是否自建单据库位 |
161 | 163 | int isSelfCreated = 0; |
162 | 164 | if (insideLocation.getSelfCreated()) { |
... | ... | @@ -166,6 +168,7 @@ public class TaskAssignServiceImpl implements TaskAssignService { |
166 | 168 | if (insideLocation.getILayer() > 3) { |
167 | 169 | isFlammable = false; |
168 | 170 | } |
171 | + //分配库位 | |
169 | 172 | String destinationLocationCode = locationAllocationService.allocation(insideLocation.getHigh(), insideLocation.getArea(), "5", |
170 | 173 | containerCode, insideLocation.getFrequencyLocation(), insideLocation.getOnlyEmptyContainer(), isSelfCreated, isFlammable); |
171 | 174 | if (StringUtils.isEmpty(destinationLocationCode)) { |
... | ... | @@ -173,11 +176,6 @@ public class TaskAssignServiceImpl implements TaskAssignService { |
173 | 176 | } else if (destinationLocationCode.length() > 10) { |
174 | 177 | return AjaxResult.error(destinationLocationCode); |
175 | 178 | } |
176 | - //锁定库位 | |
177 | - int updateCount2 = locationService.updateStatusNew(destinationLocationCode, warehouseCode, QuantityConstant.STATUS_LOCATION_LOCK, QuantityConstant.STATUS_LOCATION_EMPTY); | |
178 | - if (updateCount2 != 1) { | |
179 | - throw new ServiceException("库位已经锁定,不允许再分到这个库位"); | |
180 | - } | |
181 | 179 | destinationLocation = locationService.getLocationByCode(destinationLocationCode); |
182 | 180 | } else { |
183 | 181 | //获取一个最近的空闲库位(优先找外侧) |
... | ... | @@ -196,23 +194,16 @@ public class TaskAssignServiceImpl implements TaskAssignService { |
196 | 194 | return AjaxResult.error("先执行移库任务"); |
197 | 195 | } |
198 | 196 | } else { |
199 | - LambdaQueryWrapper<TaskHeader> lambdaWrapper = Wrappers.lambdaQuery(); | |
200 | - lambdaWrapper.eq(TaskHeader::getToLocation, insideLocationCode); | |
201 | - lambdaWrapper.lt(TaskHeader::getStatus, QuantityConstant.TASK_STATUS_COMPLETED); | |
202 | - TaskHeader taskHeader1 = taskHeaderService.getOne(lambdaWrapper); | |
203 | - if (taskHeader1 != null) { | |
204 | - return AjaxResult.error("执行外侧库位出库时,相应的内侧库位有任务,请先执行完内侧库位任务"); | |
197 | + //获取是否有未完成的任务 | |
198 | + if (taskHeaderService.getUndoneTaskByToLocationCode(insideLocationCode) != null) { | |
199 | + return AjaxResult.error("执行外侧库位出库时,相应的内侧库位有任务,请先执行完内侧库位任务,库位:" + insideLocationCode); | |
205 | 200 | } |
206 | 201 | } |
207 | 202 | taskHeader.setPreTaskNo(preTaskNo); |
208 | 203 | taskHeaderService.updateById(taskHeader); |
209 | 204 | } |
210 | - | |
211 | 205 | } |
212 | - | |
213 | - | |
214 | - AjaxResult ajaxResult = sendToWcs(taskHeader, preTaskNo, location); | |
215 | - return ajaxResult; | |
206 | + return sendToWcs(taskHeader, preTaskNo, location); | |
216 | 207 | } |
217 | 208 | |
218 | 209 | @Override |
... | ... |
src/main/java/com/huaheng/api/wcs/service/warecellAllocation/LocationAllocationServiceImpl.java
... | ... | @@ -23,6 +23,8 @@ import org.springframework.stereotype.Service; |
23 | 23 | import org.springframework.util.StopWatch; |
24 | 24 | |
25 | 25 | import javax.annotation.Resource; |
26 | +import java.time.LocalDateTime; | |
27 | +import java.time.format.DateTimeFormatter; | |
26 | 28 | import java.util.*; |
27 | 29 | import java.util.stream.Collectors; |
28 | 30 | |
... | ... | @@ -136,7 +138,7 @@ public class LocationAllocationServiceImpl implements LocationAllocationService |
136 | 138 | |
137 | 139 | for (Location temporaryLocation : setTemporaryTypeList) { |
138 | 140 | if (temporaryLocation != null) { |
139 | - temporaryLocation.setTemporaryType(prefix + location.getCode()); | |
141 | + temporaryLocation.setTemporaryType(prefix + location.getCode() + "-" + LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd-HH:mm:ss"))); | |
140 | 142 | locationService.updateById(temporaryLocation); |
141 | 143 | } |
142 | 144 | } |
... | ... |
src/main/java/com/huaheng/api/wcs/service/warecellAllocation/WarecellAllocationServiceImpl.java
... | ... | @@ -262,11 +262,6 @@ public class WarecellAllocationServiceImpl implements WarecellAllocationService |
262 | 262 | } else if (destinationLocationCode.length() > 10) { |
263 | 263 | return AjaxResult.error(destinationLocationCode); |
264 | 264 | } |
265 | - //锁定库位 | |
266 | - int updateCount2 = locationService.updateStatusNew(destinationLocationCode, warehouseCode, QuantityConstant.STATUS_LOCATION_LOCK, QuantityConstant.STATUS_LOCATION_EMPTY); | |
267 | - if (updateCount2 != 1) { | |
268 | - throw new ServiceException("库位已经锁定,不允许再分到这个库位"); | |
269 | - } | |
270 | 265 | destinationLocation = locationService.getLocationByCode(destinationLocationCode); |
271 | 266 | } else { |
272 | 267 | //获取一个最近的空闲库位(优先找外侧) |
... | ... |
src/main/java/com/huaheng/pc/inventory/inventoryHeader/controller/InventoryHeaderController.java
... | ... | @@ -324,22 +324,22 @@ public class InventoryHeaderController extends BaseController { |
324 | 324 | return prefix + "/transfer"; |
325 | 325 | } |
326 | 326 | |
327 | - /** | |
328 | - * 移库 | |
329 | - */ | |
330 | - @RequiresPermissions("inventory:inventoryHeader:transfer") | |
331 | - @PostMapping("/transfer") | |
332 | - @ResponseBody | |
333 | - public AjaxResult transfer(String sourceLocation, String destinationLocation) { | |
334 | - if (StringUtils.isEmpty(sourceLocation) || StringUtils.isEmpty(destinationLocation)) { | |
335 | - throw new ServiceException("源库位和目标库位不能有空值!"); | |
336 | - } | |
337 | - Location location = locationService.getLocationByCode(destinationLocation); | |
338 | - if (location.getSelfCreated() || location.getOnlyEmptyContainer() == 1) { | |
339 | - throw new ServiceException("空托盘库位和自建库位不能移库"); | |
340 | - } | |
341 | - return inventoryHeaderService.createTransferTask(sourceLocation, destinationLocation); | |
342 | - } | |
327 | + ///** | |
328 | + // * 移库 | |
329 | + // */ | |
330 | + //@RequiresPermissions("inventory:inventoryHeader:transfer") | |
331 | + //@PostMapping("/transfer") | |
332 | + //@ResponseBody | |
333 | + //public AjaxResult transfer(String sourceLocation, String destinationLocation) { | |
334 | + // if (StringUtils.isEmpty(sourceLocation) || StringUtils.isEmpty(destinationLocation)) { | |
335 | + // throw new ServiceException("源库位和目标库位不能有空值!"); | |
336 | + // } | |
337 | + // Location location = locationService.getLocationByCode(destinationLocation); | |
338 | + // if (location.getSelfCreated() || location.getOnlyEmptyContainer() == 1) { | |
339 | + // throw new ServiceException("空托盘库位和自建库位不能移库"); | |
340 | + // } | |
341 | + // return inventoryHeaderService.createTransferTask(sourceLocation, destinationLocation); | |
342 | + //} | |
343 | 343 | |
344 | 344 | |
345 | 345 | /** |
... | ... |
src/main/java/com/huaheng/pc/inventory/inventoryHeader/service/InventoryHeaderService.java
... | ... | @@ -15,7 +15,7 @@ public interface InventoryHeaderService extends IService<InventoryHeader> { |
15 | 15 | |
16 | 16 | AjaxResult createCheckOutTask(List<Integer> ids, String port); |
17 | 17 | |
18 | - AjaxResult createTransferTask(String sourceLocation, String destinationLocation); | |
18 | + //AjaxResult createTransferTask(String sourceLocation, String destinationLocation); | |
19 | 19 | |
20 | 20 | //移库查询入库组盘 |
21 | 21 | int getUncompleteReceiptContainer(String locationCode); |
... | ... |
src/main/java/com/huaheng/pc/inventory/inventoryHeader/service/InventoryHeaderServiceImpl.java
... | ... | @@ -107,10 +107,10 @@ public class InventoryHeaderServiceImpl extends ServiceImpl<InventoryHeaderMappe |
107 | 107 | /** |
108 | 108 | * 生成移库任务 |
109 | 109 | */ |
110 | - @Override | |
111 | - public AjaxResult createTransferTask(String sourceLocation, String destinationLocation) { | |
112 | - return transferTaskService.createTransferTask(sourceLocation, destinationLocation, ShiroUtils.getWarehouseCode()); | |
113 | - } | |
110 | + //@Override | |
111 | + //public AjaxResult createTransferTask(String sourceLocation, String destinationLocation) { | |
112 | + // return transferTaskService.createTransferTask(sourceLocation, destinationLocation, ShiroUtils.getWarehouseCode()); | |
113 | + //} | |
114 | 114 | |
115 | 115 | /** |
116 | 116 | * 出库查看 |
... | ... |
src/main/java/com/huaheng/pc/task/taskHeader/service/TaskHeaderService.java
... | ... | @@ -72,4 +72,9 @@ public interface TaskHeaderService extends IService<TaskHeader> { |
72 | 72 | TaskHeader getTaskHeaderByLocation(String locationCode); |
73 | 73 | |
74 | 74 | |
75 | + TaskHeader getUndoneTaskByToLocationCode(String locationCode); | |
76 | + | |
77 | + TaskHeader getUndoneTaskByFromLocationCode(String locationCode); | |
78 | + | |
79 | + | |
75 | 80 | } |
... | ... |
src/main/java/com/huaheng/pc/task/taskHeader/service/TaskHeaderServiceImpl.java
... | ... | @@ -949,4 +949,24 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea |
949 | 949 | } |
950 | 950 | return true; |
951 | 951 | } |
952 | + | |
953 | + | |
954 | + //根据来源库位号获取未完成的任务 | |
955 | + @Override | |
956 | + public TaskHeader getUndoneTaskByFromLocationCode(String locationCode) { | |
957 | + return taskHeaderService.getOne(new LambdaQueryWrapper<TaskHeader>() | |
958 | + .eq(TaskHeader::getFromLocation, locationCode) | |
959 | + .lt(TaskHeader::getStatus, QuantityConstant.TASK_STATUS_COMPLETED)); | |
960 | + | |
961 | + } | |
962 | + | |
963 | + //根据目标库位号获取未完成的任务 | |
964 | + @Override | |
965 | + public TaskHeader getUndoneTaskByToLocationCode(String locationCode) { | |
966 | + return taskHeaderService.getOne(new LambdaQueryWrapper<TaskHeader>() | |
967 | + .eq(TaskHeader::getToLocation, locationCode) | |
968 | + .lt(TaskHeader::getStatus, QuantityConstant.TASK_STATUS_COMPLETED)); | |
969 | + | |
970 | + } | |
971 | + | |
952 | 972 | } |
... | ... |
src/main/java/com/huaheng/pc/task/taskHeader/service/TransferTaskService.java
... | ... | @@ -66,45 +66,45 @@ public class TransferTaskService { |
66 | 66 | Location desLocation = locationService.getLocationByCode(desLocationCode, warehouseCode); |
67 | 67 | Integer preTaskNo = 0; |
68 | 68 | if (StringUtils.isNull(sourceLocation)) { |
69 | - return AjaxResult.error("源库位:" + sourceLocation.getCode() + "未找到"); | |
69 | + throw new ServiceException("源库位:" + sourceLocation.getCode() + "未找到"); | |
70 | 70 | } |
71 | 71 | if (!QuantityConstant.STATUS_LOCATION_EMPTY.equals(sourceLocation.getStatus())) { |
72 | - return AjaxResult.error("源库位:" + sourceLocation.getCode() + "状态非空闲"); | |
72 | + throw new ServiceException("源库位:" + sourceLocation.getCode() + "状态非空闲"); | |
73 | 73 | } |
74 | 74 | if (StringUtils.isEmpty(sourceLocation.getContainerCode())) { |
75 | - return AjaxResult.error("源库位:" + sourceLocation.getCode() + "不存在托盘"); | |
75 | + throw new ServiceException("源库位:" + sourceLocation.getCode() + "不存在托盘"); | |
76 | 76 | } |
77 | 77 | //这里增加组盘校验,如果此托盘存在未完成的组盘数据,则不能移库 |
78 | 78 | //校验入库组盘 |
79 | 79 | if (inventoryHeaderService.getUncompleteReceiptContainer(sourceLocationCode, warehouseCode) > 0) { |
80 | - return AjaxResult.error("源库位:" + sourceLocation.getCode() + "存在入库组盘,不能移库"); | |
80 | + throw new ServiceException("源库位:" + sourceLocation.getCode() + "存在入库组盘,不能移库"); | |
81 | 81 | } |
82 | 82 | if (inventoryHeaderService.getUncompleteShipmentContainer(sourceLocationCode, warehouseCode) > 0) { |
83 | - return AjaxResult.error("源库位:" + sourceLocation.getCode() + "存在出库组盘,不能移库"); | |
83 | + throw new ServiceException("源库位:" + sourceLocation.getCode() + "存在出库组盘,不能移库"); | |
84 | 84 | } |
85 | 85 | if (StringUtils.isNull(desLocation)) { |
86 | - return AjaxResult.error("目标库位:" + desLocationCode + "未找到"); | |
86 | + throw new ServiceException("目标库位:" + desLocationCode + "未找到"); | |
87 | 87 | } |
88 | 88 | if (!QuantityConstant.STATUS_LOCATION_EMPTY.equals(desLocation.getStatus())) { |
89 | - return AjaxResult.error("目标库位:" + desLocationCode + "状态非空闲"); | |
89 | + throw new ServiceException("目标库位:" + desLocationCode + "状态非空闲"); | |
90 | 90 | } |
91 | 91 | if (StringUtils.isNotEmpty(desLocation.getContainerCode())) { |
92 | - return AjaxResult.error("目标库位:" + desLocationCode + "存在托盘"); | |
92 | + throw new ServiceException("目标库位:" + desLocationCode + "存在托盘"); | |
93 | 93 | } |
94 | 94 | if (taskHeaderService.getUncompleteTaskInNear(desLocation) > 0) { |
95 | - return AjaxResult.error("目标库位:" + desLocationCode + "旁边存在任务,请完成任务以后再分配"); | |
95 | + throw new ServiceException("目标库位:" + desLocationCode + "旁边存在任务,请完成任务以后再分配"); | |
96 | 96 | } |
97 | 97 | if (!sourceLocation.getRoadway().equals(desLocation.getRoadway())) { |
98 | - return AjaxResult.error("目标库位和源库位不在同一个巷道"); | |
98 | + throw new ServiceException("目标库位和源库位不在同一个巷道"); | |
99 | 99 | } |
100 | 100 | if (!sourceLocation.getHigh().equals(desLocation.getHigh())) { |
101 | - return AjaxResult.error("目标库位和源库位高度不一样"); | |
101 | + throw new ServiceException("目标库位和源库位高度不一样"); | |
102 | 102 | } |
103 | 103 | if (!sourceLocation.getLocationType().equals(desLocation.getLocationType())) { |
104 | - return AjaxResult.error("目标库位和源库位库位类型不一样"); | |
104 | + throw new ServiceException("目标库位和源库位库位类型不一样"); | |
105 | 105 | } |
106 | 106 | if (!sourceLocation.getArea().equals(desLocation.getArea())) { |
107 | - return AjaxResult.error("目标库位和源库位不在同一个区域"); | |
107 | + throw new ServiceException("目标库位和源库位不在同一个区域"); | |
108 | 108 | } |
109 | 109 | |
110 | 110 | //创建移库任务前,记录托盘的状态 |
... | ... | @@ -122,14 +122,14 @@ public class TransferTaskService { |
122 | 122 | if (taskHeader != null) { |
123 | 123 | preTaskNo = taskHeader.getId(); |
124 | 124 | } else { |
125 | - return AjaxResult.error("源库位:" + sourceLocationCode + "旁边库位有托盘无法移库"); | |
125 | + throw new ServiceException("源库位:" + sourceLocationCode + "旁边库位有托盘无法移库"); | |
126 | 126 | } |
127 | 127 | } else { |
128 | 128 | TaskHeader taskHeader = taskHeaderService.getOne(new LambdaQueryWrapper<TaskHeader>() |
129 | 129 | .eq(TaskHeader::getToLocation, locationCode) |
130 | 130 | .lt(TaskHeader::getStatus, QuantityConstant.TASK_STATUS_COMPLETED)); |
131 | 131 | if (taskHeader != null) { |
132 | - return AjaxResult.error("源库位:" + sourceLocationCode + "旁边库位有任务无法移库"); | |
132 | + throw new ServiceException("源库位:" + sourceLocationCode + "旁边库位有任务无法移库"); | |
133 | 133 | } |
134 | 134 | } |
135 | 135 | } |
... | ... |
src/main/resources/application-druid.properties
1 | 1 | spring.datasource.type=com.alibaba.druid.pool.DruidDataSource |
2 | 2 | spring.datasource.driverClassName=com.mysql.cj.jdbc.Driver |
3 | -# server | |
4 | -#spring.datasource.druid.master.url=jdbc:mysql://localhost:13366/wms?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&serverTimezone=GMT%2b8&autoReconnect=true&maxReconnects=9999&initialTimeout=30&rewriteBatchedStatements=true | |
3 | +# server1 | |
4 | +#spring.datasource.druid.master.url=jdbc:mysql://192.168.100.123:13366/wms?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&serverTimezone=GMT%2b8&autoReconnect=true&maxReconnects=9999&initialTimeout=30&rewriteBatchedStatements=true | |
5 | +#spring.datasource.druid.master.username=root | |
6 | +#spring.datasource.druid.master.password=HHsoft123. | |
7 | +# server2 | |
8 | +#spring.datasource.druid.master.url=jdbc:mysql://192.168.100.134:13367/wms?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&serverTimezone=GMT%2b8&autoReconnect=true&maxReconnects=9999&initialTimeout=30&rewriteBatchedStatements=true | |
9 | +#spring.datasource.druid.master.username=root | |
10 | +#spring.datasource.druid.master.password=HHsoft123. | |
11 | +# server3 | |
12 | +#spring.datasource.druid.master.url=jdbc:mysql://192.168.100.136:13368/wms?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&serverTimezone=GMT%2b8&autoReconnect=true&maxReconnects=9999&initialTimeout=30&rewriteBatchedStatements=true | |
5 | 13 | #spring.datasource.druid.master.username=root |
6 | 14 | #spring.datasource.druid.master.password=HHsoft123. |
7 | 15 | # aliyun |
... | ... |