-
admin
2024-05-08 4a5f2a21686b42761cccb4c64a6fcaaf778f071a
-
已修改9个文件
222 ■■■■ 文件已修改
jcdm-main/src/main/java/com/jcdm/main/bs/formulaChild/service/impl/BsFormulaChildInfoServiceImpl.java 24 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jcdm-main/src/main/java/com/jcdm/main/da/paramCollection/controller/DaParamCollectionController.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jcdm-main/src/main/java/com/jcdm/main/da/paramCollection/service/IDaParamCollectionService.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jcdm-main/src/main/java/com/jcdm/main/da/paramCollection/service/impl/DaParamCollectionServiceImpl.java 30 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jcdm-main/src/main/java/com/jcdm/main/om/productionOrde/service/impl/OmProductionOrdeInfoServiceImpl.java 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jcdm-main/src/main/java/com/jcdm/main/plcserver/sub/OPCUaSubscription.java 57 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jcdm-ui/src/api/main/da/paramCollection/paramCollection.js 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jcdm-ui/src/views/main/kb/preInstalledTerminal/index.vue 49 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jcdm-ui/src/views/main/kb/stationTerminal/index.vue 34 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jcdm-main/src/main/java/com/jcdm/main/bs/formulaChild/service/impl/BsFormulaChildInfoServiceImpl.java
@@ -211,6 +211,14 @@
            bsFormulaChildInfos.get(0).setResults("OK");
            bsFormulaChildInfos.get(0).setCollectData(bsFormulaChildInfo.getTightenTheArray());
            bsFormulaChildInfoMapper.updateBsFormulaChildInfo(bsFormulaChildInfos.get(0));
            Integer stepNumber = Integer.valueOf(bsFormulaChildInfos.get(0).getStepSort());
            try {
                miloService.writeToOpcShort(ReadWriteEntity.builder().identifier("PACK."+bsFormulaChildInfo.getLocationCode()+".StepNumber").value(stepNumber).build());
            } catch (Exception e) {
                throw new RuntimeException(e);
            }
            String spareField4 = bsFormulaChildInfos.get(0).getSpareField4();
            if (spareField4 != null && !spareField4.isEmpty()) {
                // 执行操作
@@ -258,6 +266,14 @@
            bsFormulaChildInfo.setParamCode(bsFormulaChildInfos.get(0).getParamCode());
            bsFormulaChildInfo.setSfcBarcode(bsFormulaChildInfo.getSfcBarcode());
            addParameterCollection(bsFormulaChildInfo);
//            Integer stepNumber = Integer.valueOf(bsFormulaChildInfos.get(0).getStepSort());
//            try {
//                miloService.writeToOpcShort(ReadWriteEntity.builder().identifier("PACK."+bsFormulaChildInfo.getLocationCode()+".StepNumber").value(stepNumber).build());
//            } catch (Exception e) {
//                throw new RuntimeException(e);
//            }
            if (spareField4 != null && !spareField4.isEmpty()) {
                // 执行操作
                if(bsFormulaChildInfos.get(0).getSpareField4().equals("1")){
@@ -326,6 +342,14 @@
            bsFormulaChildInfos.get(0).setResults("OK");
            bsFormulaChildInfos.get(0).setCollectData(bsFormulaChildInfo.getTightenTheArray());
            bsFormulaChildInfoMapper.updateBsFormulaChildInfo(bsFormulaChildInfos.get(0));
            Integer stepNumber = Integer.valueOf(bsFormulaChildInfos.get(0).getStepSort());
            try {
                miloService.writeToOpcShort(ReadWriteEntity.builder().identifier("PACK."+bsFormulaChildInfo.getLocationCode()+".StepNumber").value(stepNumber).build());
            } catch (Exception e) {
                throw new RuntimeException(e);
            }
            String spareField4 = bsFormulaChildInfos.get(0).getSpareField4();
            if (spareField4 != null && !spareField4.isEmpty()) {
                // 执行操作
jcdm-main/src/main/java/com/jcdm/main/da/paramCollection/controller/DaParamCollectionController.java
@@ -87,6 +87,15 @@
    }
    /**
     * 基础参数增加
     */
    @PostMapping("/yzAddBasicParameters")
    public void yzAddBasicParameters(@RequestBody DaParamCollection daParamCollection)
    {
        daParamCollectionService.yzAddBasicParameters(daParamCollection);
    }
    /**
     * 拧紧参数增加
     */
    @PostMapping("/addTighteningParameters")
jcdm-main/src/main/java/com/jcdm/main/da/paramCollection/service/IDaParamCollectionService.java
@@ -72,4 +72,6 @@
    void insertBatch(List<DaParamCollection> confList);
    void replaceAssemblyCode(DaParamCollection daParamCollection);
    void yzAddBasicParameters(DaParamCollection daParamCollection);
}
jcdm-main/src/main/java/com/jcdm/main/da/paramCollection/service/impl/DaParamCollectionServiceImpl.java
@@ -283,4 +283,34 @@
        }
    }
    @Override
    public void yzAddBasicParameters(DaParamCollection daParamCollection) {
        // 假设这是从数据库或其他地方获取的参数数据
        Map<String, String> map = new HashMap<>();
//        map.put("GC", "南浔工厂");
//        map.put("CXBH", "Pack线");
//        map.put("SBBH", "设备001");
//        map.put("YGBH", "员工001");
//        map.put("GDBH", daParamCollection.getWorkOrderNo());
//        map.put("CPXH", daParamCollection.getModel());
        map.put("INT", DateUtil.formatDateTime(new Date()));
        map.forEach((key, value) -> {
            DaCollectionParamConf daCollectionParamConf = new DaCollectionParamConf();
            daCollectionParamConf.setProcessesCode(daParamCollection.getLocationCode());
            daCollectionParamConf.setCollectParameterId(key);
            List<DaCollectionParamConf> daCollectionParamConfs = daCollectionParamConfMapper.selectDaCollectionParamConfList(daCollectionParamConf);
            DaParamCollection saveData = new DaParamCollection();
            saveData.setWorkOrderNo(daParamCollection.getWorkOrderNo());
            saveData.setProductCode(daParamCollection.getProductCode());
            saveData.setLocationCode(daParamCollection.getLocationCode());
            saveData.setSfcCode(daParamCollection.getProductBarcode());
            saveData.setParamCode(daCollectionParamConfs.get(0).getCollectParameterId());
            saveData.setParamName(daCollectionParamConfs.get(0).getCollectParameterName());
            saveData.setCollectionTime(new Date());
            saveData.setParamValue(value);
            daParamCollectionMapper.insertDaParamCollection(saveData);
        });
    }
}
jcdm-main/src/main/java/com/jcdm/main/om/productionOrde/service/impl/OmProductionOrdeInfoServiceImpl.java
@@ -168,7 +168,13 @@
    @Override
    public AjaxResult findBytrolleyYardGetOne(OmProductionOrdeInfo omProductionOrdeInfo) {
        String str = "";
        OmProductionOrdeInfo one = omProductionOrdeInfoService.getOne(new LambdaQueryWrapper<OmProductionOrdeInfo>().eq(OmProductionOrdeInfo::getTrolleyYard, omProductionOrdeInfo.getTrolleyYard()));
        return AjaxResult.success(one.getProductNum());
        if(one == null){
            str = "2";
        }else {
            str = one.getProductNum();
        }
        return AjaxResult.success(str);
    }
}
jcdm-main/src/main/java/com/jcdm/main/plcserver/sub/OPCUaSubscription.java
@@ -43,6 +43,9 @@
    //区分模组型号工位
    public List<String> distinguishingModules = Arrays.asList("OP300","OP310", "OP340", "OP350", "OP330");
    //区分小车码
    public List<String> agvId = Arrays.asList("OP360", "OP390", "OP470","OP280");
    //区分pack型号的工位
    public List<String> packIdList = Arrays.asList("OP280","OP360","OP390","OP470");
