自动化立体仓库 - WCS系统
zjj
2023-12-22 7ba042f4fb701de6916594962116a49b05491178
Merge remote-tracking branch 'origin/mdqdwcs' into mdqdwcs
8个文件已修改
201 ■■■■■ 已修改文件
src/main/java/com/zy/asrs/controller/ConsoleController.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/domain/vo/SiteLatestDataVo.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java 28 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/common/model/SearchLocParam.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/core/model/DevpSlave.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/core/model/protocol/StaProtocol.java 11 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/core/thread/SiemensDevpThread.java 145 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/application.yml 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/controller/ConsoleController.java
@@ -108,7 +108,6 @@
            vo.setSiteId(String.valueOf(entry.getKey())); // 站点编号
            vo.setWorkNo(staProtocol.getWorkNo()); // 工作号
            vo.setSiteStatus(SiteStatusType.process(staProtocol));  // 状态
            vo.setNearbySta(staProtocol.getNearbySta());
            vos.add(vo);
        }
        return R.ok().add(vos);
src/main/java/com/zy/asrs/domain/vo/SiteLatestDataVo.java
@@ -19,9 +19,6 @@
    // 站点状态
    private SiteStatusType siteStatus;
    // 隔壁站点(台车特性)
    private String nearbySta;
    public String getSiteStatus() {
        return siteStatus.toString().toLowerCase().replaceAll("_", "-");
    }
src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
@@ -179,7 +179,6 @@
                        param.setIoType(1);
                        param.setSourceStaNo(inSta.getStaNo());
                        param.setLocType1(locTypeDto.getLocType1());
                        param.setFull(staProtocol.isFull());
                        String response = new HttpHandler.Builder()
                                .setUri(wmsUrl)
                                .setPath("/rpc/pakin/loc/v1")
