From 21fde820e495c08cfa0ba277685468baa5bf9118 Mon Sep 17 00:00:00 2001
From: 懒羊羊 <15939171744@163.com>
Date: 星期三, 13 十二月 2023 10:27:42 +0800
Subject: [PATCH] OPC

---
 guns-vip-main/src/main/java/cn/stylefeng/guns/modular/kb/greaseBoard/GreaseBoardController.java |   24 +++++++++++++++++++++++-
 1 files changed, 23 insertions(+), 1 deletions(-)

diff --git a/guns-vip-main/src/main/java/cn/stylefeng/guns/modular/kb/greaseBoard/GreaseBoardController.java b/guns-vip-main/src/main/java/cn/stylefeng/guns/modular/kb/greaseBoard/GreaseBoardController.java
index 5f2ea61..c3692c6 100644
--- a/guns-vip-main/src/main/java/cn/stylefeng/guns/modular/kb/greaseBoard/GreaseBoardController.java
+++ b/guns-vip-main/src/main/java/cn/stylefeng/guns/modular/kb/greaseBoard/GreaseBoardController.java
@@ -3,11 +3,13 @@
 import cn.stylefeng.guns.base.pojo.page.LayuiPageInfo;
 import cn.stylefeng.guns.modular.gm.greaseManage.entity.GreaseManage;
 import cn.stylefeng.guns.modular.gm.greaseManage.model.params.GreaseManageParam;
+import cn.stylefeng.guns.modular.gm.greaseManage.model.result.GreaseManageResult;
 import cn.stylefeng.guns.modular.gm.greaseManage.service.GreaseManageService;
 import cn.stylefeng.guns.modular.kb.utils.IPUtil;
 import cn.stylefeng.guns.modular.om.productionOrdeInfo.model.result.ProductionOrdeInfoResult;
 import cn.stylefeng.guns.modular.sc.kanbanConf.model.params.KanbanConfParam;
 import cn.stylefeng.guns.modular.sc.kanbanConf.service.KanbanConfService;
+import cn.stylefeng.guns.plcserver.opc.unit.OPCUnit;
 import cn.stylefeng.roses.core.base.controller.BaseController;
 import cn.stylefeng.roses.kernel.model.response.ResponseData;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
@@ -154,6 +156,26 @@
         return ResponseData.success(list);
     }
 
+    @ResponseBody
+    @CrossOrigin
+    @RequestMapping("/testhandleOilState")
+    public long handleOilState(){
+        SimpleDateFormat format = new SimpleDateFormat("yyyyMMdd");
+        String currentDate = format.format(new Date());
+        GreaseManageParam param = new GreaseManageParam();
+        param.setLocationCode("OP050");
+        List<GreaseManageResult> list = greaseManageService.findListBySpec(param);
+        if(list.size()>0) {
+            String duaDate = list.get(0).getDuaDate();
+//
+            long  daysBetween = Long.parseLong(getRemainder(currentDate,duaDate));
+
+//            long daysBetween = ChronoUnit.DAYS.between(date1, date2);
+//            return daysBetween;
+        }
+        return  0;
+    }
+
     public static String boldText(String param){
         return "<span style='font-size: 20px' class='colorRed'>"+param+"</span>";
     }
@@ -173,7 +195,7 @@
         DateTimeFormatter dateFormatter = DateTimeFormatter.ofPattern("yyyyMMdd");
         LocalDate localDate1 = LocalDate.parse(currentDate, dateFormatter);
         LocalDate localDate2 = LocalDate.parse(tableDate, dateFormatter);
-        long days = ChronoUnit.DAYS.between(localDate2, localDate1);
+        long days = ChronoUnit.DAYS.between(localDate1, localDate2);
         return String.valueOf(days);
     }
 

--
Gitblit v1.9.3