Lius
2025-05-15 5d5675fd6b6521c3d3e5887017a090c60897f6cd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
package org.jeecg.modules.mdcJc.service.impl;
 
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.dynamic.datasource.toolkit.DynamicDataSourceContextHolder;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.modules.mdcJc.dto.MesRcJobreport;
import org.jeecg.modules.mdcJc.entity.MdcJcRcJobreport;
import org.jeecg.modules.mdcJc.mapper.MdcJcRcJobreportMapper;
import org.jeecg.modules.mdcJc.service.IMdcJcRcJobreportService;
import org.springframework.stereotype.Service;
 
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.List;
 
/**
 * @Description: 设备集成mes合格率表
 * @Author: Lius
 * @Date:   2025-04-14
 */
@Service
@Slf4j
public class MdcJcRcJobreportServiceImpl extends ServiceImpl<MdcJcRcJobreportMapper, MdcJcRcJobreport> implements IMdcJcRcJobreportService {
 
    @Override
    public Integer selectTotalProcessCount(String equipmentId, String validDate) {
        Integer totalProcessCount = this.baseMapper.selectTotalProcessCount(equipmentId, validDate);
        if (totalProcessCount == null) {
            return 0;
        } else {
            return totalProcessCount;
        }
    }
 
    @Override
    public Integer selectTotalPassCount(String equipmentId, String validDate) {
        Integer totalPassCount = this.baseMapper.selectTotalPassCount(equipmentId, validDate);
        if (totalPassCount == null) {
            return 0;
        } else {
            return totalPassCount;
        }
    }
 
    @Override
    public BigDecimal findRateByMonth(String equipmentId, String month) {
        BigDecimal rate = new BigDecimal("100");
        MesRcJobreport mesRcJobreport = this.baseMapper.findRateByMonth(equipmentId, month);
        if (mesRcJobreport != null && mesRcJobreport.getQty().compareTo(BigDecimal.ZERO) > 0) {
            rate = mesRcJobreport.getOkuqty().multiply(new BigDecimal("100")).divide(mesRcJobreport.getQty(), 2, RoundingMode.HALF_UP);
        }
        return rate;
    }
 
}