1.前端推数据使用了最新的webSokect客户现场总是掉线,修改为接口方式
2.设备交互整体增加异常处理以及PLC连接方式改为短连接
| | |
| | | if (s7PLC == null) { |
| | | return null; |
| | | } |
| | | // List<String> addresslist = GetAddressList(address, count, 16); |
| | | byte[] bytes = null; |
| | | try { |
| | | bytes = s7PLC.readByte(address, count); |
| | |
| | | com\mes\device\PlcBitInfo.class |
| | | com\mes\device\PlcBitObject.class |
| | | com\mes\utils\MD5.class |
| | | com\mes\tools\WebSocketServer.class |
| | | com\mes\common\config\Const.class |
| | | com\mes\service\PlcAgreement.class |
| | | com\mes\tools\DatabaseDesignDocUtil.class |
| | | com\mes\websocket\WebSocketServer.class |
| | | com\mes\utils\Result.class |
| | | com\mes\common\config\MybatisPlusConfig.class |
| | | com\mes\common\exception\ServiceException.class |
| | | com\mes\service\ModbusTcp.class |
| | | com\mes\utils\ResponseUtil.class |
| | | com\mes\websocket\WebSocketUtils.class |
| | | com\mes\common\handler\MyMetaObjectHandler.class |
| | | com\mes\device\PlcParameterObject.class |
| | | com\mes\entity\request\GeneralRequest.class |
| | |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\common\servicebase\src\main\java\com\mes\tools\WebSocketServer.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\common\servicebase\src\main\java\com\mes\service\ModbusTcp.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\common\servicebase\src\main\java\com\mes\common\handler\MyMetaObjectHandler.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\common\servicebase\src\main\java\com\mes\common\config\Swagger2Config.java |
| | |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\common\servicebase\src\main\java\com\mes\utils\HexUtil.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\common\servicebase\src\main\java\com\mes\tools\CodeGet.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\common\servicebase\src\main\java\com\mes\common\config\MybatisPlusConfig.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\common\servicebase\src\main\java\com\mes\websocket\WebSocketServer.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\common\servicebase\src\main\java\com\mes\service\PlcAgreement.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\common\servicebase\src\main\java\com\mes\tools\HexConversion.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\common\servicebase\src\main\java\com\mes\common\config\Const.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\common\servicebase\src\main\java\com\mes\entity\request\GeneralRequest.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\common\servicebase\src\main\java\com\mes\device\PlcBitInfo.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\common\servicebase\src\main\java\com\mes\websocket\WebSocketUtils.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\common\servicebase\src\main\java\com\mes\utils\ResponseUtil.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\common\servicebase\src\main\java\com\mes\utils\ResultCodeEnum.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\common\servicebase\src\main\java\com\mes\device\PlcParameterInfo.java |
| | |
| | | List<Machine> machineDispensing =machineMapper.selectList(new QueryWrapper<Machine>().lambda().eq(Machine::getName,"自动点胶机").eq(Machine::getState,"开工")); |
| | | List<Machine> machineListRotate =machineMapper.selectList(new QueryWrapper<Machine>().lambda().eq(Machine::getName,"旋转台").eq(Machine::getState,"开工")); |
| | | List<Machine> machineListLamination =machineMapper.selectList(new QueryWrapper<Machine>().lambda().eq(Machine::getName,"自动贴膜机").eq(Machine::getState,"开工")); |
| | | for (Machine item:machineListLoad){ |
| | | new MachineLoad(item,primitiveTaskMapper,taskingMapper,machineMapper,taskingService,primitiveTaskService,lineConfigurationService).start(); |
| | | } |
| | | for (Machine item:machineListEdging){ |
| | | new MachineEdging(item,taskingMapper,machineMapper,taskingService,primitiveTaskService,lineConfigurationService).start(); |
| | | } |
| | | for (Machine item:machineListFlipSlice){ |
| | | new MachineFlipSlice(item,machineMapper,taskingService).start(); |
| | | } |
| | | for (Machine item:machineListMarking){ |
| | | new MachineMarking(item,machineMapper,taskingService).start(); |
| | | } |
| | | for (Machine item:machineListSilkScreen){ |
| | | new MachineSilkScreen(item,machineMapper,taskingService).start(); |
| | | } |
| | | for (Machine item:machineDispensing){ |
| | | new MachineDispensing(item,machineMapper,taskingService).start(); |
| | | } |
| | | for (Machine item:machineListRotate){ |
| | | new MachineRotate(item,machineMapper,taskingService).start(); |
| | | } |
| | | for (Machine item:machineListLamination){ |
| | | new MachineLamination(item,machineMapper,taskingService).start(); |
| | | } |
| | | // for (Machine item:machineListLoad){ |
| | | // new MachineLoad(item,primitiveTaskMapper,taskingMapper,machineMapper,taskingService,primitiveTaskService,lineConfigurationService).start(); |
| | | // } |
| | | // for (Machine item:machineListEdging){ |
| | | // new MachineEdging(item,taskingMapper,machineMapper,taskingService,primitiveTaskService,lineConfigurationService).start(); |
| | | // } |
| | | // for (Machine item:machineListFlipSlice){ |
| | | // new MachineFlipSlice(item,machineMapper,taskingService).start(); |
| | | // } |
| | | // for (Machine item:machineListMarking){ |
| | | // new MachineMarking(item,machineMapper,taskingService).start(); |
| | | // } |
| | | // for (Machine item:machineListSilkScreen){ |
| | | // new MachineSilkScreen(item,machineMapper,taskingService).start(); |
| | | // } |
| | | // for (Machine item:machineDispensing){ |
| | | // new MachineDispensing(item,machineMapper,taskingService).start(); |
| | | // } |
| | | // for (Machine item:machineListRotate){ |
| | | // new MachineRotate(item,machineMapper,taskingService).start(); |
| | | // } |
| | | // for (Machine item:machineListLamination){ |
| | | // new MachineLamination(item,machineMapper,taskingService).start(); |
| | | // } |
| | | } |
| | | } |
| | |
| | | import com.github.xingshuangs.iot.protocol.s7.enums.EPlcType; |
| | | import com.mes.device.PlcParameterInfo; |
| | | import com.mes.device.PlcParameterObject; |
| | | import com.mes.service.ModbusTcp; |
| | | import com.mes.tools.InitUtil; |
| | | import com.mes.tools.S7control; |
| | | import lombok.extern.slf4j.Slf4j; |
| | |
| | | * @Description: |
| | | */ |
| | | @Slf4j |
| | | public class S7objectMachine extends Thread { |
| | | public class S7objectMachine{ |
| | | public S7control plccontrol; // PLC通讯类实例 |
| | | private EPlcType plcType = EPlcType.S1200; // 西门子PLC类型 |
| | | private String ip = ""; // plc ip地址 |
| | | private int port = 102; // plc 端口号 |
| | | private String plcFileName=""; // json名称 |
| | | public PlcParameterObject PlcMesObject; |
| | | public S7objectMachine(String ip,int port,String plcFileName,EPlcType plcType) { |
| | | |
| | | public S7objectMachine(String ip, int port, String plcFileName, EPlcType plcType) { |
| | | initialize(ip,port,plcFileName,plcType); |
| | | if (plccontrol == null) { |
| | | plccontrol = new S7control(this.plcType, this.ip, this.port, 0, 0); |
| | |
| | | } |
| | | log.info(logInfo); |
| | | } |
| | | @Override |
| | | public void run() { |
| | | while (this != null) { |
| | | try { |
| | | Thread.sleep(100); |
| | | } catch (InterruptedException e) { |
| | | e.printStackTrace(); |
| | | public void readData() { |
| | | try { |
| | | byte[] resultValues=new byte[PlcMesObject.getPlcAddressLength()]; |
| | | int maxRead=1092; |
| | | int size=PlcMesObject.getPlcAddressLength()%maxRead==0? |
| | | (PlcMesObject.getPlcAddressLength()/maxRead): |
| | | (PlcMesObject.getPlcAddressLength()/maxRead+1); |
| | | for (int i = 0; i <size ; i++) { |
| | | int begin=i*maxRead; |
| | | int length=(i==size-1?PlcMesObject.getPlcAddressLength()-begin:maxRead); |
| | | String beginAddress=PlcMesObject.getPlcAddressBegin().substring(0, PlcMesObject.getPlcAddressBegin().indexOf("."))+"."+begin; |
| | | byte[] getplcvlues = plccontrol.readByte(beginAddress, length); |
| | | System.arraycopy(getplcvlues,0,resultValues,begin,length); |
| | | } |
| | | try { |
| | | byte[] resultValues=new byte[PlcMesObject.getPlcAddressLength()]; |
| | | int maxRead=1092; |
| | | int size=PlcMesObject.getPlcAddressLength()%maxRead==0? |
| | | (PlcMesObject.getPlcAddressLength()/maxRead): |
| | | (PlcMesObject.getPlcAddressLength()/maxRead+1); |
| | | for (int i = 0; i <size ; i++) { |
| | | int begin=i*maxRead; |
| | | int length=(i==size-1?PlcMesObject.getPlcAddressLength()-begin:maxRead); |
| | | String beginAddress=PlcMesObject.getPlcAddressBegin().substring(0, PlcMesObject.getPlcAddressBegin().indexOf("."))+"."+begin; |
| | | byte[] getplcvlues = plccontrol.readByte(beginAddress, length); |
| | | System.arraycopy(getplcvlues,0,resultValues,begin,length); |
| | | } |
| | | if (resultValues != null) { |
| | | PlcMesObject.setPlcParameterList(resultValues); |
| | | } |
| | | } catch (Exception e) { |
| | | //log.info("异常:ip:{},port:{}",this.ip,this.port); |
| | | if (resultValues != null) { |
| | | PlcMesObject.setPlcParameterList(resultValues); |
| | | } |
| | | |
| | | } catch (Exception e) { |
| | | PlcMesObject=null; |
| | | log.info("异常:ip:{},port:{},错误{}",this.ip,this.port,e.getMessage()); |
| | | } |
| | | } |
| | | } |
| | |
| | | private List<Machine> machineListLamination; |
| | | |
| | | //机械手 |
| | | @Scheduled(fixedDelay = 500) |
| | | public void MarkingTasks() { |
| | | //@Scheduled(fixedDelay = 500) |
| | | public void loadTasks() { |
| | | try { |
| | | machineListLoad = machineMapper.selectList(new QueryWrapper<Machine>().lambda().eq(Machine::getName, "上片")); |
| | | JSONObject jsonObject = new JSONObject(); |
| | |
| | | } |
| | | |
| | | //磨边机 |
| | | @Scheduled(fixedDelay = 500) |
| | | //@Scheduled(fixedDelay = 500) |
| | | public void edgingTasks() { |
| | | try { |
| | | machineListEdging = machineMapper.selectList(new QueryWrapper<Machine>().lambda().eq(Machine::getName, "磨边")); |
| | |
| | | } |
| | | |
| | | //翻片台 |
| | | @Scheduled(fixedDelay = 500) |
| | | //@Scheduled(fixedDelay = 500) |
| | | public void flipSliceTasks() { |
| | | try { |
| | | machineListFlipSlice = machineMapper.selectList(new QueryWrapper<Machine>().lambda().eq(Machine::getName, "翻片")); |
| | |
| | | } |
| | | |
| | | //打标机 |
| | | @Scheduled(fixedDelay = 500) |
| | | //@Scheduled(fixedDelay = 500) |
| | | public void markingTasks() { |
| | | try { |
| | | machineListMarking = machineMapper.selectList(new QueryWrapper<Machine>().lambda().eq(Machine::getName, "自动打标机")); |
| | |
| | | } |
| | | |
| | | //丝印机 |
| | | @Scheduled(fixedDelay = 500) |
| | | //@Scheduled(fixedDelay = 500) |
| | | public void silkScreenTasks() { |
| | | try { |
| | | machineListSilkScreen = machineMapper.selectList(new QueryWrapper<Machine>().lambda().eq(Machine::getName, "自动丝印机")); |
| | |
| | | } |
| | | |
| | | //点胶机 |
| | | @Scheduled(fixedDelay = 500) |
| | | //@Scheduled(fixedDelay = 500) |
| | | public void glueDispenserTasks() { |
| | | try { |
| | | machineListGlueDispenser = machineMapper.selectList(new QueryWrapper<Machine>().lambda().eq(Machine::getName, "自动点胶机")); |
| | |
| | | } |
| | | |
| | | //旋转台 |
| | | @Scheduled(fixedDelay = 500) |
| | | //@Scheduled(fixedDelay = 500) |
| | | public void rotateTasks() { |
| | | try { |
| | | machineListRotate = machineMapper.selectList(new QueryWrapper<Machine>().lambda().eq(Machine::getName, "旋转台")); |
| | |
| | | } |
| | | |
| | | //贴膜机 |
| | | @Scheduled(fixedDelay = 500) |
| | | //@Scheduled(fixedDelay = 500) |
| | | public void laminationTasks() { |
| | | try { |
| | | machineListLamination = machineMapper.selectList(new QueryWrapper<Machine>().lambda().eq(Machine::getName, "自动贴膜机")); |
| | |
| | | |
| | | |
| | | //报工页面查询 |
| | | @Scheduled(fixedDelay = 1000) |
| | | //@Scheduled(fixedDelay = 1000) |
| | | public void manualReporting() { |
| | | try { |
| | | machineListScanQrCode = machineMapper.selectList(new QueryWrapper<Machine>().lambda().eq(Machine::getName, "识别报工")); |
| | |
| | | } |
| | | |
| | | //线下玻璃查询 |
| | | @Scheduled(fixedDelay = 1000) |
| | | //@Scheduled(fixedDelay = 1000) |
| | | public void downLineTask() { |
| | | try { |
| | | JSONObject jsonObject = new JSONObject(); |
| | |
| | | } catch (Exception ex) { |
| | | log.info("{}发送数据失败:{}", "rawGlassStorage", ex.getMessage()); |
| | | } |
| | | |
| | | } |
| | | // public void webSocketServer(JSONObject jsonObject) { |
| | | // try { |
| | |
| | | public S7objectMachine s7objectMachine; |
| | | |
| | | //@Scheduled(fixedDelay = 500) |
| | | public void cleaning() { |
| | | public void cleaning() throws Exception { |
| | | //磨边线速度 10.36.164.200 |
| | | Long machineId=8L; |
| | | Machine machine=machineMapper.selectById(machineId); |
| | | if (s7objectMachine==null){ |
| | | s7objectMachine=new S7objectMachine(machine.getIp(),machine.getPort(),"PlcCleaning", EPlcType.S200_SMART); |
| | | s7objectMachine.start(); |
| | | } |
| | | S7objectMachine s7objectMachine = new S7objectMachine(machine.getIp(),machine.getPort(),"PlcCleaning", EPlcType.S200_SMART); |
| | | s7objectMachine.readData();//按照json文件读取内容 |
| | | PlcParameterObject plcParameterObject = s7objectMachine.PlcMesObject; |
| | | PlcParameterInfo edgSpeed =plcParameterObject.getPlcParameter("edgSpeed");//磨边机速度 |
| | | PlcParameterInfo thinness =plcParameterObject.getPlcParameter("thinness");//厚度 |
| | | if (machine.getIsLog()>0){ |
| | | s7objectMachine.consoleLogInfo(); |
| | | if (plcParameterObject == null) { |
| | | s7objectMachine.plccontrol.closeS7client(); |
| | | return; |
| | | } |
| | | int edgSpeedInt=0; |
| | | int edgThinnessInt=0; |
| | | if(!(edgSpeedInt+"").equals(edgSpeed.getValue())||!(edgThinnessInt+"").equals(thinness.getValue())){ |
| | | //给清洗机器发送磨边机速度 |
| | | S7objectCleaning.getinstance().plccontrol.writeWord(edgSpeed.getAddress(), edgSpeedInt); |
| | | S7objectCleaning.getinstance().plccontrol.writeWord(thinness.getAddress(), edgThinnessInt); |
| | | try { |
| | | PlcParameterInfo edgSpeed =plcParameterObject.getPlcParameter("edgSpeed");//磨边机速度 |
| | | PlcParameterInfo thinness =plcParameterObject.getPlcParameter("thinness");//厚度 |
| | | if (machine.getIsLog()>0){ |
| | | s7objectMachine.consoleLogInfo(); |
| | | } |
| | | int edgSpeedInt=0; |
| | | int edgThinnessInt=0; |
| | | if(!(edgSpeedInt+"").equals(edgSpeed.getValue())||!(edgThinnessInt+"").equals(thinness.getValue())){ |
| | | //给清洗机器发送磨边机速度 |
| | | S7objectCleaning.getinstance().plccontrol.writeWord(edgSpeed.getAddress(), edgSpeedInt); |
| | | S7objectCleaning.getinstance().plccontrol.writeWord(thinness.getAddress(), edgThinnessInt); |
| | | } |
| | | }catch (Exception e) { |
| | | s7objectMachine.plccontrol.closeS7client(); |
| | | log.info("逻辑处理异常:设备id【{}】", machine.getId()); |
| | | } |
| | | |
| | | } |
| | | //@Scheduled(fixedDelay = 1000) |
| | | public void cleaningTask() { |
| | |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.mes.md.entity.KBBTJPDrawingBP; |
| | | import com.mes.md.entity.PrimitiveTask; |
| | | import com.mes.md.entity.TaskingLog; |
| | | import com.mes.md.entity.*; |
| | | import com.mes.md.mapper.KBBTJPDrawingBPMapper; |
| | | import com.mes.md.mapper.TaskingLogMapper; |
| | | import com.mes.md.service.KBBTJPDrawingBPService; |
| | | import com.mes.md.service.LineConfigurationService; |
| | | import com.mes.md.service.PrimitiveTaskService; |
| | | import com.mes.md.service.TaskingLogService; |
| | | import com.mes.utils.Result; |
| | |
| | | TaskingLogService taskingLogService; |
| | | @Autowired |
| | | TaskingLogMapper taskingLogMapper; |
| | | @Autowired |
| | | LineConfigurationService lineConfigurationService; |
| | | |
| | | @ApiOperation("查询当前设备,未完工状态的线上任务") |
| | | @PostMapping("/selectPrimitiveTask") |
| | | @PostMapping("/findMachineTask") |
| | | @ResponseBody |
| | | public Result findMachineTask(@RequestBody PrimitiveTask primitiveTask) { |
| | | List<PrimitiveTask> list =primitiveTaskService.selectPrimitiveTask(primitiveTask); |
| | | public Result findMachineTask(@RequestBody Machine machine) { |
| | | LineConfiguration lineConfiguration = lineConfigurationService.machineLineConfiguration(machine); |
| | | List<PrimitiveTask> list =primitiveTaskService.findPrimitiveTasking(machine,lineConfiguration.getLineId()); |
| | | return Result.build(200,"成功",list); |
| | | } |
| | | |
| | |
| | | this.taskingService = taskingService; |
| | | } |
| | | |
| | | public void plcStart() { |
| | | public void plcStart()throws Exception { |
| | | Machine machine = machineMapper.selectById(thisMachine.getId()); |
| | | String fileName = machine.getFileName(); |
| | | ModbusTcp modbusTcp1 = new ModbusTcp(machine.getIp(), machine.getPort(), fileName); |
| | |
| | | |
| | | @Override |
| | | public void run() { |
| | | while (this != null) { |
| | | while (true) { |
| | | try { |
| | | Thread.sleep(1000); |
| | | plcStart(); |
| | | } catch (InterruptedException e) { |
| | | e.printStackTrace(); |
| | | }catch (Exception e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | } |
| | | } |
| | |
| | | this.lineConfigurationService = lineConfigurationService; |
| | | } |
| | | |
| | | public void plcStart() { |
| | | public void plcStart() throws Exception{ |
| | | Machine machine=machineMapper.selectById(thisMachine.getId()); |
| | | ModbusTcp modbusTcp1 =new ModbusTcp(machine.getIp(),machine.getPort(),machine.getFileName()); |
| | | try { |
| | |
| | | } |
| | | @Override |
| | | public void run() { |
| | | while (this != null) { |
| | | while (true) { |
| | | try { |
| | | Thread.sleep(1000); |
| | | plcStart(); |
| | | } catch (InterruptedException e) { |
| | | e.printStackTrace(); |
| | | } catch (Exception e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | } |
| | | } |
| | |
| | | import java.util.*; |
| | | |
| | | @Slf4j |
| | | public class MachineFlipSlice extends Thread{ |
| | | public class MachineFlipSlice extends Thread { |
| | | |
| | | |
| | | private MachineMapper machineMapper; |
| | | private TaskingService taskingService; |
| | | private S7objectMachine s7objectMachine; |
| | | public static int thinness = 40; |
| | | public static int edgSpeed = 40; |
| | | //public static Long machineId = 6L; |
| | | public List<Map> sendRecords = new ArrayList<>(); |
| | | public Machine thisMachine; |
| | | |
| | | public MachineFlipSlice(Machine machine,MachineMapper machineMapper, TaskingService taskingService){ |
| | | public MachineFlipSlice(Machine machine, MachineMapper machineMapper, TaskingService taskingService) { |
| | | this.thisMachine = machine; |
| | | this.machineMapper = machineMapper; |
| | | this.taskingService = taskingService; |
| | | } |
| | | |
| | | public void plcStart() { |
| | | //Long machineId=26L; |
| | | Machine machine=machineMapper.selectById(thisMachine.getId()); |
| | | if (s7objectMachine==null){ |
| | | s7objectMachine=new S7objectMachine(machine.getIp(),machine.getPort(),machine.getFileName(), EPlcType.S1200); |
| | | s7objectMachine.start(); |
| | | } |
| | | public void plcStart() throws Exception { |
| | | Machine machine = machineMapper.selectById(thisMachine.getId()); |
| | | S7objectMachine s7objectMachine = new S7objectMachine(machine.getIp(), machine.getPort(), machine.getFileName(), EPlcType.S1200); |
| | | s7objectMachine.readData();//按照json文件读取内容 |
| | | PlcParameterObject plcParameterObject = s7objectMachine.PlcMesObject; |
| | | PlcParameterInfo plcRequest =plcParameterObject.getPlcParameter("plcRequest");//请求字 |
| | | PlcParameterInfo plcRequestID =plcParameterObject.getPlcParameter("plcRequestID");//请求ID |
| | | PlcParameterInfo plcRequestType =plcParameterObject.getPlcParameter("plcRequestType");//PLC请求 |
| | | |
| | | PlcParameterInfo mesSend =plcParameterObject.getPlcParameter("mesSend");//发送字 |
| | | PlcParameterInfo mesSendId =plcParameterObject.getPlcParameter("mesSendID");//发送ID |
| | | PlcParameterInfo length =plcParameterObject.getPlcParameter("length");//长 |
| | | PlcParameterInfo width =plcParameterObject.getPlcParameter("width");//宽 |
| | | PlcParameterInfo mesSendType =plcParameterObject.getPlcParameter("mesSendType");// 扫码1 不扫码2 |
| | | |
| | | String scan_id=""; |
| | | if (machine.getIsLog()>0){ |
| | | s7objectMachine.consoleLogInfo(); |
| | | } |
| | | if ("0".equals(plcRequestType.getValue())&&!"0".equals(mesSendType.getValue())) { |
| | | //发送字置0 |
| | | log.info("1.发送类型字置零,清除上次发送的类型数据{}->0",mesSendType.getValue()); |
| | | s7objectMachine.plccontrol.writeWord(mesSendType.getAddress(), 0); |
| | | |
| | | if (plcParameterObject == null) { |
| | | s7objectMachine.plccontrol.closeS7client(); |
| | | return; |
| | | } |
| | | if ("0".equals(plcRequest.getValue())&&!"0".equals(mesSend.getValue())) { |
| | | //发送字置0 |
| | | int finishCount=taskingService.finishMachineTask(machine); |
| | | nullMachine(machine); |
| | | log.info("2.发送字置零,清除上次发送的数据{},{},{},{},{}" |
| | | ,finishCount |
| | | ,length.getValue() |
| | | ,width.getValue() |
| | | ,mesSendId.getValue() |
| | | ,mesSend.getValue()); |
| | | s7objectMachine.plccontrol.writeWord(length.getAddress(), 0); |
| | | s7objectMachine.plccontrol.writeWord(width.getAddress(), 0); |
| | | s7objectMachine.plccontrol.writeWord(mesSendId.getAddress(), 0); |
| | | s7objectMachine.plccontrol.writeWord(mesSend.getAddress(), 0); |
| | | return; |
| | | } |
| | | if ("1".equals(plcRequestType.getValue())&&"0".equals(mesSendType.getValue())) { |
| | | //发送类型 1扫码 2不扫码 |
| | | int type=machine.getMode()==1?2:1; |
| | | log.info("3.发送类型数据0->{}",mesSendType.getValue()); |
| | | s7objectMachine.plccontrol.writeWord(mesSendType.getAddress(), type); |
| | | return; |
| | | } |
| | | List<Tasking> taskingCount=taskingService.findMachineWorkStateTask(machine,"正在工作"); |
| | | if(("1".equals(plcRequest.getValue())&&"0".equals(mesSend.getValue()) |
| | | &&"开工".equals(machine.getState()) |
| | | &&taskingCount.size()<machine.getMaxTaskCount())){ |
| | | Tasking tasking; |
| | | if(machine.getMode()==1){ |
| | | //标准模式 |
| | | tasking=taskingService.startMachineTask(machine); |
| | | }else{ |
| | | //定制模式 |
| | | String PlcRequestID_=plcRequestID.getValue(); |
| | | //String PlcRequestID_=",,46403118"; |
| | | scan_id= PlcRequestID_.substring(PlcRequestID_.lastIndexOf(",")+1); |
| | | tasking=taskingService.startScanIdMachineTask(machine,scan_id);//不管顺序,直接找从磨边机扫码后到翻片台的数据 |
| | | try { |
| | | PlcParameterInfo plcRequest = plcParameterObject.getPlcParameter("plcRequest");//请求字 |
| | | PlcParameterInfo plcRequestID = plcParameterObject.getPlcParameter("plcRequestID");//请求ID |
| | | PlcParameterInfo plcRequestType = plcParameterObject.getPlcParameter("plcRequestType");//PLC请求 |
| | | |
| | | PlcParameterInfo mesSend = plcParameterObject.getPlcParameter("mesSend");//发送字 |
| | | PlcParameterInfo mesSendId = plcParameterObject.getPlcParameter("mesSendID");//发送ID |
| | | PlcParameterInfo length = plcParameterObject.getPlcParameter("length");//长 |
| | | PlcParameterInfo width = plcParameterObject.getPlcParameter("width");//宽 |
| | | PlcParameterInfo mesSendType = plcParameterObject.getPlcParameter("mesSendType");// 扫码1 不扫码2 |
| | | |
| | | String scan_id = ""; |
| | | if (machine.getIsLog() > 0) { |
| | | s7objectMachine.consoleLogInfo(); |
| | | } |
| | | if(tasking!=null){ |
| | | log.info("4、发送数据:{},{},{},{},{}" |
| | | ,tasking.getGlassId(),tasking.getProgramId() |
| | | ,tasking.getLength().intValue(),tasking.getWidth().intValue(),1); |
| | | s7objectMachine.plccontrol.writeWord(length.getAddress(), tasking.getLength().intValue()); |
| | | s7objectMachine.plccontrol.writeWord(width.getAddress(), tasking.getWidth().intValue()); |
| | | s7objectMachine.plccontrol.writeString(mesSendId.getAddress(), tasking.getTaskSequence().toString()); |
| | | s7objectMachine.plccontrol.writeWord(mesSend.getAddress(), 1); |
| | | SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | String sendRecord=df.format(new Date())+" "+ |
| | | tasking.getGlassId()+"-"+ |
| | | tasking.getLength()+"-"+ |
| | | tasking.getWidth(); |
| | | if (sendRecords.size()>7){ |
| | | sendRecords.remove(0); |
| | | } |
| | | Map sendContentMap=new HashMap(); |
| | | sendContentMap.put("sendContent",sendRecord); |
| | | sendRecords.add(sendContentMap); |
| | | nullMachine(machine); |
| | | if ("0".equals(plcRequestType.getValue()) && !"0".equals(mesSendType.getValue())) { |
| | | //发送字置0 |
| | | log.info("1.发送类型字置零,清除上次发送的类型数据{}->0", mesSendType.getValue()); |
| | | s7objectMachine.plccontrol.writeWord(mesSendType.getAddress(), 0); |
| | | |
| | | return; |
| | | }else if(!scan_id.isEmpty()){ |
| | | taskingService.scanMachineAdd(machine,scan_id); |
| | | } |
| | | }else if("0".equals(plcRequest.getValue())){ |
| | | nullMachine(machine); |
| | | if ("0".equals(plcRequest.getValue()) && !"0".equals(mesSend.getValue())) { |
| | | //发送字置0 |
| | | int finishCount = taskingService.finishMachineTask(machine); |
| | | nullMachine(machine); |
| | | log.info("2.发送字置零,清除上次发送的数据{},{},{},{},{}" |
| | | , finishCount |
| | | , length.getValue() |
| | | , width.getValue() |
| | | , mesSendId.getValue() |
| | | , mesSend.getValue()); |
| | | s7objectMachine.plccontrol.writeWord(length.getAddress(), 0); |
| | | s7objectMachine.plccontrol.writeWord(width.getAddress(), 0); |
| | | s7objectMachine.plccontrol.writeWord(mesSendId.getAddress(), 0); |
| | | s7objectMachine.plccontrol.writeWord(mesSend.getAddress(), 0); |
| | | return; |
| | | } |
| | | if ("1".equals(plcRequestType.getValue()) && "0".equals(mesSendType.getValue())) { |
| | | //发送类型 1扫码 2不扫码 |
| | | int type = machine.getMode() == 1 ? 2 : 1; |
| | | log.info("3.发送类型数据0->{}", mesSendType.getValue()); |
| | | s7objectMachine.plccontrol.writeWord(mesSendType.getAddress(), type); |
| | | return; |
| | | } |
| | | List<Tasking> taskingCount = taskingService.findMachineWorkStateTask(machine, "正在工作"); |
| | | if (("1".equals(plcRequest.getValue()) && "0".equals(mesSend.getValue()) |
| | | && "开工".equals(machine.getState()) |
| | | && taskingCount.size() < machine.getMaxTaskCount())) { |
| | | Tasking tasking; |
| | | if (machine.getMode() == 1) { |
| | | //标准模式 |
| | | tasking = taskingService.startMachineTask(machine); |
| | | } else { |
| | | //定制模式 |
| | | String PlcRequestID_ = plcRequestID.getValue(); |
| | | //String PlcRequestID_=",,46403118"; |
| | | scan_id = PlcRequestID_.substring(PlcRequestID_.lastIndexOf(",") + 1); |
| | | tasking = taskingService.startScanIdMachineTask(machine, scan_id);//不管顺序,直接找从磨边机扫码后到翻片台的数据 |
| | | } |
| | | if (tasking != null) { |
| | | log.info("4、发送数据:{},{},{},{},{}" |
| | | , tasking.getGlassId(), tasking.getProgramId() |
| | | , tasking.getLength().intValue(), tasking.getWidth().intValue(), 1); |
| | | s7objectMachine.plccontrol.writeWord(length.getAddress(), tasking.getLength().intValue()); |
| | | s7objectMachine.plccontrol.writeWord(width.getAddress(), tasking.getWidth().intValue()); |
| | | s7objectMachine.plccontrol.writeString(mesSendId.getAddress(), tasking.getTaskSequence().toString()); |
| | | s7objectMachine.plccontrol.writeWord(mesSend.getAddress(), 1); |
| | | SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | String sendRecord = df.format(new Date()) + " " + |
| | | tasking.getGlassId() + "-" + |
| | | tasking.getLength() + "-" + |
| | | tasking.getWidth(); |
| | | if (sendRecords.size() > 7) { |
| | | sendRecords.remove(0); |
| | | } |
| | | Map sendContentMap = new HashMap(); |
| | | sendContentMap.put("sendContent", sendRecord); |
| | | sendRecords.add(sendContentMap); |
| | | nullMachine(machine); |
| | | return; |
| | | } else if (!scan_id.isEmpty()) { |
| | | taskingService.scanMachineAdd(machine, scan_id); |
| | | } |
| | | } else if ("0".equals(plcRequest.getValue())) { |
| | | nullMachine(machine); |
| | | } |
| | | } catch (Exception e) { |
| | | s7objectMachine.plccontrol.closeS7client(); |
| | | log.info("逻辑处理异常:设备id【{}】", machine.getId()); |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | public void nullMachine(Machine machine) { |
| | | if (!"".equals(machine.getRemark())){ |
| | | if (!"".equals(machine.getRemark())) { |
| | | machine.setRemark(""); |
| | | machineMapper.updateById(machine); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void run() { |
| | | while (this != null) { |
| | | while (true) { |
| | | try { |
| | | Thread.sleep(1000); |
| | | plcStart(); |
| | | } catch (InterruptedException e) { |
| | | e.printStackTrace(); |
| | | } catch (Exception e) { |
| | | log.info("{}", e.getMessage()); |
| | | } |
| | | } |
| | | } |
| | |
| | | import java.util.Map; |
| | | |
| | | @Slf4j |
| | | public class MachineLamination extends Thread{ |
| | | public class MachineLamination extends Thread { |
| | | |
| | | |
| | | private MachineMapper machineMapper; |
| | | private TaskingService taskingService; |
| | | private S7objectMachine s7objectMachine; |
| | | public Machine thisMachine; |
| | | public MachineLamination(Machine machine, MachineMapper machineMapper, TaskingService taskingService){ |
| | | |
| | | public MachineLamination(Machine machine, MachineMapper machineMapper, TaskingService taskingService) { |
| | | this.thisMachine = machine; |
| | | this.machineMapper = machineMapper; |
| | | this.taskingService = taskingService; |
| | | } |
| | | |
| | | public void plcStart() { |
| | | Machine machine=machineMapper.selectById(thisMachine.getId()); |
| | | if (s7objectMachine==null){ |
| | | s7objectMachine=new S7objectMachine(machine.getIp(),machine.getPort(),machine.getFileName(), EPlcType.S1200); |
| | | s7objectMachine.start(); |
| | | } |
| | | PlcParameterObject plcParameterObject = s7objectMachine.PlcMesObject; |
| | | PlcParameterInfo plcRequest =plcParameterObject.getPlcParameter("plcRequest");//请求字 |
| | | PlcParameterInfo mesSend =plcParameterObject.getPlcParameter("mesSend");//发送字 |
| | | PlcParameterInfo lengthOutOfService =plcParameterObject.getPlcParameter("length");//长 |
| | | PlcParameterInfo widthOutOfService =plcParameterObject.getPlcParameter("width");//宽 |
| | | PlcParameterInfo markingMode =plcParameterObject.getPlcParameter("thickness");//厚度 |
| | | public void plcStart()throws Exception { |
| | | Machine machine = machineMapper.selectById(thisMachine.getId()); |
| | | |
| | | PlcParameterInfo plcReport =plcParameterObject.getPlcParameter("plcReport");//汇报字 |
| | | PlcParameterInfo mesConfirm =plcParameterObject.getPlcParameter("mesConfirm");//确认字 |
| | | PlcParameterInfo mesConfirmID =plcParameterObject.getPlcParameter("mesConfirmID");//确认ID |
| | | if (machine.getIsLog()>0){ |
| | | S7objectMachine s7objectMachine = new S7objectMachine(machine.getIp(), machine.getPort(), machine.getFileName(), EPlcType.S1200); |
| | | s7objectMachine.readData();//按照json文件读取内容 |
| | | PlcParameterObject plcParameterObject = s7objectMachine.PlcMesObject; |
| | | if (plcParameterObject == null) { |
| | | s7objectMachine.plccontrol.closeS7client(); |
| | | return; |
| | | } |
| | | try { |
| | | PlcParameterInfo plcRequest = plcParameterObject.getPlcParameter("plcRequest");//请求字 |
| | | PlcParameterInfo mesSend = plcParameterObject.getPlcParameter("mesSend");//发送字 |
| | | PlcParameterInfo lengthOutOfService = plcParameterObject.getPlcParameter("length");//长 |
| | | PlcParameterInfo widthOutOfService = plcParameterObject.getPlcParameter("width");//宽 |
| | | PlcParameterInfo markingMode = plcParameterObject.getPlcParameter("thickness");//厚度 |
| | | |
| | | PlcParameterInfo plcReport = plcParameterObject.getPlcParameter("plcReport");//汇报字 |
| | | PlcParameterInfo mesConfirm = plcParameterObject.getPlcParameter("mesConfirm");//确认字 |
| | | PlcParameterInfo mesConfirmID = plcParameterObject.getPlcParameter("mesConfirmID");//确认ID |
| | | if (machine.getIsLog() > 0) { |
| | | s7objectMachine.consoleLogInfo(); |
| | | } |
| | | if ("0".equals(plcRequest.getValue())&&"1".equals(mesSend.getValue())) { |
| | | if ("0".equals(plcRequest.getValue()) && "1".equals(mesSend.getValue())) { |
| | | //发送字置0 |
| | | log.info("1.发送字置零,清除上次发送的数据{}",mesSend.getValue()); |
| | | log.info("1.发送字置零,清除上次发送的数据{}", mesSend.getValue()); |
| | | s7objectMachine.plccontrol.writeWord(mesSend.getAddress(), 0); |
| | | return; |
| | | } |
| | | if ("0".equals(plcReport.getValue())&&"1".equals(mesConfirm.getValue())) { |
| | | if ("0".equals(plcReport.getValue()) && "1".equals(mesConfirm.getValue())) { |
| | | log.info("2.确认字置零"); |
| | | //发送字置0 |
| | | s7objectMachine.plccontrol.writeWord(mesConfirm.getAddress(), 0); |
| | | return; |
| | | } |
| | | if("1".equals(plcReport.getValue())&&"0".equals(mesConfirm.getValue())){ |
| | | |
| | | |
| | | int finishCount=taskingService.finishMachineTask(machine); |
| | | if ("1".equals(plcReport.getValue()) && "0".equals(mesConfirm.getValue())) { |
| | | int finishCount = taskingService.finishMachineTask(machine); |
| | | log.info("3、任务完成"); |
| | | if(finishCount>0){//有任务 |
| | | if (finishCount > 0) {//有任务 |
| | | s7objectMachine.plccontrol.writeWord(mesConfirm.getAddress(), 1); |
| | | return; |
| | | } |
| | | return; |
| | | } |
| | | List<Tasking> taskingCount=taskingService.findMachineWorkStateTask(machine,"正在工作"); |
| | | if("1".equals(plcRequest.getValue())&&"0".equals(mesSend.getValue()) |
| | | &&"开工".equals(machine.getState()) |
| | | &&taskingCount.size()<machine.getMaxTaskCount()){ |
| | | List<Tasking> taskingCount = taskingService.findMachineWorkStateTask(machine, "正在工作"); |
| | | if ("1".equals(plcRequest.getValue()) && "0".equals(mesSend.getValue()) |
| | | && "开工".equals(machine.getState()) |
| | | && taskingCount.size() < machine.getMaxTaskCount()) { |
| | | |
| | | Tasking tasking=taskingService.startMachineTask(machine); |
| | | if(tasking!=null){ |
| | | log.info("4、发送数据:{},{},{}",tasking.getLength().intValue(),tasking.getWidth().intValue(),1); |
| | | Tasking tasking = taskingService.startMachineTask(machine); |
| | | if (tasking != null) { |
| | | log.info("4、发送数据:{},{},{}", tasking.getLength().intValue(), tasking.getWidth().intValue(), 1); |
| | | s7objectMachine.plccontrol.writeWord(lengthOutOfService.getAddress(), tasking.getLength().intValue());//x |
| | | s7objectMachine.plccontrol.writeWord(widthOutOfService.getAddress(), tasking.getWidth().intValue());//y |
| | | |
| | |
| | | return; |
| | | } |
| | | } |
| | | } catch (Exception e) { |
| | | s7objectMachine.plccontrol.closeS7client(); |
| | | log.info("逻辑处理异常:设备id【{}】", machine.getId()); |
| | | } |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void run() { |
| | | while (this != null) { |
| | | while (true) { |
| | | try { |
| | | Thread.sleep(1000); |
| | | plcStart(); |
| | | } catch (InterruptedException e) { |
| | | e.printStackTrace(); |
| | | } catch (Exception e) { |
| | | log.info("{}", e.getMessage()); |
| | | } |
| | | } |
| | | } |
| | |
| | | this.lineConfigurationService = lineConfigurationService; |
| | | } |
| | | |
| | | public void plcStart() { |
| | | public void plcStart() throws Exception{ |
| | | ModbusTcp modbusTcp1 = null; |
| | | try { |
| | | Machine machine = machineMapper.selectById(thisMachine.getId()); |
| | |
| | | |
| | | @Override |
| | | public void run() { |
| | | while (this != null) { |
| | | while (true) { |
| | | try { |
| | | Thread.sleep(1000); |
| | | plcStart(); |
| | | } catch (InterruptedException e) { |
| | | e.printStackTrace(); |
| | | }catch (Exception e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | } |
| | | } |
| | |
| | | import java.util.*; |
| | | |
| | | @Slf4j |
| | | public class MachineMarking extends Thread{ |
| | | public class MachineMarking extends Thread { |
| | | |
| | | |
| | | private MachineMapper machineMapper; |
| | |
| | | //public static Long machineId = 6L; |
| | | public List<Map> sendRecords = new ArrayList<>(); |
| | | public Machine thisMachine; |
| | | public MachineMarking(Machine machine,MachineMapper machineMapper, TaskingService taskingService){ |
| | | |
| | | public MachineMarking(Machine machine, MachineMapper machineMapper, TaskingService taskingService) { |
| | | this.thisMachine = machine; |
| | | this.machineMapper = machineMapper; |
| | | this.taskingService = taskingService; |
| | | } |
| | | |
| | | public void plcStart() { |
| | | //Long machineId=12L; |
| | | Machine machine=machineMapper.selectById(thisMachine.getId()); |
| | | // S7objectMachine s7objectMachine=new S7objectMachine(machine.getIp(),machine.getPort(),"PlcMarking", EPlcType.S1500); |
| | | // s7objectMachine.start(); |
| | | if (s7objectMachine==null){ |
| | | s7objectMachine=new S7objectMachine(machine.getIp(),machine.getPort(),machine.getFileName(), EPlcType.S1500); |
| | | s7objectMachine.start(); |
| | | } |
| | | PlcParameterObject plcParameterObject = s7objectMachine.PlcMesObject; |
| | | PlcParameterInfo plcRequest =plcParameterObject.getPlcParameter("plcRequest");//请求字 |
| | | PlcParameterInfo plcRequestID =plcParameterObject.getPlcParameter("plcRequestID");//请求ID |
| | | PlcParameterInfo mesSend =plcParameterObject.getPlcParameter("mesSend");//发送字 |
| | | PlcParameterInfo isMark =plcParameterObject.getPlcParameter("isMark");//发送ID【0 不打标,1标准模式,2定制模式】 |
| | | PlcParameterInfo drawingMark =plcParameterObject.getPlcParameter("drawingMark");//打标图纸地址 |
| | | PlcParameterInfo lengthOutOfService =plcParameterObject.getPlcParameter("length(OutOfService)");//长 |
| | | PlcParameterInfo widthOutOfService =plcParameterObject.getPlcParameter("width(OutOfService)");//宽 |
| | | PlcParameterInfo markingMode =plcParameterObject.getPlcParameter("markingMode");// |
| | | public void plcStart()throws Exception { |
| | | Machine machine = machineMapper.selectById(thisMachine.getId()); |
| | | S7objectMachine s7objectMachine = new S7objectMachine(machine.getIp(), machine.getPort(), machine.getFileName(), EPlcType.S1500); |
| | | s7objectMachine.readData();//按照json文件读取内容 |
| | | PlcParameterObject plcParameterObject = s7objectMachine.PlcMesObject; |
| | | if (plcParameterObject == null) { |
| | | s7objectMachine.plccontrol.closeS7client(); |
| | | return; |
| | | } |
| | | try { |
| | | PlcParameterInfo plcRequest = plcParameterObject.getPlcParameter("plcRequest");//请求字 |
| | | PlcParameterInfo plcRequestID = plcParameterObject.getPlcParameter("plcRequestID");//请求ID |
| | | PlcParameterInfo mesSend = plcParameterObject.getPlcParameter("mesSend");//发送字 |
| | | PlcParameterInfo isMark = plcParameterObject.getPlcParameter("isMark");//发送ID【0 不打标,1标准模式,2定制模式】 |
| | | PlcParameterInfo drawingMark = plcParameterObject.getPlcParameter("drawingMark");//打标图纸地址 |
| | | PlcParameterInfo lengthOutOfService = plcParameterObject.getPlcParameter("length(OutOfService)");//长 |
| | | PlcParameterInfo widthOutOfService = plcParameterObject.getPlcParameter("width(OutOfService)");//宽 |
| | | PlcParameterInfo markingMode = plcParameterObject.getPlcParameter("markingMode");// |
| | | |
| | | PlcParameterInfo plcReport =plcParameterObject.getPlcParameter("plcReport");//汇报字 |
| | | PlcParameterInfo plcReportID =plcParameterObject.getPlcParameter("plcReportID");//汇报ID |
| | | PlcParameterInfo mesConfirm =plcParameterObject.getPlcParameter("mesConfirm");//确认字 |
| | | PlcParameterInfo mesConfirmID =plcParameterObject.getPlcParameter("mesConfirmID");//确认ID |
| | | if (machine.getIsLog()>0){ |
| | | PlcParameterInfo plcReport = plcParameterObject.getPlcParameter("plcReport");//汇报字 |
| | | PlcParameterInfo plcReportID = plcParameterObject.getPlcParameter("plcReportID");//汇报ID |
| | | PlcParameterInfo mesConfirm = plcParameterObject.getPlcParameter("mesConfirm");//确认字 |
| | | PlcParameterInfo mesConfirmID = plcParameterObject.getPlcParameter("mesConfirmID");//确认ID |
| | | if (machine.getIsLog() > 0) { |
| | | s7objectMachine.consoleLogInfo(); |
| | | } |
| | | if ("0".equals(plcRequest.getValue())&&"1".equals(mesSend.getValue())) { |
| | | if ("0".equals(plcRequest.getValue()) && "1".equals(mesSend.getValue())) { |
| | | //发送字置0 |
| | | log.info("1.发送字置零,清除上次发送的数据{},{},{},{},{}" |
| | | ,markingMode.getValue() |
| | | ,isMark.getValue() |
| | | ,lengthOutOfService.getValue() |
| | | ,widthOutOfService.getValue() |
| | | ,mesSend.getValue()); |
| | | , markingMode.getValue() |
| | | , isMark.getValue() |
| | | , lengthOutOfService.getValue() |
| | | , widthOutOfService.getValue() |
| | | , mesSend.getValue()); |
| | | //S7objectMarking.getinstance().plccontrol.writeString(drawingMark.getAddress(),""); |
| | | s7objectMachine.plccontrol.writeWord(markingMode.getAddress(), 0); |
| | | s7objectMachine.plccontrol.writeWord(lengthOutOfService.getAddress(), 0); |
| | |
| | | s7objectMachine.plccontrol.writeWord(mesSend.getAddress(), 0); |
| | | return; |
| | | } |
| | | if ("0".equals(plcReport.getValue())&&"1".equals(mesConfirm.getValue())) { |
| | | if ("0".equals(plcReport.getValue()) && "1".equals(mesConfirm.getValue())) { |
| | | log.info("2.确认字置零"); |
| | | //发送字置0 |
| | | s7objectMachine.plccontrol.writeWord(mesConfirm.getAddress(), 0); |
| | | return; |
| | | } |
| | | if("1".equals(plcReport.getValue())&&"0".equals(mesConfirm.getValue())){ |
| | | int finishCount=taskingService.finishMachineTask(machine); |
| | | if ("1".equals(plcReport.getValue()) && "0".equals(mesConfirm.getValue())) { |
| | | int finishCount = taskingService.finishMachineTask(machine); |
| | | log.info("3、任务完成"); |
| | | if(finishCount>0){//有任务 |
| | | if (finishCount > 0) {//有任务 |
| | | s7objectMachine.plccontrol.writeWord(mesConfirm.getAddress(), 1); |
| | | return; |
| | | } |
| | | return; |
| | | } |
| | | List<Tasking> taskingCount=taskingService.findMachineWorkStateTask(machine,"正在工作"); |
| | | if("1".equals(plcRequest.getValue())&&"0".equals(mesSend.getValue())&& !plcRequestID.getValue().isEmpty() |
| | | &&"开工".equals(machine.getState()) |
| | | &&taskingCount.size()<machine.getMaxTaskCount()){ |
| | | Tasking tasking=taskingService.startMachineTask(machine); |
| | | if(tasking!=null){ |
| | | List<Tasking> taskingCount = taskingService.findMachineWorkStateTask(machine, "正在工作"); |
| | | if ("1".equals(plcRequest.getValue()) && "0".equals(mesSend.getValue()) && !plcRequestID.getValue().isEmpty() |
| | | && "开工".equals(machine.getState()) |
| | | && taskingCount.size() < machine.getMaxTaskCount()) { |
| | | Tasking tasking = taskingService.startMachineTask(machine); |
| | | if (tasking != null) { |
| | | //模式:1定制 0 批量 是否打标:0不打标 1打标 |
| | | int isMark_=(tasking.getDrawingMarking()==null||tasking.getDrawingMarking().isEmpty())?0:1; |
| | | int isMarkingMode_="定制".equals(tasking.getTaskType()) ?1:0; |
| | | int isMark_ = (tasking.getDrawingMarking() == null || tasking.getDrawingMarking().isEmpty()) ? 0 : 1; |
| | | int isMarkingMode_ = "定制".equals(tasking.getTaskType()) ? 1 : 0; |
| | | log.info("4、发送数据:{},{},{},{},{},{}" |
| | | ,tasking.getProgramId() |
| | | ,tasking.getLength().intValue(),tasking.getWidth().intValue(),isMark_,isMarkingMode_,1); |
| | | if(isMark_==1){ |
| | | , tasking.getProgramId() |
| | | , tasking.getLength().intValue(), tasking.getWidth().intValue(), isMark_, isMarkingMode_, 1); |
| | | if (isMark_ == 1) { |
| | | s7objectMachine.plccontrol.writeString(drawingMark.getAddress(), tasking.getProgramId()); |
| | | } |
| | | s7objectMachine.plccontrol.writeWord(widthOutOfService.getAddress(), tasking.getWidth().intValue());//y |
| | |
| | | return; |
| | | } |
| | | } |
| | | } catch (Exception e) { |
| | | s7objectMachine.plccontrol.closeS7client(); |
| | | log.info("逻辑处理异常:设备id【{}】", machine.getId()); |
| | | } |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void run() { |
| | | while (this != null) { |
| | | while (true) { |
| | | try { |
| | | Thread.sleep(1000); |
| | | plcStart(); |
| | | } catch (InterruptedException e) { |
| | | e.printStackTrace(); |
| | | } catch (Exception e) { |
| | | log.info("{}", e.getMessage()); |
| | | } |
| | | } |
| | | } |
| | |
| | | import java.util.*; |
| | | |
| | | @Slf4j |
| | | public class MachineRotate extends Thread{ |
| | | public class MachineRotate extends Thread { |
| | | |
| | | |
| | | private MachineMapper machineMapper; |
| | |
| | | public List<Map> sendRecords = new ArrayList<>(); |
| | | public Machine thisMachine; |
| | | |
| | | public MachineRotate(Machine machine,MachineMapper machineMapper, TaskingService taskingService){ |
| | | public MachineRotate(Machine machine, MachineMapper machineMapper, TaskingService taskingService) { |
| | | this.thisMachine = machine; |
| | | this.machineMapper = machineMapper; |
| | | this.taskingService = taskingService; |
| | | } |
| | | public void plcStart() { |
| | | |
| | | public void plcStart() throws Exception { |
| | | //旋转台 |
| | | //Long machineId=20L; |
| | | Machine machine=machineMapper.selectById(thisMachine.getId()); |
| | | if (s7objectMachine==null){ |
| | | s7objectMachine=new S7objectMachine(machine.getIp(),machine.getPort(),machine.getFileName(), EPlcType.S1200); |
| | | s7objectMachine.start(); |
| | | } |
| | | Machine machine = machineMapper.selectById(thisMachine.getId()); |
| | | S7objectMachine s7objectMachine = new S7objectMachine(machine.getIp(), machine.getPort(), machine.getFileName(), EPlcType.S1200); |
| | | s7objectMachine.readData();//按照json文件读取内容 |
| | | PlcParameterObject plcParameterObject = s7objectMachine.PlcMesObject; |
| | | PlcParameterInfo plcRequest =plcParameterObject.getPlcParameter("plcRequest");//请求字 |
| | | PlcParameterInfo plcRequestID =plcParameterObject.getPlcParameter("plcRequestID");//请求ID |
| | | PlcParameterInfo plcRequestType =plcParameterObject.getPlcParameter("plcRequestType");//PLC请求 |
| | | |
| | | PlcParameterInfo mesSend =plcParameterObject.getPlcParameter("mesSend");//发送字 |
| | | PlcParameterInfo mesSendId =plcParameterObject.getPlcParameter("mesSendID");//发送ID |
| | | PlcParameterInfo length =plcParameterObject.getPlcParameter("length");//长 |
| | | PlcParameterInfo width =plcParameterObject.getPlcParameter("width");//宽 |
| | | PlcParameterInfo rotateType =plcParameterObject.getPlcParameter("rotateType");//旋转类型 |
| | | |
| | | PlcParameterInfo mesSendType =plcParameterObject.getPlcParameter("mesSendType");// 扫码1 不扫码2 |
| | | String scan_id=""; |
| | | if (machine.getIsLog()>0){ |
| | | s7objectMachine.consoleLogInfo(); |
| | | } |
| | | if ("0".equals(plcRequestType.getValue())&&!"0".equals(mesSendType.getValue())) { |
| | | //发送字置0 |
| | | log.info("1.发送类型字置零,清除上次发送的类型数据{}->0",mesSendType.getValue()); |
| | | s7objectMachine.plccontrol.writeWord(mesSendType.getAddress(), 0); |
| | | if (plcParameterObject == null) { |
| | | s7objectMachine.plccontrol.closeS7client(); |
| | | return; |
| | | } |
| | | if ("0".equals(plcRequest.getValue())&&!"0".equals(mesSend.getValue())) { |
| | | //发送字置0 |
| | | int finishCount=taskingService.finishMachineTask(machine); |
| | | nullMachine(machine); |
| | | log.info("1.发送字置零,清除上次发送的数据{},{},{},{},{}" |
| | | ,finishCount |
| | | ,length.getValue() |
| | | ,width.getValue() |
| | | ,mesSendId.getValue() |
| | | ,mesSend.getValue()); |
| | | s7objectMachine.plccontrol.writeWord(length.getAddress(), 0); |
| | | s7objectMachine.plccontrol.writeWord(width.getAddress(), 0); |
| | | s7objectMachine.plccontrol.writeWord(mesSendId.getAddress(), 0); |
| | | s7objectMachine.plccontrol.writeWord(rotateType.getAddress(), 0); |
| | | s7objectMachine.plccontrol.writeWord(mesSend.getAddress(), 0); |
| | | try { |
| | | |
| | | return; |
| | | } |
| | | if ("1".equals(plcRequestType.getValue())&&"0".equals(mesSendType.getValue())) { |
| | | //发送类型 1扫码 2不扫码 |
| | | int type=machine.getMode()==1?2:1; |
| | | log.info("3.发送类型数据0->{}",mesSendType.getValue()); |
| | | s7objectMachine.plccontrol.writeWord(mesSendType.getAddress(), type); |
| | | return; |
| | | } |
| | | List<Tasking> taskingCount=taskingService.findMachineWorkStateTask(machine,"正在工作"); |
| | | if("1".equals(plcRequest.getValue())&&"0".equals(mesSend.getValue()) |
| | | &&"开工".equals(machine.getState()) |
| | | &&taskingCount.size()<machine.getMaxTaskCount()){ |
| | | Tasking tasking; |
| | | if(machine.getMode()==1){ |
| | | //标准模式 |
| | | tasking=taskingService.startMachineTask(machine); |
| | | }else{ |
| | | //定制模式 |
| | | String PlcRequestID_=plcRequestID.getValue(); |
| | | scan_id= PlcRequestID_.substring(PlcRequestID_.lastIndexOf(",")+1); |
| | | //标记当前工序 以前的玻璃 直接到当前工序 |
| | | tasking=taskingService.startScanIdMachineTask(machine,scan_id);//不管顺序,直接找从翻片台扫码后到旋转台的数据 |
| | | PlcParameterInfo plcRequest = plcParameterObject.getPlcParameter("plcRequest");//请求字 |
| | | PlcParameterInfo plcRequestID = plcParameterObject.getPlcParameter("plcRequestID");//请求ID |
| | | PlcParameterInfo plcRequestType = plcParameterObject.getPlcParameter("plcRequestType");//PLC请求 |
| | | |
| | | PlcParameterInfo mesSend = plcParameterObject.getPlcParameter("mesSend");//发送字 |
| | | PlcParameterInfo mesSendId = plcParameterObject.getPlcParameter("mesSendID");//发送ID |
| | | PlcParameterInfo length = plcParameterObject.getPlcParameter("length");//长 |
| | | PlcParameterInfo width = plcParameterObject.getPlcParameter("width");//宽 |
| | | PlcParameterInfo rotateType = plcParameterObject.getPlcParameter("rotateType");//旋转类型 |
| | | |
| | | PlcParameterInfo mesSendType = plcParameterObject.getPlcParameter("mesSendType");// 扫码1 不扫码2 |
| | | String scan_id = ""; |
| | | if (machine.getIsLog() > 0) { |
| | | s7objectMachine.consoleLogInfo(); |
| | | } |
| | | if(tasking!=null){ |
| | | log.info("4、发送数据:{},{},{},{},{}" |
| | | ,tasking.getGlassId(),tasking.getProgramId() |
| | | ,tasking.getLength().intValue(),tasking.getWidth().intValue(),1); |
| | | s7objectMachine.plccontrol.writeWord(length.getAddress(), tasking.getLength().intValue()); |
| | | s7objectMachine.plccontrol.writeWord(width.getAddress(), tasking.getWidth().intValue()); |
| | | s7objectMachine.plccontrol.writeString(mesSendId.getAddress(), tasking.getTaskSequence().toString()); |
| | | s7objectMachine.plccontrol.writeWord(rotateType.getAddress(), machine.getRotateMode()); |
| | | s7objectMachine.plccontrol.writeWord(mesSend.getAddress(), 1); |
| | | SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | String sendRecord=df.format(new Date())+" "+ |
| | | tasking.getGlassId()+"-"+ |
| | | tasking.getLength()+"-"+ |
| | | tasking.getWidth(); |
| | | if (sendRecords.size()>7){ |
| | | sendRecords.remove(0); |
| | | } |
| | | if ("0".equals(plcRequestType.getValue()) && !"0".equals(mesSendType.getValue())) { |
| | | //发送字置0 |
| | | log.info("1.发送类型字置零,清除上次发送的类型数据{}->0", mesSendType.getValue()); |
| | | s7objectMachine.plccontrol.writeWord(mesSendType.getAddress(), 0); |
| | | return; |
| | | } |
| | | if ("0".equals(plcRequest.getValue()) && !"0".equals(mesSend.getValue())) { |
| | | //发送字置0 |
| | | int finishCount = taskingService.finishMachineTask(machine); |
| | | nullMachine(machine); |
| | | Map sendContentMap=new HashMap(); |
| | | sendContentMap.put("sendContent",sendRecord); |
| | | sendRecords.add(sendContentMap); |
| | | }else if(!scan_id.isEmpty()){ |
| | | taskingService.scanMachineAdd(machine,scan_id); |
| | | log.info("1.发送字置零,清除上次发送的数据{},{},{},{},{}" |
| | | , finishCount |
| | | , length.getValue() |
| | | , width.getValue() |
| | | , mesSendId.getValue() |
| | | , mesSend.getValue()); |
| | | s7objectMachine.plccontrol.writeWord(length.getAddress(), 0); |
| | | s7objectMachine.plccontrol.writeWord(width.getAddress(), 0); |
| | | s7objectMachine.plccontrol.writeWord(mesSendId.getAddress(), 0); |
| | | s7objectMachine.plccontrol.writeWord(rotateType.getAddress(), 0); |
| | | s7objectMachine.plccontrol.writeWord(mesSend.getAddress(), 0); |
| | | |
| | | return; |
| | | } |
| | | }else if("0".equals(plcRequest.getValue())){ |
| | | nullMachine(machine); |
| | | if ("1".equals(plcRequestType.getValue()) && "0".equals(mesSendType.getValue())) { |
| | | //发送类型 1扫码 2不扫码 |
| | | int type = machine.getMode() == 1 ? 2 : 1; |
| | | log.info("3.发送类型数据0->{}", mesSendType.getValue()); |
| | | s7objectMachine.plccontrol.writeWord(mesSendType.getAddress(), type); |
| | | return; |
| | | } |
| | | List<Tasking> taskingCount = taskingService.findMachineWorkStateTask(machine, "正在工作"); |
| | | if ("1".equals(plcRequest.getValue()) && "0".equals(mesSend.getValue()) |
| | | && "开工".equals(machine.getState()) |
| | | && taskingCount.size() < machine.getMaxTaskCount()) { |
| | | Tasking tasking; |
| | | if (machine.getMode() == 1) { |
| | | //标准模式 |
| | | tasking = taskingService.startMachineTask(machine); |
| | | } else { |
| | | //定制模式 |
| | | String PlcRequestID_ = plcRequestID.getValue(); |
| | | scan_id = PlcRequestID_.substring(PlcRequestID_.lastIndexOf(",") + 1); |
| | | //标记当前工序 以前的玻璃 直接到当前工序 |
| | | tasking = taskingService.startScanIdMachineTask(machine, scan_id);//不管顺序,直接找从翻片台扫码后到旋转台的数据 |
| | | } |
| | | if (tasking != null) { |
| | | log.info("4、发送数据:{},{},{},{},{}" |
| | | , tasking.getGlassId(), tasking.getProgramId() |
| | | , tasking.getLength().intValue(), tasking.getWidth().intValue(), 1); |
| | | s7objectMachine.plccontrol.writeWord(length.getAddress(), tasking.getLength().intValue()); |
| | | s7objectMachine.plccontrol.writeWord(width.getAddress(), tasking.getWidth().intValue()); |
| | | s7objectMachine.plccontrol.writeString(mesSendId.getAddress(), tasking.getTaskSequence().toString()); |
| | | s7objectMachine.plccontrol.writeWord(rotateType.getAddress(), machine.getRotateMode()); |
| | | s7objectMachine.plccontrol.writeWord(mesSend.getAddress(), 1); |
| | | SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | String sendRecord = df.format(new Date()) + " " + |
| | | tasking.getGlassId() + "-" + |
| | | tasking.getLength() + "-" + |
| | | tasking.getWidth(); |
| | | if (sendRecords.size() > 7) { |
| | | sendRecords.remove(0); |
| | | } |
| | | nullMachine(machine); |
| | | Map sendContentMap = new HashMap(); |
| | | sendContentMap.put("sendContent", sendRecord); |
| | | sendRecords.add(sendContentMap); |
| | | } else if (!scan_id.isEmpty()) { |
| | | taskingService.scanMachineAdd(machine, scan_id); |
| | | } |
| | | } else if ("0".equals(plcRequest.getValue())) { |
| | | nullMachine(machine); |
| | | } |
| | | } catch (Exception e) { |
| | | s7objectMachine.plccontrol.closeS7client(); |
| | | log.info("逻辑处理异常:设备id【{}】", machine.getId()); |
| | | } |
| | | |
| | | } |
| | | |
| | | public void nullMachine(Machine machine) { |
| | | if (!"".equals(machine.getRemark())){ |
| | | if (!"".equals(machine.getRemark())) { |
| | | machine.setRemark(""); |
| | | machineMapper.updateById(machine); |
| | | } |
| | |
| | | |
| | | @Override |
| | | public void run() { |
| | | while (this != null) { |
| | | while (true) { |
| | | try { |
| | | Thread.sleep(1000); |
| | | plcStart(); |
| | | } catch (InterruptedException e) { |
| | | e.printStackTrace(); |
| | | }catch (Exception e) { |
| | | log.info("{}", e.getMessage()); |
| | | } |
| | | } |
| | | } |
| | |
| | | this.taskingService = taskingService; |
| | | } |
| | | |
| | | public void plcStart() { |
| | | public void plcStart() throws Exception{ |
| | | Machine machine=machineMapper.selectById(thisMachine.getId()); |
| | | String fileName=machine.getFileName(); |
| | | ModbusTcp modbusTcp1 =new ModbusTcp(machine.getIp(),machine.getPort(),fileName); |
| | |
| | | } catch (Exception e) { |
| | | log.info("交互逻辑错误"); |
| | | } |
| | | |
| | | modbusTcp1.close(); |
| | | //log.info("无可执行的条件"); |
| | | } |
| | |
| | | |
| | | @Override |
| | | public void run() { |
| | | while (this != null) { |
| | | while (true) { |
| | | try { |
| | | Thread.sleep(1000); |
| | | plcStart(); |
| | | } catch (InterruptedException e) { |
| | | e.printStackTrace(); |
| | | }catch (Exception e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | } |
| | | } |
| | |
| | | public Long machineId = 2L; |
| | | public List<Map> sendRecords = new ArrayList<>(); |
| | | |
| | | // public void plcStart1(PlcAgreement plcAgreement,String zuKey) { |
| | | // //逻辑组 :请求组,完成组,其他组 |
| | | // //List<Map<String,String>> map=new ArrayList<>();//逻辑组 |
| | | // Map<String,Map<String,Map<String,String>>> map=new HashMap<>();//请求逻辑组 |
| | | |
| | | // Map<String,Map<String,String>> zuMap=map.get(zuKey); |
| | | // |
| | | // for(String key:map.keySet()){ |
| | | // boolean istrue=false; |
| | | // if(plcAgreement.getPlcParameter(key).getValueString()==map.get(key)){ |
| | | // istrue=true; |
| | | // } |
| | | // map.put(key,plcAgreement.getPlcParameter(key).getValueString()); |
| | | // } |
| | | // |
| | | // } |
| | | |
| | | public void plcStart() { |
| | | Machine machine=machineMapper.selectById(machineId); |
| | |
| | | username: root |
| | | password: beibo.123/ |
| | | driver-class-name: com.mysql.cj.jdbc.Driver |
| | | # salve_JomooKBB: |
| | | # url: jdbc:sqlserver://localhost:1433;databasename=JomooKBB |
| | | # username: sa |
| | | # password: beibo.123/ |
| | | # driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver |
| | | salve_JomooKBB: |
| | | url: jdbc:sqlserver://172.18.19.85:1433;databasename=JomooKBB |
| | | username: thok |
| | | password: jomoo@123 |
| | | url: jdbc:sqlserver://localhost:1433;databasename=JomooKBB |
| | | username: sa |
| | | password: beibo.123/ |
| | | driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver |
| | | # salve_JomooKBB: |
| | | # url: jdbc:sqlserver://172.18.19.85:1433;databasename=JomooKBB |
| | | # username: thok |
| | | # password: jomoo@123 |
| | | # driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver |
| | | cloud: |
| | | nacos: |
| | | discovery: |
| | |
| | | username: root |
| | | password: beibo.123/ |
| | | driver-class-name: com.mysql.cj.jdbc.Driver |
| | | # salve_JomooKBB: |
| | | # url: jdbc:sqlserver://localhost:1433;databasename=JomooKBB |
| | | # username: sa |
| | | # password: beibo.123/ |
| | | # driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver |
| | | salve_JomooKBB: |
| | | url: jdbc:sqlserver://172.18.19.85:1433;databasename=JomooKBB |
| | | username: thok |
| | | password: jomoo@123 |
| | | url: jdbc:sqlserver://localhost:1433;databasename=JomooKBB |
| | | username: sa |
| | | password: beibo.123/ |
| | | driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver |
| | | # salve_JomooKBB: |
| | | # url: jdbc:sqlserver://172.18.19.85:1433;databasename=JomooKBB |
| | | # username: thok |
| | | # password: jomoo@123 |
| | | # driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver |
| | | cloud: |
| | | nacos: |
| | | discovery: |
| | |
| | | com\mes\energy\entity\EnergyConsumption.class |
| | | com\mes\md\mapper\TaskingMapper.class |
| | | com\mes\md\entity\Machine.class |
| | | com\mes\plannedAmount\service\impl\PlannedAmountImpl.class |
| | | com\mes\quantity\service\QuantityService.class |
| | | com\mes\yield\controller\YieldController.class |
| | | com\mes\md\mapper\RoleMapper.class |
| | | com\mes\md\service\TaskingLogService.class |
| | | com\mes\md\mapper\KBBTProgramsDeviceStatusLogBPMapper.class |
| | | com\mes\md\service\impl\ProjectServiceImpl.class |
| | | com\mes\md\service\impl\OrderOriginalPieceServiceImpl.class |
| | | com\mes\plannedAmount\controller\PlannedAmountController.class |
| | | com\mes\md\service\AccountService.class |
| | | com\mes\DeviceInteractionModuleApplication.class |
| | | com\mes\md\service\ProjectService.class |
| | |
| | | com\mes\md\mapper\KBBTJPDrawingBPMapper.class |
| | | com\mes\md\controller\GlassInfoController.class |
| | | com\mes\md\service\KBBTProgramsOperationLogBPService.class |
| | | com\mes\yield\service\impl\YieldServiceImpl.class |
| | | com\mes\md\mapper\PageMapper.class |
| | | com\mes\md\service\ProjectLogService.class |
| | | com\mes\md\entity\Project.class |
| | | com\mes\quantity\controller\QuantityController.class |
| | | com\mes\quantity\entity\Quantity.class |
| | | com\mes\md\mapper\PrimitiveTaskMapper.class |
| | | com\mes\md\service\impl\EdgeGrindingLogServiceImpl.class |
| | | com\mes\yield\mapper\YieldMapper.class |
| | | com\mes\job\AddTask.class |
| | | com\mes\md\entity\KBBTProgramsOperationLogBP.class |
| | | com\mes\md\entity\LineConfiguration.class |
| | |
| | | com\mes\edgstoragecage\service\EdgStorageCageService.class |
| | | com\mes\common\CommunicationProtocol.class |
| | | com\mes\md\entity\Line.class |
| | | com\mes\utilization\service\impl\UtilizationServiceImpl.class |
| | | com\mes\plcTaskThread\MachineEdging.class |
| | | com\mes\md\entity\EdgeGrindingLog.class |
| | | com\mes\md\service\OrderOriginalPieceService.class |
| | | com\mes\yield\service\YieldService.class |
| | | com\mes\md\service\impl\GlassInfoServiceImpl.class |
| | | com\mes\mechanicalMonitor\service\MechanicalMonitorService.class |
| | | com\mes\plcTaskThread\MachineSilkScreen.class |
| | |
| | | com\mes\md\mapper\WorkTaskDetailMapper.class |
| | | com\mes\md\service\LineService.class |
| | | com\mes\md\service\impl\PageServiceImpl.class |
| | | com\mes\quantity\mapper\QuantityMapper.class |
| | | com\mes\md\entity\TaskingLog.class |
| | | com\mes\md\service\impl\WorkTaskDetailServiceImpl.class |
| | | com\mes\md\service\impl\TaskLogServiceImpl.class |
| | |
| | | com\mes\md\service\LineConfigurationService.class |
| | | com\mes\md\entity\GlassInfo.class |
| | | com\mes\md\service\GlassInfoService.class |
| | | com\mes\utilization\entity\Utilization.class |
| | | com\mes\md\entity\Page.class |
| | | com\mes\job\PLCCleaning.class |
| | | com\mes\md\controller\RoleController.class |
| | |
| | | com\mes\md\controller\OrderOriginalPieceController.class |
| | | com\mes\md\controller\ProjectController.class |
| | | com\mes\md\entity\ProjectLog.class |
| | | com\mes\yield\entity\Yield.class |
| | | com\mes\md\service\EdgeGrindingLogService.class |
| | | com\mes\AppRunnerConfig.class |
| | | com\mes\plcTaskThread\MachineFlipSlice.class |
| | |
| | | com\mes\md\service\impl\KBBTJPDrawingBPServiceImpl.class |
| | | com\mes\md\mapper\ProjectMapper.class |
| | | com\mes\energy\service\EnergyConsumptionService.class |
| | | com\mes\common\S7objectMachine3.class |
| | | com\mes\md\controller\EquipmentLogController.class |
| | | com\mes\md\controller\TaskingLogController.class |
| | | com\mes\plannedAmount\mapper\PlannedAmountMapper.class |
| | | com\mes\common\SmbTool.class |
| | | com\mes\md\mapper\ProjectLogMapper.class |
| | | com\mes\plannedAmount\service\PlannedAmountService.class |
| | | com\mes\plcTaskThread\MachineMarking.class |
| | | com\mes\md\mapper\OrderOriginalPieceMapper.class |
| | | com\mes\plannedAmount\entity\PlannedAmount.class |
| | | com\mes\edgstoragecage\entity\EdgStorageCageDetails.class |
| | | com\mes\md\service\impl\RoleServiceImpl.class |
| | | com\mes\md\controller\MachineController.class |
| | |
| | | com\mes\md\service\impl\LineServiceImpl.class |
| | | com\mes\md\mapper\LineMapper.class |
| | | com\mes\md\mapper\EdgeGrindingLogMapper.class |
| | | com\mes\common\S7objectMarking.class |
| | | com\mes\utilization\service\UtilizationService.class |
| | | com\mes\md\entity\KBBTProgramsDeviceOlnlineLogBP.class |
| | | com\mes\md\entity\PrimitiveTask.class |
| | | com\mes\mechanicalMonitor\controller\MechanicalMonitorController.class |
| | |
| | | com\mes\job\MachineTask.class |
| | | com\mes\md\entity\Menu.class |
| | | com\mes\md\service\impl\LineConfigurationServiceImpl.class |
| | | com\mes\plcTaskThread\MachineDispensing.class |
| | | com\mes\common\S7object.class |
| | | com\mes\md\mapper\MenuMapper.class |
| | | com\mes\md\service\RoleMenuService.class |
| | | com\mes\edgstoragecage\service\impl\EdgStorageCageServiceImpl.class |
| | | com\mes\common\S7objectFlipSlice.class |
| | | com\mes\edgstoragecage\mapper\EdgStorageCageMapper.class |
| | | com\mes\energy\service\impl\EnergyConsumptionServiceImpl.class |
| | | com\mes\md\service\impl\ProjectLogServiceImpl.class |
| | |
| | | com\mes\md\service\TaskingService.class |
| | | com\mes\plcTaskThread\MachineThread.class |
| | | com\mes\md\service\RoleService.class |
| | | com\mes\quantity\service\impl\QuantityServiceImpl.class |
| | | com\mes\md\service\MachineService.class |
| | | com\mes\md\service\PageService.class |
| | | com\mes\utilization\controller\UtilizationController.class |
| | | com\mes\md\controller\ProjectLogController.class |
| | | com\mes\md\mapper\GlassInfoMapper.class |
| | | com\mes\md\service\impl\KBBTProgramsOperationLogBPServiceImpl.class |
| | | com\mes\md\entity\Tasking.class |
| | | com\mes\utilization\mapper\UtilizationMapper.class |
| | | com\mes\mechanicalMonitor\service\impl\MechanicalMonitorServiceImpl.class |
| | | com\mes\md\service\impl\MachineServiceImpl.class |
| | |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\entity\LineConfiguration.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\edgstoragecage\mapper\EdgStorageCageMapper.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\quantity\service\QuantityService.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\common\CommunicationProtocol.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\DeviceInteractionModuleApplication.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\entity\Role.java |
| | |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\controller\MenuController.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\mapper\ProjectLogMapper.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\service\impl\GlassInfoServiceImpl.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\yield\controller\YieldController.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\controller\WorkTaskDetailController.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\mapper\KBBTProgramsOperationLogBPMapper.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\job\MachineTask.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\plannedAmount\service\PlannedAmountService.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\plcTaskThread\MachineThread.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\service\impl\WorkTaskDetailServiceImpl.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\service\AccountService.java |
| | |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\entity\Project.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\service\impl\PrimitiveTaskServiceImpl.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\edgstoragecage\service\EdgStorageCageService.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\quantity\entity\Quantity.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\entity\EdgeGrindingLog.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\mapper\KBBTLensSortingMapper.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\plannedAmount\entity\PlannedAmount.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\controller\TaskingController.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\service\impl\TaskLogServiceImpl.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\service\impl\TaskingServiceImpl.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\yield\mapper\YieldMapper.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\service\LineConfigurationService.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\utilization\service\impl\UtilizationServiceImpl.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\AppRunnerConfig.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\mapper\AccountMapper.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\mapper\ProjectMapper.java |
| | |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\energy\entity\EnergyConsumption.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\entity\Page.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\mechanicalMonitor\entity\MechanicalMonitor.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\common\S7objectFlipSlice.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\plcTaskThread\MachineLoad.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\job\PLCCleaning.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\entity\TaskingLog.java |
| | |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\controller\MachineController.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\edgstoragecage\entity\EdgStorageCageDetails.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\plcTaskThread\MachineFlipSlice.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\plannedAmount\controller\PlannedAmountController.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\controller\ProjectLogController.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\common\S7objectMarking.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\entity\WorkTaskDetail.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\energy\service\impl\EnergyConsumptionServiceImpl.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\mapper\KBBTProgramsDeviceOlnlineLogBPMapper.java |
| | |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\mapper\LineMapper.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\entity\KBBTLensSorting.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\plcTaskThread\MachineLamination.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\utilization\controller\UtilizationController.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\entity\ProjectLog.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\entity\KBBTJPDrawingBP.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\service\PageService.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\plcTaskThread\MachineMarking.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\entity\KBBTProgramsOperationLogBP.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\plannedAmount\service\impl\PlannedAmountImpl.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\mechanicalMonitor\service\impl\MechanicalMonitorServiceImpl.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\quantity\controller\QuantityController.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\entity\TaskLog.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\entity\GlassInfo.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\mapper\OrderOriginalPieceMapper.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\controller\RoleController.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\common\tcpIp.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\service\WorkTaskDetailService.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\quantity\service\impl\QuantityServiceImpl.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\service\RoleService.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\energy\controller\EnergyConsumptionController.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\service\impl\MachineServiceImpl.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\yield\service\impl\YieldServiceImpl.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\mechanicalMonitor\service\MechanicalMonitorService.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\edgstoragecage\entity\EdgStorageCage.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\mapper\PrimitiveTaskMapper.java |
| | |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\plcTaskThread\MachineRotate.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\service\EdgeGrindingLogService.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\service\PrimitiveTaskService.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\plannedAmount\mapper\PlannedAmountMapper.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\yield\entity\Yield.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\common\S7object.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\service\impl\EdgeGrindingLogServiceImpl.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\service\impl\ProjectServiceImpl.java |
| | |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\mapper\RoleMenuMapper.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\mapper\EquipmentLogMapper.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\entity\EquipmentLog.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\utilization\mapper\UtilizationMapper.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\mapper\LineConfigurationMapper.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\service\impl\LineServiceImpl.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\mapper\KBBTProgramsDeviceStatusLogBPMapper.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\controller\AccountController.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\plcTaskThread\MachineDispensing.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\utilization\entity\Utilization.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\entity\KBBTProgramsDeviceStatusLogBP.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\service\MenuService.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\entity\Menu.java |
| | |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\service\TaskingLogService.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\mechanicalMonitor\controller\MechanicalMonitorController.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\service\impl\KBBTProgramsOperationLogBPServiceImpl.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\common\S7objectMachine3.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\service\impl\ProjectLogServiceImpl.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\mapper\TaskingMapper.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\controller\OrderOriginalPieceController.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\utilization\service\UtilizationService.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\common\S7objectCleaning.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\quantity\mapper\QuantityMapper.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\service\KBBTProgramsOperationLogBPService.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\plcTaskThread\MachineEdging.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\entity\PrimitiveTask.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\controller\EquipmentLogController.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\md\service\impl\RoleServiceImpl.java |
| | | D:\workfile\JiuMuMES\JiuMuMesParent\moduleService\DeviceInteractionModule\src\main\java\com\mes\yield\service\YieldService.java |
| | |
| | | export default { |
| | | |
| | | // serverUrl: "localhost:88/api", |
| | | // serverUrl2: "localhost:88" |
| | | serverUrl: "localhost:88/api", |
| | | serverUrl2: "localhost:88" |
| | | |
| | | // serverUrl: "10.36.164.253:88/api", |
| | | // serverUrl2: "10.36.164.253:88" |
| | | |
| | | serverUrl: "10.36.164.200:88/api", |
| | | serverUrl2: "10.36.164.200:88" |
| | | // serverUrl: "10.36.164.200:88/api", |
| | | // serverUrl2: "10.36.164.200:88" |
| | | |
| | | // serverUrl2: "127.0.0.1:88"npm |
| | | |
| | |
| | | "vue-print-nb": "^1.7.5", |
| | | "vue-router": "^4.2.4", |
| | | "vue3-print-nb": "^0.1.4", |
| | | "vxe-pc-ui": "^4.9.14", |
| | | "vxe-table": "^4.5.15", |
| | | "xe-utils": "^3.5.14", |
| | | "xlsx": "^0.18.5" |
| | |
| | | } |
| | | } |
| | | }, |
| | | "node_modules/@vxe-ui/core": { |
| | | "version": "4.2.11", |
| | | "resolved": "https://registry.npmmirror.com/@vxe-ui/core/-/core-4.2.11.tgz", |
| | | "integrity": "sha512-Cv0XKTGgFD+CD2MGixxM+k60Y3tFEJYErQj59tuPd0y0HuSFc7sQk0fuXdbcNgxZxtAi4zX3nsDk3kY+/HeAgQ==", |
| | | "dependencies": { |
| | | "dom-zindex": "^1.0.6", |
| | | "xe-utils": "^3.7.8" |
| | | }, |
| | | "peerDependencies": { |
| | | "vue": "^3.2.0" |
| | | } |
| | | }, |
| | | "node_modules/acorn": { |
| | | "version": "8.12.0", |
| | | "resolved": "https://registry.npmmirror.com/acorn/-/acorn-8.12.0.tgz", |
| | |
| | | "integrity": "sha512-qiSlmBq9+BCdCA/L46dw8Uy93mloxsPSbwnm5yrKn2vMPiy8KyAskTF6zuV/j5BMsmOGZDPs7KjU+mjb670kfA==" |
| | | }, |
| | | "node_modules/dom-zindex": { |
| | | "version": "1.0.1", |
| | | "resolved": "https://registry.npmjs.org/dom-zindex/-/dom-zindex-1.0.1.tgz", |
| | | "integrity": "sha512-M/MERVDZ8hguvjl6MAlLWSLYLS7PzEyXaTb5gEeJ+SF+e9iUC0sdvlzqe91MMDHBoy+nqw7wKcUOrDSyvMCrRg==" |
| | | "version": "1.0.6", |
| | | "resolved": "https://registry.npmmirror.com/dom-zindex/-/dom-zindex-1.0.6.tgz", |
| | | "integrity": "sha512-FKWIhiU96bi3xpP9ewRMgANsoVmMUBnMnmpCT6dPMZOunVYJQmJhSRruoI0XSPoHeIif3kyEuiHbFrOJwEJaEA==" |
| | | }, |
| | | "node_modules/echarts": { |
| | | "version": "5.6.0", |
| | |
| | | "vue": "^3.0.5" |
| | | } |
| | | }, |
| | | "node_modules/vxe-pc-ui": { |
| | | "version": "4.9.14", |
| | | "resolved": "https://registry.npmmirror.com/vxe-pc-ui/-/vxe-pc-ui-4.9.14.tgz", |
| | | "integrity": "sha512-YtpLUU6x43UQnjPBMqgewAYdC9w5FGC/ZHO3ZiYl3fWt+HACkJgreJzgfX4z0QkzLdp/6vmDS4rvnH9vpdNmrw==", |
| | | "dependencies": { |
| | | "@vxe-ui/core": "^4.2.11" |
| | | } |
| | | }, |
| | | "node_modules/vxe-table": { |
| | | "version": "4.5.15", |
| | | "resolved": "https://registry.npmjs.org/vxe-table/-/vxe-table-4.5.15.tgz", |
| | |
| | | } |
| | | }, |
| | | "node_modules/xe-utils": { |
| | | "version": "3.5.14", |
| | | "resolved": "https://registry.npmjs.org/xe-utils/-/xe-utils-3.5.14.tgz", |
| | | "integrity": "sha512-Xq6mS8dWwHBQsQUEBXcZYSaBV0KnNLoVWd0vRRDI3nKpbNxfs/LSCK0W21g1edLFnXYfKqg7hh5dakr3RtYY0A==" |
| | | "version": "3.7.8", |
| | | "resolved": "https://registry.npmmirror.com/xe-utils/-/xe-utils-3.7.8.tgz", |
| | | "integrity": "sha512-V/k6B/ASYir6yLYhp62DnM17po9u1N9mou/rn4if5WoFCsAO49JpCiVpkDpwCv4zxGfWmhWgzmz4FytWF+pDVw==" |
| | | }, |
| | | "node_modules/xlsx": { |
| | | "version": "0.18.5", |
| | |
| | | } |
| | | } |
| | | }, |
| | | "@vxe-ui/core": { |
| | | "version": "4.2.11", |
| | | "resolved": "https://registry.npmmirror.com/@vxe-ui/core/-/core-4.2.11.tgz", |
| | | "integrity": "sha512-Cv0XKTGgFD+CD2MGixxM+k60Y3tFEJYErQj59tuPd0y0HuSFc7sQk0fuXdbcNgxZxtAi4zX3nsDk3kY+/HeAgQ==", |
| | | "requires": { |
| | | "dom-zindex": "^1.0.6", |
| | | "xe-utils": "^3.7.8" |
| | | } |
| | | }, |
| | | "acorn": { |
| | | "version": "8.12.0", |
| | | "resolved": "https://registry.npmmirror.com/acorn/-/acorn-8.12.0.tgz", |
| | |
| | | "integrity": "sha512-qiSlmBq9+BCdCA/L46dw8Uy93mloxsPSbwnm5yrKn2vMPiy8KyAskTF6zuV/j5BMsmOGZDPs7KjU+mjb670kfA==" |
| | | }, |
| | | "dom-zindex": { |
| | | "version": "1.0.1", |
| | | "resolved": "https://registry.npmjs.org/dom-zindex/-/dom-zindex-1.0.1.tgz", |
| | | "integrity": "sha512-M/MERVDZ8hguvjl6MAlLWSLYLS7PzEyXaTb5gEeJ+SF+e9iUC0sdvlzqe91MMDHBoy+nqw7wKcUOrDSyvMCrRg==" |
| | | "version": "1.0.6", |
| | | "resolved": "https://registry.npmmirror.com/dom-zindex/-/dom-zindex-1.0.6.tgz", |
| | | "integrity": "sha512-FKWIhiU96bi3xpP9ewRMgANsoVmMUBnMnmpCT6dPMZOunVYJQmJhSRruoI0XSPoHeIif3kyEuiHbFrOJwEJaEA==" |
| | | }, |
| | | "echarts": { |
| | | "version": "5.6.0", |
| | |
| | | "vue-print-nb": "^1.7.5", |
| | | "vue-router": "^4.2.4", |
| | | "vue3-print-nb": "^0.1.4", |
| | | "vxe-pc-ui": "*", |
| | | "vxe-table": "^4.5.15", |
| | | "xe-utils": "^3.5.14", |
| | | "xlsx": "^0.18.5" |
| | |
| | | } |
| | | } |
| | | }, |
| | | "@vxe-ui/core": { |
| | | "version": "4.2.11", |
| | | "resolved": "https://registry.npmmirror.com/@vxe-ui/core/-/core-4.2.11.tgz", |
| | | "integrity": "sha512-Cv0XKTGgFD+CD2MGixxM+k60Y3tFEJYErQj59tuPd0y0HuSFc7sQk0fuXdbcNgxZxtAi4zX3nsDk3kY+/HeAgQ==", |
| | | "requires": { |
| | | "dom-zindex": "^1.0.6", |
| | | "xe-utils": "^3.7.8" |
| | | } |
| | | }, |
| | | "acorn": { |
| | | "version": "8.12.0", |
| | | "resolved": "https://registry.npmmirror.com/acorn/-/acorn-8.12.0.tgz", |
| | |
| | | "integrity": "sha512-qiSlmBq9+BCdCA/L46dw8Uy93mloxsPSbwnm5yrKn2vMPiy8KyAskTF6zuV/j5BMsmOGZDPs7KjU+mjb670kfA==" |
| | | }, |
| | | "dom-zindex": { |
| | | "version": "1.0.1", |
| | | "resolved": "https://registry.npmjs.org/dom-zindex/-/dom-zindex-1.0.1.tgz", |
| | | "integrity": "sha512-M/MERVDZ8hguvjl6MAlLWSLYLS7PzEyXaTb5gEeJ+SF+e9iUC0sdvlzqe91MMDHBoy+nqw7wKcUOrDSyvMCrRg==" |
| | | "version": "1.0.6", |
| | | "resolved": "https://registry.npmmirror.com/dom-zindex/-/dom-zindex-1.0.6.tgz", |
| | | "integrity": "sha512-FKWIhiU96bi3xpP9ewRMgANsoVmMUBnMnmpCT6dPMZOunVYJQmJhSRruoI0XSPoHeIif3kyEuiHbFrOJwEJaEA==" |
| | | }, |
| | | "echarts": { |
| | | "version": "5.6.0", |
| | |
| | | "vue": "^3.0.5" |
| | | } |
| | | }, |
| | | "vxe-pc-ui": { |
| | | "version": "4.9.14", |
| | | "resolved": "https://registry.npmmirror.com/vxe-pc-ui/-/vxe-pc-ui-4.9.14.tgz", |
| | | "integrity": "sha512-YtpLUU6x43UQnjPBMqgewAYdC9w5FGC/ZHO3ZiYl3fWt+HACkJgreJzgfX4z0QkzLdp/6vmDS4rvnH9vpdNmrw==", |
| | | "requires": { |
| | | "@vxe-ui/core": "^4.2.11" |
| | | } |
| | | }, |
| | | "vxe-table": { |
| | | "version": "4.5.15", |
| | | "resolved": "https://registry.npmjs.org/vxe-table/-/vxe-table-4.5.15.tgz", |
| | |
| | | } |
| | | }, |
| | | "xe-utils": { |
| | | "version": "3.5.14", |
| | | "resolved": "https://registry.npmjs.org/xe-utils/-/xe-utils-3.5.14.tgz", |
| | | "integrity": "sha512-Xq6mS8dWwHBQsQUEBXcZYSaBV0KnNLoVWd0vRRDI3nKpbNxfs/LSCK0W21g1edLFnXYfKqg7hh5dakr3RtYY0A==" |
| | | "version": "3.7.8", |
| | | "resolved": "https://registry.npmmirror.com/xe-utils/-/xe-utils-3.7.8.tgz", |
| | | "integrity": "sha512-V/k6B/ASYir6yLYhp62DnM17po9u1N9mou/rn4if5WoFCsAO49JpCiVpkDpwCv4zxGfWmhWgzmz4FytWF+pDVw==" |
| | | }, |
| | | "xlsx": { |
| | | "version": "0.18.5", |
| | |
| | | "vue": "^3.0.5" |
| | | } |
| | | }, |
| | | "vxe-pc-ui": { |
| | | "version": "4.9.14", |
| | | "resolved": "https://registry.npmmirror.com/vxe-pc-ui/-/vxe-pc-ui-4.9.14.tgz", |
| | | "integrity": "sha512-YtpLUU6x43UQnjPBMqgewAYdC9w5FGC/ZHO3ZiYl3fWt+HACkJgreJzgfX4z0QkzLdp/6vmDS4rvnH9vpdNmrw==", |
| | | "requires": { |
| | | "@vxe-ui/core": "^4.2.11" |
| | | } |
| | | }, |
| | | "vxe-table": { |
| | | "version": "4.5.15", |
| | | "resolved": "https://registry.npmjs.org/vxe-table/-/vxe-table-4.5.15.tgz", |
| | |
| | | } |
| | | }, |
| | | "xe-utils": { |
| | | "version": "3.5.14", |
| | | "resolved": "https://registry.npmjs.org/xe-utils/-/xe-utils-3.5.14.tgz", |
| | | "integrity": "sha512-Xq6mS8dWwHBQsQUEBXcZYSaBV0KnNLoVWd0vRRDI3nKpbNxfs/LSCK0W21g1edLFnXYfKqg7hh5dakr3RtYY0A==" |
| | | "version": "3.7.8", |
| | | "resolved": "https://registry.npmmirror.com/xe-utils/-/xe-utils-3.7.8.tgz", |
| | | "integrity": "sha512-V/k6B/ASYir6yLYhp62DnM17po9u1N9mou/rn4if5WoFCsAO49JpCiVpkDpwCv4zxGfWmhWgzmz4FytWF+pDVw==" |
| | | }, |
| | | "xlsx": { |
| | | "version": "0.18.5", |
| | |
| | | "vue-print-nb": "^1.7.5", |
| | | "vue-router": "^4.2.4", |
| | | "vue3-print-nb": "^0.1.4", |
| | | "vxe-pc-ui": "^4.9.14", |
| | | "vxe-table": "^4.5.15", |
| | | "xe-utils": "^3.5.14", |
| | | "xlsx": "^0.18.5" |
| | |
| | | // export const WebSocketHost = "localhost"; |
| | | export const WebSocketHost = "localhost"; |
| | | // export const WebSocketHost = "10.36.164.253"; |
| | | export const WebSocketHost = "10.36.164.200"; |
| | | //export const WebSocketHost = "10.36.164.200"; |
| | | export const host = "88"; |
| | |
| | | const loadData = ref([]); |
| | | const findMachine = ref([]); |
| | | const machineId=7;//当前页面的设备ID |
| | | //使用WebSocket方式展示数据 |
| | | let socket = null; |
| | | const socketUrl = `ws://${WebSocketHost}:${host}/api/deviceInteraction/api/talk/cleaning`; |
| | | // 定义消息处理函数,更新 receivedData 变量 |
| | | const handleMessage = (data) => { |
| | | // 更新 tableData 的数据 |
| | | loadData.value = data.taskingList[0]; |
| | | findMachine.value = data.machine[0]; |
| | | // console.log(data); |
| | | }; |
| | | onUnmounted(() => { |
| | | if (socket) { |
| | | closeWebSocket(socket); |
| | | // 新增:定时任务ID(用于清除定时器) |
| | | const timerId = ref(null); |
| | | /** |
| | | * 单次接口请求函数 |
| | | * 作用:调用后端接口,获取数据后交给 handleMessage 处理 |
| | | */ |
| | | const fetchMachineData = async () => { |
| | | try { |
| | | // 任务数据 |
| | | request.post("/deviceInteraction/tasking/findMachineTask",{ |
| | | "id": machineId |
| | | }).then((res) => { // 替换为你的API端点 |
| | | if (res.code === 200) { |
| | | // 假设后端返回的数据格式与 handleMessage 预期一致 |
| | | const responseData = res.data || {}; |
| | | loadData.value =responseData; |
| | | } |
| | | }); |
| | | |
| | | // 设备数据 |
| | | request.post("/deviceInteraction/machine/findMachine",{ |
| | | "id": machineId |
| | | }).then((res) => { // 替换为你的API端点 |
| | | if (res.code === 200) { |
| | | // 假设后端返回的数据格式与 handleMessage 预期一致 |
| | | const responseData = res.data || {}; |
| | | findMachine.value =responseData; |
| | | if (Object.keys(findMachine.value).length === 0){ |
| | | if(findMachine.value.remark.toString()!=errorScanId&&findMachine.value.remark.toString()!=""&&findMachine.value.remark.toString()!=undefined){ |
| | | //有数据就弹窗 |
| | | if(errorOpen){ |
| | | ElMessageBox.close(); |
| | | } |
| | | errorScanId=findMachine.value.remark.toString(); |
| | | errorInfoFuntion(findMachine.value.remark.toString()); |
| | | errorOpen=true; |
| | | }else if(findMachine.value.remark.toString()==""&&errorOpen){ |
| | | ElMessageBox.close(); |
| | | errorOpen=false; |
| | | } |
| | | } |
| | | } |
| | | }); |
| | | |
| | | // 线下数据 |
| | | } catch (err) { |
| | | console.error('定时请求后端接口失败:', err); |
| | | } |
| | | }); |
| | | onBeforeUnmount(() => { |
| | | console.log("关闭了") |
| | | closeWebSocket(); |
| | | }; |
| | | |
| | | /** |
| | | * 启动定时器 |
| | | * @param {number} interval - 定时间隔(毫秒,默认500ms,与后端任务频率对齐) |
| | | */ |
| | | const startTimer = (interval = 500) => { |
| | | // 先清除已有定时器(避免重复创建) |
| | | if (timerId.value) clearInterval(timerId.value); |
| | | // 立即执行一次(避免首次等待间隔) |
| | | fetchMachineData(); |
| | | // 创建新定时器 |
| | | timerId.value = setInterval(() => { |
| | | fetchMachineData(); |
| | | }, interval); |
| | | }; |
| | | |
| | | /** |
| | | * 清除定时器(避免内存泄漏) |
| | | */ |
| | | const clearTimer = () => { |
| | | if (timerId.value) { |
| | | clearInterval(timerId.value); |
| | | timerId.value = null; // 重置ID |
| | | } |
| | | }; |
| | | |
| | | // 组件卸载时清除定时器(关键:避免组件销毁后定时器仍运行) |
| | | onUnmounted(() => { |
| | | clearTimer(); |
| | | }); |
| | | |
| | | onMounted(async () => { |
| | | //使用WebSocket方式展示数据 |
| | | socket = initializeWebSocket(socketUrl, handleMessage);// 初始化 WebSocket,并传递消息处理函数 |
| | | |
| | | |
| | | //使用接口方式展示数据 |
| | | //load(); |
| | | startTimer(500); // 500ms 间隔(可根据业务调整,如1000ms) |
| | | // //使用WebSocket方式展示数据 |
| | | // socket = initializeWebSocket(socketUrl, handleMessage);// 初始化 WebSocket,并传递消息处理函数 |
| | | // //使用WebSocket方式展示数据 |
| | | // socketDownLineTask = initializeWebSocket(socketDownLineTaskUrl, handleMessage2);// 初始化 WebSocket,并传递消息处理函数 |
| | | }); |
| | | |
| | | // //获取数据 |
| | | // const load = async() => { |
| | | // //获取设备任务数据 |
| | | // try { |
| | | // const response = await request.post('/deviceInteraction/tasking/findMachineTask', |
| | | // { |
| | | // "id": 11 |
| | | // }); // 替换为你的API端点 |
| | | // if (response.code === 200) { |
| | | // loadData.value.findTaskingData= response.data; |
| | | // } else { |
| | | // ElMessage.warning(res.msg) |
| | | // } |
| | | // } catch (error) { |
| | | // // console.error('Error fetching rects :', error); |
| | | // } |
| | | // //获取设备状态 |
| | | // try { |
| | | // const response = await request.post('/deviceInteraction/machine/findMachine', |
| | | // { |
| | | // "id": 11 |
| | | // }); // 替换为你的API端点 |
| | | // if (response.code === 200) { |
| | | // findMachine.value= response.data; |
| | | // } else { |
| | | // ElMessage.warning(res.msg) |
| | | // } |
| | | // } catch (error) { |
| | | // // console.error('Error fetching rects :', error); |
| | | // } |
| | | // } |
| | | //修改工作状态 【失败/正在工作/完工】 |
| | | const workStatus = async(row,state) => { |
| | | let url; |
| | |
| | | const pageParams=userInfo.user.menus[0].pages[1].params; |
| | | const pageParamsJson=JSON.parse(pageParams); |
| | | const machineId = pageParamsJson.machineId;//当前页面的设备ID |
| | | |
| | | |
| | | |
| | | console.log(machineId); |
| | | var errorScanId; |
| | | var errorOpen=false; |
| | | //使用WebSocket方式展示数据 |
| | | let socket = null; |
| | | let socketDownLineTask = null; |
| | | const socketUrl = `ws://${WebSocketHost}:${host}/api/deviceInteraction/api/talk/edgingTask`; |
| | | const socketDownLineTaskUrl = `ws://${WebSocketHost}:${host}/api/deviceInteraction/api/talk/downLineTask`; |
| | | // 定义消息处理函数,更新 receivedData 变量 |
| | | const handleMessage = (data) => { |
| | | // 更新 tableData 的数据 |
| | | let dataJson = data[""+machineId][0]; |
| | | // 新增:定时任务ID(用于清除定时器) |
| | | const timerId = ref(null); |
| | | /** |
| | | * 单次接口请求函数 |
| | | * 作用:调用后端接口,获取数据后交给 handleMessage 处理 |
| | | */ |
| | | const fetchMachineData = async () => { |
| | | try { |
| | | // 任务数据 |
| | | request.post("/deviceInteraction/tasking/findMachineTask",{ |
| | | "id": machineId |
| | | }).then((res) => { // 替换为你的API端点 |
| | | if (res.code === 200) { |
| | | // 假设后端返回的数据格式与 handleMessage 预期一致 |
| | | const responseData = res.data || {}; |
| | | loadData.value =responseData; |
| | | } |
| | | }); |
| | | |
| | | loadData.value = dataJson.taskingList[0]; |
| | | findMachine.value = dataJson.machine[0]; |
| | | sendRecords.value = dataJson.sendRecords[0].reverse(); |
| | | |
| | | if(findMachine.value.remark.toString()!=errorScanId&&findMachine.value.remark.toString()!=""&&findMachine.value.remark.toString()!=undefined){ |
| | | //有数据就弹窗 |
| | | if(errorOpen){ |
| | | ElMessageBox.close(); |
| | | } |
| | | errorScanId=findMachine.value.remark.toString(); |
| | | errorInfoFuntion(findMachine.value.remark.toString()); |
| | | errorOpen=true; |
| | | |
| | | }else if(findMachine.value.remark.toString()==""&&errorOpen){ |
| | | ElMessageBox.close(); |
| | | errorOpen=false; |
| | | // 设备数据 |
| | | request.post("/deviceInteraction/machine/findMachine",{ |
| | | "id": machineId |
| | | }).then((res) => { // 替换为你的API端点 |
| | | if (res.code === 200) { |
| | | // 假设后端返回的数据格式与 handleMessage 预期一致 |
| | | const responseData = res.data || {}; |
| | | findMachine.value =responseData; |
| | | if (Object.keys(findMachine.value).length === 0){ |
| | | if(findMachine.value.remark.toString()!=errorScanId&&findMachine.value.remark.toString()!=""&&findMachine.value.remark.toString()!=undefined){ |
| | | //有数据就弹窗 |
| | | if(errorOpen){ |
| | | ElMessageBox.close(); |
| | | } |
| | | errorScanId=findMachine.value.remark.toString(); |
| | | errorInfoFuntion(findMachine.value.remark.toString()); |
| | | errorOpen=true; |
| | | }else if(findMachine.value.remark.toString()==""&&errorOpen){ |
| | | ElMessageBox.close(); |
| | | errorOpen=false; |
| | | } |
| | | } |
| | | } |
| | | }); |
| | | |
| | | // 线下数据 |
| | | } catch (err) { |
| | | console.error('定时请求后端接口失败:', err); |
| | | } |
| | | |
| | | }; |
| | | // 定义消息处理函数,更新 receivedData 变量 |
| | | const handleMessage2 = (data) => { |
| | | downLineTask.value = data.downLineTask[0]; |
| | | // console.log(data); |
| | | |
| | | /** |
| | | * 启动定时器 |
| | | * @param {number} interval - 定时间隔(毫秒,默认500ms,与后端任务频率对齐) |
| | | */ |
| | | const startTimer = (interval = 500) => { |
| | | // 先清除已有定时器(避免重复创建) |
| | | if (timerId.value) clearInterval(timerId.value); |
| | | // 立即执行一次(避免首次等待间隔) |
| | | fetchMachineData(); |
| | | // 创建新定时器 |
| | | timerId.value = setInterval(() => { |
| | | fetchMachineData(); |
| | | }, interval); |
| | | }; |
| | | |
| | | /** |
| | | * 清除定时器(避免内存泄漏) |
| | | */ |
| | | const clearTimer = () => { |
| | | if (timerId.value) { |
| | | clearInterval(timerId.value); |
| | | timerId.value = null; // 重置ID |
| | | } |
| | | }; |
| | | |
| | | // 组件卸载时清除定时器(关键:避免组件销毁后定时器仍运行) |
| | | onUnmounted(() => { |
| | | if (socket) { |
| | | closeWebSocket(socket); |
| | | } |
| | | if (socketDownLineTask) { |
| | | closeWebSocket(socketDownLineTask); |
| | | } |
| | | }); |
| | | onBeforeUnmount(() => { |
| | | console.log("关闭了") |
| | | closeWebSocket(); |
| | | clearTimer(); |
| | | }); |
| | | |
| | | onMounted(async () => { |
| | | //使用WebSocket方式展示数据 |
| | | socket = initializeWebSocket(socketUrl, handleMessage);// 初始化 WebSocket,并传递消息处理函数 |
| | | //使用WebSocket方式展示数据 |
| | | socketDownLineTask = initializeWebSocket(socketDownLineTaskUrl, handleMessage2);// 初始化 WebSocket,并传递消息处理函数 |
| | | startTimer(500); // 500ms 间隔(可根据业务调整,如1000ms) |
| | | // //使用WebSocket方式展示数据 |
| | | // socket = initializeWebSocket(socketUrl, handleMessage);// 初始化 WebSocket,并传递消息处理函数 |
| | | // //使用WebSocket方式展示数据 |
| | | // socketDownLineTask = initializeWebSocket(socketDownLineTaskUrl, handleMessage2);// 初始化 WebSocket,并传递消息处理函数 |
| | | }); |
| | | |
| | | //报警提示 |
| | | const errorInfoFuntion = async (info) => { |
| | | let infoScancode=info; |
| | |
| | | const pageParams=userInfo.user.menus[0].pages[2].params; |
| | | const pageParamsJson=JSON.parse(pageParams); |
| | | const machineId = pageParamsJson.machineId;//当前页面的设备ID |
| | | |
| | | |
| | | console.log(machineId); |
| | | //const machineId = 26;//当前页面的设备ID |
| | | var errorScanId; |
| | | var errorOpen=false; |
| | | //使用WebSocket方式展示数据 |
| | | let socket = null; |
| | | let socketDownLineTask = null; |
| | | const socketUrl = `ws://${WebSocketHost}:${host}/api/deviceInteraction/api/talk/flipSlice`; |
| | | const socketDownLineTaskUrl = `ws://${WebSocketHost}:${host}/api/deviceInteraction/api/talk/downLineTask`; |
| | | // 定义消息处理函数,更新 receivedData 变量 |
| | | const handleMessage = (data) => { |
| | | // 更新 tableData 的数据 |
| | | let dataJson = data[""+machineId][0]; |
| | | // 新增:定时任务ID(用于清除定时器) |
| | | const timerId = ref(null); |
| | | /** |
| | | * 单次接口请求函数 |
| | | * 作用:调用后端接口,获取数据后交给 handleMessage 处理 |
| | | */ |
| | | const fetchMachineData = async () => { |
| | | try { |
| | | // 任务数据 |
| | | request.post("/deviceInteraction/tasking/findMachineTask",{ |
| | | "id": machineId |
| | | }).then((res) => { // 替换为你的API端点 |
| | | if (res.code === 200) { |
| | | // 假设后端返回的数据格式与 handleMessage 预期一致 |
| | | const responseData = res.data || {}; |
| | | loadData.value =responseData; |
| | | } |
| | | }); |
| | | |
| | | loadData.value = dataJson.taskingList[0]; |
| | | findMachine.value = dataJson.machine[0]; |
| | | sendRecords.value = dataJson.sendRecords[0].reverse(); |
| | | if(findMachine.value.remark.toString()!=errorScanId&&findMachine.value.remark.toString()!=""&&findMachine.value.remark.toString()!=undefined){ |
| | | //有数据就弹窗 |
| | | if(errorOpen){ |
| | | ElMessageBox.close(); |
| | | } |
| | | errorScanId=findMachine.value.remark.toString(); |
| | | errorInfoFuntion(findMachine.value.remark.toString()); |
| | | errorOpen=true; |
| | | }else if(findMachine.value.remark.toString()==""&&errorOpen){ |
| | | ElMessageBox.close(); |
| | | errorOpen=false; |
| | | // 设备数据 |
| | | request.post("/deviceInteraction/machine/findMachine",{ |
| | | "id": machineId |
| | | }).then((res) => { // 替换为你的API端点 |
| | | if (res.code === 200) { |
| | | // 假设后端返回的数据格式与 handleMessage 预期一致 |
| | | const responseData = res.data || {}; |
| | | findMachine.value =responseData; |
| | | if (Object.keys(findMachine.value).length === 0){ |
| | | if(findMachine.value.remark.toString()!=errorScanId&&findMachine.value.remark.toString()!=""&&findMachine.value.remark.toString()!=undefined){ |
| | | //有数据就弹窗 |
| | | if(errorOpen){ |
| | | ElMessageBox.close(); |
| | | } |
| | | errorScanId=findMachine.value.remark.toString(); |
| | | errorInfoFuntion(findMachine.value.remark.toString()); |
| | | errorOpen=true; |
| | | }else if(findMachine.value.remark.toString()==""&&errorOpen){ |
| | | ElMessageBox.close(); |
| | | errorOpen=false; |
| | | } |
| | | } |
| | | } |
| | | }); |
| | | // 线下数据 |
| | | } catch (err) { |
| | | console.error('定时请求后端接口失败:', err); |
| | | } |
| | | |
| | | }; |
| | | // 定义消息处理函数,更新 receivedData 变量 |
| | | const handleMessage2 = (data) => { |
| | | downLineTask.value = data.downLineTask[0]; |
| | | // console.log(data); |
| | | |
| | | /** |
| | | * 启动定时器 |
| | | * @param {number} interval - 定时间隔(毫秒,默认500ms,与后端任务频率对齐) |
| | | */ |
| | | const startTimer = (interval = 500) => { |
| | | // 先清除已有定时器(避免重复创建) |
| | | if (timerId.value) clearInterval(timerId.value); |
| | | // 立即执行一次(避免首次等待间隔) |
| | | fetchMachineData(); |
| | | // 创建新定时器 |
| | | timerId.value = setInterval(() => { |
| | | fetchMachineData(); |
| | | }, interval); |
| | | }; |
| | | |
| | | /** |
| | | * 清除定时器(避免内存泄漏) |
| | | */ |
| | | const clearTimer = () => { |
| | | if (timerId.value) { |
| | | clearInterval(timerId.value); |
| | | timerId.value = null; // 重置ID |
| | | } |
| | | }; |
| | | |
| | | // 组件卸载时清除定时器(关键:避免组件销毁后定时器仍运行) |
| | | onUnmounted(() => { |
| | | if (socket) { |
| | | closeWebSocket(socket); |
| | | } |
| | | if (socketDownLineTask) { |
| | | closeWebSocket(socketDownLineTask); |
| | | } |
| | | }); |
| | | onBeforeUnmount(() => { |
| | | console.log("关闭了") |
| | | closeWebSocket(); |
| | | clearTimer(); |
| | | }); |
| | | |
| | | onMounted(async () => { |
| | | //使用WebSocket方式展示数据 |
| | | socket = initializeWebSocket(socketUrl, handleMessage);// 初始化 WebSocket,并传递消息处理函数 |
| | | //使用WebSocket方式展示数据 |
| | | socketDownLineTask = initializeWebSocket(socketDownLineTaskUrl, handleMessage2);// 初始化 WebSocket,并传递消息处理函数 |
| | | startTimer(500); // 500ms 间隔(可根据业务调整,如1000ms) |
| | | // //使用WebSocket方式展示数据 |
| | | // socket = initializeWebSocket(socketUrl, handleMessage);// 初始化 WebSocket,并传递消息处理函数 |
| | | // //使用WebSocket方式展示数据 |
| | | // socketDownLineTask = initializeWebSocket(socketDownLineTaskUrl, handleMessage2);// 初始化 WebSocket,并传递消息处理函数 |
| | | }); |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | //报警提示 |
| | | const errorInfoFuntion = async (info) => { |
| | | let infoScancode=info; |
| | | ElMessageBox.confirm( |
| | | infoScancode, |
| | | t('delivery.prompt'), |
| | | { |
| | | confirmButtonText: t('functionState.sureStart'), |
| | | cancelButtonText: t('functionState.cancel'), |
| | | type: 'warning', |
| | | } |
| | | infoScancode, |
| | | t('delivery.prompt'), |
| | | { |
| | | confirmButtonText: t('functionState.sureStart'), |
| | | cancelButtonText: t('functionState.cancel'), |
| | | type: 'warning', |
| | | } |
| | | ) |
| | | .then(() => { |
| | | }) |
| | | .catch(() => { |
| | | ElMessage({ |
| | | type: 'info', |
| | | message: t('functionState.cancel'), |
| | | .then(() => { |
| | | }) |
| | | }) |
| | | .catch(() => { |
| | | ElMessage({ |
| | | type: 'info', |
| | | message: t('functionState.cancel'), |
| | | }) |
| | | }) |
| | | } |
| | | //修改工作状态 【失败/正在工作/完工】 |
| | | const workStatus = async (row, state) => { |
| | |
| | | return; |
| | | } |
| | | ElMessageBox.confirm( |
| | | t('functionState.tips'), |
| | | t('delivery.prompt'), |
| | | { |
| | | confirmButtonText: t('functionState.sure'), |
| | | cancelButtonText: t('functionState.cancel'), |
| | | type: 'warning', |
| | | } |
| | | t('functionState.tips'), |
| | | t('delivery.prompt'), |
| | | { |
| | | confirmButtonText: t('functionState.sure'), |
| | | cancelButtonText: t('functionState.cancel'), |
| | | type: 'warning', |
| | | } |
| | | ) |
| | | .then(() => { |
| | | //开始修改 |
| | | request.post(url, |
| | | { |
| | | "id": machineId |
| | | }).then((res) => { // 替换为你的API端点 |
| | | .then(() => { |
| | | //开始修改 |
| | | request.post(url, |
| | | { |
| | | "id": machineId |
| | | }).then((res) => { // 替换为你的API端点 |
| | | if (res.code === 200) { |
| | | ElMessage.success(res.message); |
| | | } else { |
| | | ElMessage.warning(res.message) |
| | | } |
| | | }) |
| | | }) |
| | | .catch(() => { |
| | | ElMessage({ |
| | | type: 'info', |
| | | message: t('functionState.cancel'), |
| | | }) |
| | | }) |
| | | .catch(() => { |
| | | ElMessage({ |
| | | type: 'info', |
| | | message: t('functionState.cancel'), |
| | | }) |
| | | }) |
| | | |
| | | } |
| | | |
| | | //开工/暂停 |
| | | const machineStatus = async (state) => { |
| | | ElMessageBox.confirm( |
| | | t('functionState.tips'), |
| | | t('delivery.prompt'), |
| | | { |
| | | confirmButtonText: t('functionState.sure'), |
| | | cancelButtonText: t('functionState.cancel'), |
| | | type: 'warning', |
| | | } |
| | | t('functionState.tips'), |
| | | t('delivery.prompt'), |
| | | { |
| | | confirmButtonText: t('functionState.sure'), |
| | | cancelButtonText: t('functionState.cancel'), |
| | | type: 'warning', |
| | | } |
| | | ) |
| | | .then(() => { |
| | | //下线接口 |
| | | request.post("/deviceInteraction/machine/updateMachineState", |
| | | { |
| | | "id": machineId, |
| | | "state": state |
| | | }).then((res) => { // 替换为你的API端点 |
| | | .then(() => { |
| | | //下线接口 |
| | | request.post("/deviceInteraction/machine/updateMachineState", |
| | | { |
| | | "id": machineId, |
| | | "state": state |
| | | }).then((res) => { // 替换为你的API端点 |
| | | if (res.code === 200) { |
| | | ElMessage.success(res.message); |
| | | } else { |
| | | ElMessage.warning(res.message) |
| | | } |
| | | }) |
| | | }) |
| | | .catch(() => { |
| | | ElMessage({ |
| | | type: 'info', |
| | | message: t('functionState.cancel'), |
| | | }) |
| | | }) |
| | | .catch(() => { |
| | | ElMessage({ |
| | | type: 'info', |
| | | message: t('functionState.cancel'), |
| | | }) |
| | | }) |
| | | } |
| | | //定制/标准 |
| | | const machineMode = async (mode) => { |
| | | ElMessageBox.confirm( |
| | | t('functionState.tips'), |
| | | t('delivery.prompt'), |
| | | { |
| | | confirmButtonText: t('functionState.sure'), |
| | | cancelButtonText: t('functionState.cancel'), |
| | | type: 'warning', |
| | | } |
| | | t('functionState.tips'), |
| | | t('delivery.prompt'), |
| | | { |
| | | confirmButtonText: t('functionState.sure'), |
| | | cancelButtonText: t('functionState.cancel'), |
| | | type: 'warning', |
| | | } |
| | | ) |
| | | .then(() => { |
| | | //下线接口 |
| | | request.post("/deviceInteraction/machine/toggleModeMachine", |
| | | { |
| | | "id": machineId, |
| | | "mode": mode |
| | | }).then((res) => { // 替换为你的API端点 |
| | | .then(() => { |
| | | //下线接口 |
| | | request.post("/deviceInteraction/machine/toggleModeMachine", |
| | | { |
| | | "id": machineId, |
| | | "mode": mode |
| | | }).then((res) => { // 替换为你的API端点 |
| | | if (res.code === 200) { |
| | | ElMessage.success(res.message); |
| | | } else { |
| | | ElMessage.warning(res.message) |
| | | } |
| | | }) |
| | | }) |
| | | .catch(() => { |
| | | ElMessage({ |
| | | type: 'info', |
| | | message: t('functionState.cancel'), |
| | | }) |
| | | }) |
| | | .catch(() => { |
| | | ElMessage({ |
| | | type: 'info', |
| | | message: t('functionState.cancel'), |
| | | }) |
| | | }) |
| | | } |
| | | //破损 |
| | | const damagedTask = async (row) => { |
| | | ElMessageBox.confirm( |
| | | t('functionState.tips'), |
| | | t('delivery.prompt'), |
| | | { |
| | | confirmButtonText: t('functionState.sure'), |
| | | cancelButtonText: t('functionState.cancel'), |
| | | type: 'warning', |
| | | } |
| | | t('functionState.tips'), |
| | | t('delivery.prompt'), |
| | | { |
| | | confirmButtonText: t('functionState.sure'), |
| | | cancelButtonText: t('functionState.cancel'), |
| | | type: 'warning', |
| | | } |
| | | ) |
| | | .then(() => { |
| | | //下线接口 |
| | | request.post("/deviceInteraction/tasking/damagedTask", |
| | | { |
| | | "glassId": row.glassId |
| | | }).then((res) => { // 替换为你的API端点 |
| | | .then(() => { |
| | | //下线接口 |
| | | request.post("/deviceInteraction/tasking/damagedTask", |
| | | { |
| | | "glassId": row.glassId |
| | | }).then((res) => { // 替换为你的API端点 |
| | | if (res.code === 200) { |
| | | ElMessage.success(res.message); |
| | | } else { |
| | | ElMessage.warning(res.message) |
| | | } |
| | | }) |
| | | }) |
| | | .catch(() => { |
| | | ElMessage({ |
| | | type: 'info', |
| | | message: t('functionState.cancel'), |
| | | }) |
| | | }) |
| | | .catch(() => { |
| | | ElMessage({ |
| | | type: 'info', |
| | | message: t('functionState.cancel'), |
| | | }) |
| | | }) |
| | | } |
| | | //下线(拿走) |
| | | const glassDownLine = async (row) => { |
| | | ElMessageBox.confirm( |
| | | t('functionState.tips'), |
| | | t('delivery.prompt'), |
| | | { |
| | | confirmButtonText: t('functionState.sure'), |
| | | cancelButtonText: t('functionState.cancel'), |
| | | type: 'warning', |
| | | } |
| | | t('functionState.tips'), |
| | | t('delivery.prompt'), |
| | | { |
| | | confirmButtonText: t('functionState.sure'), |
| | | cancelButtonText: t('functionState.cancel'), |
| | | type: 'warning', |
| | | } |
| | | ) |
| | | .then(() => { |
| | | //下线接口 |
| | | request.post("/deviceInteraction/tasking/glassDownLine", |
| | | { |
| | | "glassId": row.glassId, |
| | | }).then((res) => { // 替换为你的API端点 |
| | | .then(() => { |
| | | //下线接口 |
| | | request.post("/deviceInteraction/tasking/glassDownLine", |
| | | { |
| | | "glassId": row.glassId, |
| | | }).then((res) => { // 替换为你的API端点 |
| | | if (res.code === 200) { |
| | | ElMessage.success(res.message); |
| | | } else { |
| | | ElMessage.warning(res.message) |
| | | } |
| | | }) |
| | | }) |
| | | .catch(() => { |
| | | ElMessage({ |
| | | type: 'info', |
| | | message: t('functionState.cancel'), |
| | | }) |
| | | }) |
| | | .catch(() => { |
| | | ElMessage({ |
| | | type: 'info', |
| | | message: t('functionState.cancel'), |
| | | }) |
| | | }) |
| | | } |
| | | const topLineShow = async () => { |
| | | blind.value = true; |
| | | blind.value = true; |
| | | } |
| | | //上线 |
| | | const topLine = async (row) => { |
| | | ElMessageBox.confirm( |
| | | t('functionState.tips'), |
| | | t('delivery.prompt'), |
| | | { |
| | | confirmButtonText: t('functionState.sure'), |
| | | cancelButtonText: t('functionState.cancel'), |
| | | type: 'warning', |
| | | } |
| | | t('functionState.tips'), |
| | | t('delivery.prompt'), |
| | | { |
| | | confirmButtonText: t('functionState.sure'), |
| | | cancelButtonText: t('functionState.cancel'), |
| | | type: 'warning', |
| | | } |
| | | ) |
| | | .then(() => { |
| | | //上线接口 |
| | | request.post("/deviceInteraction/tasking/glassTopLine", |
| | | { |
| | | "glassId": row.glassId, |
| | | "lineConfigurationId": machineId |
| | | }).then((res) => { // 替换为你的API端点 |
| | | .then(() => { |
| | | //上线接口 |
| | | request.post("/deviceInteraction/tasking/glassTopLine", |
| | | { |
| | | "glassId": row.glassId, |
| | | "lineConfigurationId": machineId |
| | | }).then((res) => { // 替换为你的API端点 |
| | | if (res.code === 200) { |
| | | ElMessage.success(res.message); |
| | | } else {n |
| | | ElMessage.warning(res.message) |
| | | } |
| | | }) |
| | | }) |
| | | .catch(() => { |
| | | ElMessage({ |
| | | type: 'info', |
| | | message: t('functionState.cancel'), |
| | | }) |
| | | }) |
| | | .catch(() => { |
| | | ElMessage({ |
| | | type: 'info', |
| | | message: t('functionState.cancel'), |
| | | }) |
| | | }) |
| | | } |
| | | const handleDialogClose = () => { |
| | | |
| | | const handleDialogClose = () => { |
| | | |
| | | } |
| | | </script> |
| | | <template> |
| | |
| | | {{ $t('machine.flipSlice') }} |
| | | </div> |
| | | <el-dialog v-model="blind" top="30vh" style="text-align: center;" @close="handleDialogClose"> |
| | | <!-- 线下玻璃 --> |
| | | <!-- 线下玻璃 --> |
| | | <el-table :data="downLineTask" stripe :header-cell-style="{ background: '#F2F3F5 ', color: '#1D2129', textAlign: 'center' }" :cell-style="{ textAlign: 'center' }"> |
| | | <!-- <el-table-column type="selection" min-width="30" /> --> |
| | | <el-table-column type="index" :label="$t('glassInfo.number')" min-width="30" /> |
| | |
| | | <el-table-column fixed="right" :label="$t('productStock.operate')" align="center" width="70"> |
| | | <template #default="scope"> |
| | | <el-button size="mini" link type="primary" plain @click="topLine(scope.row)">{{ |
| | | $t('functionState.topLine') }}</el-button> |
| | | $t('functionState.topLine') }}</el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | |
| | | <div id="search"> |
| | | <!-- 功能 --> |
| | | <el-button :type="(findMachine['state'] == '暂停' ? 'danger' : 'success')" id="ButtonMachineStatus" |
| | | @click="machineStatus((findMachine['state'] == '暂停' ? '开工' : '暂停'))">{{ findMachine['state'] == '开工' ? |
| | | @click="machineStatus((findMachine['state'] == '暂停' ? '开工' : '暂停'))">{{ findMachine['state'] == '开工' ? |
| | | $t('functionState.start') : $t('functionState.stop') }}</el-button> |
| | | |
| | | <el-button :type="(findMachine['mode'] == '定制' ? 'danger' : 'success')" id="ButtonMachineMode" |
| | | @click="machineMode((findMachine['mode'] == 0 ? 1 : 0))">{{ findMachine['mode'] == 0 ? |
| | | $t('functionState.modeD') : $t('functionState.modeB') }}</el-button> |
| | | |
| | | @click="machineMode((findMachine['mode'] == 0 ? 1 : 0))">{{ findMachine['mode'] == 0 ? |
| | | $t('functionState.modeD') : $t('functionState.modeB') }}</el-button> |
| | | |
| | | <el-button type="primary" id="ButtonTopLine" @click="topLineShow">{{ $t('functionState.topLine') }}</el-button> |
| | | <!-- <el-button type="primary" id="searchButton" @click="downLine('下线')">下线</el-button> |
| | | <el-button type="primary" id="searchButton" @click="workStatus('破损')">破损</el-button> |
| | |
| | | <div id="main-body"> |
| | | <!-- 表格内容 --> |
| | | <el-table :data="loadData" stripe style="height:260px" |
| | | :header-cell-style="{ background: '#F2F3F5 ', color: '#1D2129', textAlign: 'center' }" |
| | | :cell-style="{ textAlign: 'center' }"> |
| | | :header-cell-style="{ background: '#F2F3F5 ', color: '#1D2129', textAlign: 'center' }" |
| | | :cell-style="{ textAlign: 'center' }"> |
| | | <!-- <el-table-column type="selection" min-width="30" /> --> |
| | | <el-table-column type="index" :label="$t('glassInfo.number')" min-width="30" /> |
| | | <el-table-column prop="batchNumber" :label="$t('glassInfo.batchNumber')" /> |
| | |
| | | <el-table-column fixed="right" :label="$t('productStock.operate')" align="center" width="270"> |
| | | <template #default="scope"> |
| | | <el-button size="mini" link type="primary" plain @click="workStatus(scope.row, '重发')">{{ |
| | | $t('functionState.anew') }}</el-button> |
| | | $t('functionState.anew') }}</el-button> |
| | | <el-button size="mini" link type="primary" plain @click="workStatus(scope.row, '完工')">{{ |
| | | $t('functionState.finish') }}</el-button> |
| | | $t('functionState.finish') }}</el-button> |
| | | <el-button size="mini" link type="primary" plain @click="damagedTask(scope.row)">{{ $t('functionState.lose') |
| | | }}</el-button> |
| | | <el-button size="mini" link type="primary" plain @click="glassDownLine(scope.row)">{{ |
| | | $t('functionState.downLine') }}</el-button> |
| | | $t('functionState.downLine') }}</el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | |
| | | </div> --> |
| | | <div style="width: 30%;min-width: 300px; height: 460px;float: left;padding: 20px;;"> |
| | | <el-table :data="sendRecords" stripe |
| | | :header-cell-style="{ background: '#F2F3F5 ', color: '#1D2129', textAlign: 'center', height: '30px' }" |
| | | :cell-style="{ textAlign: 'center' }"> |
| | | :header-cell-style="{ background: '#F2F3F5 ', color: '#1D2129', textAlign: 'center', height: '30px' }" |
| | | :cell-style="{ textAlign: 'center' }"> |
| | | <el-table-column prop="sendContent" :label="$t('glassInfo.sendContent')" /> |
| | | </el-table> |
| | | </div> |
| | |
| | | height:10px; |
| | | border-radius: 50%; |
| | | display: block; |
| | | margin-left: 10px; |
| | | margin-left: 10px; |
| | | } |
| | | </style> |
| | |
| | | const userInfo=JSON.parse(window.localStorage.getItem('userInfo')); |
| | | const pageParams=userInfo.user.menus[0].pages[8].params; |
| | | const pageParamsJson=JSON.parse(pageParams); |
| | | console.log(pageParams); |
| | | console.log(userInfo.user); |
| | | |
| | | |
| | | const machineId = pageParamsJson.machineId;//当前页面的设备ID |
| | | console.log(machineId); |
| | | //使用WebSocket方式展示数据 |
| | | let socket = null; |
| | | let socketDownLineTask = null; |
| | | const socketUrl = `ws://${WebSocketHost}:${host}/api/deviceInteraction/api/talk/glueDispenser`; |
| | | const socketDownLineTaskUrl = `ws://${WebSocketHost}:${host}/api/deviceInteraction/api/talk/downLineTask`; |
| | | // 定义消息处理函数,更新 receivedData 变量 |
| | | const handleMessage = (data) => { |
| | | // 更新 tableData 的数据 |
| | | let dataJson = data[""+machineId][0]; |
| | | // 新增:定时任务ID(用于清除定时器) |
| | | const timerId = ref(null); |
| | | /** |
| | | * 单次接口请求函数 |
| | | * 作用:调用后端接口,获取数据后交给 handleMessage 处理 |
| | | */ |
| | | const fetchMachineData = async () => { |
| | | try { |
| | | // 任务数据 |
| | | request.post("/deviceInteraction/tasking/findMachineTask",{ |
| | | "id": machineId |
| | | }).then((res) => { // 替换为你的API端点 |
| | | if (res.code === 200) { |
| | | // 假设后端返回的数据格式与 handleMessage 预期一致 |
| | | const responseData = res.data || {}; |
| | | loadData.value =responseData; |
| | | } |
| | | }); |
| | | |
| | | loadData.value = dataJson.taskingList[0]; |
| | | findMachine.value = dataJson.machine[0]; |
| | | // 设备数据 |
| | | request.post("/deviceInteraction/machine/findMachine",{ |
| | | "id": machineId |
| | | }).then((res) => { // 替换为你的API端点 |
| | | if (res.code === 200) { |
| | | // 假设后端返回的数据格式与 handleMessage 预期一致 |
| | | const responseData = res.data || {}; |
| | | findMachine.value =responseData; |
| | | } |
| | | }); |
| | | |
| | | sendRecords.value = dataJson.sendRecords[0].reverse(); |
| | | |
| | | // 线下数据 |
| | | } catch (err) { |
| | | console.error('定时请求后端接口失败:', err); |
| | | } |
| | | }; |
| | | // 定义消息处理函数,更新 receivedData 变量 |
| | | const handleMessage2 = (data) => { |
| | | downLineTask.value = data.downLineTask[0]; |
| | | // console.log(data); |
| | | |
| | | /** |
| | | * 启动定时器 |
| | | * @param {number} interval - 定时间隔(毫秒,默认500ms,与后端任务频率对齐) |
| | | */ |
| | | const startTimer = (interval = 500) => { |
| | | // 先清除已有定时器(避免重复创建) |
| | | if (timerId.value) clearInterval(timerId.value); |
| | | // 立即执行一次(避免首次等待间隔) |
| | | fetchMachineData(); |
| | | // 创建新定时器 |
| | | timerId.value = setInterval(() => { |
| | | fetchMachineData(); |
| | | }, interval); |
| | | }; |
| | | |
| | | /** |
| | | * 清除定时器(避免内存泄漏) |
| | | */ |
| | | const clearTimer = () => { |
| | | if (timerId.value) { |
| | | clearInterval(timerId.value); |
| | | timerId.value = null; // 重置ID |
| | | } |
| | | }; |
| | | |
| | | // 组件卸载时清除定时器(关键:避免组件销毁后定时器仍运行) |
| | | onUnmounted(() => { |
| | | if (socket) { |
| | | closeWebSocket(socket); |
| | | } |
| | | if (socketDownLineTask) { |
| | | closeWebSocket(socketDownLineTask); |
| | | } |
| | | }); |
| | | onBeforeUnmount(() => { |
| | | console.log("关闭了") |
| | | closeWebSocket(); |
| | | clearTimer(); |
| | | }); |
| | | |
| | | onMounted(async () => { |
| | | //使用WebSocket方式展示数据 |
| | | socket = initializeWebSocket(socketUrl, handleMessage);// 初始化 WebSocket,并传递消息处理函数 |
| | | //使用WebSocket方式展示数据 |
| | | socketDownLineTask = initializeWebSocket(socketDownLineTaskUrl, handleMessage2);// 初始化 WebSocket,并传递消息处理函数 |
| | | startTimer(500); // 500ms 间隔(可根据业务调整,如1000ms) |
| | | // //使用WebSocket方式展示数据 |
| | | // socket = initializeWebSocket(socketUrl, handleMessage);// 初始化 WebSocket,并传递消息处理函数 |
| | | // //使用WebSocket方式展示数据 |
| | | // socketDownLineTask = initializeWebSocket(socketDownLineTaskUrl, handleMessage2);// 初始化 WebSocket,并传递消息处理函数 |
| | | }); |
| | | //报警提示 |
| | | const errorInfoFuntion = async (info) => { |
| | |
| | | //const machineId = 21;//当前页面的设备ID |
| | | var errorScanId; |
| | | var errorOpen=false; |
| | | //使用WebSocket方式展示数据 |
| | | let socket = null; |
| | | let socketDownLineTask = null; |
| | | const socketUrl = `ws://${WebSocketHost}:${host}/api/deviceInteraction/api/talk/lamination`; |
| | | const socketDownLineTaskUrl = `ws://${WebSocketHost}:${host}/api/deviceInteraction/api/talk/downLineTask`; |
| | | // 定义消息处理函数,更新 receivedData 变量 |
| | | const handleMessage = (data) => { |
| | | // 更新 tableData 的数据 |
| | | let dataJson = data[""+machineId][0]; |
| | | // 新增:定时任务ID(用于清除定时器) |
| | | const timerId = ref(null); |
| | | /** |
| | | * 单次接口请求函数 |
| | | * 作用:调用后端接口,获取数据后交给 handleMessage 处理 |
| | | */ |
| | | const fetchMachineData = async () => { |
| | | try { |
| | | // 任务数据 |
| | | request.post("/deviceInteraction/tasking/findMachineTask",{ |
| | | "id": machineId |
| | | }).then((res) => { // 替换为你的API端点 |
| | | if (res.code === 200) { |
| | | // 假设后端返回的数据格式与 handleMessage 预期一致 |
| | | const responseData = res.data || {}; |
| | | loadData.value =responseData; |
| | | } |
| | | }); |
| | | |
| | | loadData.value = dataJson.taskingList[0]; |
| | | findMachine.value = dataJson.machine[0]; |
| | | sendRecords.value = dataJson.sendRecords[0].reverse(); |
| | | |
| | | // 设备数据 |
| | | request.post("/deviceInteraction/machine/findMachine",{ |
| | | "id": machineId |
| | | }).then((res) => { // 替换为你的API端点 |
| | | if (res.code === 200) { |
| | | // 假设后端返回的数据格式与 handleMessage 预期一致 |
| | | const responseData = res.data || {}; |
| | | findMachine.value =responseData; |
| | | if (Object.keys(findMachine.value).length === 0){ |
| | | if(findMachine.value.remark.toString()!=errorScanId&&findMachine.value.remark.toString()!=""&&findMachine.value.remark.toString()!=undefined){ |
| | | //有数据就弹窗 |
| | | if(errorOpen){ |
| | | ElMessageBox.close(); |
| | | } |
| | | errorScanId=findMachine.value.remark.toString(); |
| | | errorInfoFuntion(findMachine.value.remark.toString()); |
| | | errorOpen=true; |
| | | }else if(findMachine.value.remark.toString()==""&&errorOpen){ |
| | | ElMessageBox.close(); |
| | | errorOpen=false; |
| | | } |
| | | } |
| | | } |
| | | }); |
| | | |
| | | // 线下数据 |
| | | } catch (err) { |
| | | console.error('定时请求后端接口失败:', err); |
| | | } |
| | | }; |
| | | // 定义消息处理函数,更新 receivedData 变量 |
| | | const handleMessage2 = (data) => { |
| | | downLineTask.value = data.downLineTask[0]; |
| | | // console.log(data); |
| | | |
| | | /** |
| | | * 启动定时器 |
| | | * @param {number} interval - 定时间隔(毫秒,默认500ms,与后端任务频率对齐) |
| | | */ |
| | | const startTimer = (interval = 500) => { |
| | | // 先清除已有定时器(避免重复创建) |
| | | if (timerId.value) clearInterval(timerId.value); |
| | | // 立即执行一次(避免首次等待间隔) |
| | | fetchMachineData(); |
| | | // 创建新定时器 |
| | | timerId.value = setInterval(() => { |
| | | fetchMachineData(); |
| | | }, interval); |
| | | }; |
| | | |
| | | /** |
| | | * 清除定时器(避免内存泄漏) |
| | | */ |
| | | const clearTimer = () => { |
| | | if (timerId.value) { |
| | | clearInterval(timerId.value); |
| | | timerId.value = null; // 重置ID |
| | | } |
| | | }; |
| | | |
| | | // 组件卸载时清除定时器(关键:避免组件销毁后定时器仍运行) |
| | | onUnmounted(() => { |
| | | if (socket) { |
| | | closeWebSocket(socket); |
| | | } |
| | | if (socketDownLineTask) { |
| | | closeWebSocket(socketDownLineTask); |
| | | } |
| | | }); |
| | | onBeforeUnmount(() => { |
| | | console.log("关闭了") |
| | | closeWebSocket(); |
| | | clearTimer(); |
| | | }); |
| | | |
| | | onMounted(async () => { |
| | | //使用WebSocket方式展示数据 |
| | | socket = initializeWebSocket(socketUrl, handleMessage);// 初始化 WebSocket,并传递消息处理函数 |
| | | //使用WebSocket方式展示数据 |
| | | socketDownLineTask = initializeWebSocket(socketDownLineTaskUrl, handleMessage2);// 初始化 WebSocket,并传递消息处理函数 |
| | | startTimer(500); // 500ms 间隔(可根据业务调整,如1000ms) |
| | | // //使用WebSocket方式展示数据 |
| | | // socket = initializeWebSocket(socketUrl, handleMessage);// 初始化 WebSocket,并传递消息处理函数 |
| | | // //使用WebSocket方式展示数据 |
| | | // socketDownLineTask = initializeWebSocket(socketDownLineTaskUrl, handleMessage2);// 初始化 WebSocket,并传递消息处理函数 |
| | | }); |
| | | //报警提示 |
| | | const errorInfoFuntion = async (info) => { |
| | |
| | | const blind = ref(false) |
| | | const errorInfo = ref(true) |
| | | const loadData = ref([]); |
| | | const taskinggoruby = ref([]); |
| | | |
| | | const findMachine = ref([]); |
| | | const sendRecords = ref([]); |
| | | const downLineTask = ref([]); |
| | |
| | | console.log(machineId); |
| | | var errorScanId; |
| | | var errorOpen=false; |
| | | //使用WebSocket方式展示数据 |
| | | let socket = null; |
| | | let socketDownLineTask = null; |
| | | const socketUrl = `ws://${WebSocketHost}:${host}/api/deviceInteraction/api/talk/manualReporting`; |
| | | const socketDownLineTaskUrl = `ws://${WebSocketHost}:${host}/api/deviceInteraction/api/talk/downLineTask`; |
| | | // 定义消息处理函数,更新 receivedData 变量 |
| | | const handleMessage = (data) => { |
| | | // 更新 tableData 的数据 |
| | | //taskinggoruby.value = data.taskinggoruby[0]; |
| | | //loadData.value =getDataSort(data.taskingList[0]); |
| | | const dataJson = data[""+machineId][0]; |
| | | loadData.value = dataJson.taskingList[0]; |
| | | findMachine.value = dataJson.machine[0]; |
| | | |
| | | if(findMachine.value.remark.toString()!=errorScanId&&findMachine.value.remark.toString()!=""&&findMachine.value.remark.toString()!=undefined){ |
| | | //有数据就弹窗 |
| | | if(errorOpen){ |
| | | ElMessageBox.close(); |
| | | // 分组后的统计数据 |
| | | const taskingGroupBy = ref([]); |
| | | // 分组并统计的方法 |
| | | const groupAndCount = () => { |
| | | // 创建一个临时对象用于分组计数 |
| | | const groupMap = {}; |
| | | // 遍历原始数据 |
| | | loadData.value.forEach(item => { |
| | | // 生成唯一的分组键(组合三个字段) |
| | | const groupKey = `${item.scanId || ''}-${item.batchNumber || ''}-${item.taskType || ''}`; |
| | | // 检查该分组是否已存在 |
| | | if (groupMap[groupKey]) { |
| | | // 已存在则数量+1 |
| | | groupMap[groupKey].reportCount++; |
| | | } else { |
| | | // 不存在则创建新分组 |
| | | groupMap[groupKey] = { |
| | | scanId: item.scanId, |
| | | batchNumber: item.batchNumber, |
| | | taskType: item.taskType, |
| | | taskQuantity: item.taskQuantity, |
| | | reportCount:1 |
| | | |
| | | }; |
| | | } |
| | | errorScanId=findMachine.value.remark.toString(); |
| | | errorInfoFuntion(findMachine.value.remark.toString()); |
| | | errorOpen=true; |
| | | }else if(findMachine.value.remark.toString()==""&&errorOpen){ |
| | | ElMessageBox.close(); |
| | | errorOpen=false; |
| | | }); |
| | | console.log(taskingGroupBy.value); |
| | | // 将对象转换为数组 |
| | | taskingGroupBy.value = Object.values(groupMap); |
| | | }; |
| | | // 新增:定时任务ID(用于清除定时器) |
| | | const timerId = ref(null); |
| | | /** |
| | | * 单次接口请求函数 |
| | | * 作用:调用后端接口,获取数据后交给 handleMessage 处理 |
| | | */ |
| | | const fetchMachineData = async () => { |
| | | try { |
| | | // 任务数据 |
| | | request.post("/deviceInteraction/tasking/findMachineTask",{ |
| | | "id": machineId |
| | | }).then((res) => { // 替换为你的API端点 |
| | | if (res.code === 200) { |
| | | // 假设后端返回的数据格式与 handleMessage 预期一致 |
| | | const responseData = res.data || {}; |
| | | loadData.value =responseData; |
| | | groupAndCount(); |
| | | } |
| | | }); |
| | | |
| | | // 设备数据 |
| | | request.post("/deviceInteraction/machine/findMachine",{ |
| | | "id": machineId |
| | | }).then((res) => { // 替换为你的API端点 |
| | | if (res.code === 200) { |
| | | // 假设后端返回的数据格式与 handleMessage 预期一致 |
| | | const responseData = res.data || {}; |
| | | findMachine.value =responseData; |
| | | if (Object.keys(findMachine.value).length === 0){ |
| | | if(findMachine.value.remark.toString()!=errorScanId&&findMachine.value.remark.toString()!=""&&findMachine.value.remark.toString()!=undefined){ |
| | | //有数据就弹窗 |
| | | if(errorOpen){ |
| | | ElMessageBox.close(); |
| | | } |
| | | errorScanId=findMachine.value.remark.toString(); |
| | | errorInfoFuntion(findMachine.value.remark.toString()); |
| | | errorOpen=true; |
| | | }else if(findMachine.value.remark.toString()==""&&errorOpen){ |
| | | ElMessageBox.close(); |
| | | errorOpen=false; |
| | | } |
| | | } |
| | | } |
| | | }); |
| | | // 线下数据 |
| | | } catch (err) { |
| | | console.error('定时请求后端接口失败:', err); |
| | | } |
| | | |
| | | }; |
| | | // 定义消息处理函数,更新 receivedData 变量 |
| | | const handleMessage2 = (data) => { |
| | | downLineTask.value = data.downLineTask[0]; |
| | | // console.log(data); |
| | | |
| | | /** |
| | | * 启动定时器 |
| | | * @param {number} interval - 定时间隔(毫秒,默认500ms,与后端任务频率对齐) |
| | | */ |
| | | const startTimer = (interval = 500) => { |
| | | // 先清除已有定时器(避免重复创建) |
| | | if (timerId.value) clearInterval(timerId.value); |
| | | // 立即执行一次(避免首次等待间隔) |
| | | fetchMachineData(); |
| | | // 创建新定时器 |
| | | timerId.value = setInterval(() => { |
| | | fetchMachineData(); |
| | | }, interval); |
| | | }; |
| | | |
| | | /** |
| | | * 清除定时器(避免内存泄漏) |
| | | */ |
| | | const clearTimer = () => { |
| | | if (timerId.value) { |
| | | clearInterval(timerId.value); |
| | | timerId.value = null; // 重置ID |
| | | } |
| | | }; |
| | | |
| | | // 组件卸载时清除定时器(关键:避免组件销毁后定时器仍运行) |
| | | onUnmounted(() => { |
| | | if (socket) { |
| | | closeWebSocket(socket); |
| | | } |
| | | if (socketDownLineTask) { |
| | | closeWebSocket(socketDownLineTask); |
| | | } |
| | | }); |
| | | onBeforeUnmount(() => { |
| | | console.log("关闭了") |
| | | closeWebSocket(); |
| | | clearTimer(); |
| | | }); |
| | | |
| | | onMounted(async () => { |
| | | //使用WebSocket方式展示数据 |
| | | socket = initializeWebSocket(socketUrl, handleMessage);// 初始化 WebSocket,并传递消息处理函数 |
| | | //使用WebSocket方式展示数据 |
| | | socketDownLineTask = initializeWebSocket(socketDownLineTaskUrl, handleMessage2);// 初始化 WebSocket,并传递消息处理函数 |
| | | startTimer(500); // 500ms 间隔(可根据业务调整,如1000ms) |
| | | // //使用WebSocket方式展示数据 |
| | | // socket = initializeWebSocket(socketUrl, handleMessage);// 初始化 WebSocket,并传递消息处理函数 |
| | | // //使用WebSocket方式展示数据 |
| | | // socketDownLineTask = initializeWebSocket(socketDownLineTaskUrl, handleMessage2);// 初始化 WebSocket,并传递消息处理函数 |
| | | }); |
| | | //报警提示 |
| | | const errorInfoFuntion = async (info) => { |
| | |
| | | |
| | | <div id="main-body" style="min-height:240px;"> |
| | | <!-- 表格内容 --> |
| | | <el-table :data="taskinggoruby" stripe |
| | | <el-table :data="taskingGroupBy" stripe |
| | | :header-cell-style="{ background: '#F2F3F5 ', color: '#1D2129', textAlign: 'center' }" |
| | | :cell-style="{ textAlign: 'center' }"> |
| | | <!-- <el-table-column type="selection" min-width="30" /> --> |
| | |
| | | <el-table-column prop="scanId" :label="$t('glassInfo.scanId')" /> |
| | | <el-table-column prop="taskQuantity" :label="$t('glassInfo.taskQuantity')" /> |
| | | <el-table-column prop="reportCount" :label="$t('glassInfo.reportCount')" /> |
| | | |
| | | <el-table-column fixed="right" :label="$t('productStock.operate')" align="center" width="270"> |
| | | <template #default="scope"> |
| | | <el-button size="mini" link type="primary" plain @click="damagedTask(scope.row)">{{ $t('functionState.lose') |
| | | }}</el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | </div> |
| | | |
| | |
| | | const machineId = pageParamsJson.machineId;//当前页面的设备ID |
| | | console.log(machineId); |
| | | //const machineId=12;//当前页面的设备ID |
| | | //使用WebSocket方式展示数据 |
| | | let socket = null; |
| | | const socketUrl = `ws://${WebSocketHost}:${host}/api/deviceInteraction/api/talk/marking`; |
| | | // 定义消息处理函数,更新 receivedData 变量 |
| | | const handleMessage = (data) => { |
| | | // 更新 tableData 的数据 |
| | | let dataJson = data[""+machineId][0]; |
| | | // 新增:定时任务ID(用于清除定时器) |
| | | const timerId = ref(null); |
| | | /** |
| | | * 单次接口请求函数 |
| | | * 作用:调用后端接口,获取数据后交给 handleMessage 处理 |
| | | */ |
| | | const fetchMachineData = async () => { |
| | | try { |
| | | // 任务数据 |
| | | request.post("/deviceInteraction/tasking/findMachineTask",{ |
| | | "id": machineId |
| | | }).then((res) => { // 替换为你的API端点 |
| | | if (res.code === 200) { |
| | | // 假设后端返回的数据格式与 handleMessage 预期一致 |
| | | const responseData = res.data || {}; |
| | | loadData.value =responseData; |
| | | } |
| | | }); |
| | | |
| | | loadData.value = dataJson.taskingList[0]; |
| | | findMachine.value = dataJson.machine[0]; |
| | | sendRecords.value = dataJson.sendRecords[0]; |
| | | }; |
| | | onUnmounted(() => { |
| | | if (socket) { |
| | | closeWebSocket(socket); |
| | | // 设备数据 |
| | | request.post("/deviceInteraction/machine/findMachine",{ |
| | | "id": machineId |
| | | }).then((res) => { // 替换为你的API端点 |
| | | if (res.code === 200) { |
| | | // 假设后端返回的数据格式与 handleMessage 预期一致 |
| | | const responseData = res.data || {}; |
| | | findMachine.value =responseData; |
| | | } |
| | | }); |
| | | |
| | | // 线下数据 |
| | | } catch (err) { |
| | | console.error('定时请求后端接口失败:', err); |
| | | } |
| | | }); |
| | | onBeforeUnmount(() => { |
| | | console.log("关闭了") |
| | | closeWebSocket(); |
| | | }; |
| | | |
| | | /** |
| | | * 启动定时器 |
| | | * @param {number} interval - 定时间隔(毫秒,默认500ms,与后端任务频率对齐) |
| | | */ |
| | | const startTimer = (interval = 500) => { |
| | | // 先清除已有定时器(避免重复创建) |
| | | if (timerId.value) clearInterval(timerId.value); |
| | | // 立即执行一次(避免首次等待间隔) |
| | | fetchMachineData(); |
| | | // 创建新定时器 |
| | | timerId.value = setInterval(() => { |
| | | fetchMachineData(); |
| | | }, interval); |
| | | }; |
| | | |
| | | /** |
| | | * 清除定时器(避免内存泄漏) |
| | | */ |
| | | const clearTimer = () => { |
| | | if (timerId.value) { |
| | | clearInterval(timerId.value); |
| | | timerId.value = null; // 重置ID |
| | | } |
| | | }; |
| | | |
| | | // 组件卸载时清除定时器(关键:避免组件销毁后定时器仍运行) |
| | | onUnmounted(() => { |
| | | clearTimer(); |
| | | }); |
| | | |
| | | onMounted(async () => { |
| | | //使用WebSocket方式展示数据 |
| | | socket = initializeWebSocket(socketUrl, handleMessage);// 初始化 WebSocket,并传递消息处理函数 |
| | | startTimer(500); // 500ms 间隔(可根据业务调整,如1000ms) |
| | | // //使用WebSocket方式展示数据 |
| | | // socket = initializeWebSocket(socketUrl, handleMessage);// 初始化 WebSocket,并传递消息处理函数 |
| | | // //使用WebSocket方式展示数据 |
| | | // socketDownLineTask = initializeWebSocket(socketDownLineTaskUrl, handleMessage2);// 初始化 WebSocket,并传递消息处理函数 |
| | | }); |
| | | //修改工作状态 【失败/正在工作/完工】 |
| | | const workStatus = async(row,state) => { |
| | |
| | | <!-- 上片机 --> |
| | | <script setup> |
| | | import request from "@/utils/request"; |
| | | import { ElMessage, ElMessageBox } from "element-plus"; |
| | | import { computed, reactive, ref, onMounted, onBeforeUnmount, onUnmounted } from 'vue' |
| | | import { useI18n } from 'vue-i18n' |
| | | import { WebSocketHost, host } from '@/utils/constants' |
| | | import { initializeWebSocket, closeWebSocket } from '@/utils/WebSocketService'; |
| | | import {ElMessage, ElMessageBox} from "element-plus"; |
| | | import {computed, reactive, ref, onMounted, onBeforeUnmount, onUnmounted} from 'vue' |
| | | import {useI18n} from 'vue-i18n' |
| | | import {WebSocketHost, host} from '@/utils/constants' |
| | | import {initializeWebSocket, closeWebSocket} from '@/utils/WebSocketService'; |
| | | |
| | | let language = ref(localStorage.getItem('lang') || 'zh') |
| | | const { t } = useI18n() |
| | | const {t} = useI18n() |
| | | const requestData = reactive({ |
| | | account: '', |
| | | password: '', |
| | |
| | | const scanCodeOld = ref([]); |
| | | const searchs = ref(); |
| | | |
| | | const userInfo=JSON.parse(window.localStorage.getItem('userInfo')); |
| | | const pageParams=userInfo.user.menus[0].pages[0].params; |
| | | const pageParamsJson=JSON.parse(pageParams); |
| | | const userInfo = JSON.parse(window.localStorage.getItem('userInfo')); |
| | | const pageParams = userInfo.user.menus[0].pages[0].params; |
| | | const pageParamsJson = JSON.parse(pageParams); |
| | | const machineId = pageParamsJson.machineId;//当前页面的设备ID |
| | | console.log(machineId); |
| | | var errorScanId; |
| | | |
| | | // 新增:定时任务ID(用于清除定时器) |
| | | const timerId = ref(null); |
| | | /** |
| | | * 单次接口请求函数 |
| | | * 作用:调用后端接口,获取数据后交给 handleMessage 处理 |
| | | */ |
| | | const fetchMachineData = async () => { |
| | | try { |
| | | // 已领取的任务数据 |
| | | request.post("/deviceInteraction/primitiveTask/findMachineTask",{ |
| | | "id": machineId |
| | | }).then((res) => { // 替换为你的API端点 |
| | | if (res.code === 200) { |
| | | // 假设后端返回的数据格式与 handleMessage 预期一致 |
| | | const responseData = res.data || {}; |
| | | loadData.value = responseData; |
| | | } |
| | | }); |
| | | // 线下数据 |
| | | } catch (err) { |
| | | console.error('定时请求后端接口【已领取的任务数据】失败:', err); |
| | | } |
| | | try { |
| | | // 可领取的任务数据 |
| | | request.post("/deviceInteraction/primitiveTask/findKBBTJPDrawingBP").then((res) => { // 替换为你的API端点 |
| | | if (res.code === 200) { |
| | | // 假设后端返回的数据格式与 handleMessage 预期一致 |
| | | const responseData = res.data || {}; |
| | | findPrimitiveTask.value = responseData; |
| | | } |
| | | }); |
| | | } catch (err) { |
| | | console.error('定时请求后端接口【可领取的任务数据:客户表】失败:', err); |
| | | } |
| | | try { |
| | | // 设备数据 |
| | | request.post("/deviceInteraction/machine/findMachine", { |
| | | "id": machineId |
| | | }).then((res) => { // 替换为你的API端点 |
| | | if (res.code === 200) { |
| | | // 假设后端返回的数据格式与 handleMessage 预期一致 |
| | | const responseData = res.data || {}; |
| | | findMachine.value = responseData; |
| | | if (Object.keys(findMachine.value).length === 0) { |
| | | if (findMachine.value.mode == "1") { |
| | | modevalue.value = { |
| | | value: '1', |
| | | label: '标准', |
| | | }; |
| | | } else if (findMachine.value.mode == "2") { |
| | | modevalue.value = { |
| | | value: '2', |
| | | label: '定制', |
| | | }; |
| | | } else if (findMachine.value.mode == "3") { |
| | | modevalue.value = { |
| | | value: '3', |
| | | label: '手动', |
| | | }; |
| | | } |
| | | } |
| | | } |
| | | }); |
| | | } catch (err) { |
| | | console.error('定时请求后端接口失败【设备数据】:', err); |
| | | } |
| | | |
| | | }; |
| | | |
| | | /** |
| | | * 启动定时器 |
| | | * @param {number} interval - 定时间隔(毫秒,默认500ms,与后端任务频率对齐) |
| | | */ |
| | | const startTimer = (interval = 500) => { |
| | | // 先清除已有定时器(避免重复创建) |
| | | if (timerId.value) clearInterval(timerId.value); |
| | | // 立即执行一次(避免首次等待间隔) |
| | | fetchMachineData(); |
| | | // 创建新定时器 |
| | | timerId.value = setInterval(() => { |
| | | fetchMachineData(); |
| | | }, interval); |
| | | }; |
| | | |
| | | /** |
| | | * 清除定时器(避免内存泄漏) |
| | | */ |
| | | const clearTimer = () => { |
| | | if (timerId.value) { |
| | | clearInterval(timerId.value); |
| | | timerId.value = null; // 重置ID |
| | | } |
| | | }; |
| | | |
| | | // 组件卸载时清除定时器(关键:避免组件销毁后定时器仍运行) |
| | | onUnmounted(() => { |
| | | clearTimer(); |
| | | }); |
| | | |
| | | onMounted(async () => { |
| | | startTimer(500); // 500ms 间隔(可根据业务调整,如1000ms) |
| | | // //使用WebSocket方式展示数据 |
| | | // socket = initializeWebSocket(socketUrl, handleMessage);// 初始化 WebSocket,并传递消息处理函数 |
| | | // //使用WebSocket方式展示数据 |
| | | // socketDownLineTask = initializeWebSocket(socketDownLineTaskUrl, handleMessage2);// 初始化 WebSocket,并传递消息处理函数 |
| | | }); |
| | | |
| | | |
| | | //使用WebSocket方式展示数据 |
| | | let socket = null; |
| | | let socketDownLineTask = null; |
| | |
| | | // 定义消息处理函数,更新 receivedData 变量 |
| | | |
| | | |
| | | |
| | | const handleMessage = (data) => { |
| | | // 更新 tableData 的数据 |
| | | let dataJson = data[""+machineId][0]; |
| | | let dataJson = data["" + machineId][0]; |
| | | |
| | | loadData.value = dataJson.findPrimitiveTasking[0]; |
| | | findPrimitiveTask.value = dataJson.findPrimitiveTask[0]; |
| | | findMachine.value = dataJson.machine[0]; |
| | | if(findMachine.value.mode=="1"){ |
| | | if (findMachine.value.mode == "1") { |
| | | modevalue.value = { |
| | | value: '1', |
| | | label: '标准', |
| | | }; |
| | | }else if(findMachine.value.mode=="2"){ |
| | | value: '1', |
| | | label: '标准', |
| | | }; |
| | | } else if (findMachine.value.mode == "2") { |
| | | modevalue.value = { |
| | | value: '2', |
| | | label: '定制', |
| | | }; |
| | | }else if(findMachine.value.mode=="3"){ |
| | | } else if (findMachine.value.mode == "3") { |
| | | modevalue.value = { |
| | | value: '3', |
| | | label: '手动', |
| | |
| | | socket = initializeWebSocket(socketUrl, handleMessage);// 初始化 WebSocket,并传递消息处理函数 |
| | | //使用WebSocket方式展示数据 |
| | | socketDownLineTask = initializeWebSocket(socketDownLineTaskUrl, handleMessage2);// 初始化 WebSocket,并传递消息处理函数 |
| | | |
| | | |
| | | }); |
| | | //报警提示 |
| | | const errorInfoFuntion = async (info) => { |
| | | let infoScancode = '扫码ID:' + info.scanId + ' ' + info.scanCode; |
| | | ElMessageBox.confirm( |
| | | infoScancode, |
| | | t('delivery.prompt'), |
| | | { |
| | | confirmButtonText: t('functionState.sureStart'), |
| | | cancelButtonText: t('functionState.cancel'), |
| | | type: 'warning', |
| | | } |
| | | ) |
| | | .then(() => { |
| | | //重新补单 |
| | | request.post("/deviceInteraction/tasking/glassAgainTopLine", |
| | | { |
| | | "scanId": info.scanId, |
| | | }).then((res) => { // 替换为你的API端点 |
| | | if (res.code === 200) { |
| | | ElMessage.success(res.message); |
| | | } else { |
| | | ElMessage.warning(res.message) |
| | | } |
| | | }) |
| | | }) |
| | | .catch(() => { |
| | | ElMessage({ |
| | | type: 'info', |
| | | message: t('functionState.cancel'), |
| | | }) |
| | | }) |
| | | } |
| | | //修改工作状态 【失败/正在工作/完工】 |
| | | const workStatus = async (row, state) => { |
| | | let url; |
| | |
| | | return; |
| | | } |
| | | ElMessageBox.confirm( |
| | | t('functionState.tips'), |
| | | t('delivery.prompt'), |
| | | { |
| | | confirmButtonText: t('functionState.sure'), |
| | | cancelButtonText: t('functionState.cancel'), |
| | | type: 'warning', |
| | | } |
| | | t('functionState.tips'), |
| | | t('delivery.prompt'), |
| | | { |
| | | confirmButtonText: t('functionState.sure'), |
| | | cancelButtonText: t('functionState.cancel'), |
| | | type: 'warning', |
| | | } |
| | | ) |
| | | .then(() => { |
| | | //开始修改 |
| | | request.post(url, |
| | | { |
| | | "id": machineId |
| | | }).then((res) => { // 替换为你的API端点 |
| | | .then(() => { |
| | | //开始修改 |
| | | request.post(url, |
| | | { |
| | | "id": machineId |
| | | }).then((res) => { // 替换为你的API端点 |
| | | if (res.code === 200) { |
| | | ElMessage.success(res.message); |
| | | } else { |
| | | ElMessage.warning(res.message) |
| | | } |
| | | }) |
| | | }) |
| | | .catch(() => { |
| | | ElMessage({ |
| | | type: 'info', |
| | | message: t('functionState.cancel'), |
| | | }) |
| | | }) |
| | | .catch(() => { |
| | | ElMessage({ |
| | | type: 'info', |
| | | message: t('functionState.cancel'), |
| | | }) |
| | | }) |
| | | |
| | | } |
| | | |
| | | //定制/标准 |
| | | const machineMode = async (mode) => { |
| | | ElMessageBox.confirm( |
| | | t('functionState.tips'), |
| | | t('delivery.prompt'), |
| | | { |
| | | confirmButtonText: t('functionState.sure'), |
| | | cancelButtonText: t('functionState.cancel'), |
| | | type: 'warning', |
| | | } |
| | | t('functionState.tips'), |
| | | t('delivery.prompt'), |
| | | { |
| | | confirmButtonText: t('functionState.sure'), |
| | | cancelButtonText: t('functionState.cancel'), |
| | | type: 'warning', |
| | | } |
| | | ) |
| | | .then(() => { |
| | | //下线接口 |
| | | request.post("/deviceInteraction/machine/toggleModeMachine", |
| | | { |
| | | "id": machineId, |
| | | "mode": mode |
| | | }).then((res) => { // 替换为你的API端点 |
| | | .then(() => { |
| | | //下线接口 |
| | | request.post("/deviceInteraction/machine/toggleModeMachine", |
| | | { |
| | | "id": machineId, |
| | | "mode": mode |
| | | }).then((res) => { // 替换为你的API端点 |
| | | if (res.code === 200) { |
| | | ElMessage.success(res.message); |
| | | } else { |
| | | ElMessage.warning(res.message) |
| | | } |
| | | }) |
| | | }) |
| | | .catch(() => { |
| | | ElMessage({ |
| | | type: 'info', |
| | | message: t('functionState.cancel'), |
| | | }) |
| | | }) |
| | | .catch(() => { |
| | | ElMessage({ |
| | | type: 'info', |
| | | message: t('functionState.cancel'), |
| | | }) |
| | | }) |
| | | } |
| | | //开工/暂停 |
| | | const machineStatus = async (state) => { |
| | | ElMessageBox.confirm( |
| | | t('functionState.tips'), |
| | | t('delivery.prompt'), |
| | | { |
| | | confirmButtonText: t('functionState.sure'), |
| | | cancelButtonText: t('functionState.cancel'), |
| | | type: 'warning', |
| | | } |
| | | t('functionState.tips'), |
| | | t('delivery.prompt'), |
| | | { |
| | | confirmButtonText: t('functionState.sure'), |
| | | cancelButtonText: t('functionState.cancel'), |
| | | type: 'warning', |
| | | } |
| | | ) |
| | | .then(() => { |
| | | //下线接口 |
| | | request.post("/deviceInteraction/machine/updateMachineState", |
| | | { |
| | | "id": machineId, |
| | | "state": state |
| | | }).then((res) => { // 替换为你的API端点 |
| | | .then(() => { |
| | | //下线接口 |
| | | request.post("/deviceInteraction/machine/updateMachineState", |
| | | { |
| | | "id": machineId, |
| | | "state": state |
| | | }).then((res) => { // 替换为你的API端点 |
| | | if (res.code === 200) { |
| | | ElMessage.success(res.message); |
| | | } else { |
| | | ElMessage.warning(res.message) |
| | | } |
| | | }) |
| | | }) |
| | | .catch(() => { |
| | | ElMessage({ |
| | | type: 'info', |
| | | message: t('functionState.cancel'), |
| | | }) |
| | | }) |
| | | .catch(() => { |
| | | ElMessage({ |
| | | type: 'info', |
| | | message: t('functionState.cancel'), |
| | | }) |
| | | }) |
| | | } |
| | | //破损 |
| | | const damagedTask = async (row) => { |
| | | ElMessageBox.confirm( |
| | | t('functionState.tips'), |
| | | t('delivery.prompt'), |
| | | { |
| | | confirmButtonText: t('functionState.sure'), |
| | | cancelButtonText: t('functionState.cancel'), |
| | | type: 'warning', |
| | | } |
| | | t('functionState.tips'), |
| | | t('delivery.prompt'), |
| | | { |
| | | confirmButtonText: t('functionState.sure'), |
| | | cancelButtonText: t('functionState.cancel'), |
| | | type: 'warning', |
| | | } |
| | | ) |
| | | .then(() => { |
| | | //下线接口 |
| | | request.post("/deviceInteraction/tasking/damagedTask", |
| | | { |
| | | "glassId": row.glassId |
| | | }).then((res) => { // 替换为你的API端点 |
| | | .then(() => { |
| | | //下线接口 |
| | | request.post("/deviceInteraction/tasking/damagedTask", |
| | | { |
| | | "glassId": row.glassId |
| | | }).then((res) => { // 替换为你的API端点 |
| | | if (res.code === 200) { |
| | | ElMessage.success(res.message); |
| | | } else { |
| | | ElMessage.warning(res.message) |
| | | } |
| | | }) |
| | | }) |
| | | .catch(() => { |
| | | ElMessage({ |
| | | type: 'info', |
| | | message: t('functionState.cancel'), |
| | | }) |
| | | }) |
| | | .catch(() => { |
| | | ElMessage({ |
| | | type: 'info', |
| | | message: t('functionState.cancel'), |
| | | }) |
| | | }) |
| | | } |
| | | //下线(拿走) |
| | | const glassDownLine = async (row) => { |
| | | ElMessageBox.confirm( |
| | | t('functionState.tips'), |
| | | t('delivery.prompt'), |
| | | { |
| | | confirmButtonText: t('functionState.sure'), |
| | | cancelButtonText: t('functionState.cancel'), |
| | | type: 'warning', |
| | | } |
| | | t('functionState.tips'), |
| | | t('delivery.prompt'), |
| | | { |
| | | confirmButtonText: t('functionState.sure'), |
| | | cancelButtonText: t('functionState.cancel'), |
| | | type: 'warning', |
| | | } |
| | | ) |
| | | .then(() => { |
| | | //下线接口 |
| | | request.post("/deviceInteraction/tasking/glassDownLine", |
| | | { |
| | | "glassId": row.glassId, |
| | | }).then((res) => { // 替换为你的API端点 |
| | | .then(() => { |
| | | //下线接口 |
| | | request.post("/deviceInteraction/tasking/glassDownLine", |
| | | { |
| | | "glassId": row.glassId, |
| | | }).then((res) => { // 替换为你的API端点 |
| | | if (res.code === 200) { |
| | | ElMessage.success(res.message); |
| | | } else { |
| | | ElMessage.warning(res.message) |
| | | } |
| | | }) |
| | | }) |
| | | .catch(() => { |
| | | ElMessage({ |
| | | type: 'info', |
| | | message: t('functionState.cancel'), |
| | | }) |
| | | }) |
| | | .catch(() => { |
| | | ElMessage({ |
| | | type: 'info', |
| | | message: t('functionState.cancel'), |
| | | }) |
| | | }) |
| | | } |
| | | const topLineShow = async () => { |
| | | blind.value = true; |
| | |
| | | //领取任务/结束任务 |
| | | const startOrStopTask = async (row, line, isWorking) => { |
| | | ElMessageBox.confirm( |
| | | t('functionState.tips'), |
| | | t('delivery.prompt'), |
| | | { |
| | | confirmButtonText: t('functionState.sure'), |
| | | cancelButtonText: t('functionState.cancel'), |
| | | type: 'warning', |
| | | } |
| | | t('functionState.tips'), |
| | | t('delivery.prompt'), |
| | | { |
| | | confirmButtonText: t('functionState.sure'), |
| | | cancelButtonText: t('functionState.cancel'), |
| | | type: 'warning', |
| | | } |
| | | ) |
| | | .then(() => { |
| | | //领取任务 |
| | | request.post("/deviceInteraction/primitiveTask/startOrStopPrimitiveTasking", |
| | | { |
| | | "id": row.id, |
| | | "getLine": line, |
| | | "isWorking": isWorking |
| | | }).then((res) => { // 替换为你的API端点 |
| | | .then(() => { |
| | | //领取任务 |
| | | request.post("/deviceInteraction/primitiveTask/startOrStopPrimitiveTasking", |
| | | { |
| | | "id": row.id, |
| | | "getLine": line, |
| | | "isWorking": isWorking |
| | | }).then((res) => { // 替换为你的API端点 |
| | | if (res.code === 200) { |
| | | ElMessage.success(res.message); |
| | | } else { |
| | |
| | | ElMessage.warning(res.message) |
| | | } |
| | | }) |
| | | }) |
| | | .catch(() => { |
| | | ElMessage({ |
| | | type: 'info', |
| | | message: t('functionState.cancel'), |
| | | }) |
| | | }) |
| | | .catch(() => { |
| | | ElMessage({ |
| | | type: 'info', |
| | | message: t('functionState.cancel'), |
| | | }) |
| | | }) |
| | | } |
| | | const handleDialogClose = () => { |
| | | |
| | |
| | | } |
| | | |
| | | const filterTableData = computed(() => |
| | | loadData.value.filter( |
| | | (data) => |
| | | !searchs.value || data.scanId.toLowerCase().includes(searchs.value.toLowerCase()) |
| | | ) |
| | | loadData.value.filter( |
| | | (data) => |
| | | !searchs.value || data.scanId.toLowerCase().includes(searchs.value.toLowerCase()) |
| | | ) |
| | | ) |
| | | |
| | | //下拉框模式选择 |
| | |
| | | |
| | | const modeShow = async () => { |
| | | blindMode.value = true; |
| | | blindModeNumberLocal.value=findMachine.taskCount; |
| | | blindModeNumberLocal.value = findMachine.taskCount; |
| | | } |
| | | //模式选择时进行处理 |
| | | const modeChange = async () => { |
| | | let mode=modevalue.value; |
| | | let mode = modevalue.value; |
| | | request.post("/deviceInteraction/machine/toggleModeMachine", |
| | | { |
| | | "id": machineId, |
| | | "mode": mode |
| | | }).then((res) => { // 替换为你的API端点 |
| | | if (res.code === 200) { |
| | | ElMessage.success(res.message); |
| | | } else { |
| | | ElMessage.warning(res.message) |
| | | } |
| | | }) |
| | | if(modevalue.value=='3'){ |
| | | { |
| | | "id": machineId, |
| | | "mode": mode |
| | | }).then((res) => { // 替换为你的API端点 |
| | | if (res.code === 200) { |
| | | ElMessage.success(res.message); |
| | | } else { |
| | | ElMessage.warning(res.message) |
| | | } |
| | | }) |
| | | if (modevalue.value == '3') { |
| | | //当是手动模式时弹窗提示 设置上片数量 |
| | | blindMode.value = true; |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | //提交修改手动模式的吸片数量 |
| | | const fetchSubmit = async () => { |
| | | //扫码回车提交 |
| | | request.post("/deviceInteraction/machine/manualOperationTask", |
| | | { |
| | | "id": machineId, |
| | | "taskCount": blindModeNumberLocal.value, |
| | | "finshCount": 0 |
| | | }).then((res) => { // 替换为你的API端点 |
| | | if (res.code === 200) { |
| | | ElMessage.success(res.message); |
| | | } else { |
| | | ElMessage.warning(res.message) |
| | | } |
| | | }) |
| | | blindMode.value = false; |
| | | { |
| | | "id": machineId, |
| | | "taskCount": blindModeNumberLocal.value, |
| | | "finshCount": 0 |
| | | }).then((res) => { // 替换为你的API端点 |
| | | if (res.code === 200) { |
| | | ElMessage.success(res.message); |
| | | } else { |
| | | ElMessage.warning(res.message) |
| | | } |
| | | }) |
| | | blindMode.value = false; |
| | | } |
| | | </script> |
| | | <template> |
| | |
| | | <!-- 未领取的标准任务 --> |
| | | |
| | | <el-table :data="findPrimitiveTask" stripe style="height:660px" |
| | | :header-cell-style="{ background: '#F2F3F5 ', color: '#1D2129', textAlign: 'center' }" |
| | | :cell-style="{ textAlign: 'center' }"> |
| | | :header-cell-style="{ background: '#F2F3F5 ', color: '#1D2129', textAlign: 'center' }" |
| | | :cell-style="{ textAlign: 'center' }"> |
| | | <!-- <el-table-column type="selection" min-width="30" /> --> |
| | | |
| | | <el-table-column type="index" :label="$t('glassInfo.number')" min-width="30" /> |
| | | <el-table-column prop="batchNumber" :label="$t('glassInfo.batchNumber')" /> |
| | | <el-table-column prop="taskType" :label="$t('glassInfo.taskType')" /> |
| | | <el-table-column prop="scanId" :label="$t('glassInfo.scanId')" /> |
| | | <el-table-column prop="length" :label="$t('glassInfo.length')" /> |
| | | <el-table-column prop="width" :label="$t('glassInfo.width')" /> |
| | | <el-table-column prop="thickness" :label="$t('glassInfo.thickness')" /> |
| | | <el-table-column prop="taskQuantity" :label="$t('glassInfo.taskQuantity')" /> |
| | | <el-table-column prop="reportCount" :label="$t('glassInfo.reportCount')" /> |
| | | <el-table-column prop="workState" :label="$t('glassInfo.workState')" /> |
| | | <el-table-column type="index" :label="$t('glassInfo.number')" min-width="30"/> |
| | | <el-table-column prop="batchNumber" :label="$t('glassInfo.batchNumber')"/> |
| | | <el-table-column prop="taskType" :label="$t('glassInfo.taskType')"/> |
| | | <el-table-column prop="scanId" :label="$t('glassInfo.scanId')"/> |
| | | <el-table-column prop="length" :label="$t('glassInfo.length')"/> |
| | | <el-table-column prop="width" :label="$t('glassInfo.width')"/> |
| | | <el-table-column prop="thickness" :label="$t('glassInfo.thickness')"/> |
| | | <el-table-column prop="taskQuantity" :label="$t('glassInfo.taskQuantity')"/> |
| | | <el-table-column prop="reportCount" :label="$t('glassInfo.reportCount')"/> |
| | | <el-table-column prop="workState" :label="$t('glassInfo.workState')"/> |
| | | <el-table-column fixed="right" :label="$t('productStock.operate')" align="center" width="70"> |
| | | <template #default="scope"> |
| | | <el-button size="small" link type="primary" plain @click="startOrStopTask(scope.row, findMachine.id, 1)">{{ |
| | | $t('functionState.getTask') }}</el-button> |
| | | $t('functionState.getTask') |
| | | }} |
| | | </el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | |
| | | </div> |
| | | <div> |
| | | 手动输入上片数量: |
| | | <el-input v-model="blindModeNumberLocal" style="width: 200px;" type="Number" id="blindMode" @keyup.enter="fetchSubmit"></el-input> |
| | | |
| | | <el-input v-model="blindModeNumberLocal" style="width: 200px;" type="Number" id="blindMode" |
| | | @keyup.enter="fetchSubmit"></el-input> |
| | | |
| | | </div> |
| | | <!-- <div> |
| | | <el-button size="mini" link type="primary" plain @click="startOrStopTask(scope.row, 2, 2)">确认</el-button> |
| | | <el-button size="mini" link type="primary" plain @click="startOrStopTask(scope.row, 2, 2)">取消</el-button> |
| | | </div> --> |
| | | </el-dialog> |
| | | <hr /> |
| | | <hr/> |
| | | <br> |
| | | <div id="search"> |
| | | <!-- 功能 --> |
| | |
| | | <div class="flex flex-wrap gap-4 items-center"> |
| | | 上片机运行模式: |
| | | <el-select v-model="modevalue" @change="modeChange" placeholder="请选择模式" size="large" style="width: 220px"> |
| | | <el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value" /> |
| | | <el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value"/> |
| | | </el-select> |
| | | |
| | | |
| | | <span> |
| | | <span @click="modeShow" style="margin-left: 40px;">{{ findMachine.mode=="3"? ("上片数量:"+findMachine.taskCount):"" }}</span> |
| | | <span style="margin-left: 40px;">{{ findMachine.mode=="3"? ("已完成数量:"+findMachine.finshCount):"" }}</span> |
| | | <span @click="modeShow" style="margin-left: 40px;">{{ |
| | | findMachine.mode == "3" ? ("上片数量:" + findMachine.taskCount) : "" |
| | | }}</span> |
| | | <span style="margin-left: 40px;">{{ |
| | | findMachine.mode == "3" ? ("已完成数量:" + findMachine.finshCount) : "" |
| | | }}</span> |
| | | </span> |
| | | |
| | | |
| | | |
| | | |
| | | </div> |
| | | <br> |
| | | <el-button :type="(findMachine['state'] == '暂停' ? 'danger' : 'success')" id="ButtonMachineStatus" |
| | | @click="machineStatus((findMachine['state'] == '暂停' ? '开工' : '暂停'))">{{ findMachine['state'] == '开工' ? |
| | | $t('functionState.start') : $t('functionState.stop') }}</el-button> |
| | | @click="machineStatus((findMachine['state'] == '暂停' ? '开工' : '暂停'))">{{ |
| | | findMachine['state'] == '开工' ? |
| | | $t('functionState.start') : $t('functionState.stop') |
| | | }} |
| | | </el-button> |
| | | <el-button type="primary" id="ButtonTopLine" @click="topLineShow">{{ $t('functionState.getTask') }}</el-button> |
| | | </div> |
| | | |
| | | <div id="main-body" style="min-height:240px;"> |
| | | <!-- 表格内容 --> |
| | | <el-table :data="filterTableData" stripe style="height:260px" |
| | | :header-cell-style="{ background: '#F2F3F5 ', color: '#1D2129', textAlign: 'center' }" |
| | | :cell-style="{ textAlign: 'center' }"> |
| | | :header-cell-style="{ background: '#F2F3F5 ', color: '#1D2129', textAlign: 'center' }" |
| | | :cell-style="{ textAlign: 'center' }"> |
| | | |
| | | <!-- <el-table-column type="selection" min-width="30" /> --> |
| | | <el-table-column type="index" :label="$t('glassInfo.number')" min-width="30" /> |
| | | <el-table-column prop="batchNumber" sortable :label="$t('glassInfo.batchNumber')" /> |
| | | <el-table-column prop="taskType" sortable :label="$t('glassInfo.taskType')" /> |
| | | <el-table-column type="index" :label="$t('glassInfo.number')" min-width="30"/> |
| | | <el-table-column prop="batchNumber" sortable :label="$t('glassInfo.batchNumber')"/> |
| | | <el-table-column prop="taskType" sortable :label="$t('glassInfo.taskType')"/> |
| | | <el-table-column prop="scanId" :label="$t('glassInfo.scanId')"> |
| | | <template #header> |
| | | <div> |
| | |
| | | <el-input v-model="searchs" type="primary" id="ReportSubmission" @keyup.enter="fetchData"></el-input> |
| | | <template #reference> |
| | | <el-icon> |
| | | <Filter /> |
| | | <Filter/> |
| | | </el-icon> |
| | | </template> |
| | | </el-popover> |
| | | <el-icon> |
| | | <CaretTop /> |
| | | <CaretTop/> |
| | | </el-icon> |
| | | <el-icon> |
| | | <CaretBottom /> |
| | | <CaretBottom/> |
| | | </el-icon> |
| | | <!-- <el-input v-model="searchs" type="primary" id="ReportSubmission" @keyup.enter="fetchData"></el-input> --> |
| | | <!-- <el-input size="small" placeholder="Type to search" /> --> |
| | | </div> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="length" sortable :label="$t('glassInfo.length')" /> |
| | | <el-table-column prop="width" sortable :label="$t('glassInfo.width')" /> |
| | | <el-table-column prop="thickness" sortable :label="$t('glassInfo.thickness')" /> |
| | | <el-table-column prop="taskQuantity" sortable :label="$t('glassInfo.taskQuantity')" /> |
| | | <el-table-column prop="isWorking" sortable :label="$t('glassInfo.isWorking')" /> |
| | | <el-table-column prop="length" sortable :label="$t('glassInfo.length')"/> |
| | | <el-table-column prop="width" sortable :label="$t('glassInfo.width')"/> |
| | | <el-table-column prop="thickness" sortable :label="$t('glassInfo.thickness')"/> |
| | | <el-table-column prop="taskQuantity" sortable :label="$t('glassInfo.taskQuantity')"/> |
| | | <el-table-column prop="isWorking" sortable :label="$t('glassInfo.isWorking')"/> |
| | | <el-table-column fixed="right" :label="$t('productStock.operate')" align="center" width="270"> |
| | | <template #default="scope"> |
| | | <el-button size="mini" link type="primary" plain @click="startOrStopTask(scope.row, 2, 2)">{{ |
| | | $t('functionState.stopTask') }}</el-button> |
| | | $t('functionState.stopTask') |
| | | }} |
| | | </el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | |
| | | </div> --> |
| | | <div style="width: 30%;min-width: 300px; height: 460px;float: left;padding: 20px;;"> |
| | | <el-table :data="sendRecords" stripe |
| | | :header-cell-style="{ background: '#F2F3F5 ', color: '#1D2129', textAlign: 'center', height: '30px' }" |
| | | :cell-style="{ textAlign: 'center' }"> |
| | | <el-table-column prop="sendContent" :label="$t('glassInfo.sendContent')" /> |
| | | :header-cell-style="{ background: '#F2F3F5 ', color: '#1D2129', textAlign: 'center', height: '30px' }" |
| | | :cell-style="{ textAlign: 'center' }"> |
| | | <el-table-column prop="sendContent" :label="$t('glassInfo.sendContent')"/> |
| | | </el-table> |
| | | </div> |
| | | <div style="clear:both"></div> |
| | |
| | | //const machineId = 20;//当前页面的设备ID |
| | | var errorScanId; |
| | | var errorOpen=false; |
| | | //使用WebSocket方式展示数据 |
| | | let socket = null; |
| | | let socketDownLineTask = null; |
| | | const socketUrl = `ws://${WebSocketHost}:${host}/api/deviceInteraction/api/talk/rotate`; |
| | | const socketDownLineTaskUrl = `ws://${WebSocketHost}:${host}/api/deviceInteraction/api/talk/downLineTask`; |
| | | // 定义消息处理函数,更新 receivedData 变量 |
| | | const handleMessage = (data) => { |
| | | // 更新 tableData 的数据 |
| | | let dataJson = data[""+machineId][0]; |
| | | // 新增:定时任务ID(用于清除定时器) |
| | | |
| | | loadData.value = dataJson.taskingList[0]; |
| | | findMachine.value = dataJson.machine[0]; |
| | | sendRecords.value = dataJson.sendRecords[0].reverse(); |
| | | |
| | | if(findMachine.value.remark.toString()!=errorScanId&&findMachine.value.remark.toString()!=""&&findMachine.value.remark.toString()!=undefined){ |
| | | //有数据就弹窗 |
| | | if(errorOpen){ |
| | | ElMessageBox.close(); |
| | | } |
| | | errorScanId=findMachine.value.remark.toString(); |
| | | errorInfoFuntion(findMachine.value.remark.toString()); |
| | | errorOpen=true; |
| | | }else if(findMachine.value.remark.toString()==""&&errorOpen){ |
| | | ElMessageBox.close(); |
| | | errorOpen=false; |
| | | const timerId = ref(null); |
| | | /** |
| | | * 单次接口请求函数 |
| | | * 作用:调用后端接口,获取数据后交给 handleMessage 处理 |
| | | */ |
| | | const fetchMachineData = async () => { |
| | | try { |
| | | // 任务数据 |
| | | request.post("/deviceInteraction/tasking/findMachineTask",{ |
| | | "id": machineId |
| | | }).then((res) => { // 替换为你的API端点 |
| | | if (res.code === 200) { |
| | | // 假设后端返回的数据格式与 handleMessage 预期一致 |
| | | const responseData = res.data || {}; |
| | | loadData.value =responseData; |
| | | } |
| | | }); |
| | | |
| | | // 设备数据 |
| | | request.post("/deviceInteraction/machine/findMachine",{ |
| | | "id": machineId |
| | | }).then((res) => { // 替换为你的API端点 |
| | | if (res.code === 200) { |
| | | // 假设后端返回的数据格式与 handleMessage 预期一致 |
| | | const responseData = res.data || {}; |
| | | findMachine.value =responseData; |
| | | if (Object.keys(findMachine.value).length === 0){ |
| | | if(findMachine.value.remark.toString()!=errorScanId&&findMachine.value.remark.toString()!=""&&findMachine.value.remark.toString()!=undefined){ |
| | | //有数据就弹窗 |
| | | if(errorOpen){ |
| | | ElMessageBox.close(); |
| | | } |
| | | errorScanId=findMachine.value.remark.toString(); |
| | | errorInfoFuntion(findMachine.value.remark.toString()); |
| | | errorOpen=true; |
| | | }else if(findMachine.value.remark.toString()==""&&errorOpen){ |
| | | ElMessageBox.close(); |
| | | errorOpen=false; |
| | | } |
| | | } |
| | | } |
| | | }); |
| | | |
| | | // 线下数据 |
| | | } catch (err) { |
| | | console.error('定时请求后端接口失败:', err); |
| | | } |
| | | |
| | | }; |
| | | // 定义消息处理函数,更新 receivedData 变量 |
| | | const handleMessage2 = (data) => { |
| | | downLineTask.value = data.downLineTask[0]; |
| | | // console.log(data); |
| | | |
| | | /** |
| | | * 启动定时器 |
| | | * @param {number} interval - 定时间隔(毫秒,默认500ms,与后端任务频率对齐) |
| | | */ |
| | | const startTimer = (interval = 500) => { |
| | | // 先清除已有定时器(避免重复创建) |
| | | if (timerId.value) clearInterval(timerId.value); |
| | | // 立即执行一次(避免首次等待间隔) |
| | | fetchMachineData(); |
| | | // 创建新定时器 |
| | | timerId.value = setInterval(() => { |
| | | fetchMachineData(); |
| | | }, interval); |
| | | }; |
| | | |
| | | /** |
| | | * 清除定时器(避免内存泄漏) |
| | | */ |
| | | const clearTimer = () => { |
| | | if (timerId.value) { |
| | | clearInterval(timerId.value); |
| | | timerId.value = null; // 重置ID |
| | | } |
| | | }; |
| | | |
| | | // 组件卸载时清除定时器(关键:避免组件销毁后定时器仍运行) |
| | | onUnmounted(() => { |
| | | if (socket) { |
| | | closeWebSocket(socket); |
| | | } |
| | | if (socketDownLineTask) { |
| | | closeWebSocket(socketDownLineTask); |
| | | } |
| | | }); |
| | | onBeforeUnmount(() => { |
| | | console.log("关闭了") |
| | | closeWebSocket(); |
| | | clearTimer(); |
| | | }); |
| | | |
| | | onMounted(async () => { |
| | | //使用WebSocket方式展示数据 |
| | | socket = initializeWebSocket(socketUrl, handleMessage);// 初始化 WebSocket,并传递消息处理函数 |
| | | //使用WebSocket方式展示数据 |
| | | socketDownLineTask = initializeWebSocket(socketDownLineTaskUrl, handleMessage2);// 初始化 WebSocket,并传递消息处理函数 |
| | | startTimer(500); // 500ms 间隔(可根据业务调整,如1000ms) |
| | | // //使用WebSocket方式展示数据 |
| | | // socket = initializeWebSocket(socketUrl, handleMessage);// 初始化 WebSocket,并传递消息处理函数 |
| | | // //使用WebSocket方式展示数据 |
| | | // socketDownLineTask = initializeWebSocket(socketDownLineTaskUrl, handleMessage2);// 初始化 WebSocket,并传递消息处理函数 |
| | | }); |
| | | //报警提示 |
| | | const errorInfoFuntion = async (info) => { |
| | |
| | | const machineId = pageParamsJson.machineId;//当前页面的设备ID |
| | | console.log(machineId); |
| | | //const machineId=14;//当前页面的设备ID |
| | | //使用WebSocket方式展示数据 |
| | | let socket = null; |
| | | const socketUrl = `ws://${WebSocketHost}:${host}/api/deviceInteraction/api/talk/silkScreenTask`; |
| | | // 定义消息处理函数,更新 receivedData 变量 |
| | | const handleMessage = (data) => { |
| | | // 更新 tableData 的数据 |
| | | let dataJson = data[""+machineId][0]; |
| | | loadData.value = dataJson.taskingList[0]; |
| | | findMachine.value = dataJson.machine[0]; |
| | | sendRecords.value = dataJson.sendRecords[0]; |
| | | }; |
| | | onUnmounted(() => { |
| | | if (socket) { |
| | | closeWebSocket(socket); |
| | | // 新增:定时任务ID(用于清除定时器) |
| | | const timerId = ref(null); |
| | | /** |
| | | * 单次接口请求函数 |
| | | * 作用:调用后端接口,获取数据后交给 handleMessage 处理 |
| | | */ |
| | | const fetchMachineData = async () => { |
| | | try { |
| | | // 任务数据 |
| | | request.post("/deviceInteraction/tasking/findMachineTask",{ |
| | | "id": machineId |
| | | }).then((res) => { // 替换为你的API端点 |
| | | if (res.code === 200) { |
| | | // 假设后端返回的数据格式与 handleMessage 预期一致 |
| | | const responseData = res.data || {}; |
| | | loadData.value =responseData; |
| | | } |
| | | }); |
| | | |
| | | // 设备数据 |
| | | request.post("/deviceInteraction/machine/findMachine",{ |
| | | "id": machineId |
| | | }).then((res) => { // 替换为你的API端点 |
| | | if (res.code === 200) { |
| | | // 假设后端返回的数据格式与 handleMessage 预期一致 |
| | | const responseData = res.data || {}; |
| | | findMachine.value =responseData; |
| | | if (Object.keys(findMachine.value).length === 0){ |
| | | if(findMachine.value.remark.toString()!=errorScanId&&findMachine.value.remark.toString()!=""&&findMachine.value.remark.toString()!=undefined){ |
| | | //有数据就弹窗 |
| | | if(errorOpen){ |
| | | ElMessageBox.close(); |
| | | } |
| | | errorScanId=findMachine.value.remark.toString(); |
| | | errorInfoFuntion(findMachine.value.remark.toString()); |
| | | errorOpen=true; |
| | | }else if(findMachine.value.remark.toString()==""&&errorOpen){ |
| | | ElMessageBox.close(); |
| | | errorOpen=false; |
| | | } |
| | | } |
| | | } |
| | | }); |
| | | |
| | | // 线下数据 |
| | | } catch (err) { |
| | | console.error('定时请求后端接口失败:', err); |
| | | } |
| | | }); |
| | | onBeforeUnmount(() => { |
| | | console.log("关闭了") |
| | | closeWebSocket(); |
| | | }; |
| | | |
| | | /** |
| | | * 启动定时器 |
| | | * @param {number} interval - 定时间隔(毫秒,默认500ms,与后端任务频率对齐) |
| | | */ |
| | | const startTimer = (interval = 500) => { |
| | | // 先清除已有定时器(避免重复创建) |
| | | if (timerId.value) clearInterval(timerId.value); |
| | | // 立即执行一次(避免首次等待间隔) |
| | | fetchMachineData(); |
| | | // 创建新定时器 |
| | | timerId.value = setInterval(() => { |
| | | fetchMachineData(); |
| | | }, interval); |
| | | }; |
| | | |
| | | /** |
| | | * 清除定时器(避免内存泄漏) |
| | | */ |
| | | const clearTimer = () => { |
| | | if (timerId.value) { |
| | | clearInterval(timerId.value); |
| | | timerId.value = null; // 重置ID |
| | | } |
| | | }; |
| | | |
| | | // 组件卸载时清除定时器(关键:避免组件销毁后定时器仍运行) |
| | | onUnmounted(() => { |
| | | clearTimer(); |
| | | }); |
| | | |
| | | onMounted(async () => { |
| | | //使用WebSocket方式展示数据 |
| | | socket = initializeWebSocket(socketUrl, handleMessage);// 初始化 WebSocket,并传递消息处理函数 |
| | | startTimer(500); // 500ms 间隔(可根据业务调整,如1000ms) |
| | | // //使用WebSocket方式展示数据 |
| | | // socket = initializeWebSocket(socketUrl, handleMessage);// 初始化 WebSocket,并传递消息处理函数 |
| | | // //使用WebSocket方式展示数据 |
| | | // socketDownLineTask = initializeWebSocket(socketDownLineTaskUrl, handleMessage2);// 初始化 WebSocket,并传递消息处理函数 |
| | | }); |
| | | //修改工作状态 【失败/正在工作/完工】 |
| | | const workStatus = async(row,state) => { |