|
@ -8,6 +8,7 @@ import com.alibaba.fastjson.JSON; |
|
|
import com.alibaba.fastjson.JSONArray; |
|
|
import com.alibaba.fastjson.JSONArray; |
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
import lombok.RequiredArgsConstructor; |
|
|
import lombok.RequiredArgsConstructor; |
|
|
|
|
|
import lombok.SneakyThrows; |
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
import org.nl.modules.common.exception.BadRequestException; |
|
|
import org.nl.modules.common.exception.BadRequestException; |
|
|
import org.nl.modules.system.util.CodeUtil; |
|
|
import org.nl.modules.system.util.CodeUtil; |
|
@ -36,12 +37,16 @@ import org.nl.wms.sch.task.send.material.YZSendMaterialTask; |
|
|
import org.nl.wms.sch.task.to.pack.BTHCToPackageTask; |
|
|
import org.nl.wms.sch.task.to.pack.BTHCToPackageTask; |
|
|
import org.nl.wms.sch.task.to.pack.FJToPackageTask; |
|
|
import org.nl.wms.sch.task.to.pack.FJToPackageTask; |
|
|
import org.nl.wms.sch.task.util.TaskUtils; |
|
|
import org.nl.wms.sch.task.util.TaskUtils; |
|
|
|
|
|
import org.redisson.api.RLock; |
|
|
|
|
|
import org.redisson.api.RedissonClient; |
|
|
|
|
|
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.Transactional; |
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
|
|
|
|
import java.lang.reflect.Method; |
|
|
import java.lang.reflect.Method; |
|
|
import java.util.Map; |
|
|
import java.util.Map; |
|
|
|
|
|
import java.util.concurrent.TimeUnit; |
|
|
|
|
|
|
|
|
@Service |
|
|
@Service |
|
|
@RequiredArgsConstructor |
|
|
@RequiredArgsConstructor |
|
@ -78,6 +83,11 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { |
|
|
|
|
|
|
|
|
private final SZCallMaterialTask szCallMaterialTask; |
|
|
private final SZCallMaterialTask szCallMaterialTask; |
|
|
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
|
private RedissonClient redissonClient; |
|
|
|
|
|
@Autowired |
|
|
|
|
|
private AcsToWmsService acsToWmsService; |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* task_id:任务标识 |
|
|
* task_id:任务标识 |
|
|
* task_code:任务编码 |
|
|
* task_code:任务编码 |
|
@ -199,9 +209,29 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
@SneakyThrows |
|
|
|
|
|
public JSONObject apply(JSONObject jsonObject) { |
|
|
|
|
|
String type = (String) jsonObject.get("type"); |
|
|
|
|
|
RLock lock = redissonClient.getLock("acs_to_wms:" + type); |
|
|
|
|
|
boolean tryLock = lock.tryLock(5, TimeUnit.SECONDS); |
|
|
|
|
|
try { |
|
|
|
|
|
if (tryLock) { |
|
|
|
|
|
return acsToWmsService.transApply(jsonObject); |
|
|
|
|
|
} |
|
|
|
|
|
} finally { |
|
|
|
|
|
if (tryLock) { |
|
|
|
|
|
lock.unlock(); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return null; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
public JSONObject apply(JSONObject param) { |
|
|
public JSONObject transApply(JSONObject param) { |
|
|
String point_code = param.getString("device_code"); |
|
|
String point_code = param.getString("device_code"); |
|
|
String type = param.getString("type"); |
|
|
String type = param.getString("type"); |
|
|
if (StrUtil.isBlank(type)) { |
|
|
if (StrUtil.isBlank(type)) { |
|
@ -232,6 +262,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { |
|
|
method_param.put("request_param", request_param); |
|
|
method_param.put("request_param", request_param); |
|
|
method_param.put("create_id", ACSSystem.id); |
|
|
method_param.put("create_id", ACSSystem.id); |
|
|
method_param.put("create_name", ACSSystem.nick_name); |
|
|
method_param.put("create_name", ACSSystem.nick_name); |
|
|
|
|
|
|
|
|
switch (type) { |
|
|
switch (type) { |
|
|
case "1": |
|
|
case "1": |
|
|
// 送料
|
|
|
// 送料
|
|
@ -801,8 +832,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { |
|
|
|
|
|
|
|
|
JSONObject data = null; |
|
|
JSONObject data = null; |
|
|
if (!"0000".equals(vehicle_code)) { |
|
|
if (!"0000".equals(vehicle_code)) { |
|
|
data = WQLObject |
|
|
data = WQLObject.getWQLObject("st_ivt_vehicle_detail") |
|
|
.getWQLObject("st_ivt_vehicle_detail") |
|
|
|
|
|
.query("is_delete = '0' AND vehicle_type = '" + vehicle_type + "' AND vehicle_code = '" + vehicle_code + "'") |
|
|
.query("is_delete = '0' AND vehicle_type = '" + vehicle_type + "' AND vehicle_code = '" + vehicle_code + "'") |
|
|
.uniqueResult(0); |
|
|
.uniqueResult(0); |
|
|
} |
|
|
} |
|
@ -840,10 +870,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { |
|
|
} else { |
|
|
} else { |
|
|
update.put("vehicle_type", String.valueOf(Integer.parseInt(vehicle_type) + 2)); |
|
|
update.put("vehicle_type", String.valueOf(Integer.parseInt(vehicle_type) + 2)); |
|
|
} |
|
|
} |
|
|
WQLObject |
|
|
WQLObject.getWQLObject("sch_base_point").update(update, "point_code = '" + point_code + "'"); |
|
|
.getWQLObject("sch_base_point") |
|
|
|
|
|
.update(update, "point_code = '" + point_code + "'"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
JSONObject result = new JSONObject(); |
|
|
JSONObject result = new JSONObject(); |
|
|
result.put("status", HttpStatus.OK.value()); |
|
|
result.put("status", HttpStatus.OK.value()); |
|
@ -890,8 +917,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { |
|
|
String vehicle_code = point.getString("vehicle_code"); |
|
|
String vehicle_code = point.getString("vehicle_code"); |
|
|
JSONObject data = null; |
|
|
JSONObject data = null; |
|
|
if (StrUtil.isNotBlank(vehicle_code) && !"0000".equals(vehicle_code)) { |
|
|
if (StrUtil.isNotBlank(vehicle_code) && !"0000".equals(vehicle_code)) { |
|
|
data = WQL |
|
|
data = WQL.getWO("ACS_TO_WMS") |
|
|
.getWO("ACS_TO_WMS") |
|
|
|
|
|
.addParam("flag", "1") |
|
|
.addParam("flag", "1") |
|
|
.addParam("vehicle_type", vehicle_type) |
|
|
.addParam("vehicle_type", vehicle_type) |
|
|
.addParam("vehicle_code", vehicle_code) |
|
|
.addParam("vehicle_code", vehicle_code) |
|
@ -914,8 +940,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
boolean to_package = false; |
|
|
boolean to_package = false; |
|
|
JSONObject workorder = WQL |
|
|
JSONObject workorder = WQL.getWO("ACS_TO_WMS") |
|
|
.getWO("ACS_TO_WMS") |
|
|
|
|
|
.addParam("flag", "2") |
|
|
.addParam("flag", "2") |
|
|
.addParam("vehicle_code", vehicle_code) |
|
|
.addParam("vehicle_code", vehicle_code) |
|
|
.process() |
|
|
.process() |
|
|