zwl
2025-07-07 d0a82572324e161d140f17321bcb716233e885ea
新增称重功能
5个文件已修改
192 ■■■■ 已修改文件
src/main/java/com/zy/asrs/entity/param/StorageEscalationParam.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/core/ServerBootstrap.java 14 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/core/thread/ScaleThread.java 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/application-prod.yml 162 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/entity/param/StorageEscalationParam.java
@@ -16,4 +16,7 @@
    private int LocType = 0;
    //站点
    private int TerminalNo = 0;
    //重量
    private double weight = 0.0;
}
src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
@@ -38,6 +38,7 @@
import com.zy.core.properties.SlaveProperties;
import com.zy.core.thread.BarcodeThread;
import com.zy.core.thread.LedThread;
import com.zy.core.thread.ScaleThread;
import com.zy.core.thread.SiemensDevpThread;
import com.zy.system.entity.Config;
import com.zy.system.service.ConfigService;
@@ -340,6 +341,7 @@
                        errMsg = "扫码失败";
                        back = true;
                    }
                    // 判断是否满足入库条件
                    if (staProtocol.isAutoing() && staProtocol.isLoading()
                            && staProtocol.isInEnable()
@@ -374,6 +376,10 @@
                            }
                        }
                        ScaleThread scaleThread = (ScaleThread) SlaveConnection.get(SlaveType.Scale, inSta.getBarcode());
                        if(scaleThread != null) {
                            storageEscalationParam.setWeight(scaleThread.getScale());
                        }
                        storageEscalationParam.setBoxNo(BoxNo);
                        //是否满板 1满板  0空板
src/main/java/com/zy/core/ServerBootstrap.java
@@ -102,13 +102,13 @@
            new Thread(ledThread).start();
            SlaveConnection.put(SlaveType.Led, led.getId(), ledThread);
        }
//        // 初始化磅秤线程
//        log.info("初始化磅秤线程...................................................");
//        for (Slave scale : slaveProperties.getScale()) {
//            ScaleThread scaleThread = new ScaleThread(scale);
//            new Thread(scaleThread).start();
//            SlaveConnection.put(SlaveType.Scale, scale.getId(), scaleThread);
//        }
        // 初始化磅秤线程
        log.info("初始化磅秤线程...................................................");
        for (Slave scale : slaveProperties.getScale()) {
            ScaleThread scaleThread = new ScaleThread(scale);
            new Thread(scaleThread).start();
            SlaveConnection.put(SlaveType.Scale, scale.getId(), scaleThread);
        }
    }