@@ -133,6 +136,17 @@
//                                    miloService.writeToOpcShort(ReadWriteEntity.builder().identifier(thoroughfare + "." + device + ".RecordDataDone").value(12).build());
//                                }
                            }else {
                                if(agvId.stream().anyMatch(s -> s.equals(device))){
                                    String agvId = miloService.readFromOpcUa(thoroughfare + "." + device + ".AGVID").getValue().toString();
                                    String PACKCode = thoroughfare + "." + device + ".MPACKCode";
                                    if (null != agvId) {
                                        OmProductionOrdeInfo one = omProductionOrdeInfoService.getOne(new LambdaQueryWrapper<OmProductionOrdeInfo>().eq(OmProductionOrdeInfo::getTrolleyYard, agvId));
                                        String packId = one.getProductNum();
                                        miloService.writeToOpcUa(ReadWriteEntity.builder().identifier(PACKCode).value(packId).build());
                                    } else {
                                        miloService.writeToOpcShort(ReadWriteEntity.builder().identifier(thoroughfare + "." + device + ".RecordDataDone").value(12).build());
                                    }
                                }
                                //pack 如果区分型号的话就要处理
                                //记录数据完成
                                String RecordDataDoneAddress = thoroughfare + "." + device + ".RecordDataDone";
@@ -181,7 +195,7 @@
                        List<ReadWriteEntity> list1 = miloService.readFromOpcUa(list);
                        List<Object> collect = list1.stream().map(ReadWriteEntity::getValue).collect(Collectors.toList());
                        String joinedString = String.join(",", collect.toString());
                        WebSocketUsers.sendMessageToUserByText(map.get(device), joinedString);
                        WebSocketUsers.sendMessageToUserByText(map.get(device), TightenTheConversionOkNg(joinedString));
                    }
                }
            }
