| | |
| | | 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.enums.MajorCategoryEnum; |
| | | import com.ruoyi.production.mapper.ProductionCostingProcessMapper; |
| | | import com.ruoyi.production.mapper.ProductionCostingFactorMapper; |
| | | import com.ruoyi.production.mapper.ProductionCostingMapper; |
| | |
| | | |
| | | 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; |
| | |
| | | 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)); |
| | | } |
| | | } |
| | |
| | | for (ProductionCostingDetailVo vo : finishedGroup.values()) { |
| | | ProductionCostingFactor factor = factorMap.get(key(vo.getProcessId(), vo.getStaffId())); |
| | | BigDecimal violinFactor = factor == null ? ONE : nzDefault(factor.getViolinFactor(), ONE); |
| | | // 注意:getViolaFactor() 的列名是“中提琴”,但历史语义是【大提琴】折算率,勿改 |
| | | 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); |