src/main/java/com/zy/core/thread/ScaleThread.java
@@ -49,7 +49,8 @@
                byte[] read = read(8, 100);
                if (null != read) {
                    String s = new String(read);
                    if (!Cools.isEmpty(s) && s.startsWith("=")) {
                    s=s.substring(1);
                    if (!Cools.isEmpty(s) && s.startsWith("+")) {
                        scale = Double.parseDouble(s.substring(1));
                        //将称重重量写入设备基础数据中的gross_wt字段
@@ -94,13 +95,9 @@
            dataOutputStream = new DataOutputStream(socket.getOutputStream());
            dataInputStream = new DataInputStream(socket.getInputStream());
//            log.info("条码扫描仪连接成功 ===>> [id:{}] [ip:{}] [port:{}]", slave.getId(), slave.getIp(), slave.getPort());
            DeviceErrorService deviceErrorService = SpringUtils.getBean(DeviceErrorService.class);
            deviceErrorService.deleteDeviceError("scale", slave.getId());
        } catch (Exception e) {
            socket = null;
            log.error("磅秤连接失败!!! ===>> [id:{}] [ip:{}] [port:{}]", slave.getId(), slave.getIp(), slave.getPort());
            DeviceErrorService deviceErrorService = SpringUtils.getBean(DeviceErrorService.class);
            deviceErrorService.addDeviceError("scale", slave.getId(), "磅秤连接失败");
            return false;
        }
        return true;
src/main/resources/application-prod.yml
@@ -169,6 +169,7 @@
      backSta: 1015
      barcode: ${wcs-slave.barcode[0].id}
      led: ${wcs-slave.led[2].id}
      scale: ${wcs-slave.scale[0].id}
    outSta[0]: #出库口1
      staNo: 1019
    outSta[1]: #出库口2
@@ -188,6 +189,7 @@
      backSta: 2006
      barcode: ${wcs-slave.barcode[1].id}
      led: ${wcs-slave.led[8].id}
      scale: ${wcs-slave.scale[1].id}
    outSta[0]: #出库口1
      staNo: 2001
    outSta[1]: #出库口2
@@ -203,6 +205,7 @@
      backSta: 1051
      barcode: ${wcs-slave.barcode[2].id}
      led: ${wcs-slave.led[0].id}
      scale: ${wcs-slave.scale[2].id}
    inSta[1]: #空板入库口0
        staNo: 1058
    outSta[0]: #出库口1
@@ -221,6 +224,7 @@
      backSta: 2055
      barcode: ${wcs-slave.barcode[3].id}
      led: ${wcs-slave.led[4].id}
      scale: ${wcs-slave.scale[3].id}
    outSta[0]: #出库口1
      staNo: 1053
    outSta[1]: #出库口1
@@ -331,143 +335,25 @@
    port: 5005
    devpPlcId: ${wcs-slave.devp[1].id}
    staArr: 2018
#  crn[0]: #堆垛机1
#    rack: 0
#    offset: 2    #偏移量,当堆垛机站点列号=1时,偏移量=2
#    port: 102
#    crnOutStn[0]:    #堆垛机出库站点
#      staNo: 101
#      row: 2
#      bay: 1
#      lev: 1
#      devpPlcId: ${wcs-slave.devp[0].id}
#    ip: 192.168.1.100
#    crnInStn[0]:    #堆垛机入库站点1
#      staNo: 100
#      row: 1
#      bay: 1
#      lev: 1
#      devpPlcId: ${wcs-slave.devp[0].id}
#    id: 1
#    slot: 0
#    demo: false
#  crn[1]: #堆垛机2
#    rack: 0
#    offset: 2    #偏移量,当堆垛机站点列号=1时,偏移量=2
#    port: 102
#    crnOutStn[0]:    #堆垛机出库站点
#      staNo: 103
#      row: 5
#      bay: 1
#      lev: 1
#      devpPlcId: ${wcs-slave.devp[0].id}
#    ip: 192.168.1.110
#    crnInStn[0]:    #堆垛机入库站点1
#      staNo: 102
#      row: 4
#      bay: 1
#      lev: 1
#      devpPlcId: ${wcs-slave.devp[0].id}
#    id: 2
#    slot: 0
#    demo: false
#  barcode[3]: #条码扫描仪4
#    port: 51236
#    ip: 10.10.10.52
#    id: 4
#  barcode[2]: #条码扫描仪3
#    port: 51236
#    ip: 10.10.10.52
#    id: 3
#
#  barcode[1]: #条码扫描仪2
#    port: 51236
#    ip: 10.10.10.52
#    id: 2
#
#  devp[0]: #输送线
#    emptyInSta[2]: #空板入库口3
#      staNo: 104
#    emptyInSta[1]: #空板入库口2
#      staNo: 102
#    rack: 0
#    emptyInSta[0]: #空板入库口1
#      staNo: 100
#    ip: 192.168.1.140
#    outSta[4]: #出库口5
#      staNo: 104
#    outSta[3]: #出库口4
#      staNo: 103
#    outSta[6]: #出库口7
#      staNo: 106
#    slot: 0
#    outSta[5]: #出库口6
#      staNo: 105
#    outSta[0]: #出库口1
#      staNo: 100
#    outSta[2]: #出库口3
#      staNo: 102
#    emptyInSta[3]: #空板入库口4
#      staNo: 106
#    outSta[1]: #出库口2
#      staNo: 101
#    inSta[2]:
#      staNo: 104
#      barcode: ${wcs-slave.barcode[2].id}
#    inSta[3]:
#      staNo: 106
#      barcode: ${wcs-slave.barcode[3].id}
#    port: 102
#    outSta[7]: #出库口8
#      staNo: 107
#    inSta[0]: #入库口1
#      staNo: 100
#      barcode: ${wcs-slave.barcode[0].id}
#    inSta[1]: #入库口2
#      staNo: 102
#      barcode: ${wcs-slave.barcode[1].id}
#    id: 1
#
#
#  crn[2]: #堆垛机3
#    rack: 0
#    offset: 2    #偏移量,当堆垛机站点列号=1时,偏移量=2
#    port: 102
#    crnOutStn[0]:    #堆垛机出库站点
#      staNo: 105
#      row: 9
#      bay: 1
#      lev: 1
#      devpPlcId: ${wcs-slave.devp[0].id}
#    ip: 192.168.1.120
#    crnInStn[0]:    #堆垛机入库站点1
#      staNo: 104
#      row: 8
#      bay: 1
#      lev: 1
#      devpPlcId: ${wcs-slave.devp[0].id}
#    id: 3
#    slot: 0
#    demo: false
#  crn[3]: #堆垛机4
#    rack: 0
#    offset: 2    #偏移量,当堆垛机站点列号=1时,偏移量=2
#    port: 102
#    crnOutStn[0]:    #堆垛机出库站点
#      staNo: 107
#      row: 12
#      bay: 1
#      lev: 1
#      devpPlcId: ${wcs-slave.devp[0].id}
#    ip: 192.168.1.130
#    crnInStn[0]:    #堆垛机入库站点1
#      staNo: 106
#      row: 11
#      bay: 1
#      lev: 1
#      devpPlcId: ${wcs-slave.devp[0].id}
#    id: 4
#    slot: 0
#    demo: false
  # 磅秤 半成品一楼 192.168.110.24
  scale[0]:
    id: 1
    ip: 192.168.110.24
    port: 5005
  # 磅秤 半成品2楼 192.168.110.23
  scale[1]:
    id: 2
    ip: 192.168.110.23
    port: 5005
  # 磅秤 成品库一楼192.168.110.21
  scale[2]:
    id: 3
    ip: 192.168.110.21
    port: 5005
  # 磅秤 成品库2楼 192.168.110.22
  scale[3]:
    id: 4
    ip: 192.168.110.22
    port: 5005