| | |
| | | |
| | | import cn.hutool.core.collection.CollectionUtil; |
| | | import cn.hutool.json.JSONObject; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.StringUtils; |
| | | import com.github.yulichang.wrapper.MPJLambdaWrapper; |
| | | import com.mes.common.config.Const; |
| | | import com.mes.order.entity.dto.OrderDTO; |
| | | import com.mes.order.service.OrdersService; |
| | | import com.mes.rawglassdetails.entity.RawGlassStorageDetails; |
| | | import com.mes.rawglassdetails.service.RawGlassStorageDetailsService; |
| | | import com.mes.rawglassstation.entity.RawGlassStorageStation; |
| | | import com.mes.rawglassstation.service.RawGlassStorageStationService; |
| | | import com.mes.rawglasstask.entity.RawGlassStorageTask; |
| | | import com.mes.rawglasstask.service.RawGlassStorageTaskService; |
| | |
| | | @Component |
| | | public class RawGlassPushMessage { |
| | | |
| | | @Resource private RawGlassStorageStationService rawGlassStorageStationService; |
| | | @Resource |
| | | private RawGlassStorageStationService rawGlassStorageStationService; |
| | | |
| | | @Resource private RawGlassStorageTaskService rawGlassStorageTaskService; |
| | | @Resource |
| | | private RawGlassStorageTaskService rawGlassStorageTaskService; |
| | | |
| | | @Scheduled(fixedDelay = 2000) |
| | | public void sendRawGlassMessage() { |
| | | log.info("发送任务信息和架子信息"); |
| | | JSONObject jsonObject = new JSONObject(); |
| | | List<RawGlassStorageDetails> rawStationDetailsList = |
| | | rawGlassStorageStationService.listRawGlassDetails(); |
| | | List<RawGlassStorageTask> tasks = rawGlassStorageTaskService.listRawGlassTask(); |
| | | jsonObject.append("rawStationDetailsList", rawStationDetailsList); |
| | | jsonObject.append("tasks", tasks); |
| | | log.info("获取到的工位详情及任务信息为:{}", jsonObject); |
| | | @Resource |
| | | private RawGlassStorageDetailsService rawGlassStorageDetailsService; |
| | | |
| | | List<WebSocketServer> sendwServer = WebSocketServer.sessionMap.get("rawGlass"); |
| | | if (CollectionUtil.isNotEmpty(sendwServer)) { |
| | | if (sendwServer.get(0).session.isOpen()) { |
| | | log.info("已发送"); |
| | | sendwServer.get(0).sendMessage(String.valueOf(jsonObject)); |
| | | } |
| | | @Resource |
| | | private OrdersService ordersService; |
| | | |
| | | @Scheduled(fixedDelay = 2000) |
| | | public void sendRawGlassMessage() { |
| | | log.info("发送任务信息和架子信息"); |
| | | JSONObject jsonObject = new JSONObject(); |
| | | List<RawGlassStorageDetails> rawStationDetailsList = |
| | | rawGlassStorageStationService.listRawGlassDetails(); |
| | | List<RawGlassStorageTask> tasks = rawGlassStorageTaskService.listRawGlassTask(); |
| | | jsonObject.append("rawStationDetailsList", rawStationDetailsList); |
| | | jsonObject.append("tasks", tasks); |
| | | List<WebSocketServer> sendwServer = WebSocketServer.sessionMap.get("rawGlass"); |
| | | if (CollectionUtil.isNotEmpty(sendwServer)) { |
| | | sendwServer.stream().forEach(e -> { |
| | | e.sendMessage(String.valueOf(jsonObject)); |
| | | }); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** todo:入库任务:吊装位有玻璃,先去工位表查询空格子,生成入库任务从吊装位到目标格子 */ |
| | | @Scheduled(fixedDelay = 1000) |
| | | public void largenScreen() { |
| | | log.info("发送任务信息和架子信息"); |
| | | JSONObject jsonObject = new JSONObject(); |
| | | MPJLambdaWrapper<RawGlassStorageDetails> wrapper = new MPJLambdaWrapper<>(); |
| | | wrapper.select(RawGlassStorageStation::getSlot) |
| | | .select("ifnull(remain_quantity, 0) as remain_quantity") |
| | | .rightJoin(RawGlassStorageStation.class, on -> on.eq(RawGlassStorageStation::getSlot, RawGlassStorageDetails::getSlot) |
| | | .eq(RawGlassStorageDetails::getState, Const.RAW_GLASS_STATE_IN)) |
| | | .orderByAsc(RawGlassStorageStation::getSlot); |
| | | List<RawGlassStorageDetails> rawGlassStorageDetailList = rawGlassStorageDetailsService.list(wrapper); |
| | | jsonObject.append("rawGlassStorageDetailList", rawGlassStorageDetailList); |
| | | |
| | | /** todo:出库任务:1、点出库,立马生成出片任务 2、点出库修改工位详情内的状态为待出库,定时任务扫描生成出库任务 */ |
| | | List<OrderDTO> orderDTOS = ordersService.selectOrderPercent(); |
| | | jsonObject.append("orderDTOS", orderDTOS); |
| | | |
| | | /** todo:原片调度:1、查询工程原片表,按照顺序将原片放入上片1号位,后续原片放上片2号位,出现尺寸替换,判断原上片位是否有玻璃,有 先出后进,无 直接进片 */ |
| | | List<WebSocketServer> sendwServer = WebSocketServer.sessionMap.get("largenScreen"); |
| | | if (CollectionUtil.isNotEmpty(sendwServer)) { |
| | | sendwServer.stream().forEach(e -> { |
| | | e.sendMessage(String.valueOf(jsonObject)); |
| | | }); |
| | | } |
| | | } |
| | | } |