| | |
| | | miloService.writeToOpcShort(ReadWriteEntity.builder().identifier(thoroughfare + "." + device + ".ScanerResult1").value(scanResult).build()); |
| | | log.info("写入到工位{}的ScanerResult1数据:{}",device,scanResult); |
| | | } |
| | | }else if (Constants.RECORD_SN.equals(tab)){//请求下发模组码9 |
| | | if (Constants.ONE.equals(valueString)){ |
| | | if (Constants.OP070.equals(device)){ |
| | | List<WorkOrder> orderList = workOrderService.list().stream() |
| | | .sorted(Comparator.comparing(WorkOrder::getCreateTime).reversed()) |
| | | .collect(Collectors.toList()); |
| | | if (CollUtil.isNotEmpty(orderList)){ |
| | | String productNum = orderList.get(0).getProductNum();//模组码 |
| | | //OP070下发产品模组码 |
| | | miloService.writeToOpcUa(ReadWriteEntity.builder().identifier(thoroughfare + "." + device + ".ModuleCode").value(productNum).build()); |
| | | miloService.writeToOpcShort(ReadWriteEntity.builder().identifier(thoroughfare + "." + device + ".RecordSNDone").value(1).build()); |
| | | }else{ |
| | | miloService.writeToOpcShort(ReadWriteEntity.builder().identifier(thoroughfare + "." + device + ".RecordSNDone").value(2).build());//没有要生产的工单 |
| | | } |
| | | } |
| | | } |
| | | }else if (Constants.RECORD_DATA.equals(tab)){//出入站 |
| | | if (Constants.ONE.equals(valueString)){//入站 |
| | | //1:告知MES托盘已到站,请求下发进站状态 |
| | |
| | | miloService.writeToOpcShort(ReadWriteEntity.builder().identifier(thoroughfare + "." + device + ".RecordDataDone").value(21).build()); |
| | | log.info("写入到工位{}的RecordDataDone数据:{}",device,21); |
| | | }else if (Constants.OP020_OP065.contains(device)){ |
| | | String result = "21"; |
| | | Integer result = 21; |
| | | //读取电芯码 |
| | | List<String> cellCodeList = readCellCodeList(thoroughfare, device); |
| | | if(ObjectUtil.isNull(cellCodeList) && cellCodeList.size() != 4){ |
| | | result = "23"; |
| | | result = 23; |
| | | miloService.writeToOpcShort(ReadWriteEntity.builder().identifier(thoroughfare + "." + device + ".RecordDataDone").value(23).build()); |
| | | }else{ |
| | | result = savePassingStation(thoroughfare, device,cellCodeList);//保存过站 |
| | | if(result.equals("21")) { |
| | | if(result==21) { |
| | | result = saveParamCollection(thoroughfare, device,cellCodeList);//保存参数,发送工厂MES |
| | | } |
| | | } |
| | |
| | | log.info("写入到工位{}的RecordDataDone数据:{}",device,result); |
| | | } else if (Constants.OP100_1.equals(device) || Constants.OP100_2.equals(device)){ |
| | | //下发刻码信息-为模组码 |
| | | ProductOrderQuery query = new ProductOrderQuery(); |
| | | /*ProductOrderQuery query = new ProductOrderQuery(); |
| | | query.setSiteCode("3983"); |
| | | query.setStationCode(device); |
| | | query.setStationCode(device);*/ |
| | | List<WorkOrder> collect = workOrderService.list().stream() |
| | | .sorted(Comparator.comparing(WorkOrder::getCreateTime).reversed()) |
| | | .collect(Collectors.toList()); |
| | | if (CollUtil.isNotEmpty(collect)){ |
| | | /*if (CollUtil.isNotEmpty(collect)){ |
| | | query.setProductNum(collect.get(0).getProductNum()); |
| | | } |
| | | }*/ |
| | | // ProductOrderVO vo = daPassingStationCollectionService.queryMessFromLine(query); |
| | | ProductOrderVO vo = new ProductOrderVO(); |
| | | ProductOrderChild child = new ProductOrderChild(); |
| | |
| | | log.info("写入到工位{}的RecordDataDone数据:{}",device,21); |
| | | } |
| | | } |
| | | } else if (Constants.RECORD_SN.equals(tab)){ |
| | | if (Constants.ONE.equals(valueString)){ |
| | | if (Constants.OP070.equals(device)){ |
| | | //OP070下发产品模组码 |
| | | String string = UUID.randomUUID().toString(); |
| | | miloService.writeToOpcUa(ReadWriteEntity.builder().identifier(thoroughfare + "." + device + ".ModuleCode").value(string).build()); |
| | | miloService.writeToOpcShort(ReadWriteEntity.builder().identifier(thoroughfare + "." + device + ".RecordSNDone").value(1).build()); |
| | | } |
| | | } |
| | | } else if (Constants.RECORD_CHECK_CODE_1.equals(tab)) { |
| | | if (Constants.OP100_1.equals(device)){ |
| | | //钢带条码校验--发送给工厂mes |
| | |
| | | * @return list |
| | | * @throws Exception e |
| | | */ |
| | | private static String savePassingStation(String thoroughfare, String device,List<String> cellCodeList){ |
| | | String result = "21"; |
| | | private static Integer savePassingStation(String thoroughfare, String device,List<String> cellCodeList){ |
| | | Integer result = 21; |
| | | |
| | | try { |
| | | //读进站时间 |
| | |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS"); |
| | | startTime = sdf.parse(stringStartTime); |
| | | }else{ |
| | | result = "23"; |
| | | result = 23; |
| | | log.info("读取到工位{}的StartTime数据:{},返回RecordDataDone的值为{}",device,"IS NULL!",result); |
| | | } |
| | | |
| | |
| | | stationStatus = Constants.UN_PASS; |
| | | } |
| | | }else{ |
| | | result = "23"; |
| | | result = 23; |
| | | log.info("读取到工位{}StationStatuss数据:{},返回RecordDataDone的值为{}",device,"IS NULL!",result); |
| | | } |
| | | |
| | |
| | | passingStationCollection.setCollectionTime(new Date());//采集时间 |
| | | passingList.add(passingStationCollection); |
| | | }else{ |
| | | result = "23"; |
| | | result = 23; |
| | | log.info("读取到工位{}CellCode数据:{},返回RecordDataDone的值为{}",device,"IS NULL!",result); |
| | | } |
| | | } |
| | |
| | | * @return list |
| | | * @throws Exception e |
| | | */ |
| | | private static String saveParamCollection(String thoroughfare, String device,List<String> cellCodeList){ |
| | | String result = "21";//返回结果 |
| | | private static Integer saveParamCollection(String thoroughfare, String device,List<String> cellCodeList){ |
| | | Integer result = 21;//返回结果 |
| | | List<List<ChildVO>> mesList = new ArrayList<>();//存储4个电芯的发送给MES的值 |
| | | |
| | | try { |