pang.jiabao
14 小时以前 2de4173f02cc9525949eb20e60595019b9be9a3f
部署服务器
22个文件已修改
1979 ■■■■■ 已修改文件
src/main/java/com/zy/common/model/CanningLineInLocParam.java 28 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/common/model/LocTypeDto.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/common/model/SearchLocParam.java 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/controller/SiteController.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/core/MainProcess.java 33 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/core/model/command/CrnCommand.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/core/model/protocol/StaProtocol.java 38 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/core/thread/SiemensCrnThread.java 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/core/thread/SiemensDevpThread.java 415 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/entity/WrkDetl.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/entity/WrkMast.java 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/mapper/WrkMastMapper.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/service/impl/MainServiceImpl.java 952 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/application.yml 140 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/WrkDetlMapper.xml 36 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/WrkMastMapper.xml 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/webapp/static/js/console.js 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/webapp/static/js/console.map.js 228 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/webapp/views/console.html 47 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/webapp/views/control.html 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/webapp/views/index.html 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/webapp/views/indexTV.html 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/common/model/CanningLineInLocParam.java
@@ -10,14 +10,28 @@
@Data
public class CanningLineInLocParam {
    /**
     * 任务号
     */
    private Integer wrkNo;
    // 任务号
    private int wrkNo;
    /**
     * 源站点
     */
    // 桶型标识
    private String matnr;
    //  批号
    private String batch;
    // 生产日期
    private String manuDate;
    // 净重
    private double weight;
    // 复检重量
    private double grossWeight;
     // 源站点
    private Integer sourceStaNo;
    // 贴标成功否
    private boolean tbFlag;
}
src/main/java/com/zy/common/model/LocTypeDto.java
@@ -33,9 +33,9 @@
//        if (staProtocol.isHigh() == staProtocol.isLow()) {
//            throw new CoolException("plc高低检测异常");
//        }
//        if (staProtocol.getSiteId() == 106 || staProtocol.getSiteId() == 159){
//        if (staProtocol.isHigh()) {
//            this.locType1 = 2; // 高库位
//        }else {
//        } else if (staProtocol.isLow()) {
            this.locType1 = 1; // 低库位
//        }
    }
src/main/java/com/zy/common/model/SearchLocParam.java
@@ -1,10 +1,10 @@
package com.zy.common.model;
import com.alibaba.fastjson.JSON;
import lombok.AllArgsConstructor;
import lombok.Data;
import java.util.HashMap;
import java.util.Map;
import java.util.List;
/**
 * Created by vincent on 2020/10/30
@@ -21,11 +21,6 @@
    // 库位规格( 0:未知, 1:低库位, 2:中库位, 3:高库位 )
    private Short locType1;
    /**
     * 库区类型 1.成品库,2.空桶库
     */
    private int locArea;
    // 入库桶编号
    private String bucketType;
@@ -36,7 +31,14 @@
    private boolean tailSupportFlag;
    // 罐装线要桶 罐装线号-桶类型
    private Map<Integer,String> wantBucketFlag =  new HashMap<>();
    private List<WantBucket> wantBucketFlag;
    @Data
    @AllArgsConstructor
    public static class WantBucket{
        private int site;
        private int bucketType;
    }
    public static void main(String[] args) {
        SearchLocParam searchLocParam = new SearchLocParam();
src/main/java/com/zy/controller/SiteController.java
@@ -50,8 +50,6 @@
            SiemensDevpThread devpThread = (SiemensDevpThread) SlaveConnection.get(SlaveType.Devp, devp.getId());
            Map<String, Object> map2 = new HashMap<>();
            map2.put("floor", 2);
            map2.put("modeVal", devpThread.ioModeOf101.id);
            map2.put("modeDesc", devpThread.ioModeOf101.desc);
            res.add(map2);
        }
        return R.ok().add(res);
