Commit 1b1068db24a0141c7ebcb4ee4811500042b8c892
1 parent
6212cfc3
任务页面新增单据搜索功能
Showing
7 changed files
with
89 additions
and
76 deletions
src/main/java/com/huaheng/api/wcs/service/warecellAllocation/LocationAllocationServiceImpl.java
... | ... | @@ -239,7 +239,6 @@ public class LocationAllocationServiceImpl implements LocationAllocationService |
239 | 239 | public String doubleRk(String roadWay, int high, Integer frequencyLocation, Integer emptyContainerTask, boolean isFlammable, String taskNo, boolean bypass) { |
240 | 240 | //boolean isSecondFactory = isSecondFactory();//是否是二厂项目 |
241 | 241 | int reserveNumber = 0; |
242 | - //二厂,分拣任务回库的时候,也要判断预留库位 | |
243 | 242 | if (!bypass) { |
244 | 243 | reserveNumber = getReserveNumber(roadWay); |
245 | 244 | } |
... | ... | @@ -264,8 +263,7 @@ public class LocationAllocationServiceImpl implements LocationAllocationService |
264 | 263 | .eq(Location::getContainerCode, "") |
265 | 264 | .eq(Location::getSelfCreated, NO_TSELFCREATED) |
266 | 265 | .eq(Location::getOnlyEmptyContainer, NO_EMPTY_CONTAINER_LOCATION) |
267 | - .eq(Location::getHigh, high) | |
268 | - .last(" limit 20"); | |
266 | + .eq(Location::getHigh, high); | |
269 | 267 | //if (isSecondFactory) { |
270 | 268 | // wrapper.ge(Location::getHigh, high); |
271 | 269 | //} else { |
... | ... | @@ -287,8 +285,7 @@ public class LocationAllocationServiceImpl implements LocationAllocationService |
287 | 285 | .eq(Location::getOnlyEmptyContainer, NO_EMPTY_CONTAINER_LOCATION) |
288 | 286 | .orderByAsc(Location::getHigh) |
289 | 287 | .orderByAsc(Location::getILayer) |
290 | - .orderByAsc(Location::getId) | |
291 | - .last(" limit 20"); | |
288 | + .orderByAsc(Location::getId); | |
292 | 289 | //if (isSecondFactory) { |
293 | 290 | // locationLambda.ge(Location::getHigh, high); |
294 | 291 | //} else { |
... | ... | @@ -321,8 +318,7 @@ public class LocationAllocationServiceImpl implements LocationAllocationService |
321 | 318 | .eq(Location::getHigh, high) |
322 | 319 | .orderByAsc(Location::getHigh) |
323 | 320 | .orderByAsc(Location::getILayer) |
324 | - .orderByAsc(Location::getId) | |
325 | - .last(" limit 20"); | |
321 | + .orderByAsc(Location::getId); | |
326 | 322 | //if (isSecondFactory) { |
327 | 323 | // locationLambda2.ge(Location::getHigh, high); |
328 | 324 | //} else { |
... | ... | @@ -367,8 +363,7 @@ public class LocationAllocationServiceImpl implements LocationAllocationService |
367 | 363 | .eq(Location::getContainerCode, "") |
368 | 364 | .eq(Location::getSelfCreated, SELFCREATED) |
369 | 365 | .eq(Location::getOnlyEmptyContainer, NO_EMPTY_CONTAINER_LOCATION) |
370 | - .eq(Location::getHigh, high) | |
371 | - .last(" limit 20"); | |
366 | + .eq(Location::getHigh, high); | |
372 | 367 | //if (isSecondFactory) { |
373 | 368 | // wrapper.ge(Location::getHigh, high); |
374 | 369 | //} else { |
... | ... | @@ -391,8 +386,7 @@ public class LocationAllocationServiceImpl implements LocationAllocationService |
391 | 386 | .eq(Location::getOnlyEmptyContainer, NO_EMPTY_CONTAINER_LOCATION) |
392 | 387 | .orderByAsc(Location::getHigh) |
393 | 388 | .orderByAsc(Location::getILayer) |
394 | - .orderByAsc(Location::getId) | |
395 | - .last(" limit 20"); | |
389 | + .orderByAsc(Location::getId); | |
396 | 390 | |
397 | 391 | //if (isSecondFactory) { |
398 | 392 | // locationLambda.ge(Location::getHigh, high); |
... | ... | @@ -426,8 +420,7 @@ public class LocationAllocationServiceImpl implements LocationAllocationService |
426 | 420 | .eq(Location::getHigh, high) |
427 | 421 | .orderByAsc(Location::getHigh) |
428 | 422 | .orderByAsc(Location::getILayer) |
429 | - .orderByAsc(Location::getId) | |
430 | - .last(" limit 20"); | |
423 | + .orderByAsc(Location::getId); | |
431 | 424 | //if (isSecondFactory) { |
432 | 425 | // locationLambda2.ge(Location::getHigh, high); |
433 | 426 | //} else { |
... | ... | @@ -479,8 +472,7 @@ public class LocationAllocationServiceImpl implements LocationAllocationService |
479 | 472 | .eq(Location::getContainerCode, "") |
480 | 473 | .eq(Location::getSelfCreated, NO_TSELFCREATED) |
481 | 474 | .eq(Location::getHigh, high) |
482 | - .eq(Location::getOnlyEmptyContainer, NO_EMPTY_CONTAINER_LOCATION) | |
483 | - .last(" limit 20"); | |
475 | + .eq(Location::getOnlyEmptyContainer, NO_EMPTY_CONTAINER_LOCATION); | |
484 | 476 | |
485 | 477 | //if (isSecondFactory) { |
486 | 478 | // wrapper.ge(Location::getHigh, high); |
... | ... |
src/main/java/com/huaheng/pc/monitor/job/task/RyTask.java
... | ... | @@ -349,8 +349,7 @@ public class RyTask extends BaseController { |
349 | 349 | .eq(TaskHeader::getStatus, QuantityConstant.TASK_STATUS_COMPLETED) |
350 | 350 | .lt(TaskHeader::getPushErrorCount, 2) |
351 | 351 | .in(TaskHeader::getTaskType, QuantityConstant.TASK_TYPE_WHOLERECEIPT, QuantityConstant.TASK_TYPE_SUPPLEMENTRECEIPT) |
352 | - .eq(TaskHeader::getBackMoM, 0) | |
353 | - .last("LIMIT 5"); | |
352 | + .eq(TaskHeader::getBackMoM, 0); | |
354 | 353 | List<TaskHeader> taskHeaderList = taskHeaderService.list(taskHeaderLambdaQueryWrapper); |
355 | 354 | for (TaskHeader taskHeader : taskHeaderList) { |
356 | 355 | try { |
... | ... | @@ -708,56 +707,37 @@ public class RyTask extends BaseController { |
708 | 707 | } |
709 | 708 | |
710 | 709 | |
711 | - public void saveWcsTaskRecord() { | |
712 | - String date = DateUtils.getDate(); | |
713 | - LambdaQueryWrapper<TaskTime> lambdaQueryWrapper = new LambdaQueryWrapper<>(); | |
714 | - lambdaQueryWrapper.eq(TaskTime::getCreatedTime, date); | |
715 | - lambdaQueryWrapper.last("limit 1"); | |
716 | - TaskTime OneTaskTime = taskTimeMapper.selectOne(lambdaQueryWrapper); | |
717 | - if (!Objects.isNull(OneTaskTime)) { | |
718 | - return; | |
719 | - } | |
720 | - String startTime = StringUtils.join(date, " 00:00:00"); | |
721 | - String endTime = StringUtils.join(date, " 23:59:59"); | |
722 | - Map<String, Object> map = srmTaskInfoService.getData(startTime, endTime); | |
723 | - List<TaskTime> taskTimeMapListResult = (List<TaskTime>) map.get("taskTimeMapListResult"); | |
724 | - List<TaskNum> taskNumMapListResult = (List<TaskNum>) map.get("taskNumMapListResult"); | |
725 | - List<SrmStatusTime> srmStatusMapList = (List<SrmStatusTime>) map.get("srmStatusMapList"); | |
726 | - List<TaskTime> taskTimes = BeanUtil.copyToList(taskTimeMapListResult, TaskTime.class); | |
727 | - List<TaskNum> taskNums = BeanUtil.copyToList(taskNumMapListResult, TaskNum.class); | |
728 | - List<SrmStatusTime> statusTimes = BeanUtil.copyToList(srmStatusMapList, SrmStatusTime.class); | |
729 | - taskTimes.forEach(taskTime -> taskTimeMapper.insert(taskTime)); | |
730 | - taskNums.forEach(taskNum -> taskNumMapper.insert(taskNum)); | |
731 | - statusTimes.forEach(srmStatusTime -> srmStatusTimeMapper.insert(srmStatusTime)); | |
732 | - } | |
733 | - | |
734 | - | |
735 | 710 | //修复错误的单据状态 建议十分钟一次 |
736 | 711 | public void fixErroneousBillStatus() { |
737 | - //List<ReceiptHeader> receiptHeaderList = receiptHeaderService.list(new LambdaQueryWrapper<ReceiptHeader>() | |
738 | - // .eq(ReceiptHeader::getFirstStatus, QuantityConstant.RECEIPT_HEADER_POSTING) | |
739 | - // .ne(ReceiptHeader::getLastStatus, QuantityConstant.RECEIPT_HEADER_POSTING) | |
740 | - // .eq(ReceiptHeader::getDeleted, 1)); | |
741 | - // | |
742 | - //List<ReceiptHeader> newReceiptHeaderList = receiptHeaderList.stream() | |
743 | - // .filter(receiptHeader -> { | |
744 | - // List<ReceiptDetail> receiptDetails = receiptDetailService.list(new LambdaQueryWrapper<ReceiptDetail>().eq(ReceiptDetail::getReceiptId, receiptHeader.getId())); | |
745 | - // return receiptDetails.stream().allMatch(detail -> detail.getQty().equals(detail.getTaskQty())); | |
746 | - // }) | |
747 | - // .collect(Collectors.toList()); | |
748 | - // | |
749 | - //for (ReceiptHeader receiptHeader : newReceiptHeaderList) { | |
750 | - // | |
751 | - // int taskCount = taskDetailService.count(new LambdaQueryWrapper<TaskDetail>() | |
752 | - // .eq(TaskDetail::getBillCode, receiptHeader.getCode()) | |
753 | - // .eq(TaskDetail::getInternalTaskType, QuantityConstant.TASK_TYPE_WHOLERECEIPT) | |
754 | - // .ne(TaskDetail::getStatus, QuantityConstant.TASK_STATUS_COMPLETED)); | |
755 | - // if (taskCount == 0) { | |
756 | - // receiptHeader.setLastStatus(QuantityConstant.RECEIPT_HEADER_POSTING); | |
757 | - // receiptHeader.setErrorMsg("单据尾状态异常"); | |
758 | - // receiptHeaderService.updateById(receiptHeader); | |
759 | - // } | |
760 | - //} | |
712 | + List<ReceiptHeader> receiptHeaderList = receiptHeaderService.list(new LambdaQueryWrapper<ReceiptHeader>() | |
713 | + .eq(ReceiptHeader::getFirstStatus, QuantityConstant.RECEIPT_HEADER_RETURN) | |
714 | + .eq(ReceiptHeader::getLastStatus, QuantityConstant.RECEIPT_HEADER_POSTING) | |
715 | + .eq(ReceiptHeader::getDeleted, 1)); | |
716 | + // ReceiptDetail 的数量 (qty) 和任务数量 (taskQty) 相等时,该 ReceiptHeader 才会被保留在新的列表中。 | |
717 | + List<ReceiptHeader> newReceiptHeaderList = receiptHeaderList.stream() | |
718 | + .filter(receiptHeader -> { | |
719 | + List<ReceiptDetail> receiptDetails = receiptDetailService.list(new LambdaQueryWrapper<ReceiptDetail>().eq(ReceiptDetail::getReceiptId, receiptHeader.getId())); | |
720 | + return receiptDetails.stream().allMatch(detail -> detail.getQty().equals(detail.getTaskQty())); | |
721 | + }) | |
722 | + .collect(Collectors.toList()); | |
723 | + | |
724 | + //查询任务是否都已回传,已回传就完成单据,让它进入历史 | |
725 | + for (ReceiptHeader receiptHeader : newReceiptHeaderList) { | |
726 | + List<TaskDetail> detailList = taskDetailService.list(new LambdaQueryWrapper<TaskDetail>() | |
727 | + .eq(TaskDetail::getBillCode, receiptHeader.getCode()) | |
728 | + .eq(TaskDetail::getInternalTaskType, QuantityConstant.TASK_TYPE_WHOLERECEIPT)); | |
729 | + | |
730 | + Integer[] taskIds = detailList.stream().map(TaskDetail::getTaskId).distinct().toArray(Integer[]::new); | |
731 | + | |
732 | + List<TaskHeader> taskHeaderList = taskHeaderService.getTasksByIds(taskIds); | |
733 | + boolean flag = taskHeaderList.stream().allMatch(taskHeader -> taskHeader.getBackMoM() == 1); | |
734 | + if (flag) { | |
735 | + receiptHeader.setPushSuccessStatus(1); | |
736 | + receiptHeader.setLastStatus(QuantityConstant.RECEIPT_HEADER_RETURN); | |
737 | + receiptHeader.setErrorMsg("单据尾状态异常"); | |
738 | + receiptHeaderService.updateById(receiptHeader); | |
739 | + } | |
740 | + } | |
761 | 741 | |
762 | 742 | |
763 | 743 | //出库单----------------------------------------- |
... | ... |
src/main/java/com/huaheng/pc/task/taskHeader/controller/TaskHeaderController.java
... | ... | @@ -126,6 +126,7 @@ public class TaskHeaderController extends BaseController { |
126 | 126 | .gt(StringUtils.isNotEmpty(createdBegin), TaskHeader::getCreated, createdBegin) |
127 | 127 | .lt(StringUtils.isNotEmpty(createdEnd), TaskHeader::getCreated, createdEnd) |
128 | 128 | .gt(StringUtils.isNotEmpty(completeTimeBegin), TaskHeader::getCompleteTime, completeTimeBegin) |
129 | + .in(StringUtils.isNotEmpty(taskHeader.getBillCode()), TaskHeader::getId, taskDetailService.list(new LambdaQueryWrapper<TaskDetail>().eq(TaskDetail::getBillCode, taskHeader.getBillCode())).stream().map(TaskDetail::getTaskId).collect(Collectors.toList())) | |
129 | 130 | .lt(StringUtils.isNotEmpty(completeTimeEnd), TaskHeader::getCompleteTime, completeTimeEnd) |
130 | 131 | .orderByAsc(TaskHeader::getStatus) |
131 | 132 | .orderByDesc(TaskHeader::getId); |
... | ... |
src/main/java/com/huaheng/pc/task/taskHeader/domain/TaskHeader.java
... | ... | @@ -431,5 +431,13 @@ public class TaskHeader implements Serializable { |
431 | 431 | |
432 | 432 | @TableField(exist = false) |
433 | 433 | private String zoneName; |
434 | + | |
435 | + @TableField(exist = false) | |
436 | + private String billCode; | |
437 | + | |
438 | + @TableField(exist = false) | |
439 | + private String receiptCode; | |
434 | 440 | |
441 | + @TableField(exist = false) | |
442 | + private String shipmentCode; | |
435 | 443 | } |
... | ... |
src/main/java/com/huaheng/pc/task/taskHeader/service/ReceiptTaskService.java
... | ... | @@ -486,6 +486,25 @@ public class ReceiptTaskService { |
486 | 486 | throw new ServiceException("更新入库组盘头表状态失败"); |
487 | 487 | } |
488 | 488 | } |
489 | + //任务明细为空,任务类型为补充入库 | |
490 | + if (taskDetailList.isEmpty() && task.getTaskType().equals(QuantityConstant.TASK_TYPE_SUPPLEMENTRECEIPT)) { | |
491 | + List<ReceiptContainerHeader> list = receiptContainerHeaderService.list(new LambdaQueryWrapper<ReceiptContainerHeader>() | |
492 | + .eq(ReceiptContainerHeader::getFromLocation, task.getFromLocation()) | |
493 | + .eq(ReceiptContainerHeader::getStatus, QuantityConstant.RECEIPT_HEADER_BUILD) | |
494 | + .eq(ReceiptContainerHeader::getContainerCode, task.getContainerCode())); | |
495 | + if (!list.isEmpty()) { | |
496 | + //取消组盘 | |
497 | + if (list.size() > 1) { | |
498 | + throw new ServiceException("完成空明细补充入库任务时,获取的组盘输了大于1,请根据来源库位和容器排查为什么会有两条"); | |
499 | + } | |
500 | + Integer id = list.get(0).getId(); | |
501 | + if (!receiptContainerHeaderService.cancelByIds(Collections.singletonList(id))) { | |
502 | + throw new ServiceException("完成空明细补充入库任务时,取消组盘失败"); | |
503 | + } | |
504 | + } | |
505 | + } | |
506 | + | |
507 | + | |
489 | 508 | return AjaxResult.success(); |
490 | 509 | } |
491 | 510 | |
... | ... | @@ -660,6 +679,7 @@ public class ReceiptTaskService { |
660 | 679 | ReceiptDetail receiptDetail = receiptDetailService.getById(taskDetail.getBillDetailId()); |
661 | 680 | |
662 | 681 | if (!"MOM".equals(receiptDetail.getCreatedBy())) { |
682 | + updateTaskHeaderWithSuccess(taskHeader); | |
663 | 683 | continue; // 只处理创建者为MOM的明细 |
664 | 684 | } |
665 | 685 | |
... | ... | @@ -673,6 +693,12 @@ public class ReceiptTaskService { |
673 | 693 | continue; |
674 | 694 | } |
675 | 695 | |
696 | + //快速入平库,也不用回传 | |
697 | + if (receiptHeader.getIsFastReceipt() == 1) { | |
698 | + updateTaskHeaderWithSuccess(taskHeader); | |
699 | + continue; | |
700 | + } | |
701 | + | |
676 | 702 | // 调用接口进行回传操作 |
677 | 703 | ReturnInfo returnInfo = mesReceiptController.postE_Rd_In(receiptDetail); |
678 | 704 | processReturnInfo(returnInfo, taskDetail, taskHeader, receiptHeader); |
... | ... |
src/main/resources/templates/receipt/receiptContainerHeader/receiptContainerHeader.html
... | ... | @@ -34,16 +34,15 @@ |
34 | 34 | <li> |
35 | 35 | 库位编号:<input type="text" name="toLocation"/> |
36 | 36 | </li> |
37 | - <li> | |
38 | - <!--入库类型:<input type="text" name="sourceCode"/> | |
39 | - --> | |
40 | - 任务类型:<select name="taskType" | |
41 | - th:with="type=${@dict.getType('receiptTaskType')}"> | |
42 | - <option value="">所有</option> | |
43 | - <option th:each="e : ${type}" th:text="${e['dictLabel']}" | |
44 | - th:value="${e['dictValue']}"></option> | |
45 | - </select> | |
46 | - </li> | |
37 | +<!-- <li>--> | |
38 | +<!-- <!–入库类型:<input type="text" name="sourceCode"/>--> | |
39 | +<!-- –>--> | |
40 | +<!-- 任务类型:<select name="taskType" th:with="type=${@dict.getType('receiptTaskType')}">--> | |
41 | +<!-- <option value="">所有</option>--> | |
42 | +<!-- <option th:each="e : ${type}" th:text="${e['dictLabel']}"--> | |
43 | +<!-- th:value="${e['dictValue']}"></option>--> | |
44 | +<!-- </select>--> | |
45 | +<!-- </li>--> | |
47 | 46 | <li> |
48 | 47 | <!--头 状 态:<input type="text" name="firstStatus"/>--> |
49 | 48 | 容器任务状态:<select name="Status" |
... | ... | @@ -142,8 +141,12 @@ |
142 | 141 | title: '容器编号', |
143 | 142 | }, |
144 | 143 | { |
144 | + field: 'fromLocation', | |
145 | + title: '来源库位编号', | |
146 | + }, | |
147 | + { | |
145 | 148 | field: 'toLocation', |
146 | - title: '库位编号', | |
149 | + title: '目标库位编号', | |
147 | 150 | }, |
148 | 151 | { |
149 | 152 | field: 'taskType', |
... | ... |
src/main/resources/templates/task/taskHeader/taskHeader.html
... | ... | @@ -46,6 +46,9 @@ |
46 | 46 | 任务id:<input type="text" name="id"/> |
47 | 47 | </li> |
48 | 48 | <li> |
49 | + 单据编码:<input type="billCode" name="billCode"/> | |
50 | + </li> | |
51 | + <li> | |
49 | 52 | 任务类型:<select id="taskType" name="taskType" |
50 | 53 | th:with="type=${@dict.getType('taskType')}"> |
51 | 54 | <option value="">所有</option> |
... | ... |