*
lsh
2025-04-28 184980deb3f854a98eb112e7998875113ebbba9a
*
9个文件已修改
125 ■■■■ 已修改文件
src/main/java/com/zy/asrs/entity/ToWmsDTO.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java 13 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/common/model/MatDto.java 23 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/core/DevpThread.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/core/Slave.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/core/model/protocol/StaProtocol.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/core/thread/ScaleThread.java 56 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/core/thread/SiemensDevpThread.java 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/application-prod.yml 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/entity/ToWmsDTO.java
@@ -24,6 +24,7 @@
    //库位类型
    private Integer locType;
    private Integer status;//空满版
    private Double grossWt;
//    public ToWmsDTO(String barcode, Integer stationCode, Integer locType){
//        this.barcode = barcode;
@@ -37,6 +38,13 @@
        this.status = status;
    }
    public ToWmsDTO(Integer stationCode, Double grossWt, String barcode, Integer status) {
        this.stationCode = stationCode;
        this.grossWt = grossWt;
        this.barcode = barcode;
        this.status = status;
    }
    public ToWmsDTO(){
    }
src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
@@ -194,7 +194,7 @@
                        String barcode = barcodeThread.getBarcode();
                        if (!Cools.isEmpty(barcode) && !barcode.equals("99999999")) {
                            // 请求wms接口,获取工作号和目标库位
                            ToWmsDTO toWmsDTO = new ToWmsDTO(barcode, staProtocol.getSiteId(), 0);
                            ToWmsDTO toWmsDTO = new ToWmsDTO(staProtocol.getSiteId(),staProtocol.getGrossWt(),barcode, 0);
                            TaskWrk taskWrk1 = taskWrkService.selectOne(new EntityWrapper<TaskWrk>().eq("barcode", barcode));
                            if (!Cools.isEmpty(taskWrk1)) {
                                log.info("托盘码:" + barcode + "任务档存在");
@@ -1665,8 +1665,17 @@
                }
                // 获取工作档数据
                LedCommand ledCommand = new LedCommand();
                //请求wms
//
//                ledCommand.setWorkNo(wrkMast.getWrkNo());
//                ledCommand.setIoType(wrkMast.getIoType());
//                ledCommand.setTitle("空板出库");
//                ledCommand.setEmptyMk(true);
//                ledCommand.setSourceLocNo(wrkMast.getSourceLocNo());
//                ledCommand.setLocNo(wrkMast.getLocNo());
//                ledCommand.setStaNo(wrkMast.getStaNo());
                MatDto matDto = new MatDto();
                ledCommand.getMatDtos().add(matDto);
                commands.add(ledCommand);
            }
            Set<Integer> workNos = wrkMasts.stream().map(WrkMast::getWrkNo).collect(Collectors.toSet());
