ZY
2025-04-07 a662099c1fdd8d3e6da2d6b167758a4bc548ccff
src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
@@ -10,10 +10,7 @@
import com.zy.asrs.domain.param.CrnOperatorParam;
import com.zy.asrs.entity.*;
import com.zy.asrs.entity.wms.StorageEscalationParam;
import com.zy.asrs.mapper.BasCrnErrorMapper;
import com.zy.asrs.mapper.StaDescMapper;
import com.zy.asrs.mapper.TaskWrkMapper;
import com.zy.asrs.mapper.WrkMastMapper;
import com.zy.asrs.mapper.*;
import com.zy.asrs.service.*;
import com.zy.asrs.utils.Utils;
import com.zy.core.CrnThread;
@@ -67,6 +64,9 @@
    private BasCrnErrorMapper basCrnErrorMapper;
    @Autowired
    private TaskWrkMapper taskWrkMapper;
    @Autowired
    private DevpTaskMapper devpTaskMapper;
    @Autowired
    private TaskWrkService taskWrkService;
@@ -84,9 +84,6 @@
    @Autowired
    private CrnController crnController;
    @Autowired
    private TransferTaskService transferTaskService;
    public void generateStoreWrkFile1() throws IOException, InterruptedException {
@@ -420,6 +417,15 @@
                    if (flag) {
                        LocMast locMast1 = locMastService.selectOne(new EntityWrapper<LocMast>()
                                .eq("row1", (locMast.getRow1() - 1))
                                .eq("bay1", locMast.getBay1())
                                .eq("lev1", locMast.getLev1()).eq("loc_sts", "F"));
                        if (!Cools.isEmpty(locMast1)) {
                            log.info(locMast.getLocNo() + "出深库位,浅库位有货");
                            continue;
                        }
                    } else {
                        LocMast locMast1 = locMastService.selectOne(new EntityWrapper<LocMast>()
                                .eq("row1", (locMast.getRow1() + 1))
                                .eq("bay1", locMast.getBay1())
                                .eq("lev1", locMast.getLev1()).eq("loc_sts", "F"));
                        if (!Cools.isEmpty(locMast1)) {
@@ -830,9 +836,6 @@
        try {
            // 根据输送线plc遍历
            for (DevpSlave devp : slaveProperties.getDevp()) {
                if (devp.getId() == 2) {
                    continue;
                }
                SiemensDevpThread devpThread = (SiemensDevpThread) SlaveConnection.get(SlaveType.Devp, devp.getId());
                for (DevpSlave.Sta inSta : devp.getInSta()) {
                    WrkMast pakout = wrkMastMapper.selectWorkingPakout(inSta.getBackSta());
@@ -993,6 +996,71 @@
    /**
     * 独立输送线
     */
    public void onlyDevp() {
        DevpSlave devpSlave = slaveProperties.getDevp().get(1);
        List<DevpSlave.Sta> inSta = devpSlave.getInSta();
        // 获取堆垛机出库站信息
        DevpThread devpThread = (DevpThread) SlaveConnection.get(SlaveType.Devp, devpSlave.getId());
        for (DevpSlave.Sta sta : inSta) {
            try {
                StaProtocol staProtocol = devpThread.getStation().get(sta.getStaNo());
                if (staProtocol == null) {
                    continue;
                } else {
                    staProtocol = staProtocol.clone();
                }
                if (staProtocol.isAutoing() && staProtocol.isLoading() && (staProtocol.getWorkNo() == 0 || staProtocol.getStaNo() == 0)) {
                    // 查询工作档
//                    TaskWrk taskWrk = devpTaskMapper.selectCrnStaWorking(crnSlave.getId(), staDesc.getStnNo().toString());
//                    if (taskWrk == null) {
//                        continue;
//                    }
//                    log.info("下发输送线任务:taskWrk:" + JSON.toJSONString(taskWrk));
//                    staProtocol.setWorkNo(taskWrk.getWrkNo().shortValue());
//                    staProtocol.setStaNo(staDesc.getStnNo().shortValue());
//                    boolean offer = false;
//                    try {
//                        offer = MessageQueue.offer(SlaveType.Devp, 1, new Task(2, staProtocol));
//                    } catch (Exception e) {
//                        log.error("下发输送线任务失败:异常:" + e);
//                        log.error("下发输送线任务失败:异常:offer:" + offer);
//                    }
//                    if (offer) {
//                        log.info("下发输送线任务成功:taskWrk:" + JSON.toJSONString(taskWrk));
//                        taskWrk.setStatus(5);
//                        taskWrk.setWrkSts(14);
//                        taskWrkService.updateById(taskWrk);
//
//                    } else {
//                        log.error("下发输送线任务失败:taskWrk:" + JSON.toJSONString(taskWrk));
//                    }
                }
            } catch (Exception e) {
                log.error("出库到出库站异常:异常信息:" + e);
            }
        }
    }
    /**
     * 跑库程序
     */
    public void debug() {
        //首先库位有一个在库的库位
        LocMast locMast = locMastService.selectOne(new EntityWrapper<LocMast>().eq("loc_sts", "F"));
        if (locMast != null) {
            // 再生成一个移库任务
            LocMast mk = locMastService.selectOne(new EntityWrapper<LocMast>().eq("loc_sts", "O").ne("mk", 1));
        }
    }
    /**
     * 转移任务下发
     */
    public void transferTaskStart() {