feat(生产核算): 新增成品/白盒部门产量工时折算核算
- 白盒部门:折算时长 = 月产量 × 标准数量 × 8(按 工序+型号/零件)
- 成品部门:月产折合小提琴 = 小提琴 + 大提琴×折算率 + 贝斯×折算率;折算时长 = 折合小提琴 ÷ 标准数量 × 8(按 工序)
- 月时间合计 = 折算时长求和;折合倍数 = 月时间合计 ÷(当月工作日 × 8)
- 新增配置:部门类型、标准数量、折算率(工序+员工)、月度工作日
- 提供汇总/明细查询、配置 CRUD、导出接口
- 新增建表与初始化脚本 sql/production_costing_config.sql
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | -- ============================================================ |
| | | -- çäº§æ ¸ç®ï¼æåé¨é¨ / ç½çé¨é¨ï¼é
ç½®ä¸ç»æè¡¥å
èæ¬ |
| | | -- æ°æ®åºï¼product-inventory-management-new-pro |
| | | -- 说æï¼æ¬å°åºç»æè½åäºä»£ç ï¼production_product_main ç¼ºå° |
| | | -- æ¥å·¥ç»æ/å®¡æ ¸ç¸å
³åï¼è¿éè¡¥é½ï¼å¹¶æ°å¢æ ¸ç®é
ç½®è¡¨ä¸æ¼ç¤ºæ°æ®ã |
| | | -- ============================================================ |
| | | SET NAMES utf8mb4; |
| | | |
| | | -- ------------------------------------------------------------ |
| | | -- 1. è¡¥å
production_product_main 缺失åï¼æ¥å·¥ç»æ / å®¡æ ¸ / 补修çå·¥æ¶ï¼ |
| | | -- ------------------------------------------------------------ |
| | | ALTER TABLE `production_product_main` |
| | | ADD COLUMN `report_type` int NULL COMMENT 'æ¥å·¥ç»æç±»åï¼0åæ ¼ï¼1轻微è¿å·¥ï¼2严éè¿å·¥ï¼3æ¥åº' AFTER `status`, |
| | | ADD COLUMN `audit_status` int NULL DEFAULT 1 COMMENT 'å®¡æ ¸ç¶æï¼0å¾
å®¡æ ¸ï¼1å®¡æ ¸éè¿ï¼2å®¡æ ¸ä¸éè¿' AFTER `report_type`, |
| | | ADD COLUMN `audit_remark` varchar(255) NULL COMMENT 'å®¡æ ¸æè§' AFTER `audit_status`, |
| | | ADD COLUMN `repair_work_hour` decimal(10,2) NULL DEFAULT 0 COMMENT '补修çå·¥æ¶' AFTER `work_hour`; |
| | | |
| | | -- å·²å卿¥å·¥æ°æ®é»è®¤è§ä¸ºï¼å®¡æ ¸éè¿ãåæ ¼ |
| | | UPDATE `production_product_main` SET `report_type` = 0 WHERE `report_type` IS NULL; |
| | | UPDATE `production_product_main` SET `audit_status` = 1 WHERE `audit_status` IS NULL; |
| | | |
| | | -- ------------------------------------------------------------ |
| | | -- 2. æ°å¢æ ¸ç®é
置表 |
| | | -- ------------------------------------------------------------ |
| | | DROP TABLE IF EXISTS `production_costing_dept`; |
| | | CREATE TABLE `production_costing_dept` ( |
| | | `id` bigint NOT NULL AUTO_INCREMENT COMMENT '主é®', |
| | | `dept_id` bigint NULL COMMENT 'é¨é¨ID(sys_dept.dept_id)', |
| | | `dept_type` int NULL COMMENT 'é¨é¨ç±»åï¼1æåé¨é¨ï¼2ç½çé¨é¨', |
| | | `remark` varchar(255) NULL COMMENT '夿³¨', |
| | | `create_user` bigint NULL COMMENT 'å建人', |
| | | `create_time` datetime NULL COMMENT 'å建æ¶é´', |
| | | `update_user` bigint NULL COMMENT 'ä¿®æ¹äºº', |
| | | `update_time` datetime NULL COMMENT 'ä¿®æ¹æ¶é´', |
| | | PRIMARY KEY (`id`) |
| | | ) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COMMENT = 'çäº§æ ¸ç®-é¨é¨ç±»åé
ç½®'; |
| | | |
| | | DROP TABLE IF EXISTS `production_costing_standard`; |
| | | CREATE TABLE `production_costing_standard` ( |
| | | `id` bigint NOT NULL AUTO_INCREMENT COMMENT '主é®', |
| | | `dept_type` int NULL COMMENT 'é¨é¨ç±»åï¼1æåï¼2ç½ç', |
| | | `process_id` bigint NULL COMMENT 'å·¥åºID(technology_operation.id)', |
| | | `product_model_id` bigint NULL COMMENT 'åå·ID(product_model.id)ï¼ç½çå¿
å¡«', |
| | | `standard_quantity` decimal(18,4) NULL COMMENT 'æ åæ°é', |
| | | `unit` varchar(50) NULL COMMENT 'åä½', |
| | | `remark` varchar(255) NULL COMMENT '夿³¨', |
| | | `create_user` bigint NULL COMMENT 'å建人', |
| | | `create_time` datetime NULL COMMENT 'å建æ¶é´', |
| | | `update_user` bigint NULL COMMENT 'ä¿®æ¹äºº', |
| | | `update_time` datetime NULL COMMENT 'ä¿®æ¹æ¶é´', |
| | | PRIMARY KEY (`id`) |
| | | ) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COMMENT = 'çäº§æ ¸ç®-æ åæ°éé
ç½®'; |
| | | |
| | | DROP TABLE IF EXISTS `production_costing_factor`; |
| | | CREATE TABLE `production_costing_factor` ( |
| | | `id` bigint NOT NULL AUTO_INCREMENT COMMENT '主é®', |
| | | `process_id` bigint NULL COMMENT 'å·¥åºID(technology_operation.id)', |
| | | `staff_id` bigint NULL COMMENT 'åå·¥ID(sys_user.user_id)', |
| | | `staff_name` varchar(255) NULL COMMENT 'åå·¥å§å', |
| | | `violin_factor` decimal(18,4) NULL DEFAULT 1 COMMENT 'å°æç´æç®ç(åºå)', |
| | | `viola_factor` decimal(18,4) NULL COMMENT '大æç´æç®ç', |
| | | `bass_factor` decimal(18,4) NULL COMMENT 'è´æ¯æç®ç', |
| | | `remark` varchar(255) NULL COMMENT '夿³¨', |
| | | `create_user` bigint NULL COMMENT 'å建人', |
| | | `create_time` datetime NULL COMMENT 'å建æ¶é´', |
| | | `update_user` bigint NULL COMMENT 'ä¿®æ¹äºº', |
| | | `update_time` datetime NULL COMMENT 'ä¿®æ¹æ¶é´', |
| | | PRIMARY KEY (`id`) |
| | | ) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COMMENT = 'çäº§æ ¸ç®-æç®çé
ç½®(å·¥åº+åå·¥)'; |
| | | |
| | | -- ------------------------------------------------------------ |
| | | -- 3. æ¼ç¤ºæ°æ®ï¼ä¾¿äºæ¬å°æ¥çææï¼ |
| | | -- ------------------------------------------------------------ |
| | | -- 3.1 æ°å¢é¨é¨ï¼æåé¨é¨ / ç½çé¨é¨ |
| | | INSERT INTO `sys_dept` (`dept_id`, `parent_id`, `ancestors`, `dept_name`, `order_num`, `status`, `del_flag`, `create_by`, `create_time`) |
| | | VALUES (220, 100, '0,100', 'æåé¨é¨', 1, '0', '0', 'admin', NOW()), |
| | | (221, 100, '0,100', 'ç½çé¨é¨', 2, '0', '0', 'admin', NOW()); |
| | | |
| | | -- 3.2 ææ¼ç¤ºå·¥åºå½å
¥å¯¹åºé¨é¨ï¼æåï¼å·å·¥èº27/ç¡«å28ï¼ç½çï¼æ¶çº¿25/åå²2ï¼ |
| | | UPDATE `technology_operation` SET `dept_id` = 220 WHERE `id` IN (27, 28); |
| | | UPDATE `technology_operation` SET `dept_id` = 221 WHERE `id` IN (2, 25); |
| | | |
| | | -- 3.3 é¨é¨ç±»åé
ç½® |
| | | INSERT INTO `production_costing_dept` (`dept_id`, `dept_type`, `remark`, `create_time`) |
| | | VALUES (220, 1, 'æåé¨é¨', NOW()), |
| | | (221, 2, 'ç½çé¨é¨', NOW()); |
| | | |
| | | -- 3.4 æ åæ°éé
ç½® |
| | | -- æåï¼æå·¥åº |
| | | -- ç½çï¼æå·¥åº + åå· |
| | | INSERT INTO `production_costing_standard` (`dept_type`, `process_id`, `product_model_id`, `standard_quantity`, `unit`, `remark`, `create_time`) |
| | | VALUES (1, 27, NULL, 10, 'm', 'å·å·¥èºæ åæ°é', NOW()), |
| | | (1, 28, NULL, 20, 'm', 'ç¡«åæ åæ°é', NOW()), |
| | | (2, 25, 251, 5, 'kg/km', 'æ¶çº¿-éåé线', NOW()), |
| | | (2, 25, 256, 2, 'm', 'æ¶çº¿-éåéç»çº¿', NOW()), |
| | | (2, 2, 246, 4, 'kg/km', 'åå²-éåé线', NOW()); |
| | | |
| | | -- 3.5 æç®çé
ç½®ï¼å·¥åº + åå·¥ï¼ |
| | | INSERT INTO `production_costing_factor` (`process_id`, `staff_id`, `staff_name`, `violin_factor`, `viola_factor`, `bass_factor`, `remark`, `create_time`) |
| | | VALUES (27, 1, '管çåè´¦å·', 1, 3, 6, 'å·å·¥èº-æç®ç', NOW()), |
| | | (28, 1, '管çåè´¦å·', 1, 2, 4, 'ç¡«å-æç®ç', NOW()); |
| | | |
| | | -- 3.6 ä¹å¨æ¼ç¤ºæ°æ®ï¼å°æç´/大æç´/è´æ¯ï¼ï¼ç¨äºå±ç¤ºæåé¨é¨æç®ææ |
| | | INSERT INTO `product` (`id`, `parent_id`, `product_name`, `create_user`, `dept_id`) |
| | | VALUES (510, 276, 'å°æç´', 1, 220), |
| | | (511, 276, '大æç´', 1, 220), |
| | | (512, 276, 'è´æ¯', 1, 220); |
| | | |
| | | INSERT INTO `product_model` (`id`, `product_id`, `model`, `unit`, `create_user`, `dept_id`) |
| | | VALUES (5001, 510, 'VIOLIN-STD', 'æ', 1, 220), |
| | | (5002, 511, 'CELLO-STD', 'æ', 1, 220), |
| | | (5003, 512, 'BASS-STD', 'æ', 1, 220); |
| | | |
| | | -- æ¥å·¥é¾ï¼è®¢å -> å·¥èºè·¯çº¿å·¥åº -> å·¥å -> æ¥å·¥ -> äº§åº |
| | | INSERT INTO `production_order` (`id`, `product_model_id`, `technology_routing_id`, `nps_no`, `quantity`, `create_user`, `dept_id`) |
| | | VALUES (5000, 5001, 0, 'DEMO-ORDER-1', 100, 1, 220); |
| | | |
| | | INSERT INTO `production_order_routing_operation` (`id`, `production_order_id`, `technology_routing_operation_id`, `technology_operation_id`, `operation_name`, `product_model_id`, `type`, `create_user`, `dept_id`) |
| | | VALUES (5000, 5000, 0, 27, 'å·å·¥èº', 5001, 1, 1, 220); |
| | | |
| | | INSERT INTO `production_operation_task` (`id`, `production_order_routing_operation_id`, `technology_routing_operation_id`, `work_order_no`, `status`, `production_order_id`, `create_user`, `dept_id`) |
| | | VALUES (5000, 5000, 0, 'DEMO-WO-1', 4, 5000, 1, 220); |
| | | |
| | | INSERT INTO `production_product_main` (`id`, `product_no`, `user_id`, `user_name`, `production_operation_task_id`, `status`, `dept_id`, `create_time`, `create_user`, `report_type`, `audit_status`) |
| | | VALUES (5000, 'BG-DEMO-001', 1, '管çåè´¦å·', 5000, 4, 220, '2026-09-15 10:00:00', 1, 0, 1); |
| | | |
| | | INSERT INTO `production_product_output` (`production_product_main_id`, `product_model_id`, `quantity`, `scrap_qty`, `create_user`, `dept_id`) |
| | | VALUES (5000, 5001, 20, 0, 1, 220), |
| | | (5000, 5002, 10, 0, 1, 220), |
| | | (5000, 5003, 5, 0, 1, 220); |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.production.bean.dto; |
| | | |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * çäº§æ ¸ç®æ¥è¯¢åæ° |
| | | */ |
| | | @Data |
| | | @Schema(name = "ProductionCostingQueryDto", description = "çäº§æ ¸ç®æ¥è¯¢åæ°") |
| | | public class ProductionCostingQueryDto implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @Schema(description = "é¨é¨ç±»åï¼1æåé¨é¨ï¼2ç½çé¨é¨") |
| | | private Integer deptType; |
| | | |
| | | @Schema(description = "æä»½ yyyy-MM") |
| | | private String yearMonth; |
| | | |
| | | @Schema(description = "åå·¥å§åï¼æ¨¡ç³ï¼") |
| | | private String staffName; |
| | | |
| | | @Schema(description = "å·¥åºID") |
| | | private Long processId; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.production.bean.vo; |
| | | |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Excel; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | | import java.math.BigDecimal; |
| | | |
| | | /** |
| | | * çäº§æ ¸ç®æç»åé¡µè¡ |
| | | * ç½çï¼åå·¥ + å·¥åº + åå·/é¶ä»¶ |
| | | * æåï¼åå·¥ + å·¥åºï¼å«ä¸ç§ä¹å¨æ°éãæç®çãæåå°æç´ï¼ |
| | | */ |
| | | @Data |
| | | @Schema(name = "ProductionCostingDetailVo", description = "çäº§æ ¸ç®æç»è¡") |
| | | public class ProductionCostingDetailVo implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | private Long staffId; |
| | | @Excel(name = "ç产人") |
| | | private String staffName; |
| | | private String yearMonth; |
| | | |
| | | private Long processId; |
| | | @Excel(name = "å·¥åº") |
| | | private String processName; |
| | | private Integer deptType; |
| | | |
| | | private Long productModelId; |
| | | @Excel(name = "产å大类") |
| | | private String productName; |
| | | @Excel(name = "åå·/é¶ä»¶") |
| | | private String modelName; |
| | | |
| | | @Excel(name = "æäº§é") |
| | | private BigDecimal quantity; |
| | | |
| | | @Excel(name = "å°æç´æ°é") |
| | | private BigDecimal violinQty; |
| | | @Excel(name = "大æç´æ°é") |
| | | private BigDecimal celloQty; |
| | | @Excel(name = "è´æ¯æ°é") |
| | | private BigDecimal bassQty; |
| | | |
| | | @Excel(name = "å°æç´æç®ç") |
| | | private BigDecimal violinFactor; |
| | | @Excel(name = "大æç´æç®ç") |
| | | private BigDecimal celloFactor; |
| | | @Excel(name = "è´æ¯æç®ç") |
| | | private BigDecimal bassFactor; |
| | | |
| | | @Excel(name = "æäº§æåå°æç´") |
| | | private BigDecimal foldedQuantity; |
| | | |
| | | @Excel(name = "æ åæ°é") |
| | | private BigDecimal standardQuantity; |
| | | |
| | | @Excel(name = "æç®æ¶é¿") |
| | | private BigDecimal convertedHours; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.production.bean.vo; |
| | | |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | | import java.math.BigDecimal; |
| | | |
| | | /** |
| | | * çäº§æ ¸ç®-æ¥å·¥èååå§è¡ï¼åå·¥ + æä»½ + å·¥åº + åå·/产åå¤§ç±»ï¼ |
| | | */ |
| | | @Data |
| | | @Schema(name = "ProductionCostingRawVo", description = "çäº§æ ¸ç®åå§èåè¡") |
| | | public class ProductionCostingRawVo implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | private Long staffId; |
| | | private String staffName; |
| | | private String yearMonth; |
| | | private Long processId; |
| | | private String processName; |
| | | private Integer deptType; |
| | | private Long productModelId; |
| | | /** 产å大类ï¼product.product_nameï¼ï¼ä¹å¨å¤æä¾æ® */ |
| | | private String productName; |
| | | /** åå·/è§æ ¼ï¼product_model.modelï¼ */ |
| | | private String modelName; |
| | | /** æäº§é */ |
| | | private BigDecimal quantity; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.production.bean.vo; |
| | | |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | | import java.math.BigDecimal; |
| | | |
| | | /** |
| | | * çäº§æ ¸ç®-æ±æ»å°è´¦è¡ï¼æåå·¥ï¼ |
| | | */ |
| | | @Data |
| | | @Schema(name = "ProductionCostingSummaryVo", description = "çäº§æ ¸ç®æ±æ»è¡") |
| | | public class ProductionCostingSummaryVo implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | private Long staffId; |
| | | private String staffName; |
| | | private String yearMonth; |
| | | |
| | | /** 产é */ |
| | | private BigDecimal output; |
| | | |
| | | /** ææ¶é´åè®¡ï¼æç®æ¶é¿æ±åï¼ */ |
| | | private BigDecimal monthTimeTotal; |
| | | |
| | | /** æååæ° = ææ¶é´å计 / (彿工使¥ * 8) */ |
| | | private BigDecimal conversionRatio; |
| | | |
| | | /** 彿工使¥ */ |
| | | private Integer workDays; |
| | | |
| | | /** å½ææ»¡å¤å·¥æ¶ = 工使¥ * 8 */ |
| | | private BigDecimal monthHours; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.production.controller; |
| | | |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log; |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.production.bean.dto.ProductionCostingQueryDto; |
| | | import com.ruoyi.production.bean.vo.ProductionCostingDetailVo; |
| | | import com.ruoyi.production.bean.vo.ProductionCostingSummaryVo; |
| | | import com.ruoyi.production.pojo.ProductionCostingDept; |
| | | import com.ruoyi.production.pojo.ProductionCostingFactor; |
| | | import com.ruoyi.production.pojo.ProductionCostingStandard; |
| | | import com.ruoyi.production.pojo.ProductionCostingWorkday; |
| | | import com.ruoyi.production.service.ProductionCostingService; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.web.bind.annotation.DeleteMapping; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.PutMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * çäº§æ ¸ç®ï¼æåé¨é¨ / ç½çé¨é¨ï¼å端æ§å¶å¨ |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/productionCosting") |
| | | @RequiredArgsConstructor |
| | | @Tag(name = "çäº§æ ¸ç®") |
| | | public class ProductionCostingController { |
| | | |
| | | private final ProductionCostingService productionCostingService; |
| | | |
| | | @GetMapping("/summary") |
| | | @Log(title = "çäº§æ ¸ç®-æ±æ»æ¥è¯¢", businessType = BusinessType.OTHER) |
| | | @Operation(summary = "çäº§æ ¸ç®æåå·¥æ±æ»") |
| | | public R<List<ProductionCostingSummaryVo>> summary(ProductionCostingQueryDto dto) { |
| | | return R.ok(productionCostingService.summary(dto)); |
| | | } |
| | | |
| | | @GetMapping("/detail") |
| | | @Log(title = "çäº§æ ¸ç®-æç»æ¥è¯¢", businessType = BusinessType.OTHER) |
| | | @Operation(summary = "çäº§æ ¸ç®æç»æ¥è¯¢") |
| | | public R<List<ProductionCostingDetailVo>> detail(ProductionCostingQueryDto dto) { |
| | | return R.ok(productionCostingService.detailList(dto)); |
| | | } |
| | | |
| | | @GetMapping("/workday") |
| | | @Operation(summary = "æ¥è¯¢æä»½å·¥ä½æ¥ä¿¡æ¯") |
| | | public R<Map<String, Object>> workday(String yearMonth) { |
| | | return R.ok(productionCostingService.workdayInfo(yearMonth)); |
| | | } |
| | | |
| | | @PostMapping("/export") |
| | | @Log(title = "çäº§æ ¸ç®-导åº", businessType = BusinessType.EXPORT) |
| | | @Operation(summary = "导åºçäº§æ ¸ç®æç»") |
| | | public void export(HttpServletResponse response, ProductionCostingQueryDto dto) { |
| | | ExcelUtil<ProductionCostingDetailVo> util = new ExcelUtil<>(ProductionCostingDetailVo.class); |
| | | util.exportExcel(response, productionCostingService.detailList(dto), "çäº§æ ¸ç®æç»"); |
| | | } |
| | | |
| | | /* ---------------- é¨é¨ç±»åé
ç½® ---------------- */ |
| | | |
| | | @GetMapping("/dept/list") |
| | | @Operation(summary = "é¨é¨ç±»åé
ç½®å表") |
| | | public R<List<ProductionCostingDept>> deptList() { |
| | | return R.ok(productionCostingService.listDept()); |
| | | } |
| | | |
| | | @PostMapping("/dept") |
| | | @Log(title = "çäº§æ ¸ç®-é¨é¨ç±»åé
ç½®æ°å¢", businessType = BusinessType.INSERT) |
| | | @Operation(summary = "æ°å¢é¨é¨ç±»åé
ç½®") |
| | | public R<Boolean> deptAdd(@RequestBody ProductionCostingDept dept) { |
| | | return R.ok(productionCostingService.saveDept(dept)); |
| | | } |
| | | |
| | | @PutMapping("/dept") |
| | | @Log(title = "çäº§æ ¸ç®-é¨é¨ç±»åé
置修æ¹", businessType = BusinessType.UPDATE) |
| | | @Operation(summary = "ä¿®æ¹é¨é¨ç±»åé
ç½®") |
| | | public R<Boolean> deptEdit(@RequestBody ProductionCostingDept dept) { |
| | | return R.ok(productionCostingService.updateDept(dept)); |
| | | } |
| | | |
| | | @DeleteMapping("/dept/{id}") |
| | | @Log(title = "çäº§æ ¸ç®-é¨é¨ç±»åé
ç½®å é¤", businessType = BusinessType.DELETE) |
| | | @Operation(summary = "å é¤é¨é¨ç±»åé
ç½®") |
| | | public R<Boolean> deptRemove(@PathVariable Long id) { |
| | | return R.ok(productionCostingService.removeDept(id)); |
| | | } |
| | | |
| | | /* ---------------- æ åæ°éé
ç½® ---------------- */ |
| | | |
| | | @GetMapping("/standard/list") |
| | | @Operation(summary = "æ åæ°éé
ç½®å表") |
| | | public R<List<ProductionCostingStandard>> standardList(ProductionCostingStandard query) { |
| | | return R.ok(productionCostingService.listStandard(query)); |
| | | } |
| | | |
| | | @PostMapping("/standard") |
| | | @Log(title = "çäº§æ ¸ç®-æ åæ°éé
ç½®æ°å¢", businessType = BusinessType.INSERT) |
| | | @Operation(summary = "æ°å¢æ åæ°éé
ç½®") |
| | | public R<Boolean> standardAdd(@RequestBody ProductionCostingStandard standard) { |
| | | return R.ok(productionCostingService.saveStandard(standard)); |
| | | } |
| | | |
| | | @PutMapping("/standard") |
| | | @Log(title = "çäº§æ ¸ç®-æ åæ°éé
置修æ¹", businessType = BusinessType.UPDATE) |
| | | @Operation(summary = "ä¿®æ¹æ åæ°éé
ç½®") |
| | | public R<Boolean> standardEdit(@RequestBody ProductionCostingStandard standard) { |
| | | return R.ok(productionCostingService.updateStandard(standard)); |
| | | } |
| | | |
| | | @DeleteMapping("/standard/{id}") |
| | | @Log(title = "çäº§æ ¸ç®-æ åæ°éé
ç½®å é¤", businessType = BusinessType.DELETE) |
| | | @Operation(summary = "å 餿 åæ°éé
ç½®") |
| | | public R<Boolean> standardRemove(@PathVariable Long id) { |
| | | return R.ok(productionCostingService.removeStandard(id)); |
| | | } |
| | | |
| | | /* ---------------- æç®çé
ç½® ---------------- */ |
| | | |
| | | @GetMapping("/factor/list") |
| | | @Operation(summary = "æç®çé
ç½®å表") |
| | | public R<List<ProductionCostingFactor>> factorList(ProductionCostingFactor query) { |
| | | return R.ok(productionCostingService.listFactor(query)); |
| | | } |
| | | |
| | | @PostMapping("/factor") |
| | | @Log(title = "çäº§æ ¸ç®-æç®çé
ç½®æ°å¢", businessType = BusinessType.INSERT) |
| | | @Operation(summary = "æ°å¢æç®çé
ç½®") |
| | | public R<Boolean> factorAdd(@RequestBody ProductionCostingFactor factor) { |
| | | return R.ok(productionCostingService.saveFactor(factor)); |
| | | } |
| | | |
| | | @PutMapping("/factor") |
| | | @Log(title = "çäº§æ ¸ç®-æç®çé
置修æ¹", businessType = BusinessType.UPDATE) |
| | | @Operation(summary = "ä¿®æ¹æç®çé
ç½®") |
| | | public R<Boolean> factorEdit(@RequestBody ProductionCostingFactor factor) { |
| | | return R.ok(productionCostingService.updateFactor(factor)); |
| | | } |
| | | |
| | | @DeleteMapping("/factor/{id}") |
| | | @Log(title = "çäº§æ ¸ç®-æç®çé
ç½®å é¤", businessType = BusinessType.DELETE) |
| | | @Operation(summary = "å 餿ç®çé
ç½®") |
| | | public R<Boolean> factorRemove(@PathVariable Long id) { |
| | | return R.ok(productionCostingService.removeFactor(id)); |
| | | } |
| | | |
| | | /* ---------------- æåº¦å·¥ä½æ¥é
ç½® ---------------- */ |
| | | |
| | | @GetMapping("/workdayConfig/list") |
| | | @Operation(summary = "æåº¦å·¥ä½æ¥é
ç½®å表") |
| | | public R<List<ProductionCostingWorkday>> workdayList(ProductionCostingWorkday query) { |
| | | return R.ok(productionCostingService.listWorkday(query)); |
| | | } |
| | | |
| | | @PostMapping("/workdayConfig") |
| | | @Log(title = "çäº§æ ¸ç®-æåº¦å·¥ä½æ¥é
ç½®æ°å¢", businessType = BusinessType.INSERT) |
| | | @Operation(summary = "æ°å¢æåº¦å·¥ä½æ¥é
ç½®") |
| | | public R<Boolean> workdayAdd(@RequestBody ProductionCostingWorkday workday) { |
| | | return R.ok(productionCostingService.saveWorkday(workday)); |
| | | } |
| | | |
| | | @PutMapping("/workdayConfig") |
| | | @Log(title = "çäº§æ ¸ç®-æåº¦å·¥ä½æ¥é
置修æ¹", businessType = BusinessType.UPDATE) |
| | | @Operation(summary = "ä¿®æ¹æåº¦å·¥ä½æ¥é
ç½®") |
| | | public R<Boolean> workdayEdit(@RequestBody ProductionCostingWorkday workday) { |
| | | return R.ok(productionCostingService.updateWorkday(workday)); |
| | | } |
| | | |
| | | @DeleteMapping("/workdayConfig/{id}") |
| | | @Log(title = "çäº§æ ¸ç®-æåº¦å·¥ä½æ¥é
ç½®å é¤", businessType = BusinessType.DELETE) |
| | | @Operation(summary = "å é¤æåº¦å·¥ä½æ¥é
ç½®") |
| | | public R<Boolean> workdayRemove(@PathVariable Long id) { |
| | | return R.ok(productionCostingService.removeWorkday(id)); |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.production.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.ruoyi.production.pojo.ProductionCostingDept; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * çäº§æ ¸ç®-é¨é¨ç±»åé
ç½® Mapper |
| | | */ |
| | | @Mapper |
| | | public interface ProductionCostingDeptMapper extends BaseMapper<ProductionCostingDept> { |
| | | |
| | | /** |
| | | * æ¥è¯¢é¨é¨ç±»åé
ç½®ï¼å«é¨é¨åç§°ï¼ |
| | | */ |
| | | List<ProductionCostingDept> selectDeptConfigs(); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.production.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.ruoyi.production.pojo.ProductionCostingFactor; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * çäº§æ ¸ç®-æç®çé
ç½® Mapper |
| | | */ |
| | | @Mapper |
| | | public interface ProductionCostingFactorMapper extends BaseMapper<ProductionCostingFactor> { |
| | | |
| | | /** |
| | | * æ¥è¯¢æç®çé
ç½®å表ï¼å«å·¥åºåç§°ï¼ |
| | | */ |
| | | List<ProductionCostingFactor> selectFactorList(@Param("c") ProductionCostingFactor query); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.production.mapper; |
| | | |
| | | import com.ruoyi.production.bean.dto.ProductionCostingQueryDto; |
| | | import com.ruoyi.production.bean.vo.ProductionCostingRawVo; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * çäº§æ ¸ç®-æ ¸ç®ç»è®¡ Mapper |
| | | */ |
| | | @Mapper |
| | | public interface ProductionCostingMapper { |
| | | |
| | | /** |
| | | * æ¥è¯¢ææ¡ä»¶ä¸çæ¥å·¥èååå§è¡ï¼åå·¥+æä»½+å·¥åº+åå·/产åå¤§ç±»ï¼ |
| | | */ |
| | | List<ProductionCostingRawVo> selectCostingRows(@Param("c") ProductionCostingQueryDto dto); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.production.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.ruoyi.production.pojo.ProductionCostingStandard; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * çäº§æ ¸ç®-æ åæ°éé
ç½® Mapper |
| | | */ |
| | | @Mapper |
| | | public interface ProductionCostingStandardMapper extends BaseMapper<ProductionCostingStandard> { |
| | | |
| | | /** |
| | | * æ¥è¯¢æ åæ°éé
ç½®å表ï¼å«å·¥åºåç§°ãåå·åç§°ï¼ |
| | | */ |
| | | List<ProductionCostingStandard> selectStandardList(@Param("c") ProductionCostingStandard query); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.production.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.ruoyi.production.pojo.ProductionCostingWorkday; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * çäº§æ ¸ç®-æåº¦å·¥ä½æ¥é
ç½® Mapper |
| | | */ |
| | | @Mapper |
| | | public interface ProductionCostingWorkdayMapper extends BaseMapper<ProductionCostingWorkday> { |
| | | |
| | | /** |
| | | * æ¥è¯¢æåº¦å·¥ä½æ¥é
ç½®å表 |
| | | */ |
| | | List<ProductionCostingWorkday> selectWorkdayList(@Param("c") ProductionCostingWorkday query); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.production.pojo; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.FieldFill; |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | | import java.time.LocalDateTime; |
| | | |
| | | /** |
| | | * çäº§æ ¸ç®-é¨é¨ç±»åé
ç½®ï¼åºåæåé¨é¨ / ç½çé¨é¨ï¼ |
| | | */ |
| | | @Data |
| | | @TableName("production_costing_dept") |
| | | @Schema(name = "ProductionCostingDept对象", description = "çäº§æ ¸ç®-é¨é¨ç±»åé
ç½®") |
| | | public class ProductionCostingDept implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | @Schema(description = "主é®") |
| | | private Long id; |
| | | |
| | | @Schema(description = "é¨é¨ID") |
| | | private Long deptId; |
| | | |
| | | @Schema(description = "é¨é¨ç±»åï¼1æåé¨é¨ï¼2ç½çé¨é¨") |
| | | private Integer deptType; |
| | | |
| | | @Schema(description = "夿³¨") |
| | | private String remark; |
| | | |
| | | @Schema(description = "é¨é¨åç§°ï¼éæ°æ®åºå段ï¼") |
| | | @TableField(exist = false) |
| | | private String deptName; |
| | | |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long createUser; |
| | | |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private LocalDateTime createTime; |
| | | |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | private Long updateUser; |
| | | |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | private LocalDateTime updateTime; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.production.pojo; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.FieldFill; |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | |
| | | /** |
| | | * çäº§æ ¸ç®-æç®çé
ç½®ï¼å·¥åº + åå·¥ï¼ |
| | | * æåé¨é¨ï¼æ¯ä¸ªå·¥åºçæ¯ä¸ªåå·¥æç®çå¯ä¸åï¼å°æç´ä¸ºåºå 1ï¼ |
| | | */ |
| | | @Data |
| | | @TableName("production_costing_factor") |
| | | @Schema(name = "ProductionCostingFactor对象", description = "çäº§æ ¸ç®-æç®çé
ç½®") |
| | | public class ProductionCostingFactor implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | @Schema(description = "主é®") |
| | | private Long id; |
| | | |
| | | @Schema(description = "å·¥åºID") |
| | | private Long processId; |
| | | |
| | | @Schema(description = "åå·¥ID") |
| | | private Long staffId; |
| | | |
| | | @Schema(description = "åå·¥å§å") |
| | | private String staffName; |
| | | |
| | | @Schema(description = "å°æç´æç®çï¼åºåï¼") |
| | | private BigDecimal violinFactor; |
| | | |
| | | @Schema(description = "大æç´æç®ç") |
| | | private BigDecimal violaFactor; |
| | | |
| | | @Schema(description = "è´æ¯æç®ç") |
| | | private BigDecimal bassFactor; |
| | | |
| | | @Schema(description = "夿³¨") |
| | | private String remark; |
| | | |
| | | @Schema(description = "å·¥åºåç§°ï¼éæ°æ®åºå段ï¼") |
| | | @TableField(exist = false) |
| | | private String processName; |
| | | |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long createUser; |
| | | |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private LocalDateTime createTime; |
| | | |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | private Long updateUser; |
| | | |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | private LocalDateTime updateTime; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.production.pojo; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.FieldFill; |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | |
| | | /** |
| | | * çäº§æ ¸ç®-æ åæ°éé
ç½® |
| | | * æåé¨é¨ï¼æå·¥åºé
ç½®ï¼product_model_id å¯ç©ºï¼ |
| | | * ç½çé¨é¨ï¼æ å·¥åº + åå· é
ç½® |
| | | */ |
| | | @Data |
| | | @TableName("production_costing_standard") |
| | | @Schema(name = "ProductionCostingStandard对象", description = "çäº§æ ¸ç®-æ åæ°éé
ç½®") |
| | | public class ProductionCostingStandard implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | @Schema(description = "主é®") |
| | | private Long id; |
| | | |
| | | @Schema(description = "é¨é¨ç±»åï¼1æåï¼2ç½ç") |
| | | private Integer deptType; |
| | | |
| | | @Schema(description = "å·¥åºID") |
| | | private Long processId; |
| | | |
| | | @Schema(description = "åå·IDï¼ç½çå¿
å¡«ï¼") |
| | | private Long productModelId; |
| | | |
| | | @Schema(description = "æ åæ°é") |
| | | private BigDecimal standardQuantity; |
| | | |
| | | @Schema(description = "åä½") |
| | | private String unit; |
| | | |
| | | @Schema(description = "夿³¨") |
| | | private String remark; |
| | | |
| | | @Schema(description = "å·¥åºåç§°ï¼éæ°æ®åºå段ï¼") |
| | | @TableField(exist = false) |
| | | private String processName; |
| | | |
| | | @Schema(description = "åå·åç§°ï¼éæ°æ®åºå段ï¼") |
| | | @TableField(exist = false) |
| | | private String modelName; |
| | | |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long createUser; |
| | | |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private LocalDateTime createTime; |
| | | |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | private Long updateUser; |
| | | |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | private LocalDateTime updateTime; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.production.pojo; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.FieldFill; |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | | import java.time.LocalDateTime; |
| | | |
| | | /** |
| | | * çäº§æ ¸ç®-æåº¦å·¥ä½æ¥é
ç½® |
| | | */ |
| | | @Data |
| | | @TableName("production_costing_workday") |
| | | @Schema(name = "ProductionCostingWorkday对象", description = "çäº§æ ¸ç®-æåº¦å·¥ä½æ¥é
ç½®") |
| | | public class ProductionCostingWorkday implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | @Schema(description = "主é®") |
| | | private Long id; |
| | | |
| | | @Schema(description = "å¹´æ yyyy-MM") |
| | | @TableField("work_month") |
| | | private String yearMonth; |
| | | |
| | | @Schema(description = "彿工使¥å¤©æ°") |
| | | private Integer workDays; |
| | | |
| | | @Schema(description = "夿³¨") |
| | | private String remark; |
| | | |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long createUser; |
| | | |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private LocalDateTime createTime; |
| | | |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | private Long updateUser; |
| | | |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | private LocalDateTime updateTime; |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.production.service; |
| | | |
| | | import com.ruoyi.production.bean.dto.ProductionCostingQueryDto; |
| | | import com.ruoyi.production.bean.vo.ProductionCostingDetailVo; |
| | | import com.ruoyi.production.bean.vo.ProductionCostingSummaryVo; |
| | | import com.ruoyi.production.pojo.ProductionCostingDept; |
| | | import com.ruoyi.production.pojo.ProductionCostingFactor; |
| | | import com.ruoyi.production.pojo.ProductionCostingStandard; |
| | | import com.ruoyi.production.pojo.ProductionCostingWorkday; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * çäº§æ ¸ç®ï¼æåé¨é¨ / ç½çé¨é¨ï¼æå¡ |
| | | */ |
| | | public interface ProductionCostingService { |
| | | |
| | | /** æåå·¥æ±æ»ï¼äº§éãææ¶é´å计ãæååæ° */ |
| | | List<ProductionCostingSummaryVo> summary(ProductionCostingQueryDto dto); |
| | | |
| | | /** æç»è¡ï¼ç½çï¼å·¥åº+åå·ï¼æåï¼å·¥åºï¼ */ |
| | | List<ProductionCostingDetailVo> detailList(ProductionCostingQueryDto dto); |
| | | |
| | | /** æä»½å·¥ä½æ¥ä¿¡æ¯ */ |
| | | Map<String, Object> workdayInfo(String yearMonth); |
| | | |
| | | /* ---------------- é¨é¨ç±»åé
ç½® ---------------- */ |
| | | List<ProductionCostingDept> listDept(); |
| | | |
| | | boolean saveDept(ProductionCostingDept dept); |
| | | |
| | | boolean updateDept(ProductionCostingDept dept); |
| | | |
| | | boolean removeDept(Long id); |
| | | |
| | | /* ---------------- æ åæ°éé
ç½® ---------------- */ |
| | | List<ProductionCostingStandard> listStandard(ProductionCostingStandard query); |
| | | |
| | | boolean saveStandard(ProductionCostingStandard standard); |
| | | |
| | | boolean updateStandard(ProductionCostingStandard standard); |
| | | |
| | | boolean removeStandard(Long id); |
| | | |
| | | /* ---------------- æç®çé
ç½® ---------------- */ |
| | | List<ProductionCostingFactor> listFactor(ProductionCostingFactor query); |
| | | |
| | | boolean saveFactor(ProductionCostingFactor factor); |
| | | |
| | | boolean updateFactor(ProductionCostingFactor factor); |
| | | |
| | | boolean removeFactor(Long id); |
| | | |
| | | /* ---------------- æåº¦å·¥ä½æ¥é
ç½® ---------------- */ |
| | | List<ProductionCostingWorkday> listWorkday(ProductionCostingWorkday query); |
| | | |
| | | boolean saveWorkday(ProductionCostingWorkday workday); |
| | | |
| | | boolean updateWorkday(ProductionCostingWorkday workday); |
| | | |
| | | boolean removeWorkday(Long id); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.production.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.ruoyi.production.bean.dto.ProductionCostingQueryDto; |
| | | import com.ruoyi.production.bean.vo.ProductionCostingDetailVo; |
| | | import com.ruoyi.production.bean.vo.ProductionCostingRawVo; |
| | | import com.ruoyi.production.bean.vo.ProductionCostingSummaryVo; |
| | | import com.ruoyi.production.mapper.ProductionCostingDeptMapper; |
| | | import com.ruoyi.production.mapper.ProductionCostingFactorMapper; |
| | | import com.ruoyi.production.mapper.ProductionCostingMapper; |
| | | import com.ruoyi.production.mapper.ProductionCostingStandardMapper; |
| | | import com.ruoyi.production.mapper.ProductionCostingWorkdayMapper; |
| | | import com.ruoyi.production.pojo.ProductionCostingDept; |
| | | import com.ruoyi.production.pojo.ProductionCostingFactor; |
| | | import com.ruoyi.production.pojo.ProductionCostingStandard; |
| | | import com.ruoyi.production.pojo.ProductionCostingWorkday; |
| | | import com.ruoyi.production.service.ProductionCostingService; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.time.DayOfWeek; |
| | | import java.time.YearMonth; |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.LinkedHashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * çäº§æ ¸ç®æå¡å®ç° |
| | | * <p> |
| | | * 计ç®è§åï¼ä¸¥æ ¼æéæ±ï¼ï¼ |
| | | * ç½çé¨é¨ï¼æç®æ¶é¿ = æäº§é à æ åæ°é à 8 |
| | | * æåé¨é¨ï¼æäº§æåå°æ = å°æç´ + 大æç´Ã大ææç®ç + è´æ¯Ãè´æ¯æç®ç |
| | | * æç®æ¶é¿ = æäº§æåå°æ ÷ æ åæ°é à 8 |
| | | * ææ¶é´å计 = æç®æ¶é¿æ±å |
| | | * æååæ° = ææ¶é´å计 ÷ï¼å½æå·¥ä½æ¥ à 8ï¼ |
| | | */ |
| | | @Service |
| | | @RequiredArgsConstructor |
| | | public class ProductionCostingServiceImpl implements ProductionCostingService { |
| | | |
| | | private static final BigDecimal EIGHT = new BigDecimal("8"); |
| | | private static final BigDecimal ONE = new BigDecimal("1"); |
| | | private static final String VIOLIN = "å°æç´"; |
| | | private static final String CELLO = "大æç´"; |
| | | private static final String BASS = "è´æ¯"; |
| | | |
| | | private final ProductionCostingMapper productionCostingMapper; |
| | | private final ProductionCostingStandardMapper standardMapper; |
| | | private final ProductionCostingFactorMapper factorMapper; |
| | | private final ProductionCostingDeptMapper deptMapper; |
| | | private final ProductionCostingWorkdayMapper workdayMapper; |
| | | |
| | | @Override |
| | | public List<ProductionCostingDetailVo> detailList(ProductionCostingQueryDto dto) { |
| | | ProductionCostingQueryDto query = dto == null ? new ProductionCostingQueryDto() : dto; |
| | | List<ProductionCostingRawVo> rows = productionCostingMapper.selectCostingRows(query); |
| | | |
| | | // æ åæ°éï¼æå(1) æå·¥åºï¼ç½ç(2) æ å·¥åº+åå· |
| | | Map<Long, BigDecimal> standardByProcess = new HashMap<>(); |
| | | Map<String, BigDecimal> standardByProcessModel = new HashMap<>(); |
| | | List<ProductionCostingStandard> standardList = standardMapper.selectList(null); |
| | | for (ProductionCostingStandard s : standardList) { |
| | | if (s.getProcessId() == null || s.getStandardQuantity() == null) { |
| | | continue; |
| | | } |
| | | if (Integer.valueOf(2).equals(s.getDeptType())) { |
| | | standardByProcessModel.put(key(s.getProcessId(), s.getProductModelId()), s.getStandardQuantity()); |
| | | } else { |
| | | standardByProcess.put(s.getProcessId(), s.getStandardQuantity()); |
| | | } |
| | | } |
| | | |
| | | // æç®çï¼å·¥åº + åå·¥ |
| | | Map<String, ProductionCostingFactor> factorMap = new HashMap<>(); |
| | | for (ProductionCostingFactor f : factorMapper.selectList(null)) { |
| | | factorMap.put(key(f.getProcessId(), f.getStaffId()), f); |
| | | } |
| | | |
| | | List<ProductionCostingDetailVo> result = new ArrayList<>(); |
| | | |
| | | // ---------- æåé¨é¨ï¼æ åå·¥ + æä»½ + å·¥åº èå ---------- |
| | | Map<String, ProductionCostingDetailVo> finishedGroup = new LinkedHashMap<>(); |
| | | // ---------- ç½çé¨é¨ï¼æ åå·¥ + æä»½ + å·¥åº + åå· èå ---------- |
| | | Map<String, ProductionCostingDetailVo> whiteGroup = new LinkedHashMap<>(); |
| | | |
| | | for (ProductionCostingRawVo row : rows) { |
| | | BigDecimal qty = nz(row.getQuantity()); |
| | | boolean white = Integer.valueOf(2).equals(row.getDeptType()); |
| | | if (white) { |
| | | String k = key(row.getStaffId(), row.getYearMonth(), row.getProcessId(), row.getProductModelId()); |
| | | ProductionCostingDetailVo vo = whiteGroup.get(k); |
| | | if (vo == null) { |
| | | vo = new ProductionCostingDetailVo(); |
| | | vo.setStaffId(row.getStaffId()); |
| | | vo.setStaffName(row.getStaffName()); |
| | | vo.setYearMonth(row.getYearMonth()); |
| | | vo.setProcessId(row.getProcessId()); |
| | | vo.setProcessName(row.getProcessName()); |
| | | vo.setDeptType(row.getDeptType()); |
| | | vo.setProductModelId(row.getProductModelId()); |
| | | vo.setProductName(row.getProductName()); |
| | | vo.setModelName(row.getModelName()); |
| | | vo.setQuantity(BigDecimal.ZERO); |
| | | whiteGroup.put(k, vo); |
| | | } |
| | | vo.setQuantity(vo.getQuantity().add(qty)); |
| | | } else { |
| | | String k = key(row.getStaffId(), row.getYearMonth(), row.getProcessId()); |
| | | ProductionCostingDetailVo vo = finishedGroup.get(k); |
| | | if (vo == null) { |
| | | vo = new ProductionCostingDetailVo(); |
| | | vo.setStaffId(row.getStaffId()); |
| | | vo.setStaffName(row.getStaffName()); |
| | | vo.setYearMonth(row.getYearMonth()); |
| | | vo.setProcessId(row.getProcessId()); |
| | | vo.setProcessName(row.getProcessName()); |
| | | vo.setDeptType(row.getDeptType()); |
| | | vo.setQuantity(BigDecimal.ZERO); |
| | | vo.setViolinQty(BigDecimal.ZERO); |
| | | vo.setCelloQty(BigDecimal.ZERO); |
| | | vo.setBassQty(BigDecimal.ZERO); |
| | | finishedGroup.put(k, vo); |
| | | } |
| | | vo.setQuantity(vo.getQuantity().add(qty)); |
| | | if (VIOLIN.equals(row.getProductName())) { |
| | | vo.setViolinQty(vo.getViolinQty().add(qty)); |
| | | } else if (CELLO.equals(row.getProductName())) { |
| | | vo.setCelloQty(vo.getCelloQty().add(qty)); |
| | | } else if (BASS.equals(row.getProductName())) { |
| | | vo.setBassQty(vo.getBassQty().add(qty)); |
| | | } else { |
| | | // éä¹å¨äº§åé»è®¤æå°æç´å½é 1:1 计å
¥ |
| | | vo.setViolinQty(vo.getViolinQty().add(qty)); |
| | | } |
| | | } |
| | | } |
| | | |
| | | // æåï¼æç® |
| | | for (ProductionCostingDetailVo vo : finishedGroup.values()) { |
| | | ProductionCostingFactor factor = factorMap.get(key(vo.getProcessId(), vo.getStaffId())); |
| | | BigDecimal violinFactor = factor == null ? ONE : nzDefault(factor.getViolinFactor(), ONE); |
| | | BigDecimal celloFactor = factor == null ? ONE : nzDefault(factor.getViolaFactor(), ONE); |
| | | BigDecimal bassFactor = factor == null ? ONE : nzDefault(factor.getBassFactor(), ONE); |
| | | vo.setViolinFactor(violinFactor); |
| | | vo.setCelloFactor(celloFactor); |
| | | vo.setBassFactor(bassFactor); |
| | | |
| | | BigDecimal folded = nz(vo.getViolinQty()).multiply(violinFactor) |
| | | .add(nz(vo.getCelloQty()).multiply(celloFactor)) |
| | | .add(nz(vo.getBassQty()).multiply(bassFactor)) |
| | | .setScale(2, RoundingMode.HALF_UP); |
| | | vo.setFoldedQuantity(folded); |
| | | |
| | | BigDecimal standard = standardByProcess.get(vo.getProcessId()); |
| | | vo.setStandardQuantity(standard); |
| | | vo.setConvertedHours(calcFinishedHours(folded, standard)); |
| | | } |
| | | |
| | | // ç½çï¼æç®æ¶é¿ = æäº§é à æ åæ°é à 8 |
| | | for (ProductionCostingDetailVo vo : whiteGroup.values()) { |
| | | BigDecimal standard = standardByProcessModel.get(key(vo.getProcessId(), vo.getProductModelId())); |
| | | vo.setStandardQuantity(standard); |
| | | BigDecimal hours = nz(standard).compareTo(BigDecimal.ZERO) <= 0 |
| | | ? BigDecimal.ZERO |
| | | : nz(vo.getQuantity()).multiply(standard).multiply(EIGHT); |
| | | vo.setConvertedHours(hours.setScale(2, RoundingMode.HALF_UP)); |
| | | } |
| | | |
| | | result.addAll(finishedGroup.values()); |
| | | result.addAll(whiteGroup.values()); |
| | | return result; |
| | | } |
| | | |
| | | @Override |
| | | public List<ProductionCostingSummaryVo> summary(ProductionCostingQueryDto dto) { |
| | | ProductionCostingQueryDto query = dto == null ? new ProductionCostingQueryDto() : dto; |
| | | String yearMonth = (query.getYearMonth() == null || query.getYearMonth().isEmpty()) |
| | | ? YearMonth.now().toString() : query.getYearMonth(); |
| | | query.setYearMonth(yearMonth); |
| | | int workDays = resolveWorkDays(yearMonth); |
| | | BigDecimal fullHours = new BigDecimal(workDays).multiply(EIGHT); |
| | | |
| | | List<ProductionCostingDetailVo> details = detailList(query); |
| | | Map<Long, ProductionCostingSummaryVo> map = new LinkedHashMap<>(); |
| | | for (ProductionCostingDetailVo d : details) { |
| | | ProductionCostingSummaryVo vo = map.get(d.getStaffId()); |
| | | if (vo == null) { |
| | | vo = new ProductionCostingSummaryVo(); |
| | | vo.setStaffId(d.getStaffId()); |
| | | vo.setStaffName(d.getStaffName()); |
| | | vo.setYearMonth(yearMonth); |
| | | vo.setOutput(BigDecimal.ZERO); |
| | | vo.setMonthTimeTotal(BigDecimal.ZERO); |
| | | vo.setWorkDays(workDays); |
| | | vo.setMonthHours(fullHours); |
| | | map.put(d.getStaffId(), vo); |
| | | } |
| | | vo.setOutput(vo.getOutput().add(nz(d.getQuantity())).setScale(2, RoundingMode.HALF_UP)); |
| | | vo.setMonthTimeTotal(vo.getMonthTimeTotal().add(nz(d.getConvertedHours())).setScale(2, RoundingMode.HALF_UP)); |
| | | } |
| | | List<ProductionCostingSummaryVo> result = new ArrayList<>(map.values()); |
| | | for (ProductionCostingSummaryVo vo : result) { |
| | | BigDecimal divisor = fullHours; |
| | | BigDecimal ratio = divisor.compareTo(BigDecimal.ZERO) == 0 |
| | | ? BigDecimal.ZERO |
| | | : vo.getMonthTimeTotal().divide(divisor, 2, RoundingMode.HALF_UP); |
| | | vo.setConversionRatio(ratio); |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | @Override |
| | | public Map<String, Object> workdayInfo(String yearMonth) { |
| | | String ym = (yearMonth == null || yearMonth.isEmpty()) ? YearMonth.now().toString() : yearMonth; |
| | | ProductionCostingWorkday cfg = findWorkday(ym); |
| | | int workDays = (cfg != null && cfg.getWorkDays() != null) ? cfg.getWorkDays() : workDays(ym); |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("yearMonth", ym); |
| | | map.put("workDays", workDays); |
| | | map.put("dayHours", 8); |
| | | map.put("monthHours", new BigDecimal(workDays).multiply(EIGHT).setScale(2, RoundingMode.HALF_UP)); |
| | | map.put("source", (cfg != null && cfg.getWorkDays() != null) ? "CONFIG" : "DEFAULT"); |
| | | return map; |
| | | } |
| | | |
| | | /* ================= é
ç½® CRUD ================= */ |
| | | |
| | | @Override |
| | | public List<ProductionCostingDept> listDept() { |
| | | return deptMapper.selectDeptConfigs(); |
| | | } |
| | | |
| | | @Override |
| | | public boolean saveDept(ProductionCostingDept dept) { |
| | | return deptMapper.insert(dept) > 0; |
| | | } |
| | | |
| | | @Override |
| | | public boolean updateDept(ProductionCostingDept dept) { |
| | | return deptMapper.updateById(dept) > 0; |
| | | } |
| | | |
| | | @Override |
| | | public boolean removeDept(Long id) { |
| | | return deptMapper.deleteById(id) > 0; |
| | | } |
| | | |
| | | @Override |
| | | public List<ProductionCostingStandard> listStandard(ProductionCostingStandard query) { |
| | | return standardMapper.selectStandardList(query == null ? new ProductionCostingStandard() : query); |
| | | } |
| | | |
| | | @Override |
| | | public boolean saveStandard(ProductionCostingStandard standard) { |
| | | return standardMapper.insert(standard) > 0; |
| | | } |
| | | |
| | | @Override |
| | | public boolean updateStandard(ProductionCostingStandard standard) { |
| | | return standardMapper.updateById(standard) > 0; |
| | | } |
| | | |
| | | @Override |
| | | public boolean removeStandard(Long id) { |
| | | return standardMapper.deleteById(id) > 0; |
| | | } |
| | | |
| | | @Override |
| | | public List<ProductionCostingFactor> listFactor(ProductionCostingFactor query) { |
| | | return factorMapper.selectFactorList(query == null ? new ProductionCostingFactor() : query); |
| | | } |
| | | |
| | | @Override |
| | | public boolean saveFactor(ProductionCostingFactor factor) { |
| | | return factorMapper.insert(factor) > 0; |
| | | } |
| | | |
| | | @Override |
| | | public boolean updateFactor(ProductionCostingFactor factor) { |
| | | return factorMapper.updateById(factor) > 0; |
| | | } |
| | | |
| | | @Override |
| | | public boolean removeFactor(Long id) { |
| | | return factorMapper.deleteById(id) > 0; |
| | | } |
| | | |
| | | @Override |
| | | public List<ProductionCostingWorkday> listWorkday(ProductionCostingWorkday query) { |
| | | return workdayMapper.selectWorkdayList(query == null ? new ProductionCostingWorkday() : query); |
| | | } |
| | | |
| | | @Override |
| | | public boolean saveWorkday(ProductionCostingWorkday workday) { |
| | | return workdayMapper.insert(workday) > 0; |
| | | } |
| | | |
| | | @Override |
| | | public boolean updateWorkday(ProductionCostingWorkday workday) { |
| | | return workdayMapper.updateById(workday) > 0; |
| | | } |
| | | |
| | | @Override |
| | | public boolean removeWorkday(Long id) { |
| | | return workdayMapper.deleteById(id) > 0; |
| | | } |
| | | |
| | | /* ================= å·¥å
·æ¹æ³ ================= */ |
| | | |
| | | /** æ¥æåº¦å·¥ä½æ¥é
ç½® */ |
| | | private ProductionCostingWorkday findWorkday(String yearMonth) { |
| | | if (yearMonth == null || yearMonth.isEmpty()) { |
| | | return null; |
| | | } |
| | | return workdayMapper.selectOne(new LambdaQueryWrapper<ProductionCostingWorkday>() |
| | | .eq(ProductionCostingWorkday::getYearMonth, yearMonth) |
| | | .last("limit 1")); |
| | | } |
| | | |
| | | /** 工使¥ï¼ä¼å
åæåº¦é
ç½®ï¼æªé
ç½®åæå¨ä¸~å¨äº */ |
| | | private int resolveWorkDays(String yearMonth) { |
| | | ProductionCostingWorkday cfg = findWorkday(yearMonth); |
| | | if (cfg != null && cfg.getWorkDays() != null) { |
| | | return cfg.getWorkDays(); |
| | | } |
| | | return workDays(yearMonth); |
| | | } |
| | | |
| | | /** æåæç®ï¼æåå°æç´ / æ åæ°é * 8ï¼æ åæ°é<=0 è¿å 0 */ |
| | | private BigDecimal calcFinishedHours(BigDecimal folded, BigDecimal standard) { |
| | | if (standard == null || standard.compareTo(BigDecimal.ZERO) <= 0) { |
| | | return BigDecimal.ZERO.setScale(2, RoundingMode.HALF_UP); |
| | | } |
| | | return folded.divide(standard, 8, RoundingMode.HALF_UP) |
| | | .multiply(EIGHT) |
| | | .setScale(2, RoundingMode.HALF_UP); |
| | | } |
| | | |
| | | private int workDays(String yearMonth) { |
| | | try { |
| | | YearMonth ym = YearMonth.parse(yearMonth); |
| | | int count = 0; |
| | | for (int d = 1; d <= ym.lengthOfMonth(); d++) { |
| | | DayOfWeek dow = ym.atDay(d).getDayOfWeek(); |
| | | if (dow != DayOfWeek.SATURDAY && dow != DayOfWeek.SUNDAY) { |
| | | count++; |
| | | } |
| | | } |
| | | return count; |
| | | } catch (Exception e) { |
| | | return 0; |
| | | } |
| | | } |
| | | |
| | | private BigDecimal nz(BigDecimal v) { |
| | | return v == null ? BigDecimal.ZERO : v; |
| | | } |
| | | |
| | | private BigDecimal nzDefault(BigDecimal v, BigDecimal def) { |
| | | return v == null ? def : v; |
| | | } |
| | | |
| | | private String key(Object... parts) { |
| | | StringBuilder sb = new StringBuilder(); |
| | | for (int i = 0; i < parts.length; i++) { |
| | | if (i > 0) { |
| | | sb.append(':'); |
| | | } |
| | | sb.append(parts[i] == null ? "null" : parts[i]); |
| | | } |
| | | return sb.toString(); |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <?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.production.mapper.ProductionCostingDeptMapper"> |
| | | |
| | | <select id="selectDeptConfigs" resultType="com.ruoyi.production.pojo.ProductionCostingDept"> |
| | | select d.id, d.dept_id, d.dept_type, d.remark, d.create_user, d.create_time, d.update_user, d.update_time, |
| | | sd.dept_name as deptName |
| | | from production_costing_dept d |
| | | left join sys_dept sd on sd.dept_id = d.dept_id |
| | | order by d.dept_type asc, d.id asc |
| | | </select> |
| | | |
| | | </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.production.mapper.ProductionCostingFactorMapper"> |
| | | |
| | | <select id="selectFactorList" resultType="com.ruoyi.production.pojo.ProductionCostingFactor"> |
| | | select f.id, f.process_id, f.staff_id, f.staff_name, f.violin_factor, f.viola_factor, f.bass_factor, f.remark, |
| | | f.create_user, f.create_time, f.update_user, f.update_time, |
| | | too.name as processName |
| | | from production_costing_factor f |
| | | left join technology_operation too on too.id = f.process_id |
| | | <where> |
| | | <if test="c != null"> |
| | | <if test="c.processId != null"> |
| | | and f.process_id = #{c.processId} |
| | | </if> |
| | | <if test="c.staffId != null"> |
| | | and f.staff_id = #{c.staffId} |
| | | </if> |
| | | <if test="c.staffName != null and c.staffName != ''"> |
| | | and f.staff_name like concat('%', #{c.staffName}, '%') |
| | | </if> |
| | | </if> |
| | | </where> |
| | | order by f.process_id asc, f.staff_id asc |
| | | </select> |
| | | |
| | | </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.production.mapper.ProductionCostingMapper"> |
| | | |
| | | <select id="selectCostingRows" resultType="com.ruoyi.production.bean.vo.ProductionCostingRawVo"> |
| | | select |
| | | ppm.user_id as staffId, |
| | | ppm.user_name as staffName, |
| | | date_format(ppm.create_time, '%Y-%m') as yearMonth, |
| | | too.id as processId, |
| | | too.name as processName, |
| | | cd.dept_type as deptType, |
| | | ppo.product_model_id as productModelId, |
| | | p.product_name as productName, |
| | | pm.model as modelName, |
| | | sum(ifnull(ppo.quantity, 0)) as quantity |
| | | from production_product_main ppm |
| | | inner join production_operation_task pot on pot.id = ppm.production_operation_task_id |
| | | inner join production_order_routing_operation poro on poro.id = pot.production_order_routing_operation_id |
| | | inner join technology_operation too on too.id = poro.technology_operation_id |
| | | inner join production_costing_dept cd on cd.dept_id = too.dept_id |
| | | inner join production_product_output ppo on ppo.production_product_main_id = ppm.id |
| | | left join product_model pm on pm.id = ppo.product_model_id |
| | | left join product p on p.id = pm.product_id |
| | | <where> |
| | | ppm.audit_status = 1 |
| | | and ppm.report_type in (0, 1) |
| | | <if test="c != null"> |
| | | <if test="c.deptType != null"> |
| | | and cd.dept_type = #{c.deptType} |
| | | </if> |
| | | <if test="c.yearMonth != null and c.yearMonth != ''"> |
| | | and date_format(ppm.create_time, '%Y-%m') = #{c.yearMonth} |
| | | </if> |
| | | <if test="c.staffName != null and c.staffName != ''"> |
| | | and ppm.user_name like concat('%', #{c.staffName}, '%') |
| | | </if> |
| | | <if test="c.processId != null"> |
| | | and too.id = #{c.processId} |
| | | </if> |
| | | </if> |
| | | </where> |
| | | group by ppm.user_id, ppm.user_name, yearMonth, too.id, too.name, cd.dept_type, ppo.product_model_id, p.product_name, pm.model |
| | | order by yearMonth desc, ppm.user_id, too.id |
| | | </select> |
| | | |
| | | </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.production.mapper.ProductionCostingStandardMapper"> |
| | | |
| | | <select id="selectStandardList" resultType="com.ruoyi.production.pojo.ProductionCostingStandard"> |
| | | select s.id, s.dept_type, s.process_id, s.product_model_id, s.standard_quantity, s.unit, s.remark, |
| | | s.create_user, s.create_time, s.update_user, s.update_time, |
| | | too.name as processName, |
| | | pm.model as modelName |
| | | from production_costing_standard s |
| | | left join technology_operation too on too.id = s.process_id |
| | | left join product_model pm on pm.id = s.product_model_id |
| | | <where> |
| | | <if test="c != null"> |
| | | <if test="c.deptType != null"> |
| | | and s.dept_type = #{c.deptType} |
| | | </if> |
| | | <if test="c.processId != null"> |
| | | and s.process_id = #{c.processId} |
| | | </if> |
| | | <if test="c.productModelId != null"> |
| | | and s.product_model_id = #{c.productModelId} |
| | | </if> |
| | | </if> |
| | | </where> |
| | | order by s.dept_type asc, s.process_id asc, s.product_model_id asc |
| | | </select> |
| | | |
| | | </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.production.mapper.ProductionCostingWorkdayMapper"> |
| | | |
| | | <select id="selectWorkdayList" resultType="com.ruoyi.production.pojo.ProductionCostingWorkday"> |
| | | select w.id, w.work_month as yearMonth, w.work_days, w.remark, |
| | | w.create_user, w.create_time, w.update_user, w.update_time |
| | | from production_costing_workday w |
| | | <where> |
| | | <if test="c != null"> |
| | | <if test="c.yearMonth != null and c.yearMonth != ''"> |
| | | and w.work_month = #{c.yearMonth} |
| | | </if> |
| | | </if> |
| | | </where> |
| | | order by w.work_month desc |
| | | </select> |
| | | |
| | | </mapper> |