rsf-server/src/main/java/com/vincent/rsf/server/api/controller/pda/SysInfoController.java
@@ -20,6 +20,7 @@ import javax.annotation.Resource; import java.util.List; import java.util.Map; import java.util.stream.Collectors; @Api(tags = "PDA获取信息接口") @RequestMapping("/pda") @@ -49,11 +50,15 @@ PageParam<BasStation, BaseParam> page = basStationService.page(pageParam, pageParam.buildWrapper(true)); for (BasStation station : page.getRecords()) { if (!Cools.isEmpty(station.getCrossZoneArea())) { List<Long> longs1 = station.getCrossZoneArea(); List<Long> longs1 = station.getCrossZoneArea().stream() .map(Integer::longValue) .collect(Collectors.toList()); station.setAreaIds(longs1); } if (!Cools.isEmpty(station.getContainerType())) { List<Long> longs1 = station.getContainerType(); List<Long> longs1 = station.getContainerType().stream() .map(Integer::longValue) .collect(Collectors.toList()); station.setContainerTypes(longs1); } rsf-server/src/main/java/com/vincent/rsf/server/api/service/impl/AgvServiceImpl.java
@@ -22,6 +22,7 @@ import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.stream.Collectors; @Service public class AgvServiceImpl implements AgvService { @@ -83,7 +84,9 @@ if (Cools.isEmpty(basStation)) { throw new CoolException("未找到接驳站点信息,请检查站点状态"); } List<Long> ids = basStation.getCrossZoneArea(); List<Long> ids = basStation.getCrossZoneArea().stream() .map(Integer::longValue) .collect(Collectors.toList()); // ids.add(basStation.getArea()); // if (basStation.getIsCrossZone() == 1) { // String content = basStation.getCrossZoneArea().substring(1,.length() - 1); @@ -213,7 +216,9 @@ if (Cools.isEmpty(waitPakinItems)) { throw new CoolException("数据错误,未找到组托明细"); } List<Long> ids = basStation.getCrossZoneArea(); List<Long> ids = basStation.getCrossZoneArea().stream() .map(Integer::longValue) .collect(Collectors.toList()); // ids.add(basStation.getArea()); // if (basStation.getIsCrossZone() == 1) { // String content = basStation.getCrossZoneArea().substring(1, basStation.getCrossZoneArea().length() - 1); @@ -274,7 +279,9 @@ throw new CoolException("未找到站点信息"); } if (!Cools.isEmpty(basStation.getContainerType())) { List<Long> longs1 = basStation.getCrossZoneArea(); List<Long> longs1 = basStation.getCrossZoneArea().stream() .map(Integer::longValue) .collect(Collectors.toList()); List<BasContainer> containers = basContainerService.list( new LambdaQueryWrapper<BasContainer>() .in(BasContainer::getContainerType, longs1) @@ -330,12 +337,13 @@ throw new CoolException("站点为光电站点,禁止呼叫AGV"); } List<Long> areaList = basStation.getCrossZoneArea(); if (!areaList.contains(Long.parseLong(area))) { if (!basStation.getCrossZoneArea().contains(Integer.parseInt(area))) { throw new CoolException("当前站点不支持目标库区"); } if (!Cools.isEmpty(basStation.getContainerType())) { List<Long> longs1 = basStation.getContainerType(); List<Long> longs1 = basStation.getContainerType().stream() .map(Integer::longValue) .collect(Collectors.toList()); List<BasContainer> containers = basContainerService.list( new LambdaQueryWrapper<BasContainer>() .in(BasContainer::getContainerType, longs1) rsf-server/src/main/java/com/vincent/rsf/server/api/service/impl/InBoundServiceImpl.java
@@ -80,7 +80,9 @@ throw new CoolException("站点状态不为空闲"); } if (!Cools.isEmpty(basStation.getContainerType())) { List<Long> longs1 = basStation.getContainerType(); List<Long> longs1 = basStation.getContainerType().stream() .map(Integer::longValue) .collect(Collectors.toList()); List<BasContainer> containers = basContainerService.list( new LambdaQueryWrapper<BasContainer>() .in(BasContainer::getContainerType, longs1) @@ -131,12 +133,13 @@ throw new CoolException("站点状态不为空闲"); } List<Long> areaList = basStation.getCrossZoneArea(); if (!areaList.contains(Long.parseLong(area))) { if (!basStation.getCrossZoneArea().contains(Integer.parseInt(area))) { throw new CoolException("当前站点不支持目标库区"); } if (!Cools.isEmpty(basStation.getContainerType())) { List<Long> longs1 = basStation.getContainerType(); List<Long> longs1 = basStation.getContainerType().stream() .map(Integer::longValue) .collect(Collectors.toList()); List<BasContainer> containers = basContainerService.list( new LambdaQueryWrapper<BasContainer>() .in(BasContainer::getContainerType, longs1) rsf-server/src/main/java/com/vincent/rsf/server/api/service/impl/PdaOutStockServiceImpl.java
@@ -445,7 +445,9 @@ throw new CoolException("站点状态不为空闲"); } List<Long> areaList = basStation.getCrossZoneArea(); List<Long> areaList = basStation.getCrossZoneArea().stream() .map(Integer::longValue) .collect(Collectors.toList()); if (Cools.isEmpty(areaList)) { throw new CoolException("当前站点库区未配置"); } rsf-server/src/main/java/com/vincent/rsf/server/manager/controller/BasStationController.java
@@ -20,6 +20,7 @@ import javax.servlet.http.HttpServletResponse; import java.util.*; import java.util.stream.Collectors; @RestController public class BasStationController extends BaseController { @@ -35,11 +36,15 @@ PageParam<BasStation, BaseParam> page = basStationService.page(pageParam, pageParam.buildWrapper(true)); for (BasStation station : page.getRecords()) { if (!Cools.isEmpty(station.getCrossZoneArea())) { List<Long> longs1 = station.getCrossZoneArea(); List<Long> longs1 = station.getCrossZoneArea().stream() .map(Integer::longValue) .collect(Collectors.toList()); station.setAreaIds(longs1); } if (!Cools.isEmpty(station.getContainerType())) { List<Long> longs1 = station.getContainerType(); List<Long> longs1 = station.getContainerType().stream() .map(Integer::longValue) .collect(Collectors.toList()); station.setContainerTypes(longs1); } @@ -72,11 +77,15 @@ public R get(@PathVariable("id") Long id) { BasStation station = basStationService.getById(id); if (!Cools.isEmpty(station.getCrossZoneArea())) { List<Long> longs1 = station.getCrossZoneArea(); List<Long> longs1 = station.getCrossZoneArea().stream() .map(Integer::longValue) .collect(Collectors.toList()); station.setAreaIds(longs1); } if (!Cools.isEmpty(station.getContainerType())) { List<Long> longs1 = station.getContainerType(); List<Long> longs1 = station.getContainerType().stream() .map(Integer::longValue) .collect(Collectors.toList()); station.setContainerTypes(longs1); } @@ -96,10 +105,14 @@ return R.error(basStation.getStationName()+"站已被初始化"); } if (null !=basStation.getAreaIds()){ basStation.setCrossZoneArea(basStation.getAreaIds()); basStation.setCrossZoneArea(basStation.getAreaIds().stream() .map(Long::intValue) .collect(Collectors.toList())); } if (null !=basStation.getContainerTypes()){ basStation.setContainerType(basStation.getContainerTypes()); basStation.setContainerType(basStation.getContainerTypes().stream() .map(Long::intValue) .collect(Collectors.toList())); } if (Cools.isEmpty(basStation.getStationAlias())){ basStation.setStationAlias(new ArrayList<>()); @@ -120,10 +133,14 @@ basStation.setUpdateBy(getLoginUserId()); basStation.setUpdateTime(new Date()); if (null !=basStation.getAreaIds() && !basStation.getContainerTypes().isEmpty()){ basStation.setCrossZoneArea(basStation.getAreaIds()); basStation.setCrossZoneArea(basStation.getAreaIds().stream() .map(Long::intValue) .collect(Collectors.toList())); } if (null != basStation.getContainerTypes() && !basStation.getContainerTypes().isEmpty()){ basStation.setContainerType(basStation.getContainerTypes()); basStation.setContainerType(basStation.getContainerTypes().stream() .map(Long::intValue) .collect(Collectors.toList())); } if (null !=basStation.getUseStatus() && basStation.getUseStatus().equals(LocStsType.LOC_STS_TYPE_O.type)){ basStation.setBarcode(null); rsf-server/src/main/java/com/vincent/rsf/server/manager/entity/BasStation.java
@@ -89,7 +89,7 @@ */ @ApiModelProperty(value = "可跨区区域id") @TableField(typeHandler = JacksonTypeHandler.class) private List<Long> crossZoneArea; private List<Integer> crossZoneArea; /** * 是否wcs站点 @@ -108,7 +108,7 @@ */ @ApiModelProperty(value = "容器类型") @TableField(typeHandler = JacksonTypeHandler.class) private List<Long> containerType; private List<Integer> containerType; /** * 条码 @@ -276,4 +276,6 @@ return null; } } } rsf-server/src/main/java/com/vincent/rsf/server/manager/entity/Task.java
@@ -212,7 +212,7 @@ private String endStep; @TableField(typeHandler = JacksonTypeHandler.class) private List<Integer> targSiteArea; private List<String> targSiteArea; private String targLocArea; rsf-server/src/main/java/com/vincent/rsf/server/manager/enums/TaskType.java
@@ -19,7 +19,7 @@ TASK_TYPE_PICK_AGAIN_OUT("103", "拣料出库"), TASK_TYPE_MERGE_OUT("104", "并板出库"), TASK_TYPE_CHECK_OUT("107", "盘点出库"), TASK_TYPE_CROSS_DOCKING_OUT("109", "越库"), TASK_TYPE_CROSS_DOCKING_OUT("109", "备货"), TASK_TYPE_EMPTY_OUT("110", "空板出库"), ; public Integer type; rsf-server/src/main/java/com/vincent/rsf/server/manager/schedules/AutoRunSchedules.java
@@ -101,15 +101,19 @@ * @description: 自动完成盘点功能 * @version 1.0 */ // @Scheduled(cron = "0/25 * * * * ?") @Scheduled(cron = "0/25 * * * * ?") @Transactional(rollbackFor = Exception.class) public void autoCheckComplete() { //获取任务列表中,为盘点出库的任务 List<Task> tasks = taskService.list(new LambdaQueryWrapper<Task>() .in(Task::getTaskType, Arrays.asList(TaskType.TASK_TYPE_CHECK_OUT.type, TaskType.TASK_TYPE_PICK_IN.type, TaskType.TASK_TYPE_PICK_AGAIN_OUT.type, TaskType.TASK_TYPE_CHECK_IN.type))); // TaskType.TASK_TYPE_PICK_IN.type, TaskType.TASK_TYPE_PICK_AGAIN_OUT.type // , // TaskType.TASK_TYPE_CHECK_IN.type ) ) ); if (!tasks.isEmpty()) { tasks.forEach(task -> { rsf-server/src/main/java/com/vincent/rsf/server/manager/schedules/TaskSchedules.java
@@ -456,9 +456,10 @@ } else if (task.getTaskType().equals(TaskType.TASK_TYPE_OUT.type) || task.getTaskType().equals(TaskType.TASK_TYPE_PICK_AGAIN_OUT.type) || task.getTaskType().equals(TaskType.TASK_TYPE_MERGE_OUT.type) || task.getTaskType().equals(TaskType.TASK_TYPE_CHECK_OUT.type) || task.getTaskType().equals(TaskType.TASK_TYPE_CROSS_DOCKING_OUT.type) || task.getTaskType().equals(TaskType.TASK_TYPE_EMPTY_OUT.type)) { || task.getTaskType().equals(TaskType.TASK_TYPE_CHECK_OUT.type)) { task.setTaskStatus(TaskStsType.AWAIT.id); } else if ( task.getTaskType().equals(TaskType.TASK_TYPE_CROSS_DOCKING_OUT.type) || task.getTaskType().equals(TaskType.TASK_TYPE_EMPTY_OUT.type)) {//备货 task.setTaskStatus(TaskStsType.COMPLETE_OUT.id); } taskService.updateById(task); rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/LocItemServiceImpl.java
@@ -177,7 +177,7 @@ throw new CoolException("库位状态更新失败!!"); } //增加对备货单得判断 //增加对备货单的判断 Integer taskStatus = resouce.equals(TaskResouceType.TASK_RESOUCE_STOCK_UP.val) ? TaskStsType.MISSION_INITIAL.id:TaskStsType.MISSION_INITIAL.id; @@ -194,6 +194,7 @@ .setUpdateTime(new Date()) .setTaskStatus(taskStatus) .setBarcode(loc.getBarcode()) .setTargSiteArea(map.getTargSiteAreaList()) .setMemo(map.getMemo()); List<LocItem> locItems = this.list(new LambdaQueryWrapper<LocItem>().eq(LocItem::getLocId, key)); rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/TaskServiceImpl.java
@@ -494,12 +494,13 @@ throw new CoolException("站点状态不为空闲"); } List<Long> areaList = basStation.getCrossZoneArea(); if (!areaList.contains(Long.parseLong(area))) { if (!basStation.getCrossZoneArea().contains(Integer.parseInt(area))) { throw new CoolException("当前站点不支持目标库区"); } if (!Cools.isEmpty(basStation.getContainerType())) { List<Long> longs1 = basStation.getContainerType(); List<Long> longs1 = basStation.getContainerType().stream() .map(Integer::longValue) .collect(Collectors.toList()); List<BasContainer> containers = basContainerService.list( new LambdaQueryWrapper<BasContainer>() .in(BasContainer::getContainerType, longs1) @@ -558,7 +559,9 @@ throw new CoolException("站点状态不为空闲"); } if (!Cools.isEmpty(basStation.getContainerType())) { List<Long> longs1 = basStation.getContainerType(); List<Long> longs1 = basStation.getContainerType().stream() .map(Integer::longValue) .collect(Collectors.toList()); List<BasContainer> containers = basContainerService.list( new LambdaQueryWrapper<BasContainer>() .in(BasContainer::getContainerType, longs1) @@ -612,7 +615,9 @@ } warehouseAreasList.add(warehouseArea); } else { List<Long> areaList = basStation.getCrossZoneArea(); List<Long> areaList = basStation.getCrossZoneArea().stream() .map(Integer::longValue) .collect(Collectors.toList()); if (areaList.isEmpty()) { throw new CoolException("当前站点库区未配置"); } @@ -992,10 +997,12 @@ complateOutStockDocking(task, loginUserId); } else if (task.getTaskType().equals(TaskType.TASK_TYPE_CHECK_OUT.type)) { //107.盘 pickOrCheckTask(task.getId(), Constants.TASK_TYPE_OUT_CHECK); // pickOrCheckTask(task.getId(), Constants.TASK_TYPE_OUT_CHECK); complateOutStock2(task, loginUserId); } else if (task.getTaskType().equals(TaskType.TASK_TYPE_PICK_AGAIN_OUT.type)) { //103.拣选 pickOrCheckTask(task.getId(), Constants.TASK_TYPE_OUT_PICK); // pickOrCheckTask(task.getId(), Constants.TASK_TYPE_OUT_PICK); complateOutStock2(task, loginUserId); } else { complateOutStock(task, loginUserId); } @@ -1498,6 +1505,154 @@ */ @Synchronized @Transactional(rollbackFor = Exception.class) public void complateOutStock2(Task task, Long loginUserId) throws Exception { if (Objects.isNull(task)) { throw new CoolException("参数不能为空!!"); } Loc loc = locService.getOne(new LambdaQueryWrapper<Loc>().eq(Loc::getCode, task.getOrgLoc())); if (Objects.isNull(loc)) { throw new CoolException("库位不存在!!"); } if (!loc.getUseStatus().equals(LocStsType.LOC_STS_TYPE_R.type)) { throw new CoolException("库位状态不处理于R.出库预约!!"); } List<TaskItem> taskItems = taskItemService.list(new LambdaQueryWrapper<TaskItem>().eq(TaskItem::getTaskId, task.getId())); if (taskItems.isEmpty()) { throw new CoolException("任务明细不存在!!"); } List<LocItem> locItems = locItemService.list(new LambdaQueryWrapper<LocItem>().eq(LocItem::getLocId, loc.getId())); if (locItems.isEmpty()) { throw new CoolException("库位明细不存在!!"); } List<LocItemWorking> workings = new ArrayList<>(); for (LocItem item : locItems) { LocItemWorking working = new LocItemWorking(); BeanUtils.copyProperties(item, working); working.setId(null) .setTaskId(task.getId()) .setLocItemId(item.getId()) .setUpdateBy(loginUserId) .setUpdateTime(new Date()); workings.add(working); } if (!locItemWorkingService.saveBatch(workings)) { throw new CoolException("临时库存保存失败!!"); } try { //更新库位明细 subtractLocItem(loc); } catch (Exception e) { logger.error("<UNK>", e); throw new CoolException(e.getMessage()); } //添加出入库记录信息 Map<Short, List<TaskItem>> listMap = taskItems.stream().collect(Collectors.groupingBy(TaskItem::getWkType)); /***获取库存出库值,如果为空表示正常单据出库,非空表明是库存出库 * 1. 库存出库没有单据信息,单据信息默认为空 * 2. 单据库存需通过波次查询原始单据信息,将单据信息填入stock中 * */ List<TaskItem> list = listMap.get(Short.parseShort(OrderWorkType.ORDER_WORK_TYPE_STOCK_OUT.type)); if (Objects.isNull(list) || list.isEmpty()) { Map<Long, List<TaskItem>> maps = taskItems.stream().collect(Collectors.groupingBy(TaskItem::getSource)); maps.keySet().forEach(key -> { if (task.getResource().equals(TaskResouceType.TASK_RESOUCE_WAVE_TYPE.val)) { WaveItem waveItem = waveItemService.getById(key); if (Objects.isNull(waveItem)) { throw new CoolException("波次明细不存在!!"); } // try { // saveOutStockItem(maps.get(key), null, waveItem, null, loginUserId); // } catch (Exception e) { // throw new CoolException(e.getMessage()); // } } else if (task.getResource().equals(TaskResouceType.TASK_RESOUCE_ORDER_TYPE.val)) { WkOrderItem orderItem = asnOrderItemService.getById(key); if (Objects.isNull(orderItem)) { throw new CoolException("单据明细不存在!!"); } try { saveOutStockItem(maps.get(key), orderItem, loginUserId); } catch (Exception e) { throw new CoolException(e.getMessage()); } } else if (task.getResource().equals(TaskResouceType.TASK_RESOUCE_CHECK_TYPE.val)) { WkOrderItem orderItem = asnOrderItemService.getById(key); if (Objects.isNull(orderItem)) { throw new CoolException("单据明细不存在!!"); } try { saveOutStockItem(maps.get(key), null, null, orderItem, loginUserId); } catch (Exception e) { throw new CoolException(e.getMessage()); } } else { } }); } else { try { saveOutStockItem(taskItems, null, null, null, loginUserId); } catch (Exception e) { throw new CoolException(e.getMessage()); } } /**修改为库位状态为O.空库*/ if (!locService.update(new LambdaUpdateWrapper<Loc>() .set(Loc::getUseStatus, LocStsType.LOC_STS_TYPE_O.type) .set(Loc::getBarcode, null) .set(Loc::getUpdateBy, loginUserId) .set(Loc::getUpdateTime, new Date()) .eq(Loc::getId, loc.getId()))) { throw new CoolException("库位状态修改失败!!"); } if (!this.update(new LambdaUpdateWrapper<Task>() .eq(Task::getId, task.getId()) .set(Task::getUpdateBy, loginUserId) .set(Task::getUpdateTime, new Date()) .set(Task::getTaskStatus, TaskStsType.WAVE_SEED.id))) { throw new CoolException("库存状态更新失败!!"); } // if (task.getTaskType().equals(TaskType.TASK_TYPE_PICK_AGAIN_OUT.type) || task.getTaskType().equals(TaskType.TASK_TYPE_CHECK_OUT.type)) { // if (!this.update(new LambdaUpdateWrapper<Task>() // .eq(Task::getId, task.getId()) // .set(Task::getUpdateBy, loginUserId) // .set(Task::getUpdateTime, new Date()) // .set(Task::getTaskStatus, TaskStsType.WAVE_SEED.id))) { // throw new CoolException("库存状态更新失败!!"); // } // } else { // if (!this.update(new LambdaUpdateWrapper<Task>() // .eq(Task::getId, task.getId()) // .set(Task::getUpdateBy, loginUserId) // .set(Task::getUpdateTime, new Date()) // .set(Task::getTaskStatus, TaskStsType.WAVE_SEED.id))) { // throw new CoolException("库存状态更新失败!!"); // } //// //全板出库,删除临时库存 //// if (!locItemWorkingService.remove(new LambdaQueryWrapper<LocItemWorking>().eq(LocItemWorking::getTaskId, task.getId()))) { //// throw new CoolException("临时库存清除失败!!"); //// } // } } /** * @author Ryan * @date 2025/5/20 * @description: 完成出库任务,更新出库库存信息 * @version 1.0 */ @Synchronized @Transactional(rollbackFor = Exception.class) public void complateOutStock(Task task, Long loginUserId) throws Exception { if (Objects.isNull(task)) { throw new CoolException("参数不能为空!!"); rsf-server/src/main/java/com/vincent/rsf/server/manager/utils/LocManageUtil.java
@@ -233,11 +233,17 @@ orderOutItemDto.setLoc(loc); orderOutItemDto.getLocItemList().add(locItem); BasContainer containerType = getContainerType(loc.getBarcode()); if (Cools.isEmpty(containerType)){ continue; } List<BasStationArea> basStationAreas = basStationAreaService.list(new LambdaQueryWrapper<BasStationArea>() .apply("JSON_CONTAINS(cross_zone_area, '{0}') = 1", loc.getAreaId())//可执行库区区区域id .apply("JSON_CONTAINS(container_type, '{0}') = 1", containerType)//容器类型 // .apply("JSON_CONTAINS(station_alias, '\"{0}\"') = 1", null)//区域包含站点集 .apply("cross_zone_area != '[]'") // 不是空数组 .apply("container_type != '[]'") // 不是空数组 .apply("station_alias != '[]'") // 不是空数组 .apply("JSON_CONTAINS(cross_zone_area, '{0}') = 1", loc.getAreaId().toString())//可执行库区区区域id .apply("JSON_CONTAINS(container_type, '{0}') = 1", containerType.getContainerType().toString())//容器类型 .eq(BasStationArea::getDeleted, 0));// 通常需要加上未删除条件 // .apply("JSON_CONTAINS(station_alias, '\"{0}\"') = 1", null)//区域包含站点集 List<String> targSiteAreaList = new ArrayList<>(); for (BasStationArea basStationArea : basStationAreas) { targSiteAreaList.add(basStationArea.getStationAreaId());