1
2 天以前 664df6de041aeab4341f739372f64ac9e428aad2
rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/TaskServiceImpl.java
@@ -207,7 +207,6 @@
        return R.ok("任务生成完毕!");
    }
    @Override
    @Transactional(rollbackFor = Exception.class)
    public synchronized R generateFlatWarehouseTasks(WaitPakin pakins, String locCode, Long loginUserId) {
@@ -334,13 +333,16 @@
            throw new CoolException("请检查组拖状态是否完成!!");
        }
        waitPakins.forEach(pakin -> {
            BasContainer container = basContainerService.getOne(new LambdaUpdateWrapper<BasContainer>()
                    .eq(BasContainer::getCode, pakin.getBarcode()));
            if (Objects.isNull(container)) {
                throw new CoolException("容器未维护入库,请维护后再操作!!");
            }
//            BasContainer container = basContainerService.getOne(new LambdaUpdateWrapper<BasContainer>()
//                    .eq(BasContainer::getCode, pakin.getBarcode()));
//            if (Objects.isNull(container)) {
//                throw new CoolException("容器未维护入库,请维护后再操作!!");
//            }
            //验证基础信息
            BasStation basStation = checkStaStatus(pakin.getBarcode(), deviceSite.getSite());
            /**获取库位*/
            String targetLoc = LocManageUtil.getTargetLoc(warehouseArea.getId(), container.getContainerType());
            String targetLoc = LocManageUtil.getTargetLoc(warehouseArea.getId(), null);
            if (Cools.isEmpty(targetLoc)) {
                throw new CoolException("该站点对应库区未找到库位");
            }
@@ -447,26 +449,71 @@
    }
    private BasStation checkStaStatus(String barcode, String sta) {
        if (Cools.isEmpty(barcode)) {
            throw new CoolException("容器码不能为空");
        }
        if (Cools.isEmpty(sta)) {
            throw new CoolException("接驳位不能为空");
        }
        BasStation isBarcodeSta = basStationService.getOne(new LambdaQueryWrapper<BasStation>()
                        .eq(BasStation::getBarcode, barcode)
                , false
        );
        if (!Cools.isEmpty(isBarcodeSta)) {
            throw new CoolException("该条码已被" + isBarcodeSta.getStationName() + "站绑定");
        }
        BasStation basStation = basStationService.getOne(new LambdaQueryWrapper<BasStation>()
                .eq(BasStation::getStationName, sta)
        );
        if (Cools.isEmpty(basStation)) {
            throw new CoolException("未找到站点信息");
        }
        if (!basStation.getUseStatus().equals("O")) {
            throw new CoolException("站点状态不为空闲");
        }
        if (!Cools.isEmpty(basStation.getContainerType())) {
            List<Long> longs1 = JSONObject.parseArray(basStation.getContainerType(), Long.class);
            List<BasContainer> containers = basContainerService.list(
                    new LambdaQueryWrapper<BasContainer>()
                            .in(BasContainer::getContainerType, longs1)
            );
            boolean matches = false;
            for (BasContainer container : containers) {
                String codeType = container.getCodeType();  // 获取正则表达式
                if (barcode.matches(codeType)) {  // 判断条码是否符合这个正则
                    matches = true;
                    break;  // 找到匹配的就退出循环
                }
            }
//            boolean matches = containers.stream()
//                    .map(BasContainer::getCodeType)
//                    .anyMatch(codeType -> barcode.matches(codeType));
            if (!matches) {
                throw new CoolException("条码与站点不匹配");
            }
        }
        return basStation;
    }
    /**
     * @param
     * @param loginUserId
     * @return
     * @author Munch D. Luffy
     * @date 2026/01/10
     * @description: WCS入库任务申请
     */
    @Override
    @Transactional(rollbackFor = Exception.class)
    public synchronized R generateTasksWcs(GenerateTaskParams waitPakin, Long loginUserId) {
    public synchronized R generateTasksWcs(GenerateTaskParams waitPakin, Long loginUserId,List<Integer> rowList) {
        if (Objects.isNull(waitPakin) || waitPakin.getWaitPakins().isEmpty()) {
            throw new CoolException("参数不能为空!!");
        }
        DeviceSite deviceSite = deviceSiteService.getById(waitPakin.getSiteId());
        if (Objects.isNull(deviceSite)) {
        BasStation basStation = basStationService.getById(waitPakin.getSiteId());
        if (Objects.isNull(basStation)) {
            throw new CoolException("站点不存在!!");
        }
        DeviceBind deviceBind = deviceBindService.getById(LocUtils.getAreaType(deviceSite.getSite()));
        DeviceBind deviceBind = deviceBindService.getById(LocUtils.getAreaType(basStation.getStationName()));
        if (Cools.isEmpty(deviceBind)) {
            throw new CoolException("库位规则未知");
        }
@@ -484,13 +531,18 @@
            throw new CoolException("请检查组拖状态是否完成!!");
        }
        waitPakins.forEach(pakin -> {
            BasContainer container = basContainerService.getOne(new LambdaUpdateWrapper<BasContainer>()
                    .eq(BasContainer::getCode, pakin.getBarcode()));
            if (Objects.isNull(container)) {
                throw new CoolException("容器未维护入库,请维护后再操作!!");
            }
            //验证基础信息
            BasStation basStation1 = checkStaStatus(pakin.getBarcode(),basStation.getStationName());
//            BasContainer container = basContainerService.getOne(new LambdaUpdateWrapper<BasContainer>()
//                    .eq(BasContainer::getCode, pakin.getBarcode()));
//            if (Objects.isNull(container)) {
//                throw new CoolException("容器未维护入库,请维护后再操作!!");
//            }
            /**获取库位*/
            String targetLoc = LocManageUtil.getTargetLoc(warehouseArea.getId(), container.getContainerType());
            String targetLoc = LocManageUtil.getTargetLoc(warehouseArea.getId(),null,rowList);
            if (Cools.isEmpty(targetLoc)) {
                throw new CoolException("该站点对应库区未找到库位");
            }
@@ -507,8 +559,8 @@
                    .setResource(TaskResouceType.TASK_RESOUCE_PAKIN_TYPE.val)
                    .setTargLoc(targetLoc)
                    .setBarcode(pakin.getBarcode())
                    .setOrgSite(deviceSite.getSite())
                    .setTargSite(deviceSite.getDeviceSite())
                    .setOrgSite(basStation.getStationName())
                    .setTargSite(basStation.getStationName())
                    .setCreateBy(loginUserId)
                    .setUpdateBy(loginUserId);
@@ -659,7 +711,7 @@
     */
    private Task modiftyTaskSort(Task task, Long loginUserId) {
        String curLoc;
        if (task.getTaskType().equals(TaskType.TASK_TYPE_IN.type)) {
        if (task.getTaskType().equals(TaskType.TASK_TYPE_IN.type) || task.getTaskType().equals(TaskType.TASK_TYPE_EMPITY_IN.type)) {
            curLoc = task.getTargLoc();
        } else {
            curLoc = task.getOrgLoc();