add: Connector添加临时点位,实现空满交换时间缩短
This commit is contained in:
@@ -51,7 +51,7 @@ public class ItemProtocol {
|
|||||||
public int getOpcIntegerValue(String protocol) {
|
public int getOpcIntegerValue(String protocol) {
|
||||||
Integer value = this.driver.getIntegeregerValue(protocol);
|
Integer value = this.driver.getIntegeregerValue(protocol);
|
||||||
if (value == null) {
|
if (value == null) {
|
||||||
log.error("读取错误!");
|
|
||||||
} else {
|
} else {
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -547,10 +547,10 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
|||||||
}
|
}
|
||||||
boolean flag = true;
|
boolean flag = true;
|
||||||
String jobName = null;
|
String jobName = null;
|
||||||
iSchBaseVehiclematerialgroupService.remove(Wrappers.lambdaQuery(SchBaseVehiclematerialgroup.class)
|
|
||||||
.eq(SchBaseVehiclematerialgroup::getVehicle_code, schBaseTask.getVehicle_code()));
|
|
||||||
AcsResponse acsResponse = connectorService.feedAgvTaskStatus(json);
|
AcsResponse acsResponse = connectorService.feedAgvTaskStatus(json);
|
||||||
if (acsResponse.getStatus() == 200 && StrUtil.isNotEmpty(acsResponse.getData())) {
|
if (acsResponse.getStatus() == 200 && StrUtil.isNotEmpty(acsResponse.getData())) {
|
||||||
|
iSchBaseVehiclematerialgroupService.remove(Wrappers.lambdaQuery(SchBaseVehiclematerialgroup.class)
|
||||||
|
.eq(SchBaseVehiclematerialgroup::getVehicle_code, schBaseTask.getVehicle_code()));
|
||||||
JSONArray objects = JSONObject.parseArray(acsResponse.getData());
|
JSONArray objects = JSONObject.parseArray(acsResponse.getData());
|
||||||
List<ConnectorDto> connectorDtos = BeanUtil.copyToList(objects, ConnectorDto.class);
|
List<ConnectorDto> connectorDtos = BeanUtil.copyToList(objects, ConnectorDto.class);
|
||||||
for (ConnectorDto connectorDto : connectorDtos) {
|
for (ConnectorDto connectorDto : connectorDtos) {
|
||||||
|
|||||||
@@ -73,6 +73,7 @@ public class HandheldServiceImpl implements HandheldService {
|
|||||||
private RedisUtils redisUtils;
|
private RedisUtils redisUtils;
|
||||||
@Autowired
|
@Autowired
|
||||||
private WmsToAcsService wmsToAcsService;
|
private WmsToAcsService wmsToAcsService;
|
||||||
|
static final Map<String,String> STATUS = MapOf.of("释放","0","锁定","1");
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -368,30 +369,6 @@ public class HandheldServiceImpl implements HandheldService {
|
|||||||
iSchBasePointService.update(Wrappers.lambdaUpdate(SchBasePoint.class)
|
iSchBasePointService.update(Wrappers.lambdaUpdate(SchBasePoint.class)
|
||||||
.eq(SchBasePoint::getPoint_code, device_code)
|
.eq(SchBasePoint::getPoint_code, device_code)
|
||||||
.set(SchBasePoint::getIs_lock, true));
|
.set(SchBasePoint::getIs_lock, true));
|
||||||
/*iSchBaseVehiclematerialgroupService.remove(Wrappers.lambdaQuery(SchBaseVehiclematerialgroup.class)
|
|
||||||
.eq(SchBaseVehiclematerialgroup::getVehicle_code, vehicle_code));
|
|
||||||
materials.stream().forEach(material -> {
|
|
||||||
String replace = StrUtil.replace(StrUtil.toString(material), "=", ":");
|
|
||||||
replace = replace.replaceAll("material_code:,", "");
|
|
||||||
// 使用 Hutool 的 JSONUtil 解析 JSON 字符串
|
|
||||||
cn.hutool.json.JSONObject jsonObject1 = JSONUtil.parseObj(replace);
|
|
||||||
// 判断 material_code 是否为空
|
|
||||||
if (replace.contains("OR")) {
|
|
||||||
Object materialCode = jsonObject1.get("order_code");
|
|
||||||
jsonObject1.put("order_code", materialCode.toString());
|
|
||||||
replace = jsonObject1.toString();
|
|
||||||
}
|
|
||||||
JSONObject jsonObject = JSONObject.parseObject(replace);
|
|
||||||
SchBaseVehiclematerialgroup schBaseVehiclematerialgroup = new SchBaseVehiclematerialgroup();
|
|
||||||
schBaseVehiclematerialgroup.setVehicle_code(vehicle_code);
|
|
||||||
schBaseVehiclematerialgroup.setMaterial_qty(jsonObject.getInteger("material_qty"));
|
|
||||||
schBaseVehiclematerialgroup.setMaterial_code(jsonObject.getString("material_code"));
|
|
||||||
schBaseVehiclematerialgroup.setOrder_code(jsonObject.getString("order_code"));
|
|
||||||
schBaseVehiclematerialgroup.setDue_date(jsonObject.getString("due_date"));
|
|
||||||
schBaseVehiclematerialgroup.setCreate_name(SecurityUtils.getCurrentNickName());
|
|
||||||
schBaseVehiclematerialgroup.setRegion_code(region_code);
|
|
||||||
iSchBaseVehiclematerialgroupService.create(schBaseVehiclematerialgroup);
|
|
||||||
});*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -405,7 +382,7 @@ public class HandheldServiceImpl implements HandheldService {
|
|||||||
.eq(SchBaseRegion::getRegion_code, region_code));
|
.eq(SchBaseRegion::getRegion_code, region_code));
|
||||||
if (ObjectUtil.isEmpty(schBaseRegion)) throw new BadRequestException("该区域不存在!");
|
if (ObjectUtil.isEmpty(schBaseRegion)) throw new BadRequestException("该区域不存在!");
|
||||||
List<String> pointCodes = iSchBasePointService.getByRegionCode(region_code);
|
List<String> pointCodes = iSchBasePointService.getByRegionCode(region_code);
|
||||||
if (StrUtil.equals(status, "0")) {
|
if (StrUtil.equals(status, STATUS.get("释放"))) {
|
||||||
iSchBaseTaskService.updateTaskStatusByPointCode(pointCodes);
|
iSchBaseTaskService.updateTaskStatusByPointCode(pointCodes);
|
||||||
if (param.getJSONArray("pointCodes").size() > 0) {
|
if (param.getJSONArray("pointCodes").size() > 0) {
|
||||||
param.getJSONArray("pointCodes").forEach(pointCode -> {
|
param.getJSONArray("pointCodes").forEach(pointCode -> {
|
||||||
@@ -420,7 +397,7 @@ public class HandheldServiceImpl implements HandheldService {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
iSchBasePointService.updatePointLock(region_code, false);
|
iSchBasePointService.updatePointLock(region_code, false);
|
||||||
} else if (StrUtil.equals(status, "1")) {
|
} else if (StrUtil.equals(status, STATUS.get("锁定"))) {
|
||||||
boolean is_executing = iSchBaseTaskService.selectByPointCodeAndStatus(pointCodes);
|
boolean is_executing = iSchBaseTaskService.selectByPointCodeAndStatus(pointCodes);
|
||||||
if (is_executing) {
|
if (is_executing) {
|
||||||
throw new BadRequestException("该区域有任务正在执行,请等待任务执行完成再锁定!");
|
throw new BadRequestException("该区域有任务正在执行,请等待任务执行完成再锁定!");
|
||||||
@@ -577,12 +554,11 @@ public class HandheldServiceImpl implements HandheldService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public JSONObject
|
public JSONObject deviceInLogin(JSONObject json) {
|
||||||
deviceInLogin(JSONObject json) {
|
|
||||||
Assert.notNull(json.getString("device_code"), "登录参数不能为空");
|
Assert.notNull(json.getString("device_code"), "登录参数不能为空");
|
||||||
if (StrUtil.isNotEmpty(json.getString("device_code"))) {
|
if (StrUtil.isNotEmpty(json.getString("device_code"))) {
|
||||||
Object region_code = redisUtils.get("mobile:" + json.getString("device_code"));
|
Object deviceLogin = redisUtils.get("mobile:" + json.getString("device_code"));
|
||||||
if (region_code != null) {
|
if (deviceLogin != null) {
|
||||||
throw new BadRequestException("当前设备工序已经登陆,无法继续选择");
|
throw new BadRequestException("当前设备工序已经登陆,无法继续选择");
|
||||||
} else {
|
} else {
|
||||||
SysParamServiceImpl sysParamService = SpringContextHolder.getBean(SysParamServiceImpl.class);
|
SysParamServiceImpl sysParamService = SpringContextHolder.getBean(SysParamServiceImpl.class);
|
||||||
@@ -599,9 +575,7 @@ public class HandheldServiceImpl implements HandheldService {
|
|||||||
JSONObject map = new JSONObject();
|
JSONObject map = new JSONObject();
|
||||||
map.put("device_code", schBasePoint.getPoint_code());
|
map.put("device_code", schBasePoint.getPoint_code());
|
||||||
map.put("device_name", schBasePoint.getPoint_name());
|
map.put("device_name", schBasePoint.getPoint_name());
|
||||||
String region_points = schBasePoint.getRegion_points();
|
map.put("region_points", JSONUtil.parseArray(schBasePoint.getRegion_points()));
|
||||||
cn.hutool.json.JSONArray jsonArray = JSONUtil.parseArray(region_points);
|
|
||||||
map.put("region_points", jsonArray);
|
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
@@ -102,7 +102,6 @@ public interface ISchBasePointService extends IService<SchBasePoint> {
|
|||||||
*/
|
*/
|
||||||
SchBasePoint selectEmpVehicleByRegionCode(String region_code, String vehicleType);
|
SchBasePoint selectEmpVehicleByRegionCode(String region_code, String vehicleType);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据点位编码查询
|
* 根据点位编码查询
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -84,16 +84,19 @@ public class SchBaseTaskServiceImpl extends ServiceImpl<SchBaseTaskMapper, SchBa
|
|||||||
LambdaQueryWrapper<SchBaseTask> lam = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<SchBaseTask> lam = new LambdaQueryWrapper<>();
|
||||||
lam.eq(ObjectUtil.isNotEmpty(task_code), SchBaseTask::getTask_code, task_code)
|
lam.eq(ObjectUtil.isNotEmpty(task_code), SchBaseTask::getTask_code, task_code)
|
||||||
.eq(ObjectUtil.isNotEmpty(vehicle_code), SchBaseTask::getVehicle_code, vehicle_code)
|
.eq(ObjectUtil.isNotEmpty(vehicle_code), SchBaseTask::getVehicle_code, vehicle_code)
|
||||||
.eq(ObjectUtil.isNotEmpty(point_code), SchBaseTask::getPoint_code1, point_code)
|
|
||||||
.ge(ObjectUtil.isNotEmpty(begin_time), SchBaseTask::getCreate_time, begin_time)
|
.ge(ObjectUtil.isNotEmpty(begin_time), SchBaseTask::getCreate_time, begin_time)
|
||||||
.le(ObjectUtil.isNotEmpty(end_time), SchBaseTask::getCreate_time, end_time)
|
.le(ObjectUtil.isNotEmpty(end_time), SchBaseTask::getCreate_time, end_time)
|
||||||
.le(ObjectUtil.isNotEmpty(unFinished), SchBaseTask::getTask_status, unFinished)
|
.le(ObjectUtil.isNotEmpty(unFinished), SchBaseTask::getTask_status, unFinished);
|
||||||
.orderByDesc(SchBaseTask::getUpdate_time);
|
|
||||||
if (ObjectUtil.isNotEmpty(collect)) {
|
if (ObjectUtil.isNotEmpty(collect)) {
|
||||||
lam.in(SchBaseTask::getTask_status, collect);
|
lam.in(SchBaseTask::getTask_status, collect);
|
||||||
} else {
|
} else {
|
||||||
lam.in(SchBaseTask::getTask_status, TaskStatus.APPLY.getCode(), TaskStatus.CREATED.getCode(), TaskStatus.ISSUED.getCode(), TaskStatus.EXECUTING.getCode(), TaskStatus.TIMEOUT.getCode());
|
lam.in(SchBaseTask::getTask_status, TaskStatus.APPLY.getCode(), TaskStatus.CREATED.getCode(), TaskStatus.ISSUED.getCode(), TaskStatus.EXECUTING.getCode(), TaskStatus.TIMEOUT.getCode());
|
||||||
}
|
}
|
||||||
|
if (ObjectUtil.isNotEmpty(point_code)) {
|
||||||
|
lam.and(wrapper -> wrapper.like(SchBaseTask::getPoint_code1, point_code)
|
||||||
|
.or()
|
||||||
|
.like(SchBaseTask::getPoint_code2, point_code));
|
||||||
|
}
|
||||||
lam.orderByDesc(SchBaseTask::getUpdate_time);
|
lam.orderByDesc(SchBaseTask::getUpdate_time);
|
||||||
IPage<SchBaseTask> pages = new Page<>(page.getPage() + 1, page.getSize());
|
IPage<SchBaseTask> pages = new Page<>(page.getPage() + 1, page.getSize());
|
||||||
schBaseTaskMapper.selectPage(pages, lam);
|
schBaseTaskMapper.selectPage(pages, lam);
|
||||||
@@ -261,10 +264,7 @@ public class SchBaseTaskServiceImpl extends ServiceImpl<SchBaseTaskMapper, SchBa
|
|||||||
// 调用每个任务类的method_name()强制结束方法
|
// 调用每个任务类的method_name()强制结束方法
|
||||||
JSONObject result;
|
JSONObject result;
|
||||||
switch (method_name) {
|
switch (method_name) {
|
||||||
case "immediateNotifyAcs":
|
case "forceFinish":
|
||||||
//
|
|
||||||
break;
|
|
||||||
case "forceFinish": // 强制完成
|
|
||||||
abstractTask.forceFinish(task_code);
|
abstractTask.forceFinish(task_code);
|
||||||
break;
|
break;
|
||||||
case "cancel":
|
case "cancel":
|
||||||
@@ -291,7 +291,6 @@ public class SchBaseTaskServiceImpl extends ServiceImpl<SchBaseTaskMapper, SchBa
|
|||||||
.eq(SchBaseTask::getPoint_code1, pointCode)
|
.eq(SchBaseTask::getPoint_code1, pointCode)
|
||||||
.or()
|
.or()
|
||||||
.eq(SchBaseTask::getPoint_code2, pointCode))
|
.eq(SchBaseTask::getPoint_code2, pointCode))
|
||||||
|
|
||||||
);
|
);
|
||||||
if (CollUtil.isNotEmpty(schBaseTasks) && schBaseTasks.size() > 0) {
|
if (CollUtil.isNotEmpty(schBaseTasks) && schBaseTasks.size() > 0) {
|
||||||
return true;
|
return true;
|
||||||
@@ -363,7 +362,7 @@ public class SchBaseTaskServiceImpl extends ServiceImpl<SchBaseTaskMapper, SchBa
|
|||||||
task.add(item.getUpdate_time());
|
task.add(item.getUpdate_time());
|
||||||
jsonObjects.add(task);
|
jsonObjects.add(task);
|
||||||
});
|
});
|
||||||
String[] tableHeaderArr = {"任务ID","任务编码","任务状态","配置编码","载具类型","载具号","提示信息", "起点", "终点", "创建时间", "修改时间"};
|
String[] tableHeaderArr = {"任务ID", "任务编码", "任务状态", "配置编码", "载具类型", "载具号", "提示信息", "起点", "终点", "创建时间", "修改时间"};
|
||||||
String fileName = "导出文件.csv";
|
String fileName = "导出文件.csv";
|
||||||
byte[] bytes = writeExcelAfterToBytes(tableHeaderArr, jsonObjects);
|
byte[] bytes = writeExcelAfterToBytes(tableHeaderArr, jsonObjects);
|
||||||
responseSetProperties(fileName, bytes, response);
|
responseSetProperties(fileName, bytes, response);
|
||||||
@@ -374,19 +373,22 @@ public class SchBaseTaskServiceImpl extends ServiceImpl<SchBaseTaskMapper, SchBa
|
|||||||
LambdaQueryWrapper<SchBaseTask> lam = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<SchBaseTask> lam = new LambdaQueryWrapper<>();
|
||||||
boolean more_task_status = StrUtil.toString(whereJson.get("more_task_status")).contains(",");
|
boolean more_task_status = StrUtil.toString(whereJson.get("more_task_status")).contains(",");
|
||||||
String[] moreTaskStatuses = new String[5];
|
String[] moreTaskStatuses = new String[5];
|
||||||
if(more_task_status){
|
if (more_task_status) {
|
||||||
moreTaskStatuses = StrUtil.toString(whereJson.get("more_task_status")).split(",");
|
moreTaskStatuses = StrUtil.toString(whereJson.get("more_task_status")).split(",");
|
||||||
}else{
|
} else {
|
||||||
moreTaskStatuses[0] = StrUtil.toString(whereJson.get("more_task_status"));
|
moreTaskStatuses[0] = StrUtil.toString(whereJson.get("more_task_status"));
|
||||||
}
|
}
|
||||||
lam.eq(ObjectUtil.isNotEmpty(whereJson.get("task_code")), SchBaseTask::getTask_code, whereJson.get("task_code"))
|
lam.eq(ObjectUtil.isNotEmpty(whereJson.get("task_code")), SchBaseTask::getTask_code, whereJson.get("task_code"))
|
||||||
.eq(ObjectUtil.isNotEmpty(whereJson.get("vehicle_code")), SchBaseTask::getVehicle_code, whereJson.get("vehicle_code"))
|
.eq(ObjectUtil.isNotEmpty(whereJson.get("vehicle_code")), SchBaseTask::getVehicle_code, whereJson.get("vehicle_code"))
|
||||||
.eq(ObjectUtil.isNotEmpty(whereJson.get("point_code")), SchBaseTask::getPoint_code1, whereJson.get("point_code"))
|
|
||||||
.eq(ObjectUtil.isNotEmpty(whereJson.get("point_code")), SchBaseTask::getPoint_code2, whereJson.get("point_code"))
|
|
||||||
.ge(ObjectUtil.isNotEmpty(whereJson.get("begin_time")), SchBaseTask::getCreate_time, whereJson.get("begin_time"))
|
.ge(ObjectUtil.isNotEmpty(whereJson.get("begin_time")), SchBaseTask::getCreate_time, whereJson.get("begin_time"))
|
||||||
.le(ObjectUtil.isNotEmpty(whereJson.get("end_time")), SchBaseTask::getCreate_time, whereJson.get("end_time"))
|
.le(ObjectUtil.isNotEmpty(whereJson.get("end_time")), SchBaseTask::getCreate_time, whereJson.get("end_time"))
|
||||||
.in(ObjectUtil.isNotEmpty(whereJson.get("more_task_status")), SchBaseTask::getTask_status, moreTaskStatuses)
|
.in(ObjectUtil.isNotEmpty(whereJson.get("more_task_status")), SchBaseTask::getTask_status, moreTaskStatuses)
|
||||||
.orderByDesc(SchBaseTask::getCreate_time);
|
.orderByDesc(SchBaseTask::getCreate_time);
|
||||||
|
if (ObjectUtil.isNotEmpty(whereJson.get("point_code"))) {
|
||||||
|
lam.and(wrapper -> wrapper.like(SchBaseTask::getPoint_code1, whereJson.get("point_code"))
|
||||||
|
.or()
|
||||||
|
.like(SchBaseTask::getPoint_code2, whereJson.get("point_code")));
|
||||||
|
}
|
||||||
return schBaseTaskMapper.selectList(lam);
|
return schBaseTaskMapper.selectList(lam);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -399,7 +401,7 @@ public class SchBaseTaskServiceImpl extends ServiceImpl<SchBaseTaskMapper, SchBa
|
|||||||
writer.write(cellList, true);
|
writer.write(cellList, true);
|
||||||
outputStream = new ByteArrayOutputStream();
|
outputStream = new ByteArrayOutputStream();
|
||||||
writer.flush(outputStream);
|
writer.flush(outputStream);
|
||||||
}catch (Exception e){
|
} catch (Exception e) {
|
||||||
log.error("writeExcelAfterToBytes error:{}", e.getMessage(), e);
|
log.error("writeExcelAfterToBytes error:{}", e.getMessage(), e);
|
||||||
} finally {
|
} finally {
|
||||||
writer.close();
|
writer.close();
|
||||||
@@ -419,7 +421,7 @@ public class SchBaseTaskServiceImpl extends ServiceImpl<SchBaseTaskMapper, SchBa
|
|||||||
outputStream.write(bytes);
|
outputStream.write(bytes);
|
||||||
outputStream.flush();
|
outputStream.flush();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
log.error("iostream error:{}", e.getMessage(), e);
|
log.error("isstream error:{}", e.getMessage(), e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
package org.nl.wms.sch.task_manage.task.tasks.connector;
|
package org.nl.wms.sch.task_manage.task.tasks.connector;
|
||||||
|
|
||||||
|
import cn.hutool.core.date.DateUtil;
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
@@ -19,6 +21,7 @@ import org.nl.wms.sch.task_manage.AbstractTask;
|
|||||||
import org.nl.wms.sch.task_manage.GeneralDefinition;
|
import org.nl.wms.sch.task_manage.GeneralDefinition;
|
||||||
import org.nl.wms.sch.task_manage.enums.NoticeTypeEnum;
|
import org.nl.wms.sch.task_manage.enums.NoticeTypeEnum;
|
||||||
import org.nl.wms.sch.task_manage.enums.TaskFinishedTypeEnum;
|
import org.nl.wms.sch.task_manage.enums.TaskFinishedTypeEnum;
|
||||||
|
import org.nl.wms.sch.task_manage.task.TaskFactory;
|
||||||
import org.nl.wms.sch.task_manage.task.core.TaskStatus;
|
import org.nl.wms.sch.task_manage.task.core.TaskStatus;
|
||||||
import org.nl.wms.sch.task_manage.task.core.TaskType;
|
import org.nl.wms.sch.task_manage.task.core.TaskType;
|
||||||
import org.nl.wms.util.PointUtils;
|
import org.nl.wms.util.PointUtils;
|
||||||
@@ -40,25 +43,22 @@ public class CNTTask extends AbstractTask {
|
|||||||
|
|
||||||
|
|
||||||
private static final String TASK_CONFIG_CODE = "CNTTask";
|
private static final String TASK_CONFIG_CODE = "CNTTask";
|
||||||
|
private static final String[] EMPTY_POINT = {"13-01-01","13-01-03"};
|
||||||
@Autowired
|
@Autowired
|
||||||
private ISchBasePointService pointService;
|
private ISchBasePointService pointService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private ISchBaseTaskService taskService;
|
private ISchBaseTaskService taskService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private ISchBaseTaskconfigService taskConfigService;
|
|
||||||
@Autowired
|
|
||||||
private ISysNoticeService noticeService;
|
private ISysNoticeService noticeService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private ISchBasePointService schBasePointService;
|
private ISchBasePointService schBasePointService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private ISchBaseVehiclematerialgroupService schBaseVehiclematerialgroupService;
|
private TaskFactory taskFactory;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void create() throws BadRequestException {
|
protected void create() throws BadRequestException {
|
||||||
// 获取任务
|
// 获取任务
|
||||||
List<SchBaseTask> tasks = taskService.findTasksByTaskStatus(TASK_CONFIG_CODE, TaskStatus.APPLY);
|
List<SchBaseTask> tasks = taskService.findTasksByTaskStatus(TASK_CONFIG_CODE, TaskStatus.APPLY);
|
||||||
// 配置信息
|
|
||||||
// 定义按数字后缀排序的比较器
|
|
||||||
Comparator<SchBaseTask> numericSuffixComparator = (s1, s2) -> {
|
Comparator<SchBaseTask> numericSuffixComparator = (s1, s2) -> {
|
||||||
Integer suffix1 = getNumericSuffix(s1.getPoint_code1());
|
Integer suffix1 = getNumericSuffix(s1.getPoint_code1());
|
||||||
Integer suffix2 = getNumericSuffix(s2.getPoint_code1());
|
Integer suffix2 = getNumericSuffix(s2.getPoint_code1());
|
||||||
@@ -66,9 +66,8 @@ public class CNTTask extends AbstractTask {
|
|||||||
};
|
};
|
||||||
tasks = tasks.stream().sorted(numericSuffixComparator).collect(Collectors.toList());
|
tasks = tasks.stream().sorted(numericSuffixComparator).collect(Collectors.toList());
|
||||||
for (SchBaseTask task : tasks) {
|
for (SchBaseTask task : tasks) {
|
||||||
// 找起点
|
SchBasePoint schBasePoint = precedencePoint();
|
||||||
SchBasePoint schBasePoint = null;
|
if (ObjectUtil.isEmpty(schBasePoint) && TaskType.CARRY_TASK.getValue().equals(task.getTask_type())) {
|
||||||
if (TaskType.CARRY_TASK.getValue().equals(task.getTask_type())) {
|
|
||||||
schBasePoint = schBasePointService.selectByRegionCode(RegionEnum.LAG_ROBOT_BEANDING_CELL.getRegion_code(), task.getVehicle_code(), "1");
|
schBasePoint = schBasePointService.selectByRegionCode(RegionEnum.LAG_ROBOT_BEANDING_CELL.getRegion_code(), task.getVehicle_code(), "1");
|
||||||
}
|
}
|
||||||
if (ObjectUtil.isEmpty(schBasePoint)) {
|
if (ObjectUtil.isEmpty(schBasePoint)) {
|
||||||
@@ -79,43 +78,62 @@ public class CNTTask extends AbstractTask {
|
|||||||
NoticeTypeEnum.WARN.getCode());
|
NoticeTypeEnum.WARN.getCode());
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
updateTaskStatus(task, schBasePoint);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 设置终点并修改创建成功状态
|
/**
|
||||||
task.setPoint_code2(schBasePoint.getPoint_code());
|
* 修改任务状态
|
||||||
task.setVehicle_type(schBasePoint.getCan_vehicle_type());
|
* @param task
|
||||||
task.setRemark("");
|
* @param schBasePoint
|
||||||
task.setTask_status(TaskStatus.CREATED.getCode());
|
*/
|
||||||
if (task.getPoint_code1().endsWith("1") || task.getPoint_code1().endsWith("3") || task.getPoint_code1().endsWith("5")) {
|
private void updateTaskStatus(SchBaseTask task, SchBasePoint schBasePoint) {
|
||||||
task.setAcs_trace_id("4");
|
task.setPoint_code2(schBasePoint.getPoint_code());
|
||||||
} else {
|
task.setVehicle_type(schBasePoint.getCan_vehicle_type());
|
||||||
if(task.getPoint_code1().endsWith("2")){
|
task.setRemark("");
|
||||||
String replace = task.getPoint_code1().replace("2", "1");
|
task.setTask_status(TaskStatus.CREATED.getCode());
|
||||||
SchBaseTask schBaseTask = taskService.getOne(Wrappers.lambdaQuery(SchBaseTask.class)
|
if (task.getPoint_code1().endsWith("1") || task.getPoint_code1().endsWith("3") || task.getPoint_code1().endsWith("5")) {
|
||||||
.eq(SchBaseTask::getPoint_code1, replace)
|
task.setAcs_trace_id("4");
|
||||||
.le(SchBaseTask::getTask_status,TaskStatus.EXECUTING.getCode()));
|
} else {
|
||||||
if(ObjectUtil.isNotEmpty(schBaseTask)){
|
if(task.getPoint_code1().endsWith("2")){
|
||||||
task.setTask_status(TaskStatus.TIMEOUT.getCode());
|
updateTaskStop("2","1", task);
|
||||||
}
|
} else if(task.getPoint_code1().endsWith("4")){
|
||||||
} else if(task.getPoint_code1().endsWith("4")){
|
updateTaskStop("4","3", task);
|
||||||
String replace = task.getPoint_code1().replace("4", "3");
|
} else if(task.getPoint_code1().endsWith("6")){
|
||||||
SchBaseTask schBaseTask = taskService.getOne(Wrappers.lambdaQuery(SchBaseTask.class)
|
updateTaskStop("6","5", task);
|
||||||
.eq(SchBaseTask::getPoint_code1, replace)
|
|
||||||
.le(SchBaseTask::getTask_status,TaskStatus.EXECUTING.getCode()));
|
|
||||||
if(ObjectUtil.isNotEmpty(schBaseTask)){
|
|
||||||
task.setTask_status(TaskStatus.TIMEOUT.getCode());
|
|
||||||
}
|
|
||||||
} else if(task.getPoint_code1().endsWith("6")){
|
|
||||||
String replace = task.getPoint_code1().replace("6", "5");
|
|
||||||
SchBaseTask schBaseTask = taskService.getOne(Wrappers.lambdaQuery(SchBaseTask.class)
|
|
||||||
.eq(SchBaseTask::getPoint_code1, replace)
|
|
||||||
.le(SchBaseTask::getTask_status,TaskStatus.EXECUTING.getCode()));
|
|
||||||
if(ObjectUtil.isNotEmpty(schBaseTask)){
|
|
||||||
task.setTask_status(TaskStatus.TIMEOUT.getCode());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
TaskUtils.setUpdateByAcs(task);
|
}
|
||||||
taskService.updateById(task);
|
TaskUtils.setUpdateByAcs(task);
|
||||||
|
taskService.updateById(task);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 优先分配点位
|
||||||
|
*/
|
||||||
|
private SchBasePoint precedencePoint() {
|
||||||
|
for (int i = 0; i < EMPTY_POINT.length; i++) {
|
||||||
|
SchBasePoint schBasePoint = schBasePointService.selectByPointCode(EMPTY_POINT[i]);
|
||||||
|
if(ObjectUtil.isNotEmpty(schBasePoint) && schBasePoint.getPoint_status().equals(GoodsEnum.OUT_OF_STOCK.getValue())
|
||||||
|
&& !schBasePoint.getIs_lock()){
|
||||||
|
PointUtils.setUpdateByAcs(schBasePoint);
|
||||||
|
schBasePoint.setIs_lock(true);
|
||||||
|
schBasePointService.updateById(schBasePoint);
|
||||||
|
return schBasePoint;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 将任务设置为暂停
|
||||||
|
*/
|
||||||
|
public void updateTaskStop(String pointCode,String lastPointCode,SchBaseTask task){
|
||||||
|
String replace = task.getPoint_code1().replace(pointCode, lastPointCode);
|
||||||
|
SchBaseTask schBaseTask = taskService.getOne(Wrappers.lambdaQuery(SchBaseTask.class)
|
||||||
|
.eq(SchBaseTask::getPoint_code1, replace)
|
||||||
|
.le(SchBaseTask::getTask_status,TaskStatus.EXECUTING.getCode()));
|
||||||
|
if(ObjectUtil.isNotEmpty(schBaseTask)){
|
||||||
|
task.setTask_status(TaskStatus.TIMEOUT.getCode());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -146,21 +164,21 @@ public class CNTTask extends AbstractTask {
|
|||||||
//TODO:取消任务的时候将int_task_code的清除
|
//TODO:取消任务的时候将int_task_code的清除
|
||||||
SchBaseTask taskObj = taskService.getByCode(task_code);
|
SchBaseTask taskObj = taskService.getByCode(task_code);
|
||||||
SchBasePoint schBasePoint = schBasePointService.selectByPointCode(taskObj.getPoint_code1());
|
SchBasePoint schBasePoint = schBasePointService.selectByPointCode(taskObj.getPoint_code1());
|
||||||
|
updateCancelPoint(schBasePoint);
|
||||||
|
SchBasePoint schBasePoint1 = schBasePointService.selectByPointCode(taskObj.getPoint_code2());
|
||||||
|
updateCancelPoint(schBasePoint1);
|
||||||
|
if (ObjectUtil.isEmpty(taskObj)) {
|
||||||
|
throw new BadRequestException("该任务不存在");
|
||||||
|
}
|
||||||
|
this.cancelTask(taskObj, TaskFinishedTypeEnum.MANUAL_CONNECTOR);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateCancelPoint(SchBasePoint schBasePoint) {
|
||||||
if (ObjectUtil.isNotEmpty(schBasePoint)) {
|
if (ObjectUtil.isNotEmpty(schBasePoint)) {
|
||||||
schBasePoint.setIs_lock(false);
|
schBasePoint.setIs_lock(false);
|
||||||
PointUtils.setUpdateByAcs(schBasePoint);
|
PointUtils.setUpdateByAcs(schBasePoint);
|
||||||
schBasePointService.updateById(schBasePoint);
|
schBasePointService.updateById(schBasePoint);
|
||||||
}
|
}
|
||||||
SchBasePoint schBasePoint1 = schBasePointService.selectByPointCode(taskObj.getPoint_code2());
|
|
||||||
if (ObjectUtil.isNotEmpty(schBasePoint1)) {
|
|
||||||
schBasePoint1.setIs_lock(false);
|
|
||||||
PointUtils.setUpdateByAcs(schBasePoint1);
|
|
||||||
schBasePointService.updateById(schBasePoint1);
|
|
||||||
}
|
|
||||||
if (ObjectUtil.isEmpty(taskObj)) {
|
|
||||||
throw new BadRequestException("该任务不存在");
|
|
||||||
}
|
|
||||||
this.cancelTask(taskObj, TaskFinishedTypeEnum.MANUAL_CONNECTOR);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -169,14 +187,51 @@ public class CNTTask extends AbstractTask {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void finishTask(SchBaseTask taskObj, TaskFinishedTypeEnum taskFinishedType) {
|
public void finishTask(SchBaseTask taskObj, TaskFinishedTypeEnum taskFinishedType) {
|
||||||
// 获取参数
|
//修改点位状态
|
||||||
|
updatePointStatus(taskObj);
|
||||||
|
//生成移库任务
|
||||||
|
moveTheLibraryTask(taskObj);
|
||||||
|
taskObj.setTask_status(TaskStatus.FINISHED.getCode());
|
||||||
|
taskObj.setRemark(GeneralDefinition.TASK_FINISH);
|
||||||
|
taskObj.setFinished_type(taskFinishedType.getCode());
|
||||||
|
TaskUtils.setUpdateByType(taskObj, taskFinishedType);
|
||||||
|
taskService.updateById(taskObj);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生成移库任务
|
||||||
|
* @param taskObj
|
||||||
|
*/
|
||||||
|
private void moveTheLibraryTask(SchBaseTask taskObj) {
|
||||||
|
AbstractTask connectorTask = taskFactory.getTask("CNTTask");
|
||||||
|
for (int i = 0; i < EMPTY_POINT.length; i++) {
|
||||||
|
String pointName = EMPTY_POINT[i];
|
||||||
|
if(StrUtil.equals(pointName, taskObj.getPoint_code2())){
|
||||||
|
JSONObject param = new JSONObject();
|
||||||
|
param.put("device_code", pointName);
|
||||||
|
param.put("config_code", "CNTTask");
|
||||||
|
param.put("create_mode", GeneralDefinition.AUTO_CREATION);
|
||||||
|
param.put("vehicle_code", taskObj.getVehicle_code());
|
||||||
|
param.put("task_type", "1");
|
||||||
|
connectorTask.apply(param);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改点位状态
|
||||||
|
* @param taskObj
|
||||||
|
*/
|
||||||
|
private void updatePointStatus(SchBaseTask taskObj) {
|
||||||
String startPoint = taskObj.getPoint_code1();
|
String startPoint = taskObj.getPoint_code1();
|
||||||
SchBasePoint schBasePoint = pointService.selectByPointCode(startPoint);
|
SchBasePoint schBasePoint = pointService.selectByPointCode(startPoint);
|
||||||
// 起点清空
|
|
||||||
if (ObjectUtil.isNotEmpty(schBasePoint)) {
|
if (ObjectUtil.isNotEmpty(schBasePoint)) {
|
||||||
schBasePoint.setIs_lock(false);
|
schBasePointService.update(Wrappers.lambdaUpdate(SchBasePoint.class)
|
||||||
PointUtils.setUpdateByAcs(schBasePoint);
|
.eq(SchBasePoint::getPoint_code, startPoint)
|
||||||
schBasePointService.updateById(schBasePoint);
|
.set(SchBasePoint::getIs_lock, false)
|
||||||
|
.set(SchBasePoint::getVehicle_code,null)
|
||||||
|
.set(SchBasePoint::getPoint_status, GoodsEnum.OUT_OF_STOCK.getValue())
|
||||||
|
.set(SchBasePoint::getUpdate_time, DateUtil.now()));
|
||||||
}
|
}
|
||||||
String endPoint = taskObj.getPoint_code2();
|
String endPoint = taskObj.getPoint_code2();
|
||||||
SchBasePoint schBasePoint2 = pointService.selectByPointCode(endPoint);
|
SchBasePoint schBasePoint2 = pointService.selectByPointCode(endPoint);
|
||||||
@@ -187,16 +242,9 @@ public class CNTTask extends AbstractTask {
|
|||||||
PointUtils.setUpdateByAcs(schBasePoint2);
|
PointUtils.setUpdateByAcs(schBasePoint2);
|
||||||
schBasePointService.updateById(schBasePoint2);
|
schBasePointService.updateById(schBasePoint2);
|
||||||
}
|
}
|
||||||
// 任务完成
|
|
||||||
taskObj.setTask_status(TaskStatus.FINISHED.getCode());
|
|
||||||
taskObj.setRemark(GeneralDefinition.TASK_FINISH);
|
|
||||||
taskObj.setFinished_type(taskFinishedType.getCode());
|
|
||||||
TaskUtils.setUpdateByType(taskObj, taskFinishedType);
|
|
||||||
taskService.updateById(taskObj);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void cancelTask(SchBaseTask taskObj, TaskFinishedTypeEnum taskFinishedType) {
|
public void cancelTask(SchBaseTask taskObj, TaskFinishedTypeEnum taskFinishedType) {
|
||||||
|
|
||||||
taskObj.setRemark(GeneralDefinition.TASK_CANCEL);
|
taskObj.setRemark(GeneralDefinition.TASK_CANCEL);
|
||||||
taskObj.setTask_status(TaskStatus.CANCELED.getCode());
|
taskObj.setTask_status(TaskStatus.CANCELED.getCode());
|
||||||
taskObj.setFinished_type(taskFinishedType.getCode());
|
taskObj.setFinished_type(taskFinishedType.getCode());
|
||||||
|
|||||||
@@ -1,13 +1,18 @@
|
|||||||
package org.nl.wms.sch.task_manage.task.tasks.connector;
|
package org.nl.wms.sch.task_manage.task.tasks.connector;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.nl.common.enums.GoodsEnum;
|
import org.nl.common.enums.GoodsEnum;
|
||||||
import org.nl.common.enums.region.RegionEnum;
|
import org.nl.common.enums.region.RegionEnum;
|
||||||
import org.nl.common.exception.BadRequestException;
|
import org.nl.common.exception.BadRequestException;
|
||||||
import org.nl.system.service.notice.ISysNoticeService;
|
import org.nl.system.service.notice.ISysNoticeService;
|
||||||
|
import org.nl.wms.database.vehicle.service.IMdBaseVehicleService;
|
||||||
|
import org.nl.wms.database.vehicle.service.dao.MdBaseVehicle;
|
||||||
import org.nl.wms.ext.acs.service.dto.to.BaseResponse;
|
import org.nl.wms.ext.acs.service.dto.to.BaseResponse;
|
||||||
import org.nl.wms.sch.group.service.ISchBaseVehiclematerialgroupService;
|
import org.nl.wms.sch.group.service.ISchBaseVehiclematerialgroupService;
|
||||||
import org.nl.wms.sch.point.service.ISchBasePointService;
|
import org.nl.wms.sch.point.service.ISchBasePointService;
|
||||||
@@ -19,6 +24,7 @@ import org.nl.wms.sch.task_manage.AbstractTask;
|
|||||||
import org.nl.wms.sch.task_manage.GeneralDefinition;
|
import org.nl.wms.sch.task_manage.GeneralDefinition;
|
||||||
import org.nl.wms.sch.task_manage.enums.NoticeTypeEnum;
|
import org.nl.wms.sch.task_manage.enums.NoticeTypeEnum;
|
||||||
import org.nl.wms.sch.task_manage.enums.TaskFinishedTypeEnum;
|
import org.nl.wms.sch.task_manage.enums.TaskFinishedTypeEnum;
|
||||||
|
import org.nl.wms.sch.task_manage.task.TaskFactory;
|
||||||
import org.nl.wms.sch.task_manage.task.core.TaskStatus;
|
import org.nl.wms.sch.task_manage.task.core.TaskStatus;
|
||||||
import org.nl.wms.util.PointUtils;
|
import org.nl.wms.util.PointUtils;
|
||||||
import org.nl.wms.util.TaskUtils;
|
import org.nl.wms.util.TaskUtils;
|
||||||
@@ -26,6 +32,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
@@ -39,6 +46,7 @@ public class FTGTask extends AbstractTask {
|
|||||||
|
|
||||||
|
|
||||||
private static final String TASK_CONFIG_CODE = "FTGTask";
|
private static final String TASK_CONFIG_CODE = "FTGTask";
|
||||||
|
private static final String[] EMPTY_POINT = {"13-01-02","13-01-04"};
|
||||||
@Autowired
|
@Autowired
|
||||||
private ISchBasePointService pointService;
|
private ISchBasePointService pointService;
|
||||||
@Autowired
|
@Autowired
|
||||||
@@ -51,6 +59,10 @@ public class FTGTask extends AbstractTask {
|
|||||||
private ISchBasePointService schBasePointService;
|
private ISchBasePointService schBasePointService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private ISchBaseVehiclematerialgroupService schBaseVehiclematerialgroupService;
|
private ISchBaseVehiclematerialgroupService schBaseVehiclematerialgroupService;
|
||||||
|
@Autowired
|
||||||
|
private TaskFactory taskFactory;
|
||||||
|
@Autowired
|
||||||
|
private IMdBaseVehicleService mdBaseVehicleService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
@@ -58,8 +70,11 @@ public class FTGTask extends AbstractTask {
|
|||||||
// 获取任务
|
// 获取任务
|
||||||
List<SchBaseTask> tasks = taskService.findTasksByTaskStatus(TASK_CONFIG_CODE, TaskStatus.APPLY);
|
List<SchBaseTask> tasks = taskService.findTasksByTaskStatus(TASK_CONFIG_CODE, TaskStatus.APPLY);
|
||||||
for (SchBaseTask task : tasks) {
|
for (SchBaseTask task : tasks) {
|
||||||
// 查找空载具点位
|
//获取空托盘点位
|
||||||
SchBasePoint schBasePoint = schBasePointService.selectEmpVehicleByRegionCode(RegionEnum.LAG_ROBOT_BEANDING_CELL.getRegion_code(), task.getVehicle_type());
|
SchBasePoint schBasePoint = precedencePoint();
|
||||||
|
if(ObjectUtil.isEmpty(schBasePoint)) {
|
||||||
|
schBasePoint = schBasePointService.selectEmpVehicleByRegionCode(RegionEnum.LAG_ROBOT_BEANDING_CELL.getRegion_code(), task.getVehicle_type());
|
||||||
|
}
|
||||||
if (ObjectUtil.isEmpty(schBasePoint)) {
|
if (ObjectUtil.isEmpty(schBasePoint)) {
|
||||||
task.setRemark("未找到所需点位!");
|
task.setRemark("未找到所需点位!");
|
||||||
taskService.updateById(task);
|
taskService.updateById(task);
|
||||||
@@ -68,7 +83,6 @@ public class FTGTask extends AbstractTask {
|
|||||||
NoticeTypeEnum.WARN.getCode());
|
NoticeTypeEnum.WARN.getCode());
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 设置终点并修改创建成功状态
|
// 设置终点并修改创建成功状态
|
||||||
task.setPoint_code1(schBasePoint.getPoint_code());
|
task.setPoint_code1(schBasePoint.getPoint_code());
|
||||||
task.setVehicle_type(schBasePoint.getCan_vehicle_type());
|
task.setVehicle_type(schBasePoint.getCan_vehicle_type());
|
||||||
@@ -80,6 +94,20 @@ public class FTGTask extends AbstractTask {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private SchBasePoint precedencePoint() {
|
||||||
|
for (String s : EMPTY_POINT) {
|
||||||
|
SchBasePoint schBasePoint = schBasePointService.selectByPointCode(s);
|
||||||
|
if (ObjectUtil.isNotEmpty(schBasePoint) && schBasePoint.getPoint_status().equals(GoodsEnum.EMPTY_PALLETS.getValue())
|
||||||
|
&& !schBasePoint.getIs_lock() && StrUtil.isNotEmpty(schBasePoint.getVehicle_code())) {
|
||||||
|
schBasePoint.setIs_lock(true);
|
||||||
|
PointUtils.setUpdateByAcs(schBasePoint);
|
||||||
|
schBasePointService.updateById(schBasePoint);
|
||||||
|
return schBasePoint;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
private static Integer getNumericSuffix(String filename) {
|
private static Integer getNumericSuffix(String filename) {
|
||||||
// 提取数字后缀
|
// 提取数字后缀
|
||||||
String suffix = filename.replaceAll(".*?(\\d+)$", "$1");
|
String suffix = filename.replaceAll(".*?(\\d+)$", "$1");
|
||||||
@@ -118,23 +146,15 @@ public class FTGTask extends AbstractTask {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void finishTask(SchBaseTask taskObj, TaskFinishedTypeEnum taskFinishedType) {
|
public void finishTask(SchBaseTask taskObj, TaskFinishedTypeEnum taskFinishedType) {
|
||||||
// 获取参数
|
updateFinishPoint(taskObj.getPoint_code1(), taskObj, GoodsEnum.OUT_OF_STOCK.getValue(),0);
|
||||||
String startPoint = taskObj.getPoint_code1();
|
|
||||||
SchBasePoint schBasePoint = pointService.selectByPointCode(startPoint);
|
|
||||||
if (ObjectUtil.isNotEmpty(schBasePoint)) {
|
|
||||||
pointService.update(Wrappers.lambdaUpdate(SchBasePoint.class)
|
|
||||||
.eq(SchBasePoint::getPoint_code, startPoint)
|
|
||||||
.set(SchBasePoint::getIs_lock, false)
|
|
||||||
.set(SchBasePoint::getPoint_status, GoodsEnum.OUT_OF_STOCK.getValue())
|
|
||||||
.set(SchBasePoint::getVehicle_code, null));
|
|
||||||
}
|
|
||||||
String endPoint = taskObj.getPoint_code2();
|
String endPoint = taskObj.getPoint_code2();
|
||||||
SchBasePoint schBasePoint2 = pointService.selectByPointCode(endPoint);
|
if(CollUtil.contains(Arrays.asList(EMPTY_POINT),endPoint)){
|
||||||
if (ObjectUtil.isNotEmpty(schBasePoint2)) {
|
updateFinishPoint(endPoint,taskObj, GoodsEnum.EMPTY_PALLETS.getValue(),1);
|
||||||
pointService.update(Wrappers.lambdaUpdate(SchBasePoint.class)
|
}else{
|
||||||
.eq(SchBasePoint::getPoint_code, endPoint)
|
updateFinishPoint(endPoint,taskObj, null,0);
|
||||||
.set(SchBasePoint::getIs_lock, false));
|
|
||||||
}
|
}
|
||||||
|
//叫空完成后生成补空任务
|
||||||
|
paddingEmptyTask(taskObj);
|
||||||
// 任务完成
|
// 任务完成
|
||||||
taskObj.setTask_status(TaskStatus.FINISHED.getCode());
|
taskObj.setTask_status(TaskStatus.FINISHED.getCode());
|
||||||
taskObj.setRemark(GeneralDefinition.TASK_FINISH);
|
taskObj.setRemark(GeneralDefinition.TASK_FINISH);
|
||||||
@@ -143,6 +163,60 @@ public class FTGTask extends AbstractTask {
|
|||||||
taskService.updateById(taskObj);
|
taskService.updateById(taskObj);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 补空任务
|
||||||
|
* @param taskObj
|
||||||
|
*/
|
||||||
|
private void paddingEmptyTask(SchBaseTask taskObj) {
|
||||||
|
AbstractTask connectorTask = taskFactory.getTask("FTGTask");
|
||||||
|
MdBaseVehicle mdBaseVehicle = mdBaseVehicleService.selectByVehicleCode(taskObj.getVehicle_code());
|
||||||
|
if(ObjectUtil.isEmpty(mdBaseVehicle)){
|
||||||
|
throw new BadRequestException("托盘号不存在!");
|
||||||
|
}
|
||||||
|
for (int i = 0; i < EMPTY_POINT.length; i++) {
|
||||||
|
String pointName = EMPTY_POINT[i];
|
||||||
|
if(StrUtil.equals(pointName, taskObj.getPoint_code1())){
|
||||||
|
JSONObject param = new JSONObject();
|
||||||
|
param.put("device_code", pointName);
|
||||||
|
param.put("config_code", "FTGTask");
|
||||||
|
param.put("create_mode", GeneralDefinition.AUTO_CREATION);
|
||||||
|
param.put("vehicle_type", mdBaseVehicle.getVehicle_type());
|
||||||
|
connectorTask.apply(param);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新完成点位
|
||||||
|
* @param startPoint
|
||||||
|
* @param schBasePoint
|
||||||
|
* @param pointStatus
|
||||||
|
*/
|
||||||
|
private void updateFinishPoint(String point, SchBaseTask taskObj, String pointStatus, int status) {
|
||||||
|
SchBasePoint schBasePoint = pointService.selectByPointCode(point);
|
||||||
|
if (ObjectUtil.isNotEmpty(schBasePoint)) {
|
||||||
|
try {
|
||||||
|
LambdaUpdateWrapper<SchBasePoint> updateWrapper = Wrappers.lambdaUpdate(SchBasePoint.class)
|
||||||
|
.eq(SchBasePoint::getPoint_code, point)
|
||||||
|
.set(SchBasePoint::getIs_lock, false);
|
||||||
|
if (StrUtil.isNotEmpty(pointStatus)) {
|
||||||
|
if (status == 0) {
|
||||||
|
updateWrapper.set(SchBasePoint::getPoint_status, pointStatus)
|
||||||
|
.set(SchBasePoint::getVehicle_code, null);
|
||||||
|
} else if (status == 1) {
|
||||||
|
updateWrapper.set(SchBasePoint::getPoint_status, pointStatus)
|
||||||
|
.set(SchBasePoint::getVehicle_code, taskObj.getVehicle_code());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
pointService.update(updateWrapper);
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("Failed to update point with code: {}", point, e);
|
||||||
|
throw new RuntimeException("Failed to update point", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public void cancelTask(SchBaseTask taskObj, TaskFinishedTypeEnum taskFinishedType) {
|
public void cancelTask(SchBaseTask taskObj, TaskFinishedTypeEnum taskFinishedType) {
|
||||||
SchBasePoint schBasePoint = schBasePointService.selectByPointCode(taskObj.getPoint_code1());
|
SchBasePoint schBasePoint = schBasePointService.selectByPointCode(taskObj.getPoint_code1());
|
||||||
if (ObjectUtil.isNotEmpty(schBasePoint)) {
|
if (ObjectUtil.isNotEmpty(schBasePoint)) {
|
||||||
|
|||||||
@@ -84,8 +84,6 @@ public class RackTask extends AbstractTask {
|
|||||||
task.setTask_status(TaskStatus.CREATED.getCode());
|
task.setTask_status(TaskStatus.CREATED.getCode());
|
||||||
TaskUtils.setUpdateByAcs(task);
|
TaskUtils.setUpdateByAcs(task);
|
||||||
taskService.updateById(task);
|
taskService.updateById(task);
|
||||||
|
|
||||||
|
|
||||||
schBasePoint.setIs_lock(true);
|
schBasePoint.setIs_lock(true);
|
||||||
PointUtils.setUpdateByAcs(schBasePoint);
|
PointUtils.setUpdateByAcs(schBasePoint);
|
||||||
pointService.updateById(schBasePoint);
|
pointService.updateById(schBasePoint);
|
||||||
|
|||||||
@@ -130,28 +130,12 @@ public class PcOperationSMTTask extends AbstractTask {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void finishTask(SchBaseTask taskObj, TaskFinishedTypeEnum taskFinishedType) {
|
public void finishTask(SchBaseTask taskObj, TaskFinishedTypeEnum taskFinishedType) {
|
||||||
// 获取参数
|
|
||||||
String startPoint = taskObj.getPoint_code1();
|
String startPoint = taskObj.getPoint_code1();
|
||||||
SchBasePoint schBasePoint = pointService.selectByPointCode(startPoint);
|
SchBasePoint schBasePoint = pointService.selectByPointCode(startPoint);
|
||||||
// 起点清空
|
updatePointStatus(schBasePoint, null, GoodsEnum.OUT_OF_STOCK.getValue());
|
||||||
if (ObjectUtil.isNotEmpty(schBasePoint)) {
|
String endPoint = taskObj.getPoint_code2();
|
||||||
PointUtils.updateByIngTaskCode(schBasePoint);
|
SchBasePoint schBasePoint2 = pointService.selectByPointCode(endPoint);
|
||||||
pointService.update(Wrappers.lambdaUpdate(SchBasePoint.class)
|
updatePointStatus(schBasePoint, taskObj.getVehicle_code(), GoodsEnum.IN_STOCK.getValue());
|
||||||
.eq(SchBasePoint::getPoint_code, startPoint)
|
|
||||||
.set(SchBasePoint::getIs_lock, false)
|
|
||||||
.set(SchBasePoint::getVehicle_code, null)
|
|
||||||
.set(SchBasePoint::getPoint_status, GoodsEnum.OUT_OF_STOCK.getValue()));
|
|
||||||
}
|
|
||||||
String point_code2 = taskObj.getPoint_code2();
|
|
||||||
SchBasePoint schBasePoint2 = pointService.selectByPointCode(point_code2);
|
|
||||||
if (ObjectUtil.isNotEmpty(schBasePoint2)) {
|
|
||||||
PointUtils.updateByIngTaskCode(schBasePoint2);
|
|
||||||
pointService.update(Wrappers.lambdaUpdate(SchBasePoint.class)
|
|
||||||
.eq(SchBasePoint::getPoint_code, point_code2)
|
|
||||||
.set(SchBasePoint::getVehicle_code, taskObj.getVehicle_code())
|
|
||||||
.set(SchBasePoint::getPoint_status, GoodsEnum.IN_STOCK.getValue())
|
|
||||||
.set(SchBasePoint::getIs_lock, false));
|
|
||||||
}
|
|
||||||
SendMaterVo sendMaterVo = JSONObject.parseObject(taskObj.getRequest_param(),SendMaterVo.class);
|
SendMaterVo sendMaterVo = JSONObject.parseObject(taskObj.getRequest_param(),SendMaterVo.class);
|
||||||
List<SendMaterVo> sendMaterVos = new ArrayList<>();
|
List<SendMaterVo> sendMaterVos = new ArrayList<>();
|
||||||
sendMaterVo.getMaterial_info().forEach(materVo -> {
|
sendMaterVo.getMaterial_info().forEach(materVo -> {
|
||||||
@@ -181,6 +165,20 @@ public class PcOperationSMTTask extends AbstractTask {
|
|||||||
taskService.updateById(taskObj);
|
taskService.updateById(taskObj);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改点位状态
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public void updatePointStatus(SchBasePoint schBasePoint,String vehicleCode,String pointType){
|
||||||
|
if (ObjectUtil.isNotEmpty(schBasePoint)) {
|
||||||
|
pointService.update(Wrappers.lambdaUpdate(SchBasePoint.class)
|
||||||
|
.eq(SchBasePoint::getPoint_code, schBasePoint.getPoint_code())
|
||||||
|
.set(SchBasePoint::getVehicle_code, vehicleCode)
|
||||||
|
.set(SchBasePoint::getPoint_status, pointType)
|
||||||
|
.set(SchBasePoint::getIs_lock, false));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void cancelTask(SchBaseTask taskObj, TaskFinishedTypeEnum taskFinishedType) {
|
public void cancelTask(SchBaseTask taskObj, TaskFinishedTypeEnum taskFinishedType) {
|
||||||
// 获取参数
|
// 获取参数
|
||||||
SchBasePoint schBasePoint1 = schBasePointService.selectByPointCode(taskObj.getPoint_code2());
|
SchBasePoint schBasePoint1 = schBasePointService.selectByPointCode(taskObj.getPoint_code2());
|
||||||
|
|||||||
@@ -117,52 +117,52 @@ public class PcOperationSNTTask extends AbstractTask {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void updatePointStatus(SchBasePoint point, String pointCode, String vehicleCode, GoodsEnum status) {
|
||||||
|
if (ObjectUtil.isNotEmpty(point)) {
|
||||||
|
log.info("开始更新点位状态,点位编码:{}", pointCode);
|
||||||
|
try {
|
||||||
|
pointService.update(Wrappers.lambdaUpdate(SchBasePoint.class)
|
||||||
|
.eq(SchBasePoint::getPoint_code, pointCode)
|
||||||
|
.set(SchBasePoint::getIs_lock, false)
|
||||||
|
.set(SchBasePoint::getVehicle_code, vehicleCode)
|
||||||
|
.set(SchBasePoint::getPoint_status, status.getValue()));
|
||||||
|
log.info("点位状态更新成功,点位编码:{}", pointCode);
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("更新点位状态失败,点位编码:{}", pointCode, e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void finishTask(SchBaseTask taskObj, TaskFinishedTypeEnum taskFinishedType) {
|
public void finishTask(SchBaseTask taskObj, TaskFinishedTypeEnum taskFinishedType) {
|
||||||
// 获取参数
|
log.info("开始完成任务,任务 ID:{}", taskObj.getTask_code());
|
||||||
String startPoint = taskObj.getPoint_code1();
|
try {
|
||||||
SchBasePoint schBasePoint = pointService.selectByPointCode(startPoint);
|
// 获取起点信息并更新状态
|
||||||
// 起点清空
|
String startPoint = taskObj.getPoint_code1();
|
||||||
if (ObjectUtil.isNotEmpty(schBasePoint)) {
|
SchBasePoint schBasePoint = pointService.selectByPointCode(startPoint);
|
||||||
PointUtils.updateByIngTaskCode(schBasePoint);
|
updatePointStatus(schBasePoint, startPoint, null, GoodsEnum.OUT_OF_STOCK);
|
||||||
pointService.update(Wrappers.lambdaUpdate(SchBasePoint.class)
|
|
||||||
.eq(SchBasePoint::getPoint_code, startPoint)
|
// 获取终点信息并更新状态
|
||||||
.set(SchBasePoint::getIs_lock, false)
|
String endPoint = taskObj.getPoint_code2();
|
||||||
.set(SchBasePoint::getVehicle_code, null)
|
SchBasePoint schBasePoint2 = pointService.selectByPointCode(endPoint);
|
||||||
.set(SchBasePoint::getPoint_status, GoodsEnum.OUT_OF_STOCK.getValue()));
|
updatePointStatus(schBasePoint2, endPoint, taskObj.getVehicle_code(), GoodsEnum.EMPTY_PALLETS);
|
||||||
|
|
||||||
|
// 任务完成
|
||||||
|
taskObj.setTask_status(TaskStatus.FINISHED.getCode());
|
||||||
|
taskObj.setRemark(GeneralDefinition.TASK_FINISH);
|
||||||
|
taskObj.setFinished_type(taskFinishedType.getCode());
|
||||||
|
TaskUtils.setUpdateByType(taskObj, taskFinishedType);
|
||||||
|
taskService.updateById(taskObj);
|
||||||
|
log.info("任务完成成功,任务 ID:{}", taskObj.getTask_code());
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("完成任务失败,任务 ID:{}", taskObj.getTask_code(), e);
|
||||||
}
|
}
|
||||||
String point_code2 = taskObj.getPoint_code2();
|
|
||||||
SchBasePoint schBasePoint2 = pointService.selectByPointCode(point_code2);
|
|
||||||
if (ObjectUtil.isNotEmpty(schBasePoint2)) {
|
|
||||||
PointUtils.updateByIngTaskCode(schBasePoint2);
|
|
||||||
pointService.update(Wrappers.lambdaUpdate(SchBasePoint.class)
|
|
||||||
.eq(SchBasePoint::getPoint_code, point_code2)
|
|
||||||
.set(SchBasePoint::getIs_lock, false)
|
|
||||||
.set(SchBasePoint::getPoint_status, GoodsEnum.EMPTY_PALLETS.getValue())
|
|
||||||
.set(SchBasePoint::getVehicle_code, taskObj.getVehicle_code()));
|
|
||||||
}
|
|
||||||
// 任务完成
|
|
||||||
taskObj.setTask_status(TaskStatus.FINISHED.getCode());
|
|
||||||
taskObj.setRemark(GeneralDefinition.TASK_FINISH);
|
|
||||||
taskObj.setFinished_type(taskFinishedType.getCode());
|
|
||||||
TaskUtils.setUpdateByType(taskObj, taskFinishedType);
|
|
||||||
taskService.updateById(taskObj);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void cancelTask(SchBaseTask taskObj, TaskFinishedTypeEnum taskFinishedType) {
|
public void cancelTask(SchBaseTask taskObj, TaskFinishedTypeEnum taskFinishedType) {
|
||||||
// 获取参数
|
SchBasePoint endPoint = schBasePointService.selectByPointCode(taskObj.getPoint_code2());
|
||||||
SchBasePoint schBasePoint1 = schBasePointService.selectByPointCode(taskObj.getPoint_code2());
|
updatePointStatus(endPoint);
|
||||||
if (ObjectUtil.isNotEmpty(schBasePoint1)) {
|
SchBasePoint startPoint = schBasePointService.selectByPointCode(taskObj.getPoint_code1());
|
||||||
schBasePoint1.setIs_lock(false);
|
updatePointStatus(startPoint);
|
||||||
PointUtils.setUpdateByAcs(schBasePoint1);
|
|
||||||
schBasePointService.updateById(schBasePoint1);
|
|
||||||
}
|
|
||||||
SchBasePoint schBasePoint = schBasePointService.selectByPointCode(taskObj.getPoint_code1());
|
|
||||||
if (ObjectUtil.isNotEmpty(schBasePoint)) {
|
|
||||||
schBasePoint.setIs_lock(false);
|
|
||||||
PointUtils.setUpdateByAcs(schBasePoint);
|
|
||||||
schBasePointService.updateById(schBasePoint);
|
|
||||||
}
|
|
||||||
|
|
||||||
taskObj.setRemark(GeneralDefinition.TASK_CANCEL);
|
taskObj.setRemark(GeneralDefinition.TASK_CANCEL);
|
||||||
taskObj.setTask_status(TaskStatus.CANCELED.getCode());
|
taskObj.setTask_status(TaskStatus.CANCELED.getCode());
|
||||||
taskObj.setFinished_type(taskFinishedType.getCode());
|
taskObj.setFinished_type(taskFinishedType.getCode());
|
||||||
@@ -170,4 +170,16 @@ public class PcOperationSNTTask extends AbstractTask {
|
|||||||
taskService.updateById(taskObj);
|
taskService.updateById(taskObj);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void updatePointStatus(SchBasePoint schBasePoint1) {
|
||||||
|
try {
|
||||||
|
if (ObjectUtil.isNotEmpty(schBasePoint1)) {
|
||||||
|
schBasePoint1.setIs_lock(false);
|
||||||
|
PointUtils.setUpdateByAcs(schBasePoint1);
|
||||||
|
schBasePointService.updateById(schBasePoint1);
|
||||||
|
}
|
||||||
|
}catch (Exception e){
|
||||||
|
log.info("更新点位状态失败,点位编码:{}", schBasePoint1.getPoint_code(), e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -47,6 +47,7 @@ import org.nl.wms.util.PrintUtil;
|
|||||||
import org.nl.wms.util.TaskUtils;
|
import org.nl.wms.util.TaskUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
@@ -155,36 +156,14 @@ public class ProcessingSMTTask extends AbstractTask {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 完成任务
|
||||||
|
*/
|
||||||
|
@Transactional
|
||||||
public void finishTask(SchBaseTask taskObj, TaskFinishedTypeEnum taskFinishedType) {
|
public void finishTask(SchBaseTask taskObj, TaskFinishedTypeEnum taskFinishedType) {
|
||||||
// 获取参数
|
log.info("开始完成任务:{},", taskObj.getTask_code());
|
||||||
String startPoint = taskObj.getPoint_code1();
|
updateStartPointStatus(taskObj);
|
||||||
SchBasePoint schBasePoint = pointService.selectByPointCode(startPoint);
|
updateEndPointStatus(taskObj);
|
||||||
// 起点清空
|
|
||||||
if (ObjectUtil.isNotEmpty(schBasePoint)) {
|
|
||||||
pointService.update(Wrappers.lambdaUpdate(SchBasePoint.class)
|
|
||||||
.eq(SchBasePoint::getPoint_code, startPoint)
|
|
||||||
.set(SchBasePoint::getVehicle_code, null)
|
|
||||||
.set(SchBasePoint::getPoint_status, GoodsEnum.OUT_OF_STOCK.getValue())
|
|
||||||
.set(SchBasePoint::getIs_lock, false));
|
|
||||||
}
|
|
||||||
String point_code2 = taskObj.getPoint_code2();
|
|
||||||
SchBasePoint schBasePoint2 = pointService.selectByPointCode(point_code2);
|
|
||||||
if (ObjectUtil.isNotEmpty(schBasePoint2)) {
|
|
||||||
String point_status = GoodsEnum.IN_STOCK.getValue();
|
|
||||||
Boolean point_type = false;
|
|
||||||
if (point_code2.contains("NBJGKLLDJW")) {
|
|
||||||
point_status = GoodsEnum.EMPTY_PALLETS.getValue();
|
|
||||||
point_type = true;
|
|
||||||
}
|
|
||||||
MdBaseVehicle mdBaseVehicle = mdBaseVehicleService.selectByVehicleCode(taskObj.getVehicle_code());
|
|
||||||
pointService.update(Wrappers.lambdaUpdate(SchBasePoint.class)
|
|
||||||
.eq(SchBasePoint::getPoint_code, point_code2)
|
|
||||||
.set(SchBasePoint::getVehicle_code, taskObj.getVehicle_code())
|
|
||||||
.set(point_type, SchBasePoint::getCan_vehicle_type, mdBaseVehicle.getVehicle_type())
|
|
||||||
.set(point_type, SchBasePoint::getIn_order_seq, 5)
|
|
||||||
.set(SchBasePoint::getPoint_status, point_status)
|
|
||||||
.set(SchBasePoint::getIs_lock, false));
|
|
||||||
}
|
|
||||||
cn.hutool.json.JSONObject jsonObject2 = JSONUtil.parseObj(taskObj.getRequest_param());
|
cn.hutool.json.JSONObject jsonObject2 = JSONUtil.parseObj(taskObj.getRequest_param());
|
||||||
String region_code = jsonObject2.getStr("region_code");
|
String region_code = jsonObject2.getStr("region_code");
|
||||||
JSONArray materials = jsonObject2.getJSONArray("material");
|
JSONArray materials = jsonObject2.getJSONArray("material");
|
||||||
@@ -242,7 +221,6 @@ public class ProcessingSMTTask extends AbstractTask {
|
|||||||
schBaseVehiclematerialgroup.setOrder_code(sendVehicleVo.getOrder_code());
|
schBaseVehiclematerialgroup.setOrder_code(sendVehicleVo.getOrder_code());
|
||||||
schBaseVehiclematerialgroup.setDue_date(sendVehicleVo.getDue_date());
|
schBaseVehiclematerialgroup.setDue_date(sendVehicleVo.getDue_date());
|
||||||
schBaseVehiclematerialgroup.setCreate_name(SecurityUtils.getCurrentNickName());
|
schBaseVehiclematerialgroup.setCreate_name(SecurityUtils.getCurrentNickName());
|
||||||
//schBaseVehiclematerialgroup.setRegion_code(schBasePoint2.getPoint_code());
|
|
||||||
schBaseVehiclematerialgroupService.create(schBaseVehiclematerialgroup);
|
schBaseVehiclematerialgroupService.create(schBaseVehiclematerialgroup);
|
||||||
});
|
});
|
||||||
// 任务完成
|
// 任务完成
|
||||||
@@ -253,6 +231,55 @@ public class ProcessingSMTTask extends AbstractTask {
|
|||||||
taskService.updateById(taskObj);
|
taskService.updateById(taskObj);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改终点点位状态
|
||||||
|
*/
|
||||||
|
private void updateEndPointStatus(SchBaseTask taskObj) {
|
||||||
|
try {
|
||||||
|
String pointCode2 = taskObj.getPoint_code2();
|
||||||
|
SchBasePoint schBasePoint2 = pointService.selectByPointCode(pointCode2);
|
||||||
|
if (ObjectUtil.isNotEmpty(schBasePoint2)) {
|
||||||
|
String pointStatus = GoodsEnum.IN_STOCK.getValue();
|
||||||
|
boolean pointType = false;
|
||||||
|
if (pointCode2.contains("NBJGKLLDJW")) {
|
||||||
|
pointStatus = GoodsEnum.EMPTY_PALLETS.getValue();
|
||||||
|
pointType = true;
|
||||||
|
}
|
||||||
|
MdBaseVehicle mdBaseVehicle = mdBaseVehicleService.selectByVehicleCode(taskObj.getVehicle_code());
|
||||||
|
pointService.update(Wrappers.lambdaUpdate(SchBasePoint.class)
|
||||||
|
.eq(SchBasePoint::getPoint_code, pointCode2)
|
||||||
|
.set(SchBasePoint::getVehicle_code, taskObj.getVehicle_code())
|
||||||
|
.set(pointType, SchBasePoint::getCan_vehicle_type, mdBaseVehicle.getVehicle_type())
|
||||||
|
.set(pointType, SchBasePoint::getIn_order_seq, 5)
|
||||||
|
.set(SchBasePoint::getPoint_status, pointStatus)
|
||||||
|
.set(SchBasePoint::getIs_lock, false));
|
||||||
|
}
|
||||||
|
}catch (Exception e){
|
||||||
|
log.error("修改终点点位状态失败",e);
|
||||||
|
throw new BadRequestException("修改" + taskObj.getPoint_code2()+ "终点点位状态失败:" + e.getMessage() + "任务号:" + taskObj.getTask_code());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改起点点位状态
|
||||||
|
*/
|
||||||
|
private void updateStartPointStatus(SchBaseTask taskObj) {
|
||||||
|
try {
|
||||||
|
String startPoint = taskObj.getPoint_code1();
|
||||||
|
SchBasePoint schBasePoint = pointService.selectByPointCode(startPoint);
|
||||||
|
if (ObjectUtil.isNotEmpty(schBasePoint)) {
|
||||||
|
pointService.update(Wrappers.lambdaUpdate(SchBasePoint.class)
|
||||||
|
.eq(SchBasePoint::getPoint_code, startPoint)
|
||||||
|
.set(SchBasePoint::getVehicle_code, null)
|
||||||
|
.set(SchBasePoint::getPoint_status, GoodsEnum.OUT_OF_STOCK.getValue())
|
||||||
|
.set(SchBasePoint::getIs_lock, false));
|
||||||
|
}
|
||||||
|
}catch (Exception e){
|
||||||
|
log.error("修改起点点位状态失败",e);
|
||||||
|
throw new BadRequestException("修改" + taskObj.getPoint_code1()+ "起点点位状态失败:" + e.getMessage() + "任务号:" + taskObj.getTask_code());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public void cancelTask(SchBaseTask taskObj, TaskFinishedTypeEnum taskFinishedType) {
|
public void cancelTask(SchBaseTask taskObj, TaskFinishedTypeEnum taskFinishedType) {
|
||||||
// 获取参数
|
// 获取参数
|
||||||
|
|||||||
BIN
lms/nladmin-ui/src/assets/images/ximenzi.png
Normal file
BIN
lms/nladmin-ui/src/assets/images/ximenzi.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 4.3 KiB |
@@ -14,7 +14,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import Logo from '@/assets/images/logo.png'
|
import Logo from '@/assets/images/ximenzi.png'
|
||||||
import variables from '@/assets/styles/variables.scss'
|
import variables from '@/assets/styles/variables.scss'
|
||||||
export default {
|
export default {
|
||||||
name: 'SidebarLogo',
|
name: 'SidebarLogo',
|
||||||
|
|||||||
@@ -47,7 +47,7 @@
|
|||||||
range-separator="至"
|
range-separator="至"
|
||||||
start-placeholder="开始日期"
|
start-placeholder="开始日期"
|
||||||
end-placeholder="结束日期"
|
end-placeholder="结束日期"
|
||||||
@change="crud.toQuery"
|
@change="handleDateChange"
|
||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="任务状态">
|
<el-form-item label="任务状态">
|
||||||
@@ -178,12 +178,6 @@
|
|||||||
{{ scope.row.vehicle_code ? scope.row.vehicle_code : '-' }}
|
{{ scope.row.vehicle_code ? scope.row.vehicle_code : '-' }}
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<!-- <el-table-column prop="vehicle_code2" label="载具编码2" :min-width="flexWidth('vehicle_code2',crud.data,'载具编码2')">
|
|
||||||
<template slot-scope="scope">
|
|
||||||
{{ scope.row.vehicle_code2 ? scope.row.vehicle_code2 : '-' }}
|
|
||||||
</template>
|
|
||||||
</el-table-column> -->
|
|
||||||
<!-- <el-table-column prop="task_class_id" label="任务分类" :min-width="flexWidth('task_class_id',crud.data,'任务分类')" />-->
|
|
||||||
<el-table-column prop="task_status" label="任务状态" :min-width="flexWidth('task_status',crud.data,'任务状态')">
|
<el-table-column prop="task_status" label="任务状态" :min-width="flexWidth('task_status',crud.data,'任务状态')">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
{{ getStatusName(scope.row.task_status) }}
|
{{ getStatusName(scope.row.task_status) }}
|
||||||
@@ -193,7 +187,6 @@
|
|||||||
<el-table-column prop="config_code" label="配置编码" :min-width="flexWidth('config_code',crud.data,'配置编码')" />
|
<el-table-column prop="config_code" label="配置编码" :min-width="flexWidth('config_code',crud.data,'配置编码')" />
|
||||||
<el-table-column prop="point_code1" label="点位1" :min-width="flexWidth('point_code1',crud.data,'点位1')" />
|
<el-table-column prop="point_code1" label="点位1" :min-width="flexWidth('point_code1',crud.data,'点位1')" />
|
||||||
<el-table-column prop="point_code2" label="点位2" :min-width="flexWidth('point_code2',crud.data,'点位2')" />
|
<el-table-column prop="point_code2" label="点位2" :min-width="flexWidth('point_code2',crud.data,'点位2')" />
|
||||||
<!-- <el-table-column prop="request_param" label="请求参数" :min-width="flexWidth('request_param',crud.data,'请求参数')" /> -->
|
|
||||||
<el-table-column prop="request_param" label="请求参数" :min-width="150">
|
<el-table-column prop="request_param" label="请求参数" :min-width="150">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<div class="truncate" :title="scope.row.request_param" placement="top">
|
<div class="truncate" :title="scope.row.request_param" placement="top">
|
||||||
@@ -339,6 +332,15 @@ export default {
|
|||||||
[CRUD.HOOK.beforeRefresh]() {
|
[CRUD.HOOK.beforeRefresh]() {
|
||||||
return true
|
return true
|
||||||
},
|
},
|
||||||
|
handleDateChange() {
|
||||||
|
if (this.query.createTime && this.query.createTime.length === 2) {
|
||||||
|
const startTime = this.query.createTime[0]
|
||||||
|
const endTime = this.query.createTime[1]
|
||||||
|
this.query.begin_time = startTime
|
||||||
|
this.query.end_time = endTime
|
||||||
|
this.crud.toQuery()
|
||||||
|
}
|
||||||
|
},
|
||||||
hand(value) {
|
hand(value) {
|
||||||
this.crud.toQuery()
|
this.crud.toQuery()
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user