Commit b398462378546ef93673228e87ca993ade1466f6
1 parent
b9e93a44
修复WCS完成接口问题
Showing
9 changed files
with
84 additions
and
77 deletions
src/main/java/com/huaheng/pc/config/container/service/ContainerService.java
... | ... | @@ -23,9 +23,10 @@ public interface ContainerService extends IService<Container>{ |
23 | 23 | */ |
24 | 24 | void updateLocationCodeAndStatus(String containerCode, String locationCode, String status); |
25 | 25 | |
26 | -void updateLocationCodeAndStatus(String containerCode, String locationCode, | |
26 | + void updateLocationCodeAndStatus(String containerCode, String locationCode, | |
27 | 27 | String status, String warehouseCode); |
28 | - boolean updateStatus(String containerCode, String status); | |
28 | + | |
29 | + boolean updateStatus(String containerCode, String status, String wareohuseCode); | |
29 | 30 | |
30 | 31 | void removeContainer(String containType, String containCode); |
31 | 32 | |
... | ... |
src/main/java/com/huaheng/pc/config/container/service/ContainerServiceImpl.java
... | ... | @@ -145,13 +145,18 @@ public class ContainerServiceImpl extends ServiceImpl<ContainerMapper, Container |
145 | 145 | } |
146 | 146 | } |
147 | 147 | |
148 | - @Override public void updateLocationCodeAndStatus(String containerCode, String locationCode, String status, String warehouseCode) { | |
148 | + @Override | |
149 | + public void updateLocationCodeAndStatus(String containerCode, String locationCode, String status, String warehouseCode) { | |
149 | 150 | if (StringUtils.isNotEmpty(containerCode) || StringUtils.isNotEmpty(locationCode)) { |
150 | 151 | containerMapper.updateLocationCodeAndStatus(warehouseCode, containerCode, locationCode, status); |
151 | 152 | } |
152 | - } public boolean updateStatus(String containerCode, String status) { | |
153 | + } | |
154 | + | |
155 | + @Override | |
156 | + public boolean updateStatus(String containerCode, String status, String warehouseCode) { | |
153 | 157 | LambdaQueryWrapper<Container> containerLambdaQueryWrapper = Wrappers.lambdaQuery(); |
154 | - containerLambdaQueryWrapper.eq(Container::getCode, containerCode); | |
158 | + containerLambdaQueryWrapper.eq(Container::getCode, containerCode) | |
159 | + .eq(Container::getWarehouseCode, warehouseCode); | |
155 | 160 | Container container = getOne(containerLambdaQueryWrapper); |
156 | 161 | container.setStatus(status); |
157 | 162 | boolean result = update(container, containerLambdaQueryWrapper); |
... | ... |
src/main/java/com/huaheng/pc/task/taskHeader/service/CycleCountTaskService.java
... | ... | @@ -280,6 +280,7 @@ public class CycleCountTaskService { |
280 | 280 | List<TaskDetail> list = new CopyOnWriteArrayList<>(); |
281 | 281 | List<CycleCountDetailChild> cycChildList = new ArrayList<>(); |
282 | 282 | boolean difference = false; |
283 | + String warehouseCode = taskHeader.getWarehouseCode(); | |
283 | 284 | //修改任务明细状态的同时查找到盘点明细的条目并修改状态,最后修改主单状态 |
284 | 285 | for (TaskDetail item : taskDetailList) { |
285 | 286 | item.setStatus(QuantityConstant.TASK_STATUS_COMPLETED); |
... | ... | @@ -343,7 +344,8 @@ public class CycleCountTaskService { |
343 | 344 | //更新主单状态 |
344 | 345 | cycleCountHeaderService.updataHeaderStatus(cycleCountDetail.getCycleCountHeadCode()); |
345 | 346 | //释放库位 |
346 | - locationService.updateStatus(cycleCountDetail.getLocationCode(), QuantityConstant.STATUS_LOCATION_EMPTY); | |
347 | + locationService.updateStatus(cycleCountDetail.getLocationCode(), | |
348 | + QuantityConstant.STATUS_LOCATION_EMPTY, warehouseCode); | |
347 | 349 | |
348 | 350 | return AjaxResult.success("完成盘点任务成功!"); |
349 | 351 | |
... | ... |
src/main/java/com/huaheng/pc/task/taskHeader/service/ReceiptTaskService.java
... | ... | @@ -111,7 +111,7 @@ public class ReceiptTaskService { |
111 | 111 | } |
112 | 112 | //锁定容器 |
113 | 113 | containerService.updateStatus(receiptContainerHeader.getContainerCode(), |
114 | - QuantityConstant.STATUS_CONTAINER_LOCK); | |
114 | + QuantityConstant.STATUS_CONTAINER_LOCK, container.getWarehouseCode()); | |
115 | 115 | //查询入库组盘明细 |
116 | 116 | LambdaQueryWrapper<ReceiptContainerDetail> containerDetailLambda = Wrappers.lambdaQuery(); |
117 | 117 | containerDetailLambda.eq(ReceiptContainerDetail::getReceiptContainerId, id); |
... | ... | @@ -257,7 +257,7 @@ public class ReceiptTaskService { |
257 | 257 | if (StringUtils.isEmpty(task.getToLocation())) { |
258 | 258 | throw new ServiceException("任务" + task.getId() + "没有目的库位,执行中止"); |
259 | 259 | } |
260 | - | |
260 | + String warehouseCode = task.getWarehouseCode(); | |
261 | 261 | BigDecimal totalQty = BigDecimal.ZERO; |
262 | 262 | List<TaskDetail> taskDetailList = taskDetailService.findByTaskId(task.getId()); |
263 | 263 | if (taskDetailList.isEmpty()) { |
... | ... | @@ -270,20 +270,20 @@ public class ReceiptTaskService { |
270 | 270 | InventoryHeader inventoryHeader = null; |
271 | 271 | if(task.getTaskType().equals(QuantityConstant.TASK_TYPE_SUPPLEMENTRECEIPT)) { |
272 | 272 | LambdaQueryWrapper<InventoryHeader> lambdaQueryWrapper = Wrappers.lambdaQuery(); |
273 | - lambdaQueryWrapper.eq(InventoryHeader::getWarehouseCode, ShiroUtils.getWarehouseCode()) | |
273 | + lambdaQueryWrapper.eq(InventoryHeader::getWarehouseCode, warehouseCode) | |
274 | 274 | .eq(InventoryHeader::getLocationCode, task.getFromLocation()) |
275 | 275 | .eq(InventoryHeader::getContainerCode, task.getContainerCode()); |
276 | 276 | inventoryHeader= inventoryHeaderService.getOne(lambdaQueryWrapper); |
277 | 277 | if(inventoryHeader != null) { |
278 | 278 | String locationCode = inventoryHeader.getLocationCode(); |
279 | - Location location = locationService.getLocationByCode(locationCode, ShiroUtils.getWarehouseCode()); | |
279 | + Location location = locationService.getLocationByCode(locationCode, warehouseCode); | |
280 | 280 | location.setContainerCode(""); |
281 | 281 | location.setStatus(QuantityConstant.STATUS_LOCATION_EMPTY); |
282 | 282 | locationService.updateById(location); |
283 | 283 | inventoryHeader.setLocationCode(task.getToLocation()); |
284 | 284 | inventoryHeaderService.updateById(inventoryHeader); |
285 | 285 | LambdaQueryWrapper<InventoryDetail> lambdaQueryWrapper2 = Wrappers.lambdaQuery(); |
286 | - lambdaQueryWrapper2.eq(InventoryDetail::getWarehouseCode, ShiroUtils.getWarehouseCode()) | |
286 | + lambdaQueryWrapper2.eq(InventoryDetail::getWarehouseCode, warehouseCode) | |
287 | 287 | .eq(InventoryDetail::getInventoryHeaderId, inventoryHeader.getId()); |
288 | 288 | List<InventoryDetail> inventoryDetails = inventoryDetailService.list(lambdaQueryWrapper2); |
289 | 289 | if(inventoryDetails != null && inventoryDetails.size() > 0) { |
... | ... | @@ -297,7 +297,7 @@ public class ReceiptTaskService { |
297 | 297 | } |
298 | 298 | if (StringUtils.isNull(inventoryHeader)) { |
299 | 299 | LambdaQueryWrapper<InventoryHeader> inventoryHeaderLambdaQueryWrapper = Wrappers.lambdaQuery(); |
300 | - inventoryHeaderLambdaQueryWrapper.eq(InventoryHeader::getWarehouseCode, ShiroUtils.getWarehouseCode()) | |
300 | + inventoryHeaderLambdaQueryWrapper.eq(InventoryHeader::getWarehouseCode, warehouseCode) | |
301 | 301 | .eq(InventoryHeader::getLocationCode, task.getToLocation()) |
302 | 302 | .eq(InventoryHeader::getContainerCode, task.getContainerCode()); |
303 | 303 | inventoryHeader = inventoryHeaderService.getOne(inventoryHeaderLambdaQueryWrapper); |
... | ... | @@ -305,9 +305,9 @@ public class ReceiptTaskService { |
305 | 305 | /* 如果库存 头明细不存在则新增库存头表记录*/ |
306 | 306 | if (StringUtils.isNull(inventoryHeader)) { |
307 | 307 | inventoryHeader = new InventoryHeader(); |
308 | - inventoryHeader.setWarehouseCode(task.getWarehouseCode()); | |
308 | + inventoryHeader.setWarehouseCode(warehouseCode); | |
309 | 309 | inventoryHeader.setLocationCode(task.getToLocation()); |
310 | - Location location = locationService.getLocationByCode(task.getToLocation(), ShiroUtils.getWarehouseCode()); | |
310 | + Location location = locationService.getLocationByCode(task.getToLocation(), warehouseCode); | |
311 | 311 | inventoryHeader.setZoneCode(location.getZoneCode()); |
312 | 312 | inventoryHeader.setTotalWeight(task.getWeight()); |
313 | 313 | if(task.getZoneCode().equals("C")) { |
... | ... | @@ -342,6 +342,7 @@ public class ReceiptTaskService { |
342 | 342 | //修改组盘表状态为完成 |
343 | 343 | ReceiptContainerDetail receiptContainerDetail = new ReceiptContainerDetail(); |
344 | 344 | receiptContainerDetail.setStatus(QuantityConstant.RECEIPT_CONTAINER_FINISHED); |
345 | + receiptContainerDetail.setLastUpdatedBy(receiptDetail.getCreatedBy()); | |
345 | 346 | LambdaUpdateWrapper<ReceiptContainerDetail> receiptContainerDetailLambdaUpdateWrapper = Wrappers.lambdaUpdate(); |
346 | 347 | receiptContainerDetailLambdaUpdateWrapper.eq(ReceiptContainerDetail::getId, taskDetail.getAllocationId()); |
347 | 348 | if (!receiptContainerDetailService.update(receiptContainerDetail, receiptContainerDetailLambdaUpdateWrapper)){ |
... | ... | @@ -372,11 +373,11 @@ public class ReceiptTaskService { |
372 | 373 | } else { |
373 | 374 | location.setContainerCode(task.getContainerCode()); |
374 | 375 | } |
375 | - location.setWarehouseCode(ShiroUtils.getWarehouseCode()); | |
376 | + location.setWarehouseCode(warehouseCode); | |
376 | 377 | location.setStatus(QuantityConstant.STATUS_LOCATION_EMPTY); |
377 | 378 | LambdaUpdateWrapper<Location> locationLambdaUpdateWrapper = Wrappers.lambdaUpdate(); |
378 | 379 | locationLambdaUpdateWrapper.eq(Location::getCode, task.getToLocation()); |
379 | - locationLambdaUpdateWrapper.eq(Location::getWarehouseCode, ShiroUtils.getWarehouseCode()); | |
380 | + locationLambdaUpdateWrapper.eq(Location::getWarehouseCode, warehouseCode); | |
380 | 381 | if (!locationService.update(location, locationLambdaUpdateWrapper)){ |
381 | 382 | throw new ServiceException("更新库位失败"); |
382 | 383 | } |
... | ... | @@ -384,7 +385,6 @@ public class ReceiptTaskService { |
384 | 385 | |
385 | 386 | //修改任务主表状态,因为立库任务表单头只对应一个货箱,表单详情的任务会同时完成 |
386 | 387 | task.setStatus(QuantityConstant.TASK_STATUS_COMPLETED); |
387 | - task.setZoneCode(location.getZoneCode()); | |
388 | 388 | LambdaUpdateWrapper<TaskHeader> taskHeaderLambdaUpdateWrapper = Wrappers.lambdaUpdate(); |
389 | 389 | taskHeaderLambdaUpdateWrapper.eq(TaskHeader::getId, task.getId()); |
390 | 390 | if (!taskHeaderService.update(task, taskHeaderLambdaUpdateWrapper)){ |
... | ... | @@ -406,6 +406,7 @@ public class ReceiptTaskService { |
406 | 406 | //修改入库组盘头表状态 |
407 | 407 | ReceiptContainerHeader receiptContainerHeader = new ReceiptContainerHeader(); |
408 | 408 | receiptContainerHeader.setId(task.getAllocationHeadId()); |
409 | + receiptContainerHeader.setLastUpdatedBy(task.getCreatedBy()); | |
409 | 410 | receiptContainerHeader.setStatus(QuantityConstant.RECEIPT_CONTAINER_FINISHED); |
410 | 411 | if (!receiptContainerHeaderService.updateById(receiptContainerHeader)) { |
411 | 412 | throw new ServiceException("更新入库组盘头表状态失败"); |
... | ... | @@ -421,9 +422,10 @@ public class ReceiptTaskService { |
421 | 422 | * @return 任务数量 |
422 | 423 | */ |
423 | 424 | private BigDecimal addInventoryDetail(TaskDetail taskDetail, ReceiptDetail receiptDetail, InventoryHeader inventoryHeader) { |
425 | + String warehouseCode = inventoryHeader.getWarehouseCode(); | |
424 | 426 | /*该入库明细是否已存在库存明细记录,已存在更新数量、不存在新增记录*/ |
425 | 427 | LambdaQueryWrapper<InventoryDetail> inventory = Wrappers.lambdaQuery(); |
426 | - inventory.eq(InventoryDetail::getWarehouseCode, taskDetail.getWarehouseCode()) | |
428 | + inventory.eq(InventoryDetail::getWarehouseCode, warehouseCode) | |
427 | 429 | .eq(InventoryDetail::getLocationCode, inventoryHeader.getLocationCode()) |
428 | 430 | .eq(InventoryDetail::getMaterialCode, taskDetail.getMaterialCode()) |
429 | 431 | .eq(InventoryDetail::getContainerCode, inventoryHeader.getContainerCode()) |
... | ... | @@ -431,7 +433,7 @@ public class ReceiptTaskService { |
431 | 433 | .eq(InventoryDetail::getBatch,taskDetail.getBatch()) |
432 | 434 | .eq(InventoryDetail::getReceiptDetailId, taskDetail.getBillDetailId()); |
433 | 435 | InventoryDetail inventoryDetail = inventoryDetailService.getOne(inventory); |
434 | - Material material = materialService.findAllByCode(receiptDetail.getMaterialCode()); | |
436 | + Material material = materialService.findAllByCode(receiptDetail.getMaterialCode(), warehouseCode); | |
435 | 437 | /*单位换算*/ |
436 | 438 | BigDecimal receiptQty = taskDetail.getQty(); |
437 | 439 | if (StringUtils.isNotEmpty(receiptDetail.getMaterialUnit()) && |
... | ... |
src/main/java/com/huaheng/pc/task/taskHeader/service/ShipmentTaskService.java
... | ... | @@ -245,7 +245,6 @@ public class ShipmentTaskService { |
245 | 245 | //获取任务明细 |
246 | 246 | List<TaskDetail> taskDetails = taskDetailService.findByTaskId(task.getId()); |
247 | 247 | |
248 | - List<Integer> shipmentHeadIds = new ArrayList<>(); | |
249 | 248 | if (task.getStatus().intValue() == QuantityConstant.TASK_STATUS_COMPLETED) { |
250 | 249 | throw new ServiceException("任务已完成"); |
251 | 250 | } |
... | ... | @@ -258,23 +257,23 @@ public class ShipmentTaskService { |
258 | 257 | && task.getTaskType().equals(QuantityConstant.TASK_TYPE_SORTINGSHIPMENT)) { |
259 | 258 | throw new ServiceException("任务" + task.getId() + "没有目的库位,执行中止"); |
260 | 259 | } |
261 | - | |
260 | + String warehouseCode = task.getWarehouseCode(); | |
262 | 261 | InventoryHeader inventoryHeader = null; |
263 | 262 | if(task.getTaskType().equals(QuantityConstant.TASK_TYPE_SORTINGSHIPMENT)) { |
264 | 263 | LambdaQueryWrapper<InventoryHeader> lambdaQueryWrapper = Wrappers.lambdaQuery(); |
265 | - lambdaQueryWrapper.eq(InventoryHeader::getWarehouseCode, ShiroUtils.getWarehouseCode()) | |
264 | + lambdaQueryWrapper.eq(InventoryHeader::getWarehouseCode, warehouseCode) | |
266 | 265 | .eq(InventoryHeader::getLocationCode, task.getFromLocation()) |
267 | 266 | .eq(InventoryHeader::getContainerCode, task.getContainerCode()); |
268 | - inventoryHeader= inventoryHeaderService.getOne(lambdaQueryWrapper); | |
267 | + inventoryHeader = inventoryHeaderService.getOne(lambdaQueryWrapper); | |
269 | 268 | if(inventoryHeader != null) { |
270 | 269 | String locationCode = inventoryHeader.getLocationCode(); |
271 | - Location location = locationService.getLocationByCode(locationCode); | |
270 | + Location location = locationService.getLocationByCode(locationCode, warehouseCode); | |
272 | 271 | location.setStatus(QuantityConstant.STATUS_LOCATION_EMPTY); |
273 | 272 | locationService.updateById(location); |
274 | 273 | inventoryHeader.setLocationCode(task.getToLocation()); |
275 | 274 | inventoryHeaderService.updateById(inventoryHeader); |
276 | 275 | LambdaQueryWrapper<InventoryDetail> lambdaQueryWrapper2 = Wrappers.lambdaQuery(); |
277 | - lambdaQueryWrapper2.eq(InventoryDetail::getWarehouseCode, ShiroUtils.getWarehouseCode()) | |
276 | + lambdaQueryWrapper2.eq(InventoryDetail::getWarehouseCode, warehouseCode) | |
278 | 277 | .eq(InventoryDetail::getInventoryHeaderId, inventoryHeader.getId()); |
279 | 278 | List<InventoryDetail> inventoryDetails = inventoryDetailService.list(lambdaQueryWrapper2); |
280 | 279 | if(inventoryDetails != null && inventoryDetails.size() > 0) { |
... | ... | @@ -330,7 +329,7 @@ public class ShipmentTaskService { |
330 | 329 | shipmentContainerDetailService.updateById(shipmentContainerDetail); |
331 | 330 | //记录库存交易记录 |
332 | 331 | InventoryTransaction inventoryTransaction = new InventoryTransaction(); |
333 | - inventoryTransaction.setWarehouseCode(task.getWarehouseCode()); | |
332 | + inventoryTransaction.setWarehouseCode(warehouseCode); | |
334 | 333 | inventoryTransaction.setCompanyCode(inventoryDetail.getCompanyCode()); |
335 | 334 | inventoryTransaction.setLocationCode(inventoryDetail.getLocationCode()); |
336 | 335 | inventoryTransaction.setContainerCode(inventoryDetail.getContainerCode()); |
... | ... | @@ -363,7 +362,8 @@ public class ShipmentTaskService { |
363 | 362 | task.setStatus(QuantityConstant.TASK_STATUS_COMPLETED); |
364 | 363 | taskHeaderService.updateById(task); |
365 | 364 | /* 更新库位和容器*/ |
366 | - updateShipmentLocationContainer(task.getFromLocation(), task.getToLocation(), task.getContainerCode(), task.getTaskType()); | |
365 | + updateShipmentLocationContainer(task.getFromLocation(), task.getToLocation(), | |
366 | + task.getContainerCode(), task.getTaskType(), warehouseCode); | |
367 | 367 | |
368 | 368 | //设置出库货箱表头状态为拣货任务完成 |
369 | 369 | LambdaUpdateWrapper<ShipmentContainerHeader> shipmentContainerHeaderLambdaUpdateWrapper = Wrappers.lambdaUpdate(); |
... | ... | @@ -416,9 +416,10 @@ public class ShipmentTaskService { |
416 | 416 | * @param containerCode 容器编码 |
417 | 417 | * @param taskType 任务类型 |
418 | 418 | */ |
419 | - public void updateShipmentLocationContainer(String fromLocation, String toLocation, String containerCode, Integer taskType){ | |
419 | + public void updateShipmentLocationContainer(String fromLocation, String toLocation, | |
420 | + String containerCode, Integer taskType, String warehouseCode){ | |
420 | 421 | //将库位状态改为空闲,如果是整出的对应的容器也清空 |
421 | - Location fromLocationRecord = locationService.getLocationByCode(fromLocation); | |
422 | + Location fromLocationRecord = locationService.getLocationByCode(fromLocation, warehouseCode); | |
422 | 423 | if (StringUtils.isNull(fromLocationRecord)) { |
423 | 424 | throw new ServiceException("系统没有" + fromLocation + "库位"); |
424 | 425 | } |
... | ... | @@ -444,7 +445,7 @@ public class ShipmentTaskService { |
444 | 445 | } |
445 | 446 | locationService.updateById(fromLocationRecord); |
446 | 447 | |
447 | - Container container = containerService.getContainerByCode(containerCode); | |
448 | + Container container = containerService.getContainerByCode(containerCode, warehouseCode); | |
448 | 449 | if (StringUtils.isEmpty(containerCode)) { |
449 | 450 | throw new ServiceException("系统无"+container+"容器"); |
450 | 451 | } |
... | ... | @@ -456,7 +457,7 @@ public class ShipmentTaskService { |
456 | 457 | } |
457 | 458 | } else { |
458 | 459 | containerService.updateLocationCodeAndStatus(containerCode, "", |
459 | - QuantityConstant.STATUS_CONTAINER_EMPTY); | |
460 | + QuantityConstant.STATUS_CONTAINER_EMPTY, warehouseCode); | |
460 | 461 | } |
461 | 462 | } else { |
462 | 463 | //查询是否存在关联的库存,入如果没有就修改容器状态为empty |
... | ... | @@ -465,9 +466,11 @@ public class ShipmentTaskService { |
465 | 466 | List<InventoryDetail> detailList = inventoryDetailService.list(inventoryDetaillambdaQueryWrapper); |
466 | 467 | //库存查询不到该容器就把容器状态改为可用 |
467 | 468 | if (detailList.isEmpty()) { |
468 | - containerService.updateLocationCodeAndStatus(containerCode, toLocation, QuantityConstant.STATUS_CONTAINER_EMPTY); | |
469 | + containerService.updateLocationCodeAndStatus(containerCode, toLocation, | |
470 | + QuantityConstant.STATUS_CONTAINER_EMPTY, warehouseCode); | |
469 | 471 | } else { |
470 | - containerService.updateLocationCodeAndStatus(containerCode, toLocation, QuantityConstant.STATUS_CONTAINER_SOME); | |
472 | + containerService.updateLocationCodeAndStatus(containerCode, toLocation, | |
473 | + QuantityConstant.STATUS_CONTAINER_SOME, warehouseCode); | |
471 | 474 | } |
472 | 475 | } |
473 | 476 | } |
... | ... |
src/main/java/com/huaheng/pc/task/taskHeader/service/TaskHeaderServiceImpl.java
... | ... | @@ -580,14 +580,15 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea |
580 | 580 | |
581 | 581 | @Transactional(rollbackFor = Exception.class) |
582 | 582 | public void combineInventory(TaskHeader task) { |
583 | + String warehouseCode = task.getWarehouseCode(); | |
583 | 584 | LambdaQueryWrapper<InventoryHeader> inventoryHeaderErapper = Wrappers.lambdaQuery(); |
584 | - inventoryHeaderErapper.eq(InventoryHeader::getWarehouseCode, ShiroUtils.getWarehouseCode()) | |
585 | + inventoryHeaderErapper.eq(InventoryHeader::getWarehouseCode, warehouseCode) | |
585 | 586 | .eq(InventoryHeader::getLocationCode, task.getToLocation()) |
586 | 587 | .eq(InventoryHeader::getContainerCode, task.getContainerCode()); |
587 | 588 | InventoryHeader header = inventoryHeaderService.getOne(inventoryHeaderErapper); |
588 | 589 | if (header != null) { |
589 | 590 | LambdaQueryWrapper<InventoryDetail> inventory = Wrappers.lambdaQuery(); |
590 | - inventory.eq(InventoryDetail::getWarehouseCode, ShiroUtils.getWarehouseCode()) | |
591 | + inventory.eq(InventoryDetail::getWarehouseCode, warehouseCode) | |
591 | 592 | .eq(InventoryDetail::getLocationCode, task.getToLocation()) |
592 | 593 | .eq(InventoryDetail::getContainerCode, task.getContainerCode()); |
593 | 594 | List<InventoryDetail> inventoryDetailList = inventoryDetailService.list(inventory); |
... | ... |
src/main/java/com/huaheng/pc/task/taskHeader/service/TransferTaskService.java
... | ... | @@ -204,6 +204,7 @@ public class TransferTaskService { |
204 | 204 | InventoryDetail inventoryDetail = null; |
205 | 205 | for (TaskDetail taskDetail : taskDetailList) { |
206 | 206 | taskDetail.setStatus(QuantityConstant.TASK_STATUS_COMPLETED); |
207 | + inventoryDetail = inventoryDetailService.getById(taskDetail.getToInventoryId()); | |
207 | 208 | inventoryHeadIdList.add(inventoryDetail.getInventoryHeaderId()); |
208 | 209 | InventoryTransaction inventoryTransaction = new InventoryTransaction(); |
209 | 210 | inventoryTransaction.setWarehouseCode(taskDetail.getWarehouseCode()); |
... | ... | @@ -241,12 +242,16 @@ public class TransferTaskService { |
241 | 242 | throw new ServiceException("任务单据状态更新失败!"); |
242 | 243 | } |
243 | 244 | if(inventoryDetail != null) { |
244 | - containerService.updateLocationCodeAndStatus(taskHeader.getContainerCode(), taskHeader.getToLocation(), QuantityConstant.STATUS_CONTAINER_SOME, warehouseCode); | |
245 | + containerService.updateLocationCodeAndStatus(taskHeader.getContainerCode(), | |
246 | + taskHeader.getToLocation(), QuantityConstant.STATUS_CONTAINER_SOME, warehouseCode); | |
245 | 247 | } else { |
246 | - containerService.updateLocationCodeAndStatus(taskHeader.getContainerCode(), taskHeader.getToLocation(), QuantityConstant.STATUS_CONTAINER_EMPTY, warehouseCode); | |
248 | + containerService.updateLocationCodeAndStatus(taskHeader.getContainerCode(), | |
249 | + taskHeader.getToLocation(), QuantityConstant.STATUS_CONTAINER_EMPTY, warehouseCode); | |
247 | 250 | } |
248 | - locationService.updateContainerCodeAndStatus(taskHeader.getFromLocation(), "", QuantityConstant.STATUS_LOCATION_EMPTY, warehouseCode); | |
249 | - locationService.updateContainerCodeAndStatus(taskHeader.getToLocation(), taskHeader.getContainerCode(), QuantityConstant.STATUS_LOCATION_EMPTY, warehouseCode); | |
251 | + locationService.updateContainerCodeAndStatus(taskHeader.getFromLocation(), "", | |
252 | + QuantityConstant.STATUS_LOCATION_EMPTY, warehouseCode); | |
253 | + locationService.updateContainerCodeAndStatus(taskHeader.getToLocation(), taskHeader.getContainerCode(), | |
254 | + QuantityConstant.STATUS_LOCATION_EMPTY, warehouseCode); | |
250 | 255 | inventoryHeadIdList = inventoryHeadIdList.stream().distinct().collect(Collectors.toList()); |
251 | 256 | LambdaUpdateWrapper<InventoryHeader> headerUpdateWrapper = Wrappers.lambdaUpdate(); |
252 | 257 | headerUpdateWrapper.set(InventoryHeader::getLocationCode, taskHeader.getToLocation()) |
... | ... |
src/main/java/com/huaheng/pc/task/taskHeader/service/WorkTaskService.java
... | ... | @@ -659,34 +659,38 @@ public class WorkTaskService { |
659 | 659 | if (StringUtils.isEmpty(taskHeader.getToLocation())) { |
660 | 660 | throw new ServiceException("任务" + taskHeader.getId() + "没有目的库位,执行中止"); |
661 | 661 | } |
662 | + String warehouseCode = taskHeader.getWarehouseCode(); | |
663 | + String containerCode = taskHeader.getContainerCode(); | |
662 | 664 | taskHeader.setStatus(QuantityConstant.TASK_STATUS_COMPLETED); |
663 | 665 | List<TaskDetail> taskDetailList = taskDetailService.findByTaskId(taskHeader.getId()); |
664 | - for (TaskDetail item : taskDetailList) { | |
665 | - item.setStatus(QuantityConstant.TASK_STATUS_COMPLETED); | |
666 | + if(taskDetailList != null && taskDetailList.size() > 0) { | |
667 | + for (TaskDetail item : taskDetailList) { | |
668 | + item.setStatus(QuantityConstant.TASK_STATUS_COMPLETED); | |
669 | + } | |
670 | + if (!taskDetailService.saveOrUpdateBatch(taskDetailList)) { | |
671 | + throw new ServiceException("任务单据状态更新失败!"); | |
672 | + } | |
666 | 673 | } |
667 | - if (!taskDetailService.saveOrUpdateBatch(taskDetailList) || | |
668 | - !taskHeaderService.saveOrUpdate(taskHeader)) { | |
669 | - throw new ServiceException("任务单据状态更新失败!"); | |
674 | + if (!taskHeaderService.saveOrUpdate(taskHeader)) { | |
675 | + throw new ServiceException("任务头状态更新失败!"); | |
670 | 676 | } |
671 | 677 | locationService.updateContainerCodeAndStatus(taskHeader.getFromLocation(), |
672 | - "", QuantityConstant.STATUS_LOCATION_EMPTY); | |
678 | + "", QuantityConstant.STATUS_LOCATION_EMPTY, warehouseCode); | |
673 | 679 | |
674 | 680 | locationService.updateContainerCodeAndStatus(taskHeader.getToLocation(), |
675 | - taskHeader.getContainerCode(), QuantityConstant.STATUS_LOCATION_EMPTY); | |
676 | - Container container = containerService.getContainerByCode(taskHeader.getContainerCode()); | |
677 | - container.setLocationCode(taskHeader.getToLocation()); | |
678 | - container.setStatus(QuantityConstant.STATUS_CONTAINER_EMPTY); | |
679 | - | |
681 | + containerCode, QuantityConstant.STATUS_LOCATION_EMPTY, warehouseCode); | |
682 | + containerService.updateLocationCodeAndStatus(containerCode, taskHeader.getToLocation(), | |
683 | + QuantityConstant.STATUS_CONTAINER_EMPTY, warehouseCode); | |
680 | 684 | LambdaQueryWrapper<InventoryHeader> lambdaQueryWrapper = Wrappers.lambdaQuery(); |
681 | - lambdaQueryWrapper.eq(InventoryHeader::getWarehouseCode, ShiroUtils.getWarehouseCode()) | |
685 | + lambdaQueryWrapper.eq(InventoryHeader::getWarehouseCode, warehouseCode) | |
682 | 686 | .eq(InventoryHeader::getLocationCode, taskHeader.getFromLocation()) |
683 | - .eq(InventoryHeader::getContainerCode, taskHeader.getContainerCode()); | |
687 | + .eq(InventoryHeader::getContainerCode, containerCode); | |
684 | 688 | InventoryHeader inventoryHeader= inventoryHeaderService.getOne(lambdaQueryWrapper); |
685 | 689 | if(inventoryHeader != null) { |
686 | 690 | inventoryHeader.setLocationCode(taskHeader.getToLocation()); |
687 | 691 | inventoryHeaderService.updateById(inventoryHeader); |
688 | 692 | LambdaQueryWrapper<InventoryDetail> lambdaQueryWrapper2 = Wrappers.lambdaQuery(); |
689 | - lambdaQueryWrapper2.eq(InventoryDetail::getWarehouseCode, ShiroUtils.getWarehouseCode()) | |
693 | + lambdaQueryWrapper2.eq(InventoryDetail::getWarehouseCode, warehouseCode) | |
690 | 694 | .eq(InventoryDetail::getInventoryHeaderId, inventoryHeader.getId()); |
691 | 695 | List<InventoryDetail> inventoryDetails = inventoryDetailService.list(lambdaQueryWrapper2); |
692 | 696 | if(inventoryDetails != null && inventoryDetails.size() > 0) { |
... | ... | @@ -694,15 +698,12 @@ public class WorkTaskService { |
694 | 698 | inventoryDetail.setLocationCode(taskHeader.getToLocation()); |
695 | 699 | inventoryDetailService.updateById(inventoryDetail); |
696 | 700 | } |
697 | - container.setStatus(QuantityConstant.STATUS_CONTAINER_SOME); | |
701 | + containerService.updateStatus(containerCode, QuantityConstant.STATUS_CONTAINER_SOME, warehouseCode); | |
698 | 702 | } |
699 | 703 | } |
700 | 704 | |
701 | - if (!containerService.updateById(container)) { | |
702 | - throw new ServiceException("更新容器状态失败"); | |
703 | - } | |
704 | 705 | |
705 | - return AjaxResult.success(); | |
706 | + return AjaxResult.success("完成出库查看任务成功"); | |
706 | 707 | } |
707 | 708 | |
708 | 709 | /** |
... | ... | @@ -781,26 +782,13 @@ public class WorkTaskService { |
781 | 782 | taskHeader.setFromLocation(locationCode); |
782 | 783 | taskHeader.setToLocation(locationCode); |
783 | 784 | taskHeader.setPort(port); |
784 | - if(taskHeaderService.save(taskHeader)){ | |
785 | - //锁定库位状态 | |
786 | - locationService.updateStatus(locationCode,QuantityConstant.STATUS_LOCATION_LOCK); | |
787 | - containerService.updateStatus(containerCode, QuantityConstant.STATUS_CONTAINER_LOCK); | |
788 | - } else { | |
785 | + if(!taskHeaderService.save(taskHeader)){ | |
789 | 786 | throw new ServiceException("空托出库主表生成失败!"); |
790 | 787 | } |
791 | - //写入任务细表 | |
792 | - TaskDetail taskDetail = new TaskDetail(); | |
793 | - taskDetail.setTaskId(taskHeader.getId()); | |
794 | - taskDetail.setTaskType(taskHeader.getTaskType()); | |
795 | - taskDetail.setInternalTaskType(taskHeader.getInternalTaskType()); | |
796 | - taskDetail.setWarehouseCode(taskHeader.getWarehouseCode()); | |
797 | - taskDetail.setCompanyCode(ShiroUtils.getCompanyCodeList().get(0)); | |
798 | - taskDetail.setFromLocation(taskHeader.getFromLocation()); | |
799 | - taskDetail.setToLocation(taskHeader.getToLocation()); | |
800 | - taskDetail.setContainerCode(taskHeader.getContainerCode()); | |
801 | - if(!taskDetailService.save(taskDetail)){ | |
802 | - throw new ServiceException("空托出库任务明细生成失败!"); | |
803 | - } | |
788 | + //锁定库位状态 | |
789 | + locationService.updateStatus(locationCode,QuantityConstant.STATUS_LOCATION_LOCK, ShiroUtils.getWarehouseCode()); | |
790 | + containerService.updateStatus(containerCode, QuantityConstant.STATUS_CONTAINER_LOCK, ShiroUtils.getWarehouseCode()); | |
791 | + | |
804 | 792 | return AjaxResult.success(taskHeader.getId()); |
805 | 793 | } |
806 | 794 | |
... | ... |
src/main/resources/templates/receipt/receiptHeader/receiptHeader.html
... | ... | @@ -46,7 +46,7 @@ |
46 | 46 | </li> |
47 | 47 | <li> |
48 | 48 | <!--入库类型:<input type="text" name="sourceCode"/>--> |
49 | - 入库类型:<select name="type" th:with="type=${@receiptTypeService.getType()}" id="type"> | |
49 | + 入库类型:<select name="receiptType" th:with="type=${@receiptTypeService.getType()}" id="receiptType"> | |
50 | 50 | <option value="">所有</option> |
51 | 51 | <option th:each="e : ${type}" th:text="${e['name']}" th:value="${e['code']}"></option></select> |
52 | 52 | </li> |
... | ... |