wangh 4 years ago
parent a6a0da58f8
commit dbb1e1052a

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

Loading…
Cancel
Save