| | |
| | | |
| | | import cn.hutool.json.JSONObject; |
| | | 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.mes.common.config.Const; |
| | | import com.mes.damage.entity.Damage; |
| | | import com.mes.damage.service.DamageService; |
| | | import com.mes.engineering.entity.Engineering; |
| | | import com.mes.temperingglass.service.TemperingGlassInfoService; |
| | | import com.mes.largenscreen.entity.PieChartVO; |
| | | 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.scheduling.annotation.Scheduled; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.time.LocalDate; |
| | | import java.time.ZoneId; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * @author SNG-010 |
| | |
| | | public void temperingGlassHome() { |
| | | JSONObject jsonObject = new JSONObject(); |
| | | //正在等待进片的玻璃 |
| | | List<TemperingGlassInfo> waitingGlass = temperingAgoService.selectWaitingGlass(); |
| | | List<TemperingGlassInfo> waitingGlass = temperingAgoService.selectWaitingGlassByOpc(); |
| | | if (waitingGlass != null) { |
| | | jsonObject.append("waitingGlass", waitingGlass); |
| | | } |
| | |
| | | public void largenScreen() { |
| | | JSONObject jsonObject = new JSONObject(); |
| | | //大屏钢化信息 |
| | | Date startOfToday = new Date(LocalDate.now().atStartOfDay(ZoneId.systemDefault()).toInstant().toEpochMilli()); |
| | | |
| | | Integer putGlass = temperingAgoService.count( |
| | | new LambdaUpdateWrapper<TemperingGlassInfo>() |
| | | .eq(TemperingGlassInfo::getState, Const.TEMPERING_NEW) |
| | | new QueryWrapper<TemperingGlassInfo>() |
| | | .eq("state", Const.TEMPERING_NEW) |
| | | .gt("create_time", startOfToday) |
| | | ); |
| | | jsonObject.append("temperingTaskType", putGlass); |
| | | //大屏钢化信息 |
| | | List<TemperingGlassInfo> temperingGlassInfoList = temperingAgoService.list( |
| | | new LambdaQueryWrapper<TemperingGlassInfo>() |
| | | .select(TemperingGlassInfo::getEngineerId, TemperingGlassInfo::getTemperingLayoutId) // 选择要去重的字段 |
| | | .eq(TemperingGlassInfo::getState, Const.TEMPERING_START) |
| | | .groupBy(TemperingGlassInfo::getEngineerId, TemperingGlassInfo::getTemperingLayoutId) // 按 engineerId 和 temperingLayoutId 分组 |
| | | new QueryWrapper<TemperingGlassInfo>() |
| | | .select("engineer_id" ,"tempering_layout_id") |
| | | .eq("state", Const.TEMPERING_START) |
| | | .gt("create_time", startOfToday) |
| | | .groupBy("engineer_id" ,"tempering_layout_id") |
| | | ); |
| | | jsonObject.append("temperingGlassInfoList", temperingGlassInfoList.size()); |
| | | //大屏钢化信息 |
| | | List<TemperingGlassInfo> temperingGlassInfoOutList = temperingAgoService.list( |
| | | List<TemperingGlassInfo> temperingGlassInfoInList = temperingAgoService.list( |
| | | new LambdaQueryWrapper<TemperingGlassInfo>() |
| | | .select(TemperingGlassInfo::getEngineerId, TemperingGlassInfo::getTemperingLayoutId) // 选择要去重的字段 |
| | | .eq(TemperingGlassInfo::getState, Const.TEMPERING_SUCCESS) |
| | | .eq(TemperingGlassInfo::getState, Const.TEMPERING_DROP) |
| | | .groupBy(TemperingGlassInfo::getEngineerId, TemperingGlassInfo::getTemperingLayoutId) // 按 engineerId 和 temperingLayoutId 分组 |
| | | ); |
| | | jsonObject.append("temperingGlassInfoOutList", temperingGlassInfoOutList.size()); |
| | | jsonObject.append("temperingGlassInfoInList", temperingGlassInfoInList.size()); |
| | | //钢化饼图数据 |
| | | List<PieChartVO> pieChartVOS = temperingAgoService.queryPieChart(); |
| | | jsonObject.append("pieChartVOS", pieChartVOS); |
| | | ArrayList<WebSocketServer> sendwServer = WebSocketServer.sessionMap.get("largenScreen"); |
| | | if (sendwServer != null) { |
| | | for (WebSocketServer webserver : sendwServer) { |