jcdm-main/src/main/java/com/jcdm/main/bs/formulaChild/service/impl/BsFormulaChildInfoServiceImpl.java
@@ -2,17 +2,23 @@ import java.util.Date; import java.util.List; import java.util.Map; import com.jcdm.common.core.domain.AjaxResult; import com.jcdm.common.utils.DateUtils; import com.jcdm.framework.websocket.WebSocketUsers; import com.jcdm.main.da.paramCollection.domain.DaParamCollection; import com.jcdm.main.da.paramCollection.mapper.DaParamCollectionMapper; import com.kangaroohy.milo.model.ReadWriteEntity; import com.kangaroohy.milo.service.MiloService; import org.aspectj.weaver.loadtime.Aj; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.jcdm.main.bs.formulaChild.mapper.BsFormulaChildInfoMapper; import com.jcdm.main.bs.formulaChild.domain.BsFormulaChildInfo; import com.jcdm.main.bs.formulaChild.service.IBsFormulaChildInfoService; import javax.websocket.Session; /** * 配方配置子信息Service业务层处理 @@ -28,6 +34,11 @@ @Autowired private DaParamCollectionMapper daParamCollectionMapper; @Autowired private MiloService miloService; Map<String, Session> map = WebSocketUsers.getUsers(); /** * 查询配方配置子信息 @@ -133,6 +144,7 @@ bsFormulaChildInfo.setMaterialCode(bsFormulaChildInfo.getScanBarcode().substring(1,2)); List<BsFormulaChildInfo> bsFormulaChildInfos = bsFormulaChildInfoMapper.selectBsFormulaChildInfoList(bsFormulaChildInfo); if(bsFormulaChildInfos.size()>0){ bsFormulaChildInfos.get(0).setCollectData(bsFormulaChildInfo.getScanBarcode()); bsFormulaChildInfos.get(0).setResults("OK"); bsFormulaChildInfoMapper.updateBsFormulaChildInfo(bsFormulaChildInfos.get(0)); bsFormulaChildInfo.setParamValue(bsFormulaChildInfo.getScanBarcode()); @@ -181,6 +193,19 @@ bsFormulaChildInfos.get(0).setResults("OK"); bsFormulaChildInfos.get(0).setCollectData(bsFormulaChildInfo.getTightenTheArray()); bsFormulaChildInfoMapper.updateBsFormulaChildInfo(bsFormulaChildInfos.get(0)); String spareField4 = bsFormulaChildInfos.get(0).getSpareField4(); if (spareField4 != null && !spareField4.isEmpty()) { // 执行操作 if(bsFormulaChildInfos.get(0).getSpareField4().equals("1")){ try { miloService.writeToOpcShort(ReadWriteEntity.builder().identifier("OP."+bsFormulaChildInfo.getLocationCode()+".RecordDataDone").value(21).build()); WebSocketUsers.sendMessageToUserByText(map.get(bsFormulaChildInfo.getLocationCode()), "OUT"); } catch (Exception e) { throw new RuntimeException(e); } } } } return AjaxResult.success("扫描成功!"); } jcdm-main/src/main/java/com/jcdm/main/da/paramCollection/service/impl/DaParamCollectionServiceImpl.java
@@ -127,7 +127,7 @@ saveData.setWorkOrderNo(daParamCollection.getWorkOrderNo()); saveData.setProductCode(daParamCollection.getProductCode()); saveData.setLocationCode(daParamCollection.getLocationCode()); saveData.setSfcCode(daParamCollection.getSfcCode()); saveData.setSfcCode(daParamCollection.getProductBarcode()); saveData.setParamCode(daCollectionParamConfs.get(0).getCollectParameterId()); saveData.setParamName(daCollectionParamConfs.get(0).getCollectParameterName()); saveData.setCollectionTime(new Date()); jcdm-main/src/main/java/com/jcdm/main/plcserver/CustomRunner.java
@@ -52,6 +52,9 @@ lists.add(OPCElement.OP_OP010_RecordSN);//请求下发SN号 lists.add(OPCElement.OP_OP230_RecordData);//请求记录数据 lists.add(OPCElement.OP_OP240_RecordData);//请求记录数据 lists.add(OPCElement.OP_OP240_AngleResult);//请求记录数据 lists.add(OPCElement.OP_OP250_RecordData);//请求记录数据 lists.add(OPCElement.OP_OP250_AngleResult);//请求记录数据 return lists; } } jcdm-main/src/main/java/com/jcdm/main/plcserver/conf/OPCElement.java
@@ -8,16 +8,26 @@ /** * OP010 * OP230 */ public static final String OP_OP010_RecordSN = "TestOP.OP1010.RecordSN";//请求下发SN号 public static final String OP_OP230_RecordData = "OP.OP230.RecordData";//请求记录数据 /** * OP020 * OP240 */ public static final String OP_OP240_RecordData = "OP.OP240.RecordData";//请求记录数据 public static final String OP_OP240_AngleResult = "OP.OP240.AngleResult";//请求拧紧数据 /** * OP250 */ public static final String OP_OP250_RecordData = "OP.OP250.RecordData";//请求记录数据 public static final String OP_OP250_AngleResult = "OP.OP250.AngleResult";//请求拧紧数据 jcdm-main/src/main/java/com/jcdm/main/plcserver/sub/OPCUaSubscription.java
@@ -81,13 +81,12 @@ //进站保存数据 // inSaveDate(thoroughfare,device) //记录数据完成 String RecordDataDoneAddress = thoroughfare + "." + device + ".RecordDataDone"; miloService.writeToOpcShort(ReadWriteEntity.builder().identifier(RecordDataDoneAddress).value(recordDataDoneValue).build()); // String RecordDataDoneAddress = thoroughfare + "." + device + ".RecordDataDone"; // miloService.writeToOpcShort(ReadWriteEntity.builder().identifier(RecordDataDoneAddress).value(recordDataDoneValue).build()); //给前端发工件到位信号 WebSocketUsers.sendMessageToUserByText(map.get(device), "IN"); //请求工单 @@ -98,7 +97,13 @@ //记录数据完成 String RecordDataDoneAddress = thoroughfare + "." + device + ".RecordDataDone"; miloService.writeToOpcShort(ReadWriteEntity.builder().identifier(RecordDataDoneAddress).value(recordDataDoneValue).build()); }else if("3".equals(tabVlaue)){ }else { System.out.println("^"); } } //保存拧紧数据 else if (("AngleResult").equals(tab)) { if("1".equals(tabVlaue)||"2".equals(tabVlaue)){ String Torque = thoroughfare + "." + device + ".Torque"; String Angle = thoroughfare + "." + device + ".Angle"; String Result = thoroughfare + "." + device + ".Result"; @@ -112,14 +117,7 @@ List<Object> collect = list1.stream().map(ReadWriteEntity::getValue).collect(Collectors.toList()); String joinedString = String.join(",", collect.toString()); WebSocketUsers.sendMessageToUserByText(map.get(device), joinedString); }else { System.out.println("^"); } } } } catch (Exception e) { jcdm-ui/src/views/main/kb/stationTerminal/index.vue
@@ -107,7 +107,7 @@ <span slot="label"> <a class="el-icon-date"></a>首页</span> <el-col :span="24"> <el-table :cell-style="rowStyle" :data="formulaChildList"> <el-table-column label="排序" width="60" align="center" prop="stepSort"> <el-table-column label="排序" width="60" align="center" type="index"> </el-table-column> <el-table-column label="操作内容" :show-overflow-tooltip='true' align="center" prop="operationSteps"> </el-table-column> @@ -359,7 +359,7 @@ }, content: '', activeName: 'first', url: "ws://192.168.11.76:8080/websocket/message/", url: "ws://192.168.10.21:8080/websocket/message/", message: "", text_content: "", ws: null, @@ -490,11 +490,11 @@ }, /** 查询配方配置子信息列表 */ getListFormulaChild() { this.formulaChildList = [] this.formulaChildParams.productCode = this.workpieceInformation.productCode this.formulaChildParams.processesCode = this.headContent.processesCode listFormulaChild(this.formulaChildParams).then(response => { this.formulaChildList = response.rows; console.log(this.formulaChildList) }); }, @@ -631,32 +631,39 @@ self.cakeLamp.InPlace = 0; } else if (event.data === "OUT") { self.cakeLamp.release = 1; setTimeout(() => { self.cakeLamp.InPlace = 0; self.cakeLamp.release = 0; self.cakeLamp.startWork = 0; self.cakeLamp.scanFinish = 0; self.Release(); }, DELAY_TIME); // setTimeout(() => { // self.cakeLamp.InPlace = 0; // self.cakeLamp.release = 0; // self.cakeLamp.startWork = 0; // self.cakeLamp.scanFinish = 0; // self.Release(); // }, DELAY_TIME); } else if (event.data === "TIGHTEN") { this.formulaChildList = []; self.getListFormulaChild(); } else if (event.data.includes("[")) { // console.log('event.data'+event.data) // let eventArr = event.data.split("[")[1].split("]")[0].split(", "); // let eventArr1 = event.data.replace('[', '').replace(']', '').trim().split(', '); // console.log(eventArr1) // console.log(Array.isArray(eventArr)) let formulaChilds = ""; self.formulaChildList.forEach((formulaChild) => { let operationType = formulaChild.operationType; self.formulaChildList.sort((a, b) => a.stepSort - b.stepSort); self.formulaChildList .filter((formulaChild) => formulaChild.operationType === '1'); for (let i = 0; i < self.formulaChildList.length; i++) { let formulaChild = self.formulaChildList[i]; let results = formulaChild.results; if(operationType === '1' && (results === '' || results === null || results === 'NG')){ if (results === '' || results === null || results === 'NG') { formulaChilds = formulaChild; return; // 使用return代替break break; } // 执行其他操作 }); } // self.formulaChildList.sort((a, b) => a.stepSort - b.stepSort); // self.formulaChildList.forEach((formulaChild) => { // let operationType = formulaChild.operationType; // let results = formulaChild.results; // if(operationType === '1' && (results === '' || results === null || results === 'NG')){ // formulaChilds = formulaChild; // return; // 使用return代替break // } // // 执行其他操作 // }); const param = { tightenTheArray: event.data, paramCode: formulaChilds.paramCode, @@ -678,19 +685,21 @@ if (this.form1.isShowHistory) this.form1.desc = this.readLi().join(""); else { const scanValue = this.myserialport.hex2atostr(value).replace(/[\r\n]/g, ''); this.$message('扫码完成'+this.content); if(this.headContent.sfcCode !== ''){ console.log(scanValue) this.serialPortMethod(scanValue) }else { this.headContent.sfcCode = scanValue; this.queryParams.productNum = scanValue; this.getList() // this.getListFormulaChild() this.cakeLamp.scanFinish = 1 this.cakeLamp.startWork = 1 } // if(this.cakeLamp.InPlace=== 1){ if(this.headContent.sfcCode !== ''){ console.log(scanValue) this.serialPortMethod(scanValue) }else { this.headContent.sfcCode = scanValue; this.queryParams.productNum = scanValue; this.getList() // this.getListFormulaChild() this.cakeLamp.scanFinish = 1 this.cakeLamp.startWork = 1 } // }else { // this.$message('工件未到位禁止扫码!'); // } } }, clearHistory() {