#
Junjie
5 小时以前 58b2e9a664d9395654cd3865f01043e3cfc2f1dd
#
1个文件已修改
53 ■■■■■ 已修改文件
src/main/java/com/zy/core/utils/CrnOperateProcessUtils.java 53 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/core/utils/CrnOperateProcessUtils.java
@@ -105,45 +105,60 @@
                // 如果最近一次是入库模式
                if (crnProtocol.getLastIo().equals("I")) {
                    if (basCrnp.getInEnable().equals("Y")) {
                        this.crnExecuteIn(basCrnp, crnThread); //  入库
                        boolean result = this.crnExecuteIn(basCrnp, crnThread);//  入库
                        crnProtocol.setLastIo("O");
                        if (result) {
                            break;
                        }
                    } else if (basCrnp.getOutEnable().equals("Y")) {
                        this.crnExecuteOut(basCrnp, crnThread); //  出库
                        boolean result = this.crnExecuteOut(basCrnp, crnThread);//  出库
                        crnProtocol.setLastIo("I");
                        if (result) {
                            break;
                        }
                    }
                }
                // 如果最近一次是出库模式
                else if (crnProtocol.getLastIo().equals("O")) {
                    if (basCrnp.getOutEnable().equals("Y")) {
                        this.crnExecuteOut(basCrnp, crnThread); //  出库
                        boolean result = this.crnExecuteOut(basCrnp, crnThread);//  出库
                        crnProtocol.setLastIo("I");
                        if (result) {
                            break;
                        }
                    } else if (basCrnp.getInEnable().equals("Y")) {
                        this.crnExecuteIn(basCrnp, crnThread); //  入库
                        boolean result = this.crnExecuteIn(basCrnp, crnThread);//  入库
                        crnProtocol.setLastIo("O");
                        if (result) {
                            break;
                        }
                    }
                }
                //库位移转
                this.crnExecuteLocTransfer(basCrnp, crnThread);
                boolean transfer = this.crnExecuteLocTransfer(basCrnp, crnThread);
                if (transfer) {
                    break;
                }
            }
        }
    }
    private synchronized void crnExecuteIn(BasCrnp basCrnp, CrnThread crnThread) {
    private synchronized boolean crnExecuteIn(BasCrnp basCrnp, CrnThread crnThread) {
        CrnProtocol crnProtocol = crnThread.getStatus();
        if(crnProtocol == null){
            return;
            return false;
        }
        if(!basCrnp.getInEnable().equals("Y")){
            News.info("堆垛机:{} 可入信号不满足", basCrnp.getCrnNo());
            return;
            return false;
        }
        List<StationObjModel> inStationList = basCrnp.getInStationList$();
        if(inStationList.isEmpty()){
            News.info("堆垛机:{} 入库站点未设置", basCrnp.getCrnNo());
            return;
            return false;
        }
        Integer crnNo = basCrnp.getCrnNo();
@@ -219,25 +234,27 @@
                MessageQueue.offer(SlaveType.Crn, crnNo, new Task(2, command));
                notifyUtils.notify(String.valueOf(SlaveType.Crn), crnNo, String.valueOf(wrkMast.getWrkNo()), wrkMast.getWmsWrkNo(), NotifyMsgType.CRN_IN_TASK_RUN, null);
                News.info("堆垛机命令下发成功,堆垛机号={},任务数据={}", crnNo, JSON.toJSON(command));
                return true;
            }
        }
        return false;
    }
    private synchronized void crnExecuteOut(BasCrnp basCrnp, CrnThread crnThread) {
    private synchronized boolean crnExecuteOut(BasCrnp basCrnp, CrnThread crnThread) {
        CrnProtocol crnProtocol = crnThread.getStatus();
        if(crnProtocol == null){
            return;
            return false;
        }
        if(!basCrnp.getOutEnable().equals("Y")){
            News.info("堆垛机:{} 可出信号不满足", basCrnp.getCrnNo());
            return;
            return false;
        }
        List<StationObjModel> outStationList = basCrnp.getOutStationList$();
        if(outStationList.isEmpty()){
            News.info("堆垛机:{} 出库站点未设置", basCrnp.getCrnNo());
            return;
            return false;
        }
        Integer crnNo = basCrnp.getCrnNo();
@@ -308,10 +325,11 @@
                    MessageQueue.offer(SlaveType.Crn, crnNo, new Task(2, command));
                    notifyUtils.notify(String.valueOf(SlaveType.Crn), crnNo, String.valueOf(wrkMast.getWrkNo()), wrkMast.getWmsWrkNo(), NotifyMsgType.CRN_OUT_TASK_RUN, null);
                    News.info("堆垛机命令下发成功,堆垛机号={},任务数据={}", crnNo, JSON.toJSON(command));
                    return;
                    return true;
                }
            }
        }
        return false;
    }
    private synchronized boolean crnExecuteInPlanner(BasCrnp basCrnp, CrnThread crnThread, WrkMast wrkMast) {
@@ -492,10 +510,10 @@
        return false;
    }
    private synchronized void crnExecuteLocTransfer(BasCrnp basCrnp, CrnThread crnThread) {
    private synchronized boolean crnExecuteLocTransfer(BasCrnp basCrnp, CrnThread crnThread) {
        CrnProtocol crnProtocol = crnThread.getStatus();
        if(crnProtocol == null){
            return;
            return false;
        }
        Integer crnNo = basCrnp.getCrnNo();
@@ -540,9 +558,10 @@
                MessageQueue.offer(SlaveType.Crn, crnNo, new Task(2, command));
                notifyUtils.notify(String.valueOf(SlaveType.Crn), crnNo, String.valueOf(wrkMast.getWrkNo()), wrkMast.getWmsWrkNo(), NotifyMsgType.CRN_TRANSFER_TASK_RUN, null);
                News.info("堆垛机命令下发成功,堆垛机号={},任务数据={}", crnNo, JSON.toJSON(command));
                return;
                return true;
            }
        }
        return false;
    }
    //堆垛机任务执行完成