1
2 天以前 a729e71aa06080bbd6a80cb801e502f85d16496e
lsh#
1个文件已修改
68 ■■■■ 已修改文件
rsf-server/src/main/java/com/vincent/rsf/server/manager/schedules/TaskCacheLocSchedules.java 68 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
rsf-server/src/main/java/com/vincent/rsf/server/manager/schedules/TaskCacheLocSchedules.java
@@ -2,7 +2,13 @@
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.vincent.rsf.framework.common.Cools;
import com.vincent.rsf.framework.exception.CoolException;
import com.vincent.rsf.server.manager.controller.params.LocToTaskParams;
import com.vincent.rsf.server.manager.entity.Loc;
import com.vincent.rsf.server.manager.entity.WarehouseAreas;
import com.vincent.rsf.server.manager.enums.LocStsType;
import com.vincent.rsf.server.manager.service.*;
import com.vincent.rsf.server.manager.service.impl.WarehouseAreasServiceImpl;
import com.vincent.rsf.server.system.constant.GlobalConfigCode;
import com.vincent.rsf.server.system.entity.Config;
import com.vincent.rsf.server.system.service.ConfigService;
@@ -16,6 +22,7 @@
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
/**
 * @author Munch D. Luffy
@@ -32,6 +39,12 @@
    private TaskService taskService;
    @Autowired
    private ConfigService configService;
    @Autowired
    private WarehouseAreasServiceImpl warehouseAreasService;
    @Autowired
    private LocService locService;
    @Autowired
    private LocItemService locItemService;
    /**
     * @author Munch D. Luffy
@@ -47,18 +60,55 @@
            return;
        }
        String autoRunArea = configService.getVal("AUTO_RUN_AREA", String.class);
        if (Cools.isEmpty(autoRunArea)) {
        String autoRunAreaStartYz = configService.getVal("AUTO_RUN_AREA_START_YZ", String.class);
        if (Cools.isEmpty(autoRunAreaStartYz)) {
            return;
        }
        List<Integer> array = new ArrayList<>();
        for (char c : autoRunArea.toCharArray()) {
            switch (c) {
                case '1':
                default:
                    break;
            }
        String autoRunAreaEndYz = configService.getVal("AUTO_RUN_AREA_END_YZ", String.class);
        if (Cools.isEmpty(autoRunAreaEndYz)) {
            return;
        }
        String curLoc = null;
        String deepLoc = null;
        try{
            String[] split = autoRunAreaStartYz.split(";");
            for (String c : split) {
                WarehouseAreas byId = warehouseAreasService.getById(Integer.parseInt(c));
                if (!Cools.isEmpty(byId)) {
                    Loc loc = locService.getOne(new LambdaQueryWrapper<Loc>().eq(Loc::getWarehouseId, byId.getWarehouseId()).eq(Loc::getUseStatus, LocStsType.LOC_STS_TYPE_F.type),false);
                    if (!Objects.isNull(loc)) {
                        curLoc = loc.getCode();
                        break;
                    }
                }
            }
        } catch (Exception e){
            log.error("配置参数AUTO_RUN_AREA_START_YZ解析失败,请检查!!!");
        }
        try{
            String[] split = autoRunAreaEndYz.split(";");
            for (String c : split) {
                WarehouseAreas byId = warehouseAreasService.getById(Integer.parseInt(c));
                if (!Cools.isEmpty(byId)) {
                    Loc loc = locService.getOne(new LambdaQueryWrapper<Loc>().eq(Loc::getWarehouseId, byId.getWarehouseId()).eq(Loc::getUseStatus, LocStsType.LOC_STS_TYPE_O.type),false);
                    if (!Objects.isNull(loc)) {
                        deepLoc = loc.getCode();
                        break;
                    }
                }
            }
        } catch (Exception e){
            log.error("配置参数AUTO_RUN_AREA_START_YZ解析失败,请检查!!!");
        }
        if (curLoc == null ||  deepLoc == null) {
            return;
        }
        LocToTaskParams params = new LocToTaskParams();
        params.setOrgLoc(curLoc).setTarLoc(deepLoc);
        //生成移库位任务
        locItemService.genMoveTask(params, 9999L);
    }
    /**