1
14 小时以前 e711c834aec2293c53b07efe53e81e3573c289b6
rsf-server/src/main/java/com/vincent/rsf/server/api/service/impl/InBoundServiceImpl.java
@@ -15,6 +15,7 @@
import com.vincent.rsf.server.manager.enums.*;
import com.vincent.rsf.server.manager.service.*;
import com.vincent.rsf.server.manager.utils.LocManageUtil;
import com.vincent.rsf.server.manager.utils.WarehouseLocationRetrievalUtil;
import com.vincent.rsf.server.system.constant.SerialRuleCode;
import com.vincent.rsf.server.system.utils.SerialRuleUtils;
import lombok.extern.slf4j.Slf4j;
@@ -76,7 +77,7 @@
        if (Cools.isEmpty(basStation)) {
            throw new CoolException("未找到站点信息");
        }
        if (!basStation.getUseStatus().equals("O")) {
        if (!basStation.getUseStatus().equals("O") &&  !basStation.getUseStatus().equals("D") && !basStation.getUseStatus().equals("F")) {
            throw new CoolException("站点状态不为空闲");
        }
        if (!Cools.isEmpty(basStation.getContainerType())) {
@@ -214,14 +215,20 @@
//                throw new CoolException("未找到所属库区信息");
            }
            DeviceSite deviceSite = deviceSiteService.getOne(new LambdaQueryWrapper<DeviceSite>()
                    .eq(DeviceSite::getSite, station.getStationName())
                    .eq(DeviceSite::getAreaIdEnd, warehouseArea.getId())
                    .eq(DeviceSite::getType, TaskType.TASK_TYPE_EMPTY_IN.type).last("limit 1"));
            if (Cools.isEmpty(deviceSite)) {
            boolean isItAvailable = new WarehouseLocationRetrievalUtil().queryPathIsItAvailableInArea(station.getStationName(),  warehouseArea.getId(), param.getContainerNo(), TaskType.TASK_TYPE_EMPTY_IN.type);
//            DeviceSite deviceSite = deviceSiteService.getOne(new LambdaQueryWrapper<DeviceSite>()
//                    .eq(DeviceSite::getSite, )
//                    .eq(DeviceSite::getAreaIdEnd,)
//                    .eq(DeviceSite::getType, TaskType.TASK_TYPE_EMPTY_IN.type).last("limit 1"));
//            if (Cools.isEmpty(deviceSite)) {
//                errorBuilder.append("无可用路径");
//                continue;
//                throw new CoolException("无可用路径!!");
//            }
            if (!isItAvailable){
                errorBuilder.append("无可用路径");
                continue;
//                throw new CoolException("无可用路径!!");
            }
//        BasContainer container = basContainerService.getOne(new LambdaUpdateWrapper<BasContainer>()
@@ -244,16 +251,7 @@
            if (StringUtils.isBlank(ruleCode)) {
                throw new CoolException("编码错误:请确认编码「SYS_TASK_CODE」是否已生成!!");
            }
            String stationName = null;
            if (Cools.isEmpty(deviceSite.getDeviceCode())) {
                stationName = station.getStationName();
            } else {
                BasStation stationCode = basStationService.getById(deviceSite.getDeviceCode());
                stationName = stationCode.getStationName();
                if (Cools.isEmpty(stationCode)) {
                    stationName = station.getStationName();
                }
            }
            String stationName = station.getStationName();
            Task task = new Task();
            task.setTaskCode(ruleCode)
                    .setTaskStatus(TaskStsType.MISSION_INITIAL.id)
@@ -275,8 +273,17 @@
            if (!basStationService.updateById(station)) {
                throw new CoolException("站点状态更新失败!!");
            }
            if (!locService.update(new LambdaUpdateWrapper<Loc>().eq(Loc::getCode, task.getTargLoc())
                    .set(Loc::getUseStatus, LocStsType.LOC_STS_TYPE_S.type).set(Loc::getBarcode, param.getContainerNo()))) {
            Loc taskLoc = locService.getOne(new LambdaQueryWrapper<Loc>()
                    .eq(Loc::getCode, task.getTargLoc())
                    .last("limit 1"), false);
            if (Objects.isNull(taskLoc)) {
                throw new CoolException("库位预约失败!!");
            }
            taskLoc.setUseStatus(LocStsType.LOC_STS_TYPE_S.type)
                    .setBarcode(param.getContainerNo())
                    .setUpdateBy(loginUserId)
                    .setUpdateTime(new Date());
            if (!locService.updateById(taskLoc)) {
                throw new CoolException("库位预约失败!!");
            }
            return R.ok("任务生成完毕!");
@@ -289,7 +296,7 @@
        if (Cools.isEmpty(param.getTransferStationNo())) {
            return R.error("无参数");
        }
        BasStation basStation = basStationService.getOne(new LambdaQueryWrapper<BasStation>().eq(BasStation::getStationId, param.getTransferStationNo()));
        BasStation basStation = basStationService.getOne(new LambdaQueryWrapper<BasStation>().eq(BasStation::getStationName, param.getTransferStationNo()));
        if (Cools.isEmpty(basStation)) {
            return R.error("未找到匹配站点");
        }