| | |
| | | import java.io.IOException; |
| | | import java.util.*; |
| | | import java.util.concurrent.CompletableFuture; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * @author Administrator |
| | |
| | | return map; |
| | | } |
| | | standardMethodLists.addAll(standardMethodMapper.selectStandardMethodListsByNull(str)); |
| | | map.put("standardMethodList", standardMethodLists); |
| | | List<StandardMethodList> collect = standardMethodLists.stream().distinct().collect(Collectors.toList()); |
| | | map.put("standardMethodList", collect); |
| | | return map; |
| | | } |
| | | |
| | |
| | | */ |
| | | public class DCResistanceMqttConstants { |
| | | |
| | | /** |
| | | * SN号 |
| | | */ |
| | | public final static String NSDQCS_DQCS_SN = "NSDQCS.DQCS.SN"; |
| | | |
| | | /** |
| | | * 电阻值 |
| | | */ |
| | | public final static String NSDQCS_DQCS_DZZ = "NSDQCS.DQCS.DZZ"; |
| | | |
| | | /** |
| | | * 64 |
| | | */ |
| | | public final static String NSDQCS_DQCS_64 = "NSDQCS.DQCS.64"; |
| | | |
| | | /** |
| | | * 长度 |
| | | */ |
| | | public final static String NSDQCS_DQCS_CD = "NSDQCS.DQCS.CD"; |
| | | |
| | | /** |
| | | * 反向电阻值 |
| | | */ |
| | | public final static String NSDQCS_DQCS_FXDZZ = "NSDQCS.DQCS.FXDZZ"; |
| | | |
| | | /** |
| | | * 正向电阻值 |
| | | */ |
| | | public final static String NSDQCS_DQCS_ZXDZZ = "NSDQCS.DQCS.ZXDZZ"; |
| | | |
| | | /** |
| | | * 温度 |
| | | */ |
| | | public final static String NSDQCS_DQCS_WD = "NSDQCS.DQCS.WD"; |
| | | |
| | | } |
| | |
| | | String parse = new String(message.getPayload()); |
| | | switch (topic){ |
| | | case "/ztt/v3/2455220/publish": |
| | | //耐丝:直流电阻数据解析 |
| | | //耐丝:直流电阻数据解析NS-ER02001 |
| | | mqCallback.collectBridgeService.dcResistanceDataAnalysis(parse); |
| | | break; |
| | | case "/ztt/v3/2455221/publish": |
| | | //耐丝:伸长率数据解析 |
| | | //耐丝:伸长率数据解析NS-FM05003 |
| | | mqCallback.collectBridgeService.elongationDataAnalysis(parse); |
| | | break; |
| | | } |
| | |
| | | @ApiModelProperty("最后一次采集时间") |
| | | private LocalDateTime lastCollectDate; |
| | | |
| | | public CollectBridge(String entrustCode, BigDecimal collectValue, LocalDateTime firstCollectDate, LocalDateTime lastCollectDate) { |
| | | public CollectBridge(String entrustCode, BigDecimal collectValue, Double collectTemperature, LocalDateTime firstCollectDate, LocalDateTime lastCollectDate) { |
| | | this.entrustCode = entrustCode; |
| | | this.collectValue = collectValue; |
| | | this.collectTemperature = collectTemperature; |
| | | this.firstCollectDate = firstCollectDate; |
| | | this.lastCollectDate = lastCollectDate; |
| | | } |
| | |
| | | if(CollectionUtil.isNotEmpty(dataMap) && Objects.nonNull(dataMap.get("data"))){ |
| | | List<DeviceMqttVO> dataList = JSONArray.parseObject(dataMap.get("data").toString(), new TypeReference<List<DeviceMqttVO>>(){}.getType()); |
| | | //过滤出包含实际电阻值的对象 |
| | | // 处理 NSDQCS.DQCS.DZZ 数据 |
| | | String entrustCode = getValueByDataStream(dataList,DCResistanceMqttConstants.NSDQCS_DQCS_SN); |
| | | BigDecimal value = new BigDecimal(getValueByDataStream(dataList,DCResistanceMqttConstants.NSDQCS_DQCS_DZZ)); |
| | | BigDecimal zxdzzValue = new BigDecimal(getValueByDataStream(dataList,DCResistanceMqttConstants.NSDQCS_DQCS_ZXDZZ)); |
| | | BigDecimal fxdzzValue = new BigDecimal(getValueByDataStream(dataList,DCResistanceMqttConstants.NSDQCS_DQCS_FXDZZ)); |
| | | // BigDecimal testLength = new BigDecimal(getValueByDataStream(dataList,DCResistanceMqttConstants.NSDQCS_DQCS_CD)); |
| | | Double tempValue = new BigDecimal(getValueByDataStream(dataList,DCResistanceMqttConstants.NSDQCS_DQCS_WD)).setScale(2, RoundingMode.HALF_UP).doubleValue(); |
| | | //计算平均电阻值 |
| | | BigDecimal value = zxdzzValue.abs().add(fxdzzValue.abs()).divide(BigDecimal.valueOf(2L), RoundingMode.HALF_UP); |
| | | Long count = collectBridgeMapper.selectCount(Wrappers.<CollectBridge>lambdaQuery().eq(CollectBridge::getEntrustCode, entrustCode)); |
| | | if(count>0L){ |
| | | collectBridgeMapper.update(null,Wrappers.<CollectBridge>lambdaUpdate() |
| | | .set(CollectBridge::getCollectValue,value) |
| | | .set(CollectBridge::getCollectTemperature,tempValue) |
| | | .set(CollectBridge::getLastCollectDate,LocalDateTime.now()) |
| | | .eq(CollectBridge::getEntrustCode,entrustCode)); |
| | | }else{ |
| | | collectBridgeMapper.insert(new CollectBridge(entrustCode,value,LocalDateTime.now(),LocalDateTime.now())); |
| | | collectBridgeMapper.insert(new CollectBridge(entrustCode,value,tempValue,LocalDateTime.now(),LocalDateTime.now())); |
| | | } |
| | | } |
| | | } |
| | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.StringUtils; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | |
| | | import com.ruoyi.device.pojo.Device; |
| | | import com.ruoyi.device.service.DataConfigService; |
| | | import lombok.AllArgsConstructor; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | |
| | | List<DataConfig> list = baseMapper.selectList(Wrappers.<DataConfig>lambdaQuery() |
| | | .eq(DataConfig::getDeviceId,dataConfig.getDeviceId()) |
| | | .eq(DataConfig::getInspectionItem,dataConfig.getInspectionItem()) |
| | | .eq(DataConfig::getInspectionItemClass,dataConfig.getInspectionItemClass()) |
| | | .eq(DataConfig::getInspectionItemSubclass,dataConfig.getInspectionItemSubclass()) |
| | | .eq(StringUtils.isNotBlank(dataConfig.getInspectionItemClass()),DataConfig::getInspectionItemClass,dataConfig.getInspectionItemClass()) |
| | | .eq(StringUtils.isNotBlank(dataConfig.getInspectionItemSubclass()),DataConfig::getInspectionItemSubclass,dataConfig.getInspectionItemSubclass()) |
| | | .eq(DataConfig::getStructureItemParameterId, dataConfig.getStructureItemParameterId())); |
| | | return Result.success(list); |
| | | } |
| | |
| | | throw new ErrorException("直流电阻数采异常:没有找到委托编号为【"+entrustCode+"】的数据"); |
| | | } |
| | | list.add(0,1);//测试长度,默认1 |
| | | list.add(1,Objects.isNull(collectBridge.getCollectTemperature())?0.0:collectBridge.getCollectTemperature());//todo:温度,暂时未采集到值 |
| | | list.add(1,Objects.isNull(collectBridge.getCollectTemperature())?0.0:collectBridge.getCollectTemperature()); |
| | | list.add(2,collectBridge.getCollectValue());//实际电阻值 |
| | | }else { |
| | | // 从 Redis 中获取列表数据 |
| | | List<?> objectList = RedisUtil.lGet(refery, 0, -1); |
| | | Set<Object> objectList = RedisUtil.getZSetRange(refery, 0, -1); |
| | | list.addAll(objectList); |
| | | } |
| | | numberOfDataEntries.getAndIncrement(); |
| | |
| | | // 从 JSON 数据中提取 data 数组 |
| | | JSONArray dataList = JSONArray.parseArray(jsonObject.get("data").toString()); |
| | | dataConfig.forEach((k, v) -> { |
| | | AtomicInteger numberOfDataEntries = new AtomicInteger(); |
| | | AtomicInteger numberOfDataEntries = new AtomicInteger(0); |
| | | List<Object> list = new ArrayList<>(); |
| | | for (int config = 0; config < v.size(); config++) { |
| | | // String refery = v.get(config).getRefery(); |
| | |
| | | List<Object> result = new ArrayList<>(); |
| | | for (int i = 0; i < numberOfDataEntries.get(); i++) { |
| | | String aggregate = ""; |
| | | for (int j = 0; j < v.size(); j++) { |
| | | int index; |
| | | if (j == 0) { |
| | | index = i; |
| | | } else { |
| | | index = numberOfDataEntries.get() + i; |
| | | } |
| | | aggregate += list.get(index).toString() + ","; |
| | | } |
| | | // for (int j = 0; j < v.size(); j++) { |
| | | // int index; |
| | | // if (j == 0) { |
| | | // index = i; |
| | | // } else { |
| | | // index = numberOfDataEntries.get() + i; |
| | | // } |
| | | // } |
| | | aggregate += list.get(i).toString() + ","; |
| | | int lastIndex = aggregate.lastIndexOf(","); |
| | | String substring = aggregate.substring(0, lastIndex); |
| | | result.add(substring); |
| | |
| | | return Result.success(rawMaterialOrderService.confirmSplitOrder(orderSplitDTO)); |
| | | } |
| | | |
| | | /** |
| | | * 根据ifsId查询下单数量 |
| | | */ |
| | | @ApiOperation(value = "根据ifsId查询下单数量") |
| | | @GetMapping("/getOrderCountByIfsId/{ifsId}") |
| | | public Result getOrderCountByIfsId(@PathVariable("ifsId") Long ifsId){ |
| | | return Result.success(rawMaterialOrderService.getOrderCountByIfsId(ifsId)); |
| | | } |
| | | |
| | | } |
| | |
| | | Result importSplitOrderData(MultipartFile file,Long ifsId, HttpServletRequest request); |
| | | |
| | | boolean confirmSplitOrder(OrderSplitDTO orderSplitDTO); |
| | | |
| | | Long getOrderCountByIfsId(Long ifsId); |
| | | } |
| | |
| | | import com.ruoyi.basic.mapper.IfsInventoryQuantityMapper; |
| | | import com.ruoyi.basic.pojo.IfsInventoryQuantity; |
| | | import com.ruoyi.common.core.domain.Result; |
| | | import com.ruoyi.common.enums.OrderType; |
| | | import com.ruoyi.common.utils.api.IfsApiUtils; |
| | | import com.ruoyi.inspect.dto.IfsPartPropsRecordDTO; |
| | | import com.ruoyi.inspect.mapper.IfsSplitOrderRecordMapper; |
| | |
| | | import com.ruoyi.inspect.service.IfsPartPropsRecordService; |
| | | import com.ruoyi.inspect.mapper.IfsPartPropsRecordMapper; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | |
| | | throw new RuntimeException("未找到对应的IFS订单信息"); |
| | | } |
| | | //判断是否是拆分订单 |
| | | if(ifsInventoryQuantity.getIsSplitOrder().equals(1)){ |
| | | if(ifsInventoryQuantity.getIsSplitOrder().equals(1)&& StringUtils.equals(ifsInventoryQuantity.getOrderType(), OrderType.RAW.getValue())){ |
| | | //查询拆分记录 |
| | | IfsSplitOrderRecord splitRecord = ifsSplitOrderRecordMapper.selectOne(Wrappers.<IfsSplitOrderRecord>lambdaQuery() |
| | | .eq(IfsSplitOrderRecord::getOrderNo, ifsInventoryQuantity.getOrderNo()) |
| | |
| | | |
| | | //设置样式 |
| | | TableStyle tableStyle = new TableStyle(); |
| | | if(max<=5){ |
| | | for (int i = 1; i <= max; i++) { |
| | | // 根据减压那结果个数修改长度 |
| | | // 根据检验结果个数修改长度 |
| | | switch (i) { |
| | | case 1: |
| | | tableStyle.setColWidths(new int[]{650, 2900, 850, 2300, 2100, 1200}); |
| | |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | |
| | | tableStyle.setWidth("10000"); |
| | | tableStyle.setAlign(TableRowAlign.CENTER); |
| | | BorderStyle borderStyle = new BorderStyle(); |
| | |
| | | return false; |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class,isolation = Isolation.READ_COMMITTED) |
| | | public Long getOrderCountByIfsId(Long ifsId) { |
| | | return insOrderMapper.selectCount(Wrappers.<InsOrder>lambdaQuery().eq(InsOrder::getIfsInventoryId,ifsId).ne(InsOrder::getState,-1)); |
| | | } |
| | | |
| | | /** |
| | | * 添加工时 |
| | | * @param insOrder |
| | |
| | | # oa流程 |
| | | oa: |
| | | oaHost: http://192.168.0.49:8000/oa_workflowrequest.asmx?wsdl |
| | | prodIp: http://192.168.21.53:7012/lims |
| | | prodIp: http://192.168.21.53:7002/lims |
| | | unqualifiedProcessId: 715114 |
| | | |
| | | # 企业微信推送 |
| | |
| | | import org.springframework.data.redis.serializer.StringRedisSerializer; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Set; |
| | | import java.util.*; |
| | | import java.util.concurrent.TimeUnit; |
| | | |
| | | @Component |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 获取zset元素,按排名 |
| | | * @param key 键 |
| | | * @param start 开始索引 |
| | | * @param end 结束索引 |
| | | * @return |
| | | */ |
| | | public static Set<Object> getZSetRange(String key,long start,long end){ |
| | | try { |
| | | return redisTemplate.opsForZSet().range(key,start,end); |
| | | }catch(Exception e){ |
| | | e.printStackTrace(); |
| | | return new HashSet<Object>(); |
| | | } |
| | | } |
| | | |
| | | } |
| | | |