瀏覽代碼

库存量改成液位的库存量

hfxc226 3 周之前
父節點
當前提交
08f2cd1d66

+ 1 - 0
platform-service/src/main/java/com/platform/service/produce/ProduceReportService.java

@@ -4,6 +4,7 @@ import com.platform.common.bean.AbstractPageResultBean;
 import com.platform.dao.dto.produce.ProduceRecordDTO;
 import com.platform.dao.dto.produce.ProduceReportDTO;
 import com.platform.dao.entity.produce.ProduceReport;
+import com.platform.dao.vo.query.produce.ProduceRecordVO;
 import com.platform.dao.vo.query.produce.ProduceReportTianVO;
 import com.platform.dao.vo.query.produce.ProduceReportVO;
 import com.platform.service.base.IBaseService;

+ 31 - 36
platform-service/src/main/java/com/platform/service/produce/impl/ProduceReportServiceImpl.java

@@ -204,7 +204,6 @@ public class ProduceReportServiceImpl extends BaseServiceImpl<ProduceReportMappe
                 || model.getNo().equals("dl_河水")) {
             // 当日耗用,自动计算:本月耗用,本年耗用
             // 本年耗用:更新
-            ProduceData yearData = produceDataService.selectByNo(model.getNo() + "_year");
             ProduceReportDTO month = new ProduceReportDTO();
             month.setDataId(model.getDataId());
             month.setYear(model.getYear());
@@ -222,10 +221,9 @@ public class ProduceReportServiceImpl extends BaseServiceImpl<ProduceReportMappe
             mapper.updateByPrimaryKey(yearReport);
 
             // 本月耗用:更新
-            ProduceData monthData = produceDataService.selectByNo(model.getNo() + "_month");
             month.setMonth(model.getMonth());
             ProduceReportVO monthVO = this.sumMonthYear(month);
-            // 查找
+            // 查找
             ProduceReport monthReport = new ProduceReport();
             monthReport.setNo(model.getNo() + "_month");
             monthReport.setDate(model.getDate());
@@ -770,39 +768,36 @@ public class ProduceReportServiceImpl extends BaseServiceImpl<ProduceReportMappe
 
         // 更新本月耗用和本年耗用
         // 年累计
-        ProduceRecordDTO month1 = new ProduceRecordDTO();
-        month1.setProductNo(prefix + no);
-        month1.setDateStart(DateUtils.getFirstDayOfThisYear(date.getYear()));
-        month1.setDateEnd(DateUtils.getLastDayOfThisYear(date.getYear()));
-        month1.setType(ProduceRecordTypeEnum.CL_CK.getValue());
-        ProduceRecordVO yearVO = produceRecordService.sumMonthYear(month1);
-
-        Weekend<ProduceReport> year = new Weekend<>(ProduceReport.class);
-        WeekendCriteria<ProduceReport, Object> weekendCriteriaYear = year.weekendCriteria();
-        weekendCriteriaYear.andEqualTo(ProduceReport::getNo, prefix + no + "_year")
-                .andEqualTo(ProduceReport::getYear, date.getYear())
-                .andEqualTo(ProduceReport::getMonth, date.getMonthValue())
-                .andEqualTo(ProduceReport::getDay, date.getDayOfMonth())
-                .andEqualTo(ProduceReport::getDate, date);
-        ProduceReport yearReport = mapper.selectOneByExample(year);
-        yearReport.setValue(yearVO.getTotalValue().toString());
-        this.modModelByPrimaryKey(yearReport);
-
-        // 月累计
-        month1.setDateStart(DateUtils.getFirstDayOfMonth(date));
-        month1.setDateEnd(DateUtils.getLastDayOfMonth(date));
-        ProduceRecordVO monthVO = produceRecordService.sumMonthYear(month1);
-
-        Weekend<ProduceReport> monthValue = new Weekend<>(ProduceReport.class);
-        WeekendCriteria<ProduceReport, Object> weekendCriteriaMonth = monthValue.weekendCriteria();
-        weekendCriteriaMonth.andEqualTo(ProduceReport::getNo, prefix + no + "_year")
-                .andEqualTo(ProduceReport::getYear, date.getYear())
-                .andEqualTo(ProduceReport::getMonth, date.getMonthValue())
-                .andEqualTo(ProduceReport::getDay, date.getDayOfMonth())
-                .andEqualTo(ProduceReport::getDate, date);
-        ProduceReport monthReport = mapper.selectOneByExample(monthValue);
-        monthReport.setValue(monthVO.getTotalValue().toString());
-        this.modModelByPrimaryKey(monthReport);
+        ProduceReportDTO month1 = new ProduceReportDTO();
+        month1.setDataId(produceData.getId());
+        month1.setYear(date.getYear());
+        ProduceReportVO yearVO = this.sumMonthYear(month1);
+
+        // 查找年
+        ProduceReport yearReport = new ProduceReport();
+        yearReport.setNo(prefix + no + "_year");
+        yearReport.setDate(date);
+        yearReport.setYear(date.getYear());
+        yearReport = super.getModelListByModel(yearReport).get(0);
+        yearReport.setValue(yearVO.getTotalValue());
+        yearReport.setUpdateTime(LocalDateTime.now());
+        yearReport.setUpdateUserId(SecurityUtils.getUserInfo().getUserId());
+        mapper.updateByPrimaryKey(yearReport);
+
+        // 本月耗用:更新
+        month1.setMonth(date.getMonthValue());
+        ProduceReportVO monthVO = this.sumMonthYear(month1);
+        // 查找月
+        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(monthVO.getTotalValue());
+        monthReport.setUpdateTime(LocalDateTime.now());
+        monthReport.setUpdateUserId(SecurityUtils.getUserInfo().getUserId());
+        mapper.updateByPrimaryKey(monthReport);
     }
 
     /**