huang
2025-05-22 16b32f4511aa90b95b13a15751850cf6db0829e2
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
package com.mes;
 
import com.mes.md.service.impl.RotatingRackServiceImpl;
import lombok.extern.slf4j.Slf4j;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
 
/**
 * @Author : yanzhixin
 * @Date: 2024/3/27 16:37
 * @Description:
 */
@Slf4j
@RunWith(SpringRunner.class)
@SpringBootTest(classes = DeviceInteractionModuleApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
public class DeviceInteractionModuleApplicationTest {
 
    private RotatingRackServiceImpl rotatingRackService;
 
    @Test
public void test() {
    // 测试代码
    byte[] plcValueArray=new byte[]{1};//0000 0001
    String binaryString1 = String.format("%8s",Integer.toBinaryString(plcValueArray[0] & 0xFF))
            .replace(' ', '0');
    //String bitAddress =Integer.toBinaryString(p & 0xFF);
    log.info("测试代码:{}",binaryString1);
    String values=binaryString1.substring(7-0,8-0);
    log.info("测试代码:{}",values);
}
 
@Test
public void test1() {
    rotatingRackService.retryFailedErpSending();
    }
 
}