diff --git a/aucma-api/src/main/java/com/aucma/api/task/SAPTask.java b/aucma-api/src/main/java/com/aucma/api/task/SAPTask.java index c02741e..7cafa0b 100644 --- a/aucma-api/src/main/java/com/aucma/api/task/SAPTask.java +++ b/aucma-api/src/main/java/com/aucma/api/task/SAPTask.java @@ -5,6 +5,8 @@ import com.aucma.api.domain.dto.SAPPortDto; import com.aucma.api.domain.dto.WERKSDto; import com.aucma.api.service.ISAPPortService; import com.aucma.common.utils.DateUtils; +import com.aucma.production.domain.BaseBomInfo; +import com.aucma.production.service.IBaseBomInfoService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @@ -22,42 +24,53 @@ public class SAPTask { @Autowired private ISAPPortService portService; + @Autowired + private IBaseBomInfoService baseBomInfoService; + /** * SAP物料主数据定时任务 - * - * @param days 开始时间(天) + * @param factoryCode + * @param startDays + * @param endDays */ - public void SAPMaterialDataTask(String factoryCode, Long days) { - SAPPortDto sapPortDto = this.SAPRequestDataAssembly(factoryCode, days); + public void SAPMaterialDataTask(String factoryCode, Long startDays, Long endDays) { + SAPPortDto sapPortDto = this.SAPRequestDataAssembly(factoryCode, startDays, endDays); portService.getSAPMaterialData(sapPortDto); } /** * 生产工单定时任务 * - * @param days 开始时间(天) + * @param factoryCode + * @param startDays + * @param endDays */ - public void SAPProduceWorkTicketsDataTask(String factoryCode, Long days) { - SAPPortDto sapPortDto = this.SAPRequestDataAssembly(factoryCode, days); + public void SAPProduceWorkTicketsDataTask(String factoryCode, Long startDays, Long endDays) { + SAPPortDto sapPortDto = this.SAPRequestDataAssembly(factoryCode, startDays, endDays); portService.getSapBaseOrderInfo(sapPortDto); } + /** *设备台账定时任务 * - * @param days 开始时间(天) + * @param factoryCode + * @param startDays + * @param endDays */ - public void SAPDeviceLedgerDataTask(String factoryCode, Long days) { - SAPPortDto sapPortDto = this.SAPRequestDataAssembly(factoryCode, days); + public void SAPDeviceLedgerDataTask(String factoryCode, Long startDays, Long endDays) { + SAPPortDto sapPortDto = this.SAPRequestDataAssembly(factoryCode, startDays, endDays); portService.getSapDeviceLedgers(sapPortDto); } /** * 产品bom信息定时任务 * - * @param days 开始时间(天) + * @param factoryCode + * @param startDays + * @param endDays */ - public void SAPBaseBomInfoDataTask(String factoryCode, Long days) { - SAPPortDto sapPortDto = this.SAPRequestDataAssembly(factoryCode, days); + public void SAPBaseBomInfoDataTask(String factoryCode, Long startDays, Long endDays) { + SAPPortDto sapPortDto = this.SAPRequestDataAssembly(factoryCode, startDays, endDays); SAPBOMPortDto sapbomPortDto = new SAPBOMPortDto(); sapbomPortDto.setStartDate(sapPortDto.getStartDate()); sapbomPortDto.setEndDate(sapPortDto.getEndDate()); @@ -66,15 +79,25 @@ public class SAPTask { } + /** + * 自动同步生产BOM定时任务 + * + */ + public void automaticSynchronizationBOM() { + baseBomInfoService.addAutomaticSynchronizationBOM(new BaseBomInfo()); + } + + /** * 定时任务:SAP请求数据组装 * @param factoryCode - * @param days + * @param startDays + * @param endDays * @return */ - public SAPPortDto SAPRequestDataAssembly(String factoryCode, Long days) { - String startDate = DateUtils.convertDaysToDateString(days); - String endDate = DateUtils.getDate(); + public SAPPortDto SAPRequestDataAssembly(String factoryCode, Long startDays, Long endDays) { + String startDate = DateUtils.convertDaysToDateString(startDays,0); + String endDate = DateUtils.convertDaysToDateString(endDays,1); SAPPortDto sapPortDto = new SAPPortDto(); WERKSDto werksDto = new WERKSDto(); List> factoryList = new ArrayList<>(); diff --git a/aucma-base/src/main/resources/mapper/base/OrderBomInfoMapper.xml b/aucma-base/src/main/resources/mapper/base/OrderBomInfoMapper.xml index 30ce488..430ca6f 100644 --- a/aucma-base/src/main/resources/mapper/base/OrderBomInfoMapper.xml +++ b/aucma-base/src/main/resources/mapper/base/OrderBomInfoMapper.xml @@ -115,7 +115,7 @@ #{objId}, #{bomCode}, #{materialCode}, - #{materialName}, + #{materialName,jdbcType=NVARCHAR}, #{materialType}, #{standardAmount}, #{parentId}, @@ -137,7 +137,7 @@ bom_code = #{bomCode}, material_code = #{materialCode}, - material_name = #{materialName}, + material_name = #{materialName,jdbcType=NVARCHAR}, material_type = #{materialType}, standard_amount = #{standardAmount}, parent_id = #{parentId}, diff --git a/aucma-common/src/main/java/com/aucma/common/utils/DateUtils.java b/aucma-common/src/main/java/com/aucma/common/utils/DateUtils.java index a4dcbf0..54c6557 100644 --- a/aucma-common/src/main/java/com/aucma/common/utils/DateUtils.java +++ b/aucma-common/src/main/java/com/aucma/common/utils/DateUtils.java @@ -191,16 +191,21 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils } /** - * 输出days天之前的日期 + * 输出days天type的日期 + * type: 0-减法;1-加法 * @param days * @return */ - public static String convertDaysToDateString(Long days) { + public static String convertDaysToDateString(Long days, Integer type) { // 获取当前日期 LocalDate currentDate = LocalDate.now(); - + LocalDate targetDate = null; // 减去相应的天数 - LocalDate targetDate = currentDate.minusDays(days); + if (type.equals(0)){ + targetDate = currentDate.minusDays(days); + }else { + targetDate = currentDate.plusDays(days); + } // 创建DateTimeFormatter对象,指定日期格式 DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd"); diff --git a/aucma-production/src/main/java/com/aucma/production/service/impl/BaseBomInfoServiceImpl.java b/aucma-production/src/main/java/com/aucma/production/service/impl/BaseBomInfoServiceImpl.java index 5e0cb7f..8e2c272 100644 --- a/aucma-production/src/main/java/com/aucma/production/service/impl/BaseBomInfoServiceImpl.java +++ b/aucma-production/src/main/java/com/aucma/production/service/impl/BaseBomInfoServiceImpl.java @@ -1,6 +1,7 @@ package com.aucma.production.service.impl; import java.math.BigDecimal; +import java.util.ArrayList; import java.util.List; import com.aucma.base.domain.BaseMaterialInfo; @@ -54,9 +55,44 @@ public class BaseBomInfoServiceImpl implements IBaseBomInfoService { */ @Override public List selectBaseBomInfoList(BaseBomInfo baseBomInfo) { - baseBomInfo.setMaterialCode(baseBomInfo.getMaterialCode()); - baseBomInfo.setAncestors(null); - List baseBomInfos = baseBomInfoMapper.selectBaseBomInfoList(baseBomInfo); + List baseBomInfos = new ArrayList<>(); + //测试查看全部BOM关系 + if (StringUtils.isNotEmpty(baseBomInfo.getAncestors()) && baseBomInfo.getAncestors().equals("0")){ + baseBomInfo.setMaterialCode(baseBomInfo.getMaterialCode()); + baseBomInfo.setAncestors(null); + baseBomInfos = baseBomInfoMapper.selectBaseBomInfoList(baseBomInfo); + return baseBomInfos; + } + //筛选子集BOM + if (StringUtils.isNotEmpty(baseBomInfo.getAncestors()) && baseBomInfo.getAncestors().startsWith("900")){ + BaseBomInfo baseBomInfo1 = new BaseBomInfo(); + baseBomInfo1.setParentId(baseBomInfo.getAncestors()); + List baseBomInfos1 = baseBomInfoMapper.selectBaseBomInfoList(baseBomInfo1); + baseBomInfos.addAll(baseBomInfos1); + for (BaseBomInfo bomInfo : baseBomInfos1) { + BaseBomInfo baseBomInfo2 = new BaseBomInfo(); + baseBomInfo2.setParentId(bomInfo.getMaterialCode()); + List baseBomInfos2 = baseBomInfoMapper.selectBaseBomInfoList(baseBomInfo2); + baseBomInfos.addAll(baseBomInfos2); + for (BaseBomInfo info : baseBomInfos2) { + BaseBomInfo baseBomInfo4 = new BaseBomInfo(); + baseBomInfo4.setParentId(info.getMaterialCode()); + List baseBomInfos4 = baseBomInfoMapper.selectBaseBomInfoList(baseBomInfo4); + baseBomInfos.addAll(baseBomInfos4); + } + } + BaseBomInfo baseBomInfo3 = new BaseBomInfo(); + baseBomInfo3.setMaterialCode(baseBomInfo.getAncestors()); + List baseBomInfos3 = baseBomInfoMapper.selectBaseBomInfoList(baseBomInfo3); + baseBomInfos.addAll(baseBomInfos3); + return baseBomInfos; + } + if (StringUtils.isNotEmpty(baseBomInfo.getMaterialCode()) || StringUtils.isEmpty(baseBomInfo.getAncestors())){ + baseBomInfo.setMaterialCode(baseBomInfo.getMaterialCode()); + baseBomInfo.setAncestors(null); + baseBomInfos = baseBomInfoMapper.selectBaseBomInfoList(baseBomInfo); + return baseBomInfos; + } return baseBomInfos; } diff --git a/aucma-production/src/main/resources/mapper/production/BaseBomInfoMapper.xml b/aucma-production/src/main/resources/mapper/production/BaseBomInfoMapper.xml index f544395..1c56927 100644 --- a/aucma-production/src/main/resources/mapper/production/BaseBomInfoMapper.xml +++ b/aucma-production/src/main/resources/mapper/production/BaseBomInfoMapper.xml @@ -115,7 +115,7 @@ #{objId}, #{bomCode}, #{materialCode}, - #{materialName}, + #{materialName,jdbcType=NVARCHAR}, #{materialType}, #{standardAmount}, #{parentId}, @@ -135,7 +135,7 @@ bom_code = #{bomCode}, material_code = #{materialCode}, - material_name = #{materialName}, + material_name = #{materialName,jdbcType=NVARCHAR}, material_type = #{materialType}, standard_amount = #{standardAmount}, parent_id = #{parentId}, diff --git a/aucma-report/src/main/java/com/aucma/report/controller/QualityReportController.java b/aucma-report/src/main/java/com/aucma/report/controller/QualityReportController.java index cf0e2a8..bc0c045 100644 --- a/aucma-report/src/main/java/com/aucma/report/controller/QualityReportController.java +++ b/aucma-report/src/main/java/com/aucma/report/controller/QualityReportController.java @@ -71,4 +71,26 @@ public class QualityReportController extends BaseController { return success(list); } + + /** + * 测温记录报表 + * @param hashMap + * @return + */ + @GetMapping("/temperatureRecordReportList") + public AjaxResult temperatureRecordReportList(@RequestParam(required = false) Map hashMap) { + List> list = qualityReportService.temperatureRecordReportList(hashMap); + return success(list); + } + + /** + * 灌注记录报表 + * @param hashMap + * @return + */ + @GetMapping("/pourRecordReportList") + public AjaxResult pourRecordReportList(@RequestParam(required = false) Map hashMap) { + List> list = qualityReportService.pourRecordReportList(hashMap); + return success(list); + } } diff --git a/aucma-report/src/main/java/com/aucma/report/mapper/GeneralReportMapper.java b/aucma-report/src/main/java/com/aucma/report/mapper/GeneralReportMapper.java index 37126d3..d7a9136 100644 --- a/aucma-report/src/main/java/com/aucma/report/mapper/GeneralReportMapper.java +++ b/aucma-report/src/main/java/com/aucma/report/mapper/GeneralReportMapper.java @@ -71,4 +71,18 @@ public interface GeneralReportMapper { * @return */ List> ScanOfflineRecordReportList(Map hashMap); + + /** + * 测温记录报表 + * @param hashMap + * @return + */ + List> temperatureRecordReportList(Map hashMap); + + /** + * 灌注记录报表 + * @param hashMap + * @return + */ + List> pourRecordReportList(Map hashMap); } diff --git a/aucma-report/src/main/java/com/aucma/report/service/IQualityReportService.java b/aucma-report/src/main/java/com/aucma/report/service/IQualityReportService.java index 4535fb0..b6fcb08 100644 --- a/aucma-report/src/main/java/com/aucma/report/service/IQualityReportService.java +++ b/aucma-report/src/main/java/com/aucma/report/service/IQualityReportService.java @@ -41,4 +41,18 @@ public interface IQualityReportService * @return */ List> productTraceabilityReportList(Map hashMap); + + /** + * 测温记录报表 + * @param hashMap + * @return + */ + List> temperatureRecordReportList(Map hashMap); + + /** + * 灌注记录报表 + * @param hashMap + * @return + */ + List> pourRecordReportList(Map hashMap); } diff --git a/aucma-report/src/main/java/com/aucma/report/service/impl/QualityReportServiceImpl.java b/aucma-report/src/main/java/com/aucma/report/service/impl/QualityReportServiceImpl.java index 4c07669..bdef6c1 100644 --- a/aucma-report/src/main/java/com/aucma/report/service/impl/QualityReportServiceImpl.java +++ b/aucma-report/src/main/java/com/aucma/report/service/impl/QualityReportServiceImpl.java @@ -62,4 +62,24 @@ public class QualityReportServiceImpl implements IQualityReportService { return reportMapper.productTraceabilityReportList(hashMap); } + /** + * 测温记录报表 + * @param hashMap + * @return + */ + @Override + public List> temperatureRecordReportList(Map hashMap) { + return reportMapper.temperatureRecordReportList(hashMap); + } + + /** + * 灌注记录报表 + * @param hashMap + * @return + */ + @Override + public List> pourRecordReportList(Map hashMap) { + return reportMapper.pourRecordReportList(hashMap); + } + } diff --git a/aucma-report/src/main/resources/mapper/report/GeneralReportMapper.xml b/aucma-report/src/main/resources/mapper/report/GeneralReportMapper.xml index 89312d3..8d47688 100644 --- a/aucma-report/src/main/resources/mapper/report/GeneralReportMapper.xml +++ b/aucma-report/src/main/resources/mapper/report/GeneralReportMapper.xml @@ -66,6 +66,14 @@ SELECT * FROM VIEW_PRODUCT_OFFLINE + +