自动化立体仓库 - WCS系统
#
tqs
2022-09-07 470962be1cfdbf75b734ab8f78e28a7b23a06964
#
3个文件已修改
24 ■■■■■ 已修改文件
src/main/java/com/zy/core/model/DevpSlave.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/core/thread/ScaleThread.java 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/application.yml 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/core/model/DevpSlave.java
@@ -34,6 +34,7 @@
        private Integer barcode;
        private Integer scale;
    }
}
src/main/java/com/zy/core/thread/ScaleThread.java
@@ -1,6 +1,9 @@
package com.zy.core.thread;
import com.core.common.Cools;
import com.core.common.SpringUtils;
import com.zy.asrs.entity.BasDevp;
import com.zy.asrs.service.BasDevpService;
import com.zy.core.Slave;
import com.zy.core.ThreadHandler;
import lombok.Data;
@@ -43,6 +46,19 @@
                    String s = new String(read);
                    if (!Cools.isEmpty(s) && s.startsWith("=")) {
                        scale = Double.parseDouble(s.substring(1));
                        //将称重重量写入设备基础数据中的gross_wt字段
                        if(scale > 20) {
                            BasDevpService basDevpService = SpringUtils.getBean(BasDevpService.class);
                            Integer staNo = slave.getId() == 1 ? 101 : 201;
                            BasDevp basDevp = basDevpService.selectById(staNo);
                            if(!Cools.isEmpty(basDevp)) {
                                basDevp.setGrossWt(scale);
                                if (null != basDevpService && !basDevpService.updateById(basDevp)) {
                                    throw new Exception("更新数据库数据失败");
                                }
                            }
                        }
                    }
                }
                Thread.sleep(100);
src/main/resources/application.yml
@@ -131,10 +131,12 @@
    inSta[0]:
      staNo: 101
      barcode: ${wcs-slave.barcode[0].id}
      scale: ${wcs-slave.scale[0].id}
    # 入库口2
    inSta[1]:
      staNo: 201
      barcode: ${wcs-slave.barcode[1].id}
      scale: ${wcs-slave.scale[1].id}
    # 空板入库口1
    emptyInSta[0]:
      staNo: 101
@@ -160,4 +162,9 @@
  scale[0]:
    id: 1
    ip: 10.10.10.201
    port: 5005
  # 磅秤
  scale[1]:
    id: 2
    ip: 10.10.10.201
    port: 5005