Browse Source

下发阈值数据包

5 years ago
parent
commit
77a45a2a64

+ 10 - 8
cloud-model/src/main/java/com/hssx/cloudmodel/service/impl/MouldHistoryServiceImpl.java

@@ -1,15 +1,10 @@
 package com.hssx.cloudmodel.service.impl;
 
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import com.hssx.cloudmodel.entity.MouldCycleRuntime;
-import com.hssx.cloudmodel.entity.MouldHistory;
-import com.hssx.cloudmodel.entity.MouldHistoryTime;
+import com.hssx.cloudmodel.entity.*;
 import com.hssx.cloudmodel.entity.vo.MouldHistoryTimeVO;
 import com.hssx.cloudmodel.entity.vo.MouldHistoryVO;
-import com.hssx.cloudmodel.mapper.MouldCycleRuntimeMapper;
-import com.hssx.cloudmodel.mapper.MouldHistoryMapper;
-import com.hssx.cloudmodel.mapper.MouldHistoryTimeMapper;
-import com.hssx.cloudmodel.mapper.MouldMapper;
+import com.hssx.cloudmodel.mapper.*;
 import com.hssx.cloudmodel.service.MouldHistoryService;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.hssx.cloudmodel.util.HttpRespMsg;
@@ -38,6 +33,10 @@ public class MouldHistoryServiceImpl extends ServiceImpl<MouldHistoryMapper, Mou
     private MouldCycleRuntimeMapper mouldCycleRuntimeMapper;
     @Resource
     private MouldMapper mouldMapper;
+    @Resource
+    private MouldEquipmentMapper mouldEquipmentMapper;
+    @Resource
+    private InjectionMoldingMapper injectionMoldingMapper;
     @Override
     public HttpRespMsg getOpeningAndClosingTimesChart(String equipmentNo, String time) {
         HttpRespMsg msg = new HttpRespMsg();
@@ -136,6 +135,9 @@ public class MouldHistoryServiceImpl extends ServiceImpl<MouldHistoryMapper, Mou
     @Override
     public HttpRespMsg openingAndClosingTimesChartCycle(String equipmentNo,String time) {
         HttpRespMsg msg = new HttpRespMsg();
+        MouldEquipment mouldEquipment = mouldEquipmentMapper.selectOne(new QueryWrapper<MouldEquipment>().eq("equipment_no", equipmentNo));
+        Mould mould = mouldMapper.selectOne(new QueryWrapper<Mould>().eq("equipment_id", mouldEquipment.getId()));
+        InjectionMolding molding = injectionMoldingMapper.selectOne(new QueryWrapper<InjectionMolding>().eq("mould_id", mould.getId()));
         Map<String,MouldHistoryTimeVO> map = TimeAndCountUtil.getMap();
         List<MouldHistoryVO> list = mouldHistoryTimeMapper.getOpeningAndClosingTimesChartCycle(time,equipmentNo);
         Integer count = 0;
@@ -146,7 +148,7 @@ public class MouldHistoryServiceImpl extends ServiceImpl<MouldHistoryMapper, Mou
             vo.setMinCycle(entry.getValue().stream().mapToInt(MouldHistoryVO::getRunCnt).min().getAsInt());
             vo.setMaxCycle(entry.getValue().stream().mapToInt(MouldHistoryVO::getRunCnt).max().getAsInt());
             vo.setAvgCycle((int)entry.getValue().stream().mapToInt(MouldHistoryVO::getRunCnt).average().getAsDouble());
-            vo.setTheoryCycle(40000);
+            vo.setTheoryCycle(molding.getCycle()==null?4000:molding.getCycle());
             if("00".equals(entry.getKey())){
                 map.put("00:00-01:00",vo);
             }else if("01".equals(entry.getKey())){