rev:分切载具号校验,空载具查询修改,任务回调方法添加事务
This commit is contained in:
@@ -113,22 +113,12 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
} else {
|
||||
message = e.getTargetException().getMessage();
|
||||
}
|
||||
log.info("任务状态更新失败:{}", message);
|
||||
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("task_id", task_id);
|
||||
json.put("message", message);
|
||||
errArr.add(json);
|
||||
throw new BadRequestException(message);
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
message = e.getMessage();
|
||||
log.info("任务状态更新失败:{}", message);
|
||||
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("task_id", task_id);
|
||||
json.put("message", message);
|
||||
errArr.add(json);
|
||||
throw new BadRequestException(message);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -438,11 +428,11 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("flag", "1");
|
||||
param.put("sale_order_name",sale_order_name);
|
||||
param.put("product_name",product_name);
|
||||
param.put("box_length",box_length_1);
|
||||
param.put("box_width",box_width_1);
|
||||
param.put("box_high",box_high_1);
|
||||
param.put("sale_order_name", sale_order_name);
|
||||
param.put("product_name", product_name);
|
||||
param.put("box_length", box_length_1);
|
||||
param.put("box_width", box_width_1);
|
||||
param.put("box_high", box_high_1);
|
||||
|
||||
//查询是否存在可用的空位
|
||||
String point_code = "";
|
||||
@@ -614,7 +604,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
}
|
||||
|
||||
JSONObject data = new JSONObject();
|
||||
data.put("is_auto_table",jsonCust.getString("is_auto_table"));
|
||||
data.put("is_auto_table", jsonCust.getString("is_auto_table"));
|
||||
|
||||
// 判断是否贴标
|
||||
if (!StrUtil.equals(jsonCust.getString("is_auto_table"), "1")) {
|
||||
@@ -1009,7 +999,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
point.update(json);
|
||||
|
||||
JSONObject jsonTwo = new JSONObject();
|
||||
jsonTwo.put("point_id", IdUtil.getSnowflake(1,1).nextId());
|
||||
jsonTwo.put("point_id", IdUtil.getSnowflake(1, 1).nextId());
|
||||
jsonTwo.put("device_code", json.getString("device_code"));
|
||||
jsonTwo.put("point_code", jsonTwo.getString("device_code") + "_2");
|
||||
jsonTwo.put("point_name", json.getString("point_name"));
|
||||
|
||||
@@ -232,7 +232,7 @@ public class OutServiceImpl implements OutService {
|
||||
throw new BadRequestException("起点不能为空!");
|
||||
}
|
||||
|
||||
JSONObject task1 = WQLObject.getWQLObject("SCH_BASE_Task").query("point_code1 = '" + point_code + "' AND task_status < '07' AND is_delete = '0'").uniqueResult(0);
|
||||
JSONObject task1 = WQLObject.getWQLObject("SCH_BASE_Task").query("(point_code2 = '" + point_code + "' OR point_code1 = '" + point_code + "' ) AND task_status < '07' AND is_delete = '0'").uniqueResult(0);
|
||||
|
||||
if (ObjectUtil.isNotEmpty(task1)) {
|
||||
throw new BadRequestException("点位:" + point_code + "存在未完成的任务!");
|
||||
|
||||
@@ -59,7 +59,7 @@ public class ShippingServiceImpl implements ShippingService {
|
||||
.addParam("sql_str", " ORDER BY abs(" + cut_jo.getString("sort_seq") + "-sort_seq),point_code")
|
||||
.addParam("product_area", cut_jo.getString("product_area"))
|
||||
.addParam("point_location", cut_jo.getString("point_location"))
|
||||
.addParam("flag", "3").process().uniqueResult(0);
|
||||
.addParam("flag", "302").process().uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(empty_vehicle)) {
|
||||
throw new BadRequestException("未查询到可用的空载具!");
|
||||
}
|
||||
@@ -87,6 +87,14 @@ public class ShippingServiceImpl implements ShippingService {
|
||||
if (StrUtil.isEmpty(vehicle_code)) {
|
||||
throw new BadRequestException("输入的载具号不能为空!");
|
||||
}
|
||||
JSONObject vehicle_task = WQLObject.getWQLObject("sch_base_task").query("vehicle_code2 = '" + vehicle_code + "' AND is_delete = '0' AND task_status < '07'").uniqueResult(0);
|
||||
if (ObjectUtil.isNotEmpty(vehicle_task)) {
|
||||
throw new BadRequestException("载具码:" + vehicle_code + "存在未完成的输送线任务!");
|
||||
}
|
||||
JSONObject del_jo = WQLObject.getWQLObject("st_ivt_deliverypointivt").query("vehicle_code = '"+vehicle_code+"'").uniqueResult(0);
|
||||
if (ObjectUtil.isNotEmpty(del_jo)){
|
||||
throw new BadRequestException("载具码:" + vehicle_code + "存在点位:"+del_jo.getString("point_code")+"上!");
|
||||
}
|
||||
|
||||
if (rows.size() > 2) {
|
||||
throw new BadRequestException("最多选择两个分切计划进行操作!");
|
||||
@@ -272,6 +280,14 @@ public class ShippingServiceImpl implements ShippingService {
|
||||
if (StrUtil.isEmpty(vehicle_code)) {
|
||||
throw new BadRequestException("载具码不能为空!");
|
||||
}
|
||||
JSONObject vehicle_task = WQLObject.getWQLObject("sch_base_task").query("vehicle_code2 = '" + vehicle_code + "' AND is_delete = '0' AND task_status < '07'").uniqueResult(0);
|
||||
if (ObjectUtil.isNotEmpty(vehicle_task)) {
|
||||
throw new BadRequestException("载具码:" + vehicle_code + "存在未完成的输送线任务!");
|
||||
}
|
||||
JSONObject del_jo = WQLObject.getWQLObject("st_ivt_deliverypointivt").query("vehicle_code = '"+vehicle_code+"'").uniqueResult(0);
|
||||
if (ObjectUtil.isNotEmpty(del_jo)){
|
||||
throw new BadRequestException("载具码:" + vehicle_code + "存在点位:"+del_jo.getString("point_code")+"上!");
|
||||
}
|
||||
|
||||
//判断起点是否存在
|
||||
JSONObject start_jo = WQLObject.getWQLObject("sch_base_point").query("point_code = '" + point_code + "' AND is_delete = '0' AND is_used = '1'").uniqueResult(0);
|
||||
|
||||
@@ -135,7 +135,8 @@
|
||||
sch_base_task
|
||||
WHERE
|
||||
( point_code1 = ivt.point_code OR point_code2 = ivt.point_code )
|
||||
AND task_status < '07'
|
||||
AND vehicle_code2 = ivt.vehicle_code
|
||||
AND task_status < '07'
|
||||
AND is_delete = '0'
|
||||
)
|
||||
OPTION 输入.product_area <> ""
|
||||
@@ -150,6 +151,38 @@
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
|
||||
IF 输入.flag = "302"
|
||||
QUERY
|
||||
SELECT
|
||||
ivt.*
|
||||
FROM
|
||||
st_ivt_deliverypointivt ivt
|
||||
WHERE
|
||||
point_status = '02'
|
||||
AND ivt.is_used = '1'
|
||||
AND NOT EXISTS (
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
sch_base_task
|
||||
WHERE
|
||||
( point_code1 = ivt.point_code OR point_code2 = ivt.point_code )
|
||||
AND vehicle_code2 = ivt.vehicle_code
|
||||
AND task_status < '07'
|
||||
AND is_delete = '0'
|
||||
)
|
||||
OPTION 输入.product_area <> ""
|
||||
ivt.product_area = 输入.product_area
|
||||
ENDOPTION
|
||||
OPTION 输入.product_area <> ""
|
||||
ivt.point_location = 输入.point_location
|
||||
ENDOPTION
|
||||
输入.sql_str
|
||||
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
|
||||
IF 输入.flag = "4"
|
||||
QUERY
|
||||
SELECT
|
||||
|
||||
@@ -13,6 +13,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.modules.common.exception.BadRequestException;
|
||||
import org.nl.modules.wql.WQL;
|
||||
import org.nl.modules.wql.core.bean.WQLObject;
|
||||
import org.nl.modules.wql.util.SpringContextHolder;
|
||||
import org.nl.modules.wql.util.WqlUtil;
|
||||
import org.nl.wms.basedata.master.service.ClassstandardService;
|
||||
import org.nl.wms.basedata.master.service.dto.ClassstandardDto;
|
||||
@@ -21,6 +22,11 @@ import org.nl.wms.sch.service.RegionService;
|
||||
import org.nl.wms.sch.service.TaskService;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.PlatformTransactionManager;
|
||||
import org.springframework.transaction.TransactionDefinition;
|
||||
import org.springframework.transaction.TransactionStatus;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.transaction.support.DefaultTransactionDefinition;
|
||||
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
@@ -98,6 +104,7 @@ public class TaskServiceImpl implements TaskService {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void operation(Map<String, Object> map) {
|
||||
String task_id = MapUtil.getStr(map, "task_id");
|
||||
String method_name = MapUtil.getStr(map, "method_name");
|
||||
@@ -105,7 +112,6 @@ public class TaskServiceImpl implements TaskService {
|
||||
// 任务处理类
|
||||
String processing_class = taskObj.getString("handle_class");
|
||||
String message = "";
|
||||
// 根据任务类型获取对应的任务操作类
|
||||
try {
|
||||
Class<?> clz = Class.forName(processing_class);
|
||||
Object obj = clz.newInstance();
|
||||
@@ -139,7 +145,7 @@ public class TaskServiceImpl implements TaskService {
|
||||
throw new BadRequestException(message);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
throw new BadRequestException("任务操作失败!");
|
||||
throw new BadRequestException(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -36,7 +36,6 @@ public class TranUtil {
|
||||
try {
|
||||
//创建所有事务集合
|
||||
Consumer<String> allTransactionConsumer = task -> {
|
||||
System.out.println(TransactionSynchronizationManager.getCurrentTransactionName());
|
||||
DefaultTransactionDefinition def = new DefaultTransactionDefinition();
|
||||
def.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRES_NEW);
|
||||
def.setIsolationLevel(TransactionDefinition.ISOLATION_READ_UNCOMMITTED);
|
||||
|
||||
Reference in New Issue
Block a user