@@ -2215,12 +2214,11 @@
     * 扫描碟盘机自动入库空托盘
     */
    public synchronized void autoEmptyIn() {
        for (CrnSlave crnSlave : slaveProperties.getCrn()) {
            // 遍历空板入库口
            for (CrnSlave.CrnStn emptyInStn : crnSlave.getEmptyCrnInStn()) {
        for (DevpSlave slave : slaveProperties.getDevp()) {
            for (DevpSlave.Sta sta : slave.getAutoEmptyIn()) {
                // 获取空板入库站信息
                SiemensDevpThread devpThread = (SiemensDevpThread) SlaveConnection.get(SlaveType.Devp, emptyInStn.getDevpPlcId());
                StaProtocol staProtocol = devpThread.getStation().get(emptyInStn.getStaNo());
                SiemensDevpThread devpThread = (SiemensDevpThread) SlaveConnection.get(SlaveType.Devp, slave.getId());
                StaProtocol staProtocol = devpThread.getStation().get(sta.getStaNo());
                if (staProtocol == null) {
                    continue;
                } else {
@@ -2236,7 +2234,7 @@
                        SearchLocParam param = new SearchLocParam();
                        param.setIoType(10);
                        param.setSourceStaNo(emptyInStn.getStaNo());
                        param.setSourceStaNo(sta.getStaNo());
                        param.setLocType1(locTypeDto.getLocType1());
                        String response = new HttpHandler.Builder()
                                .setUri(wmsUrl)
@@ -2263,7 +2261,6 @@
                        e.printStackTrace();
                        TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
                    }
                }
            }
        }
@@ -2273,10 +2270,10 @@
     * 扫描拆盘机自动出库空托盘
     */
    public synchronized void autoEmptyOut() {
        for (CrnSlave crnSlave : slaveProperties.getCrn()) {
            for (CrnSlave.CrnStn emptyOutStn : crnSlave.getEmptyCrnOutStn()) {
                DevpThread devpThread = (DevpThread) SlaveConnection.get(SlaveType.Devp, emptyOutStn.getDevpPlcId());
                StaProtocol staProtocol = devpThread.getStation().get(emptyOutStn.getStaNo());
        for (DevpSlave slave : slaveProperties.getDevp()) {
            for (DevpSlave.Sta sta : slave.getAutoEmptyOut()) {
                DevpThread devpThread = (DevpThread) SlaveConnection.get(SlaveType.Devp, slave.getId());
                StaProtocol staProtocol = devpThread.getStation().get(sta.getStaNo());
                if (staProtocol == null) {
                    return;
                } else {
@@ -2285,16 +2282,16 @@
                if (staProtocol.isAutoing()  //自动
                        && !staProtocol.isLoading()  //无物
                        && staProtocol.isOutEnable()  //可出信号
                        && staProtocol.isEmptyPalletRequire()  //空托盘需求信号
                        && staProtocol.getWorkNo() == 0
                ) {
                    WrkMast pakoutEmpty = wrkMastMapper.selectPakoutEmpty(emptyOutStn.getStaNo());
                    WrkMast pakoutEmpty = wrkMastMapper.selectPakoutEmpty(sta.getStaNo());
                    if (null != pakoutEmpty) {
                        return;
                    }
                    try {
                        HashMap<String, Object> map = new HashMap<>();
                        map.put("crnNo", crnSlave.getId());
                        map.put("staNo", sta.getStaNo());//目标站
                        String response = new HttpHandler.Builder()
                                .setUri(wmsUrl)
                                .setParams(map)
@@ -2314,6 +2311,7 @@
                    }
                }
            }
        }
    }
src/main/java/com/zy/common/model/SearchLocParam.java
@@ -15,9 +15,6 @@
    private String barcode;
    // 托盘是可否整垛
    private boolean full;
    // 库位规格( 0:未知, 1:低库位, 2:中库位, 3:高库位 )
    private Short locType1;
src/main/java/com/zy/core/model/DevpSlave.java
@@ -27,6 +27,10 @@
    private List<Sta> pickSta = new ArrayList<>();
    private List<Sta> autoEmptyOut = new ArrayList<>();
    private List<Sta> autoEmptyIn = new ArrayList<>();
    @Data
    public static class Sta {
src/main/java/com/zy/core/model/protocol/StaProtocol.java
@@ -55,14 +55,8 @@
    // 锁定标记
    private boolean pakMk = true;
    // 入库暂存数
    private Short inQty;
    // 隔壁站点(台车位置)
    private String nearbySta;
    // 托盘是可否整垛
    private boolean full;
    //空托盘需求信号
    private boolean emptyPalletRequire;
    public BasDevp toSqlModel(){
        BasDevp basDevp = new BasDevp();
@@ -77,7 +71,6 @@
        basDevp.setLocType3((short) 0);  // 轻重类型{0:未知,1:轻库位,2:重库位}
        basDevp.setLocType1(high != low && low ? (short) 1 : (short) 2);
//        basDevp.
        basDevp.setInQty(inQty !=null ?(int)inQty : 0);
        return basDevp;
    }
src/main/java/com/zy/core/thread/SiemensDevpThread.java
@@ -43,35 +43,104 @@
    private Map<Integer, StaProtocol> station = new ConcurrentHashMap<>();
    private short heartBeatVal = 1;
//    public static final ArrayList<Integer> staNoseee1 = new ArrayList<Integer>() {{
//        add(1001);add(1002);add(1003);add(1004);add(1005);
//        add(1006);add(1007);add(1008);add(1009);add(1010);
//        add(1011);add(1012);add(1013);add(1014);add(1015);
//        add(1016);add(1017);add(1018);add(1019);add(1020);
//        add(1021);add(1022);add(1023);add(1024);add(1025);
//
//        add(2001);add(2002);add(2003);add(2004);add(2005);
//        add(2006);add(2007);add(2008);add(2009);add(2010);
//        add(2011);add(2012);add(2013);
//
//        add(2101);add(2102);add(2103);add(2104);add(2105);
//        add(2106);add(2107);add(2108);add(2109);add(2110);
//        add(2111);add(2112);add(2113);add(2114);
//
//        add(2301);add(2302);add(2303);add(2304);add(2305);
//        add(2306);
//
//        add(2401);add(2402);add(2403);
//
//        add(3001);add(3002);add(3003);add(3004);add(3005);
//        add(3006);add(3007);add(3008);add(3009);add(3010);
//        add(3011);add(3012);
//
//        add(4001);add(4002);add(4003);add(4004);add(4005);
//        add(4006);add(4007);
//
//        add(4010);add(4011);add(4012);add(4013);add(4014);
//        add(4015);add(4016);
//    }};
    public static final ArrayList<Integer> staNos1 = new ArrayList<Integer>() {{
        add(1001);add(1002);add(1003);add(1004);add(1005);
        add(1006);add(1007);add(1008);add(1009);add(1010);
        add(1011);add(1012);add(1013);add(1014);add(1015);
        add(1016);add(1017);add(1018);add(1019);add(1020);
        add(1021);add(1022);add(1023);add(1024);add(1025);
    }};
        add(2001);add(2002);add(2003);add(2004);add(2005);
        add(2006);add(2007);add(2008);add(2009);add(2010);
        add(2011);add(2012);add(2013);
    public static final ArrayList<Integer> staNos2 = new ArrayList<Integer>() {{
        add(2001);add(2002);add(2003);add(2004);add(2005);add(2006);
        add(2101);add(2102);add(2103);add(2104);add(2105);add(2106);add(2107);
        add(2301);add(2302);add(2303);add(2304);add(2305);add(2306);
    }};
        add(2101);add(2102);add(2103);add(2104);add(2105);
        add(2106);add(2107);add(2108);add(2109);add(2110);
        add(2111);add(2112);add(2113);add(2114);
        add(2301);add(2302);add(2303);add(2304);add(2305);
        add(2306);
    public static final ArrayList<Integer> staNos3 = new ArrayList<Integer>() {{
        add(2007);add(2008);add(2009);add(2010);add(2011);add(2012);add(2013);
        add(2108);add(2109);add(2110);add(2111);add(2112);add(2113);add(2114);
        add(2401);add(2402);add(2403);
    }};
    public static final ArrayList<Integer> staNos4 = new ArrayList<Integer>() {{
        add(3001);add(3002);add(3003);add(3004);add(3005);
        add(3006);add(3007);add(3008);add(3009);add(3010);
        add(3011);add(3012);
    }};
        add(4001);add(4002);add(4003);add(4004);add(4005);
        add(4006);add(4007);
    public static final ArrayList<Integer> staNos5 = new ArrayList<Integer>() {{
        add(4001);add(4002);add(4003);add(4004);add(4005);add(4006);add(4007);
    }};
        add(4010);add(4011);add(4012);add(4013);add(4014);
        add(4015);add(4016);
    public static final ArrayList<Integer> staNos6 = new ArrayList<Integer>() {{
        add(4010);add(4011);add(4012);add(4013);add(4014);add(4015);add(4016);
    }};
    public static final ArrayList<Integer> writeStaNos1 = new ArrayList<Integer>() {{
        add(1001);add(1002);add(1003);add(1004);add(1005);
        add(1006);add(1007);add(1008);add(1009);add(1010);
        add(1011);add(1012);add(1013);add(1014);add(1015);
        add(1016);add(1017);add(1018);add(1019);add(1020);
        add(1021);add(1022);add(1023);add(1024);add(1025);
    }};
    public static final ArrayList<Integer> writeStaNos2 = new ArrayList<Integer>() {{
        add(2001);add(2002);add(2003);
        add(2101);add(2102);add(2103);
        add(2301);
    }};
    public static final ArrayList<Integer> writeStaNos3 = new ArrayList<Integer>() {{
        add(2013);
        add(2114);
        add(2401);add(2402);
    }};
    public static final ArrayList<Integer> writeStaNos4 = new ArrayList<Integer>() {{
        add(3001);
        add(3007);
        add(3012);
    }};
    public static final ArrayList<Integer> writeStaNos5 = new ArrayList<Integer>() {{
        add(4001);add(4007);
    }};
    public static final ArrayList<Integer> writeStaNos6 = new ArrayList<Integer>() {{
        add(4010);add(4016);
    }};
    /**
@@ -97,6 +166,35 @@
        switch (slave.getId()) {
            case 1:
                return staNos1;
            case 2:
                return staNos2;
            case 3:
                return staNos3;
            case 4:
                return staNos4;
            case 5:
                return staNos5;
            case 6:
                return staNos6;
            default:
                throw new CoolException("获取站点失败!");
        }
    }
    private ArrayList<Integer> getWriteStaNo() {
        switch (slave.getId()) {
            case 1:
                return writeStaNos1;
            case 2:
                return writeStaNos2;
            case 3:
                return writeStaNos3;
            case 4:
                return writeStaNos4;
            case 5:
                return writeStaNos5;
            case 6:
                return writeStaNos6;
            default:
                throw new CoolException("获取站点失败!");
        }
@@ -190,6 +288,7 @@
                staProtocol.setFullPlt(status[5]);  // 满托盘
                staProtocol.setHigh(status[6]);     // 高库位
                staProtocol.setLow(status[7]);      // 低库位
                staProtocol.setEmptyPalletRequire(status[8]);      // 空托盘需求信号
                if (!staProtocol.isPakMk() && !staProtocol.isLoading()) {
                    staProtocol.setPakMk(true);
@@ -248,7 +347,7 @@
        if (null == staProtocol) {
            return;
        }
        ArrayList<Integer> staNos = getStaNo();
        ArrayList<Integer> staNos = getWriteStaNo();
        int index = staNos.indexOf(staProtocol.getSiteId());
        OperateResult write = siemensS7Net.Write("DB100." + index*6, staProtocol.getWorkNo().intValue());    // 工作号
        Thread.sleep(500);
@@ -264,22 +363,6 @@
        } else {
            OutputQueue.DEVP.offer(MessageFormat.format("【{0}】 输送线命令下发 [id:{1}] >>>>> {2}", DateUtils.convert(new Date()), slave.getId(), JSON.toJSON(staProtocol)));
            log.info("输送线命令下发 [id:{}] >>>>> 命令下发: {}",  slave.getId(), JSON.toJSON(staProtocol));
        }
    }
    // 更新入出库模式
    private void updateIoMode() throws InterruptedException {
        if (slave.getId() == 1 && this.ioModeOf1F1 != IoModeType.NONE) {
            if (!siemensS7Net.Write("DB100.120", this.ioModeOf1F1.id).IsSuccess) {
                OutputQueue.DEVP.offer(MessageFormat.format("【{0}】写入输送线1F1入出库模式失败。输送线plc编号={1}", slave.getId()));
                log.error("写入输送线1F1入出库模式失败。输送线plc编号={}", slave.getId());
            }
        }
        if (slave.getId() == 1 && this.ioModeOf1F2 != IoModeType.NONE) {
            if (!siemensS7Net.Write("DB100.122", this.ioModeOf1F2.id).IsSuccess) {
                OutputQueue.DEVP.offer(MessageFormat.format("【{0}】写入输送线1F2入出库模式失败。输送线plc编号={1}", slave.getId()));
                log.error("写入输送线1F2入出库模式失败。输送线plc编号={}", slave.getId());
            }
        }
    }
src/main/resources/application.yml
@@ -180,6 +180,12 @@
      barcode: ${wcs-slave.barcode[2].id}
      backSta: 3012
      led: ${wcs-slave.led[5].id}
    # 拆盘机出空托
    autoEmptyOut[0]:
      staNo: 1007
    # 拆盘机入空托
    autoEmptyIn[0]:
      staNo: 1007
  # RGV1
#  rgv[0]: