| | |
| | | import com.ruoyi.approve.pojo.ApproveProcess; |
| | | import com.ruoyi.basic.mapper.CustomerMapper; |
| | | import com.ruoyi.basic.mapper.ProductMapper; |
| | | import com.ruoyi.basic.mapper.ProductModelMapper; |
| | | import com.ruoyi.basic.mapper.SupplierManageMapper; |
| | | import com.ruoyi.basic.pojo.Customer; |
| | | import com.ruoyi.basic.pojo.Product; |
| | |
| | | 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; |
| | |
| | | import com.ruoyi.framework.security.LoginUser; |
| | | import com.ruoyi.home.dto.*; |
| | | import com.ruoyi.home.service.HomeService; |
| | | import com.ruoyi.procurementrecord.mapper.ProcurementRecordMapper; |
| | | import com.ruoyi.procurementrecord.pojo.ProcurementRecordStorage; |
| | | import com.ruoyi.procurementrecord.utils.StockUtils; |
| | | import com.ruoyi.production.dto.ProductOrderDto; |
| | | import com.ruoyi.production.dto.ProductWorkOrderDto; |
| | | import com.ruoyi.production.mapper.ProductOrderMapper; |
| | |
| | | import com.ruoyi.production.mapper.ProductionProductInputMapper; |
| | | import com.ruoyi.production.mapper.ProductionProductOutputMapper; |
| | | import com.ruoyi.production.mapper.SalesLedgerProductionAccountingMapper; |
| | | import com.ruoyi.production.pojo.ProductProcess; |
| | | import com.ruoyi.production.pojo.ProductWorkOrder; |
| | | import com.ruoyi.project.system.domain.SysDept; |
| | | import com.ruoyi.project.system.mapper.SysDeptMapper; |
| | |
| | | public ProductionTurnoverDto workInProcessTurnover() { |
| | | ProductionTurnoverDto productionTurnoverDto = new ProductionTurnoverDto(); |
| | | ProductWorkOrderDto workOrder = new ProductWorkOrderDto(); |
| | | workOrder.setPlanStartTime(LocalDate.now().minusMonths(1)); |
| | | workOrder.setPlanEndTime(LocalDate.now()); |
| | | workOrder.setPlanStartTime(LocalDateTime.now()); |
| | | workOrder.setPlanEndTime(LocalDateTime.now()); |
| | | List<ProductWorkOrderDto> productWorkOrders = productWorkOrderMapper |
| | | .pageProductWorkOrder(new Page<>(1, -1), workOrder).getRecords(); |
| | | long sum = productWorkOrders.stream() |
| | |
| | | |
| | | @Override |
| | | public List<MapDto> processOutputAnalysis(Integer type) { |
| | | LocalDate today = LocalDate.now(); |
| | | LocalDate startDate; |
| | | LocalDate endDate = today; |
| | | // 获取当前时间点 |
| | | LocalDateTime now = LocalDateTime.now(); |
| | | LocalDateTime startDateTime; |
| | | LocalDateTime endDateTime = now.with(LocalTime.MAX); |
| | | |
| | | switch (type) { |
| | | case 1: // 周 |
| | | startDate = today.with(DayOfWeek.MONDAY); |
| | | startDateTime = now.with(DayOfWeek.MONDAY).with(LocalTime.MIN); |
| | | break; |
| | | case 2: // 月 |
| | | startDate = today.withDayOfMonth(1); |
| | | startDateTime = now.withDayOfMonth(1).with(LocalTime.MIN); |
| | | break; |
| | | case 3: // 季度 |
| | | int currentMonth = today.getMonthValue(); |
| | | int currentMonth = now.getMonthValue(); |
| | | int startMonth = ((currentMonth - 1) / 3) * 3 + 1; |
| | | startDate = LocalDate.of(today.getYear(), startMonth, 1); |
| | | startDateTime = LocalDateTime.of(now.getYear(), startMonth, 1, 0, 0, 0); |
| | | break; |
| | | default: |
| | | startDate = today.with(DayOfWeek.MONDAY); |
| | | startDateTime = now.with(DayOfWeek.MONDAY).with(LocalTime.MIN); |
| | | break; |
| | | } |
| | | |
| | | ProductWorkOrderDto queryDto = new ProductWorkOrderDto(); |
| | | queryDto.setPlanStartTime(startDate); |
| | | queryDto.setPlanEndTime(endDate); |
| | | queryDto.setPlanStartTime(startDateTime); |
| | | queryDto.setPlanEndTime(endDateTime); |
| | | |
| | | List<ProductWorkOrderDto> list = productWorkOrderMapper.pageProductWorkOrder(new Page<>(1, -1), queryDto) |
| | | .getRecords(); |
| | |
| | | BigDecimal total = processOutputMap.values().stream() |
| | | .reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | |
| | | if (BigDecimal.ZERO.compareTo(total) == 0) { |
| | | if (total.compareTo(BigDecimal.ZERO) == 0) { |
| | | return new ArrayList<>(); |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | @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; |
| | | } |
| | | } |