Forráskód Böngészése

库存量改成液位的库存量

hfxc226 3 hete
szülő
commit
d31d13391d

+ 34 - 0
platform-service/src/main/java/com/platform/service/produce/impl/ProduceReportServiceImpl.java

@@ -768,7 +768,41 @@ public class ProduceReportServiceImpl extends BaseServiceImpl<ProduceReportMappe
         }
         this.modModelByPrimaryKey(danhaoMonth);
 
+        // 更新本月耗用和本年耗用
+        // 年累计
+        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);
     }
 
     /**

+ 9 - 8
platform-service/src/main/java/com/platform/service/util/FelParameterUtil.java

@@ -28,17 +28,18 @@ public class FelParameterUtil {
     private final static FelContext ctx = fel.getContext();
 
     public static void main(String[] args) throws IOException {
-        String expression = "(m3-m1)*100/m2";
+        String expression = "(3.14159*(4.8/2)*(4.8/2)*value/100*8.2)*1000*1.01";
         Map<String, Double> param = new HashMap<>();
-        param.put("m3", 110.0);
-        param.put("m1", 100.0);
-        param.put("m2", 10.0);
-        int scale = 4;
+        param.put("value", 52.56);
+        int scale = 2;
         String result = getResultFromMap(expression, param, scale);
         log.info(result);
-        String ss = "m₃";
-        String ssss = "₃";
-        System.out.println(ss.contains(ssss));
+
+        param.put("value", 51.69);
+        String result1 = getResultFromMap(expression, param, scale);
+        log.info(result1);
+
+
     }
 
     /**