Browse Source

add:新增区域

master
刘先源 2 weeks ago
parent
commit
53d634a24e
  1. 43
      acs2/nladmin-system/src/main/java/org/nl/modules/common/utils/enums/RegionEnum.java
  2. 5
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/mes/service/impl/MesToWmsServiceImpl.java
  3. 146
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/fj/PUBLICLPQTask.java

43
acs2/nladmin-system/src/main/java/org/nl/modules/common/utils/enums/RegionEnum.java

@ -70,6 +70,49 @@ public enum RegionEnum {
// 包装线-->拆盘机
BZX_CPJ("BZX", "CPJ","PS15","Group-004"),
// 拆盘机-->良品区
CPJ_LPQ("CPJ", "LPQ","PS20","Group-001"),
// 良品区-->拆盘机
LPQ_CPJ("LPQ", "CPJ","PS20","Group-001"),
// AB生产区-->良品区
AB_LPQ("AB", "LPQ","PS20","Group-001"),
// 良品区-->AB生产区
LPQ_AB("LPQ", "AB","PS20","Group-001"),
// C生产区-->良品区
C_LPQ("C", "LPQ","PS20","Group-001"),
// 良品区-->C生产区
LPQ_C("LPQ", "C","PS20","Group-001"),
// D生产区-->良品区
D_LPQ("D", "LPQ","PS20","Group-001"),
// 良品区-->D生产区
LPQ_D("LPQ", "D","PS20","Group-001"),
// 包装线-->良品区
BZX_LPQ("BZX", "LPQ","PS20","Group-001"),
// 良品区-->包装线
LPQ_BZX("LPQ", "BZX","PS20","Group-001"),
// 地面货架-->良品区
DMHJ_LPQ("DMHJ", "LPQ","PS20","Group-001"),
// 良品区-->地面货架
LPQ_DMHJ("LPQ", "DMHJ","PS20","Group-001"),
// 钢平台接驳-->良品区
GPTJB_LPQ("GPTJB", "LPQ","PS20","Group-001"),
// 良品区-->钢平台接驳
LPQ_GPTJB("LPQ", "GPTJB","PS20","Group-001"),
;
// 起点区域

5
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/mes/service/impl/MesToWmsServiceImpl.java

@ -287,6 +287,11 @@ public class MesToWmsServiceImpl implements MesToWmsService {
private String ifTaskRegion(String start_region, String next_region) {
String task_code = "";
// 如果是良品区的点位则返回公共任务配置类
if (start_region.equals("LPQ") || next_region.equals("LPQ")) {
return "PUBLICLPQTask";
}
// 获取全部任务配置类
List<SchBaseTaskconfig> taskConfigList = iSchBaseTaskconfigService.list(
new QueryWrapper<SchBaseTaskconfig>().lambda()

146
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/fj/PUBLICLPQTask.java

@ -0,0 +1,146 @@
package org.nl.wms.sch.task_manage.task.tasks.fj;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSONObject;
import org.nl.common.exception.BadRequestException;
import org.nl.common.utils.SecurityUtils;
import org.nl.config.IdUtil;
import org.nl.wms.ext.mes.service.WmsToMesService;
import org.nl.wms.sch.task.service.ISchBaseTaskService;
import org.nl.wms.sch.task.service.ISchBaseTaskconfigService;
import org.nl.wms.sch.task.service.dao.SchBaseTask;
import org.nl.wms.sch.task_manage.AbstractTask;
import org.nl.wms.sch.task_manage.AcsTaskDto;
import org.nl.wms.sch.task_manage.GeneralDefinition;
import org.nl.wms.sch.task_manage.enums.TaskFinishedTypeEnum;
import org.nl.wms.sch.task_manage.task.TaskType;
import org.nl.wms.sch.task_manage.task.core.TaskStatus;
import org.nl.wms.util.TaskUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
/**
* @Author: lxy
* @Description: 良品区公共类
* @Date: 2024/9/24
*/
@Component(value = "PUBLICLPQTask")
@TaskType("PUBLICLPQTask")
public class PUBLICLPQTask extends AbstractTask {
@Autowired
private ISchBaseTaskService taskService;
@Autowired
private ISchBaseTaskconfigService taskConfigService;
@Autowired
private WmsToMesService wmsToMesService;
@Override
public String create(JSONObject json) {
SchBaseTask task = new SchBaseTask();
task.setTask_id(IdUtil.getStringId());
task.setTask_code(json.getString("TaskCode"));
task.setTask_status(TaskStatus.CREATE.getCode());
task.setConfig_code(json.getString("task_type"));
task.setPoint_code1(json.getString("PickingLocation"));
task.setPoint_code2(json.getString("PlacedLocation"));
task.setRequest_param(json.toString());
task.setPriority(json.getString("Priority"));
task.setIs_vehicle(json.getString("IsPanCode"));
task.setCreate_id(SecurityUtils.getCurrentUserId());
task.setCreate_name(SecurityUtils.getCurrentNickName());
task.setCreate_time(DateUtil.now());
taskService.save(task);
return task.getTask_id();
}
@Override
public AcsTaskDto sendAcsParam(String taskId) {
SchBaseTask taskDao = taskService.getById(taskId);
// 组织下发给acs的数据
AcsTaskDto acsTaskDto = new AcsTaskDto();
acsTaskDto.setExt_task_uuid(taskDao.getTask_id());
acsTaskDto.setTask_code(taskDao.getTask_code());
acsTaskDto.setStart_device_code(taskDao.getPoint_code1());
acsTaskDto.setNext_device_code(taskDao.getPoint_code2());
acsTaskDto.setPriority(taskDao.getPriority());
acsTaskDto.setIs_vehicle(taskDao.getIs_vehicle());
acsTaskDto.setTask_type("1");
return acsTaskDto;
}
@Override
protected void updateStatus(String task_code, TaskStatus status) {
// 校验任务
SchBaseTask taskObj = taskService.getByCode(task_code);
if (taskObj.getTask_status().equals(TaskStatus.FINISHED.getCode())) {
throw new BadRequestException("该任务已完成!");
}
if (taskObj.getTask_status().equals(TaskStatus.CANCELED.getCode())) {
throw new BadRequestException("该任务已取消!");
}
// 根据传来的类型去对任务进行操作
if (status.equals(TaskStatus.EXECUTING)) {
taskObj.setTask_status(TaskStatus.EXECUTING.getCode());
taskObj.setRemark("执行中");
TaskUtils.setUpdateByAcs(taskObj);
taskService.updateById(taskObj);
}
if (status.equals(TaskStatus.FINISHED)) {
this.finishTask(taskObj, TaskFinishedTypeEnum.AUTO_ACS);
}
if (status.equals(TaskStatus.CANCELED)) {
this.cancelTask(taskObj, TaskFinishedTypeEnum.AUTO_ACS);
}
}
@Override
public void backMes(String task_code) {
wmsToMesService.receiveTaskStatusMesData(taskService.getByCode(task_code));
}
@Override
public void forceFinish(String task_code) {
SchBaseTask taskObj = taskService.getByCode(task_code);
if (ObjectUtil.isEmpty(taskObj)) {
throw new BadRequestException("该任务不存在");
}
this.finishTask(taskObj, TaskFinishedTypeEnum.MANUAL_PC);
}
@Override
public void cancel(String task_code) {
SchBaseTask taskObj = taskService.getByCode(task_code);
if (ObjectUtil.isEmpty(taskObj)) {
throw new BadRequestException("该任务不存在");
}
this.cancelTask(taskObj, TaskFinishedTypeEnum.MANUAL_PC);
}
@Transactional(rollbackFor = Exception.class)
public void finishTask(SchBaseTask taskObj, TaskFinishedTypeEnum taskFinishedType) {
// 任务完成
taskObj.setTask_status(TaskStatus.FINISHED.getCode());
taskObj.setRemark(GeneralDefinition.TASK_FINISH);
taskObj.setFinished_type(taskFinishedType.getCode());
TaskUtils.setUpdateByType(taskObj, taskFinishedType);
taskService.updateById(taskObj);
// 通知mes任务完成
wmsToMesService.receiveTaskStatusMesData(taskObj);
}
@Transactional(rollbackFor = Exception.class)
public void cancelTask(SchBaseTask taskObj, TaskFinishedTypeEnum taskFinishedType) {
taskObj.setRemark(GeneralDefinition.TASK_CANCEL);
taskObj.setTask_status(TaskStatus.CANCELED.getCode());
taskObj.setFinished_type(taskFinishedType.getCode());
TaskUtils.setUpdateByType(taskObj, taskFinishedType);
taskService.updateById(taskObj);
}
}
Loading…
Cancel
Save