jcdm-main/src/main/java/com/jcdm/main/bs/formulaChild/service/impl/BsFormulaChildInfoServiceImpl.java
@@ -14,6 +14,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.jcdm.common.core.domain.AjaxResult; import com.jcdm.common.utils.DateUtils; import com.jcdm.common.utils.StringUtils; import com.jcdm.framework.websocket.WebSocketUsers; import com.jcdm.main.da.paramCollection.domain.DaParamCollection; import com.jcdm.main.da.paramCollection.mapper.DaParamCollectionMapper; @@ -345,14 +346,26 @@ try { for (int i = 0; i < split.length; i++) { daParamCollectionService.pushGeelycvMesFeedback(split[i], bsFormulaChildInfo.getLocationCode()); String barCode = bsFormulaChildInfo.getProductBarcode(); String barCode = split[i]; String locationCode = bsFormulaChildInfo.getLocationCode(); DaPassingStationCollection passingStationCollectionOne = daPassingStationCollectionService.getOne(new LambdaQueryWrapper<DaPassingStationCollection>().eq(DaPassingStationCollection::getSfcCode, barCode).eq(DaPassingStationCollection::getLocationCode, locationCode)); if (passingStationCollectionOne != null) { passingStationCollectionOne.setOutRsSign("1"); passingStationCollectionOne.setOutboundTime(new Date()); daPassingStationCollectionService.saveOrUpdate(passingStationCollectionOne); if(StringUtils.isNotBlank(locationCode)&&StringUtils.isNotBlank(barCode)){ DaPassingStationCollection daPassingStationCollection = new DaPassingStationCollection(); daPassingStationCollection.setOutRsSign("1"); daPassingStationCollection.setOutboundTime(new Date()); daPassingStationCollection.setSfcCode(barCode); daPassingStationCollection.setLocationCode(locationCode); int updateDaPassingStation = daPassingStationCollectionService.updateDaPassingStationCollectionBySfcCodeAndLocationCode(daPassingStationCollection); logger.info("加热膜人工工位更新过站记录updateDaPassingStationCollectionBySfcCodeAndLocationCode:更新了{}条数据-更新条件pack码{}-工位{}",updateDaPassingStation,barCode,locationCode); } // DaPassingStationCollection passingStationCollectionOne = daPassingStationCollectionService.getOne(new LambdaQueryWrapper<DaPassingStationCollection>().eq(DaPassingStationCollection::getSfcCode, barCode).eq(DaPassingStationCollection::getLocationCode, locationCode)); // if (passingStationCollectionOne != null) { // passingStationCollectionOne.setOutRsSign("1"); // passingStationCollectionOne.setOutboundTime(new Date()); // daPassingStationCollectionService.saveOrUpdate(passingStationCollectionOne); // } } }catch (Exception e){ } @@ -405,7 +418,16 @@ ); for (BsFormulaChildInfo formulaChildInfo : infos) { if(bsFormulaChildInfo.getScanBarcode().contains(formulaChildInfo.getMaterialCode())){ bsFormulaChildInfos.add(formulaChildInfo); if(null != formulaChildInfo.getCollectData()){ if(!formulaChildInfo.getCollectData().equals(bsFormulaChildInfo.getScanBarcode())){ bsFormulaChildInfos.add(formulaChildInfo); }else{ result = "2"; return AjaxResult.success(result); } }else{ bsFormulaChildInfos.add(formulaChildInfo); } break; } } @@ -437,8 +459,6 @@ } } } }else { result = "1"; } return AjaxResult.success(result); } @@ -514,12 +534,23 @@ daParamCollectionService.pushGeelycvMesFeedback(bsFormulaChildInfo.getProductBarcode(), bsFormulaChildInfo.getLocationCode()); String barCode = bsFormulaChildInfo.getProductBarcode(); String locationCode = bsFormulaChildInfo.getLocationCode(); DaPassingStationCollection passingStationCollectionOne = daPassingStationCollectionService.getOne(new LambdaQueryWrapper<DaPassingStationCollection>().eq(DaPassingStationCollection::getSfcCode, barCode).eq(DaPassingStationCollection::getLocationCode, locationCode)); if (passingStationCollectionOne != null) { passingStationCollectionOne.setOutRsSign("1"); passingStationCollectionOne.setOutboundTime(new Date()); daPassingStationCollectionService.saveOrUpdate(passingStationCollectionOne); if(StringUtils.isNotBlank(locationCode)&&StringUtils.isNotBlank(barCode)){ DaPassingStationCollection daPassingStationCollection = new DaPassingStationCollection(); daPassingStationCollection.setOutRsSign("1"); daPassingStationCollection.setOutboundTime(new Date()); daPassingStationCollection.setSfcCode(barCode); daPassingStationCollection.setLocationCode(locationCode); int updateDaPassingStation = daPassingStationCollectionService.updateDaPassingStationCollectionBySfcCodeAndLocationCode(daPassingStationCollection); logger.info("普通人工工位更新过站记录updateDaPassingStationCollectionBySfcCodeAndLocationCode:更新了{}条数据-更新条件pack码{}-工位{}",updateDaPassingStation,barCode,locationCode); } // DaPassingStationCollection passingStationCollectionOne = daPassingStationCollectionService.getOne(new LambdaQueryWrapper<DaPassingStationCollection>().eq(DaPassingStationCollection::getSfcCode, barCode).eq(DaPassingStationCollection::getLocationCode, locationCode)); // if (passingStationCollectionOne != null) { // passingStationCollectionOne.setOutRsSign("1"); // passingStationCollectionOne.setOutboundTime(new Date()); // daPassingStationCollectionService.saveOrUpdate(passingStationCollectionOne); // } }catch (Exception e){ } return AjaxResult.success(); @@ -535,43 +566,53 @@ List<String> collect = operationType.stream().map(BsFormulaChildInfo::getResults).collect(Collectors.toList()); for (String s : collect) { if(s.equals("")){ return AjaxResult.error("扫描未完成,禁止拧紧操作!"); return AjaxResult.error("扫码未完成,禁止拧紧操作!"); } } BsFormulaChildInfo listQuery = new BsFormulaChildInfo(); listQuery.setParamCode(bsFormulaChildInfo.getParamCode()); listQuery.setProcessesCode(bsFormulaChildInfo.getLocationCode()); //添加拧紧参数-参数采集表 DaParamCollection daParamCollection = new DaParamCollection(); daParamCollection.setParamCode(bsFormulaChildInfo.getParamCode()); daParamCollection.setTightenTheArray(bsFormulaChildInfo.getTightenTheArray()); daParamCollection.setProductBarcode(bsFormulaChildInfo.getProductBarcode()); daParamCollection.setWorkOrderNo(bsFormulaChildInfo.getWorkOrderNo()); daParamCollection.setLocationCode(bsFormulaChildInfo.getLocationCode()); daParamCollection.setProductCode(bsFormulaChildInfo.getProductCode()); daParamCollectionService.addTighteningParameters(daParamCollection); String paramCode = bsFormulaChildInfo.getTightenTheArray(); if(paramCode.contains("N")){ List<BsFormulaChildInfo> bsFormulaChildInfos = bsFormulaChildInfoMapper.selectBsFormulaChildInfoList(listQuery); if(paramCode.contains("NG")){ /* List<BsFormulaChildInfo> bsFormulaChildInfos = bsFormulaChildInfoMapper.selectBsFormulaChildInfoList(listQuery); bsFormulaChildInfos.get(0).setResults("NG"); bsFormulaChildInfos.get(0).setCollectData(bsFormulaChildInfo.getTightenTheArray()); bsFormulaChildInfoMapper.updateBsFormulaChildInfo(bsFormulaChildInfos.get(0)); return AjaxResult.error("扫描结果NG,请重新扫描!"); */ bsFormulaChildInfo.setResults("NG"); bsFormulaChildInfo.setCollectData(bsFormulaChildInfo.getTightenTheArray()); bsFormulaChildInfoMapper.updateBsFormulaChildInfo(bsFormulaChildInfo); return AjaxResult.error("拧紧结果NG,请重新拧紧!"); }else { List<BsFormulaChildInfo> bsFormulaChildInfos = bsFormulaChildInfoMapper.selectBsFormulaChildInfoList(listQuery); if(bsFormulaChildInfos.get(0).getSpareField2()!=null&&bsFormulaChildInfos.get(0).getSpareField3()!=null){ //List<BsFormulaChildInfo> bsFormulaChildInfos = bsFormulaChildInfoMapper.selectBsFormulaChildInfoList(listQuery); if(bsFormulaChildInfo.getSpareField2()!=null&&bsFormulaChildInfo.getSpareField3()!=null){ String tightenArray = bsFormulaChildInfo.getTightenTheArray().replace("[", "").replace("]", "").replace(" ", ""); String[] tightenDataParts = tightenArray.split(","); b = TimeUtil.isNumberInRange(Double.parseDouble(tightenDataParts[0]),Double.parseDouble(bsFormulaChildInfos.get(0).getSpareField2()),Double.parseDouble(bsFormulaChildInfos.get(0).getSpareField3())); b = TimeUtil.isNumberInRange(Double.parseDouble(tightenDataParts[0]),Double.parseDouble(bsFormulaChildInfo.getSpareField2()),Double.parseDouble(bsFormulaChildInfo.getSpareField3())); } if(b){ bsFormulaChildInfos.get(0).setResults("OK"); bsFormulaChildInfos.get(0).setCollectData(bsFormulaChildInfo.getTightenTheArray()); bsFormulaChildInfoMapper.updateBsFormulaChildInfo(bsFormulaChildInfos.get(0)); logger.info("查询条件参数:"+listQuery); logger.info("查询结果:"+bsFormulaChildInfos.get(0)); Integer stepNumber = Integer.valueOf(bsFormulaChildInfos.get(0).getStepSort()); bsFormulaChildInfo.setResults("OK"); bsFormulaChildInfo.setCollectData(bsFormulaChildInfo.getTightenTheArray()); bsFormulaChildInfoMapper.updateBsFormulaChildInfo(bsFormulaChildInfo); Integer stepNumber = Integer.valueOf(bsFormulaChildInfo.getStepSort()); try { miloService.writeToOpcShort(ReadWriteEntity.builder().identifier("PACK."+bsFormulaChildInfo.getLocationCode()+".MStepNumber").value(stepNumber+1).build()); } catch (Exception e) { throw new RuntimeException(e); } String spareField4 = bsFormulaChildInfos.get(0).getSpareField4(); String spareField4 = bsFormulaChildInfo.getSpareField4(); if (spareField4 != null && !spareField4.isEmpty()) { // 执行操作 if(bsFormulaChildInfos.get(0).getSpareField4().equals("1")){ if(spareField4.equals("1")){ try { // //更新过站记录表出站时间 // DaPassingStationCollection daPassingStationCollection = new DaPassingStationCollection(); @@ -587,17 +628,19 @@ } } }else { List<BsFormulaChildInfo> bsFormulaChildInfos1 = bsFormulaChildInfoMapper.selectBsFormulaChildInfoList(listQuery); bsFormulaChildInfos1.get(0).setResults("NG"); //List<BsFormulaChildInfo> bsFormulaChildInfos1 = bsFormulaChildInfoMapper.selectBsFormulaChildInfoList(listQuery); bsFormulaChildInfo.setResults("NG"); String originalString = bsFormulaChildInfo.getTightenTheArray(); String modifiedString = originalString.replaceFirst("OK", "NG"); bsFormulaChildInfos1.get(0).setCollectData(modifiedString); bsFormulaChildInfoMapper.updateBsFormulaChildInfo(bsFormulaChildInfos1.get(0)); return AjaxResult.error("扫描结果NG,请重新扫描!"); bsFormulaChildInfo.setCollectData(modifiedString); bsFormulaChildInfoMapper.updateBsFormulaChildInfo(bsFormulaChildInfo); return AjaxResult.error("拧紧结果NG,请重新拧紧!"); } } return AjaxResult.success("扫描成功!"); return AjaxResult.success("拧紧成功!"); } jcdm-main/src/main/java/com/jcdm/main/da/paramCollection/service/impl/DaParamCollectionServiceImpl.java
@@ -30,6 +30,7 @@ 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.om.productionOrde.service.IOmProductionOrdeInfoService; import com.jcdm.main.plcserver.sub.OPCUaSubscription; import com.jcdm.main.restful.factoryMes.service.RestfulService; import com.jcdm.main.restful.qingYan.doman.ChildVO; @@ -94,6 +95,9 @@ @Autowired private IDaParamCollectionTempService daParamCollectionTempService; @Autowired private IOmProductionOrdeInfoService omProductionOrdeInfoService; public SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); @@ -312,8 +316,26 @@ //给opc发21 miloService.writeToOpcShort(ReadWriteEntity.builder().identifier("PACK."+daParamCollection.getLocationCode()+".RecordDataDone").value(21).build()); if(daParamCollection.getLocationCode().equals("OP240")){ RestfulService.getWorkReportResultFeedback(daParamCollection.getProductBarcode(),"OP230",format.format(new Date())); try{ CompletableFuture<Void> cp1 = CompletableFuture.runAsync(() -> { logger.info("OP230报工开始-工厂MES异步方法"); String reportResult = RestfulService.getWorkReportResultFeedback(daParamCollection.getProductBarcode(), "OP230", format.format(new Date())); if("".equals(reportResult)){ //执行报工失败方法 }else{ //解析工厂mes返回结果,如果失败,执行报工失败方法,修改是否报工为2,添加报工时间 //如果成功,执行报工成功方法,修改是否报工为1,添加报工时间 } logger.info("OP230报工结束-工厂MES异步方法{}"+reportResult); }); }catch (Exception e){ System.out.println(e.getMessage()); } // RestfulService.getWorkReportResultFeedback(daParamCollection.getProductBarcode(),"OP230",format.format(new Date())); } } catch (Exception e) { throw new RuntimeException(e); } @@ -525,10 +547,16 @@ HttpResponse execute = HttpRequest.post(url).body(JSONUtil.toJsonStr(parentVO)).execute(); logger.info("异步方法执行结束"); logger.info("手动工位传工厂MES异步方法{}"+execute.body()); List<Long> idsList = paramList.stream().map(DaParamCollectionTemp::getId).collect(Collectors.toList()); Long[] array = idsList.toArray(new Long[0]); int i = daParamCollectionTempService.deleteDaParamCollectionTempByIds(array); DaParamCollectionTemp daParamCollectionTemp = new DaParamCollectionTemp(); daParamCollectionTemp.setSfcCode(packID); daParamCollectionTemp.setLocationCode(stationCode); int i = daParamCollectionTempService.deleteDaParamCollectionTempBySfcCodeAndLocationCode(daParamCollectionTemp); logger.info("删除临时表数据条数{}-工位{}-pack码{}",i,stationCode,packID); // List<Long> idsList = paramList.stream().map(DaParamCollectionTemp::getId).collect(Collectors.toList()); // Long[] array = idsList.toArray(new Long[0]); // int i = daParamCollectionTempService.deleteDaParamCollectionTempByIds(array); // logger.info("删除临时表数据条数{}-工位{}-pack码{}",i,stationCode,packID); }); }catch (Exception e){ System.out.println(e.getMessage()); jcdm-main/src/main/java/com/jcdm/main/da/paramCollectionTemp/mapper/DaParamCollectionTempMapper.java
@@ -60,4 +60,6 @@ * @return 结果 */ public int deleteDaParamCollectionTempByIds(Long[] ids); int deleteDaParamCollectionTempBySfcCodeAndLocationCode(DaParamCollectionTemp daParamCollectionTemp); } jcdm-main/src/main/java/com/jcdm/main/da/paramCollectionTemp/service/IDaParamCollectionTempService.java
@@ -53,6 +53,9 @@ */ public int deleteDaParamCollectionTempByIds(Long[] ids); public int deleteDaParamCollectionTempBySfcCodeAndLocationCode(DaParamCollectionTemp daParamCollectionTemp); /** * 删除设备产品过程参数采集临时表信息 * jcdm-main/src/main/java/com/jcdm/main/da/paramCollectionTemp/service/impl/DaParamCollectionTempServiceImpl.java
@@ -87,6 +87,11 @@ return daParamCollectionTempMapper.deleteDaParamCollectionTempByIds(ids); } @Override public int deleteDaParamCollectionTempBySfcCodeAndLocationCode(DaParamCollectionTemp daParamCollectionTemp) { return daParamCollectionTempMapper.deleteDaParamCollectionTempBySfcCodeAndLocationCode(daParamCollectionTemp); } /** * 删除设备产品过程参数采集临时表信息 * jcdm-main/src/main/java/com/jcdm/main/da/passingStationCollection/domain/DaPassingStationCollection.java
@@ -1,6 +1,7 @@ package com.jcdm.main.da.passingStationCollection.domain; import com.baomidou.mybatisplus.annotation.TableField; import com.fasterxml.jackson.annotation.JsonFormat; import com.jcdm.common.annotation.Excel; import com.jcdm.common.core.domain.BaseEntity; import org.apache.commons.lang3.builder.ToStringBuilder; @@ -51,7 +52,7 @@ private Date inboundTime; /** 出站时间 */ // @JsonFormat(pattern = "yyyy-MM-dd") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") @Excel(name = "出站时间") private Date outboundTime; jcdm-main/src/main/java/com/jcdm/main/da/passingStationCollection/mapper/DaPassingStationCollectionMapper.java
@@ -60,4 +60,6 @@ * @return 结果 */ public int deleteDaPassingStationCollectionByIds(Long[] ids); int updateDaPassingStationCollectionBySfcCodeAndLocationCode(DaPassingStationCollection daPassingStationCollection); } jcdm-main/src/main/java/com/jcdm/main/da/passingStationCollection/service/IDaPassingStationCollectionService.java
@@ -53,6 +53,9 @@ */ public int updateDaPassingStationCollection(DaPassingStationCollection daPassingStationCollection); public int updateDaPassingStationCollectionBySfcCodeAndLocationCode(DaPassingStationCollection daPassingStationCollection); /** * 批量删除产品过站采集 * jcdm-main/src/main/java/com/jcdm/main/da/passingStationCollection/service/impl/DaPassingStationCollectionServiceImpl.java
@@ -120,6 +120,11 @@ return daPassingStationCollectionMapper.updateDaPassingStationCollection(daPassingStationCollection); } @Override public int updateDaPassingStationCollectionBySfcCodeAndLocationCode(DaPassingStationCollection daPassingStationCollection) { return daPassingStationCollectionMapper.updateDaPassingStationCollectionBySfcCodeAndLocationCode(daPassingStationCollection); } /** * 批量删除产品过站采集 * jcdm-main/src/main/java/com/jcdm/main/restful/factoryMes/service/RestfulService.java
@@ -47,10 +47,19 @@ //{"code":"success","data":{"productNum":"LCV123456P0600036","stationCode":"1HZ01","resultCode":"S","resultText":"报工成功"},"message":"API调用成功"} public static String getWorkReportResultFeedback(String productNum,String stationCode,String confirmTime) { String url = getRealmName + "/workReportResultFeedback?siteCode="+siteCode+"&stationCode="+stationCode+"&productNum="+productNum+"&confirmTime="+confirmTime; HttpResponse response = HttpRequest.get(url).execute(); HttpRequest httpRequest = HttpRequest.get(url); return response.body(); String result = ""; try { String url = getRealmName + "/workReportResultFeedback?siteCode="+siteCode+"&stationCode="+stationCode+"&productNum="+productNum+"&confirmTime="+confirmTime; HttpResponse response = HttpRequest.get(url).execute(); HttpRequest httpRequest = HttpRequest.get(url); result = response.body(); }catch (Exception e){ e.printStackTrace(); }finally { return result; } } /** jcdm-main/src/main/resources/mapper/da/paramCollectionTemp/DaParamCollectionTempMapper.xml
@@ -170,6 +170,10 @@ delete from da_param_collection_temp where id = #{id} </delete> <delete id="deleteDaParamCollectionTempBySfcCodeAndLocationCode" parameterType="DaParamCollectionTemp"> delete from da_param_collection_temp where sfc_code = #{sfcCode} and location_code = #{locationCode} </delete> <delete id="deleteDaParamCollectionTempByIds" parameterType="String"> delete from da_param_collection_temp where id in <foreach item="id" collection="array" open="(" separator="," close=")"> jcdm-main/src/main/resources/mapper/da/passingStationCollection/DaPassingStationCollectionMapper.xml
@@ -104,6 +104,17 @@ </trim> </insert> <update id="updateDaPassingStationCollectionBySfcCodeAndLocationCode" parameterType="DaPassingStationCollection"> UPDATE da_passing_station_collection <trim prefix="SET" suffixOverrides=","> <if test="outboundTime != null">outbound_time = #{outboundTime},</if> <if test="outRsSign != null">out_rs_sign = #{outRsSign},</if> </trim> WHERE sfc_code = #{sfcCode} AND location_code = #{locationCode} </update> <update id="updateDaPassingStationCollection" parameterType="DaPassingStationCollection"> update da_passing_station_collection <trim prefix="SET" suffixOverrides=","> jcdm-ui/src/views/main/kb/stationTerminal/index.vue
@@ -505,6 +505,8 @@ console.log(response) if(response.msg === "3"){ this.cakeLamp.release= 1 //允许放行 }else if(response.msg === "2"){ this.$message.error('扫码重复请重新扫码!'); } this.getListFormulaChild() }); @@ -700,7 +702,7 @@ } if(self.headContent.sfcCode=== ''||self.headContent.sfcCode=== null){ self.$message('总成码为空,请检查!') self.$message('总成码为空,请扫码!') return } @@ -739,7 +741,9 @@ }); } }else { self.$message('未绑定小车码禁止放行'); self.$alert('<strong style="color: red;font-size: 30px">未扫描小车码禁止放行</strong>', '提示', { dangerouslyUseHTMLString: true }); } }); } else if (event.data.includes("[")) { @@ -750,26 +754,37 @@ for (let i = 0; i < self.formulaChildList.length; i++) { let formulaChild = self.formulaChildList[i]; let results = formulaChild.results; if (results === '' || results === null || results === 'NG') { formulaChilds = formulaChild; break; } } if(formulaChilds === ""){ self.$message.error('本工位已工作完成!'); return; } const param = { id: formulaChilds.id, tightenTheArray: event.data, paramCode: formulaChilds.paramCode, workOrderNo: self.workpieceInformation.workOrderNo, productCode: self.workpieceInformation.productCode, locationCode: self.headContent.processesCode, productBarcode: self.headContent.sfcCode, spareField1: formulaChilds.spareField1, spareField2: formulaChilds.spareField2, spareField3: formulaChilds.spareField3, spareField4: formulaChilds.spareField4, stepSort: formulaChilds.stepSort } if(formulaChilds.paramCode === null||formulaChilds.paramCode ===''){ self.$message('未找到参数码,请检查参数码是否正确'); return; } if(self.headContent.sfcCode!==null||self.headContent.sfcCode!==''){ addTighteningParameters(param).then(response => {}); updateTighteningFormula(param).then(response => { //addTighteningParameters(param).then(response => {}); self.getListFormulaChild() }).catch(error =>{ self.getListFormulaChild() @@ -787,7 +802,7 @@ else { const scanValue = this.myserialport.hex2atostr(value).replace(/[\r\n]/g, ''); console.log("串口收到数据-------------------"+scanValue) console.log("sfc=--"+this.headContent.sfcCode+"--") if(this.headContent.sfcCode !== '' && this.headContent.sfcCode !== null && this.headContent.sfcCode !== undefined){ if(scanValue.includes("P9900173252")){