|
@@ -329,10 +329,10 @@ public class ProduceReportServiceImpl extends BaseServiceImpl<ProduceReportMappe
|
|
|
generateSCL("xiaoshou_", date, "lhn", ProduceRecordTypeEnum.XS_CK.getValue(), new BigDecimal(1));//氯化钠:手填,先生成0
|
|
|
|
|
|
// 库存数据
|
|
|
- generateStock(date, "0300027");//977:0300027,
|
|
|
- generateStock(date, "0300073");//氟化钠:0300073
|
|
|
- generateStock(date, "0300083");//锂渣:0300083
|
|
|
- generateStock(date, "lhn");//氯化钠:手填,先生成0
|
|
|
+ generateStock(date, "0300027", new BigDecimal(0.3));//977:0300027,
|
|
|
+ generateStock(date, "0300073", new BigDecimal(1));//氟化钠:0300073
|
|
|
+ generateStock(date, "0300083", new BigDecimal(1));//锂渣:0300083
|
|
|
+ generateStock(date, "lhn", new BigDecimal(1));//氯化钠:手填,先生成0
|
|
|
|
|
|
// 物料入库数据
|
|
|
generateRk(date, "0600032");//GS-902
|
|
@@ -707,157 +707,166 @@ public class ProduceReportServiceImpl extends BaseServiceImpl<ProduceReportMappe
|
|
|
* @param no
|
|
|
*/
|
|
|
private void generateHyAgain(LocalDate date, String prefix, String no) {
|
|
|
- ProduceData produceData = produceDataService.selectByNo(prefix + no);
|
|
|
+ try {
|
|
|
+ ProduceData produceData = produceDataService.selectByNo(prefix + no);
|
|
|
|
|
|
- // 找到当日耗用
|
|
|
- Weekend<ProduceReport> weekend = new Weekend<>(ProduceReport.class);
|
|
|
- WeekendCriteria<ProduceReport, Object> weekendCriteria = weekend.weekendCriteria();
|
|
|
- weekendCriteria.andEqualTo(ProduceReport::getDataId, produceData.getId())
|
|
|
- .andEqualTo(ProduceReport::getYear, date.getYear())
|
|
|
- .andEqualTo(ProduceReport::getMonth, date.getMonthValue()).andEqualTo(ProduceReport::getDate, date);
|
|
|
- ProduceReport report = mapper.selectOneByExample(weekend);
|
|
|
+ // 找到当日耗用
|
|
|
+ Weekend<ProduceReport> weekend = new Weekend<>(ProduceReport.class);
|
|
|
+ WeekendCriteria<ProduceReport, Object> weekendCriteria = weekend.weekendCriteria();
|
|
|
+ weekendCriteria.andEqualTo(ProduceReport::getDataId, produceData.getId())
|
|
|
+ .andEqualTo(ProduceReport::getYear, date.getYear())
|
|
|
+ .andEqualTo(ProduceReport::getMonth, date.getMonthValue()).andEqualTo(ProduceReport::getDate, date);
|
|
|
+ ProduceReport report = mapper.selectOneByExample(weekend);
|
|
|
|
|
|
- // 找到当日库存
|
|
|
- Weekend<ProduceReport> weekend2 = new Weekend<>(ProduceReport.class);
|
|
|
- WeekendCriteria<ProduceReport, Object> weekendCriteria2 = weekend2.weekendCriteria();
|
|
|
- weekendCriteria2.andEqualTo(ProduceReport::getNo, "hy_" + no.replace("_hy", "_stock"))
|
|
|
- .andEqualTo(ProduceReport::getYear, date.getYear())
|
|
|
- .andEqualTo(ProduceReport::getMonth, date.getMonthValue())
|
|
|
- .andEqualTo(ProduceReport::getDay, date.getDayOfMonth())
|
|
|
- .andEqualTo(ProduceReport::getDate, date);
|
|
|
- ProduceReport reportStock = mapper.selectOneByExample(weekend2);
|
|
|
+ // 找到当日库存
|
|
|
+ Weekend<ProduceReport> weekend2 = new Weekend<>(ProduceReport.class);
|
|
|
+ WeekendCriteria<ProduceReport, Object> weekendCriteria2 = weekend2.weekendCriteria();
|
|
|
+ weekendCriteria2.andEqualTo(ProduceReport::getNo, "hy_" + no.replace("_hy", "_stock"))
|
|
|
+ .andEqualTo(ProduceReport::getYear, date.getYear())
|
|
|
+ .andEqualTo(ProduceReport::getMonth, date.getMonthValue())
|
|
|
+ .andEqualTo(ProduceReport::getDay, date.getDayOfMonth())
|
|
|
+ .andEqualTo(ProduceReport::getDate, date);
|
|
|
+ ProduceReport reportStock = mapper.selectOneByExample(weekend2);
|
|
|
|
|
|
- // 找到前一天库存
|
|
|
- LocalDate preDate = date.plusDays(-1);
|
|
|
- Weekend<ProduceReport> weekend3 = new Weekend<>(ProduceReport.class);
|
|
|
- WeekendCriteria<ProduceReport, Object> weekendCriteria3 = weekend3.weekendCriteria();
|
|
|
- weekendCriteria3.andEqualTo(ProduceReport::getNo, "hy_" + no.replace("_hy", "_stock"))
|
|
|
- .andEqualTo(ProduceReport::getYear, preDate.getYear())
|
|
|
- .andEqualTo(ProduceReport::getMonth, preDate.getMonthValue())
|
|
|
- .andEqualTo(ProduceReport::getDay, preDate.getDayOfMonth())
|
|
|
- .andEqualTo(ProduceReport::getDate, preDate);
|
|
|
- ProduceReport reportStockPre = mapper.selectOneByExample(weekend3);
|
|
|
-
|
|
|
- // 找到当日入库
|
|
|
- Weekend<ProduceReport> weekend4 = new Weekend<>(ProduceReport.class);
|
|
|
- WeekendCriteria<ProduceReport, Object> weekendCriteria4 = weekend4.weekendCriteria();
|
|
|
- weekendCriteria4.andEqualTo(ProduceReport::getNo, "ck_" + no.replace("_hy", ""))
|
|
|
- .andEqualTo(ProduceReport::getYear, date.getYear())
|
|
|
- .andEqualTo(ProduceReport::getMonth, date.getMonthValue())
|
|
|
- .andEqualTo(ProduceReport::getDay, date.getDayOfMonth())
|
|
|
- .andEqualTo(ProduceReport::getDate, date);
|
|
|
- ProduceReport inStock = mapper.selectOneByExample(weekend4);
|
|
|
+ // 找到前一天库存
|
|
|
+ LocalDate preDate = date.plusDays(-1);
|
|
|
+ Weekend<ProduceReport> weekend3 = new Weekend<>(ProduceReport.class);
|
|
|
+ WeekendCriteria<ProduceReport, Object> weekendCriteria3 = weekend3.weekendCriteria();
|
|
|
+ weekendCriteria3.andEqualTo(ProduceReport::getNo, "hy_" + no.replace("_hy", "_stock"))
|
|
|
+ .andEqualTo(ProduceReport::getYear, preDate.getYear())
|
|
|
+ .andEqualTo(ProduceReport::getMonth, preDate.getMonthValue())
|
|
|
+ .andEqualTo(ProduceReport::getDay, preDate.getDayOfMonth())
|
|
|
+ .andEqualTo(ProduceReport::getDate, preDate);
|
|
|
+ ProduceReport reportStockPre = mapper.selectOneByExample(weekend3);
|
|
|
+
|
|
|
+ // 找到当日入库
|
|
|
+ Weekend<ProduceReport> weekend4 = new Weekend<>(ProduceReport.class);
|
|
|
+ WeekendCriteria<ProduceReport, Object> weekendCriteria4 = weekend4.weekendCriteria();
|
|
|
+ weekendCriteria4.andEqualTo(ProduceReport::getNo, "ck_" + no.replace("_hy", ""))
|
|
|
+ .andEqualTo(ProduceReport::getYear, date.getYear())
|
|
|
+ .andEqualTo(ProduceReport::getMonth, date.getMonthValue())
|
|
|
+ .andEqualTo(ProduceReport::getDay, date.getDayOfMonth())
|
|
|
+ .andEqualTo(ProduceReport::getDate, date);
|
|
|
+ ProduceReport inStock = mapper.selectOneByExample(weekend4);
|
|
|
|
|
|
- // 更新
|
|
|
- report.setValue(new BigDecimal(reportStockPre.getValue()).add(new BigDecimal(inStock.getValue())).subtract(new BigDecimal(reportStock.getValue())).toString());
|
|
|
- this.modModelByPrimaryKey(report);
|
|
|
+ // 更新
|
|
|
+ report.setValue(new BigDecimal(reportStockPre.getValue()).add(new BigDecimal(inStock.getValue())).subtract(new BigDecimal(reportStock.getValue())).toString());
|
|
|
+ this.modModelByPrimaryKey(report);
|
|
|
|
|
|
- // 重新计算当日单耗和月均单耗
|
|
|
- // 每单当日单耗和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);
|
|
|
-
|
|
|
- // 默认977
|
|
|
- String sclNo = "scl_0300027";
|
|
|
- BigDecimal rate = new BigDecimal(1);
|
|
|
- if (no.equals("0100010_hy") || no.equals("0100065_hy") || no.equals("0100120_hy") || no.equals("0100160_hy") || no.equals("0100086_hy")) {
|
|
|
- sclNo = "scl_0600032";// 902
|
|
|
- rate = new BigDecimal(1);
|
|
|
- }
|
|
|
- Weekend<ProduceReport> weekend977 = new Weekend<>(ProduceReport.class);
|
|
|
- WeekendCriteria<ProduceReport, Object> weekendCriteria977 = weekend977.weekendCriteria();
|
|
|
- weekendCriteria977.andEqualTo(ProduceReport::getNo, sclNo)
|
|
|
- .andEqualTo(ProduceReport::getYear, date.getYear())
|
|
|
- .andEqualTo(ProduceReport::getMonth, date.getMonthValue())
|
|
|
- .andEqualTo(ProduceReport::getDay, date.getDayOfMonth())
|
|
|
- .andEqualTo(ProduceReport::getDate, date);
|
|
|
- ProduceReport cs077 = mapper.selectOneByExample(weekend977);
|
|
|
+ // 重新计算当日单耗和月均单耗
|
|
|
+ // 每单当日单耗和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);
|
|
|
|
|
|
- if (StringUtils.isBlank(cs077.getValue()) || new BigDecimal(cs077.getValue()).compareTo(new BigDecimal(0)) == 0 || new BigDecimal(cs077.getValue()).compareTo(new BigDecimal(0)) == 0) {
|
|
|
- danhao.setValue("0");
|
|
|
- } else {
|
|
|
- danhao.setValue(new BigDecimal(report.getValue()).divide(new BigDecimal(cs077.getValue()).multiply(rate), RoundingMode.HALF_UP).setScale(2, RoundingMode.HALF_UP).toString());
|
|
|
- }
|
|
|
- this.modModelByPrimaryKey(danhao);
|
|
|
+ // 默认977
|
|
|
+ String sclNo = "scl_0300027";
|
|
|
+ BigDecimal rate = new BigDecimal(1);
|
|
|
+ if (no.equals("0100010_hy") || no.equals("0100065_hy") || no.equals("0100120_hy") || no.equals("0100160_hy") || no.equals("0100086_hy")) {
|
|
|
+ sclNo = "scl_0600032";// 902
|
|
|
+ rate = new BigDecimal(1);
|
|
|
+ }
|
|
|
+ Weekend<ProduceReport> weekend977 = new Weekend<>(ProduceReport.class);
|
|
|
+ WeekendCriteria<ProduceReport, Object> weekendCriteria977 = weekend977.weekendCriteria();
|
|
|
+ weekendCriteria977.andEqualTo(ProduceReport::getNo, sclNo)
|
|
|
+ .andEqualTo(ProduceReport::getYear, date.getYear())
|
|
|
+ .andEqualTo(ProduceReport::getMonth, date.getMonthValue())
|
|
|
+ .andEqualTo(ProduceReport::getDay, date.getDayOfMonth())
|
|
|
+ .andEqualTo(ProduceReport::getDate, date);
|
|
|
+ ProduceReport cs077 = mapper.selectOneByExample(weekend977);
|
|
|
|
|
|
- // 月均单耗=本月耗用/月累计产量,月均单耗和月产量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);
|
|
|
+ if (StringUtils.isBlank(cs077.getValue()) || new BigDecimal(cs077.getValue()).compareTo(new BigDecimal(0)) == 0 || new BigDecimal(cs077.getValue()).compareTo(new BigDecimal(0)) == 0) {
|
|
|
+ danhao.setValue("0");
|
|
|
+ } else {
|
|
|
+ danhao.setValue(new BigDecimal(report.getValue()).divide(new BigDecimal(cs077.getValue()).multiply(rate), RoundingMode.HALF_UP).setScale(2, RoundingMode.HALF_UP).toString());
|
|
|
+ }
|
|
|
+ this.modModelByPrimaryKey(danhao);
|
|
|
|
|
|
- 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);
|
|
|
+ // 月均单耗=本月耗用/月累计产量,月均单耗和月产量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> 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);
|
|
|
+ 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);
|
|
|
|
|
|
- // 更新本月耗用和本年耗用
|
|
|
- // 年累计
|
|
|
- ProduceReportDTO month1 = new ProduceReportDTO();
|
|
|
- month1.setDataId(produceData.getId());
|
|
|
- month1.setYear(date.getYear());
|
|
|
- ProduceReportVO yearVO = this.sumMonthYear(month1);
|
|
|
- log.info("yearVO.getTotalValue(): " + yearVO.getTotalValue());
|
|
|
-
|
|
|
- // 查找年
|
|
|
- ProduceReport yearReport = new ProduceReport();
|
|
|
- yearReport.setNo(prefix + no + "_year");
|
|
|
- yearReport.setDate(date);
|
|
|
- yearReport.setYear(date.getYear());
|
|
|
- yearReport = super.getModelListByModel(yearReport).get(0);
|
|
|
- yearReport.setValue(new BigDecimal(yearVO.getTotalValue()).setScale(2, RoundingMode.HALF_UP).toString());
|
|
|
- yearReport.setUpdateTime(LocalDateTime.now());
|
|
|
- yearReport.setUpdateUserId(SecurityUtils.getUserInfo().getUserId());
|
|
|
- mapper.updateByPrimaryKey(yearReport);
|
|
|
-
|
|
|
- // 本月耗用:更新
|
|
|
- month1.setMonth(date.getMonthValue());
|
|
|
- ProduceReportVO monthVO = this.sumMonthYear(month1);
|
|
|
- log.info("monthVO.getTotalValue(): " + monthVO.getTotalValue());
|
|
|
-
|
|
|
- // 查找月
|
|
|
- ProduceReport monthReport = new ProduceReport();
|
|
|
- monthReport.setNo(prefix + no + "_month");
|
|
|
- monthReport.setDate(date);
|
|
|
- monthReport.setYear(date.getYear());
|
|
|
- monthReport.setMonth(date.getMonthValue());
|
|
|
- monthReport = super.getModelListByModel(monthReport).get(0);
|
|
|
- monthReport.setValue(new BigDecimal(monthVO.getTotalValue()).setScale(2, RoundingMode.HALF_UP).toString());
|
|
|
- monthReport.setUpdateTime(LocalDateTime.now());
|
|
|
- monthReport.setUpdateUserId(SecurityUtils.getUserInfo().getUserId());
|
|
|
- mapper.updateByPrimaryKey(monthReport);
|
|
|
+ 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());
|
|
|
+ ProduceReportVO yearVO = this.sumMonthYear(month1);
|
|
|
+ log.info("yearVO.getTotalValue(): " + yearVO.getTotalValue());
|
|
|
+
|
|
|
+ // 查找年
|
|
|
+ ProduceReport yearReport = new ProduceReport();
|
|
|
+ yearReport.setNo(prefix + no + "_year");
|
|
|
+ yearReport.setDate(date);
|
|
|
+ yearReport.setYear(date.getYear());
|
|
|
+ yearReport = super.getModelListByModel(yearReport).get(0);
|
|
|
+ log.info(yearReport.toString());
|
|
|
+ yearReport.setValue(new BigDecimal(yearVO.getTotalValue()).setScale(2, RoundingMode.HALF_UP).toString());
|
|
|
+ yearReport.setUpdateTime(LocalDateTime.now());
|
|
|
+ yearReport.setUpdateUserId(SecurityUtils.getUserInfo().getUserId());
|
|
|
+ mapper.updateByPrimaryKey(yearReport);
|
|
|
+
|
|
|
+ // 本月耗用:更新
|
|
|
+ month1.setMonth(date.getMonthValue());
|
|
|
+ ProduceReportVO monthVO = this.sumMonthYear(month1);
|
|
|
+ log.info("monthVO.getTotalValue(): " + monthVO.getTotalValue());
|
|
|
+
|
|
|
+ // 查找月
|
|
|
+ ProduceReport monthReport = new ProduceReport();
|
|
|
+ monthReport.setNo(prefix + no + "_month");
|
|
|
+ monthReport.setDate(date);
|
|
|
+ monthReport.setYear(date.getYear());
|
|
|
+ monthReport.setMonth(date.getMonthValue());
|
|
|
+ monthReport = super.getModelListByModel(monthReport).get(0);
|
|
|
+ monthReport.setValue(new BigDecimal(monthVO.getTotalValue()).setScale(2, RoundingMode.HALF_UP).toString());
|
|
|
+ monthReport.setUpdateTime(LocalDateTime.now());
|
|
|
+ monthReport.setUpdateUserId(SecurityUtils.getUserInfo().getUserId());
|
|
|
+ mapper.updateByPrimaryKey(monthReport);
|
|
|
+ }catch(Exception e){
|
|
|
+ e.printStackTrace();
|
|
|
+ log.error(e.getStackTrace().toString());
|
|
|
+ log.error(e.getMessage());
|
|
|
+ log.error(e.getCause().getMessage());
|
|
|
+ log.error(e.getCause().toString());
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -960,8 +969,6 @@ public class ProduceReportServiceImpl extends BaseServiceImpl<ProduceReportMappe
|
|
|
this.modModelByDTO(dto);
|
|
|
|
|
|
// 库存量改成液位库存量
|
|
|
- log.info("total: " + total);
|
|
|
- log.info("reportStock: " + reportStock.toString());
|
|
|
reportStock.setValue(total.toString());
|
|
|
this.modModelByPrimaryKey(reportStock);
|
|
|
|
|
@@ -1026,8 +1033,6 @@ public class ProduceReportServiceImpl extends BaseServiceImpl<ProduceReportMappe
|
|
|
.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 {
|
|
@@ -1253,7 +1258,7 @@ public class ProduceReportServiceImpl extends BaseServiceImpl<ProduceReportMappe
|
|
|
ProduceReport yearReport = BeanConverterUtil.copyObjectProperties(yearData, ProduceReport.class);
|
|
|
yearReport.setDate(date);
|
|
|
yearReport.setDataId(yearData.getId());
|
|
|
- yearReport.setValue(yearVO.getTotalValue().divide(new BigDecimal(1000), 2, BigDecimal.ROUND_HALF_UP).toString());
|
|
|
+ yearReport.setValue(yearVO.getTotalValue().multiply(rate).divide(new BigDecimal(1000), 2, BigDecimal.ROUND_HALF_UP).toString());
|
|
|
yearReport.setYear(date.getYear());
|
|
|
yearReport.setMonth(date.getMonthValue());
|
|
|
yearReport.setDay(date.getDayOfMonth());
|
|
@@ -1268,7 +1273,7 @@ public class ProduceReportServiceImpl extends BaseServiceImpl<ProduceReportMappe
|
|
|
ProduceReport monthReport = BeanConverterUtil.copyObjectProperties(monthData, ProduceReport.class);
|
|
|
monthReport.setDate(date);
|
|
|
monthReport.setDataId(monthData.getId());
|
|
|
- monthReport.setValue(monthVO.getTotalValue().divide(new BigDecimal(1000), 2, BigDecimal.ROUND_HALF_UP).toString());
|
|
|
+ monthReport.setValue(monthVO.getTotalValue().multiply(rate).divide(new BigDecimal(1000), 2, BigDecimal.ROUND_HALF_UP).toString());
|
|
|
monthReport.setYear(date.getYear());
|
|
|
monthReport.setMonth(date.getMonthValue());
|
|
|
monthReport.setDay(date.getDayOfMonth());
|
|
@@ -1319,7 +1324,7 @@ public class ProduceReportServiceImpl extends BaseServiceImpl<ProduceReportMappe
|
|
|
* <p>
|
|
|
* 氯化钠:0300094:手填
|
|
|
*/
|
|
|
- public void generateStock(LocalDate date, String no) {
|
|
|
+ public void generateStock(LocalDate date, String no, BigDecimal rate) {
|
|
|
String prefix = "stock_";
|
|
|
// 统计当天数据,累加
|
|
|
ProduceRecordDTO dto = new ProduceRecordDTO();
|
|
@@ -1339,7 +1344,7 @@ public class ProduceReportServiceImpl extends BaseServiceImpl<ProduceReportMappe
|
|
|
ProduceReport monthReport = BeanConverterUtil.copyObjectProperties(data, ProduceReport.class);
|
|
|
monthReport.setDate(date);
|
|
|
monthReport.setDataId(data.getId());
|
|
|
- monthReport.setValue(new BigDecimal(total.toString()).divide(new BigDecimal(1000), 2, BigDecimal.ROUND_HALF_UP).toString());
|
|
|
+ monthReport.setValue(new BigDecimal(total.toString()).multiply(rate).divide(new BigDecimal(1000), 2, BigDecimal.ROUND_HALF_UP).toString());
|
|
|
monthReport.setYear(date.getYear());
|
|
|
monthReport.setMonth(date.getMonthValue());
|
|
|
monthReport.setDay(date.getDayOfMonth());
|