basic-server/src/main/java/com/ruoyi/basic/pojo/IfsInventoryQuantity.java
@@ -30,6 +30,9 @@ @ApiModelProperty("订单类型(01raw:原材料,02wg:外购成品)") private String orderType; @ApiModelProperty("物料属性,用于区分铜、铝导体等零件") private String materialProp; @ApiModelProperty("行号") private String lineNo; cnas-device/src/main/java/com/ruoyi/device/utils/DataAcquisition.java
@@ -346,23 +346,25 @@ } } // 拼接数采配置 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() + ","; } int lastIndex = aggregate.lastIndexOf(","); String substring = aggregate.substring(0, lastIndex); result.add(substring); } List<Object> result = new ArrayList<>(list); // String join = String.join(",", list.stream().map(String::valueOf).collect(Collectors.toList())); // result.add(join); // 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() + ","; // } // int lastIndex = aggregate.lastIndexOf(","); // String substring = aggregate.substring(0, lastIndex); // result.add(substring); // // } // 进行公式计算 Object resultValue = calculationFormula(result, v.get(0), k, device); map.put(k, resultValue); inspect-server/src/main/java/com/ruoyi/inspect/aspect/MoveLocationAfterPushMesStockAspect.java
@@ -3,15 +3,14 @@ import cn.hutool.core.bean.BeanUtil; import cn.hutool.json.JSONUtil; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.ruoyi.basic.mapper.IfsInventoryQuantityMapper; import com.ruoyi.basic.pojo.IfsInventoryQuantity; import com.ruoyi.common.numgen.NumberGenerator; import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.api.MesApiUtils; import com.ruoyi.inspect.pojo.IfsSplitOrderRecord; import com.ruoyi.inspect.service.IfsSplitOrderRecordService; import lombok.extern.slf4j.Slf4j; import org.aspectj.lang.JoinPoint; import org.aspectj.lang.annotation.AfterReturning; import org.aspectj.lang.annotation.Aspect; import org.aspectj.lang.annotation.Before; import org.springframework.beans.factory.annotation.Autowired; @@ -36,6 +35,9 @@ private MesApiUtils mesApiUtils; private final static String LOCATION_NO = "WG-02-001";//mes外购合格库位 @Autowired private NumberGenerator<IfsSplitOrderRecord> splitOrderRecordNumberGenerator; @Before(value = "execution(* com.ruoyi.inspect.service.impl.InsOrderServiceImpl.moveRawMaterial(..))") @Transactional(rollbackFor = Exception.class,isolation = Isolation.READ_COMMITTED) @@ -66,6 +68,9 @@ //使用相同的系统编号 one.setSystemNo(quantityList.get(0).getSystemNo()); } if(StringUtils.isBlank(one.getSystemNo())){ one.setSystemNo(splitOrderRecordNumberGenerator.generateNumberWithPrefix(IfsSplitOrderRecord.DIGIT,IfsSplitOrderRecord.PREFIX,IfsSplitOrderRecord::getSystemNo)); } //同步MES实时库存 Map<String, Object> requestMap = new HashMap<>(); requestMap.put("partNo", one.getPartNo()); // 零件编号 @@ -92,6 +97,7 @@ if(b){ ifsSplitOrderRecordService.update(null,Wrappers.<IfsSplitOrderRecord>lambdaUpdate() .set(IfsSplitOrderRecord::getSyncStatus,1) .set(IfsSplitOrderRecord::getSystemNo,one.getSystemNo()) .eq(IfsSplitOrderRecord::getId,one.getId())); } } inspect-server/src/main/java/com/ruoyi/inspect/controller/RawMaterialOrderController.java
@@ -110,10 +110,11 @@ public Result<?> inspectionReport(@RequestBody Map<String, Object> param) { List<Long> ids = (List<Long>) param.get("ids"); String orderType = Objects.nonNull(param.get("orderType"))?param.get("orderType").toString():""; String materialProp = Objects.nonNull(param.get("materialProp"))?param.get("materialProp").toString():""; if(!OrderType.validateValue(orderType)){ throw new ErrorException("批量报检失败,非法的销售订单分类枚举"); } return Result.success(rawMaterialOrderService.inspectionReport(ids,orderType)); return Result.success(rawMaterialOrderService.inspectionReport(ids,orderType,materialProp)); } /** inspect-server/src/main/java/com/ruoyi/inspect/dto/OrderSplitDTO.java
@@ -31,4 +31,7 @@ @ApiModelProperty("是否同步到MES") private Boolean pushToMes; @ApiModelProperty("物料属性,用于区分铜、铝导体等材料") private String materialProp; } inspect-server/src/main/java/com/ruoyi/inspect/service/RawMaterialOrderService.java
@@ -42,7 +42,7 @@ */ IPage<IfsInventoryQuantityDto> getIfsByStateOne(IPage<IfsInventoryQuantityDto> page, IfsInventoryQuantityDto ifsInventoryQuantityDto); int inspectionReport(List<Long> ids,String orderType); int inspectionReport(List<Long> ids,String orderType,String materialProp); int revokeInspectionReport(Long id); inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsOrderPlanServiceImpl.java
@@ -1700,7 +1700,7 @@ } } //切割电缆配置项 dto.setTell(String.join("\n",tellSet)); dto.setTell(String.join("\n",tellSet.stream().sorted(Comparator.naturalOrder()).collect(Collectors.toList()))); dto.setLastValueList(lastValueList); sampleProductExportDtos.add(dto); } @@ -1792,7 +1792,7 @@ enterFactoryReport.setInspectDate(insSampleUser.getInspectDate()); } Map<String, List<SampleProductExportDto>> item = new LinkedHashMap<>();//非电缆配置检测项 Map<String, List<SampleProductExportDto>> totalItem = new LinkedHashMap<>();//检测项列表 Map<String, List<SampleProductExportDto>> cableTagItem = new LinkedHashMap<>();//电缆配置检测项 Map<String, List<SampleProductExportDto>> cableTagEnclosureItem = new LinkedHashMap<>();//电缆配置检测项附件 @@ -1817,12 +1817,19 @@ }else{ sampleProductExportDtos = transformSampleProduct(cableTags,collect,0,cableTags.size()); } tempMap.put(key,sampleProductExportDtos); cableTagItem.put(key,sampleProductExportDtos); } sortSampleProduct(tempMap,cableTagItem); //处理非电缆配置检测项 Map<String, List<SampleProductExportDto>> listMap = filterItems.stream() .filter(f -> StringUtils.isBlank(f.getCableTag()) && StringUtils.isNotBlank(f.getInspectionItem())) .collect(Collectors.groupingBy(s->s.getInspectionItem()+"&")); //合并检测项列表 tempMap.putAll(cableTagItem); tempMap.putAll(listMap); sortSampleProduct(tempMap,totalItem); int tagNum = Math.min(max,maxCableTag); List<String> tagList = cableTags.subList(0,tagNum); handlerSampleItems(cableTagItem,finalIndex,sampleList,tagNum,text,rows,rowRenderData,resultCh,tagList,true); handlerSampleItems(totalItem,finalIndex,sampleList,tagNum,text,rows,rowRenderData,resultCh,tagList,true); if(CollectionUtil.isNotEmpty(tempMap2)){ sortSampleProduct(tempMap2,cableTagEnclosureItem); @@ -1849,17 +1856,9 @@ cableTagEnclosureTables.add(tableMap); } //处理非电缆配置检测项 Map<String, List<SampleProductExportDto>> listMap = filterItems.stream() .filter(f -> StringUtils.isBlank(f.getCableTag()) && StringUtils.isNotBlank(f.getInspectionItem())) .collect(Collectors.groupingBy(SampleProductExportDto::getInspectionItem)); sortSampleProduct(listMap,item); text = new ArrayList<>(); sampleList = new ArrayList<>(); handlerSampleItems(item,finalIndex,sampleList,tagNum,text,rows,rowRenderData,resultCh,cableTags,false); tableRenderData.setRows(rows); tableRenderData.setTableStyle(setTableStyle(tagNum)); if (!resultCh.get().equals("")) { if (!resultCh.get().isEmpty()) { resultCh.set("经检验," + resultCh.get() + "所检项目不合格,其余所检项目均合格。(盖章有效)"); } else { resultCh.set("本产品符合相关标准要求,经检验合格准予出厂(盖章有效)"); @@ -1871,13 +1870,8 @@ Map<String, List<SampleProductExportDto>> sortedMap = sampleProductDto2s.stream() .filter(sampleProductDto2 -> StringUtils.isNotBlank(sampleProductDto2.getInspectionItem())) .collect(Collectors.groupingBy(SampleProductExportDto::getInspectionItem)); // List<Map.Entry<String, List<SampleProductExportDto>>> entries = new ArrayList<>(sortedMap.entrySet()); // entries.sort(Comparator.comparingInt(o -> (o.getValue().get(0).getSort() == null ? 0 : o.getValue().get(0).getSort()))); // // 创建一个 LinkedHashMap 来保持插入顺序 Map<String, List<SampleProductExportDto>> item = new LinkedHashMap<>(); // for (Map.Entry<String, List<SampleProductExportDto>> entry : entries) { // item.put(entry.getKey(), entry.getValue()); // } sortSampleProduct(sortedMap,item); @@ -1956,7 +1950,7 @@ // 处理集合 Map<String, SampleProductExportDto> map = new LinkedHashMap<>(); for (SampleProductExportDto productDto2 : sampleProductDtoInside) { String productName = productDto2.getInspectionItemClass() + productDto2.getInspectionItem(); String productName = productDto2.getInspectionItemClass() + productDto2.getInspectionItem() + productDto2.getCableTag(); if (map.containsKey(productName)) { // 如果名称已经存在,添加 lastValue 值到 lastValueList 列表 if(CollectionUtil.isEmpty(map.get(productName).getLastValueList())){ @@ -2001,7 +1995,7 @@ // 处理集合 Map<String, SampleProductExportDto> map = new LinkedHashMap<>(); for (SampleProductExportDto productDto2 : sampleProductDtoInside) { String productName = productDto2.getInspectionItemClass() + productDto2.getInspectionItem() + productDto2.getInspectionItemSubclass(); String productName = productDto2.getInspectionItemClass() + productDto2.getInspectionItem() + productDto2.getInspectionItemSubclass() + productDto2.getCableTag(); if (map.containsKey(productName)) { // 如果名称已经存在,添加 lastValue 值到 lastValueList 列表 if(CollectionUtil.isEmpty(map.get(productName).getLastValueList())){ @@ -2054,7 +2048,9 @@ // 检验项目 TextRenderData middleRenderData2 = new TextRenderData(); middleRenderData2.setText(sample.getInspectionName()+"∑"+sample.getInspectionName()+i); String[] split = sample.getInspectionName().split("&"); String itemName = split.length>0?split[0]:sample.getInspectionName(); middleRenderData2.setText(itemName+"∑"+itemName+i+"_"+finalIndex); Style middleStyle2 = new Style(); middleStyle2.setFontFamily("宋体"); middleStyle2.setColor("000000"); inspect-server/src/main/java/com/ruoyi/inspect/service/impl/RawMaterialOrderServiceImpl.java
@@ -171,7 +171,7 @@ * @return */ @Override public int inspectionReport(List<Long> ids,String orderType) { public int inspectionReport(List<Long> ids,String orderType,String materialProp) { Integer userId = SecurityUtils.getUserId().intValue(); ifsInventoryQuantityMapper.update(null, Wrappers.<IfsInventoryQuantity>lambdaUpdate() .in(IfsInventoryQuantity::getId, ids) @@ -179,6 +179,7 @@ .set(IfsInventoryQuantity::getDeclareUserId, userId) .set(IfsInventoryQuantity::getIsInspect, 1) .set(IfsInventoryQuantity::getOrderType,orderType) .set(IfsInventoryQuantity::getMaterialProp,materialProp) .set(IfsInventoryQuantity::getDeclareDate, LocalDateTime.now()) ); threadPoolTaskExecutor.execute(() -> { @@ -254,6 +255,7 @@ .set(IfsInventoryQuantity::getDeclareDate, LocalDateTime.now()) .set(IfsInventoryQuantity::getUpdateBatchNo, ifsInventoryQuantity.getUpdateBatchNo()) .set(IfsInventoryQuantity::getOrderType,ifsInventoryQuantity.getOrderType()) .set(IfsInventoryQuantity::getMaterialProp,ifsInventoryQuantity.getMaterialProp()) ); threadPoolTaskExecutor.execute(() -> { @@ -939,7 +941,7 @@ if(Objects.nonNull(splitOrderList) && !splitOrderList.isEmpty()){ List<Long> ids = splitOrderList.stream().map(IfsInventoryQuantity::getId).collect(Collectors.toList()); ids.add(ifsInventoryQuantity.getId()); this.inspectionReport(ids,OrderType.RAW.getValue()); this.inspectionReport(ids,OrderType.RAW.getValue(),orderSplitDTO.getMaterialProp()); } //勾选同步到MES,保存订单拆分记录 if(orderSplitDTO.getPushToMes()){