#
luxiaotao1123
2021-01-11 9042e885de0413ccfa89d231fc77ddf70c9e58d5
src/main/java/com/zy/core/thread/SiemensCrnThread.java
@@ -114,7 +114,7 @@
     * 读取状态
     */
    private void readStatus(){
        OperateResultExOne<byte[]> result = siemensNet.Read("DB11.2", (short) 90);
        OperateResultExOne<byte[]> result = siemensNet.Read("DB11.2", (short) 104);
        if (result.IsSuccess) {
            if (null == crnProtocol) {
                crnProtocol = new CrnProtocol();
@@ -160,6 +160,19 @@
            crnProtocol.setDoubleLow(bool3[5]);
            crnProtocol.setPlatformHigh(bool3[6]);
            crnProtocol.setPlatformLow(bool3[7]);
            boolean[] bool4 = siemensNet.getByteTransform().TransBool(result.Content, 64, 1);    // 66
            crnProtocol.setLoaded((short) (bool4[4]?1:0));  // 有物
            // 速度
            crnProtocol.setXSpeed((float) siemensNet.getByteTransform().TransInt16(result.Content, 22));    // 24
            crnProtocol.setYSpeed((float) siemensNet.getByteTransform().TransInt16(result.Content, 24));    // 26
            crnProtocol.setZSpeed((float) siemensNet.getByteTransform().TransInt16(result.Content, 26));    // 28
            // 累计里程、时长
            crnProtocol.setXDuration((float) siemensNet.getByteTransform().TransInt32(result.Content, 88));    // 90
            crnProtocol.setYDistance((float) siemensNet.getByteTransform().TransInt32(result.Content, 92));    // 94
            crnProtocol.setXDuration((float) siemensNet.getByteTransform().TransInt32(result.Content, 96));    // 98
            crnProtocol.setYDuration((float) siemensNet.getByteTransform().TransInt32(result.Content, 100));    // 102
            // 增强
            if (crnProtocol.getForkHome()) {
                crnProtocol.setForkPos(CrnForkPosType.HOME);
@@ -230,6 +243,9 @@
            log.error("堆垛机写入命令为空");
            return false;
        }
        if (command.getTaskNo() == 0) {
            command.setTaskNo((short) 9999);
        }
        command.setCrnNo(slave.getId());
        short[] array = new short[9];
        if (!command.getTaskModeType().equals(CrnTaskModeType.CLEAR)) {
@@ -246,15 +262,14 @@
        array[7] = command.getSourceStaNo();
        array[8] = command.getDestinationStaNo();
        // 作业信息
        OperateResult result = siemensNet.Write("DB10.0", array);
        OperateResult result = siemensNet.Write("DB1000.0", array);
        // 任务号
        OperateResult result1 = siemensNet.Write("DB10.24", command.getTaskNo());
        OperateResult result1 = siemensNet.Write("DB1000.24", command.getTaskNo());
        // 结束位
        OperateResult result2 = siemensNet.Write("DB10.28.1", true);
        if (result.IsSuccess && result1.IsSuccess && result2.IsSuccess) {
            try {
                // 日志记录
        OperateResult result2 = siemensNet.Write("DB1000.28.1", true);
        // 日志记录
        try {
            if (command.getAckFinish() != 1) {
                BasCrnOptService bean = SpringUtils.getBean(BasCrnOptService.class);
                BasCrnOpt basCrnOpt = new BasCrnOpt(
                        command.getTaskNo().intValue(),    // 任务号
@@ -264,17 +279,20 @@
                        command.getSourcePosX().intValue(),    // 源排
                        command.getSourcePosY().intValue(),    // 源列
                        command.getSourcePosZ().intValue(),    // 源层
                        command.getSourceStaNo().intValue(),    // 源站
                        null,    // 源站
                        command.getDestinationPosX().intValue(),    // 目标排
                        command.getDestinationPosY().intValue(),    // 目标列
                        command.getDestinationPosZ().intValue(),    // 目标层
                        command.getDestinationStaNo().intValue(),    // 目标站
                        null,    // 目标站
                        null,    // 响应结果
                        null,    // 修改时间
                        null    // 修改人员
                );
                bean.insert(basCrnOpt);
            } catch (Exception ignore) {}
            }
        } catch (Exception ignore) {}
        if (result.IsSuccess && result1.IsSuccess && result2.IsSuccess) {
            log.info("堆垛机命令下发[id:{}] >>>>> {}", slave.getId(), JSON.toJSON(command));
            OutputQueue.CRN.offer(MessageFormat.format("【{0}】[id:{1}] >>>>> 命令下发: {2}", DateUtils.convert(new Date()), slave.getId(), JSON.toJSON(command)));