|
@@ -210,6 +210,8 @@ public class ProduceReportServiceImpl extends BaseServiceImpl<ProduceReportMappe
|
|
|
ProduceReportDTO month = new ProduceReportDTO();
|
|
|
month.setDataId(model.getDataId());
|
|
|
month.setYear(model.getYear());
|
|
|
+ month.setDateStart(DateUtils.getFirstDayOfThisYear(model.getYear()).toLocalDate());
|
|
|
+ month.setDateEnd(model.getDate());
|
|
|
ProduceReportVO yearVO = this.sumMonthYear(month);
|
|
|
|
|
|
// 查找年
|
|
@@ -225,6 +227,8 @@ public class ProduceReportServiceImpl extends BaseServiceImpl<ProduceReportMappe
|
|
|
|
|
|
// 本月耗用:更新
|
|
|
month.setMonth(model.getMonth());
|
|
|
+ month.setDateStart(DateUtils.getFirstDayOfMonth(model.getDate()).toLocalDate());
|
|
|
+ month.setDateEnd(model.getDate());
|
|
|
ProduceReportVO monthVO = this.sumMonthYear(month);
|
|
|
// 查找月
|
|
|
ProduceReport monthReport = new ProduceReport();
|
|
@@ -263,6 +267,8 @@ public class ProduceReportServiceImpl extends BaseServiceImpl<ProduceReportMappe
|
|
|
month.setDataId(model.getDataId());
|
|
|
month.setYear(date.getYear());
|
|
|
month.setMonth(date.getMonthValue());
|
|
|
+ month.setDateStart(DateUtils.getFirstDayOfMonth(model.getMonth()).toLocalDate());
|
|
|
+ month.setDateEnd(model.getDate());
|
|
|
ProduceReportVO monthVO = this.sumMonthYear(month);
|
|
|
monthReport.setValue(monthVO.getTotalValue());
|
|
|
this.modModelByDTOWithNotLogin(BeanConverterUtil.copyObjectProperties(monthReport, ProduceReportDTO.class));
|
|
@@ -274,6 +280,8 @@ public class ProduceReportServiceImpl extends BaseServiceImpl<ProduceReportMappe
|
|
|
yearReport.setMonth(model.getMonth());
|
|
|
yearReport = super.getModelListByModel(yearReport).get(0);
|
|
|
month.setMonth(null);
|
|
|
+ month.setDateStart(DateUtils.getFirstDayOfThisYear(model.getYear()).toLocalDate());
|
|
|
+ month.setDateEnd(model.getDate());
|
|
|
ProduceReportVO yearVO = this.sumMonthYear(month);
|
|
|
yearReport.setValue(yearVO.getTotalValue());
|
|
|
this.modModelByDTOWithNotLogin(BeanConverterUtil.copyObjectProperties(yearReport, ProduceReportDTO.class));
|
|
@@ -479,6 +487,8 @@ public class ProduceReportServiceImpl extends BaseServiceImpl<ProduceReportMappe
|
|
|
ProduceReportDTO month = new ProduceReportDTO();
|
|
|
month.setDataId(produceData.getId());
|
|
|
month.setYear(date.getYear());
|
|
|
+ month.setDateStart(DateUtils.getFirstDayOfThisYear(date.getYear()).toLocalDate());
|
|
|
+ month.setDateEnd(date);
|
|
|
ProduceReportVO yearVO = this.sumMonthYear(month);
|
|
|
|
|
|
produceData = produceDataService.selectByNo(prefix + no + "_hy_year");
|
|
@@ -495,6 +505,8 @@ public class ProduceReportServiceImpl extends BaseServiceImpl<ProduceReportMappe
|
|
|
|
|
|
// 本月耗用
|
|
|
month.setMonth(date.getMonthValue());
|
|
|
+ month.setDateStart(DateUtils.getFirstDayOfMonth(date).toLocalDate());
|
|
|
+ month.setDateEnd(date);
|
|
|
ProduceReportVO monthVO = this.sumMonthYear(month);
|
|
|
produceData = produceDataService.selectByNo(prefix + no + "_hy_month");
|
|
|
report = BeanConverterUtil.copyObjectProperties(produceData, ProduceReport.class);
|
|
@@ -602,7 +614,7 @@ public class ProduceReportServiceImpl extends BaseServiceImpl<ProduceReportMappe
|
|
|
param.put("a3", a3.doubleValue());
|
|
|
generateYeweiTotalReport(date, param);
|
|
|
|
|
|
- // 计算当日库存,当日库存=液位
|
|
|
+ // 计算液位,当日耗用=液位
|
|
|
generateYeweiReport(date, "ck_", "0100087_hy", SysConfigEnum.PRODUCE_YEWEI_903_HY.name());// 903
|
|
|
generateYeweiReport(date, "ck_", "0100083_hy", SysConfigEnum.PRODUCE_YEWEI_905_HY.name());// 905
|
|
|
generateYeweiReport(date, "ck_", "0100003_hy", SysConfigEnum.PRODUCE_YEWEI_907_HY.name());// 907
|
|
@@ -613,7 +625,7 @@ public class ProduceReportServiceImpl extends BaseServiceImpl<ProduceReportMappe
|
|
|
generateYeweiReport(date, "ck_", "0100160_hy", SysConfigEnum.PRODUCE_YEWEI_YJ_HY.name());// 液碱
|
|
|
generateYeweiReport(date, "ck_", "0100086_hy", SysConfigEnum.PRODUCE_YEWEI_YS_HY.name());// 盐酸
|
|
|
|
|
|
- // 当日耗用
|
|
|
+ // 库存量=当日液位
|
|
|
generateYWLStock(date, "ck_", "0100087_hy", SysConfigEnum.PRODUCE_YEWEI_903_HY.name());// 903
|
|
|
generateYWLStock(date, "ck_", "0100083_hy", SysConfigEnum.PRODUCE_YEWEI_905_HY.name());// 905
|
|
|
generateYWLStock(date, "ck_", "0100003_hy", SysConfigEnum.PRODUCE_YEWEI_907_HY.name());// 907
|
|
@@ -804,48 +816,13 @@ public class ProduceReportServiceImpl extends BaseServiceImpl<ProduceReportMappe
|
|
|
}
|
|
|
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);
|
|
|
-
|
|
|
- log.info("no: " + no);
|
|
|
- Weekend<ProduceReport> weekendDanhaoMonth = new Weekend<>(ProduceReport.class);
|
|
|
- WeekendCriteria<ProduceReport, Object> weekendCriteriaDanhaoMonth = weekendDanhaoMonth.weekendCriteria();
|
|
|
- weekendCriteriaDanhaoMonth.andEqualTo(ProduceReport::getNo, "ck_" + 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, sclNo + "_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);
|
|
|
- log.info("month: " + month.getValue());
|
|
|
- log.info("cs077Month: " + cs077Month.getValue());
|
|
|
- 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()).multiply(rate), RoundingMode.HALF_UP).setScale(2, RoundingMode.HALF_UP).toString());
|
|
|
- }
|
|
|
- this.modModelByPrimaryKey(danhaoMonth);
|
|
|
-
|
|
|
// 更新本月耗用和本年耗用
|
|
|
// 年累计
|
|
|
ProduceReportDTO month1 = new ProduceReportDTO();
|
|
|
month1.setDataId(produceData.getId());
|
|
|
month1.setYear(date.getYear());
|
|
|
+ month1.setDateStart(DateUtils.getFirstDayOfThisYear(date.getYear()).toLocalDate());
|
|
|
+ month1.setDateEnd(date);
|
|
|
ProduceReportVO yearVO = this.sumMonthYear(month1);
|
|
|
log.info("yearVO.getTotalValue(): " + yearVO.getTotalValue());
|
|
|
|
|
@@ -863,6 +840,8 @@ public class ProduceReportServiceImpl extends BaseServiceImpl<ProduceReportMappe
|
|
|
|
|
|
// 本月耗用:更新
|
|
|
month1.setMonth(date.getMonthValue());
|
|
|
+ month1.setDateStart(DateUtils.getFirstDayOfMonth(date).toLocalDate());
|
|
|
+ month1.setDateEnd(date);
|
|
|
ProduceReportVO monthVO = this.sumMonthYear(month1);
|
|
|
log.info("monthVO.getTotalValue(): " + monthVO.getTotalValue());
|
|
|
|
|
@@ -877,6 +856,43 @@ public class ProduceReportServiceImpl extends BaseServiceImpl<ProduceReportMappe
|
|
|
monthReport.setUpdateTime(LocalDateTime.now());
|
|
|
monthReport.setUpdateUserId(SecurityUtils.getUserInfo().getUserId());
|
|
|
mapper.updateByPrimaryKey(monthReport);
|
|
|
+
|
|
|
+ // 月均单耗=本月耗用/月累计产量,月均单耗和月产量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);
|
|
|
+
|
|
|
+ log.info("no: " + no);
|
|
|
+ Weekend<ProduceReport> weekendDanhaoMonth = new Weekend<>(ProduceReport.class);
|
|
|
+ WeekendCriteria<ProduceReport, Object> weekendCriteriaDanhaoMonth = weekendDanhaoMonth.weekendCriteria();
|
|
|
+ weekendCriteriaDanhaoMonth.andEqualTo(ProduceReport::getNo, "ck_" + 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, sclNo + "_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);
|
|
|
+ log.info("month: " + month.getValue());
|
|
|
+ log.info("cs077Month: " + cs077Month.getValue());
|
|
|
+ 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()).multiply(rate), RoundingMode.HALF_UP).setScale(2, RoundingMode.HALF_UP).toString());
|
|
|
+ }
|
|
|
+ this.modModelByPrimaryKey(danhaoMonth);
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
log.error(e.getStackTrace().toString());
|
|
@@ -1262,7 +1278,7 @@ public class ProduceReportServiceImpl extends BaseServiceImpl<ProduceReportMappe
|
|
|
ProduceRecordDTO month = new ProduceRecordDTO();
|
|
|
month.setProductNo(no);
|
|
|
month.setDateStart(DateUtils.getFirstDayOfThisYear(date.getYear()));
|
|
|
- month.setDateEnd(DateUtils.getLastDayOfThisYear(date.getYear()));
|
|
|
+ month.setDateEnd(date.atTime(23,59,59));
|
|
|
month.setType(type);
|
|
|
ProduceRecordVO yearVO = produceRecordService.sumMonthYear(month);
|
|
|
ProduceData yearData = produceDataService.selectByNo(prefix + no + "_year");
|
|
@@ -1278,7 +1294,7 @@ public class ProduceReportServiceImpl extends BaseServiceImpl<ProduceReportMappe
|
|
|
|
|
|
// 月累计
|
|
|
month.setDateStart(DateUtils.getFirstDayOfMonth(date));
|
|
|
- month.setDateEnd(DateUtils.getLastDayOfMonth(date));
|
|
|
+ month.setDateEnd(date.atTime(23,59,59));
|
|
|
ProduceRecordVO monthVO = produceRecordService.sumMonthYear(month);
|
|
|
ProduceData monthData = produceDataService.selectByNo(prefix + no + "_month");
|
|
|
ProduceReport monthReport = BeanConverterUtil.copyObjectProperties(monthData, ProduceReport.class);
|
|
@@ -1456,7 +1472,7 @@ public class ProduceReportServiceImpl extends BaseServiceImpl<ProduceReportMappe
|
|
|
ProduceRecordDTO month = new ProduceRecordDTO();
|
|
|
month.setProductNo(no);
|
|
|
month.setDateStart(DateUtils.getFirstDayOfThisYear(date.getYear()));
|
|
|
- month.setDateEnd(DateUtils.getLastDayOfThisYear(date.getYear()));
|
|
|
+ month.setDateEnd(date.atTime(23,59,59));
|
|
|
month.setType(ProduceRecordTypeEnum.CL_CK.getValue());
|
|
|
ProduceRecordVO yearVO = produceRecordService.sumMonthYear(month);
|
|
|
ProduceData yearData = produceDataService.selectByNo(prefix + no + "_hy" + "_year");
|
|
@@ -1476,7 +1492,7 @@ public class ProduceReportServiceImpl extends BaseServiceImpl<ProduceReportMappe
|
|
|
|
|
|
// 月累计
|
|
|
month.setDateStart(DateUtils.getFirstDayOfMonth(date));
|
|
|
- month.setDateEnd(DateUtils.getLastDayOfMonth(date));
|
|
|
+ month.setDateEnd(date.atTime(23,59,59));
|
|
|
ProduceRecordVO monthVO = produceRecordService.sumMonthYear(month);
|
|
|
ProduceData monthData = produceDataService.selectByNo(prefix + no + "_hy" + "_month");
|
|
|
ProduceReport monthReport = BeanConverterUtil.copyObjectProperties(monthData, ProduceReport.class);
|