自动化立体仓库 - WCS系统
Junjie
2023-04-14 f27968397dd2d37add528bf7937ebd6905762a09
src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
@@ -606,115 +606,6 @@
        }
    }
//    /**
//     * 入库  ===>>  四向穿梭车入库作业下发
//     */
//    public synchronized void shuttleIoInExecute() {
//        // 根据输送线plc遍历
//        for (DevpSlave devp : slaveProperties.getDevp()) {
//            // 遍历入库站
//            for (DevpSlave.StaRack rackInStn : devp.getRackInStn()) {
//                // 获取入库站信息
//                DevpThread devpThread = (DevpThread) SlaveConnection.get(SlaveType.Devp, devp.getId());
//
//                StaProtocol staProtocol = devpThread.getStation().get(rackInStn.getStaNo());
//                StaProtocol staProtocol105 = devpThread.getStation().get(105);
//                staProtocol105.setWorkNo((short) 752);
//                staProtocol105.setStaNo((short) 100);
//
//                StaProtocol staProtocol106 = devpThread.getStation().get(106);
//                staProtocol106.setWorkNo((short) 753);
//                staProtocol106.setStaNo((short) 100);
//
//                if (staProtocol == null) {
//                    continue;
//                } else {
//                    staProtocol = staProtocol.clone();
//                }
//                Short workNo = staProtocol.getWorkNo();
//
//                // 判断是否满足入库条件
//                if (true || staProtocol.isAutoing() && staProtocol.isLoading() && staProtocol.isInEnable()) {
//                    WrkMast wrkMast = wrkMastMapper.selectRackInStep48(workNo, staProtocol.getSiteId());
//                    if (wrkMast != null) {
//                        if (wrkMast.getWrkSts() == 4 || wrkMast.getWrkSts() == 8) {
//                            ShuttleThread shuttleThread = null;
//                            HashMap<String, Object> searchIdleShuttle = null;
//                            if (wrkMast.getWrkSts() == 4) {
//                                //寻找最近且空闲的四向穿梭车
//                                searchIdleShuttle = this.searchIdleShuttle(wrkMast);
//                                shuttleThread = (ShuttleThread) searchIdleShuttle.get("result");
//                            }else {
//                                //状态8,四向穿梭车已在提升机口,等待命令进行入库搬运动作
//                                Integer shuttleNo = wrkMast.getShuttleNo();//四向穿梭车号
//                                shuttleThread = (ShuttleThread) SlaveConnection.get(SlaveType.Shuttle, shuttleNo);
//                            }
//
//                            if (shuttleThread == null) {
//                                continue;
//                            }
//
//                            ShuttleProtocol shuttleProtocol = shuttleThread.getShuttleProtocol();
//                            if (!shuttleProtocol.isIdle()) {
//                                continue;
//                            }
//
//                            wrkMast.setShuttleNo(shuttleProtocol.getShuttleNo().intValue());//给工作档分配四向穿梭车号
//
//                            //分配任务号
//                            shuttleProtocol.setTaskNo(wrkMast.getWrkNo().shortValue());
//                            //分配源库位
//                            shuttleProtocol.setSourceLocNo(wrkMast.getSourceLocNo());
//
//                            ShuttleAssignCommand assignCommand = new ShuttleAssignCommand();
//                            //四向穿梭车号
//                            assignCommand.setShuttleNo(shuttleProtocol.getShuttleNo());
//                            //任务号
//                            assignCommand.setTaskNo(wrkMast.getWrkNo().shortValue());
//                            //入出库模式
//                            assignCommand.setTaskMode(ShuttleTaskModeType.PAK_IN.id.shortValue());
//                            //源库位(小车当前位置)
//                            String currentLocNo = shuttleProtocol.getCurrentLocNo();
//                            assignCommand.setSourceLocNo(currentLocNo);
//
//                            if (wrkMast.getWrkSts() == 8 || Boolean.parseBoolean(searchIdleShuttle.get("sameLay").toString())) {
//                                //同一层
//                                //分配目标库位
//                                shuttleProtocol.setLocNo(wrkMast.getLocNo());
//                                //目标库位
//                                assignCommand.setLocNo(wrkMast.getLocNo());
//                                wrkMast.setWrkSts(9L);//小车入库中
//
//                                //获取从小车
//                            }else {
//                                //不同层,将目标库位分配成提升机库位号
//
//                                //小车当前层高
//                                Integer currentLev = Integer.parseInt(currentLocNo.substring(currentLocNo.length() - 2, currentLocNo.length()));
//
//                                //获取提升机
//                                LiftSlave liftSlave = slaveProperties.getLift().get(0);
//                                //提升机库位号
//                                String liftLocNo = liftSlave.getLiftLocNo(currentLev);
//                                shuttleProtocol.setLocNo(liftLocNo);
//                                //目标库位
//                                assignCommand.setLocNo(liftLocNo);
//                                wrkMast.setWrkSts(5L);//小车迁移状态
//                            }
//
//                            if (wrkMastMapper.updateById(wrkMast) > 0) {
//                                //下发任务
//                                MessageQueue.offer(SlaveType.Shuttle, assignCommand.getShuttleNo().intValue(), new Task(3, assignCommand));
//                            }
//                        }
//
//                    }
//                }
//
//            }
//        }
//
//    }
    /**
     * 入库  ===>>  四向穿梭车入库作业下发
@@ -807,7 +698,6 @@
                                    moveCommand.setStartToDistDistance(1300);
                                    moveCommand.setMiddleToDistDistance(0);
                                    moveCommand.setRunDirection(commands.get(0).getRunDirection());
                                    moveCommand.setRunSpeed((short) 1000);
                                    moveCommand.setCommandEnd((short) 1);
                                    commands.add(0, moveCommand);//将该指令添加到队头
                                }
@@ -883,7 +773,6 @@
            command.setForceMoveDistance(0);
            command.setChargeSwitch((short) 2);
            command.setIOControl((short) 0);
            command.setRunSpeed((short) 1000);
            command.setRadarTmp((short) 0);
            command.setCommandEnd((short) 1);
            commands.add(command);
@@ -930,7 +819,6 @@
            command.setForceMoveDistance(0);
            command.setChargeSwitch((short) 2);
            command.setIOControl((short) 0);
            command.setRunSpeed((short) 1000);
            command.setRadarTmp((short) 0);
            command.setCommandEnd((short) 1);
            commands.add(command);
@@ -978,7 +866,6 @@
            command.setForceMoveDistance(0);
            command.setChargeSwitch((short) 2);
            command.setIOControl((short) 0);
            command.setRunSpeed((short) 1000);
            command.setRadarTmp((short) 0);
            command.setCommandEnd((short) 1);
            commands.add(command);
@@ -1103,7 +990,6 @@
                        moveCommand.setStartToDistDistance(1300);
                        moveCommand.setMiddleToDistDistance(0);
                        moveCommand.setRunDirection(commands.get(0).getRunDirection());
                        moveCommand.setRunSpeed((short) 1000);
                        moveCommand.setCommandEnd((short) 1);
                        commands.add(0, moveCommand);//将该指令添加到队头