| | |
| | | |
| | | /** |
| | | * 自动打标机 |
| | | * |
| | | * @Author : yanzhxiin |
| | | * @Date: 2024/8/20 11:19 |
| | | * @Description: |
| | |
| | | //机械手 |
| | | @Scheduled(fixedDelay = 500) |
| | | public void MarkingTasks() { |
| | | machineListLoad =machineMapper.selectList(new QueryWrapper<Machine>().lambda().eq(Machine::getName,"上片")); |
| | | JSONObject jsonObject = new JSONObject(); |
| | | jsonObject.append("sessionMapName", "loadTask"); |
| | | for (Machine machine : machineListLoad) { |
| | | JSONObject jsonObjectItem = new JSONObject(); |
| | | //标准模式 找已领取未完成的第一条任务 |
| | | LineConfiguration lineConfiguration=lineConfigurationService.machineLineConfiguration(machine); |
| | | //此线路已领取的任务 |
| | | List<PrimitiveTask> findPrimitiveTasking=primitiveTaskService.findPrimitiveTasking(machine,lineConfiguration.getLineId()); |
| | | //此线路未领取的任务 本地 |
| | | //List<PrimitiveTask> findPrimitiveTask=primitiveTaskService.findPrimitiveTaskNotFinish(); |
| | | //此线路未领取的任务 客户数据库 |
| | | List<KBBTJPDrawingBP> list =kBBTJPDrawingBPService.notReceiveKBBTJPDrawingBP(); |
| | | jsonObjectItem.append("findPrimitiveTask", list); |
| | | jsonObjectItem.append("findPrimitiveTasking", findPrimitiveTasking); |
| | | //jsonObject.append("findPrimitiveTask", findPrimitiveTask); |
| | | jsonObjectItem.append("machine", machine); |
| | | jsonObjectItem.append("sendRecords", sendRecords); |
| | | jsonObject.append(machine.getId().toString(), jsonObjectItem); |
| | | try { |
| | | machineListLoad = machineMapper.selectList(new QueryWrapper<Machine>().lambda().eq(Machine::getName, "上片")); |
| | | JSONObject jsonObject = new JSONObject(); |
| | | jsonObject.append("sessionMapName", "loadTask"); |
| | | for (Machine machine : machineListLoad) { |
| | | JSONObject jsonObjectItem = new JSONObject(); |
| | | //标准模式 找已领取未完成的第一条任务 |
| | | LineConfiguration lineConfiguration = lineConfigurationService.machineLineConfiguration(machine); |
| | | //此线路已领取的任务 |
| | | List<PrimitiveTask> findPrimitiveTasking = primitiveTaskService.findPrimitiveTasking(machine, lineConfiguration.getLineId()); |
| | | //此线路未领取的任务 本地 |
| | | //List<PrimitiveTask> findPrimitiveTask=primitiveTaskService.findPrimitiveTaskNotFinish(); |
| | | //此线路未领取的任务 客户数据库 |
| | | List<KBBTJPDrawingBP> list = kBBTJPDrawingBPService.notReceiveKBBTJPDrawingBP(); |
| | | jsonObjectItem.append("findPrimitiveTask", list); |
| | | jsonObjectItem.append("findPrimitiveTasking", findPrimitiveTasking); |
| | | //jsonObject.append("findPrimitiveTask", findPrimitiveTask); |
| | | jsonObjectItem.append("machine", machine); |
| | | jsonObjectItem.append("sendRecords", sendRecords); |
| | | jsonObject.append(machine.getId().toString(), jsonObjectItem); |
| | | } |
| | | this.webSocketServer(jsonObject); |
| | | } catch (Exception exception) { |
| | | log.info("MarkingTasks:{}", exception.getMessage()); |
| | | } |
| | | this.webSocketServer(jsonObject); |
| | | } |
| | | |
| | | //磨边机 |
| | | @Scheduled(fixedDelay = 500) |
| | | public void edgingTasks() { |
| | | machineListEdging =machineMapper.selectList(new QueryWrapper<Machine>().lambda().eq(Machine::getName,"磨边")); |
| | | JSONObject jsonObject = new JSONObject(); |
| | | jsonObject.append("sessionMapName", "edgingTask"); |
| | | for (Machine machine : machineListEdging) { |
| | | JSONObject jsonObjectItem = new JSONObject(); |
| | | List<Tasking> taskingList=taskingService.findMachineTask(machine); |
| | | jsonObjectItem.append("taskingList", taskingList); |
| | | jsonObjectItem.append("machine", machine); |
| | | jsonObjectItem.append("sendRecords", sendRecords); |
| | | jsonObject.append(machine.getId().toString(), jsonObjectItem); |
| | | try { |
| | | machineListEdging = machineMapper.selectList(new QueryWrapper<Machine>().lambda().eq(Machine::getName, "磨边")); |
| | | JSONObject jsonObject = new JSONObject(); |
| | | jsonObject.append("sessionMapName", "edgingTask"); |
| | | for (Machine machine : machineListEdging) { |
| | | JSONObject jsonObjectItem = new JSONObject(); |
| | | List<Tasking> taskingList = taskingService.findMachineTask(machine); |
| | | jsonObjectItem.append("taskingList", taskingList); |
| | | jsonObjectItem.append("machine", machine); |
| | | jsonObjectItem.append("sendRecords", sendRecords); |
| | | jsonObject.append(machine.getId().toString(), jsonObjectItem); |
| | | } |
| | | this.webSocketServer(jsonObject); |
| | | } catch (Exception exception) { |
| | | log.info("edgingTasks:{}", exception.getMessage()); |
| | | } |
| | | this.webSocketServer(jsonObject); |
| | | } |
| | | |
| | | //翻片台 |
| | | @Scheduled(fixedDelay = 500) |
| | | public void flipSliceTasks() { |
| | | machineListFlipSlice =machineMapper.selectList(new QueryWrapper<Machine>().lambda().eq(Machine::getName,"翻片")); |
| | | JSONObject jsonObject = new JSONObject(); |
| | | jsonObject.append("sessionMapName", "flipSlice"); |
| | | for (Machine machine : machineListFlipSlice) { |
| | | JSONObject jsonObjectItem = new JSONObject(); |
| | | List<Tasking> taskingList=taskingService.findMachineTask(machine); |
| | | jsonObjectItem.append("taskingList", taskingList); |
| | | jsonObjectItem.append("machine", machine); |
| | | jsonObjectItem.append("sendRecords", sendRecords); |
| | | jsonObject.append(machine.getId().toString(), jsonObjectItem); |
| | | try { |
| | | machineListFlipSlice = machineMapper.selectList(new QueryWrapper<Machine>().lambda().eq(Machine::getName, "翻片")); |
| | | JSONObject jsonObject = new JSONObject(); |
| | | jsonObject.append("sessionMapName", "flipSlice"); |
| | | for (Machine machine : machineListFlipSlice) { |
| | | JSONObject jsonObjectItem = new JSONObject(); |
| | | List<Tasking> taskingList = taskingService.findMachineTask(machine); |
| | | jsonObjectItem.append("taskingList", taskingList); |
| | | jsonObjectItem.append("machine", machine); |
| | | jsonObjectItem.append("sendRecords", sendRecords); |
| | | jsonObject.append(machine.getId().toString(), jsonObjectItem); |
| | | } |
| | | this.webSocketServer(jsonObject); |
| | | } catch (Exception exception) { |
| | | log.info("flipSliceTasks:{}", exception.getMessage()); |
| | | } |
| | | this.webSocketServer(jsonObject); |
| | | |
| | | } |
| | | |
| | | //打标机 |
| | | @Scheduled(fixedDelay = 500) |
| | | public void markingTasks() { |
| | | machineListMarking =machineMapper.selectList(new QueryWrapper<Machine>().lambda().eq(Machine::getName,"自动打标机")); |
| | | try { |
| | | machineListMarking = machineMapper.selectList(new QueryWrapper<Machine>().lambda().eq(Machine::getName, "自动打标机")); |
| | | |
| | | JSONObject jsonObject = new JSONObject(); |
| | | jsonObject.append("sessionMapName", "marking"); |
| | | for (Machine machine : machineListMarking) { |
| | | JSONObject jsonObjectItem = new JSONObject(); |
| | | List<Tasking> taskingList=taskingService.findMachineTask(machine); |
| | | jsonObjectItem.append("taskingList", taskingList); |
| | | jsonObjectItem.append("machine", machine); |
| | | jsonObjectItem.append("sendRecords", sendRecords); |
| | | jsonObject.append(machine.getId().toString(), jsonObjectItem); |
| | | JSONObject jsonObject = new JSONObject(); |
| | | jsonObject.append("sessionMapName", "marking"); |
| | | for (Machine machine : machineListMarking) { |
| | | JSONObject jsonObjectItem = new JSONObject(); |
| | | List<Tasking> taskingList = taskingService.findMachineTask(machine); |
| | | jsonObjectItem.append("taskingList", taskingList); |
| | | jsonObjectItem.append("machine", machine); |
| | | jsonObjectItem.append("sendRecords", sendRecords); |
| | | jsonObject.append(machine.getId().toString(), jsonObjectItem); |
| | | } |
| | | this.webSocketServer(jsonObject); |
| | | } catch (Exception exception) { |
| | | log.info("markingTasks:{}", exception.getMessage()); |
| | | } |
| | | this.webSocketServer(jsonObject); |
| | | } |
| | | |
| | | //丝印机 |
| | | @Scheduled(fixedDelay = 500) |
| | | public void silkScreenTasks() { |
| | | machineListSilkScreen =machineMapper.selectList(new QueryWrapper<Machine>().lambda().eq(Machine::getName,"自动丝印机")); |
| | | JSONObject jsonObject = new JSONObject(); |
| | | jsonObject.append("sessionMapName", "silkScreenTask"); |
| | | for (Machine machine : machineListSilkScreen) { |
| | | JSONObject jsonObjectItem = new JSONObject(); |
| | | List<Tasking> taskingList=taskingService.findMachineTask(machine); |
| | | jsonObjectItem.append("taskingList", taskingList); |
| | | jsonObjectItem.append("machine", machine); |
| | | jsonObjectItem.append("sendRecords", sendRecords); |
| | | jsonObject.append(machine.getId().toString(), jsonObjectItem); |
| | | try { |
| | | machineListSilkScreen = machineMapper.selectList(new QueryWrapper<Machine>().lambda().eq(Machine::getName, "自动丝印机")); |
| | | JSONObject jsonObject = new JSONObject(); |
| | | jsonObject.append("sessionMapName", "silkScreenTask"); |
| | | for (Machine machine : machineListSilkScreen) { |
| | | JSONObject jsonObjectItem = new JSONObject(); |
| | | List<Tasking> taskingList = taskingService.findMachineTask(machine); |
| | | jsonObjectItem.append("taskingList", taskingList); |
| | | jsonObjectItem.append("machine", machine); |
| | | jsonObjectItem.append("sendRecords", sendRecords); |
| | | jsonObject.append(machine.getId().toString(), jsonObjectItem); |
| | | } |
| | | this.webSocketServer(jsonObject); |
| | | } catch (Exception exception) { |
| | | log.info("silkScreenTasks:{}", exception.getMessage()); |
| | | } |
| | | this.webSocketServer(jsonObject); |
| | | } |
| | | |
| | | //点胶机 |
| | | //@Scheduled(fixedDelay = 500) |
| | | @Scheduled(fixedDelay = 500) |
| | | public void glueDispenserTasks() { |
| | | machineListGlueDispenser =machineMapper.selectList(new QueryWrapper<Machine>().lambda().eq(Machine::getName,"自动点胶机")); |
| | | JSONObject jsonObject = new JSONObject(); |
| | | jsonObject.append("sessionMapName", "glueDispenser"); |
| | | for (Machine machine : machineListGlueDispenser) { |
| | | JSONObject jsonObjectItem = new JSONObject(); |
| | | List<Tasking> taskingList=taskingService.findMachineTask(machine); |
| | | jsonObjectItem.append("taskingList", taskingList); |
| | | jsonObjectItem.append("machine", machine); |
| | | jsonObjectItem.append("sendRecords", sendRecords); |
| | | jsonObject.append(machine.getId().toString(), jsonObjectItem); |
| | | try { |
| | | machineListGlueDispenser = machineMapper.selectList(new QueryWrapper<Machine>().lambda().eq(Machine::getName, "自动点胶机")); |
| | | JSONObject jsonObject = new JSONObject(); |
| | | jsonObject.append("sessionMapName", "glueDispenser"); |
| | | for (Machine machine : machineListGlueDispenser) { |
| | | JSONObject jsonObjectItem = new JSONObject(); |
| | | List<Tasking> taskingList = taskingService.findMachineTask(machine); |
| | | jsonObjectItem.append("taskingList", taskingList); |
| | | jsonObjectItem.append("machine", machine); |
| | | jsonObjectItem.append("sendRecords", sendRecords); |
| | | jsonObject.append(machine.getId().toString(), jsonObjectItem); |
| | | } |
| | | this.webSocketServer(jsonObject); |
| | | } catch (Exception exception) { |
| | | log.info("glueDispenserTasks:{}", exception.getMessage()); |
| | | } |
| | | this.webSocketServer(jsonObject); |
| | | } |
| | | |
| | | //旋转台 |
| | | @Scheduled(fixedDelay = 500) |
| | | public void rotateTasks() { |
| | | machineListRotate =machineMapper.selectList(new QueryWrapper<Machine>().lambda().eq(Machine::getName,"旋转台")); |
| | | JSONObject jsonObject = new JSONObject(); |
| | | jsonObject.append("sessionMapName", "rotate"); |
| | | for (Machine machine : machineListRotate) { |
| | | JSONObject jsonObjectItem = new JSONObject(); |
| | | List<Tasking> taskingList=taskingService.findMachineTask(machine); |
| | | jsonObjectItem.append("taskingList", taskingList); |
| | | jsonObjectItem.append("machine", machine); |
| | | jsonObjectItem.append("sendRecords", sendRecords); |
| | | jsonObject.append(machine.getId().toString(), jsonObjectItem); |
| | | try { |
| | | machineListRotate = machineMapper.selectList(new QueryWrapper<Machine>().lambda().eq(Machine::getName, "旋转台")); |
| | | JSONObject jsonObject = new JSONObject(); |
| | | jsonObject.append("sessionMapName", "rotate"); |
| | | for (Machine machine : machineListRotate) { |
| | | JSONObject jsonObjectItem = new JSONObject(); |
| | | List<Tasking> taskingList = taskingService.findMachineTask(machine); |
| | | jsonObjectItem.append("taskingList", taskingList); |
| | | jsonObjectItem.append("machine", machine); |
| | | jsonObjectItem.append("sendRecords", sendRecords); |
| | | jsonObject.append(machine.getId().toString(), jsonObjectItem); |
| | | } |
| | | this.webSocketServer(jsonObject); |
| | | } catch (Exception exception) { |
| | | log.info("rotateTasks:{}", exception.getMessage()); |
| | | } |
| | | this.webSocketServer(jsonObject); |
| | | } |
| | | |
| | | //贴膜机 |
| | | @Scheduled(fixedDelay = 500) |
| | | public void laminationTasks() { |
| | | machineListLamination =machineMapper.selectList(new QueryWrapper<Machine>().lambda().eq(Machine::getName,"自动贴膜机")); |
| | | JSONObject jsonObject = new JSONObject(); |
| | | jsonObject.append("sessionMapName", "lamination"); |
| | | for (Machine machine : machineListLamination) { |
| | | JSONObject jsonObjectItem = new JSONObject(); |
| | | List<Tasking> taskingList=taskingService.findMachineTask(machine); |
| | | jsonObjectItem.append("taskingList", taskingList); |
| | | jsonObjectItem.append("machine", machine); |
| | | jsonObjectItem.append("sendRecords", sendRecords); |
| | | jsonObject.append(machine.getId().toString(), jsonObjectItem); |
| | | try { |
| | | machineListLamination = machineMapper.selectList(new QueryWrapper<Machine>().lambda().eq(Machine::getName, "自动贴膜机")); |
| | | JSONObject jsonObject = new JSONObject(); |
| | | jsonObject.append("sessionMapName", "lamination"); |
| | | for (Machine machine : machineListLamination) { |
| | | JSONObject jsonObjectItem = new JSONObject(); |
| | | List<Tasking> taskingList = taskingService.findMachineTask(machine); |
| | | jsonObjectItem.append("taskingList", taskingList); |
| | | jsonObjectItem.append("machine", machine); |
| | | jsonObjectItem.append("sendRecords", sendRecords); |
| | | jsonObject.append(machine.getId().toString(), jsonObjectItem); |
| | | } |
| | | this.webSocketServer(jsonObject); |
| | | } catch (Exception exception) { |
| | | log.info("laminationTasks:{}", exception.getMessage()); |
| | | } |
| | | this.webSocketServer(jsonObject); |
| | | } |
| | | |
| | | |
| | | //报工页面查询 |
| | | @Scheduled(fixedDelay = 1000) |
| | | public void manualReporting() { |
| | | try { |
| | | machineListScanQrCode = machineMapper.selectList(new QueryWrapper<Machine>().lambda().eq(Machine::getName, "识别报工")); |
| | | JSONObject jsonObject = new JSONObject(); |
| | | jsonObject.append("sessionMapName", "manualReporting"); |
| | | for (Machine machine : machineListScanQrCode) { |
| | | JSONObject jsonObjectItem = new JSONObject(); |
| | | List<Tasking> taskingList = taskingMapper.selectJoinList(Tasking.class, new MPJLambdaWrapper<Tasking>() |
| | | .selectAll(Tasking.class) |
| | | .innerJoin(LineConfiguration.class, LineConfiguration::getId, Tasking::getLineConfigurationId) |
| | | .innerJoin(Machine.class, Machine::getId, LineConfiguration::getMachineId) |
| | | .eq(LineConfiguration::getMachineId, machine.getId()) |
| | | .eq(Tasking::getGlassState, "正常") |
| | | .eq(Tasking::getState, "线上") |
| | | .ne(Tasking::getWorkState, "完工") |
| | | .orderByDesc(Tasking::getOperationRecordTime)); |
| | | jsonObjectItem.append("taskingList", taskingList); |
| | | jsonObjectItem.append("machine", machine); |
| | | jsonObject.append(machine.getId().toString(), jsonObjectItem); |
| | | } |
| | | |
| | | machineListScanQrCode =machineMapper.selectList(new QueryWrapper<Machine>().lambda().eq(Machine::getName,"识别报工")); |
| | | JSONObject jsonObject = new JSONObject(); |
| | | jsonObject.append("sessionMapName", "manualReporting"); |
| | | for (Machine machine : machineListScanQrCode) { |
| | | JSONObject jsonObjectItem = new JSONObject(); |
| | | List<Tasking> taskingList=taskingMapper.selectJoinList(Tasking.class,new MPJLambdaWrapper<Tasking>() |
| | | .selectAll(Tasking.class) |
| | | .innerJoin(LineConfiguration.class,LineConfiguration::getId,Tasking::getLineConfigurationId) |
| | | .innerJoin(Machine.class,Machine::getId,LineConfiguration::getMachineId) |
| | | .eq(LineConfiguration::getMachineId,machine.getId()) |
| | | .eq(Tasking::getGlassState,"正常") |
| | | .eq(Tasking::getState,"线上") |
| | | .ne(Tasking::getWorkState,"完工") |
| | | .orderByDesc(Tasking::getOperationRecordTime)); |
| | | jsonObjectItem.append("taskingList", taskingList); |
| | | jsonObjectItem.append("machine", machine); |
| | | jsonObject.append(machine.getId().toString(), jsonObjectItem); |
| | | this.webSocketServer(jsonObject); |
| | | } catch (Exception exception) { |
| | | log.info("manualReporting:{}", exception.getMessage()); |
| | | } |
| | | |
| | | this.webSocketServer(jsonObject); |
| | | } |
| | | |
| | | //线下玻璃查询 |
| | | @Scheduled(fixedDelay = 1000) |
| | | public void downLineTask() { |
| | | JSONObject jsonObject = new JSONObject(); |
| | | List<Tasking> downLineTask=taskingService.findDownLineTask(); |
| | | jsonObject.append("sessionMapName", "downLineTask"); |
| | | jsonObject.append("downLineTask", downLineTask); |
| | | this.webSocketServer(jsonObject); |
| | | try { |
| | | JSONObject jsonObject = new JSONObject(); |
| | | List<Tasking> downLineTask = taskingService.findDownLineTask(); |
| | | jsonObject.append("sessionMapName", "downLineTask"); |
| | | jsonObject.append("downLineTask", downLineTask); |
| | | this.webSocketServer(jsonObject); |
| | | } catch (Exception exception) { |
| | | log.info("downLineTask:{}", exception.getMessage()); |
| | | } |
| | | } |
| | | |
| | | public void webSocketServer(JSONObject jsonObject) { |
| | | try { |
| | | String sessionMapName=jsonObject.getJSONArray("sessionMapName").get(0).toString(); |
| | | log.info("发送数据:{}", jsonObject.getJSONArray("sessionMapName").get(0).toString()); |
| | | String sessionMapName = jsonObject.getJSONArray("sessionMapName").get(0).toString(); |
| | | webSocketServer.sendToWeb(sessionMapName, jsonObject.toString()); |
| | | } catch (Exception ex) { |
| | | log.info("{}发送数据失败:{}", "rawGlassStorage", ex.getMessage()); |