#
luxiaotao1123
3 天以前 4790be9d288a84a38b10e143c8433b7becc62404
src/main/java/com/zy/asrs/service/impl/CtuMainServiceImpl.java
@@ -69,11 +69,26 @@
    private boolean flag1007 = false;
    private Map<Integer, Long> staNoSet = new HashMap<>();
    public Map<Integer, Long> getStaNoSet() {
        return staNoSet;
    }
    public void setStaNoSet(Map<Integer, Long> staNoSet) {
        this.staNoSet = staNoSet;
    }
    /**
     * 入库,从拣料站到入库站(CTU取货站)
     */
    public synchronized void generateStoreWrkFile(Integer mark) {
        for (Map.Entry<Integer, Long> entry : staNoSet.entrySet()) {
            if (entry.getValue() != null && System.currentTimeMillis() - entry.getValue() > 1000 * 60 * 5) {
                log.info("超时:{}", entry.getKey());
                staNoSet.remove(entry.getKey());
            }
        }
        // 根据输送线plc遍历
        SiemensDevpThread devpThread = (SiemensDevpThread) SlaveConnection.get(SlaveType.Devp, 1);
        StaProtocol staProtocol = devpThread.getStation().get(1004);
@@ -83,9 +98,13 @@
            staProtocol = staProtocol.clone();
        }
        // 判断是否满足条件
//        if (!staProtocol.isLoading()) {
//            return;
//        }
        if (!staProtocol.isLoading()) {
            return;
        }
        Long i = staNoSet.get(staProtocol.getWorkNo());
        if (i != null) {
            return;
        }
        // && staProtocol.isInEnable()
        if (staProtocol.getWorkNo() > 0 && staProtocol.isAutoing() && !staProtocol.isEmptyMk() && staProtocol.isPakMk()) {
            if (staProtocol.getStaNo() == 1004) {
@@ -96,6 +115,7 @@
                }
                staProtocol.setStaNo((short) 1007);
                boolean result = MessageQueue.offer(SlaveType.Devp, 1, new Task(2, staProtocol));
                staNoSet.put(staProtocol.getWorkNo(), System.currentTimeMillis());
                log.info("入库输送线下发:{},{}", staProtocol.getWorkNo(), 1007);
            }
@@ -302,14 +322,24 @@
        }
        SiemensDevpThread devpThread = (SiemensDevpThread) SlaveConnection.get(SlaveType.Devp, 1);
        StaProtocol staProtocol = devpThread.getStation().get(1001);
        if (i >= 6) {
        if (i >= 7) {
            OpenBusSubmitParam openBusSubmitParam = new OpenBusSubmitParam();
            openBusSubmitParam.setBatch(DateUtils.convert(new Date()));
            List<TaskDto> taskList = new ArrayList<>();
            TaskDto taskDto = new TaskDto();
            Random rand = new Random();
            TaskDto taskDto = new TaskDto();
            taskDto.setSeqNum("SSX-CK" + rand.nextInt() * 10000);
            taskDto.setOriLoc(getFLoc("1001", "16"));
            taskDto.setDestSta("1001");
            taskDto.setPriority(123);
            taskList.add(taskDto);
            String fLoc = getFLoc("1001", "16");
            if (fLoc == taskDto.getOriLoc()) {
                fLoc = getFLoc("1001", "16");
            }
            taskDto = new TaskDto();
            taskDto.setSeqNum("SSX-CK" + rand.nextInt() * 10000);
            taskDto.setOriLoc(fLoc);
            taskDto.setDestSta("1001");
            taskDto.setPriority(123);
            taskList.add(taskDto);
@@ -386,7 +416,7 @@
                log.info("下发任务返回数据:{}", response);
                return true;
            } else {
                log.error("请求接口失败!!!url:{};request:{};response:{}", ctuUrl + sendTask, JSON.toJSONString(openBusSubmitParam), response);
                //log.error("请求接口失败!!!url:{};request:{};response:{}", ctuUrl + sendTask, JSON.toJSONString(openBusSubmitParam), response);
                throw new CoolException("调用下发任务接口报错");
            }
        } catch (Exception e) {
@@ -441,7 +471,7 @@
                JSONObject loc = JSON.parseObject(jsonObject.getString("data"));
                return loc.getString("locNo");
            } else {
                log.error("请求接口失败!!!url:{};request:{};response:{}", ctuUrl + sendTask, JSON.toJSONString(data), response);
                //log.error("请求接口失败!!!url:{};request:{};response:{}", ctuUrl + sendTask, JSON.toJSONString(data), response);
                throw new CoolException("调用下发任务接口报错");
            }
        } catch (Exception e) {