| | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | | import com.github.xingshuangs.iot.protocol.s7.serializer.S7Serializer; |
| | | import com.kangaroohy.milo.model.ReadWriteEntity; |
| | | import com.mes.common.config.Const; |
| | | import com.mes.damage.service.DamageService; |
| | | import com.mes.largenscreen.entity.PieChartVO; |
| | | import com.mes.s7.entity.S7DataGHTwo; |
| | | import com.mes.temperingglass.entity.TemperingGlassInfo; |
| | | import com.mes.temperingglass.service.TemperingGlassInfoService; |
| | | import com.mes.tools.WebSocketServer; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Qualifier; |
| | | import org.springframework.scheduling.annotation.Scheduled; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | |
| | | @Autowired |
| | | private DamageService damageService; |
| | | |
| | | @Autowired |
| | | @Qualifier("s7SerializerGHTwo") |
| | | private S7Serializer s7SerializerGHTwo; |
| | | |
| | | /** |
| | | * fixedRate : 上一个调用开始后再次调用的延时(不用等待上一次调用完成) |
| | | * fixedDelay : 上一个调用结束后再次调用的延时 |
| | | */ |
| | | |
| | | private List<TemperingGlassInfo> selectWaitingGlassByOpc() { |
| | | //获取等待进炉中的玻璃信息 |
| | | try { |
| | | S7DataGHTwo s7DataGHTwo = s7SerializerGHTwo.read(S7DataGHTwo.class); |
| | | String engineerEntity = s7DataGHTwo.getF09EngineerId(); |
| | | Integer temperingLayoutIdEntity = s7DataGHTwo.getF09TemperingLayoutId(); |
| | | if (null == engineerEntity || null == temperingLayoutIdEntity) { |
| | | engineerEntity = s7DataGHTwo.getF08EngineerId(); |
| | | temperingLayoutIdEntity = s7DataGHTwo.getF08TemperingLayoutId(); |
| | | if (null == engineerEntity || null == temperingLayoutIdEntity) { |
| | | log.info("获取参数异常,结束本次任务"); |
| | | return new ArrayList<>(); |
| | | } |
| | | } |
| | | return temperingAgoService.list(new LambdaQueryWrapper<TemperingGlassInfo>() |
| | | .eq(TemperingGlassInfo::getEngineerId, engineerEntity) |
| | | .eq(TemperingGlassInfo::getTemperingLayoutId, temperingLayoutIdEntity)); |
| | | } catch (Exception e) { |
| | | log.info("获取钢化参数异常:{}", e); |
| | | return new ArrayList<>(); |
| | | } |
| | | } |
| | | |
| | | @Scheduled(fixedDelay = 1000) |
| | | public void temperingGlassHome() { |
| | | JSONObject jsonObject = new JSONObject(); |
| | | //正在等待进片的玻璃 |
| | | List<TemperingGlassInfo> waitingGlass = temperingAgoService.selectWaitingGlassByOpc(); |
| | | List<TemperingGlassInfo> waitingGlass = selectWaitingGlassByOpc(); |
| | | if (waitingGlass != null) { |
| | | jsonObject.append("waitingGlass", waitingGlass); |
| | | } |
| | |
| | | //大屏钢化信息 |
| | | List<TemperingGlassInfo> temperingGlassInfoList = temperingAgoService.list( |
| | | new QueryWrapper<TemperingGlassInfo>() |
| | | .select("engineer_id" ,"tempering_layout_id") |
| | | .select("engineer_id", "tempering_layout_id") |
| | | .eq("state", Const.TEMPERING_START) |
| | | .gt("create_time", startOfToday) |
| | | .groupBy("engineer_id" ,"tempering_layout_id") |
| | | .groupBy("engineer_id", "tempering_layout_id") |
| | | ); |
| | | jsonObject.append("temperingGlassInfoList", temperingGlassInfoList.size()); |
| | | //大屏钢化信息 |