|
@@ -659,7 +659,7 @@ public class ProduceReportServiceImpl extends BaseServiceImpl<ProduceReportMappe
|
|
.andEqualTo(ProduceReport::getYear, date.getYear())
|
|
.andEqualTo(ProduceReport::getYear, date.getYear())
|
|
.andEqualTo(ProduceReport::getMonth, date.getMonthValue()).andEqualTo(ProduceReport::getDate, date);
|
|
.andEqualTo(ProduceReport::getMonth, date.getMonthValue()).andEqualTo(ProduceReport::getDate, date);
|
|
ProduceReport report = mapper.selectOneByExample(weekend2);
|
|
ProduceReport report = mapper.selectOneByExample(weekend2);
|
|
- if (report != null) {// 说明存在了,是当日消耗,这个时候需要找到库存减去现在的数据就行了
|
|
|
|
|
|
+ if (report != null) {// 说明存在了,是当日消耗,这个时候需要找到库存减去现在的数据就行了,然后计算单日
|
|
ProduceReportDTO dto = BeanConverterUtil.copyObjectProperties(report, ProduceReportDTO.class);
|
|
ProduceReportDTO dto = BeanConverterUtil.copyObjectProperties(report, ProduceReportDTO.class);
|
|
// 数据除以1000,换算成吨
|
|
// 数据除以1000,换算成吨
|
|
total = total.divide(new BigDecimal(1000)).setScale(2, RoundingMode.HALF_UP);
|
|
total = total.divide(new BigDecimal(1000)).setScale(2, RoundingMode.HALF_UP);
|
|
@@ -675,6 +675,67 @@ public class ProduceReportServiceImpl extends BaseServiceImpl<ProduceReportMappe
|
|
total = new BigDecimal(reportStock.getValue()).subtract(total);
|
|
total = new BigDecimal(reportStock.getValue()).subtract(total);
|
|
dto.setValue(total.toString());
|
|
dto.setValue(total.toString());
|
|
this.modModelByDTO(dto);
|
|
this.modModelByDTO(dto);
|
|
|
|
+
|
|
|
|
+ // 每单当日单耗和977生产量,如果生产量为0,则当日单耗为0
|
|
|
|
+ Weekend<ProduceReport> weekendDanhao = new Weekend<>(ProduceReport.class);
|
|
|
|
+ WeekendCriteria<ProduceReport, Object> weekendCriteriaDanhao = weekendDanhao.weekendCriteria();
|
|
|
|
+ weekendCriteriaDanhao.andEqualTo(ProduceReport::getNo, "hy_" + no.replace("_hy", ""))
|
|
|
|
+ .andEqualTo(ProduceReport::getYear, date.getYear())
|
|
|
|
+ .andEqualTo(ProduceReport::getMonth, date.getMonthValue())
|
|
|
|
+ .andEqualTo(ProduceReport::getDay, date.getDayOfMonth())
|
|
|
|
+ .andEqualTo(ProduceReport::getDate, date);
|
|
|
|
+ ProduceReport danhao = mapper.selectOneByExample(weekendDanhao);
|
|
|
|
+
|
|
|
|
+ Weekend<ProduceReport> weekend977 = new Weekend<>(ProduceReport.class);
|
|
|
|
+ WeekendCriteria<ProduceReport, Object> weekendCriteria977 = weekend977.weekendCriteria();
|
|
|
|
+ weekendCriteria977.andEqualTo(ProduceReport::getNo, "scl_0600032")
|
|
|
|
+ .andEqualTo(ProduceReport::getYear, date.getYear())
|
|
|
|
+ .andEqualTo(ProduceReport::getMonth, date.getMonthValue())
|
|
|
|
+ .andEqualTo(ProduceReport::getDay, date.getDayOfMonth())
|
|
|
|
+ .andEqualTo(ProduceReport::getDate, date);
|
|
|
|
+ ProduceReport cs077 = mapper.selectOneByExample(weekend977);
|
|
|
|
+
|
|
|
|
+ if(StringUtils.isBlank(cs077.getValue()) || new BigDecimal(cs077.getValue()).compareTo(new BigDecimal(0))==0){
|
|
|
|
+ danhao.setValue("0");
|
|
|
|
+ }else{
|
|
|
|
+ danhao.setValue(total.divide(new BigDecimal(cs077.getValue())).setScale(2,RoundingMode.HALF_UP).toString());
|
|
|
|
+ }
|
|
|
|
+ this.modModelByPrimaryKey(danhao);
|
|
|
|
+
|
|
|
|
+ // 月均单耗=本月耗用/月累计产量,月均单耗和月产量977生产量,如果生产量为0,则单耗为0
|
|
|
|
+ Weekend<ProduceReport> weekendHyoMonth = new Weekend<>(ProduceReport.class);
|
|
|
|
+ WeekendCriteria<ProduceReport, Object> weekendCriteriaHyMonth = weekendHyoMonth.weekendCriteria();
|
|
|
|
+ weekendCriteriaHyMonth.andEqualTo(ProduceReport::getNo, "hy_" + no.replace("_hy", "_month"))
|
|
|
|
+ .andEqualTo(ProduceReport::getYear, date.getYear())
|
|
|
|
+ .andEqualTo(ProduceReport::getMonth, date.getMonthValue())
|
|
|
|
+ .andEqualTo(ProduceReport::getDay, date.getDayOfMonth())
|
|
|
|
+ .andEqualTo(ProduceReport::getDate, date);
|
|
|
|
+ ProduceReport danhaoMonth = mapper.selectOneByExample(weekendHyoMonth);
|
|
|
|
+
|
|
|
|
+ Weekend<ProduceReport> weekendDanhaoMonth = new Weekend<>(ProduceReport.class);
|
|
|
|
+ WeekendCriteria<ProduceReport, Object> weekendCriteriaDanhaoMonth = weekendDanhaoMonth.weekendCriteria();
|
|
|
|
+ weekendCriteriaDanhaoMonth.andEqualTo(ProduceReport::getNo, "dl_" + no.replace("_hy", "_hy_month"))
|
|
|
|
+ .andEqualTo(ProduceReport::getYear, date.getYear())
|
|
|
|
+ .andEqualTo(ProduceReport::getMonth, date.getMonthValue())
|
|
|
|
+ .andEqualTo(ProduceReport::getDay, date.getDayOfMonth())
|
|
|
|
+ .andEqualTo(ProduceReport::getDate, date);
|
|
|
|
+ ProduceReport month = mapper.selectOneByExample(weekendDanhaoMonth);
|
|
|
|
+
|
|
|
|
+ Weekend<ProduceReport> weekend977Month = new Weekend<>(ProduceReport.class);
|
|
|
|
+ WeekendCriteria<ProduceReport, Object> weekendCriteria977Month = weekend977Month.weekendCriteria();
|
|
|
|
+ weekendCriteria977Month.andEqualTo(ProduceReport::getNo, "scl_0600032_month")
|
|
|
|
+ .andEqualTo(ProduceReport::getYear, date.getYear())
|
|
|
|
+ .andEqualTo(ProduceReport::getMonth, date.getMonthValue())
|
|
|
|
+ .andEqualTo(ProduceReport::getDay, date.getDayOfMonth())
|
|
|
|
+ .andEqualTo(ProduceReport::getDate, date);
|
|
|
|
+ ProduceReport cs077Month = mapper.selectOneByExample(weekend977Month);
|
|
|
|
+
|
|
|
|
+ if(StringUtils.isBlank(cs077Month.getValue()) || new BigDecimal(cs077Month.getValue()).compareTo(new BigDecimal(0))==0){
|
|
|
|
+ danhaoMonth.setValue("0");
|
|
|
|
+ }else{
|
|
|
|
+ danhaoMonth.setValue(new BigDecimal(month.getValue()).divide(new BigDecimal(cs077Month.getValue())).setScale(2,RoundingMode.HALF_UP).toString());
|
|
|
|
+ }
|
|
|
|
+ this.modModelByPrimaryKey(danhaoMonth);
|
|
} else {
|
|
} else {
|
|
report = BeanConverterUtil.copyObjectProperties(produceData, ProduceReport.class);
|
|
report = BeanConverterUtil.copyObjectProperties(produceData, ProduceReport.class);
|
|
report.setDate(date);
|
|
report.setDate(date);
|