wu
2024-11-26 fddf1c716af76c2968e08ce11895eaa1c26319a5
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
package com.example.springboot.component;
 
import com.example.springboot.mapper.SpianMapper;
import com.example.springboot.service.SpianService;
 
public class Plclog extends Thread {
 
    boolean b01 = false;
    boolean b02 = false;
    private SpianService spianService;
    private SpianMapper spianMapper;
 
    @Override
    public void run() {
        while (this != null) {
            try {
                Thread.sleep(10);
            } catch (InterruptedException e) {
                // \\ TODO Auto-generated catch block
                e.printStackTrace();
            }
            spianMapper = WebSocketServer.applicationContext.getBean(SpianMapper.class);
            spianService = WebSocketServer.applicationContext.getBean(SpianService.class);
            StringBuilder B01glassid = spianService.queGlassid("DB103.184", 14);// BO1的玻璃id
            StringBuilder B02glassid = spianService.queGlassid("DB103.212", 14);// B02的玻璃id
            boolean B01backs = spianService.listbool("DB106.60");// b01汇报
            boolean B02backs = spianService.listbool("DB106.62");// b01汇报
            if (b01 != B01backs) {
                if (B01backs == true) {
                    spianMapper.insertlog("BO1:1"+B01glassid);
                } else {
                    spianMapper.insertlog("BO1:0"+B01glassid);
                }
                 b01 = B01backs;
            }
           
             if (b02 != B02backs) {
                if (B02backs == true) {
                    spianMapper.insertlog("BO2:1"+B02glassid);
                } else {
                    spianMapper.insertlog("BO2:0"+B02glassid);
                }
                b02 = B02backs;
            }
            
        }
    }
}