| | |
| | | DROP TABLE IF EXISTS product_structure_instance; |
| | | |
| | | ALTER TABLE `product-inventory-management-zsjc`.`production_product_route_item_param` |
| | | MODIFY COLUMN `order_item_param_id` bigint NULL DEFAULT NULL COMMENT 'ç产订åç»å®çå·¥èºè·¯çº¿å·¥åº--åæ°è¡¨ID' AFTER `production_product_route_item_id`; |
| | | MODIFY COLUMN `order_item_param_id` bigint NULL DEFAULT NULL COMMENT 'ç产订åç»å®çå·¥èºè·¯çº¿å·¥åº--åæ°è¡¨ID' AFTER `production_product_route_item_id`; |
| | | |
| | | CREATE TABLE `production_product_input` |
| | | ( |
| | | `id` bigint NOT NULL AUTO_INCREMENT, |
| | | `product_main_id` bigint NOT NULL COMMENT 'æ¥å·¥å主表ID', |
| | | `route_item_id` bigint DEFAULT NULL COMMENT 'å
³èå
·ä½çæ¥å·¥å·¥åºID (对åºååæ°è¡¨çå
³èID)', |
| | | `product_id` bigint NOT NULL COMMENT '产å/ç©æID', |
| | | `bom_id` bigint DEFAULT NULL COMMENT 'BOM ID', |
| | | `quantity` decimal(30, 15) NOT NULL COMMENT 'æå
¥æ°é (对åºåproduct_value)', |
| | | `unit` varchar(20) DEFAULT NULL COMMENT 'åä½', |
| | | `create_user` bigint DEFAULT NULL COMMENT 'å½å
¥äºº', |
| | | `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT 'å½å
¥æ¶é´', |
| | | `update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT 'æ´æ°æ¶é´', |
| | | `tenant_id` bigint NOT NULL COMMENT 'ç§æ·ID', |
| | | PRIMARY KEY (`id`) USING BTREE, |
| | | KEY `idx_main_id` (`product_main_id`), |
| | | KEY `idx_product_id` (`product_id`) |
| | | ) ENGINE = InnoDB |
| | | DEFAULT CHARSET = utf8mb4 |
| | | COLLATE = utf8mb4_general_ci COMMENT ='ç产æ¥å·¥ç©ææå
¥è¡¨'; |
| | | |
| | | ALTER TABLE `production_product_route_item_param` |
| | | DROP COLUMN `product_id`, |
| | | DROP COLUMN `bom_id`, |
| | | DROP COLUMN `product_value`, |
| | | DROP COLUMN `dict_code`; |
| | | |
| | | ALTER TABLE `product-inventory-management-zsjc`.`production_product_output` |
| | | ADD COLUMN `total_quantity` decimal(20, 15) NULL COMMENT 'æ»æ°é' AFTER `scrap_qty`; |
| | |
| | | private List<EnergyConsumptionTypeDto> energyConsumptionTypeProportion; |
| | | |
| | | @ApiModelProperty("è½èç±»åæç»") |
| | | private List<EnergyConsumptionDetailDto> energyConsumptionDetailDtoList; |
| | | private List<EnergyDetailDto> energyConsumptionDetailDtoList; |
| | | } |
| | |
| | | @ApiModelProperty("è½èç±»åå æ¯") |
| | | private List<EnergyConsumptionTypeDto> energyConsumptionTypeProportion; |
| | | |
| | | @ApiModelProperty("è½èåèè¶å¿") |
| | | private List<EnergyCostDto> energyCostDtos; |
| | | |
| | | } |
| | |
| | | public class EnergyCostDto { |
| | | |
| | | @ApiModelProperty("æ¥æ") |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd") |
| | | private LocalDate meterReadingDate; |
| | | private String meterReadingDate; |
| | | |
| | | @ApiModelProperty("ç¨æ°´é") |
| | | private BigDecimal waterConsumption; |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.energy.dto; |
| | | |
| | | import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; |
| | | import com.baomidou.mybatisplus.annotation.FieldFill; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.ruoyi.energy.pojo.EnergyConsumptionDetail; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Excel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | |
| | | //è½èæç» |
| | | @Data |
| | | public class EnergyDetailDto { |
| | | |
| | | @ApiModelProperty("è½æºç±»å") |
| | | private String energyTyep; |
| | | |
| | | @ApiModelProperty("è½æºåç§°") |
| | | private String energyName; |
| | | |
| | | @ApiModelProperty("åä½") |
| | | private String unit; |
| | | |
| | | //å建人 |
| | | private String createUserName; |
| | | |
| | | //è´¹ç¨ |
| | | private BigDecimal cost; |
| | | |
| | | //åä»· |
| | | private BigDecimal unitPrice; |
| | | |
| | | @ApiModelProperty("åå
¬/ç产") |
| | | private String type; |
| | | |
| | | @ApiModelProperty("æè¡¨ä½ç½®") |
| | | private String meterReadingLocation; |
| | | |
| | | @ApiModelProperty("æ¥æ") |
| | | private String meterReadingDate; |
| | | |
| | | @ApiModelProperty("ç¨é") |
| | | private BigDecimal dosage; |
| | | |
| | | @ApiModelProperty("夿³¨") |
| | | private String remark; |
| | | |
| | | } |
| | |
| | | import com.ruoyi.energy.dto.EnergyConsumptionDetailDto; |
| | | import com.ruoyi.energy.dto.EnergyConsumptionTypeDto; |
| | | import com.ruoyi.energy.dto.EnergyCostDto; |
| | | import com.ruoyi.energy.dto.EnergyDetailDto; |
| | | import com.ruoyi.energy.pojo.EnergyConsumptionDetail; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.ruoyi.energy.vo.EnergyStatisticsVo; |
| | |
| | | |
| | | List<EnergyConsumptionTypeDto> energyConsumptionTypeProportion(@Param("c") EnergyStatisticsVo energyStatisticsVo); |
| | | |
| | | List<EnergyCostDto> energyCostDtos(@Param("c") EnergyStatisticsVo energyStatisticsVo); |
| | | //æ¥è½èæç» |
| | | List<EnergyCostDto> energyCostDtos1(@Param("c") EnergyStatisticsVo energyStatisticsVo); |
| | | //æè½èæç» |
| | | List<EnergyCostDto> energyCostDtos2(@Param("c") EnergyStatisticsVo energyStatisticsVo); |
| | | //å¹´è½èæç» |
| | | List<EnergyCostDto> energyCostDtos3(@Param("c") EnergyStatisticsVo energyStatisticsVo); |
| | | |
| | | List<EnergyConsumptionDetailDto> energyConsumptionDetailDtos(@Param("c") EnergyStatisticsVo energyStatisticsVo); |
| | | //æ¥è½èç±»åæç» |
| | | List<EnergyDetailDto> energyConsumptionDetailDtos1(@Param("c") EnergyStatisticsVo energyStatisticsVo); |
| | | //æè½èç±»åæç» |
| | | List<EnergyDetailDto> energyConsumptionDetailDtos2(@Param("c") EnergyStatisticsVo energyStatisticsVo); |
| | | //å¹´è½èç±»åæç» |
| | | List<EnergyDetailDto> energyConsumptionDetailDtos3(@Param("c") EnergyStatisticsVo energyStatisticsVo); |
| | | } |
| | |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.time.LocalDate; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | |
| | | List<EnergyConsumptionTypeDto> energyConsumptionTypeDtos=energyConsumptionDetailMapper.energyConsumptionTypeProportion(energyStatisticsVo); |
| | | energyStatisticsDto.setEnergyConsumptionTypeProportion(energyConsumptionTypeDtos); |
| | | //è½èæç» |
| | | List<EnergyCostDto> energyCostDtos=energyConsumptionDetailMapper.energyCostDtos(energyStatisticsVo); |
| | | List<EnergyCostDto> energyCostDtos=new ArrayList<>(); |
| | | //夿æ¥/æ/å¹´ |
| | | switch (energyStatisticsVo.getState()){ |
| | | case "æ¥": |
| | | energyCostDtos=energyConsumptionDetailMapper.energyCostDtos1(energyStatisticsVo); |
| | | break; |
| | | case "æ": |
| | | energyCostDtos=energyConsumptionDetailMapper.energyCostDtos2(energyStatisticsVo); |
| | | break; |
| | | case "å¹´": |
| | | energyCostDtos=energyConsumptionDetailMapper.energyCostDtos3(energyStatisticsVo); |
| | | break; |
| | | } |
| | | energyStatisticsDto.setEnergyCostDtos(energyCostDtos); |
| | | return energyStatisticsDto; |
| | | } |
| | |
| | | List<EnergyConsumptionTypeDto> energyConsumptionTypeDtos=energyConsumptionDetailMapper.energyConsumptionTypeProportion(energyStatisticsVo); |
| | | energyAccountDto.setEnergyConsumptionTypeProportion(energyConsumptionTypeDtos); |
| | | //è½èç±»åæç» |
| | | List<EnergyConsumptionDetailDto> energyConsumptionDetailDtoList=energyConsumptionDetailMapper.energyConsumptionDetailDtos(energyStatisticsVo); |
| | | energyAccountDto.setEnergyConsumptionDetailDtoList(energyConsumptionDetailDtoList); |
| | | List<EnergyDetailDto> energyDetailDtos = new ArrayList<>(); |
| | | //夿æ¥/æ/å¹´ |
| | | switch (energyStatisticsVo.getState()){ |
| | | case "æ¥": |
| | | energyDetailDtos=energyConsumptionDetailMapper.energyConsumptionDetailDtos1(energyStatisticsVo); |
| | | break; |
| | | case "æ": |
| | | energyDetailDtos=energyConsumptionDetailMapper.energyConsumptionDetailDtos2(energyStatisticsVo); |
| | | break; |
| | | case "å¹´": |
| | | energyDetailDtos=energyConsumptionDetailMapper.energyConsumptionDetailDtos3(energyStatisticsVo); |
| | | break; |
| | | } |
| | | energyAccountDto.setEnergyConsumptionDetailDtoList(energyDetailDtos); |
| | | return energyAccountDto; |
| | | } |
| | | |
| | |
| | | //è½èåèæ°æ® |
| | | List<EnergyConsumptionTypeDto> energyConsumptionTypeDtos=energyConsumptionDetailMapper.energyConsumptionTypeProportion(energyStatisticsVo); |
| | | energyCollectDto.setEnergyConsumptionTypeProportion(energyConsumptionTypeDtos); |
| | | //è½èåèè¶å¿(å¾
å®ç°) |
| | | //è½èåèè¶å¿ |
| | | List<EnergyCostDto> energyCostDtos=new ArrayList<>(); |
| | | //夿æ¥/æ/å¹´ |
| | | switch (energyStatisticsVo.getState()){ |
| | | case "æ¥": |
| | | energyCostDtos=energyConsumptionDetailMapper.energyCostDtos1(energyStatisticsVo); |
| | | break; |
| | | case "æ": |
| | | energyCostDtos=energyConsumptionDetailMapper.energyCostDtos2(energyStatisticsVo); |
| | | break; |
| | | case "å¹´": |
| | | energyCostDtos=energyConsumptionDetailMapper.energyCostDtos3(energyStatisticsVo); |
| | | break; |
| | | } |
| | | energyCollectDto.setEnergyCostDtos(energyCostDtos); |
| | | return energyCollectDto; |
| | | } |
| | | } |
| | |
| | | |
| | | //è½èç±»å(æ°´/çµ/æ°) |
| | | private String energyName; |
| | | |
| | | //æ¥/æ/å¹´ |
| | | private String state; |
| | | } |
| | |
| | | package com.ruoyi.home.controller; |
| | | |
| | | import com.ruoyi.approve.pojo.ApproveProcess; |
| | | import com.ruoyi.energy.vo.EnergyStatisticsVo; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log; |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.home.annotation.DefaultType; |
| | | import com.ruoyi.home.dto.*; |
| | | import com.ruoyi.home.service.HomeService; |
| | | import com.ruoyi.dto.MapDto; |
| | | import com.ruoyi.productionPlan.service.SalesDeliveryService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | * @date : 2025/7/25 9:15 |
| | | */ |
| | | @RestController |
| | | @Api(tags = "é¦é¡µç»è®¡") |
| | | @Api(tags = "ç»è®¡") |
| | | @RequestMapping("/home") |
| | | public class HomeController extends BaseController { |
| | | |
| | |
| | | return AjaxResult.success(list); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | /*******************************************å®å¤ä¸ç建æç大å±ç»è®¡***************************************************/ |
| | | |
| | | @GetMapping("/total") |
| | | @ApiOperation("éå®ç»è®¡çæ¿---æ»æ°æ®æ±æ»") |
| | | public AjaxResult total() { |
| | | return AjaxResult.success(homeService.total()); |
| | | } |
| | | |
| | | } |
| | |
| | | QualityStatisticsDto qualityInspectionStatistics(Integer type); |
| | | |
| | | List<processDataProductionStatisticsDto> processDataProductionStatistics(Integer type, List<Long> processIds); |
| | | |
| | | Map<String,Long> total(); |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.account.mapper.AccountIncomeMapper; |
| | | import com.ruoyi.account.pojo.AccountExpense; |
| | |
| | | import com.ruoyi.production.mapper.SalesLedgerProductionAccountingMapper; |
| | | import com.ruoyi.production.pojo.ProductProcess; |
| | | import com.ruoyi.production.pojo.ProductWorkOrder; |
| | | import com.ruoyi.productionPlan.enums.AddressRegionEnum; |
| | | import com.ruoyi.productionPlan.mapper.SalesDeliveryMapper; |
| | | import com.ruoyi.productionPlan.pojo.SalesDelivery; |
| | | import com.ruoyi.project.system.domain.SysDept; |
| | | import com.ruoyi.project.system.mapper.SysDeptMapper; |
| | | import com.ruoyi.purchase.mapper.PaymentRegistrationMapper; |
| | |
| | | |
| | | @Autowired |
| | | private ProductProcessMapper productProcessMapper; |
| | | |
| | | |
| | | @Autowired |
| | | private AccountExpenseMapper accountExpenseMapper; |
| | | |
| | | @Autowired |
| | | private AccountIncomeMapper accountIncomeMapper; |
| | | |
| | | @Autowired |
| | | private SalesDeliveryMapper salesDeliveryMapper; |
| | | |
| | | @Override |
| | | public HomeBusinessDto business() { |
| | |
| | | |
| | | return productProcessMapper.calculateProductionStatistics(startDateTime, endDateTime, userId, processIds); |
| | | } |
| | | |
| | | @Override |
| | | public Map<String, Long> total() { |
| | | Map<String, Long> map = new HashMap<>(); |
| | | //æ»éå®éé¢ |
| | | List<SalesDelivery> salesDeliveries = salesDeliveryMapper.selectList(null); |
| | | long sum = salesDeliveries.stream().mapToLong(value -> Long.parseLong(value.getPrice().toString())).sum(); |
| | | map.put("price",sum/1000);//åä½w |
| | | //æ»åè´§å |
| | | map.put("delivery",salesDeliveries.stream().count()); |
| | | //æ»éå®åº? |
| | | //ç´¯è®¡å®¢æ· |
| | | Long count = customerMapper.selectCount(null); |
| | | map.put("customer",count); |
| | | return map; |
| | | } |
| | | } |
| | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import java.math.BigDecimal; |
| | | |
| | | /** |
| | | * <br> |
| | |
| | | @ApiModelProperty("ç©æç¼ç ") |
| | | private String materialCode; |
| | | |
| | | @ApiModelProperty("产åID") |
| | | private Long productId; |
| | | |
| | | @ApiModelProperty("BOM ID") |
| | | private Long bomId; |
| | | |
| | | @ApiModelProperty("æå
¥æ°é") |
| | | private BigDecimal quantity; |
| | | |
| | | @ApiModelProperty("ç©æå¼") |
| | | private BigDecimal productValue; |
| | | |
| | | @ApiModelProperty("强度") |
| | | private String strength; |
| | | |
| | |
| | | @ApiModelProperty(value = "æ´æ°æ¶é´") |
| | | private LocalDateTime updateTime; |
| | | |
| | | @ApiModelProperty("åæ ¼æ°é") |
| | | @ApiModelProperty("åæ ¼æ°é/äº§åºæ¹é") |
| | | private BigDecimal qualifiedQuantity; |
| | | |
| | | @ApiModelProperty("ä¸åæ ¼æ°é") |
| | | @ApiModelProperty("ä¸åæ ¼æ°é/ä¸åæ ¼æ¹é") |
| | | private BigDecimal unqualifiedQuantity; |
| | | |
| | | @ApiModelProperty("äº§åºæ°é") |
| | |
| | | @TableId(type = IdType.AUTO) |
| | | private Long id; |
| | | |
| | | @ApiModelProperty(value = "æ¥å·¥id") |
| | | @ApiModelProperty(value = "æ¥å·¥å主表ID") |
| | | private Long productMainId; |
| | | |
| | | @ApiModelProperty(value = "产åid") |
| | | private Long productModelId; |
| | | @ApiModelProperty(value = "å
³èå
·ä½çæ¥å·¥å·¥åºID") |
| | | private Long routeItemId; |
| | | |
| | | @ApiModelProperty(value = "æ°é") |
| | | @ApiModelProperty(value = "产å/ç©æID") |
| | | @TableField("product_id") |
| | | private Long productId; |
| | | |
| | | @ApiModelProperty(value = "BOM ID") |
| | | private Long bomId; |
| | | |
| | | @ApiModelProperty(value = "æå
¥æ°é") |
| | | private BigDecimal quantity; |
| | | |
| | | @ApiModelProperty(value = "å建æ¶é´") |
| | | @ApiModelProperty(value = "åä½") |
| | | private String unit; |
| | | |
| | | @ApiModelProperty(value = "å½å
¥äºº") |
| | | private Long createUser; |
| | | |
| | | @ApiModelProperty(value = "å½å
¥æ¶é´") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private LocalDateTime createTime; |
| | | |
| | | @ApiModelProperty(value = "æ´æ°æ¶é´") |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | private LocalDateTime updateTime; |
| | | |
| | | @ApiModelProperty(value = "ç§æ·ID") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long tenantId; |
| | | } |
| | | } |
| | |
| | | @ApiModelProperty(value = "产åid") |
| | | private Long productModelId; |
| | | |
| | | @ApiModelProperty(value = "åæ ¼æ°é") |
| | | @ApiModelProperty(value = "åæ ¼æ°é/äº§åºæ¹é") |
| | | private BigDecimal quantity; |
| | | |
| | | @ApiModelProperty(value = "å建æ¶é´") |
| | |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long tenantId; |
| | | |
| | | @ApiModelProperty(value = "ä¸åæ ¼æ°é") |
| | | @ApiModelProperty(value = "ä¸åæ ¼æ°é/ä¸åæ ¼æ¹é") |
| | | private BigDecimal scrapQty; |
| | | |
| | | @ApiModelProperty(value = "æ»æ°é") |
| | | private BigDecimal totalQuantity; |
| | | } |
| | |
| | | @ApiModelProperty(value = "åæ°å¼") |
| | | private String paramValue; |
| | | |
| | | @ApiModelProperty(value = "产åID") |
| | | private Long productId; |
| | | |
| | | @ApiModelProperty(value = "产åæå
¥å¼") |
| | | private BigDecimal productValue; |
| | | |
| | | @ApiModelProperty(value = "BOM ID") |
| | | private Long bomId; |
| | | |
| | | @ApiModelProperty(value = "åä½") |
| | | private String unit; |
| | | |
| | |
| | | @ApiModelProperty(value = "åæ°æåº") |
| | | private Integer sourceSort; |
| | | |
| | | @ApiModelProperty(value = "产åç±»å") |
| | | private Long dictCode; |
| | | |
| | | @ApiModelProperty(value = "ä¸ä¼ è
") |
| | | private Long createUser; |
| | | |
| | | @ApiModelProperty(value = "å建æ¶é´") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | @TableField(value = "create_time", fill = FieldFill.INSERT) |
| | | private LocalDateTime createTime; |
| | | |
| | | @ApiModelProperty(value = "ä¿®æ¹è
") |
| | | private Long updateUser; |
| | | |
| | | @ApiModelProperty(value = "ä¿®æ¹æ¶é´") |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | @TableField(value = "update_time", fill = FieldFill.INSERT_UPDATE) |
| | | private LocalDateTime updateTime; |
| | | |
| | | @ApiModelProperty(value = "ç§æ·ID") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | @TableField(value = "tenant_id", fill = FieldFill.INSERT) |
| | | private Long tenantId; |
| | | |
| | | } |
| | |
| | | productStructureDtos.add(productStructureDto); |
| | | } |
| | | for (ProductStructureDto productStructureDto : productStructureDtos) { |
| | | |
| | | ProductionProductInput productionProductInput = new ProductionProductInput(); |
| | | productionProductInput.setProductModelId(productStructureDto.getProductModelId()); |
| | | productionProductInput.setQuantity(productStructureDto.getUnitQuantity().multiply(dto.getQuantity())); |
| | | productionProductInput.setProductId(productStructureDto.getProductModelId()); |
| | | BigDecimal unitQty = productStructureDto.getUnitQuantity() != null ? productStructureDto.getUnitQuantity() : BigDecimal.ZERO; |
| | | BigDecimal mainQty = dto.getQuantity() != null ? dto.getQuantity() : BigDecimal.ZERO; |
| | | productionProductInput.setQuantity(unitQty.multiply(mainQty)); |
| | | productionProductInput.setUnit(productStructureDto.getUnit()); |
| | | productionProductInput.setProductMainId(productionProductMain.getId()); |
| | | productionProductInput.setRouteItemId(productProcessRouteItem.getId()); |
| | | productionProductInputMapper.insert(productionProductInput); |
| | | stockUtils.substractStock(productStructureDto.getProductModelId(), productionProductInput.getQuantity(), StockOutQualifiedRecordTypeEnum.PRODUCTION_REPORT_STOCK_OUT.getCode(), productionProductMain.getId()); |
| | | |
| | | } |
| | | /*æ°å¢æ¥å·¥äº§åºè¡¨*/ |
| | | ProductionProductOutput productionProductOutput = new ProductionProductOutput(); |
| | |
| | | throw new ServiceException("æ¥å·¥å¤±è´¥,æ°æ®åå¨å¤±è´¥"); |
| | | } |
| | | |
| | | ProductionProductInput productionProductInput = new ProductionProductInput(); |
| | | productionProductInput.setProductMainId(productionProductMain.getId()); |
| | | productionProductInput.setProductModelId(dto.getProductId()); |
| | | productionProductInput.setQuantity(dto.getQuantity()); |
| | | result = productionProductInputService.save(productionProductInput); |
| | | if (!result) { |
| | | throw new ServiceException("æ¥å·¥å¤±è´¥,ç产产åºåå¨å¤±è´¥"); |
| | | } |
| | | |
| | | ProductionProductOutput productionProductOutput = new ProductionProductOutput(); |
| | | productionProductOutput.setProductMainId(productionProductMain.getId()); |
| | | productionProductOutput.setProductModelId(dto.getProductId()); |
| | | productionProductOutput.setQuantity(dto.getQualifiedQuantity()); |
| | | productionProductOutput.setScrapQty(dto.getUnqualifiedQuantity()); |
| | | productionProductOutput.setTotalQuantity(dto.getQuantity()); |
| | | result = productionProductOutputService.save(productionProductOutput); |
| | | if (!result) { |
| | | throw new ServiceException("æ¥å·¥å¤±è´¥,ç产产åºåå¨å¤±è´¥"); |
| | |
| | | List<ProductionProductRouteItemParamDto> productionProductRouteItemParamDtoList = productRouteItemDto.getProductionProductRouteItemParamDtoList(); |
| | | if (productionProductRouteItemParamDtoList != null && !productionProductRouteItemParamDtoList.isEmpty()) { |
| | | for (ProductionProductRouteItemParamDto productRouteItemParamDto : productionProductRouteItemParamDtoList) { |
| | | ProductionProductRouteItemParam paramEntity = new ProductionProductRouteItemParam(); |
| | | BeanUtils.copyProperties(productRouteItemParamDto, paramEntity, "id"); |
| | | paramEntity.setProductionProductRouteItemId(productRouteItemEntity.getId()); |
| | | paramEntity.setOrderItemParamId(productRouteItemParamDto.getId()); |
| | | if (paramEntity.getProductId() == null) { |
| | | ProductionOrderRouteItemParam productionOrderRouteItemParam = productionOrderRouteItemParamService.getById(productRouteItemParamDto.getId()); |
| | | paramEntity.setParamName(productionOrderRouteItemParam.getParamName()); |
| | | paramEntity.setParamType(productionOrderRouteItemParam.getParamType()); |
| | | paramEntity.setParamFormat(productionOrderRouteItemParam.getParamFormat()); |
| | | paramEntity.setValueMode(productionOrderRouteItemParam.getValueMode()); |
| | | } |
| | | if (productRouteItemParamDto.getProductId() != null) { |
| | | // 妿æäº§åIDï¼åæ¯æå
¥ç©æï¼åå
¥æå
¥è¡¨ |
| | | ProductionProductInput inputEntity = new ProductionProductInput(); |
| | | inputEntity.setProductMainId(productionProductMain.getId()); |
| | | inputEntity.setRouteItemId(productRouteItemEntity.getId()); |
| | | inputEntity.setProductId(productRouteItemParamDto.getProductId()); |
| | | inputEntity.setBomId(productRouteItemParamDto.getBomId()); |
| | | BigDecimal qty = productRouteItemParamDto.getQuantity(); |
| | | if (qty == null) { |
| | | qty = productRouteItemParamDto.getProductValue(); |
| | | } |
| | | inputEntity.setQuantity(qty != null ? qty : BigDecimal.ZERO); |
| | | inputEntity.setUnit(productRouteItemParamDto.getUnit()); |
| | | productionProductInputService.save(inputEntity); |
| | | } else { |
| | | // å¦åæ¯æ®éåæ°ï¼åå
¥åæ°è¡¨ |
| | | ProductionProductRouteItemParam paramEntity = new ProductionProductRouteItemParam(); |
| | | BeanUtils.copyProperties(productRouteItemParamDto, paramEntity, "id"); |
| | | paramEntity.setProductionProductRouteItemId(productRouteItemEntity.getId()); |
| | | paramEntity.setOrderItemParamId(productRouteItemParamDto.getId()); |
| | | |
| | | productionProductRouteItemParamService.save(paramEntity); |
| | | // ä»è®¢ååæ°è¡¨è¡¥å
¨åºç¡ä¿¡æ¯ï¼åç§°ãç±»åãåä½çï¼ |
| | | if (productRouteItemParamDto.getId() != null) { |
| | | ProductionOrderRouteItemParam orderParam = productionOrderRouteItemParamService.getById(productRouteItemParamDto.getId()); |
| | | if (orderParam != null) { |
| | | paramEntity.setParamName(orderParam.getParamName()); |
| | | paramEntity.setParamType(orderParam.getParamType()); |
| | | paramEntity.setParamFormat(orderParam.getParamFormat()); |
| | | paramEntity.setValueMode(orderParam.getValueMode()); |
| | | paramEntity.setUnit(orderParam.getUnit()); |
| | | } |
| | | } |
| | | productionProductRouteItemParamService.save(paramEntity); |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | dto.setMaterialCode(productMaterialSkuDto.getMaterialCode()); |
| | | dto.setModel(productMaterialSkuDto.getModel()); |
| | | |
| | | // æ¥è¯¢æ»çäº§åºæ°é(è¿éææå
¥è¡¨å¼æäºäº§åºæ»è¡¨) |
| | | // æ¥è¯¢æ»çæå
¥æ°é |
| | | ProductionProductInput input = productionProductInputService.getOne( |
| | | new LambdaQueryWrapper<ProductionProductInput>() |
| | | .eq(ProductionProductInput::getProductMainId, productMainId) |
| | | .isNull(ProductionProductInput::getRouteItemId) |
| | | .last("LIMIT 1")); |
| | | if (input != null) { |
| | | dto.setProductId(input.getProductModelId()); |
| | | dto.setProductId(input.getProductId()); |
| | | dto.setQuantity(input.getQuantity()); |
| | | } |
| | | |
| | |
| | | .eq(ProductionProductOutput::getProductMainId, productMainId) |
| | | .last("LIMIT 1")); |
| | | if (output != null) { |
| | | dto.setQuantity(output.getTotalQuantity()); |
| | | dto.setQualifiedQuantity(output.getQuantity()); |
| | | dto.setUnqualifiedQuantity(output.getScrapQty()); |
| | | } |
| | |
| | | List<ProductionProductRouteItemParam> paramList = productionProductRouteItemParamService.list( |
| | | new LambdaQueryWrapper<ProductionProductRouteItemParam>() |
| | | .eq(ProductionProductRouteItemParam::getProductionProductRouteItemId, routeItem.getId())); |
| | | |
| | | List<ProductionProductRouteItemParamDto> paramDtoList = new ArrayList<>(); |
| | | if (paramList != null && !paramList.isEmpty()) { |
| | | List<ProductionProductRouteItemParamDto> paramDtoList = paramList.stream().map(param -> { |
| | | paramDtoList.addAll(paramList.stream().map(param -> { |
| | | ProductionProductRouteItemParamDto paramDto = new ProductionProductRouteItemParamDto(); |
| | | BeanUtils.copyProperties(param, paramDto); |
| | | if (paramDto.getProductId() != null) { |
| | | ProductMaterialSkuDto materialSkuDto = productMaterialService.selectProductByModelId(paramDto.getProductId()); |
| | | productMaterialService.selectProductByModelId(paramDto.getProductId()); |
| | | return paramDto; |
| | | }).collect(Collectors.toList())); |
| | | } |
| | | |
| | | // æ¥è¯¢å·¥åºæå
¥ç©æ |
| | | List<ProductionProductInput> routeItemInputList = productionProductInputService.list( |
| | | new LambdaQueryWrapper<ProductionProductInput>() |
| | | .eq(ProductionProductInput::getProductMainId, productMainId) |
| | | .eq(ProductionProductInput::getRouteItemId, routeItem.getId())); |
| | | if (routeItemInputList != null && !routeItemInputList.isEmpty()) { |
| | | paramDtoList.addAll(routeItemInputList.stream().map(inputItem -> { |
| | | ProductionProductRouteItemParamDto paramDto = new ProductionProductRouteItemParamDto(); |
| | | paramDto.setProductId(inputItem.getProductId()); |
| | | paramDto.setBomId(inputItem.getBomId()); |
| | | paramDto.setQuantity(inputItem.getQuantity()); |
| | | paramDto.setProductValue(inputItem.getQuantity()); |
| | | paramDto.setUnit(inputItem.getUnit()); |
| | | |
| | | ProductMaterialSkuDto materialSkuDto = productMaterialService.selectProductByModelId(inputItem.getProductId()); |
| | | if (materialSkuDto != null) { |
| | | paramDto.setParamName(materialSkuDto.getProductName()); |
| | | paramDto.setProductName(materialSkuDto.getProductName()); |
| | | paramDto.setModel(materialSkuDto.getModel()); |
| | | paramDto.setMaterialCode(materialSkuDto.getMaterialCode()); |
| | | String strength = productBomService.strengthById(paramDto.getBomId()); |
| | | paramDto.setStrength(strength); |
| | | } |
| | | String strength = productBomService.strengthById(inputItem.getBomId()); |
| | | paramDto.setStrength(strength); |
| | | return paramDto; |
| | | }).collect(Collectors.toList()); |
| | | }).collect(Collectors.toList())); |
| | | } |
| | | |
| | | if (!paramDtoList.isEmpty()) { |
| | | routeItemDto.setProductionProductRouteItemParamDtoList(paramDtoList); |
| | | } |
| | | |
| | |
| | | // æ´æ°æå
¥è¡¨ |
| | | ProductionProductInput input = productionProductInputService.getOne(new LambdaQueryWrapper<ProductionProductInput>() |
| | | .eq(ProductionProductInput::getProductMainId, productMainId) |
| | | .isNull(ProductionProductInput::getRouteItemId) |
| | | .last("LIMIT 1")); |
| | | if (input != null) { |
| | | input.setProductModelId(dto.getProductId()); |
| | | input.setQuantity(dto.getQuantity()); |
| | | input.setProductId(dto.getProductId()); |
| | | input.setQuantity(dto.getQuantity() != null ? dto.getQuantity() : BigDecimal.ZERO); |
| | | productionProductInputService.updateById(input); |
| | | } |
| | | |
| | |
| | | oldOutput.setProductModelId(dto.getProductId()); |
| | | oldOutput.setQuantity(dto.getQualifiedQuantity()); |
| | | oldOutput.setScrapQty(dto.getUnqualifiedQuantity()); |
| | | oldOutput.setTotalQuantity(dto.getQuantity()); |
| | | productionProductOutputService.updateById(oldOutput); |
| | | } |
| | | |
| | |
| | | |
| | | final Long routeItemId = routeItemEntity.getId(); |
| | | |
| | | // å¤çå·¥åºåæ°: å
å é¤è¯¥å·¥åºä¸æææ§åæ°ï¼åéæ°æå
¥ä¼ å
¥çåæ° |
| | | // å¤çå·¥åºåæ°åæå
¥: å
å é¤è¯¥å·¥åºä¸æææ§åæ°åæ§æå
¥ï¼åéæ°æå
¥ä¼ å
¥çæ°æ® |
| | | productionProductRouteItemParamService.remove(new LambdaQueryWrapper<ProductionProductRouteItemParam>() |
| | | .eq(ProductionProductRouteItemParam::getProductionProductRouteItemId, routeItemId)); |
| | | productionProductInputService.remove(new LambdaQueryWrapper<ProductionProductInput>() |
| | | .eq(ProductionProductInput::getProductMainId, productMainId) |
| | | .eq(ProductionProductInput::getRouteItemId, routeItemId)); |
| | | |
| | | List<ProductionProductRouteItemParamDto> paramDtoList = routeItemDto.getProductionProductRouteItemParamDtoList(); |
| | | if (paramDtoList != null && !paramDtoList.isEmpty()) { |
| | | for (ProductionProductRouteItemParamDto paramDto : paramDtoList) { |
| | | ProductionProductRouteItemParam paramEntity = new ProductionProductRouteItemParam(); |
| | | BeanUtils.copyProperties(paramDto, paramEntity, "id"); |
| | | paramEntity.setProductionProductRouteItemId(routeItemId); |
| | | if (paramEntity.getProductId() == null && paramDto.getId() != null) { |
| | | ProductionOrderRouteItemParam orderParam = productionOrderRouteItemParamService.getById(paramDto.getId()); |
| | | if (orderParam != null) { |
| | | paramEntity.setOrderItemParamId(orderParam.getId()); |
| | | paramEntity.setParamName(orderParam.getParamName()); |
| | | paramEntity.setParamType(orderParam.getParamType()); |
| | | paramEntity.setParamFormat(orderParam.getParamFormat()); |
| | | paramEntity.setValueMode(orderParam.getValueMode()); |
| | | if (paramDto.getProductId() != null) { |
| | | // æå
¥ç©æ |
| | | ProductionProductInput inputEntity = new ProductionProductInput(); |
| | | inputEntity.setProductMainId(productMainId); |
| | | inputEntity.setRouteItemId(routeItemId); |
| | | inputEntity.setProductId(paramDto.getProductId()); |
| | | inputEntity.setBomId(paramDto.getBomId()); |
| | | BigDecimal qty = paramDto.getQuantity(); |
| | | if (qty == null) { |
| | | qty = paramDto.getProductValue(); |
| | | } |
| | | inputEntity.setQuantity(qty != null ? qty : BigDecimal.ZERO); |
| | | inputEntity.setUnit(paramDto.getUnit()); |
| | | productionProductInputService.save(inputEntity); |
| | | } else { |
| | | // æ®éåæ° |
| | | ProductionProductRouteItemParam paramEntity = new ProductionProductRouteItemParam(); |
| | | BeanUtils.copyProperties(paramDto, paramEntity, "id"); |
| | | paramEntity.setProductionProductRouteItemId(routeItemId); |
| | | if (paramDto.getId() != null) { |
| | | ProductionOrderRouteItemParam orderParam = productionOrderRouteItemParamService.getById(paramDto.getId()); |
| | | if (orderParam != null) { |
| | | paramEntity.setOrderItemParamId(orderParam.getId()); |
| | | paramEntity.setParamName(orderParam.getParamName()); |
| | | paramEntity.setParamType(orderParam.getParamType()); |
| | | paramEntity.setParamFormat(orderParam.getParamFormat()); |
| | | paramEntity.setValueMode(orderParam.getValueMode()); |
| | | paramEntity.setUnit(orderParam.getUnit()); |
| | | } |
| | | } |
| | | productionProductRouteItemParamService.save(paramEntity); |
| | | } |
| | | productionProductRouteItemParamService.save(paramEntity); |
| | | } |
| | | } |
| | | |
| | |
| | | package com.ruoyi.productionPlan.controller; |
| | | |
| | | import com.ruoyi.energy.vo.EnergyStatisticsVo; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.productionPlan.pojo.SalesDelivery; |
| | | import com.ruoyi.productionPlan.service.SalesDeliveryService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | |
| | | @RequestMapping("/salesDelivery") |
| | | @Api(tags = "éå®åè´§æç»") |
| | | public class SalesDeliveryController { |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.productionPlan.enums; |
| | | |
| | | import lombok.Getter; |
| | | |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * å°åå½å±å°æä¸¾ |
| | | * æ ¹æ®å°åå
³é®åèªå¨å¹é
ï¼é¶å·/ç³å´å±±/å´å¿ /åºå/ä¸å«/èªæ/å
èå¤/å
¶ä» |
| | | */ |
| | | @Getter |
| | | public enum AddressRegionEnum { |
| | | |
| | | /** |
| | | * é¶å·å¸ |
| | | */ |
| | | YINCHUAN("é¶å·", Arrays.asList("å
´åº", "西å¤", "éå¤", "æ°¸å®", "è´ºå
°", "çµæ¦")), |
| | | |
| | | /** |
| | | * ç³å´å±±å¸ |
| | | */ |
| | | SHIZUISHAN("ç³å´å±±", Arrays.asList("大æ¦å£", "å¹³ç½", "æ å", "å©é")), |
| | | |
| | | /** |
| | | * å´å¿ å¸ |
| | | */ |
| | | WUZHONG("å´å¿ ", Arrays.asList("çº¢å¯ºå ¡", "çæ± ", "åå¿", "éé峡")), |
| | | |
| | | /** |
| | | * åºåå¸ |
| | | */ |
| | | GUYUAN("åºå",Arrays.asList("åå·", "æ³¾æº", "å½é³", "ä¸å®", "æµ·å", "éå¾·", "西å")), |
| | | |
| | | /** |
| | | * ä¸å«å¸ |
| | | */ |
| | | ZHONGWEI("ä¸å«", Arrays.asList("æ²å¡å¤´", "ä¸å®", "æµ·å")), |
| | | |
| | | /** |
| | | * èªæ |
| | | */ |
| | | SELF_PICKUP("èªæ", Arrays.asList("èªæ")), |
| | | |
| | | /** |
| | | * å
èå¤ï¼å
å«ä½ æä¾çææåºå¿å
³é®åï¼ |
| | | */ |
| | | INNER_MONGOLIA("å
èå¤", Arrays.asList( |
| | | // å¼åæµ©ç¹ |
| | | "å¼å浩ç¹", "æ°å", "åæ°", "çæ³", "èµç½", "åé»ç¹å·¦æ", "åé»ç¹", "æå
æ", "åææ ¼å°", "æ¸
æ°´æ²³", "æ¦å·", |
| | | // å
头 |
| | | "å
头", "䏿²³", "æé½ä»", "éå±±", "ç³æ", "ç½äºéå", "ä¹å", "åé»ç¹å³æ", "åºé³", "è¾¾å°ç½èæå®èåæ", |
| | | // 乿µ· |
| | | "乿µ·", "æµ·åæ¹¾", "æµ·å", "ä¹è¾¾", |
| | | // 赤峰 |
| | | "赤峰", "红山", "å
å®å±±", "æ¾å±±", "é¿é²ç§å°æ²æ", "å·´æå·¦æ", "å·´æå³æ", "æè¥¿", "å
ä»å
è
¾æ", "ç¿çç¹æ", "ååæ²æ", "å®å", "ææ±æ", |
| | | // éè¾½ |
| | | "éè¾½", "ç§å°æ²", "éæéå", "ç§å°æ²å·¦ç¿¼ä¸æ", "ç§å°æ²å·¦ç¿¼åæ", "å¼é²", "åºä¼¦æ", "奿¼æ", "æé²ç¹æ", |
| | | // éå°å¤æ¯ï¼å«èªå®ä¹å°åï¼ |
| | | "éå°å¤æ¯", "ä¸è", "康巴ä»", "è¾¾æç¹æ", "åæ ¼å°æ", "éæå
åæ", "éæå
æ", "æé¦æ", "ä¹å®¡æ", "ä¼ééæ´æ", |
| | | // å¼ä¼¦è´å° |
| | | "å¼ä¼¦è´å°", "æµ·æå°", "æèµè¯ºå°", "满洲é", "çå
ç³", "æå
°å±¯", "é¢å°å¤çº³", "æ ¹æ²³", |
| | | "é¿è£æ", "è«åè¾¾ç¦è¾¾æ¡å°æèªæ²»æ", "é伦æ¥èªæ²»æ", "鿏©å
æèªæ²»æ", "éå·´å°èæ", "æ°å·´å°èå·¦æ", "æ°å·´å°è峿", |
| | | // 巴彦æ·å° |
| | | "巴彦æ·å°", "临河", "äºå", "磴å£", "乿ç¹åæ", "乿ç¹ä¸æ", "乿ç¹åæ", "æé¦åæ", |
| | | // ä¹å
°å¯å¸ |
| | | "ä¹å
°å¯å¸", "éå®", "丰é", "åèµ", "åå¾·", "åé½", "å
´å", "åå", |
| | | "å¯åå°å³ç¿¼åæ", "å¯åå°å³ç¿¼ä¸æ", "å¯åå°å³ç¿¼åæ", "ååçæ", |
| | | // å
´å®ç |
| | | "å
´å®ç", "ä¹å
°æµ©ç¹", "é¿å°å±±", "ç§å°æ²å³ç¿¼åæ", "ç§å°æ²å³ç¿¼ä¸æ", "æèµç¹æ", "çªæ³", |
| | | // 顿éåç |
| | | "顿éåç", "é¡ææµ©ç¹", "äºè¿æµ©ç¹", "é¿å·´åæ", "èå°¼ç¹å·¦æ", "èå°¼ç¹å³æ", |
| | | "ä¸ä¹ç ç©æ²æ", "西ä¹ç ç©æ²æ", "太ä»å¯ºæ", "é¶é»æ", "æ£é¶ç½æ", "æ£èæ", "å¤ä¼¦", |
| | | // é¿æåç |
| | | "é¿æåç", "é¿æåå·¦æ", "é¿æå峿", "颿µçº³æ", |
| | | //èªå®ä¹ |
| | | "èéæ ¼ç»æµå¼ååº", "æé¦æä¼åä¹ç´ èæ¨èåç«", "éæå
åæä¸æµ·åºé","å
è" |
| | | )), |
| | | |
| | | /** |
| | | * å
¶ä»å°åº |
| | | */ |
| | | OTHER("å
¶ä»", Arrays.asList()); |
| | | |
| | | |
| | | /** |
| | | * å½å±å°åç§° |
| | | */ |
| | | private final String regionName; |
| | | |
| | | /** |
| | | * å¹é
å
³é®åå表 |
| | | */ |
| | | private final List<String> keyWords; |
| | | |
| | | /** |
| | | * æé æ¹æ³ |
| | | */ |
| | | AddressRegionEnum(String regionName, List<String> keyWords) { |
| | | this.regionName = regionName; |
| | | this.keyWords = keyWords; |
| | | } |
| | | |
| | | // ==================== æ ¸å¿æ¹æ³ï¼æ ¹æ®å°åå符串å¹é
å½å±å° ==================== |
| | | /** |
| | | * æ ¹æ®å°åææ¬èªå¨è¯å«å½å±å° |
| | | * @param address 详ç»å°åå符串 |
| | | * @return å¹é
å°çå½å±å°æä¸¾ï¼é»è®¤è¿åOTHERï¼ |
| | | */ |
| | | public static AddressRegionEnum matchRegion(String address) { |
| | | // å°å为空/空å符串ï¼ç´æ¥è¿åå
¶ä» |
| | | if (address == null || address.trim().isEmpty()) { |
| | | return OTHER; |
| | | } |
| | | |
| | | // æä¼å
级å¹é
ï¼èªæ > å®å¤åå°å¸ > å
èå¤ > å
¶ä» |
| | | for (AddressRegionEnum region : values()) { |
| | | // è·³è¿æ å
³é®åçOTHER |
| | | if (region.keyWords.isEmpty()) { |
| | | continue; |
| | | } |
| | | // éåå
³é®åï¼å°åå
å«ä»»æå
³é®ååå¹é
æå |
| | | for (String keyword : region.keyWords) { |
| | | if (address.contains(keyword)) { |
| | | return region; |
| | | } |
| | | } |
| | | } |
| | | |
| | | // æ å¹é
å
³é®åï¼è¿åå
¶ä» |
| | | return OTHER; |
| | | } |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.production.dto.ProcessRouteItemParamDto; |
| | | import com.ruoyi.production.pojo.ProductionOrderRouteItemParam; |
| | | import com.ruoyi.production.pojo.ProductionProductRouteItemParam; |
| | | import com.ruoyi.production.dto.ProductionProductRouteItemParamDto; |
| | | import com.ruoyi.quality.dto.FinishedPageDto; |
| | | import com.ruoyi.quality.dto.FinishedRatioDto; |
| | | import com.ruoyi.quality.dto.ProcessPageDto; |
| | |
| | | |
| | | IPage<ProcessPageDto> processPage(Page page, ProcessPageDto processPageDto); |
| | | |
| | | List<ProductionProductRouteItemParam> processDetails(ProcessPageDto processPageDto); |
| | | List<ProductionProductRouteItemParamDto> processDetails(ProcessPageDto processPageDto); |
| | | |
| | | IPage<FinishedPageDto> finishedPage(Page page, FinishedPageDto finishedPageDto); |
| | | |
| | |
| | | import com.deepoove.poi.XWPFTemplate; |
| | | import com.deepoove.poi.config.Configure; |
| | | import com.ruoyi.common.enums.StockInQualifiedRecordTypeEnum; |
| | | import com.ruoyi.common.enums.StockOutQualifiedRecordTypeEnum; |
| | | import com.ruoyi.common.utils.HackLoopTableRenderPolicy; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.procurementrecord.service.ProcurementRecordService; |
| | | import com.ruoyi.procurementrecord.utils.StockUtils; |
| | | import com.ruoyi.production.dto.ProcessRouteItemParamDto; |
| | | import com.ruoyi.production.dto.ProductMaterialSkuDto; |
| | | import com.ruoyi.production.dto.ProductionProductRouteItemParamDto; |
| | | import com.ruoyi.production.mapper.ProductOrderMapper; |
| | | import com.ruoyi.production.mapper.ProductionProductRouteItemMapper; |
| | | import com.ruoyi.production.mapper.ProductionProductRouteItemParamMapper; |
| | | import com.ruoyi.production.pojo.ProductionOrderRouteItemParam; |
| | | import com.ruoyi.production.pojo.ProductionProductInput; |
| | | import com.ruoyi.production.pojo.ProductionProductRouteItemParam; |
| | | import com.ruoyi.production.service.ProductBomService; |
| | | import com.ruoyi.production.service.ProductMaterialService; |
| | | import com.ruoyi.production.service.ProductionProductInputService; |
| | | import com.ruoyi.quality.dto.FinishedPageDto; |
| | | import com.ruoyi.quality.dto.FinishedRatioDto; |
| | | import com.ruoyi.quality.dto.ProcessPageDto; |
| | |
| | | import java.io.InputStream; |
| | | import java.io.OutputStream; |
| | | import java.net.URLEncoder; |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | |
| | | public class QualityInspectServiceImpl extends ServiceImpl<QualityInspectMapper, QualityInspect> implements IQualityInspectService { |
| | | |
| | | private final StockUtils stockUtils; |
| | | private QualityInspectMapper qualityInspectMapper; |
| | | private final QualityInspectMapper qualityInspectMapper; |
| | | |
| | | private IQualityInspectParamService qualityInspectParamService; |
| | | private final IQualityInspectParamService qualityInspectParamService; |
| | | |
| | | private QualityTestStandardMapper qualityTestStandardMapper; |
| | | private final QualityTestStandardMapper qualityTestStandardMapper; |
| | | |
| | | private QualityUnqualifiedMapper qualityUnqualifiedMapper; |
| | | private final QualityUnqualifiedMapper qualityUnqualifiedMapper; |
| | | |
| | | private SalesLedgerProductMapper salesLedgerProductMapper; |
| | | private final SalesLedgerProductMapper salesLedgerProductMapper; |
| | | |
| | | private ProcurementRecordService procurementRecordService; |
| | | private final ProcurementRecordService procurementRecordService; |
| | | |
| | | private ProductionProductRouteItemMapper productionProductRouteItemMapper; |
| | | private final ProductionProductRouteItemMapper productionProductRouteItemMapper; |
| | | |
| | | private ProductionProductRouteItemParamMapper productionProductRouteItemParamMapper; |
| | | private final ProductionProductRouteItemParamMapper productionProductRouteItemParamMapper; |
| | | |
| | | private ProductOrderMapper productOrderMapper; |
| | | private final ProductOrderMapper productOrderMapper; |
| | | |
| | | private final ProductionProductInputService productionProductInputService; |
| | | |
| | | private final ProductMaterialService productMaterialService; |
| | | |
| | | private final ProductBomService productBomService; |
| | | |
| | | @Override |
| | | public int add(QualityInspectDto qualityInspectDto) { |
| | |
| | | } |
| | | |
| | | @Override |
| | | public List<ProductionProductRouteItemParam> processDetails(ProcessPageDto processPageDto) { |
| | | return productionProductRouteItemParamMapper.processDetails(processPageDto.getProductionProductRouteItemId()); |
| | | public List<ProductionProductRouteItemParamDto> processDetails(ProcessPageDto processPageDto) { |
| | | List<ProductionProductRouteItemParamDto> resultList = new ArrayList<>(); |
| | | |
| | | // 1. æ¥è¯¢æ®éåæ° |
| | | List<ProductionProductRouteItemParam> paramList = productionProductRouteItemParamMapper.processDetails(processPageDto.getProductionProductRouteItemId()); |
| | | if (paramList != null && !paramList.isEmpty()) { |
| | | resultList.addAll(paramList.stream().map(param -> { |
| | | ProductionProductRouteItemParamDto dto = new ProductionProductRouteItemParamDto(); |
| | | BeanUtils.copyProperties(param, dto); |
| | | return dto; |
| | | }).collect(Collectors.toList())); |
| | | } |
| | | |
| | | // 2. æ¥è¯¢ç©ææå
¥ |
| | | // 注æï¼æåæ£çæ¶åå¯è½æ²¡æå
·ä½åæ¡æ¥å·¥è®°å½IDï¼æä»¥æåæ£è¯¦æ
å¯è½éè¦æè®¢åæ¥è¯¢ï¼ |
| | | // ä½è¿éçprocessDetailsæ¯âè¿ç¨æ£è¯¦æ
âï¼é常æå
·ä½æ¥å·¥è®°å½ã |
| | | // æ ¹æ®æ¥å·¥è®°å½ ID æ¥æ¾å¯¹åºç ProductMainId |
| | | Long routeItemId = processPageDto.getProductionProductRouteItemId(); |
| | | if (routeItemId != null) { |
| | | List<ProductionProductInput> inputList = productionProductInputService.list(Wrappers.<ProductionProductInput>lambdaQuery() |
| | | .eq(ProductionProductInput::getRouteItemId, routeItemId)); |
| | | |
| | | if (inputList != null && !inputList.isEmpty()) { |
| | | for (ProductionProductInput input : inputList) { |
| | | ProductionProductRouteItemParamDto dto = new ProductionProductRouteItemParamDto(); |
| | | dto.setProductId(input.getProductId()); |
| | | dto.setBomId(input.getBomId()); |
| | | dto.setQuantity(input.getQuantity()); |
| | | dto.setProductValue(input.getQuantity()); |
| | | dto.setUnit(input.getUnit()); |
| | | |
| | | // å¡«å
ç©æä¿¡æ¯ |
| | | ProductMaterialSkuDto materialSkuDto = productMaterialService.selectProductByModelId(input.getProductId()); |
| | | if (materialSkuDto != null) { |
| | | dto.setParamName(materialSkuDto.getProductName()); |
| | | dto.setProductName(materialSkuDto.getProductName()); |
| | | dto.setModel(materialSkuDto.getModel()); |
| | | dto.setMaterialCode(materialSkuDto.getMaterialCode()); |
| | | } |
| | | String strength = productBomService.strengthById(input.getBomId()); |
| | | dto.setStrength(strength); |
| | | |
| | | resultList.add(dto); |
| | | } |
| | | } |
| | | } |
| | | |
| | | return resultList; |
| | | } |
| | | |
| | | @Override |
| | |
| | | </if> |
| | | group by e.energy_tyep |
| | | </select> |
| | | <select id="energyCostDtos" resultType="com.ruoyi.energy.dto.EnergyCostDto"> |
| | | select z.meter_reading_date, |
| | | <select id="energyCostDtos1" resultType="com.ruoyi.energy.dto.EnergyCostDto"> |
| | | select distinct |
| | | z.meter_reading_date, |
| | | COALESCE(A.waterConsumption, 0) waterConsumption, |
| | | COALESCE(A.waterCost, 0) waterCost, |
| | | COALESCE(B.electricityConsumption, 0) electricityConsumption, |
| | |
| | | on z.meter_reading_date=C.meter_reading_date |
| | | order by z.meter_reading_date |
| | | </select> |
| | | <select id="energyConsumptionDetailDtos" |
| | | resultType="com.ruoyi.energy.dto.EnergyConsumptionDetailDto"> |
| | | select ecd.meter_reading_date, |
| | | <select id="energyCostDtos2" resultType="com.ruoyi.energy.dto.EnergyCostDto"> |
| | | select distinct |
| | | DATE_FORMAT(z.meter_reading_date, '%Y-%m') AS meterReadingDate , |
| | | COALESCE(A.waterConsumption, 0) waterConsumption, |
| | | COALESCE(A.waterCost, 0) waterCost, |
| | | COALESCE(B.electricityConsumption, 0) electricityConsumption, |
| | | COALESCE(B.electricityCost, 0) electricityCost, |
| | | COALESCE(C.gasConsumption, 0) gasConsumption, |
| | | COALESCE(C.gasCost, 0) gasCost, |
| | | COALESCE(A.waterConsumption, 0)+ COALESCE(B.electricityConsumption, 0)+ COALESCE(C.gasConsumption, 0) totalConsumption, |
| | | COALESCE(A.waterCost, 0)+ COALESCE(B.electricityCost, 0)+ COALESCE(C.gasCost, 0) totalCost |
| | | from energy_consumption_detail z |
| | | left join |
| | | (select DATE_FORMAT(ecd.meter_reading_date, '%Y-%m') AS meterReadingDate , |
| | | sum(ecd.dosage) waterConsumption, |
| | | sum(ecd.dosage * e1.unit_price) waterCost |
| | | from energy_consumption_detail ecd |
| | | left join energy e1 on ecd.energy_id = e1.id |
| | | where ecd.meter_reading_date between #{c.startDate} and #{c.endDate} |
| | | and e1.energy_tyep='æ°´' |
| | | <if test="c.type != null and c.type != ''"> |
| | | and ecd.type =#{c.type} |
| | | </if> |
| | | group by DATE_FORMAT(ecd.meter_reading_date, '%Y-%m'))A |
| | | on DATE_FORMAT(z.meter_reading_date, '%Y-%m')=A.meterReadingDate |
| | | left join |
| | | (select DATE_FORMAT(ecd.meter_reading_date, '%Y-%m') AS meterReadingDate, |
| | | sum(ecd.dosage) electricityConsumption, |
| | | sum(ecd.dosage * e2.unit_price) electricityCost |
| | | from energy_consumption_detail ecd |
| | | left join energy e2 on ecd.energy_id = e2.id |
| | | where ecd.meter_reading_date between #{c.startDate} and #{c.endDate} |
| | | and e2.energy_tyep='çµ' |
| | | <if test="c.type != null and c.type != ''"> |
| | | and ecd.type =#{c.type} |
| | | </if> |
| | | group by DATE_FORMAT(ecd.meter_reading_date, '%Y-%m'))B |
| | | on DATE_FORMAT(z.meter_reading_date, '%Y-%m')=B.meterReadingDate |
| | | left join |
| | | (select DATE_FORMAT(ecd.meter_reading_date, '%Y-%m') AS meterReadingDate, |
| | | sum(ecd.dosage) gasConsumption, |
| | | sum(ecd.dosage * e3.unit_price) gasCost |
| | | from energy_consumption_detail ecd |
| | | left join energy e3 on ecd.energy_id = e3.id |
| | | where ecd.meter_reading_date between #{c.startDate} and #{c.endDate} |
| | | and e3.energy_tyep='æ°' |
| | | <if test="c.type != null and c.type != ''"> |
| | | and ecd.type =#{c.type} |
| | | </if> |
| | | group by DATE_FORMAT(ecd.meter_reading_date, '%Y-%m'))C |
| | | on DATE_FORMAT(z.meter_reading_date, '%Y-%m')=C.meterReadingDate |
| | | order by DATE_FORMAT(z.meter_reading_date, '%Y-%m') |
| | | </select> |
| | | <select id="energyCostDtos3" resultType="com.ruoyi.energy.dto.EnergyCostDto"> |
| | | select distinct |
| | | DATE_FORMAT(z.meter_reading_date, '%Y') AS meterReadingDate, |
| | | COALESCE(A.waterConsumption, 0) waterConsumption, |
| | | COALESCE(A.waterCost, 0) waterCost, |
| | | COALESCE(B.electricityConsumption, 0) electricityConsumption, |
| | | COALESCE(B.electricityCost, 0) electricityCost, |
| | | COALESCE(C.gasConsumption, 0) gasConsumption, |
| | | COALESCE(C.gasCost, 0) gasCost, |
| | | COALESCE(A.waterConsumption, 0)+ COALESCE(B.electricityConsumption, 0)+ COALESCE(C.gasConsumption, 0) totalConsumption, |
| | | COALESCE(A.waterCost, 0)+ COALESCE(B.electricityCost, 0)+ COALESCE(C.gasCost, 0) totalCost |
| | | from energy_consumption_detail z |
| | | left join |
| | | (select DATE_FORMAT(ecd.meter_reading_date, '%Y') AS meterReadingDate, |
| | | sum(ecd.dosage) waterConsumption, |
| | | sum(ecd.dosage * e1.unit_price) waterCost |
| | | from energy_consumption_detail ecd |
| | | left join energy e1 on ecd.energy_id = e1.id |
| | | where ecd.meter_reading_date between #{c.startDate} and #{c.endDate} |
| | | and e1.energy_tyep='æ°´' |
| | | <if test="c.type != null and c.type != ''"> |
| | | and ecd.type =#{c.type} |
| | | </if> |
| | | group by DATE_FORMAT(ecd.meter_reading_date, '%Y'))A |
| | | on DATE_FORMAT(z.meter_reading_date, '%Y')=A.meterReadingDate |
| | | left join |
| | | (select DATE_FORMAT(ecd.meter_reading_date, '%Y') AS meterReadingDate, |
| | | sum(ecd.dosage) electricityConsumption, |
| | | sum(ecd.dosage * e2.unit_price) electricityCost |
| | | from energy_consumption_detail ecd |
| | | left join energy e2 on ecd.energy_id = e2.id |
| | | where ecd.meter_reading_date between #{c.startDate} and #{c.endDate} |
| | | and e2.energy_tyep='çµ' |
| | | <if test="c.type != null and c.type != ''"> |
| | | and ecd.type =#{c.type} |
| | | </if> |
| | | group by DATE_FORMAT(ecd.meter_reading_date, '%Y'))B |
| | | on DATE_FORMAT(z.meter_reading_date, '%Y')=B.meterReadingDate |
| | | left join |
| | | (select DATE_FORMAT(ecd.meter_reading_date, '%Y') AS meterReadingDate, |
| | | sum(ecd.dosage) gasConsumption, |
| | | sum(ecd.dosage * e3.unit_price) gasCost |
| | | from energy_consumption_detail ecd |
| | | left join energy e3 on ecd.energy_id = e3.id |
| | | where ecd.meter_reading_date between #{c.startDate} and #{c.endDate} |
| | | and e3.energy_tyep='æ°' |
| | | <if test="c.type != null and c.type != ''"> |
| | | and ecd.type =#{c.type} |
| | | </if> |
| | | group by DATE_FORMAT(ecd.meter_reading_date, '%Y'))C |
| | | on DATE_FORMAT(z.meter_reading_date, '%Y')=C.meterReadingDate |
| | | order by DATE_FORMAT(z.meter_reading_date, '%Y') |
| | | </select> |
| | | <select id="energyConsumptionDetailDtos1" resultType="com.ruoyi.energy.dto.EnergyDetailDto"> |
| | | select distinct |
| | | ecd.meter_reading_date, |
| | | e.energy_tyep, |
| | | ecd.type, |
| | | e.unit, |
| | |
| | | e.unit_price |
| | | order by ecd.meter_reading_date |
| | | </select> |
| | | |
| | | <select id="energyConsumptionDetailDtos2" resultType="com.ruoyi.energy.dto.EnergyDetailDto"> |
| | | select distinct |
| | | DATE_FORMAT(ecd.meter_reading_date, '%Y-%m') AS meterReadingDate , |
| | | e.energy_tyep, |
| | | ecd.type, |
| | | e.unit, |
| | | e.unit_price, |
| | | sum(ecd.dosage) dosage, |
| | | sum(ecd.dosage * e.unit_price) cost |
| | | from energy_consumption_detail ecd |
| | | left join energy e on ecd.energy_id = e.id |
| | | where ecd.meter_reading_date between #{c.startDate} and #{c.endDate} |
| | | group by DATE_FORMAT(ecd.meter_reading_date, '%Y-%m'), |
| | | e.energy_tyep, |
| | | ecd.type, |
| | | e.unit, |
| | | e.unit_price |
| | | order by DATE_FORMAT(ecd.meter_reading_date, '%Y-%m') |
| | | </select> |
| | | <select id="energyConsumptionDetailDtos3" resultType="com.ruoyi.energy.dto.EnergyDetailDto"> |
| | | select distinct |
| | | DATE_FORMAT(ecd.meter_reading_date, '%Y') AS meterReadingDate, |
| | | e.energy_tyep, |
| | | ecd.type, |
| | | e.unit, |
| | | e.unit_price, |
| | | sum(ecd.dosage) dosage, |
| | | sum(ecd.dosage * e.unit_price) cost |
| | | from energy_consumption_detail ecd |
| | | left join energy e on ecd.energy_id = e.id |
| | | where ecd.meter_reading_date between #{c.startDate} and #{c.endDate} |
| | | group by DATE_FORMAT(ecd.meter_reading_date, '%Y'), |
| | | e.energy_tyep, |
| | | ecd.type, |
| | | e.unit, |
| | | e.unit_price |
| | | order by DATE_FORMAT(ecd.meter_reading_date, '%Y') |
| | | </select> |
| | | </mapper> |
| | |
| | | sku.material_code, |
| | | pm.product_name, |
| | | sku.model, |
| | | pprip.unit, |
| | | ppi.unit, |
| | | pos.unit_quantity, |
| | | sum(pprip.product_value) actualInputQuantity, |
| | | sum(ppi.quantity) actualInputQuantity, |
| | | sum(ppo.quantity+ppo.scrap_qty) actualOutputQuantity |
| | | from production_product_route_item_param pprip |
| | | left join production_product_route_item ppri on ppri.id=pprip.production_product_route_item_id |
| | | left join production_product_main ppm on ppm.id=ppri.product_main_id |
| | | from production_product_input ppi |
| | | left join production_product_main ppm on ppm.id=ppi.product_main_id |
| | | left join production_product_output ppo on ppm.id=ppo.product_main_id |
| | | left join product_material_sku sku ON pprip.product_id = sku.id |
| | | left join product_material_sku sku ON ppi.product_id = sku.id |
| | | left join product_material pm ON sku.product_id = pm.id |
| | | left join production_order_structure pos ON pos.product_model_id = pprip.product_id |
| | | left join production_order_structure pos ON pos.product_model_id = ppi.product_id |
| | | where ppm.product_order_id = #{productOrderId} |
| | | and pos.order_id = #{productOrderId} |
| | | and pprip.order_item_param_id is null |
| | | group by sku.material_code, |
| | | pm.product_name, |
| | | sku.model, |
| | | pos.unit_quantity, |
| | | pprip.unit)A |
| | | ppi.unit)A |
| | | |
| | | </select> |
| | | </mapper> |
| | |
| | | <resultMap id="basicMap" type="com.ruoyi.production.pojo.ProductionProductInput"> |
| | | <id property="id" column="id"/> |
| | | <result property="productMainId" column="product_main_id"/> |
| | | <result property="productModelId" column="product_model_id"/> |
| | | <result property="routeItemId" column="route_item_id"/> |
| | | <result property="productId" column="product_id"/> |
| | | <result property="bomId" column="bom_id"/> |
| | | <result property="quantity" column="quantity"/> |
| | | <result property="tenantId" column="tenant_id"/> |
| | | <result property="unit" column="unit"/> |
| | | <result property="createUser" column="create_user"/> |
| | | <result property="createTime" column="create_time"/> |
| | | <result property="updateTime" column="update_time"/> |
| | | <result property="tenantId" column="tenant_id"/> |
| | | </resultMap> |
| | | |
| | | <select id="listPageProductionProductInputDto" resultType="com.ruoyi.production.dto.ProductionProductInputDto"> |
| | | select ppi.*, |
| | | pm.model as model, |
| | |
| | | pms.material_code as materialCode, |
| | | pm.product_name as productName, |
| | | pms.model as productModelName, |
| | | IFNULL(ppi.quantity, 0) as totalQuantity, |
| | | IFNULL(ppo.total_quantity, 0) as totalQuantity, |
| | | IFNULL(ppo.scrap_qty, 0) as scrapQty, |
| | | IFNULL(ppo.quantity, 0) as quantity |
| | | from |
| | | production_product_main ppm |
| | | left join production_product_output ppo on ppo.product_main_id = ppm.id |
| | | left join production_product_input ppi on ppi.product_main_id = ppm.id |
| | | left join product_order po on po.id = ppm.product_order_id |
| | | left join product_order_plan pop on po.id = pop.product_order_id |
| | | left join production_plan pp on pop.production_plan_id = pp.id |
| | |
| | | <result column="min_value" property="minValue"/> |
| | | <result column="max_value" property="maxValue"/> |
| | | <result column="param_value" property="paramValue"/> |
| | | <result column="product_id" property="productId"/> |
| | | <result column="bom_id" property="bomId"/> |
| | | <result column="product_value" property="productValue"/> |
| | | <result column="unit" property="unit"/> |
| | | <result column="is_required" property="isRequired"/> |
| | | <result column="source_sort" property="sourceSort"/> |
| | | <result column="dict_code" property="dictCode"/> |
| | | <result column="create_user" property="createUser"/> |
| | | <result column="create_time" property="createTime"/> |
| | | <result column="update_user" property="updateUser"/> |
| | |
| | | select pprip.* |
| | | from production_product_route_item_param pprip |
| | | where pprip.production_product_route_item_id = #{productionProductRouteItemId} |
| | | and pprip.order_item_param_id is not null |
| | | and pprip.order_item_param_id is not null |
| | | </select> |
| | | |
| | | </mapper> |