basic-server/src/main/java/com/ruoyi/basic/mapper/IfsInventoryQuantityMapper.java
@@ -45,5 +45,5 @@ @Param("lineNo")String lineNo, @Param("releaseNo")String releaseNo, @Param("receiptNo")Integer receiptNo, @Param("orderNo")String orderNo); @Param("orderNo")String orderNo,@Param("contract") String contract); } basic-server/src/main/resources/mapper/IfsInventoryQuantityMapper.xml
@@ -91,6 +91,7 @@ and iiq.line_no=#{lineNo} and iiq.release_no=#{releaseNo} and iiq.receipt_no=#{receiptNo} and iiq.contract = #{contract} and iiq.is_split_order=1 and (iiq.is_finish != 1 or isor.sync_status != 1) and (io.id is null or io.is_exemption != 1) inspect-server/src/main/java/com/ruoyi/inspect/aspect/MoveLocationAfterPushMesStockAspect.java
@@ -4,6 +4,8 @@ import cn.hutool.json.JSONUtil; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.ruoyi.basic.pojo.IfsInventoryQuantity; import com.ruoyi.common.config.mes.MesConfig; import com.ruoyi.common.config.mes.MesProperties; import com.ruoyi.common.numgen.NumberGenerator; import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.api.MesApiUtils; @@ -38,6 +40,8 @@ @Autowired private NumberGenerator<IfsSplitOrderRecord> splitOrderRecordNumberGenerator; @Before(value = "execution(* com.ruoyi.inspect.service.impl.InsOrderServiceImpl.moveRawMaterial(..))") @Transactional(rollbackFor = Exception.class,isolation = Isolation.READ_COMMITTED) @@ -92,7 +96,7 @@ String jsonStr = JSONUtil.toJsonStr(Collections.singletonList(requestMap)); log.info("忥MES宿¶åºå请æ±åæ°-->{}",jsonStr); boolean b = mesApiUtils.batchAddStock(jsonStr); boolean b = mesApiUtils.batchAddStock(ifsInventoryQuantity.getContract(),jsonStr); //忥æåï¼æ´æ°åæ¥ç¶æ if(b){ ifsSplitOrderRecordService.update(null,Wrappers.<IfsSplitOrderRecord>lambdaUpdate() inspect-server/src/main/java/com/ruoyi/inspect/dto/DataAnalysisDto.java
@@ -48,4 +48,7 @@ @ApiModelProperty("åå®¶æ°æ®") private List<String> supplierDataList; @ApiModelProperty("IFSå") private String contract; } inspect-server/src/main/java/com/ruoyi/inspect/pojo/InsOrder.java
@@ -227,4 +227,7 @@ @ApiModelProperty("ä¾åºååç§°") private String supplierName; @ApiModelProperty("IFSå") private String contract; } inspect-server/src/main/java/com/ruoyi/inspect/service/impl/DataAnalysisServiceImpl.java
@@ -18,15 +18,18 @@ import com.ruoyi.inspect.vo.RawMaterialSupplierVo; import com.ruoyi.inspect.vo.RawProductAnalysisVo; import lombok.AllArgsConstructor; import org.apache.commons.lang3.ObjectUtils; import org.springframework.stereotype.Service; import java.math.BigDecimal; import java.math.MathContext; import java.math.RoundingMode; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import java.time.LocalDate; import java.time.LocalDateTime; import java.time.LocalTime; import java.time.ZoneId; import java.time.format.DateTimeFormatter; import java.util.*; import java.util.stream.Collectors; /** @@ -55,35 +58,43 @@ // æ ¼å¼ååæ®µ, é¿å æ¥é this.formatDataAnalysisDto(dataAnalysisDto); // è·åå½åæ¥æ DateTime now = DateUtil.date(); if (StrUtil.isNotBlank(dataAnalysisDto.getBeginDate()) && StrUtil.isNotBlank(dataAnalysisDto.getEndDate())) { return dataAnalysisMapper.getRawPassRateByBarChartByDay(dataAnalysisDto); } else if (dataAnalysisDto.getDateType().equals("1")) { // è·åæ¬å¨çå¼å§æ¶é´ï¼å¨ä¸ 00:00:00ï¼ DateTime beginOfWeek = DateUtil.beginOfWeek(now); // è·åæ¬å¨çç»ææ¶é´ï¼å¨æ¥ 23:59:59ï¼ // è·åæ¬å¨çç»ææ¶é´ï¼å¨æ¥ 23:59:59ï¼ DateTime endOfWeek = DateUtil.endOfWeek(now); dataAnalysisDto.setBeginDate(DateUtil.format(beginOfWeek, "yyyy-MM-dd HH:mm:ss")); dataAnalysisDto.setEndDate(DateUtil.format(endOfWeek, "yyyy-MM-dd HH:mm:ss")); List<Map<String, Object>> maps = dataAnalysisMapper.getRawPassRateByBarChartByWeek(dataAnalysisDto); return maps; } else if (dataAnalysisDto.getDateType().equals("2")) { // è·åå½åæçå¼å§æ¶é´ï¼æ¯æ1å· 00:00:00ï¼ DateTime beginOfMonth = DateUtil.beginOfMonth(now); // è·åå½åæçç»ææ¶é´ï¼æ¬ææåä¸å¤© 23:59:59ï¼ DateTime endOfMonth = DateUtil.endOfMonth(now); dataAnalysisDto.setBeginDate(DateUtil.format(beginOfMonth, "yyyy-MM-dd HH:mm:ss")); dataAnalysisDto.setEndDate(DateUtil.format(endOfMonth, "yyyy-MM-dd HH:mm:ss")); if(ObjectUtils.allNull(dataAnalysisDto.getBeginDate(),dataAnalysisDto.getEndDate())){ DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); LocalDate endDate = LocalDate.now(ZoneId.of("Asia/Shanghai")); LocalDate startDate = endDate.minusDays(6L); dataAnalysisDto.setBeginDate(startDate.atTime(LocalTime.MIN).format(dateTimeFormatter)); dataAnalysisDto.setEndDate(endDate.atTime(LocalTime.MAX).format(dateTimeFormatter)); } // if (StrUtil.isNotBlank(dataAnalysisDto.getBeginDate()) && StrUtil.isNotBlank(dataAnalysisDto.getEndDate())) { // return dataAnalysisMapper.getRawPassRateByBarChartByDay(dataAnalysisDto); // } else // if (dataAnalysisDto.getDateType().equals("1")) { //// // è·åæ¬å¨çå¼å§æ¶é´ï¼å¨ä¸ 00:00:00ï¼ //// DateTime beginOfWeek = DateUtil.beginOfWeek(now); //// // è·åæ¬å¨çç»ææ¶é´ï¼å¨æ¥ 23:59:59ï¼ //// // è·åæ¬å¨çç»ææ¶é´ï¼å¨æ¥ 23:59:59ï¼ //// DateTime endOfWeek = DateUtil.endOfWeek(now); //// dataAnalysisDto.setBeginDate(DateUtil.format(beginOfWeek, "yyyy-MM-dd HH:mm:ss")); //// dataAnalysisDto.setEndDate(DateUtil.format(endOfWeek, "yyyy-MM-dd HH:mm:ss")); // List<Map<String, Object>> maps = dataAnalysisMapper.getRawPassRateByBarChartByWeek(dataAnalysisDto); // return maps; // } else if (Arrays.asList("1","2").contains(dataAnalysisDto.getDateType())) { // // è·åå½åæçå¼å§æ¶é´ï¼æ¯æ1å· 00:00:00ï¼ // DateTime beginOfMonth = DateUtil.beginOfMonth(now); // // è·åå½åæçç»ææ¶é´ï¼æ¬ææåä¸å¤© 23:59:59ï¼ // DateTime endOfMonth = DateUtil.endOfMonth(now); // dataAnalysisDto.setBeginDate(DateUtil.format(beginOfMonth, "yyyy-MM-dd HH:mm:ss")); // dataAnalysisDto.setEndDate(DateUtil.format(endOfMonth, "yyyy-MM-dd HH:mm:ss")); List<Map<String, Object>> maps = dataAnalysisMapper.getRawPassRateByBarChartByDay(dataAnalysisDto); return maps; } else if (dataAnalysisDto.getDateType().equals("3")) { // è·åå½åå¹´çå¼å§æ¶é´ï¼æ¯å¹´1æ1æ¥ 00:00:00ï¼ DateTime beginOfYear = DateUtil.beginOfYear(now); // è·åå½åå¹´çç»ææ¶é´ï¼æ¯å¹´12æ31æ¥ 23:59:59ï¼ DateTime endOfYear = DateUtil.endOfYear(now); dataAnalysisDto.setBeginDate(DateUtil.format(beginOfYear, "yyyy-MM-dd HH:mm:ss")); dataAnalysisDto.setEndDate(DateUtil.format(endOfYear, "yyyy-MM-dd HH:mm:ss")); // // è·åå½åå¹´çå¼å§æ¶é´ï¼æ¯å¹´1æ1æ¥ 00:00:00ï¼ // DateTime beginOfYear = DateUtil.beginOfYear(now); // // è·åå½åå¹´çç»ææ¶é´ï¼æ¯å¹´12æ31æ¥ 23:59:59ï¼ // DateTime endOfYear = DateUtil.endOfYear(now); // dataAnalysisDto.setBeginDate(DateUtil.format(beginOfYear, "yyyy-MM-dd HH:mm:ss")); // dataAnalysisDto.setEndDate(DateUtil.format(endOfYear, "yyyy-MM-dd HH:mm:ss")); List<Map<String, Object>> maps = dataAnalysisMapper.getRawPassRateByBarChartByYear(dataAnalysisDto); return maps; } @@ -105,35 +116,40 @@ // æ ¼å¼ååæ®µ, é¿å æ¥é this.formatDataAnalysisDto(dataAnalysisDto); // è·åå½åæ¥æ DateTime now = DateUtil.date(); if (StrUtil.isNotBlank(dataAnalysisDto.getBeginDate()) && StrUtil.isNotBlank(dataAnalysisDto.getEndDate())) { } else if (dataAnalysisDto.getDateType().equals("1")) { // è·åæ¬å¨çå¼å§æ¶é´ï¼å¨ä¸ 00:00:00ï¼ DateTime beginOfWeek = DateUtil.beginOfWeek(now); // è·åæ¬å¨çç»ææ¶é´ï¼å¨æ¥ 23:59:59ï¼ DateTime endOfWeek = DateUtil.endOfWeek(now); dataAnalysisDto.setBeginDate(DateUtil.format(beginOfWeek, "yyyy-MM-dd HH:mm:ss")); dataAnalysisDto.setEndDate(DateUtil.format(endOfWeek, "yyyy-MM-dd HH:mm:ss")); } else if (dataAnalysisDto.getDateType().equals("2")) { // è·åå½åæçå¼å§æ¶é´ï¼æ¯æ1å· 00:00:00ï¼ DateTime beginOfMonth = DateUtil.beginOfMonth(now); // è·åå½åæçç»ææ¶é´ï¼æ¬ææåä¸å¤© 23:59:59ï¼ DateTime endOfMonth = DateUtil.endOfMonth(now); dataAnalysisDto.setBeginDate(DateUtil.format(beginOfMonth, "yyyy-MM-dd HH:mm:ss")); dataAnalysisDto.setEndDate(DateUtil.format(endOfMonth, "yyyy-MM-dd HH:mm:ss")); } else if (dataAnalysisDto.getDateType().equals("3")) { // è·åå½åå¹´çå¼å§æ¶é´ï¼æ¯å¹´1æ1æ¥ 00:00:00ï¼ DateTime beginOfYear = DateUtil.beginOfYear(now); // è·åå½åå¹´çç»ææ¶é´ï¼æ¯å¹´12æ31æ¥ 23:59:59ï¼ DateTime endOfYear = DateUtil.endOfYear(now); dataAnalysisDto.setBeginDate(DateUtil.format(beginOfYear, "yyyy-MM-dd HH:mm:ss")); dataAnalysisDto.setEndDate(DateUtil.format(endOfYear, "yyyy-MM-dd HH:mm:ss")); if(ObjectUtils.allNull(dataAnalysisDto.getBeginDate(),dataAnalysisDto.getEndDate())){ DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); LocalDate endDate = LocalDate.now(ZoneId.of("Asia/Shanghai")); LocalDate startDate = endDate.minusDays(6L); dataAnalysisDto.setBeginDate(startDate.atTime(LocalTime.MIN).format(dateTimeFormatter)); dataAnalysisDto.setEndDate(endDate.atTime(LocalTime.MAX).format(dateTimeFormatter)); } Map<String, Object> rawPassRateByCake = dataAnalysisMapper.getRawPassRateByCake(dataAnalysisDto); return rawPassRateByCake; // DateTime now = DateUtil.date(); // if (StrUtil.isNotBlank(dataAnalysisDto.getBeginDate()) && StrUtil.isNotBlank(dataAnalysisDto.getEndDate())) { // // } else // if (dataAnalysisDto.getDateType().equals("1")) { // // è·åæ¬å¨çå¼å§æ¶é´ï¼å¨ä¸ 00:00:00ï¼ // DateTime beginOfWeek = DateUtil.beginOfWeek(now); // // è·åæ¬å¨çç»ææ¶é´ï¼å¨æ¥ 23:59:59ï¼ // DateTime endOfWeek = DateUtil.endOfWeek(now); // dataAnalysisDto.setBeginDate(DateUtil.format(beginOfWeek, "yyyy-MM-dd HH:mm:ss")); // dataAnalysisDto.setEndDate(DateUtil.format(endOfWeek, "yyyy-MM-dd HH:mm:ss")); // } else if (dataAnalysisDto.getDateType().equals("2")) { // // è·åå½åæçå¼å§æ¶é´ï¼æ¯æ1å· 00:00:00ï¼ // DateTime beginOfMonth = DateUtil.beginOfMonth(now); // // è·åå½åæçç»ææ¶é´ï¼æ¬ææåä¸å¤© 23:59:59ï¼ // DateTime endOfMonth = DateUtil.endOfMonth(now); // dataAnalysisDto.setBeginDate(DateUtil.format(beginOfMonth, "yyyy-MM-dd HH:mm:ss")); // dataAnalysisDto.setEndDate(DateUtil.format(endOfMonth, "yyyy-MM-dd HH:mm:ss")); // } else if (dataAnalysisDto.getDateType().equals("3")) { // // è·åå½åå¹´çå¼å§æ¶é´ï¼æ¯å¹´1æ1æ¥ 00:00:00ï¼ // DateTime beginOfYear = DateUtil.beginOfYear(now); // // è·åå½åå¹´çç»ææ¶é´ï¼æ¯å¹´12æ31æ¥ 23:59:59ï¼ // DateTime endOfYear = DateUtil.endOfYear(now); // dataAnalysisDto.setBeginDate(DateUtil.format(beginOfYear, "yyyy-MM-dd HH:mm:ss")); // dataAnalysisDto.setEndDate(DateUtil.format(endOfYear, "yyyy-MM-dd HH:mm:ss")); // } return dataAnalysisMapper.getRawPassRateByCake(dataAnalysisDto); } @Override @@ -142,34 +158,39 @@ this.formatDataAnalysisDto(dataAnalysisDto); // è·åå½åæ¥æ DateTime now = DateUtil.date(); if (StrUtil.isNotBlank(dataAnalysisDto.getBeginDate()) && StrUtil.isNotBlank(dataAnalysisDto.getEndDate())) { } else if (dataAnalysisDto.getDateType().equals("1")) { // è·åæ¬å¨çå¼å§æ¶é´ï¼å¨ä¸ 00:00:00ï¼ DateTime beginOfWeek = DateUtil.beginOfWeek(now); // è·åæ¬å¨çç»ææ¶é´ï¼å¨æ¥ 23:59:59ï¼ DateTime endOfWeek = DateUtil.endOfWeek(now); dataAnalysisDto.setBeginDate(DateUtil.format(beginOfWeek, "yyyy-MM-dd HH:mm:ss")); dataAnalysisDto.setEndDate(DateUtil.format(endOfWeek, "yyyy-MM-dd HH:mm:ss")); } else if (dataAnalysisDto.getDateType().equals("2")) { // è·åå½åæçå¼å§æ¶é´ï¼æ¯æ1å· 00:00:00ï¼ DateTime beginOfMonth = DateUtil.beginOfMonth(now); // è·åå½åæçç»ææ¶é´ï¼æ¬ææåä¸å¤© 23:59:59ï¼ DateTime endOfMonth = DateUtil.endOfMonth(now); dataAnalysisDto.setBeginDate(DateUtil.format(beginOfMonth, "yyyy-MM-dd HH:mm:ss")); dataAnalysisDto.setEndDate(DateUtil.format(endOfMonth, "yyyy-MM-dd HH:mm:ss")); } else if (dataAnalysisDto.getDateType().equals("3")) { // è·åå½åå¹´çå¼å§æ¶é´ï¼æ¯å¹´1æ1æ¥ 00:00:00ï¼ DateTime beginOfYear = DateUtil.beginOfYear(now); // è·åå½åå¹´çç»ææ¶é´ï¼æ¯å¹´12æ31æ¥ 23:59:59ï¼ DateTime endOfYear = DateUtil.endOfYear(now); dataAnalysisDto.setBeginDate(DateUtil.format(beginOfYear, "yyyy-MM-dd HH:mm:ss")); dataAnalysisDto.setEndDate(DateUtil.format(endOfYear, "yyyy-MM-dd HH:mm:ss")); if(ObjectUtils.allNull(dataAnalysisDto.getBeginDate(),dataAnalysisDto.getEndDate())){ DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); LocalDate endDate = LocalDate.now(ZoneId.of("Asia/Shanghai")); LocalDate startDate = endDate.minusDays(6L); dataAnalysisDto.setBeginDate(startDate.atTime(LocalTime.MIN).format(dateTimeFormatter)); dataAnalysisDto.setEndDate(endDate.atTime(LocalTime.MAX).format(dateTimeFormatter)); } // if (StrUtil.isNotBlank(dataAnalysisDto.getBeginDate()) && StrUtil.isNotBlank(dataAnalysisDto.getEndDate())) { // // } else if (dataAnalysisDto.getDateType().equals("1")) { // // è·åæ¬å¨çå¼å§æ¶é´ï¼å¨ä¸ 00:00:00ï¼ // DateTime beginOfWeek = DateUtil.beginOfWeek(now); // // è·åæ¬å¨çç»ææ¶é´ï¼å¨æ¥ 23:59:59ï¼ // DateTime endOfWeek = DateUtil.endOfWeek(now); // dataAnalysisDto.setBeginDate(DateUtil.format(beginOfWeek, "yyyy-MM-dd HH:mm:ss")); // dataAnalysisDto.setEndDate(DateUtil.format(endOfWeek, "yyyy-MM-dd HH:mm:ss")); // } else if (dataAnalysisDto.getDateType().equals("2")) { // // è·åå½åæçå¼å§æ¶é´ï¼æ¯æ1å· 00:00:00ï¼ // DateTime beginOfMonth = DateUtil.beginOfMonth(now); // // è·åå½åæçç»ææ¶é´ï¼æ¬ææåä¸å¤© 23:59:59ï¼ // DateTime endOfMonth = DateUtil.endOfMonth(now); // dataAnalysisDto.setBeginDate(DateUtil.format(beginOfMonth, "yyyy-MM-dd HH:mm:ss")); // dataAnalysisDto.setEndDate(DateUtil.format(endOfMonth, "yyyy-MM-dd HH:mm:ss")); // } else if (dataAnalysisDto.getDateType().equals("3")) { // // è·åå½åå¹´çå¼å§æ¶é´ï¼æ¯å¹´1æ1æ¥ 00:00:00ï¼ // DateTime beginOfYear = DateUtil.beginOfYear(now); // // è·åå½åå¹´çç»ææ¶é´ï¼æ¯å¹´12æ31æ¥ 23:59:59ï¼ // DateTime endOfYear = DateUtil.endOfYear(now); // dataAnalysisDto.setBeginDate(DateUtil.format(beginOfYear, "yyyy-MM-dd HH:mm:ss")); // dataAnalysisDto.setEndDate(DateUtil.format(endOfYear, "yyyy-MM-dd HH:mm:ss")); // } List<MaterialPropTableDTO> rawPassRateByCake = dataAnalysisMapper.getMaterialPropTable(dataAnalysisDto); return rawPassRateByCake; return dataAnalysisMapper.getMaterialPropTable(dataAnalysisDto); } /** inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsOrderPlanServiceImpl.java
@@ -31,6 +31,7 @@ import com.ruoyi.basic.pojo.IfsInventoryQuantity; import com.ruoyi.basic.pojo.StandardTemplate; import com.ruoyi.basic.service.StandardTemplateService; import com.ruoyi.basic.vo.IfsInventoryQuantityVO; import com.ruoyi.common.constant.DictDataConstants; import com.ruoyi.common.constant.InsOrderTypeConstants; import com.ruoyi.common.constant.MenuJumpPathConstants; @@ -311,12 +312,13 @@ if (Objects.nonNull(insOrder.getIfsInventoryId())) { IfsInventoryQuantity one = ifsInventoryQuantityMapper.selectById(insOrder.getIfsInventoryId()); //è¿æ»¤åºä¸åæ ¼ææªæäº¤çåå count = ifsInventoryQuantityMapper.selectSplitOrderList(one.getPartNo(), one.getLineNo(), one.getReleaseNo(), one.getReceiptNo(), one.getOrderNo()) .stream() List<IfsInventoryQuantityVO> ifsInventoryQuantityVOS = ifsInventoryQuantityMapper.selectSplitOrderList(one.getPartNo(), one.getLineNo(), one.getReleaseNo(), one.getReceiptNo(), one.getOrderNo(), one.getContract()); count = ifsInventoryQuantityVOS.stream() .filter(f -> (Objects.nonNull(f.getInsOrderId()) && !Objects.equals(f.getInsOrderId(), orderId)) && (Objects.isNull(f.getInsResult()) || 0 == f.getInsResult())).count(); } map.put("errorMsg", collect); map.put("unInsOrderCount", count); map.put("unFinishCount", count); return map; } @@ -1710,7 +1712,7 @@ List<String> lastValueList = new ArrayList<>(); SampleProductExportDto dto = new SampleProductExportDto(); BeanUtil.copyProperties(collect.get(s).get(0), dto); Set<String> tellSet = new HashSet<>(); List<String> tellSet = new ArrayList<>(); for (int i = startIndex; i < endIndex; i++) { String cableTag = cableTags.get(i); for (SampleProductExportDto sDto : collect.get(s)) { @@ -1721,7 +1723,7 @@ } } //åå²çµç¼é 置项 dto.setTell(String.join("\n", tellSet.stream().sorted(Comparator.naturalOrder()).collect(Collectors.toList()))); dto.setTell(tellSet.stream().distinct().collect(Collectors.joining("\n"))); dto.setLastValueList(lastValueList); sampleProductExportDtos.add(dto); } inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsReportServiceImpl.java
@@ -817,7 +817,7 @@ //å¦ææ¯æåç订åï¼åææåçæææ¹æ¬¡é½ç§»åº if(one.getIsSplitOrder()==1 && !hasExemption){ //æ¥è¯¢æå订å详æ List<IfsInventoryQuantityVO> ifsInventoryQuantityVOS = ifsInventoryQuantityMapper.selectSplitOrderList(one.getPartNo(), one.getLineNo(), one.getReleaseNo(), one.getReceiptNo(), one.getOrderNo()); List<IfsInventoryQuantityVO> ifsInventoryQuantityVOS = ifsInventoryQuantityMapper.selectSplitOrderList(one.getPartNo(), one.getLineNo(), one.getReleaseNo(), one.getReceiptNo(), one.getOrderNo(),one.getContract()); for (IfsInventoryQuantityVO vo : ifsInventoryQuantityVOS) { //妿æå§æåä¿¡æ¯ä¸åæ ¼ï¼èµ°ç»è®°åç§»åºï¼å¦ææ²¡æï¼åèµ°å æ£ï¼ä¸åæ ¼ä¸åå¤ç if(Objects.isNull(vo.getInsOrderId())){ inspect-server/src/main/resources/mapper/DataAnalysisMapper.xml
@@ -26,7 +26,7 @@ SELECT DAYOFWEEK(io1.send_time) AS week, SUM(CASE WHEN iiq.inspect_status = 1 THEN 1 ELSE 0 END) AS qualified, SUM(CASE WHEN iiq.inspect_status = 2 THEN 1 ELSE 0 END) AS unQualified SUM(CASE WHEN iiq.inspect_status = 2 or iiq.inspect_status = 4 THEN 1 ELSE 0 END) AS unQualified FROM ifs_inventory_quantity iiq INNER JOIN ins_order io1 ON io1.ifs_inventory_id = iiq.id @@ -37,7 +37,7 @@ ) ins ON ins.ins_order_id = io1.id WHERE iiq.is_finish = 1 AND iiq.inspect_status IN (1, 2) AND iiq.inspect_status IN (1, 2,4) AND io1.order_type = #{dto.orderType} AND io1.state != -1 AND io1.send_time BETWEEN #{dto.beginDate} AND #{dto.endDate} @@ -86,7 +86,7 @@ DATE(io1.send_time) AS day, COUNT(*) AS total, SUM(CASE WHEN iiq.inspect_status = 1 THEN 1 ELSE 0 END) AS qualified, SUM(CASE WHEN iiq.inspect_status = 2 THEN 1 ELSE 0 END) AS unQualified SUM(CASE WHEN iiq.inspect_status = 2 or iiq.inspect_status = 4 THEN 1 ELSE 0 END) AS unQualified FROM ifs_inventory_quantity iiq LEFT JOIN ins_order io1 ON io1.ifs_inventory_id = iiq.id @@ -100,7 +100,7 @@ ) ins ON ins.ins_order_id = io1.id WHERE iiq.is_finish = 1 AND iiq.inspect_status IN (1,2) AND iiq.inspect_status IN (1,2,4) <if test="dto.materialProp != null and dto.materialProp != ''"> AND IFNULL(iiq.material_prop,'') LIKE CONCAT('%',#{dto.materialProp},'%') @@ -114,7 +114,9 @@ <if test="dto.supplierName != null and dto.supplierName != ''"> AND IFNULL(iiq.supplier_name,'') LIKE CONCAT('%',#{dto.supplierName},'%') </if> <if test="dto.contract != null and dto.contract != ''"> AND IFNULL(iiq.contract,'') = #{dto.contract} </if> GROUP BY DATE(io1.send_time) ) sub ON ad.day = sub.day ORDER BY ad.day @@ -158,7 +160,7 @@ MONTH(io1.send_time) AS month, COUNT(*) AS total, SUM(CASE WHEN iiq.inspect_status = 1 THEN 1 ELSE 0 END) AS qualified, SUM(CASE WHEN iiq.inspect_status = 2 THEN 1 ELSE 0 END) AS unQualified SUM(CASE WHEN iiq.inspect_status = 2 or iiq.inspect_status = 4 THEN 1 ELSE 0 END) AS unQualified FROM ifs_inventory_quantity iiq LEFT JOIN ins_order io1 ON io1.ifs_inventory_id = iiq.id @@ -172,7 +174,7 @@ ) ins ON ins.ins_order_id = io1.id WHERE iiq.is_finish = 1 AND iiq.inspect_status IN (1,2) AND iiq.inspect_status IN (1,2,4) <if test="dto.materialProp != null and dto.materialProp != ''"> AND IFNULL(iiq.material_prop,'') LIKE CONCAT('%',#{dto.materialProp},'%') @@ -186,7 +188,9 @@ <if test="dto.supplierName != null and dto.supplierName != ''"> AND IFNULL(iiq.supplier_name,'') LIKE CONCAT('%',#{dto.supplierName},'%') </if> <if test="dto.contract != null and dto.contract != ''"> AND IFNULL(iiq.contract,'') = #{dto.contract} </if> GROUP BY MONTH(io1.send_time) ) sub ON am.month = sub.month ORDER BY am.month @@ -200,7 +204,7 @@ /* åæ ¼ */ SUM(CASE WHEN iiq.inspect_status = 1 THEN 1 ELSE 0 END) AS qualified, /* ä¸åæ ¼ */ SUM(CASE WHEN iiq.inspect_status = 2 THEN 1 ELSE 0 END) AS unQualified, SUM(CASE WHEN iiq.inspect_status = 2 or iiq.inspect_status = 4 THEN 1 ELSE 0 END) AS unQualified, ROUND( SUM(CASE WHEN iiq.inspect_status = 1 THEN 1 ELSE 0 END) / COUNT(*) * 100, @@ -220,7 +224,7 @@ ) ins ON ins.ins_order_id = io1.id WHERE iiq.is_finish = 1 AND iiq.inspect_status IN (1, 2) AND iiq.inspect_status IN (1, 2,4) AND io1.order_type = #{dto.orderType} AND io1.state != -1 AND io1.send_time BETWEEN #{dto.beginDate} AND #{dto.endDate} @@ -237,13 +241,16 @@ <if test="dto.supplierName != null and dto.supplierName.trim() != ''"> AND IFNULL(iiq.supplier_name, '') LIKE CONCAT('%', #{dto.supplierName}, '%') </if> <if test="dto.contract != null and dto.contract != ''"> AND IFNULL(iiq.contract,'') = #{dto.contract} </if> </select> <select id="getMaterialPropTable" resultType="com.ruoyi.inspect.dto.MaterialPropTableDTO"> SELECT iiq.supplier_name AS supplierName, COUNT(*) AS totalBatch, SUM(CASE WHEN iiq.inspect_status = 2 THEN 1 ELSE 0 END) AS unqualifiedBatch, SUM(CASE WHEN iiq.inspect_status = 2 or iiq.inspect_status = 4 THEN 1 ELSE 0 END) AS unqualifiedBatch, ROUND(SUM(CASE WHEN iiq.inspect_status = 1 THEN 1 ELSE 0 END) / COUNT(*)* 100, 2 ) AS passRate FROM ifs_inventory_quantity iiq @@ -264,7 +271,7 @@ WHERE iiq.is_finish = 1 AND iiq.inspect_status IN (1,2) AND iiq.inspect_status IN (1,2,4) <if test="dto.materialProp != null and dto.materialProp != ''"> AND IFNULL(iiq.material_prop,'') LIKE CONCAT('%',#{dto.materialProp},'%') @@ -281,7 +288,9 @@ <if test="dto.supplierName != null and dto.supplierName != ''"> AND IFNULL(iiq.supplier_name,'') LIKE CONCAT('%',#{dto.supplierName},'%') </if> <if test="dto.contract != null and dto.contract != ''"> AND IFNULL(iiq.contract,'') = #{dto.contract} </if> GROUP BY iiq.supplier_name inspect-server/src/main/resources/mapper/InsReportMapper.xml
@@ -20,10 +20,22 @@ iiq.is_copper, iiq.material_prop, ip.son_laboratory, iiq.update_batch_no, iiq.part_desc, iiq.supplier_name, iiq.contract CASE WHEN io.ifs_inventory_id IS NOT NULL THEN iiq.update_batch_no ELSE io.update_batch_no END AS update_batch_no, CASE WHEN io.ifs_inventory_id IS NOT NULL THEN iiq.part_desc ELSE io.part_desc END AS part_desc, CASE WHEN io.ifs_inventory_id IS NOT NULL THEN iiq.supplier_name ELSE io.supplier_name END AS supplier_name, CASE WHEN io.ifs_inventory_id IS NOT NULL THEN iiq.contract ELSE io.contract END AS contract from ins_report ir left join ins_order io on io.id = ir.ins_order_id LEFT JOIN ifs_inventory_quantity iiq ON iiq.id = io.ifs_inventory_id inspect-server/src/main/resources/mapper/InsSampleMapper.xml
@@ -193,7 +193,6 @@ ira.temp_url_pdf, iiq.is_copper, iiq.is_split_order, iiq.contract, CASE WHEN io.ifs_inventory_id IS NOT NULL THEN iiq.update_batch_no ELSE io.update_batch_no @@ -208,6 +207,10 @@ WHEN io.ifs_inventory_id IS NOT NULL THEN iiq.supplier_name ELSE io.supplier_name END AS supplier_name, CASE WHEN io.ifs_inventory_id IS NOT NULL THEN iiq.contract ELSE io.contract END AS contract, iiq.material_prop AS material_prop FROM ruoyi-admin-ztns/src/main/resources/application-druid.yml
@@ -174,10 +174,15 @@ product-qualified-location: C101 #æååæ ¼åºä½ mes: ztns: ip: http://10.16.173.36 user: lims password: qCzOMJlqE8TYOHDWGva/Tw== props: - contract: ZTNS ip: http://10.16.173.36 user: lims password: qCzOMJlqE8TYOHDWGva/Tw== - contract: KJNS ip: http://10.1.203.177 user: lims password: qCzOMJlqE8TYOHDWGva/Tw== # 夿³¨ 18083å¯ç ï¼zttZTT123!@ mqtt: ruoyi-admin-ztns/src/main/resources/application-ztns.yml
@@ -175,10 +175,15 @@ product-qualified-location: C101 #æååæ ¼åºä½ mes: ztns: ip: http://10.1.51.128 user: lims password: q1CItm6Zl7P4SQkfczu/oQ== props: - contract: ZTNS ip: http://10.1.51.128 user: lims password: qCzOMJlqE8TYOHDWGva/Tw== - contract: KJNS ip: http://10.1.203.177 user: lims password: qCzOMJlqE8TYOHDWGva/Tw== # 夿³¨ 18083å¯ç ï¼zttZTT123!@ mqtt: ruoyi-common/src/main/java/com/ruoyi/common/config/ifs/IfsConfig.java
@@ -7,7 +7,7 @@ import java.util.List; /** * é ç½®æ å°å®ä½ç±» * ifsé ç½®æ å°å®ä½ç±» */ @Configuration @ConfigurationProperties(prefix = "ifs") ruoyi-common/src/main/java/com/ruoyi/common/config/mes/MesConfig.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,19 @@ package com.ruoyi.common.config.mes; import lombok.Data; import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.context.annotation.Configuration; import java.util.List; /** * mesé ç½®æ å°å®ä½ç±» */ @Configuration @ConfigurationProperties(prefix = "mes") @Data public class MesConfig { private List<MesProperties> props; } ruoyi-common/src/main/java/com/ruoyi/common/config/mes/MesProperties.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,31 @@ package com.ruoyi.common.config.mes; import lombok.Data; /** * 对æ¥mes宿¶åºåï¼é 置对象 */ @Data public class MesProperties { /** * å·¥åå */ private String contract; /** * ipå°å */ private String ip; /** * è´¦å· */ private String user; /** * å¯ç */ private String password; } ruoyi-common/src/main/java/com/ruoyi/common/utils/api/MesApiUtils.java
@@ -3,7 +3,11 @@ import cn.hutool.http.HttpRequest; import cn.hutool.json.JSONObject; import cn.hutool.json.JSONUtil; import com.ruoyi.common.config.mes.MesConfig; import com.ruoyi.common.config.mes.MesProperties; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Component; @@ -15,20 +19,23 @@ @Component public class MesApiUtils { @Value("${mes.ztns.ip}") String ip; @Autowired private MesConfig mesConfig; @Value("${mes.ztns.user}") String user; @Value("${mes.ztns.password}") String password; /** * æ ¹æ®å·¥åååå»mesé ç½® * @param contract * @return */ public MesProperties getMesPropertiesByContract(String contract){ return mesConfig.getProps().stream().filter(f-> org.apache.commons.lang3.StringUtils.equals(f.getContract(),contract)).findFirst().orElse(new MesProperties()); } /** * è·åtoken请æ±é¾æ¥ * @return */ private String getAuthTokenUrl() { private String getAuthTokenUrl(String ip) { return ip + "/auth/oauth/token?randomStr=blockPuzzle&grant_type=password"; } @@ -36,7 +43,7 @@ * æ°å¢å®æ¶åºå请æ±é¾æ¥ * @return */ private String getBatchAddStockUrl(){ private String getBatchAddStockUrl(String ip){ return ip + "/mes/stock/batchAddStock"; } @@ -44,12 +51,12 @@ * è·åmesç³»ç»token * @return æ¥å£ååºç»æ */ public String getToken(){ public String getToken(MesProperties mesProperties){ try{ Map<String,Object> bodyMap = new HashMap<>(); bodyMap.put("username",user); String bodyStr = "username="+user+"&password="+password; String response = HttpRequest.post(getAuthTokenUrl()) bodyMap.put("username",mesProperties.getUser()); String bodyStr = "username="+mesProperties.getUser()+"&password="+mesProperties.getPassword(); String response = HttpRequest.post(getAuthTokenUrl(mesProperties.getIp())) .header("Authorization", "Basic cGlnOnBpZw==") .header("Content-Type", "application/x-www-form-urlencoded") .body(bodyStr,"application/x-www-form-urlencoded").execute().body(); @@ -67,13 +74,15 @@ /** * mesæ°å¢å®æ¶åºåæ¥å£ * @param contract å·¥åå * @param requestJsonStr 请æ±åæ°jsonå符串 * @return æ¥å£ååºç»æ */ public boolean batchAddStock(String requestJsonStr){ public boolean batchAddStock(String contract,String requestJsonStr){ try{ String response = HttpRequest.post(getBatchAddStockUrl()) .header("Authorization", getToken()) MesProperties mesProperties = getMesPropertiesByContract(contract); String response = HttpRequest.post(getBatchAddStockUrl(mesProperties.getIp())) .header("Authorization", getToken(mesProperties)) .header("Content-Type", "application/json") .body(requestJsonStr) .execute() @@ -82,11 +91,11 @@ if(entries.getInt("code")==0){ return true; }else{ throw new RuntimeException("忥å°MES失败ï¼"+entries.getStr("msg")); throw new RuntimeException("ã"+contract+"ã忥å°MES失败ï¼"+entries.getStr("msg")); } }catch (Exception e){ e.printStackTrace(); throw new RuntimeException("忥MES宿¶åºåæ¥å£å¼å¸¸:"+e.getMessage()); throw new RuntimeException("ã"+contract+"ã忥MES宿¶åºåæ¥å£å¼å¸¸:"+e.getMessage()); } }