| | |
| | | |
| | | @GetMapping("/processDataProductionStatistics") |
| | | @ApiOperation("å·¥åºæ°æ®ç产ç»è®¡æ°æ®") |
| | | public AjaxResult processDataProductionStatistics(@DefaultType Integer type,@RequestParam(required = false) List<Long> processIds) { |
| | | List<processDataProductionStatisticsDto> list = homeService.processDataProductionStatistics(type, processIds); |
| | | public AjaxResult processDataProductionStatistics(@DefaultType Integer type,@RequestParam(required = false) List<Long> processTypes) { |
| | | List<processDataProductionStatisticsDto> list = homeService.processDataProductionStatistics(type, processTypes); |
| | | return AjaxResult.success(list); |
| | | } |
| | | |
| | |
| | | package com.ruoyi.home.dto; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonIgnore; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | |
| | | private String processName; |
| | | |
| | | /** |
| | | * å·¥åºç±»å |
| | | */ |
| | | @JsonIgnore |
| | | private Integer processType; |
| | | |
| | | /** |
| | | * ç´¯è®¡æ»æå
¥ |
| | | */ |
| | | private BigDecimal totalInput; |
| | |
| | | |
| | | QualityStatisticsDto qualityInspectionStatistics(Integer type); |
| | | |
| | | List<processDataProductionStatisticsDto> processDataProductionStatistics(Integer type, List<Long> processIds); |
| | | List<processDataProductionStatisticsDto> processDataProductionStatistics(Integer type, List<Long> processTypes); |
| | | } |
| | |
| | | import com.ruoyi.collaborativeApproval.mapper.NoticeMapper; |
| | | import com.ruoyi.collaborativeApproval.pojo.Notice; |
| | | import com.ruoyi.common.enums.ApproveTypeEnum; |
| | | import com.ruoyi.common.utils.DictUtils; |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.device.mapper.DeviceRepairMapper; |
| | |
| | | } |
| | | |
| | | @Override |
| | | public List<processDataProductionStatisticsDto> processDataProductionStatistics(Integer type, List<Long> processIds) { |
| | | public List<processDataProductionStatisticsDto> processDataProductionStatistics(Integer type, List<Long> processTypes) { |
| | | LoginUser loginUser = SecurityUtils.getLoginUser(); |
| | | Long userId = SecurityUtils.isAdmin(loginUser.getUserId()) ? null : loginUser.getUserId(); |
| | | |
| | |
| | | LocalDateTime startDateTime = startDate.atStartOfDay(); |
| | | LocalDateTime endDateTime = endDate.atTime(LocalTime.MAX); |
| | | |
| | | return productProcessMapper.calculateProductionStatistics(startDateTime, endDateTime, userId, processIds); |
| | | List<processDataProductionStatisticsDto> result = productProcessMapper.calculateProductionStatistics(startDateTime, endDateTime, userId, processTypes); |
| | | if (!ObjectUtils.isEmpty(result)) { |
| | | result.forEach(dto -> { |
| | | if (dto == null) { |
| | | return; |
| | | } |
| | | Integer processType = dto.getProcessType(); |
| | | String dictLabel = null; |
| | | if (processType != null) { |
| | | dictLabel = DictUtils.getDictLabel("product_process_type", String.valueOf(processType)); |
| | | } |
| | | if (StringUtils.isEmpty(dictLabel)) { |
| | | dictLabel = "å
¶ä»"; |
| | | } |
| | | dto.setProcessName(dictLabel); |
| | | }); |
| | | } |
| | | |
| | | return result; |
| | | } |
| | | } |
| | |
| | | |
| | | IPage<ProductProcessDto> listPage(Page page, @Param("productProcessDto") ProductProcessDto productProcessDto); |
| | | |
| | | List<processDataProductionStatisticsDto> calculateProductionStatistics(LocalDateTime startDateTime, LocalDateTime endDateTime, Long userId, List<Long> processIds); |
| | | List<processDataProductionStatisticsDto> calculateProductionStatistics(LocalDateTime startDateTime, LocalDateTime endDateTime, Long userId, List<Long> processTypes); |
| | | } |
| | |
| | | import com.ruoyi.basic.service.IProductModelService; |
| | | import com.ruoyi.basic.service.IProductService; |
| | | import com.ruoyi.common.exception.ServiceException; |
| | | import com.ruoyi.common.utils.DictUtils; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.production.dto.ProductProcessDto; |
| | | import com.ruoyi.production.dto.ProductProcessImportDto; |
| | | import com.ruoyi.production.enums.ProductProcessEnum; |
| | | import com.ruoyi.production.mapper.ProcessRouteItemMapper; |
| | | import com.ruoyi.production.mapper.ProductProcessMapper; |
| | | import com.ruoyi.production.mapper.ProductProcessRouteItemMapper; |
| | |
| | | if (ObjectUtils.isEmpty(importDto.getProductProcessType())) { |
| | | throw new ServiceException("第" + rowNum + "è¡ï¼é¨ä»¶ã" + importDto.getName() + "ãçç±»åä¸è½ä¸ºç©º"); |
| | | } |
| | | ProductProcessEnum enumByInfo = ProductProcessEnum.getEnumByInfo(importDto.getProductProcessType()); |
| | | if (ObjectUtils.isEmpty(enumByInfo)) { |
| | | String dictValue = DictUtils.getDictValue("product_process_type", importDto.getProductProcessType()); |
| | | if (StringUtils.isEmpty(dictValue)) { |
| | | throw new ServiceException("第" + rowNum + "è¡ï¼é¨ä»¶ã" + importDto.getName() + "ãçç±»åã" |
| | | + importDto.getProductProcessType() + "ãä¸åå¨ï¼è¯·å¡«åæ£ç¡®çç±»åï¼å å·¥ã宿¿å·è¯å¶ä½ã管路ç»å¯¹ãç½ä½è¿æ¥åè°è¯ãæµè¯æåãå
¶ä»"); |
| | | + importDto.getProductProcessType() + "ãä¸åå¨ï¼è¯·å¡«åæ£ç¡®çç±»åï¼" + DictUtils.getDictLabels("product_process_type")); |
| | | } |
| | | // æ£éªè®¡åå·¥æ¶ |
| | | if (importDto.getSalaryQuota() == null || importDto.getSalaryQuota().compareTo(BigDecimal.ZERO) < 0) { |
| | |
| | | ProductProcess productProcess = new ProductProcess(); |
| | | BeanUtils.copyProperties(importDto, productProcess); |
| | | productProcess.setProductModelId(productModel.getId()); |
| | | productProcess.setType(enumByInfo.getCode()); |
| | | productProcess.setType(Integer.valueOf(dictValue)); |
| | | if (sysUser != null) { |
| | | productProcess.setPlannerId(sysUser.getUserId()); |
| | | productProcess.setPlannerName(sysUser.getNickName()); |
| | |
| | | import com.ruoyi.common.enums.StockOutQualifiedRecordTypeEnum; |
| | | import com.ruoyi.common.enums.StockInUnQualifiedRecordTypeEnum; |
| | | import com.ruoyi.common.exception.ServiceException; |
| | | import com.ruoyi.common.utils.DictUtils; |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.common.utils.bean.BeanUtils; |
| | | import com.ruoyi.procurementrecord.utils.StockUtils; |
| | |
| | | import com.ruoyi.production.dto.ProductionProductMainSummaryExportDto; |
| | | import com.ruoyi.production.dto.ProductionReportDailySummaryDto; |
| | | import com.ruoyi.production.dto.ProductionReportStateDto; |
| | | import com.ruoyi.production.enums.ProductProcessEnum; |
| | | import com.ruoyi.production.mapper.ProductionProductReportDailyMapper; |
| | | import com.ruoyi.production.pojo.ProductionProductReportDaily; |
| | | import com.ruoyi.production.mapper.*; |
| | |
| | | if (process == null || process.getType() == null) { |
| | | return "å
¶ä»"; |
| | | } |
| | | for (ProductProcessEnum value : ProductProcessEnum.values()) { |
| | | if (value.getCode().equals(process.getType())) { |
| | | return value.getInfo(); |
| | | } |
| | | } |
| | | return "å
¶ä»"; |
| | | String dictLabel = DictUtils.getDictLabel("product_process_type", String.valueOf(process.getType())); |
| | | return (dictLabel == null || dictLabel.isEmpty()) ? "å
¶ä»" : dictLabel; |
| | | } |
| | | |
| | | private void saveDailyDurations(ProductionProductMain main, LocalDateTime start, LocalDateTime end) { |
| | |
| | | |
| | | <select id="calculateProductionStatistics" resultType="com.ruoyi.home.dto.processDataProductionStatisticsDto"> |
| | | SELECT |
| | | pp.name AS processName, |
| | | pp.type AS processType, |
| | | SUM(pi.quantity) AS totalInput, |
| | | SUM(distinct ppo.scrap_qty) AS totalScrap, |
| | | SUM(distinct (ppo.quantity - ppo.scrap_qty)) AS totalOutput |
| | |
| | | <if test="userId != null"> |
| | | AND ppm.user_id = #{userId} |
| | | </if> |
| | | <if test="processIds != null and processIds.size() > 0"> |
| | | AND pp.id IN |
| | | <foreach collection="processIds" item="id" open="(" separator="," close=")"> |
| | | <if test="processTypes != null and processTypes.size() > 0"> |
| | | AND pp.type IN |
| | | <foreach collection="processTypes" item="id" open="(" separator="," close=")"> |
| | | #{id} |
| | | </foreach> |
| | | </if> |
| | | </where> |
| | | GROUP BY |
| | | pp.id, |
| | | pp.name |
| | | pp.type |
| | | </select> |
| | | </mapper> |