Browse Source

opt: 下发任务优化

master
yanps 5 months ago
parent
commit
59734cd4b8
  1. 25
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/acs/service/impl/AcsToWmsServiceImpl.java
  2. 1
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/connector/controller/ConnectorToWmsController.java
  3. 2
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/connector/service/impl/ConnectorToWmsServiceImpl.java
  4. 6
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/point/service/impl/SchBasePointServiceImpl.java
  5. 7
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task/service/impl/SchBaseTaskServiceImpl.java
  6. 6
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/AbstractTask.java
  7. 9
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/cnt/CNTTask.java
  8. 5
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/cnt/FTGTask.java
  9. 4
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/sorting/SortingCMTTask.java
  10. 2
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/sorting/SortingCNTTask.java
  11. 3
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/sorting/SortingSMTTask.java
  12. 10
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/sorting/SortingSNTTask.java
  13. 17
      lms/nladmin-ui/src/views/wms/sch/task/index.vue

25
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/acs/service/impl/AcsToWmsServiceImpl.java

@ -346,15 +346,15 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
@Override
public Object feedTaskStatus(JSONObject param) {
if(ObjectUtil.isNotEmpty(param)){
if (ObjectUtil.isNotEmpty(param)) {
String task_code = param.getString("task_code");
String task_status = param.getString("task_status");
if(StrUtil.isEmpty(task_code) || StrUtil.isEmpty(task_status)){
if (StrUtil.isEmpty(task_code) || StrUtil.isEmpty(task_status)) {
throw new BadRequestException("task_code或task_status为空!");
}
SchBaseTask schBaseTask = taskService.getOne(Wrappers.lambdaQuery(SchBaseTask.class)
.eq(SchBaseTask::getTask_code, task_code).in(SchBaseTask::getTask_status, TaskStatus.EXECUTING.getCode(), TaskStatus.ISSUED.getCode()));
if(ObjectUtil.isEmpty(schBaseTask)) throw new BadRequestException("任务不存在!task_code:" + task_code);
if (ObjectUtil.isEmpty(schBaseTask)) throw new BadRequestException("任务不存在!task_code:" + task_code);
switch (task_status) {
case "1":
//执行中
@ -369,7 +369,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
break;
default:
break;
}
}
}
return null;
@ -385,9 +385,8 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
//TODO:空料容放货完成反馈给Connector
if (!is_empty) {
finishTask(schBaseTask.getTask_code(), schBaseTask.getPoint_code2());
}else {
} else {
finishTask(schBaseTask.getTask_code(), schBaseTask.getPoint_code1());
if ("1".equals(is_connector)) {
JSONObject json = new JSONObject();
json.put("vehicle_code", schBaseTask.getVehicle_code());
@ -411,8 +410,6 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
private void finishTask(String task_code, String point_code) {
pointService.update(Wrappers.lambdaUpdate(SchBasePoint.class).eq(SchBasePoint::getPoint_code, point_code)
.set(SchBasePoint::getIs_lock, false));
/*taskService.update(Wrappers.lambdaUpdate(SchBaseTask.class).eq(SchBaseTask::getTask_code, task_code)
.set(SchBaseTask::getTask_status, TaskStatus.FINISHED.getCode()));*/
}
/**
@ -425,7 +422,8 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
//TODO:取货完成创建第二条任务:补空托盘
String vehicle_code = schBaseTask.getVehicle_code();
if ("1".equals(is_connector)) {
List<SchBaseTask> list = taskService.list(Wrappers.lambdaQuery(SchBaseTask.class).eq(SchBaseTask::getPoint_code2, schBaseTask.getPoint_code1())
List<SchBaseTask> list = taskService.list(Wrappers.lambdaQuery(SchBaseTask.class)
.eq(SchBaseTask::getPoint_code2, schBaseTask.getPoint_code1())
.in(SchBaseTask::getTask_status, TaskStatus.APPLY.getCode(), TaskStatus.CREATED.getCode(), TaskStatus.ISSUED.getCode(), TaskStatus.EXECUTING.getCode()));
if (CollectionUtils.isEmpty(list)) {
MdBaseVehicle mdBaseVehicle = iMdBaseVehicleService.getOne(new QueryWrapper<MdBaseVehicle>().eq("vehicle_code", vehicle_code));
@ -496,6 +494,8 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
taskService.update(Wrappers.lambdaUpdate(SchBaseTask.class).eq(SchBaseTask::getTask_code, schBaseTask.getTask_code())
.set(SchBaseTask::getJob_name, connectorDto.getJobname()));
}
} else {
throw new BadRequestException("LMS向Connector请求取货");
}
}
if ("2".equals(is_connector)) {
@ -532,6 +532,13 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
if (acsResponse.getStatus() != 200 || StringUtils.isNotEmpty(acsResponse.getErrMsg())) {
throw new BadRequestException("申请失败,"+ acsResponse.getErrMsg());
}
}else if("1".equals(is_connector)){
JSONObject json = new JSONObject();
json.put("vehicle_code", schBaseTask.getVehicle_code());
json.put("status", status);
json.put("device_code", schBaseTask.getPoint_code2());
json.put("task_code", schBaseTask.getTask_code());
AcsResponse acsResponse = connectorService.feedAgvTaskStatus(json);
}
}

1
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/connector/controller/ConnectorToWmsController.java

@ -31,7 +31,6 @@ public class ConnectorToWmsController {
@SaIgnore
@PostMapping("/wms/task")
public ResponseEntity<Object> createTaskByConnector(@RequestBody JSONArray jsonArray){
Object taskByConnector = connectorService.createTaskByConnector(jsonArray);
return new ResponseEntity(connectorService.createTaskByConnector(jsonArray), HttpStatus.OK);
}

2
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/connector/service/impl/ConnectorToWmsServiceImpl.java

@ -68,7 +68,7 @@ public class ConnectorToWmsServiceImpl implements ConnectorToWmsService {
if (ObjectUtil.isEmpty(schBasePoint)) {
map1.put("task_code", task_code);
map1.put("status", HttpStatus.HTTP_INTERNAL_ERROR);
map1.put("message", start_device_code + "点设备不存在!");
map1.put("message", start_device_code + "点设备不存在!");
objects.add(map1);
continue;
} else if (schBasePoint.getIs_lock()) {

6
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/point/service/impl/SchBasePointServiceImpl.java

@ -246,9 +246,6 @@ public class SchBasePointServiceImpl extends ServiceImpl<SchBasePointMapper, Sch
SchBasePoint schBasePoint = schBasePoints.get(0);
schBasePoint.setVehicle_code(vehicleCode);
schBasePoint.setIs_lock(true);
schBasePoint.setPoint_status(GoodsEnum.IN_STOCK.getValue());
PointUtils.setUpdateByAcs(schBasePoint);
updateById(schBasePoint);
return schBasePoint;
}
SchBasePoint schBasePoint1 = pointMapper.selectList(Wrappers.lambdaQuery(SchBasePoint.class).eq(SchBasePoint::getRegion_code, region_code)).get(0);
@ -265,9 +262,6 @@ public class SchBasePointServiceImpl extends ServiceImpl<SchBasePointMapper, Sch
SchBasePoint schBasePoint = schBasePoints1.get(0);
schBasePoint.setVehicle_code(vehicleCode);
schBasePoint.setIs_lock(true);
schBasePoint.setPoint_status(GoodsEnum.IN_STOCK.getValue());
PointUtils.setUpdateByAcs(schBasePoint);
updateById(schBasePoint);
return schBasePoint;
}
return null;

7
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task/service/impl/SchBaseTaskServiceImpl.java

@ -25,10 +25,7 @@ import org.nl.wms.sch.task_manage.task.core.TaskStatus;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.*;
import java.util.stream.Collectors;
/**
@ -130,7 +127,7 @@ public class SchBaseTaskServiceImpl extends ServiceImpl<SchBaseTaskMapper, SchBa
@Override
public List<SchBaseTask> findUnFinishTasksByTaskConfig(String config_code, String device_code, String direction) {
Assert.notNull(config_code, "任务配置编码不能为空!");
Assert.noNullElements(new Object[]{config_code, device_code, direction}, "任务配置编码不能为空!");
LambdaQueryWrapper<SchBaseTask> lam = new LambdaQueryWrapper<>();
lam.eq(SchBaseTask::getConfig_code, config_code)
.lt(SchBaseTask::getTask_status, TaskStatus.FINISHED.getCode())

6
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/AbstractTask.java

@ -234,6 +234,12 @@ public abstract class AbstractTask {
Assert.isFalse(unFinishTasksByTaskConfig.size() >= tcmn,
"该点位申请的任务未完成数已超过上限,无法申请任务");
// 校验同个点位,同种任务是否多次请求创建任务(固定只能1个任务)
List<SchBaseTask> applyPointTask = taskService.findUnFinishTasksByTaskConfig(
taskConfig.getConfig_code(), apply_point_code, taskConfig.getTask_direction());
if (applyPointTask.size() == 1) {
throw new BadRequestException("已创建相同点位任务,不可重复创建!");
}
// 获取对接位点位对象
SchBasePoint pointObj = pointService.getOne(new LambdaQueryWrapper<SchBasePoint>()
.eq(SchBasePoint::getPoint_code, apply_point_code));

9
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/cnt/CNTTask.java

@ -65,8 +65,8 @@ public class CNTTask extends AbstractTask {
SchBasePoint schBasePoint = null;
if (TaskType.CARRY_TASK.getValue().equals(task.getTask_type())) {
schBasePoint = schBasePointService.selectByRegionCode(RegionEnum.TRUBEND_SHELVES_3_1_1.getRegion_code(), task.getVehicle_code());
} else if (TaskType.REASSIGN_TASK.getValue().equals(task.getTask_type())){
schBasePoint = schBasePointService.selectByReassign(RegionEnum.TRUBEND_SHELVES_3_1_1.getRegion_code(),task.getVehicle_code());
} else if (TaskType.REASSIGN_TASK.getValue().equals(task.getTask_type())) {
schBasePoint = schBasePointService.selectByReassign(RegionEnum.TRUBEND_SHELVES_3_1_1.getRegion_code(), task.getVehicle_code());
}
if (ObjectUtil.isEmpty(schBasePoint)) {
task.setRemark("未找到所需点位!");
@ -83,6 +83,11 @@ public class CNTTask extends AbstractTask {
task.setRemark("");
task.setTask_status(TaskStatus.CREATED.getCode());
taskService.updateById(task);
schBasePoint.setIng_task_code(task.getTask_code());
schBasePoint.setPoint_status(GoodsEnum.IN_STOCK.getValue());
PointUtils.setUpdateByAcs(schBasePoint);
pointService.updateById(schBasePoint);
}
}

5
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/cnt/FTGTask.java

@ -71,11 +71,6 @@ public class FTGTask extends AbstractTask {
continue;
}
/*SchBaseVehiclematerialgroup schBaseVehiclematerialgroup = new SchBaseVehiclematerialgroup();
schBaseVehiclematerialgroup.setVehicle_code(task.getVehicle_code());
schBaseVehiclematerialgroup.setPoint_code(schBasePoint.getPoint_code());
schBaseVehiclematerialgroupService.create(schBaseVehiclematerialgroup);*/
// 设置终点并修改创建成功状态
task.setPoint_code1(schBasePoint.getPoint_code());
task.setVehicle_type(schBasePoint.getCan_vehicle_type());

4
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/sorting/SortingCMTTask.java

@ -77,7 +77,9 @@ public class SortingCMTTask extends AbstractTask {
.set("task_status",TaskStatus.CREATED.getCode())
.set("point_code1",structPoint.getPoint_code())
.eq("task_id",task.getTask_id()));
pointService.update(new UpdateWrapper<SchBasePoint>().set("ing_task_code",task.getTask_code())
pointService.update(new UpdateWrapper<SchBasePoint>()
.set("ing_task_code",task.getTask_code())
.set("is_lock",true)
.eq("point_code",structPoint.getPoint_code()));
}
}

2
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/sorting/SortingCNTTask.java

@ -34,7 +34,7 @@ import java.util.List;
@Component(value = "SortingCNTTask")
public class SortingCNTTask extends AbstractTask {
private static String Vehicle_Type = VehicleEnum.S.getCode();
private static String Vehicle_Type = VehicleEnum.XL.getCode();
private static final String TASK_CONFIG_CODE = "SortingCNTTask";
@Autowired

3
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/sorting/SortingSMTTask.java

@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import jdk.nashorn.internal.scripts.JS;
import lombok.extern.slf4j.Slf4j;
import org.nl.common.enums.GoodsEnum;
import org.nl.common.enums.region.RegionEnum;
import org.nl.common.exception.BadRequestException;
import org.nl.system.service.notice.ISysNoticeService;
@ -102,6 +103,8 @@ public class SortingSMTTask extends AbstractTask {
task.setTask_status(TaskStatus.CREATED.getCode());
taskService.updateById(task);
//更新点位
schBasePoint.setPoint_status(GoodsEnum.IN_STOCK.getValue());
schBasePoint.setIng_task_code(task.getTask_code());
PointUtils.setUpdateByAcs(schBasePoint);
pointService.updateById(schBasePoint);

10
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/sorting/SortingSNTTask.java

@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import lombok.extern.slf4j.Slf4j;
import org.nl.common.enums.GoodsEnum;
import org.nl.common.enums.region.RegionEnum;
import org.nl.common.exception.BadRequestException;
import org.nl.system.service.notice.ISysNoticeService;
@ -86,9 +87,12 @@ public class SortingSNTTask extends AbstractTask {
.set("task_status",TaskStatus.CREATED.getCode())
.set("point_code2",schBasePoint.getPoint_code())
.eq("task_id",task.getTask_id()));
pointService.update(new UpdateWrapper<SchBasePoint>()
.set("ing_task_code",task.getTask_code())
.eq("point_code",schBasePoint.getPoint_code()));
//更新点位信息
schBasePoint.setIng_task_code(task.getTask_code());
schBasePoint.setPoint_status(GoodsEnum.EMPTY_PALLETS.getValue());
PointUtils.setUpdateByAcs(schBasePoint);
pointService.updateById(schBasePoint);
}
}

17
lms/nladmin-ui/src/views/wms/sch/task/index.vue

@ -182,9 +182,9 @@
<el-table-column prop="config_code" label="配置编码" :min-width="flexWidth('config_code',crud.data,'配置编码')" />
<el-table-column prop="point_code1" label="起点" :min-width="flexWidth('point_code1',crud.data,'点位1')" />
<el-table-column prop="point_code2" label="终点" :min-width="flexWidth('point_code2',crud.data,'点位2')" />
<!-- <el-table-column prop="point_code3" label="起点2" :min-width="flexWidth('point_code3',crud.data,'点位3')" />-->
<!-- <el-table-column prop="point_code4" label="终点2" :min-width="flexWidth('point_code4',crud.data,'点位4')" />-->
<!-- <el-table-column prop="start_wait_point" label="取货等待点" :min-width="flexWidth('start_wait_point',crud.data,'取货等待点')" />-->
<!-- <el-table-column prop="point_code3" label="起点2" :min-width="flexWidth('point_code3',crud.data,'点位3')" />-->
<!-- <el-table-column prop="point_code4" label="终点2" :min-width="flexWidth('point_code4',crud.data,'点位4')" />-->
<!-- <el-table-column prop="start_wait_point" label="取货等待点" :min-width="flexWidth('start_wait_point',crud.data,'取货等待点')" />-->
<el-table-column prop="next_wait_point" label="放货等待点" :min-width="flexWidth('next_wait_point',crud.data,'放货等待点')" />
<el-table-column prop="vehicle_type" label="载具类型" :min-width="flexWidth('vehicle_type',crud.data,'载具类型', 20)">
<template slot-scope="scope">
@ -208,8 +208,8 @@
{{ dict.label.create_mode[scope.row.create_mode] }}
</template>
</el-table-column>
<el-table-column prop="request_param" label="生成任务的请求参数" :min-width="100" show-overflow-tooltip/>
<el-table-column prop="workshop_code" v-if="false" label="车间编码" :min-width="flexWidth('workshop_code',crud.data,'车间编码')" />
<el-table-column prop="request_param" label="生成任务的请求参数" :min-width="100" show-overflow-tooltip />
<el-table-column v-if="false" prop="workshop_code" label="车间编码" :min-width="flexWidth('workshop_code',crud.data,'车间编码')" />
<el-table-column prop="create_name" label="创建人" :min-width="flexWidth('create_name',crud.data,'创建人')" />
<el-table-column prop="create_time" label="创建时间" :min-width="flexWidth('create_time',crud.data,'创建时间')" />
<el-table-column prop="update_name" label="修改人" :min-width="flexWidth('update_name',crud.data,'修改人')" />
@ -227,12 +227,12 @@
:disabled="scope.row.task_status==='5' || scope.row.task_status==='6'"
@click="doOperate(scope.row, 'a')"
>完成</el-button>
<el-button
<!-- <el-button
type="text"
icon="el-icon-error"
:disabled="scope.row.task_status==='5' || scope.row.task_status==='6'"
@click="doOperate(scope.row, 'b')"
>取消</el-button>
>取消</el-button> -->
</template>
</el-table-column>
</el-table>
@ -247,7 +247,6 @@ import crudSchBaseTask from './schBaseTask'
import CRUD, { crud, form, header, presenter } from '@crud/crud'
import rrOperation from '@crud/RR.operation'
import crudOperation from '@crud/CRUD.operation'
import udOperation from '@crud/UD.operation'
import pagination from '@crud/Pagination'
const defaultForm = {
@ -285,7 +284,7 @@ const defaultForm = {
export default {
name: 'Task',
dicts: ['vehicle_type', 'create_mode', 'finished_type'],
components: { pagination, crudOperation, rrOperation, udOperation },
components: { pagination, crudOperation, rrOperation },
mixins: [presenter(), header(), form(defaultForm), crud()],
cruds() {
return CRUD({

Loading…
Cancel
Save