更新代码
This commit is contained in:
@@ -81,7 +81,7 @@ public class AutoCreateTask {
|
||||
|
||||
String status = result.getString("status");
|
||||
String message = result.getString("message");
|
||||
//发送失败的任务JSON集合:task_uuid,message
|
||||
//发送失败的任务JSON集合:task_id,message
|
||||
JSONArray errArr = result.getJSONArray("errArr");
|
||||
|
||||
//任务下发以后,更新任务状态
|
||||
@@ -89,7 +89,7 @@ public class AutoCreateTask {
|
||||
if ("200".equals(status)) {
|
||||
taskList.forEach(item -> {
|
||||
JSONObject taskObj = new JSONObject();
|
||||
taskObj.put("task_uuid", item.getTask_id());
|
||||
taskObj.put("task_id", item.getTask_id());
|
||||
taskObj.put("task_status", TaskStatusEnum.ISSUE.getCode());
|
||||
taskObj.put("remark", "下发成功");
|
||||
taskObj.put("update_time", DateUtil.now());
|
||||
@@ -98,7 +98,7 @@ public class AutoCreateTask {
|
||||
} else {//下发失败
|
||||
taskList.forEach(item -> {
|
||||
JSONObject taskObj = new JSONObject();
|
||||
taskObj.put("task_uuid", item.getTask_id());
|
||||
taskObj.put("task_id", item.getTask_id());
|
||||
taskObj.put("task_status", TaskStatusEnum.ISSUE.getCode());
|
||||
taskObj.put("remark", "下发失败:" + message);
|
||||
taskObj.put("update_time", DateUtil.now());
|
||||
|
||||
@@ -12,7 +12,6 @@ import org.nl.modules.system.service.GenCodeService;
|
||||
import org.nl.modules.wql.core.bean.ResultBean;
|
||||
import org.nl.modules.wql.core.bean.WQLObject;
|
||||
import org.nl.modules.wql.util.WqlUtil;
|
||||
import org.springframework.cache.annotation.CacheConfig;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@@ -23,7 +22,6 @@ import java.util.Set;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@CacheConfig(cacheNames = "genCode")
|
||||
public class GenCodeServiceImpl implements GenCodeService {
|
||||
@Override
|
||||
public JSONObject queryAll(Map form, Pageable pageable) {
|
||||
@@ -98,7 +96,7 @@ public class GenCodeServiceImpl implements GenCodeService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String codeDemo(Map form) {
|
||||
public synchronized String codeDemo(Map form) {
|
||||
String code = (String) form.get("code");
|
||||
String id = this.queryIdByCode(code);
|
||||
//如果flag=1就执行更新数据库的操作
|
||||
@@ -166,7 +164,7 @@ public class GenCodeServiceImpl implements GenCodeService {
|
||||
}
|
||||
demo += value;
|
||||
if (flag.equals("1")) {
|
||||
wo.update(jo);
|
||||
wo.update(jo,"id = '"+jo.getString("id")+"'");
|
||||
}
|
||||
}
|
||||
return demo;
|
||||
|
||||
@@ -1,19 +1,18 @@
|
||||
package org.nl.modules.system.util;
|
||||
|
||||
import org.nl.modules.system.service.GenCodeService;
|
||||
import org.nl.modules.system.service.impl.GenCodeServiceImpl;
|
||||
import org.nl.modules.wql.util.SpringContextHolder;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
public class CodeUtil {
|
||||
|
||||
public static synchronized String getNewCode(String ruleCode){
|
||||
GenCodeService service=new GenCodeServiceImpl();
|
||||
public static String getNewCode(String ruleCode){
|
||||
String flag = "1";
|
||||
HashMap<String,String> map = new HashMap<>();
|
||||
map.put("flag",flag);
|
||||
map.put("code",ruleCode);
|
||||
return service.codeDemo(map);
|
||||
return SpringContextHolder.getBean(GenCodeService.class).codeDemo(map);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
private final TaskService taskService;
|
||||
|
||||
/**
|
||||
* task_uuid:任务标识
|
||||
* task_id:任务标识
|
||||
* task_code:任务编码
|
||||
* task_status:1:执行中,2:完成 ,3:acs取消
|
||||
*
|
||||
@@ -53,8 +53,8 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
JSONArray errArr = new JSONArray();
|
||||
for (int i = 0; i < array.size(); i++) {
|
||||
JSONObject row = array.getJSONObject(i);
|
||||
String task_uuid = row.getString("task_id");
|
||||
TaskDto taskDto = taskService.findById(task_uuid);
|
||||
String task_id = row.getString("task_id");
|
||||
TaskDto taskDto = taskService.findById(task_id);
|
||||
String processing_class = taskDto.getHandle_class();
|
||||
//1:执行中,2:完成 ,3:acs取消
|
||||
String acs_task_status = row.getString("task_status");
|
||||
@@ -87,7 +87,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
log.info("任务状态更新失败:{}", message);
|
||||
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("task_uuid", task_uuid);
|
||||
json.put("task_id", task_id);
|
||||
json.put("message", message);
|
||||
errArr.add(json);
|
||||
|
||||
@@ -97,7 +97,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
log.info("任务状态更新失败:{}", message);
|
||||
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("task_uuid", task_uuid);
|
||||
json.put("task_id", task_id);
|
||||
json.put("message", message);
|
||||
errArr.add(json);
|
||||
|
||||
@@ -181,17 +181,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
param.put("qty", vehicle_num);
|
||||
// 创建任务
|
||||
GjxCallEmpVehicleTask taskBean = SpringContextHolder.getBean(GjxCallEmpVehicleTask.class);
|
||||
String task_id = taskBean.createTask(param);
|
||||
// 下发
|
||||
JSONObject jsonObject = taskBean.renotifyAcs(task_id);
|
||||
if (StrUtil.equals(jsonObject.getString("status"), "200")) {
|
||||
// 成功返回 更新任务状态
|
||||
JSONObject jsonTask = taskTab.query("task_id = '" + task_id + "'").uniqueResult(0);
|
||||
jsonTask.put("task_status", TaskStatusEnum.ISSUE.getCode());
|
||||
taskTab.update(jsonTask);
|
||||
} else {
|
||||
throw new BadRequestException(jsonObject.getString("message"));
|
||||
}
|
||||
taskBean.createTask(param);
|
||||
|
||||
} else if (StrUtil.equals(type, "2")) {
|
||||
// 2.共挤线满托入库: 调用物料入库处理类创建任务
|
||||
@@ -279,22 +269,16 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
} else if (StrUtil.equals(type, "5")) {
|
||||
// 5.油漆线空盘入库: 调用空托盘入库处理类创建任务
|
||||
if (ObjectUtil.isEmpty(vehicle_num)) throw new BadRequestException("数量不能为空");
|
||||
if (ObjectUtil.isEmpty(vehicle_type)) throw new BadRequestException("载具类型不能为空");
|
||||
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("point_code1", point_code);
|
||||
param.put("qty", vehicle_num);
|
||||
param.put("vehicle_num", vehicle_num);
|
||||
param.put("vehicle_type", vehicle_type);
|
||||
// 创建任务
|
||||
SendEmpVehicleTask taskBean = SpringContextHolder.getBean(SendEmpVehicleTask.class);
|
||||
String task_id = taskBean.createTask(param);
|
||||
// 下发
|
||||
JSONObject jsonObject = taskBean.renotifyAcs(task_id);
|
||||
if (StrUtil.equals(jsonObject.getString("status"), "200")) {
|
||||
JSONObject jsonTask = taskTab.query("task_id = '" + task_id + "'").uniqueResult(0);
|
||||
jsonTask.put("task_status", TaskStatusEnum.ISSUE.getCode());
|
||||
taskTab.update(jsonTask);
|
||||
} else {
|
||||
throw new BadRequestException(jsonObject.getString("message"));
|
||||
}
|
||||
YqxSendEmpVehicleTask taskBean = SpringContextHolder.getBean(YqxSendEmpVehicleTask.class);
|
||||
taskBean.createTask(param);
|
||||
|
||||
|
||||
} else if (StrUtil.equals(type, "6")) {
|
||||
// 6.一楼空盘入库 (有载具号): 调用空托盘入库处理类创建任务
|
||||
|
||||
@@ -39,14 +39,6 @@ public interface TaskService {
|
||||
*/
|
||||
TaskDto findById(String task_id);
|
||||
|
||||
/**
|
||||
* 根据ID查询
|
||||
*
|
||||
* @param taskdtl_id ID
|
||||
* @return Task
|
||||
*/
|
||||
TaskDto findByDtlId(String taskdtl_id);
|
||||
|
||||
/**
|
||||
* 根据编码查询
|
||||
*
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
package org.nl.wms.sch.service.dto;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
@@ -23,10 +21,6 @@ public class TaskQueryDto implements Serializable {
|
||||
*/
|
||||
private String task_type;
|
||||
|
||||
/**
|
||||
* 任务明细类型
|
||||
*/
|
||||
private String taskdtl_type;
|
||||
|
||||
/**
|
||||
* 指令状态
|
||||
@@ -69,12 +63,6 @@ public class TaskQueryDto implements Serializable {
|
||||
*/
|
||||
private String update_time;
|
||||
|
||||
/** 任务明细标识 */
|
||||
/**
|
||||
* 防止精度丢失
|
||||
*/
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long taskdtl_id;
|
||||
|
||||
/**
|
||||
* 任务标识
|
||||
|
||||
@@ -78,9 +78,6 @@ public class TaskServiceImpl implements TaskService {
|
||||
ClassstandardDto task_type = classstandardService.findById(whereJson.getString("task_type"));
|
||||
map.put("task_type", task_type.getClass_code());
|
||||
}
|
||||
if (StrUtil.isNotEmpty(whereJson.getString("taskdtl_type"))) {
|
||||
map.put("taskdtl_type", whereJson.getString("taskdtl_type"));
|
||||
}
|
||||
if (StrUtil.isNotEmpty(whereJson.getString("finishTypeList"))) {
|
||||
map.put("finishTypeList", whereJson.getString("finishTypeList"));
|
||||
}
|
||||
@@ -121,14 +118,6 @@ public class TaskServiceImpl implements TaskService {
|
||||
return obj;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TaskDto findByDtlId(String taskdtl_id) {
|
||||
WQLObject wo = WQLObject.getWQLObject("sch_base_task");
|
||||
JSONObject json = wo.query("task_id = '" + taskdtl_id + "'").uniqueResult(0);
|
||||
final TaskDto obj = json.toJavaObject(TaskDto.class);
|
||||
return obj;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TaskDto findByCode(String code) {
|
||||
WQLObject wo = WQLObject.getWQLObject("sch_base_task");
|
||||
@@ -141,7 +130,7 @@ public class TaskServiceImpl implements TaskService {
|
||||
public void operation(Map<String, Object> map) {
|
||||
String task_id = MapUtil.getStr(map, "task_id");
|
||||
String method_name = MapUtil.getStr(map, "method_name");
|
||||
TaskDto dto = this.findByDtlId(task_id);
|
||||
TaskDto dto = this.findById(task_id);
|
||||
// 任务处理类
|
||||
String processing_class = dto.getHandle_class();
|
||||
String message = "";
|
||||
@@ -159,7 +148,7 @@ public class TaskServiceImpl implements TaskService {
|
||||
for (int i = 0; i < arr.size(); i++) {
|
||||
JSONObject json = arr.getJSONObject(i);
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("taskdtl_id", json.getString("taskdtl_id"));
|
||||
param.put("task_id", json.getString("task_id"));
|
||||
param.put("remark", json.getString("message"));
|
||||
wo.update(param);
|
||||
}
|
||||
|
||||
@@ -137,10 +137,9 @@ public class CallEmpVehicleTask extends AbstractAcsTask {
|
||||
String task_id = IdUtil.getSnowflake(1, 1).nextId() + "";
|
||||
|
||||
jsonTask.put("task_id", task_id);
|
||||
jsonTask.put("taskdtl_id", task_id);
|
||||
|
||||
jsonTask.put("task_code", CodeUtil.getNewCode("TASK_CODE"));
|
||||
jsonTask.put("task_type", "04");
|
||||
jsonTask.put("taskdtl_type", "04");
|
||||
jsonTask.put("task_status", "01");
|
||||
jsonTask.put("point_code1", point_code1);
|
||||
jsonTask.put("point_code2", point_code2);
|
||||
|
||||
@@ -190,10 +190,8 @@ public class CallMaterialTask extends AbstractAcsTask {
|
||||
|
||||
JSONObject taskObj = new JSONObject();
|
||||
taskObj.put("task_id", task_id);
|
||||
taskObj.put("taskdtl_id", task_id);
|
||||
taskObj.put("task_code", CodeUtil.getNewCode("TASK_CODE"));
|
||||
taskObj.put("task_type", "02");
|
||||
taskObj.put("taskdtl_type", "02");
|
||||
taskObj.put("task_status", task_status);
|
||||
taskObj.put("point_code1", point_code1);
|
||||
taskObj.put("start_area", start_area);
|
||||
|
||||
@@ -1,12 +1,9 @@
|
||||
package org.nl.wms.sch.tasks;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.nl.modules.common.exception.BadRequestException;
|
||||
import org.nl.modules.common.utils.SecurityUtils;
|
||||
import org.nl.modules.system.util.CodeUtil;
|
||||
import org.nl.modules.wql.core.bean.WQLObject;
|
||||
import org.nl.wms.sch.manage.AbstractAcsTask;
|
||||
import org.nl.wms.sch.manage.TaskStatusEnum;
|
||||
@@ -55,43 +52,7 @@ public class PointToPointTask extends AbstractAcsTask {
|
||||
@Override
|
||||
@Transactional
|
||||
public String createTask(JSONObject form) {
|
||||
String point_code1 = form.getString("point_code1");
|
||||
String point_code2 = form.getString("point_code2");
|
||||
String vehicle_code = form.getString("vehicle_code");
|
||||
String now = DateUtil.now();
|
||||
if (StrUtil.isEmpty(point_code1)) {
|
||||
throw new BadRequestException("起点不能为空!");
|
||||
}
|
||||
/* if (StrUtil.isEmpty(point_code2)) {
|
||||
throw new BadRequestException("终点不能为空!");
|
||||
}
|
||||
if (StrUtil.isEmpty(vehicle_code)) {
|
||||
throw new BadRequestException("载具不能为空!");
|
||||
}*/
|
||||
String taskdtl_id = IdUtil.getSnowflake(1, 1).nextId() + "";
|
||||
JSONObject task = new JSONObject();
|
||||
task.put("taskdtl_id", taskdtl_id);
|
||||
task.put("task_id", taskdtl_id);
|
||||
task.put("task_code", CodeUtil.getNewCode("TASK_CODE"));
|
||||
task.put("task_type", "05");
|
||||
task.put("taskdtl_type", "05");
|
||||
task.put("task_status", "01");
|
||||
task.put("point_code1", point_code1);
|
||||
task.put("point_code2", point_code2);
|
||||
task.put("vehicle_code", vehicle_code);
|
||||
task.put("handle_class", this.getClass().getName());
|
||||
task.put("finished_type", "00");
|
||||
task.put("is_delete", "0");
|
||||
Long currentUserId = SecurityUtils.getCurrentUserId();
|
||||
task.put("create_id", currentUserId);
|
||||
task.put("create_name", SecurityUtils.getCurrentNickName());
|
||||
task.put("update_optid", currentUserId);
|
||||
task.put("update_optname", SecurityUtils.getCurrentNickName());
|
||||
task.put("create_time", now);
|
||||
task.put("update_time", now);
|
||||
task.put("priority", "1");
|
||||
WQLObject.getWQLObject("SCH_BASE_Task").insert(task);
|
||||
return taskdtl_id;
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -101,12 +62,12 @@ public class PointToPointTask extends AbstractAcsTask {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void pullBack(String taskdtl_id) {
|
||||
public void pullBack(String task_id) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cancel(String taskdtl_id) {
|
||||
public void cancel(String task_id) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,19 +2,14 @@ package org.nl.wms.sch.tasks;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.NumberUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import org.nl.modules.common.exception.BadRequestException;
|
||||
import org.nl.modules.common.utils.SecurityUtils;
|
||||
import org.nl.modules.system.util.CodeUtil;
|
||||
|
||||
|
||||
import org.nl.modules.wql.WQL;
|
||||
import org.nl.modules.wql.core.bean.WQLObject;
|
||||
import org.nl.modules.wql.util.SpringContextHolder;
|
||||
@@ -26,12 +21,9 @@ import org.nl.wms.sch.manage.AbstractAcsTask;
|
||||
import org.nl.wms.sch.manage.TaskStatusEnum;
|
||||
import org.nl.wms.sch.service.PointService;
|
||||
import org.nl.wms.sch.service.dto.PointDto;
|
||||
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.HashMap;
|
||||
|
||||
@Service
|
||||
@@ -44,7 +36,6 @@ public class SendEmpVehicleTask extends AbstractAcsTask {
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void updateTaskStatus(JSONObject taskObj, String status) {
|
||||
WQLObject taskTab = WQLObject.getWQLObject("SCH_BASE_Task");
|
||||
WQLObject empTab = WQLObject.getWQLObject("st_ivt_EmptyVehicleRecord");
|
||||
WQLObject pointTab = WQLObject.getWQLObject("sch_base_point");
|
||||
|
||||
String task_id = taskObj.getString("task_id");
|
||||
@@ -81,24 +72,6 @@ public class SendEmpVehicleTask extends AbstractAcsTask {
|
||||
PointDto nextDto = point.findByCode(jsonTask.getString("point_code2"));
|
||||
if (ObjectUtil.isEmpty(nextDto)) throw new BadRequestException("未找到可用点位:" + nextDto);
|
||||
|
||||
// 1.更新点位数量 2.解锁点位
|
||||
JSONObject jsonEmp = empTab.query("task_uuid = '" + task_id + "'").uniqueResult(0);
|
||||
int vehicle_qty = JSONObject.parseObject(JSON.toJSONString(nextDto)).getIntValue("vehicle_qty");
|
||||
BigDecimal vehicle_qty_point = NumberUtil.add(String.valueOf(vehicle_qty), String.valueOf(jsonEmp.getIntValue("vehicle_qty")));
|
||||
|
||||
nextDto.setVehicle_qty(vehicle_qty_point);
|
||||
nextDto.setPoint_status("01");
|
||||
nextDto.setLock_type("00");
|
||||
nextDto.setVehicle_type(jsonTask.getString("vehicle_type"));
|
||||
nextDto.setVehicle_code(jsonTask.getString("vehicle_code"));
|
||||
pointTab.update(JSONObject.parseObject(JSON.toJSONString(nextDto)));
|
||||
|
||||
// 完成单据状态
|
||||
jsonEmp.put("bill_status", "50");
|
||||
jsonEmp.put("update_optid", SecurityUtils.getCurrentUserId());
|
||||
jsonEmp.put("update_optname", SecurityUtils.getCurrentUsername());
|
||||
jsonEmp.put("update_time", DateUtil.now());
|
||||
empTab.update(jsonEmp);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -108,7 +81,6 @@ public class SendEmpVehicleTask extends AbstractAcsTask {
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public String createTask(JSONObject form) {
|
||||
WQLObject taskTab = WQLObject.getWQLObject("SCH_BASE_Task");
|
||||
WQLObject empTab = WQLObject.getWQLObject("st_ivt_EmptyVehicleRecord");
|
||||
WQLObject pointTab = WQLObject.getWQLObject("sch_base_point");
|
||||
|
||||
String point_code1 = form.getString("point_code1");
|
||||
@@ -152,10 +124,9 @@ public class SendEmpVehicleTask extends AbstractAcsTask {
|
||||
String task_id = IdUtil.getSnowflake(1, 1).nextId() + "";
|
||||
|
||||
jsonTask.put("task_id", task_id);
|
||||
jsonTask.put("taskdtl_id", task_id);
|
||||
|
||||
jsonTask.put("task_code", CodeUtil.getNewCode("TASK_CODE"));
|
||||
jsonTask.put("task_type", "03");
|
||||
jsonTask.put("taskdtl_type", "03");
|
||||
jsonTask.put("task_status", "01");
|
||||
jsonTask.put("point_code1", point_code1);
|
||||
jsonTask.put("point_code2", point_code2);
|
||||
@@ -173,12 +144,7 @@ public class SendEmpVehicleTask extends AbstractAcsTask {
|
||||
jsonPoint.put("lock_type", "02");
|
||||
pointTab.update(jsonPoint);
|
||||
|
||||
// 更新空载具单据状态
|
||||
if (ObjectUtil.isNotEmpty(record_uuid)) {
|
||||
JSONObject jsonEmp = empTab.query("record_uuid ='" + record_uuid + "'").uniqueResult(0);
|
||||
jsonEmp.put("bill_status","20");
|
||||
empTab.update(jsonEmp);
|
||||
}
|
||||
|
||||
return task_id;
|
||||
}
|
||||
|
||||
|
||||
@@ -200,12 +200,9 @@ public class SendMaterialTask extends AbstractAcsTask {
|
||||
CodeUtil.getNewCode("TASK_CODE");
|
||||
Long task_id = IdUtil.getSnowflake(1, 1).nextId();
|
||||
taskObj.put("task_id", task_id);
|
||||
taskObj.put("taskdtl_id", task_id);
|
||||
taskObj.put("task_code", CodeUtil.getNewCode("TASK_CODE"));
|
||||
taskObj.put("task_type", "01");
|
||||
taskObj.put("vehicle_type", vehicle_type);
|
||||
taskObj.put("taskdtl_type", "01");
|
||||
taskObj.put("acs_task_type", "1");
|
||||
taskObj.put("task_status", TaskStatusEnum.START_AND_POINT.getCode());
|
||||
taskObj.put("point_code1", point_code1);
|
||||
PointDto startPoint = pointService.findByCode(point_code1);
|
||||
|
||||
@@ -136,10 +136,9 @@ public class YqxCallEmpVehicleTask extends AbstractAcsTask {
|
||||
String task_id = IdUtil.getSnowflake(1, 1).nextId() + "";
|
||||
|
||||
jsonTask.put("task_id", task_id);
|
||||
jsonTask.put("taskdtl_id", task_id);
|
||||
|
||||
jsonTask.put("task_code", CodeUtil.getNewCode("TASK_CODE"));
|
||||
jsonTask.put("task_type", "04");
|
||||
jsonTask.put("taskdtl_type", "04");
|
||||
jsonTask.put("task_status", "01");
|
||||
jsonTask.put("point_code1", point_code1);
|
||||
jsonTask.put("point_code2", point_code2);
|
||||
|
||||
@@ -0,0 +1,186 @@
|
||||
package org.nl.wms.sch.tasks;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.modules.common.exception.BadRequestException;
|
||||
import org.nl.modules.common.utils.SecurityUtils;
|
||||
import org.nl.modules.system.util.CodeUtil;
|
||||
import org.nl.modules.wql.WQL;
|
||||
import org.nl.modules.wql.core.bean.WQLObject;
|
||||
import org.nl.wms.sch.manage.AbstractAcsTask;
|
||||
import org.nl.wms.sch.manage.TaskStatusEnum;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class YqxSendEmpVehicleTask extends AbstractAcsTask {
|
||||
private final String THIS_CLASS = YqxSendEmpVehicleTask.class.getName();
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void updateTaskStatus(JSONObject taskObj, String status) {
|
||||
WQLObject taskTab = WQLObject.getWQLObject("SCH_BASE_Task");
|
||||
WQLObject pointTab = WQLObject.getWQLObject("sch_base_point");
|
||||
|
||||
String task_id = taskObj.getString("task_id");
|
||||
JSONObject jsonTask = taskTab.query("task_id = '" + task_id + "'").uniqueResult(0);
|
||||
|
||||
if (StrUtil.equals(status, "0")) {
|
||||
// 取消删除任务
|
||||
taskTab.delete("task_id = '" + task_id + "'");
|
||||
}
|
||||
|
||||
if (TaskStatusEnum.EXECUTING.getCode().equals(status)) {
|
||||
// 更新任务状态为执行中
|
||||
jsonTask.put("task_status", TaskStatusEnum.EXECUTING.getCode());
|
||||
jsonTask.put("update_time", DateUtil.now());
|
||||
jsonTask.put("car_no", taskObj.getString("car_no"));
|
||||
taskTab.update(jsonTask);
|
||||
}
|
||||
|
||||
if (StrUtil.equals(status, TaskStatusEnum.FINISHED.getCode())) {
|
||||
// 更改任务状态为完成
|
||||
jsonTask.put("task_status", TaskStatusEnum.FINISHED.getCode());
|
||||
jsonTask.put("update_optid", SecurityUtils.getCurrentUserId());
|
||||
jsonTask.put("update_optname", SecurityUtils.getCurrentUsername());
|
||||
jsonTask.put("update_time", DateUtil.now());
|
||||
taskTab.update(jsonTask);
|
||||
|
||||
String point_code2 = jsonTask.getString("point_code2");
|
||||
JSONObject endPoint = pointTab.query("point_code = '" + point_code2 + "'").uniqueResult(0);
|
||||
//终点是叠盘架
|
||||
if (StrUtil.equals("DPJQB01", endPoint.getString("region_code"))) {
|
||||
Integer vehicle_qty = endPoint.getInteger("vehicle_qty");
|
||||
vehicle_qty += jsonTask.getInteger("vehicle_qty");
|
||||
endPoint.put("lock_type", "00");
|
||||
endPoint.put("vehicle_qty", vehicle_qty);
|
||||
endPoint.put("point_status", "1");
|
||||
endPoint.put("vehicle_type", jsonTask.getString("vehicle_type"));
|
||||
pointTab.update(endPoint);
|
||||
} else {//非叠盘架
|
||||
endPoint.put("lock_type", "00");
|
||||
endPoint.put("vehicle_qty", jsonTask.getString("vehicle_qty"));
|
||||
endPoint.put("vehicle_type", jsonTask.getString("vehicle_type"));
|
||||
endPoint.put("point_status", "1");
|
||||
pointTab.update(endPoint);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public String createTask(JSONObject form) {
|
||||
WQLObject taskTab = WQLObject.getWQLObject("SCH_BASE_Task");
|
||||
|
||||
String point_code1 = form.getString("point_code1");
|
||||
String point_code2 = form.getString("point_code2");
|
||||
String vehicle_code = form.getString("vehicle_code");
|
||||
String vehicle_type = form.getString("vehicle_type");
|
||||
|
||||
String vehicle_num = form.getString("vehicle_num");
|
||||
// 入库起点不能为空
|
||||
if (ObjectUtil.isEmpty(point_code1)) {
|
||||
throw new BadRequestException("起点不能为空");
|
||||
}
|
||||
// 判断起点是否有正在执行的任务
|
||||
JSONObject beforTaskObj = taskTab.query("is_delete='0' and point_code1='" + point_code1 + "' and task_status <>'" + TaskStatusEnum.FINISHED.getCode() + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isNotEmpty(beforTaskObj)) throw new BadRequestException("存在指令号为'" + beforTaskObj.getString("task_code") + "' 未完成!");
|
||||
|
||||
// 创建任务
|
||||
JSONObject jsonTask = new JSONObject();
|
||||
String task_id = IdUtil.getSnowflake(1, 1).nextId() + "";
|
||||
jsonTask.put("task_id", task_id);
|
||||
jsonTask.put("task_code", CodeUtil.getNewCode("TASK_CODE"));
|
||||
jsonTask.put("task_type", "kzj");
|
||||
jsonTask.put("task_status", TaskStatusEnum.SURE_START.getCode());
|
||||
jsonTask.put("point_code1", point_code1);
|
||||
jsonTask.put("point_code2", point_code2);
|
||||
jsonTask.put("vehicle_type", vehicle_type);
|
||||
jsonTask.put("vehicle_code", vehicle_code);
|
||||
jsonTask.put("vehicle_num", vehicle_num);
|
||||
jsonTask.put("handle_class", THIS_CLASS);
|
||||
jsonTask.put("create_name", SecurityUtils.getCurrentUsername());
|
||||
jsonTask.put("create_id", SecurityUtils.getCurrentUserId());
|
||||
jsonTask.put("create_time", DateUtil.now());
|
||||
taskTab.insert(jsonTask);
|
||||
|
||||
this.findNextPoint();
|
||||
return task_id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return
|
||||
* @discription 确定下一点位
|
||||
* @author ldjun
|
||||
* @created 2020年6月12日 下午6:01:06
|
||||
*/
|
||||
@Override
|
||||
public void findNextPoint() {
|
||||
WQLObject taskTab = WQLObject.getWQLObject("SCH_BASE_Task");
|
||||
WQLObject pointTab = WQLObject.getWQLObject("sch_base_point");
|
||||
JSONArray taskArr = taskTab.query("is_delete = '0' and handle_class = '" + this.THIS_CLASS + "' and task_status = '" + TaskStatusEnum.SURE_START.getCode() + "'").getResultJSONArray(0);
|
||||
for (int i = 0; i < taskArr.size(); i++) {
|
||||
JSONObject jsonTask = taskArr.getJSONObject(i);
|
||||
String vehicle_type = jsonTask.getString("vehicle_type");
|
||||
Integer vehicle_qty = jsonTask.getInteger("vehicle_qty");
|
||||
//TODO 判断叠盘位是否有另外任务,则不生成任务,后续可以考虑托盘数量大于某个数直接去缓存区或者养生A区
|
||||
JSONObject taskObj = taskTab.query("is_delete='0' and handle_class='" + this.THIS_CLASS + "' and task_status <>'" + TaskStatusEnum.FINISHED.getCode() + "' and task_id <> " + jsonTask.getLong("task_id")).uniqueResult(0);
|
||||
if (ObjectUtil.isNotEmpty(taskObj)) continue;
|
||||
|
||||
JSONObject dpjPoint = pointTab.query("is_used ='1' and lock_type='00' and is_delete='0' and region_code='DPJQB01' and can_vehicle_type like '%" + vehicle_type + "%'").uniqueResult(0);
|
||||
|
||||
int sum_qty=(dpjPoint.getInteger("vehicle_qty")==null?0:dpjPoint.getInteger("vehicle_qty"))+vehicle_qty;
|
||||
//超过叠盘架允许的最大托盘数,去托盘缓存区或者去养生A区,后续可以考虑任务的载具数量和叠盘架的载具数量谁比较大,大的先去缓存位或者去养生A区
|
||||
if ( sum_qty > dpjPoint.getInteger("vehicle_max_qty")) {
|
||||
JSONObject endPoint = WQL.getWO("ST_VEHICLE_IN_01").addParam("flag", "1").addParam("vehicle_type", "'%" + vehicle_type + "'").process().uniqueResult(0);
|
||||
jsonTask.put("point_code2", endPoint.getString("point_code"));
|
||||
jsonTask.put("task_status", TaskStatusEnum.START_AND_POINT);
|
||||
jsonTask.put("update_time", DateUtil.now());
|
||||
taskTab.update(jsonTask);
|
||||
|
||||
|
||||
} else {//去叠盘架
|
||||
jsonTask.put("point_code2", dpjPoint.getString("point_code"));
|
||||
jsonTask.put("task_status", TaskStatusEnum.START_AND_POINT.getCode());
|
||||
jsonTask.put("update_time", DateUtil.now());
|
||||
taskTab.update(jsonTask);
|
||||
}
|
||||
//锁住终点
|
||||
JSONObject pointObj = new JSONObject();
|
||||
pointObj.put("lock_type", "01");
|
||||
pointObj.put("update_time", DateUtil.now());
|
||||
pointTab.update(pointObj, "point_code ='" + jsonTask.getString("point_code2") + "'");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
;
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void forceFinish(String task_id) {
|
||||
JSONObject taskObj = WQLObject.getWQLObject("SCH_BASE_Task").query("task_id = '" + task_id + "'").uniqueResult(0);
|
||||
this.updateTaskStatus(taskObj, TaskStatusEnum.FINISHED.getCode());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void pullBack(String task_id) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cancel(String task_id) {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -24,7 +24,6 @@
|
||||
输入.begin_time TYPEAS s_string
|
||||
输入.end_time TYPEAS s_string
|
||||
输入.unFinish TYPEAS s_string
|
||||
输入.taskdtl_type TYPEAS s_string
|
||||
|
||||
[临时表]
|
||||
--这边列出来的临时表就会在运行期动态创建
|
||||
|
||||
@@ -0,0 +1,113 @@
|
||||
[交易说明]
|
||||
交易名: 空载具入库业务
|
||||
所属模块:
|
||||
功能简述:flag=1 油漆线入空载具
|
||||
版权所有:
|
||||
表引用:
|
||||
版本经历:
|
||||
|
||||
[数据库]
|
||||
--指定数据库,为空采用默认值,默认为db.properties中列出的第一个库
|
||||
|
||||
[IO定义]
|
||||
#################################################
|
||||
## 表字段对应输入参数
|
||||
#################################################
|
||||
输入.flag TYPEAS s_string
|
||||
输入.vehicle_qty TYPEAS s_string
|
||||
输入.vehicle_type TYPEAS s_string
|
||||
输入.region_code TYPEAS s_string
|
||||
|
||||
[临时表]
|
||||
--这边列出来的临时表就会在运行期动态创建
|
||||
|
||||
[临时变量]
|
||||
--所有中间过程变量均可在此处定义
|
||||
|
||||
[业务过程]
|
||||
|
||||
##########################################
|
||||
# 1、输入输出检查 #
|
||||
##########################################
|
||||
|
||||
|
||||
##########################################
|
||||
# 2、主过程前处理 #
|
||||
##########################################
|
||||
|
||||
|
||||
##########################################
|
||||
# 3、业务主过程 #
|
||||
##########################################
|
||||
|
||||
IF 输入.flag = "1"
|
||||
QUERY
|
||||
SELECT
|
||||
p.point_id,
|
||||
p.point_code,
|
||||
p.point_name
|
||||
FROM
|
||||
SCH_BASE_Point p
|
||||
WHERE
|
||||
p.is_used = '1'
|
||||
AND p.is_delete = '0'
|
||||
AND p.lock_type = '00'
|
||||
AND p.lock_type = '00'
|
||||
AND p.point_status = '1'
|
||||
AND region_code IN ( 'KTPHCQB01', 'YSQA01' )
|
||||
OPTION 输入.vehicle_type <> ""
|
||||
p.can_vehicle_type like 输入.vehicle_type
|
||||
ENDOPTION
|
||||
|
||||
ORDER BY in_empty_seq
|
||||
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
|
||||
IF 输入.flag = "3"
|
||||
QUERY
|
||||
SELECT
|
||||
point.*
|
||||
FROM
|
||||
sch_base_point point
|
||||
LEFT JOIN SCH_BASE_Region region ON point.region_id = region.region_id
|
||||
WHERE
|
||||
point.lock_type = '00'
|
||||
AND point.point_status = '01'
|
||||
AND IFNULL(point.vehicle_qty,0) == 输入.vehicle_qty
|
||||
|
||||
OPTION 输入.region_code <> ""
|
||||
region.region_code = 输入.region_code
|
||||
ENDOPTION
|
||||
|
||||
OPTION 输入.vehicle_type <> ""
|
||||
point.vehicle_type = 输入.vehicle_type
|
||||
ENDOPTION
|
||||
|
||||
order by point.point_code DESC
|
||||
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
|
||||
IF 输入.flag = "2"
|
||||
QUERY
|
||||
SELECT
|
||||
point.*
|
||||
FROM
|
||||
sch_base_point point
|
||||
LEFT JOIN SCH_BASE_Region region ON point.region_id = region.region_id
|
||||
WHERE
|
||||
point.lock_type = '00'
|
||||
AND point.point_status = '00'
|
||||
|
||||
OPTION 输入.region_code <> ""
|
||||
region.region_code = 输入.region_code
|
||||
ENDOPTION
|
||||
|
||||
order by point.point_code DESC
|
||||
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
@@ -52,6 +52,7 @@
|
||||
p.is_used = '1'
|
||||
AND p.is_delete = '0'
|
||||
AND p.lock_type = '00'
|
||||
AND p.point_status = '2'
|
||||
and region_code in ('KTPHCQB01','YSQA01')
|
||||
|
||||
OPTION 输入.vehicle_type <> ""
|
||||
|
||||
Binary file not shown.
@@ -84,9 +84,15 @@ https://juejin.cn/post/6844903775631572999
|
||||
<logger name="jdbc.audit" level="ERROR" additivity="false">
|
||||
<appender-ref ref="CONSOLE"/>
|
||||
</logger>
|
||||
<logger name="org.hibernate" level="ERROR" additivity="false">
|
||||
<appender-ref ref="CONSOLE"/>
|
||||
</logger>
|
||||
<logger name="org.springframework" level="ERROR" additivity="false">
|
||||
<appender-ref ref="CONSOLE"/>
|
||||
</logger>
|
||||
<logger name="io.netty" level="ERROR" additivity="false">
|
||||
<appender-ref ref="CONSOLE"/>
|
||||
</logger>
|
||||
<logger name="org.apache" level="ERROR" additivity="false">
|
||||
<appender-ref ref="CONSOLE"/>
|
||||
</logger>
|
||||
|
||||
Reference in New Issue
Block a user