Commit 7bed896e874ef541035d9e6249b1187e2c3b6c19
1 parent
bf1d1e44
fix:agv任务下发;
Showing
8 changed files
with
63 additions
and
19 deletions
src/main/java/com/huaheng/api/acs/controller/AgvTaskCSController.java
... | ... | @@ -93,7 +93,7 @@ public class AgvTaskCSController extends BaseController { |
93 | 93 | String containerCode=taskHeader.getContainerCode(); |
94 | 94 | List<Location> list=locationService.getLocationListByContainerCode(taskHeader.getWarehouseCode(),containerCode,taskHeader.getToLocation()); |
95 | 95 | mmap.put("locationList", list); |
96 | - List<Station> stationList=stationService.getStationByContainers(taskHeader.getContainerCode(),"3"); | |
96 | + List<Station> stationList=stationService.getStationByContainers(taskHeader.getContainerCode(),"3",taskHeader.getWarehouseCode()); | |
97 | 97 | mmap.put("stationList", stationList); |
98 | 98 | return prefix + "/agvSetPort"; |
99 | 99 | } |
... | ... |
src/main/java/com/huaheng/api/acs/service/AgvTaskCSServiceImpl.java
... | ... | @@ -134,7 +134,9 @@ public class AgvTaskCSServiceImpl extends ServiceImpl<AgvTaskCsMapper, AgvTaskCS |
134 | 134 | return AjaxResult.error("出库任务未完成,还不能下发agv任务"); |
135 | 135 | } |
136 | 136 | } |
137 | - if(flag){ | |
137 | + //为1时,地面站台自动回库;演示用 | |
138 | + String value= configService.getKey("AUTO_AGV_BACK",task.getWarehouseCode()); | |
139 | + if(StringUtils.isNotEmpty(value)&&value.equals("1")){ | |
138 | 140 | //agv库,地面站台分拣任务的入库任务,手动状态下发任务;自动状态下不下发 |
139 | 141 | if (task.getWarehouseCode().equals(QuantityConstant.WAREHOUSE_CS)&&task.getZoneCode().equals("V")) { |
140 | 142 | if(task.getTaskType().equals(QuantityConstant.AGV_TYPE_TAKE)&&!task.getFromPort().equals(QuantityConstant.AGV_PORT_CS)){ |
... | ... | @@ -762,7 +764,7 @@ public class AgvTaskCSServiceImpl extends ServiceImpl<AgvTaskCsMapper, AgvTaskCS |
762 | 764 | task.setPort(taskHeader.getPort()); |
763 | 765 | task.setToPort(taskHeader.getToPort()); |
764 | 766 | task.setToLocation(taskHeader.getToLocation()); |
765 | - task.setStatus(QuantityConstant.TASK_STATUS_RELEASE); | |
767 | +// task.setStatus(QuantityConstant.TASK_STATUS_RELEASE); | |
766 | 768 | |
767 | 769 | String tolocation=task.getToLocation(); |
768 | 770 | AgvTaskCS agvTaskCS=null; |
... | ... |
src/main/java/com/huaheng/pc/config/station/controller/StationLkController.java
... | ... | @@ -321,7 +321,7 @@ public class StationLkController extends BaseController { |
321 | 321 | @ResponseBody |
322 | 322 | public Map<String, Object> getStationByContainers(StationType stationType) { |
323 | 323 | Map<String, Object> map = new HashMap<>(); |
324 | - List<Station> stationList = stationService.getStationByContainers(stationType.getContainerCode(),stationType.getType()); | |
324 | + List<Station> stationList = stationService.getStationByContainers(stationType.getContainerCode(),stationType.getType(),"CS0001"); | |
325 | 325 | List<Map<String, Object>> list = new ArrayList<>(); |
326 | 326 | for (Station station : stationList) { |
327 | 327 | Map<String, Object> resultMap = new HashMap<>(); |
... | ... |
src/main/java/com/huaheng/pc/config/station/service/StationService.java
... | ... | @@ -54,8 +54,8 @@ public class StationService extends ServiceImpl<StationMapper, Station> { |
54 | 54 | List<Station> stationList = this.list(queryWrapper); |
55 | 55 | return stationList; |
56 | 56 | } |
57 | - public List<Station> getStationByContainers(String containerCode,String type){ | |
58 | - Container container = containerService.getContainerByCode(containerCode); | |
57 | + public List<Station> getStationByContainers(String containerCode,String type,String warehouseCode){ | |
58 | + Container container = containerService.getContainerByCode(containerCode,warehouseCode); | |
59 | 59 | ContainerType containerType = containerTypeService.getContainerTypeByCode(container.getContainerType(), container.getWarehouseCode()); |
60 | 60 | Map<String, Object> map = new HashMap<>(); |
61 | 61 | if (container == null) { |
... | ... |
src/main/java/com/huaheng/pc/monitor/job/task/RyTask.java
... | ... | @@ -24,6 +24,7 @@ import com.huaheng.pc.config.location.domain.Location; |
24 | 24 | import com.huaheng.pc.config.location.service.LocationService; |
25 | 25 | import com.huaheng.pc.config.station.service.StationService; |
26 | 26 | import com.huaheng.pc.config.zone.service.ZoneService; |
27 | +import com.huaheng.pc.inventory.inventoryHeader.domain.InventoryHeader; | |
27 | 28 | import com.huaheng.pc.inventory.inventoryHeader.service.InventoryHeaderService; |
28 | 29 | import com.huaheng.pc.inventory.snapshotInventoryDetail.domain.SnapshotInventoryDetail; |
29 | 30 | import com.huaheng.pc.inventory.snapshotInventoryDetail.service.ISnapshotInventoryDetailService; |
... | ... | @@ -612,18 +613,27 @@ public class RyTask extends BaseController { |
612 | 613 | .and(i -> i.ne(Container::getLocationCode, "").isNotNull(Container::getLocationCode)) |
613 | 614 | .eq(StringUtils.isNotEmpty(zoneCode), Container::getZoneCode, zoneCode) |
614 | 615 | .eq(Container::getStatus, QuantityConstant.STATUS_CONTAINER_EMPTY) |
615 | -// .last("limit 1")); | |
616 | 616 | .last(" order by rand() limit 1")); |
617 | 617 | if (container == null) { |
618 | 618 | continue; |
619 | 619 | } |
620 | 620 | AjaxResult ajaxResult = inventoryHeaderService.createEmptyCheckOut(container.getCode(), container.getLocationCode(), str, QuantityConstant.WAREHOUSE_CS); |
621 | +// InventoryHeader inventoryHeader= inventoryHeaderService.getOne(new LambdaQueryWrapper<InventoryHeader>() | |
622 | +// .eq(InventoryHeader::getWarehouseCode, QuantityConstant.WAREHOUSE_CS) | |
623 | +// .and(i -> i.ne(InventoryHeader::getLocationCode, "").isNotNull(InventoryHeader::getLocationCode)) | |
624 | +// .eq(StringUtils.isNotEmpty(zoneCode), InventoryHeader::getZoneCode, zoneCode) | |
625 | +// .last(" order by rand() limit 1")); | |
626 | +// if(inventoryHeader==null){ | |
627 | +// continue; | |
628 | +// } | |
629 | +// AjaxResult ajaxResult = inventoryHeaderService.createCheckOutTask(Arrays.asList(Convert.toIntArray(inventoryHeader.getId().toString())), port); | |
621 | 630 | if (!ajaxResult.hasErr()) { |
622 | 631 | Integer taskid = (Integer) ajaxResult.getData(); |
623 | 632 | TaskHeader taskHeader = new TaskHeader(); |
624 | 633 | taskHeader.setId(taskid); |
625 | 634 | taskHeader.setPort(str); |
626 | 635 | taskHeader.setToLocation(container.getLocationCode()); |
636 | +// taskHeader.setToLocation(inventoryHeader.getLocationCode()); | |
627 | 637 | agvTaskService.setAgvPort(taskHeader); |
628 | 638 | } |
629 | 639 | } |
... | ... |
src/main/java/com/huaheng/pc/task/taskHeader/controller/TaskHeaderController.java
... | ... | @@ -41,7 +41,9 @@ import org.springframework.web.bind.annotation.*; |
41 | 41 | import javax.annotation.Resource; |
42 | 42 | import javax.servlet.http.HttpServletRequest; |
43 | 43 | import java.util.ArrayList; |
44 | +import java.util.HashMap; | |
44 | 45 | import java.util.List; |
46 | +import java.util.Map; | |
45 | 47 | |
46 | 48 | |
47 | 49 | @Controller |
... | ... | @@ -428,7 +430,7 @@ public class TaskHeaderController extends BaseController { |
428 | 430 | } |
429 | 431 | List<String> list = new ArrayList<>(); |
430 | 432 | list.add(locationCode); |
431 | - return workTaskService.createCheckOutTask(list, null); | |
433 | + return workTaskService.createCheckOutTask(list, null,null); | |
432 | 434 | } |
433 | 435 | |
434 | 436 | /** |
... | ... | @@ -587,10 +589,28 @@ public class TaskHeaderController extends BaseController { |
587 | 589 | List<Location> list=locationService.getLocationListByContainerCode(taskHeader.getWarehouseCode(),taskHeader.getContainerCode(),taskHeader.getToLocation()); |
588 | 590 | mmap.put("locationList", list); |
589 | 591 | } |
590 | - List<Station> stationList=stationService.getStationByContainers(taskHeader.getContainerCode(),type); | |
592 | + List<Station> stationList=stationService.getStationByContainers(taskHeader.getContainerCode(),type,taskHeader.getWarehouseCode()); | |
591 | 593 | mmap.put("stationList", stationList); |
592 | 594 | return prefix + "/lkSetPort"; |
593 | 595 | } |
596 | + | |
597 | + @PostMapping("/getLKPortData") | |
598 | + @ResponseBody | |
599 | + public AjaxResult getLKPortData(@RequestBody TaskHeader task) { | |
600 | + Map map=new HashMap<String,Object>(); | |
601 | + TaskHeader taskHeader=taskHeaderService.getById(task.getId()); | |
602 | + List<Station> dmStationList=stationService.getStationByAreaType(null,"2",taskHeader.getWarehouseCode()); | |
603 | + map.put("taskId",taskHeader.getId()); | |
604 | + map.put("containerCode",taskHeader.getContainerCode()); | |
605 | + map.put("dmStationList",dmStationList); | |
606 | + String type="2"; | |
607 | + if(taskHeader.getZoneCode().equals("V")){ | |
608 | + type="3"; | |
609 | + } | |
610 | + List<Station> stationList=stationService.getStationByContainers(taskHeader.getContainerCode(),type,taskHeader.getWarehouseCode()); | |
611 | + map.put("stationList", stationList); | |
612 | + return AjaxResult.success().setData(map); | |
613 | + } | |
594 | 614 | @Log(title = "分配站台", operating = "分配站台", action = BusinessType.GRANT) |
595 | 615 | @PostMapping("/setLKPort") |
596 | 616 | @ResponseBody |
... | ... |
src/main/java/com/huaheng/pc/task/taskHeader/service/TaskHeaderService.java
... | ... | @@ -479,6 +479,10 @@ public class TaskHeaderService extends ServiceImpl<TaskHeaderMapper, TaskHeader> |
479 | 479 | return AjaxResult.error(ajaxResult.getMsg()); |
480 | 480 | } |
481 | 481 | break; |
482 | + case "V": | |
483 | + task = this.updateTaskRelease(task); | |
484 | + break; | |
485 | + | |
482 | 486 | } |
483 | 487 | |
484 | 488 | } |
... | ... |
src/main/java/com/huaheng/pc/task/taskHeader/service/WorkTaskService.java
... | ... | @@ -719,9 +719,13 @@ public class WorkTaskService { |
719 | 719 | * @param port 出库口 |
720 | 720 | * @return |
721 | 721 | */ |
722 | - public AjaxResult createCheckOutTask(List<String> locationCodeList, String port) { | |
722 | + public AjaxResult createCheckOutTask(List<String> locationCodeList, String port,String warehouseCode) { | |
723 | + if (ShiroUtils.getUser() != null ) { | |
724 | + warehouseCode=ShiroUtils.getWarehouseCode(); | |
725 | + } | |
726 | + Integer taskid=null; | |
723 | 727 | for (String locationCode : locationCodeList) { |
724 | - Location location = locationService.getLocationByCode(locationCode); | |
728 | + Location location = locationService.getLocationByCode(locationCode,warehouseCode); | |
725 | 729 | if (StringUtils.isNull(location)) { |
726 | 730 | throw new ServiceException("库存没有库位!"); |
727 | 731 | } |
... | ... | @@ -733,7 +737,7 @@ public class WorkTaskService { |
733 | 737 | } |
734 | 738 | |
735 | 739 | TaskHeader taskHeader = new TaskHeader(); |
736 | - taskHeader.setWarehouseCode(ShiroUtils.getWarehouseCode()); | |
740 | + taskHeader.setWarehouseCode(warehouseCode); | |
737 | 741 | taskHeader.setTaskType(QuantityConstant.TASK_TYPE_VIEW); |
738 | 742 | taskHeader.setInternalTaskType(QuantityConstant.TASK_INTENERTYPE_WORK); |
739 | 743 | taskHeader.setContainerCode(location.getContainerCode()); |
... | ... | @@ -741,7 +745,7 @@ public class WorkTaskService { |
741 | 745 | taskHeader.setZoneCode(location.getZoneCode()); |
742 | 746 | } |
743 | 747 | taskHeader.setFromLocation(locationCode); |
744 | - String value = dictDataService.getDictValueByLabel(QuantityConstant.RULE_TASK_LOCATION, location.getZoneCode(), ShiroUtils.getWarehouseCode()); | |
748 | + String value = dictDataService.getDictValueByLabel(QuantityConstant.RULE_TASK_LOCATION, location.getZoneCode(), warehouseCode); | |
745 | 749 | // String value = configService.getKey(QuantityConstant.RULE_TASK_LOCATION,ShiroUtils.getWarehouseCode()); |
746 | 750 | int taskLocationRule = Integer.parseInt(value); |
747 | 751 | if (taskLocationRule == QuantityConstant.RULE_TASK_SET_LOCATION) { |
... | ... | @@ -764,13 +768,13 @@ public class WorkTaskService { |
764 | 768 | } |
765 | 769 | |
766 | 770 | LambdaQueryWrapper<InventoryDetail> queryWrapper = Wrappers.lambdaQuery(); |
767 | - queryWrapper.eq(InventoryDetail::getWarehouseCode, ShiroUtils.getWarehouseCode()) | |
771 | + queryWrapper.eq(InventoryDetail::getWarehouseCode, warehouseCode) | |
768 | 772 | .eq(InventoryDetail::getLocationCode, locationCode); |
769 | 773 | List<InventoryDetail> inventoryDetailList = inventoryDetailService.list(queryWrapper); |
770 | 774 | if (inventoryDetailList != null && inventoryDetailList.size() > 0) { |
771 | 775 | taskHeader.setCompanyCode(inventoryDetailList.get(0).getCompanyCode()); |
772 | 776 | } |
773 | - taskHeader.setCreatedBy(ShiroUtils.getUserName()); | |
777 | +// taskHeader.setCreatedBy(ShiroUtils.getUserName()); | |
774 | 778 | if (!taskHeaderService.save(taskHeader)) { |
775 | 779 | throw new ServiceException("创建任务失败"); |
776 | 780 | } |
... | ... | @@ -797,9 +801,9 @@ public class WorkTaskService { |
797 | 801 | } |
798 | 802 | } |
799 | 803 | |
800 | - locationService.updateStatus(locationCode, QuantityConstant.STATUS_LOCATION_LOCK); | |
804 | + locationService.updateStatus(locationCode, QuantityConstant.STATUS_LOCATION_LOCK,warehouseCode); | |
801 | 805 | containerService.updateLocationCodeAndStatus(location.getContainerCode(), |
802 | - location.getCode(), QuantityConstant.STATUS_CONTAINER_LOCK); | |
806 | + location.getCode(), QuantityConstant.STATUS_CONTAINER_LOCK,warehouseCode); | |
803 | 807 | |
804 | 808 | //判断长沙agv库则添加agv任务 |
805 | 809 | // String warehouseCode=taskHeader.getWarehouseCode(); |
... | ... | @@ -808,9 +812,10 @@ public class WorkTaskService { |
808 | 812 | // //出库查看回库指令 |
809 | 813 | // AgvTaskCS agvTask1=agvTaskCSService.saveAGVTaskByTaskReturn(taskHeader,agvTask); |
810 | 814 | // } |
815 | + taskid=taskHeader.getId(); | |
811 | 816 | } |
812 | 817 | |
813 | - return AjaxResult.success("成功"); | |
818 | + return AjaxResult.success("成功").setData(taskid); | |
814 | 819 | } |
815 | 820 | |
816 | 821 | /** |
... | ... | @@ -822,9 +827,12 @@ public class WorkTaskService { |
822 | 827 | LambdaQueryWrapper<InventoryHeader> queryWrapper = Wrappers.lambdaQuery(); |
823 | 828 | queryWrapper.in(InventoryHeader::getId, ids); |
824 | 829 | List<InventoryHeader> inventoryHeaderList = inventoryHeaderService.list(queryWrapper); |
830 | + if(inventoryHeaderList==null||inventoryHeaderList.size()<=0){ | |
831 | + return AjaxResult.error("找不到库存"); | |
832 | + } | |
825 | 833 | List<String> locationCodeList = inventoryHeaderList.stream().map( |
826 | 834 | InventoryHeader::getLocationCode).distinct().collect(Collectors.toList()); |
827 | - return createCheckOutTask(locationCodeList, port); | |
835 | + return createCheckOutTask(locationCodeList, port,inventoryHeaderList.get(0).getWarehouseCode()); | |
828 | 836 | } |
829 | 837 | |
830 | 838 | /** |
... | ... |