wangh 4 years ago
parent a6a0da58f8
commit dbb1e1052a

@ -32,9 +32,9 @@ public class ServiceImpl implements IService {
public static String rfid;
private static boolean m_GetInCenterStartSuccessful;
private static boolean m_GetInCenterStopSuccessful;
private static boolean m_GetOutCenterStartSuccessful;
private static boolean m_GetOutCenterStopSuccessful;
private static boolean StartFlag = false;
// private static boolean m_GetOutCenterStartSuccessful;
// private static boolean m_GetOutCenterStopSuccessful;
// private static boolean StartFlag = false;
private static final Semaphore m_RecData = new Semaphore(1);
private static final Semaphore m_RecstopData = new Semaphore(1);
@ -51,11 +51,11 @@ public class ServiceImpl implements IService {
case "103":
case "105":
m_GetInCenterStartSuccessful = true;
rfid = "";
break;
case "102":
case "104":
case "106":
m_RecstopData.release();
m_GetInCenterStopSuccessful = true;
break;
default:
@ -83,13 +83,13 @@ public class ServiceImpl implements IService {
containerRegisterQuery1.setPdaip(pdaip);
containerRegisterQuery1.setCommandCode(functionID);
String json = JSONObject.toJSONString(containerRegisterQuery1);
if(StartFlag){
return R.data(100, "向客户端发送消息失败,请先发送结束入库读指令在进行其他操作!");
}
// if(StartFlag){
// return R.data(100, "向客户端发送消息失败,请先发送结束入库读指令在进行其他操作!");
// }
if (WebSocketServerContent.getSocket(pdaip, json)) {
StartFlag = true;
// StartFlag = true;
try {
Thread.sleep(500);
Thread.sleep(1000);
if (m_GetInCenterStartSuccessful) {
m_GetInCenterStartSuccessful = false;
System.out.println("\n开始读返回成功" + "\t开始请求时间" + sdf.format(new Date()));
@ -123,16 +123,16 @@ public class ServiceImpl implements IService {
String json = JSONObject.toJSONString(containerRegisterQuery2);
if (WebSocketServerContent.getSocket(pdaip, json)) {
try {
m_RecstopData.acquire();
//Thread.sleep(1000);
if (m_GetInCenterStopSuccessful) {
m_GetInCenterStopSuccessful = false;
System.out.println("\n结束读返回成功,返回数据=" + rfid);
if (functionID==106){
return R.data(200, "向客户端发送消息成功!", "[\"1972102100000002\"]");
Thread.sleep(500);
return R.data(200, "向客户端发送消息成功!", rfid);
}else {
StartFlag = false;
// StartFlag = false;
return R.data(200, "向客户端发送消息成功!");
}

Loading…
Cancel
Save