| | |
| | | import com.billion.main.om.domain.OmProductionOrderInfo; |
| | | import com.billion.main.om.service.IOmOrderSchedulingService; |
| | | import com.billion.main.om.service.IOmProductionOrderInfoService; |
| | | import com.billion.main.plcServer.util.TimeUtil; |
| | | import com.billion.main.sys.domain.SysCount; |
| | | import com.billion.main.sys.service.ISysCountService; |
| | | import com.kangaroohy.milo.model.ReadWriteEntity; |
| | |
| | | import com.kangaroohy.milo.service.MiloService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.stereotype.Component; |
| | | import com.billion.main.plcServer.util.TimeUtil; |
| | | |
| | | import java.text.SimpleDateFormat; |
| | | import java.time.LocalDateTime; |
| | |
| | | omOrderScheduling.setWorkOrderNo(workOrderNumber.toString()); |
| | | omOrderScheduling.setNowQty(nowQty.toString()); |
| | | omOrderScheduling.setSfcCode(SFCCode.toString()); |
| | | Date Time = new Date(); |
| | | ReadWriteEntity TimeRead = miloService.readFromOpcUa(thoroughfare + "." + device + ".StartTime"); |
| | | Time = format.parse(TimeUtil.test(TimeUtil.stringProcessing(TimeRead.getValue().toString()))); |
| | | omOrderScheduling.setOnlineTime(Time); |
| | | omOrderScheduling.setStatus("1"); |
| | | //托盘绑定SFCCode和工单和产线 |
| | | if(Constants.OP005.equals(device)){ |
| | | omOrderScheduling.setRemarks("Body"); |
| | |
| | | } |
| | | omOrderSchedulingService.insertOmOrderScheduling(omOrderScheduling); |
| | | }else if(Constants.OFFLINE.contains(device)){ |
| | | Date Time = new Date(); |
| | | ReadWriteEntity TimeRead = miloService.readFromOpcUa(thoroughfare + "." + device + ".StopTime"); |
| | | Time = format.parse(TimeUtil.test(TimeUtil.stringProcessing(TimeRead.getValue().toString()))); |
| | | omOrderScheduling.setOfflineTime(Time); |
| | | omOrderScheduling.setStatus("2"); |
| | | if(Constants.C060.equals(device)){ |
| | | omOrderScheduling.setRemarks("Head"); |
| | | omOrderScheduling.setSfcCode(SFCCode.toString()); |
| | |
| | | //查询descriptive字段等于1的采集项保存到扫码保存到da_material_collection表里 |
| | | DaCollectionParamConf daCollectionParamConf1 = new DaCollectionParamConf(); |
| | | daCollectionParamConf1.setProcessesCode(device); |
| | | daCollectionParamConf1.setDescriptive("3"); |
| | | daCollectionParamConf1.setDescriptive("1"); |
| | | List<DaCollectionParamConf> daCollectionParamConfList1 = daCollectionParamConfService.selectDaCollectionParamConfList(daCollectionParamConf1); |
| | | for (DaCollectionParamConf conf : daCollectionParamConfList1) { |
| | | String gatherAddress = conf.getGatherAddress(); |
| | | Object valueObj = miloService.readFromOpcUa(gatherAddress).getValue(); // 获取原始值对象:ml-citation{ref="4" data="citationList"} |
| | | if (valueObj != null ) { |
| | | String valueObj = miloService.readFromOpcUa(gatherAddress).getValue().toString(); // 获取原始值对象:ml-citation{ref="4" data="citationList"} |
| | | if (!Objects.equals(valueObj, " ")) { |
| | | DaMaterialCollection materialCollection = new DaMaterialCollection(); |
| | | materialCollection.setSfcCode(SFCCode.toString()); |
| | | materialCollection.setLocationCode(device); |
| | | materialCollection.setParamName(conf.getParameterSetName()); |
| | | materialCollection.setParamValue((String) miloService.readFromOpcUa(gatherAddress).getValue()); |
| | | materialCollection.setCollectTime(new Date()); |
| | | materialCollection.setParamValue(miloService.readFromOpcUa(gatherAddress).getValue().toString()); |
| | | Date Time = new Date(); |
| | | ReadWriteEntity TimeRead = miloService.readFromOpcUa(thoroughfare + "." + device + ".StopTime"); |
| | | Time = format.parse(TimeUtil.test(TimeUtil.stringProcessing(TimeRead.getValue().toString()))); |
| | | materialCollection.setCollectTime(Time); |
| | | daMaterialCollectionService.insertDaMaterialCollection(materialCollection); |
| | | } |
| | | else { |
| | | log.debug("采集项为空: {}", gatherAddress); |
| | | } |
| | | } |
| | | //查询descriptive字段等于2的采集项保存到扫码保存到da_param_collection表里 |
| | | // 查询descriptive字段等于2的采集项保存到扫码保存到da_param_collection表里 |
| | | DaCollectionParamConf daCollectionParamConf2 = new DaCollectionParamConf(); |
| | | daCollectionParamConf2.setProcessesCode(device); |
| | | daCollectionParamConf2.setDescriptive("4"); |
| | | daCollectionParamConf2.setDescriptive("2"); |
| | | List<DaCollectionParamConf> daCollectionParamConfList2 = daCollectionParamConfService.selectDaCollectionParamConfList(daCollectionParamConf2); |
| | | for (DaCollectionParamConf conf : daCollectionParamConfList2) { |
| | | String gatherAddress = conf.getGatherAddress(); |
| | | Object valueObj = miloService.readFromOpcUa(gatherAddress).getValue(); // 获取原始值对象:ml-citation{ref="4" data="citationList"} |
| | | if (valueObj != null ) { |
| | | String valueObj = miloService.readFromOpcUa(gatherAddress).getValue().toString(); // 获取原始值对象:ml-citation{ref="4" data="citationList"} |
| | | if (!Objects.equals(valueObj, "0.0") && !Objects.equals(valueObj, "0")) { |
| | | DaParamCollection paramCollection = new DaParamCollection(); |
| | | paramCollection.setSfcCode(SFCCode.toString()); |
| | | paramCollection.setLocationCode(device); |
| | | paramCollection.setParamName(conf.getParameterSetName()); |
| | | paramCollection.setParamValue((String) miloService.readFromOpcUa(gatherAddress).getValue()); |
| | | paramCollection.setCollectionTime(new Date()); |
| | | paramCollection.setParamValue(miloService.readFromOpcUa(gatherAddress).getValue().toString()); |
| | | Date Time = new Date(); |
| | | ReadWriteEntity TimeRead = miloService.readFromOpcUa(thoroughfare + "." + device + ".StopTime"); |
| | | Time = format.parse(TimeUtil.test(TimeUtil.stringProcessing(TimeRead.getValue().toString()))); |
| | | paramCollection.setCollectTime(Time); |
| | | daParamCollectionService.insertDaParamCollection(paramCollection); |
| | | } |
| | | else { |
| | | log.debug("采集项为空: {}", gatherAddress); |
| | | } |
| | | } |
| | | DaStationCollection daStationCollection = new DaStationCollection(); |
| | | daStationCollection.setLocationCode(device); |