src/main/java/com/zy/common/model/MatDto.java
@@ -8,21 +8,34 @@
@Data
public class MatDto {
    // 物料编号
    private String matNo;
    private String matnr;
    // 物料名称
    private String maknx;
    private String maktx;
    // 库位规格
    private String specs;
    // 物料数量
    private Double count;
    // 库位数量
    private Double total;
    //工序
    private String sku;
    public MatDto() {
    }
    public MatDto(String matNo, String maknx, Double count) {
        this.matNo = matNo;
        this.maknx = maknx;
    public MatDto(String matnr, String maktx, String specs, Double count, Double total, String sku) {
        this.matnr = matnr;
        this.maktx = maktx;
        this.specs = specs;
        this.count = count;
        this.total = total;
        this.sku = sku;
    }
}
src/main/java/com/zy/core/DevpThread.java
@@ -10,5 +10,6 @@
    void setPakMk(Integer siteId, boolean pakMk);
    void setPakMkWalk(Integer siteId, boolean pakMkWalk);
    void setGrossWt(Integer siteId, Double grossWt);
}
src/main/java/com/zy/core/Slave.java
@@ -14,4 +14,9 @@
    private Integer port;
    private Integer staNo;
    // 输送线plc编号
    private Integer devpPlcId;
}
src/main/java/com/zy/core/model/protocol/StaProtocol.java
@@ -84,6 +84,7 @@
    //指令ID
    private Integer commandId;
    private Double grossWt;
    public BasDevp toSqlModel(){
        BasDevp basDevp = new BasDevp();
src/main/java/com/zy/core/thread/ScaleThread.java
@@ -7,9 +7,13 @@
import com.zy.asrs.entity.BasDevp;
import com.zy.asrs.service.BasDevpService;
import com.zy.asrs.service.DeviceErrorService;
import com.zy.core.DevpThread;
import com.zy.core.Slave;
import com.zy.core.ThreadHandler;
import com.zy.core.cache.OutputQueue;
import com.zy.core.cache.SlaveConnection;
import com.zy.core.enums.SlaveType;
import com.zy.core.model.protocol.StaProtocol;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
@@ -52,25 +56,47 @@
                    if (!Cools.isEmpty(s) && s.startsWith("=")) {
                        scale = Double.parseDouble(s.substring(1));
//                        String substring = s.substring(1);
//                        String s1 = new StringBuilder(substring).reverse().toString();//逆序
//                        scale = Double.parseDouble(s1);
                        //将称重重量写入设备基础数据中的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("更新数据库数据失败");
                            try{
                                // 获取站信息
                                DevpThread devpThread = (DevpThread) SlaveConnection.get(SlaveType.Devp, slave.getDevpPlcId());
                                StaProtocol staProtocol = devpThread.getStation().get(slave.getStaNo());
                                if (staProtocol != null) {
                                    devpThread.setGrossWt(staProtocol.getSiteId(), scale);
                                    JSONObject jsonObject = new JSONObject();
                                    jsonObject.put("time", DateUtils.convert(new Date(), DateUtils.yyyyMMddHHmmss_F));
                                    jsonObject.put("id", slave.getStaNo());
                                    jsonObject.put("scale", scale);
                                    if (OutputQueue.SCALE.size() >= 32) {
                                        OutputQueue.SCALE.poll();
                                    }
                                    OutputQueue.SCALE.offer(jsonObject);
                                }
                                JSONObject jsonObject = new JSONObject();
                                jsonObject.put("time", DateUtils.convert(new Date(), DateUtils.yyyyMMddHHmmss_F));
                                jsonObject.put("id", staNo);
                                jsonObject.put("scale", scale);
                                if (OutputQueue.SCALE.size() >= 32) {
                                    OutputQueue.SCALE.poll();
                                }
                                OutputQueue.SCALE.offer(jsonObject);
                            } catch (Exception e){
                                log.error("称重模块异常"+e.getMessage());
                            }
//                            BasDevpService basDevpService = SpringUtils.getBean(BasDevpService.class);
//                            BasDevp basDevp = basDevpService.selectById(slave.getStaNo());
//                            if(!Cools.isEmpty(basDevp)) {
//                                basDevp.setGrossWt(scale);
//                                if (null != basDevpService && !basDevpService.updateById(basDevp)) {
//                                    throw new Exception("更新数据库数据失败");
//                                }
//                                JSONObject jsonObject = new JSONObject();
//                                jsonObject.put("time", DateUtils.convert(new Date(), DateUtils.yyyyMMddHHmmss_F));
//                                jsonObject.put("id", slave.getStaNo());
//                                jsonObject.put("scale", scale);
//                                if (OutputQueue.SCALE.size() >= 32) {
//                                    OutputQueue.SCALE.poll();
//                                }
//                                OutputQueue.SCALE.offer(jsonObject);
//
//                            }
                        }
                    }
                }
src/main/java/com/zy/core/thread/SiemensDevpThread.java
@@ -412,6 +412,17 @@
        }
    }
    /**
     * 设置入库标记
     */
    @Override
    public void setGrossWt(Integer siteId, Double grossWt) {
        StaProtocol staProtocol = station.get(siteId);
        if (null != staProtocol) {
            staProtocol.setGrossWt(grossWt);
        }
    }
    @Override
    public void close() {
        siemensS7Net.ConnectClose();
src/main/resources/application-prod.yml
@@ -120,6 +120,13 @@
    port: 51236
    ip: 10.10.10.52
    id: 3
    # 磅秤
  scale[0]:
    id: 1
    ip: 10.10.10.207
    port: 5005
    staNo: 281
    devpPlcId: 1
  crn[0]: #堆垛机1
    ip: 192.168.4.250
    id: 1