#
lsh
2024-06-21 c147a3dc2a56ab23b1cfeafef3de2867593f4206
src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
@@ -34,13 +34,11 @@
import com.zy.core.model.command.RgvCommand;
import com.zy.core.model.cpmmandParam.CrnCommandParam;
import com.zy.core.model.protocol.CrnProtocol;
import com.zy.core.model.protocol.JarProtocol;
import com.zy.core.model.protocol.RgvProtocol;
import com.zy.core.model.protocol.StaProtocol;
import com.zy.core.properties.SlaveProperties;
import com.zy.core.thread.BarcodeThread;
import com.zy.core.thread.LedThread;
import com.zy.core.thread.RgvThread;
import com.zy.core.thread.SiemensDevpThread;
import com.zy.core.thread.*;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
@@ -107,11 +105,14 @@
    private WrkMastCrnMapper wrkMastCrnMapper;
    @Autowired
    private WrkMastSplitTwinMapper wrkMastSplitTwinMapper;
    @Autowired
    private WrkMastSplitTwinService wrkMastSplitTwinService;
    @Autowired
    private BasJarMastService basJarMastService;
    @Value("${wms.url}")
    private String wmsUrl;
    @Autowired
    private WrkMastSplitTwinService wrkMastSplitTwinService;
    /**
     * 组托
@@ -4409,11 +4410,126 @@
     *  Jar任务创建
     */
    public synchronized void jarGenerateWrkMastSta() {
        try{
        }catch (Exception e){
            log.error("小车复位线程报错!"+e);
        for (JarSlave jarSlave : slaveProperties.getJar()) {
            try{
                Integer count = basJarMastService.getJarMastByJarIdCount(jarSlave.getId().longValue());
                if (count>=7){
                    continue;
                }
                BasJarMast jarMastByJarIdMax = basJarMastService.getJarMastByJarIdMax(jarSlave.getId().longValue());
                if (!Cools.isEmpty(jarMastByJarIdMax) && jarMastByJarIdMax.getJarLocDigit()==7){
                    continue;
                }
                jarGenerateWrkMastStaExecute(jarSlave);
            }catch (Exception e){
                log.error(jarSlave.getId()+"号小车复位线程报错!"+e);
            }
        }
    }
    /**
     *  Jar任务创建  执行
     */
    public synchronized boolean jarGenerateWrkMastStaExecute(JarSlave jarSlave) {
        try{
            // 获取堆垛机信息
            JarThread jarThread = (JarThread) SlaveConnection.get(SlaveType.Jar, jarSlave.getId());
            JarProtocol jarProtocol = jarThread.getJarProtocol();
            if (jarProtocol == null) {
                return false;
            }
            if (jarProtocol.modeType != JarModeType.AUTO){
                return false;
            }
            JarThread jarOtherThread = (JarThread) SlaveConnection.get(SlaveType.Jar, jarSlave.getJarOtherId());
            JarProtocol jarOtherProtocol = jarOtherThread.getJarProtocol();
            if (jarOtherProtocol == null) {
                return false;
            }
            if (jarOtherProtocol.modeType != JarModeType.AUTO){
                return false;
            }
            //自动、空闲、右门关闭、
            if (jarProtocol.isAutoing() && !jarProtocol.isRightDoor() && jarProtocol.jarErr==0 && !jarOtherProtocol.isLeftDoor() && jarOtherProtocol.jarErr==0){
            }
        } catch (Exception e){
//            log.error("堆垛机工位二完成等待确认异常,堆垛机号={},异常信息={},工位号={}",crn.getId(),e.getMessage(),2);
        }
        return false;
    }
    /**
     *  Jar任务创建  执行
     */
    public synchronized boolean jarGenerateWrkMastStaExecuteOne(JarSlave jarSlave) {
        try{
            // 获取堆垛机信息
            JarThread jarThread = (JarThread) SlaveConnection.get(SlaveType.Jar, jarSlave.getId());
            JarProtocol jarProtocol = jarThread.getJarProtocol();
            if (jarProtocol == null) {
                return false;
            }
            if (jarProtocol.modeType != JarModeType.AUTO){
                return false;
            }
            JarThread jarOtherThread = (JarThread) SlaveConnection.get(SlaveType.Jar, jarSlave.getJarOtherId());
            JarProtocol jarOtherProtocol = jarOtherThread.getJarProtocol();
            if (jarOtherProtocol == null) {
                return false;
            }
            if (jarOtherProtocol.modeType != JarModeType.AUTO){
                return false;
            }
            //自动、空闲、右门关闭、
            if (jarProtocol.isAutoing() && !jarProtocol.isRightDoor() && jarProtocol.jarErr==0 && !jarOtherProtocol.isLeftDoor() && jarOtherProtocol.jarErr==0){
            }
        } catch (Exception e){
//            log.error("堆垛机工位二完成等待确认异常,堆垛机号={},异常信息={},工位号={}",crn.getId(),e.getMessage(),2);
        }
        return false;
    }
    /**
     *  Jar任务创建  执行
     */
    public synchronized boolean jarGenerateWrkMastStaExecuteTwo(JarSlave jarSlave) {
        try{
            // 获取堆垛机信息
            JarThread jarThread = (JarThread) SlaveConnection.get(SlaveType.Jar, jarSlave.getId());
            JarProtocol jarProtocol = jarThread.getJarProtocol();
            if (jarProtocol == null) {
                return false;
            }
            if (jarProtocol.modeType != JarModeType.AUTO){
                return false;
            }
            JarThread jarOtherThread = (JarThread) SlaveConnection.get(SlaveType.Jar, jarSlave.getJarOtherId());
            JarProtocol jarOtherProtocol = jarOtherThread.getJarProtocol();
            if (jarOtherProtocol == null) {
                return false;
            }
            if (jarOtherProtocol.modeType != JarModeType.AUTO){
                return false;
            }
            //自动、空闲、右门关闭、
            if (jarProtocol.isAutoing() && !jarProtocol.isRightDoor() && jarProtocol.jarErr==0 && !jarOtherProtocol.isLeftDoor() && jarOtherProtocol.jarErr==0){
            }
        } catch (Exception e){
//            log.error("堆垛机工位二完成等待确认异常,堆垛机号={},异常信息={},工位号={}",crn.getId(),e.getMessage(),2);
        }
        return false;
    }
    /**
@@ -4499,7 +4615,7 @@
        return false;
    }
    /*
     * 小车取空板至工位任务  满取
     * 穿梭板移动
     * */
    public synchronized boolean jarRgvTake8(Integer rgvId,BasJarMast basJarMast){
        return false;