From 3e144b2eb8fc9447d2d092edb71db533d12abc52 Mon Sep 17 00:00:00 2001
From: liu <2021943741@qq.com>
Date: 星期四, 24 九月 2026 19:06:39 +0800
Subject: [PATCH] feat(生产核算): 新增大类「中提琴」并打通工资/核算折算

---
 src/main/java/com/ruoyi/production/service/impl/ProductionCostingServiceImpl.java |   48 +++++++++++++++++++++++++++++-------------------
 1 files changed, 29 insertions(+), 19 deletions(-)

diff --git a/src/main/java/com/ruoyi/production/service/impl/ProductionCostingServiceImpl.java b/src/main/java/com/ruoyi/production/service/impl/ProductionCostingServiceImpl.java
index bd9d2d7..f20f2df 100644
--- a/src/main/java/com/ruoyi/production/service/impl/ProductionCostingServiceImpl.java
+++ b/src/main/java/com/ruoyi/production/service/impl/ProductionCostingServiceImpl.java
@@ -5,12 +5,13 @@
 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.enums.MajorCategoryEnum;
+import com.ruoyi.production.mapper.ProductionCostingProcessMapper;
 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.ProductionCostingProcess;
 import com.ruoyi.production.pojo.ProductionCostingFactor;
 import com.ruoyi.production.pojo.ProductionCostingStandard;
 import com.ruoyi.production.pojo.ProductionCostingWorkday;
@@ -44,14 +45,16 @@
 
     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 = "璐濇柉";
+    // 澶х被瑙勮寖鍊肩粺涓�鍙栬嚜 MajorCategoryEnum锛岄伩鍏嶈鍒欐暎钀�
+    private static final String VIOLIN = MajorCategoryEnum.VIOLIN.getCategory();
+    private static final String VIOLA = MajorCategoryEnum.VIOLA.getCategory();
+    private static final String CELLO = MajorCategoryEnum.CELLO.getCategory();
+    private static final String BASS = MajorCategoryEnum.BASS.getCategory();
 
     private final ProductionCostingMapper productionCostingMapper;
     private final ProductionCostingStandardMapper standardMapper;
     private final ProductionCostingFactorMapper factorMapper;
-    private final ProductionCostingDeptMapper deptMapper;
+    private final ProductionCostingProcessMapper processMapper;
     private final ProductionCostingWorkdayMapper workdayMapper;
 
     @Override
@@ -121,19 +124,22 @@
                     vo.setDeptType(row.getDeptType());
                     vo.setQuantity(BigDecimal.ZERO);
                     vo.setViolinQty(BigDecimal.ZERO);
+                    vo.setViolaQty(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())) {
+                // 鎸夋姤宸ユ椂褰掗泦濂界殑澶х被鍒嗘祦锛涙湭褰掔被锛堝闆朵欢/鍘熸枡绫绘姤宸ワ級涓庣┖鍊间竴寰嬫寜灏忔彁鐞村綋閲� 1:1 璁″叆锛�
+                // 涓庢敼鍔ㄥ墠鈥滈潪涔愬櫒浜у搧鈥濆垎鏀殑琛屼负淇濇寔涓�鑷淬��
+                String category = row.getMajorCategory();
+                if (VIOLA.equals(category)) {
+                    vo.setViolaQty(vo.getViolaQty().add(qty));
+                } else if (CELLO.equals(category)) {
                     vo.setCelloQty(vo.getCelloQty().add(qty));
-                } else if (BASS.equals(row.getProductName())) {
+                } else if (BASS.equals(category)) {
                     vo.setBassQty(vo.getBassQty().add(qty));
                 } else {
-                    // 闈炰箰鍣ㄤ骇鍝侀粯璁ゆ寜灏忔彁鐞村綋閲� 1:1 璁″叆
                     vo.setViolinQty(vo.getViolinQty().add(qty));
                 }
             }
@@ -143,13 +149,17 @@
         for (ProductionCostingDetailVo vo : finishedGroup.values()) {
             ProductionCostingFactor factor = factorMap.get(key(vo.getProcessId(), vo.getStaffId()));
             BigDecimal violinFactor = factor == null ? ONE : nzDefault(factor.getViolinFactor(), ONE);
+            // 娉ㄦ剰锛歡etViolaFactor() 鐨勫垪鍚嶆槸鈥滀腑鎻愮惔鈥濓紝浣嗗巻鍙茶涔夋槸銆愬ぇ鎻愮惔銆戞姌绠楃巼锛屽嬁鏀�
             BigDecimal celloFactor = factor == null ? ONE : nzDefault(factor.getViolaFactor(), ONE);
+            BigDecimal violaFactor = factor == null ? ONE : nzDefault(factor.getMidViolinFactor(), ONE);
             BigDecimal bassFactor = factor == null ? ONE : nzDefault(factor.getBassFactor(), ONE);
             vo.setViolinFactor(violinFactor);
             vo.setCelloFactor(celloFactor);
+            vo.setViolaFactor(violaFactor);
             vo.setBassFactor(bassFactor);
 
             BigDecimal folded = nz(vo.getViolinQty()).multiply(violinFactor)
+                    .add(nz(vo.getViolaQty()).multiply(violaFactor))
                     .add(nz(vo.getCelloQty()).multiply(celloFactor))
                     .add(nz(vo.getBassQty()).multiply(bassFactor))
                     .setScale(2, RoundingMode.HALF_UP);
@@ -230,23 +240,23 @@
     /* ================= 閰嶇疆 CRUD ================= */
 
     @Override
-    public List<ProductionCostingDept> listDept() {
-        return deptMapper.selectDeptConfigs();
+    public List<ProductionCostingProcess> listProcess(ProductionCostingProcess query) {
+        return processMapper.selectProcessList(query == null ? new ProductionCostingProcess() : query);
     }
 
     @Override
-    public boolean saveDept(ProductionCostingDept dept) {
-        return deptMapper.insert(dept) > 0;
+    public boolean saveProcess(ProductionCostingProcess process) {
+        return processMapper.insert(process) > 0;
     }
 
     @Override
-    public boolean updateDept(ProductionCostingDept dept) {
-        return deptMapper.updateById(dept) > 0;
+    public boolean updateProcess(ProductionCostingProcess process) {
+        return processMapper.updateById(process) > 0;
     }
 
     @Override
-    public boolean removeDept(Long id) {
-        return deptMapper.deleteById(id) > 0;
+    public boolean removeProcess(Long id) {
+        return processMapper.deleteById(id) > 0;
     }
 
     @Override

--
Gitblit v1.9.3