fix - 简单修改篮球入场订单逻辑

This commit is contained in:
2026-03-29 10:19:12 +08:00
parent 9f3a1c02c3
commit 14a9944c72
10 changed files with 198 additions and 166 deletions

View File

@@ -38,9 +38,9 @@ public class ListenKeyFrame {
frame.add(label);
frame.add(buttonIn);
frame.add(buttonOut);
frame.add(jTextField); // 注释
frame.add(buttonSubmit); // 注释
frame.add(buttonPlay);
// frame.add(jTextField); // 注释
// frame.add(buttonSubmit); // 注释
// frame.add(buttonPlay); // 播放音乐的可注释
frame.setFocusableWindowState(true);
frame.setAlwaysOnTop(true);
// frame.setExtendedState(JFrame.MAXIMIZED_BOTH); //最大化

View File

@@ -10,39 +10,28 @@ import Net.PC15.FC8800.FC8800Identity;
import com.sv.intergration.DoorService;
import com.sv.netty.config.NettyConstant;
import java.io.IOException;
import java.net.InetSocketAddress;
import java.net.Socket;
public class OldDoorService implements DoorService {
@Override
public void enterOpenDoor() {
try {
ConnectorAllocator connector = ConnectorAllocator.GetAllocator();
TCPClientDetial tcpClientDetial = new TCPClientDetial("192.168.1.150", Integer.valueOf("8000"));
connector.GetCommandCount(tcpClientDetial);
connector.OpenForciblyConnect(tcpClientDetial);
CommandDetial detial = new CommandDetial();
detial.Connector = tcpClientDetial;
String clientSn = System.getProperty(NettyConstant.VENUE_CLIENT_SN);
System.out.println(clientSn);
// detial.Identity = new FC8800Identity("MC-5824T23014127", "12345678", E_ControllerType.FC8900);
detial.Identity = new FC8800Identity(clientSn, "12345678", E_ControllerType.FC8900);
OpenDoor_Parameter openDoorParameter = new OpenDoor_Parameter(detial);
openDoorParameter.Door.SetDoor(1, 1);
OpenDoor openDoor = new OpenDoor(openDoorParameter);
boolean command = connector.AddCommand(openDoor);
if (!command) {
logger.error("enter door open command exec fail");
}
if (openDoor.getIsTimeout()) {
logger.info("----in open door timeout ----");
}
} catch (Exception e) {
logger.error("----in open door error ----", e);
}
opendoor(1);
}
@Override
public void outOpenDoor() {
opendoor(2);
}
private void opendoor(int doorSn) {
try {
// 1. 先检查网络连通性Java 层)
if (!isNetworkReachable("192.168.1.150", 8000, 2000)) {
throw new RuntimeException("net socket error: 192.168.1.150:8000");
}
ConnectorAllocator connector = ConnectorAllocator.GetAllocator();
TCPClientDetial tcpClientDetial = new TCPClientDetial("192.168.1.150", Integer.valueOf("8000"));
connector.GetCommandCount(tcpClientDetial);
@@ -53,24 +42,43 @@ public class OldDoorService implements DoorService {
// detial.Identity = new FC8800Identity("MC-5824T23014127", "12345678", E_ControllerType.FC8900);
detial.Identity = new FC8800Identity(clientSn, "12345678", E_ControllerType.FC8900);
OpenDoor_Parameter openDoorParameter = new OpenDoor_Parameter(detial);
openDoorParameter.Door.SetDoor(2, 1);
openDoorParameter.Door.SetDoor(doorSn, 1);
for (int i = 0; i < 3; i++) {
logger.info("{} times to try...", i + 1);
boolean connected = connector.IsForciblyConnect(tcpClientDetial);
if (connected) {
logger.info("[{}] connected");
break;
}
logger.warn("[{}] times to try, trying", i + 1);
Thread.sleep(1000); // 等待 1 秒后重试
}
OpenDoor openDoor = new OpenDoor(openDoorParameter);
boolean command = connector.AddCommand(openDoor);
if (!command) {
logger.error("out door open command exec fail");
logger.error("sn-{} door open command exec fail",doorSn);
}
if (openDoor.getIsTimeout()) {
logger.info("----out open door timeout ----");
logger.info("----sn-{} open door timeout ----",doorSn);
}
} catch (Exception e) {
logger.error("----out open door error ----", e);
logger.error("----sn-{} open door error ----",doorSn, e);
}
}
// 网络连通性检查Java 层)
private boolean isNetworkReachable(String host, int port, int timeoutMs) {
try (Socket socket = new Socket()) {
socket.connect(new InetSocketAddress(host, port), timeoutMs);
return true;
} catch (IOException e) {
logger.error("net link error: {}:{} - {}", host, port, e.getMessage());
return false;
}
}
// 测试
// public static void main(String[] args) {
// OldDoorService oldDoorService = new OldDoorService();
// oldDoorService.enterOpenDoor();
// oldDoorService.outOpenDoor();
// }
}