src/main/java/com/zy/core/MainProcess.java
@@ -29,34 +29,47 @@
    /**
     * =====>>  开始工作
     */
    public void start(){
    public void start() throws InterruptedException {
        thread = new Thread(() -> {
            // 初始化罐装线出库口是否可出
            while (!Thread.currentThread().isInterrupted()) {
                try {
                    Thread.sleep(1000);
                    // 系统运行状态判断
                    if (!SystemProperties.WCS_RUNNING_STATUS.get()) {
                        continue;
                    }
                    if(rgcWrk) {
                        Thread.sleep(3000);
                        mainService.intiGzxkc();
                        rgcWrk = false;
                    }
                    // 托盘到达rgv接驳站点,更改工作档状态为9.呼叫RGV,环穿程序调度rgv
                    mainService.callRgv();
                    // rgv放货完成,给输送线下发任务
                    mainService.rgvToDev();
                    // 1090异常口重新入库分配库位
                    mainService.abnormalMouthWarehousing();
                    Thread.sleep(1000);
                    // 入库  ===>> 入库站到堆垛机站,根据条码扫描生成入库工作档
                    mainService.generateStoreWrkFile(1); // 组托
                    Thread.sleep(500);
                    Thread.sleep(1000);
                    // 生成 空子/母托盘出库任务
                    mainService.generateEmptyPalletStoreWrk();
                    // 入库 ===>> 空子托盘入库
                    mainService.storeEmptyPlt();
                    // 入库 ===>> 母空托盘叠满入库
                    // 入库 ===>> 母托盘叠满入库
                    mainService.autoEmptyIn();
                    Thread.sleep(1000);
                    // 子托盘底下母托盘回叠盘机
//                    mainService.motherTrayReflow();
                    // 出库  ===>>  堆垛机出库站到出库站
                    mainService.crnStnToOutStn(4);
@@ -67,8 +80,12 @@
                    // 入库  ===>> 执行对工作档的完成操作
                    mainService.storeFinished(6);
                    // 空桶罐装完成到达罐装线rgv口 完成直供罐装线任务和空桶出库任务,创建成品桶入库任务
                    // 空桶到达罐装线入口 告诉罐装线入库桶信息
                    mainService.inGzxBefore();
                    // 空桶罐装完成到达罐装线出口 完成直供罐装线任务和空桶出库任务,创建成品桶入库任务
                    mainService.canningLineTaskFinish();
                    Thread.sleep(1000);
                    // 堆垛机异常信息记录
                    mainService.recCrnErr(7);
src/main/java/com/zy/core/model/command/CrnCommand.java
@@ -74,6 +74,9 @@
    // 任务确认 0:未确认 1:已确认
    private Short command = 0;
    // 空桶库出库,告诉堆垛机这次出库有几个货
    private Short taskCount = 0;
    private boolean traySize = false;
    public void setTaskMode(Short taskMode){
src/main/java/com/zy/core/model/protocol/StaProtocol.java
@@ -58,6 +58,7 @@
    //lfd入库印记  当stamp>=2时才入库
    private Integer stamp = 0;
    // 入库输送线反馈入库桶的信息----------------------------------------------------------
    /**
     * 入库桶编号/物料号
     */
@@ -73,10 +74,39 @@
     */
    private boolean tailSupportFlag;
    /**
     * 清除要桶信号 0.不用清除,123清除相应要桶信号
     */
    private int clearBucketSignal;
//    /**
//     * 清除要桶信号 0.不用清除,123清除相应要桶信号
//     */
//    private int clearBucketSignal;
    // 读输送线反馈的辅助任务号----------------------------------------------------------
    // RGV放货完成辅助任务号
    private Integer hideWorkNo = 0;
    // 要桶型-------------------------------------------------------------------------
    private int wantBucketFlag = 0;
    // 出罐装线 罐装线反馈给wcs----------------------------------------------------------
    // 任务号
    private int wrkNo;
    // 成品标识
    private String matnr;
    //  批号
    private String batch;
    // 生产日期
    private String manuDate;
    // 净重
    private double weight;
    // 复检重量
    private double grossWeight;
    // 出罐装线任务完成,给罐装线写可放信号 1可放,2不可放-------------------------------------
    private int placeableFlag;
    // 外形检测 ------------------------------------------------------------------------
src/main/java/com/zy/core/thread/SiemensCrnThread.java
@@ -89,6 +89,7 @@
                        command.setDestinationPosX((short)0);     // 目标库位排
                        command.setDestinationPosY((short)0);     // 目标库位列
                        command.setDestinationPosZ((short)0);     // 目标库位层
                        command.setTaskCount((short) 0);
                        write(command);
                        break;
                    default:
@@ -267,7 +268,7 @@
//        convertRow(command);
        command.setCrnNo(slave.getId());
//        short[] array = new short[10];
        short[] array = new short[10];
        short[] array = new short[12];
        array[0] = command.getAckFinish(); // 任务完成确认位
        array[1] = command.getTaskNo();  // 任务号
        array[2] = command.getTaskMode();  // 模式
@@ -278,6 +279,7 @@
        array[7] = command.getDestinationPosY(); // 目标位置列号
        array[8] = command.getDestinationPosZ(); // 目标位置层号
        array[9] = command.getCommand();
        array[11] = command.getTaskCount(); // 空桶出库,告诉堆垛机取一个货还是两个货
        OperateResult result = siemensNet.Write("DB100.0", array);
        News.info("堆垛机命令下发[id:{}] >>>>> {}", slave.getId(), array);
src/main/java/com/zy/core/thread/SiemensDevpThread.java
@@ -8,16 +8,13 @@
import com.core.common.Cools;
import com.core.common.DateUtils;
import com.core.common.SpringUtils;
import com.core.exception.CoolException;
import com.zy.core.DevpThread;
import com.zy.core.cache.MessageQueue;
import com.zy.core.cache.OutputQueue;
import com.zy.core.cache.SlaveConnection;
import com.zy.core.enums.IoModeType;
import com.zy.core.enums.SlaveType;
import com.zy.core.model.DevpSlave;
import com.zy.core.model.Task;
import com.zy.core.model.protocol.StaError1;
import com.zy.core.model.protocol.StaProtocol;
import com.zy.entity.BasDevp;
import com.zy.service.BasDevpService;
@@ -41,55 +38,88 @@
    private SiemensS7Net siemensS7Net;
    private Map<Integer, StaProtocol> station = new ConcurrentHashMap<>();
    private short heartBeatVal = 1;
    private StaError1 staError1;
    public static final ArrayList<Integer> staNos = new ArrayList<Integer>() {{
    public static final ArrayList<Integer> staNos1 = new ArrayList<Integer>() {{
        add(1001);add(1002);add(1004);add(1005);add(1006);add(1007);add(1008);add(1009);add(1010);add(1011);add(1012);
        add(1041);add(1042);add(1043);add(1013);add(1014);add(1015);add(1016);add(1017);add(1018);add(1019);add(1020);
        add(1034);add(1035);add(1036);add(1038);add(1039);add(1040);
        add(1018);add(1017);add(1016);add(1015);add(1014);add(1020);add(1019);add(1013);add(1043);add(1042);add(1041);
        add(1022);add(1023);add(1024);add(1025);add(1026);add(1027);add(1028);add(1030);add(1031);add(1032);add(1033);
        add(1044);add(1045);add(1046);add(1047);add(1049);add(1050);add(1051);add(1052);add(1053);add(1054);add(1056);add(1057);
        add(1061);add(1063);add(1064);add(1065);add(1066);add(1067);add(1068);add(1073);add(1074);add(1075);add(1077);add(1078);add(1079);
        add(1034);add(1035);add(1036);add(1038);add(1039);add(1040);
    }};
    public static final ArrayList<Integer> staNos2 = new ArrayList<Integer>() {{
        add(1044);add(1045);add(1046);add(1047);add(1048);add(1049);add(1050);add(1051);add(1052);add(1053);add(1054);add(1055);add(1056);add(1057);add(1058);
        add(1061);add(1062);add(1066);add(1067);add(1068);add(1069);add(1070);add(1071);add(1072);add(1063);add(1064);add(1065);
        add(1073);add(1074);add(1075);add(1076);add(1077);add(1078);add(1079);
        add(1081);add(1082);add(1083);add(1084);add(1085);add(1086);add(1087);add(1088);add(1089);add(1090);
        add(1091);add(1092);add(1093);add(1094);add(1095);add(1096);add(1097);add(1098);add(1099);add(1100);add(1101);add(1102);add(1103);add(1104);
        add(1105);add(1106);add(1107);
    }};
    public static final ArrayList<Integer> BarcodeList = new ArrayList<Integer>() {{
        add(1); add(2);
    }};
    public static final ArrayList<Integer> staNosErrList = new ArrayList<Integer>() {{
        add(101); add(103);
    public static final ArrayList<Integer> staNos3 = new ArrayList<Integer>() {{
        add(1091);add(1092);add(1093);add(1094);add(1095);add(1096);add(1097);add(1098);add(1099);add(1100);add(1101);add(1102);
        add(1103);add(1104);add(1105);add(1106);add(1107);
    }};
    // 罐装线要桶标识
    private volatile Map<Integer,String> wantBucketFlag =  new HashMap<>();
    public static final ArrayList<Integer> rgvSiteBackWrkNo1= new ArrayList<Integer>() {{
        add(1001);add(1006);add(1012);add(1018);add(1019);add(1041);add(1022);add(1026);add(1033);add(1034);
    }};
    /**
     * 条码数量
     */
    private int barcodeSize = 2;
    public static final ArrayList<Integer> rgvSiteBackWrkNo2= new ArrayList<Integer>() {{
        add(1044);
    }};
    /**
     * 入出库模式
     * 0:未知
     * 1:入库启动中
     * 2.入库模式
     * 3.出库启动中 (不能生成入库工作档)
     * 4.出库模式
     */
    public IoModeType ioModeOf101 = IoModeType.NONE;
    public IoModeType ioModeOf103 = IoModeType.NONE;
    public IoModeType ioModeOf305 = IoModeType.NONE;
//    public IoModeType ioMode = IoModeType.NONE;
//    public IoModeType ioModeOf4F = IoModeType.NONE;
//    public IoModeType ioMode = IoModeType.NONE;
    public static final ArrayList<Integer> rgvSiteBackWrkNo3= new ArrayList<Integer>() {{
        add(1105);add(1100);add(1091);add(1094);add(1097);
    }};
    public static final ArrayList<Integer> barcodeList = new ArrayList<Integer>() {{
        add(1); add(2); add(3); add(4);
    }};
    // 外形检测1号plc
    public static final ArrayList<Integer> staNosErrList1 = new ArrayList<Integer>() {{
        add(1006); add(1012);add(1018);add(1041);
    }};
    // 外形检测2号plc
    public static final ArrayList<Integer> staNosErrList2 = new ArrayList<Integer>() {{
        add(1083); add(1086);add(1089);
    }};
    // 出罐装线反馈给wcs信息站点
    public static final ArrayList<Integer> gzxResultSite = new ArrayList<Integer>() {{
        add(1081); add(1084);add(1087);
    }};
    public SiemensDevpThread(DevpSlave slave) {
        this.slave = slave;
    }
    private ArrayList<Integer> getRgvSiteBackWrkNo() {
        switch (this.slave.getId()) {
            case 1: return rgvSiteBackWrkNo1;
            case 2: return rgvSiteBackWrkNo2;
            case 3: return rgvSiteBackWrkNo3;
            default:
        }
        return new ArrayList<>();
    }
    private ArrayList<Integer> getStaNo() {
        return staNos;
        switch (this.slave.getId()) {
            case 1: return staNos1;
            case 2: return staNos2;
            case 3: return staNos3;
            default:
        }
        return new ArrayList<>();
    }
    private ArrayList<Integer> getStaNosErrList() {
        switch (this.slave.getId()) {
            case 1: return staNosErrList1;
            case 2: return staNosErrList2;
            default:
        }
        return new ArrayList<>();
    }
    @Override
@@ -111,7 +141,18 @@
                    // 写数据 ID+目标站
                    case 2:
                        write((StaProtocol)task.getData());
//                        log.error("输送线下发命令:"+((StaProtocol) task.getData()).getWorkNo()+","+((StaProtocol) task.getData()).getStaNo());
                        break;
                    // 写尾桶信号
                    case 3:
                        writeTail((StaProtocol)task.getData());
                        break;
                    // 写入罐装线桶型信息
                    case 4:
                        writeGzx((StaProtocol)task.getData());
                        break;
                    // 给罐装线写可出
                    case 5:
                        writeGzxkc((StaProtocol)task.getData());
                        break;
                    default:
                        break;
@@ -176,15 +217,45 @@
    /**
     * 读取状态 ====> 整块plc
     */
    private void read() throws InterruptedException {
        wantBucketFlag.clear();
        //todo 读取罐装线PLC要桶标识
        wantBucketFlag.put(1,"IBC");
    private void read() {
        // 读一楼连续8个站点
        OperateResultExOne<byte[]> result = siemensS7Net.Read("DB101.0", (short) (8*8));
        if (result.IsSuccess) {
            for (int i = 0; i < 8; i++) {
        // 读罐装线反馈信息
        if (slave.getId() > 3) {
//            log.info("读取{}号罐装线plc信息成功",slave.getId());
            OperateResultExOne<byte[]> read = siemensS7Net.Read("DB101.0", (short) 58);
            if (read.IsSuccess) {
                // 成品信息反馈到罐装线出口站点
                DevpThread devpThread = (DevpThread) SlaveConnection.get(SlaveType.Devp, 2);
                StaProtocol staProtocol = devpThread.getStation().get(gzxResultSite.get(slave.getId()-4));
                if (staProtocol != null) {
                    staProtocol.setWantBucketFlag(siemensS7Net.getByteTransform().TransInt16(read.Content, 0));// 罐装线要桶型信号
                    staProtocol.setWrkNo(siemensS7Net.getByteTransform().TransInt16(read.Content, 2));
                    double weight208l1 = siemensS7Net.getByteTransform().TransInt32(read.Content, 4); // 200L桶1净重
                    double weight208l2 = siemensS7Net.getByteTransform().TransInt32(read.Content, 8); // 200L桶2净重
                    double weight208l3 = siemensS7Net.getByteTransform().TransInt32(read.Content, 12); // 200L桶3净重
                    double weight208l4 = siemensS7Net.getByteTransform().TransInt32(read.Content, 16); // 200L桶4净重
                    double weight1T = siemensS7Net.getByteTransform().TransInt32(read.Content, 20); // 1T桶净重
//                    log.info("读取工罐装线净重 200l桶1:{},200l桶2:{},200l桶3:{},200l桶4:{},1t桶:{}",weight208l1,weight208l2,weight208l3,weight208l4,weight1T);
                    staProtocol.setWeight(weight208l1 + weight208l2 + weight208l3 + weight208l4 + weight1T);
                    staProtocol.setGrossWeight(siemensS7Net.getByteTransform().TransInt32(read.Content, 24));
                    staProtocol.setMatnr(siemensS7Net.getByteTransform().TransString(read.Content, 28,12,"UTF-8"));
                    staProtocol.setBatch(siemensS7Net.getByteTransform().TransString(read.Content, 40,10,"UTF-8"));
                    staProtocol.setManuDate(siemensS7Net.getByteTransform().TransString(read.Content, 50,8,"UTF-8"));
                }
                return;
            }
        }
        ArrayList<Integer> staNos = getStaNo();
        if(staNos == null) {
            log.error("读取plc地址块,获取站点列表失败");
            return;
        }
        // 读站点信息反馈
        OperateResultExOne<byte[]> result = siemensS7Net.Read("DB101.0", (short) (staNos.size() * 8));
        if (result.IsSuccess)   {
            for (int i = 0; i < staNos.size(); i++) {
                Integer siteId = staNos.get(i); // 站点编号
                StaProtocol staProtocol = station.get(siteId);
                if (null == staProtocol) {
@@ -212,38 +283,11 @@
            }
        }
        // 条码扫描器
        OperateResultExOne<byte[]> barcodeResult = siemensS7Net.Read("DB101.1672", (short) ((BarcodeList.size()+1) * 8)); // 不连续
        if (barcodeResult.IsSuccess) {
            for (int i = 0; i < BarcodeList.size(); i++) {
                String barcode = siemensS7Net.getByteTransform().TransString(barcodeResult.Content,i*16,8, "UTF-8");
                BarcodeThread barcodeThread = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, BarcodeList.get(i));
                if(!Cools.isEmpty(barcodeThread) && !barcodeThread.getBarcode().equals(barcode)) {
                    barcodeThread.setBarcode(barcode);
                }
            }
        }
        // 外形检测
        OperateResultExOne<byte[]> resultErr = siemensS7Net.Read("DB101.1652", (short) ((staNosErrList.size()+1)*4)); // 不连续,多读中间一个
        if (resultErr.IsSuccess){
            for (int i = 0;i<staNosErrList.size();i++){
                boolean[] status = siemensS7Net.getByteTransform().TransBool(resultErr.Content, i*8+2, 1);
                StaProtocol staProtocol = station.get(staNosErrList.get(i));
                staProtocol.setFrontErr(status[0]);
                staProtocol.setBackErr(status[1]);
                staProtocol.setHighErr(status[2]);
                staProtocol.setLeftErr(status[3]);
                staProtocol.setRightErr(status[4]);
                staProtocol.setWeightErr(status[5]);
                staProtocol.setBarcodeErr(status[6]);
            }
        }
        // 读一楼连续8个站点,故障信息反馈
        OperateResultExOne<byte[]> resultErr2 = siemensS7Net.Read("DB101.3312", (short) (8*2));
        // 读故障信息反馈
        OperateResultExOne<byte[]> resultErr2 = siemensS7Net.Read("DB101.920", (short) (staNos.size()*4));
        if (resultErr2.IsSuccess) {
            for (int i = 0; i < 8; i++) {
                boolean[] status = siemensS7Net.getByteTransform().TransBool(resultErr2.Content, i*2 + 1, 1);
            for (int i = 0; i < staNos.size(); i++) {
                boolean[] status = siemensS7Net.getByteTransform().TransBool(resultErr2.Content, i * 4 + 2, 1);
                StaProtocol staProtocol = station.get(staNos.get(i)); // 站点编号
                staProtocol.setBreakerErr(status[0]);
                staProtocol.setInfraredErr(status[1]);
@@ -254,6 +298,74 @@
                staProtocol.setContactErr(status[6]);
                staProtocol.setUpcontactErr(status[7]);
            }
        }
        // 读rgv放货站点任务号反馈
        ArrayList<Integer> rgvSiteBackWrkNo = getRgvSiteBackWrkNo();
        OperateResultExOne<byte[]> rgvSiteBackWrkNoResult = siemensS7Net.Read("DB101.1440", (short) (rgvSiteBackWrkNo.size() * 2));
        if (rgvSiteBackWrkNoResult.IsSuccess) {
            for (int i = 0; i < rgvSiteBackWrkNo.size(); i ++ ){
                short hideWrkNo = siemensS7Net.getByteTransform().TransInt16(rgvSiteBackWrkNoResult.Content, i * 2);
                StaProtocol staProtocol = station.get(getRgvSiteBackWrkNo().get(i));
                staProtocol.setHideWorkNo((int) hideWrkNo);
            }
        }
        // 读条码扫描器
        if(slave.getId() == 1) {
            OperateResultExOne<byte[]> barcodeResult = siemensS7Net.Read("DB101.840", (short) (barcodeList.size() * 8));
            if (barcodeResult.IsSuccess) {
                for (int i = 0; i < barcodeList.size(); i++) {
                    String barcode = siemensS7Net.getByteTransform().TransString(barcodeResult.Content,i*8,8, "UTF-8");
                    BarcodeThread barcodeThread = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, barcodeList.get(i));
                    if(!Cools.isEmpty(barcodeThread) && !barcodeThread.getBarcode().equals(barcode)) {
                        barcodeThread.setBarcode(barcode);
                    }
                }
            }
        }
        // 读空桶信息反馈
        if (slave.getId() == 1) {
            OperateResultExOne<byte[]> emptyBucketsResult = siemensS7Net.Read("DB101.1320", (short) (staNosErrList1.size() * 6));
            if (emptyBucketsResult.IsSuccess) {
                for (int i = 0; i < staNosErrList1.size(); i++) {
                    // 桶类型标识
                    int bucketType = siemensS7Net.getByteTransform().TransInt16(emptyBucketsResult.Content, i * 6);
                    // 桶数量
                    int bucketCount = siemensS7Net.getByteTransform().TransInt16(emptyBucketsResult.Content, i * 6 + 2);
                    // 尾桶标识
                    boolean[] tailSupportArray= siemensS7Net.getByteTransform().TransBool(emptyBucketsResult.Content, i * 6 + 4,1);
                    boolean tailSupportFlag = tailSupportArray[0];
//                    log.info("空桶信息反馈,站点:{},桶类型标识:{},数量:{},尾桶标识:{}",staNosErrList1.get(i),bucketType,bucketCount,tailSupportFlag);
                    StaProtocol staProtocol = station.get(staNosErrList1.get(i));
                    if (null == staProtocol) {
                        staProtocol = new StaProtocol();
                        staProtocol.setSiteId(staNosErrList1.get(i));
                        station.put(staNosErrList1.get(i), staProtocol);
                    }
                    staProtocol.setBucketType(String.valueOf(bucketType));
                    staProtocol.setBucketCount(bucketCount);
                    staProtocol.setTailSupportFlag(tailSupportFlag);
                }
            }
        }
        // 读外形检测
        ArrayList<Integer> staNosErrList = getStaNosErrList();
        OperateResultExOne<byte[]> resultErr = siemensS7Net.Read("DB101.800", (short) (staNosErrList.size()*4));
        if (resultErr.IsSuccess){
            for (int i = 0;i<staNosErrList.size();i++){
                boolean[] status = siemensS7Net.getByteTransform().TransBool(resultErr.Content, i*4+2, 1);
                StaProtocol staProtocol = station.get(staNosErrList.get(i));
                staProtocol.setFrontErr(status[0]);
                staProtocol.setBackErr(status[1]);
                staProtocol.setHighErr(status[2]);
                staProtocol.setLeftErr(status[3]);
                staProtocol.setRightErr(status[4]);
                staProtocol.setWeightErr(status[5]);
                staProtocol.setBarcodeErr(status[6]);
            }
        }
@@ -270,9 +382,12 @@
                }
                BasDevpService basDevpService = SpringUtils.getBean(BasDevpService.class);
                if (null != basDevpService && !basDevpService.updateBatchById(basDevps)) {
                    throw new Exception("更新数据库数据失败");
                if(basDevps.size() > 0) {
                    if (null != basDevpService && !basDevpService.updateBatchById(basDevps)) {
                        throw new Exception("更新数据库数据失败");
                    }
                }
            } catch (Exception e) {
                initSite();
                e.printStackTrace();
@@ -294,41 +409,19 @@
            return;
        }
        int address = -1;
        switch (staProtocol.getSiteId()) {
            case 100: address = 0; break;
            case 101: address = 4; break;
            case 102: address = 8; break;
            case 103: address = 12; break;
            case 104: address = 16; break;
            case 105: address = 20; break;
            case 106: address = 24; break;
            case 107: address = 28; break;
            case 200: address = 400; break;
            case 201: address = 404; break;
            case 202: address = 408; break;
            case 203: address = 412; break;
            case 210: address = 440; break;
            case 300: address = 800; break;
            case 301: address = 804; break;
            case 302: address = 808; break;
            case 303: address = 812; break;
            case 304: address = 816; break;
            case 305: address = 820; break;
            default:
        }
        if(address == -1) {
            throw new CoolException("写入站点异常:" + staProtocol.getSiteId());
        }
        // 取站点下标,计算plc偏移量
        int i = getStaNo().indexOf(staProtocol.getSiteId());
        OperateResult write;
        OperateResult write1;
        //任务下发次数
        int writeCount = 0;
        do {
            write1 = siemensS7Net.Write("DB100." + (address+2), staProtocol.getStaNo());    // 目标站
            write = siemensS7Net.Write("DB100." + address, staProtocol.getWorkNo().shortValue());    // 工作号
            write1 = siemensS7Net.Write("DB100." + (i*6 +4), staProtocol.getStaNo());    // 目标站
            write = siemensS7Net.Write("DB100." + (i*6), staProtocol.getWorkNo());    // 工作号
            Thread.sleep(200);
            if(write.IsSuccess && write1.IsSuccess){
                log.info("输送线命令下发成功,站点:{},任务号:{},目标站:{}",staProtocol.getSiteId(),staProtocol.getWorkNo(),staProtocol.getStaNo());
                break;
            }
            else {
@@ -351,6 +444,114 @@
    }
    /**
     * 写尾桶信号
     */
    private void writeTail(StaProtocol staProtocol) throws InterruptedException {
        if (null == staProtocol) {
            return;
        }
        OperateResult write;
        //任务下发次数
        int writeCount = 0;
        do {
            write = siemensS7Net.Write("DB100.600", staProtocol.isTailSupportFlag() ? 1 : 0);    // 0 不是尾桶,1 是尾桶
            Thread.sleep(200);
            if(write.IsSuccess){
                break;
            }
            else {
                writeCount++;
                log.error("写入尾桶命令失败。输送线plc编号={},是否尾桶={},写入次数={}", slave.getId(), staProtocol.isTailSupportFlag(), writeCount);
            }
        }while (writeCount<5);
        if (!write.IsSuccess) {
            OutputQueue.DEVP.offer(MessageFormat.format("【{0}】写入尾桶命令数据失败。输送线plc编号={1},站点数据={2}", slave.getId(), staProtocol.isTailSupportFlag()));
            News.error("SiemensDevp"+" - 4"+" - 写入尾桶命令数据失败。输送线plc编号={},站点数据={}", slave.getId(), staProtocol.isTailSupportFlag());
        } else {
            OutputQueue.DEVP.offer(MessageFormat.format("【{0}】 写入尾桶命令下发 [id:{1}] >>>>> {2}", DateUtils.convert(new Date()), slave.getId(), staProtocol.isTailSupportFlag()));
            News.info("SiemensDevp"+" - 5"+" - 写入尾桶命令下发 [id:{}] >>>>> 命令下发: {}",  slave.getId(), staProtocol.isTailSupportFlag());
        }
    }
    /**
     * 入罐装线前wcs写桶型信息
     */
    private void writeGzx(StaProtocol staProtocol) throws InterruptedException {
        if (null == staProtocol) {
            return;
        }
        short[] common = new short[3];
        common[0] = Short.parseShort(staProtocol.getBucketType());
        common[1] = (short) staProtocol.getBucketCount();
        common[2] = staProtocol.getWorkNo().shortValue();
        OperateResult write;
        //任务下发次数
        int writeCount = 0;
        do {
            write = siemensS7Net.Write("DB100.0", common);
            Thread.sleep(200);
            if(write.IsSuccess){
                break;
            }
            else {
                writeCount++;
                log.error("给罐装线写入桶型信息失败。输送线plc编号={},是否尾桶={},写入次数={}", slave.getId(), staProtocol.isTailSupportFlag(), writeCount);
            }
        }while (writeCount<5);
        if (!write.IsSuccess) {
            OutputQueue.DEVP.offer(MessageFormat.format("【{0}】写入尾桶命令数据失败。输送线plc编号={1},站点数据={2}", slave.getId(), staProtocol.isTailSupportFlag()));
            News.error("SiemensDevp"+" - 4"+" - 给罐装线写入桶型信息失败。输送线plc编号={},站点数据={}", slave.getId(), staProtocol.isTailSupportFlag());
        } else {
            OutputQueue.DEVP.offer(MessageFormat.format("【{0}】 给罐装线写入桶型信息命令下发成功 [id:{1}] >>>>> {2}", DateUtils.convert(new Date()), slave.getId(), staProtocol.isTailSupportFlag()));
            News.info("SiemensDevp"+" - 5"+" - 给罐装线写入桶型信息命令下发成功 [id:{}] >>>>> 命令下发: {}",  slave.getId(), staProtocol.getBucketType());
        }
    }
    /**
     * 给罐装线写入可出信号
     */
    private void writeGzxkc(StaProtocol staProtocol) throws InterruptedException {
        if (null == staProtocol) {
            return;
        }
        short[] common = new short[1];
        common[0] = (short) staProtocol.getPlaceableFlag();
        OperateResult write;
        //任务下发次数
        int writeCount = 0;
        do {
            write = siemensS7Net.Write("DB100.6", common);
            Thread.sleep(200);
            OperateResultExOne<byte[]> read = siemensS7Net.Read("DB100.6", (short) 2);
            if(write.IsSuccess && read.IsSuccess){
                short i = siemensS7Net.getByteTransform().TransInt16(read.Content, 0);
                if ( i != 1) {
                    writeCount++;
                    log.error("给罐装线写入可出信号成功,但回读失败:读取值:{},输送线plc编号={},写入次数={}", i, slave.getId(), writeCount);
                    continue;
                }
                break;
            }
            else {
                writeCount++;
                log.error("给罐装线写入可出信号:{}失败。输送线plc编号={},写入次数={}", common[0], slave.getId(), writeCount);
            }
        }while (writeCount<5);
        if (!write.IsSuccess) {
            OutputQueue.DEVP.offer(MessageFormat.format("【{0}】给罐装线写入可出信号失败。输送线plc编号={1},站点数据={2}", slave.getId(), staProtocol.getPlaceableFlag()));
            News.error("SiemensDevp"+" - 4"+" - 给罐装线写入可出信号失败。输送线plc编号={},站点数据={}", slave.getId(), staProtocol.getPlaceableFlag());
        } else {
            OutputQueue.DEVP.offer(MessageFormat.format("【{0}】 给罐装线写入可出信号命令下发成功 [id:{1}] >>>>> {2}", DateUtils.convert(new Date()), slave.getId(), staProtocol.getPlaceableFlag()));
            News.info("SiemensDevp"+" - 5"+" - 给罐装线写入可出信号命令下发成功 [id:{}] >>>>> 命令下发: {}",  slave.getId(), staProtocol.getPlaceableFlag());
        }
    }
    /**
     * 心跳
     */
    private void heartbeat(){
src/main/java/com/zy/entity/WrkDetl.java
@@ -166,8 +166,9 @@
    /**
     * 长度
     */
    @ApiModelProperty(value= "长度")
    private Double length;
    @ApiModelProperty(value= "毛重")
    @TableField("man_length")
    private Double manLength;
    /**
     * 体积
@@ -223,9 +224,9 @@
    private Integer source;
    /**
     * 要求检验 1: 是  0: 否
     * 贴标结果(1.成功,0.失败)
     */
    @ApiModelProperty(value= "要求检验 1: 是  0: 否  ")
    @ApiModelProperty(value= "贴标结果(1.成功,0.失败)")
    private Integer inspect;
    /**
src/main/java/com/zy/entity/WrkMast.java
@@ -295,7 +295,7 @@
    @ApiModelProperty(value= "")
    @TableField("Pdc_type")
    private String PdcType;
    private String pdcType;
    @ApiModelProperty(value= "")
    @TableField("ctn_no")
@@ -310,6 +310,9 @@
    @TableField("rgv_dsta_no")
    private Integer rgvDstaNo;
    @TableField("work_no_other")
    private Integer workNoOther;
    /**
     * 满板
     */
src/main/java/com/zy/mapper/WrkMastMapper.java
@@ -31,7 +31,7 @@
    // 入库第二步,当托盘物料在堆垛机入库站时时查询
//    @Select("select top 1 * from dbo.asr_wrk_mast where wrk_sts=2 and crn_no=#{crnNo} and wrk_no=#{workNo} and (io_type=1 or io_type=10 or io_type=53 or io_type=54 or io_type=57) order by io_pri desc,io_time,wrk_no ASC")
    WrkMast selectPakInStep2(@Param("crnNo")Integer crnNo, @Param("workNo")Integer workNo, @Param("staNo")Integer staNo);
    WrkMast selectPakInStep2(@Param("crnNo")Integer crnNo, @Param("workNo")Integer workNo);
    // 入库第三步,当堆垛机把货放入库位时
//    @Select("select top 1 from dbo.asr_wrk_mast where wrk_no=#{workNo}")
src/main/java/com/zy/service/impl/MainServiceImpl.java
@@ -65,11 +65,21 @@
    // 罐装完成rgv接驳站点
    public static final List<Integer>  canningLineRgvConnectionSiteList = new ArrayList<>();
    static {
        emptyPalletSiteMap.put(1002,"M");
        emptyPalletSiteMap.put(1020,"M");emptyPalletSiteMap.put(1035,"Z");
    // 入罐装线之前告诉罐装线桶信息的站点
    public static final List<Integer>  inGzxSiteList = new ArrayList<>();
        stackingSite.add(1027);stackingSite.add(1020);
    // 出罐装线后读取罐装线反馈信息
    public static final List<Integer>  outGzxSiteList = new ArrayList<>();
    // 成品库堆垛机出库站点到rgv接驳点
    public static final Map<Integer,Short>  crnOutSiteToRgvSite = new HashMap<>();
    static {
        emptyPalletSiteMap.put(1001,"M"); // emptyPalletSiteMap.put(1002,"M");
        emptyPalletSiteMap.put(1019,"M"); // emptyPalletSiteMap.put(1020,"M");
        emptyPalletSiteMap.put(1034,"Z"); // emptyPalletSiteMap.put(1035,"Z");
        stackingSite.add(1019);stackingSite.add(1026);
        rgvConnectionSiteList.add(1012);rgvConnectionSiteList.add(1006);rgvConnectionSiteList.add(1001);rgvConnectionSiteList.add(1018);
        rgvConnectionSiteList.add(1019);rgvConnectionSiteList.add(1041);rgvConnectionSiteList.add(1034);rgvConnectionSiteList.add(1033);
@@ -78,13 +88,18 @@
        rgvConnectionSiteList.add(1105);rgvConnectionSiteList.add(1100);rgvConnectionSiteList.add(1097);rgvConnectionSiteList.add(1094);
        rgvConnectionSiteList.add(1091);
        taskStaNoToRgvStaNoMap.put(1050,1044);taskStaNoToRgvStaNoMap.put(1079,1044);taskStaNoToRgvStaNoMap.put(1065,1044);taskStaNoToRgvStaNoMap.put(1072,1044);taskStaNoToRgvStaNoMap.put(1093,1094);
        taskStaNoToRgvStaNoMap.put(1050,1044);taskStaNoToRgvStaNoMap.put(1078,1044);taskStaNoToRgvStaNoMap.put(1064,1044);taskStaNoToRgvStaNoMap.put(1071,1044);taskStaNoToRgvStaNoMap.put(1096,1094);
        taskStaNoToRgvStaNoMap.put(1104,1100);taskStaNoToRgvStaNoMap.put(1102,1100);taskStaNoToRgvStaNoMap.put(1090,1090);taskStaNoToRgvStaNoMap.put(1002,1001);taskStaNoToRgvStaNoMap.put(1016,1018);
        taskStaNoToRgvStaNoMap.put(1020,1019);taskStaNoToRgvStaNoMap.put(1024,1022);taskStaNoToRgvStaNoMap.put(1035,1034);taskStaNoToRgvStaNoMap.put(1040,1033);taskStaNoToRgvStaNoMap.put(1043,1041);
        canningLineRgvConnectionSiteList.add(1083);canningLineRgvConnectionSiteList.add(1086);
        canningLineRgvConnectionSiteList.add(1089);
        inGzxSiteList.add(1071);inGzxSiteList.add(1064);inGzxSiteList.add(1078);
        outGzxSiteList.add(1081);outGzxSiteList.add(1084);outGzxSiteList.add(1087);
        crnOutSiteToRgvSite.put(1093, (short) 1091);crnOutSiteToRgvSite.put(1099, (short) 1097);crnOutSiteToRgvSite.put(1107, (short) 1105);
    }
    @Autowired
@@ -155,36 +170,36 @@
                // 尺寸检测异常
                boolean back = false;
                String errMsg = "";
                if (staProtocol.isFrontErr()) {
                    errMsg = "前超限";
                    back = true;
                }
                if (!back && staProtocol.isBackErr()) {
                    errMsg = "后超限";
                    back = true;
                }
                if (!back && staProtocol.isHighErr()) {
                    errMsg = "高超限";
                    back = true;
                }
                if (!back && staProtocol.isLeftErr()) {
                    errMsg = "左超限";
                    back = true;
                }
                if (!back && staProtocol.isRightErr()) {
                    errMsg = "右超限";
                    back = true;
                }
                if (!back && staProtocol.isWeightErr()) {
                    errMsg = "超重";
                    back = true;
                }
                if (!back && staProtocol.isBarcodeErr()) {
                    errMsg = "扫码失败";
                    back = true;
                }
//                if (staProtocol.isFrontErr()) {
//                    errMsg = "前超限";
//                    back = true;
//                }
//                if (!back && staProtocol.isBackErr()) {
//                    errMsg = "后超限";
//                    back = true;
//                }
//                if (!back && staProtocol.isHighErr()) {
//                    errMsg = "高超限";
//                    back = true;
//                }
//                if (!back && staProtocol.isLeftErr()) {
//                    errMsg = "左超限";
//                    back = true;
//                }
//                if (!back && staProtocol.isRightErr()) {
//                    errMsg = "右超限";
//                    back = true;
//                }
//                if (!back && staProtocol.isWeightErr()) {
//                    errMsg = "超重";
//                    back = true;
//                }
//                if (!back && staProtocol.isBarcodeErr()) {
//                    errMsg = "扫码失败";
//                    back = true;
//                }
                // 退回
                if (back) {
                if (back && staProtocol.isInEnable()) {
                    MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(3, errMsg));
                    if (!staProtocol.isLoading()){
@@ -193,12 +208,8 @@
                    if (!staProtocol.isPakMk()) {
                        continue;
                    }
                    staProtocol.setWorkNo(wrkNo);
                    News.info("{}入库回退:{},任务号:{}", inSta.getStaNo(), errMsg,wrkNo);
                    staProtocol.setStaNo(inSta.getBackSta().shortValue());
                    devpThread.setPakMk(staProtocol.getSiteId(), false);
                    MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol));
                    log.error("输送线下发1:"+wrkNo+","+inSta.getBackSta());
                    log.error("{}入库回退:{},任务号:{}", inSta.getStaNo(), errMsg,wrkNo);
                    return;
                }
@@ -206,48 +217,31 @@
                if (staProtocol.isAutoing()
                        && staProtocol.isLoading()
                        && staProtocol.isInEnable()
                        && !staProtocol.isEmptyMk()
                        && staProtocol.isPakMk()) {
                    if(Cools.isEmpty(barcode) || "NG".endsWith(barcode) || "NoRead".equals(barcode) || "00000000".equals(barcode)) {
//                        News.info("{}号条码扫描器检测条码信息:{}", inSta.getBarcode(), barcode);
//
//                        staProtocol.setWorkNo(wrkNo);
//                        News.info("{}入库回退:{},任务号:{}", inSta.getStaNo(), errMsg,wrkNo);
//                        staProtocol.setStaNo(inSta.getBackSta().shortValue());
//                        devpThread.setPakMk(staProtocol.getSiteId(), false);
//                        MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol));
//                        log.error("输送线下发1:"+wrkNo+","+inSta.getBackSta());
                        && staProtocol.getWorkNo() == 0
                        && staProtocol.isPakMk()
                ) {
                    if(Cools.isEmpty(barcode) || "NG".endsWith(barcode) || "NoRead".equals(barcode) || "00000000".equals(barcode) || barcode.startsWith("ERROR")) {
                        log.error("{}号条码检测失败,条码信息:{}", inSta.getBarcode(), barcode);
                        continue;
                    }
                    // 判断重复工作档
                    WrkMast wrkMast = wrkMastMapper.selectPakInStep1(inSta.getStaNo(), barcode);
                    if (wrkMast != null) {
//                        News.error(methodName + ":工作档中已存在该站状态为( 2.设备上走 )的数据,工作号={}", wrkMast.getWrkNo());
//                        if (ledThread != null) {
//                            News.error(methodName + ":扫码失败,请重试");
//                            MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(3, "工作档中已存在该站状态为( 2.设备上走 )的数据,工作号={" + wrkMast.getWrkNo() + "}, 请手动取消已存在工作档"));
//                        }
                        continue;
                    }
                    WrkMast checkPick = wrkMastService.selectOne(new EntityWrapper<WrkMast>()
                            .eq("barcode", barcode)
                            .in("io_type", 107,103,57));
                    if (!Cools.isEmpty(checkPick)) {
                        continue;
                    }
                    try {
                        LocTypeDto locTypeDto = new LocTypeDto(staProtocol);
                        SearchLocParam param = new SearchLocParam();
                        param.setBarcode(barcode);
                        param.setIoType(1);
                        param.setIoType(staProtocol.getBucketType().equals("21")  || staProtocol.getBucketType().equals("20") ? 10 : 1);
                        param.setSourceStaNo(inSta.getStaNo());
                        param.setLocType1(locTypeDto.getLocType1());
                        param.setLocArea(2);// 入空桶库标识
                        param.setBucketType(staProtocol.getBucketType());
                        param.setBucketCount(staProtocol.getBucketCount());
                        param.setTailSupportFlag(staProtocol.isTailSupportFlag());
                        param.setWantBucketFlag(devpThread.getWantBucketFlag());
                        param.setWantBucketFlag(getWantBucketFlag());
                        String response = new HttpHandler.Builder()
                                .setUri(wmsUrl)
@@ -260,28 +254,18 @@
                        if (jsonObject.getInteger("code").equals(200)) {
                            StartupDto dto = jsonObject.getObject("data", StartupDto.class);
                            barcodeThread.setBarcode("");
                            // 目标站点是直供罐装线
                            if (dto.getStaNo() == 1079 || dto.getStaNo() == 1065 || dto.getStaNo() == 1072) {
                                devpThread.getWantBucketFlag().remove(dto.getCrnNo()); // 移除输送线要桶信号
                                staProtocol.setClearBucketSignal(dto.getCrnNo()); // 清除要桶信号标识
                            }
                            staProtocol.setWorkNo(dto.getWorkNo());
                            staProtocol.setStaNo(RouteUtils.SouStaEnd(dto.getStaNo(),dto.getSourceStaNo()));
                            staProtocol.setStaNo(dto.getStaNo().shortValue());
                            devpThread.setPakMk(staProtocol.getSiteId(), false);
                            boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol));
                            log.error("输送线下发2:"+dto.getWorkNo()+","+dto.getStaNo());
                            if (!result) {
                                News.error(methodName + ":更新plc站点信息失败");
                                throw new CoolException("更新plc站点信息失败");
                            }else {
                                ledThread.errorReset();
                            }
                        } else {
                            staProtocol.setWorkNo(wrkNo);
                            staProtocol.setStaNo(inSta.getBackSta().shortValue());
                            devpThread.setPakMk(staProtocol.getSiteId(), false);
                            MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol));
                            if (ledThread != null) {
                                String errorMsg = jsonObject.getString("msg");
                                if (!Cools.isEmpty(errorMsg)) {
@@ -301,70 +285,18 @@
    }
    /**
     * wms入库
     * 入库站,根据条码扫描生成入库工作档,工作状态 1 ==>> 2
     * 获取罐装线要桶信息
     */
    public synchronized void generateStoreWrkFile0(Integer mark) {
        // 根据输送线plc遍历
        for (DevpSlave devp : slaveProperties.getDevp()) {
            // 遍历入库口
            for (DevpSlave.Sta inSta : devp.getInSta()) {
                // 获取入库站信息
                SiemensDevpThread devpThread = (SiemensDevpThread) SlaveConnection.get(SlaveType.Devp, devp.getId());
                StaProtocol staProtocol = devpThread.getStation().get(inSta.getStaNo());
                if (staProtocol == null) {
                    continue;
                } else {
                    staProtocol = staProtocol.clone();
                }
//                // 入出库模式判断
                if (inSta.getStaNo() == 203 && devpThread.ioModeOf101 != IoModeType.PAKIN_MODE) {
                    continue;
                }
                // 判断是否满足入库条件
                if (!staProtocol.isLoading()){
                    continue;
                }
                if (staProtocol.isAutoing() && staProtocol.isInEnable()
                        && !staProtocol.isEmptyMk() && (staProtocol.getWorkNo() == 0 || staProtocol.getWorkNo() == 9999)
                        && staProtocol.isPakMk()) {
                    News.warnNoLog(""+mark+" - 0"+" - 开始执行");
                    // 判断重复工作档
                    WrkMast wrkMast = wrkMastMapper.selectPakInStep11(inSta.getStaNo());
                    if (wrkMast == null) {
                        continue;
                    }
                    // 命令下发区 --------------------------------------------------------------------------
                    // 更新站点信息 且 下发plc命令
                    staProtocol.setWorkNo(wrkMast.getWrkNo());
                    staProtocol.setStaNo(wrkMast.getStaNo().shortValue());
                    devpThread.setPakMk(staProtocol.getSiteId(), false);
                    boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol));
                    log.error("输送线下发3:"+wrkMast.getWrkNo()+","+wrkMast.getStaNo());
                    if (result) {
                        // 更新工作主档
                        wrkMast.setWrkSts(2L); // 工作状态:2.设备上走
                        wrkMast.setModiTime(new Date());
                        if (wrkMastMapper.updateById(wrkMast) == 0) {
                            News.error(""+mark+" - 1"+" - 更新工作档失败!!! [工作号:{}]", wrkMast.getWrkNo());
                        }
                    } else {
                        News.error(""+mark+" - 2"+" - 发布命令至输送线队列失败!!! [plc编号:{}]", devp.getId());
                    }
                }else {
                    News.errorNoLog(""+mark+" - 6"+" - 站点信息不符合入库条件!!!"+" 自动信号:"+staProtocol.isLoading()+"、可入信号:" + staProtocol.isInEnable()
                            +"、空板信号:"+ staProtocol.isEmptyMk()+"、工作号:" + staProtocol.getWorkNo()
                            +"、锁定标记"+ staProtocol.isPakMk()+"、入库印记:" + staProtocol.getStamp());
                }
            }
        }
//        News.infoNoLog(""+mark+" - 0"+" - wms入库  ===》执行完成");
    private List<SearchLocParam.WantBucket> getWantBucketFlag() {
        SiemensDevpThread devpThread = (SiemensDevpThread) SlaveConnection.get(SlaveType.Devp, 2);
        StaProtocol staProtocol1081 = devpThread.getStation().get(1081);
        StaProtocol staProtocol1084 = devpThread.getStation().get(1084);
        StaProtocol staProtocol1087 = devpThread.getStation().get(1087);
        List<SearchLocParam.WantBucket> wantBucketList = new ArrayList<>();
        wantBucketList.add(new SearchLocParam.WantBucket(1071,staProtocol1081.getWantBucketFlag()));
        wantBucketList.add(new SearchLocParam.WantBucket(1064,staProtocol1084.getWantBucketFlag()));
        wantBucketList.add(new SearchLocParam.WantBucket(1078,staProtocol1087.getWantBucketFlag()));
        return wantBucketList;
    }
    /**
@@ -545,33 +477,34 @@
                            && crnProtocol.statusType == CrnStatusType.WAITING
                            && crnProtocol.forkPosType == CrnForkPosType.HOME) {
                        staProtocol.setStaNo(wrkMast.getStaNo().shortValue());
                        staProtocol.setStaNo(crnSlave.getId() == 4 ? wrkMast.getStaNo().shortValue() : crnOutSiteToRgvSite.get(wrkMast.getSourceStaNo()));
                        staProtocol.setWorkNo(wrkMast.getWrkNo());
                        if (!MessageQueue.offer(SlaveType.Devp, crnStn.getDevpPlcId(), new Task(2, staProtocol))) {
                            continue;
                        }
                        wrkMast.setWrkSts(14L);
                        wrkMast.setCrnEndTime(new Date());
                        if (wrkMastMapper.updateById(wrkMast) != 0) {
                            // 空桶出库完成库位组任务
                            if (wrkMast.getSourceStaNo() == 1056) {
                                WrkMast wrkMast1 = wrkMastService.selectOne(new EntityWrapper<WrkMast>().eq("source_sta_no", 1056).eq("wrk_sts", 12));
                                if (wrkMast1 != null) {
                                    StaProtocol staProtocol1 = devpThread.getStation().get(1057);
                                    if (staProtocol1 != null) {
                                        staProtocol1 = staProtocol1.clone();
                                        staProtocol1.setStaNo(wrkMast1.getStaNo().shortValue());
                                        staProtocol1.setWorkNo(wrkMast1.getWrkNo());
                                        if (!MessageQueue.offer(SlaveType.Devp, crnStn.getDevpPlcId(), new Task(2, staProtocol1))) {
                                            log.error("空桶出库完成库位组任务推送输送线命令队列失败");
                                        }
                                        wrkMast1.setWrkSts(14L);
                                        wrkMast1.setCrnEndTime(new Date());
                                        if (wrkMastMapper.updateById(wrkMast1) != 0) {
                                        }
                        // 空桶出库完成库位组任务
                        if (wrkMast.getWorkNoOther() != 0) {
                            WrkMast wrkMast1 = wrkMastService.selectOne(new EntityWrapper<WrkMast>().eq("wrk_no", wrkMast.getWorkNoOther()));
                            if (wrkMast1 != null) {
                                StaProtocol staProtocol1 = devpThread.getStation().get(1057);
                                if (staProtocol1 != null) {
                                    staProtocol1 = staProtocol1.clone();
                                    staProtocol1.setWorkNo(wrkMast1.getWrkNo());
                                    staProtocol1.setStaNo(wrkMast1.getStaNo().shortValue());
                                    if (!MessageQueue.offer(SlaveType.Devp, crnStn.getDevpPlcId(), new Task(2, staProtocol1))) {
                                        log.error("空桶出库完成库位组任务推送输送线命令队列失败");
                                    }
                                    wrkMast1.setWrkSts(14L);
                                    wrkMast1.setCrnEndTime(new Date());
                                    wrkMast1.setWorkNoOther(0);
                                    wrkMastMapper.updateById(wrkMast1);
                                }
                            }
                        }
                        wrkMast.setWrkSts(14L);
                        wrkMast.setCrnEndTime(new Date());
                        wrkMast.setWorkNoOther(0); // 清除另一个任务号
                        if (wrkMastMapper.updateById(wrkMast) != 0) {
                            // 复位堆垛机
                            log.info("出库任务完成下发堆垛机复位,任务号:{}",wrkMast.getWrkNo());
                            crnThread.setResetFlag(true);
@@ -591,142 +524,6 @@
            }
        }
//        News.infoNoLog(""+mark+" - 0"+" - 堆垛机站出库到出库站  ===》执行完成");
    }
    /**
     * 空子托盘入库
     */
    public synchronized void storeEmptyPlt() {
        // 根据输送线plc遍历
        for (DevpSlave devp : slaveProperties.getDevp()) {
            // 遍历入库口
            for (DevpSlave.Sta inSta : devp.getEmptyInSta()) {
                // 获取条码扫描仪信息
                BarcodeThread barcodeThread = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, inSta.getBarcode());
                LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, inSta.getLed());
                SiemensDevpThread devpThread = (SiemensDevpThread) SlaveConnection.get(SlaveType.Devp, devp.getId());
                StaProtocol staProtocol = devpThread.getStation().get(inSta.getStaNo());
                if (staProtocol == null) {
                    continue;
                } else {
                    staProtocol = staProtocol.clone();
                }
                if (barcodeThread == null) {
                    continue;
                }
                String barcode = barcodeThread.getBarcode();
                // 尺寸检测异常
                boolean back = false;
                String errMsg = "";
                if (staProtocol.isFrontErr()) {
                    errMsg = "前超限";
                    back = true;
                }
                if (!back && staProtocol.isBackErr()) {
                    errMsg = "后超限";
                    back = true;
                }
                if (!back && staProtocol.isHighErr()) {
                    errMsg = "高超限";
                    back = true;
                }
                if (!back && staProtocol.isLeftErr()) {
                    errMsg = "左超限";
                    back = true;
                }
                if (!back && staProtocol.isRightErr()) {
                    errMsg = "右超限";
                    back = true;
                }
                if (!back && staProtocol.isWeightErr()) {
                    errMsg = "超重";
                    back = true;
                }
                if (!back && staProtocol.isBarcodeErr()) {
                    errMsg = "扫码失败";
                    back = true;
                }
                // 退回
                if (back) {
                    MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(3, errMsg));
                    if (!staProtocol.isLoading()) {
                        continue;
                    }
                    if (!staProtocol.isPakMk()) {
                        continue;
                    }
                    staProtocol.setWorkNo(wrkNo);
                    News.info("{}空托入库回退:{},任务号:{}", inSta.getStaNo(), errMsg, wrkNo);
                    staProtocol.setStaNo(inSta.getBackSta().shortValue());
                    devpThread.setPakMk(staProtocol.getSiteId(), false);
                    MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol));
                    log.error("输送线下发1:" + wrkNo + "," + inSta.getBackSta());
                    return;
                }
                // 判断是否满足入库条件
                if (staProtocol.isAutoing()
                        && staProtocol.isLoading()
                        && staProtocol.isInEnable()
                        && staProtocol.isEmptyMk()
                        && staProtocol.isPakMk()) {
                    if (Cools.isEmpty(barcode) || "NG".endsWith(barcode) || "NoRead".equals(barcode) || "00000000".equals(barcode)) {
                        News.info("{}号条码扫描器检测条码信息:{}", inSta.getBarcode(), barcode);
                        continue;
                    }
                    // 判断重复工作档
                    WrkMast wrkMast = wrkMastMapper.selectPakInStep1(inSta.getStaNo(), barcode);
                    if (wrkMast != null) {
                        continue;
                    }
                    try {
                        LocTypeDto locTypeDto = new LocTypeDto(staProtocol);
                        SearchLocParam param = new SearchLocParam();
                        param.setBarcode(barcode);
                        param.setIoType(10);
                        param.setSourceStaNo(inSta.getStaNo());
                        param.setLocType1(locTypeDto.getLocType1());
                        String response = new HttpHandler.Builder()
                                .setUri(wmsUrl)
                                .setPath("/rpc/pakin/loc/v1")
                                .setJson(JSON.toJSONString(param))
                                .build()
                                .doPost();
                        log.info("空子托盘入库请求wms原始返回:" + response);
                        JSONObject jsonObject = JSON.parseObject(response);
                        if (jsonObject.getInteger("code").equals(200)) {
                            StartupDto dto = jsonObject.getObject("data", StartupDto.class);
                            barcodeThread.setBarcode("");
                            staProtocol.setWorkNo(dto.getWorkNo());
                            staProtocol.setStaNo(RouteUtils.SouStaEnd(dto.getStaNo(), dto.getSourceStaNo()));
                            devpThread.setPakMk(staProtocol.getSiteId(), false);
                            boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol));
                            log.error("输送线下发2:" + dto.getWorkNo() + "," + dto.getStaNo());
                            if (!result) {
                                News.error(":更新plc站点信息失败");
                                throw new CoolException("更新plc站点信息失败");
                            } else {
                                ledThread.errorReset();
                            }
                        } else {
                            staProtocol.setWorkNo(wrkNo);
                            staProtocol.setStaNo(inSta.getBackSta().shortValue());
                            devpThread.setPakMk(staProtocol.getSiteId(), false);
                            MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol));
                            String errorMsg = jsonObject.getString("msg");
                            if (!Cools.isEmpty(errorMsg)) {
                                MessageQueue.offer(SlaveType.Led, inSta.getLed(), new Task(3, errorMsg));
                            }
                        }
                    } catch (Exception e) {
                        e.printStackTrace();
                        TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
                    }
                }
            }
        }
    }
    /**
@@ -801,7 +598,7 @@
                News.error(""+mark+" - 1"+" - 2"+" - 入库 ===>> 堆垛机站点在数据库不存在, 站点编号={}", crnStn.getStaNo());
                continue;
            }
            if (staProtocol.isAutoing() && staProtocol.isLoading() && staProtocol.getWorkNo() > 0 && staProtocol.isInEnable()
            if (staProtocol.isAutoing() && staProtocol.isLoading() && staProtocol.getWorkNo() > 0 // && staProtocol.isInEnable()
                    && staDetl.getCanining() != null && staDetl.getCanining().equals("Y")) {
                flag = true;
            }
@@ -813,11 +610,30 @@
                continue;
            }
            // 获取工作状态为2(设备上走)的入库工作档
            WrkMast wrkMast = wrkMastMapper.selectPakInStep2(slave.getId(), staProtocol.getWorkNo(), crnStn.getStaNo());
            WrkMast wrkMast = wrkMastMapper.selectPakInStep2(slave.getId(), staProtocol.getWorkNo());
            if (null == wrkMast) {
                News.infoNoLog(""+mark+" - 1"+" - 4"+" - 查询无待入库数据--wrk_sts=2, 工作号={}", staProtocol.getWorkNo());
//                log.error("查询无待入库数据--wrk_sts=2, 工作号={}", staProtocol.getWorkNo());
                log.error("查询无待入库数据--wrk_sts=2, 工作号={}", staProtocol.getWorkNo());
                continue;
            }
            if (crnStn.getStaNo() == 1050 && wrkMast.getCtnType() != 1) {
                continue;
            } else if(crnStn.getStaNo() == 1049) {
                // 判断1050是否有货
                StaProtocol staProtocol1 = devpThread.getStation().get(1050);
                if(staProtocol1.isAutoing() && staProtocol1.isLoading() && staProtocol1.isInEnable() && staProtocol1.getWorkNo() != 0) {
                } else {
                    continue;
                }
            }
            if (crnStn.getStaNo() == 1096) { // 判断入库到1096,判断1093是否有物
                StaProtocol staProtocol2 = devpThread.getStation().get(1093);
                if(!staProtocol2.isAutoing() || staProtocol2.isLoading() || staProtocol2.getWorkNo() != 0) {
                    log.warn("1号堆垛机入库取货前,判断1096站点信息自动:{},有物:{},工作号:{},不可入",staProtocol2.isAutoing(),staProtocol2.isLoading(),staProtocol2.getWorkNo());
                    continue;
                }
            }
            // 获取库位信息
            LocMast locMast = locMastService.selectById(wrkMast.getLocNo());
@@ -897,22 +713,22 @@
            crnCommand.setSourcePosY(crnStn.getBay().shortValue());     // 源库位列
            crnCommand.setSourcePosZ(crnStn.getLev().shortValue());     // 源库位层
            crnCommand.setDestinationPosX(locMast.getRow1().shortValue());     // 目标库位排
            if(crnStn.getStaNo() == 1050 && locMast.getRow1() == 10) {
                crnCommand.setDestinationPosX((short) 9);
            }
            if(crnStn.getStaNo() == 1049 && locMast.getRow1() == 11) {
                crnCommand.setDestinationPosX((short) 12);
            }
            crnCommand.setDestinationPosY(locMast.getBay1().shortValue());     // 目标库位列
            crnCommand.setDestinationPosZ(locMast.getLev1().shortValue());     // 目标库位层
            crnCommand.setTraySize(locMast.getLocType1() == 2);
            if (!MessageQueue.offer(SlaveType.Crn, wrkMast.getCrnNo(), new Task(2, crnCommand))) {
                News.error(""+mark+" - 1"+" - 16"+" - 堆垛机命令下发失败,堆垛机号={},任务数据={}", wrkMast.getCrnNo(), JSON.toJSON(crnCommand));
            } else {
                // 修改工作档状态 2.设备上走 => 3.吊车入库中
                Date now = new Date();
                wrkMast.setWrkSts(3L);
                wrkMast.setCrnStrTime(now);
                wrkMast.setModiTime(now);
                if (wrkMastMapper.updateById(wrkMast) == 0) {
                    News.error(""+mark+" - 1"+" - 17"+" - 修改工作档状态 2.设备上走 => 3.吊车入库中 失败!!,工作号={}", wrkMast.getWrkNo());
                }
                // 修改工作档状态 2.设备上走 => 3.吊车入库中
                // 如果是1049则有两个任务,需要把1050改成吊车入库中
                int workNoOther = 0;
                if (crnStn.getStaNo() == 1049) {
                    BasDevp basDevp = basDevpService.selectById(1050);
                    if (basDevp.getWrkNo() == 0) {
@@ -922,11 +738,22 @@
                        wrkMast1.setWrkSts(3L);
                        wrkMast1.setCrnStrTime(now);
                        wrkMast1.setModiTime(now);
                        wrkMast1.setWorkNoOther(0);
                        workNoOther = wrkMast1.getWrkNo();
                        if (wrkMastMapper.updateById(wrkMast1) == 0) {
                            News.error(""+mark+" - 1"+" - 17"+" - 修改工作档状态 2.设备上走 => 3.吊车入库中 失败!!,工作号={}", wrkMast.getWrkNo());
                        }
                    }
                }
                wrkMast.setWrkSts(3L);
                wrkMast.setCrnStrTime(now);
                wrkMast.setModiTime(now);
                wrkMast.setWorkNoOther(workNoOther);
                if (wrkMastMapper.updateById(wrkMast) == 0) {
                    News.error(""+mark+" - 1"+" - 17"+" - 修改工作档状态 2.设备上走 => 3.吊车入库中 失败!!,工作号={}", wrkMast.getWrkNo());
                }
            }
        }
        News.infoNoLog(""+mark+" - 1"+" - 0"+" - 堆垛机入出库作业下发 : 入库执行完毕");
@@ -974,7 +801,7 @@
                }
                // 判断堆垛机出库站状态
                if (staProtocol.isAutoing() && staProtocol.isLoading() && staDetl.getCanouting() != null && staDetl.getCanouting().equals("Y")
                if (staProtocol.isAutoing() && !staProtocol.isLoading() && staDetl.getCanouting() != null && staDetl.getCanouting().equals("Y")
                        && staProtocol.getWorkNo() == 0 && staProtocol.isOutEnable()) {
                    // 堆垛机控制过滤
                    if (!crnProtocol.getStatusType().equals(CrnStatusType.IDLE) || crnProtocol.getTaskNo() != 0) {
@@ -1035,35 +862,47 @@
                        break;
                    }
                    WrkMast wrkMast1 = null; // 库位任务对应另一个库位任务
                    LocMast locMast = null; // 库位对应另一个库位
                    // 空桶库出库需要两个库位一起出
                    if(slave.getId() == 4) {
                        Integer row = sourceSta.getRow1();
                        // 获取对应库位
                        String  newLocNo = (row == 9 || row == 11 ? String.valueOf(row + 1) : row == 10 ? "09" : "11") + sourceSta.getLocNo().substring(2);
                        locMast = locMastService.selectById(newLocNo);
                        if (locMast == null) {
                            log.error("空桶出库寻找{}对应库位组库位号{}错误",sourceSta.getLocNo(),newLocNo);
                            break;
                    if(slave.getId() == 4 && crnStn.getStaNo() == 1057) {
                        String locNo = wrkMast.getSourceLocNo();
                        // 取对应另一个库位
                        String newLocNo="";
                        switch (locNo.substring(0,2)){
                            case "09":newLocNo="10";break;
                            case "10":newLocNo="09";break;
                            case "11":newLocNo="12";break;
                            case "12":newLocNo="11";break;
                        }
                        if (locMast.getLocSts().equals("R")) {
                            wrkMast1 = wrkMastService.selectOne(new EntityWrapper<WrkMast>().eq("source_loc_no", newLocNo));
                        } else if(locMast.getLocSts().equals("F")) {
                            log.error("空桶出库寻找{}对应库位组库位号{}库位状态错误F",sourceSta.getLocNo(),newLocNo);
                        newLocNo = newLocNo + locNo.substring(2);
                        // 对应库位有无任务
                        WrkMast wrkMast1 = wrkMastService.selectOne(new EntityWrapper<WrkMast>().eq("source_loc_no", newLocNo));
                        if(wrkMast1 == null) {
                             if(locNo.startsWith("10") || locNo.startsWith("11")){ // 浅库位
                             } else  { // 深库位判断浅库位状态
                                LocMast locMast = locMastService.selectById(newLocNo);
                                if(!locMast.getLocSts().equals("O")) {
                                     log.info("{}空桶单出库,浅库位{}被堵塞",locNo,newLocNo);
                                     break;
                                }
                            }
                            // 出一个时,取货排11,12,目标位置1057,放货伸叉会伸到1056上,所以得判断1056没东西才能放
                            if(sourceSta.getRow1() == 11 || sourceSta.getRow1() == 12) {
                                StaProtocol staProtocol2 = devpThread.getStation().get(1056);
                                if(!staProtocol2.isAutoing() || staProtocol2.isLoading() || staProtocol2.getWorkNo() != 0) {
                                    log.warn("1057空桶出一个货时,1056不满足放货条件,自动:{},有物:{},任务号:{}",staProtocol2.isAutoing(),staProtocol2.isLoading(),staProtocol2.getWorkNo());
                                    continue;
                                }
                            }
                        } else { // 有任务
                            // 每个库位默认出库站点是1057,如果深浅库位一起出,则修改源站点为1056,堆垛机出库站点为1056时更新对应库位出到1057
                            if(locNo.startsWith("09") || locNo.startsWith("11")) { //
                                wrkMast.setSourceStaNo(1056);
                                wrkMastService.updateById(wrkMast);
                            } else  {
                                wrkMast1.setSourceStaNo(1056);
                                wrkMastService.updateById(wrkMast1);
                            }
                            break;
                        }
                    }
                    if (wrkMast1 != null) {
                        // 判断给堆垛机发生命令的源库位
                        if (sourceSta.getRow1() == 10 || sourceSta.getRow1() == 11) {
                            // 交换库位和任务
                            LocMast t1 = sourceSta;
                            sourceSta = locMast;
                            locMast = t1;
                            WrkMast t2 = wrkMast1;
                            wrkMast1 = wrkMast;
                            wrkMast = t2;
                        }
                    }
@@ -1078,31 +917,51 @@
//                    crnCommand.setAckFinish((short) 0);  // 任务完成确认位
                    crnCommand.setTaskMode(CrnTaskModeType.LOC_MOVE); // 任务模式:  库位移转
                    crnCommand.setSourcePosX(sourceSta.getRow1().shortValue());     // 源库位排
                    if(slave.getId() == 4 && crnStn.getStaNo() == 1056 && sourceSta.getRow1() == 11) { // 11排出到1056一次出两个时,取货位置偏移到12排
                        crnCommand.setSourcePosX((short) 12);
                        crnCommand.setTaskCount((short) 2);  // 出两个桶时告诉堆垛机这是两个
                    } else {
                        crnCommand.setTaskCount((short) 1); // 其他默认出的是一个
                    }
                    crnCommand.setSourcePosY(sourceSta.getBay1().shortValue());     // 源库位列
                    crnCommand.setSourcePosZ(sourceSta.getLev1().shortValue());     // 源库位层
                    crnCommand.setDestinationPosX(crnStn.getRow().shortValue());     // 目标库位排
                    // 源站1057
                    if(slave.getId() == 4 && crnStn.getStaNo() == 1057 && sourceSta.getRow1() == 12) {
                        crnCommand.setDestinationPosX((short) 9);
                    }
                    crnCommand.setDestinationPosY(crnStn.getBay().shortValue());     // 目标库位列
                    crnCommand.setDestinationPosZ(crnStn.getLev().shortValue());     // 目标库位层
                    crnCommand.setTraySize(sourceSta.getLocType1() == 2);     //库位类型
                    if (!MessageQueue.offer(SlaveType.Crn, wrkMast.getCrnNo(), new Task(2, crnCommand))) {
                        News.error(""+mark+" - 2"+" - 13"+" - 堆垛机命令下发失败,堆垛机号={},任务数据={}", wrkMast.getCrnNo(), JSON.toJSON(crnCommand));
                    } else {
                        // 修改工作档状态 11.生成出库ID => 12.吊车出库中
                        Date now = new Date();
                        int workNoOther = 0;
                        // 修改空桶库对应库位任务状态
                        if(slave.getId() == 4 && crnStn.getStaNo() == 1056) {
                            String locNo2 = (wrkMast.getSourceLocNo().startsWith("09") ? "10" : "12") + wrkMast.getSourceLocNo().substring(2);
                            WrkMast wrkMast1 = wrkMastService.selectOne(new EntityWrapper<WrkMast>().eq("source_loc_no", locNo2));
                            if (wrkMast1 != null) {
                                wrkMast1.setWrkSts(12L);
                                wrkMast1.setCrnStrTime(now);
                                wrkMast1.setModiTime(now);
                                if (wrkMastMapper.updateById(wrkMast1) == 0) {
                                    News.error(""+mark+" - 2"+" - 14"+" - 修改工作档状态 11.生成出库ID => 12.吊车出库中 失败!!,工作号={}", wrkMast1.getWrkNo());
                                }
                                workNoOther = wrkMast1.getWrkNo(); // 记录任务号,出库完成的时候一起完成
                            }
                        }
                        // 修改工作档状态 11.生成出库ID => 12.吊车出库中
                        wrkMast.setWrkSts(12L);
                        wrkMast.setCrnStrTime(now);
                        wrkMast.setModiTime(now);
                        wrkMast.setWorkNoOther(workNoOther);
                        if (wrkMastMapper.updateById(wrkMast) == 0) {
                            News.error(""+mark+" - 2"+" - 14"+" - 修改工作档状态 11.生成出库ID => 12.吊车出库中 失败!!,工作号={}", wrkMast.getWrkNo());
                        }
                        // 修改空桶库对应库位任务状态
                        if (wrkMast1 != null) {
                            wrkMast1.setWrkSts(12L);
                            wrkMast1.setCrnStrTime(now);
                            wrkMast1.setModiTime(now);
                            if (wrkMastMapper.updateById(wrkMast1) == 0) {
                                News.error(""+mark+" - 2"+" - 14"+" - 修改工作档状态 11.生成出库ID => 12.吊车出库中 失败!!,工作号={}", wrkMast.getWrkNo());
                            }
                        }
                        break;
                    }
@@ -1223,8 +1082,22 @@
                        continue;
                    }
                    Date now = new Date();
                    // 空桶入库完成,先完成对应库位组任务
                    if(wrkMast.getWorkNoOther() != 0 ){
                        WrkMast wrkMast1 = wrkMastService.selectByWrkNo(wrkMast.getWorkNoOther());
                        // 交换库位号
                        String locNo = wrkMast.getLocNo();
                        wrkMast.setLocNo(wrkMast1.getLocNo());
                        wrkMast1.setLocNo(locNo);
                        wrkMast1.setCrnEndTime(now);
                        wrkMast1.setModiTime(now);
                        wrkMast1.setWrkSts(4L);
                        wrkMast1.setWorkNoOther(0);
                        wrkMastMapper.updateById(wrkMast1);
                    }
                    wrkMast.setCrnEndTime(now);
                    wrkMast.setModiTime(now);
                    wrkMast.setWorkNoOther(0); // 清空另一个任务号
                    // 修改成功后复位堆垛机
                    if (wrkMastMapper.updateById(wrkMast) > 0) {
                        // 堆垛机复位
@@ -1392,6 +1265,9 @@
                    case 1:
                        ledCommand.setTitle("全板入库");
                        break;
                    case 3:
                        ledCommand.setTitle("站到站");
                        break;
                    case 10:
                        ledCommand.setTitle("空板入库");
                        break;
@@ -1421,7 +1297,7 @@
                if (wrkMast.getIoType() != 110 && wrkMast.getIoType() != 10) {
                    List<WrkDetl> wrkDetls = wrkDetlService.selectList(new EntityWrapper<WrkDetl>().eq("wrk_no", wrkMast.getWrkNo()));
//                    List<WrkDetl> wrkDetls = wrkDetlService.findByWorkNo(wrkMast.getWrkNo());
                    wrkDetls.forEach(wrkDetl -> ledCommand.getMatDtos().add(new MatDto(wrkDetl.getMatnr(), wrkDetl.getBatch(), wrkDetl.getSpecs(),wrkDetl.getManuDate(),wrkDetl.getModel(),wrkDetl.getWeight(),wrkDetl.getLength(),wrkDetl.getVolume())));
                    wrkDetls.forEach(wrkDetl -> ledCommand.getMatDtos().add(new MatDto(wrkDetl.getMatnr(), wrkDetl.getBatch(), wrkDetl.getSpecs(),wrkDetl.getManuDate(),wrkDetl.getModel(),wrkDetl.getWeight(),wrkDetl.getManLength(),wrkDetl.getVolume())));
//                    wrkDetls.forEach(wrkDetl -> {
//                        Double total = 0.0;
//                        EntityWrapper<LocDetl> wrapper = new EntityWrapper<>();
@@ -1665,9 +1541,8 @@
     * 生成 空子/母托盘出库任务
     */
    public synchronized void generateEmptyPalletStoreWrk() {
        Integer devpId = 1;
        SiemensDevpThread devpThread = (SiemensDevpThread) SlaveConnection.get(SlaveType.Devp, 1);
        for (Map.Entry<Integer, String> entry : emptyPalletSiteMap.entrySet()) {
            SiemensDevpThread devpThread = (SiemensDevpThread) SlaveConnection.get(SlaveType.Devp, devpId);
            StaProtocol staProtocol = devpThread.getStation().get(entry.getKey());
            if (staProtocol == null) {
                continue;
@@ -1676,14 +1551,20 @@
            }
            // 自动&无物&可出
            if (staProtocol.isAutoing() && !staProtocol.isLoading() && staProtocol.isOutEnable()) {
            if (staProtocol.isAutoing() && !staProtocol.isLoading() && staProtocol.isOutEnable() && staProtocol.getWrkNo() == 0) {
                // 判断是否已经生成任务
                if (wrkMastService.selectList(new EntityWrapper<WrkMast>().in("io_type", 111,112).eq("sta_no", entry.getKey())).size() > 0) {
                    log.warn("{}站点已经存在空板出库任务", entry.getKey());
                int dismantlingMachine = entry.getKey();
                switch (entry.getKey()) {
                    case 1001:dismantlingMachine = 1002;break;
                    case 1019:dismantlingMachine = 1020;break;
                    case 1034:dismantlingMachine = 1035;break;
                }
                if (wrkMastService.selectList(new EntityWrapper<WrkMast>().in("io_type", 110).eq("sta_no", dismantlingMachine)).size() > 0) {
//                    log.warn("{}站点已经存在两个空板出库任务", entry.getKey());
                    continue;
                }
                Map<String, String> map = new HashMap<>();
                map.put("site", String.valueOf(entry.getKey()));
                map.put("site", String.valueOf(dismantlingMachine));
                map.put("flag", entry.getValue());
                String response = "";
                try {
@@ -1711,23 +1592,31 @@
     * 托盘到达rgv接驳站点,更改工作档状态为9.呼叫RGV,环穿程序调度rgv
     */
    public synchronized void callRgv() {
        // 输送线plc编号
        Integer devpPlcId = 1;
        DevpThread devpThread = (DevpThread) SlaveConnection.get(SlaveType.Devp, devpPlcId);
        for (Integer site : rgvConnectionSiteList) {
            // 输送线plc编号
            Integer devpPlcId = site < 1044 ? 1 : site <= 1090 ? 2 : 3;
            DevpThread devpThread = (DevpThread) SlaveConnection.get(SlaveType.Devp, devpPlcId);
            StaProtocol staProtocol = devpThread.getStation().get(site);
            if (staProtocol == null) {
                continue;
            } else {
                staProtocol = staProtocol.clone();
            }
            if (staProtocol.isAutoing() && staProtocol.isLoading() && staProtocol.getWorkNo() != 0) {
            if (staProtocol.isAutoing() && staProtocol.isLoading() && (staProtocol.isInEnable() || staProtocol.isOutEnable() && site == 1090) && staProtocol.getWorkNo() != 0 && staProtocol.getWorkNo() < 9000) {
                // 查询工作档
                WrkMast wrkMast = wrkMastMapper.selectByWrkNo(staProtocol.getWorkNo());
                if (wrkMast == null) {
                    log.error("呼叫rgv,任务号不存在:{}",staProtocol.getWorkNo());
                    continue;
                }
                if (staProtocol.getSiteId() == 1090 && wrkMast.getLocNo() == null) {
                    continue;
                }
                if ((wrkMast.getWrkSts() == 2 || wrkMast.getWrkSts() == 15) && wrkMast.getRgvNo() == null) {
                    wrkMast.setRgvNo(0);
                    wrkMast.setRgvSstaNo(site);
                    wrkMast.setRgvDstaNo(taskStaNoToRgvStaNoMap.get(wrkMast.getStaNo()));
                    wrkMast.setWrkSts(9L);
                    wrkMast.setModiTime(new Date());
                    wrkMastMapper.updateById(wrkMast);
                    log.info("任务号:{}已到达rgv接驳位,准备呼叫rgv...", wrkMast.getWrkNo());
@@ -1737,15 +1626,124 @@
    }
    /**
     * rgv放货完成,给输送线下发任务
     */
    public synchronized void rgvToDev() {
        for (Integer site : rgvConnectionSiteList) {
            // 输送线plc编号
            Integer devpPlcId = site < 1044 ? 1 : site <= 1090 ? 2 : 3;
            DevpThread devpThread = (DevpThread) SlaveConnection.get(SlaveType.Devp, devpPlcId);
            StaProtocol staProtocol = devpThread.getStation().get(site);
            if (staProtocol == null) {
                continue;
            } else {
                staProtocol = staProtocol.clone();
            }
            if (staProtocol.isAutoing() && staProtocol.isLoading() && (staProtocol.isOutEnable() ||  (staProtocol.getSiteId() == 1001 || staProtocol.getSiteId() == 1019 || staProtocol.getSiteId() == 1034))&& staProtocol.getWorkNo() == 0 && staProtocol.getHideWorkNo() != 0) {
                // 查询工作档
                WrkMast wrkMast = wrkMastMapper.selectByWrkNo(staProtocol.getHideWorkNo());
                if (wrkMast == null) {
                    log.error("rgv放货完成,{}站点,隐藏任务号找不到工作档:{}", site, staProtocol.getHideWorkNo());
                    continue;
                }
                if(wrkMast.getIoType() == 3 && (wrkMast.getStaNo() == 1024 || wrkMast.getStaNo() == 1016 || wrkMast.getStaNo() == 1043)) { // 到1024出库口,放到输送线后任务完成
                    wrkMast.setWrkSts(2L);
                    wrkMast.setModiTime(new Date());
                    wrkMastService.updateById(wrkMast);
                } else if(wrkMast.getIoType() == 101 && (wrkMast.getStaNo() == 1024 || wrkMast.getStaNo() == 1016 || wrkMast.getStaNo() == 1043)) {
                    wrkMast.setWrkSts(15L);
                    wrkMast.setModiTime(new Date());
                    wrkMastService.updateById(wrkMast);
                } else if(wrkMast.getIoType() == 110 && (wrkMast.getStaNo() == 1002 || wrkMast.getStaNo() == 1020 ||wrkMast.getStaNo() == 1035)) {
                    wrkMast.setWrkSts(15L);
                    wrkMast.setModiTime(new Date());
                    wrkMastService.updateById(wrkMast);
                }
                // 给输送线下发命令
                staProtocol.setWorkNo(staProtocol.getHideWorkNo());
                staProtocol.setStaNo(wrkMast.getStaNo().shortValue());
                if (!MessageQueue.offer(SlaveType.Devp, devpPlcId, new Task(2, staProtocol))) {
                    log.info("rgv搬运完成给输送线下发命令失败!,plc id:{},站点{},任务号:{},目标站:{}", devpPlcId,staProtocol.getStaNo(), staProtocol.getWorkNo(), staProtocol.getStaNo());
                } else {
                    log.info("rgv搬运完成给输送线下发命令成功plc id:{}!,站点{},任务号:{},目标站:{}", devpPlcId,staProtocol.getStaNo(), staProtocol.getWorkNo(), staProtocol.getStaNo());
                }
            }
        }
    }
    /**
     * 读异常口可入信号,分配库位
     */
    public synchronized void abnormalMouthWarehousing() {
        DevpThread devpThread = (DevpThread) SlaveConnection.get(SlaveType.Devp, 2);
        StaProtocol staProtocol = devpThread.getStation().get(1090);
        if (staProtocol == null) {
            return;
        } else {
            staProtocol = staProtocol.clone();
        }
        if (staProtocol.isAutoing() && staProtocol.isLoading() && (staProtocol.isInEnable() || staProtocol.isOutEnable()) && staProtocol.getWorkNo() != 0 && staProtocol.getWorkNo() < 9000) {
            // 查询工作档
            WrkMast wrkMast = wrkMastService.selectById(staProtocol.getWorkNo());
            if (wrkMast == null) {
                log.error("异常口入库任务号无任务:{}", staProtocol.getWorkNo());
                return;
            } else if (wrkMast.getLocNo() != null) {
                log.info("异常口入库库位已分配:{}", wrkMast.getLocNo());
                return;
            } else if(wrkMast.getStaNo() != 1090) {
                log.info("异常口入库入库目标站点已分配:{}", wrkMast.getStaNo());
                return;
            }
            try {
                CanningLineInLocParam param = new CanningLineInLocParam();
                param.setWrkNo(staProtocol.getWrkNo());
                param.setSourceStaNo(1090);
                param.setTbFlag(staProtocol.isInEnable()); // true入成品库,false入空桶库
                String response = new HttpHandler.Builder()
                        .setUri(wmsUrl)
                        .setPath("/rpc/pakin/abnormalMouthWarehousing/loc/v1")
                        .setJson(JSON.toJSONString(param))
                        .build()
                        .doPost();
                log.info("异常口入库请求wms原始返回:" + response);
                JSONObject jsonObject = JSON.parseObject(response);
                if (jsonObject.getInteger("code").equals(200)) {
//                    StartupDto dto = jsonObject.getObject("data", StartupDto.class);
//                    staProtocol.setWorkNo(dto.getWorkNo());
//                    staProtocol.setStaNo(dto.getStaNo().shortValue());
//                    devpThread.setPakMk(staProtocol.getSiteId(), false);
//                    boolean result = MessageQueue.offer(SlaveType.Devp, 2, new Task(2, staProtocol));
//                    if (result) {
//                        log.info("异常口入库推送输送线命令成功:" + dto.getWorkNo() + "," + 1090 + "," + dto.getStaNo());
//                        News.info("异常口入库推送输送线命令成功:" + dto.getWorkNo() + "," + 1090 + "," + dto.getStaNo());
//                    } else {
//                        log.error("异常口入库推送输送线命令失败:" + dto.getWorkNo() + "," + 1090 + "," + dto.getStaNo());
//                        News.error("异常口入库推送输送线命令失败:" + dto.getWorkNo() + "," + 1090 + "," + dto.getStaNo());
//                        throw new CoolException("异常口入库推送输送线命令失败:" + 1090);
//                    }
                } else {
                    log.error("异常口入库请求接口异常,url:{},request:{},response:{}", wmsUrl + "/rpc/pakin/CanningLine/loc/v1", JSON.toJSONString(param), response);
                    News.error("异常口入库请求接口异常!!!url:{};request:{};response:{}", wmsUrl + "/rpc/pakin/CanningLine/loc/v1", JSON.toJSONString(param), response);
                }
            } catch (Exception e) {
                e.printStackTrace();
                TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
            }
        }
    }
    /**
     * 母托盘叠满自动入库
     */
    public synchronized void autoEmptyIn() {
        for (DevpSlave devp : slaveProperties.getDevp()) {
            // 遍历空板入库口
        SiemensDevpThread devpThread = (SiemensDevpThread) SlaveConnection.get(SlaveType.Devp, 1);
            for (Integer site :  stackingSite) {
                // 获取空板入库站信息
                SiemensDevpThread devpThread = (SiemensDevpThread) SlaveConnection.get(SlaveType.Devp, devp.getId());
                StaProtocol staProtocol = devpThread.getStation().get(site);
                if (staProtocol == null) {
                    continue;
@@ -1753,26 +1751,14 @@
                    staProtocol = staProtocol.clone();
                }
                if (!staProtocol.isLoading()){
                    continue;
                }
                // 站点条件判断
                if (staProtocol.isAutoing()
                        && staProtocol.isLoading()
                        && staProtocol.isInEnable()
                        && staProtocol.isEmptyMk()
                        && staProtocol.isPakMk()
                        && staProtocol.getWorkNo() == 0
                ) {
                if (staProtocol.isAutoing() && staProtocol.isLoading() && staProtocol.isInEnable() && staProtocol.getWorkNo() == 0) {
                    try {
                        LocTypeDto locTypeDto = new LocTypeDto(staProtocol);
                        SearchLocParam param = new SearchLocParam();
                        param.setIoType(10);
                        param.setSourceStaNo(site);
                        param.setLocType1(locTypeDto.getLocType1());
                        param.setLocType1((short) 1);
                        String response = new HttpHandler.Builder()
                                .setUri(wmsUrl)
                                .setPath("/rpc/pakin/loc/v1")
@@ -1784,10 +1770,9 @@
                            StartupDto dto = jsonObject.getObject("data", StartupDto.class);
                            // 更新站点信息 且 下发plc命令
                            staProtocol.setWorkNo(dto.getWorkNo());
                            staProtocol.setStaNo(staProtocol.getSiteId().shortValue());
                            devpThread.setPakMk(staProtocol.getSiteId(), false);
                            boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol));
                            log.error("输送线下发6:"+dto.getWorkNo()+","+staProtocol.getSiteId());
                            staProtocol.setStaNo(dto.getStaNo().shortValue());
                            boolean result = MessageQueue.offer(SlaveType.Devp, 1, new Task(2, staProtocol));
                            log.error("母托叠盘入库输送线下发:"+dto.getWorkNo()+","+staProtocol.getSiteId());
                            if (!result) {
                                News.errorNoLog(""+" - 1"+" - 更新plc站点信息失败");
                                throw new CoolException("更新plc站点信息失败");
@@ -1799,24 +1784,149 @@
                        e.printStackTrace();
                        TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
                    }
                } else {
                    News.errorNoLog(" - 母托叠盘入库站点信息不符合入库条件!!!"+" 自动信号:"+staProtocol.isAutoing()+"、可入信号:" + staProtocol.isInEnable()
                            +"、空板信号:"+ staProtocol.isEmptyMk()+"、工作号:" + staProtocol.getWorkNo()
                            +"、锁定标记"+ staProtocol.isPakMk());
                }
            }
        }
    }
    /**
     * 空桶罐装完成到达罐装线rgv口 完成直供罐装线任务和空桶出库任务,创建成品桶入库任务
     * 子托盘底下母托盘回流
     */
    public synchronized void motherTrayReflow() {
        SiemensDevpThread devpThread = (SiemensDevpThread) SlaveConnection.get(SlaveType.Devp, 1);
        StaProtocol staProtocol = devpThread.getStation().get(1034);
        if (staProtocol == null) {
            return;
        } else {
            staProtocol = staProtocol.clone();
        }
        // 站点条件判断
        if (staProtocol.isAutoing() && staProtocol.isLoading() && staProtocol.isInEnable() && staProtocol.getWrkNo() == 0) {
            Date now = new Date();
            // 保存工作档
            WrkMast wrkMast = new WrkMast();
            wrkMast.setWrkNo(commonService.getWorkNo(1));
            wrkMast.setIoTime(now);
            wrkMast.setWrkSts(2L);
            wrkMast.setIoType(3);
            wrkMast.setSourceStaNo(1034); // 源站
            wrkMast.setStaNo(1024); // 目标站
            wrkMast.setAppeTime(now);
            wrkMast.setMemo("子托盘底座母托盘回流");
            wrkMastService.insert(wrkMast);
            staProtocol.setWorkNo(wrkMast.getWrkNo());
            staProtocol.setStaNo(wrkMast.getStaNo().shortValue());
            boolean result = MessageQueue.offer(SlaveType.Devp, 1, new Task(2, staProtocol));
            if (result) {
                log.info("子托盘底座母托盘回流命令推送队列成功:" + wrkMast.getWrkNo() + "," + staProtocol.getSiteId());
            } else {
                log.error("子托盘底座母托盘回流命令推送队列失败:" + wrkMast.getWrkNo() + "," + staProtocol.getSiteId());
            }
        }
    }
    /**
     * 空桶罐装完成到达罐装线出口 完成直供罐装线任务和空桶出库任务,创建成品桶入库任务
     */
    public synchronized void canningLineTaskFinish() {
        // 输送线plc编号
        Integer devpPlcId = 1;
        Integer devpPlcId = 2;
        DevpThread devpThread = (DevpThread) SlaveConnection.get(SlaveType.Devp, devpPlcId);
        for (Integer site : canningLineRgvConnectionSiteList) {
        for (Integer site : outGzxSiteList) {
            StaProtocol staProtocol = devpThread.getStation().get(site);
            if (staProtocol == null) {
                continue;
            } else {
                staProtocol = staProtocol.clone();
            }
            if (staProtocol.isAutoing() && staProtocol.isLoading() && staProtocol.isInEnable() && staProtocol.getWorkNo() == 0) {
                if(staProtocol.getWrkNo() == 0) {
                    log.error("{}出罐装线货物到位,没有读取到任务号:{}",staProtocol.getSiteId(),staProtocol.getWrkNo());
                    continue;
                }
                // 贴标结果反馈到外形检测的扫描条码失败
                StaProtocol staProtocol2 = devpThread.getStation().get(site + 2);
                // 根据罐装线反馈任务号查询工作档
                WrkMast wrkMast = wrkMastService.selectById(staProtocol.getWrkNo());
                if(wrkMast == null) {
                    log.error("出罐装线货物任务号工作档不存在:{}",staProtocol.getWrkNo());
                    continue;
                } else if(wrkMast.getWrkSts() != 2) {
                    log.error("出罐装线货物任务号工作档状态异常,不为2:{}",staProtocol.getWrkNo());
                    continue;
                }
                try {
                    CanningLineInLocParam param = new CanningLineInLocParam();
                    param.setWrkNo(staProtocol.getWrkNo());
                    param.setMatnr(staProtocol.getMatnr().trim());
                    param.setBatch(staProtocol.getBatch());
                    param.setManuDate(staProtocol.getManuDate());
                    param.setWeight(staProtocol.getWeight());
                    param.setGrossWeight(staProtocol.getGrossWeight());
                    param.setSourceStaNo(site + 2);
                    param.setTbFlag(staProtocol2.isBarcodeErr());
//                    param.setWrkNo(57);
//                    param.setMatnr("101");
//                    param.setBatch("tt1");
//                    param.setManuDate("2025-06-05");
//                    param.setWeight(100.0);
//                    param.setGrossWeight(100.0);
//                    param.setSourceStaNo(site);
//                    param.setTbFlag(true);
                    String response = new HttpHandler.Builder()
                            .setUri(wmsUrl)
                            .setPath("/rpc/pakin/CanningLine/loc/v1")
                            .setJson(JSON.toJSONString(param))
                            .build()
                            .doPost();
                    log.info("罐装线入库请求wms原始返回:" + response);
                    JSONObject jsonObject = JSON.parseObject(response);
                    if (jsonObject.getInteger("code").equals(200)) {
                        StartupDto dto = jsonObject.getObject("data", StartupDto.class);
                        staProtocol.setWorkNo(dto.getWorkNo());
                        staProtocol.setStaNo(dto.getSourceStaNo().shortValue());
                        devpThread.setPakMk(staProtocol.getSiteId(), false);
                        boolean result = MessageQueue.offer(SlaveType.Devp, devpPlcId, new Task(2, staProtocol));
                        staProtocol.setPlaceableFlag(1);
                        boolean offer = MessageQueue.offer(SlaveType.Devp, outGzxSiteList.indexOf(site) + 4, new Task(5, staProtocol));
                        if (offer) {
                            log.info("给罐装线写入可出信号推送{}号输送线命令成功:{}" ,site,1);
                        }
                        if (result) {
                            log.info("罐装线入库推送输送线命令成功:" + dto.getWorkNo() + "," + site + "," + dto.getStaNo());
                            News.info("罐装线入库推送输送线命令成功:" + dto.getWorkNo() + "," + site + "," + dto.getStaNo());
                        } else {
                            log.error("罐装线入库推送输送线命令失败:" + dto.getWorkNo() + "," + site + "," + dto.getStaNo());
                            News.error("罐装线入库推送输送线命令失败:" + dto.getWorkNo() + "," + site + "," + dto.getStaNo());
                            throw new CoolException("罐装线入库推送输送线命令失败:" + site);
                        }
                    } else {
                        log.error("罐装线入库请求接口异常,url:{},request:{},response:{}", wmsUrl + "/rpc/pakin/CanningLine/loc/v1", JSON.toJSONString(param), response);
                        News.error("罐装线入库请求接口异常!!!url:{};request:{};response:{}", wmsUrl + "/rpc/pakin/CanningLine/loc/v1", JSON.toJSONString(param), response);
                    }
                } catch (Exception e) {
                    e.printStackTrace();
                    TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
                }
            }
        }
    }
    /**
     * 到达罐装线入库口,告诉罐装线要入库桶信息
     */
    public synchronized void inGzxBefore() {
        // 输送线plc编号
        Integer devpPlcId = 2;
        DevpThread devpThread = (DevpThread) SlaveConnection.get(SlaveType.Devp, devpPlcId);
        for (Integer site : inGzxSiteList) {
            StaProtocol staProtocol = devpThread.getStation().get(site);
            if (staProtocol == null) {
                continue;
@@ -1826,45 +1936,43 @@
            if (staProtocol.isAutoing() && staProtocol.isLoading() && staProtocol.isInEnable() && staProtocol.getWorkNo() != 0) {
                // 查询工作档
                WrkMast wrkMast = wrkMastMapper.selectByWrkNo(staProtocol.getWorkNo());
                if (wrkMast.getIoType() != 1) {
                    try {
                        CanningLineInLocParam param = new CanningLineInLocParam();
                        param.setWrkNo(wrkMast.getWrkNo());
                        param.setSourceStaNo(site);
                        String response = new HttpHandler.Builder()
                                .setUri(wmsUrl)
                                .setPath("/rpc/pakin/CanningLine/loc/v1")
                                .setJson(JSON.toJSONString(param))
                                .build()
                                .doPost();
                        log.info("罐装线入库请求wms原始返回:" + response);
                        JSONObject jsonObject = JSON.parseObject(response);
                        if (jsonObject.getInteger("code").equals(200)) {
                            StartupDto dto = jsonObject.getObject("data", StartupDto.class);
                            staProtocol.setWorkNo(dto.getWorkNo());
                            staProtocol.setStaNo(RouteUtils.SouStaEnd(dto.getStaNo(), dto.getSourceStaNo()));
                            devpThread.setPakMk(staProtocol.getSiteId(), false);
                            // 这里下发命令后,输送线要把该站点可入信号去除
                            boolean result = MessageQueue.offer(SlaveType.Devp, devpPlcId, new Task(2, staProtocol));
                            if (result) {
                                log.info("罐装线入库推送输送线命令成功:" + dto.getWorkNo() + "," + site + "," + dto.getStaNo());
                                News.info("罐装线入库推送输送线命令成功:" + dto.getWorkNo() + "," + site + "," + dto.getStaNo());
                            } else {
                                log.error("罐装线入库推送输送线命令失败:" + dto.getWorkNo() + "," + site + "," + dto.getStaNo());
                                News.error("罐装线入库推送输送线命令失败:" + dto.getWorkNo() + "," + site + "," + dto.getStaNo());
                                throw new CoolException("罐装线入库推送输送线命令失败:" + site);
                            }
                        } else {
                            log.error("罐装线入库请求接口异常,url:{},request:{},response:{}", wmsUrl + "/rpc/pakin/CanningLine/loc/v1", JSON.toJSONString(param), response);
                            News.error("罐装线入库请求接口异常!!!url:{};request:{};response:{}", wmsUrl + "/rpc/pakin/CanningLine/loc/v1", JSON.toJSONString(param), response);
                        }
                    } catch (Exception e) {
                        e.printStackTrace();
                        TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
                if (wrkMast != null && wrkMast.getWhsType() == null) {
                    WrkDetl wrkDetl = wrkDetlService.selectOne(new EntityWrapper<WrkDetl>().eq("wrk_no", wrkMast.getWrkNo()));
                    staProtocol.setBucketType(wrkDetl.getMatnr());
                    staProtocol.setBucketCount(wrkDetl.getAnfme().intValue());
                    boolean result = MessageQueue.offer(SlaveType.Devp, inGzxSiteList.indexOf(site) + 4, new Task(4, staProtocol));
                    if (result) {
                        log.info("告诉罐装线入库桶信息命令队列推送成功:" + staProtocol.getWorkNo() + "," + site + "," + staProtocol.getBucketType() +"," + staProtocol.getBucketCount());
                        News.info("告诉罐装线入库桶信息命令队列推送成功:" + staProtocol.getWorkNo() + "," + site + "," + staProtocol.getBucketType() +"," + staProtocol.getBucketCount());
                        wrkMast.setWhsType(1); // 更新推送标识,避免重复推送
                        wrkMastService.updateById(wrkMast);
                    } else {
                        log.error("告诉罐装线入库桶信息命令队列推送失败:" + staProtocol.getWorkNo() + "," + site + "," + staProtocol.getBucketType() +"," + staProtocol.getBucketCount());
                        News.error("告诉罐装线入库桶信息命令队列推送失败:" + staProtocol.getWorkNo() + "," + site + "," + staProtocol.getBucketType() +"," + staProtocol.getBucketCount());
                        throw new CoolException("告诉罐装线入库桶信息命令队列推送失败:" + site);
                    }
                }
            }
        }
    }
    public synchronized void intiGzxkc() throws InterruptedException {
        DevpThread devpThread = (DevpThread) SlaveConnection.get(SlaveType.Devp, 2);
        for (Integer site : outGzxSiteList) {
            StaProtocol staProtocol = devpThread.getStation().get(site);
            if (staProtocol == null) {
                continue;
            } else {
                staProtocol = staProtocol.clone();
            }
            if (staProtocol.isAutoing() && !staProtocol.isLoading() && staProtocol.getWorkNo() == 0) {
                staProtocol.setPlaceableFlag(1);
                boolean offer = MessageQueue.offer(SlaveType.Devp, outGzxSiteList.indexOf(site) + 4, new Task(5, staProtocol));
                if(offer) {
                    log.info("初始化罐装线可出信号成功,站点{},信号:{}",site,1);
                    Thread.sleep(500);
                }
            }
        }
    }
}
src/main/resources/application.yml
@@ -8,7 +8,8 @@
    name: @pom.build.finalName@
  datasource:
    driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver
    url: jdbc:sqlserver://127.0.0.1:1433;databasename=mdqzasrs
    url: jdbc:sqlserver://192.168.2.201:1433;databasename=mdqzasrs
#    url: jdbc:sqlserver://127.0.0.1:1433;databasename=mdqzasrs
    username: sa
    password: sa@123
  mvc:
@@ -48,7 +49,7 @@
  # 堆垛机1
  crn[0]:
    id: 1
    ip: 10.10.10.1
    ip: 192.168.2.1
    port: 102
    rack: 0
    slot: 0
@@ -57,22 +58,22 @@
    demo: false
    # 堆垛机入库站点
    crnInStn[0]:
      devpPlcId: ${wcs-slave.devp[0].id}
      staNo: 1093
      row: 3
      bay: 1
      devpPlcId: ${wcs-slave.devp[2].id}
      staNo: 1096
      row: 4
      bay: 0
      lev: 1
    # 堆垛机出库站点
    crnOutStn[0]:
      devpPlcId: ${wcs-slave.devp[0].id}
      devpPlcId: ${wcs-slave.devp[2].id}
      staNo: 1093
      row: 3
      bay: 1
      bay: 0
      lev: 1
  # 堆垛机2
  crn[1]:
    id: 2
    ip: 10.10.10.10
    ip: 192.168.2.11
    port: 102
    rack: 0
    slot: 0
@@ -81,22 +82,22 @@
    demo: false
    # 堆垛机入库站点
    crnInStn[0]:
      devpPlcId: ${wcs-slave.devp[0].id}
      devpPlcId: ${wcs-slave.devp[2].id}
      staNo: 1104
      row: 6
      bay: 1
      bay: 0
      lev: 1
    # 堆垛机出库站点
    crnOutStn[0]:
      devpPlcId: ${wcs-slave.devp[0].id}
      devpPlcId: ${wcs-slave.devp[2].id}
      staNo: 1099
      row: 5
      bay: 1
      bay: 0
      lev: 1
  # 堆垛机3
  crn[2]:
    id: 3
    ip: 10.10.10.20
    ip: 192.168.2.21
    port: 102
    rack: 0
    slot: 0
@@ -105,22 +106,22 @@
    demo: false
    # 堆垛机入库站点
    crnInStn[0]:
      devpPlcId: ${wcs-slave.devp[0].id}
      devpPlcId: ${wcs-slave.devp[2].id}
      staNo: 1102
      row: 7
      bay: 1
      bay: 0
      lev: 1
    # 堆垛机出库站点
    crnOutStn[0]:
      devpPlcId: ${wcs-slave.devp[0].id}
      devpPlcId: ${wcs-slave.devp[2].id}
      staNo: 1107
      row: 8
      bay: 1
      bay: 0
      lev: 1
  # 堆垛机4
  crn[3]:
    id: 4
    ip: 10.10.10.30
    ip: 192.168.2.31
    port: 102
    rack: 0
    slot: 0
@@ -129,75 +130,60 @@
    demo: false
    # 堆垛机入库站点1
    crnInStn[0]:
      devpPlcId: ${wcs-slave.devp[0].id}
      devpPlcId: ${wcs-slave.devp[1].id}
      staNo: 1050
      row: 11
      bay: 1
      bay: 0
      lev: 1
    # 堆垛机入库站点2
    crnInStn[1]:
      devpPlcId: ${wcs-slave.devp[0].id}
      devpPlcId: ${wcs-slave.devp[1].id}
      staNo: 1049
      row: 12
      bay: 1
      bay: 0
      lev: 1
    # 堆垛机出库站点
    crnOutStn[0]:
      devpPlcId: ${wcs-slave.devp[0].id}
      devpPlcId: ${wcs-slave.devp[1].id}
      staNo: 1056
      row: 9
      bay: 1
      bay: 0
      lev: 1
    # 堆垛机出库站点
    crnOutStn[1]:
      devpPlcId: ${wcs-slave.devp[1].id}
      staNo: 1057
      row: 10
      bay: 0
      lev: 1
  # 输送线1
  devp[0]:
    id: 1
    ip: 10.10.10.18
    ip: 192.168.2.60
    port: 102
    rack: 0
    slot: 0
    # 入库口1
    inSta[0]:
      staNo: 1011
      staNo: 1006
      barcode: ${wcs-slave.barcode[0].id}
      backSta: 1010
      led: ${wcs-slave.led[0].id}
    # 入库口2
    inSta[1]:
      staNo: 1007
      staNo: 1012
      barcode: ${wcs-slave.barcode[1].id}
      backSta: 1008
      led: ${wcs-slave.led[1].id}
    # 入库口3
    inSta[2]:
      staNo: 1017
      barcode: ${wcs-slave.barcode[1].id}
      backSta: 1016
      led: ${wcs-slave.led[1].id}
      staNo: 1018
      barcode: ${wcs-slave.barcode[2].id}
      led: ${wcs-slave.led[2].id}
    # 入库口4
    inSta[3]:
      staNo: 1042
      barcode: ${wcs-slave.barcode[1].id}
      backSta: 1043
      led: ${wcs-slave.led[1].id}
    # 空板入库口1
    emptyInSta[0]:
      staNo: 1042
      barcode: ${wcs-slave.barcode[0].id}
      backSta: 1043
      led: ${wcs-slave.led[2].id}
    # 空板入库口2
    emptyInSta[1]:
      staNo: 1017
      barcode: ${wcs-slave.barcode[1].id}
      backSta: 1016
      staNo: 1041
      barcode: ${wcs-slave.barcode[3].id}
      led: ${wcs-slave.led[3].id}
    # 空板入库口3
    emptyInSta[2]:
      staNo: 1007
      barcode: ${wcs-slave.barcode[2].id}
      backSta: 1008
      led: ${wcs-slave.led[4].id}
    # 出库口1
    outSta[0]:
      staNo: 1024
@@ -214,26 +200,60 @@
    outSta[3]:
      staNo: 1016
      led: ${wcs-slave.led[1].id}
  # 输送线2
  devp[1]:
    id: 2
    ip: 192.168.2.80
    port: 102
    rack: 0
    slot: 0
  # 输送线3
  devp[2]:
    id: 3
    ip: 192.168.2.100
    port: 102
    rack: 0
    slot: 0
  # 罐装线1
  devp[3]:
    id: 4
    ip: 192.168.1.10
    port: 102
    rack: 0
    slot: 0
  # 罐装线2
  devp[4]:
    id: 5
    ip: 192.168.1.30
    port: 102
    rack: 0
    slot: 0
  # 罐装线3
  devp[5]:
    id: 6
    ip: 192.168.1.50
    port: 102
    rack: 0
    slot: 0
  # 条码扫描仪1
  barcode[0]:
    id: 1
    ip: 10.10.10.121
    ip: 192.168.2.63
    port: 51236
  # 条码扫描仪2
  barcode[1]:
    id: 2
    ip: 10.10.10.122
    ip: 192.168.2.64
    port: 51236
  # 条码扫描仪3
  barcode[2]:
    id: 3
    ip: 10.10.10.122
    ip: 192.168.2.67
    port: 51236
  # 条码扫描仪4
  barcode[3]:
    id: 4
    ip: 10.10.10.122
    ip: 192.168.2.68
    port: 51236
  # LED1
src/main/resources/mapper/WrkDetlMapper.xml
@@ -6,24 +6,44 @@
    <resultMap id="BaseResultMap" type="com.zy.entity.WrkDetl">
        <result column="wrk_no" property="wrkNo" />
        <result column="io_time" property="ioTime" />
        <result column="anfme" property="anfme" />
        <result column="zpallet" property="zpallet" />
        <result column="matnr" property="matnr" />
        <result column="maktx" property="maktx" />
        <result column="batch" property="batch" />
        <result column="order_no" property="orderNo" />
        <result column="specs" property="specs" />
<!--        <result column="size" property="size" />-->
        <result column="model" property="model" />
        <result column="color" property="color" />
        <result column="weight" property="weight" />
<!--        <result column="bill_no" property="billNo" />-->
<!--        <result column="seq_no" property="seqNo" />-->
        <result column="brand" property="brand" />
        <result column="anfme" property="anfme" />
        <result column="unit" property="unit" />
        <result column="zpallet" property="zpallet" />
<!--        <result column="bname" property="bname" />-->
        <result column="memo" property="memo" />
        <result column="price" property="price" />
        <result column="sku" property="sku" />
        <result column="units" property="units" />
        <result column="barcode" property="barcode" />
        <result column="origin" property="origin" />
        <result column="manu" property="manu" />
        <result column="manu_date" property="manuDate" />
        <result column="item_num" property="itemNum" />
        <result column="safe_qty" property="safeQty" />
        <result column="weight" property="weight" />
        <result column="man_length" property="manLength" />
        <result column="volume" property="volume" />
        <result column="three_code" property="threeCode" />
        <result column="supp" property="supp" />
        <result column="supp_code" property="suppCode" />
        <result column="be_batch" property="beBatch" />
        <result column="dead_time" property="deadTime" />
        <result column="dead_warn" property="deadWarn" />
        <result column="source" property="source" />
        <result column="inspect" property="inspect" />
        <result column="danger" property="danger" />
        <result column="modi_user" property="modiUser" />
        <result column="modi_time" property="modiTime" />
        <result column="appe_user" property="appeUser" />
        <result column="appe_time" property="appeTime" />
        <result column="memo" property="memo" />
    </resultMap>
    <select id="findByWorkNo" resultMap="BaseResultMap">
src/main/resources/mapper/WrkMastMapper.xml
@@ -55,6 +55,7 @@
        <result column="log_mk" property="logMk" />
        <result column="log_err_time" property="logErrTime" />
        <result column="log_err_memo" property="logErrMemo" />
        <result column="Pdc_type" property="pdcType" />
        <result column="barcode" property="barcode" />
<!--        <result column="Pdc_type" property="PdcType" />-->
        <result column="ctn_no" property="ctnNo" />
@@ -62,7 +63,7 @@
        <result column="rgv_no" property="rgvNo" />
        <result column="rgv_ssta_no" property="rgvSstaNo" />
        <result column="rgv_dsta_no" property="rgvDstaNo" />
        <result column="work_no_other" property="workNoOther" />
    </resultMap>
    <select id="selectByLocNo"  resultMap="BaseResultMap">
@@ -98,7 +99,7 @@
    </select>
    <select id="selectPakInStep2" resultMap="BaseResultMap">
        select top 1 * from dbo.asr_wrk_mast where wrk_sts=2 and crn_no=#{crnNo} and wrk_no=#{workNo} and sta_no=#{staNo} and (io_type=1 or io_type=10 or io_type=53 or io_type=54 or io_type=57) order by io_pri desc,io_time,wrk_no ASC
        select top 1 * from dbo.asr_wrk_mast where wrk_sts=2 and crn_no=#{crnNo} and wrk_no=#{workNo} and (io_type=1 or io_type=10 or io_type=53 or io_type=54 or io_type=57) order by io_pri desc,io_time,wrk_no ASC
    </select>
    <select id="selectPakInStep3" resultMap="BaseResultMap">
src/main/webapp/static/js/console.js
@@ -30,7 +30,7 @@
        let bLen
        let interval // 间隔数
        if (i < 8) {
        if (i <= 12) {
            interval = 1
            bLen = maxBayNo / interval // 库位个数
        } else {
src/main/webapp/static/js/console.map.js
@@ -11,73 +11,73 @@
        "id": "rack1",
        "top": 100,
        "left": 450,
        "width": 1300,
        "width": 1120,
        "height": 20,
        "minBayNo": 1,
        "maxBayNo": 40
        "maxBayNo": 56
    },{
        "type": "rack",
        "id": "rack2",
        "top": 120,
        "left": 450,
        "width": 1300,
        "width": 1120,
        "height": 20,
        "minBayNo": 1,
        "maxBayNo": 40
        "maxBayNo": 56
    },{
            "type": "rack",
            "id": "rack3",
            "top": 170,
            "left": 450,
            "width": 1300,
            "width": 1120,
            "height": 20,
            "minBayNo": 1,
            "maxBayNo": 40
            "maxBayNo": 56
        },{
        "type": "rack",
        "id": "rack4",
        "top": 190,
        "left": 450,
        "width": 1300,
        "width": 1120,
        "height": 20,
        "minBayNo": 1,
        "maxBayNo": 40
        "maxBayNo": 56
    },{
        "type": "rack",
        "id": "rack5",
        "top": 210,
        "left": 450,
        "width": 1300,
        "width": 1120,
        "height": 20,
        "minBayNo": 1,
        "maxBayNo": 40
        "maxBayNo": 56
    },{
        "type": "rack",
        "id": "rack6",
        "top": 260,
        "left": 450,
        "width": 1300,
        "width": 1120,
        "height": 20,
        "minBayNo": 1,
        "maxBayNo": 40
        "maxBayNo": 56
    },{
        "type": "rack",
        "id": "rack7",
        "top": 280,
        "left": 450,
        "width": 1300,
        "width": 1120,
        "height": 20,
        "minBayNo": 1,
        "maxBayNo": 40
        "maxBayNo": 56
    },{
        "type": "rack",
        "id": "rack8",
        "top": 330,
        "left": 450,
        "width": 1300,
        "width": 1120,
        "height": 20,
        "minBayNo": 1,
        "maxBayNo": 40
        "maxBayNo": 56
    },{
        "type": "rack",
        "id": "rack9",
@@ -116,27 +116,27 @@
        "maxBayNo": 40
    }],
    "rackDescs": [
        {"type": "rackDescs", "id": "lb_desc1", "text": "#1", "top": 102, "left": 1750, "width": 30, "height": 20},
        {"type": "rackDescs", "id": "lb_desc2", "text": "#2", "top": 120, "left": 1750, "width": 30, "height": 20},
        {"type": "rackDescs", "id": "lb_desc3", "text": "#3", "top": 172, "left": 1750, "width": 30, "height": 20},
        {"type": "rackDescs", "id": "lb_desc4", "text": "#4", "top": 192, "left": 1750, "width": 30, "height": 20},
        {"type": "rackDescs", "id": "lb_desc5", "text": "#5", "top": 212, "left": 1750, "width": 30, "height": 20},
        {"type": "rackDescs", "id": "lb_desc6", "text": "#6", "top": 262, "left": 1750, "width": 30, "height": 20},
        {"type": "rackDescs", "id": "lb_desc7", "text": "#7", "top": 282, "left": 1750, "width": 30, "height": 20},
        {"type": "rackDescs", "id": "lb_desc8", "text": "#8", "top": 332, "left": 1750, "width": 30, "height": 20},
        {"type": "rackDescs", "id": "lb_desc1", "text": "#1", "top": 102, "left": 1570, "width": 30, "height": 20},
        {"type": "rackDescs", "id": "lb_desc2", "text": "#2", "top": 120, "left": 1570, "width": 30, "height": 20},
        {"type": "rackDescs", "id": "lb_desc3", "text": "#3", "top": 172, "left": 1570, "width": 30, "height": 20},
        {"type": "rackDescs", "id": "lb_desc4", "text": "#4", "top": 192, "left": 1570, "width": 30, "height": 20},
        {"type": "rackDescs", "id": "lb_desc5", "text": "#5", "top": 212, "left": 1570, "width": 30, "height": 20},
        {"type": "rackDescs", "id": "lb_desc6", "text": "#6", "top": 262, "left": 1570, "width": 30, "height": 20},
        {"type": "rackDescs", "id": "lb_desc7", "text": "#7", "top": 282, "left": 1570, "width": 30, "height": 20},
        {"type": "rackDescs", "id": "lb_desc8", "text": "#8", "top": 332, "left": 1570, "width": 30, "height": 20},
        {"type": "rackDescs", "id": "lb_desc9", "text": "#9", "top": 457, "left": 1760, "width": 30, "height": 20},
        {"type": "rackDescs", "id": "lb_desc10", "text": "10", "top": 476, "left": 1760, "width": 30, "height": 20},
        {"type": "rackDescs", "id": "lb_desc11", "text": "11", "top": 527, "left": 1760, "width": 30, "height": 20},
        {"type": "rackDescs", "id": "lb_desc12", "text": "12", "top": 546, "left": 1760, "width": 30, "height": 20}
    ],
    "crns": [
        {"type": "crane", "id": "crn-1", "text": "1", "top": 142, "left": 376, "width": 100, "height": 30},
        {"type": "track", "id": "lb_track1","text": "", "top": 159, "left": 450, "width": 1300, "height": 1},
        {"type": "crane", "id": "crn-2", "text": "2", "top": 232, "left": 376, "width": 100, "height": 30},
        {"type": "track", "id": "lb_track2","text": "", "top": 250, "left": 450, "width": 1300, "height": 1},
        {"type": "crane", "id": "crn-3", "text": "3", "top": 302, "left": 460, "width": 100, "height": 30},
        {"type": "track", "id": "lb_track3","text": "", "top": 320, "left": 450, "width": 1300, "height": 1},
        {"type": "crane", "id": "crn-4", "text": "4", "top": 497, "left": 1200, "width": 100, "height": 30},
        {"type": "crane", "id": "crn-1", "text": "1", "top": 142, "left": 376, "width": 60, "height": 30},
        {"type": "track", "id": "lb_track1","text": "", "top": 159, "left": 450, "width": 1120, "height": 1},
        {"type": "crane", "id": "crn-2", "text": "2", "top": 232, "left": 376, "width": 60, "height": 30},
        {"type": "track", "id": "lb_track2","text": "", "top": 250, "left": 450, "width": 1120, "height": 1},
        {"type": "crane", "id": "crn-3", "text": "3", "top": 302, "left": 460, "width": 60, "height": 30},
        {"type": "track", "id": "lb_track3","text": "", "top": 320, "left": 450, "width": 1120, "height": 1},
        {"type": "crane", "id": "crn-4", "text": "4", "top": 497, "left": 1200, "width": 60, "height": 30},
        {"type": "track", "id": "lb_track4","text": "", "top": 515, "left": 960, "width": 800, "height": 1},
        {"type": "track", "id": "lb_track5","text": "", "top": 612, "left": 303, "width": 1430, "height": 1},
        {"type": "track", "id": "lb_track6","text": "", "top": 638, "left": 270 , "width": 1464, "height": 1},
@@ -179,93 +179,95 @@
                {"type": "stn", "id": "site-1105", "text": "1105", "top": 332, "left": 307, "width": 47, "height": 20},
                {"type": "stn", "id": "site-1106", "text": "1106", "top": 332, "left": 355, "width": 47, "height": 20},
                {"type": "stn", "id": "site-1107", "text": "1107", "top": 332, "left": 403, "width": 47, "height": 20},
                {"type": "stn", "id": "site-1107", "text": "1090", "top": 367, "left": 307, "width": 47, "height": 20},
                {"type": "stn", "id": "site-1107", "text": "1089", "top": 393, "left": 307, "width": 47, "height": 20},
                {"type": "stn", "id": "site-1107", "text": "1088", "top": 393, "left": 355, "width": 47, "height": 20},
                {"type": "stn", "id": "site-1107", "text": "1087", "top": 393, "left": 403, "width": 47, "height": 20},
                {"type": "stn", "id": "site-1107", "text": "1086", "top": 456, "left": 307, "width": 47, "height": 20},
                {"type": "stn", "id": "site-1107", "text": "1085", "top": 456, "left": 355, "width": 47, "height": 20},
                {"type": "stn", "id": "site-1107", "text": "1084", "top": 456, "left": 403, "width": 47, "height": 20},
                {"type": "stn", "id": "site-1107", "text": "1083", "top": 519, "left": 307, "width": 47, "height": 20},
                {"type": "stn", "id": "site-1107", "text": "1082", "top": 519, "left": 355, "width": 47, "height": 20},
                {"type": "stn", "id": "site-1107", "text": "1081", "top": 519, "left": 403, "width": 47, "height": 20},
                {"type": "stn", "id": "site-1107", "text": "1079", "top": 393, "left": 625, "width": 47, "height": 20},
                {"type": "stn", "id": "site-1107", "text": "1078", "top": 393, "left": 673, "width": 47, "height": 20},
                {"type": "stn", "id": "site-1107", "text": "1077", "top": 393, "left": 721, "width": 47, "height": 20},
                {"type": "stn", "id": "site-1107", "text": "1075", "top": 393, "left": 769, "width": 47, "height": 20},
                {"type": "stn", "id": "site-1107", "text": "1074", "top": 414, "left": 769, "width": 47, "height": 20},
                {"type": "stn", "id": "site-1107", "text": "1073", "top": 435, "left": 769, "width": 47, "height": 20},
                {"type": "stn", "id": "site-1107", "text": "1061", "top": 456, "left": 769, "width": 47, "height": 20},
                {"type": "stn", "id": "site-1107", "text": "1063", "top": 456, "left": 721, "width": 47, "height": 20},
                {"type": "stn", "id": "site-1107", "text": "1064", "top": 456, "left": 673, "width": 47, "height": 20},
                {"type": "stn", "id": "site-1107", "text": "1065", "top": 456, "left": 625, "width": 47, "height": 20},
                {"type": "stn", "id": "site-1107", "text": "1066", "top": 477, "left": 769, "width": 47, "height": 20},
                {"type": "stn", "id": "site-1107", "text": "1067", "top": 498, "left": 769, "width": 47, "height": 20},
                {"type": "stn", "id": "site-1107", "text": "1068", "top": 519, "left": 769, "width": 47, "height": 20},
                {"type": "stn", "id": "site-1107", "text": "1070", "top": 519, "left": 721, "width": 47, "height": 20},
                {"type": "stn", "id": "site-1107", "text": "1071", "top": 519, "left": 673, "width": 47, "height": 20},
                {"type": "stn", "id": "site-1107", "text": "1072", "top": 519, "left": 625, "width": 47, "height": 20},
                {"type": "stn", "id": "site-1107", "text": "1050", "top": 527, "left": 913, "width": 47, "height": 20},
                {"type": "stn", "id": "site-1107", "text": "1051", "top": 512, "left": 817, "width": 47, "height": 35},
                {"type": "stn", "id": "site-1107", "text": "1052", "top": 477, "left": 817, "width": 47, "height": 35},
                {"type": "stn", "id": "site-1107", "text": "1049", "top": 548, "left": 913, "width": 47, "height": 20},
                {"type": "stn", "id": "site-1107", "text": "1047", "top": 548, "left": 865, "width": 47, "height": 20},
                {"type": "stn", "id": "site-1107", "text": "1046", "top": 548, "left": 817, "width": 47, "height": 20},
                {"type": "stn", "id": "site-1107", "text": "1045", "top": 569, "left": 817, "width": 47, "height": 20},
                {"type": "stn", "id": "site-1107", "text": "1044", "top": 590, "left": 817, "width": 47, "height": 20},
                {"type": "stn", "id": "site-1107", "text": "1053", "top": 456, "left": 817, "width": 47, "height": 20},
                {"type": "stn", "id": "site-1107", "text": "1054", "top": 456, "left": 865, "width": 47, "height": 20},
                {"type": "stn", "id": "site-1107", "text": "1056", "top": 456, "left": 913, "width": 47, "height": 20},
                {"type": "stn", "id": "site-1107", "text": "1057", "top": 477, "left": 913, "width": 47, "height": 20},
                {"type": "stn", "id": "site-1090", "text": "1090", "top": 367, "left": 307, "width": 47, "height": 20},
                {"type": "stn", "id": "site-1089", "text": "1089", "top": 393, "left": 307, "width": 47, "height": 20},
                // {"type": "stn", "id": "site-1088", "text": "1088", "top": 393, "left": 355, "width": 47, "height": 20},
                {"type": "stn", "id": "site-1087", "text": "1087", "top": 393, "left": 355, "width": 47, "height": 20},
                {"type": "stn", "id": "site-1086", "text": "1086", "top": 456, "left": 307, "width": 47, "height": 20},
                // {"type": "stn", "id": "site-1085", "text": "1085", "top": 456, "left": 355, "width": 47, "height": 20},
                {"type": "stn", "id": "site-1084", "text": "1084", "top": 456, "left": 355, "width": 47, "height": 20},
                {"type": "stn", "id": "site-1083", "text": "1083", "top": 519, "left": 307, "width": 47, "height": 20},
                // {"type": "stn", "id": "site-1082", "text": "1082", "top": 519, "left": 355, "width": 47, "height": 20},
                {"type": "stn", "id": "site-1081", "text": "1081", "top": 519, "left": 355, "width": 47, "height": 20},
                // {"type": "stn", "id": "site-1079", "text": "1079", "top": 393, "left": 578, "width": 47, "height": 20},
                {"type": "stn", "id": "site-1078", "text": "1078", "top": 393, "left": 626, "width": 47, "height": 20},
                {"type": "stn", "id": "site-1077", "text": "1077", "top": 393, "left": 674, "width": 47, "height": 20},
                {"type": "stn", "id": "site-1075", "text": "1075", "top": 393, "left": 722, "width": 47, "height": 20},
                {"type": "stn", "id": "site-1074", "text": "1074", "top": 414, "left": 722, "width": 47, "height": 20},
                {"type": "stn", "id": "site-1073", "text": "1073", "top": 435, "left": 722, "width": 47, "height": 20},
                {"type": "stn", "id": "site-1061", "text": "1061", "top": 456, "left": 722, "width": 47, "height": 20},
                {"type": "stn", "id": "site-1063", "text": "1063", "top": 456, "left": 674, "width": 47, "height": 20},
                {"type": "stn", "id": "site-1064", "text": "1064", "top": 456, "left": 626, "width": 47, "height": 20},
                // {"type": "stn", "id": "site-1065", "text": "1065", "top": 456, "left": 578, "width": 47, "height": 20},
                {"type": "stn", "id": "site-1066", "text": "1066", "top": 477, "left": 722, "width": 47, "height": 20},
                {"type": "stn", "id": "site-1067", "text": "1067", "top": 498, "left": 722, "width": 47, "height": 20},
                {"type": "stn", "id": "site-1068", "text": "1068", "top": 519, "left": 722, "width": 47, "height": 20},
                {"type": "stn", "id": "site-1070", "text": "1070", "top": 519, "left": 674, "width": 47, "height": 20},
                {"type": "stn", "id": "site-1071", "text": "1071", "top": 519, "left": 626, "width": 47, "height": 20},
                // {"type": "stn", "id": "site-1072", "text": "1072", "top": 519, "left": 578, "width": 47, "height": 20},
                {"type": "stn", "id": "site-1050", "text": "1050", "top": 527, "left": 913, "width": 47, "height": 20},
                {"type": "stn", "id": "site-1051", "text": "1051", "top": 512, "left": 770, "width": 47, "height": 35},
                {"type": "stn", "id": "site-1052", "text": "1052", "top": 477, "left": 770, "width": 47, "height": 35},
                {"type": "stn", "id": "site-1049", "text": "1049", "top": 548, "left": 913, "width": 47, "height": 20},
                {"type": "stn", "id": "site-1048", "text": "1048", "top": 548, "left": 865, "width": 47, "height": 20},
                {"type": "stn", "id": "site-1047", "text": "1047", "top": 548, "left": 818, "width": 47, "height": 20},
                {"type": "stn", "id": "site-1046", "text": "1046", "top": 548, "left": 770, "width": 47, "height": 20},
                {"type": "stn", "id": "site-1045", "text": "1045", "top": 569, "left": 770, "width": 47, "height": 20},
                {"type": "stn", "id": "site-1044", "text": "1044", "top": 590, "left": 770, "width": 47, "height": 20},
                {"type": "stn", "id": "site-1053", "text": "1053", "top": 456, "left": 770, "width": 47, "height": 20},
                {"type": "stn", "id": "site-1054", "text": "1054", "top": 456, "left": 818, "width": 47, "height": 20},
                {"type": "stn", "id": "site-1055", "text": "1055", "top": 456, "left": 865, "width": 47, "height": 20},
                {"type": "stn", "id": "site-1056", "text": "1056", "top": 456, "left": 913, "width": 47, "height": 20},
                {"type": "stn", "id": "site-1057", "text": "1057", "top": 477, "left": 913, "width": 47, "height": 20},
                {"type": "stn", "id": "site-1107", "text": "1001", "top": 640, "left": 1340, "width": 47, "height": 20},
                {"type": "stn", "id": "site-1107", "text": "1002", "top": 661, "left": 1340, "width": 47, "height": 20},
                {"type": "stn", "id": "site-1107", "text": "1004", "top": 682, "left": 1340, "width": 47, "height": 20},
                {"type": "stn", "id": "site-1107", "text": "1005", "top": 682, "left": 1388, "width": 47, "height": 20},
                {"type": "stn", "id": "site-1107", "text": "1006", "top": 640, "left": 1436, "width": 47, "height": 20},
                {"type": "stn", "id": "site-1107", "text": "1007", "top": 661, "left": 1436, "width": 47, "height": 20},
                {"type": "stn", "id": "site-1107", "text": "1008", "top": 682, "left": 1436, "width": 47, "height": 20},
                {"type": "stn", "id": "site-1107", "text": "1009", "top": 682, "left": 1484, "width": 47, "height": 20},
                {"type": "stn", "id": "site-1107", "text": "1010", "top": 682, "left": 1532, "width": 47, "height": 20},
                {"type": "stn", "id": "site-1107", "text": "1011", "top": 661, "left": 1532, "width": 47, "height": 20},
                {"type": "stn", "id": "site-1107", "text": "1012", "top": 640, "left": 1532, "width": 47, "height": 20},
                {"type": "stn", "id": "site-1001", "text": "1001", "top": 640, "left": 1340, "width": 47, "height": 20},
                {"type": "stn", "id": "site-1002", "text": "1002", "top": 661, "left": 1340, "width": 47, "height": 20},
                {"type": "stn", "id": "site-1004", "text": "1004", "top": 682, "left": 1340, "width": 47, "height": 20},
                {"type": "stn", "id": "site-1005", "text": "1005", "top": 682, "left": 1388, "width": 47, "height": 20},
                {"type": "stn", "id": "site-1006", "text": "1006", "top": 640, "left": 1436, "width": 47, "height": 20},
                {"type": "stn", "id": "site-1007", "text": "1007", "top": 661, "left": 1436, "width": 47, "height": 20},
                {"type": "stn", "id": "site-1008", "text": "1008", "top": 682, "left": 1436, "width": 47, "height": 20},
                {"type": "stn", "id": "site-1009", "text": "1009", "top": 682, "left": 1484, "width": 47, "height": 20},
                {"type": "stn", "id": "site-1010", "text": "1010", "top": 682, "left": 1532, "width": 47, "height": 20},
                {"type": "stn", "id": "site-1011", "text": "1011", "top": 661, "left": 1532, "width": 47, "height": 20},
                {"type": "stn", "id": "site-1012", "text": "1012", "top": 640, "left": 1532, "width": 47, "height": 20},
                {"type": "stn", "id": "site-1107", "text": "1041", "top": 640, "left": 1050, "width": 47, "height": 20},
                {"type": "stn", "id": "site-1107", "text": "1042", "top": 661, "left": 1050, "width": 47, "height": 20},
                {"type": "stn", "id": "site-1107", "text": "1043", "top": 682, "left": 1050, "width": 47, "height": 20},
                {"type": "stn", "id": "site-1107", "text": "1013", "top": 682, "left": 1098, "width": 47, "height": 20},
                {"type": "stn", "id": "site-1107", "text": "1014", "top": 682, "left": 1146, "width": 47, "height": 20},
                {"type": "stn", "id": "site-1107", "text": "1015", "top": 682, "left": 1194, "width": 47, "height": 20},
                {"type": "stn", "id": "site-1107", "text": "1016", "top": 682, "left": 1242, "width": 47, "height": 20},
                {"type": "stn", "id": "site-1107", "text": "1017", "top": 661, "left": 1242, "width": 47, "height": 20},
                {"type": "stn", "id": "site-1107", "text": "1018", "top": 640, "left": 1242, "width": 47, "height": 20},
                {"type": "stn", "id": "site-1107", "text": "1019", "top": 640, "left": 1146, "width": 47, "height": 20},
                {"type": "stn", "id": "site-1107", "text": "1020", "top": 661, "left": 1146, "width": 47, "height": 20},
                {"type": "stn", "id": "site-1041", "text": "1041", "top": 640, "left": 1050, "width": 47, "height": 20},
                {"type": "stn", "id": "site-1042", "text": "1042", "top": 661, "left": 1050, "width": 47, "height": 20},
                {"type": "stn", "id": "site-1043", "text": "1043", "top": 682, "left": 1050, "width": 47, "height": 20},
                {"type": "stn", "id": "site-1013", "text": "1013", "top": 682, "left": 1098, "width": 47, "height": 20},
                {"type": "stn", "id": "site-1014", "text": "1014", "top": 682, "left": 1146, "width": 47, "height": 20},
                {"type": "stn", "id": "site-1015", "text": "1015", "top": 682, "left": 1194, "width": 47, "height": 20},
                {"type": "stn", "id": "site-1016", "text": "1016", "top": 682, "left": 1242, "width": 47, "height": 20},
                {"type": "stn", "id": "site-1017", "text": "1017", "top": 661, "left": 1242, "width": 47, "height": 20},
                {"type": "stn", "id": "site-1018", "text": "1018", "top": 640, "left": 1242, "width": 47, "height": 20},
                {"type": "stn", "id": "site-1019", "text": "1019", "top": 640, "left": 1146, "width": 47, "height": 20},
                {"type": "stn", "id": "site-1020", "text": "1020", "top": 661, "left": 1146, "width": 47, "height": 20},
                {"type": "stn", "id": "site-1107", "text": "1022", "top": 640, "left": 400, "width": 47, "height": 20},
                {"type": "stn", "id": "site-1107", "text": "1023", "top": 661, "left": 400, "width": 47, "height": 20},
                {"type": "stn", "id": "site-1107", "text": "1024", "top": 682, "left": 400, "width": 47, "height": 20},
                {"type": "stn", "id": "site-1107", "text": "1025", "top": 682, "left": 448, "width": 47, "height": 20},
                {"type": "stn", "id": "site-1107", "text": "1026", "top": 640, "left": 496, "width": 47, "height": 20},
                {"type": "stn", "id": "site-1107", "text": "1027", "top": 661, "left": 496, "width": 47, "height": 20},
                {"type": "stn", "id": "site-1107", "text": "1028", "top": 682, "left": 496, "width": 47, "height": 20},
                {"type": "stn", "id": "site-1107", "text": "1030", "top": 682, "left": 544, "width": 47, "height": 20},
                {"type": "stn", "id": "site-1107", "text": "1031", "top": 682, "left": 592, "width": 47, "height": 20},
                {"type": "stn", "id": "site-1107", "text": "1032", "top": 661, "left": 592, "width": 47, "height": 20},
                {"type": "stn", "id": "site-1107", "text": "1033", "top": 640, "left": 592, "width": 47, "height": 20},
                {"type": "stn", "id": "site-1022", "text": "1022", "top": 640, "left": 400, "width": 47, "height": 20},
                {"type": "stn", "id": "site-1023", "text": "1023", "top": 661, "left": 400, "width": 47, "height": 20},
                {"type": "stn", "id": "site-1024", "text": "1024", "top": 682, "left": 400, "width": 47, "height": 20},
                {"type": "stn", "id": "site-1025", "text": "1025", "top": 682, "left": 448, "width": 47, "height": 20},
                {"type": "stn", "id": "site-1026", "text": "1026", "top": 640, "left": 496, "width": 47, "height": 20},
                {"type": "stn", "id": "site-1027", "text": "1027", "top": 661, "left": 496, "width": 47, "height": 20},
                {"type": "stn", "id": "site-1028", "text": "1028", "top": 682, "left": 496, "width": 47, "height": 20},
                {"type": "stn", "id": "site-1030", "text": "1030", "top": 682, "left": 544, "width": 47, "height": 20},
                {"type": "stn", "id": "site-1031", "text": "1031", "top": 682, "left": 592, "width": 47, "height": 20},
                {"type": "stn", "id": "site-1032", "text": "1032", "top": 661, "left": 592, "width": 47, "height": 20},
                {"type": "stn", "id": "site-1033", "text": "1033", "top": 640, "left": 592, "width": 47, "height": 20},
                {"type": "stn", "id": "site-1107", "text": "1034", "top": 640, "left": 650, "width": 47, "height": 20},
                {"type": "stn", "id": "site-1107", "text": "1035", "top": 661, "left": 650, "width": 47, "height": 20},
                {"type": "stn", "id": "site-1107", "text": "1036", "top": 682, "left": 650, "width": 47, "height": 20},
                {"type": "stn", "id": "site-1107", "text": "1038", "top": 682, "left": 698, "width": 47, "height": 20},
                {"type": "stn", "id": "site-1107", "text": "1039", "top": 682, "left": 746, "width": 47, "height": 20},
                {"type": "stn", "id": "site-1107", "text": "1040", "top": 682, "left": 794, "width": 47, "height": 20},
                {"type": "stn", "id": "site-1034", "text": "1034", "top": 640, "left": 650, "width": 47, "height": 20},
                {"type": "stn", "id": "site-1035", "text": "1035", "top": 661, "left": 650, "width": 47, "height": 20},
                {"type": "stn", "id": "site-1036", "text": "1036", "top": 682, "left": 650, "width": 47, "height": 20},
                {"type": "stn", "id": "site-1038", "text": "1038", "top": 682, "left": 698, "width": 47, "height": 20},
                {"type": "stn", "id": "site-1039", "text": "1039", "top": 682, "left": 746, "width": 47, "height": 20},
                {"type": "stn", "id": "site-1040", "text": "1040", "top": 682, "left": 794, "width": 47, "height": 20},
                {"type": "stn", "id": "site-1107", "text": "1", "top": 627, "left": 737, "width": 47, "height": 20},
                {"type": "stn", "id": "site-1107", "text": "2", "top": 627, "left": 800, "width": 47, "height": 20},
                {"type": "stn", "id": "site-1107", "text": "3", "top": 627, "left": 850, "width": 47, "height": 20},
                {"type": "stn", "id": "site-1107", "text": "4", "top": 627, "left": 900, "width": 47, "height": 20},
                {"type": "stn", "id": "site-1107", "text": "5", "top": 627, "left": 950, "width": 47, "height": 20},
                // {"type": "stn", "id": "site-1107", "text": "1", "top": 627, "left": 737, "width": 47, "height": 20},
                // {"type": "stn", "id": "site-1107", "text": "2", "top": 627, "left": 800, "width": 47, "height": 20},
                // {"type": "stn", "id": "site-1107", "text": "3", "top": 627, "left": 850, "width": 47, "height": 20},
                // {"type": "stn", "id": "site-1107", "text": "4", "top": 627, "left": 900, "width": 47, "height": 20},
                // {"type": "stn", "id": "site-1107", "text": "5", "top": 627, "left": 950, "width": 47, "height": 20},
            ]
        }]
    }]
src/main/webapp/views/console.html
@@ -595,40 +595,25 @@
                    for (var i = 0; i < crns.length; i++) {
                        var crnEl = $("#crn-" + crns[i].crnId);
                        crnEl.attr("class", "machine " + crns[i].crnStatus);
                        var unit = 31;//($('.item').eq(0).width() + 13) / 2;
                        if (crns[i].bay < 0 || crns[i].bay === -2) {
                            crns[i].bay = 1
                        if (crns[i].bay < 0) {
                            crns[i].bay = 1;
                        }
                        // crnEl.animate({left: (crns[i].bay * unit) + 'px'}, 1000);
                        // crns[i].bay = 15;
                        var offSet = 1450;
                        // switch (i) 5
                        //     case 0:
                        //     case 1:
                        //     case 2:
                        //     case 3:
                        //         unit = 35;
                        //         offSet = 500;
                        //         break;
                        //     case 5:
                        //         unit = 124;
                        //         offSet = 550;
                        //         break;
                        //     case 4:
                        //     case 6:
                        //         unit = 62;
                        //         offSet = 550;
                        //         break;
                        // }
                        console.log(offSet)
                        if(crns[i].bay === 1){
                            crnEl.animate({left: offSet + 'px'}, 1000);
                        let unit = 20
                        if (crns[i].crnId === 4) {
                            let offSet = 960;
                            if(crns[i].bay === 1){
                                crnEl.animate({left: offSet + 'px'}, 1000);
                            } else {
                                crnEl.animate({left: (offSet + unit*(crns[i].bay-1)) + 'px'}, 1000);
                            }
                        } else {
                            let lf = (offSet - crns[i].bay * 42);
                            crnEl.animate({left: lf + 'px'}, 1000);
                            let offSet = 450;
                            if(crns[i].bay === 1){
                                crnEl.animate({left: offSet + 'px'}, 1000);
                            } else {
                                crnEl.animate({left: (offSet + unit*(crns[i].bay -1)) + 'px'}, 1000);
                            }
                        }
                    }
                } else if (res.code === 403) {
                    parent.location.href = baseUrl + "/login";
src/main/webapp/views/control.html
@@ -84,7 +84,7 @@
    </main>
    <footer class="footer">
        Copyright © 2023 All Rights Reserved. <a href="http://www.zoneyung.com" target="_blank">浙江中扬立库技术有限公司</a>  保留所有权利
<!--        Copyright © 2023 All Rights Reserved. <a href="http://www.zoneyung.com" target="_blank">浙江中扬立库技术有限公司</a>  保留所有权利-->
    </footer>
</body>
src/main/webapp/views/index.html
@@ -34,7 +34,7 @@
<!-- 主体内容 -->
<iframe id="content" src="console.html"></iframe>
<footer class="footer">
    Copyright © 2024 All Rights Reserved. <a href="http://www.zoneyung.com" target="_blank">浙江中扬立库技术有限公司</a>  保留所有权利
<!--    Copyright © 2024 All Rights Reserved. <a href="http://www.zoneyung.com" target="_blank">浙江中扬立库技术有限公司</a>  保留所有权利-->
</footer>
</body>
<script>
@@ -70,7 +70,7 @@
                // , control:false
                , opacity:0.9
                , border:false
                , icon:'<img src="../static/images/favicon.ico" style="height:22px;display:block;"  alt=""/>'
                // , icon:'<img src="../static/images/favicon.ico" style="height:22px;display:block;"  alt=""/>'
                , stickMenu:true
                , maxMenu:false
                , closeMenu:false
src/main/webapp/views/indexTV.html
@@ -41,7 +41,7 @@
<!-- 主体内容 -->
<iframe id="content" src="console.html"></iframe>
<footer class="footer">
    Copyright © 2023 All Rights Reserved. <a href="http://www.zoneyung.com" target="_blank">浙江中扬立库技术有限公司</a>  保留所有权利
<!--    Copyright © 2023 All Rights Reserved. <a href="http://www.zoneyung.com" target="_blank">浙江中扬立库技术有限公司</a>  保留所有权利-->
</footer>
</body>
<script>