@@ -411,4 +425,45 @@
        omProductionOrdeInfoService.saveOrUpdate(one);
    }
    public static void avgFunction(){
    }
    public static String TightenTheConversionOkNg(String param){
        // 去除首尾的方括号,然后按照逗号分割字符串
        String[] parts = param.substring(1, param.length() - 1).split(",");
        // 创建一个新的StringBuilder来构建替换后的字符串
        StringBuilder sb = new StringBuilder();
        sb.append('['); // 添加左方括号
        for (int i = 0; i < parts.length; i++) {
            String part = parts[i].trim(); // 去除可能的空格
            float value;
            try {
                value = Float.parseFloat(part); // 尝试将字符串转换为浮点数
                String replacement;
                if (value == 1f) {
                    replacement = "OK";
                } else if (value == 2f) {
                    replacement = "NG";
                } else {
                    replacement = part; // 如果不是1或2,则保持不变
                }
                sb.append(replacement);
                if (i < parts.length - 1) {
                    sb.append(','); // 添加逗号(除了最后一个元素)
                }
            } catch (NumberFormatException e) {
                // 如果转换失败,则保持原样(或进行其他错误处理)
                sb.append(part);
                if (i < parts.length - 1) {
                    sb.append(',');
                }
            }
        }
        sb.append(']'); // 添加右方括号
        return sb.toString();
    }
}
jcdm-ui/src/api/main/da/paramCollection/paramCollection.js
@@ -35,6 +35,15 @@
  })
}
// 新增设备产品过程参数采集
export function yzAddBasicParameters(data) {
  return request({
    url: '/main/paramCollection/yzAddBasicParameters',
    method: 'post',
    data: data
  })
}
// 线边总成换总成码
export function replaceAssemblyCode(data) {
  return request({
jcdm-ui/src/views/main/kb/preInstalledTerminal/index.vue
@@ -43,34 +43,7 @@
               </el-table-column>
             </el-table>
           </el-col>
<!--           <el-col :span="14">-->
<!--             <el-image style="height: 520px;width: 100%" :src="imgSrc"></el-image>-->
<!--           </el-col>-->
         </el-tab-pane>
<!--         <el-tab-pane name="second">-->
<!--           <span slot="label"> <b class="el-icon-date"></b>物料BOM</span>-->
<!--           <el-empty>-->
<!--             <span slot="description">暂无数据</span>-->
<!--           </el-empty>-->
<!--         </el-tab-pane>-->
<!--         <el-tab-pane name="third">-->
<!--           <span slot="label"> <b class="el-icon-date"></b>采集清单</span>-->
<!--           <el-empty>-->
<!--             <span slot="description">暂无数据</span>-->
<!--           </el-empty>-->
<!--         </el-tab-pane>-->
<!--         <el-tab-pane name="fourth">-->
<!--           <span slot="label"> <b class="el-icon-date"></b>安灯状态</span>-->
<!--           <el-empty>-->
<!--             <span slot="description">暂无数据</span>-->
<!--           </el-empty>-->
<!--         </el-tab-pane>-->
<!--         <el-tab-pane name="fifth">-->
<!--           <span slot="label"> <b class="el-icon-date"></b>工艺配方</span>-->
<!--           <el-empty>-->
<!--             <span slot="description">暂无数据</span>-->
<!--           </el-empty>-->
<!--         </el-tab-pane>-->
       </el-tabs>
     </el-col>
   </el-row>
@@ -233,7 +206,7 @@
  addParamCollection,
  addTighteningParameters,
  saveCampaignTimeParameters,
  replaceAssemblyCode,
  replaceAssemblyCode, yzAddBasicParameters,
} from "@/api/main/da/paramCollection/paramCollection";
export default {
@@ -288,7 +261,7 @@
      },
      content: '',
      activeName: 'first',
      url: "ws://192.168.2.248:8080/websocket/message/",
      url: "ws://192.168.2.76:8080/websocket/message/",
      message: "",
      text_content: "",
      ws: null,
@@ -369,6 +342,7 @@
        });
      }
    },
    Release(){
      // this.$message('portsList!'+this.portsList.length);
      if(this.btnType === "danger"){
@@ -433,23 +407,23 @@
    /** 查询工单列表 */
    async getList() {
      this.getListFormulaChild()
      // this.addOverStationCollection()
      this.addOverStationCollection()
    },
    /** 入站增加过站采集记录 **/
    addOverStationCollection(){
      this.passingStationForm = {
        id: null,
        workOrderNo: this.workpieceInformation.workOrderNo,
        productCode: this.workpieceInformation.productCode,
        // workOrderNo: this.workpieceInformation.workOrderNo,
        productCode: "1P102S",
        locationCode: this.headContent.processesCode,
        model: this.workpieceInformation.productModel,
        // model: this.workpieceInformation.productModel,
        productBarcode: this.headContent.sfcCode,
        sfcCode: this.headContent.sfcCode,
        inboundTime: new Date()
      }
      addPassingStationCollection(this.passingStationForm).then(response => {});
      addBasicParameters(this.passingStationForm).then(response => {});
      yzAddBasicParameters(this.passingStationForm).then(response => {});
    },
    exit() {
      if (this.ws) {
@@ -535,16 +509,13 @@
          const param = {
            tightenTheArray: event.data,
            paramCode: formulaChilds.paramCode,
            workOrderNo: self.workpieceInformation.workOrderNo,
            productCode: self.workpieceInformation.productCode,
            // workOrderNo: self.workpieceInformation.workOrderNo,
            productCode: "1P102S",
            locationCode: self.headContent.processesCode,
            productBarcode: self.headContent.sfcCode,
          }
          addTighteningParameters(param).then(response => {});
          yzUpdateTighteningFormula(param).then(response => {
          //   self.getListFormulaChild()
          // }).catch(error =>{
          //   self.getListFormulaChild()
            console.log(response.msg)
            if(response.msg === "1"){
                self.getListFormulaChild()
jcdm-ui/src/views/main/kb/stationTerminal/index.vue
@@ -574,7 +574,7 @@
        inboundTime: new Date()
      }
      addPassingStationCollection(this.passingStationForm).then(response => {});
      addBasicParameters(this.passingStationForm).then(response => {});
      // addBasicParameters(this.passingStationForm).then(response => {});
    },
    exit() {
      if (this.ws) {
@@ -606,7 +606,7 @@
        if(this.headContent.processesCode === 'OP240'){
          this.onLineBinDing = true
        }
        if(this.headContent.processesCode === 'OP250-1' || this.headContent.processesCode === 'OP250-2' || this.headContent.processesCode === 'OP250-3'){
        if(this.headContent.processesCode === 'OP260'){
          this.showInput = true
        }
@@ -679,9 +679,9 @@
        console.log("串口收到数据-------------------"+scanValue)
        if(this.headContent.sfcCode !== ''){
          if(scanValue.includes("SS")){
          if(scanValue.includes("P9900173252")){
            this.headContent.yzSfcCode = scanValue
          }else if(scanValue.includes("CC")){
          }else if(scanValue.includes("HDY")){
            this.headContent.cardCode = scanValue
          }else {
            this.$message('扫描物料编码'+scanValue);
@@ -692,22 +692,30 @@
          if(this.headContent.processesCode === 'OP240'){
            this.headContent.sfcCode = scanValue;
            this.queryParams.productNum = scanValue;
            this.getList()
            this.cakeLamp.scanFinish = 1
            this.cakeLamp.startWork = 1
          }else {
            let param = {
              trolleyYard: scanValue
            }
            findBytrolleyYardGetOne(param).then(response => {
              this.headContent.sfcCode = response.msg;
              this.queryParams.productNum = response.msg;
              if(response.msg !== '2'){
                this.headContent.sfcCode = response.msg;
                this.queryParams.productNum = response.msg;
                this.$message('扫码识别产品序列号'+scanValue);
                // this.headContent.sfcCode = scanValue;
                // this.queryParams.productNum = scanValue;
                this.getList()
                this.cakeLamp.scanFinish = 1
                this.cakeLamp.startWork = 1
              }else {
                this.$message('没有序列号'+scanValue);
                return
              }
            });
          }
          this.$message('扫码识别产品序列号'+scanValue);
          // this.headContent.sfcCode = scanValue;
          // this.queryParams.productNum = scanValue;
          this.getList()
          this.cakeLamp.scanFinish = 1
          this.cakeLamp.startWork = 1
        }
      }