|
|
@ -9,6 +9,7 @@ import java.time.format.DateTimeFormatter;
|
|
|
|
import java.util.*;
|
|
|
|
import java.util.*;
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import com.alibaba.csp.sentinel.util.StringUtil;
|
|
|
|
import com.alibaba.fastjson2.JSONArray;
|
|
|
|
import com.alibaba.fastjson2.JSONArray;
|
|
|
|
import com.alibaba.fastjson2.JSONObject;
|
|
|
|
import com.alibaba.fastjson2.JSONObject;
|
|
|
|
import com.baomidou.dynamic.datasource.annotation.DS;
|
|
|
|
import com.baomidou.dynamic.datasource.annotation.DS;
|
|
|
@ -424,9 +425,9 @@ public class MesReportWorkServiceImpl implements IMesReportWorkService {
|
|
|
|
|
|
|
|
|
|
|
|
quantityDto.setWorkorderCode(workorderCode);
|
|
|
|
quantityDto.setWorkorderCode(workorderCode);
|
|
|
|
quantityDto.setMachineCode(machineCode);
|
|
|
|
quantityDto.setMachineCode(machineCode);
|
|
|
|
QuantityDto realQuantity = mesReportWorkMapper.getRealQuantity(quantityDto);
|
|
|
|
QuantityDto parentMesReport = mesReportWorkMapper.getRealQuantity(quantityDto);
|
|
|
|
List<QuantityDto> sumQuantityList = mesReportWorkMapper.getSumQuantity(quantityDto);
|
|
|
|
List<QuantityDto> sonMesReportList = mesReportWorkMapper.getSumQuantity(quantityDto);
|
|
|
|
QuantityDto sumQuantity = sumQuantityList.stream().max(Comparator.comparingLong(QuantityDto::getUseMan)).orElse(null);
|
|
|
|
QuantityDto sonMesReport = sonMesReportList.stream().max(Comparator.comparingLong(QuantityDto::getUseMan)).orElse(null);
|
|
|
|
|
|
|
|
|
|
|
|
// 产量
|
|
|
|
// 产量
|
|
|
|
Long sumQua = 0L;
|
|
|
|
Long sumQua = 0L;
|
|
|
@ -436,27 +437,29 @@ public class MesReportWorkServiceImpl implements IMesReportWorkService {
|
|
|
|
BigDecimal workTime = BigDecimal.ZERO;
|
|
|
|
BigDecimal workTime = BigDecimal.ZERO;
|
|
|
|
// 实际用人
|
|
|
|
// 实际用人
|
|
|
|
Long useMan = 0L;
|
|
|
|
Long useMan = 0L;
|
|
|
|
if (realQuantity != null && sumQuantity != null) {
|
|
|
|
if (sonMesReport != null && sonMesReport != null) {
|
|
|
|
sumQua = sumQuantity.getQuantityFeedbackSum();
|
|
|
|
sumQua = sonMesReport.getQuantityFeedbackSum();
|
|
|
|
realQua = realQuantity.getQuantityFeedbackSum();
|
|
|
|
realQua = parentMesReport.getQuantityFeedbackSum();
|
|
|
|
workTime = sumQuantity.getWorkTime();
|
|
|
|
workTime = sonMesReport.getWorkTime();
|
|
|
|
useMan = sumQuantity.getUseMan();
|
|
|
|
useMan = sonMesReport.getUseMan();
|
|
|
|
dto.setQuantityAct(String.valueOf(sumQua));
|
|
|
|
dto.setQuantityAct(String.valueOf(sumQua));
|
|
|
|
dto.setQuantityFeedback(String.valueOf(realQua));
|
|
|
|
dto.setQuantityFeedback(String.valueOf(realQua));
|
|
|
|
dto.setWorkTime(workTime);
|
|
|
|
dto.setWorkTime(workTime);
|
|
|
|
dto.setManStandard(useMan.toString());
|
|
|
|
//实际用人
|
|
|
|
|
|
|
|
dto.setUseMan(useMan);
|
|
|
|
// 计算规格
|
|
|
|
// 计算规格
|
|
|
|
dto.setSpec(sumQua / realQua);
|
|
|
|
//dto.setSpec(sumQua / realQua);
|
|
|
|
// 订单完成率 实际产量/计划产量
|
|
|
|
// 订单完成率 实际产量/计划产量
|
|
|
|
BigDecimal completeRate = new BigDecimal(realQua)
|
|
|
|
BigDecimal completeRate = new BigDecimal(realQua)
|
|
|
|
.multiply(new BigDecimal("100.00"))
|
|
|
|
.multiply(new BigDecimal("100.00"))
|
|
|
|
.divide(new BigDecimal(dto.getQuantitySplit()),2,BigDecimal.ROUND_HALF_UP);
|
|
|
|
.divide(new BigDecimal(dto.getQuantitySplit()),2,BigDecimal.ROUND_HALF_UP);
|
|
|
|
dto.setCompleteRate(completeRate.toString()+"%");
|
|
|
|
dto.setCompleteRate(completeRate.toString()+"%");
|
|
|
|
// 标准工时 产量/产线标准效率
|
|
|
|
//标准工时=母单数量*规格/产线标准效率
|
|
|
|
BigDecimal workTimeStandard = new BigDecimal(sumQua)
|
|
|
|
BigDecimal workTimeStandard = new BigDecimal(realQua)
|
|
|
|
.divide(dto.getEfficiency(),1,BigDecimal.ROUND_HALF_UP);
|
|
|
|
.multiply(new BigDecimal(dto.getSpec()))
|
|
|
|
|
|
|
|
.divide(dto.getEfficiency(),2,BigDecimal.ROUND_HALF_UP);
|
|
|
|
dto.setWorkTimeStandard(workTimeStandard.toString());
|
|
|
|
dto.setWorkTimeStandard(workTimeStandard.toString());
|
|
|
|
|
|
|
|
|
|
|
|
// 产线效率 标准工时/实际工时
|
|
|
|
// 产线效率 标准工时/实际工时
|
|
|
|
BigDecimal productivity = workTimeStandard
|
|
|
|
BigDecimal productivity = workTimeStandard
|
|
|
|
.multiply(new BigDecimal("100.00"))
|
|
|
|
.multiply(new BigDecimal("100.00"))
|
|
|
@ -468,17 +471,17 @@ public class MesReportWorkServiceImpl implements IMesReportWorkService {
|
|
|
|
dto.setTotalWorkTime(totalWorkTime.toString());
|
|
|
|
dto.setTotalWorkTime(totalWorkTime.toString());
|
|
|
|
// 标准人均效率 实际产量/标准用人/标准工时
|
|
|
|
// 标准人均效率 实际产量/标准用人/标准工时
|
|
|
|
BigDecimal manAvgStandard = new BigDecimal(realQua)
|
|
|
|
BigDecimal manAvgStandard = new BigDecimal(realQua)
|
|
|
|
.divide(new BigDecimal(dto.getUseMan()),2,BigDecimal.ROUND_HALF_UP)
|
|
|
|
.divide(new BigDecimal(dto.getManStandard()),4,BigDecimal.ROUND_HALF_UP)
|
|
|
|
.divide(workTimeStandard,2,BigDecimal.ROUND_HALF_UP);
|
|
|
|
.divide(workTimeStandard,2,BigDecimal.ROUND_HALF_UP);
|
|
|
|
dto.setManAvgStandard(manAvgStandard.toString());
|
|
|
|
dto.setManAvgStandard(manAvgStandard.toString());
|
|
|
|
// 实际人均效率 实际产量/总工时
|
|
|
|
// 实际人均效率 实际产量/总工时
|
|
|
|
BigDecimal manAvgActual = new BigDecimal(realQua)
|
|
|
|
BigDecimal manAvgActual = new BigDecimal(realQua)
|
|
|
|
.divide(totalWorkTime,2,BigDecimal.ROUND_HALF_UP);
|
|
|
|
.divide(totalWorkTime,2,BigDecimal.ROUND_HALF_UP);
|
|
|
|
dto.setManAvgActual(manAvgActual.toString());
|
|
|
|
dto.setManAvgActual(manAvgActual.toString());
|
|
|
|
// 人均效率达成率 标准人均效率/实际人均效率
|
|
|
|
// 人均效率达成率 实际人均效率/标准人均效率
|
|
|
|
BigDecimal manAvgDo = manAvgStandard
|
|
|
|
BigDecimal manAvgDo = manAvgActual
|
|
|
|
.multiply(new BigDecimal("100.00"))
|
|
|
|
.multiply(new BigDecimal("100.00"))
|
|
|
|
.divide(manAvgActual,2,BigDecimal.ROUND_HALF_UP);
|
|
|
|
.divide(manAvgStandard,2,BigDecimal.ROUND_HALF_UP);
|
|
|
|
dto.setManAvgDo(manAvgDo.toString()+"%");
|
|
|
|
dto.setManAvgDo(manAvgDo.toString()+"%");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|