| | |
| | | //OP020 电芯挡位校验 |
| | | if (Constants.OP020.equals(device)){ |
| | | Integer result = 11; |
| | | Object cellGearObjcet = miloService.readFromOpcUa(thoroughfare + "." + device + ".CellGear").getValue(); |
| | | /*Object cellGearObjcet = miloService.readFromOpcUa(thoroughfare + "." + device + ".CellGear").getValue(); |
| | | if (ObjectUtil.isNull(cellGearObjcet)){ |
| | | result = 16;//电芯挡位为空 |
| | | result = 11;//如果电芯挡位为空,不进行挡位校验 |
| | | }else{ |
| | | String cellGear = cellGearObjcet.toString(); |
| | | /*List<String> cellCodeList = readCellCodeList(thoroughfare, device); |
| | | result = checkCellGear(thoroughfare, device,cellCodeList,cellGear);//校验电芯挡位和组别*/ |
| | | } |
| | | List<String> cellCodeList = readCellCodeList(thoroughfare, device); |
| | | result = checkCellGear(thoroughfare, device,cellCodeList,cellGear);//校验电芯挡位和组别 |
| | | Constants.OLD_CELL_GEAR = cellGear;//挡位赋值 |
| | | }*/ |
| | | miloService.writeToOpcShort(ReadWriteEntity.builder().identifier(thoroughfare + "." + device + ".RecordDataDone").value(result).build()); |
| | | |
| | | }else if (Constants.OP030.equals(device)){ |
| | |
| | | return; |
| | | } |
| | | |
| | | result = savePassingStation(thoroughfare, device,cellCodeList);//保存过站 |
| | | //result = savePassingStation(thoroughfare, device,cellCodeList);//保存过站 |
| | | if(result == 21) { |
| | | if(Constants.OP020.contains(device)){ |
| | | if(!cellCode1.isEmpty()){ |
| | |
| | | Object stationStatusObjcet = miloService.readFromOpcUa(thoroughfare + "." + device + ".StationStatus").getValue();//站状态地址 |
| | | if (ObjectUtil.isNotNull(stationStatusObjcet)){ |
| | | String stationStatus = stationStatusObjcet.toString(); |
| | | result = savePassingStation(thoroughfare, device,moduleCode,stationStatus);//保存过站 |
| | | //result = savePassingStation(thoroughfare, device,moduleCode,stationStatus);//保存过站 |
| | | if(result == 21) { |
| | | result = saveParamCollection(device,moduleCode,stationStatus);//保存参数,发送工厂MES |
| | | } |
| | |
| | | */ |
| | | private Integer checkCellGear(String thoroughfare, String device,List<String> cellCodeList,String cellGear) throws Exception { |
| | | Integer result = 11; |
| | | |
| | | String cellSerial = ""; |
| | | for(int i = 0; i < cellCodeList.size(); i ++){ |
| | | Integer cellStatus = 1; |
| | | String cellCode = cellCodeList.get(i); |
| | |
| | | if(CollUtil.isNotEmpty(list)){ |
| | | DaCellData daCellData = list.get(0); |
| | | String cellValue = daCellData.getCellValue();//数据库中电芯挡位 |
| | | String cellSerial = daCellData.getCellSerial();//数据库中电芯组别 |
| | | cellSerial = daCellData.getCellSerial();//数据库中电芯组别 |
| | | if(!cellValue.isEmpty() && cellValue.equals(cellGear)){ |
| | | cellStatus = 1; |
| | | }else { |
| | | cellStatus = 2; |
| | | result = 17;//挡位校验不合格 |
| | | result = 16;//挡位校验不合格 |
| | | log.info("电芯挡位校验不合格:电芯码为{},PLC设置挡位为{},工厂MES下发挡位为:{}",cellCode,cellGear,cellValue); |
| | | } |
| | | }else { |
| | | cellStatus = 2; |
| | | result = 17;//查不到要校验的挡位 |
| | | result = 16;//查不到要校验的挡位 |
| | | log.info("电芯挡位校验不合格:电芯码为{},PLC设置挡位为{},工厂MES下发挡位为空,查询不到该数据",cellCode,cellGear); |
| | | } |
| | | miloService.writeToOpcShort(ReadWriteEntity.builder().identifier(thoroughfare + "." + device + ".CellStatus_"+(i+1)).value(cellStatus).build()); |
| | | miloService.writeToOpcShort(ReadWriteEntity.builder().identifier(thoroughfare + "." + device + ".Cell_Status_"+(i+1)).value(cellStatus).build()); |
| | | } |
| | | } |
| | | |
| | | //当电芯挡位发生变化时,并且老的挡位不为空,删除当前电芯批次 |
| | | if(!Constants.OLD_CELL_GEAR.isEmpty() && !cellGear.equals(Constants.OLD_CELL_GEAR)){ |
| | | if(!cellSerial.isEmpty()){ |
| | | daCellDataService.deleteDaCellDataByCellSerial(cellSerial); |
| | | } |
| | | log.info("电芯挡位发生改变,老的挡位为:{},新的挡位为:{},批次号为{}",Constants.OLD_CELL_GEAR,cellGear,cellSerial); |
| | | } |
| | | |
| | | return result; |
| | | } |
| | | |
| | |
| | | public static String getWorkReportResultFeedback(String productNum,String stationCode,String confirmTime) |
| | | { |
| | | String result = ""; |
| | | String url = Constants.FACTORY_EMS_UAT_GET_RUL + "workReportResultFeedback?siteCode="+Constants.FACTORY_EMS_SITE_CODE+"&stationCode="+stationCode+"&productNum="+productNum+"&confirmTime="+confirmTime; |
| | | try { |
| | | String url = Constants.FACTORY_EMS_UAT_GET_RUL + "workReportResultFeedback?siteCode="+Constants.FACTORY_EMS_SITE_CODE+"&stationCode="+stationCode+"&productNum="+productNum+"&confirmTime="+confirmTime; |
| | | log.info("执行工厂MES报工方法start,序列号{}工位号{}url{}",productNum,stationCode ,url); |
| | | HttpResponse response = HttpRequest.get(url).execute(); |
| | | HttpRequest httpRequest = HttpRequest.get(url); |
| | | //HttpRequest httpRequest = HttpRequest.get(url); |
| | | result = response.body(); |
| | | log.info("执行工厂MES报工方法第一次end,序列号{}工位号{}返回数据{}",productNum,stationCode ,result); |
| | | }catch (Exception e){ |
| | | throw new RuntimeException(e); |
| | | }finally { |
| | | if(result.isEmpty()){ |
| | | HttpResponse response = HttpRequest.get(url).execute(); |
| | | result = response.body(); |
| | | log.info("执行工厂MES报工方法第二次end,序列号{}工位号{}返回数据{}",productNum,stationCode ,result); |
| | | } |
| | | return result; |
| | | } |
| | | } |
| | |
| | | if (CollUtil.isNotEmpty(list)){ |
| | | for(DaCollectionParamConf conf:list){ |
| | | //1P1S生成 |
| | | if(conf.getCollectParameterId().equals("1P1S")){ |
| | | if("1P1S".equals(conf.getCollectParameterId())){ |
| | | String result = get1P1S(sfcCode); |
| | | conf.setParamCentral(result); |
| | | } |
| | |
| | | String batteryTypeCode = list.get(0).getBatteryTypeCode();//电池类型代码 |
| | | String specificationsCode = list.get(0).getSpecificationsCode();//规格代码 |
| | | String traceInfoCode = list.get(0).getTraceInfoCode();//追溯信息代码 |
| | | |
| | | String oldDateCode = list.get(0).getProDateCode(); |
| | | String proDateCode = Constants.YEARSMAP.get(now.getYear()) |
| | | + Constants.MONTHSMAP.get(now.getMonthValue()) |
| | | + Constants.DAYMAP.get(now.getDayOfMonth());//生产日期 |
| | | |
| | | String code = list.get(0).getSfcCode();//序列号 |
| | | String code = ""; |
| | | if(oldDateCode.equals(proDateCode)){ |
| | | code = list.get(0).getSfcCode();//序列号 |
| | | }else { |
| | | code = "0"; |
| | | } |
| | | code = StringUtils.leftPad(String.valueOf(Integer.valueOf(code)+1),7, "0");;//序列号 |
| | | result = mfCode+proTypeCode+batteryTypeCode+specificationsCode+traceInfoCode+proDateCode+code; |
| | | |