优化输送线同步锁
This commit is contained in:
@@ -13,8 +13,6 @@ import org.nl.exception.BadRequestException;
|
|||||||
import org.nl.ext.acs.service.AcsToWmsService;
|
import org.nl.ext.acs.service.AcsToWmsService;
|
||||||
import org.nl.ext.acs.service.WmsToAcsService;
|
import org.nl.ext.acs.service.WmsToAcsService;
|
||||||
import org.nl.modules.security.service.dto.JwtUserDto;
|
import org.nl.modules.security.service.dto.JwtUserDto;
|
||||||
import org.nl.modules.system.service.GenCodeService;
|
|
||||||
import org.nl.modules.system.service.impl.GenCodeServiceImpl;
|
|
||||||
import org.nl.pda.exception.PdaRequestException;
|
import org.nl.pda.exception.PdaRequestException;
|
||||||
import org.nl.utils.SecurityUtils;
|
import org.nl.utils.SecurityUtils;
|
||||||
import org.nl.wms.pf.service.FlourworkService;
|
import org.nl.wms.pf.service.FlourworkService;
|
||||||
@@ -32,8 +30,8 @@ import org.nl.wql.core.bean.WQLObject;
|
|||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Isolation;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import java.lang.reflect.InvocationTargetException;
|
import java.lang.reflect.InvocationTargetException;
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@@ -57,13 +55,49 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
|
||||||
public Map<String, Object> transferApply(Map<String, String> jsObject) {
|
public Map<String, Object> transferApply(Map<String, String> jsObject) {
|
||||||
Map<String, Object> map = transferApply2(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);
|
||||||
|
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;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static synchronized Map<String, Object> transferApply2(Map<String, String> jsObject){
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public Map<String, Object> transferApply2(Map<String, String> jsObject){
|
||||||
//任务表
|
//任务表
|
||||||
WQLObject wo_Task = WQLObject.getWQLObject("SCH_BASE_Task");
|
WQLObject wo_Task = WQLObject.getWQLObject("SCH_BASE_Task");
|
||||||
WQLObject wo_EmptyVehicleRecord = WQLObject.getWQLObject("ST_IVT_EmptyVehicleRecord");
|
WQLObject wo_EmptyVehicleRecord = WQLObject.getWQLObject("ST_IVT_EmptyVehicleRecord");
|
||||||
|
|||||||
@@ -120,6 +120,7 @@ public class InbillServiceImpl {
|
|||||||
WQLObject.getWQLObject("ST_IVT_IOStorInv").update(mst);
|
WQLObject.getWQLObject("ST_IVT_IOStorInv").update(mst);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void operatePoint(String operate, JSONObject form) {
|
public void operatePoint(String operate, JSONObject form) {
|
||||||
WQLObject point_table = WQLObject.getWQLObject("SCH_BASE_Point");
|
WQLObject point_table = WQLObject.getWQLObject("SCH_BASE_Point");
|
||||||
WQLObject struct_table = WQLObject.getWQLObject("ST_IVT_StructAttr");
|
WQLObject struct_table = WQLObject.getWQLObject("ST_IVT_StructAttr");
|
||||||
|
|||||||
Reference in New Issue
Block a user