| | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.google.gson.Gson; |
| | | import com.jcdm.common.core.domain.AjaxResult; |
| | | import com.jcdm.common.utils.DateUtils; |
| | | import com.jcdm.common.utils.SecurityUtils; |
| | |
| | | try{ |
| | | CompletableFuture<Void> cp1 = CompletableFuture.runAsync(() -> { |
| | | logger.info("OP230报工开始-工厂MES异步方法"); |
| | | String reportResult = RestfulService.getWorkReportResultFeedback(daParamCollection.getProductBarcode(), "OP230", format.format(new Date())); |
| | | String reportResult = RestfulService.getWorkReportResultFeedback(daParamCollection.getProductBarcode(), "POP230", format.format(new Date())); |
| | | JSONObject jsonObject = new JSONObject(reportResult); |
| | | String code = jsonObject.getStr("code"); |
| | | if("success".equals(code)){ |
| | | //如果成功,执行报工成功方法,修改是否报工为1,添加报工时间 |
| | | omProductionOrdeInfoService.updateOrderByProductNum("1",daParamCollection.getProductBarcode(),"OP230"); |
| | | omProductionOrdeInfoService.updateOrderByProductNum("1",daParamCollection.getProductBarcode(),"POP230"); |
| | | }else{ |
| | | //解析工厂mes返回结果,如果失败,执行报工失败方法,修改是否报工为2,添加报工时间 |
| | | omProductionOrdeInfoService.updateOrderByProductNum("2",daParamCollection.getProductBarcode(),"OP230"); |
| | | omProductionOrdeInfoService.updateOrderByProductNum("2",daParamCollection.getProductBarcode(),"POP230"); |
| | | } |
| | | logger.info("OP230报工结束-工厂MES异步方法{}"+reportResult); |
| | | }); |
| | |
| | | |
| | | @Override |
| | | public void jrmSaveCampaignTimeParameters(DaParamCollection daParamCollection) { |
| | | DaCollectionParamConf daCollectionParamConf = new DaCollectionParamConf(); |
| | | daCollectionParamConf.setProcessesCode(daParamCollection.getLocationCode()); |
| | | daCollectionParamConf.setCollectParameterId("OUTT"); |
| | | 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(DateUtil.formatDateTime(new Date())); |
| | | daParamCollectionMapper.insertDaParamCollection(saveData); |
| | | |
| | | //更新过站记录表出站时间 |
| | | //增加过站记录 |
| | | DaPassingStationCollection daPassingStationCollection = new DaPassingStationCollection(); |
| | | daPassingStationCollection.setWorkOrderNo(daParamCollection.getWorkOrderNo()); |
| | | daPassingStationCollection.setSfcCode(daParamCollection.getProductBarcode()); |
| | | daPassingStationCollection.setProductCode(daParamCollection.getProductCode()); |
| | | daPassingStationCollection.setLocationCode(daParamCollection.getLocationCode()); |
| | | List<DaPassingStationCollection> daPassingStationCollections = daPassingStationCollectionMapper.selectDaPassingStationCollectionList(daPassingStationCollection); |
| | | daPassingStationCollections.get(0).setOutboundTime(new Date()); |
| | | int i = daPassingStationCollectionMapper.updateDaPassingStationCollection(daPassingStationCollections.get(0)); |
| | | daPassingStationCollection.setInboundTime(daParamCollection.getInboundTime()); |
| | | daPassingStationCollection.setOutboundTime(new Date()); |
| | | daPassingStationCollection.setCreateTime(new Date()); |
| | | daPassingStationCollection.setOutRsSign("1"); |
| | | boolean save = daPassingStationCollectionService.save(daPassingStationCollection); |
| | | |
| | | // OPCUaSubscription.SaveParamData(daParamCollection.getProductBarcode(),"OP",daParamCollection.getLocationCode(),daParamCollection.getWorkOrderNo(),daParamCollection.getProductCode()); |
| | | //添加基础参数 |
| | | this.manualWorkstationsAddBasicParameters(daParamCollection); |
| | | |
| | | //给opc发21 |
| | | try { |
| | | // miloService.writeToOpcShort(ReadWriteEntity.builder().identifier("PACK."+daParamCollection.getLocationCode()+".RecordDataDone").value(21).build()); |
| | | String strA = daParamCollection.getLocationCode(); |
| | | miloService.writeToOpcShort(ReadWriteEntity.builder().identifier("PACK."+strA+".RecordDataDone").value(21).build()); |
| | | String str = daParamCollection.getLocationCode(); |
| | | miloService.writeToOpcShort(ReadWriteEntity.builder().identifier("PACK."+str+".RecordDataDone").value(21).build()); |
| | | } catch (Exception e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | |
| | | logger.info("开始执行异步方法"); |
| | | HttpResponse execute = HttpRequest.post(url).body(JSONUtil.toJsonStr(parentVO)).execute(); |
| | | logger.info("异步方法执行结束"); |
| | | logger.info("手动工位传工厂MES异步方法{}"+execute.body()); |
| | | logger.info("手动工位{}传工厂入参VO{}" + stationCode,new Gson().toJson(parentVO)); |
| | | logger.info("手动工位{}传工厂MES异步方法{}"+stationCode,execute.body()); |
| | | |
| | | DaParamCollectionTemp daParamCollectionTemp = new DaParamCollectionTemp(); |
| | | daParamCollectionTemp.setSfcCode(packID); |
| | |
| | | System.out.println(e.getMessage()); |
| | | } |
| | | // HttpResponse execute = HttpRequest.post(url).body(JSONUtil.toJsonStr(parentVO)).execute(); |
| | | |
| | | // System.out.println(execute.body()); |
| | | System.out.println("-----------------------"+totalResult); |
| | | logger.info("结束人工工位推送工厂MES数据方法-pushGeelycvMesFeedback-工位{}-pack码{}",stationCode,packID); |
| | | } |
| | | |
| | |
| | | CompletableFuture<Void> cp1 = CompletableFuture.runAsync(() -> { |
| | | logger.info("开始执行异步方法"); |
| | | HttpResponse execute = HttpRequest.post(url).body(JSONUtil.toJsonStr(parentVO)).execute(); |
| | | System.out.println(execute.body()); |
| | | logger.info("异步方法执行结束"); |
| | | logger.info("自动工位传工厂MES异步方法{}"+execute.body()); |
| | | logger.info("自动工位{}传工厂入参VO{}" + stationCode,new Gson().toJson(parentVO)); |
| | | logger.info("自动工位{}传工厂MES异步方法返回{}"+stationCode,execute.body()); |
| | | }); |
| | | }catch (Exception e){ |
| | | System.out.println(e.getMessage()); |
| | | } |
| | | // HttpResponse execute = HttpRequest.post(url).body(JSONUtil.toJsonStr(parentVO)).execute(); |
| | | logger.info("结束工位{}-工厂MES推送数据方法HttpResponseSend",stationCode); |
| | | System.out.println("-----------------------"+totalResult); |
| | | } |
| | | logger.info("结束工位{}-工厂MES推送数据方法automaticWorkstationPushGeelycvMesFeedback",stationCode); |
| | | } |
| | |
| | | childVOList.add(childVO); |
| | | parentVO.setSiteCode("3983"); |
| | | parentVO.setRecordId(""+timestampMillis); |
| | | parentVO.setStationCode("OP500"); |
| | | parentVO.setStationCode("POP430"); |
| | | parentVO.setProductNum(daParamCollection.getSfcCode()); |
| | | parentVO.setTotalResult("1"); |
| | | parentVO.setCheckList(childVOList); |
| | |
| | | // }catch (Exception e){ |
| | | // System.out.println(e.getMessage()); |
| | | // } |
| | | RestfulService.getWorkReportResultFeedback(daParamCollection.getSfcCode(),"OP500",format.format(new Date())); |
| | | RestfulService.getWorkReportResultFeedback(daParamCollection.getSfcCode(),"POP430",format.format(new Date())); |
| | | } |
| | | |
| | | @Override |
| | |
| | | |
| | | @Override |
| | | public void preInstallOut(DaParamCollection daParamCollection) { |
| | | String locationCode = daParamCollection.getLocationCode(); |
| | | //增加过站记录 |
| | | DaPassingStationCollection daPassingStationCollection = new DaPassingStationCollection(); |
| | | daPassingStationCollection.setSfcCode(daParamCollection.getProductBarcode()); |
| | | daPassingStationCollection.setLocationCode(daParamCollection.getLocationCode()); |
| | | daPassingStationCollection.setLocationCode(locationCode); |
| | | daPassingStationCollection.setInboundTime(daParamCollection.getInboundTime()); |
| | | daPassingStationCollection.setOutboundTime(new Date()); |
| | | daPassingStationCollection.setCreateTime(new Date()); |
| | |
| | | boolean save = daPassingStationCollectionService.save(daPassingStationCollection); |
| | | //添加基础参数 |
| | | this.manualWorkstationsAddBasicParameters(daParamCollection); |
| | | |
| | | try { |
| | | String str = "PACK."+locationCode+".RecordDataDone"; |
| | | miloService.writeToOpcShort(ReadWriteEntity.builder().identifier(str).value(21).build()); |
| | | logger.info("预装工位写入OPC成功,工位:{},值{}",str,21); |
| | | } catch (Exception e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | } |
| | | |
| | | } |