jcdm-main/src/main/java/com/jcdm/main/bs/formulaChild/controller/BsFormulaChildInfoController.java
@@ -7,6 +7,8 @@ import cn.hutool.core.collection.CollUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.jcdm.main.constant.Constants; import com.kangaroohy.milo.model.ReadWriteEntity; import com.kangaroohy.milo.service.MiloService; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; @@ -39,12 +41,30 @@ @Autowired private IBsFormulaChildInfoService bsFormulaChildInfoService; @Autowired private MiloService miloService; /** * 扫码确认 */ @GetMapping("/fistSetpNumber") public void fistSetpNumber(BsFormulaChildInfo bsFormulaChildInfo) { try { String str = "PACK."+bsFormulaChildInfo.getProcessesCode()+".MStepNumber"; miloService.writeToOpcShort(ReadWriteEntity.builder().identifier(str).value(1).build()); } catch (Exception e) { throw new RuntimeException(e); } } /** * 查询配方配置子信息列表 */ @GetMapping("/noPageListFormulaChild") public TableDataInfo noPageListFormulaChild(BsFormulaChildInfo bsFormulaChildInfo) { List<BsFormulaChildInfo> list = bsFormulaChildInfoService.list(new LambdaQueryWrapper<BsFormulaChildInfo>() .eq(BsFormulaChildInfo::getProductCode,bsFormulaChildInfo.getProductCode()) .eq(BsFormulaChildInfo::getProcessesCode,bsFormulaChildInfo.getProcessesCode())); jcdm-main/src/main/java/com/jcdm/main/bs/formulaChild/domain/BsFormulaChildInfo.java
@@ -139,6 +139,9 @@ @TableField(exist = false) private Integer counts; @TableField(exist = false) private String productBarcode; public String getParamName() { return paramName; } jcdm-main/src/main/java/com/jcdm/main/bs/formulaChild/service/impl/BsFormulaChildInfoServiceImpl.java
@@ -15,8 +15,10 @@ import com.jcdm.framework.websocket.WebSocketUsers; import com.jcdm.main.da.paramCollection.domain.DaParamCollection; import com.jcdm.main.da.paramCollection.mapper.DaParamCollectionMapper; import com.jcdm.main.da.paramCollection.service.IDaParamCollectionService; import com.jcdm.main.da.passingStationCollection.domain.DaPassingStationCollection; import com.jcdm.main.da.passingStationCollection.mapper.DaPassingStationCollectionMapper; import com.jcdm.main.da.testDeviceInterface.service.IDaTestDeviceInterfaceService; import com.kangaroohy.milo.model.ReadWriteEntity; import com.kangaroohy.milo.service.MiloService; import org.aspectj.weaver.loadtime.Aj; @@ -51,6 +53,12 @@ @Autowired private DaPassingStationCollectionMapper daPassingStationCollectionMapper; @Autowired private IDaTestDeviceInterfaceService daTestDeviceInterfaceService; @Autowired private IDaParamCollectionService daParamCollectionService; Map<String, Session> map = WebSocketUsers.getUsers(); @@ -215,7 +223,7 @@ Integer stepNumber = Integer.valueOf(bsFormulaChildInfos.get(0).getStepSort()); try { miloService.writeToOpcShort(ReadWriteEntity.builder().identifier("PACK."+bsFormulaChildInfo.getLocationCode()+".MStepNumber").value(stepNumber).build()); miloService.writeToOpcShort(ReadWriteEntity.builder().identifier("PACK."+bsFormulaChildInfo.getLocationCode()+".MStepNumber").value(stepNumber+1).build()); } catch (Exception e) { throw new RuntimeException(e); } @@ -375,6 +383,7 @@ @Override public AjaxResult workpieceRelease(BsFormulaChildInfo bsFormulaChildInfo) { daParamCollectionService.pushGeelycvMesFeedback(bsFormulaChildInfo.getProductBarcode(), bsFormulaChildInfo.getLocationCode()); List<BsFormulaChildInfo> list = bsFormulaChildInfoService.list(new LambdaQueryWrapper<BsFormulaChildInfo>() .eq(BsFormulaChildInfo::getProcessesCode, bsFormulaChildInfo.getLocationCode()) .eq(BsFormulaChildInfo::getProductCode, bsFormulaChildInfo.getProductCode())); @@ -415,7 +424,7 @@ Integer stepNumber = Integer.valueOf(bsFormulaChildInfos.get(0).getStepSort()); try { miloService.writeToOpcShort(ReadWriteEntity.builder().identifier("PACK."+bsFormulaChildInfo.getLocationCode()+".MStepNumber").value(stepNumber).build()); miloService.writeToOpcShort(ReadWriteEntity.builder().identifier("PACK."+bsFormulaChildInfo.getLocationCode()+".MStepNumber").value(stepNumber+1).build()); } catch (Exception e) { throw new RuntimeException(e); } jcdm-main/src/main/java/com/jcdm/main/da/passingStationCollection/service/IDaPassingStationCollectionService.java
@@ -72,4 +72,6 @@ void insertRepairRecordByIds(DaPassingStationCollection daPassingStationCollection); int jrmAddPassingStationCollection(DaPassingStationCollection daPassingStationCollection); void saveBeachDaPassingStationCollection(List<DaPassingStationCollection> list); } jcdm-main/src/main/java/com/jcdm/main/da/passingStationCollection/service/impl/DaPassingStationCollectionServiceImpl.java
@@ -5,14 +5,19 @@ //import com.jcdm.main.bs.orderScheduling.domain.BsOrderScheduling; //import com.jcdm.main.bs.orderScheduling.mapper.BsOrderSchedulingMapper; //import com.jcdm.main.bs.orderScheduling.service.IBsOrderSchedulingService; import com.jcdm.main.da.paramCollection.mapper.DaParamCollectionMapper; import com.jcdm.main.da.passingStationCollection.domain.DaPassingStationCollection; import com.jcdm.main.da.passingStationCollection.mapper.DaPassingStationCollectionMapper; import com.jcdm.main.da.passingStationCollection.service.IDaPassingStationCollectionService; import com.jcdm.main.rm.repairRecord.domain.RmRepairRecord; import com.jcdm.main.rm.repairRecord.mapper.RmRepairRecordMapper; import org.apache.ibatis.session.ExecutorType; import org.apache.ibatis.session.SqlSession; import org.apache.ibatis.session.SqlSessionFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import javax.annotation.Resource; import java.time.LocalDate; import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; @@ -35,6 +40,9 @@ @Autowired private RmRepairRecordMapper rmRepairRecordMapper; @Resource private SqlSessionFactory sqlSessionFactory; // @Autowired // private BsOrderSchedulingMapper bsOrderSchedulingMapper; @@ -157,4 +165,25 @@ } return 1; } @Override public void saveBeachDaPassingStationCollection(List<DaPassingStationCollection> list) { // ExecutorType.SIMPLE: 这个执行器类型不做特殊的事情。它为每个语句的执行创建一个新的预处理语句。 // ExecutorType.REUSE: 这个执行器类型会复用预处理语句。 // ExecutorType.BATCH: 这个执行器会批量执行所有更新语句,如果 SELECT 在它们中间执行还会标定它们是 必须的,来保证一个简单并易于理解的行为。 // 关闭session的自动提交 SqlSession sqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH, false); try { DaPassingStationCollectionMapper userMapper = sqlSession.getMapper(DaPassingStationCollectionMapper.class); list.stream().forEach(item -> userMapper.insertDaPassingStationCollection(item)); // 提交数据 sqlSession.commit(); sqlSession.rollback(); } catch (Exception e) { sqlSession.rollback(); } finally { sqlSession.close(); } } } jcdm-main/src/main/java/com/jcdm/main/plcserver/conf/OPCElement.java
@@ -92,7 +92,7 @@ */ public static final String PACK_OP400_RecordData = "PACK.OP400.RecordData";//请求记录数据 public static final String PACK_OP400_AngleResult = "PACK.OP400.AngleResult_1";//请求拧紧数据 public static final String PACK_OP400_AngleResult = "PACK.OP400.AngleResult";//请求拧紧数据 /** * OP410 */ jcdm-main/src/main/java/com/jcdm/main/plcserver/sub/OPCUaSubscription.java
@@ -115,6 +115,16 @@ String RecordDataDoneAddress = thoroughfare + "." + device + ".RecordDataDone"; //读模组码 Object moduleCode = miloService.readFromOpcUa(thoroughfare + "." + device + ".ModuleCode").getValue(); if(device.equals("OP365")){ Object moduleCodeA = miloService.readFromOpcUa(thoroughfare + "." + device + ".ModuleCodeA").getValue(); Object moduleCodeB = miloService.readFromOpcUa(thoroughfare + "." + device + ".ModuleCodeB").getValue(); if(moduleCodeA!=null && moduleCodeB!=null){ miloService.writeToOpcShort(ReadWriteEntity.builder().identifier(RecordDataDoneAddress).value(11).build()); }else { miloService.writeToOpcShort(ReadWriteEntity.builder().identifier(RecordDataDoneAddress).value(12).build()); } return; } if(moduleCode!=null){ miloService.writeToOpcShort(ReadWriteEntity.builder().identifier(RecordDataDoneAddress).value(11).build()); @@ -150,7 +160,6 @@ }else { miloService.writeToOpcShort(ReadWriteEntity.builder().identifier(RecordDataDoneAddress).value(12).build()); } } } }else { @@ -231,6 +240,13 @@ if(nullList.stream().noneMatch(s -> s.equals(device))){ if(moduleCodeList.stream().anyMatch(s -> s.equals(device))){ read = read + "ModuleCode"; if(device.equals("OP365")){ try { saveStationInfo365(thoroughfare,device); }catch (Exception e){ e.printStackTrace(); } } }else { read = read + "PACKCode"; } @@ -264,7 +280,10 @@ //1、更新工单信息 updateOrderInfo(snCode); } try{ daParamCollectionService.pushGeelycvMesFeedback(snCode,device); }catch (Exception e){ } result = "21"; } @@ -492,4 +511,36 @@ return CollUtil.isEmpty(list); } /** * 保存过站采集 */ public void saveStationInfo365(String thoroughfare,String device) throws Exception { String prefix = thoroughfare+"."+device+"."; List<DaPassingStationCollection> passingStationCollections = new ArrayList<>(); String ModuleCodeA = miloService.readFromOpcUa(prefix + "ModuleCodeA").getValue().toString(); String ModuleCodeB = miloService.readFromOpcUa(prefix + "ModuleCodeB").getValue().toString(); String StationStatusA = miloService.readFromOpcUa(prefix + "StationStatusA").getValue().toString(); String StationStatusB = miloService.readFromOpcUa(prefix + "StationStatusB").getValue().toString(); String[] modeles = {ModuleCodeA,ModuleCodeB}; String[] StationStatus = {StationStatusA,StationStatusB}; String startTime = miloService.readFromOpcUa(prefix + "StartTime").getValue().toString(); String stopTime = miloService.readFromOpcUa(prefix + "StopTime").getValue().toString(); for (int i = 0; i < 2; i++) { DaPassingStationCollection daPassingStationCollection = new DaPassingStationCollection(); String strt = TimeUtil.stringProcessing(startTime); String end = TimeUtil.stringProcessing(stopTime); daPassingStationCollection.setInboundTime(format.parse(TimeUtil.test(strt)));//入站时间 daPassingStationCollection.setOutboundTime(format.parse(TimeUtil.test(end)));//出站时间 daPassingStationCollection.setSfcCode(modeles[i]); daPassingStationCollection.setLocationCode(device); daPassingStationCollection.setOutRsSign(StationStatus[i]);//出站是否合格 passingStationCollections.add(daPassingStationCollection); } daPassingStationCollectionService.saveBeachDaPassingStationCollection(passingStationCollections); String RecordDataDoneAddress = thoroughfare + "." + device + ".RecordDataDone"; miloService.writeToOpcShort(ReadWriteEntity.builder().identifier(RecordDataDoneAddress).value(21).build()); return; } } jcdm-ui/src/api/main/bs/formulaChild/formulaChild.js
@@ -38,6 +38,16 @@ } // 查询配方配置子信息列表 export function fistSetpNumber(query) { return request({ url: '/bs/formulaChild/fistSetpNumber', method: 'get', params: query }) } // 查询配方配置子信息列表 export function jrmUpdateResults(query) { return request({ url: '/bs/formulaChild/jrmUpdateResults', jcdm-ui/src/views/main/kb/stationTerminal/index.vue
@@ -298,6 +298,7 @@ import {listWorkReport} from "@/api/main/om/workReport/workReport"; import {listStationConf,getIpv4} from "@/api/main/sc/stationConf"; import { fistSetpNumber, listFormulaChild, noPageListFormulaChild, releaseCheck, @@ -575,9 +576,9 @@ this.workpieceInformation.productCode = rowsData.productCode; this.workpieceInformation.productModel = rowsData.productModel; this.workpieceInformation.productName = rowsData.productName; this.timer = setInterval(() => { this.workpieceInformation.beat++; }, 1000); // this.timer = setInterval(() => { // this.workpieceInformation.beat++; // }, 1000); }); this.getListFormulaChild() this.addOverStationCollection() @@ -633,6 +634,7 @@ } console.log('设置工位编码' + this.headContent.processesCode) }); this.conCom() console.log('websocket连接工位为' + this.headContent.processesCode) @@ -641,10 +643,16 @@ const self = this; this.ws.onopen = function (event) { this.$message('websocket连接成功!'); }; this.ws.onmessage = function (event) { if (event.data === "IN") { self.cakeLamp.InPlace = 1; console.log(self.headContent.processesCode); const param = { processesCode: self.headContent.processesCode, } fistSetpNumber(param).then(response => {}); } else if (event.data === "IN0") { self.cakeLamp.InPlace = 0; } else if (event.data === "OUT") { @@ -703,7 +711,7 @@ if(this.headContent.sfcCode !== ''){ if(scanValue.includes("P9900173252")){ this.headContent.yzSfcCode = scanValue }else if(scanValue.includes("HDY")){ }else if(scanValue.includes("RSP01TE")){ this.headContent.cardCode = scanValue }else { this.$message('扫描物料编码'+scanValue);