| | |
| | | |
| | | !*/build/*.java |
| | | !*/build/*.html |
| | | !*/build/*.xml |
| | | !*/build/*.xml |
| | | |
| | | logs/ |
| | |
| | | { |
| | | // åå
¥åæ¡è®°å½,æ¯æ¡è®°å½å¯¹åºexcel表ä¸çä¸è¡ |
| | | Map<String, CellStyle> styles = new HashMap<String, CellStyle>(); |
| | | CellStyle style = wb.createCellStyle(); |
| | | style.setAlignment(HorizontalAlignment.CENTER); |
| | | style.setVerticalAlignment(VerticalAlignment.CENTER); |
| | | Font titleFont = wb.createFont(); |
| | | titleFont.setFontName("Arial"); |
| | | titleFont.setFontHeightInPoints((short) 16); |
| | | titleFont.setBold(true); |
| | | style.setFont(titleFont); |
| | | DataFormat dataFormat = wb.createDataFormat(); |
| | | style.setDataFormat(dataFormat.getFormat("@")); |
| | | CellStyle style = getTitleCellStyle(wb); |
| | | styles.put("title", style); |
| | | |
| | | style = wb.createCellStyle(); |
| | | style.setAlignment(HorizontalAlignment.CENTER); |
| | | style.setVerticalAlignment(VerticalAlignment.CENTER); |
| | | style.setBorderRight(BorderStyle.THIN); |
| | | style.setRightBorderColor(IndexedColors.GREY_50_PERCENT.getIndex()); |
| | | style.setBorderLeft(BorderStyle.THIN); |
| | | style.setLeftBorderColor(IndexedColors.GREY_50_PERCENT.getIndex()); |
| | | style.setBorderTop(BorderStyle.THIN); |
| | | style.setTopBorderColor(IndexedColors.GREY_50_PERCENT.getIndex()); |
| | | style.setBorderBottom(BorderStyle.THIN); |
| | | style.setBottomBorderColor(IndexedColors.GREY_50_PERCENT.getIndex()); |
| | | Font dataFont = wb.createFont(); |
| | | dataFont.setFontName("Arial"); |
| | | dataFont.setFontHeightInPoints((short) 10); |
| | | style.setFont(dataFont); |
| | | style = getDataCellStyle(wb); |
| | | styles.put("data", style); |
| | | |
| | | style = wb.createCellStyle(); |
| | |
| | | return styles; |
| | | } |
| | | |
| | | public static CellStyle getTitleCellStyle(Workbook wb) { |
| | | CellStyle style = wb.createCellStyle(); |
| | | style.setAlignment(HorizontalAlignment.CENTER); |
| | | style.setVerticalAlignment(VerticalAlignment.CENTER); |
| | | Font titleFont = wb.createFont(); |
| | | titleFont.setFontName("Arial"); |
| | | titleFont.setFontHeightInPoints((short) 16); |
| | | titleFont.setBold(true); |
| | | style.setFont(titleFont); |
| | | DataFormat dataFormat = wb.createDataFormat(); |
| | | style.setDataFormat(dataFormat.getFormat("@")); |
| | | return style; |
| | | } |
| | | |
| | | public static CellStyle getDataCellStyle(Workbook wb) { |
| | | CellStyle style; |
| | | style = wb.createCellStyle(); |
| | | style.setAlignment(HorizontalAlignment.CENTER); |
| | | style.setVerticalAlignment(VerticalAlignment.CENTER); |
| | | style.setBorderRight(BorderStyle.THIN); |
| | | style.setRightBorderColor(IndexedColors.GREY_50_PERCENT.getIndex()); |
| | | style.setBorderLeft(BorderStyle.THIN); |
| | | style.setLeftBorderColor(IndexedColors.GREY_50_PERCENT.getIndex()); |
| | | style.setBorderTop(BorderStyle.THIN); |
| | | style.setTopBorderColor(IndexedColors.GREY_50_PERCENT.getIndex()); |
| | | style.setBorderBottom(BorderStyle.THIN); |
| | | style.setBottomBorderColor(IndexedColors.GREY_50_PERCENT.getIndex()); |
| | | Font dataFont = wb.createFont(); |
| | | dataFont.setFontName("Arial"); |
| | | dataFont.setFontHeightInPoints((short) 10); |
| | | style.setFont(dataFont); |
| | | return style; |
| | | } |
| | | |
| | | /** |
| | | * æ ¹æ®Excel注解åå»ºè¡¨æ ¼å¤´æ ·å¼ |
| | | * |
| | |
| | | String key = StringUtils.format("header_{}_{}", excel.headerColor(), excel.headerBackgroundColor()); |
| | | if (!headerStyles.containsKey(key)) |
| | | { |
| | | CellStyle style = wb.createCellStyle(); |
| | | style.cloneStyleFrom(styles.get("data")); |
| | | style.setAlignment(HorizontalAlignment.CENTER); |
| | | style.setVerticalAlignment(VerticalAlignment.CENTER); |
| | | style.setFillForegroundColor(excel.headerBackgroundColor().index); |
| | | style.setFillPattern(FillPatternType.SOLID_FOREGROUND); |
| | | Font headerFont = wb.createFont(); |
| | | headerFont.setFontName("Arial"); |
| | | headerFont.setFontHeightInPoints((short) 10); |
| | | headerFont.setBold(true); |
| | | headerFont.setColor(excel.headerColor().index); |
| | | style.setFont(headerFont); |
| | | // è®¾ç½®è¡¨æ ¼å¤´åå
æ ¼ææ¬å½¢å¼ |
| | | DataFormat dataFormat = wb.createDataFormat(); |
| | | style.setDataFormat(dataFormat.getFormat("@")); |
| | | CellStyle style = getHeaderStyle(wb, excel); |
| | | headerStyles.put(key, style); |
| | | } |
| | | } |
| | | return headerStyles; |
| | | } |
| | | |
| | | private static CellStyle getHeaderStyle(Workbook wb, Excel excel) { |
| | | CellStyle style = wb.createCellStyle(); |
| | | style.cloneStyleFrom(getDataCellStyle(wb)); |
| | | style.setAlignment(HorizontalAlignment.CENTER); |
| | | style.setVerticalAlignment(VerticalAlignment.CENTER); |
| | | style.setFillForegroundColor(excel.headerBackgroundColor().index); |
| | | style.setFillPattern(FillPatternType.SOLID_FOREGROUND); |
| | | Font headerFont = wb.createFont(); |
| | | headerFont.setFontName("Arial"); |
| | | headerFont.setFontHeightInPoints((short) 10); |
| | | headerFont.setBold(true); |
| | | headerFont.setColor(excel.headerColor().index); |
| | | style.setFont(headerFont); |
| | | // è®¾ç½®è¡¨æ ¼å¤´åå
æ ¼ææ¬å½¢å¼ |
| | | DataFormat dataFormat = wb.createDataFormat(); |
| | | style.setDataFormat(dataFormat.getFormat("@")); |
| | | return style; |
| | | } |
| | | public static CellStyle getCommonHeaderStyle(Workbook wb) { |
| | | CellStyle style = wb.createCellStyle(); |
| | | style.cloneStyleFrom(getDataCellStyle(wb)); |
| | | style.setAlignment(HorizontalAlignment.CENTER); |
| | | style.setVerticalAlignment(VerticalAlignment.CENTER); |
| | | style.setFillForegroundColor( IndexedColors.GREY_50_PERCENT.getIndex()); |
| | | style.setFillPattern(FillPatternType.SOLID_FOREGROUND); |
| | | Font headerFont = wb.createFont(); |
| | | headerFont.setFontName("Arial"); |
| | | headerFont.setFontHeightInPoints((short) 10); |
| | | headerFont.setBold(true); |
| | | headerFont.setColor(IndexedColors.WHITE.getIndex()); |
| | | style.setFont(headerFont); |
| | | // è®¾ç½®è¡¨æ ¼å¤´åå
æ ¼ææ¬å½¢å¼ |
| | | DataFormat dataFormat = wb.createDataFormat(); |
| | | style.setDataFormat(dataFormat.getFormat("@")); |
| | | return style; |
| | | } |
| | | /** |
| | | * æ ¹æ®Excel注解åå»ºè¡¨æ ¼åæ ·å¼ |
| | | * |
| | |
| | | /** |
| | | * å¾å°ææå®ä¹å段 |
| | | */ |
| | | private void createExcelField() |
| | | public void createExcelField() |
| | | { |
| | | this.fields = getFields(); |
| | | this.fields = this.fields.stream().sorted(Comparator.comparing(objects -> ((Excel) objects[1]).sort())).collect(Collectors.toList()); |
| | |
| | | * 夿æ¯å¦åå¨é |
| | | * */ |
| | | public boolean existLock(String key,String value){ |
| | | if(null==this.redisTemplate.opsForValue().get(key)){ |
| | | return false; |
| | | } |
| | | return this.redisTemplate.opsForValue().get(key).equals(value); |
| | | } |
| | | |
| | |
| | | package com.aps.common.security.utils; |
| | | |
| | | import java.util.Collection; |
| | | import java.util.Collections; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | |
| | | import com.alibaba.fastjson2.JSONArray; |
| | | import com.aps.common.core.constant.CacheConstants; |
| | | import com.aps.common.core.utils.SpringUtils; |
| | | import com.aps.common.core.utils.StringUtils; |
| | | import com.aps.common.redis.service.RedisService; |
| | | import com.aps.system.api.domain.SysDictData; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | /** |
| | | * åå
¸å·¥å
·ç±» |
| | | * |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public class DictUtils |
| | | { |
| | | public class DictUtils { |
| | | /** |
| | | * 设置åå
¸ç¼å |
| | | * |
| | | * @param key åæ°é® |
| | | * |
| | | * @param key åæ°é® |
| | | * @param dictDatas åå
¸æ°æ®å表 |
| | | */ |
| | | public static void setDictCache(String key, List<SysDictData> dictDatas) |
| | | { |
| | | public static void setDictCache(String key, List<SysDictData> dictDatas) { |
| | | SpringUtils.getBean(RedisService.class).setCacheObject(getCacheKey(key), dictDatas); |
| | | } |
| | | |
| | | /** |
| | | * è·ååå
¸ç¼å |
| | | * |
| | | * |
| | | * @param key åæ°é® |
| | | * @return dictDatas åå
¸æ°æ®å表 |
| | | */ |
| | | public static List<SysDictData> getDictCache(String key) |
| | | { |
| | | public static List<SysDictData> getDictCache(String key) { |
| | | JSONArray arrayCache = SpringUtils.getBean(RedisService.class).getCacheObject(getCacheKey(key)); |
| | | if (StringUtils.isNotNull(arrayCache)) |
| | | { |
| | | if (StringUtils.isNotNull(arrayCache)) { |
| | | return arrayCache.toList(SysDictData.class); |
| | | } |
| | | return null; |
| | |
| | | |
| | | /** |
| | | * å 餿å®åå
¸ç¼å |
| | | * |
| | | * |
| | | * @param key åå
¸é® |
| | | */ |
| | | public static void removeDictCache(String key) |
| | | { |
| | | public static void removeDictCache(String key) { |
| | | SpringUtils.getBean(RedisService.class).deleteObject(getCacheKey(key)); |
| | | } |
| | | |
| | | /** |
| | | * æ¸
空åå
¸ç¼å |
| | | */ |
| | | public static void clearDictCache() |
| | | { |
| | | public static void clearDictCache() { |
| | | Collection<String> keys = SpringUtils.getBean(RedisService.class).keys(CacheConstants.SYS_DICT_KEY + "*"); |
| | | SpringUtils.getBean(RedisService.class).deleteObject(keys); |
| | | } |
| | | |
| | | /** |
| | | * 设置cache key |
| | | * |
| | | * |
| | | * @param configKey åæ°é® |
| | | * @return ç¼åé®key |
| | | */ |
| | | public static String getCacheKey(String configKey) |
| | | { |
| | | public static String getCacheKey(String configKey) { |
| | | return CacheConstants.SYS_DICT_KEY + configKey; |
| | | } |
| | | |
| | | |
| | | public static interface CacheValue{ |
| | | String get(String label); |
| | | } |
| | | |
| | | /** |
| | | * æ ¹æ®åå
¸ç±»åååå
¸æ ç¾è·ååå
¸å¼ |
| | | * |
| | | * @param dictType |
| | | * @return |
| | | */ |
| | | public static CacheValue getCacheValue(String dictType) { |
| | | |
| | | List<SysDictData> cacheData = StringUtils.isEmpty(dictType) ? Collections.emptyList() : getDictCache(dictType); |
| | | return label -> { |
| | | if (CollectionUtils.isEmpty(cacheData)){ |
| | | return null; |
| | | } |
| | | if(StringUtils.isEmpty(label)){ |
| | | return null; |
| | | } |
| | | return cacheData.stream().filter(item -> Objects.equals(item.getDictLabel(), label)) |
| | | .findFirst() |
| | | .map(SysDictData::getDictValue) |
| | | .orElse(null); |
| | | }; |
| | | } |
| | | } |
| | |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * æ°ä½ç®¡è·¯äº§è½è´è½½ç»è®¡Controller |
| | |
| | | /** |
| | | * è·åæ°ä½ç®¡è·¯äº§è½è´è½½ç»è®¡è¯¦ç»ä¿¡æ¯ |
| | | */ |
| | | @Operation(summary = "è·åæ°ä½ç®¡è·¯äº§è½è´è½½ç»è®¡è¯¦ç»ä¿¡æ¯", description = "æ ¹æ®idè·å") |
| | | @Operation(summary = "è·åæ°ä½ç®¡è·¯äº§è½è´è½½ç»è®¡è¯¦ç»ä¿¡æ¯", description = "æ ¹æ®IDæ¥è¯¢") |
| | | @RequiresPermissions("aps:apsGasPipingRouteStat:query") |
| | | @GetMapping(value = "/{id}") |
| | | public AjaxResult getInfo(@PathVariable("id") String id) |
| | |
| | | /** |
| | | * æ°å¢æ°ä½ç®¡è·¯äº§è½è´è½½ç»è®¡ |
| | | */ |
| | | @Operation(summary = "æ°å¢æ°ä½ç®¡è·¯äº§è½è´è½½ç»è®¡", description = "å个æ°å¢") |
| | | @Operation(summary = "æ°å¢æ°ä½ç®¡è·¯äº§è½è´è½½ç»è®¡", description = "æ°å¢") |
| | | @RequiresPermissions("aps:apsGasPipingRouteStat:add") |
| | | @Log(title = "æ°ä½ç®¡è·¯äº§è½è´è½½ç»è®¡", businessType = BusinessType.INSERT) |
| | | @PostMapping |
| | |
| | | /** |
| | | * ä¿®æ¹æ°ä½ç®¡è·¯äº§è½è´è½½ç»è®¡ |
| | | */ |
| | | @Operation(summary = "ä¿®æ¹æ°ä½ç®¡è·¯äº§è½è´è½½ç»è®¡", description = "å个修æ¹") |
| | | @Operation(summary = "ä¿®æ¹æ°ä½ç®¡è·¯äº§è½è´è½½ç»è®¡", description = "ä¿®æ¹") |
| | | @RequiresPermissions("aps:apsGasPipingRouteStat:edit") |
| | | @Log(title = "æ°ä½ç®¡è·¯äº§è½è´è½½ç»è®¡", businessType = BusinessType.UPDATE) |
| | | @PutMapping |
| | |
| | | /** |
| | | * å 餿°ä½ç®¡è·¯äº§è½è´è½½ç»è®¡ |
| | | */ |
| | | @Operation(summary = "å 餿°ä½ç®¡è·¯äº§è½è´è½½ç»è®¡", description = "æ¹éå é¤") |
| | | @Operation(summary = "å 餿°ä½ç®¡è·¯äº§è½è´è½½ç»è®¡", description = "å é¤") |
| | | @RequiresPermissions("aps:apsGasPipingRouteStat:remove") |
| | | @Log(title = "æ°ä½ç®¡è·¯äº§è½è´è½½ç»è®¡", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/{ids}") |
| | |
| | | { |
| | | return toAjax(apsGasPipingRouteStatService.deleteApsGasPipingRouteStatByIds(ids)); |
| | | } |
| | | |
| | | /** |
| | | * çææ°ä½ç®¡è·¯äº§è½è´è½½ç»è®¡æ°æ® |
| | | */ |
| | | @Operation(summary = "çææ°ä½ç®¡è·¯äº§è½è´è½½ç»è®¡æ°æ®", description = "æ ¹æ®é¢æµæ°æ®å工忰æ®çæç»è®¡æ°æ®") |
| | | @RequiresPermissions("aps:apsGasPipingRouteStat:generate") |
| | | @Log(title = "æ°ä½ç®¡è·¯äº§è½è´è½½ç»è®¡", businessType = BusinessType.INSERT) |
| | | @PostMapping("/generate") |
| | | public AjaxResult generateGasPipingRouteStatData() |
| | | { |
| | | return toAjax(apsGasPipingRouteStatService.generateGasPipingRouteStatData()); |
| | | } |
| | | |
| | | /** |
| | | * èåæ°ä½ç®¡è·¯äº§è½è´è½½ç»è®¡æ°æ® |
| | | */ |
| | | @Operation(summary = "èåæ°ä½ç®¡è·¯äº§è½è´è½½ç»è®¡æ°æ®", description = "èåç»è®¡æ°æ®ï¼æ¯æå¨æéæ©è¡ç»´åº¦(rowGroupBy)è¿è¡èåï¼å¦æå·¥åºåç§°ã车é´ãå·¥åãä¸ä¸ç") |
| | | @RequiresPermissions("aps:apsGasPipingRouteStat:aggregate") |
| | | @PostMapping("/aggregate") |
| | | public AjaxResult aggregateGasPipingRouteStat(@RequestBody Map<String, Object> params) |
| | | { |
| | | return success(apsGasPipingRouteStatService.aggregateGasPipingRouteStat(params)); |
| | | } |
| | | |
| | | @Operation(summary = "è®¡ç®æ°ä½ç®¡è·¯äº§è½è´è½½ç»è®¡", description = "计ç®") |
| | | @PostMapping("/computeCapacity") |
| | |
| | | import com.aps.common.security.annotation.RequiresPermissions; |
| | | import com.aps.common.security.utils.SecurityUtils; |
| | | import com.aps.core.domain.ApsGasPipelineCapacityPlan; |
| | | import com.aps.core.domain.ApsShop; |
| | | import com.aps.core.domain.ApsStandardProcess; |
| | | import com.aps.core.service.IApsGasPipelineCapacityPlanService; |
| | | import com.aps.core.service.IApsShopService; |
| | | import com.aps.core.service.IApsStandardProcessService; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Comparator; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | |
| | | /** |
| | | * æ°ä½ç®¡è·¯äº§è½è§åController |
| | | * |
| | | * |
| | | * @author hjy |
| | | * @date 2025-04-24 |
| | | */ |
| | |
| | | @Tag(name = "æ°ä½ç®¡è·¯äº§è½è§å", description = "æ°ä½ç®¡è·¯äº§è½è§åæ¥å£") |
| | | @RestController |
| | | @RequestMapping("/gasPipelineCapacityPlan") |
| | | public class ApsGasPipelineCapacityPlanController extends BaseController |
| | | { |
| | | public class ApsGasPipelineCapacityPlanController extends BaseController { |
| | | @Autowired |
| | | private IApsGasPipelineCapacityPlanService apsGasPipelineCapacityPlanService; |
| | | |
| | | @Autowired |
| | | private IApsStandardProcessService apsStandardProcessService; |
| | | |
| | | @Autowired |
| | | private IApsShopService apsShopService; |
| | | |
| | | /** |
| | | * æ¥è¯¢æ°ä½ç®¡è·¯äº§è½è§åå表 |
| | |
| | | @Operation(summary = "æ¥è¯¢æ°ä½ç®¡è·¯äº§è½è§åå表", description = "å页æ¥è¯¢") |
| | | @RequiresPermissions("aps:gasPipelineCapacityPlan:list") |
| | | @GetMapping("/list") |
| | | public TableDataInfo list(ApsGasPipelineCapacityPlan apsGasPipelineCapacityPlan) |
| | | { |
| | | public TableDataInfo list(ApsGasPipelineCapacityPlan apsGasPipelineCapacityPlan) { |
| | | // startPage(); |
| | | List<ApsGasPipelineCapacityPlan> list = apsGasPipelineCapacityPlanService.selectApsGasPipelineCapacityPlanList(apsGasPipelineCapacityPlan); |
| | | ApsStandardProcess apsStandardProcess = new ApsStandardProcess(); |
| | | apsStandardProcess.setMajor(apsGasPipelineCapacityPlan.getMajor()); |
| | | apsStandardProcess.setPlant(apsGasPipelineCapacityPlan.getOrgCode()); |
| | | List<ApsStandardProcess> processList = apsStandardProcessService.selectApsStandardProcessListAll(apsStandardProcess); |
| | | if(list.isEmpty()){ |
| | | for(ApsStandardProcess apsStandardProcessTemp : processList){ |
| | | List<ApsShop> apsShops = apsShopService.findShopByFactory(apsGasPipelineCapacityPlan.getOrgCode()); |
| | | if (list.isEmpty()) { |
| | | for (ApsStandardProcess apsStandardProcessTemp : processList) { |
| | | ApsGasPipelineCapacityPlan apsGasPipelineCapacityPlanTemp = new ApsGasPipelineCapacityPlan(); |
| | | apsGasPipelineCapacityPlanTemp.setProcessName(apsStandardProcessTemp.getProcessName()); |
| | | apsGasPipelineCapacityPlanTemp.setOrgCode(apsStandardProcessTemp.getPlant()); |
| | | apsGasPipelineCapacityPlanTemp.setWorkshop(apsShops.stream() |
| | | .filter(shop -> Objects.equals(shop.getShopCode(), apsStandardProcessTemp.getWorkShop())) |
| | | .map(ApsShop::getShopName) |
| | | .findFirst() |
| | | .orElse(null)); |
| | | list.add(apsGasPipelineCapacityPlanTemp); |
| | | } |
| | | } else { |
| | | list.forEach(capacityPlan -> { |
| | | processList.stream().filter(p -> Objects.equals(p.getPlant(), capacityPlan.getOrgCode())) |
| | | .filter(p -> Objects.equals(p.getMajor(), capacityPlan.getMajor())) |
| | | .filter(p -> p.getWorkShop() != null) |
| | | .findFirst().ifPresent(p -> { |
| | | capacityPlan.setWorkshop(apsShops.stream() |
| | | .filter(shop -> Objects.equals(shop.getShopCode(), p.getWorkShop())) |
| | | .map(ApsShop::getShopName) |
| | | .findFirst() |
| | | .orElse(null)); |
| | | }); |
| | | }); |
| | | } |
| | | if(processList.size()>list.size()){ |
| | | List<String> newProcess = new ArrayList<>(); |
| | | for(ApsStandardProcess apsStandardProcessTemp : processList){ |
| | | if (processList.size() > list.size()) { |
| | | List<ApsStandardProcess> newProcess = new ArrayList<>(); |
| | | for (ApsStandardProcess apsStandardProcessTemp : processList) { |
| | | boolean flag = true; |
| | | for(ApsGasPipelineCapacityPlan temp : list){ |
| | | if(apsStandardProcessTemp.getProcessName().equals(temp.getProcessName())){ |
| | | for (ApsGasPipelineCapacityPlan temp : list) { |
| | | if (apsStandardProcessTemp.getProcessName().equals(temp.getProcessName())) { |
| | | flag = false; |
| | | break; |
| | | } |
| | | } |
| | | if(flag){ |
| | | newProcess.add(apsStandardProcessTemp.getProcessName()); |
| | | if (flag) { |
| | | newProcess.add(apsStandardProcessTemp); |
| | | } |
| | | } |
| | | for(String processName : newProcess){ |
| | | for (ApsStandardProcess process : newProcess) { |
| | | ApsGasPipelineCapacityPlan apsGasPipelineCapacityPlanTemp = new ApsGasPipelineCapacityPlan(); |
| | | apsGasPipelineCapacityPlanTemp.setProcessName(processName); |
| | | apsGasPipelineCapacityPlanTemp.setProcessName(process.getProcessName()); |
| | | apsGasPipelineCapacityPlanTemp.setOrgCode(process.getPlant()); |
| | | apsGasPipelineCapacityPlanTemp.setWorkshop(apsShops.stream() |
| | | .filter(shop -> Objects.equals(shop.getShopCode(), process.getWorkShop())) |
| | | .map(ApsShop::getShopName) |
| | | .findFirst() |
| | | .orElse(null)); |
| | | list.add(apsGasPipelineCapacityPlanTemp); |
| | | } |
| | | } |
| | | list.sort((a, b)->a.getProcessName().compareTo(b.getProcessName())); |
| | | list.sort(Comparator.comparing(ApsGasPipelineCapacityPlan::getProcessName)); |
| | | return getDataTable(list); |
| | | } |
| | | |
| | |
| | | @RequiresPermissions("aps:gasPipelineCapacityPlan:export") |
| | | @Log(title = "æ°ä½ç®¡è·¯äº§è½è§å", businessType = BusinessType.EXPORT) |
| | | @PostMapping("/export") |
| | | public void export(HttpServletResponse response, ApsGasPipelineCapacityPlan apsGasPipelineCapacityPlan) |
| | | { |
| | | public void export(HttpServletResponse response, ApsGasPipelineCapacityPlan apsGasPipelineCapacityPlan) { |
| | | List<ApsGasPipelineCapacityPlan> list = apsGasPipelineCapacityPlanService.selectApsGasPipelineCapacityPlanList(apsGasPipelineCapacityPlan); |
| | | ExcelUtil<ApsGasPipelineCapacityPlan> util = new ExcelUtil<ApsGasPipelineCapacityPlan>(ApsGasPipelineCapacityPlan.class); |
| | | util.exportExcel(response, list, "æ°ä½ç®¡è·¯äº§è½è§åæ°æ®"); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * å¤å¶æ°ä½ç®¡è·¯äº§è½è§å |
| | | */ |
| | | @Operation(summary = "å¤å¶æ°ä½ç®¡è·¯äº§è½è§å", description = "å¤å¶") |
| | | @RequiresPermissions("aps:gasPipelineCapacityPlan:copy") |
| | | @Log(title = "å¤å¶æ°ä½ç®¡è·¯äº§è½è§å", businessType = BusinessType.INSERT) |
| | | @PutMapping("/copy") |
| | | public AjaxResult copy( |
| | | // æ ¼å¼ï¼yyyy-MM |
| | | @RequestParam String date, |
| | | @RequestParam String factory, |
| | | @RequestParam String major, |
| | | // æ ¼å¼ï¼yyyy-MM |
| | | @RequestParam String toStart, |
| | | // æ ¼å¼ï¼yyyy-MM |
| | | @RequestParam String toEnd) { |
| | | apsGasPipelineCapacityPlanService.copyPlan(date, factory, major, toStart, toEnd); |
| | | return success(); |
| | | } |
| | | |
| | | /** |
| | |
| | | @Operation(summary = "è·åæ°ä½ç®¡è·¯äº§è½è§å详ç»ä¿¡æ¯", description = "æ ¹æ®idè·å") |
| | | @RequiresPermissions("aps:gasPipelineCapacityPlan:query") |
| | | @GetMapping(value = "/{id}") |
| | | public AjaxResult getInfo(@PathVariable("id") Long id) |
| | | { |
| | | public AjaxResult getInfo(@PathVariable("id") Long id) { |
| | | return success(apsGasPipelineCapacityPlanService.selectApsGasPipelineCapacityPlanById(id)); |
| | | } |
| | | |
| | |
| | | @RequiresPermissions("aps:gasPipelineCapacityPlan:add") |
| | | @Log(title = "æ°ä½ç®¡è·¯äº§è½è§å", businessType = BusinessType.INSERT) |
| | | @PostMapping |
| | | public AjaxResult add(@RequestBody List<ApsGasPipelineCapacityPlan> apsGasPipelineCapacityPlan) |
| | | { |
| | | public AjaxResult add(@RequestBody List<ApsGasPipelineCapacityPlan> apsGasPipelineCapacityPlan) { |
| | | apsGasPipelineCapacityPlan.forEach(apsGasPipelineCapacityPlanTemp -> { |
| | | if(apsGasPipelineCapacityPlanTemp.getId()==null){ |
| | | if (apsGasPipelineCapacityPlanTemp.getId() == null) { |
| | | apsGasPipelineCapacityPlanTemp.setCreateBy(SecurityUtils.getUsername()); |
| | | apsGasPipelineCapacityPlanTemp.setCreateTime(DateUtils.getNowDate()); |
| | | apsGasPipelineCapacityPlanService.insertApsGasPipelineCapacityPlan(apsGasPipelineCapacityPlanTemp); |
| | | }else{ |
| | | } else { |
| | | apsGasPipelineCapacityPlanTemp.setUpdateBy(SecurityUtils.getUsername()); |
| | | apsGasPipelineCapacityPlanTemp.setUpdateTime(DateUtils.getNowDate()); |
| | | apsGasPipelineCapacityPlanService.updateApsGasPipelineCapacityPlan(apsGasPipelineCapacityPlanTemp); |
| | |
| | | @RequiresPermissions("aps:gasPipelineCapacityPlan:edit") |
| | | @Log(title = "æ°ä½ç®¡è·¯äº§è½è§å", businessType = BusinessType.UPDATE) |
| | | @PutMapping |
| | | public AjaxResult edit(@RequestBody ApsGasPipelineCapacityPlan apsGasPipelineCapacityPlan) |
| | | { |
| | | public AjaxResult edit(@RequestBody ApsGasPipelineCapacityPlan apsGasPipelineCapacityPlan) { |
| | | return toAjax(apsGasPipelineCapacityPlanService.updateApsGasPipelineCapacityPlan(apsGasPipelineCapacityPlan)); |
| | | } |
| | | |
| | |
| | | @Operation(summary = "å 餿°ä½ç®¡è·¯äº§è½è§å", description = "æ¹éå é¤") |
| | | @RequiresPermissions("aps:gasPipelineCapacityPlan:remove") |
| | | @Log(title = "æ°ä½ç®¡è·¯äº§è½è§å", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/{ids}") |
| | | public AjaxResult remove(@PathVariable Long[] ids) |
| | | { |
| | | @DeleteMapping("/{ids}") |
| | | public AjaxResult remove(@PathVariable Long[] ids) { |
| | | return toAjax(apsGasPipelineCapacityPlanService.deleteApsGasPipelineCapacityPlanByIds(ids)); |
| | | } |
| | | } |
| | |
| | | import com.aps.common.log.annotation.Log; |
| | | import com.aps.common.log.enums.BusinessType; |
| | | import com.aps.common.security.annotation.RequiresPermissions; |
| | | import com.aps.common.security.utils.DictUtils; |
| | | import com.aps.core.domain.ApsShop; |
| | | import com.aps.core.domain.ApsStandardProcess; |
| | | import com.aps.core.service.IApsShopService; |
| | | import com.aps.core.service.IApsStandardProcessService; |
| | | import com.aps.system.api.domain.SysDictData; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import lombok.SneakyThrows; |
| | | import org.apache.commons.io.IOUtils; |
| | | import org.apache.poi.ss.usermodel.Row; |
| | | import org.apache.poi.ss.usermodel.Sheet; |
| | | import org.apache.poi.ss.usermodel.Workbook; |
| | | import org.apache.poi.ss.usermodel.WorkbookFactory; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.core.io.ByteArrayResource; |
| | | import org.springframework.http.HttpHeaders; |
| | | import org.springframework.http.ResponseEntity; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import java.io.ByteArrayInputStream; |
| | | import java.io.ByteArrayOutputStream; |
| | | import java.net.URLEncoder; |
| | | import java.nio.charset.StandardCharsets; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * æ åå·¥åºController |
| | | * |
| | | * |
| | | * @author hjy |
| | | * @date 2025-04-23 |
| | | */ |
| | |
| | | @Tag(name = "æ åå·¥åº", description = "æ åå·¥åºæ¥å£") |
| | | @RestController |
| | | @RequestMapping("/standardProcess") |
| | | public class ApsStandardProcessController extends BaseController |
| | | { |
| | | public class ApsStandardProcessController extends BaseController { |
| | | @Autowired |
| | | private IApsStandardProcessService apsStandardProcessService; |
| | | |
| | | @Autowired |
| | | IApsShopService apsShopService; |
| | | |
| | | /** |
| | | * æ¥è¯¢æ åå·¥åºå表 |
| | |
| | | @Operation(summary = "æ¥è¯¢æ åå·¥åºå表", description = "å页æ¥è¯¢") |
| | | @RequiresPermissions("aps:standardProcess:list") |
| | | @GetMapping("/list") |
| | | public TableDataInfo list(ApsStandardProcess apsStandardProcess) |
| | | { |
| | | public TableDataInfo list(ApsStandardProcess apsStandardProcess) { |
| | | startPage(); |
| | | List<ApsStandardProcess> list = apsStandardProcessService.selectApsStandardProcessList(apsStandardProcess); |
| | | List<ApsShop> apsShops = apsShopService.findShopByCodes(list.stream().map(ApsStandardProcess::getWorkShop) |
| | | .filter(Objects::nonNull) |
| | | .collect(Collectors.toSet())); |
| | | list.forEach(temp -> { |
| | | temp.setWorkShop(apsShops.stream() |
| | | .filter(tempShop -> Objects.equals(tempShop.getShopCode(), temp.getWorkShop())) |
| | | .map(ApsShop::getShopName) |
| | | .findFirst() |
| | | .orElse(null)); |
| | | }); |
| | | return getDataTable(list); |
| | | } |
| | | |
| | |
| | | @RequiresPermissions("aps:standardProcess:export") |
| | | @Log(title = "æ åå·¥åº", businessType = BusinessType.EXPORT) |
| | | @PostMapping("/export") |
| | | public void export(HttpServletResponse response, ApsStandardProcess apsStandardProcess) |
| | | { |
| | | public void export(HttpServletResponse response, ApsStandardProcess apsStandardProcess) { |
| | | List<ApsStandardProcess> list = apsStandardProcessService.selectApsStandardProcessList(apsStandardProcess); |
| | | ExcelUtil<ApsStandardProcess> util = new ExcelUtil<ApsStandardProcess>(ApsStandardProcess.class); |
| | | util.exportExcel(response, list, "æ åå·¥åºæ°æ®"); |
| | |
| | | @Operation(summary = "è·åæ åå·¥åºè¯¦ç»ä¿¡æ¯", description = "æ ¹æ®idè·å") |
| | | @RequiresPermissions("aps:standardProcess:query") |
| | | @GetMapping(value = "/{id}") |
| | | public AjaxResult getInfo(@PathVariable("id") Long id) |
| | | { |
| | | public AjaxResult getInfo(@PathVariable("id") Long id) { |
| | | return success(apsStandardProcessService.selectApsStandardProcessById(id)); |
| | | } |
| | | |
| | |
| | | @RequiresPermissions("aps:standardProcess:add") |
| | | @Log(title = "æ åå·¥åº", businessType = BusinessType.INSERT) |
| | | @PostMapping |
| | | public AjaxResult add(@RequestBody ApsStandardProcess apsStandardProcess) |
| | | { |
| | | public AjaxResult add(@RequestBody ApsStandardProcess apsStandardProcess) { |
| | | return toAjax(apsStandardProcessService.insertApsStandardProcess(apsStandardProcess)); |
| | | } |
| | | |
| | |
| | | @RequiresPermissions("aps:standardProcess:edit") |
| | | @Log(title = "æ åå·¥åº", businessType = BusinessType.UPDATE) |
| | | @PutMapping |
| | | public AjaxResult edit(@RequestBody ApsStandardProcess apsStandardProcess) |
| | | { |
| | | public AjaxResult edit(@RequestBody ApsStandardProcess apsStandardProcess) { |
| | | return toAjax(apsStandardProcessService.updateApsStandardProcess(apsStandardProcess)); |
| | | } |
| | | |
| | |
| | | @Operation(summary = "å 餿 åå·¥åº", description = "æ¹éå é¤") |
| | | @RequiresPermissions("aps:standardProcess:remove") |
| | | @Log(title = "æ åå·¥åº", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/{ids}") |
| | | public AjaxResult remove(@PathVariable Long[] ids) |
| | | { |
| | | @DeleteMapping("/{ids}") |
| | | public AjaxResult remove(@PathVariable Long[] ids) { |
| | | return toAjax(apsStandardProcessService.deleteApsStandardProcessByIds(ids)); |
| | | } |
| | | |
| | |
| | | * 导å
¥æ åå·¥åºæ°æ® |
| | | */ |
| | | @Operation(summary = "导å
¥æ åå·¥åºæ°æ®", description = "å¢é导å
¥") |
| | | @RequiresPermissions("aps:standardProcess:importData") |
| | | // @RequiresPermissions("aps:standardProcess:importData") |
| | | @PostMapping("/importData") |
| | | public AjaxResult importData(MultipartFile file) throws Exception { |
| | | ExcelUtil<ApsStandardProcess> util = new ExcelUtil<>(ApsStandardProcess.class); |
| | |
| | | //夿坼å
¥æ°æ®æ¯å¦ä¸ºç©º |
| | | if (!tempList.isEmpty()) { |
| | | Boolean res = apsStandardProcessService.importData(tempList); |
| | | if(res){ |
| | | if (res) { |
| | | return AjaxResult.success("导å
¥æåï¼"); |
| | | }else{ |
| | | } else { |
| | | return AjaxResult.error("导å
¥å¤±è´¥ï¼"); |
| | | } |
| | | } else { |
| | |
| | | @Operation(summary = "æ ¹æ®è½¦é´æ¥è¯¢æ åå·¥åºå表", description = "å
¨éæ¥è¯¢") |
| | | @RequiresPermissions("aps:standardProcess:listByWorkShop") |
| | | @GetMapping("/listByWorkShop") |
| | | public TableDataInfo listByWorkShop(ApsStandardProcess apsStandardProcess) |
| | | { |
| | | public TableDataInfo listByWorkShop(ApsStandardProcess apsStandardProcess) { |
| | | List<ApsStandardProcess> list = apsStandardProcessService.selectApsStandardProcessList(apsStandardProcess); |
| | | return getDataTable(list); |
| | | } |
| | | |
| | | /** |
| | | * ä¸è½½æ åå·¥åºæ°æ®å¯¼å
¥æ¨¡æ¿ |
| | | */ |
| | | @SneakyThrows |
| | | @Operation(summary = "ä¸è½½æ åå·¥åºæ°æ®å¯¼å
¥æ¨¡æ¿", description = "ä¸è½½æ åå·¥åºæ°æ®å¯¼å
¥æ¨¡æ¿") |
| | | // @RequiresPermissions("gasPipeline:prediction:template") |
| | | // @Log(title = "ä¸è½½æ°ä½é¢æµæ°æ®å¯¼å
¥æ¨¡æ¿", businessType = BusinessType.EXPORT) |
| | | @GetMapping("/template") |
| | | public ResponseEntity<ByteArrayResource> exportTemplate() { |
| | | byte[] file = IOUtils.resourceToByteArray("/templates/æ åå·¥åºæ°æ®æ¨¡æ¿v1.0.xlsx"); |
| | | Workbook workbook = WorkbookFactory.create(new ByteArrayInputStream(file)); |
| | | Sheet sheet = workbook.getSheet("åå
¸-å·¥å"); |
| | | List<SysDictData> sysDictDataList = DictUtils.getDictCache("aps_factory"); |
| | | boolean changed = false; |
| | | if (sysDictDataList != null) { |
| | | for (int i = 0; i < sysDictDataList.size(); i++) { |
| | | Row row = sheet.createRow(i + 1); |
| | | row.createCell(0).setCellValue(sysDictDataList.get(i).getDictValue()); |
| | | row.createCell(1).setCellValue(sysDictDataList.get(i).getDictLabel()); |
| | | } |
| | | |
| | | sheet = workbook.getSheet("åå
¸-车é´"); |
| | | List<ApsShop> shops = apsShopService.findAllShops(); |
| | | for (int i = 0; i < shops.size(); i++) { |
| | | Row row = sheet.createRow(i + 1); |
| | | ApsShop shop = shops.get(i); |
| | | row.createCell(0).setCellValue(sysDictDataList |
| | | .stream() |
| | | .filter(d -> d.getDictValue().equals(shop.getPlantCode())) |
| | | .map(SysDictData::getDictLabel) |
| | | .findFirst() |
| | | .orElse(null)); |
| | | row.createCell(1).setCellValue(shops.get(i).getShopCode()); |
| | | row.createCell(2).setCellValue(shops.get(i).getShopName()); |
| | | } |
| | | changed = true; |
| | | } |
| | | sheet = workbook.getSheet("åå
¸-ä¸ä¸"); |
| | | sysDictDataList = DictUtils.getDictCache("aps_domain"); |
| | | if (sysDictDataList != null) { |
| | | for (int i = 0; i < sysDictDataList.size(); i++) { |
| | | Row row = sheet.createRow(i + 1); |
| | | row.createCell(0).setCellValue(sysDictDataList.get(i).getDictValue()); |
| | | row.createCell(1).setCellValue(sysDictDataList.get(i).getDictLabel()); |
| | | } |
| | | |
| | | changed = true; |
| | | } |
| | | if (changed) { |
| | | ByteArrayOutputStream baos = new ByteArrayOutputStream(); |
| | | workbook.write(baos); |
| | | file = baos.toByteArray(); |
| | | } |
| | | workbook.close(); |
| | | ByteArrayResource resource = new ByteArrayResource(file); |
| | | return ResponseEntity.ok() |
| | | .header("Access-Control-Expose-Headers", HttpHeaders.CONTENT_DISPOSITION) |
| | | .header(HttpHeaders.CONTENT_DISPOSITION, |
| | | String.format("attachment;filename=%s", URLEncoder.encode("æ°ä½é¢æµæ°æ®æ¨¡æ¿.xlsx", StandardCharsets.UTF_8))) |
| | | .header(HttpHeaders.CONTENT_TYPE, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet") |
| | | .contentLength(file.length) |
| | | .body(resource); |
| | | } |
| | | } |
| | |
| | | @PostMapping("/setBomDataToRedis") |
| | | public void setBomDataToRedis() |
| | | { |
| | | apsBomHeaderService.setBomDataToRedis(""); |
| | | apsBomHeaderService.setBomDataToRedis("FORTUNA"); |
| | | //apsBomHeaderService.setBomDataToRedis("FORTUNE"); |
| | | } |
| | | |
| | | @PostMapping("/test") |
| | |
| | | { |
| | | apsBomHeaderService.setBomDataToRedis("FORTUNA"); |
| | | } |
| | | |
| | | @GetMapping("/getBomRdsCount/{orgCode}") |
| | | public Integer getBomRdsCount(String orgCode) |
| | | { |
| | | return apsBomHeaderService.getBomKeys(orgCode); |
| | | } |
| | | } |
| | |
| | | import com.aps.common.log.annotation.Log; |
| | | import com.aps.common.log.enums.BusinessType; |
| | | import com.aps.common.security.annotation.RequiresPermissions; |
| | | import com.aps.common.security.utils.DictUtils; |
| | | import com.aps.core.domain.ApsGasPipelineMo; |
| | | import com.aps.core.service.IApsGasPipelineMoService; |
| | | import com.aps.system.api.domain.SysDictData; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import lombok.SneakyThrows; |
| | | import org.apache.commons.io.IOUtils; |
| | | import org.apache.poi.ss.usermodel.Row; |
| | | import org.apache.poi.ss.usermodel.Sheet; |
| | | import org.apache.poi.ss.usermodel.Workbook; |
| | | import org.apache.poi.ss.usermodel.WorkbookFactory; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.core.io.ByteArrayResource; |
| | | import org.springframework.http.HttpHeaders; |
| | | import org.springframework.http.ResponseEntity; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import java.io.ByteArrayInputStream; |
| | | import java.io.ByteArrayOutputStream; |
| | | import java.net.URLEncoder; |
| | | import java.nio.charset.StandardCharsets; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | { |
| | | return toAjax(apsGasPipelineMoService.deleteApsGasPipelineMoByIds(ids)); |
| | | } |
| | | |
| | | /** |
| | | * ä¸è½½æ°ä½é¢æµæ°æ®å¯¼å
¥æ¨¡æ¿ |
| | | */ |
| | | @SneakyThrows |
| | | @Operation(summary = "ä¸è½½æ°ä½å·¥åæ°æ®å¯¼å
¥æ¨¡æ¿", description = "ä¸è½½æ°ä½å·¥åæ°æ®å¯¼å
¥æ¨¡æ¿") |
| | | // @RequiresPermissions("gasPipeline:mo:template") |
| | | // @Log(title = "ä¸è½½æ°ä½å·¥åæ°æ®å¯¼å
¥æ¨¡æ¿", businessType = BusinessType.EXPORT) |
| | | @GetMapping("/template") |
| | | public ResponseEntity<ByteArrayResource> exportTemplate() { |
| | | byte[] file = IOUtils.resourceToByteArray("/templates/æ°ä½å·¥åæ°æ®æ¨¡æ¿v1.0.xlsx"); |
| | | Workbook workbook = WorkbookFactory.create(new ByteArrayInputStream(file)); |
| | | Sheet sheet = workbook.getSheet("åå
¸-ç产åºå°"); |
| | | List<SysDictData> sysDictDataList = DictUtils.getDictCache("aps_factory"); |
| | | if (sysDictDataList != null) { |
| | | for (int i = 0; i < sysDictDataList.size(); i++) { |
| | | Row row = sheet.createRow(i + 1); |
| | | row.createCell(0).setCellValue(sysDictDataList.get(i).getDictValue()); |
| | | row.createCell(1).setCellValue(sysDictDataList.get(i).getDictLabel()); |
| | | } |
| | | ByteArrayOutputStream baos = new ByteArrayOutputStream(); |
| | | workbook.write(baos); |
| | | file = baos.toByteArray(); |
| | | } |
| | | workbook.close(); |
| | | ByteArrayResource resource = new ByteArrayResource(file); |
| | | return ResponseEntity.ok() |
| | | .header("Access-Control-Expose-Headers", HttpHeaders.CONTENT_DISPOSITION) |
| | | .header(HttpHeaders.CONTENT_DISPOSITION, |
| | | String.format("attachment;filename=%s", URLEncoder.encode("æ°ä½å·¥åæ°æ®æ¨¡æ¿.xlsx", StandardCharsets.UTF_8))) |
| | | .header(HttpHeaders.CONTENT_TYPE, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet") |
| | | .contentLength(file.length) |
| | | .body(resource); |
| | | } |
| | | } |
| | |
| | | import com.aps.common.log.annotation.Log; |
| | | import com.aps.common.log.enums.BusinessType; |
| | | import com.aps.common.security.annotation.RequiresPermissions; |
| | | import com.aps.common.security.utils.DictUtils; |
| | | import com.aps.core.domain.ApsGasPipelinePrediction; |
| | | import com.aps.core.service.IApsGasPipelinePredictionService; |
| | | import com.aps.system.api.domain.SysDictData; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import lombok.SneakyThrows; |
| | | import org.apache.commons.io.IOUtils; |
| | | import org.apache.poi.ss.usermodel.Row; |
| | | import org.apache.poi.ss.usermodel.Sheet; |
| | | import org.apache.poi.ss.usermodel.Workbook; |
| | | import org.apache.poi.ss.usermodel.WorkbookFactory; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.core.io.ByteArrayResource; |
| | | import org.springframework.http.HttpHeaders; |
| | | import org.springframework.http.ResponseEntity; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import java.io.ByteArrayInputStream; |
| | | import java.io.ByteArrayOutputStream; |
| | | import java.net.URLEncoder; |
| | | import java.nio.charset.StandardCharsets; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 管路æå·¥æ°ä½é¢æµæ°æ®Controller |
| | | * |
| | | * |
| | | * @author ruoyi |
| | | * @date 2025-05-19 |
| | | */ |
| | |
| | | @Tag(name = "管路æå·¥æ°ä½é¢æµæ°æ®", description = "管路æå·¥æ°ä½é¢æµæ°æ®æ¥å£") |
| | | @RestController |
| | | @RequestMapping("/gasPipelinePrediction") |
| | | public class ApsGasPipelinePredictionController extends BaseController |
| | | { |
| | | public class ApsGasPipelinePredictionController extends BaseController { |
| | | @Autowired |
| | | private IApsGasPipelinePredictionService apsGasPipelinePredictionService; |
| | | |
| | |
| | | @Operation(summary = "æ¥è¯¢ç®¡è·¯æå·¥æ°ä½é¢æµæ°æ®å表", description = "å页æ¥è¯¢") |
| | | @RequiresPermissions("gasPipeline:prediction:list") |
| | | @GetMapping("/list") |
| | | public TableDataInfo list(ApsGasPipelinePrediction apsGasPipelineMo) |
| | | { |
| | | public TableDataInfo list(ApsGasPipelinePrediction apsGasPipelineMo) { |
| | | startPage(); |
| | | List<ApsGasPipelinePrediction> list = apsGasPipelinePredictionService.selectApsGasPipelinePredictionList(apsGasPipelineMo); |
| | | return getDataTable(list); |
| | |
| | | public AjaxResult importData(MultipartFile file) throws Exception { |
| | | |
| | | apsGasPipelinePredictionService.batchInsertApsGasPipelinePrediction(file); |
| | | return toAjax(true); |
| | | return toAjax(true); |
| | | } |
| | | |
| | | /** |
| | | * ä¸è½½æ°ä½é¢æµæ°æ®å¯¼å
¥æ¨¡æ¿ |
| | | */ |
| | | @SneakyThrows |
| | | @Operation(summary = "ä¸è½½æ°ä½é¢æµæ°æ®å¯¼å
¥æ¨¡æ¿", description = "ä¸è½½æ°ä½é¢æµæ°æ®å¯¼å
¥æ¨¡æ¿") |
| | | // @RequiresPermissions("gasPipeline:prediction:template") |
| | | // @Log(title = "ä¸è½½æ°ä½é¢æµæ°æ®å¯¼å
¥æ¨¡æ¿", businessType = BusinessType.EXPORT) |
| | | @GetMapping("/template") |
| | | public ResponseEntity<ByteArrayResource> exportTemplate() { |
| | | byte[] file = IOUtils.resourceToByteArray("/templates/æ°ä½é¢æµæ°æ®æ¨¡æ¿v1.0.xlsx"); |
| | | Workbook workbook = WorkbookFactory.create(new ByteArrayInputStream(file)); |
| | | Sheet sheet = workbook.getSheet("åå
¸-ç产åºå°"); |
| | | List<SysDictData> sysDictDataList = DictUtils.getDictCache("aps_factory"); |
| | | if (sysDictDataList != null) { |
| | | for (int i = 0; i < sysDictDataList.size(); i++) { |
| | | Row row = sheet.createRow(i + 1); |
| | | row.createCell(0).setCellValue(sysDictDataList.get(i).getDictValue()); |
| | | row.createCell(1).setCellValue(sysDictDataList.get(i).getDictLabel()); |
| | | } |
| | | ByteArrayOutputStream baos = new ByteArrayOutputStream(); |
| | | workbook.write(baos); |
| | | file = baos.toByteArray(); |
| | | } |
| | | workbook.close(); |
| | | ByteArrayResource resource = new ByteArrayResource(file); |
| | | return ResponseEntity.ok() |
| | | .header("Access-Control-Expose-Headers", HttpHeaders.CONTENT_DISPOSITION) |
| | | .header(HttpHeaders.CONTENT_DISPOSITION, |
| | | String.format("attachment;filename=%s", URLEncoder.encode("æ°ä½é¢æµæ°æ®æ¨¡æ¿.xlsx", StandardCharsets.UTF_8))) |
| | | .header(HttpHeaders.CONTENT_TYPE, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet") |
| | | .contentLength(file.length) |
| | | .body(resource); |
| | | } |
| | | |
| | | /** |
| | | * 导åºç®¡è·¯æå·¥æ°ä½é¢æµæ°æ®å表 |
| | | */ |
| | |
| | | @RequiresPermissions("gasPipeline:prediction:export") |
| | | @Log(title = "管路æå·¥æ°ä½é¢æµæ°æ®", businessType = BusinessType.EXPORT) |
| | | @PostMapping("/export") |
| | | public void export(HttpServletResponse response, ApsGasPipelinePrediction apsGasPipelinePrediction) |
| | | { |
| | | public void export(HttpServletResponse response, ApsGasPipelinePrediction apsGasPipelinePrediction) { |
| | | List<ApsGasPipelinePrediction> list = apsGasPipelinePredictionService.selectApsGasPipelinePredictionList(apsGasPipelinePrediction); |
| | | ExcelUtil<ApsGasPipelinePrediction> util = new ExcelUtil<ApsGasPipelinePrediction>(ApsGasPipelinePrediction.class); |
| | | util.exportExcel(response, list, "管路æå·¥æ°ä½é¢æµæ°æ®æ°æ®"); |
| | |
| | | @Operation(summary = "è·å管路æå·¥æ°ä½é¢æµæ°æ®è¯¦ç»ä¿¡æ¯", description = "æ ¹æ®idè·å") |
| | | @RequiresPermissions("gasPipeline:prediction:query") |
| | | @GetMapping(value = "/{id}") |
| | | public AjaxResult getInfo(@PathVariable("id") Long id) |
| | | { |
| | | public AjaxResult getInfo(@PathVariable("id") Long id) { |
| | | return success(apsGasPipelinePredictionService.selectApsGasPipelinePredictionById(id)); |
| | | } |
| | | |
| | |
| | | @RequiresPermissions("gasPipeline:prediction:add") |
| | | @Log(title = "管路æå·¥æ°ä½é¢æµæ°æ®", businessType = BusinessType.INSERT) |
| | | @PostMapping |
| | | public AjaxResult add(@RequestBody ApsGasPipelinePrediction apsGasPipelinePrediction) |
| | | { |
| | | public AjaxResult add(@RequestBody ApsGasPipelinePrediction apsGasPipelinePrediction) { |
| | | return toAjax(apsGasPipelinePredictionService.insertApsGasPipelinePrediction(apsGasPipelinePrediction)); |
| | | } |
| | | |
| | |
| | | @RequiresPermissions("gasPipeline:prediction:edit") |
| | | @Log(title = "管路æå·¥æ°ä½é¢æµæ°æ®", businessType = BusinessType.UPDATE) |
| | | @PutMapping |
| | | public AjaxResult edit(@RequestBody ApsGasPipelinePrediction apsGasPipelinePrediction) |
| | | { |
| | | public AjaxResult edit(@RequestBody ApsGasPipelinePrediction apsGasPipelinePrediction) { |
| | | return toAjax(apsGasPipelinePredictionService.updateApsGasPipelinePrediction(apsGasPipelinePrediction)); |
| | | } |
| | | |
| | |
| | | @Operation(summary = "å é¤ç®¡è·¯æå·¥æ°ä½é¢æµæ°æ®", description = "æ¹éå é¤") |
| | | @RequiresPermissions("gasPipeline:prediction:remove") |
| | | @Log(title = "管路æå·¥æ°ä½é¢æµæ°æ®", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/{ids}") |
| | | public AjaxResult remove(@PathVariable Long[] ids) |
| | | { |
| | | @DeleteMapping("/{ids}") |
| | | public AjaxResult remove(@PathVariable Long[] ids) { |
| | | return toAjax(apsGasPipelinePredictionService.deleteApsGasPipelinePredictionByIds(ids)); |
| | | } |
| | | } |
| | |
| | | apsMaterialProductGroupManagementService.batchInsertApsMaterialProductGroupManagement(file); |
| | | return toAjax(true); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 导åºç©æäº§åç»æ°æ®ç®¡çå表 |
| | | */ |
| | |
| | | import com.aps.common.log.enums.BusinessType; |
| | | import com.aps.common.security.annotation.RequiresPermissions; |
| | | import com.aps.core.domain.ApsPlate.ApsPlateProcessShopStat; |
| | | import com.aps.core.service.ApsPlanTaskService; |
| | | import com.aps.core.service.ApsPlate.IApsPlateProcessShopStatService; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import jakarta.annotation.Resource; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | |
| | | { |
| | | @Autowired |
| | | private IApsPlateProcessShopStatService apsPlateProcessShopStatService; |
| | | |
| | | @Resource |
| | | ApsPlanTaskService apsPlanTaskService; |
| | | |
| | | /** |
| | | * 导åºé£é车é´ç»è®¡å表 |
| | |
| | | |
| | | @Operation(summary = "é£é计å大表", description = "æ´æ°ç»è®¡æ°æ®") |
| | | @Log(title = "é£é车é´ç»è®¡", businessType = BusinessType.UPDATE) |
| | | @RequiresPermissions("plateProcessShopStat:update") |
| | | //@RequiresPermissions("plateProcessShopStat:update") |
| | | @PostMapping("/update") |
| | | public AjaxResult update() |
| | | { |
| | | apsPlateProcessShopStatService.saveShopStat(); |
| | | return toAjax(true); |
| | | try { |
| | | |
| | | return apsPlanTaskService.generatorPlatePlanTable(); |
| | | } catch (Exception e) { |
| | | return AjaxResult.error("æ´æ°å¤±è´¥ï¼"+e.getMessage()); |
| | | } |
| | | |
| | | } |
| | | |
| | | /** |
| | |
| | | @PostMapping("/update") |
| | | public AjaxResult updateStat() |
| | | { |
| | | apsPlateProcessStatService.savePlateProcessStat(); |
| | | apsPlateProcessStatService.computePlateProcessStat(); |
| | | return toAjax(true); |
| | | } |
| | | /** |
| | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.io.IOException; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | /** |
| | | * 导åºçç¼ç»è®¡è¡¨V2å表 |
| | | */ |
| | | @RequiresPermissions("weldSeamStatistics:weldSeamStatisticsV2:export") |
| | | //@RequiresPermissions("weldSeamStatistics:weldSeamStatisticsV2:export") |
| | | @Log(title = "çç¼ç»è®¡è¡¨V2", businessType = BusinessType.EXPORT) |
| | | @PostMapping("/export") |
| | | public void export(HttpServletResponse response, ApsWeldSeamStatisticsV2 apsWeldSeamStatisticsV2) |
| | | { |
| | | List<ApsWeldSeamStatisticsV2> list = apsWeldSeamStatisticsV2Service.selectApsWeldSeamStatisticsV2List(apsWeldSeamStatisticsV2); |
| | | ExcelUtil<ApsWeldSeamStatisticsV2> util = new ExcelUtil<ApsWeldSeamStatisticsV2>(ApsWeldSeamStatisticsV2.class); |
| | | util.exportExcel(response, list, "çç¼ç»è®¡è¡¨V2æ°æ®"); |
| | | public void export(HttpServletResponse response, ApsWeldSeamStatisticsV2 apsWeldSeamStatisticsV2) throws IOException { |
| | | apsWeldSeamStatisticsV2Service.exportWeldSeamStatistics(response); |
| | | } |
| | | |
| | | /** |
| | |
| | | |
| | | import com.aps.common.core.annotation.Excel; |
| | | import com.aps.common.core.web.domain.BaseEntity; |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | import org.apache.commons.lang3.builder.ToStringBuilder; |
| | | import org.apache.commons.lang3.builder.ToStringStyle; |
| | | import org.springframework.data.annotation.Id; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | |
| | | * @author hjy |
| | | * @date 2025-04-24 |
| | | */ |
| | | @Data |
| | | @Schema(description = "æ°ä½ç®¡è·¯äº§è½è§åå®ä½ç±»") |
| | | public class ApsGasPipelineCapacityPlan extends BaseEntity |
| | | { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @Id |
| | | @TableId(type = IdType.AUTO) |
| | | /** 主é®id */ |
| | | @JsonFormat(shape = JsonFormat.Shape.STRING) |
| | | @Schema(description = "主é®id", type = "Long") |
| | | private Long id; |
| | | |
| | |
| | | @Schema(description = "æ¥äº§åºåä½", type = "String") |
| | | private String dayProduceUnit; |
| | | |
| | | |
| | | /** äººåæ°é */ |
| | | @Excel(name = "äººåæ°é") |
| | | @Schema(description = "äººåæ°é", type = "BigDecimal") |
| | |
| | | @Schema(description = "å·¥å代ç ", type = "String") |
| | | private String orgCode; |
| | | |
| | | |
| | | /** è½¦é´ */ |
| | | @Excel(name = "车é´") |
| | | @Schema(description = "车é´", type = "String") |
| | | private String workshop; |
| | | |
| | | public void setOrgCode(String orgCode) |
| | | { |
| | | this.orgCode = orgCode; |
| | |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.sql.Timestamp; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * 管路æå·¥æ°ä½å·¥åæ°æ®å¯¹è±¡ aps_gas_pipeline_mo |
| | |
| | | @Schema(description = "æå·") |
| | | private String materialCode; |
| | | |
| | | /** 计åå®å·¥æ¥æ */ |
| | | /** 计åå®å·¥æ¥ */ |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @Excel(name = "计åå®å·¥æ¥æ", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") |
| | | @Schema(description = "计åå®å·¥æ¥æ") |
| | | private Timestamp planEnd; |
| | | @Excel(name = "计åå®å·¥æ¥", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") |
| | | @Schema(description = "计åå®å·¥æ¥") |
| | | private Date planEnd; |
| | | |
| | | /** æ°é */ |
| | | @Excel(name = "æ°é") |
| | | @Schema(description = "æ°é") |
| | | private BigDecimal quantity; |
| | | |
| | | public void setId(Long id) |
| | | { |
| | | this.id = id; |
| | | } |
| | | |
| | | public Long getId() |
| | | { |
| | | return id; |
| | | } |
| | | |
| | | public void setMo(String mo) |
| | | { |
| | | this.mo = mo; |
| | | } |
| | | |
| | | public String getMo() |
| | | { |
| | | return mo; |
| | | } |
| | | |
| | | public void setFactory(String factory) |
| | | { |
| | | this.factory = factory; |
| | | } |
| | | |
| | | public String getFactory() |
| | | { |
| | | return factory; |
| | | } |
| | | |
| | | public void setMaterialCode(String materialCode) |
| | | { |
| | | this.materialCode = materialCode; |
| | | } |
| | | |
| | | public String getMaterialCode() |
| | | { |
| | | return materialCode; |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) |
| | | .append("id", getId()) |
| | | .append("mo", getMo()) |
| | | .append("factory", getFactory()) |
| | | .append("materialCode", getMaterialCode()) |
| | | .append("planEnd", getPlanEnd()) |
| | | .append("createBy", getCreateBy()) |
| | | .append("createTime", getCreateTime()) |
| | | .append("updateBy", getUpdateBy()) |
| | | .append("updateTime", getUpdateTime()) |
| | | .toString(); |
| | | } |
| | | } |
| | |
| | | import java.math.BigDecimal; |
| | | import java.sql.Timestamp; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @Excel(name = "颿µæ¥æ", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") |
| | | @Schema(description = "颿µæ¥æ") |
| | | private Timestamp predictDate; |
| | | private Date predictDate; |
| | | |
| | | /** æ°é */ |
| | | @Excel(name = "æ°é") |
| | |
| | | private BigDecimal processTotalTime; |
| | | |
| | | /** 计åå¼å·¥æ¥ */ |
| | | @Excel(name = "计åå¼å·¥æ¥", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @Excel(name = "计åå¼å·¥æ¥", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") |
| | | @Schema(description = "计åå¼å·¥æ¥", type = "Date") |
| | | private Date processPlanStartDay; |
| | | |
| | | /** è®¾è®¡å·¥æ¶ */ |
| | | @Excel(name = "设计工æ¶") |
| | | @Schema(description = "设计工æ¶", type = "Long") |
| | | private Long designTimes; |
| | | @Schema(description = "设计工æ¶", type = "BigDecimal") |
| | | private BigDecimal designTimes; |
| | | |
| | | /** å 餿 å¿ï¼0代表åå¨ 2代表å é¤ï¼ */ |
| | | @Schema(description = "å 餿 å¿ï¼0代表åå¨ 2代表å é¤ï¼", type = "String") |
| | | @Schema(description = "å 餿 å¿", type = "String") |
| | | private String delFlag; |
| | | |
| | | /** å·¥åºåç§° */ |
| | |
| | | @Schema(description = "设计产è½", type = "BigDecimal") |
| | | private BigDecimal designCapacity; |
| | | |
| | | /** è®¾è®¡äº§è½ */ |
| | | /** ä¸ä¸ */ |
| | | @Excel(name = "ä¸ä¸") |
| | | @Schema(description = "ä¸ä¸", type = "String") |
| | | private String major; |
| | |
| | | @Schema(description = "æ¥", type = "String") |
| | | private String planStartDay; |
| | | |
| | | /** 计åå®ææ¥ */ |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @Excel(name = "计å宿æ¥", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") |
| | | @Schema(description = "计å宿æ¥", type = "Date") |
| | | private Date processPlanEndDay; |
| | | |
| | | /** 订å计åå®ææ¥ */ |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @Excel(name = "订å计å宿æ¥", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") |
| | | @Schema(description = "订å计å宿æ¥", type = "Date") |
| | | private Date orderPlanEndDay; |
| | | |
| | | /** è¦å */ |
| | | @Excel(name = "è¦å") |
| | | @Schema(description = "è¦å", type = "Boolean") |
| | | private Boolean warning; |
| | | |
| | | /** å·¥å */ |
| | | @Excel(name = "å·¥å") |
| | | @Schema(description = "å·¥å", type = "String") |
| | | private String plant; |
| | | |
| | | /** è½¦é´ */ |
| | | @Excel(name = "车é´") |
| | | @Schema(description = "车é´", type = "String") |
| | | private String workshop; |
| | | |
| | | /** æ¹æ¬¡å· */ |
| | | @Excel(name = "æ¹æ¬¡å·") |
| | | @Schema(description = "æ¹æ¬¡å·", type = "String") |
| | | private String batchNumber; |
| | | |
| | | /** å·¥å */ |
| | | private String plant; |
| | | |
| | | |
| | | @Transient |
| | | private String searchStartDate; |
| | | |
| | |
| | | @Transient |
| | | private String searchType; |
| | | |
| | | private Boolean warning; |
| | | private Integer num; |
| | | private BigDecimal routeProcessNumber; |
| | | private Date orderPlanEndDay; |
| | | /** 计åå®ææ¥ */ |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @Excel(name = "计åå®å·¥æ¥", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") |
| | | private Date processPlanEndDay; |
| | | |
| | | @Override |
| | | public String toString() { |
| | |
| | | package com.aps.core.domain; |
| | | |
| | | import com.aps.common.core.annotation.Excel; |
| | | import com.aps.common.core.web.domain.BaseEntity; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.fasterxml.jackson.annotation.JsonIgnore; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | import org.apache.commons.lang3.builder.ToStringBuilder; |
| | | import org.apache.commons.lang3.builder.ToStringStyle; |
| | | import com.aps.common.core.annotation.Excel; |
| | | import org.springframework.data.annotation.Id; |
| | | |
| | | /** |
| | |
| | | /** |
| | | * éç¨å·¥å åè aps_factory |
| | | */ |
| | | @Excel(name = "éç¨å·¥å åè aps_factory") |
| | | @Excel(name = "éç¨å·¥å") |
| | | @Schema(description = "éç¨å·¥å åè aps_factory") |
| | | private String factory; |
| | | |
| | |
| | | /** |
| | | * ä¸ä¸ åè aps_domain |
| | | */ |
| | | @Excel(name = "ä¸ä¸ åè aps_domain") |
| | | @Excel(name = "ä¸ä¸å½å±") |
| | | @Schema(description = "ä¸ä¸ åè aps_domain") |
| | | private String domain; |
| | | |
| | | /** |
| | | * æ¯å¦ä¸ºä¸»é¶ æ¯/å¦ |
| | | */ |
| | | @Excel(name = "æ¯å¦ä¸ºä¸»é¶ æ¯/å¦") |
| | | @Excel(name = "æ¯å¦ä¸»é¶æå·") |
| | | @Schema(description = "æ¯å¦ä¸ºä¸»é¶ æ¯/å¦") |
| | | private String isMain; |
| | | |
| | | @JsonIgnore |
| | | @TableField(exist = false) |
| | | private String key; |
| | | /** |
| | | * æå·ç±»å« å¶é ä»¶/éè´ä»¶ |
| | | */ |
| | | @Excel(name = "æå·ç±»å«") |
| | | @Schema(description = "æå·ç±»å« å¶é ä»¶/éè´ä»¶") |
| | | private String materialType; |
| | | |
| | | @JsonIgnore |
| | | public String getKey() { |
| | |
| | | key = getFactory() + "##" + getMaterialCode(); |
| | | } |
| | | return key; |
| | | } |
| | | |
| | | /** |
| | | * æå·ç±»å« å¶é ä»¶/éè´ä»¶ |
| | | */ |
| | | @Excel(name = "æå·ç±»å« å¶é ä»¶/éè´ä»¶") |
| | | @Schema(description = "æå·ç±»å« å¶é ä»¶/éè´ä»¶") |
| | | private String materialType; |
| | | |
| | | public void setId(Long id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public Long getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setFactory(String factory) { |
| | | this.factory = factory; |
| | | } |
| | | |
| | | public String getFactory() { |
| | | return factory; |
| | | } |
| | | |
| | | public void setMaterialCode(String materialCode) { |
| | | this.materialCode = materialCode; |
| | | } |
| | | |
| | | public String getMaterialCode() { |
| | | return materialCode; |
| | | } |
| | | |
| | | public void setDomain(String domain) { |
| | | this.domain = domain; |
| | | } |
| | | |
| | | public String getDomain() { |
| | | return domain; |
| | | } |
| | | |
| | | public void setIsMain(String isMain) { |
| | | this.isMain = isMain; |
| | | } |
| | | |
| | | public String getIsMain() { |
| | | return isMain; |
| | | } |
| | | |
| | | public void setMaterialType(String materialType) { |
| | | this.materialType = materialType; |
| | | } |
| | | |
| | | public String getMaterialType() { |
| | | return materialType; |
| | | } |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE) |
| | | .append("id", getId()) |
| | | .append("factory", getFactory()) |
| | | .append("materialCode", getMaterialCode()) |
| | | .append("domain", getDomain()) |
| | | .append("createBy", getCreateBy()) |
| | | .append("createTime", getCreateTime()) |
| | | .append("updateBy", getUpdateBy()) |
| | | .append("updateTime", getUpdateTime()) |
| | | .append("isMain", getIsMain()) |
| | | .append("materialType", getMaterialType()) |
| | | .toString(); |
| | | } |
| | | } |
| | |
| | | |
| | | import com.aps.common.core.annotation.Excel; |
| | | import com.aps.common.core.web.domain.BaseEntity; |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import org.apache.commons.lang3.builder.ToStringBuilder; |
| | | import org.apache.commons.lang3.builder.ToStringStyle; |
| | | import org.springframework.data.annotation.Id; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | /** |
| | | * æ åå·¥åºå¯¹è±¡ aps_standard_process |
| | | * |
| | | * |
| | | * @author hjy |
| | | * @date 2025-04-23 |
| | | */ |
| | | |
| | | @Schema(description = "æ åå·¥åºå®ä½") |
| | | public class ApsStandardProcess extends BaseEntity |
| | | { |
| | | public class ApsStandardProcess extends BaseEntity { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @Id |
| | | @TableId(type = IdType.AUTO) |
| | | /** 主é®id */ |
| | | @JsonFormat(shape = JsonFormat.Shape.STRING) |
| | | /** 主é®id */ |
| | | @Schema(description = "主é®id", type = "Long") |
| | | private Long id; |
| | | |
| | | /** å·¥åºç¼ç */ |
| | | /** |
| | | * å·¥åºç¼ç |
| | | */ |
| | | @Schema(description = "å·¥åºç¼ç ", type = "String") |
| | | @Excel(name = "å·¥åºç¼ç ") |
| | | private String processNumber; |
| | | |
| | | /** å·¥åºåç§° */ |
| | | /** |
| | | * å·¥åºåç§° |
| | | */ |
| | | @Schema(description = "å·¥åºåç§°", type = "String") |
| | | @Excel(name = "å·¥åºåç§°") |
| | | private String processName; |
| | | |
| | | /** èµæºç» */ |
| | | /** |
| | | * èµæºç» |
| | | */ |
| | | @Schema(description = "èµæºç»", type = "String") |
| | | @Excel(name = "èµæºç»") |
| | | private String resourceGroupName; |
| | | /** ä¸ä¸ */ |
| | | /** |
| | | * ä¸ä¸ |
| | | */ |
| | | @Schema(description = "ä¸ä¸", type = "String") |
| | | @Excel(name = "ä¸ä¸") |
| | | private String major; |
| | | |
| | | /** äº§è½æ¨¡å: ç¬å /åæ¹ */ |
| | | /** |
| | | * äº§è½æ¨¡å: ç¬å /åæ¹ |
| | | */ |
| | | @Schema(description = "äº§è½æ¨¡å", type = "String") |
| | | @Excel(name = "äº§è½æ¨¡å") |
| | | private String model; |
| | | |
| | | /** è®¾è®¡äº§è½ */ |
| | | /** |
| | | * è®¾è®¡äº§è½ |
| | | */ |
| | | @Schema(description = "设计产è½", type = "String") |
| | | @Excel(name = "设计产è½") |
| | | private BigDecimal designCapacity; |
| | | |
| | | /** å·¥åId */ |
| | | /** |
| | | * å·¥åId |
| | | */ |
| | | @Schema(description = "å·¥åId", type = "String") |
| | | // @Excel(name = "å·¥åId") |
| | | private String plantId; |
| | | |
| | | /** å·¥å */ |
| | | /** |
| | | * å·¥å |
| | | */ |
| | | @Schema(description = "éç¨å·¥å", type = "String") |
| | | @Excel(name = "éç¨å·¥å") |
| | | private String plant; |
| | | |
| | | /** 车é´Id */ |
| | | /** |
| | | * 车é´Id |
| | | */ |
| | | @Schema(description = "车é´Id", type = "String") |
| | | // @Excel(name = "车é´Id") |
| | | private String workShopId; |
| | | |
| | | /** è½¦é´ */ |
| | | /** |
| | | * è½¦é´ |
| | | */ |
| | | @Schema(description = "éç¨è½¦é´", type = "String") |
| | | @Excel(name = "éç¨è½¦é´") |
| | | private String workShop; |
| | | |
| | | /** æ¥åId */ |
| | | /** |
| | | * æ¥åId |
| | | */ |
| | | @Schema(description = "æ¥åId", type = "Long") |
| | | // @Excel(name = "æ¥åId") |
| | | private Long workCalenderId; |
| | | |
| | | /** æ¥åæè¿° */ |
| | | /** |
| | | * æ¥åæè¿° |
| | | */ |
| | | @Schema(description = "æ¥åæè¿°", type = "String") |
| | | @Excel(name = "æ¥åæè¿°") |
| | | private String workCalender; |
| | | |
| | | /** äº§è½æ¨¡åId */ |
| | | /** |
| | | * äº§è½æ¨¡åId |
| | | */ |
| | | @Schema(description = "äº§è½æ¨¡åId", type = "Long") |
| | | // @Excel(name = "äº§è½æ¨¡åId") |
| | | private Long modelId; |
| | | |
| | | |
| | | /** å 餿 å¿ï¼0代表åå¨ 2代表å é¤ï¼ */ |
| | | /** |
| | | * å 餿 å¿ï¼0代表åå¨ 2代表å é¤ï¼ |
| | | */ |
| | | @Schema(description = "å 餿 å¿ï¼0代表åå¨ 2代表å é¤ï¼", type = "String") |
| | | private String delFlag; |
| | | |
| | | |
| | | |
| | | public String getMajor() { |
| | |
| | | this.major = major; |
| | | } |
| | | |
| | | public void setId(Long id) |
| | | { |
| | | public void setId(Long id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public Long getId() |
| | | { |
| | | public Long getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setProcessNumber(String processNumber) |
| | | { |
| | | public void setProcessNumber(String processNumber) { |
| | | this.processNumber = processNumber; |
| | | } |
| | | |
| | | public String getProcessNumber() |
| | | { |
| | | public String getProcessNumber() { |
| | | return processNumber; |
| | | } |
| | | |
| | | public void setProcessName(String processName) |
| | | { |
| | | public void setProcessName(String processName) { |
| | | this.processName = processName; |
| | | } |
| | | |
| | | public String getProcessName() |
| | | { |
| | | public String getProcessName() { |
| | | return processName; |
| | | } |
| | | |
| | | public void setResourceGroupName(String resourceGroupName) |
| | | { |
| | | public void setResourceGroupName(String resourceGroupName) { |
| | | this.resourceGroupName = resourceGroupName; |
| | | } |
| | | |
| | | public String getResourceGroupName() |
| | | { |
| | | public String getResourceGroupName() { |
| | | return resourceGroupName; |
| | | } |
| | | |
| | | public void setModel(String model) |
| | | { |
| | | public void setModel(String model) { |
| | | this.model = model; |
| | | } |
| | | |
| | | public String getModel() |
| | | { |
| | | public String getModel() { |
| | | return model; |
| | | } |
| | | |
| | | public void setDesignCapacity(BigDecimal designCapacity) |
| | | { |
| | | public void setDesignCapacity(BigDecimal designCapacity) { |
| | | this.designCapacity = designCapacity; |
| | | } |
| | | |
| | | public BigDecimal getDesignCapacity() |
| | | { |
| | | public BigDecimal getDesignCapacity() { |
| | | return designCapacity; |
| | | } |
| | | |
| | | public void setPlantId(String plantId) |
| | | { |
| | | public void setPlantId(String plantId) { |
| | | this.plantId = plantId; |
| | | } |
| | | |
| | | public String getPlantId() |
| | | { |
| | | public String getPlantId() { |
| | | return plantId; |
| | | } |
| | | |
| | | public void setPlant(String plant) |
| | | { |
| | | public void setPlant(String plant) { |
| | | this.plant = plant; |
| | | } |
| | | |
| | | public String getPlant() |
| | | { |
| | | public String getPlant() { |
| | | return plant; |
| | | } |
| | | |
| | | public void setWorkShopId(String workShopId) |
| | | { |
| | | public void setWorkShopId(String workShopId) { |
| | | this.workShopId = workShopId; |
| | | } |
| | | |
| | | public String getWorkShopId() |
| | | { |
| | | public String getWorkShopId() { |
| | | return workShopId; |
| | | } |
| | | |
| | | public void setWorkShop(String workShop) |
| | | { |
| | | public void setWorkShop(String workShop) { |
| | | this.workShop = workShop; |
| | | } |
| | | |
| | | public String getWorkShop() |
| | | { |
| | | public String getWorkShop() { |
| | | return workShop; |
| | | } |
| | | |
| | | public void setWorkCalenderId(Long workCalenderId) |
| | | { |
| | | public void setWorkCalenderId(Long workCalenderId) { |
| | | this.workCalenderId = workCalenderId; |
| | | } |
| | | |
| | | public Long getWorkCalenderId() |
| | | { |
| | | public Long getWorkCalenderId() { |
| | | return workCalenderId; |
| | | } |
| | | |
| | | public void setDelFlag(String delFlag) |
| | | { |
| | | public void setDelFlag(String delFlag) { |
| | | this.delFlag = delFlag; |
| | | } |
| | | |
| | | public String getDelFlag() |
| | | { |
| | | public String getDelFlag() { |
| | | return delFlag; |
| | | } |
| | | |
| | | public void setModelId(Long modelId) |
| | | { |
| | | public void setModelId(Long modelId) { |
| | | this.modelId = modelId; |
| | | } |
| | | |
| | | public Long getModelId() |
| | | { |
| | | public Long getModelId() { |
| | | return modelId; |
| | | } |
| | | |
| | | public void setWorkCalender(String workCalender) |
| | | { |
| | | public void setWorkCalender(String workCalender) { |
| | | this.workCalender = workCalender; |
| | | } |
| | | |
| | | public String getWorkCalender() |
| | | { |
| | | public String getWorkCalender() { |
| | | return workCalender; |
| | | } |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) |
| | | .append("id", getId()) |
| | | .append("processNumber", getProcessNumber()) |
| | | .append("processName", getProcessName()) |
| | | .append("resourceGroupName", getResourceGroupName()) |
| | | .append("model", getModel()) |
| | | .append("designCapacity", getDesignCapacity()) |
| | | .append("plantId", getPlantId()) |
| | | .append("plant", getPlant()) |
| | | .append("workShopId", getWorkShopId()) |
| | | .append("workShop", getWorkShop()) |
| | | .append("workCalenderId", getWorkCalenderId()) |
| | | .append("delFlag", getDelFlag()) |
| | | .append("createBy", getCreateBy()) |
| | | .append("createTime", getCreateTime()) |
| | | .append("updateBy", getUpdateBy()) |
| | | .append("updateTime", getUpdateTime()) |
| | | .append("modelId", getModelId()) |
| | | .append("workCalender", getWorkCalender()) |
| | | .append("major", getMajor()) |
| | | .toString(); |
| | | return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE) |
| | | .append("id", getId()) |
| | | .append("processNumber", getProcessNumber()) |
| | | .append("processName", getProcessName()) |
| | | .append("resourceGroupName", getResourceGroupName()) |
| | | .append("model", getModel()) |
| | | .append("designCapacity", getDesignCapacity()) |
| | | .append("plantId", getPlantId()) |
| | | .append("plant", getPlant()) |
| | | .append("workShopId", getWorkShopId()) |
| | | .append("workShop", getWorkShop()) |
| | | .append("workCalenderId", getWorkCalenderId()) |
| | | .append("delFlag", getDelFlag()) |
| | | .append("createBy", getCreateBy()) |
| | | .append("createTime", getCreateTime()) |
| | | .append("updateBy", getUpdateBy()) |
| | | .append("updateTime", getUpdateTime()) |
| | | .append("modelId", getModelId()) |
| | | .append("workCalender", getWorkCalender()) |
| | | .append("major", getMajor()) |
| | | .toString(); |
| | | } |
| | | } |
| | |
| | | |
| | | public enum PLAN_TASK_STATUS { |
| | | IN_PROCESS("InProgress","è¿è¡ä¸"), |
| | | FINISHED("Finished","宿"); |
| | | |
| | | FINISHED("Finished","宿"), |
| | | ERROR("Error","失败"); |
| | | private String code; |
| | | private String desc; |
| | | |
| | |
| | | |
| | | public enum PLAN_TASK_TYPE { |
| | | |
| | | PLATE_PLAN("PlateOrderPlan","çæé£éå·¥å计å"); |
| | | |
| | | PLATE_PLAN("PlateOrderPlan","çæé£éå·¥å计å"), |
| | | PLATE_SHOP_PLAN_TABLE("PlateShopPlanTable","çæé£é计å大表"); |
| | | private String code; |
| | | private String desc; |
| | | |
| | |
| | | public enum REDIS_LOCK_KEY { |
| | | |
| | | /*é£éå·¥å计åä»»å¡*/ |
| | | PLATE_ORDER_PLAN("PLAN_TASK:PLATE_ORDER_PLAN"); |
| | | |
| | | PLATE_ORDER_PLAN("PLAN_TASK:PLATE_ORDER_PLAN"), |
| | | /*é£é计å大表*/ |
| | | PLATE_SHOP_PLAN_TABLE("PLAN_TASK:PLATE_SHOP_PLAN_TABLE"); |
| | | private String key; |
| | | |
| | | public String getKey() { |
| | |
| | | package com.aps.core.mapper; |
| | | |
| | | import com.aps.core.domain.ApsGasPipelineCapacityPlan; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | |
| | | * @date 2025-04-24 |
| | | */ |
| | | @Mapper |
| | | public interface ApsGasPipelineCapacityPlanMapper |
| | | public interface ApsGasPipelineCapacityPlanMapper extends BaseMapper<ApsGasPipelineCapacityPlan> |
| | | { |
| | | /** |
| | | * æ¥è¯¢æ°ä½ç®¡è·¯äº§è½è§å |
| | |
| | | * @return æ°ä½ç®¡è·¯äº§è½è§åéå |
| | | */ |
| | | public List<ApsGasPipelineCapacityPlan> selectApsGasPipelineCapacityPlanList(ApsGasPipelineCapacityPlan apsGasPipelineCapacityPlan); |
| | | |
| | | /** |
| | | * æ¥è¯¢è®¾è®¡äº§è½æ°æ® - ä¸ç¨äºæ¥å£äºåè½ |
| | | * |
| | | * @param processName å·¥åºåç§° |
| | | * @param year 年份 |
| | | * @param month æä»½ |
| | | * @param major ä¸ä¸ |
| | | * @param orgCode å·¥å代ç |
| | | * @return æ°ä½ç®¡è·¯äº§è½è§åéå |
| | | */ |
| | | public List<ApsGasPipelineCapacityPlan> selectDesignCapacityForInterface2( |
| | | @Param("processName") String processName, |
| | | @Param("year") String year, |
| | | @Param("month") String month, |
| | | @Param("major") String major, |
| | | @Param("orgCode") String orgCode); |
| | | |
| | | /** |
| | | * æ°å¢æ°ä½ç®¡è·¯äº§è½è§å |
| | |
| | | * @return ç»æ |
| | | */ |
| | | public int deleteApsGasPipelineCapacityPlanByIds(Long[] ids); |
| | | |
| | | void deleteByDateAndFactory(String year, String month, String factory, String major); |
| | | } |
| | |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * æ°ä½ç®¡è·¯äº§è½è´è½½ç»è®¡Mapperæ¥å£ |
| | |
| | | */ |
| | | public int deleteApsGasPipingRouteStatByBatchNum(String batchNumber); |
| | | |
| | | |
| | | /** |
| | | * æ¹éæå
¥ç®¡è·¯æ°æäº§è½æ°æ® |
| | | * @param apsGasPipingRouteStatList |
| | |
| | | public int insertApsGasPipingRouteStatBatch(List<ApsGasPipingRouteStat> apsGasPipingRouteStatList); |
| | | |
| | | List<ApsGasPipingRouteStat> queryTempStat(); |
| | | |
| | | /** |
| | | * å é¤æææ°ä½ç®¡è·¯äº§è½è´è½½ç»è®¡æ°æ® |
| | | * |
| | | * @return ç»æ |
| | | */ |
| | | public int deleteAll(); |
| | | |
| | | /** |
| | | * èåæ¥è¯¢æå·¥æ°ä½é¢æµæ°æ®ç¸å
³ä¿¡æ¯ |
| | | * |
| | | * @return æå·¥æ°ä½é¢æµæ°æ®åå
³èä¿¡æ¯ |
| | | */ |
| | | public List<Map<String, Object>> selectPredictionRouteData(); |
| | | |
| | | /** |
| | | * èåæ¥è¯¢æå·¥æ°ä½å·¥åæ°æ®ç¸å
³ä¿¡æ¯ |
| | | * |
| | | * @return æå·¥æ°ä½å·¥åæ°æ®åå
³èä¿¡æ¯ |
| | | */ |
| | | public List<Map<String, Object>> selectMoRouteData(); |
| | | |
| | | /** |
| | | * æ ¹æ®æ¶é´ç»´åº¦èåæ¥è¯¢ç»è®¡æ°æ® |
| | | * |
| | | * @param params æ¥è¯¢åæ°ï¼å
嫿¶é´èå´åè¿æ»¤æ¡ä»¶ |
| | | * @return æå·¥åºåç§°åæ¶é´ç»´åº¦èåçæ°æ® |
| | | */ |
| | | public List<Map<String, Object>> selectAggregatedStatData(Map<String, Object> params); |
| | | |
| | | /** |
| | | * æ¥è¯¢åå§ç»è®¡æ°æ®ï¼ä¸è¿è¡èåï¼ |
| | | * |
| | | * @param params æ¥è¯¢åæ° |
| | | * @return åå§ç»è®¡æ°æ®å表 |
| | | */ |
| | | public List<Map<String, Object>> selectRawStatData(Map<String, Object> params); |
| | | |
| | | /** |
| | | * æ¥è¯¢æææå·¥æ°ä½å·¥åæ°æ® |
| | | * |
| | | * @return æææå·¥æ°ä½å·¥åæ°æ® |
| | | */ |
| | | public List<Map<String, Object>> selectAllMoData(); |
| | | |
| | | /** |
| | | * æ¥è¯¢åºç¡ç»è®¡æ°æ®ï¼ä¸å
嫿¶é´éå¶ï¼ |
| | | * |
| | | * @param params æ¥è¯¢åæ°ï¼ä¸å
嫿¶é´èå´åæ°ï¼ |
| | | * @return åºç¡ç»è®¡æ°æ®å表 |
| | | */ |
| | | public List<Map<String, Object>> selectBaseStatData(Map<String, Object> params); |
| | | |
| | | /** |
| | | * æ¥è¯¢ææå»éçå·¥åºåç§° |
| | | * |
| | | * @return ææå»éçå·¥åºåç§°å表 |
| | | */ |
| | | public List<String> selectDistinctProcessNames(); |
| | | |
| | | /** |
| | | * æ¥è¯¢ææå»éçè½¦é´ |
| | | * |
| | | * @return ææå»éç车é´å表 |
| | | */ |
| | | public List<String> selectDistinctWorkshops(); |
| | | } |
| | |
| | | * æ¹éæå
¥æ°æ® |
| | | * */ |
| | | int batchInsertPlateStat(List<ApsPlateProcessStat> list); |
| | | |
| | | int deleteAll(); |
| | | } |
| | |
| | | */ |
| | | public int deleteApsPlateStandardRequireErrorByIds(Long[] ids); |
| | | |
| | | /** |
| | | * æ¹éæå
¥é£éæ åéæ±å¼å¸¸ä¿¡æ¯ |
| | | * |
| | | * @param errorList éè¦æå
¥çå¼å¸¸æ°æ®éå |
| | | * @return ç»æ |
| | | */ |
| | | public int batchInsert(List<ApsPlateStandardRequireError> errorList); |
| | | |
| | | int deleteLastPatch(String batchNumber); |
| | | } |
| | |
| | | package com.aps.core.mapper; |
| | | |
| | | import java.util.List; |
| | | import java.util.Set; |
| | | |
| | | import com.aps.core.domain.ApsShop; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Select; |
| | | import org.jetbrains.annotations.NotNull; |
| | | |
| | | /** |
| | | * 车é´Mapperæ¥å£ |
| | |
| | | * @date 2025-04-14 |
| | | */ |
| | | @Mapper |
| | | public interface ApsShopMapper |
| | | public interface ApsShopMapper extends BaseMapper<ApsShop> |
| | | { |
| | | /** |
| | | * æ¥è¯¢è½¦é´ |
| | |
| | | * @return ç»æ |
| | | */ |
| | | public int deleteApsShopByIds(String[] ids); |
| | | |
| | | |
| | | @Select(""" |
| | | <script> |
| | | select * from aps_shop where 1 = 0 |
| | | <if test="!names.isEmpty()"> or shop_name in |
| | | <foreach collection="names" item="item" open="(" separator="," close=")"> |
| | | #{item} |
| | | </foreach> |
| | | </if> |
| | | </script> |
| | | """) |
| | | List<ApsShop> selectApsByName(@NotNull Set<String> names); |
| | | |
| | | @Select("select * from aps_shop where plant_code = #{orgCode}") |
| | | List<ApsShop> selectApsByFactory(String orgCode); |
| | | |
| | | @Select(""" |
| | | <script> |
| | | select * from aps_shop where 1 = 0 |
| | | <if test="!codes.isEmpty()"> or shop_code in |
| | | <foreach collection="codes" item="item" open="(" separator="," close=")"> |
| | | #{item} |
| | | </foreach> |
| | | </if> |
| | | </script> |
| | | """) |
| | | List<ApsShop> selectByCodes(Set<String> codes); |
| | | } |
| | |
| | | package com.aps.core.mapper; |
| | | |
| | | import com.aps.core.domain.ApsStandardProcess; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | |
| | | import java.util.List; |
| | | |
| | |
| | | * @author hjy |
| | | * @date 2025-04-23 |
| | | */ |
| | | public interface ApsStandardProcessMapper |
| | | public interface ApsStandardProcessMapper extends BaseMapper<ApsStandardProcess> |
| | | { |
| | | /** |
| | | * æ¥è¯¢æ åå·¥åº |
| | |
| | | void updateTaskStatus(String batchNum, PLAN_TASK_STATUS status); |
| | | |
| | | AjaxResult generatorPlan(); |
| | | |
| | | AjaxResult generatorPlatePlanTable(); |
| | | } |
| | |
| | | */ |
| | | public int deleteApsPlateProcessStatById(String id); |
| | | |
| | | @Transactional |
| | | void savePlateProcessStat(); |
| | | |
| | | List<ApsPlateProcessStat> computePlateProcessStat(); |
| | | } |
| | |
| | | String getNewBatchNumber(); |
| | | |
| | | @Transactional |
| | | void initRequireBatch(); |
| | | void initRequireBatch(String batchNumber); |
| | | } |
| | |
| | | package com.aps.core.service.ApsPlate; |
| | | |
| | | import java.util.List; |
| | | |
| | | import com.aps.core.domain.ApsPlate.ApsPlateStandardRequire; |
| | | import com.aps.core.domain.ApsPlate.ApsPlateStandardRequireError; |
| | | |
| | | /** |
| | |
| | | * @return ç»æ |
| | | */ |
| | | public int deleteApsPlateStandardRequireErrorById(Long id); |
| | | |
| | | void saveRequireError(ApsPlateStandardRequire require, String message); |
| | | } |
| | |
| | | * @return |
| | | */ |
| | | public boolean setBomDataToRedis(String orgCode); |
| | | |
| | | Integer getBomKeys(String orgCode); |
| | | } |
| | |
| | | * @return ç»æ |
| | | */ |
| | | public int deleteApsGasPipelineCapacityPlanById(Long id); |
| | | |
| | | void copyPlan(String date, String factory, String major, String toStart, String toEnd); |
| | | } |
| | |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * æ°ä½ç®¡è·¯äº§è½è´è½½ç»è®¡Serviceæ¥å£ |
| | |
| | | |
| | | @Transactional |
| | | void saveGasPipingRoutStateList(); |
| | | |
| | | /** |
| | | * æ ¹æ®æå·¥æ°ä½é¢æµæ°æ®åæå·¥æ°ä½å·¥åæ°æ®çæç»è®¡æ°æ® |
| | | * |
| | | * @return ç»æ |
| | | */ |
| | | @Transactional |
| | | public int generateGasPipingRouteStatData(); |
| | | |
| | | /** |
| | | * èåæ°ä½ç®¡è·¯äº§è½è´è½½ç»è®¡æ°æ® |
| | | * |
| | | * @param params èååæ° |
| | | * @return èåç»æ |
| | | */ |
| | | public Map<String, Object> aggregateGasPipingRouteStat(Map<String, Object> params); |
| | | } |
| | |
| | | package com.aps.core.service; |
| | | |
| | | import java.util.List; |
| | | import java.util.Set; |
| | | |
| | | import com.aps.core.domain.ApsShop; |
| | | import org.jetbrains.annotations.NotNull; |
| | | |
| | | /** |
| | | * 车é´Serviceæ¥å£ |
| | |
| | | * @return ç»æ |
| | | */ |
| | | public int deleteApsShopById(String id); |
| | | |
| | | List<ApsShop> findAllShops(); |
| | | |
| | | List<ApsShop> findShopByFactory(String orgCode); |
| | | |
| | | List<ApsShop> findShopByCodes(@NotNull Set<String> collect); |
| | | } |
| | |
| | | } |
| | | return true; |
| | | } |
| | | @Override |
| | | public Integer getBomKeys(String orgCode){ |
| | | return redisTemplate.keys("BOM:BOM_"+orgCode+"*").size(); |
| | | } |
| | | } |
| | |
| | | bomLineList.add(apsBom); |
| | | } |
| | | } |
| | | // else { |
| | | // bomLineList = selectApsBomLineList(plant, itemNumber); |
| | | // } |
| | | |
| | | return bomLineList; |
| | | } |
| | | } |
| | |
| | | import com.aps.core.domain.ApsGasPipelineCapacityPlan; |
| | | import com.aps.core.mapper.ApsGasPipelineCapacityPlanMapper; |
| | | import com.aps.core.service.IApsGasPipelineCapacityPlanService; |
| | | import lombok.SneakyThrows; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.sql.Timestamp; |
| | | import java.text.SimpleDateFormat; |
| | | import java.time.LocalDateTime; |
| | | import java.util.Calendar; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * æ°ä½ç®¡è·¯äº§è½è§åServiceä¸å¡å±å¤ç |
| | | * |
| | | * |
| | | * @author hjy |
| | | * @date 2025-04-24 |
| | | */ |
| | | @Service |
| | | public class ApsGasPipelineCapacityPlanServiceImpl implements IApsGasPipelineCapacityPlanService |
| | | { |
| | | public class ApsGasPipelineCapacityPlanServiceImpl implements IApsGasPipelineCapacityPlanService { |
| | | @Autowired |
| | | private ApsGasPipelineCapacityPlanMapper apsGasPipelineCapacityPlanMapper; |
| | | |
| | | /** |
| | | * æ¥è¯¢æ°ä½ç®¡è·¯äº§è½è§å |
| | | * |
| | | * |
| | | * @param id æ°ä½ç®¡è·¯äº§è½è§åä¸»é® |
| | | * @return æ°ä½ç®¡è·¯äº§è½è§å |
| | | */ |
| | | @Override |
| | | public ApsGasPipelineCapacityPlan selectApsGasPipelineCapacityPlanById(Long id) |
| | | { |
| | | public ApsGasPipelineCapacityPlan selectApsGasPipelineCapacityPlanById(Long id) { |
| | | return apsGasPipelineCapacityPlanMapper.selectApsGasPipelineCapacityPlanById(id); |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢æ°ä½ç®¡è·¯äº§è½è§åå表 |
| | | * |
| | | * |
| | | * @param apsGasPipelineCapacityPlan æ°ä½ç®¡è·¯äº§è½è§å |
| | | * @return æ°ä½ç®¡è·¯äº§è½è§å |
| | | */ |
| | | @Override |
| | | public List<ApsGasPipelineCapacityPlan> selectApsGasPipelineCapacityPlanList(ApsGasPipelineCapacityPlan apsGasPipelineCapacityPlan) |
| | | { |
| | | public List<ApsGasPipelineCapacityPlan> selectApsGasPipelineCapacityPlanList(ApsGasPipelineCapacityPlan apsGasPipelineCapacityPlan) { |
| | | return apsGasPipelineCapacityPlanMapper.selectApsGasPipelineCapacityPlanList(apsGasPipelineCapacityPlan); |
| | | } |
| | | |
| | | /** |
| | | * æ°å¢æ°ä½ç®¡è·¯äº§è½è§å |
| | | * |
| | | * |
| | | * @param apsGasPipelineCapacityPlan æ°ä½ç®¡è·¯äº§è½è§å |
| | | * @return ç»æ |
| | | */ |
| | | @Override |
| | | public int insertApsGasPipelineCapacityPlan(ApsGasPipelineCapacityPlan apsGasPipelineCapacityPlan) |
| | | { |
| | | public int insertApsGasPipelineCapacityPlan(ApsGasPipelineCapacityPlan apsGasPipelineCapacityPlan) { |
| | | apsGasPipelineCapacityPlan.setCreateTime(DateUtils.getNowDate()); |
| | | apsGasPipelineCapacityPlan.setCreateBy(SecurityUtils.getUsername()); |
| | | return apsGasPipelineCapacityPlanMapper.insertApsGasPipelineCapacityPlan(apsGasPipelineCapacityPlan); |
| | |
| | | |
| | | /** |
| | | * ä¿®æ¹æ°ä½ç®¡è·¯äº§è½è§å |
| | | * |
| | | * |
| | | * @param apsGasPipelineCapacityPlan æ°ä½ç®¡è·¯äº§è½è§å |
| | | * @return ç»æ |
| | | */ |
| | | @Override |
| | | public int updateApsGasPipelineCapacityPlan(ApsGasPipelineCapacityPlan apsGasPipelineCapacityPlan) |
| | | { |
| | | public int updateApsGasPipelineCapacityPlan(ApsGasPipelineCapacityPlan apsGasPipelineCapacityPlan) { |
| | | apsGasPipelineCapacityPlan.setUpdateTime(DateUtils.getNowDate()); |
| | | apsGasPipelineCapacityPlan.setUpdateBy(SecurityUtils.getUsername()); |
| | | return apsGasPipelineCapacityPlanMapper.updateApsGasPipelineCapacityPlan(apsGasPipelineCapacityPlan); |
| | |
| | | |
| | | /** |
| | | * æ¹éå 餿°ä½ç®¡è·¯äº§è½è§å |
| | | * |
| | | * |
| | | * @param ids éè¦å é¤çæ°ä½ç®¡è·¯äº§è½è§åä¸»é® |
| | | * @return ç»æ |
| | | */ |
| | | @Override |
| | | public int deleteApsGasPipelineCapacityPlanByIds(Long[] ids) |
| | | { |
| | | public int deleteApsGasPipelineCapacityPlanByIds(Long[] ids) { |
| | | return apsGasPipelineCapacityPlanMapper.deleteApsGasPipelineCapacityPlanByIds(ids); |
| | | } |
| | | |
| | | /** |
| | | * å 餿°ä½ç®¡è·¯äº§è½è§åä¿¡æ¯ |
| | | * |
| | | * |
| | | * @param id æ°ä½ç®¡è·¯äº§è½è§åä¸»é® |
| | | * @return ç»æ |
| | | */ |
| | | @Override |
| | | public int deleteApsGasPipelineCapacityPlanById(Long id) |
| | | { |
| | | public int deleteApsGasPipelineCapacityPlanById(Long id) { |
| | | return apsGasPipelineCapacityPlanMapper.deleteApsGasPipelineCapacityPlanById(id); |
| | | } |
| | | |
| | | @SneakyThrows |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void copyPlan(String date, String factory, String major, String toStart, String toEnd) { |
| | | |
| | | String[] dtSrc = date.split("-"); |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM"); |
| | | Calendar dtStart = Calendar.getInstance(); |
| | | dtStart.setTime(sdf.parse(toStart)); |
| | | dtStart.set(Calendar.DAY_OF_MONTH, 1); |
| | | Calendar dtEnd = Calendar.getInstance(); |
| | | dtEnd.setTime(sdf.parse(toEnd)); |
| | | dtEnd.set(Calendar.DAY_OF_MONTH, 2); |
| | | |
| | | ApsGasPipelineCapacityPlan plan = new ApsGasPipelineCapacityPlan(); |
| | | plan.setYear(Integer.valueOf(dtSrc[0]).toString()); |
| | | plan.setMonth(Integer.valueOf(dtSrc[1]).toString()); |
| | | plan.setOrgCode(factory); |
| | | plan.setMajor(major); |
| | | List<ApsGasPipelineCapacityPlan> templatePlans = apsGasPipelineCapacityPlanMapper.selectApsGasPipelineCapacityPlanList(plan); |
| | | templatePlans.forEach(p -> { |
| | | p.setCreateBy(SecurityUtils.getUsername()); |
| | | p.setCreateTime(new Date()); |
| | | p.setUpdateBy(null); |
| | | p.setUpdateTime(null); |
| | | // apsGasPipelineCapacityPlanMapper.insertApsGasPipelineCapacityPlan(p); |
| | | }); |
| | | |
| | | while (dtStart.before(dtEnd)) { |
| | | String year = dtStart.get(Calendar.YEAR) + ""; |
| | | String month = (dtStart.get(Calendar.MONTH) + 1) + ""; |
| | | apsGasPipelineCapacityPlanMapper.deleteByDateAndFactory( |
| | | year, |
| | | month, |
| | | factory, |
| | | major |
| | | ); |
| | | templatePlans.forEach(p -> { |
| | | p.setId(null); |
| | | p.setYear(year); |
| | | p.setMonth(month); |
| | | // apsGasPipelineCapacityPlanMapper.insertApsGasPipelineCapacityPlan(p); |
| | | }); |
| | | apsGasPipelineCapacityPlanMapper.insert(templatePlans); |
| | | |
| | | dtStart.add(Calendar.MONTH, 1); |
| | | } |
| | | |
| | | } |
| | | } |
| | |
| | | |
| | | import cn.hutool.core.util.IdUtil; |
| | | import com.aps.common.core.utils.DateUtils; |
| | | import com.aps.common.core.utils.poi.ExcelUtil; |
| | | import com.aps.common.security.utils.DictUtils; |
| | | import com.aps.common.security.utils.SecurityUtils; |
| | | import com.aps.core.domain.ApsGasPipelineMo; |
| | | import com.aps.core.mapper.ApsGasPipelineMoMapper; |
| | | import com.aps.core.service.IApsGasPipelineMoService; |
| | | import io.micrometer.common.util.StringUtils; |
| | | import lombok.SneakyThrows; |
| | | import org.apache.poi.ss.usermodel.Row; |
| | | import org.apache.poi.ss.usermodel.Sheet; |
| | | import org.apache.poi.ss.usermodel.Workbook; |
| | | import org.apache.poi.ss.usermodel.WorkbookFactory; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.sql.Timestamp; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @Override |
| | | public int batchInsertGasPipelineMo(MultipartFile file) { |
| | | Workbook workbook = WorkbookFactory.create(file.getInputStream()); |
| | | |
| | | Sheet sheet = workbook.getSheetAt(0); |
| | | int rows = sheet.getLastRowNum(); |
| | | if (rows > 0) { |
| | | List<ApsGasPipelineMo> list = new ArrayList<>(); |
| | | ExcelUtil<ApsGasPipelineMo> util = new ExcelUtil<>(ApsGasPipelineMo.class); |
| | | List<ApsGasPipelineMo> tempList = util.importExcel(file.getInputStream()); |
| | | DictUtils.CacheValue cacheValue = DictUtils.getCacheValue("aps_factory"); |
| | | tempList.forEach(apsGasPipelineMo -> { |
| | | apsGasPipelineMo.setId(IdUtil.getSnowflakeNextId()); |
| | | apsGasPipelineMo.setFactory(cacheValue.get(apsGasPipelineMo.getFactory())); |
| | | apsGasPipelineMo.setCreateBy(SecurityUtils.getUsername()); |
| | | apsGasPipelineMo.setCreateTime(DateUtils.getNowDate()); |
| | | }); |
| | | |
| | | /*æ°æ®åä»1å¼å§*/ |
| | | for (int i = 1; i <= rows; i++) { |
| | | Row row = sheet.getRow(i); |
| | | if (row.getCell(0) == null){ |
| | | continue; |
| | | } |
| | | String mo = row.getCell(0).getStringCellValue(); |
| | | if (StringUtils.isEmpty(mo)){ |
| | | continue; |
| | | } |
| | | String factory = row.getCell(1).getStringCellValue(); |
| | | String materialNum = row.getCell(2).getStringCellValue(); |
| | | double quantity = row.getCell(3).getNumericCellValue(); |
| | | Date planEnd = row.getCell(4).getDateCellValue(); |
| | | if (StringUtils.isNotBlank(factory) && |
| | | StringUtils.isNotBlank(materialNum) && |
| | | planEnd != null) { |
| | | ApsGasPipelineMo apsGasPipelineMo = new ApsGasPipelineMo(); |
| | | apsGasPipelineMo.setMo(mo); |
| | | apsGasPipelineMo.setMaterialCode(materialNum); |
| | | apsGasPipelineMo.setId(IdUtil.getSnowflakeNextId()); |
| | | apsGasPipelineMo.setFactory(factory); |
| | | apsGasPipelineMo.setCreateBy(SecurityUtils.getUsername()); |
| | | apsGasPipelineMo.setCreateTime(DateUtils.getNowDate()); |
| | | apsGasPipelineMo.setQuantity(new BigDecimal(quantity)); |
| | | apsGasPipelineMo.setPlanEnd(new Timestamp(planEnd.getTime())); |
| | | list.add(apsGasPipelineMo); |
| | | } |
| | | } |
| | | if (!list.isEmpty()) { |
| | | apsGasPipelineMoMapper.deleteAll(); |
| | | apsGasPipelineMoMapper.insert(list); |
| | | } |
| | | return list.size(); |
| | | if (!tempList.isEmpty()) { |
| | | apsGasPipelineMoMapper.deleteAll(); |
| | | apsGasPipelineMoMapper.insert(tempList); |
| | | } |
| | | return 0; |
| | | |
| | | return tempList.size(); |
| | | } |
| | | } |
| | |
| | | |
| | | import cn.hutool.core.util.IdUtil; |
| | | import com.aps.common.core.utils.DateUtils; |
| | | import com.aps.common.core.utils.poi.ExcelUtil; |
| | | import com.aps.common.security.utils.DictUtils; |
| | | import com.aps.common.security.utils.SecurityUtils; |
| | | import com.aps.core.domain.ApsGasPipelinePrediction; |
| | | import com.aps.core.domain.ApsMaterialProductGroupManagement; |
| | | import com.aps.core.mapper.ApsGasPipelinePredictionMapper; |
| | | import com.aps.core.service.IApsGasPipelinePredictionService; |
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | | import io.micrometer.common.util.StringUtils; |
| | | import lombok.SneakyThrows; |
| | | import org.apache.poi.ss.usermodel.Row; |
| | | import org.apache.poi.ss.usermodel.Sheet; |
| | | import org.apache.poi.ss.usermodel.Workbook; |
| | | import org.apache.poi.ss.usermodel.WorkbookFactory; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.sql.Timestamp; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | import java.util.concurrent.atomic.AtomicBoolean; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | |
| | | @SneakyThrows |
| | | @Override |
| | | public int batchInsertApsGasPipelinePrediction(MultipartFile file) { |
| | | Workbook workbook = WorkbookFactory.create(file.getInputStream()); |
| | | |
| | | Sheet sheet = workbook.getSheetAt(0); |
| | | int rows = sheet.getLastRowNum(); |
| | | if (rows > 0) { |
| | | List<ApsGasPipelinePrediction> list = new ArrayList<>(); |
| | | Set<String> keys = new HashSet<>(); |
| | | /*æ°æ®åä»1å¼å§*/ |
| | | for (int i = rows; i > 0; --i) { |
| | | Row row = sheet.getRow(i); |
| | | if (row.getCell(0) == null) { |
| | | continue; |
| | | } |
| | | ExcelUtil<ApsGasPipelinePrediction> util = new ExcelUtil<>(ApsGasPipelinePrediction.class); |
| | | List<ApsGasPipelinePrediction> list = util.importExcel(file.getInputStream()); |
| | | DictUtils.CacheValue cacheValue = DictUtils.getCacheValue("aps_factory"); |
| | | Set<String> keys = new HashSet<>(); |
| | | list.forEach(item -> { |
| | | item.setId(IdUtil.getSnowflakeNextId()); |
| | | item.setFactory(cacheValue.get(item.getFactory())); |
| | | item.setCreateBy(SecurityUtils.getUsername()); |
| | | item.setCreateTime(DateUtils.getNowDate()); |
| | | }); |
| | | |
| | | String materialCode = row.getCell(0).getStringCellValue(); |
| | | if (StringUtils.isEmpty(materialCode)) { |
| | | continue; |
| | | } |
| | | String factory = row.getCell(1).getStringCellValue(); |
| | | double quantity = row.getCell(2).getNumericCellValue(); |
| | | Date date = row.getCell(3).getDateCellValue(); |
| | | if (StringUtils.isNotBlank(factory) && |
| | | date != null) { |
| | | ApsGasPipelinePrediction item = new ApsGasPipelinePrediction(); |
| | | item.setId(IdUtil.getSnowflakeNextId()); |
| | | item.setFactory(factory); |
| | | item.setMaterialCode(materialCode); |
| | | item.setCreateBy(SecurityUtils.getUsername()); |
| | | item.setCreateTime(DateUtils.getNowDate()); |
| | | item.setPredictQuantity(new BigDecimal(quantity)); |
| | | item.setPredictDate(new Timestamp(date.getTime())); |
| | | if (!keys.contains(item.getKey())) { |
| | | keys.add(item.getKey()); |
| | | list.add(item); |
| | | for (int i = list.size() - 1; i >= 0; --i) { |
| | | list.get(i).setKey(null); |
| | | if (!keys.contains(list.get(i).getKey())) { |
| | | keys.add(list.get(i).getKey()); |
| | | } else { |
| | | list.remove(i); |
| | | } |
| | | } |
| | | |
| | | if (!list.isEmpty()) { |
| | | List<Map<String, Object>> facCodeKey = apsGasPipelinePredictionMapper.selectByFacOrMaterial(keys); |
| | | if (!facCodeKey.isEmpty()) { |
| | | Iterator<ApsGasPipelinePrediction> it = list.iterator(); |
| | | while (it.hasNext()) { |
| | | ApsGasPipelinePrediction item = it.next(); |
| | | int count = 0; |
| | | for (Map<String, Object> map : facCodeKey) { |
| | | if (map.get("key").equals(item.getKey())) { |
| | | item.setId((Long) map.get("id")); |
| | | item.setCreateBy(null); |
| | | item.setCreateTime(null); |
| | | item.setUpdateBy(SecurityUtils.getUsername()); |
| | | item.setUpdateTime(new Timestamp(System.currentTimeMillis())); |
| | | apsGasPipelinePredictionMapper.updateById(item); |
| | | count++; |
| | | } |
| | | } |
| | | if (count > 0) { |
| | | it.remove(); |
| | | } |
| | | } |
| | | } |
| | | if (!list.isEmpty()) { |
| | | List<Map<String, Object>> facCodeKey = apsGasPipelinePredictionMapper.selectByFacOrMaterial(keys); |
| | | if (!facCodeKey.isEmpty()) { |
| | | Iterator<ApsGasPipelinePrediction> it = list.iterator(); |
| | | while (it.hasNext()) { |
| | | ApsGasPipelinePrediction item = it.next(); |
| | | long count = facCodeKey.stream() |
| | | .filter(map -> map.get("key").equals(item.getKey())) |
| | | .peek(row -> { |
| | | item.setId((Long) row.get("id")); |
| | | item.setCreateBy(null); |
| | | item.setCreateTime(null); |
| | | item.setUpdateBy(SecurityUtils.getUsername()); |
| | | item.setUpdateTime(new Timestamp(System.currentTimeMillis())); |
| | | apsGasPipelinePredictionMapper.updateById(item); |
| | | }).count(); |
| | | if (count > 0){ |
| | | it.remove(); |
| | | } |
| | | } |
| | | } |
| | | if (!list.isEmpty()) { |
| | | apsGasPipelinePredictionMapper.insert(list); |
| | | } |
| | | apsGasPipelinePredictionMapper.insert(list); |
| | | } |
| | | return list.size(); |
| | | } |
| | | return 0; |
| | | return list.size(); |
| | | } |
| | | } |
| | |
| | | import com.aps.common.core.utils.uuid.IdUtils; |
| | | import com.aps.common.security.utils.SecurityUtils; |
| | | import com.aps.core.domain.*; |
| | | import com.aps.core.mapper.ApsGasPipelineCapacityPlanMapper; |
| | | import com.aps.core.mapper.ApsGasPipingPlanMapper; |
| | | import com.aps.core.mapper.ApsGasPipingRouteStatMapper; |
| | | import com.aps.core.domain.ApsPlate.ApsPlateStandardRequireError; |
| | | import com.aps.core.mapper.*; |
| | | import com.aps.core.service.IApsGasMaterialUsageService; |
| | | import com.aps.core.service.IApsGasPipingRouteStatService; |
| | | import com.aps.core.service.IApsStandardProcessService; |
| | | import com.aps.core.mapper.ApsPlateStandardRequireErrorMapper; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.poi.ss.usermodel.*; |
| | |
| | | |
| | | @Autowired |
| | | private IApsStandardProcessService apsStandardProcessService; |
| | | |
| | | @Autowired |
| | | private ApsPlateStandardRequireErrorMapper apsPlateStandardRequireErrorMapper; |
| | | |
| | | /** |
| | | * æ¥è¯¢æ°ä½ç®¡è·¯äº§è½è´è½½ç»è®¡ |
| | |
| | | log.info("æ¹éæå
¥æ°æ®å®æ,batchNum:"+batchNum); |
| | | } |
| | | |
| | | /** |
| | | * æ ¹æ®æå·¥æ°ä½é¢æµæ°æ®åæå·¥æ°ä½å·¥åæ°æ®çæç»è®¡æ°æ® |
| | | * |
| | | * @return ç»æ |
| | | */ |
| | | @Override |
| | | @Transactional |
| | | public int generateGasPipingRouteStatData() { |
| | | int count = 0; |
| | | |
| | | // æ¸
空ä¹åçæ°æ® |
| | | apsGasPipingRouteStatMapper.deleteAll(); |
| | | |
| | | // çææ¹æ¬¡å· |
| | | String batchNumber = IdUtils.fastSimpleUUID(); |
| | | List<ApsGasPipingRouteStat> statList = new ArrayList<>(); |
| | | |
| | | // å¤çæå·¥æ°ä½é¢æµæ°æ® - 使ç¨èåæ¥è¯¢è·åææç¸å
³æ°æ® |
| | | List<Map<String, Object>> predictionDataList = apsGasPipingRouteStatMapper.selectPredictionRouteData(); |
| | | |
| | | // æç©æä»£ç åç»ï¼ä¾¿äºå¤çåä¸ç©æçä¸åå·¥åº |
| | | Map<String, List<Map<String, Object>>> predictionGroups = predictionDataList.stream() |
| | | .collect(Collectors.groupingBy(data -> data.get("material_code").toString())); |
| | | |
| | | // å¤çæ¯ä¸ªç©æçå·¥èºè·¯çº¿ |
| | | for (String materialCode : predictionGroups.keySet()) { |
| | | List<Map<String, Object>> materialData = predictionGroups.get(materialCode); |
| | | |
| | | // æå·¥åºå·æåº |
| | | materialData.sort((a, b) -> { |
| | | String numA = a.get("process_number").toString(); |
| | | String numB = b.get("process_number").toString(); |
| | | return numA.compareTo(numB); |
| | | }); |
| | | |
| | | // è·åææå·¥åºçä¿¡æ¯å¹¶å建ç»è®¡è®°å½ |
| | | List<ApsGasPipingRouteStat> processList = new ArrayList<>(); |
| | | for (Map<String, Object> data : materialData) { |
| | | ApsGasPipingRouteStat stat = new ApsGasPipingRouteStat(); |
| | | stat.setId(IdUtils.fastSimpleUUID()); |
| | | stat.setWorkOrderNo(""); // 颿µæ°æ®æ²¡æå·¥åå· |
| | | stat.setItemNumber(data.get("material_code").toString()); |
| | | stat.setProcessName(data.get("process_name").toString()); |
| | | stat.setRoadProcessNumber(new BigDecimal(data.get("process_number").toString())); |
| | | |
| | | // ç产æ°éåæ åå·¥æ¶ |
| | | BigDecimal quantity = new BigDecimal(data.get("predict_quantity").toString()).setScale(4, RoundingMode.HALF_UP); |
| | | BigDecimal standardTime = new BigDecimal(data.get("standard_time").toString()).setScale(4, RoundingMode.HALF_UP); |
| | | |
| | | stat.setProductionQuantity(quantity); |
| | | stat.setStandardTime(standardTime); |
| | | stat.setProcessTotalTime(standardTime.multiply(quantity).setScale(4, RoundingMode.HALF_UP)); |
| | | |
| | | // å·¥åãä¸ä¸åè½¦é´ |
| | | stat.setPlant(data.get("factory").toString()); |
| | | stat.setMajor(data.get("domain") != null ? data.get("domain").toString() : ""); |
| | | stat.setWorkshop(data.get("workshop") != null ? data.get("workshop").toString() : ""); |
| | | |
| | | // æ¹æ¬¡å·ååå»ºä¿¡æ¯ |
| | | stat.setBatchNumber(batchNumber); |
| | | stat.setCreateBy(SecurityUtils.getUsername()); |
| | | stat.setCreateTime(truncateToSeconds(DateUtils.getNowDate())); |
| | | |
| | | processList.add(stat); |
| | | } |
| | | |
| | | // 计ç®è®¡åå®å·¥æ¥å计åå¼å·¥æ¥ |
| | | if (!processList.isEmpty()) { |
| | | int lastIndex = processList.size() - 1; |
| | | |
| | | // æåä¸éå·¥åºç计åå®å·¥æ¥æä¸ºé¢æµæ¥æ |
| | | ApsGasPipingRouteStat lastProcess = processList.get(lastIndex); |
| | | Date predictDate = (Date) materialData.get(lastIndex).get("predict_date"); |
| | | lastProcess.setProcessPlanEndDay(truncateToSeconds(predictDate)); |
| | | |
| | | // æ è®°æ¯å¦åºç°è¿æ¶é´å²çªçæ
åµ |
| | | boolean hasTimeConflict = false; |
| | | |
| | | // è®¡ç®æ¯ä¸ªå·¥åºç计åå¼å·¥æ¥åå®å·¥æ¥ - 仿åä¸éå·¥åºå¼å§åæ¨ |
| | | for (int i = lastIndex; i >= 0; i--) { |
| | | ApsGasPipingRouteStat current = processList.get(i); |
| | | |
| | | // 妿å½åæ¯æåä¸éå·¥åºï¼è®¡åå¼å·¥æ¥ = 计åå®å·¥æ¥ - å·¥åºæ»å·¥æ¶ |
| | | if (i == lastIndex) { |
| | | hasTimeConflict = calculateProcessPlanStartDay(current, hasTimeConflict); |
| | | } else { |
| | | // éæåä¸éå·¥åºï¼è®¡åå®å·¥æ¥ä¸ºä¸ä¸éå·¥åºç计åå¼å·¥æ¥ |
| | | ApsGasPipingRouteStat next = processList.get(i + 1); |
| | | current.setProcessPlanEndDay(next.getProcessPlanStartDay()); |
| | | |
| | | // 妿已ç»åºç°æ¶é´å²çªï¼åç»å·¥åºç计åå¼å·¥æ¥å计åå®å·¥æ¥é½è®¾ä¸ºå½åæ¶é´ |
| | | if (hasTimeConflict) { |
| | | current.setProcessPlanStartDay(truncateToSeconds(new Date())); |
| | | } else { |
| | | // å¦åæ£å¸¸è®¡ç®ï¼å¹¶æ£æ¥æ¯å¦åºç°æ¶é´å²çª |
| | | hasTimeConflict = calculateProcessPlanStartDay(current, hasTimeConflict); |
| | | } |
| | | } |
| | | |
| | | // 设置年ãæãæ¥ |
| | | setDateComponents(current); |
| | | } |
| | | |
| | | statList.addAll(processList); |
| | | } |
| | | } |
| | | |
| | | // å¤çæå·¥æ°ä½å·¥åæ°æ® - 使ç¨èåæ¥è¯¢è·åææç¸å
³æ°æ® |
| | | List<Map<String, Object>> moDataList = apsGasPipingRouteStatMapper.selectMoRouteData(); |
| | | |
| | | // è·åææçMOæ°æ®ï¼ç¨äºæ£æ¥åªäºMO没æå
³èå°å·¥èºè·¯çº¿ |
| | | List<Map<String, Object>> allMoData = apsGasPipingRouteStatMapper.selectAllMoData(); |
| | | |
| | | // è®°å½å·²å
³èå·¥èºè·¯çº¿çMOç¼å· |
| | | Set<String> processedMoSet = new HashSet<>(); |
| | | |
| | | // æå·¥åå·åç»ï¼ä¾¿äºå¤çåä¸å·¥åçä¸åå·¥åº |
| | | Map<String, List<Map<String, Object>>> moGroups = moDataList.stream() |
| | | .collect(Collectors.groupingBy(data -> data.get("work_order_no").toString())); |
| | | |
| | | // å¤çæ¯ä¸ªå·¥åçå·¥èºè·¯çº¿ |
| | | for (String workOrderNo : moGroups.keySet()) { |
| | | List<Map<String, Object>> workOrderData = moGroups.get(workOrderNo); |
| | | |
| | | // æ 记该工åå·²å¤ç |
| | | processedMoSet.add(workOrderNo); |
| | | |
| | | // æå·¥åºå·æåº |
| | | workOrderData.sort((a, b) -> { |
| | | String numA = a.get("process_number").toString(); |
| | | String numB = b.get("process_number").toString(); |
| | | return numA.compareTo(numB); |
| | | }); |
| | | |
| | | // è·åææå·¥åºçä¿¡æ¯å¹¶å建ç»è®¡è®°å½ |
| | | List<ApsGasPipingRouteStat> processList = new ArrayList<>(); |
| | | for (Map<String, Object> data : workOrderData) { |
| | | ApsGasPipingRouteStat stat = new ApsGasPipingRouteStat(); |
| | | stat.setId(IdUtils.fastSimpleUUID()); |
| | | stat.setWorkOrderNo(data.get("work_order_no").toString()); |
| | | stat.setItemNumber(data.get("material_code").toString()); |
| | | stat.setProcessName(data.get("process_name").toString()); |
| | | stat.setRoadProcessNumber(new BigDecimal(data.get("process_number").toString())); |
| | | |
| | | // ç产æ°éåæ åå·¥æ¶ |
| | | BigDecimal quantity = new BigDecimal(data.get("quantity").toString()).setScale(4, RoundingMode.HALF_UP); |
| | | BigDecimal standardTime = new BigDecimal(data.get("standard_time").toString()).setScale(4, RoundingMode.HALF_UP); |
| | | |
| | | stat.setProductionQuantity(quantity); |
| | | stat.setStandardTime(standardTime); |
| | | stat.setProcessTotalTime(standardTime.multiply(quantity).setScale(4, RoundingMode.HALF_UP)); |
| | | |
| | | // å·¥åãä¸ä¸åè½¦é´ |
| | | stat.setPlant(data.get("factory").toString()); |
| | | stat.setMajor(data.get("domain") != null ? data.get("domain").toString() : ""); |
| | | stat.setWorkshop(data.get("workshop") != null ? data.get("workshop").toString() : ""); |
| | | |
| | | // æ¹æ¬¡å·ååå»ºä¿¡æ¯ |
| | | stat.setBatchNumber(batchNumber); |
| | | stat.setCreateBy(SecurityUtils.getUsername()); |
| | | stat.setCreateTime(truncateToSeconds(DateUtils.getNowDate())); |
| | | |
| | | processList.add(stat); |
| | | } |
| | | |
| | | // 计ç®è®¡åå®å·¥æ¥å计åå¼å·¥æ¥ |
| | | if (!processList.isEmpty()) { |
| | | int lastIndex = processList.size() - 1; |
| | | |
| | | // æåä¸éå·¥åºç计åå®å·¥æ¥æä¸ºå·¥å计åå®å·¥æ¥æ |
| | | ApsGasPipingRouteStat lastProcess = processList.get(lastIndex); |
| | | Date planEnd = (Date) workOrderData.get(0).get("plan_end"); |
| | | lastProcess.setProcessPlanEndDay(truncateToSeconds(planEnd)); |
| | | |
| | | // æ è®°æ¯å¦åºç°è¿æ¶é´å²çªçæ
åµ |
| | | boolean hasTimeConflict = false; |
| | | |
| | | // è®¡ç®æ¯ä¸ªå·¥åºç计åå¼å·¥æ¥åå®å·¥æ¥ - 仿åä¸éå·¥åºå¼å§åæ¨ |
| | | for (int i = lastIndex; i >= 0; i--) { |
| | | ApsGasPipingRouteStat current = processList.get(i); |
| | | |
| | | // 妿å½åæ¯æåä¸éå·¥åºï¼è®¡åå¼å·¥æ¥ = 计åå®å·¥æ¥ - å·¥åºæ»å·¥æ¶ |
| | | if (i == lastIndex) { |
| | | hasTimeConflict = calculateProcessPlanStartDay(current, hasTimeConflict); |
| | | } else { |
| | | // éæåä¸éå·¥åºï¼è®¡åå®å·¥æ¥ä¸ºä¸ä¸éå·¥åºç计åå¼å·¥æ¥ |
| | | ApsGasPipingRouteStat next = processList.get(i + 1); |
| | | current.setProcessPlanEndDay(next.getProcessPlanStartDay()); |
| | | |
| | | // 妿已ç»åºç°æ¶é´å²çªï¼åç»å·¥åºç计åå¼å·¥æ¥å计åå®å·¥æ¥é½è®¾ä¸ºå½åæ¶é´ |
| | | if (hasTimeConflict) { |
| | | current.setProcessPlanStartDay(truncateToSeconds(new Date())); |
| | | } else { |
| | | // å¦åæ£å¸¸è®¡ç®ï¼å¹¶æ£æ¥æ¯å¦åºç°æ¶é´å²çª |
| | | hasTimeConflict = calculateProcessPlanStartDay(current, hasTimeConflict); |
| | | } |
| | | } |
| | | |
| | | // 设置年ãæãæ¥ |
| | | setDateComponents(current); |
| | | } |
| | | |
| | | statList.addAll(processList); |
| | | } |
| | | } |
| | | |
| | | // å¤ç没æå
³èå°å·¥èºè·¯çº¿çMOæ°æ® |
| | | List<ApsPlateStandardRequireError> errorList = new ArrayList<>(); |
| | | for (Map<String, Object> moData : allMoData) { |
| | | String workOrderNo = moData.get("mo").toString(); |
| | | // å¦æè¯¥å·¥åæ²¡æè¢«å¤çè¿ï¼è¯´ææ²¡æå
³èå°å·¥èºè·¯çº¿ |
| | | if (!processedMoSet.contains(workOrderNo)) { |
| | | ApsPlateStandardRequireError error = ApsPlateStandardRequireError.builder() |
| | | .id(Long.valueOf(IdUtils.fastSimpleUUID().hashCode())) |
| | | .batchNumber(batchNumber) |
| | | .requireId(IdUtil.getSnowflakeNextId()) |
| | | .docNum(workOrderNo) |
| | | .itemNum(moData.get("material_code").toString()) |
| | | .orgCode(moData.get("factory").toString()) |
| | | .message("æ åå·¥èºè·¯çº¿ä¸åå¨") |
| | | .delFlag("0") |
| | | .build(); |
| | | |
| | | // 设置åºç±»å±æ§ |
| | | error.setCreateBy(SecurityUtils.getUsername()); |
| | | error.setCreateTime(truncateToSeconds(DateUtils.getNowDate())); |
| | | |
| | | errorList.add(error); |
| | | } |
| | | } |
| | | |
| | | // æ¹éæå
¥å¼å¸¸æ°æ® |
| | | if (!errorList.isEmpty()) { |
| | | apsPlateStandardRequireErrorMapper.batchInsert(errorList); |
| | | } |
| | | |
| | | // æ¹éæå
¥æ°æ® |
| | | if (!statList.isEmpty()) { |
| | | for (int i = 0; i < statList.size(); i += 500) { |
| | | int endIndex = Math.min(i + 500, statList.size()); |
| | | List<ApsGasPipingRouteStat> batch = statList.subList(i, endIndex); |
| | | count += apsGasPipingRouteStatMapper.insertApsGasPipingRouteStatBatch(batch); |
| | | } |
| | | } |
| | | |
| | | return count; |
| | | } |
| | | |
| | | /** |
| | | * 计ç®å·¥åºè®¡åå¼å·¥æ¥ï¼å¹¶å¤ææ¯å¦åçæ¶é´å²çª |
| | | * |
| | | * @param stat å½åå·¥åºç»è®¡å¯¹è±¡ |
| | | * @param hasTimeConflict ä¹åæ¯å¦å·²ç»åçæ¶é´å²çª |
| | | * @return æ¯å¦åçæ¶é´å²çª |
| | | */ |
| | | private boolean calculateProcessPlanStartDay(ApsGasPipingRouteStat stat, boolean hasTimeConflict) { |
| | | Date planEndDay = stat.getProcessPlanEndDay(); |
| | | if (planEndDay == null) { |
| | | return hasTimeConflict; |
| | | } |
| | | |
| | | // 计ç®å·¥åºæ»å·¥æ¶å¯¹åºçç§æ° |
| | | long processTotalTimeSeconds = stat.getProcessTotalTime() |
| | | .multiply(BigDecimal.valueOf(60 * 60)) |
| | | .longValue(); |
| | | |
| | | // è·åå½åæ¶é´å¹¶ç²¾ç¡®å°ç§çº§å« |
| | | Date now = truncateToSeconds(new Date()); |
| | | |
| | | // 计ç®å¼å·¥æ¥æå¹¶ç²¾ç¡®å°ç§çº§å« |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.setTime(planEndDay); |
| | | |
| | | // åæ¹åå»ç§æ°ï¼é¿å
intæº¢åº |
| | | long seconds = processTotalTimeSeconds; |
| | | while (seconds > 0) { |
| | | int step = (seconds > Integer.MAX_VALUE) ? Integer.MAX_VALUE : (int) seconds; |
| | | calendar.add(Calendar.SECOND, -step); |
| | | seconds -= step; |
| | | } |
| | | |
| | | Date calculatedStartDay = truncateToSeconds(calendar.getTime()); |
| | | |
| | | // å¦æè®¡åå®å·¥æ¥æå°äºçäºå½åæ¶é´ï¼å计åå¼å·¥æ¥ä¹è®¾ä¸ºè®¡åå®å·¥æ¥ï¼å½åæ¶é´ï¼ |
| | | if (planEndDay.compareTo(now) <= 0) { |
| | | stat.setProcessPlanStartDay(truncateToSeconds(planEndDay)); |
| | | return true; // åçæ¶é´å²çª |
| | | } |
| | | // å¦æè®¡ç®åºç计åå¼å·¥æ¥å°äºçäºå½åæ¶é´ï¼å设为å½åæ¶é´ |
| | | else if (calculatedStartDay.compareTo(now) <= 0) { |
| | | stat.setProcessPlanStartDay(now); |
| | | return true; // 馿¬¡åºç°æ¶é´å²çª |
| | | } |
| | | // å¦åæ£å¸¸è®¾ç½®è®¡åå¼å·¥æ¥ |
| | | else { |
| | | stat.setProcessPlanStartDay(calculatedStartDay); |
| | | return hasTimeConflict; // ä¿æåæå²çªç¶æ |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * å°æ¥æç²¾ç¡®å°ç§çº§å«ï¼å»é¤æ¯«ç§ä¿¡æ¯ |
| | | * |
| | | * @param date åå§æ¥æ |
| | | * @return 精确å°ç§çæ¥æ |
| | | */ |
| | | private Date truncateToSeconds(Date date) { |
| | | if (date == null) { |
| | | return null; |
| | | } |
| | | |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.setTime(date); |
| | | calendar.set(Calendar.MILLISECOND, 0); |
| | | return calendar.getTime(); |
| | | } |
| | | |
| | | /** |
| | | * è®¾ç½®æ¥æç¸å
³ç»ä»¶ï¼å¹´ãæãæ¥ï¼ |
| | | */ |
| | | private void setDateComponents(ApsGasPipingRouteStat stat) { |
| | | if (stat.getProcessPlanStartDay() != null) { |
| | | SimpleDateFormat yearFormat = new SimpleDateFormat("yyyy"); |
| | | SimpleDateFormat monthFormat = new SimpleDateFormat("MM"); |
| | | SimpleDateFormat dayFormat = new SimpleDateFormat("dd"); |
| | | |
| | | stat.setPlanStartYear(yearFormat.format(stat.getProcessPlanStartDay())); |
| | | stat.setPlanStartMonth(monthFormat.format(stat.getProcessPlanStartDay())); |
| | | stat.setPlanStartDay(dayFormat.format(stat.getProcessPlanStartDay())); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * èåæ°ä½ç®¡è·¯äº§è½è´è½½ç»è®¡æ°æ® |
| | | * å¨Serviceå±å®æèåå¤çï¼æ¯æå¤ç»´åº¦åç» |
| | | * |
| | | * @param params èååæ° |
| | | * @return èåç»æ |
| | | */ |
| | | @Override |
| | | public Map<String, Object> aggregateGasPipingRouteStat(Map<String, Object> params) { |
| | | Map<String, Object> result = new HashMap<>(); |
| | | List<Map<String, Object>> plantTable = new ArrayList<>(); |
| | | |
| | | // è·åæ¶é´é¢ç²åº¦åæ° |
| | | String timeGranularity = params.containsKey("timeGranularity") ? |
| | | (String) params.get("timeGranularity") : "day"; // é»è®¤ä¸º"æ¥"ç²åº¦ |
| | | |
| | | // è·årow维度çèååæ®µ - é»è®¤ä¸ºå·¥åºåç§°(processName) |
| | | String rowGroupBy = params.containsKey("rowGroupBy") ? |
| | | (String) params.get("rowGroupBy") : "processName"; |
| | | |
| | | // ç¡®å®åç»ç»´åº¦ - å·¥åãä¸ä¸ãè½¦é´ |
| | | boolean groupByPlant = params.containsKey("groupByPlant") && Boolean.TRUE.equals(params.get("groupByPlant")); |
| | | boolean groupByMajor = params.containsKey("groupByMajor") && Boolean.TRUE.equals(params.get("groupByMajor")); |
| | | boolean groupByWorkshop = params.containsKey("groupByWorkshop") && Boolean.TRUE.equals(params.get("groupByWorkshop")); |
| | | // 妿rowGroupByå·²ç»æ¯æä¸ªç»´åº¦ï¼å该维度ä¸éè¦å次åç» |
| | | if ("plant".equals(rowGroupBy)) groupByPlant = false; |
| | | if ("major".equals(rowGroupBy)) groupByMajor = false; |
| | | if ("workshop".equals(rowGroupBy)) groupByWorkshop = false; |
| | | |
| | | // æå»ºæ¥è¯¢æ¡ä»¶ |
| | | Map<String, Object> queryParams = new HashMap<>(); |
| | | |
| | | // 设置æ¥è¯¢æ¡ä»¶ - åç±»æ¡ä»¶ |
| | | if (params.containsKey("plant")) { |
| | | Object plantParam = params.get("plant"); |
| | | if (plantParam instanceof List) { |
| | | queryParams.put("plants", plantParam); |
| | | } else if (plantParam instanceof String) { |
| | | // å¤çå¯è½çéå·åéå符串 |
| | | String plantStr = (String) plantParam; |
| | | if (plantStr.contains(",")) { |
| | | List<String> plantList = Arrays.asList(plantStr.split(",")); |
| | | queryParams.put("plants", plantList); |
| | | } else { |
| | | queryParams.put("plant", plantStr); |
| | | } |
| | | } |
| | | } |
| | | |
| | | if (params.containsKey("major")) { |
| | | Object majorParam = params.get("major"); |
| | | if (majorParam instanceof List) { |
| | | queryParams.put("majors", majorParam); |
| | | } else if (majorParam instanceof String) { |
| | | // å¤çå¯è½çéå·åéå符串 |
| | | String majorStr = (String) majorParam; |
| | | if (majorStr.contains(",")) { |
| | | List<String> majorList = Arrays.asList(majorStr.split(",")); |
| | | queryParams.put("majors", majorList); |
| | | } else { |
| | | queryParams.put("major", majorStr); |
| | | } |
| | | } |
| | | } |
| | | |
| | | if (params.containsKey("workshop")) { |
| | | Object workshopParam = params.get("workshop"); |
| | | if (workshopParam instanceof List) { |
| | | queryParams.put("workshops", workshopParam); |
| | | } else if (workshopParam instanceof String) { |
| | | // å¤çå¯è½çéå·åéå符串 |
| | | String workshopStr = (String) workshopParam; |
| | | if (workshopStr.contains(",")) { |
| | | List<String> workshopList = Arrays.asList(workshopStr.split(",")); |
| | | queryParams.put("workshops", workshopList); |
| | | } else { |
| | | queryParams.put("workshop", workshopStr); |
| | | } |
| | | } |
| | | } |
| | | |
| | | // ç¡®å®æ¶é´èå´ |
| | | List<String> timePoints = new ArrayList<>(); |
| | | |
| | | if ("day".equalsIgnoreCase(timeGranularity)) { |
| | | // "æ¥"ç²åº¦ï¼ä¼ å
¥ä¸ä¸ªæä»½ï¼èåè¯¥ææ¯ä¸å¤©çæ°æ® |
| | | if (!params.containsKey("yearMonth")) { |
| | | result.put("plantTable", plantTable); |
| | | result.put("message", "æ¥ç²åº¦èåéè¦æå®yearMonthåæ°"); |
| | | return result; |
| | | } |
| | | |
| | | String yearMonth = (String) params.get("yearMonth"); |
| | | // çææå®æä»½ä¸çæ¯ä¸å¤© |
| | | YearMonth ym = YearMonth.parse(yearMonth); |
| | | int daysInMonth = ym.lengthOfMonth(); |
| | | |
| | | for (int day = 1; day <= daysInMonth; day++) { |
| | | String dayStr = String.format("%02d", day); |
| | | timePoints.add(yearMonth + "-" + dayStr); |
| | | } |
| | | |
| | | // 设置æ¥è¯¢åæ° |
| | | String[] ymParts = yearMonth.split("-"); |
| | | queryParams.put("yearStart", ymParts[0]); |
| | | queryParams.put("monthStart", ymParts[1]); |
| | | queryParams.put("yearEnd", ymParts[0]); |
| | | queryParams.put("monthEnd", ymParts[1]); |
| | | |
| | | } else if ("month".equalsIgnoreCase(timeGranularity)) { |
| | | // "æ"ç²åº¦ï¼ä¼ å
¥ä¸ä¸ªæ¶é´åºé´ï¼èå该åºé´å
æ¯ä¸ªæçæ°æ® |
| | | if (!params.containsKey("startDate") || !params.containsKey("endDate")) { |
| | | result.put("plantTable", plantTable); |
| | | result.put("message", "æç²åº¦èåéè¦æå®startDateåendDateåæ°"); |
| | | return result; |
| | | } |
| | | |
| | | String startDate = (String) params.get("startDate"); |
| | | String endDate = (String) params.get("endDate"); |
| | | |
| | | // è§£æå¼å§åç»æå¹´æ |
| | | YearMonth start = YearMonth.parse(startDate); |
| | | YearMonth end = YearMonth.parse(endDate); |
| | | |
| | | // çæåºé´å
çæ¯ä¸ªæ |
| | | timePoints = getYearMonthsInRange(start, end); |
| | | |
| | | // 设置æ¥è¯¢åæ° |
| | | String[] startParts = startDate.split("-"); |
| | | String[] endParts = endDate.split("-"); |
| | | queryParams.put("yearStart", startParts[0]); |
| | | queryParams.put("monthStart", startParts[1]); |
| | | queryParams.put("yearEnd", endParts[0]); |
| | | queryParams.put("monthEnd", endParts[1]); |
| | | } |
| | | |
| | | if (timePoints.isEmpty()) { |
| | | result.put("plantTable", plantTable); |
| | | result.put("message", "æªè½çæææçæ¶é´ç¹å表"); |
| | | return result; |
| | | } |
| | | |
| | | // æ¥è¯¢åå§æ°æ®ï¼ä¸ä¾èµæ°æ®åºèåï¼ |
| | | List<Map<String, Object>> rawData = apsGasPipingRouteStatMapper.selectRawStatData(queryParams); |
| | | |
| | | // å¦ææ²¡ææ¥è¯¢å°åå§æ°æ®ï¼ä½éè¦è¿åææå·¥åº/车é´çæ°æ® |
| | | if (rawData.isEmpty()) { |
| | | // åå»ºæ²¡ææ¶é´éå¶çåºç¡æ¥è¯¢åæ° |
| | | Map<String, Object> baseParams = new HashMap<>(queryParams); |
| | | baseParams.remove("yearStart"); |
| | | baseParams.remove("monthStart"); |
| | | baseParams.remove("yearEnd"); |
| | | baseParams.remove("monthEnd"); |
| | | |
| | | // ç´æ¥ä»aps_gas_piping_route_stat表æ¥è¯¢ææå¯è½çå·¥åºåè½¦é´ |
| | | List<Map<String, Object>> baseData = apsGasPipingRouteStatMapper.selectBaseStatData(baseParams); |
| | | |
| | | // 为æ¯ä¸ªå·¥åº/车é´å建åºäºæ¶é´çç©ºæ°æ® |
| | | for (Map<String, Object> data : baseData) { |
| | | String rowGroupValue = getStringValue(data, rowGroupBy); |
| | | if (rowGroupValue == null || rowGroupValue.trim().isEmpty()) continue; |
| | | |
| | | Map<String, Object> rowEntry = new HashMap<>(); |
| | | Map<String, Object> rowDetail = new HashMap<>(); |
| | | |
| | | // æ·»å åºæ¬ä¿¡æ¯ |
| | | String plant = getStringValue(data, "plant"); |
| | | String major = getStringValue(data, "major"); |
| | | String workshop = getStringValue(data, "workshop"); |
| | | |
| | | if (groupByPlant) rowDetail.put("plant", plant); |
| | | if (groupByMajor) rowDetail.put("major", major); |
| | | if (groupByWorkshop) rowDetail.put("workshop", workshop); |
| | | |
| | | // å¤çå·¥åºåç§° - 妿rowGroupBy为workshopï¼éè¦æ·»å processNameåæ®µ |
| | | if ("workshop".equals(rowGroupBy)) { |
| | | String processName = getStringValue(data, "processName"); |
| | | rowDetail.put("processName", processName != null ? processName : ""); |
| | | } |
| | | |
| | | // 为æ¯ä¸ªæ¶é´ç¹å建é¶å¼æ°æ® |
| | | List<Map<String, Object>> timeDataList = new ArrayList<>(); |
| | | for (String timePoint : timePoints) { |
| | | Map<String, Object> pointData = new HashMap<>(); |
| | | pointData.put("planDay", timePoint); |
| | | pointData.put("requireTimes", BigDecimal.ZERO); |
| | | pointData.put("designTimes", BigDecimal.ZERO); |
| | | pointData.put("capacityLoad", BigDecimal.ZERO); |
| | | timeDataList.add(pointData); |
| | | } |
| | | |
| | | rowDetail.put("timeData", timeDataList); |
| | | rowEntry.put(rowGroupValue, rowDetail); |
| | | plantTable.add(rowEntry); |
| | | } |
| | | |
| | | // æ´æ°ç»æä½ä¸ç´æ¥è¿åï¼ç»§ç»æ§è¡åç»æ³¨æç¹4çå¤ç |
| | | result.put("plantTable", plantTable); |
| | | result.put("timePoints", timePoints); |
| | | result.put("rowGroupBy", rowGroupBy); |
| | | } else { |
| | | // å¨Serviceå±å®æèå |
| | | // 使ç¨ç»åkeyæ¥å®ç°å¤ç»´åº¦åç»ï¼å¨ærowGroupByåæ®µ + å¯éçå·¥å/ä¸ä¸/车é´ï¼ |
| | | Map<String, Map<String, Object>> groupInfoMap = new HashMap<>(); |
| | | Map<String, Map<String, BigDecimal>> groupTimeDataMap = new HashMap<>(); |
| | | // å卿¯ä¸ªgroupKey对åºçprocessNameéå |
| | | Map<String, Set<String>> groupProcessNamesMap = new HashMap<>(); |
| | | |
| | | // éååå§æ°æ®ï¼æå¤ç»´åº¦åç»è¿è¡èå |
| | | for (Map<String, Object> data : rawData) { |
| | | // è·åè¡åç»åæ®µå¼ |
| | | String rowGroupValue = getStringValue(data, rowGroupBy); |
| | | if (rowGroupValue == null || rowGroupValue.trim().isEmpty()) { |
| | | log.warn("è·³è¿å¤çï¼{} åæ®µå¼ä¸ºç©º", rowGroupBy); |
| | | continue; |
| | | } |
| | | |
| | | // è·åå·¥åºåç§°ï¼ç¨äºæ¥å¿ååç»å¤çï¼ |
| | | String processName = getStringValue(data, "processName"); |
| | | |
| | | // å¤çå¼å·¥æ¥æ |
| | | Date processPlanStartDay = (Date) data.get("processPlanStartDay"); |
| | | if (processPlanStartDay == null) { |
| | | log.warn("è·³è¿å¤çï¼è®¡åå¼å·¥æ¥ä¸ºnull, {}={}", rowGroupBy, rowGroupValue); |
| | | continue; |
| | | } |
| | | |
| | | // æå»ºåç»é® - åºäºrowåç»å段åå¯éçå
¶ä»ç»´åº¦ |
| | | String plant = getStringValue(data, "plant"); |
| | | String major = getStringValue(data, "major"); |
| | | String workshop = getStringValue(data, "workshop"); |
| | | |
| | | StringBuilder groupKeyBuilder = new StringBuilder(rowGroupValue); |
| | | |
| | | // æ ¹æ®ç¨æ·éæ©çåç»ç»´åº¦æ·»å å°åç»é® |
| | | if (groupByPlant && plant != null) { |
| | | groupKeyBuilder.append("_PLANT_").append(plant); |
| | | } |
| | | if (groupByMajor && major != null) { |
| | | groupKeyBuilder.append("_MAJOR_").append(major); |
| | | } |
| | | if (groupByWorkshop && workshop != null) { |
| | | groupKeyBuilder.append("_WORKSHOP_").append(workshop); |
| | | } |
| | | |
| | | String groupKey = groupKeyBuilder.toString(); |
| | | |
| | | // è®°å½åç»çåºæ¬ä¿¡æ¯ï¼åªè®°å½ä¸æ¬¡ï¼ |
| | | if (!groupInfoMap.containsKey(groupKey)) { |
| | | Map<String, Object> groupInfo = new HashMap<>(); |
| | | groupInfo.put(rowGroupBy, rowGroupValue); |
| | | groupInfo.put("plant", plant); |
| | | groupInfo.put("major", major); |
| | | groupInfo.put("workshop", workshop); |
| | | groupInfo.put("processName", processName); |
| | | groupInfoMap.put(groupKey, groupInfo); |
| | | } |
| | | |
| | | // æ¶éprocessName |
| | | if (processName != null && !processName.trim().isEmpty()) { |
| | | if (!groupProcessNamesMap.containsKey(groupKey)) { |
| | | groupProcessNamesMap.put(groupKey, new HashSet<>()); |
| | | } |
| | | groupProcessNamesMap.get(groupKey).add(processName); |
| | | } |
| | | |
| | | // è®¡ç®æ¶é´ç¹Key |
| | | String timeKey; |
| | | LocalDate planStartLocalDate = processPlanStartDay.toInstant().atZone(ZoneId.systemDefault()).toLocalDate(); |
| | | |
| | | if ("day".equalsIgnoreCase(timeGranularity)) { |
| | | // æ¥ç²åº¦: 2025-05-25 |
| | | timeKey = planStartLocalDate.format(DateTimeFormatter.ISO_LOCAL_DATE); |
| | | } else { |
| | | // æç²åº¦: 2025-05 |
| | | timeKey = planStartLocalDate.getYear() + "-" + String.format("%02d", planStartLocalDate.getMonthValue()); |
| | | } |
| | | |
| | | // è·å该åç»çæ¶é´ç¹æ å°ï¼å¦æä¸åå¨åå建 |
| | | if (!groupTimeDataMap.containsKey(groupKey)) { |
| | | groupTimeDataMap.put(groupKey, new HashMap<>()); |
| | | } |
| | | Map<String, BigDecimal> timeMap = groupTimeDataMap.get(groupKey); |
| | | |
| | | // ç´¯å 该åç»å¨è¯¥æ¶é´ç¹çå·¥æ¶æ°æ® |
| | | BigDecimal processTotalTime = getBigDecimalValue(data, "processTotalTime"); |
| | | if (processTotalTime != null) { |
| | | BigDecimal currentTotal = timeMap.getOrDefault(timeKey, BigDecimal.ZERO); |
| | | timeMap.put(timeKey, currentTotal.add(processTotalTime)); |
| | | } |
| | | } |
| | | |
| | | // æå»ºæç»è¿åçæ°æ®ç»æ |
| | | for (String groupKey : groupInfoMap.keySet()) { |
| | | Map<String, Object> rowEntry = new HashMap<>(); |
| | | Map<String, Object> rowDetail = new HashMap<>(); |
| | | |
| | | // è·å该åç»çåºæ¬ä¿¡æ¯ |
| | | Map<String, Object> groupInfo = groupInfoMap.get(groupKey); |
| | | String rowGroupValue = (String) groupInfo.get(rowGroupBy); |
| | | |
| | | // æ·»å åç»åºæ¬ä¿¡æ¯ |
| | | if (groupByPlant) { |
| | | rowDetail.put("plant", groupInfo.get("plant")); |
| | | } |
| | | if (groupByMajor) { |
| | | rowDetail.put("major", groupInfo.get("major")); |
| | | } |
| | | if (groupByWorkshop) { |
| | | rowDetail.put("workshop", groupInfo.get("workshop")); |
| | | } |
| | | |
| | | // å¤çprocessName - 妿rowGroupBy为workshopï¼åå°ææprocessNameç¨åå·è¿æ¥ |
| | | if ("workshop".equals(rowGroupBy)) { |
| | | Set<String> processNames = groupProcessNamesMap.getOrDefault(groupKey, new HashSet<>()); |
| | | if (!processNames.isEmpty()) { |
| | | String joinedProcessNames = String.join(";", processNames); |
| | | rowDetail.put("processName", joinedProcessNames); |
| | | } else { |
| | | rowDetail.put("processName", groupInfo.get("processName")); |
| | | } |
| | | } else if (!"processName".equals(rowGroupBy)) { |
| | | // ä¿çå·¥åºåç§°ä¿¡æ¯ï¼ä»¥ä¾¿å端å±ç¤º |
| | | rowDetail.put("processName", groupInfo.get("processName")); |
| | | } |
| | | |
| | | // æ·»å æ¶é´æ°æ® |
| | | List<Map<String, Object>> timeDataList = new ArrayList<>(); |
| | | Map<String, BigDecimal> timeMap = groupTimeDataMap.getOrDefault(groupKey, new HashMap<>()); |
| | | |
| | | for (String timePoint : timePoints) { |
| | | Map<String, Object> pointData = new HashMap<>(); |
| | | pointData.put("planDay", timePoint); |
| | | |
| | | // è·å该æ¶é´ç¹ç鿱工æ¶ï¼å¦æä¸åå¨å设为0 |
| | | BigDecimal requireTimes = timeMap.getOrDefault(timePoint, BigDecimal.ZERO); |
| | | pointData.put("requireTimes", requireTimes); |
| | | |
| | | // 设计工æ¶å产è½è´è·ç¨åè®¡ç® |
| | | pointData.put("designTimes", 0); |
| | | pointData.put("capacityLoad", 0); |
| | | |
| | | timeDataList.add(pointData); |
| | | } |
| | | |
| | | rowDetail.put("timeData", timeDataList); |
| | | rowEntry.put(rowGroupValue, rowDetail); |
| | | plantTable.add(rowEntry); |
| | | } |
| | | } |
| | | |
| | | // å¨è¿ååæ¥è¯¢è®¾è®¡äº§è½æ°æ®å¹¶è®¡ç®äº§è½è´è· |
| | | for (Map<String, Object> rowEntry : plantTable) { |
| | | for (String rowKey : rowEntry.keySet()) { |
| | | Map<String, Object> rowDetail = (Map<String, Object>) rowEntry.get(rowKey); |
| | | List<Map<String, Object>> timeDataList = (List<Map<String, Object>>) rowDetail.get("timeData"); |
| | | |
| | | // è·ååºæ¬ä¿¡æ¯ |
| | | String plant = rowDetail.containsKey("plant") ? (String) rowDetail.get("plant") : null; |
| | | String major = rowDetail.containsKey("major") ? (String) rowDetail.get("major") : null; |
| | | String workshop = rowDetail.containsKey("workshop") ? (String) rowDetail.get("workshop") : null; |
| | | |
| | | // å¤çä¸åçrowGroupByæ
åµ |
| | | if ("workshop".equals(rowGroupBy) && rowDetail.containsKey("processName")) { |
| | | // æ
åµ1: æworkshopèåï¼éè¦æåprocessNameåæ®µ |
| | | String processNamesStr = (String) rowDetail.get("processName"); |
| | | String[] processNames = processNamesStr.split(";"); |
| | | |
| | | // ä¼åæ¥è¯¢ - å建ç¼åï¼ææä»½ç¼åæ¥è¯¢ç»æ |
| | | // Key: year-month-processName, Value: æ¥è¯¢ç»æå表 |
| | | Map<String, List<ApsGasPipelineCapacityPlan>> capacityPlanCache = new HashMap<>(); |
| | | |
| | | // éåæ¯ä¸ªæ¶é´ç¹ |
| | | for (Map<String, Object> timeData : timeDataList) { |
| | | String planDay = (String) timeData.get("planDay"); |
| | | BigDecimal requireTimes = new BigDecimal(timeData.get("requireTimes").toString()); |
| | | BigDecimal totalDesignTimes = BigDecimal.ZERO; |
| | | |
| | | // æåå¹´ææ¥ |
| | | String[] dateParts = planDay.split("-"); |
| | | String year = dateParts[0]; |
| | | String month = dateParts[1]; |
| | | // ç»ä¸monthæ ¼å¼ä¸ºæ´æ°å符串ï¼å»æåå¯¼é¶ |
| | | month = String.valueOf(Integer.parseInt(month)); |
| | | String yearMonth = year + "-" + month; |
| | | |
| | | // ç´¯å å¤ä¸ªå·¥åºçè®¾è®¡äº§è½ |
| | | for (String processName : processNames) { |
| | | // æå»ºç¼åé® |
| | | String cacheKey = yearMonth + "-" + processName.trim(); |
| | | |
| | | // ä»ç¼åè·åææ¥è¯¢æ°æ® |
| | | List<ApsGasPipelineCapacityPlan> capacityPlans; |
| | | if (capacityPlanCache.containsKey(cacheKey)) { |
| | | capacityPlans = capacityPlanCache.get(cacheKey); |
| | | } else { |
| | | // 使ç¨ä¸ç¨æ¥è¯¢æ¹æ³æ¥è¯¢è®¾è®¡äº§è½æ°æ® |
| | | // æææ¡£è¦æ±ï¼æ ¹æ®process_nameåplantå»aps_gas_pipeline_capacity_planè¡¨ä¸æ¥è¯¢ |
| | | capacityPlans = apsGasPipelineCapacityPlanMapper.selectDesignCapacityForInterface2( |
| | | processName.trim(), year, month, major, plant); |
| | | |
| | | // å°ç»æåå
¥ç¼å |
| | | capacityPlanCache.put(cacheKey, capacityPlans); |
| | | } |
| | | |
| | | // ç´¯å 设计产è½å¼ |
| | | for (ApsGasPipelineCapacityPlan plan : capacityPlans) { |
| | | if ("day".equalsIgnoreCase(timeGranularity)) { |
| | | // æ¥ç²åº¦ä½¿ç¨æ¥äº§åºæ°é |
| | | if (plan.getDayProduceAllNum() != null) { |
| | | totalDesignTimes = totalDesignTimes.add(plan.getDayProduceAllNum()); |
| | | } |
| | | } else { |
| | | // æç²åº¦ä½¿ç¨æäº§åºæ»æ°é |
| | | if (plan.getMonthProduceAllNum() != null) { |
| | | totalDesignTimes = totalDesignTimes.add(plan.getMonthProduceAllNum()); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | // æ´æ°è®¾è®¡å·¥æ¶ |
| | | timeData.put("designTimes", totalDesignTimes); |
| | | |
| | | // 计ç®äº§è½è´è· = éæ±äº§è½/设计产è½Ã100% |
| | | if (totalDesignTimes.compareTo(BigDecimal.ZERO) > 0) { |
| | | BigDecimal capacityLoad = requireTimes |
| | | .divide(totalDesignTimes, 2, RoundingMode.HALF_UP) |
| | | .multiply(new BigDecimal(100)); |
| | | timeData.put("capacityLoad", capacityLoad); |
| | | } else { |
| | | timeData.put("capacityLoad", 0); |
| | | } |
| | | } |
| | | } else { |
| | | // æ
åµ2: æprocessNameæå
¶ä»å段èå |
| | | String processName = rowDetail.containsKey("processName") ? |
| | | (String) rowDetail.get("processName") : rowKey; |
| | | |
| | | // ä¼åæ¥è¯¢ - å建ç¼åï¼ææä»½ç¼åæ¥è¯¢ç»æ |
| | | Map<String, List<ApsGasPipelineCapacityPlan>> capacityPlanCache = new HashMap<>(); |
| | | |
| | | // éåæ¯ä¸ªæ¶é´ç¹ |
| | | for (Map<String, Object> timeData : timeDataList) { |
| | | String planDay = (String) timeData.get("planDay"); |
| | | BigDecimal requireTimes = new BigDecimal(timeData.get("requireTimes").toString()); |
| | | |
| | | // æåå¹´ææ¥ |
| | | String[] dateParts = planDay.split("-"); |
| | | String year = dateParts[0]; |
| | | String month = dateParts[1]; |
| | | // ç»ä¸monthæ ¼å¼ä¸ºæ´æ°å符串ï¼å»æåå¯¼é¶ |
| | | month = String.valueOf(Integer.parseInt(month)); |
| | | String yearMonth = year + "-" + month; |
| | | |
| | | // æå»ºç¼åé® |
| | | String cacheKey = yearMonth + "-" + processName; |
| | | |
| | | // ä»ç¼åè·åææ¥è¯¢æ°æ® |
| | | List<ApsGasPipelineCapacityPlan> capacityPlans; |
| | | if (capacityPlanCache.containsKey(cacheKey)) { |
| | | capacityPlans = capacityPlanCache.get(cacheKey); |
| | | } else { |
| | | // 使ç¨ä¸ç¨æ¥è¯¢æ¹æ³æ¥è¯¢è®¾è®¡äº§è½æ°æ® |
| | | // æææ¡£è¦æ±ï¼æ ¹æ®process_nameåplantå»aps_gas_pipeline_capacity_planè¡¨ä¸æ¥è¯¢ |
| | | capacityPlans = apsGasPipelineCapacityPlanMapper.selectDesignCapacityForInterface2( |
| | | processName, year, month, major, plant); |
| | | |
| | | // å°ç»æåå
¥ç¼å |
| | | capacityPlanCache.put(cacheKey, capacityPlans); |
| | | } |
| | | |
| | | // ç´¯å 设计产è½å¼ |
| | | BigDecimal totalDesignTimes = BigDecimal.ZERO; |
| | | for (ApsGasPipelineCapacityPlan plan : capacityPlans) { |
| | | if ("day".equalsIgnoreCase(timeGranularity)) { |
| | | // æ¥ç²åº¦ä½¿ç¨æ¥äº§åºæ°é |
| | | if (plan.getDayProduceAllNum() != null) { |
| | | totalDesignTimes = totalDesignTimes.add(plan.getDayProduceAllNum()); |
| | | } |
| | | } else { |
| | | // æç²åº¦ä½¿ç¨æäº§åºæ»æ°é |
| | | if (plan.getMonthProduceAllNum() != null) { |
| | | totalDesignTimes = totalDesignTimes.add(plan.getMonthProduceAllNum()); |
| | | } |
| | | } |
| | | } |
| | | |
| | | // æ´æ°è®¾è®¡å·¥æ¶ |
| | | timeData.put("designTimes", totalDesignTimes); |
| | | |
| | | // 计ç®äº§è½è´è· = éæ±äº§è½/设计产è½Ã100% |
| | | if (totalDesignTimes.compareTo(BigDecimal.ZERO) > 0) { |
| | | BigDecimal capacityLoad = requireTimes |
| | | .divide(totalDesignTimes, 2, RoundingMode.HALF_UP) |
| | | .multiply(new BigDecimal(100)); |
| | | timeData.put("capacityLoad", capacityLoad); |
| | | } else { |
| | | timeData.put("capacityLoad", 0); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | result.put("plantTable", plantTable); |
| | | result.put("timePoints", timePoints); |
| | | result.put("rowGroupBy", rowGroupBy); |
| | | |
| | | // æ ¹æ®ææ¡£æ³¨æç¹3ï¼æ·»å æåºé»è¾ |
| | | if (!plantTable.isEmpty()) { |
| | | // 对èåç»æè¿è¡æåº |
| | | Collections.sort(plantTable, (map1, map2) -> { |
| | | String key1 = map1.keySet().iterator().next(); |
| | | String key2 = map2.keySet().iterator().next(); |
| | | |
| | | // é¦å
ærowGroupByæåºï¼processNameæworkshopï¼ |
| | | int result1 = key1.compareTo(key2); |
| | | if (result1 != 0) { |
| | | return result1; |
| | | } |
| | | |
| | | // 妿rowGroupByç¸åï¼åæplantæåº |
| | | Map<String, Object> detail1 = (Map<String, Object>) map1.get(key1); |
| | | Map<String, Object> detail2 = (Map<String, Object>) map2.get(key2); |
| | | |
| | | String plant1 = detail1.containsKey("plant") ? (String) detail1.get("plant") : ""; |
| | | String plant2 = detail2.containsKey("plant") ? (String) detail2.get("plant") : ""; |
| | | |
| | | return plant1.compareTo(plant2); |
| | | }); |
| | | } |
| | | |
| | | // å®ç°æ³¨æç¹4ï¼å½æ¶é´é¢ç²åº¦ä¸º"æ¥"æ¶ï¼ç¡®ä¿æ²¡ææ°æ®çå·¥åä¹è¿å宿´ç»æ |
| | | if ("day".equalsIgnoreCase(timeGranularity) && params.containsKey("plant")) { |
| | | // è·å请æ±ä¸çå·¥åå表 |
| | | List<String> requestedPlants = new ArrayList<>(); |
| | | Object plantParam = params.get("plant"); |
| | | if (plantParam instanceof List) { |
| | | requestedPlants.addAll((List<String>) plantParam); |
| | | } else if (plantParam instanceof String) { |
| | | String plantStr = (String) plantParam; |
| | | if (plantStr.contains(",")) { |
| | | requestedPlants.addAll(Arrays.asList(plantStr.split(","))); |
| | | } else { |
| | | requestedPlants.add(plantStr); |
| | | } |
| | | } |
| | | |
| | | if (!requestedPlants.isEmpty()) { |
| | | // æ£æ¥åªäºå·¥åæ²¡ææ°æ® |
| | | Set<String> plantsWithData = new HashSet<>(); |
| | | for (Map<String, Object> rowEntry : plantTable) { |
| | | for (String rowKey : rowEntry.keySet()) { |
| | | Map<String, Object> rowDetail = (Map<String, Object>) rowEntry.get(rowKey); |
| | | if (rowDetail.containsKey("plant")) { |
| | | plantsWithData.add((String) rowDetail.get("plant")); |
| | | } |
| | | } |
| | | } |
| | | |
| | | // æ¾åºæ²¡ææ°æ®çå·¥å |
| | | List<String> plantsWithoutData = requestedPlants.stream() |
| | | .filter(plant -> !plantsWithData.contains(plant)) |
| | | .collect(Collectors.toList()); |
| | | |
| | | if (!plantsWithoutData.isEmpty()) { |
| | | // è·åææå»éçprocessNameæworkshop |
| | | List<String> allUniqueValues; |
| | | if ("processName".equals(rowGroupBy)) { |
| | | allUniqueValues = apsGasPipingRouteStatMapper.selectDistinctProcessNames(); |
| | | } else if ("workshop".equals(rowGroupBy)) { |
| | | allUniqueValues = apsGasPipingRouteStatMapper.selectDistinctWorkshops(); |
| | | } else { |
| | | // 妿rowGroupBy䏿¯processNameæworkshopï¼è·³è¿å¤ç |
| | | return result; |
| | | } |
| | | |
| | | // 为æ¯ä¸ªæ²¡ææ°æ®çå·¥ååå»ºç©ºæ°æ®ç»æ |
| | | for (String plant : plantsWithoutData) { |
| | | for (String uniqueValue : allUniqueValues) { |
| | | if (uniqueValue == null || uniqueValue.trim().isEmpty()) { |
| | | continue; |
| | | } |
| | | |
| | | // æ£æ¥æ¯å¦å·²ç»åå¨è¿ä¸ªå¼ |
| | | boolean exists = false; |
| | | for (Map<String, Object> entry : plantTable) { |
| | | if (entry.containsKey(uniqueValue)) { |
| | | Map<String, Object> detail = (Map<String, Object>) entry.get(uniqueValue); |
| | | String existingPlant = detail.containsKey("plant") ? (String) detail.get("plant") : ""; |
| | | if (plant.equals(existingPlant)) { |
| | | exists = true; |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | |
| | | // 妿ä¸åå¨ï¼å建æ°çç©ºæ°æ®ç»æ |
| | | if (!exists) { |
| | | Map<String, Object> rowEntry = new HashMap<>(); |
| | | Map<String, Object> rowDetail = new HashMap<>(); |
| | | |
| | | // è®¾ç½®åºæ¬ä¿¡æ¯ |
| | | rowDetail.put("plant", plant); |
| | | if (groupByMajor) { |
| | | rowDetail.put("major", ""); |
| | | } |
| | | if (groupByWorkshop && !"workshop".equals(rowGroupBy)) { |
| | | rowDetail.put("workshop", ""); |
| | | } |
| | | |
| | | // å¤çprocessName - 妿rowGroupBy为workshopï¼éè¦è®¾ç½®ç©ºçprocessName |
| | | if ("workshop".equals(rowGroupBy)) { |
| | | rowDetail.put("processName", ""); |
| | | } |
| | | |
| | | // 为æ¯ä¸ªæ¶é´ç¹å建é¶å¼æ°æ® |
| | | List<Map<String, Object>> timeDataList = new ArrayList<>(); |
| | | for (String timePoint : timePoints) { |
| | | Map<String, Object> pointData = new HashMap<>(); |
| | | pointData.put("planDay", timePoint); |
| | | pointData.put("requireTimes", BigDecimal.ZERO); |
| | | pointData.put("designTimes", BigDecimal.ZERO); |
| | | pointData.put("capacityLoad", BigDecimal.ZERO); |
| | | timeDataList.add(pointData); |
| | | } |
| | | |
| | | rowDetail.put("timeData", timeDataList); |
| | | rowEntry.put(uniqueValue, rowDetail); |
| | | plantTable.add(rowEntry); |
| | | } |
| | | } |
| | | } |
| | | |
| | | // éæ°æåºç»æ |
| | | Collections.sort(plantTable, (map1, map2) -> { |
| | | String key1 = map1.keySet().iterator().next(); |
| | | String key2 = map2.keySet().iterator().next(); |
| | | |
| | | // é¦å
ærowGroupByæåºï¼processNameæworkshopï¼ |
| | | int result1 = key1.compareTo(key2); |
| | | if (result1 != 0) { |
| | | return result1; |
| | | } |
| | | |
| | | // 妿rowGroupByç¸åï¼åæplantæåº |
| | | Map<String, Object> detail1 = (Map<String, Object>) map1.get(key1); |
| | | Map<String, Object> detail2 = (Map<String, Object>) map2.get(key2); |
| | | |
| | | String plant1 = detail1.containsKey("plant") ? (String) detail1.get("plant") : ""; |
| | | String plant2 = detail2.containsKey("plant") ? (String) detail2.get("plant") : ""; |
| | | |
| | | return plant1.compareTo(plant2); |
| | | }); |
| | | |
| | | // æ´æ°ç»æ |
| | | result.put("plantTable", plantTable); |
| | | } |
| | | } |
| | | } |
| | | |
| | | return result; |
| | | } |
| | | |
| | | /** |
| | | * ä»Mapä¸å®å
¨è·åStringå¼ |
| | | */ |
| | | private String getStringValue(Map<String, Object> data, String key) { |
| | | Object value = data.get(key); |
| | | if (value == null) { |
| | | return null; |
| | | } |
| | | return value.toString(); |
| | | } |
| | | |
| | | /** |
| | | * ä»Mapä¸å®å
¨è·åBigDecimalå¼ |
| | | */ |
| | | private BigDecimal getBigDecimalValue(Map<String, Object> data, String key) { |
| | | Object value = data.get(key); |
| | | if (value == null) { |
| | | return null; |
| | | } |
| | | |
| | | if (value instanceof BigDecimal) { |
| | | return (BigDecimal) value; |
| | | } else if (value instanceof Number) { |
| | | return new BigDecimal(((Number) value).toString()); |
| | | } else if (value instanceof String) { |
| | | try { |
| | | return new BigDecimal((String) value); |
| | | } catch (NumberFormatException e) { |
| | | log.warn("æ æ³å°å¼è½¬æ¢ä¸ºBigDecimal: {}", value); |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | return null; |
| | | } |
| | | } |
| | |
| | | package com.aps.core.service.impl; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.sql.Timestamp; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | import cn.hutool.core.util.IdUtil; |
| | | import com.aps.common.core.utils.DateUtils; |
| | | import com.aps.common.core.utils.poi.ExcelUtil; |
| | | import com.aps.common.security.utils.DictUtils; |
| | | import com.aps.common.security.utils.SecurityUtils; |
| | | import com.aps.core.domain.ApsGasPipelinePrediction; |
| | | import com.aps.core.domain.ApsMaterialProductGroupManagement; |
| | | import com.aps.core.mapper.ApsMaterialProductGroupManagementMapper; |
| | | import com.aps.core.service.IApsMaterialProductGroupManagementService; |
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | | import io.micrometer.common.util.StringUtils; |
| | | import lombok.SneakyThrows; |
| | | import org.apache.poi.ss.usermodel.Row; |
| | | import org.apache.poi.ss.usermodel.Sheet; |
| | | import org.apache.poi.ss.usermodel.Workbook; |
| | | import org.apache.poi.ss.usermodel.WorkbookFactory; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import java.sql.Timestamp; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * ç©æäº§åç»æ°æ®ç®¡çServiceä¸å¡å±å¤ç |
| | | * |
| | | * |
| | | * @author ruoyi |
| | | * @date 2025-05-19 |
| | | */ |
| | | @Service |
| | | public class ApsMaterialProductGroupManagementServiceImpl implements IApsMaterialProductGroupManagementService |
| | | { |
| | | public class ApsMaterialProductGroupManagementServiceImpl implements IApsMaterialProductGroupManagementService { |
| | | @Autowired |
| | | private ApsMaterialProductGroupManagementMapper apsMaterialProductGroupManagementMapper; |
| | | |
| | | /** |
| | | * æ¥è¯¢ç©æäº§åç»æ°æ®ç®¡ç |
| | | * |
| | | * |
| | | * @param id ç©æäº§åç»æ°æ®ç®¡çä¸»é® |
| | | * @return ç©æäº§åç»æ°æ®ç®¡ç |
| | | */ |
| | | @Override |
| | | public ApsMaterialProductGroupManagement selectApsMaterialProductGroupManagementById(Long id) |
| | | { |
| | | public ApsMaterialProductGroupManagement selectApsMaterialProductGroupManagementById(Long id) { |
| | | return apsMaterialProductGroupManagementMapper.selectApsMaterialProductGroupManagementById(id); |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢ç©æäº§åç»æ°æ®ç®¡çå表 |
| | | * |
| | | * |
| | | * @param apsMaterialProductGroupManagement ç©æäº§åç»æ°æ®ç®¡ç |
| | | * @return ç©æäº§åç»æ°æ®ç®¡ç |
| | | */ |
| | | @Override |
| | | public List<ApsMaterialProductGroupManagement> selectApsMaterialProductGroupManagementList(ApsMaterialProductGroupManagement apsMaterialProductGroupManagement) |
| | | { |
| | | public List<ApsMaterialProductGroupManagement> selectApsMaterialProductGroupManagementList(ApsMaterialProductGroupManagement apsMaterialProductGroupManagement) { |
| | | return apsMaterialProductGroupManagementMapper.selectApsMaterialProductGroupManagementList(apsMaterialProductGroupManagement); |
| | | } |
| | | |
| | | /** |
| | | * æ°å¢ç©æäº§åç»æ°æ®ç®¡ç |
| | | * |
| | | * |
| | | * @param apsMaterialProductGroupManagement ç©æäº§åç»æ°æ®ç®¡ç |
| | | * @return ç»æ |
| | | */ |
| | | @Override |
| | | public int insertApsMaterialProductGroupManagement(ApsMaterialProductGroupManagement apsMaterialProductGroupManagement) |
| | | { |
| | | public int insertApsMaterialProductGroupManagement(ApsMaterialProductGroupManagement apsMaterialProductGroupManagement) { |
| | | apsMaterialProductGroupManagement.setId(IdUtil.getSnowflakeNextId()); |
| | | apsMaterialProductGroupManagement.setCreateBy(SecurityUtils.getUsername()); |
| | | apsMaterialProductGroupManagement.setCreateTime(DateUtils.getNowDate()); |
| | |
| | | |
| | | /** |
| | | * ä¿®æ¹ç©æäº§åç»æ°æ®ç®¡ç |
| | | * |
| | | * |
| | | * @param apsMaterialProductGroupManagement ç©æäº§åç»æ°æ®ç®¡ç |
| | | * @return ç»æ |
| | | */ |
| | | @Override |
| | | public int updateApsMaterialProductGroupManagement(ApsMaterialProductGroupManagement apsMaterialProductGroupManagement) |
| | | { |
| | | public int updateApsMaterialProductGroupManagement(ApsMaterialProductGroupManagement apsMaterialProductGroupManagement) { |
| | | apsMaterialProductGroupManagement.setUpdateTime(DateUtils.getNowDate()); |
| | | apsMaterialProductGroupManagement.setUpdateBy(SecurityUtils.getUsername()); |
| | | return apsMaterialProductGroupManagementMapper.updateApsMaterialProductGroupManagement(apsMaterialProductGroupManagement); |
| | |
| | | |
| | | /** |
| | | * æ¹éå é¤ç©æäº§åç»æ°æ®ç®¡ç |
| | | * |
| | | * |
| | | * @param ids éè¦å é¤çç©æäº§åç»æ°æ®ç®¡çä¸»é® |
| | | * @return ç»æ |
| | | */ |
| | | @Override |
| | | public int deleteApsMaterialProductGroupManagementByIds(Long[] ids) |
| | | { |
| | | public int deleteApsMaterialProductGroupManagementByIds(Long[] ids) { |
| | | return apsMaterialProductGroupManagementMapper.deleteApsMaterialProductGroupManagementByIds(ids); |
| | | } |
| | | |
| | | /** |
| | | * å é¤ç©æäº§åç»æ°æ®ç®¡çä¿¡æ¯ |
| | | * |
| | | * |
| | | * @param id ç©æäº§åç»æ°æ®ç®¡çä¸»é® |
| | | * @return ç»æ |
| | | */ |
| | | @Override |
| | | public int deleteApsMaterialProductGroupManagementById(Long id) |
| | | { |
| | | public int deleteApsMaterialProductGroupManagementById(Long id) { |
| | | return apsMaterialProductGroupManagementMapper.deleteApsMaterialProductGroupManagementById(id); |
| | | } |
| | | |
| | | @SneakyThrows |
| | | @Override |
| | | public int batchInsertApsMaterialProductGroupManagement(MultipartFile file) { |
| | | Workbook workbook = WorkbookFactory.create(file.getInputStream()); |
| | | |
| | | Sheet sheet = workbook.getSheetAt(0); |
| | | int rows = sheet.getLastRowNum(); |
| | | if (rows > 0) { |
| | | List<ApsMaterialProductGroupManagement> list = new ArrayList<>(); |
| | | |
| | | /*æ°æ®åä»1å¼å§*/ |
| | | Set<String> keys = new HashSet<>(); |
| | | for (int i = rows; i > 0; --i) { |
| | | Row row = sheet.getRow(i); |
| | | if (row.getCell(0) == null) { |
| | | continue; |
| | | } |
| | | String materialCode = row.getCell(0).getStringCellValue(); |
| | | if (StringUtils.isEmpty(materialCode)){ |
| | | continue; |
| | | } |
| | | String materialType = row.getCell(1).getStringCellValue(); |
| | | String domain = row.getCell(2).getStringCellValue(); |
| | | String isMain = row.getCell(3).getStringCellValue(); |
| | | String factory = row.getCell(4).getStringCellValue(); |
| | | if (StringUtils.isNotBlank(materialType) && |
| | | StringUtils.isNotBlank(domain) && |
| | | StringUtils.isNotBlank(isMain) && |
| | | StringUtils.isNotBlank(factory)) { |
| | | ApsMaterialProductGroupManagement item = new ApsMaterialProductGroupManagement(); |
| | | item.setId(IdUtil.getSnowflakeNextId()); |
| | | item.setFactory(factory); |
| | | item.setDomain(domain); |
| | | item.setMaterialType(materialType); |
| | | item.setMaterialCode(materialCode); |
| | | item.setIsMain(isMain); |
| | | item.setCreateBy(SecurityUtils.getUsername()); |
| | | item.setCreateTime(DateUtils.getNowDate()); |
| | | if (!keys.contains(item.getKey())) { |
| | | keys.add(item.getKey()); |
| | | list.add(item); |
| | | } |
| | | } |
| | | ExcelUtil<ApsMaterialProductGroupManagement> util = new ExcelUtil<>(ApsMaterialProductGroupManagement.class); |
| | | List<ApsMaterialProductGroupManagement> list = util.importExcel(file.getInputStream()); |
| | | DictUtils.CacheValue cacheValue = DictUtils.getCacheValue("aps_factory"); |
| | | DictUtils.CacheValue cacheDomain = DictUtils.getCacheValue("aps_domain"); |
| | | Set<String> keys = new HashSet<>(); |
| | | list.forEach(item -> { |
| | | item.setId(IdUtil.getSnowflakeNextId()); |
| | | item.setDomain(cacheDomain.get(item.getDomain())); |
| | | item.setFactory(cacheValue.get(item.getFactory())); |
| | | item.setCreateBy(SecurityUtils.getUsername()); |
| | | item.setCreateTime(DateUtils.getNowDate()); |
| | | }); |
| | | for (int i = list.size() - 1; i >= 0; --i) { |
| | | list.get(i).setKey(null); |
| | | if (!keys.contains(list.get(i).getKey())) { |
| | | keys.add(list.get(i).getKey()); |
| | | } else { |
| | | list.remove(i); |
| | | } |
| | | if (!list.isEmpty()) { |
| | | Set<String> facCodeKey = apsMaterialProductGroupManagementMapper.selectByFacOrMaterial(keys); |
| | | if (!facCodeKey.isEmpty()) { |
| | | Iterator<ApsMaterialProductGroupManagement> it = list.iterator(); |
| | | while (it.hasNext()) { |
| | | ApsMaterialProductGroupManagement item = it.next(); |
| | | if (facCodeKey.contains(item.getKey())) { |
| | | LambdaUpdateWrapper<ApsMaterialProductGroupManagement> wrapper = new LambdaUpdateWrapper<>(); |
| | | wrapper.eq(ApsMaterialProductGroupManagement::getFactory, item.getFactory()); |
| | | wrapper.eq(ApsMaterialProductGroupManagement::getMaterialCode, item.getMaterialCode()); |
| | | item.setCreateBy(null); |
| | | item.setCreateTime(null); |
| | | item.setUpdateBy(SecurityUtils.getUsername()); |
| | | item.setUpdateTime(new Timestamp(System.currentTimeMillis())); |
| | | apsMaterialProductGroupManagementMapper.update(item, wrapper); |
| | | it.remove(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | if (!list.isEmpty()) { |
| | | apsMaterialProductGroupManagementMapper.insert(list); |
| | | } |
| | | } |
| | | return list.size(); |
| | | } |
| | | return 0; |
| | | |
| | | if (!list.isEmpty()) { |
| | | Set<String> facCodeKey = apsMaterialProductGroupManagementMapper.selectByFacOrMaterial(keys); |
| | | if (!facCodeKey.isEmpty()) { |
| | | Iterator<ApsMaterialProductGroupManagement> it = list.iterator(); |
| | | while (it.hasNext()) { |
| | | ApsMaterialProductGroupManagement item = it.next(); |
| | | if (facCodeKey.contains(item.getKey())) { |
| | | LambdaUpdateWrapper<ApsMaterialProductGroupManagement> wrapper = new LambdaUpdateWrapper<>(); |
| | | wrapper.eq(ApsMaterialProductGroupManagement::getFactory, item.getFactory()); |
| | | wrapper.eq(ApsMaterialProductGroupManagement::getMaterialCode, item.getMaterialCode()); |
| | | item.setCreateBy(null); |
| | | item.setCreateTime(null); |
| | | item.setId(null); |
| | | item.setUpdateBy(SecurityUtils.getUsername()); |
| | | item.setUpdateTime(new Timestamp(System.currentTimeMillis())); |
| | | apsMaterialProductGroupManagementMapper.update(item, wrapper); |
| | | it.remove(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | if (!list.isEmpty()) { |
| | | apsMaterialProductGroupManagementMapper.insert(list); |
| | | } |
| | | } |
| | | return list.size(); |
| | | |
| | | } |
| | | } |
| | |
| | | import com.aps.core.domain.ApsMaterialStorageManagement; |
| | | import com.aps.core.mapper.ApsMaterialStorageManagementMapper; |
| | | import com.aps.core.service.IApsMaterialStorageManagementService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.redis.core.RedisTemplate; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | * @date 2025-04-17 |
| | | */ |
| | | @Service |
| | | @Slf4j |
| | | public class ApsMaterialStorageManagementServiceImpl implements IApsMaterialStorageManagementService |
| | | { |
| | | @Autowired |
| | |
| | | @Override |
| | | public boolean setStorageDataToRedis(String orgCode) { |
| | | try { |
| | | log.info("å¼å§åæ¥ ç©æåºåè³Redis!"); |
| | | Set<String> keys = redisTemplate.keys("MaterialStorage:Material_*"); |
| | | if (keys != null && !keys.isEmpty()) { |
| | | redisTemplate.delete(keys); |
| | |
| | | bulkData.put("MaterialStorage:Material_"+apsMaterialStorageManagement.getApplicableFactories()+"_"+apsMaterialStorageManagement.getItemNumber(), jsonObject); |
| | | }); |
| | | redisTemplate.opsForValue().multiSet(bulkData); |
| | | log.info("宿忥 ç©æåºåè³Redis!"); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | log.error("åæ¥ç©æåºåè³Redis失败!"+e.getMessage()); |
| | | return false; |
| | | } |
| | | // Set<String> keys = redisTemplate.keys("MaterialStorage:Material_*"); |
| | | // if (keys != null && !keys.isEmpty()) { |
| | | // redisTemplate.delete(keys); |
| | | // } |
| | | return true; |
| | | } |
| | | |
| | |
| | | package com.aps.core.service.impl; |
| | | |
| | | import cn.hutool.core.util.IdUtil; |
| | | import com.aps.common.core.domain.R; |
| | | import com.aps.common.core.utils.DateUtils; |
| | | import com.aps.common.core.web.domain.AjaxResult; |
| | | import com.aps.common.redis.service.RedisLockUtils; |
| | |
| | | import com.aps.core.enums.PLAN_TASK_TYPE; |
| | | import com.aps.core.enums.REDIS_LOCK_KEY; |
| | | import com.aps.core.mapper.ApsPlateStandardRequireOrderEndDayMapper; |
| | | import com.aps.core.service.ApsPlate.IApsPlateProcessShopStatService; |
| | | import com.aps.core.service.ApsPlate.IApsPlateStandardRequireBatchService; |
| | | import com.aps.core.service.ApsPlate.IApsPlateStandardRequireService; |
| | | import com.aps.core.service.ApsPlateStandardRequireOrderEndDayService; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | |
| | | |
| | | import static com.aps.common.core.web.domain.AjaxResult.success; |
| | | import static com.aps.core.enums.REDIS_LOCK_KEY.PLATE_ORDER_PLAN; |
| | | |
| | | |
| | | /** |
| | | * @author zhl |
| | |
| | | |
| | | @Resource |
| | | ApsPlateStandardRequireOrderEndDayMapper orderEndDayMapper; |
| | | |
| | | @Resource |
| | | IApsPlateProcessShopStatService plateProcessShopStatService; |
| | | |
| | | @Override |
| | | public Page<ApsPlanTask> pagingList(Page<ApsPlanTask> page ,ApsPlanTask task){ |
| | |
| | | } |
| | | |
| | | @Override |
| | | public AjaxResult generatorPlan() |
| | | { |
| | | public AjaxResult generatorPlan() { |
| | | String plateOrderPlanKey = PLATE_ORDER_PLAN.getKey(); |
| | | boolean existsLock = redisLockUtils.existLock(plateOrderPlanKey, PLAN_TASK_TYPE.PLATE_PLAN.getCode()); |
| | | if (existsLock){ |
| | | if (existsLock) { |
| | | return AjaxResult.warn("é£éå·¥å计å任塿£å¨æ§è¡ä¸!"); |
| | | } |
| | | LambdaQueryWrapper<ApsPlanTask> queryWrapper=new LambdaQueryWrapper<>(); |
| | | queryWrapper.eq(ApsPlanTask::getTaskType,PLAN_TASK_TYPE.PLATE_PLAN.getCode()); |
| | | queryWrapper.eq(ApsPlanTask::getTaskStatus,PLAN_TASK_STATUS.IN_PROCESS.getCode()); |
| | | LambdaQueryWrapper<ApsPlanTask> queryWrapper = new LambdaQueryWrapper<>(); |
| | | queryWrapper.eq(ApsPlanTask::getTaskType, PLAN_TASK_TYPE.PLATE_PLAN.getCode()); |
| | | queryWrapper.eq(ApsPlanTask::getTaskStatus, PLAN_TASK_STATUS.IN_PROCESS.getCode()); |
| | | boolean existsDbTask = mapper.exists(queryWrapper); |
| | | if (existsDbTask){ |
| | | if (existsDbTask) { |
| | | return AjaxResult.warn("é£éå·¥å计å任塿£å¨æ§è¡ä¸!!"); |
| | | } |
| | | String currentBatchNum = requireBatchService.getNewBatchNumber(); |
| | | try { |
| | | redisLockUtils.getLock(plateOrderPlanKey,PLAN_TASK_TYPE.PLATE_PLAN.getCode(), 3*60L); |
| | | String batchNum= requireBatchService.getNewBatchNumber(); |
| | | this.savePlanTask(batchNum); |
| | | apsPlateStandardRequireService.generatorPlan(batchNum); |
| | | this.updateTaskStatus(batchNum, PLAN_TASK_STATUS.FINISHED); |
| | | redisLockUtils.getLock(plateOrderPlanKey, PLAN_TASK_TYPE.PLATE_PLAN.getCode(), 15 * 60L); |
| | | this.savePlanTask(currentBatchNum); |
| | | //Thread.sleep(60*1000); |
| | | apsPlateStandardRequireService.generatorPlan(currentBatchNum); |
| | | /*æ¸
é¤å·²ç»åå¨ç å·¥å计åå®å·¥æ¶é´*/ |
| | | orderEndDayMapper.batchRemove(); |
| | | log.info("计å任塿§è¡å®æ!"+batchNum); |
| | | this.updateTaskStatus(currentBatchNum, PLAN_TASK_STATUS.FINISHED); |
| | | log.info("计å任塿§è¡å®æ!" + currentBatchNum); |
| | | return success(); |
| | | }catch (Exception e){ |
| | | redisLockUtils.releaseLock(plateOrderPlanKey,PLAN_TASK_TYPE.PLATE_PLAN.getCode()); |
| | | log.error("计å任塿§è¡å¤±è´¥!"+e.getMessage()); |
| | | return AjaxResult.error("计å任塿§è¡å¤±è´¥!"+e.getMessage()); |
| | | }finally { |
| | | redisLockUtils.releaseLock(plateOrderPlanKey,PLAN_TASK_TYPE.PLATE_PLAN.getCode()); |
| | | } catch (Exception e) { |
| | | redisLockUtils.releaseLock(plateOrderPlanKey, PLAN_TASK_TYPE.PLATE_PLAN.getCode()); |
| | | log.error("计å任塿§è¡å¤±è´¥!" + e.getMessage()); |
| | | this.updateTaskStatus(currentBatchNum, PLAN_TASK_STATUS.ERROR); |
| | | return AjaxResult.error("计å任塿§è¡å¤±è´¥!" + e.getMessage()); |
| | | } finally { |
| | | redisLockUtils.releaseLock(plateOrderPlanKey, PLAN_TASK_TYPE.PLATE_PLAN.getCode()); |
| | | } |
| | | } |
| | | @Override |
| | | public AjaxResult generatorPlatePlanTable() { |
| | | String plateOrderPlanKey = REDIS_LOCK_KEY.PLATE_SHOP_PLAN_TABLE.getKey(); |
| | | boolean existsLock = redisLockUtils.existLock(plateOrderPlanKey, PLAN_TASK_TYPE.PLATE_SHOP_PLAN_TABLE.getCode()); |
| | | if (existsLock) { |
| | | return AjaxResult.warn("é£é计å大表计å任塿£å¨æ§è¡ä¸!"); |
| | | } |
| | | LambdaQueryWrapper<ApsPlanTask> queryWrapper = new LambdaQueryWrapper<>(); |
| | | queryWrapper.eq(ApsPlanTask::getTaskType, PLAN_TASK_TYPE.PLATE_SHOP_PLAN_TABLE.getCode()); |
| | | queryWrapper.eq(ApsPlanTask::getTaskStatus, PLAN_TASK_STATUS.IN_PROCESS.getCode()); |
| | | boolean existsDbTask = mapper.exists(queryWrapper); |
| | | if (existsDbTask) { |
| | | return AjaxResult.warn("é£é计åå¤§è¡¨ä»»å¡æ£å¨æ§è¡ä¸!!"); |
| | | } |
| | | String currentBatchNum = String.valueOf(IdUtil.getSnowflakeNextId()) ; |
| | | try { |
| | | redisLockUtils.getLock(plateOrderPlanKey, PLAN_TASK_TYPE.PLATE_SHOP_PLAN_TABLE.getCode(), 15 * 60L); |
| | | this.savePlanTask( currentBatchNum); |
| | | Thread.sleep(60000); |
| | | plateProcessShopStatService.saveShopStat(); |
| | | this.updateTaskStatus(currentBatchNum, PLAN_TASK_STATUS.FINISHED); |
| | | log.info("é£é计åå¤§è¡¨ä»»å¡æ§è¡å®æ!" + currentBatchNum); |
| | | return success(); |
| | | } catch (Exception e) { |
| | | redisLockUtils.releaseLock(plateOrderPlanKey, PLAN_TASK_TYPE.PLATE_SHOP_PLAN_TABLE.getCode()); |
| | | log.error("é£é计åå¤§è¡¨ä»»å¡æ§è¡å¤±è´¥!" + e.getMessage()); |
| | | this.updateTaskStatus(currentBatchNum, PLAN_TASK_STATUS.ERROR); |
| | | return AjaxResult.error("é£é计åå¤§è¡¨ä»»å¡æ§è¡å¤±è´¥!" + e.getMessage()); |
| | | } finally { |
| | | redisLockUtils.releaseLock(plateOrderPlanKey, PLAN_TASK_TYPE.PLATE_SHOP_PLAN_TABLE.getCode()); |
| | | } |
| | | } |
| | | |
| | |
| | | import com.aps.core.mapper.ApsPlatePlanTempMapper; |
| | | import com.aps.core.service.ApsPlate.IApsPlatePlanService; |
| | | import com.aps.system.api.domain.SysDictData; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.logging.log4j.util.Strings; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | * @author ruoyi |
| | | * @date 2025-04-08 |
| | | */ |
| | | @Slf4j |
| | | @Service |
| | | public class ApsPlatePlanServiceImpl implements IApsPlatePlanService |
| | | { |
| | |
| | | @Override |
| | | public boolean setSubPlansToRedis() { |
| | | try { |
| | | log.info("å¼å§è®¾ç½®é£éå计åå°redis"); |
| | | Set<String> keys = redisTemplate.keys("PLATE_SUB_PLAN:*"); |
| | | if (keys != null && !keys.isEmpty()) { |
| | | redisTemplate.delete(keys); |
| | |
| | | bulkData.put("PLATE_SUB_PLAN:"+key, value); |
| | | } |
| | | redisTemplate.opsForValue().multiSet(bulkData); |
| | | log.info("设置é£éå计åå°redis宿"); |
| | | return true; |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | log.error("设置é£éå计åå°redis失败"+e.getMessage()); |
| | | return false; |
| | | } |
| | | } |
| | |
| | | import java.util.concurrent.atomic.AtomicInteger; |
| | | import java.util.stream.Collectors; |
| | | |
| | | import cn.hutool.core.collection.ListUtil; |
| | | import cn.hutool.core.util.IdUtil; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.alibaba.fastjson2.JSON; |
| | | import com.alibaba.nacos.common.utils.JacksonUtils; |
| | |
| | | import com.aps.core.domain.ApsPlate.ApsPlateProcessShopStat; |
| | | import com.aps.core.domain.ApsPlate.ApsPlateProcessStat; |
| | | import com.aps.core.mapper.*; |
| | | import com.aps.core.service.ApsPlate.IApsPlateProcessStatService; |
| | | import com.aps.system.api.domain.SysDictData; |
| | | import com.fasterxml.jackson.databind.ObjectMapper; |
| | | import com.fasterxml.jackson.databind.node.ObjectNode; |
| | |
| | | |
| | | @Resource |
| | | private ApsPlatePlanMapper apsPlatePlanMapper; |
| | | @Autowired |
| | | private IApsPlateProcessStatService apsPlateProcessStatService; |
| | | |
| | | |
| | | |
| | | /** |
| | |
| | | /** |
| | | * ä¿åé£é车é´ç»è®¡ |
| | | */ |
| | | @Transactional |
| | | @Transactional( rollbackFor =Exception.class) |
| | | @Override |
| | | public void saveShopStat() { |
| | | try { |
| | | // å¼å§ä¹åå
å 餿æå岿°æ® |
| | | // å®ä¹è¯¥åè½ä½¿ç¨æ°æ®æºä¸ºåéçå·¥å |
| | | final String plant = "FORTUNA"; |
| | | final String major="BJ"; |
| | | // æ¥è¯¢ç¸å
³æ°æ® |
| | | ApsPlatePlan platePlan = new ApsPlatePlan(); |
| | | platePlan.setPlant(plant); |
| | | log.info("å¼å§æ§è¡é£é计å大表"); |
| | | List<ApsPlatePlan> planList = apsPlatePlanMapper.selectApsPlatePlanList(platePlan); |
| | | |
| | | ApsShop apsShop = new ApsShop(); |
| | | apsShop.setPlantCode(plant); |
| | | List<ApsShop> shopList = shopMapper.selectApsShopList(apsShop); |
| | | |
| | | ApsStandardProcess process = new ApsStandardProcess(); |
| | | process.setPlant(plant); |
| | | process.setMajor(major); |
| | | |
| | | List<ApsStandardProcess> shopProcesses = standardProcessMapper.selectApsStandardProcessList(process); |
| | | |
| | | if (!planList.isEmpty() && !shopList.isEmpty() && !shopProcesses.isEmpty()) { |
| | | |
| | | log.info("é£é计å大表ï¼å 餿æå岿°æ®"); |
| | | apsPlateProcessStatMapper.deleteAll(); |
| | | apsPlateProcessShopStatMapper.deleteAll(); |
| | | |
| | | // å®ä¹è¯¥åè½ä½¿ç¨æ°æ®æºä¸ºåéçå·¥å |
| | | final String plant = "FORTUNA"; |
| | | final String major="é£é"; |
| | | // æ¥è¯¢ç¸å
³æ°æ® |
| | | ApsPlatePlan platePlan = new ApsPlatePlan(); |
| | | platePlan.setPlant(plant); |
| | | List<ApsPlatePlan> planList = apsPlatePlanMapper.selectApsPlatePlanList(platePlan); |
| | | |
| | | List<ApsPlateProcessStat> statList = apsPlateProcessStatMapper.selectApsPlateProcessStatList(new ApsPlateProcessStat()); |
| | | |
| | | ApsShop apsShop = new ApsShop(); |
| | | apsShop.setPlantCode(plant); |
| | | List<ApsShop> shopList = shopMapper.selectApsShopList(apsShop); |
| | | |
| | | ApsStandardProcess process = new ApsStandardProcess(); |
| | | process.setPlant(plant); |
| | | process.setMajor(major); |
| | | List<ApsStandardProcess> shopProcesses = standardProcessMapper.selectApsStandardProcessList(process); |
| | | if (planList.isEmpty() || shopList.isEmpty() || shopProcesses.isEmpty()) { |
| | | log.warn("计åå表ã车é´å表æå·¥åºåè¡¨ä¸ºç©ºï¼æ æ³çæç»è®¡ä¿¡æ¯"); |
| | | return; |
| | | } |
| | | // æå»ºè½¦é´åç§°å°å·¥åºåç§°çæ å° |
| | | Map<String, List<String>> shopToProcessNames = shopProcesses.stream() |
| | | log.info("é£é计åå¤§è¡¨ï¼æ¨ç®åæé£éå·¥åºè®¡åå®å·¥æ¥æå计åå¼å·¥æ¶é´"); |
| | | List<ApsPlateProcessStat> statList =apsPlateProcessStatService.computePlateProcessStat(); |
| | | // æå»ºè½¦é´åç§°å°å·¥åºåç§°çæ å° |
| | | Map<String, List<String>> shopToProcessNames = shopProcesses.stream().filter(x -> null!=x.getWorkShop()) |
| | | .collect(Collectors.groupingBy(ApsStandardProcess::getWorkShop, |
| | | Collectors.mapping(ApsStandardProcess::getProcessName, Collectors.toList()) |
| | | )); |
| | | // æ¹éæå
¥ç»è®¡æ°æ® |
| | | log.info("é£é计å大表ï¼è®¡ç®æ¯ä¸ªå·¥å䏿¯ä¸ªè½¦é´çå¼å§ãç»ææ¶é´"); |
| | | List<ApsPlateProcessShopStat> statsToInsert = new ArrayList<>(); |
| | | for (ApsPlatePlan plan : planList) { |
| | | for (ApsShop shop : shopList) { |
| | | log.info("é£é计å大表V1ï¼å¼å§è®¡ç®æ¯ä¸ªå·¥å车é´å·¥æ¶"); |
| | | planList.stream().parallel().forEach(plan -> { |
| | | shopList.stream().parallel().forEach(shop -> { |
| | | ApsPlateProcessShopStat stat = createShopStat(plan, shop, shopToProcessNames, statList); |
| | | statsToInsert.add(stat); |
| | | } |
| | | }); |
| | | }); |
| | | log.info("é£é计åå¤§è¡¨ï¼æ¹éä¿åå·¥åºå¼å·¥åå®å·¥æ¶é´"); |
| | | List<List<ApsPlateProcessStat>> processStatBatchList = ListUtil.split(statList, 1000); |
| | | processStatBatchList.stream().parallel().forEach(batch -> apsPlateProcessStatMapper.batchInsertPlateStat(batch)); |
| | | |
| | | |
| | | log.info("é£é计åå¤§è¡¨ï¼æ¹éä¿åå·¥å-è½¦é´æ¶é´ä¿¡æ¯"); |
| | | List<List<ApsPlateProcessShopStat>> shopStatBatchList = ListUtil.split(statsToInsert, 1000); |
| | | shopStatBatchList.stream().parallel().forEach(batch -> apsPlateProcessShopStatMapper.batchInsert(batch)); |
| | | }else { |
| | | if(shopProcesses.isEmpty()){ |
| | | log.error("é£é计åå¤§è¡¨ï¼æªæ¾å°æ åå·¥åºæ°æ®ï¼"); |
| | | throw new RuntimeException("æªæ¾å°æ åå·¥åºæ°æ®ï¼"); |
| | | } |
| | | // æ¹éæå
¥ä»¥æé«æ§è½ |
| | | if (!statsToInsert.isEmpty()) { |
| | | int batchSize = 1000; |
| | | for (int i = 0; i < statsToInsert.size(); i += batchSize) { |
| | | int end = Math.min(i + batchSize, statsToInsert.size()); |
| | | List<ApsPlateProcessShopStat> batch = statsToInsert.subList(i, end); |
| | | apsPlateProcessShopStatMapper.batchInsert(batch); |
| | | } |
| | | if(shopList.isEmpty()){ |
| | | log.error("é£é计åå¤§è¡¨ï¼æªæ¾å°è½¦é´æ°æ®ï¼"); |
| | | throw new RuntimeException("æªæ¾å°è½¦é´æ°æ®ï¼"); |
| | | } |
| | | } catch (Exception e) { |
| | | log.error("ä¿åé£é车é´ç»è®¡æ¶åçå¼å¸¸", e); |
| | | throw new RuntimeException("ä¿åé£é车é´ç»è®¡å¤±è´¥", e); |
| | | if(planList.isEmpty()){ |
| | | log.error("é£é计åå¤§è¡¨ï¼æªæ¾å°å·¥åæ°æ®ï¼"); |
| | | throw new RuntimeException("æªæ¾å°å·¥åæ°æ®ï¼"); |
| | | } |
| | | } |
| | | log.info("é£é计å大表ï¼å®æ"); |
| | | } |
| | | |
| | | /** |
| | |
| | | stat.setWorkCenter(plan.getWorkCenter()); |
| | | stat.setProcessNumber(plan.getProcessNumber()); |
| | | try { |
| | | |
| | | |
| | | List<String> processNames = shopToProcessNames.getOrDefault(shopName, Collections.emptyList()); |
| | | if (!processNames.isEmpty()) { |
| | |
| | | } |
| | | } |
| | | } catch (Exception e) { |
| | | log.error("computer error:"+ JSONObject.toJSONString(stat)); |
| | | log.error("é£é计å大表 error:"+ JSONObject.toJSONString(stat)); |
| | | throw new RuntimeException("计ç®è½¦é´ç»è®¡æ°æ®å¼å¸¸ï¼"); |
| | | } |
| | | return stat; |
| | | } |
| | |
| | | List<SysDictData> documentStatusDic = DictUtils.getDictCache("aps_document_status"); |
| | | |
| | | // æå»ºç»æå表 |
| | | planList.forEach( |
| | | planList.stream().parallel().forEach( |
| | | plan -> { |
| | | // æ ¹æ® docNo è·å对åºç shopStatList |
| | | List<ApsPlateProcessShopStat> shopStatList = shopStatesByDocNo.getOrDefault(plan.getDocumentNumber(), Collections.emptyList()); |
| | |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.*; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | import cn.hutool.core.util.IdUtil; |
| | | import com.aps.common.core.utils.uuid.IdUtils; |
| | | import com.aps.common.security.utils.SecurityUtils; |
| | | import com.aps.core.domain.ApsPlate.ApsPlateStandardRequireBomOrderDetail; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import com.aps.core.mapper.ApsPlateProcessStatMapper; |
| | |
| | | /** |
| | | * ä¿åé£éç»è®¡æ°æ® |
| | | */ |
| | | @Transactional |
| | | @Override |
| | | public void savePlateProcessStat() { |
| | | public List<ApsPlateProcessStat> computePlateProcessStat() { |
| | | String batchNum = IdUtils.fastSimpleUUID(); |
| | | List<ApsPlateProcessStat> tempList = apsPlateProcessStatMapper.queryTempStat(); |
| | | Map<String, List<ApsPlateProcessStat>> groupByOrderNo = tempList.stream().collect(groupingBy(ApsPlateProcessStat::getWorkOrderNo)); |
| | | Boolean hasBefore = false; |
| | | |
| | | LocalDateTime now = LocalDateTime.now(); |
| | | for (Map.Entry<String, List<ApsPlateProcessStat>> entry : groupByOrderNo.entrySet()) { |
| | | List<ApsPlateProcessStat> statPerOrder = entry.getValue(); |
| | | List<ApsPlateProcessStat> totalList=new ArrayList<>(); |
| | | ArrayList<Map.Entry<String, List<ApsPlateProcessStat>>> orderProcessRoutes = new ArrayList<>(groupByOrderNo.entrySet()); |
| | | orderProcessRoutes.stream().parallel().forEach(x->{ |
| | | boolean hasBefore = false; |
| | | List<ApsPlateProcessStat> statPerOrder = x.getValue(); |
| | | /*num ä¸ºæ ¹æ®å®å·¥æ¶é´æåºåºçåºå·ï¼ææ¤æåºï¼å¯ä¿è¯æ¯æå®å·¥æ¶é´ååæå*/ |
| | | statPerOrder.sort((a, b)->a.getNum().compareTo(b.getNum())); |
| | | ApsPlateProcessStat last=null; |
| | |
| | | } |
| | | } |
| | | last = stat; |
| | | apsPlateProcessStatMapper.insertApsPlateProcessStat(stat); |
| | | totalList.add(stat); |
| | | } |
| | | hasBefore=false; |
| | | |
| | | } |
| | | apsPlateProcessStatMapper.removeOtherStat(batchNum); |
| | | |
| | | }); |
| | | return totalList; |
| | | } |
| | | |
| | | |
| | |
| | | |
| | | @Transactional |
| | | @Override |
| | | public void initRequireBatch() { |
| | | ApsPlateStandardRequireBatch batch=apsPlateStandardRequireBatchMapper.selectLastRequireBatch(); |
| | | if (batch!=null){ |
| | | String batchNumber = batch.getBatchNumber(); |
| | | apsPlateStandardRequireMapper.deleteLastPatch(batchNumber); |
| | | apsPlateStandardRequireBomOrderDetailMapper.deleteLastPatch(batchNumber); |
| | | apsPlateStandardRequireBomStockDetailMapper.deleteLastPatch(batchNumber); |
| | | apsPlateStandardRequireErrorMapper.deleteLastPatch(batchNumber); |
| | | apsPlatePlanMapper.initUnMatchQty(); |
| | | apsMaterialStorageManagementMapper.initRemainderStock(); |
| | | } |
| | | public void initRequireBatch(String currentBatchNumber) { |
| | | apsPlateStandardRequireMapper.deleteLastPatch(currentBatchNumber); |
| | | apsPlateStandardRequireBomOrderDetailMapper.deleteLastPatch(currentBatchNumber); |
| | | apsPlateStandardRequireBomStockDetailMapper.deleteLastPatch(currentBatchNumber); |
| | | apsPlateStandardRequireErrorMapper.deleteLastPatch(currentBatchNumber); |
| | | apsPlatePlanMapper.initUnMatchQty(); |
| | | apsMaterialStorageManagementMapper.initRemainderStock(); |
| | | } |
| | | } |
| | |
| | | package com.aps.core.service.impl.ApsPlate; |
| | | |
| | | import java.util.List; |
| | | |
| | | import cn.hutool.core.util.IdUtil; |
| | | import com.aps.common.core.utils.DateUtils; |
| | | import com.aps.common.security.utils.SecurityUtils; |
| | | import com.aps.core.domain.ApsPlate.ApsPlateStandardRequire; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import com.aps.core.mapper.ApsPlateStandardRequireErrorMapper; |
| | |
| | | { |
| | | return apsPlateStandardRequireErrorMapper.deleteApsPlateStandardRequireErrorById(id); |
| | | } |
| | | |
| | | @Override |
| | | public void saveRequireError(ApsPlateStandardRequire require, String message) { |
| | | ApsPlateStandardRequireError data = ApsPlateStandardRequireError.builder() |
| | | .id(IdUtil.getSnowflakeNextId()) |
| | | .requireId(require.getId()) |
| | | .batchNumber(require.getBatchNumber()) |
| | | .docNum(require.getDocNum()) |
| | | .itemNum(require.getBomLineCode()) |
| | | .orgCode(require.getOrgCode()) |
| | | .message(message) |
| | | .delFlag("0") |
| | | .build(); |
| | | data.setCreateBy(SecurityUtils.getUsername()); |
| | | data.setCreateTime(DateUtils.getNowDate()); |
| | | apsPlateStandardRequireErrorMapper.insertApsPlateStandardRequireError(data); |
| | | } |
| | | } |
| | |
| | | package com.aps.core.service.impl.ApsPlate; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.*; |
| | | |
| | | import cn.hutool.core.util.IdUtil; |
| | | import com.aps.common.core.utils.DateUtils; |
| | | import com.aps.common.security.utils.DictUtils; |
| | | import com.aps.common.security.utils.SecurityUtils; |
| | | import com.aps.core.domain.*; |
| | | import com.aps.core.domain.ApsPlate.ApsPlatePlan; |
| | | import com.aps.core.domain.ApsPlate.ApsPlateStandardRequireBomOrderDetail; |
| | | import com.aps.core.domain.ApsPlate.ApsPlateStandardRequireBomStockDetail; |
| | | import com.aps.core.domain.ApsBom; |
| | | import com.aps.core.domain.ApsMaterialStorageManagement; |
| | | import com.aps.core.domain.ApsPlate.*; |
| | | import com.aps.core.domain.ApsStandardProcessRouteLine; |
| | | import com.aps.core.mapper.*; |
| | | import com.aps.core.service.*; |
| | | import com.aps.core.service.ApsPlate.*; |
| | | import com.aps.core.service.IApsBomService; |
| | | import com.aps.core.service.IApsMaterialStorageManagementService; |
| | | import com.aps.core.service.IApsStandardProcessRouteLineService; |
| | | import com.aps.system.api.domain.SysDictData; |
| | | import jakarta.annotation.Resource; |
| | | import com.aps.core.domain.ApsPlate.ApsPlateStandardRequire; |
| | | import com.aps.core.mapper.ApsPlateStandardRequireMapper; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.util.List; |
| | | import java.math.BigDecimal; |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * é£éå·¥åæ åéæ±Serviceä¸å¡å±å¤ç |
| | |
| | | private ApsPlateStandardRequireMapper apsPlateStandardRequireMapper; |
| | | |
| | | @Resource |
| | | private ApsPlateStandardRequireBatchMapper requireBatchMapper; |
| | | |
| | | @Resource |
| | | ApsPlatePlanMapper platePlanMapper; |
| | | |
| | | @Resource |
| | | ApsBomHeaderMapper bomHeaderMapper; |
| | | @Resource |
| | | IApsBomService bomLineService; |
| | | |
| | | @Resource |
| | | ApsMaterialStorageManagementMapper itemStorageMapper; |
| | | |
| | | @Resource |
| | | ApsPlateStandardRequireBomStockDetailMapper plateBomStockDetailMapper; |
| | | |
| | | @Resource |
| | | IApsPlateStandardRequireBomStockDetailService bomStockDetailService; |
| | | @Resource |
| | | ApsStandardProcessRouteHeaderMapper standardProcessRouteHeaderMapper; |
| | | |
| | | @Resource |
| | | ApsStandardProcessRouteLineMapper ApsStandardProcessRouteLineMapper; |
| | | |
| | | @Resource |
| | | ApsPlateStandardRequireBomOrderDetailMapper plateBomOrderDetailMapper; |
| | |
| | | IApsStandardProcessRouteLineService routeLineService; |
| | | |
| | | @Resource |
| | | IApsPlateStandardRequireBatchService requireBatchService; |
| | | IApsPlateStandardRequireErrorService requireErrorService; |
| | | @Resource |
| | | private IApsMaterialStorageManagementService storageManagementService; |
| | | |
| | | @Resource |
| | | IApsPlateStandardRequireBatchService requireBatchService; |
| | | /** |
| | | * æ¥è¯¢é£éå·¥åæ åéæ± |
| | | * |
| | |
| | | @Transactional |
| | | @Override |
| | | public void generatorPlan(String batchNum){ |
| | | |
| | | /*åå§åæ°æ®*/ |
| | | requireBatchService.initRequireBatch(); |
| | | requireBatchService.initRequireBatch(batchNum); |
| | | /*å®ä¹å·¥å为åé */ |
| | | String plantCode="FORTUNA"; |
| | | /*è·åé£é主åä¿¡æ¯*/ |
| | |
| | | if (itemStorageOpt.isPresent()) { |
| | | |
| | | ApsMaterialStorageManagement itemStorage=itemStorageOpt.get(); |
| | | BigDecimal remainderStock =itemStorage.getRemainderStock(); |
| | | BigDecimal remainderStock =BigDecimal.ZERO; |
| | | if(null!=itemStorage.getRemainderStock()){ |
| | | remainderStock = itemStorage.getRemainderStock(); |
| | | } |
| | | /*计ç®åéæ± é»è®¤=éæ±æ°é*/ |
| | | if (remainderStock.compareTo(BigDecimal.ZERO) == 0) { |
| | | require.setNetRequirement(require.getBomUseAmount()); |
| | |
| | | package com.aps.core.service.impl; |
| | | |
| | | import java.util.List; |
| | | import java.util.Set; |
| | | |
| | | import com.aps.common.core.utils.DateUtils; |
| | | import com.aps.common.core.utils.uuid.IdUtils; |
| | | import com.aps.common.security.utils.SecurityUtils; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import org.jetbrains.annotations.NotNull; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import com.aps.core.mapper.ApsShopMapper; |
| | |
| | | { |
| | | return apsShopMapper.deleteApsShopById(id); |
| | | } |
| | | |
| | | @Override |
| | | public List<ApsShop> findAllShops() { |
| | | return apsShopMapper.selectList(new QueryWrapper<>()); |
| | | } |
| | | |
| | | @Override |
| | | public List<ApsShop> findShopByFactory(String orgCode) { |
| | | return apsShopMapper.selectApsByFactory(orgCode); |
| | | } |
| | | |
| | | @Override |
| | | public List<ApsShop> findShopByCodes(@NotNull Set<String> codes) { |
| | | return apsShopMapper.selectByCodes(codes); |
| | | } |
| | | } |
| | |
| | | import com.aps.core.domain.ApsStandardProcessRouteHeader; |
| | | import com.aps.core.mapper.ApsStandardProcessRouteHeaderMapper; |
| | | import com.aps.core.service.IApsStandardProcessRouteHeaderService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.redis.core.RedisTemplate; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | * @date 2025-05-06 |
| | | */ |
| | | @Service |
| | | @Slf4j |
| | | public class ApsStandardProcessRouteHeaderServiceImpl implements IApsStandardProcessRouteHeaderService |
| | | { |
| | | @Autowired |
| | |
| | | @Override |
| | | public boolean setProcessRouteDataToRedis(String orgCode) { |
| | | try { |
| | | log.info("å¼å§åæ¥æ åå·¥èºè·¯çº¿æ°æ®è³Redis"); |
| | | Set<String> keys = redisTemplate.keys("ROUTE:ROUTE_*"); |
| | | if (keys != null && !keys.isEmpty()) { |
| | | redisTemplate.delete(keys); |
| | |
| | | bulkData.put("ROUTE:ROUTE_"+jsonObject.getString("org_code")+"_"+jsonObject.getString("item_code"), jsonObject.getBigDecimal("standardtime")); |
| | | } |
| | | redisTemplate.opsForValue().multiSet(bulkData); |
| | | log.info("宿忥æ åå·¥èºè·¯çº¿æ°æ®è³Redis"); |
| | | return true; |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | log.error("忥æ åå·¥èºè·¯çº¿æ°æ®è³Redis失败"+e.getMessage()); |
| | | return false; |
| | | } |
| | | } |
| | |
| | | import com.aps.core.domain.ApsStandardProcessRouteHeader; |
| | | import com.aps.core.mapper.ApsPlateStandardRequireErrorMapper; |
| | | import com.aps.core.mapper.ApsStandardProcessRouteHeaderMapper; |
| | | import com.aps.core.service.ApsPlate.IApsPlateStandardRequireErrorService; |
| | | import jakarta.annotation.Resource; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.redis.core.RedisTemplate; |
| | |
| | | @Resource |
| | | ApsStandardProcessRouteHeaderMapper standardProcessRouteHeaderMapper; |
| | | @Resource |
| | | ApsPlateStandardRequireErrorMapper requireErrorMapper; |
| | | IApsPlateStandardRequireErrorService requireErrorService; |
| | | @Resource |
| | | private RedisTemplate redisTemplate; |
| | | |
| | |
| | | ret.setRouteTime(totalRouteTime); |
| | | ret.setRouteId(routeHeader.getRouteId()); |
| | | }else { |
| | | saveRequireError(require,"æ åå·¥èºè·¯çº¿ä¸åå¨"); |
| | | requireErrorService.saveRequireError(require,"æ åå·¥èºè·¯çº¿ä¸åå¨"); |
| | | } |
| | | // è¿åæ»å·¥æ¶ |
| | | return ret; |
| | |
| | | ret.setRouteTime(totalRouteTime.multiply(netRequirement)); |
| | | return ret; |
| | | } else { |
| | | saveRequireError(require,"æ åå·¥èºè·¯çº¿ä¸åå¨"); |
| | | requireErrorService.saveRequireError(require,"æ åå·¥èºè·¯çº¿ä¸åå¨"); |
| | | /*// æ¥è¯¢æ åå·¥èºè·¯çº¿å¤´é¨ä¿¡æ¯ |
| | | Optional<ApsStandardProcessRouteHeader> firstProcessRoute = standardProcessRouteHeaderMapper.queryStandardProcessRouteHeaderByPlantAndItemCode(plant, itemCode).stream().findFirst(); |
| | | if (firstProcessRoute.isPresent()) { |
| | |
| | | } |
| | | } |
| | | |
| | | private void saveRequireError(ApsPlateStandardRequire require,String message) { |
| | | ApsPlateStandardRequireError data = ApsPlateStandardRequireError.builder() |
| | | .id(IdUtil.getSnowflakeNextId()) |
| | | .requireId(require.getId()) |
| | | .batchNumber(require.getBatchNumber()) |
| | | .docNum(require.getDocNum()) |
| | | .itemNum(require.getBomLineCode()) |
| | | .orgCode(require.getOrgCode()) |
| | | .message(message) |
| | | .delFlag("0") |
| | | .build(); |
| | | data.setCreateBy(SecurityUtils.getUsername()); |
| | | data.setCreateTime(DateUtils.getNowDate()); |
| | | requireErrorMapper.insertApsPlateStandardRequireError(data); |
| | | } |
| | | } |
| | |
| | | package com.aps.core.service.impl; |
| | | |
| | | import com.aps.common.core.utils.DateUtils; |
| | | import com.aps.common.core.utils.StringUtils; |
| | | import com.aps.common.security.utils.DictUtils; |
| | | import com.aps.common.security.utils.SecurityUtils; |
| | | import com.aps.core.domain.ApsShop; |
| | | import com.aps.core.domain.ApsStandardProcess; |
| | | import com.aps.core.mapper.ApsShopMapper; |
| | | import com.aps.core.mapper.ApsStandardProcessMapper; |
| | | import com.aps.core.service.IApsStandardProcessService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * æ åå·¥åºServiceä¸å¡å±å¤ç |
| | | * |
| | | * |
| | | * @author hjy |
| | | * @date 2025-04-23 |
| | | */ |
| | | @Service |
| | | public class ApsStandardProcessServiceImpl implements IApsStandardProcessService |
| | | { |
| | | public class ApsStandardProcessServiceImpl implements IApsStandardProcessService { |
| | | @Autowired |
| | | private ApsStandardProcessMapper apsStandardProcessMapper; |
| | | |
| | | @Autowired |
| | | private ApsShopMapper apsShopMapper; |
| | | |
| | | /** |
| | | * æ¥è¯¢æ åå·¥åº |
| | | * |
| | | * |
| | | * @param id æ åå·¥åºä¸»é® |
| | | * @return æ åå·¥åº |
| | | */ |
| | | @Override |
| | | public ApsStandardProcess selectApsStandardProcessById(Long id) |
| | | { |
| | | public ApsStandardProcess selectApsStandardProcessById(Long id) { |
| | | return apsStandardProcessMapper.selectApsStandardProcessById(id); |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢æ åå·¥åºå表 |
| | | * |
| | | * |
| | | * @param apsStandardProcess æ åå·¥åº |
| | | * @return æ åå·¥åº |
| | | */ |
| | | @Override |
| | | public List<ApsStandardProcess> selectApsStandardProcessList(ApsStandardProcess apsStandardProcess) |
| | | { |
| | | public List<ApsStandardProcess> selectApsStandardProcessList(ApsStandardProcess apsStandardProcess) { |
| | | return apsStandardProcessMapper.selectApsStandardProcessList(apsStandardProcess); |
| | | } |
| | | |
| | | /** |
| | | * æ°å¢æ åå·¥åº |
| | | * |
| | | * |
| | | * @param apsStandardProcess æ åå·¥åº |
| | | * @return ç»æ |
| | | */ |
| | | @Override |
| | | public int insertApsStandardProcess(ApsStandardProcess apsStandardProcess) |
| | | { |
| | | public int insertApsStandardProcess(ApsStandardProcess apsStandardProcess) { |
| | | apsStandardProcess.setCreateTime(DateUtils.getNowDate()); |
| | | apsStandardProcess.setCreateBy(SecurityUtils.getUsername()); |
| | | return apsStandardProcessMapper.insertApsStandardProcess(apsStandardProcess); |
| | |
| | | |
| | | /** |
| | | * ä¿®æ¹æ åå·¥åº |
| | | * |
| | | * |
| | | * @param apsStandardProcess æ åå·¥åº |
| | | * @return ç»æ |
| | | */ |
| | | @Override |
| | | public int updateApsStandardProcess(ApsStandardProcess apsStandardProcess) |
| | | { |
| | | public int updateApsStandardProcess(ApsStandardProcess apsStandardProcess) { |
| | | apsStandardProcess.setUpdateTime(DateUtils.getNowDate()); |
| | | apsStandardProcess.setUpdateBy(SecurityUtils.getUsername()); |
| | | return apsStandardProcessMapper.updateApsStandardProcess(apsStandardProcess); |
| | |
| | | |
| | | /** |
| | | * æ¹éå 餿 åå·¥åº |
| | | * |
| | | * |
| | | * @param ids éè¦å é¤çæ åå·¥åºä¸»é® |
| | | * @return ç»æ |
| | | */ |
| | | @Override |
| | | public int deleteApsStandardProcessByIds(Long[] ids) |
| | | { |
| | | public int deleteApsStandardProcessByIds(Long[] ids) { |
| | | return apsStandardProcessMapper.deleteApsStandardProcessByIds(ids); |
| | | } |
| | | |
| | | /** |
| | | * å 餿 åå·¥åºä¿¡æ¯ |
| | | * |
| | | * |
| | | * @param id æ åå·¥åºä¸»é® |
| | | * @return ç»æ |
| | | */ |
| | | @Override |
| | | public int deleteApsStandardProcessById(Long id) |
| | | { |
| | | public int deleteApsStandardProcessById(Long id) { |
| | | return apsStandardProcessMapper.deleteApsStandardProcessById(id); |
| | | } |
| | | |
| | | /** |
| | | * 导å
¥æ°æ® |
| | | * |
| | | * @param tempList |
| | | * @return true/false |
| | | */ |
| | |
| | | public boolean importData(List<ApsStandardProcess> tempList) { |
| | | try { |
| | | if (!tempList.isEmpty()) { |
| | | tempList.forEach(temp->{ |
| | | DictUtils.CacheValue cacheFactory = DictUtils.getCacheValue("aps_factory"); |
| | | DictUtils.CacheValue cacheDomain = DictUtils.getCacheValue("aps_domain"); |
| | | |
| | | List<ApsShop> shops = apsShopMapper.selectApsByName(tempList.stream() |
| | | .map(ApsStandardProcess::getWorkShop) |
| | | .filter(StringUtils::isNotEmpty) |
| | | .collect(Collectors.toSet())); |
| | | tempList.forEach(temp -> { |
| | | temp.setCreateBy(SecurityUtils.getUsername()); |
| | | temp.setCreateTime(DateUtils.getNowDate()); |
| | | apsStandardProcessMapper.insertApsStandardProcess(temp); |
| | | temp.setMajor(cacheDomain.get(temp.getMajor())); |
| | | temp.setPlant(cacheFactory.get(temp.getPlant())); |
| | | temp.setWorkShop(shops.stream() |
| | | .filter(shop -> Objects.equals(shop.getShopName(), temp.getWorkShop())) |
| | | .filter(shop -> Objects.equals(shop.getPlantCode(), temp.getPlant())) |
| | | .map(ApsShop::getShopCode) |
| | | .findFirst() |
| | | .orElse(null)); |
| | | }); |
| | | apsStandardProcessMapper.insert(tempList); |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | |
| | | //伿¯æ¥ |
| | | org.postgresql.util.PGobject pgObjectHolidays = (org.postgresql.util.PGobject) apsWorkCalendarTemp.getHolidays(); |
| | | if(pgObjectHolidays!=null){ |
| | | JSONArray holidays = (JSON.parseObject(pgObjectHolidays.getValue())).getJSONArray("holidays"); |
| | | JSONArray holidays = JSONArray.parse(pgObjectHolidays.getValue()); |
| | | for (int i = 0; i < holidays.size(); i++){ |
| | | JSONObject h = holidays.getJSONObject(i); |
| | | List<LocalDate> datesTempHolidays = getDatesBetween(h.getObject("startdate", LocalDate.class), h.getObject("enddate", LocalDate.class)); |
| | |
| | | package com.aps.core.service.mainPlan; |
| | | |
| | | import com.aps.core.domain.mainPlan.ApsWeldSeamStatisticsV2; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | |
| | | import java.io.IOException; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | * @return åå½±åçè®°å½æ° |
| | | */ |
| | | public int refreshWeldSeamStatistics(String username); |
| | | } |
| | | |
| | | void exportWeldSeamStatistics(HttpServletResponse response) throws IOException; |
| | | } |
| | |
| | | package com.aps.core.service.mainPlan.impl; |
| | | |
| | | import com.aps.common.core.annotation.Excel; |
| | | import com.aps.common.core.utils.DateUtils; |
| | | import com.aps.common.core.utils.poi.ExcelUtil; |
| | | import com.aps.common.core.utils.uuid.IdUtils; |
| | | import com.aps.common.core.web.page.TableDataInfo; |
| | | import com.aps.common.security.utils.DictUtils; |
| | | import com.aps.common.security.utils.SecurityUtils; |
| | | import com.aps.core.controller.basicData.ApsGasPipelineCapacityPlanController; |
| | | import com.aps.core.domain.ApsGasPipelineCapacityPlan; |
| | | import com.aps.core.domain.mainPlan.ApsWeldSeamStatisticsV2; |
| | | import com.aps.core.mapper.mainPlan.ApsWeldSeamStatisticsV2Mapper; |
| | | import com.aps.core.service.IApsGasPipelineCapacityPlanService; |
| | | import com.aps.core.service.mainPlan.IApsWeldSeamStatisticsV2Service; |
| | | import com.aps.system.api.domain.SysDictData; |
| | | import com.fasterxml.jackson.databind.JsonNode; |
| | | import com.fasterxml.jackson.databind.ObjectMapper; |
| | | import com.fasterxml.jackson.databind.node.ObjectNode; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import org.apache.poi.ss.usermodel.CellStyle; |
| | | import org.apache.poi.ss.util.CellRangeAddress; |
| | | import org.apache.poi.xssf.streaming.SXSSFCell; |
| | | import org.apache.poi.xssf.streaming.SXSSFRow; |
| | | import org.apache.poi.xssf.streaming.SXSSFSheet; |
| | | import org.apache.poi.xssf.streaming.SXSSFWorkbook; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.io.IOException; |
| | | import java.math.BigDecimal; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.*; |
| | | import java.util.concurrent.atomic.AtomicInteger; |
| | | |
| | | /** |
| | | * çç¼ç»è®¡è¡¨V2Serviceä¸å¡å±å¤ç |
| | |
| | | |
| | | return count; |
| | | } |
| | | @Override |
| | | public void exportWeldSeamStatistics(HttpServletResponse response) throws IOException { |
| | | //1. è·åæ°æ®æº |
| | | List<ApsWeldSeamStatisticsV2> list = apsWeldSeamStatisticsV2Mapper.selectApsWeldSeamStatisticsV2List(new ApsWeldSeamStatisticsV2()); |
| | | |
| | | |
| | | List<SysDictData> isRequireDic = DictUtils.getDictCache("aps_task_is_require"); |
| | | List<SysDictData> factoryDic = DictUtils.getDictCache("aps_factory"); |
| | | |
| | | |
| | | //2. å建Excelå·¥ä½ç°¿ |
| | | SXSSFWorkbook wb = new SXSSFWorkbook(500); |
| | | CellStyle titleStyle = ExcelUtil.getCommonHeaderStyle(wb); |
| | | CellStyle dataStyle =ExcelUtil.getDataCellStyle(wb); |
| | | |
| | | SXSSFSheet sheet = wb.createSheet("çç¼ç»è®¡è¡¨"); |
| | | List<LinkedHashMap<String,String>> titleList= initRowTitle(); |
| | | //3. æå»ºè¡¨å¤´ |
| | | for (int i = 0; i < titleList.size(); i++) { |
| | | SXSSFRow titleRow = sheet.createRow(i); |
| | | LinkedHashMap<String, String> map = titleList.get(i); |
| | | AtomicInteger index = new AtomicInteger(); |
| | | titleList.get(i).forEach((key,value)->{ |
| | | SXSSFCell cell = titleRow.createCell(index.get()); |
| | | cell.setCellValue(value); |
| | | cell.setCellStyle(titleStyle); |
| | | index.getAndIncrement(); |
| | | }); |
| | | } |
| | | //5. æå»ºæ°æ®è¡ |
| | | LinkedHashMap<String, String> first = titleList.get(0); |
| | | ArrayList<Map.Entry<String, String>> titles = new ArrayList<>(first.entrySet()); |
| | | for (int rowInx = 0; rowInx < list.size(); rowInx++) { |
| | | SXSSFRow dataRow = sheet.createRow(rowInx + 2); |
| | | ApsWeldSeamStatisticsV2 statistics = list.get(rowInx); |
| | | ObjectMapper mapper = new ObjectMapper(); |
| | | ObjectNode node = mapper.valueToTree(statistics); |
| | | for (int colInx = 0; colInx < titles.size(); colInx++) { |
| | | Map.Entry<String, String> entry = titles.get(colInx); |
| | | String filedKey = entry.getKey(); |
| | | SXSSFCell cell = dataRow.createCell(colInx); |
| | | JsonNode jsonNode = node.get(filedKey); |
| | | if(filedKey.equals("productionBase")){ |
| | | factoryDic.stream().filter(x->x.getDictValue().equals(jsonNode.textValue())).findFirst().ifPresent( |
| | | sysDictData -> cell.setCellValue(sysDictData.getDictLabel()) |
| | | ); |
| | | }else if(filedKey.equals("isSatisfy")){ |
| | | isRequireDic.stream().filter(x->x.getDictValue().equals(jsonNode.textValue())).findFirst().ifPresent( |
| | | sysDictData -> cell.setCellValue(sysDictData.getDictLabel()) |
| | | ); |
| | | }else{ |
| | | cell.setCellValue(jsonNode.longValue()); |
| | | } |
| | | cell.setCellStyle(dataStyle); |
| | | } |
| | | } |
| | | for (int i = 0; i < sheet.getRow(0).getLastCellNum(); i++) { |
| | | sheet.setColumnWidth(i, 20 * 256); |
| | | } |
| | | |
| | | //4.å并表头 |
| | | sheet.addMergedRegion(new CellRangeAddress(0, 1, 0, 0)); |
| | | sheet.addMergedRegion(new CellRangeAddress(0, 1, 1, 1)); |
| | | sheet.addMergedRegion(new CellRangeAddress(0, 1, 2, 2)); |
| | | sheet.addMergedRegion(new CellRangeAddress(0, 0, 3, 4)); |
| | | sheet.addMergedRegion(new CellRangeAddress(0, 0, 5, 6)); |
| | | sheet.addMergedRegion(new CellRangeAddress(0, 1, 7, 7)); |
| | | sheet.addMergedRegion(new CellRangeAddress(0, 1, 8, 8)); |
| | | sheet.addMergedRegion(new CellRangeAddress(0, 1, 9, 9)); |
| | | sheet.addMergedRegion(new CellRangeAddress(0, 1, 10, 10)); |
| | | sheet.addMergedRegion(new CellRangeAddress(0, 1, 11, 11)); |
| | | sheet.addMergedRegion(new CellRangeAddress(0, 1, 12, 12)); |
| | | //3. 设置ååºå¤´ |
| | | response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); |
| | | response.setCharacterEncoding("utf-8"); |
| | | wb.write(response.getOutputStream()); |
| | | |
| | | } |
| | | private List<LinkedHashMap<String,String>> initRowTitle(){ |
| | | List<LinkedHashMap<String,String>> list = new ArrayList<>(); |
| | | LinkedHashMap<String,String> level1 = new LinkedHashMap<>(); |
| | | level1.put("year","年份"); |
| | | level1.put("month","æä»½"); |
| | | level1.put("productionBase","ç产åºå°"); |
| | | level1.put("pipingOrderRequirement","订åéæ±"); |
| | | level1.put("gasOrderRequirement","订åéæ±"); |
| | | level1.put("pipingPredictionRequirement","颿µéæ±"); |
| | | level1.put("gasPredictionRequirement","颿µéæ±"); |
| | | level1.put("reserveEmergencyOrderOutput","é¢çç´§æ¥è®¢å产åº"); |
| | | level1.put("total","å计"); |
| | | level1.put("days","天æ°"); |
| | | level1.put("requirementDayWeldSeam","éæ±æ¥çç¼"); |
| | | level1.put("productionDayWeldSeam","ç产æ¥çç¼"); |
| | | level1.put("isSatisfy","æ¯å¦æ»¡è¶³"); |
| | | list.add(level1); |
| | | |
| | | LinkedHashMap<String,String> level2 = new LinkedHashMap<>(); |
| | | level2.put("year","年份"); |
| | | level2.put("month","æä»½"); |
| | | level2.put("productionBase","ç产åºå°"); |
| | | level2.put("pipingOrderRequirement","管路"); |
| | | level2.put("gasOrderRequirement","æ°æ"); |
| | | level2.put("pipingPredictionRequirement","管路"); |
| | | level2.put("gasPredictionRequirement","æ°æ"); |
| | | level2.put("reserveEmergencyOrderOutput","é¢çç´§æ¥è®¢å产åº"); |
| | | level2.put("total","å计"); |
| | | level2.put("days","天æ°"); |
| | | level2.put("requirementDayWeldSeam","éæ±æ¥çç¼"); |
| | | level2.put("productionDayWeldSeam","ç产æ¥çç¼"); |
| | | level2.put("isSatisfy","æ¯å¦æ»¡è¶³"); |
| | | list.add(level2); |
| | | |
| | | return list; |
| | | } |
| | | } |
| | |
| | | LEFT JOIN aps_bom_line b on a.bom_header_id=b.bom_header_id |
| | | LEFT JOIN aps_material_management d on b.item_code=d.item_number |
| | | LEFT JOIN aps_material_management c on a.item_code=c.item_number |
| | | <where> |
| | | <if test="orgCode != null and orgCode != ''"> |
| | | and a.org_code=#{orgCode} and d.applicable_factories=#{orgCode} |
| | | </if> |
| | | and d.material_type='å¶é ä»¶' |
| | | and c.material_type='å¶é ä»¶' |
| | | </where> |
| | | where d.material_type='å¶é ä»¶' and c.material_type='å¶é ä»¶' |
| | | <if test="orgCode != null and orgCode != ''"> |
| | | and a.org_code=#{orgCode} and d.applicable_factories=#{orgCode} |
| | | </if> |
| | | ORDER BY mainItemCode |
| | | </select> |
| | | </mapper> |
| | |
| | | <result property="year" column="year" /> |
| | | <result property="month" column="month" /> |
| | | <result property="major" column="major" /> |
| | | <result property="workshop" column="workshop" /> |
| | | <result property="dayProduceType" column="day_produce_type" /> |
| | | <result property="dayProduceNum" column="day_produce_num" /> |
| | | <result property="dayProduceUnit" column="day_produce_unit" /> |
| | |
| | | </resultMap> |
| | | |
| | | <sql id="selectApsGasPipelineCapacityPlanVo"> |
| | | select id, process_name, year, month, major, day_produce_type, day_produce_num, day_produce_unit, personnel_number, day_produce_all_num, days, month_produce_all_num, remark, create_by, create_time, update_by, update_time, org_code from aps_gas_pipeline_capacity_plan |
| | | select id, process_name, year, month, major, workshop, day_produce_type, day_produce_num, day_produce_unit, personnel_number, day_produce_all_num, days, month_produce_all_num, remark, create_by, create_time, update_by, update_time, org_code from aps_gas_pipeline_capacity_plan |
| | | </sql> |
| | | |
| | | <select id="selectApsGasPipelineCapacityPlanList" parameterType="com.aps.core.domain.ApsGasPipelineCapacityPlan" resultMap="ApsGasPipelineCapacityPlanResult"> |
| | |
| | | <if test="year != null and year != ''"> and year = #{year}</if> |
| | | <if test="month != null and month != ''"> and month = #{month}</if> |
| | | <if test="major != null and major != ''"> and major = #{major}</if> |
| | | <if test="workshop != null and workshop != ''"> and workshop = #{workshop}</if> |
| | | <if test="dayProduceType != null and dayProduceType != ''"> and day_produce_type = #{dayProduceType}</if> |
| | | <if test="dayProduceNum != null "> and day_produce_num = #{dayProduceNum}</if> |
| | | <if test="dayProduceUnit != null and dayProduceUnit != ''"> and day_produce_unit = #{dayProduceUnit}</if> |
| | |
| | | <if test="year != null">year,</if> |
| | | <if test="month != null">month,</if> |
| | | <if test="major != null">major,</if> |
| | | <if test="workshop != null">workshop,</if> |
| | | <if test="dayProduceType != null">day_produce_type,</if> |
| | | <if test="dayProduceNum != null">day_produce_num,</if> |
| | | <if test="dayProduceUnit != null">day_produce_unit,</if> |
| | |
| | | <if test="year != null">#{year},</if> |
| | | <if test="month != null">#{month},</if> |
| | | <if test="major != null">#{major},</if> |
| | | <if test="workshop != null">workshop,</if> |
| | | <if test="dayProduceType != null">#{dayProduceType},</if> |
| | | <if test="dayProduceNum != null">#{dayProduceNum},</if> |
| | | <if test="dayProduceUnit != null">#{dayProduceUnit},</if> |
| | |
| | | <if test="year != null">year = #{year},</if> |
| | | <if test="month != null">month = #{month},</if> |
| | | <if test="major != null">major = #{major},</if> |
| | | <if test="workshop != null">workshop,</if> |
| | | <if test="dayProduceType != null">day_produce_type = #{dayProduceType},</if> |
| | | <if test="dayProduceNum != null">day_produce_num = #{dayProduceNum},</if> |
| | | <if test="dayProduceUnit != null">day_produce_unit = #{dayProduceUnit},</if> |
| | |
| | | #{id} |
| | | </foreach> |
| | | </delete> |
| | | |
| | | <delete id="deleteByDateAndFactory" > |
| | | delete from aps_gas_pipeline_capacity_plan |
| | | where year = #{year} |
| | | and month = #{month} |
| | | and org_code = #{factory} |
| | | and major = #{major} |
| | | </delete> |
| | | |
| | | <!-- æ¥è¯¢è®¾è®¡äº§è½æ°æ® - ä¸ç¨äºæ¥å£äºåè½ --> |
| | | <select id="selectDesignCapacityForInterface2" resultMap="ApsGasPipelineCapacityPlanResult"> |
| | | <include refid="selectApsGasPipelineCapacityPlanVo"/> |
| | | <where> |
| | | <if test="processName != null and processName != ''"> |
| | | and process_name = #{processName} |
| | | </if> |
| | | <if test="year != null and year != ''"> |
| | | and year = #{year} |
| | | </if> |
| | | <if test="month != null and month != ''"> |
| | | and CAST(month AS INTEGER) = CAST(#{month} AS INTEGER) |
| | | </if> |
| | | <if test="major != null and major != ''"> |
| | | and major = #{major} |
| | | </if> |
| | | <if test="orgCode != null and orgCode != ''"> |
| | | and org_code = #{orgCode} |
| | | </if> |
| | | </where> |
| | | </select> |
| | | </mapper> |
| | |
| | | <result property="planStartDay" column="plan_start_day" /> |
| | | <result property="processPlanEndDay" column="process_plan_end_day" /> |
| | | <result property="orderPlanEndDay" column="order_plan_end_day" /> |
| | | <result property="routeProcessNumber" column="route_process_number" /> |
| | | <result property="warning" column="warning" /> |
| | | <result property="plant" column="plant" /> |
| | | <result property="workshop" column="workshop" /> |
| | | <result property="batchNumber" column="batch_number" /> |
| | | </resultMap> |
| | | |
| | | <sql id="selectApsGasPipingRouteStatVo"> |
| | |
| | | process_plan_start_day, design_times, del_flag, create_by, |
| | | process_name, create_time, item_number, standard_dosage, |
| | | process_total_dosage, design_capacity, major, plan_start_year, |
| | | plan_start_month, plan_start_day , warning, plant |
| | | plan_start_month, plan_start_day, process_plan_end_day, order_plan_end_day, |
| | | warning, plant, workshop, batch_number |
| | | from aps_gas_piping_route_stat |
| | | </sql> |
| | | |
| | | <select id="selectApsGasPipingRouteStatList" parameterType="com.aps.core.domain.ApsGasPipingRouteStat" resultMap="ApsGasPipingRouteStatResult"> |
| | | <include refid="selectApsGasPipingRouteStatVo"/> |
| | | <where> |
| | | <where> |
| | | <if test="workOrderNo != null and workOrderNo != ''"> and work_order_no = #{workOrderNo}</if> |
| | | <if test="roadProcessNumber != null and roadProcessNumber != ''"> and road_process_number = #{roadProcessNumber}</if> |
| | | <if test="currentProcessNumber != null and currentProcessNumber != ''"> and current_process_number = #{currentProcessNumber}</if> |
| | | <if test="productionQuantity != null and productionQuantity != ''"> and production_quantity = #{productionQuantity}</if> |
| | | <if test="standardTime != null and standardTime != ''"> and standard_time = #{standardTime}</if> |
| | | <if test="processTotalTime != null and processTotalTime != ''"> and process_total_time = #{processTotalTime}</if> |
| | | <if test="processPlanStartDay != null and processPlanStartDay != ''"> and process_plan_start_day = #{processPlanStartDay}</if> |
| | | <if test="roadProcessNumber != null "> and road_process_number = #{roadProcessNumber}</if> |
| | | <if test="currentProcessNumber != null "> and current_process_number = #{currentProcessNumber}</if> |
| | | <if test="productionQuantity != null "> and production_quantity = #{productionQuantity}</if> |
| | | <if test="standardTime != null "> and standard_time = #{standardTime}</if> |
| | | <if test="processTotalTime != null "> and process_total_time = #{processTotalTime}</if> |
| | | <if test="processPlanStartDay != null "> and process_plan_start_day = #{processPlanStartDay}</if> |
| | | <if test="designTimes != null "> and design_times = #{designTimes}</if> |
| | | <if test="processName != null and processName != ''"> and process_name like '%' || #{processName} || '%')</if> |
| | | <if test="major != null and major != ''"> and major = #{major} </if> |
| | | <if test="planStartYear != null and planStartYear != ''"> and plan_start_year = #{planStartYear} </if> |
| | | <if test="planStartMonth != null and planStartMonth != ''"> and plan_start_month = #{planStartMonth} </if> |
| | | <if test="planStartDay != null and planStartDay != ''"> and plan_start_day = #{planStartDay} </if> |
| | | <if test="searchStartDate != null and searchStartDate != '' and searchEndDate != null and searchEndDate != ''"> and (process_plan_start_day >= #{searchStartDate} and process_plan_start_day <= #{searchEndDate}) </if> |
| | | <if test="processName != null and processName != ''"> and process_name = #{processName}</if> |
| | | <if test="itemNumber != null and itemNumber != ''"> and item_number = #{itemNumber}</if> |
| | | <if test="standardDosage != null "> and standard_dosage = #{standardDosage}</if> |
| | | <if test="processTotalDosage != null "> and process_total_dosage = #{processTotalDosage}</if> |
| | | <if test="designCapacity != null "> and design_capacity = #{designCapacity}</if> |
| | | <if test="major != null and major != ''"> |
| | | <if test="major == 'piping'"> |
| | | and process_name in (select process_name from aps_standard_process where major='管路') |
| | |
| | | <if test="major == 'gas'"> |
| | | and process_name in (select process_name from aps_standard_process where major='æ°æ') |
| | | </if> |
| | | <if test="major != 'piping' and major != 'gas'"> |
| | | and major = #{major} |
| | | </if> |
| | | </if> |
| | | <if test="plant != null and plant != ''"> and plant = #{plant} </if> |
| | | <if test="planStartYear != null and planStartYear != ''"> and plan_start_year = #{planStartYear}</if> |
| | | <if test="planStartMonth != null and planStartMonth != ''"> and plan_start_month = #{planStartMonth}</if> |
| | | <if test="planStartDay != null and planStartDay != ''"> and plan_start_day = #{planStartDay}</if> |
| | | <if test="processPlanEndDay != null "> and process_plan_end_day = #{processPlanEndDay}</if> |
| | | <if test="orderPlanEndDay != null "> and order_plan_end_day = #{orderPlanEndDay}</if> |
| | | <if test="warning != null "> and warning = #{warning}</if> |
| | | <if test="plant != null and plant != ''"> and plant = #{plant}</if> |
| | | <if test="workshop != null and workshop != ''"> and workshop = #{workshop}</if> |
| | | <if test="batchNumber != null and batchNumber != ''"> and batch_number = #{batchNumber}</if> |
| | | </where> |
| | | </select> |
| | | |
| | |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">id,</if> |
| | | <if test="workOrderNo != null">work_order_no,</if> |
| | | <if test="roadProcessNumber != null and roadProcessNumber != ''">road_process_number,</if> |
| | | <if test="roadProcessNumber != null">road_process_number,</if> |
| | | <if test="currentProcessNumber != null">current_process_number,</if> |
| | | <if test="productionQuantity != null">production_quantity,</if> |
| | | <if test="standardTime != null">standard_time,</if> |
| | | <if test="processTotalTime != null">process_total_time,</if> |
| | | <if test="processPlanStartDay != null ">process_plan_start_day,</if> |
| | | <if test="processPlanStartDay != null">process_plan_start_day,</if> |
| | | <if test="designTimes != null">design_times,</if> |
| | | <if test="delFlag != null">del_flag,</if> |
| | | <if test="createBy != null">create_by,</if> |
| | |
| | | <if test="planStartDay != null">plan_start_day,</if> |
| | | <if test="processPlanEndDay != null">process_plan_end_day,</if> |
| | | <if test="orderPlanEndDay != null">order_plan_end_day,</if> |
| | | <if test="batchNumber != null">batch_number,</if> |
| | | <if test="warning != null">warning,</if> |
| | | <if test="plant != null">plant,</if> |
| | | <if test="workshop != null">workshop,</if> |
| | | <if test="batchNumber != null">batch_number,</if> |
| | | </trim> |
| | | <trim prefix="values (" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">#{id},</if> |
| | | <if test="workOrderNo != null">#{workOrderNo},</if> |
| | | <if test="roadProcessNumber != null and roadProcessNumber != ''">#{roadProcessNumber},</if> |
| | | <if test="roadProcessNumber != null">#{roadProcessNumber},</if> |
| | | <if test="currentProcessNumber != null">#{currentProcessNumber},</if> |
| | | <if test="productionQuantity != null">#{productionQuantity},</if> |
| | | <if test="standardTime != null">#{standardTime},</if> |
| | | <if test="processTotalTime != null">#{processTotalTime},</if> |
| | | <if test="processPlanStartDay != null ">#{processPlanStartDay},</if> |
| | | <if test="processPlanStartDay != null">#{processPlanStartDay},</if> |
| | | <if test="designTimes != null">#{designTimes},</if> |
| | | <if test="delFlag != null">#{delFlag},</if> |
| | | <if test="createBy != null">#{createBy},</if> |
| | |
| | | <if test="planStartDay != null">#{planStartDay},</if> |
| | | <if test="processPlanEndDay != null">#{processPlanEndDay},</if> |
| | | <if test="orderPlanEndDay != null">#{orderPlanEndDay},</if> |
| | | <if test="batchNumber != null">#{batchNumber},</if> |
| | | <if test="warning != null">#{warning},</if> |
| | | <if test="plant != null">#{plant},</if> |
| | | <if test="workshop != null">#{workshop},</if> |
| | | <if test="batchNumber != null">#{batchNumber},</if> |
| | | </trim> |
| | | </insert> |
| | | |
| | |
| | | update aps_gas_piping_route_stat |
| | | <trim prefix="SET" suffixOverrides=","> |
| | | <if test="workOrderNo != null">work_order_no = #{workOrderNo},</if> |
| | | <if test="roadProcessNumber != null and roadProcessNumber != ''">road_process_number = #{roadProcessNumber},</if> |
| | | <if test="roadProcessNumber != null">road_process_number = #{roadProcessNumber},</if> |
| | | <if test="currentProcessNumber != null">current_process_number = #{currentProcessNumber},</if> |
| | | <if test="productionQuantity != null">production_quantity = #{productionQuantity},</if> |
| | | <if test="standardTime != null">standard_time = #{standardTime},</if> |
| | | <if test="processTotalTime != null">process_total_time = #{processTotalTime},</if> |
| | | <if test="processPlanStartDay != null and processPlanStartDay != ''">process_plan_start_day = #{processPlanStartDay},</if> |
| | | <if test="processPlanStartDay != null">process_plan_start_day = #{processPlanStartDay},</if> |
| | | <if test="designTimes != null">design_times = #{designTimes},</if> |
| | | <if test="delFlag != null">del_flag = #{delFlag},</if> |
| | | <if test="createBy != null">create_by = #{createBy},</if> |
| | |
| | | <if test="planStartYear != null">plan_start_year = #{planStartYear},</if> |
| | | <if test="planStartMonth != null">plan_start_month = #{planStartMonth},</if> |
| | | <if test="planStartDay != null">plan_start_day = #{planStartDay},</if> |
| | | <if test="processPlanEndDay != null">process_plan_end_day = #{processPlanEndDay},</if> |
| | | <if test="orderPlanEndDay != null">order_plan_end_day = #{orderPlanEndDay},</if> |
| | | <if test="warning != null">warning = #{warning},</if> |
| | | <if test="plant != null">plant = #{plant},</if> |
| | | <if test="workshop != null">workshop = #{workshop},</if> |
| | | <if test="batchNumber != null">batch_number = #{batchNumber},</if> |
| | | </trim> |
| | | where id = #{id} |
| | | </update> |
| | |
| | | #{id} |
| | | </foreach> |
| | | </delete> |
| | | |
| | | |
| | | <delete id="deleteApsGasPipingRouteStatByBatchNum" parameterType="String"> |
| | | delete from aps_gas_piping_route_stat where batch_number != #{batchNumber} |
| | | </delete> |
| | | |
| | | <insert id="insertApsGasPipingRouteStatBatch"> |
| | | INSERT INTO aps_gas_piping_route_stat |
| | | ( |
| | | id,work_order_no, road_process_number, current_process_number, production_quantity, standard_time, |
| | | process_total_time, process_plan_start_day, design_times, del_flag, create_by, process_name, |
| | | create_time, item_number, standard_dosage, process_total_dosage, design_capacity, major, |
| | | plan_start_year, plan_start_month, plan_start_day,batch_number,process_plan_end_day,warning,order_plan_end_day,plant |
| | | ) |
| | | VALUES |
| | | <foreach collection="apsGasPipingRouteStatList" item="stat" separator=","> |
| | | |
| | | <insert id="insertApsGasPipingRouteStatBatch" parameterType="java.util.List"> |
| | | insert into aps_gas_piping_route_stat ( |
| | | id, work_order_no, road_process_number, current_process_number, |
| | | production_quantity, standard_time, process_total_time, |
| | | process_plan_start_day, design_times, del_flag, create_by, |
| | | process_name, create_time, item_number, standard_dosage, |
| | | process_total_dosage, design_capacity, major, plan_start_year, |
| | | plan_start_month, plan_start_day, process_plan_end_day, order_plan_end_day, |
| | | warning, plant, workshop, batch_number |
| | | ) values |
| | | <foreach item="item" index="index" collection="list" separator=","> |
| | | ( |
| | | #{stat.id},#{stat.workOrderNo}, #{stat.roadProcessNumber}, #{stat.currentProcessNumber}, #{stat.productionQuantity}, |
| | | #{stat.standardTime}, #{stat.processTotalTime}, #{stat.processPlanStartDay}, #{stat.designTimes}, #{stat.delFlag}, |
| | | #{stat.createBy}, #{stat.processName}, #{stat.createTime}, #{stat.itemNumber}, #{stat.standardDosage}, |
| | | #{stat.processTotalDosage}, #{stat.designCapacity}, #{stat.major}, #{stat.planStartYear}, |
| | | #{stat.planStartMonth}, #{stat.planStartDay}, #{stat.batchNumber}, #{stat.processPlanEndDay},#{stat.warning},#{stat.orderPlanEndDay},#{stat.plant} |
| | | #{item.id}, #{item.workOrderNo}, #{item.roadProcessNumber}, #{item.currentProcessNumber}, |
| | | #{item.productionQuantity}, #{item.standardTime}, #{item.processTotalTime}, |
| | | #{item.processPlanStartDay}, #{item.designTimes}, #{item.delFlag}, #{item.createBy}, |
| | | #{item.processName}, #{item.createTime}, #{item.itemNumber}, #{item.standardDosage}, |
| | | #{item.processTotalDosage}, #{item.designCapacity}, #{item.major}, #{item.planStartYear}, |
| | | #{item.planStartMonth}, #{item.planStartDay}, #{item.processPlanEndDay}, #{item.orderPlanEndDay}, |
| | | #{item.warning}, #{item.plant}, #{item.workshop}, #{item.batchNumber} |
| | | ) |
| | | </foreach> |
| | | |
| | | </insert> |
| | | |
| | | <delete id="deleteAll"> |
| | | delete from aps_gas_piping_route_stat |
| | | </delete> |
| | | |
| | | <select id="queryTempStat" resultMap="ApsGasPipingRouteStatResult" > |
| | | select row_number() over (partition by rt.work_order_no order by rt.process_number desc ) as num, |
| | |
| | | where pl.document_number is not null and rt.work_order_no is not null and pl.plan_end_day is not null |
| | | order by rt.work_order_no asc, rt.process_number desc |
| | | </select> |
| | | |
| | | <!-- èåæ¥è¯¢æå·¥æ°ä½é¢æµæ°æ®ç¸å
³ä¿¡æ¯ --> |
| | | <select id="selectPredictionRouteData" resultType="java.util.Map"> |
| | | SELECT |
| | | p.id as prediction_id, |
| | | p.material_code, |
| | | p.factory, |
| | | p.predict_quantity, |
| | | p.predict_date, |
| | | h.route_id, |
| | | l.route_name as process_name, |
| | | l.route_num as process_number, |
| | | l.standard_time, |
| | | string_agg(DISTINCT m.domain, ';') as domain, |
| | | string_agg(DISTINCT s.work_shop, ';') as workshop |
| | | FROM aps_gas_pipeline_prediction p |
| | | JOIN aps_standard_process_route_header h ON p.material_code = h.item_code AND p.factory = h.org_code |
| | | JOIN aps_standard_process_route_line l ON h.route_id = l.route_id |
| | | LEFT JOIN aps_material_product_group_management m ON p.material_code = m.material_code AND p.factory = m.factory |
| | | LEFT JOIN aps_standard_process s ON l.route_name = s.process_name |
| | | GROUP BY p.id, p.material_code, p.factory, p.predict_quantity, p.predict_date, h.route_id, l.route_name, l.route_num, l.standard_time |
| | | ORDER BY p.material_code, l.route_num |
| | | </select> |
| | | |
| | | <!-- èåæ¥è¯¢æå·¥æ°ä½å·¥åæ°æ®ç¸å
³ä¿¡æ¯ --> |
| | | <select id="selectMoRouteData" resultType="java.util.Map"> |
| | | SELECT |
| | | mo.id as mo_id, |
| | | mo.mo as work_order_no, |
| | | mo.material_code, |
| | | mo.factory, |
| | | mo.quantity, |
| | | mo.plan_end, |
| | | r.process_name, |
| | | r.process_number, |
| | | r.standard_time, |
| | | string_agg(DISTINCT m.domain, ';') as domain, |
| | | string_agg(DISTINCT s.work_shop, ';') as workshop |
| | | FROM aps_gas_pipeline_mo mo |
| | | JOIN aps_process_route r ON mo.mo = r.work_order_no |
| | | LEFT JOIN aps_material_product_group_management m ON mo.material_code = m.material_code AND mo.factory = m.factory |
| | | LEFT JOIN aps_standard_process s ON r.process_name = s.process_name |
| | | GROUP BY mo.id, mo.mo, mo.material_code, mo.factory, mo.quantity, mo.plan_end, r.process_name, r.process_number, r.standard_time |
| | | ORDER BY mo.mo, r.process_number |
| | | </select> |
| | | |
| | | <!-- èåæ¥è¯¢ç»è®¡æ°æ® - æå·¥åºåç§°åæ¶é´èå --> |
| | | <select id="selectAggregatedStatData" parameterType="java.util.Map" resultType="java.util.Map"> |
| | | SELECT |
| | | process_name AS "processName", |
| | | plan_start_year AS "year", |
| | | plan_start_month AS "month", |
| | | <choose> |
| | | <when test="timeGranularity != null and timeGranularity == 'day'"> |
| | | plan_start_day AS "day" |
| | | </when> |
| | | <otherwise> |
| | | '01' AS "day" |
| | | </otherwise> |
| | | </choose>, |
| | | plant AS "plant", |
| | | major AS "major", |
| | | workshop AS "workshop", |
| | | SUM(process_total_time) AS "totalProcessTime" |
| | | FROM aps_gas_piping_route_stat |
| | | <where> |
| | | <if test="yearStart != null and monthStart != null"> |
| | | (plan_start_year > #{yearStart} OR |
| | | (plan_start_year = #{yearStart} AND plan_start_month >= #{monthStart})) |
| | | AND |
| | | (plan_start_year < #{yearEnd} OR |
| | | (plan_start_year = #{yearEnd} AND plan_start_month <= #{monthEnd})) |
| | | </if> |
| | | <if test="plant != null and plant != ''"> |
| | | AND plant = #{plant} |
| | | </if> |
| | | <if test="major != null and major != ''"> |
| | | AND major = #{major} |
| | | </if> |
| | | <if test="workshop != null and workshop != ''"> |
| | | AND workshop = #{workshop} |
| | | </if> |
| | | </where> |
| | | GROUP BY |
| | | process_name, |
| | | plan_start_year, |
| | | plan_start_month |
| | | <if test="timeGranularity != null and timeGranularity == 'day'"> |
| | | , plan_start_day |
| | | </if>, |
| | | plant, |
| | | major, |
| | | workshop |
| | | ORDER BY |
| | | process_name, |
| | | plan_start_year, |
| | | plan_start_month |
| | | <if test="timeGranularity != null and timeGranularity == 'day'"> |
| | | , plan_start_day |
| | | </if> |
| | | </select> |
| | | |
| | | <!-- æ¥è¯¢åå§ç»è®¡æ°æ®ï¼ä¸è¿è¡èåï¼- ç¨äºå¨Serviceå±èªè¡å¤çèåé»è¾ --> |
| | | <select id="selectRawStatData" parameterType="java.util.Map" resultType="java.util.Map"> |
| | | SELECT |
| | | process_name AS "processName", |
| | | process_plan_start_day AS "processPlanStartDay", |
| | | plant AS "plant", |
| | | major AS "major", |
| | | workshop AS "workshop", |
| | | process_total_time AS "processTotalTime" |
| | | FROM aps_gas_piping_route_stat |
| | | <where> |
| | | <if test="yearStart != null and monthStart != null"> |
| | | (EXTRACT(YEAR FROM process_plan_start_day) > #{yearStart} OR |
| | | (EXTRACT(YEAR FROM process_plan_start_day) = #{yearStart} AND EXTRACT(MONTH FROM process_plan_start_day) >= #{monthStart})) |
| | | AND |
| | | (EXTRACT(YEAR FROM process_plan_start_day) < #{yearEnd} OR |
| | | (EXTRACT(YEAR FROM process_plan_start_day) = #{yearEnd} AND EXTRACT(MONTH FROM process_plan_start_day) <= #{monthEnd})) |
| | | </if> |
| | | <if test="plants != null and plants.size() > 0"> |
| | | AND plant IN |
| | | <foreach collection="plants" item="item" open="(" separator="," close=")"> |
| | | #{item} |
| | | </foreach> |
| | | </if> |
| | | <if test="plant != null and plant != ''"> |
| | | AND plant = #{plant} |
| | | </if> |
| | | <if test="majors != null and majors.size() > 0"> |
| | | AND major IN |
| | | <foreach collection="majors" item="item" open="(" separator="," close=")"> |
| | | #{item} |
| | | </foreach> |
| | | </if> |
| | | <if test="major != null and major != ''"> |
| | | AND major = #{major} |
| | | </if> |
| | | <if test="workshops != null and workshops.size() > 0"> |
| | | AND workshop IN |
| | | <foreach collection="workshops" item="item" open="(" separator="," close=")"> |
| | | #{item} |
| | | </foreach> |
| | | </if> |
| | | <if test="workshop != null and workshop != ''"> |
| | | AND workshop = #{workshop} |
| | | </if> |
| | | </where> |
| | | ORDER BY |
| | | process_name, |
| | | process_plan_start_day |
| | | </select> |
| | | |
| | | <!-- æ¥è¯¢æææå·¥æ°ä½å·¥åæ°æ® --> |
| | | <select id="selectAllMoData" resultType="java.util.Map"> |
| | | SELECT |
| | | id, |
| | | mo, |
| | | factory, |
| | | material_code, |
| | | plan_end, |
| | | quantity |
| | | FROM aps_gas_pipeline_mo |
| | | </select> |
| | | |
| | | <!-- æ¥è¯¢åºç¡ç»è®¡æ°æ®ï¼ä¸å
嫿¶é´éå¶ï¼ï¼ç¨äºè·åææå¯è½çå·¥åºååè½¦é´ --> |
| | | <select id="selectBaseStatData" parameterType="java.util.Map" resultType="java.util.Map"> |
| | | SELECT DISTINCT |
| | | process_name AS "processName", |
| | | plant AS "plant", |
| | | major AS "major", |
| | | workshop AS "workshop" |
| | | FROM aps_gas_piping_route_stat |
| | | <where> |
| | | <if test="plants != null and plants.size() > 0"> |
| | | AND plant IN |
| | | <foreach collection="plants" item="item" open="(" separator="," close=")"> |
| | | #{item} |
| | | </foreach> |
| | | </if> |
| | | <if test="plant != null and plant != ''"> |
| | | AND plant = #{plant} |
| | | </if> |
| | | <if test="majors != null and majors.size() > 0"> |
| | | AND major IN |
| | | <foreach collection="majors" item="item" open="(" separator="," close=")"> |
| | | #{item} |
| | | </foreach> |
| | | </if> |
| | | <if test="major != null and major != ''"> |
| | | AND major = #{major} |
| | | </if> |
| | | <if test="workshops != null and workshops.size() > 0"> |
| | | AND workshop IN |
| | | <foreach collection="workshops" item="item" open="(" separator="," close=")"> |
| | | #{item} |
| | | </foreach> |
| | | </if> |
| | | <if test="workshop != null and workshop != ''"> |
| | | AND workshop = #{workshop} |
| | | </if> |
| | | </where> |
| | | </select> |
| | | |
| | | <!-- æ¥è¯¢ææå»éçå·¥åºåç§° --> |
| | | <select id="selectDistinctProcessNames" resultType="java.lang.String"> |
| | | SELECT DISTINCT process_name FROM aps_gas_piping_route_stat WHERE process_name IS NOT NULL AND process_name != '' |
| | | </select> |
| | | |
| | | <!-- æ¥è¯¢ææå»éçè½¦é´ --> |
| | | <select id="selectDistinctWorkshops" resultType="java.lang.String"> |
| | | SELECT DISTINCT workshop FROM aps_gas_piping_route_stat WHERE workshop IS NOT NULL AND workshop != '' |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | left join aps_process_route as pr on ap.document_number=pr.work_order_no |
| | | where cast(pr.process_number as numeric) > cast(ap.process_number as numeric) |
| | | group by ap.document_number |
| | | ), |
| | | b as ( |
| | | select app.doc_no, string_agg( app.require_track_id ,',') as require_track_id |
| | | from aps_plate_standard_require_bom_order_detail as app |
| | | where del_flag='0' |
| | | group by app.doc_no |
| | | ) |
| | | select |
| | | app.id, |
| | | b.require_track_id, |
| | | app.main_part_number, |
| | | app.customer, |
| | | app.business_type, |
| | |
| | | a.remained_process |
| | | from aps_plate_plan as app |
| | | left join a on app.document_number=a.document_number |
| | | left join b on app.document_number=b.doc_no |
| | | where app.del_flag='0'; |
| | | </select> |
| | | </mapper> |
| | |
| | | <update id="removeOtherStat" parameterType="String"> |
| | | delete from aps_plate_process_stat where batch_number != #{batchNumber} |
| | | </update> |
| | | |
| | | <update id="deleteAll" parameterType="String"> |
| | | delete from aps_plate_process_stat |
| | | </update> |
| | | <insert id="batchInsertPlateStat" parameterType="com.aps.core.domain.ApsPlate.ApsPlateProcessStat"> |
| | | insert into aps_plate_process_stat |
| | | ( |
| | |
| | | production_quantity, |
| | | standard_time, |
| | | process_total_time, |
| | | process_plan_start_day, |
| | | process_plan_end_day, |
| | | order_plan_end_day, |
| | | batch_number, |
| | | create_by, |
| | | del_flag |
| | | del_flag, |
| | | warning |
| | | ) |
| | | values |
| | | <foreach collection="list" item="item" index="index" separator=","> |
| | |
| | | #{item.productionQuantity}, |
| | | #{item.standardTime}, |
| | | #{item.processTotalTime}, |
| | | #{item.processPlanStartDay}, |
| | | #{item.processPlanEndDay}, |
| | | #{item.orderPlanEndDay}, |
| | | #{item.batchNumber}, |
| | | #{item.createBy}, |
| | | '0' |
| | | '0', |
| | | #{item.warning} |
| | | ) |
| | | </foreach> |
| | | </insert> |
| | |
| | | </delete> |
| | | |
| | | <update id="deleteLastPatch" parameterType="String"> |
| | | update aps_plate_standard_require_bom_order_detail set del_flag = '1' where batch_number = #{batchNumber} |
| | | update aps_plate_standard_require_bom_order_detail set del_flag = '1' where del_flag = '0' and batch_number != #{batchNumber} |
| | | </update> |
| | | |
| | | <insert id="batchInsert" parameterType="com.aps.core.domain.ApsPlate.ApsPlateStandardRequireBomOrderDetail"> |
| | |
| | | </delete> |
| | | |
| | | <update id="deleteLastPatch" parameterType="String"> |
| | | update aps_plate_standard_require_bom_stock_detail set del_flag = '1' where batch_number = #{batchNumber} |
| | | update aps_plate_standard_require_bom_stock_detail |
| | | set del_flag = '1' |
| | | where del_flag = '0' and batch_number != #{batchNumber} |
| | | </update> |
| | | |
| | | <insert id="batchInsert" parameterType="com.aps.core.domain.ApsPlate.ApsPlateStandardRequireBomStockDetail"> |
| | |
| | | </foreach> |
| | | </delete> |
| | | <update id="deleteLastPatch" parameterType="String"> |
| | | update aps_plate_standard_require_error set del_flag = '1' where batch_number = #{batchNumber} |
| | | update aps_plate_standard_require_error |
| | | set del_flag = '1' |
| | | where del_flag = '0' and batch_number != #{batchNumber} |
| | | </update> |
| | | |
| | | <insert id="batchInsert" parameterType="java.util.List"> |
| | | insert into aps_plate_standard_require_error( |
| | | id, batch_number, require_id, doc_num, item_num, org_code, |
| | | message, del_flag, create_by, create_time |
| | | ) values |
| | | <foreach collection="list" item="item" separator=","> |
| | | ( |
| | | #{item.id}, #{item.batchNumber}, #{item.requireId}, #{item.docNum}, |
| | | #{item.itemNum}, #{item.orgCode}, #{item.message}, #{item.delFlag}, |
| | | #{item.createBy}, #{item.createTime} |
| | | ) |
| | | </foreach> |
| | | </insert> |
| | | </mapper> |
| | |
| | | </foreach> |
| | | </insert> |
| | | <update id="deleteLastPatch" parameterType="String"> |
| | | update aps_plate_standard_require set del_flag = '1' where batch_number = #{batchNumber} |
| | | update aps_plate_standard_require set del_flag = '1' where del_flag = '0' and batch_number != #{batchNumber} |
| | | </update> |
| | | </mapper> |
| | |
| | | </insert> |
| | | |
| | | <select id="queryWeldSeamStatistics" resultMap="ApsWeldSeamStatisticsV2Result"> |
| | | WITH å·¥åçç¼è®¡ç® AS ( |
| | | WITH order_weld_calc AS ( |
| | | -- 计ç®å·¥åççç¼æ°é |
| | | SELECT |
| | | mo.factory as ç产åºå°, |
| | | mo.material_code as æå·, |
| | | EXTRACT(YEAR FROM mo.plan_end) as 年份, |
| | | EXTRACT(MONTH FROM mo.plan_end) as æä»½, |
| | | mo.quantity * COALESCE(ws.hup_qty, 0) as å·¥åçç¼æ°, |
| | | mgm.domain as ä¸ä¸ |
| | | mo.factory as production_base, |
| | | mo.material_code as material_no, |
| | | EXTRACT(YEAR FROM mo.plan_end) as year, |
| | | EXTRACT(MONTH FROM mo.plan_end) as month, |
| | | mo.quantity * COALESCE(ws.hup_qty, 0) as order_weld_count, |
| | | mgm.domain as domain |
| | | FROM aps_gas_pipeline_mo mo |
| | | LEFT JOIN aps_weld_seam_standard ws ON mo.material_code = ws.item_code AND ws.del_flag = 0 |
| | | LEFT JOIN aps_material_product_group_management mgm ON mo.material_code = mgm.material_code AND mo.factory = mgm.factory |
| | | ), |
| | | 颿µçç¼è®¡ç® AS ( |
| | | predict_weld_calc AS ( |
| | | -- 计ç®é¢æµççç¼æ°é |
| | | SELECT |
| | | gp.factory as ç产åºå°, |
| | | gp.material_code as æå·, |
| | | EXTRACT(YEAR FROM gp.predict_date) as 年份, |
| | | EXTRACT(MONTH FROM gp.predict_date) as æä»½, |
| | | gp.predict_quantity * COALESCE(ws.hup_qty, 0) as 颿µçç¼æ°, |
| | | mgm.domain as ä¸ä¸ |
| | | gp.factory as production_base, |
| | | gp.material_code as material_no, |
| | | EXTRACT(YEAR FROM gp.predict_date) as year, |
| | | EXTRACT(MONTH FROM gp.predict_date) as month, |
| | | gp.predict_quantity * COALESCE(ws.hup_qty, 0) as predict_weld_count, |
| | | mgm.domain as domain |
| | | FROM aps_gas_pipeline_prediction gp |
| | | LEFT JOIN aps_weld_seam_standard ws ON gp.material_code = ws.item_code AND ws.del_flag = 0 |
| | | LEFT JOIN aps_material_product_group_management mgm ON gp.material_code = mgm.material_code AND gp.factory = mgm.factory |
| | | ), |
| | | æ±æ»æ°æ® AS ( |
| | | summary_data AS ( |
| | | SELECT |
| | | 年份, |
| | | æä»½, |
| | | ç产åºå°, |
| | | year, |
| | | month, |
| | | production_base, |
| | | -- 管路订åéæ± |
| | | COALESCE(SUM(CASE |
| | | WHEN ä¸ä¸ = 'GL' AND ç±»å = 'å·¥å' |
| | | THEN çç¼æ° ELSE 0 |
| | | END), 0) as 管路订åéæ±, |
| | | WHEN domain = 'GL' AND type = 'order' |
| | | THEN weld_count ELSE 0 |
| | | END), 0) as piping_order_requirement, |
| | | -- æ°æè®¢åéæ± |
| | | COALESCE(SUM(CASE |
| | | WHEN ä¸ä¸ = 'QG' AND ç±»å = 'å·¥å' |
| | | THEN çç¼æ° ELSE 0 |
| | | END), 0) as æ°æè®¢åéæ±, |
| | | WHEN domain = 'QG' AND type = 'order' |
| | | THEN weld_count ELSE 0 |
| | | END), 0) as gas_order_requirement, |
| | | -- ç®¡è·¯é¢æµéæ± |
| | | COALESCE(SUM(CASE |
| | | WHEN ä¸ä¸ = 'GL' AND ç±»å = '颿µ' |
| | | THEN çç¼æ° ELSE 0 |
| | | END), 0) as ç®¡è·¯é¢æµéæ±, |
| | | WHEN domain = 'GL' AND type = 'predict' |
| | | THEN weld_count ELSE 0 |
| | | END), 0) as piping_predict_requirement, |
| | | -- æ°æé¢æµéæ± |
| | | COALESCE(SUM(CASE |
| | | WHEN ä¸ä¸ = 'QG' AND ç±»å = '颿µ' |
| | | THEN çç¼æ° ELSE 0 |
| | | END), 0) as æ°æé¢æµéæ± |
| | | WHEN domain = 'QG' AND type = 'predict' |
| | | THEN weld_count ELSE 0 |
| | | END), 0) as gas_predict_requirement |
| | | FROM ( |
| | | SELECT |
| | | 年份, |
| | | æä»½, |
| | | ç产åºå°, |
| | | å·¥åçç¼æ° as çç¼æ°, |
| | | 'å·¥å' as ç±»å, |
| | | ä¸ä¸ |
| | | FROM å·¥åçç¼è®¡ç® |
| | | year, |
| | | month, |
| | | production_base, |
| | | order_weld_count as weld_count, |
| | | 'order' as type, |
| | | domain |
| | | FROM order_weld_calc |
| | | UNION ALL |
| | | SELECT |
| | | 年份, |
| | | æä»½, |
| | | ç产åºå°, |
| | | 颿µçç¼æ° as çç¼æ°, |
| | | '颿µ' as ç±»å, |
| | | ä¸ä¸ |
| | | FROM 颿µçç¼è®¡ç® |
| | | ) åå¹¶æ°æ® |
| | | GROUP BY 年份, æä»½, ç产åºå° |
| | | year, |
| | | month, |
| | | production_base, |
| | | predict_weld_count as weld_count, |
| | | 'predict' as type, |
| | | domain |
| | | FROM predict_weld_calc |
| | | ) merged_data |
| | | GROUP BY year, month, production_base |
| | | ) |
| | | SELECT |
| | | s.年份 as "year", |
| | | s.æä»½ as "month", |
| | | s.ç产åºå° as "production_base", |
| | | ROUND(s.管路订åéæ±, 4) as "piping_order_requirement", |
| | | ROUND(s.æ°æè®¢åéæ±, 4) as "gas_order_requirement", |
| | | ROUND(s.ç®¡è·¯é¢æµéæ±, 4) as "piping_prediction_requirement", |
| | | ROUND(s.æ°æé¢æµéæ±, 4) as "gas_prediction_requirement", |
| | | s.year as "year", |
| | | s.month as "month", |
| | | s.production_base as "production_base", |
| | | ROUND(s.piping_order_requirement, 4) as "piping_order_requirement", |
| | | ROUND(s.gas_order_requirement, 4) as "gas_order_requirement", |
| | | ROUND(s.piping_predict_requirement, 4) as "piping_prediction_requirement", |
| | | ROUND(s.gas_predict_requirement, 4) as "gas_prediction_requirement", |
| | | 0 as "reserve_emergency_order_output", |
| | | ROUND(s.管路订åéæ± + s.æ°æè®¢åéæ± + s.ç®¡è·¯é¢æµéæ± + s.æ°æé¢æµéæ±, 4) as "total", |
| | | ROUND(s.piping_order_requirement + s.gas_order_requirement + s.piping_predict_requirement + s.gas_predict_requirement, 4) as "total", |
| | | 0 as "days", |
| | | 0 as "requirement_day_weld_seam", |
| | | 0 as "production_day_weld_seam", |
| | | '0' as "is_satisfy", |
| | | 'system' as "create_by", |
| | | CURRENT_TIMESTAMP as "create_time" |
| | | FROM æ±æ»æ°æ® s |
| | | ORDER BY s.年份, s.æä»½, s.ç产åºå° |
| | | FROM summary_data s |
| | | ORDER BY s.year, s.month, s.production_base |
| | | </select> |
| | | </mapper> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.aps.job.domain; |
| | | |
| | | import com.aps.common.core.annotation.Excel; |
| | | import com.aps.common.core.web.domain.BaseEntity; |
| | | import com.fasterxml.jackson.annotation.JsonProperty; |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.Builder; |
| | | import lombok.Data; |
| | | import lombok.NoArgsConstructor; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | /** |
| | | * çç¼æ å对象 aps_weld_seam_standard_job |
| | | * |
| | | * @author user |
| | | * @date 2023-11-05 |
| | | */ |
| | | @Data |
| | | @Builder |
| | | @NoArgsConstructor |
| | | @AllArgsConstructor |
| | | public class ApsWeldSeamStandardJob extends BaseEntity |
| | | { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** 主é®ID */ |
| | | private Long id; |
| | | |
| | | /** æå·ï¼æ¥å£ä¸å¯¹åºplantCountæverIdï¼ */ |
| | | @Excel(name = "æå·") |
| | | private String itemCode; |
| | | |
| | | /** å¾å· */ |
| | | @Excel(name = "å¾å·") |
| | | private String itemFigure; |
| | | |
| | | /** çæ¬å· */ |
| | | @Excel(name = "çæ¬å·") |
| | | private String itemFigureVersion; |
| | | |
| | | /** åä»¶çç¼æ°ï¼Hupï¼ */ |
| | | @Excel(name = "åä»¶çç¼æ°ï¼Hupï¼") |
| | | private BigDecimal hupQty; |
| | | |
| | | /** åä»¶çç¼æ°ï¼LODï¼ */ |
| | | @Excel(name = "åä»¶çç¼æ°ï¼LODï¼") |
| | | private BigDecimal lodQty; |
| | | |
| | | /** çæ¥å½¢å¼(hup\lod) */ |
| | | @Excel(name = "çæ¥å½¢å¼") |
| | | private String type; |
| | | |
| | | /** æ¯å¦å é¤(0å¦ï¼1æ¯) */ |
| | | private Integer delFlag; |
| | | } |
| | |
| | | package com.aps.job.mapper; |
| | | |
| | | import com.aps.job.domain.ApsBomHeaderJob; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | |
| | | * @author hjy |
| | | * @date 2025-05-08 |
| | | */ |
| | | @Mapper |
| | | public interface ApsBomHeaderJobMapper |
| | | { |
| | | /** |
| | |
| | | package com.aps.job.mapper; |
| | | |
| | | import com.aps.job.domain.ApsBomLineJob; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | |
| | | * @author hjy |
| | | * @date 2025-05-08 |
| | | */ |
| | | @Mapper |
| | | public interface ApsBomLineJobMapper |
| | | { |
| | | /** |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.aps.job.mapper; |
| | | |
| | | import com.aps.job.domain.ApsWeldSeamStandardJob; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * çç¼æ åJob Mapperæ¥å£ |
| | | * |
| | | * @author user |
| | | * @date 2023-11-05 |
| | | */ |
| | | @Mapper |
| | | public interface ApsWeldSeamStandardJobMapper |
| | | { |
| | | /** |
| | | * æ¥è¯¢çç¼æ åå表 |
| | | * |
| | | * @param apsWeldSeamStandardJob çç¼æ å |
| | | * @return çç¼æ åéå |
| | | */ |
| | | public List<ApsWeldSeamStandardJob> selectApsWeldSeamStandardJobList(ApsWeldSeamStandardJob apsWeldSeamStandardJob); |
| | | |
| | | /** |
| | | * å 餿æçç¼æ åJobæ°æ® |
| | | * |
| | | * @return ç»æ |
| | | */ |
| | | public int deleteAllApsWeldSeamStandardJob(); |
| | | |
| | | /** |
| | | * æ¹éæ°å¢çç¼æ åJob |
| | | * |
| | | * @param list çç¼æ åJobå表 |
| | | * @return ç»æ |
| | | */ |
| | | public int batchInsertApsWeldSeamStandardJob(List<ApsWeldSeamStandardJob> list); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.aps.job.mapper; |
| | | |
| | | import com.aps.job.domain.ApsWeldSeamStandardJob; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * çç¼æ åä¸å¡è¡¨ Mapperæ¥å£ |
| | | * |
| | | * @author user |
| | | * @date 2023-11-05 |
| | | */ |
| | | @Mapper |
| | | public interface ApsWeldSeamStandardMapper |
| | | { |
| | | /** |
| | | * å 餿æçç¼æ åæ°æ® |
| | | * |
| | | * @return ç»æ |
| | | */ |
| | | public int deleteAllApsWeldSeamStandard(); |
| | | |
| | | /** |
| | | * æ¹éæ°å¢çç¼æ å |
| | | * |
| | | * @param list çç¼æ åJobå表 |
| | | * @return ç»æ |
| | | */ |
| | | public int batchInsertApsWeldSeamStandard(List<ApsWeldSeamStandardJob> list); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.aps.job.service; |
| | | |
| | | import com.aps.job.domain.ApsWeldSeamStandardJob; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * çç¼æ åJob Serviceæ¥å£ |
| | | * |
| | | * @author user |
| | | * @date 2023-11-05 |
| | | */ |
| | | public interface IApsWeldSeamStandardJobService |
| | | { |
| | | /** |
| | | * æ¥è¯¢çç¼æ åå表 |
| | | * |
| | | * @param apsWeldSeamStandardJob çç¼æ å |
| | | * @return çç¼æ åéå |
| | | */ |
| | | public List<ApsWeldSeamStandardJob> selectApsWeldSeamStandardJobList(ApsWeldSeamStandardJob apsWeldSeamStandardJob); |
| | | |
| | | /** |
| | | * å 餿æçç¼æ åJobæ°æ® |
| | | * |
| | | * @return ç»æ |
| | | */ |
| | | public int deleteAllApsWeldSeamStandardJob(); |
| | | |
| | | /** |
| | | * æ¹éæ°å¢çç¼æ åJob |
| | | * |
| | | * @param list çç¼æ åJobå表 |
| | | * @return ç»æ |
| | | */ |
| | | public int batchInsertApsWeldSeamStandardJob(List<ApsWeldSeamStandardJob> list); |
| | | |
| | | /** |
| | | * åæ¥ç©ææ åçç¼æ°æ® |
| | | * |
| | | * @return ç»æ |
| | | */ |
| | | public boolean syncWeldSeamStandardData(); |
| | | } |
| | |
| | | import cn.hutool.core.util.IdUtil; |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.alibaba.fastjson2.JSON; |
| | | import com.aps.common.core.constant.SecurityConstants; |
| | | import com.aps.common.core.utils.DateUtils; |
| | | import com.aps.common.core.utils.StringUtils; |
| | |
| | | import com.aps.job.mapper.ApsWorkOrderJobLogMapper; |
| | | import com.aps.job.service.IApsBomHeaderJobService; |
| | | import com.aps.system.api.RemoteCoreService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.http.HttpEntity; |
| | |
| | | * @date 2025-05-08 |
| | | */ |
| | | @Service |
| | | @Slf4j |
| | | public class ApsBomHeaderJobServiceImpl implements IApsBomHeaderJobService |
| | | { |
| | | @Autowired |
| | |
| | | jobLog.setResult("header:"+headerList.size() + " line:"+lineList.size()); |
| | | jobLog.setCreateBy(batchNum); |
| | | jobLogMapper.insertApsWorkOrderJobLog(jobLog); |
| | | log.info("BOM忥ï¼"+ JSON.toJSONString(jobLog)); |
| | | |
| | | pageIndex++; |
| | | }else{ |
| | | break; |
| | |
| | | jobLog.setResult("error"); |
| | | jobLog.setCreateBy(batchNum); |
| | | jobLogMapper.insertApsWorkOrderJobLog(jobLog); |
| | | log.info("BOM忥ï¼"+ JSON.toJSONString(jobLog)); |
| | | break; |
| | | } |
| | | } |
| | |
| | | jobLog.setResult("error"); |
| | | jobLog.setCreateBy(batchNum); |
| | | jobLogMapper.insertApsWorkOrderJobLog(jobLog); |
| | | log.info("BOM忥å¼å¸¸ä¿¡æ¯ï¼"+ JSON.toJSONString(jobLog)); |
| | | return false; |
| | | } |
| | | return true; |
| | |
| | | @Override |
| | | public boolean syncBomDataJob(Integer pageIndex, Integer pageSize, String orgCode, String itemCodeList){ |
| | | try { |
| | | log.info("å
¨é忥BOMæ°æ®å®æ¶ä»»å¡å¼å§"); |
| | | log.info(" DELETE FROM aps_bom_header_job"); |
| | | apsBomHeaderJobMapper.deleteApsBomHeaderJob(); |
| | | log.info(" DELETE FROM aps_bom_line_job"); |
| | | apsBomLineJobMapper.deleteApsBomLineJob(); |
| | | boolean res = syncBomData(pageIndex, pageSize, orgCode, itemCodeList); |
| | | if(!res){ |
| | | return false; |
| | | } |
| | | log.info("å°BOM忥å°Redis"); |
| | | remoteCoreService.setBomDataToRedis(SecurityConstants.INNER); |
| | | log.info("deleteApsBomHeader"); |
| | | apsBomHeaderJobMapper.deleteApsBomHeader(); |
| | | log.info("deleteApsBomLine"); |
| | | apsBomLineJobMapper.deleteApsBomLine(); |
| | | log.info("insertIntoApsBomHeader"); |
| | | apsBomHeaderJobMapper.insertIntoApsBomHeader(); |
| | | log.info("insertIntoApsBomLine"); |
| | | apsBomLineJobMapper.insertIntoApsBomLine(); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | |
| | | import cn.hutool.core.util.IdUtil; |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.alibaba.fastjson2.JSON; |
| | | import com.aps.common.core.utils.DateUtils; |
| | | import com.aps.common.core.utils.StringUtils; |
| | | import com.aps.common.core.utils.uuid.IdUtils; |
| | |
| | | import com.aps.job.mapper.ApsMaterialManagementJobMapper; |
| | | import com.aps.job.mapper.ApsWorkOrderJobLogMapper; |
| | | import com.aps.job.service.IApsMaterialManagementJobService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.http.HttpEntity; |
| | |
| | | * @date 2025-05-10 |
| | | */ |
| | | @Service |
| | | @Slf4j |
| | | public class ApsMaterialManagementJobServiceImpl implements IApsMaterialManagementJobService |
| | | { |
| | | @Autowired |
| | |
| | | jobLog.setResult("material:"+materialList.size()); |
| | | jobLog.setCreateBy(batchNum); |
| | | jobLogMapper.insertApsWorkOrderJobLog(jobLog); |
| | | log.info("ç©æåæ¥ï¼"+ JSON.toJSONString(jobLog)); |
| | | pageIndex++; |
| | | }else{ |
| | | break; |
| | |
| | | jobLog.setResult("error"); |
| | | jobLog.setCreateBy(batchNum); |
| | | jobLogMapper.insertApsWorkOrderJobLog(jobLog); |
| | | log.info("ç©æåæ¥ï¼"+ JSON.toJSONString(jobLog)); |
| | | break; |
| | | } |
| | | } |
| | |
| | | jobLog.setResult("error"); |
| | | jobLog.setCreateBy(batchNum); |
| | | jobLogMapper.insertApsWorkOrderJobLog(jobLog); |
| | | log.info("ç©æåæ¥ï¼"+ JSON.toJSONString(jobLog)); |
| | | return false; |
| | | } |
| | | return true; |
| | |
| | | @Override |
| | | public boolean syncApsMaterialDataJob(int pageIndex, int pageSize, String orgCode, String itemCodeList) { |
| | | try { |
| | | log.info("å¼å§æ¸
é¤ç©æä¸é´è¡¨aps_material_management_job"); |
| | | apsMaterialManagementJobMapper.deleteApsMaterialJob(); |
| | | log.info("å¼å§åæ¥ç©æä¿¡æ¯"); |
| | | boolean res = syncApsMaterialData(pageIndex, pageSize, orgCode, itemCodeList); |
| | | if(!res){ |
| | | return false; |
| | | } |
| | | log.info("å¼å§æ¸
é¤ç©æè¡¨ aps_material_management"); |
| | | apsMaterialManagementJobMapper.deleteApsMaterial(); |
| | | log.info("æå
¥æ°æ®å° aps_material_management"); |
| | | apsMaterialManagementJobMapper.insertIntoApsMaterialManagement(); |
| | | return true; |
| | | } catch (Exception e) { |
| | |
| | | package com.aps.job.service.impl; |
| | | |
| | | import cn.hutool.core.util.IdUtil; |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.aps.common.core.utils.DateUtils; |
| | |
| | | import com.aps.job.mapper.ApsMaterialStorageManagementJobMapper; |
| | | import com.aps.job.mapper.ApsWorkOrderJobLogMapper; |
| | | import com.aps.job.service.IApsMaterialStorageManagementJobService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.http.HttpEntity; |
| | |
| | | * @date 2025-05-08 |
| | | */ |
| | | @Service |
| | | @Slf4j |
| | | public class ApsMaterialStorageManagementJobServiceImpl implements IApsMaterialStorageManagementJobService |
| | | { |
| | | @Autowired |
| | |
| | | jobLog.setResult("storage:"+storageList.size()); |
| | | jobLog.setCreateBy(batchNum); |
| | | jobLogMapper.insertApsWorkOrderJobLog(jobLog); |
| | | log.info("ç©æåæ¥ï¼"+ JSON.toJSONString(jobLog)); |
| | | pageIndex++; |
| | | }else{ |
| | | break; |
| | |
| | | jobLog.setResult("error"); |
| | | jobLog.setCreateBy(batchNum); |
| | | jobLogMapper.insertApsWorkOrderJobLog(jobLog); |
| | | log.info("ç©æåæ¥å¼å¸¸ï¼"+ JSON.toJSONString(jobLog)); |
| | | break; |
| | | } |
| | | } |
| | |
| | | jobLog.setResult("error"); |
| | | jobLog.setCreateBy(batchNum); |
| | | jobLogMapper.insertApsWorkOrderJobLog(jobLog); |
| | | log.info("ç©æåæ¥å¼å¸¸ï¼"+ JSON.toJSONString(jobLog)); |
| | | return false; |
| | | } |
| | | return true; |
| | |
| | | @Override |
| | | public boolean syncApsMaterialStorageDataJob(int pageIndex, int pageSize, String orgCode, String itemCodeList) { |
| | | try { |
| | | log.info("å¼å§åæ¥åºåæ°æ®"); |
| | | log.info("delete ApsMaterialStorageJob"); |
| | | apsMaterialStorageManagementJobMapper.deleteApsMaterialStorageJob(); |
| | | log.info("sync ApsMaterialStorageData"); |
| | | boolean res = syncApsMaterialStorageData(pageIndex, pageSize, orgCode, itemCodeList); |
| | | if(!res){ |
| | | return false; |
| | | } |
| | | log.info("delete ApsMaterialStorage"); |
| | | apsMaterialStorageManagementJobMapper.deleteApsMaterialStorage(); |
| | | log.info("insertInto ApsMaterialStorage "); |
| | | apsMaterialStorageManagementJobMapper.insertIntoApsMaterialStorage(); |
| | | return true; |
| | | } catch (Exception e) { |
| | |
| | | package com.aps.job.service.impl; |
| | | |
| | | import cn.hutool.core.util.IdUtil; |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.aps.common.core.constant.SecurityConstants; |
| | |
| | | import com.aps.job.mapper.ApsWorkOrderJobLogMapper; |
| | | import com.aps.job.service.IApsStandardProcessRouteHeaderJobService; |
| | | import com.aps.system.api.RemoteCoreService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.http.HttpEntity; |
| | |
| | | * @author hjy |
| | | * @date 2025-05-09 |
| | | */ |
| | | @Slf4j |
| | | @Service |
| | | public class ApsStandardProcessRouteHeaderJobServiceImpl implements IApsStandardProcessRouteHeaderJobService |
| | | { |
| | |
| | | jobLog.setResult("header:"+headerList.size() + " line:"+lineList.size()); |
| | | jobLog.setCreateBy(batchNum); |
| | | jobLogMapper.insertApsWorkOrderJobLog(jobLog); |
| | | log.info("æ åå·¥èºè·¯çº¿åæ¥ï¼"+ JSON.toJSONString(jobLog)); |
| | | pageIndex++; |
| | | }else{ |
| | | break; |
| | |
| | | jobLog.setBizType("processRoute"); |
| | | jobLog.setResult("error"); |
| | | jobLog.setCreateBy(batchNum); |
| | | log.info("æ åå·¥èºè·¯çº¿åæ¥ï¼"+ JSON.toJSONString(jobLog)); |
| | | jobLogMapper.insertApsWorkOrderJobLog(jobLog); |
| | | break; |
| | | } |
| | |
| | | jobLog.setBizType("processRoute"); |
| | | jobLog.setResult("error"); |
| | | jobLog.setCreateBy(batchNum); |
| | | log.info("æ åå·¥èºè·¯çº¿åæ¥ï¼"+ JSON.toJSONString(jobLog)); |
| | | jobLogMapper.insertApsWorkOrderJobLog(jobLog); |
| | | return false; |
| | | } |
| | |
| | | @Override |
| | | public boolean syncProcessRouteDataJob(Integer pageIndex, Integer pageSize, String orgCode, String itemCodeList) { |
| | | try { |
| | | |
| | | apsStandardProcessRouteHeaderJobMapper.deleteProcessRouteHeaderJob(); |
| | | apsStandardProcessRouteLineJobMapper.deleteProcessRouteLineJob(); |
| | | boolean res = syncProcessRouteData(pageIndex, pageSize, orgCode, itemCodeList); |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.aps.job.service.impl; |
| | | |
| | | import cn.hutool.core.collection.ListUtil; |
| | | import com.alibaba.fastjson2.JSON; |
| | | import com.alibaba.fastjson2.JSONArray; |
| | | import com.alibaba.fastjson2.JSONObject; |
| | | import com.aps.common.core.utils.StringUtils; |
| | | import com.aps.common.security.utils.SecurityUtils; |
| | | import com.aps.job.domain.ApsWeldSeamStandardJob; |
| | | import com.aps.job.mapper.ApsWeldSeamStandardMapper; |
| | | import com.aps.job.mapper.ApsWeldSeamStandardJobMapper; |
| | | import com.aps.job.service.IApsWeldSeamStandardJobService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.http.HttpEntity; |
| | | import org.springframework.http.HttpHeaders; |
| | | import org.springframework.http.MediaType; |
| | | import org.springframework.http.ResponseEntity; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.web.client.RestTemplate; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.concurrent.atomic.AtomicLong; |
| | | |
| | | /** |
| | | * çç¼æ åJob Serviceä¸å¡å±å¤ç |
| | | * |
| | | * @author user |
| | | * @date 2023-11-05 |
| | | */ |
| | | @Slf4j |
| | | @Service |
| | | public class ApsWeldSeamStandardJobServiceImpl implements IApsWeldSeamStandardJobService |
| | | { |
| | | @Autowired |
| | | private ApsWeldSeamStandardJobMapper apsWeldSeamStandardJobMapper; |
| | | |
| | | @Autowired |
| | | private ApsWeldSeamStandardMapper apsWeldSeamStandardMapper; |
| | | |
| | | @Autowired |
| | | private RestTemplate restTemplate; |
| | | |
| | | @Value("${pipingIntegrationplatform.apsWeldSeamStandard}") |
| | | private String apsWeldSeamStandardUrl; |
| | | |
| | | /** |
| | | * æ¥è¯¢çç¼æ åå表 |
| | | * |
| | | * @param apsWeldSeamStandardJob çç¼æ å |
| | | * @return çç¼æ åéå |
| | | */ |
| | | @Override |
| | | public List<ApsWeldSeamStandardJob> selectApsWeldSeamStandardJobList(ApsWeldSeamStandardJob apsWeldSeamStandardJob) |
| | | { |
| | | return apsWeldSeamStandardJobMapper.selectApsWeldSeamStandardJobList(apsWeldSeamStandardJob); |
| | | } |
| | | |
| | | /** |
| | | * å 餿æçç¼æ åJobæ°æ® |
| | | * |
| | | * @return ç»æ |
| | | */ |
| | | @Override |
| | | public int deleteAllApsWeldSeamStandardJob() |
| | | { |
| | | return apsWeldSeamStandardJobMapper.deleteAllApsWeldSeamStandardJob(); |
| | | } |
| | | |
| | | /** |
| | | * æ¹éæ°å¢çç¼æ åJob |
| | | * |
| | | * @param list çç¼æ åJobå表 |
| | | * @return ç»æ |
| | | */ |
| | | @Override |
| | | public int batchInsertApsWeldSeamStandardJob(List<ApsWeldSeamStandardJob> list) |
| | | { |
| | | return apsWeldSeamStandardJobMapper.batchInsertApsWeldSeamStandardJob(list); |
| | | } |
| | | |
| | | /** |
| | | * åæ¥ç©ææ åçç¼æ°æ® |
| | | * |
| | | * @return ç»æ |
| | | */ |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public boolean syncWeldSeamStandardData() |
| | | { |
| | | try { |
| | | log.info("å¼å§åæ¥ç©ææ åçç¼æ°æ®"); |
| | | // 使ç¨POSTæ¹æ³è°ç¨æ¥å£ |
| | | HttpHeaders headers = new HttpHeaders(); |
| | | headers.setContentType(MediaType.APPLICATION_JSON); |
| | | |
| | | // åå¤è¯·æ±åæ° - ä¼ éå·¥å代ç å符串æ°ç»ï¼è®¾ç½®ä¸ºç©ºæ°ç» |
| | | String[] plantCodeArray = new String[0]; |
| | | |
| | | // ç´æ¥ä½¿ç¨å符串æ°ç»ä½ä¸ºè¯·æ±ä½ |
| | | HttpEntity<String[]> requestEntity = new HttpEntity<>(plantCodeArray, headers); |
| | | |
| | | ResponseEntity<String> responseEntity = restTemplate.postForEntity(apsWeldSeamStandardUrl, requestEntity, String.class); |
| | | if (!responseEntity.getStatusCode().is2xxSuccessful()) { |
| | | log.error("è·åç©ææ åçç¼æ°æ®å¤±è´¥"); |
| | | return false; |
| | | } |
| | | |
| | | String responseBody = responseEntity.getBody(); |
| | | if (StringUtils.isEmpty(responseBody)) { |
| | | return false; |
| | | } |
| | | |
| | | JSONObject responseJson = JSON.parseObject(responseBody); |
| | | |
| | | // æ£æ¥è¿åç |
| | | if (responseJson.getIntValue("code") != 0) { |
| | | return false; |
| | | } |
| | | |
| | | // è·åæ¥å£è¿åçæ°æ® |
| | | JSONArray weldSeamList = responseJson.getJSONArray("ok"); |
| | | if (weldSeamList == null || weldSeamList.isEmpty()) { |
| | | return false; |
| | | } |
| | | |
| | | // è§£ææ°æ®å¹¶è½¬æ¢ä¸ºå®ä½å¯¹è±¡ |
| | | List<ApsWeldSeamStandardJob> jobList = new ArrayList<>(); |
| | | AtomicLong idCounter = new AtomicLong(System.currentTimeMillis()); // 使ç¨å½åæ¶é´æ³ä½ä¸ºèµ·å§ID |
| | | |
| | | for (int i = 0; i < weldSeamList.size(); i++) { |
| | | JSONObject item = weldSeamList.getJSONObject(i); |
| | | |
| | | // ä½¿ç¨æ£ç¡®çåæ®µåç§° plantCode |
| | | String plantCode = item.getString("plantCode"); |
| | | |
| | | // è·åUHPåLODæ°é |
| | | BigDecimal uhpCount = null; |
| | | BigDecimal lodCount = null; |
| | | |
| | | try { |
| | | uhpCount = item.getBigDecimal("uhpCount"); |
| | | } catch (Exception e) { |
| | | // 忽ç¥å¼å¸¸ |
| | | } |
| | | |
| | | try { |
| | | lodCount = item.getBigDecimal("lodCount"); |
| | | } catch (Exception e) { |
| | | // 忽ç¥å¼å¸¸ |
| | | } |
| | | |
| | | // å¤ææ°æ®æ¯å¦å®æ´ |
| | | if (StringUtils.isEmpty(plantCode)) { |
| | | continue; |
| | | } |
| | | |
| | | ApsWeldSeamStandardJob job = new ApsWeldSeamStandardJob(); |
| | | // 为idèµå¼ï¼ä½¿ç¨èªå¢é¿æ´å |
| | | job.setId(idCounter.incrementAndGet()); |
| | | job.setItemCode(plantCode); // æ å°å
³ç³»: plantCode -> itemCode |
| | | job.setHupQty(uhpCount); // æ å°å
³ç³»: uhpCount -> hupQty |
| | | job.setLodQty(lodCount); // æ å°å
³ç³»: lodCount -> lodQty |
| | | job.setDelFlag(0); |
| | | // ä¸å设置createByåcreateTime |
| | | jobList.add(job); |
| | | } |
| | | |
| | | if (jobList.isEmpty()) { |
| | | return false; |
| | | } |
| | | log.info("æ¸
ç©ºæ§æ°æ® deleteAllApsWeldSeamStandardJob"); |
| | | // æ¸
ç©ºæ§æ°æ® |
| | | deleteAllApsWeldSeamStandardJob(); |
| | | |
| | | // æ¹éæå
¥æ°æ°æ® |
| | | List<List<ApsWeldSeamStandardJob>> dataGroup = ListUtil.split(jobList, 1000); |
| | | for (List<ApsWeldSeamStandardJob> data : dataGroup) { |
| | | batchInsertApsWeldSeamStandardJob(data); |
| | | } |
| | | |
| | | // å é¤ä¸å¡è¡¨æ°æ®ï¼å
¨éè¦çï¼ |
| | | deleteAllApsWeldSeamStandard(); |
| | | // åæ¥æ°æ®å°ä¸å¡è¡¨ |
| | | for (List<ApsWeldSeamStandardJob> data : dataGroup) { |
| | | syncToBizTable(data); |
| | | } |
| | | return true; |
| | | } catch (Exception e) { |
| | | log.error("åæ¥ç©ææ åçç¼æ°æ®å¼å¸¸", e); |
| | | throw e; |
| | | } |
| | | } |
| | | |
| | | private void deleteAllApsWeldSeamStandard() { |
| | | apsWeldSeamStandardMapper.deleteAllApsWeldSeamStandard(); |
| | | } |
| | | /** |
| | | * åæ¥æ°æ®å°ä¸å¡è¡¨ |
| | | * |
| | | * @param jobList çç¼æ åJobæ°æ®å表 |
| | | */ |
| | | private void syncToBizTable(List<ApsWeldSeamStandardJob> jobList) { |
| | | try { |
| | | if (jobList == null || jobList.isEmpty()) { |
| | | return; |
| | | } |
| | | |
| | | // æ¹éæå
¥æ°æ®å°ä¸å¡è¡¨ |
| | | apsWeldSeamStandardMapper.batchInsertApsWeldSeamStandard(jobList); |
| | | } catch (Exception e) { |
| | | log.error("åæ¥ç©ææ åçç¼æ°æ®å°ä¸å¡è¡¨å¼å¸¸", e); |
| | | throw e; |
| | | } |
| | | } |
| | | } |
| | |
| | | import org.springframework.http.MediaType; |
| | | import org.springframework.http.ResponseEntity; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.web.client.RestTemplate; |
| | | |
| | | import java.util.ArrayList; |
| | |
| | | return apsWorkOrderProcessMapper.deleteApsWorkOrderProcessById(id); |
| | | } |
| | | |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @Override |
| | | public void getWorkOrderProcessFromU9(List<String> docNos) throws Exception { |
| | | List<String> noProcessDocNos = new ArrayList<>(docNos); |
| | |
| | | } |
| | | if(!addList.isEmpty()){ |
| | | apsWorkOrderProcessMapper.insertApsWorkOrderProcessBatch(addList); |
| | | apsWorkOrderJobLog.setResult("ok insert "+updateList.size()); |
| | | apsWorkOrderJobLog.setResult("ok insert "+addList.size()); |
| | | apsWorkOrderJobLog.setUpdateTime(DateUtils.getNowDate()); |
| | | apsWorkOrderJobLogService.updateApsWorkOrderJobLog(apsWorkOrderJobLog); |
| | | logger.info("ãINSERTãè·åå¹¶æå
¥U9å·¥åºæåï¼ãå·¥åå·ï¼{}ã", docNos); |
| | |
| | | |
| | | @Autowired |
| | | private IApsMaterialManagementJobService apsMaterialManagementJobService; |
| | | |
| | | @Autowired |
| | | private IApsWeldSeamStandardJobService apsWeldSeamStandardJobService; |
| | | |
| | | public void ryMultipleParams(String s, Boolean b, Long l, Double d, Integer i) |
| | | { |
| | |
| | | /** |
| | | * 忥工åå·¥åºæ°æ® |
| | | */ |
| | | @Transactional(rollbackFor = Exception.class) |
| | | |
| | | public void syncWorkOrderProcessData(String status, Integer pageSize) |
| | | { |
| | | iApsWorkOrderProcessService.deleteApsWorkOrderProcess(); |
| | |
| | | public void setPlateSubPlansToRedis(){ |
| | | remoteCoreService.setPlateSubPlansToRedis(SecurityConstants.INNER); |
| | | } |
| | | |
| | | /** |
| | | * åæ¥ç©ææ åçç¼æ°æ® |
| | | */ |
| | | public void syncWeldSeamStandardData() { |
| | | apsWeldSeamStandardJobService.syncWeldSeamStandardData(); |
| | | } |
| | | |
| | | } |
| | |
| | | sysJobLog.setStartTime(startTime); |
| | | sysJobLog.setStopTime(new Date()); |
| | | long runMs = sysJobLog.getStopTime().getTime() - sysJobLog.getStartTime().getTime(); |
| | | sysJobLog.setJobMessage(sysJobLog.getJobName() + " æ»å
±èæ¶ï¼" + runMs + "毫ç§"); |
| | | long totalSeconds = runMs / 1000; |
| | | long minutes = totalSeconds / 60; |
| | | long seconds = totalSeconds % 60; |
| | | String formattedTime = minutes + "å" + seconds + "ç§"; |
| | | sysJobLog.setJobMessage(sysJobLog.getJobName() + " æ»å
±èæ¶ï¼" +formattedTime); |
| | | if (e != null) |
| | | { |
| | | sysJobLog.setStatus("1"); |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <?xml version="1.0" encoding="UTF-8" ?> |
| | | <!DOCTYPE mapper |
| | | PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
| | | "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.aps.job.mapper.ApsWeldSeamStandardJobMapper"> |
| | | |
| | | <resultMap type="com.aps.job.domain.ApsWeldSeamStandardJob" id="ApsWeldSeamStandardJobResult"> |
| | | <result property="id" column="id" /> |
| | | <result property="itemCode" column="item_code" /> |
| | | <result property="itemFigure" column="item_figure" /> |
| | | <result property="itemFigureVersion" column="item_figure_version" /> |
| | | <result property="hupQty" column="hup_qty" /> |
| | | <result property="lodQty" column="lod_qty" /> |
| | | <result property="type" column="type" /> |
| | | <result property="delFlag" column="del_flag" /> |
| | | </resultMap> |
| | | |
| | | <sql id="selectApsWeldSeamStandardJobVo"> |
| | | select id, item_code, item_figure, item_figure_version, hup_qty, lod_qty, type, del_flag from aps_weld_seam_standard_job |
| | | </sql> |
| | | |
| | | <select id="selectApsWeldSeamStandardJobList" parameterType="com.aps.job.domain.ApsWeldSeamStandardJob" resultMap="ApsWeldSeamStandardJobResult"> |
| | | <include refid="selectApsWeldSeamStandardJobVo"/> |
| | | <where> |
| | | <if test="itemCode != null and itemCode != ''"> and item_code LIKE '%' || #{itemCode} || '%'</if> |
| | | <if test="itemFigure != null and itemFigure != ''"> and item_figure = #{itemFigure}</if> |
| | | <if test="itemFigureVersion != null and itemFigureVersion != ''"> and item_figure_version = #{itemFigureVersion}</if> |
| | | <if test="hupQty != null "> and hup_qty = #{hupQty}</if> |
| | | <if test="lodQty != null "> and lod_qty = #{lodQty}</if> |
| | | <if test="type != null and type != ''"> and type = #{type}</if> |
| | | and del_flag = 0 |
| | | </where> |
| | | </select> |
| | | |
| | | <delete id="deleteAllApsWeldSeamStandardJob"> |
| | | delete from aps_weld_seam_standard_job |
| | | </delete> |
| | | |
| | | <insert id="batchInsertApsWeldSeamStandardJob" parameterType="java.util.List"> |
| | | insert into aps_weld_seam_standard_job( |
| | | id, |
| | | item_code, |
| | | item_figure, |
| | | item_figure_version, |
| | | hup_qty, |
| | | lod_qty, |
| | | type, |
| | | del_flag) |
| | | values |
| | | <foreach collection="list" item="item" index="index" separator=","> |
| | | ( |
| | | #{item.id}, |
| | | #{item.itemCode}, |
| | | #{item.itemFigure}, |
| | | #{item.itemFigureVersion}, |
| | | #{item.hupQty}, |
| | | #{item.lodQty}, |
| | | #{item.type}, |
| | | 0 |
| | | ) |
| | | </foreach> |
| | | </insert> |
| | | |
| | | </mapper> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <?xml version="1.0" encoding="UTF-8" ?> |
| | | <!DOCTYPE mapper |
| | | PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
| | | "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.aps.job.mapper.ApsWeldSeamStandardMapper"> |
| | | |
| | | <delete id="deleteAllApsWeldSeamStandard"> |
| | | delete from aps_weld_seam_standard |
| | | </delete> |
| | | |
| | | <insert id="batchInsertApsWeldSeamStandard" parameterType="java.util.List"> |
| | | insert into aps_weld_seam_standard( |
| | | id, |
| | | item_code, |
| | | item_figure, |
| | | item_figure_version, |
| | | hup_qty, |
| | | lod_qty, |
| | | type, |
| | | del_flag) |
| | | values |
| | | <foreach collection="list" item="item" index="index" separator=","> |
| | | ( |
| | | #{item.id}, |
| | | #{item.itemCode}, |
| | | #{item.itemFigure}, |
| | | #{item.itemFigureVersion}, |
| | | #{item.hupQty}, |
| | | #{item.lodQty}, |
| | | #{item.type}, |
| | | 0 |
| | | ) |
| | | </foreach> |
| | | </insert> |
| | | </mapper> |