优化
This commit is contained in:
@@ -46,6 +46,8 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
@Autowired
|
||||
private WmsToAcsService wmsToAcsService;
|
||||
private final FlourworkService flourworkService;
|
||||
//私有锁
|
||||
private Object object = new Object();
|
||||
|
||||
/**
|
||||
* * ACS客户端--->WMS服务端
|
||||
@@ -56,42 +58,9 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
*/
|
||||
@Override
|
||||
public Map<String, Object> transferApply(Map<String, String> jsObject) {
|
||||
WQLObject sys_param = WQLObject.getWQLObject("sys_param");
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
int time = 0;
|
||||
//休眠半秒
|
||||
try {
|
||||
int flag = 1;
|
||||
while(flag == 1){
|
||||
JSONObject param = sys_param.query("is_active='1' and is_delete='0' and code='TRANSFER'").uniqueResult(0);
|
||||
if (ObjectUtil.isNotEmpty(param)) {
|
||||
flag = param.getInteger("value");
|
||||
if(flag == 0){
|
||||
break;
|
||||
}else{
|
||||
flag = 1;
|
||||
}
|
||||
}else{
|
||||
flag = 1;
|
||||
}
|
||||
Thread.sleep(2000);
|
||||
time++;
|
||||
if(time == 10){
|
||||
throw new BadRequestException("输送线请求等待超时!");
|
||||
}
|
||||
}
|
||||
JSONObject param = sys_param.query("is_active='1' and is_delete='0' and code='TRANSFER'").uniqueResult(0);
|
||||
param.put("value","1");
|
||||
sys_param.update(param);
|
||||
synchronized (object) {
|
||||
map = transferApply2(jsObject);
|
||||
param.put("value","0");
|
||||
sys_param.update(param);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}finally {
|
||||
JSONObject param = sys_param.query("is_active='1' and is_delete='0' and code='TRANSFER'").uniqueResult(0);
|
||||
param.put("value","0");
|
||||
sys_param.update(param);
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user