| | |
| | | |
| | | ALTER TABLE `product_bom` |
| | | ADD COLUMN `dict_code` bigint NOT NULL COMMENT 'å
³èåå
¸æ°æ®ç¼ç ï¼sys_dict_data.dict_codeï¼'; |
| | | ALTER TABLE `product_bom` ADD INDEX `idx_dict_code` (`dict_code`); |
| | | ALTER TABLE `product_bom` ADD INDEX `idx_dict_code` (`dict_code`); |
| | | |
| | | ALTER TABLE `product-inventory-management-zsjc`.`process_route` |
| | | ADD COLUMN `dict_code` bigint NOT NULL COMMENT '产åç±»ååå
¸ç¼ç ' AFTER `status`; |
| | | |
| | | |
| | | ALTER TABLE `product-inventory-management-zsjc`.`product_order` |
| | | ADD COLUMN `status` int NULL COMMENT 'ç¶æï¼1.å¾
å¼å§ã2.è¿è¡ä¸ã3.已宿ã4.已忶ï¼' AFTER `plan_complete_time`; |
| | | |
| | | DROP TABLE IF EXISTS `process_route_item_instance`; |
| | | CREATE TABLE `process_route_item_instance` |
| | | ( |
| | | `id` bigint NOT NULL AUTO_INCREMENT, |
| | | `route_id` bigint NOT NULL DEFAULT 0 COMMENT 'å·¥èºè·¯çº¿id', |
| | | `product_model_id` bigint NULL DEFAULT 0 COMMENT '产åid', |
| | | `process_id` bigint NOT NULL DEFAULT 0 COMMENT 'å·¥åºid', |
| | | `tenant_id` bigint NOT NULL COMMENT 'ç§æ·id', |
| | | `create_time` datetime NULL DEFAULT NULL COMMENT 'å½å
¥æ¶é´', |
| | | `update_time` datetime NULL DEFAULT NULL COMMENT 'æ´æ°æ¶é´', |
| | | `drag_sort` int NULL DEFAULT NULL COMMENT 'æå¨æåº', |
| | | `is_quality` tinyint(1) NULL DEFAULT 1 COMMENT 'æ¯å¦è´¨æ£å·¥åº', |
| | | PRIMARY KEY (`id`) USING BTREE |
| | | ) ENGINE = InnoDB |
| | | AUTO_INCREMENT = 83 |
| | | CHARACTER SET = utf8mb4 |
| | | COLLATE = utf8mb4_0900_ai_ci COMMENT = 'å·¥èºè·¯çº¿åé-é表' |
| | | ROW_FORMAT = Dynamic; |
| | | |
| | | -- ---------------------------- |
| | | -- Table structure for process_route_item_param_instance |
| | | -- ---------------------------- |
| | | DROP TABLE IF EXISTS `process_route_item_param_instance`; |
| | | CREATE TABLE `process_route_item_param_instance` |
| | | ( |
| | | `id` bigint NOT NULL AUTO_INCREMENT COMMENT '主é®ID', |
| | | `route_item_id` bigint NOT NULL COMMENT 'å
³èå·¥èºè·¯çº¿æç»ID (process_route_item.id)', |
| | | `param_id` bigint NOT NULL COMMENT 'å
³èåºç¡åæ°å®ä¹ID (base_param.id)', |
| | | `process_param_id` bigint NULL DEFAULT NULL COMMENT 'æ¥æºå·¥åºåæ°ID', |
| | | `standard_value` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT 'æ¤è·¯çº¿èç¹è®¾å®çæ åå¼', |
| | | `min_value` decimal(10, 2) NULL DEFAULT NULL COMMENT 'æ¤è·¯çº¿èç¹è®¾å®çæ åæå°å¼', |
| | | `max_value` decimal(10, 2) NULL DEFAULT NULL COMMENT 'æ¤è·¯çº¿èç¹è®¾å®çæ åæå¤§å¼', |
| | | `is_required` tinyint NOT NULL DEFAULT 0 COMMENT 'æ¯å¦å¿
å¡«', |
| | | `sort` int NOT NULL DEFAULT 0 COMMENT 'æåº', |
| | | `tenant_id` bigint NULL DEFAULT NULL COMMENT 'ç§æ·ID', |
| | | `create_time` datetime NULL DEFAULT CURRENT_TIMESTAMP, |
| | | `update_time` datetime NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, |
| | | PRIMARY KEY (`id`) USING BTREE, |
| | | INDEX `idx_route_item_id` (`route_item_id` ASC) USING BTREE, |
| | | INDEX `idx_param_id` (`param_id` ASC) USING BTREE |
| | | ) ENGINE = InnoDB |
| | | AUTO_INCREMENT = 178 |
| | | CHARACTER SET = utf8mb4 |
| | | COLLATE = utf8mb4_0900_ai_ci COMMENT = 'å·¥èºè·¯çº¿å·¥åºåæ°-é表' |
| | | ROW_FORMAT = Dynamic; |
| | | |
| | | -- ---------------------------- |
| | | -- Table structure for product_process_param_instance |
| | | -- ---------------------------- |
| | | DROP TABLE IF EXISTS `product_process_param_instance`; |
| | | CREATE TABLE `product_process_param_instance` |
| | | ( |
| | | `id` bigint NOT NULL AUTO_INCREMENT COMMENT '主é®ID', |
| | | `process_id` bigint NOT NULL COMMENT 'æå±å·¥åºID (product_process.id)', |
| | | `param_id` bigint NOT NULL COMMENT 'å
³èåºç¡åæ°ID (base_param.id)', |
| | | `standard_value` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '卿¤å·¥åºè®¾å®çæ åå¼(å弿¨¡å¼)', |
| | | `min_value` decimal(10, 2) NULL DEFAULT NULL COMMENT '卿¤å·¥åºè®¾å®çæ åæå°å¼(åºé´æ¨¡å¼)', |
| | | `max_value` decimal(10, 2) NULL DEFAULT NULL COMMENT '卿¤å·¥åºè®¾å®çæ åæå¤§å¼(åºé´æ¨¡å¼)', |
| | | `is_required` tinyint NOT NULL DEFAULT 0 COMMENT '卿¤å·¥åºä¸æ¯å¦å¿
å¡«(0-å¦, 1-æ¯)', |
| | | `sort` int NOT NULL DEFAULT 0 COMMENT 'æåºå·', |
| | | `tenant_id` bigint NULL DEFAULT NULL COMMENT 'ç§æ·ID', |
| | | `create_time` datetime NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'å建æ¶é´', |
| | | `update_time` datetime NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT 'æ´æ°æ¶é´', |
| | | PRIMARY KEY (`id`) USING BTREE, |
| | | INDEX `idx_process_id` (`process_id` ASC) USING BTREE, |
| | | INDEX `idx_param_id` (`param_id` ASC) USING BTREE |
| | | ) ENGINE = InnoDB |
| | | AUTO_INCREMENT = 61 |
| | | CHARACTER SET = utf8mb4 |
| | | COLLATE = utf8mb4_0900_ai_ci COMMENT = 'å·¥åºç»å®åæ°-é表' |
| | | ROW_FORMAT = Dynamic; |
| | | |
| | | -- ---------------------------- |
| | | -- Table structure for product_structure_instance |
| | | -- ---------------------------- |
| | | DROP TABLE IF EXISTS `product_structure_instance`; |
| | | CREATE TABLE `product_structure_instance` |
| | | ( |
| | | `id` bigint NOT NULL AUTO_INCREMENT, |
| | | `parent_id` bigint NULL DEFAULT NULL COMMENT 'ç¶èç¹ID', |
| | | `product_model_id` bigint NULL DEFAULT NULL COMMENT '产åid', |
| | | `process_id` bigint NULL DEFAULT NULL COMMENT 'å·¥åºid', |
| | | `unit_quantity` decimal(16, 4) NOT NULL COMMENT 'åä½äº§åºéè¦æ°é', |
| | | `demanded_quantity` decimal(16, 4) NULL DEFAULT NULL COMMENT 'éæ±æ°é', |
| | | `unit` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT 'åä½', |
| | | `tenant_id` bigint NULL DEFAULT NULL COMMENT 'ç§æ·id', |
| | | `bom_id` bigint NOT NULL COMMENT 'bomçid', |
| | | PRIMARY KEY (`id`) USING BTREE |
| | | ) ENGINE = InnoDB |
| | | CHARACTER SET = utf8mb4 |
| | | COLLATE = utf8mb4_0900_ai_ci COMMENT = 'BOMåé-é表' |
| | | ROW_FORMAT = Dynamic; |
| | | |
| | | SET FOREIGN_KEY_CHECKS = 1; |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.appendix.controller; |
| | | |
| | | import io.swagger.annotations.Api; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | /** |
| | | * <br> |
| | | * BOM-å·¥èºè·¯çº¿é表æ§å¶å± |
| | | * </br> |
| | | * |
| | | * @author deslrey |
| | | * @version 1.0 |
| | | * @since 2026/03/18 14:44 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/appendix") |
| | | @Api("BOM-å·¥èºè·¯çº¿é表æ§å¶å±") |
| | | public class AppendixController { |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.appendix.controller; |
| | | |
| | | import io.swagger.annotations.Api; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | /** |
| | | * <br> |
| | | * å·¥èºè·¯çº¿åé-é表æ§å¶å± |
| | | * </br> |
| | | * |
| | | * @author deslrey |
| | | * @version 1.0 |
| | | * @since 2026/03/18 13:07 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/processRouteItemInstance") |
| | | @Api("èºè·¯çº¿åé-é表æ§å¶å±") |
| | | public class ProcessRouteItemInstanceController { |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.appendix.controller; |
| | | |
| | | import io.swagger.annotations.Api; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | /** |
| | | * <br> |
| | | * å·¥èºè·¯çº¿å·¥åºåæ°æ¥å£ |
| | | * </br> |
| | | * |
| | | * @author deslrey |
| | | * @version 1.0 |
| | | * @since 2026/03/18 13:14 |
| | | */ |
| | | |
| | | @Api(tags = "å·¥èºè·¯çº¿å·¥åºåæ°æ¥å£") |
| | | @RestController |
| | | @RequestMapping("/processRouteItemParamInstance") |
| | | public class ProcessRouteItemParamInstanceController { |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.appendix.controller; |
| | | |
| | | import io.swagger.annotations.Api; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | /** |
| | | * <br> |
| | | * å·¥åºç»å®åæ°-é表Controller |
| | | * </br> |
| | | * |
| | | * @author deslrey |
| | | * @version 1.0 |
| | | * @since 2026/03/18 13:19 |
| | | */ |
| | | @Api(tags = "å·¥åºç»å®åæ°æ¥å£") |
| | | @RestController |
| | | @RequestMapping("/productProcessParamInstance") |
| | | public class ProductProcessParamInstanceController { |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.appendix.controller; |
| | | |
| | | import io.swagger.annotations.Api; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | /** |
| | | * <br> |
| | | * BOMåé-é表Controller |
| | | * </br> |
| | | * |
| | | * @author deslrey |
| | | * @version 1.0 |
| | | * @since 2026/03/18 13:22 |
| | | */ |
| | | @Api(tags = "BOMç»ææ¥å£") |
| | | @RestController |
| | | @RequestMapping("/productStructureInstance") |
| | | public class ProductStructureInstanceController { |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.appendix.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.ruoyi.appendix.pojo.ProcessRouteItemInstance; |
| | | |
| | | /** |
| | | * <br> |
| | | * å·¥èºè·¯çº¿åé-é表Mapper |
| | | * </br> |
| | | * |
| | | * @author deslrey |
| | | * @version 1.0 |
| | | * @since 2026/03/18 13:02 |
| | | */ |
| | | public interface ProcessRouteItemInstanceMapper extends BaseMapper<ProcessRouteItemInstance> { |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.appendix.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.ruoyi.appendix.pojo.ProcessRouteItemParamInstance; |
| | | |
| | | /** |
| | | * <br> |
| | | * å·¥èºè·¯çº¿å·¥åºåæ°-é表Mapper |
| | | * </br> |
| | | * |
| | | * @author deslrey |
| | | * @version 1.0 |
| | | * @since 2026/03/18 13:10 |
| | | */ |
| | | public interface ProcessRouteItemParamInstanceMapper extends BaseMapper<ProcessRouteItemParamInstance> { |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.appendix.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.ruoyi.appendix.pojo.ProductProcessParamInstance; |
| | | |
| | | /** |
| | | * <br> |
| | | * å·¥åºç»å®åæ°-é表Mapper |
| | | * </br> |
| | | * |
| | | * @author deslrey |
| | | * @version 1.0 |
| | | * @since 2026/03/18 13:15 |
| | | */ |
| | | public interface ProductProcessParamInstanceMapper extends BaseMapper<ProductProcessParamInstance> { |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.appendix.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.ruoyi.appendix.pojo.ProductStructureInstance; |
| | | |
| | | /** |
| | | * <br> |
| | | * BOMåé-é表Mapper |
| | | * </br> |
| | | * |
| | | * @author deslrey |
| | | * @version 1.0 |
| | | * @since 2026/03/18 13:20 |
| | | */ |
| | | public interface ProductStructureInstanceMapper extends BaseMapper<ProductStructureInstance> { |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.appendix.pojo; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.time.LocalDateTime; |
| | | |
| | | /** |
| | | * <br> |
| | | * å·¥èºè·¯çº¿åé-é表 |
| | | * </br> |
| | | * |
| | | * @author deslrey |
| | | * @version 1.0 |
| | | * @since 2026/03/18 11:43 |
| | | */ |
| | | @Data |
| | | @TableName("process_route_item_instance") |
| | | @Api(tags = "å·¥èºè·¯çº¿åé-é表") |
| | | public class ProcessRouteItemInstance { |
| | | |
| | | @TableId(type = IdType.AUTO) |
| | | private Long id; |
| | | |
| | | @ApiModelProperty("å·¥èºè·¯çº¿id") |
| | | private Long routeId; |
| | | |
| | | @ApiModelProperty("产åid") |
| | | private Long productModelId; |
| | | |
| | | @ApiModelProperty("å·¥åºid") |
| | | private Long processId; |
| | | |
| | | @ApiModelProperty("ç§æ·id") |
| | | private Long tenantId; |
| | | |
| | | @ApiModelProperty("å½å
¥æ¶é´") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private LocalDateTime createTime; |
| | | |
| | | @ApiModelProperty("æ´æ°æ¶é´") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private LocalDateTime updateTime; |
| | | |
| | | @ApiModelProperty("æå¨æåº") |
| | | private Integer dragSort; |
| | | |
| | | @ApiModelProperty("æ¯å¦è´¨æ£å·¥åº") |
| | | private Integer isQuality; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.appendix.pojo; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.*; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | |
| | | /** |
| | | * <br> |
| | | * å·¥èºè·¯çº¿å·¥åºåæ°-é表 |
| | | * </br> |
| | | * |
| | | * @author deslrey |
| | | * @version 1.0 |
| | | * @since 2026/03/18 13:09 |
| | | */ |
| | | @Data |
| | | @TableName("process_route_item_param_instance") |
| | | @Api(tags = "å·¥èºè·¯çº¿å·¥åºåæ°-é表") |
| | | public class ProcessRouteItemParamInstance { |
| | | |
| | | @TableId(type = IdType.AUTO) |
| | | @ApiModelProperty("主é®ID") |
| | | private Long id; |
| | | |
| | | @ApiModelProperty("å
³èå·¥èºè·¯çº¿æç»ID") |
| | | private Long routeItemId; |
| | | |
| | | @ApiModelProperty("å
³èåºç¡åæ°å®ä¹ID") |
| | | private Long paramId; |
| | | |
| | | @ApiModelProperty("æ¥æºå·¥åºåæ°ID") |
| | | private Long processParamId; |
| | | |
| | | @ApiModelProperty("æ åå¼") |
| | | private String standardValue; |
| | | |
| | | @ApiModelProperty("æå°å¼") |
| | | private BigDecimal minValue; |
| | | |
| | | @ApiModelProperty("æå¤§å¼") |
| | | private BigDecimal maxValue; |
| | | |
| | | @ApiModelProperty("æ¯å¦å¿
å¡«") |
| | | private Integer isRequired; |
| | | |
| | | @ApiModelProperty("æåº") |
| | | private Integer sort; |
| | | |
| | | @ApiModelProperty("ç§æ·ID") |
| | | private Long tenantId; |
| | | |
| | | @ApiModelProperty("å建æ¶é´") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private LocalDateTime createTime; |
| | | |
| | | @ApiModelProperty("æ´æ°æ¶é´") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | private LocalDateTime updateTime; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.appendix.pojo; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.*; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | |
| | | |
| | | /** |
| | | * <br> |
| | | * å·¥åºç»å®åæ°-é表 |
| | | * </br> |
| | | * |
| | | * @author deslrey |
| | | * @version 1.0 |
| | | * @since 2026/03/18 13:14 |
| | | */ |
| | | @Data |
| | | @TableName("product_process_param_instance") |
| | | @Api(tags = "å·¥åºç»å®åæ°-é表") |
| | | public class ProductProcessParamInstance { |
| | | |
| | | @TableId(type = IdType.AUTO) |
| | | @ApiModelProperty("主é®ID") |
| | | private Long id; |
| | | |
| | | @ApiModelProperty("æå±å·¥åºID") |
| | | private Long processId; |
| | | |
| | | @ApiModelProperty("å
³èåºç¡åæ°ID") |
| | | private Long paramId; |
| | | |
| | | @ApiModelProperty("æ åå¼(å弿¨¡å¼)") |
| | | private String standardValue; |
| | | |
| | | @ApiModelProperty("æå°å¼(åºé´æ¨¡å¼)") |
| | | private BigDecimal minValue; |
| | | |
| | | @ApiModelProperty("æå¤§å¼(åºé´æ¨¡å¼)") |
| | | private BigDecimal maxValue; |
| | | |
| | | @ApiModelProperty("æ¯å¦å¿
å¡«(0-å¦,1-æ¯)") |
| | | private Boolean isRequired; |
| | | |
| | | @ApiModelProperty("æåºå·") |
| | | private Integer sort; |
| | | |
| | | @ApiModelProperty("ç§æ·ID") |
| | | private Long tenantId; |
| | | |
| | | @ApiModelProperty("å建æ¶é´") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private LocalDateTime createTime; |
| | | |
| | | @ApiModelProperty("æ´æ°æ¶é´") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | private LocalDateTime updateTime; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.appendix.pojo; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | /** |
| | | * <br> |
| | | * BOMåé-é表 |
| | | * </br> |
| | | * |
| | | * @author deslrey |
| | | * @version 1.0 |
| | | * @since 2026/03/18 13:20 |
| | | */ |
| | | @Data |
| | | @TableName("product_structure_instance") |
| | | @Api(tags = "BOMåé-é表") |
| | | public class ProductStructureInstance { |
| | | |
| | | @TableId(type = IdType.AUTO) |
| | | @ApiModelProperty("主é®ID") |
| | | private Long id; |
| | | |
| | | @ApiModelProperty("ç¶èç¹ID") |
| | | private Long parentId; |
| | | |
| | | @ApiModelProperty("产åID") |
| | | private Long productModelId; |
| | | |
| | | @ApiModelProperty("å·¥åºID") |
| | | private Long processId; |
| | | |
| | | @ApiModelProperty("åä½äº§åºéè¦æ°é") |
| | | private BigDecimal unitQuantity; |
| | | |
| | | @ApiModelProperty("éæ±æ°é") |
| | | private BigDecimal demandedQuantity; |
| | | |
| | | @ApiModelProperty("åä½") |
| | | private String unit; |
| | | |
| | | @ApiModelProperty("ç§æ·ID") |
| | | private Long tenantId; |
| | | |
| | | @ApiModelProperty("BOM ID") |
| | | private Long bomId; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.appendix.service; |
| | | |
| | | import com.ruoyi.productionPlan.dto.ProductionPlanDto; |
| | | |
| | | /** |
| | | * <br> |
| | | * BOM-å·¥èºè·¯çº¿é表Serviceæ¥å£ |
| | | * </br> |
| | | * |
| | | * @author deslrey |
| | | * @version 1.0 |
| | | * @since 2026/03/18 14:45 |
| | | */ |
| | | public interface AppendixService { |
| | | |
| | | |
| | | /** |
| | | * å°å¯¹åºçå·¥èºè·¯çº¿åéä¸ç»å®çBOMåéå¡«å
å°éè¡¨ä¸ |
| | | * |
| | | * @param productOrderId ç产订åID |
| | | * @param processRouteId å·¥èºè·¯çº¿ID |
| | | */ |
| | | void populateData(Long productOrderId, Long processRouteId); |
| | | |
| | | /** |
| | | * ç»ä¸åçç åæå对åºçå·¥èºè·¯çº¿åéä¸ç»å®çBOMåéå¡«å
å°éè¡¨ä¸ |
| | | * |
| | | * @param productionPlanDto 产å详æ
|
| | | */ |
| | | Long populateBlocks(ProductionPlanDto productionPlanDto); |
| | | |
| | | /** |
| | | * ç»ä¸åçæ¿ææå对åºçå·¥èºè·¯çº¿åéä¸ç»å®çBOMåéå¡«å
å°éè¡¨ä¸ |
| | | * |
| | | * @param productionPlanDto 产å详æ
|
| | | */ |
| | | Long populatePlates(ProductionPlanDto productionPlanDto); |
| | | |
| | | /** |
| | | * å é¤è¯¥è®¢åæºå¸¦çéè¡¨æ°æ® |
| | | * |
| | | * @param processRouteId å·¥èºè·¯çº¿ID |
| | | */ |
| | | void deleteData(Long processRouteId); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.appendix.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.appendix.pojo.ProcessRouteItemInstance; |
| | | |
| | | /** |
| | | * <br> |
| | | *å·¥èºè·¯çº¿åé-é表Service |
| | | * </br> |
| | | * |
| | | * @author deslrey |
| | | * @version 1.0 |
| | | * @since 2026/03/18 13:07 |
| | | */ |
| | | public interface ProcessRouteItemInstanceService extends IService<ProcessRouteItemInstance> { |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.appendix.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.appendix.pojo.ProcessRouteItemParamInstance; |
| | | |
| | | /** |
| | | * <br> |
| | | * å·¥èºè·¯çº¿å·¥åºåæ°-é表Service |
| | | * </br> |
| | | * |
| | | * @author deslrey |
| | | * @version 1.0 |
| | | * @since 2026/03/18 13:11 |
| | | */ |
| | | public interface ProcessRouteItemParamInstanceService extends IService<ProcessRouteItemParamInstance> { |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.appendix.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.appendix.pojo.ProductProcessParamInstance; |
| | | |
| | | /** |
| | | * <br> |
| | | * å·¥åºç»å®åæ°-é表Serviceæ¥å£ |
| | | * </br> |
| | | * |
| | | * @author deslrey |
| | | * @version 1.0 |
| | | * @since 2026/03/18 13:16 |
| | | */ |
| | | public interface ProductProcessParamInstanceService extends IService<ProductProcessParamInstance> { |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.appendix.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.appendix.pojo.ProductStructureInstance; |
| | | |
| | | /** |
| | | * <br> |
| | | * BOMåé-é表Serviceæ¥å£ |
| | | * </br> |
| | | * |
| | | * @author deslrey |
| | | * @version 1.0 |
| | | * @since 2026/03/18 13:21 |
| | | */ |
| | | public interface ProductStructureInstanceService extends IService<ProductStructureInstance> { |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.appendix.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.ruoyi.appendix.pojo.ProcessRouteItemInstance; |
| | | import com.ruoyi.appendix.pojo.ProcessRouteItemParamInstance; |
| | | import com.ruoyi.appendix.pojo.ProductProcessParamInstance; |
| | | import com.ruoyi.appendix.pojo.ProductStructureInstance; |
| | | import com.ruoyi.appendix.service.*; |
| | | import com.ruoyi.common.exception.ServiceException; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.production.pojo.*; |
| | | import com.ruoyi.production.service.*; |
| | | import com.ruoyi.productionPlan.dto.ProductionPlanDto; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * <br> |
| | | * BOM-å·¥èºè·¯çº¿é表Serviceæ¥å£å®ç°ç±» |
| | | * </br> |
| | | * |
| | | * @author deslrey |
| | | * @version 1.0 |
| | | * @since 2026/03/18 14:45 |
| | | */ |
| | | @Slf4j |
| | | @Service |
| | | public class AppendixServiceImpl implements AppendixService { |
| | | |
| | | @Resource |
| | | private ProcessRouteItemInstanceService processRouteItemInstanceService; |
| | | |
| | | @Resource |
| | | private ProcessRouteItemParamInstanceService processRouteItemParamInstanceService; |
| | | |
| | | @Resource |
| | | private ProductProcessParamInstanceService productProcessParamInstanceService; |
| | | |
| | | @Resource |
| | | private ProductStructureInstanceService productStructureInstanceService; |
| | | |
| | | @Resource |
| | | private ProcessRouteService processRouteService; |
| | | |
| | | @Resource |
| | | private ProcessRouteItemService processRouteItemService; |
| | | |
| | | @Resource |
| | | private ProcessRouteItemParamService processRouteItemParamService; |
| | | |
| | | @Resource |
| | | private ProductProcessParamService productProcessParamService; |
| | | |
| | | @Resource |
| | | private ProductStructureService productStructureService; |
| | | |
| | | @Resource |
| | | private ProductOrderService productOrderService; |
| | | |
| | | @Override |
| | | public Long populateBlocks(ProductionPlanDto productionPlanDto) { |
| | | if (productionPlanDto == null) { |
| | | throw new ServiceException("ä¸åæ°æ®ä¸è½ä¸ºç©º"); |
| | | } |
| | | if (StringUtils.isEmpty(productionPlanDto.getStrength())) { |
| | | throw new ServiceException("ç åç产åç±»åä¸è½ä¸ºç©º"); |
| | | } |
| | | ProcessRoute processRoute = processRouteService.latestTypeDate(productionPlanDto.getProductName(), productionPlanDto.getStrength()); |
| | | if (processRoute == null) { |
| | | log.info("ä¸å产åã{}ãæªæ¥è¯¢åºå·¥èºè·¯çº¿", productionPlanDto.getProductName()); |
| | | return null; |
| | | } |
| | | migration(processRoute); |
| | | return processRoute.getId(); |
| | | } |
| | | |
| | | @Override |
| | | public Long populatePlates(ProductionPlanDto productionPlanDto) { |
| | | if (productionPlanDto == null) { |
| | | throw new ServiceException("ä¸åæ°æ®ä¸è½ä¸ºç©º"); |
| | | } |
| | | // æ¿æä¸åºå强度ï¼strengthä¼ null |
| | | ProcessRoute processRoute = processRouteService.latestTypeDate(productionPlanDto.getProductName(), null); |
| | | if (processRoute == null) { |
| | | log.info("ä¸å产åã{}ãæªæ¥è¯¢åºå·¥èºè·¯çº¿", productionPlanDto.getProductName()); |
| | | return null; |
| | | } |
| | | migration(processRoute); |
| | | return processRoute.getId(); |
| | | } |
| | | |
| | | @Override |
| | | public void populateData(Long productOrderId, Long processRouteId) { |
| | | ProcessRoute processRoute = processRouteService.getById(processRouteId); |
| | | if (processRoute == null) { |
| | | log.info("ç产订åã{}ãæªæ¥è¯¢åºå·¥èºè·¯çº¿ã{}ã", productOrderId, processRouteId); |
| | | return; |
| | | } |
| | | migration(processRoute); |
| | | |
| | | // ååå·¥èºè·¯çº¿idå°ç产订å |
| | | ProductOrder productOrder = new ProductOrder(); |
| | | productOrder.setId(productOrderId); |
| | | productOrder.setRouteId(processRouteId); |
| | | productOrderService.updateById(productOrder); |
| | | } |
| | | |
| | | @Override |
| | | public void deleteData(Long processRouteId) { |
| | | // æ¥åºå·¥èºè·¯çº¿åéï¼ç¨äºå
³èå é¤åæ°é表 |
| | | List<ProcessRouteItem> itemList = processRouteItemService.list(new LambdaQueryWrapper<ProcessRouteItem>().eq(ProcessRouteItem::getRouteId, processRouteId)); |
| | | |
| | | if (itemList != null && !itemList.isEmpty()) { |
| | | List<Long> itemIds = itemList.stream().map(ProcessRouteItem::getId).collect(Collectors.toList()); |
| | | List<Long> processIds = itemList.stream().map(ProcessRouteItem::getProcessId).collect(Collectors.toList()); |
| | | |
| | | // å é¤å·¥èºè·¯çº¿å·¥åºåæ°é表 |
| | | processRouteItemParamInstanceService.remove(new LambdaQueryWrapper<ProcessRouteItemParamInstance>().in(ProcessRouteItemParamInstance::getRouteItemId, itemIds)); |
| | | |
| | | // å é¤å·¥åºç»å®åæ°é表 |
| | | productProcessParamInstanceService.remove(new LambdaQueryWrapper<ProductProcessParamInstance>().in(ProductProcessParamInstance::getProcessId, processIds)); |
| | | } |
| | | |
| | | // å é¤å·¥èºè·¯çº¿åéé表 |
| | | processRouteItemInstanceService.remove( |
| | | new LambdaQueryWrapper<ProcessRouteItemInstance>().eq(ProcessRouteItemInstance::getRouteId, processRouteId)); |
| | | |
| | | // å é¤BOMåéé表 |
| | | ProcessRoute processRoute = processRouteService.getById(processRouteId); |
| | | if (processRoute != null && processRoute.getBomId() != null) { |
| | | productStructureInstanceService.remove(new LambdaQueryWrapper<ProductStructureInstance>().eq(ProductStructureInstance::getBomId, processRoute.getBomId())); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * æ ¹æ®å·¥èºè·¯çº¿è¿ç§»åå¼ éè¡¨æ°æ® |
| | | */ |
| | | private void migration(ProcessRoute processRoute) { |
| | | // è¿ç§»å·¥èºè·¯çº¿åéè¡¨æ°æ® |
| | | List<ProcessRouteItem> processRouteItemList = processRouteItemService.list(new LambdaQueryWrapper<ProcessRouteItem>().eq(ProcessRouteItem::getRouteId, processRoute.getId())); |
| | | migrationProcessRouteItem(processRouteItemList); |
| | | |
| | | // è¿ç§»å·¥èºè·¯çº¿å
ç»å®çå·¥åºåå·¥åºåæ° |
| | | if (processRouteItemList != null && !processRouteItemList.isEmpty()) { |
| | | for (ProcessRouteItem item : processRouteItemList) { |
| | | List<ProcessRouteItemParam> paramList = processRouteItemParamService.list(new LambdaQueryWrapper<ProcessRouteItemParam>().eq(ProcessRouteItemParam::getRouteItemId, item.getId())); |
| | | migrationProcessRouteItemParam(paramList); |
| | | |
| | | List<ProductProcessParam> processParamList = productProcessParamService.list(new LambdaQueryWrapper<ProductProcessParam>().eq(ProductProcessParam::getProcessId, item.getProcessId())); |
| | | migrationProductProcessParam(processParamList); |
| | | } |
| | | } |
| | | |
| | | // è¿ç§»BOMåéè¡¨æ°æ® |
| | | if (processRoute.getBomId() != null) { |
| | | List<ProductStructure> structureList = productStructureService.list(new LambdaQueryWrapper<ProductStructure>().eq(ProductStructure::getBomId, processRoute.getBomId())); |
| | | migrationProductStructure(structureList); |
| | | } |
| | | } |
| | | |
| | | private void migrationProcessRouteItem(List<ProcessRouteItem> list) { |
| | | if (list == null || list.isEmpty()) { |
| | | return; |
| | | } |
| | | List<ProcessRouteItemInstance> instances = list.stream().map(item -> { |
| | | ProcessRouteItemInstance instance = new ProcessRouteItemInstance(); |
| | | BeanUtils.copyProperties(item, instance, "id"); |
| | | instance.setIsQuality(item.getIsQuality() != null && item.getIsQuality() ? 1 : 0); |
| | | return instance; |
| | | }).collect(Collectors.toList()); |
| | | processRouteItemInstanceService.saveBatch(instances); |
| | | } |
| | | |
| | | private void migrationProcessRouteItemParam(List<ProcessRouteItemParam> list) { |
| | | if (list == null || list.isEmpty()) { |
| | | return; |
| | | } |
| | | List<ProcessRouteItemParamInstance> instances = list.stream().map(item -> { |
| | | ProcessRouteItemParamInstance instance = new ProcessRouteItemParamInstance(); |
| | | BeanUtils.copyProperties(item, instance, "id"); |
| | | return instance; |
| | | }).collect(Collectors.toList()); |
| | | processRouteItemParamInstanceService.saveBatch(instances); |
| | | } |
| | | |
| | | private void migrationProductProcessParam(List<ProductProcessParam> list) { |
| | | if (list == null || list.isEmpty()) { |
| | | return; |
| | | } |
| | | List<ProductProcessParamInstance> instances = list.stream().map(item -> { |
| | | ProductProcessParamInstance instance = new ProductProcessParamInstance(); |
| | | BeanUtils.copyProperties(item, instance, "id"); |
| | | instance.setIsRequired(item.getIsRequired() != null && item.getIsRequired() == 1); |
| | | return instance; |
| | | }).collect(Collectors.toList()); |
| | | productProcessParamInstanceService.saveBatch(instances); |
| | | } |
| | | |
| | | private void migrationProductStructure(List<ProductStructure> list) { |
| | | if (list == null || list.isEmpty()) { |
| | | return; |
| | | } |
| | | List<ProductStructureInstance> instances = list.stream().map(item -> { |
| | | ProductStructureInstance instance = new ProductStructureInstance(); |
| | | BeanUtils.copyProperties(item, instance, "id"); |
| | | instance.setBomId(item.getBomId() != null ? item.getBomId().longValue() : null); |
| | | return instance; |
| | | }).collect(Collectors.toList()); |
| | | productStructureInstanceService.saveBatch(instances); |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.appendix.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.appendix.mapper.ProcessRouteItemInstanceMapper; |
| | | import com.ruoyi.appendix.pojo.ProcessRouteItemInstance; |
| | | import com.ruoyi.appendix.service.ProcessRouteItemInstanceService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * <br> |
| | | * å·¥èºè·¯çº¿åé-é表Serviceå®ç°ç±» |
| | | * </br> |
| | | * |
| | | * @author deslrey |
| | | * @version 1.0 |
| | | * @since 2026/03/18 13:08 |
| | | */ |
| | | @Slf4j |
| | | @Service |
| | | public class ProcessRouteItemInstanceServiceImpl extends ServiceImpl<ProcessRouteItemInstanceMapper, ProcessRouteItemInstance> implements ProcessRouteItemInstanceService { |
| | | |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.appendix.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.appendix.mapper.ProcessRouteItemParamInstanceMapper; |
| | | import com.ruoyi.appendix.pojo.ProcessRouteItemParamInstance; |
| | | import com.ruoyi.appendix.service.ProcessRouteItemParamInstanceService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * <br> |
| | | * å·¥èºè·¯çº¿å·¥åºåæ°-é表Serviceå®ç°ç±» |
| | | * </br> |
| | | * |
| | | * @author deslrey |
| | | * @version 1.0 |
| | | * @since 2026/03/18 13:12 |
| | | */ |
| | | @Slf4j |
| | | @Service |
| | | public class ProcessRouteItemParamInstanceServiceImpl extends ServiceImpl<ProcessRouteItemParamInstanceMapper, ProcessRouteItemParamInstance> implements ProcessRouteItemParamInstanceService { |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.appendix.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.appendix.mapper.ProductProcessParamInstanceMapper; |
| | | import com.ruoyi.appendix.pojo.ProductProcessParamInstance; |
| | | import com.ruoyi.appendix.service.ProductProcessParamInstanceService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * <br> |
| | | * å·¥åºç»å®åæ°-é表Serviceå®ç°ç±» |
| | | * </br> |
| | | * |
| | | * @author deslrey |
| | | * @version 1.0 |
| | | * @since 2026/03/18 13:18 |
| | | */ |
| | | @Slf4j |
| | | @Service |
| | | public class ProductProcessParamInstanceServiceImpl extends ServiceImpl<ProductProcessParamInstanceMapper, ProductProcessParamInstance> implements ProductProcessParamInstanceService { |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.appendix.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.appendix.mapper.ProductStructureInstanceMapper; |
| | | import com.ruoyi.appendix.pojo.ProductStructureInstance; |
| | | import com.ruoyi.appendix.service.ProductStructureInstanceService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * <br> |
| | | * BOMåé-é表Serviceå®ç°ç±» |
| | | * </br> |
| | | * |
| | | * @author deslrey |
| | | * @version 1.0 |
| | | * @since 2026/03/18 13:21 |
| | | */ |
| | | @Slf4j |
| | | @Service |
| | | public class ProductStructureInstanceServiceImpl extends ServiceImpl<ProductStructureInstanceMapper, ProductStructureInstance> implements ProductStructureInstanceService { |
| | | } |
| | |
| | | /*******************************************æ±æ»ç»è®¡*****************************************************************************************************************************************************************************/ |
| | | |
| | | @GetMapping("/statistics") |
| | | @ApiOperation("ææ¥æå¹´æ±æ»ç»è®¡") |
| | | @ApiOperation("è½èç»è®¡---ææ¥æå¹´æ±æ»ç»è®¡") |
| | | public R statistics(EnergyStatisticsVo energyStatisticsVo) { |
| | | return R.ok(energyConsumptionDetailService.statistics(energyStatisticsVo)); |
| | | } |
| | | |
| | | @GetMapping("/account") |
| | | @ApiOperation("è½èææ¬æ ¸ç®---ææ¥ææ±æ»ç»è®¡") |
| | | public R account(EnergyStatisticsVo energyStatisticsVo) { |
| | | energyStatisticsVo.setType(null); |
| | | return R.ok(energyConsumptionDetailService.account(energyStatisticsVo)); |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.energy.dto; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | @ApiModel("è½èææ¬æ ¸ç®---ææ¥ææ±æ»ç»è®¡") |
| | | public class EnergyAccountDto { |
| | | |
| | | @ApiModelProperty("æ»è½èææ¬") |
| | | private BigDecimal totalEnergyCost; |
| | | |
| | | @ApiModelProperty("ç产è½èææ¬") |
| | | private BigDecimal productEnergyCost; |
| | | |
| | | @ApiModelProperty("åå
¬è½èææ¬") |
| | | private BigDecimal officeEnergyCost; |
| | | |
| | | @ApiModelProperty("平忿¬") |
| | | private BigDecimal averageEnergyCost; |
| | | |
| | | @ApiModelProperty("è½èç±»åææ¬å æ¯") |
| | | private List<EnergyConsumptionTypeDto> energyConsumptionTypeProportion; |
| | | |
| | | @ApiModelProperty("è½èç±»åæç»") |
| | | private List<EnergyConsumptionDetailDto> energyConsumptionDetailDtoList; |
| | | } |
| | |
| | | //è´¹ç¨ |
| | | private BigDecimal cost; |
| | | |
| | | //åä»· |
| | | private BigDecimal unitPrice; |
| | | |
| | | } |
| | |
| | | import java.util.Map; |
| | | |
| | | @Data |
| | | @ApiModel("ææ¥æå¹´æ±æ»ç»è®¡çè½èæ°æ®") |
| | | @ApiModel("è½èç»è®¡---ææ¥æå¹´æ±æ»ç»è®¡çè½èæ°æ®") |
| | | public class EnergyStatisticsDto { |
| | | |
| | | @ApiModelProperty("æ»èç¨é") |
| | |
| | | List<EnergyConsumptionTypeDto> energyConsumptionTypeProportion(@Param("c") EnergyStatisticsVo energyStatisticsVo); |
| | | |
| | | List<EnergyCostDto> energyCostDtos(@Param("c") EnergyStatisticsVo energyStatisticsVo); |
| | | |
| | | List<EnergyConsumptionDetailDto> energyConsumptionDetailDtos(@Param("c") EnergyStatisticsVo energyStatisticsVo); |
| | | } |
| | |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.energy.dto.EnergyAccountDto; |
| | | import com.ruoyi.energy.dto.EnergyConsumptionDetailDto; |
| | | import com.ruoyi.energy.dto.EnergyStatisticsDto; |
| | | import com.ruoyi.energy.pojo.EnergyConsumptionDetail; |
| | |
| | | |
| | | EnergyStatisticsDto statistics(EnergyStatisticsVo energyStatisticsVo); |
| | | |
| | | EnergyAccountDto account(EnergyStatisticsVo energyStatisticsVo); |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.energy.dto.EnergyConsumptionDetailDto; |
| | | import com.ruoyi.energy.dto.EnergyConsumptionTypeDto; |
| | | import com.ruoyi.energy.dto.EnergyCostDto; |
| | | import com.ruoyi.energy.dto.EnergyStatisticsDto; |
| | | import com.ruoyi.energy.dto.*; |
| | | import com.ruoyi.energy.mapper.EnergyMapper; |
| | | import com.ruoyi.energy.pojo.Energy; |
| | | import com.ruoyi.energy.pojo.EnergyConsumptionDetail; |
| | |
| | | oldenergyStatisticsVo.setEndDate(masDays); |
| | | Map<String, BigDecimal> oldmap=energyConsumptionDetailMapper.calculateEnergy(oldenergyStatisticsVo); |
| | | if (ObjectUtils.isNotEmpty(oldmap)) { |
| | | BigDecimal changeVite = (map.get("totalEnergyConsumption").subtract(oldmap.get("totalEnergyConsumption"))).divide(oldmap.get("totalEnergyConsumption"), 4, RoundingMode.HALF_UP).multiply(new BigDecimal(100)); |
| | | BigDecimal subtract = map.get("totalEnergyConsumption").subtract(oldmap.get("totalEnergyConsumption")); |
| | | BigDecimal changeVite=BigDecimal.ZERO; |
| | | if (oldmap.get("totalEnergyConsumption").compareTo(BigDecimal.ZERO)>0){ |
| | | changeVite = (subtract).divide(oldmap.get("totalEnergyConsumption"), 4, RoundingMode.HALF_UP).multiply(new BigDecimal(100)); |
| | | } |
| | | energyStatisticsDto.setChangeVite(changeVite); |
| | | } |
| | | //è½èç±»åå æ¯ |
| | |
| | | energyStatisticsDto.setEnergyCostDtos(energyCostDtos); |
| | | return energyStatisticsDto; |
| | | } |
| | | |
| | | @Override |
| | | public EnergyAccountDto account(EnergyStatisticsVo energyStatisticsVo) { |
| | | EnergyAccountDto energyAccountDto = new EnergyAccountDto(); |
| | | //è®¡ç®æ»è½èææ¬+ç产è½èææ¬+åå
¬è½èææ¬ |
| | | Map<String, BigDecimal> map=energyConsumptionDetailMapper.calculateEnergy(energyStatisticsVo); |
| | | energyAccountDto.setTotalEnergyCost(map.get("totalEnergyCost"));//æ»è½èææ¬ |
| | | energyStatisticsVo.setType("ç产"); |
| | | Map<String, BigDecimal> map1=energyConsumptionDetailMapper.calculateEnergy(energyStatisticsVo); |
| | | energyAccountDto.setProductEnergyCost(map1.get("totalEnergyCost"));//ç产è½èææ¬ |
| | | energyStatisticsVo.setType("åå
¬"); |
| | | Map<String, BigDecimal> map2=energyConsumptionDetailMapper.calculateEnergy(energyStatisticsVo); |
| | | energyAccountDto.setOfficeEnergyCost(map2.get("totalEnergyCost"));//åå
¬è½èææ¬ |
| | | energyStatisticsVo.setType(null);//æ¢å¤æ¥è¯¢å
¨é¨ |
| | | //平忿¬ |
| | | energyAccountDto.setAverageEnergyCost(energyAccountDto.getTotalEnergyCost().divide(new BigDecimal(energyStatisticsVo.getDays()),2, RoundingMode.HALF_UP)); |
| | | //è½èç±»åææ¬å æ¯ |
| | | List<EnergyConsumptionTypeDto> energyConsumptionTypeDtos=energyConsumptionDetailMapper.energyConsumptionTypeProportion(energyStatisticsVo); |
| | | energyAccountDto.setEnergyConsumptionTypeProportion(energyConsumptionTypeDtos); |
| | | //è½èç±»åæç» |
| | | List<EnergyConsumptionDetailDto> energyConsumptionDetailDtoList=energyConsumptionDetailMapper.energyConsumptionDetailDtos(energyStatisticsVo); |
| | | energyAccountDto.setEnergyConsumptionDetailDtoList(energyConsumptionDetailDtoList); |
| | | return energyAccountDto; |
| | | } |
| | | } |
| | |
| | | |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.production.dto.ProcessRouteDto; |
| | | import com.ruoyi.production.dto.ProductStructureDto; |
| | | import com.ruoyi.production.pojo.ProcessRoute; |
| | | import com.ruoyi.production.pojo.ProcessRouteItem; |
| | | import com.ruoyi.production.service.ProcessRouteItemService; |
| | |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | |
| | | @RestController |
| | | @RequestMapping("processRoute") |
| | | @RequestMapping("/processRoute") |
| | | @Api(tags = "å·¥èºè·¯çº¿") |
| | | public class ProcessRouteController { |
| | | |
| | | @Autowired |
| | | private ProcessRouteService processRouteService; |
| | | |
| | | @GetMapping("page") |
| | | @GetMapping("/page") |
| | | @ApiOperation("å页æ¥è¯¢") |
| | | public R page(Page<ProcessRouteDto> page, ProcessRouteDto processRouteDto) { |
| | | public R page(Page<ProcessRouteDto> page, ProcessRouteDto processRouteDto) { |
| | | return R.ok(processRouteService.pageProcessRouteDto(page, processRouteDto)); |
| | | } |
| | | |
| | | @ApiOperation("æ°å¢å·¥èºè·¯çº¿") |
| | | @PostMapping () |
| | | public R add(@RequestBody ProcessRoute processRoute) { |
| | | @PostMapping("") |
| | | public R add(@RequestBody ProcessRoute processRoute) { |
| | | return R.ok(processRouteService.saveProcessRoute(processRoute)); |
| | | } |
| | | |
| | | @ApiOperation("ä¿®æ¹å·¥èºè·¯çº¿") |
| | | @PutMapping () |
| | | public R update(@RequestBody ProcessRoute processRoute) { |
| | | @PutMapping("") |
| | | public R update(@RequestBody ProcessRoute processRoute) { |
| | | return R.ok(processRouteService.updateById(processRoute)); |
| | | } |
| | | |
| | | @ApiOperation("å é¤å·¥èºè·¯çº¿") |
| | | @DeleteMapping("/{ids}") |
| | | public R delete(@PathVariable("ids") Long[] ids) { |
| | | return R.ok(processRouteService.batchDelete(Arrays.asList(ids))); |
| | | } |
| | | |
| | | @GetMapping("/getRouteBom/{id}") |
| | | @ApiOperation("è·åå·¥èºè·¯çº¿ç»å®çBOMåé") |
| | | public AjaxResult getRouteBom(@PathVariable Long id) { |
| | | List<ProductStructureDto> list = processRouteService.getRouteBom(id); |
| | | return AjaxResult.success(list); |
| | | } |
| | | } |
| | |
| | | import java.util.List; |
| | | |
| | | @RestController |
| | | @RequestMapping("processRouteItem") |
| | | @RequestMapping("/processRouteItem") |
| | | @Api(tags = "å·¥èºè·¯çº¿æç»") |
| | | public class ProcessRouteItemController { |
| | | @Autowired |
| | | private ProcessRouteItemService processRouteItemService; |
| | | |
| | | @GetMapping("list") |
| | | @GetMapping("/list") |
| | | public R listProcessRouteItemDto(ProcessRouteItemDto processRouteItemDto) { |
| | | return R.ok(processRouteItemService.listProcessRouteItemDto(processRouteItemDto)); |
| | | } |
| | |
| | | public AjaxResult batchDelete(@PathVariable("id") Long id) { |
| | | return AjaxResult.success(processRouteItemService.batchDelete(id)); |
| | | } |
| | | |
| | | } |
| | |
| | | package com.ruoyi.production.controller; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | |
| | | return AjaxResult.success(productBoms); |
| | | } |
| | | |
| | | @GetMapping("/getDictCode") |
| | | @Log(title = "BOM-æ ¹æ®éæ©ç产ååå·æ¥è¯¢åå¨çbom", businessType = BusinessType.OTHER) |
| | | @ApiOperation("BOM-æ ¹æ®éæ©ç产ååå·æ¥è¯¢åå¨çbom") |
| | | public AjaxResult getDictCode(Long dictCode) { |
| | | List<ProductBom> bomList = productBomService.list(new LambdaQueryWrapper<ProductBom>().eq(ProductBom::getDictCode, dictCode)); |
| | | return AjaxResult.success(bomList); |
| | | } |
| | | |
| | | |
| | | @PostMapping("uploadBom") |
| | | @PreAuthorize("@ss.hasPermi('product:bom:import')") |
| | |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | | |
| | | @RequestMapping("productOrder") |
| | | @RequestMapping("/productOrder") |
| | | @RestController |
| | | @Api(tags = "ç产订å") |
| | | public class ProductOrderController { |
| | |
| | | |
| | | |
| | | @ApiOperation("å页æ¥è¯¢") |
| | | @GetMapping("page") |
| | | @GetMapping("/page") |
| | | public R page(ProductOrderDto productOrder, Page<ProductOrder> page) { |
| | | return R.ok(productOrderService.pageProductOrder(page, productOrder)); |
| | | } |
| | |
| | | @Data |
| | | public class BomImportDto { |
| | | |
| | | @Excel(name = "ç¼å·") |
| | | private String code; |
| | | @Excel(name = "ç¶é¡¹äº§ååç§°") |
| | | private String parentName; |
| | | |
| | | @Excel(name = "ç¶é¡¹ç¼å·") |
| | | private String parentCode; |
| | | @Excel(name = "ç¶é¡¹äº§åè§æ ¼") |
| | | private String parentSpec; |
| | | |
| | | @Excel(name = "å项产ååç§°") |
| | | private String childName; |
| | | |
| | | @Excel(name = "å项产åè§æ ¼") |
| | | private String childSpec; |
| | | |
| | | @Excel(name = "åä½ç¨é") |
| | | private BigDecimal unitQty; |
| | |
| | | |
| | | @Excel(name = "夿³¨") |
| | | private String remark; |
| | | } |
| | | } |
| | |
| | | |
| | | private String productName; |
| | | |
| | | @ApiModelProperty("è§æ ¼") |
| | | private String model; |
| | | @ApiModelProperty("产åç±»å") |
| | | private String dictLabel; |
| | | |
| | | private String bomNo; |
| | | } |
| | |
| | | |
| | | @ApiModelProperty("å·¥åºåæ°ä¸ªæ°") |
| | | private Integer paramCount; |
| | | |
| | | @ApiModelProperty("产åç±»å") |
| | | private String dictLabel; |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.production.enums; |
| | | |
| | | import lombok.Getter; |
| | | |
| | | /** |
| | | * <br> |
| | | * ç产订åç¶ææä¸¾ç±» |
| | | * </br> |
| | | * |
| | | * @author deslrey |
| | | * @version 1.0 |
| | | * @since 2026/03/18 14:18 |
| | | */ |
| | | @Getter |
| | | public enum ProductOrderStatusEnum { |
| | | |
| | | WAIT(1, "å¾
å¼å§"), |
| | | RUNNING(2, "è¿è¡ä¸"), |
| | | FINISHED(3, "已宿"), |
| | | CANCEL(4, "已忶"); |
| | | |
| | | private final Integer code; |
| | | private final String desc; |
| | | |
| | | ProductOrderStatusEnum(Integer code, String desc) { |
| | | this.code = code; |
| | | this.desc = desc; |
| | | } |
| | | |
| | | /** |
| | | * æ ¹æ®codeè·åæä¸¾ |
| | | */ |
| | | public static ProductOrderStatusEnum getByCode(Integer code) { |
| | | if (code == null) { |
| | | return null; |
| | | } |
| | | for (ProductOrderStatusEnum item : values()) { |
| | | if (item.getCode().equals(code)) { |
| | | return item; |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | /** |
| | | * 夿æ¯å¦å
许å é¤ï¼1ã4ï¼ |
| | | */ |
| | | public static boolean canDelete(Integer code) { |
| | | return WAIT.getCode().equals(code) || CANCEL.getCode().equals(code); |
| | | } |
| | | |
| | | /** |
| | | * 夿æ¯å¦å·²å¼å§ç产ï¼2ã3ï¼ |
| | | */ |
| | | public static boolean isStarted(Integer code) { |
| | | return RUNNING.getCode().equals(code) || FINISHED.getCode().equals(code); |
| | | } |
| | | } |
| | |
| | | public interface ProcessRouteMapper extends BaseMapper<ProcessRoute> { |
| | | |
| | | IPage<ProcessRouteDto> pageProcessRouteDto(Page<ProcessRouteDto> page,@Param("c") ProcessRouteDto processRouteDto); |
| | | |
| | | ProcessRoute latestTypeDate(String productName, String strength); |
| | | } |
| | |
| | | |
| | | @ApiModelProperty(value = "ç¶æï¼0-è稿ï¼1-å·²æ¹å") |
| | | private Boolean status; |
| | | |
| | | @ApiModelProperty(value = "产åç±»ååå
¸ç¼ç ") |
| | | private Long dictCode; |
| | | } |
| | |
| | | |
| | | @Data |
| | | @TableName("product_order") |
| | | public class ProductOrder implements Serializable { |
| | | public class ProductOrder implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private LocalDateTime endTime; |
| | | |
| | | @ApiModelProperty(value = "ç¶æï¼1.å¾
å¼å§ã2.è¿è¡ä¸ã3.已宿ã4.已忶ï¼") |
| | | private Integer status; |
| | | } |
| | |
| | | private Long workOrderId; |
| | | |
| | | @ApiModelProperty(value = "ç产订åid") |
| | | @TableField(exist = false) |
| | | private Long productOrderId; |
| | | |
| | | @ApiModelProperty(value = "æ¥å·¥ç¶æ") |
| | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.production.dto.ProcessRouteDto; |
| | | import com.ruoyi.production.dto.ProductStructureDto; |
| | | import com.ruoyi.production.pojo.ProcessRoute; |
| | | import io.swagger.models.auth.In; |
| | | |
| | | import java.util.List; |
| | | |
| | |
| | | Integer saveProcessRoute(ProcessRoute processRoute); |
| | | |
| | | int batchDelete(List<Long> ids); |
| | | |
| | | List<ProductStructureDto> getRouteBom(Long id); |
| | | |
| | | ProcessRoute latestTypeDate(String productName, String strength); |
| | | } |
| | |
| | | import com.ruoyi.production.pojo.ProcessRouteItem; |
| | | import com.ruoyi.production.pojo.ProcessRouteItemParam; |
| | | import com.ruoyi.production.service.ProcessRouteItemService; |
| | | import com.ruoyi.production.service.ProductMaterialSkuService; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | |
| | | @Autowired |
| | | private ProcessRouteItemParamMapper processRouteItemParamMapper; |
| | | |
| | | @Autowired |
| | | private ProductMaterialSkuService productMaterialSkuService; |
| | | |
| | | @Override |
| | | public List<ProcessRouteItemDto> listProcessRouteItemDto(ProcessRouteItemDto processRouteItemDto) { |
| | |
| | | if (processRouteItem == null) { |
| | | throw new ServiceException("æ°æ®ä¸è½ä¸ºç©º"); |
| | | } |
| | | if (processRouteItem.getProductModelId() != null) { |
| | | Object product = productMaterialSkuService.getById(processRouteItem.getProductModelId()); |
| | | if (product == null) { |
| | | throw new ServiceException("æä½å¤±è´¥ï¼å
³èç产å(ID:" + processRouteItem.getProductModelId() + ")ä¸åå¨"); |
| | | } |
| | | } else { |
| | | throw new ServiceException("产åIDä¸è½ä¸ºç©º"); |
| | | } |
| | | |
| | | Long tenantId = SecurityUtils.getLoginUser().getTenantId(); |
| | | processRouteItem.setTenantId(tenantId); |
| | | |
| | |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.common.exception.ServiceException; |
| | | import com.ruoyi.production.dto.ProcessRouteDto; |
| | | import com.ruoyi.production.dto.ProductStructureDto; |
| | | import com.ruoyi.production.mapper.ProcessRouteItemMapper; |
| | | import com.ruoyi.production.mapper.ProcessRouteMapper; |
| | | import com.ruoyi.production.mapper.ProductOrderMapper; |
| | | import com.ruoyi.production.mapper.ProductProcessRouteMapper; |
| | | import com.ruoyi.production.pojo.ProcessRoute; |
| | | import com.ruoyi.production.pojo.ProcessRouteItem; |
| | | import com.ruoyi.production.pojo.ProductOrder; |
| | | import com.ruoyi.production.pojo.ProductProcessRoute; |
| | | import com.ruoyi.production.service.ProcessRouteService; |
| | | import com.ruoyi.production.service.ProductStructureService; |
| | | import com.ruoyi.project.system.domain.SysDictData; |
| | | import com.ruoyi.project.system.mapper.SysDictDataMapper; |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | |
| | | import java.time.LocalDate; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.Arrays; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | @Service |
| | |
| | | @Autowired |
| | | private ProductOrderMapper productOrderMapper; |
| | | |
| | | @Autowired |
| | | private ProductStructureService productStructureService; |
| | | |
| | | @Autowired |
| | | private SysDictDataMapper sysDictDataMapper; |
| | | |
| | | |
| | | @Override |
| | | public IPage<ProcessRouteDto> pageProcessRouteDto(Page<ProcessRouteDto> page, ProcessRouteDto processRouteDto) { |
| | | |
| | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public Integer saveProcessRoute(ProcessRoute processRoute) { |
| | | if (processRoute == null || processRoute.getDictCode() == null) { |
| | | throw new ServiceException("æ°å¢å·¥èºè·¯çº¿å¤±è´¥,产åç±»åä¸è½ä¸ºç©º"); |
| | | } |
| | | SysDictData sysDictData = sysDictDataMapper.selectDictDataById(processRoute.getDictCode()); |
| | | if (sysDictData == null) { |
| | | throw new ServiceException("æ°å¢å·¥èºè·¯çº¿å¤±è´¥,产åç±»åä¸åå¨"); |
| | | } |
| | | |
| | | save(processRoute); |
| | | if (processRoute.getProcessRouteCode() == null || processRoute.getProcessRouteCode().trim().isEmpty()) { |
| | | String dateStr = LocalDate.now().format(DateTimeFormatter.ofPattern("yyyyMMdd")); |
| | |
| | | processRouteItemMapper.delete(Wrappers.<ProcessRouteItem>lambdaQuery().in(ProcessRouteItem::getRouteId, ids)); |
| | | return processRouteMapper.deleteBatchIds(ids); |
| | | } |
| | | |
| | | @Override |
| | | public List<ProductStructureDto> getRouteBom(Long id) { |
| | | if (id == null) { |
| | | return new ArrayList<>(0); |
| | | } |
| | | |
| | | ProcessRoute processRoute = getById(id); |
| | | if (processRoute == null) { |
| | | throw new ServiceException("å·¥èºè·¯çº¿ä¸åå¨"); |
| | | } |
| | | |
| | | List<ProductStructureDto> list = productStructureService.listByBomId(processRoute.getBomId()); |
| | | if (list == null) { |
| | | list = new ArrayList<>(0); |
| | | } |
| | | return list; |
| | | } |
| | | |
| | | @Override |
| | | public ProcessRoute latestTypeDate(String productName, String strength) { |
| | | return baseMapper.latestTypeDate(productName, strength); |
| | | } |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.production.pojo.ProductMaterial; |
| | | import com.ruoyi.production.pojo.ProductMaterialSku; |
| | | import com.ruoyi.common.exception.ServiceException; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | |
| | | @Autowired |
| | | private ProductBomMapper productBomMapper; |
| | | |
| | | |
| | | @Autowired |
| | | private ProductStructureService productStructureService; |
| | | |
| | | @Autowired |
| | | private ProductProcessService productProcessService; |
| | | |
| | | @Autowired |
| | | private ProductMaterialService productMaterialService; |
| | | |
| | | @Autowired |
| | | private ProductMaterialSkuService productMaterialSkuService; |
| | | |
| | | @Autowired |
| | | private SysDictDataMapper sysDictDataMapper; |
| | |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public AjaxResult add(ProductBom productBom) { |
| | | if (productBom == null || productBom.getDictCode() == null) { |
| | | throw new ServiceException("æ°å¢å¤±è´¥,产åç±»åä¸è½ä¸ºç©º"); |
| | | throw new ServiceException("æ°å¢BOM失败,产åç±»åä¸è½ä¸ºç©º"); |
| | | } |
| | | |
| | | SysDictData sysDictData = sysDictDataMapper.selectDictDataById(productBom.getDictCode()); |
| | | if (sysDictData == null) { |
| | | throw new ServiceException("æ°å¢å¤±è´¥,产åç±»åä¸åå¨"); |
| | | throw new ServiceException("æ°å¢BOM失败,产åç±»åä¸åå¨"); |
| | | } |
| | | |
| | | boolean save = productBomMapper.insert(productBom) > 0; |
| | |
| | | if (sysDictData == null) { |
| | | return AjaxResult.error("导å
¥å¤±è´¥,产åç±»åä¸åå¨"); |
| | | } |
| | | |
| | | ExcelUtil<BomImportDto> util = new ExcelUtil<>(BomImportDto.class); |
| | | List<BomImportDto> list; |
| | | try { |
| | |
| | | return AjaxResult.error("Excelè§£æå¤±è´¥"); |
| | | } |
| | | |
| | | if (list == null || list.isEmpty()) return AjaxResult.error("æ°æ®ä¸ºç©º"); |
| | | if (list == null || list.isEmpty()) { |
| | | return AjaxResult.error("æ°æ®ä¸ºç©º"); |
| | | } |
| | | |
| | | // å¤çåæ®µæ¸
ç |
| | | // å¤çå·¥åº |
| | | list.forEach(dto -> { |
| | | dto.setParentCode(clean(dto.getParentCode())); |
| | | dto.setCode(clean(dto.getCode())); |
| | | dto.setParentName(clean(dto.getParentName())); |
| | | dto.setParentSpec(clean(dto.getParentSpec())); |
| | | dto.setChildName(clean(dto.getChildName())); |
| | | dto.setChildSpec(clean(dto.getChildSpec())); |
| | | }); |
| | | handleProcess(list); |
| | | Map<String, Long> processMap = productProcessService.list().stream() |
| | | .collect(Collectors.toMap(ProductProcess::getName, ProductProcess::getId, (k1, k2) -> k1)); |
| | | |
| | | // å建 BOM æ°æ® |
| | | BomImportDto first = list.get(0); |
| | | ProductMaterialSku rootModel = findModel(first.getParentName(), first.getParentSpec()); |
| | | ProductBom bom = new ProductBom(); |
| | | bom.setVersion("1.0"); |
| | | bom.setDictCode(dictCode); |
| | | bom.setVersion("1.0"); |
| | | productBomMapper.insert(bom); |
| | | bom.setBomNo("BM." + String.format("%05d", bom.getId())); |
| | | productBomMapper.updateById(bom); |
| | | |
| | | // è®°å½å·²ç»æå
¥ç»æçèç¹ï¼Key = "ç¼ç ", Value = structure_id |
| | | // è®°å½å·²ç»æå
¥ç»æçèç¹ï¼Key = "åç§°+è§æ ¼", Value = structure_id |
| | | Map<String, Long> treePathMap = new HashMap<>(); |
| | | |
| | | for (int i = 0; i < list.size(); i++) { |
| | | BomImportDto dto = list.get(i); |
| | | String currentCode = dto.getCode(); |
| | | String parentCode = dto.getParentCode(); |
| | | String parentKey = dto.getParentName() + "|" + dto.getParentSpec(); |
| | | String childKey = dto.getChildName() + "|" + dto.getChildSpec(); |
| | | |
| | | // å¤çæ ¹èç¹ï¼ä¸è¬æç¬¬ä¸è¡ä¸æ²¡æç¶é¡¹ç¼å· |
| | | if (i == 0 && StringUtils.isBlank(parentCode)) { |
| | | //å¤çæ ¹èç¹,第ä¸è¡ä¸å项为空 |
| | | if (i == 0 && StringUtils.isBlank(dto.getChildName())) { |
| | | ProductStructure rootNode = new ProductStructure(); |
| | | rootNode.setBomId(bom.getId()); |
| | | rootNode.setParentId(null); // 顶屿²¡æç¶èç¹ |
| | | if (processMap.containsKey(dto.getProcess())) { |
| | | rootNode.setProcessId(processMap.get(dto.getProcess())); |
| | | } |
| | | rootNode.setProductModelId(rootModel.getId()); |
| | | rootNode.setUnitQuantity(BigDecimal.ONE); |
| | | ProductMaterial rootMaterial = productMaterialService.getById(rootModel.getProductId()); |
| | | rootNode.setUnit(rootMaterial != null ? rootMaterial.getUnit() : null); |
| | | productStructureService.save(rootNode); |
| | | |
| | | treePathMap.put(currentCode, rootNode.getId()); |
| | | treePathMap.put(parentKey, rootNode.getId()); |
| | | continue; |
| | | } |
| | | |
| | | // å¤çåå±çº§èç¹ |
| | | // æ¾å°ç¶èç¹å¨æ°æ®åºéç ID |
| | | Long parentStructureId = treePathMap.get(parentCode); |
| | | Long parentStructureId = treePathMap.get(parentKey); |
| | | if (parentStructureId == null) { |
| | | // 妿 Map éæ¾ä¸å°ï¼è¯´æ Excel 顺åºä¹±äºæè
æ°æ®æè¯¯ |
| | | throw new ServiceException("导å
¥å¤±è´¥: ç¶é¡¹[" + parentCode + "]å¿
é¡»å¨å
¶å项ä¹åå®ä¹"); |
| | | throw new ServiceException("导å
¥å¤±è´¥: ç¶é¡¹[" + dto.getParentName() + "]å¿
é¡»å¨å
¶å项ä¹åå®ä¹"); |
| | | } |
| | | |
| | | // è·åå项模åä¿¡æ¯ |
| | | ProductMaterialSku childModel = findModel(dto.getChildName(), dto.getChildSpec()); |
| | | |
| | | // æå
¥ç»æè¡¨ |
| | | ProductStructure node = new ProductStructure(); |
| | | node.setBomId(bom.getId()); |
| | | node.setParentId(parentStructureId); // ç¶èç¹ID |
| | | node.setProductModelId(childModel.getId()); |
| | | node.setUnitQuantity(dto.getUnitQty()); |
| | | ProductMaterial childMaterial = productMaterialService.getById(childModel.getProductId()); |
| | | node.setUnit(childMaterial != null ? childMaterial.getUnit() : null); |
| | | if (processMap.containsKey(dto.getProcess())) { |
| | | node.setProcessId(processMap.get(dto.getProcess())); |
| | | } |
| | | productStructureService.save(node); |
| | | |
| | | // æå½å项记å½å° Map, ä½ä¸ºä»¥åæ´æ·±å±çº§çç¶é¡¹æ¥æ¾ä¾æ® |
| | | treePathMap.put(currentCode, node.getId()); |
| | | // æå½åå项记å½å° Map,ä½ä¸ºä»¥åæ´æ·±å±çº§çç¶é¡¹æ¥æ¾ä¾æ® |
| | | // åä¸ç¶é¡¹ä¸çååå项ä¸éè¦éå¤è®°å½ |
| | | treePathMap.put(childKey, node.getId()); |
| | | } |
| | | |
| | | return AjaxResult.success("BOM导å
¥æå"); |
| | |
| | | for (ProductStructureDto root : treeData) { |
| | | // æ·»å æ ¹èç¹ |
| | | BomImportDto rootRow = new BomImportDto(); |
| | | rootRow.setCode(root.getId().toString()); |
| | | rootRow.setParentName(root.getProductName()); |
| | | rootRow.setParentSpec(root.getModel()); |
| | | rootRow.setUnitQty(root.getUnitQuantity()); |
| | | rootRow.setRemark(""); |
| | | exportList.add(rootRow); |
| | |
| | | } |
| | | |
| | | BomImportDto row = new BomImportDto(); |
| | | // ç¶ç±»ç¼å· |
| | | row.setParentCode(parent.getId().toString()); |
| | | // æ¬èº«ç¼å· |
| | | row.setCode(child.getId().toString()); |
| | | // ç¶ç±»ä¿¡æ¯ |
| | | row.setParentName(parent.getProductName()); |
| | | row.setParentSpec(parent.getModel()); |
| | | // åç±»ä¿¡æ¯ |
| | | row.setChildName(child.getProductName()); |
| | | row.setChildSpec(child.getModel()); |
| | | row.setUnitQty(child.getUnitQuantity()); |
| | | row.setProcess(child.getProcessName()); |
| | | // row.setProcess(); |
| | | row.setRemark(""); |
| | | |
| | | exportList.add(row); |
| | | |
| | |
| | | map.put(node.getId(), node); |
| | | populateMap(node.getChildren(), map); |
| | | } |
| | | } |
| | | |
| | | private ProductMaterialSku findModel(String name, String spec) { |
| | | ProductMaterial product = productMaterialService.getOne(new LambdaQueryWrapper<ProductMaterial>() |
| | | .eq(ProductMaterial::getProductName, name).last("limit 1")); |
| | | if (product == null) throw new ServiceException("äº§åæªç»´æ¤ï¼" + name); |
| | | |
| | | ProductMaterialSku model = productMaterialSkuService.getOne(new LambdaQueryWrapper<ProductMaterialSku>() |
| | | .eq(ProductMaterialSku::getProductId, product.getId()) |
| | | .eq(ProductMaterialSku::getModel, spec).last("limit 1")); |
| | | if (model == null) throw new ServiceException("è§æ ¼æªç»´æ¤ï¼" + name + "[" + spec + "]"); |
| | | return model; |
| | | } |
| | | |
| | | private void handleProcess(List<BomImportDto> list) { |
| | |
| | | return s.replaceAll("[\\u00A0\\u3000]", "").trim(); |
| | | } |
| | | } |
| | | |
| | | |
| | |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.common.enums.StockOutQualifiedRecordTypeEnum; |
| | | import com.ruoyi.common.enums.StockInUnQualifiedRecordTypeEnum; |
| | | import com.ruoyi.appendix.service.AppendixService; |
| | | import com.ruoyi.procurementrecord.utils.StockUtils; |
| | | import com.ruoyi.production.dto.ProductOrderDto; |
| | | import com.ruoyi.production.dto.ProductStructureDto; |
| | | import com.ruoyi.production.enums.ProductOrderStatusEnum; |
| | | import com.ruoyi.production.mapper.*; |
| | | import com.ruoyi.production.pojo.*; |
| | | import com.ruoyi.production.service.ProductOrderService; |
| | |
| | | import com.ruoyi.productionPlan.pojo.ProductOrderPlan; |
| | | import com.ruoyi.productionPlan.pojo.ProductionPlan; |
| | | import com.ruoyi.quality.mapper.QualityInspectMapper; |
| | | import com.ruoyi.quality.pojo.QualityInspect; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | |
| | | |
| | | @Autowired |
| | | private StockUtils stockUtils; |
| | | |
| | | @Autowired |
| | | private AppendixService appendixService; |
| | | |
| | | @Override |
| | | public IPage<ProductOrderDto> pageProductOrder(Page<ProductOrder> page, ProductOrderDto productOrder) { |
| | |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public Boolean delete(Long[] ids) { |
| | | //妿已ç»å¼å§ç产,ä¸è½å é¤ |
| | | //æ¥è¯¢ç产订åä¸çå·¥å |
| | | List<ProductOrder> orders = productOrderMapper.selectList(Wrappers.<ProductOrder>lambdaQuery().in(ProductOrder::getId, ids)); |
| | | |
| | | if (orders.isEmpty()) { |
| | | throw new RuntimeException("ç产订åä¸åå¨"); |
| | | } |
| | | for (ProductOrder order : orders) { |
| | | if (!ProductOrderStatusEnum.canDelete(order.getStatus())) { |
| | | throw new RuntimeException("åªæãå¾
å¼å§ã已忶ãç¶æç订åæå¯ä»¥å é¤"); |
| | | } |
| | | } |
| | | |
| | | // æ¯å¦å·²ç产 |
| | | List<ProductWorkOrder> productWorkOrders = productWorkOrderMapper.selectList(Wrappers.<ProductWorkOrder>lambdaQuery().in(ProductWorkOrder::getProductOrderId, ids)); |
| | | if (productWorkOrders.size()>0){ |
| | | //夿æ¯å¦ææ¥å·¥æ°æ® |
| | | List<ProductionProductMain> productionProductMains = productionProductMainMapper.selectList(Wrappers.<ProductionProductMain>lambdaQuery() |
| | | .in(ProductionProductMain::getWorkOrderId, productWorkOrders.stream().map(ProductWorkOrder::getId).collect(Collectors.toList()))); |
| | | if (productionProductMains.size()>0){ |
| | | |
| | | if (!productWorkOrders.isEmpty()) { |
| | | List<Long> workOrderIds = productWorkOrders.stream() |
| | | .map(ProductWorkOrder::getId) |
| | | .collect(Collectors.toList()); |
| | | |
| | | List<ProductionProductMain> productionProductMains = productionProductMainMapper.selectList(Wrappers.<ProductionProductMain>lambdaQuery().in(ProductionProductMain::getWorkOrderId, workOrderIds)); |
| | | if (!productionProductMains.isEmpty()) { |
| | | throw new RuntimeException("ç产订åå·²ç»å¼å§ç产,ä¸è½å é¤"); |
| | | } |
| | | //å é¤å·¥å |
| | | |
| | | // å é¤å·¥å |
| | | productWorkOrderMapper.delete(Wrappers.<ProductWorkOrder>lambdaQuery().in(ProductWorkOrder::getProductOrderId, ids)); |
| | | } |
| | | //å é¤å·¥èºè·¯çº¿ |
| | | productProcessRouteItemMapper.delete(new LambdaQueryWrapper<ProductProcessRouteItem>() |
| | | .in(ProductProcessRouteItem::getProductOrderId, ids)); |
| | | productProcessRouteMapper.delete(new LambdaQueryWrapper<ProductProcessRoute>() |
| | | .in(ProductProcessRoute::getProductOrderId, ids)); |
| | | //å é¤ç产订å |
| | | productOrderMapper.delete(new LambdaQueryWrapper<ProductOrder>() |
| | | .in(ProductOrder::getId, ids)); |
| | | |
| | | // åéç产计å |
| | | List<ProductOrderPlan> productOrderPlans = productOrderPlanMapper.selectList(Wrappers.<ProductOrderPlan>lambdaQuery().in(ProductOrderPlan::getProductOrderId, ids)); |
| | | |
| | | for (ProductOrderPlan productOrderPlan : productOrderPlans) { |
| | | ProductionPlan productionPlan = productionPlanMapper.selectById(productOrderPlan.getProductionPlanId()); |
| | | |
| | | if (productionPlan != null) { |
| | | // åéæ°é |
| | | BigDecimal newAssigned = productionPlan.getAssignedQuantity() |
| | | .subtract(productOrderPlan.getAssignedQuantity()); |
| | | |
| | | if (newAssigned.compareTo(BigDecimal.ZERO) < 0) { |
| | | newAssigned = BigDecimal.ZERO; |
| | | } |
| | | productionPlan.setAssignedQuantity(newAssigned); |
| | | BigDecimal volume = productionPlan.getVolume() == null ? BigDecimal.ZERO : productionPlan.getVolume(); |
| | | |
| | | int status; |
| | | if (newAssigned.compareTo(BigDecimal.ZERO) == 0) { |
| | | status = 0; // æªä¸å |
| | | } else if (newAssigned.compareTo(volume) < 0) { |
| | | status = 1; // é¨åä¸å |
| | | } else { |
| | | status = 2; // å·²ä¸å |
| | | } |
| | | productionPlan.setStatus(status); |
| | | |
| | | productionPlanMapper.updateById(productionPlan); |
| | | } |
| | | } |
| | | |
| | | // å é¤ä¸é´è¡¨ |
| | | productOrderPlanMapper.delete(Wrappers.<ProductOrderPlan>lambdaQuery().in(ProductOrderPlan::getProductOrderId, ids)); |
| | | |
| | | // å é¤é表çå·¥èºè·¯çº¿ä¸BOM |
| | | for (Long id : ids) { |
| | | ProductOrder productOrder = baseMapper.selectById(id); |
| | | appendixService.deleteData(productOrder.getRouteId()); |
| | | } |
| | | |
| | | // productProcessRouteItemMapper.delete(new LambdaQueryWrapper<ProductProcessRouteItem>().in(ProductProcessRouteItem::getProductOrderId, ids)); |
| | | // productProcessRouteMapper.delete(new LambdaQueryWrapper<ProductProcessRoute>().in(ProductProcessRoute::getProductOrderId, ids)); |
| | | |
| | | // å é¤è®¢å |
| | | productOrderMapper.delete(new LambdaQueryWrapper<ProductOrder>().in(ProductOrder::getId, ids)); |
| | | |
| | | return true; |
| | | } |
| | | |
| | |
| | | // çå®çç¶èç¹ ID |
| | | Long realParentId; |
| | | for (ProductStructureDto psDto : flatDtoList) { |
| | | if (psDto.getId() == null && psDto.getParentTempId() != null) { |
| | | String parentTempId = psDto.getParentTempId(); |
| | | if (psDto.getId() == null && parentTempId != null && !parentTempId.isEmpty()) { |
| | | ProductStructure child = tempEntityMap.get(psDto.getTempId()); |
| | | if (tempEntityMap.containsKey(psDto.getParentTempId())) { |
| | | if (tempEntityMap.containsKey(parentTempId)) { |
| | | // ç¶èç¹æ¯æ°èç¹ |
| | | realParentId = tempEntityMap.get(psDto.getParentTempId()).getId(); |
| | | realParentId = tempEntityMap.get(parentTempId).getId(); |
| | | } else { |
| | | // ç¶èç¹æ¯èèç¹ |
| | | realParentId = Long.valueOf(psDto.getParentTempId()); |
| | | try { |
| | | realParentId = Long.valueOf(parentTempId); |
| | | } catch (NumberFormatException e) { |
| | | realParentId = 0L; |
| | | } |
| | | } |
| | | |
| | | child.setParentId(realParentId); |
| | | parentFixList.add(child); |
| | | } else if (psDto.getId() == null) { |
| | | // 妿 parentTempId 为空ï¼åæ¯é¡¶çº§èç¹ |
| | | ProductStructure child = tempEntityMap.get(psDto.getTempId()); |
| | | child.setParentId(0L); |
| | | parentFixList.add(child); |
| | | } |
| | | } |
| | |
| | | if (!parentFixList.isEmpty()) { |
| | | this.updateBatchById(parentFixList); |
| | | } |
| | | |
| | | if (!updateList.isEmpty()) { |
| | | this.updateBatchById(updateList); |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.appendix.service.AppendixService; |
| | | import com.ruoyi.common.exception.ServiceException; |
| | | import com.ruoyi.common.exception.base.BaseException; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.framework.config.AliDingConfig; |
| | | import com.ruoyi.framework.util.AliDingUtils; |
| | | import com.ruoyi.production.enums.ProductOrderStatusEnum; |
| | | import com.ruoyi.production.pojo.ProductMaterialSku; |
| | | import com.ruoyi.production.pojo.ProductOrder; |
| | | import com.ruoyi.production.service.ProductMaterialService; |
| | |
| | | |
| | | @Autowired |
| | | private ProductMaterialService productMaterialService; |
| | | |
| | | @Autowired |
| | | private AppendixService appendixService; |
| | | |
| | | /** |
| | | * 忥éï¼ç¡®ä¿æå¨å宿¶ä»»å¡ä¸åæ¶æ§è¡ |
| | |
| | | ProductOrder productOrder = new ProductOrder(); |
| | | productOrder.setQuantity(productionPlanDto.getTotalAssignedQuantity()); |
| | | productOrder.setPlanCompleteTime(productionPlanDto.getPlanCompleteTime()); |
| | | productOrder.setStatus(ProductOrderStatusEnum.WAIT.getCode()); |
| | | |
| | | // å½ä¸åç产å为ç åææ¿æï¼å°±æåBOMåéä¸å·¥èºè·¯çº¿åéæ°æ®åå
¥å°éè¡¨ä¸ |
| | | if ("ç å".equals(productionPlanDto.getProductName())) { |
| | | productOrder.setRouteId(appendixService.populateBlocks(productionPlanDto)); |
| | | } |
| | | if ("æ¿æ".equals(productionPlanDto.getProductName())) { |
| | | productOrder.setRouteId(appendixService.populatePlates(productionPlanDto)); |
| | | } |
| | | productOrderService.addProductOrder(productOrder); |
| | | |
| | | // æ ¹æ®ä¸åæ°éï¼ä»ç¬¬ä¸ä¸ªç产计åå¼å§åé
æ¹æ° |
| | |
| | | // æåä¸ä¸ªè®¡åï¼åé
å©ä½æ¹æ° |
| | | BigDecimal lastRemainingVolume = productionPlanDto.getTotalAssignedQuantity().subtract(assignedVolume); |
| | | plan.setStatus(1); |
| | | if (lastRemainingVolume.compareTo(BigDecimal.ZERO) <= 0) { |
| | | plan.setAssignedQuantity(plan.getAssignedQuantity().add(lastRemainingVolume)); |
| | | if (plan.getAssignedQuantity().compareTo(plan.getVolume()) >= 0) { |
| | | plan.setStatus(2); |
| | | } |
| | | plan.setAssignedQuantity(plan.getAssignedQuantity().add(lastRemainingVolume)); |
| | | productOrderPlan.setAssignedQuantity(lastRemainingVolume); |
| | | productionPlanMapper.updateById(plan); |
| | | productOrderPlanMapper.insert(productOrderPlan); |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <?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.ruoyi.appendix.mapper.ProcessRouteItemInstanceMapper"> |
| | | |
| | | <resultMap id="ProcessRouteItemInstanceMap" type="com.ruoyi.appendix.pojo.ProcessRouteItemInstance"> |
| | | <id property="id" column="id"/> |
| | | <result property="routeId" column="route_id"/> |
| | | <result property="productModelId" column="product_model_id"/> |
| | | <result property="processId" column="process_id"/> |
| | | <result property="tenantId" column="tenant_id"/> |
| | | <result property="createTime" column="create_time"/> |
| | | <result property="updateTime" column="update_time"/> |
| | | <result property="dragSort" column="drag_sort"/> |
| | | <result property="isQuality" column="is_quality"/> |
| | | </resultMap> |
| | | |
| | | </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.ruoyi.appendix.mapper.ProcessRouteItemParamInstanceMapper"> |
| | | |
| | | <resultMap id="BaseResultMap" type="com.ruoyi.appendix.pojo.ProcessRouteItemParamInstance"> |
| | | <id property="id" column="id"/> |
| | | <result property="routeItemId" column="route_item_id"/> |
| | | <result property="paramId" column="param_id"/> |
| | | <result property="processParamId" column="process_param_id"/> |
| | | <result property="standardValue" column="standard_value"/> |
| | | <result property="minValue" column="min_value"/> |
| | | <result property="maxValue" column="max_value"/> |
| | | <result property="isRequired" column="is_required"/> |
| | | <result property="sort" column="sort"/> |
| | | <result property="tenantId" column="tenant_id"/> |
| | | <result property="createTime" column="create_time"/> |
| | | <result property="updateTime" column="update_time"/> |
| | | </resultMap> |
| | | |
| | | </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.ruoyi.appendix.mapper.ProductProcessParamInstanceMapper"> |
| | | |
| | | <resultMap id="BaseResultMap" type="com.ruoyi.appendix.pojo.ProductProcessParamInstance"> |
| | | <id property="id" column="id"/> |
| | | <result property="processId" column="process_id"/> |
| | | <result property="paramId" column="param_id"/> |
| | | <result property="standardValue" column="standard_value"/> |
| | | <result property="minValue" column="min_value"/> |
| | | <result property="maxValue" column="max_value"/> |
| | | <result property="isRequired" column="is_required"/> |
| | | <result property="sort" column="sort"/> |
| | | <result property="tenantId" column="tenant_id"/> |
| | | <result property="createTime" column="create_time"/> |
| | | <result property="updateTime" column="update_time"/> |
| | | </resultMap> |
| | | |
| | | </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.ruoyi.appendix.mapper.ProductStructureInstanceMapper"> |
| | | |
| | | <resultMap id="BaseResultMap" type="com.ruoyi.appendix.pojo.ProductStructureInstance"> |
| | | <id property="id" column="id"/> |
| | | <result property="parentId" column="parent_id"/> |
| | | <result property="productModelId" column="product_model_id"/> |
| | | <result property="processId" column="process_id"/> |
| | | <result property="unitQuantity" column="unit_quantity"/> |
| | | <result property="demandedQuantity" column="demanded_quantity"/> |
| | | <result property="unit" column="unit"/> |
| | | <result property="tenantId" column="tenant_id"/> |
| | | <result property="bomId" column="bom_id"/> |
| | | </resultMap> |
| | | |
| | | </mapper> |
| | |
| | | </where> |
| | | </select> |
| | | <select id="calculateEnergy" resultType="java.util.Map"> |
| | | select SUM(ecd.dosage) totalEnergyConsumption, |
| | | select COALESCE(t.totalEnergyConsumption, 0) AS totalEnergyConsumption, |
| | | COALESCE(t.totalEnergyCost, 0) AS totalEnergyCost |
| | | from (select SUM(ecd.dosage) totalEnergyConsumption, |
| | | SUM(ecd.dosage * e.unit_price) totalEnergyCost |
| | | from energy_consumption_detail ecd |
| | | left join energy e on ecd.energy_id = e.id |
| | |
| | | <if test="c.type != null and c.type != ''"> |
| | | and ecd.type =#{c.type} |
| | | </if> |
| | | )t |
| | | </select> |
| | | <select id="energyConsumptionTypeProportion" |
| | | resultType="com.ruoyi.energy.dto.EnergyConsumptionTypeDto"> |
| | |
| | | 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, |
| | | 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 ecd.meter_reading_date, |
| | | e.energy_tyep, |
| | | ecd.type, |
| | | e.unit, |
| | | e.unit_price |
| | | order by ecd.meter_reading_date |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | select pri.*, |
| | | pr.description, |
| | | pp.name as process_name, |
| | | pms.product_id, |
| | | pms.model, |
| | | pm.product_name, |
| | | pm.unit, |
| | | (SELECT COUNT(1) |
| | | FROM process_route_item_param prip |
| | | WHERE prip.route_item_id = pri.id) as paramCount |
| | | from process_route_item pri |
| | | left join process_route pr on pr.id = pri.route_id |
| | | left join product_process pp on pp.id = pri.process_id |
| | | left join product_material_sku pms on pms.id = pri.product_model_id |
| | | left join product_material pm on pm.id = pms.product_id |
| | | where pri.route_id = #{c.routeId} |
| | | order by pri.drag_sort |
| | | </select> |
| | |
| | | <select id="pageProcessRouteDto" resultType="com.ruoyi.production.dto.ProcessRouteDto"> |
| | | select |
| | | ps.*, |
| | | pm.product_name, pms.product_id, pms.model, pb.bom_no |
| | | pb.bom_no, |
| | | sdd.dict_label AS dictLabel |
| | | from process_route ps |
| | | left join product_bom pb on ps.bom_id = pb.id |
| | | left join product_material_sku pms on ps.product_model_id = pms.id |
| | | left join product_material pm on pms.product_id = pm.id |
| | | <where> |
| | | <if test="c.model != null and c.model != ''"> |
| | | and pms.model like concat('%', #{c.model}, '%') |
| | | </if> |
| | | </where> |
| | | left join sys_dict_data sdd on sdd.dict_code = ps.dict_code |
| | | where 1= 1 |
| | | <if test="c.dictCode != null"> |
| | | and ps.dict_code = #{c.dictCode} |
| | | </if> |
| | | order by ps.id |
| | | </select> |
| | | |
| | | <select id="latestTypeDate" resultType="com.ruoyi.production.pojo.ProcessRoute"> |
| | | SELECT * |
| | | FROM process_route pr |
| | | WHERE pr.dict_code = (SELECT d.dict_code |
| | | FROM sys_dict_data d |
| | | WHERE d.dict_label = |
| | | <choose> |
| | | <when test="strength != null and strength != ''"> |
| | | CONCAT(#{productName}, '-', #{strength}) |
| | | </when> |
| | | <otherwise> |
| | | #{productName} |
| | | </otherwise> |
| | | </choose> |
| | | AND d.dict_type = 'product_type' |
| | | LIMIT 1) |
| | | ORDER BY pr.create_time DESC |
| | | LIMIT 1 |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | <result property="createTime" column="create_time"/> |
| | | <result property="updateTime" column="update_time"/> |
| | | <result property="planCompleteTime" column="plan_complete_time"/> |
| | | <result property="status" column="status"/> |
| | | </resultMap> |
| | | |
| | | <select id="pageProductOrder" resultType="com.ruoyi.production.dto.ProductOrderDto"> |
| | |
| | | ps.bom_id, |
| | | ps.unit_quantity, |
| | | ps.process_id, |
| | | pp.name AS process_name |
| | | pp.name AS process_name, |
| | | pm.product_name AS productName, |
| | | pm.unit, |
| | | pms.model |
| | | |
| | | FROM product_structure ps |
| | | LEFT JOIN product_process pp ON ps.process_id = pp.id |
| | | LEFT JOIN product_material_sku pms ON pms.id = ps.product_model_id |
| | | LEFT JOIN product_material pm ON pm.id = pms.product_id |
| | | WHERE ps.bom_id = #{bomId} |
| | | ORDER BY ps.id |
| | | </select> |
| | |
| | | <if test="c.model != null and c.model != '' "> |
| | | AND pms.model LIKE CONCAT('%',#{c.model},'%') |
| | | </if> |
| | | <if test="c.status != null"> |
| | | AND pp.status =#{c.status} |
| | | </if> |
| | | <if test="c.applyNo != null and c.applyNo != '' "> |
| | | AND pp.apply_no LIKE CONCAT('%',#{c.applyNo},'%') |
| | | </if> |
| | |
| | | </foreach> |
| | | ORDER BY pp.id ASC |
| | | </select> |
| | | </mapper> |
| | | </mapper> |