Browse Source

opt: 对接ACS字段、类名的优化

master
李永德 1 year ago
parent
commit
7180b537fe
  1. 18
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/acs/service/WmsToAcsService.java
  2. 14
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/acs/service/dto/to/acs/IssueAcsRequest.java
  3. 12
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/acs/service/dto/to/wms/AcsResponse.java
  4. 25
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/acs/service/impl/WmsToAcsServiceImpl.java
  5. 7
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/record/service/impl/SysInteractRecordServiceImpl.java
  6. 12
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/pdm/workorder/service/dao/mapper/PdmBdWorkorderMapper.xml
  7. 20
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/pdm/workorder/service/dao/vo/AcsWorkOrderVo.java
  8. 15
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/pdm/workorder/service/impl/PdmBdWorkorderServiceImpl.java
  9. 23
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/AbstractTask.java
  10. 1
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/AcsTaskDto.java
  11. 2
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/GeneralDefinition.java
  12. 27
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/AcsUtil.java
  13. 21
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/fj/FJMKTask.java
  14. 2
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/fj/mapper/FJMapper.java
  15. 14
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/fj/mapper/FJMapper.xml
  16. 32
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/hn/HNMLTask.java
  17. 332
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/hn/HNQKTask.java
  18. 342
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/yz/YZQLTask.java
  19. 10
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/yz/YZSLTask.java
  20. 4
      lms/nladmin-ui/src/views/wms/sch/task/config/index.vue

18
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/acs/service/WmsToAcsService.java

@ -1,28 +1,34 @@
package org.nl.wms.ext.acs.service; package org.nl.wms.ext.acs.service;
import com.alibaba.fastjson.JSONArray;
import org.nl.wms.ext.acs.service.dto.ResultForAcs; import org.nl.wms.ext.acs.service.dto.ResultForAcs;
import org.nl.wms.ext.acs.service.dto.to.acs.DeviceInfoDto; import org.nl.wms.ext.acs.service.dto.to.acs.DeviceInfoDto;
import org.nl.wms.ext.acs.service.dto.to.acs.PutActionRequest; import org.nl.wms.ext.acs.service.dto.to.acs.PutActionRequest;
import org.nl.wms.pdm.workorder.service.dao.PdmBdWorkorder; import org.nl.wms.ext.acs.service.dto.to.wms.AcsResponse;
import org.nl.wms.pdm.workorder.service.dao.vo.AcsWorkOrderVo; import org.nl.wms.pdm.workorder.service.dao.vo.AcsWorkOrderVo;
import org.nl.wms.sch.task_manage.AcsTaskDto;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* @Author: lyd * @Author: lyd
* @Description: Wms请求Acs * @Description: Wms请求Acs统一管理与ACS对接的接口
* @Date: 2023/6/30 * @Date: 2023/6/30
*/ */
public interface WmsToAcsService { public interface WmsToAcsService {
/** /**
* 下发工单 * 下发工单
* @param workorder * @param list: 工单链表
* @return * @return
*/ */
ResultForAcs order(AcsWorkOrderVo workorder); AcsResponse order(List<AcsWorkOrderVo> list);
/**
* 下发任务
* 统一在这里维护
* @param list: 任务链表
* @return
*/
AcsResponse renotifyAcs(List<AcsTaskDto> list);
/** /**
* 下发信号 - 覆膜机释放托盘 * 下发信号 - 覆膜机释放托盘

14
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/acs/service/dto/to/acs/CreateTaskRequest.java → lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/acs/service/dto/to/acs/IssueAcsRequest.java

@ -4,25 +4,23 @@ import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.IdUtil; import cn.hutool.core.util.IdUtil;
import lombok.Data; import lombok.Data;
import org.nl.wms.ext.acs.service.dto.to.BaseRequest; import org.nl.wms.ext.acs.service.dto.to.BaseRequest;
import org.nl.wms.sch.task_manage.AcsTaskDto;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* @Author: lyd * @Author: lyd
* @Description: 下发任务实体类 * @Description: 下发ACS实体类
* @Date: 2023/7/26 * @Date: 2023/7/26
*/ */
@Data @Data
public class CreateTaskRequest extends BaseRequest { public class IssueAcsRequest<T> extends BaseRequest {
/** /**
* 任务数组 * 类型根据泛型来定义
*/ */
private List<AcsTaskDto> list = null; private List<T> list = null;
public static CreateTaskRequest buildRequestObj(String name, List<AcsTaskDto> list) { public static <T> IssueAcsRequest<T> buildRequestObj(String name, List<T> list) {
CreateTaskRequest request = new CreateTaskRequest(); IssueAcsRequest<T> request = new IssueAcsRequest<>();
request.setRequest_medthod_name(name); request.setRequest_medthod_name(name);
request.setRequestNo(IdUtil.simpleUUID()); request.setRequestNo(IdUtil.simpleUUID());
request.setRequestDate(DateUtil.now()); request.setRequestDate(DateUtil.now());

12
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/acs/service/dto/to/wms/CreateTaskResponse.java → lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/acs/service/dto/to/wms/AcsResponse.java

@ -8,23 +8,23 @@ import org.nl.wms.ext.acs.service.dto.to.BaseResponse;
/** /**
* @Author: lyd * @Author: lyd
* @Description: 下发任务acs的反馈数据 * @Description: 下发acs的反馈数据*new
* @Date: 2023/7/26 * @Date: 2023/7/26
*/ */
@Data @Data
public class CreateTaskResponse extends BaseResponse { public class AcsResponse extends BaseResponse {
private JSONArray errArr = new JSONArray(); private JSONArray errArr = new JSONArray();
public static CreateTaskResponse requestRefuse(String message) { public static AcsResponse requestRefuse(String message) {
CreateTaskResponse result = new CreateTaskResponse(); AcsResponse result = new AcsResponse();
result.setCode(HttpStatus.HTTP_BAD_REQUEST); result.setCode(HttpStatus.HTTP_BAD_REQUEST);
result.setMessage(message); result.setMessage(message);
result.setResponseDate(DateUtil.now()); result.setResponseDate(DateUtil.now());
return result; return result;
} }
public static CreateTaskResponse requestOk() { public static AcsResponse requestOk() {
CreateTaskResponse result = new CreateTaskResponse(); AcsResponse result = new AcsResponse();
result.setCode(HttpStatus.HTTP_OK); result.setCode(HttpStatus.HTTP_OK);
result.setMessage("请求成功"); result.setMessage("请求成功");
result.setResponseDate(DateUtil.now()); result.setResponseDate(DateUtil.now());

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

@ -1,21 +1,21 @@
package org.nl.wms.ext.acs.service.impl; package org.nl.wms.ext.acs.service.impl;
import cn.hutool.core.date.DateUtil;
import cn.hutool.http.HttpStatus;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.nl.wms.ext.acs.service.WmsToAcsService; import org.nl.wms.ext.acs.service.WmsToAcsService;
import org.nl.wms.ext.acs.service.dto.ResultForAcs; import org.nl.wms.ext.acs.service.dto.ResultForAcs;
import org.nl.wms.ext.acs.service.dto.to.acs.DeviceInfoDto; import org.nl.wms.ext.acs.service.dto.to.acs.DeviceInfoDto;
import org.nl.wms.ext.acs.service.dto.to.acs.IssueAcsRequest;
import org.nl.wms.ext.acs.service.dto.to.acs.PutActionRequest; import org.nl.wms.ext.acs.service.dto.to.acs.PutActionRequest;
import org.nl.wms.ext.acs.service.dto.to.wms.AcsResponse;
import org.nl.wms.ext.record.service.ISysInteractRecordService; import org.nl.wms.ext.record.service.ISysInteractRecordService;
import org.nl.wms.pdm.workorder.service.dao.vo.AcsWorkOrderVo; import org.nl.wms.pdm.workorder.service.dao.vo.AcsWorkOrderVo;
import org.nl.wms.sch.task_manage.AcsTaskDto;
import org.nl.wms.sch.task_manage.GeneralDefinition; import org.nl.wms.sch.task_manage.GeneralDefinition;
import org.nl.wms.sch.task_manage.task.AcsUtil; import org.nl.wms.sch.task_manage.task.AcsUtil;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.List; import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;
/** /**
* @Author: lyd * @Author: lyd
@ -28,13 +28,20 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
@Autowired @Autowired
private ISysInteractRecordService interactRecordService; private ISysInteractRecordService interactRecordService;
@Override @Override
public ResultForAcs order(AcsWorkOrderVo workorder) { public AcsResponse order(List<AcsWorkOrderVo> list) {
String api = "api/wms/order"; String api = "api/wms/order";
List<AcsWorkOrderVo> list = new CopyOnWriteArrayList<>(); AcsResponse resultForAcs = AcsUtil.notifyAcs2(api, IssueAcsRequest.buildRequestObj("下发工单", list));
list.add(workorder); // 记录日志
ResultForAcs resultForAcs = AcsUtil.notifyAcs(api, list); interactRecordService.saveRecord("下发工单", list, resultForAcs, GeneralDefinition.LMS_ACS);
return resultForAcs;
}
@Override
public AcsResponse renotifyAcs(List<AcsTaskDto> list) {
String api = "api/wms/task";
AcsResponse resultForAcs = AcsUtil.notifyAcs2(api, IssueAcsRequest.buildRequestObj("下发任务", list));
// 记录日志 // 记录日志
interactRecordService.saveRecord("下发工单", workorder, resultForAcs, GeneralDefinition.LMS_ACS); interactRecordService.saveRecord("下发任务", list, resultForAcs, GeneralDefinition.LMS_ACS);
return resultForAcs; return resultForAcs;
} }
@ -49,7 +56,7 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
@Override @Override
public ResultForAcs getDeviceStatusByCode(List<DeviceInfoDto> list) { public ResultForAcs getDeviceStatusByCode(List<DeviceInfoDto> list) {
String api = "api/"; // todo: 地址未确认 String api = ""; // todo: 地址未确认
ResultForAcs resultForAcs = AcsUtil.notifyAcs(api, list); ResultForAcs resultForAcs = AcsUtil.notifyAcs(api, list);
// 记录日志 // 记录日志
interactRecordService.saveRecord("获取设备状态", list, resultForAcs, GeneralDefinition.LMS_ACS); interactRecordService.saveRecord("获取设备状态", list, resultForAcs, GeneralDefinition.LMS_ACS);

7
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/record/service/impl/SysInteractRecordServiceImpl.java

@ -14,7 +14,7 @@ import org.nl.common.domain.query.PageQuery;
import org.nl.common.exception.BadRequestException; import org.nl.common.exception.BadRequestException;
import org.nl.wms.ext.acs.service.dto.ResultForAcs; import org.nl.wms.ext.acs.service.dto.ResultForAcs;
import org.nl.wms.ext.acs.service.dto.to.BaseResponse; import org.nl.wms.ext.acs.service.dto.to.BaseResponse;
import org.nl.wms.ext.acs.service.dto.to.wms.CreateTaskResponse; import org.nl.wms.ext.acs.service.dto.to.wms.AcsResponse;
import org.nl.wms.ext.record.service.ISysInteractRecordService; import org.nl.wms.ext.record.service.ISysInteractRecordService;
import org.nl.wms.ext.record.service.dao.mapper.SysInteractRecordMapper; import org.nl.wms.ext.record.service.dao.mapper.SysInteractRecordMapper;
import org.nl.wms.ext.record.service.dao.SysInteractRecord; import org.nl.wms.ext.record.service.dao.SysInteractRecord;
@ -25,7 +25,6 @@ import org.springframework.stereotype.Service;
import java.util.Date; import java.util.Date;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
import java.util.function.Consumer;
/** /**
* @description 服务实现 * @description 服务实现
@ -129,8 +128,8 @@ public class SysInteractRecordServiceImpl extends ServiceImpl<SysInteractRecordM
entity.setMessage(re.getMessage()); entity.setMessage(re.getMessage());
entity.setIs_success(re.getStatus() == HttpStatus.HTTP_OK); entity.setIs_success(re.getStatus() == HttpStatus.HTTP_OK);
} }
if (response instanceof CreateTaskResponse) { // wms请求acs的返回数据 if (response instanceof AcsResponse) { // wms请求acs的返回数据
CreateTaskResponse re = (CreateTaskResponse) response; AcsResponse re = (AcsResponse) response;
entity.setCode(re.getCode()); entity.setCode(re.getCode());
entity.setMessage(re.getMessage()); entity.setMessage(re.getMessage());
entity.setIs_success(re.getCode() == HttpStatus.HTTP_OK); entity.setIs_success(re.getCode() == HttpStatus.HTTP_OK);

12
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/pdm/workorder/service/dao/mapper/PdmBdWorkorderMapper.xml

@ -36,7 +36,9 @@
w.point_code AS device_code, w.point_code AS device_code,
w.plan_qty, w.plan_qty,
m.half_material_code AS material_code, m.half_material_code AS material_code,
0 AS to_material_code, m.raw_material_code AS formula,
m.material_code AS product_code,
0 AS brick_code,
0 AS a, 0 AS a,
0 AS b, 0 AS b,
0 AS h, 0 AS h,
@ -44,10 +46,10 @@
0 AS size_error, 0 AS size_error,
0 AS single_weight, 0 AS single_weight,
0 AS drawing_address, 0 AS drawing_address,
0 AS standard_size1, 0 AS standard_size_height1,
0 AS standard_size2, 0 AS standard_size_height2,
0 AS standard_size3, 0 AS standard_size_height3,
0 AS standard_size4, 0 AS standard_size_height4,
0 AS standard_weight, 0 AS standard_weight,
0 AS detection_error 0 AS detection_error
FROM FROM

20
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/pdm/workorder/service/dao/vo/AcsWorkOrderVo.java

@ -9,15 +9,17 @@ import lombok.Data;
*/ */
@Data @Data
public class AcsWorkOrderVo { public class AcsWorkOrderVo {
private String workorder_code; private String workorder_code; // 工单编码
private String device_code; private String device_code; // 设备编码
private String material_code; private String material_code; // 半成品物料编码 - 工单物料编码
private String to_material_code; private String product_code; // 产品代号 - 成品
private String plan_qty; private String formula; // 配方-泥料
private String a; private String brick_code; // 砖型编码
private String b; private String plan_qty; // 计划数量
private String h; private String a; // a边
private String w; private String b; // b边
private String h; // 高度
private String w; // 宽度
private String size_error; // 尺寸允许误差 private String size_error; // 尺寸允许误差
private String single_weight; // 单重允许误差 private String single_weight; // 单重允许误差
private String drawing_address; // 图纸地址 private String drawing_address; // 图纸地址

15
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/pdm/workorder/service/impl/PdmBdWorkorderServiceImpl.java

@ -17,6 +17,7 @@ import org.nl.common.utils.SecurityUtils;
import org.nl.system.service.notice.ISysNoticeService; import org.nl.system.service.notice.ISysNoticeService;
import org.nl.wms.ext.acs.service.WmsToAcsService; import org.nl.wms.ext.acs.service.WmsToAcsService;
import org.nl.wms.ext.acs.service.dto.ResultForAcs; import org.nl.wms.ext.acs.service.dto.ResultForAcs;
import org.nl.wms.ext.acs.service.dto.to.wms.AcsResponse;
import org.nl.wms.pdm.workorder.service.IPdmBdWorkorderService; import org.nl.wms.pdm.workorder.service.IPdmBdWorkorderService;
import org.nl.wms.pdm.workorder.service.dao.PdmBdWorkorder; import org.nl.wms.pdm.workorder.service.dao.PdmBdWorkorder;
import org.nl.wms.pdm.workorder.service.dao.mapper.PdmBdWorkorderMapper; import org.nl.wms.pdm.workorder.service.dao.mapper.PdmBdWorkorderMapper;
@ -29,8 +30,9 @@ import org.nl.wms.util.TaskUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.Map; import java.util.List;
import java.util.Set; import java.util.Set;
import java.util.concurrent.CopyOnWriteArrayList;
/** /**
* @description 服务实现 * @description 服务实现
@ -132,11 +134,16 @@ public class PdmBdWorkorderServiceImpl extends ServiceImpl<PdmBdWorkorderMapper,
if (ObjectUtil.isNotEmpty(bdWorkorder)) { if (ObjectUtil.isNotEmpty(bdWorkorder)) {
throw new BadRequestException("该设备已有生产工单,不能重复下发"); throw new BadRequestException("该设备已有生产工单,不能重复下发");
} }
/**
* todo: 待优化-虽然一次性下发一个工单为了方便后续多个一起下发此处接口设置为list形式
*/
List<AcsWorkOrderVo> list = new CopyOnWriteArrayList<>();
// 重装数据回ACS,重新根据id找一遍,省的改动以上代码 // 重装数据回ACS,重新根据id找一遍,省的改动以上代码
AcsWorkOrderVo acsWorkOrderVo = pdmBdWorkorderMapper.toAcsWorkOrderById(pdmBdWorkorder.getWorkorder_id()); AcsWorkOrderVo acsWorkOrderVo = pdmBdWorkorderMapper.toAcsWorkOrderById(pdmBdWorkorder.getWorkorder_id());
ResultForAcs resultForAcs; list.add(acsWorkOrderVo);
AcsResponse resultForAcs;
try { try {
resultForAcs = wmsToAcsService.order(acsWorkOrderVo); resultForAcs = wmsToAcsService.order(list);
} catch (Exception e) { } catch (Exception e) {
log.error("工单下发异常:" + e.getMessage()); log.error("工单下发异常:" + e.getMessage());
// 通知 // 通知
@ -144,7 +151,7 @@ public class PdmBdWorkorderServiceImpl extends ServiceImpl<PdmBdWorkorderMapper,
+ pdmBdWorkorder.getWorkorder_code(), NoticeTypeEnum.EXCEPTION.getCode()); + pdmBdWorkorder.getWorkorder_code(), NoticeTypeEnum.EXCEPTION.getCode());
throw new BadRequestException("工单下发失败"); throw new BadRequestException("工单下发失败");
} }
if (resultForAcs.getStatus() != HttpStatus.HTTP_OK) { if (resultForAcs.getCode() != HttpStatus.HTTP_OK) {
// 不成功 // 不成功
noticeService.createNotice(resultForAcs.getMessage(), "工单下发失败: " + pdmBdWorkorder.getWorkorder_code(), noticeService.createNotice(resultForAcs.getMessage(), "工单下发失败: " + pdmBdWorkorder.getWorkorder_code(),
NoticeTypeEnum.EXCEPTION.getCode()); NoticeTypeEnum.EXCEPTION.getCode());

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

@ -10,9 +10,9 @@ import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.nl.common.exception.BadRequestException; import org.nl.common.exception.BadRequestException;
import org.nl.wms.ext.acs.service.dto.ResultForAcs; import org.nl.wms.ext.acs.service.WmsToAcsService;
import org.nl.wms.ext.acs.service.dto.to.acs.CreateTaskRequest; import org.nl.wms.ext.acs.service.dto.to.acs.IssueAcsRequest;
import org.nl.wms.ext.acs.service.dto.to.wms.CreateTaskResponse; import org.nl.wms.ext.acs.service.dto.to.wms.AcsResponse;
import org.nl.wms.ext.record.service.ISysInteractRecordService; import org.nl.wms.ext.record.service.ISysInteractRecordService;
import org.nl.wms.pdm.workorder.service.IPdmBdWorkorderService; import org.nl.wms.pdm.workorder.service.IPdmBdWorkorderService;
import org.nl.wms.pdm.workorder.service.dao.PdmBdWorkorder; import org.nl.wms.pdm.workorder.service.dao.PdmBdWorkorder;
@ -32,6 +32,7 @@ import org.springframework.stereotype.Component;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;
/** /**
* @author ldjun * @author ldjun
@ -52,6 +53,8 @@ public abstract class AbstractTask {
private IPdmBdWorkorderService workorderService; private IPdmBdWorkorderService workorderService;
@Autowired @Autowired
private ISysInteractRecordService interactRecordService; private ISysInteractRecordService interactRecordService;
@Autowired
private WmsToAcsService wmsToAcsService;
/** /**
* 任务创建 * 任务创建
@ -66,7 +69,7 @@ public abstract class AbstractTask {
* @author ldjun * @author ldjun
* @created 2020年6月12日 下午5:52:28 * @created 2020年6月12日 下午5:52:28
*/ */
protected CreateTaskResponse renotifyAcs(SchBaseTask task) { protected AcsResponse renotifyAcs(SchBaseTask task) {
Assert.notNull(task); Assert.notNull(task);
List<SchBaseTask> taskList = new ArrayList<>(); List<SchBaseTask> taskList = new ArrayList<>();
taskList.add(task); taskList.add(task);
@ -79,12 +82,12 @@ public abstract class AbstractTask {
* @author ldjun * @author ldjun
* @created 2020年6月12日 下午5:52:28 * @created 2020年6月12日 下午5:52:28
*/ */
protected CreateTaskResponse renotifyAcs(List<SchBaseTask> taskList) { protected AcsResponse renotifyAcs(List<SchBaseTask> taskList) {
CreateTaskResponse resultForAcs = CreateTaskResponse.requestOk(); AcsResponse resultForAcs = AcsResponse.requestOk();
//1、获取任务 //1、获取任务
//2、根据任务配置补全任务 //2、根据任务配置补全任务
//3、下发 //3、下发
List<AcsTaskDto> list = new ArrayList<>(); List<AcsTaskDto> list = new CopyOnWriteArrayList<>();
for (SchBaseTask task : taskList) { for (SchBaseTask task : taskList) {
AcsTaskDto taskDto = new AcsTaskDto(); AcsTaskDto taskDto = new AcsTaskDto();
String responseParam = task.getResponse_param(); String responseParam = task.getResponse_param();
@ -106,14 +109,14 @@ public abstract class AbstractTask {
} }
try { try {
// 创建下发对象 // 创建下发对象
resultForAcs = AcsUtil.notifyAcs2("api/wms/task", resultForAcs = wmsToAcsService.renotifyAcs(list);
CreateTaskRequest.buildRequestObj("下发任务", list));
} catch (Exception e) { } catch (Exception e) {
log.error("任务下发异常: {}", e.getMessage()); log.error("任务下发异常: {}", e.getMessage());
resultForAcs.setResponseDate(DateUtil.now()); resultForAcs.setResponseDate(DateUtil.now());
resultForAcs.setCode(HttpStatus.HTTP_BAD_REQUEST); resultForAcs.setCode(HttpStatus.HTTP_BAD_REQUEST);
resultForAcs.setMessage(e.getMessage()); resultForAcs.setMessage(e.getMessage());
} }
// todo: 可优化点:解除双层循环判断任务的完成性
// 如果下发完毕,就修改状态 // 如果下发完毕,就修改状态
if (resultForAcs.getCode() == 200) { if (resultForAcs.getCode() == 200) {
// 解析 // 解析
@ -138,8 +141,6 @@ public abstract class AbstractTask {
} }
taskService.updateBatchById(taskList); taskService.updateBatchById(taskList);
} }
// 记录日志
interactRecordService.saveRecord("下发任务", list, resultForAcs, GeneralDefinition.LMS_ACS);
return resultForAcs; return resultForAcs;
} }

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

@ -1,7 +1,6 @@
package org.nl.wms.sch.task_manage; package org.nl.wms.sch.task_manage;
import lombok.Data; import lombok.Data;
import org.nl.wms.ext.acs.service.dto.to.acs.CreateTaskRequest;
import java.util.Map; import java.util.Map;

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

@ -6,6 +6,8 @@ package org.nl.wms.sch.task_manage;
* @Date: 2023/7/13 * @Date: 2023/7/13
*/ */
public class GeneralDefinition { public class GeneralDefinition {
/** 未知 */
public static final String UNKNOWN = "-";
// 统一编码定义 // 统一编码定义
/** 窑自动任务开启 */ /** 窑自动任务开启 */
public static final String AUTO_KILN_CALL = "auto_kiln_call"; public static final String AUTO_KILN_CALL = "auto_kiln_call";

27
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/AcsUtil.java

@ -6,13 +6,11 @@ import cn.hutool.http.HttpRequest;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.nl.common.exception.BadRequestException;
import org.nl.config.SpringContextHolder; import org.nl.config.SpringContextHolder;
import org.nl.system.service.param.dao.Param; import org.nl.system.service.param.dao.Param;
import org.nl.system.service.param.impl.SysParamServiceImpl; import org.nl.system.service.param.impl.SysParamServiceImpl;
import org.nl.wms.ext.acs.service.dto.ResultForAcs; import org.nl.wms.ext.acs.service.dto.ResultForAcs;
import org.nl.wms.ext.acs.service.dto.to.acs.CreateTaskRequest; import org.nl.wms.ext.acs.service.dto.to.wms.AcsResponse;
import org.nl.wms.ext.acs.service.dto.to.wms.CreateTaskResponse;
import org.nl.wms.sch.task_manage.GeneralDefinition; import org.nl.wms.sch.task_manage.GeneralDefinition;
import java.util.List; import java.util.List;
@ -23,7 +21,7 @@ import java.util.List;
@Slf4j @Slf4j
public class AcsUtil { public class AcsUtil {
/** /**
* 统一多数据入口 默认执行的参数都是jsonArray * 原生默认请求方法 默认执行的参数都是jsonArray
* @param api * @param api
* @param list * @param list
* @return * @return
@ -67,38 +65,45 @@ public class AcsUtil {
return resultForAcs; return resultForAcs;
} }
public static <T> CreateTaskResponse notifyAcs2(String api, T object) { /**
* 新的请求方式对象中包含数组
* @param api
* @param object
* @return
* @param <T>
*/
public static <T> AcsResponse notifyAcs2(String api, T object) {
SysParamServiceImpl sysParamService = SpringContextHolder.getBean(SysParamServiceImpl.class); SysParamServiceImpl sysParamService = SpringContextHolder.getBean(SysParamServiceImpl.class);
//判断是否连接ACS系统 //判断是否连接ACS系统
Param isConnectAcs = sysParamService.findByCode(GeneralDefinition.IS_CONNECT_ACS); Param isConnectAcs = sysParamService.findByCode(GeneralDefinition.IS_CONNECT_ACS);
if (ObjectUtil.isEmpty(isConnectAcs)) { if (ObjectUtil.isEmpty(isConnectAcs)) {
return CreateTaskResponse.requestRefuse("参数表中:" + GeneralDefinition.IS_CONNECT_ACS + "不存在"); return AcsResponse.requestRefuse("参数表中:" + GeneralDefinition.IS_CONNECT_ACS + "不存在");
} }
String isConnect = isConnectAcs.getValue(); String isConnect = isConnectAcs.getValue();
//ACS地址:127.0.0.1:8010 //ACS地址:127.0.0.1:8010
Param acsUrlObj = sysParamService.findByCode(GeneralDefinition.ACS_URL); Param acsUrlObj = sysParamService.findByCode(GeneralDefinition.ACS_URL);
if (ObjectUtil.isEmpty(acsUrlObj)) { if (ObjectUtil.isEmpty(acsUrlObj)) {
return CreateTaskResponse.requestRefuse("参数表中:" + GeneralDefinition.ACS_URL + "不存在"); return AcsResponse.requestRefuse("参数表中:" + GeneralDefinition.ACS_URL + "不存在");
} }
String acsUrl = acsUrlObj.getValue(); String acsUrl = acsUrlObj.getValue();
JSONObject result; JSONObject result;
if (StrUtil.equals(GeneralDefinition.NO, isConnect)) { if (StrUtil.equals(GeneralDefinition.NO, isConnect)) {
return CreateTaskResponse.requestRefuse("未连接ACS!"); return AcsResponse.requestRefuse("未连接ACS!");
} }
String url = acsUrl + api; String url = acsUrl + api;
log.info("下发acs任务的参数为:{}", object.toString()); log.info("下发acs任务的参数为:{}", object.toString());
CreateTaskResponse resultForAcs; AcsResponse resultForAcs;
try { try {
String resultMsg = HttpRequest.post(url) String resultMsg = HttpRequest.post(url)
.body(JSON.toJSONString(object)) .body(JSON.toJSONString(object))
.execute().body(); .execute().body();
result = JSONObject.parseObject(resultMsg); result = JSONObject.parseObject(resultMsg);
resultForAcs = JSONObject.toJavaObject(result, CreateTaskResponse.class); resultForAcs = JSONObject.toJavaObject(result, AcsResponse.class);
} catch (Exception e) { } catch (Exception e) {
String msg = e.getMessage(); String msg = e.getMessage();
//网络不通 //网络不通
log.error("连接失败:{}", msg); log.error("连接失败:{}", msg);
return CreateTaskResponse.requestRefuse("网络不通,操作失败!"); return AcsResponse.requestRefuse("网络不通,操作失败!");
} }
return resultForAcs; return resultForAcs;
} }

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

@ -102,8 +102,16 @@ public class FJMKTask extends AbstractTask {
for (ApplyDeviceDto applyDeviceDto : list) { for (ApplyDeviceDto applyDeviceDto : list) {
sum += Integer.parseInt(applyDeviceDto.getQty()); sum += Integer.parseInt(applyDeviceDto.getQty());
} }
// 2 获取库存数量 // 2.1 获取库存剩余数量 + 2.2 获取在搬运任务 - 组盘绑定状态是带绑定状态、任务类型是创建完成、下发、执行中
int surplusNumber = fjMapper.getInventoryQuantity();
int total = sum + surplusNumber; // 现有总数
// 3 获取木托盘需要多少块 // 3 获取木托盘需要多少块
int needFullNumber = 0; // todo: 具体未知如何获取
// 4 校验是否够码满一托
if (total > needFullNumber) {
// 可以叫空木托盘
}
/** 覆膜机木托盘位 */ /** 覆膜机木托盘位 */
SchBasePoint LaminatePoint = findStartPoint(startRegionStr, jsonObject); SchBasePoint LaminatePoint = findStartPoint(startRegionStr, jsonObject);
if (ObjectUtil.isEmpty(LaminatePoint)) { if (ObjectUtil.isEmpty(LaminatePoint)) {
@ -156,12 +164,11 @@ public class FJMKTask extends AbstractTask {
String vehicleCode = basePoint.getVehicle_code(); String vehicleCode = basePoint.getVehicle_code();
String vehicleType = basePoint.getVehicle_type(); String vehicleType = basePoint.getVehicle_type();
// 找到相同组盘信息就直接返回id,避免任务取消组盘信息还存在,重复插入 // 找到相同组盘信息就直接返回id,避免任务取消组盘信息还存在,重复插入
SchBaseVehiclematerialgroup groupEntity = new SchBaseVehiclematerialgroup(); SchBaseVehiclematerialgroup groupEntity = vehiclematerialgroupService.getGroupInfo(vehicleCode, vehicleType,
groupEntity.setGroup_id(IdUtil.getSnowflake(1, 1).nextIdStr());
SchBaseVehiclematerialgroup groupObject = vehiclematerialgroupService.getGroupInfo(vehicleCode, vehicleType,
GroupBindMaterialStatusEnum.BOUND.getValue(), workorderObject.getMaterial_id()); GroupBindMaterialStatusEnum.BOUND.getValue(), workorderObject.getMaterial_id());
if (groupObject != null) { if (groupEntity == null) {
groupEntity = groupObject; groupEntity = new SchBaseVehiclematerialgroup();
groupEntity.setGroup_id(IdUtil.getSnowflake(1, 1).nextIdStr());
} }
// 要把数据存到组盘表 // 要把数据存到组盘表
groupEntity.setMaterial_id(ObjectUtil.isNotEmpty(workorderObject) groupEntity.setMaterial_id(ObjectUtil.isNotEmpty(workorderObject)
@ -190,7 +197,7 @@ public class FJMKTask extends AbstractTask {
groupEntity.setGroup_status(GroupStatusEnum.IN_STORAGE.getType()); // 暂时不维护。 groupEntity.setGroup_status(GroupStatusEnum.IN_STORAGE.getType()); // 暂时不维护。
groupEntity.setIs_delete(false); groupEntity.setIs_delete(false);
groupEntity.setIs_full(isFull.equals(GeneralDefinition.YES) ? true : false); groupEntity.setIs_full(isFull.equals(GeneralDefinition.YES) ? true : false);
vehiclematerialgroupService.save(groupEntity); vehiclematerialgroupService.saveOrUpdate(groupEntity);
// 返回组盘id记录任务中 // 返回组盘id记录任务中
return groupEntity.getGroup_id(); return groupEntity.getGroup_id();
} }

2
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/fj/mapper/FJMapper.java

@ -16,4 +16,6 @@ public interface FJMapper {
List<SchBasePoint> findPointForFJSK(List<String> regionCode); List<SchBasePoint> findPointForFJSK(List<String> regionCode);
SchBasePoint findPointForFJQK(List<String> regionCode, @Param("fluentPut") JSONObject fluentPut); SchBasePoint findPointForFJQK(List<String> regionCode, @Param("fluentPut") JSONObject fluentPut);
int getInventoryQuantity();
} }

14
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/fj/mapper/FJMapper.xml

@ -46,4 +46,18 @@
#{code} #{code}
</foreach> </foreach>
</select> </select>
<select id="getInventoryQuantity" resultType="java.lang.Integer">
SELECT
SUM(vg.material_qty) AS sum
FROM
`sch_base_vehiclematerialgroup` vg
WHERE (vg.point_code IN (
SELECT p.point_code FROM sch_base_point p WHERE p.region_code = 'GTPHC' AND p.point_status = '3' AND p.point_type = '2'
) AND vg.group_bind_material_status = '2')
OR (
vg.point_code IN (
SELECT t.point_code1 FROM sch_base_task t WHERE t.task_status IN (2,3,4) AND t.config_code = 'GZYMLTask'
) AND vg.group_bind_material_status = '1'
)
</select>
</mapper> </mapper>

32
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/hn/HNMLTask.java

@ -96,7 +96,7 @@ public class HNMLTask extends AbstractTask {
*/ */
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
protected void create() { // 找点+下发定时任务 protected void create() { // 找点+下发-定时任务
// 获取任务 // 获取任务
List<SchBaseTask> tasks = taskService.findTasksByTaskStatus(TASK_CONFIG_CODE, TaskStatus.APPLY); List<SchBaseTask> tasks = taskService.findTasksByTaskStatus(TASK_CONFIG_CODE, TaskStatus.APPLY);
// 配置信息 // 配置信息
@ -125,10 +125,7 @@ public class HNMLTask extends AbstractTask {
task.setRemark(""); task.setRemark("");
task.setVehicle_type(GeneralDefinition.MATERIAL_CUP); task.setVehicle_type(GeneralDefinition.MATERIAL_CUP);
// 告知acs去左边右边 // 告知acs去左边右边
String deviceCode = point.getDevice_code(); // 获取设备编码 int number = getNumber(point);
int number = Integer.parseInt(deviceCode.replaceAll("[^0-9]", ""));
// 1左边2右边
number = (number % 2) == 0 ? 2 : (number % 2);
task.setResponse_param(new JSONObject().fluentPut("direction", number).toJSONString()); task.setResponse_param(new JSONObject().fluentPut("direction", number).toJSONString());
taskService.updateById(task); taskService.updateById(task);
@ -142,6 +139,14 @@ public class HNMLTask extends AbstractTask {
} }
private static int getNumber(SchBasePoint point) {
String deviceCode = point.getDevice_code(); // 获取设备编码
int number = Integer.parseInt(deviceCode.replaceAll("[^0-9]", ""));
// 1左边2右边
number = (number % 2) == 0 ? 2 : (number % 2);
return number;
}
/** /**
* 根据压机工单的原料编码以及点位的更新时间 * 根据压机工单的原料编码以及点位的更新时间
* *
@ -179,9 +184,7 @@ public class HNMLTask extends AbstractTask {
public void finishTask(SchBaseTask taskObj, TaskFinishedTypeEnum taskFinishedType) { public void finishTask(SchBaseTask taskObj, TaskFinishedTypeEnum taskFinishedType) {
// 获取参数 // 获取参数
String startPoint = taskObj.getPoint_code1(); // 起点
String endPoint = taskObj.getPoint_code2(); // 终点 String endPoint = taskObj.getPoint_code2(); // 终点
SchBasePoint startPointObj = pointService.getById(startPoint);
SchBasePoint endPointObj = pointService.getById(endPoint); SchBasePoint endPointObj = pointService.getById(endPoint);
String responseParam = taskObj.getResponse_param(); String responseParam = taskObj.getResponse_param();
JSONObject responseObj = JSONObject.parseObject(responseParam); JSONObject responseObj = JSONObject.parseObject(responseParam);
@ -196,9 +199,6 @@ public class HNMLTask extends AbstractTask {
// 终点去除正在执行的任务, 设置载具编码、载具类型、载具数量 // 终点去除正在执行的任务, 设置载具编码、载具类型、载具数量
if (ObjectUtil.isNotEmpty(endPointObj)) { if (ObjectUtil.isNotEmpty(endPointObj)) {
endPointObj.setIng_task_code(""); endPointObj.setIng_task_code("");
// endPointObj.setVehicle_code(vehicle_code);
// endPointObj.setVehicle_type(vehicleType);
// endPointObj.setPoint_status(PointStatusEnum.FULL_POINT.getCode()); // 有料
endPointObj.setVehicle_qty(1); endPointObj.setVehicle_qty(1);
PointUtils.setUpdateByType(endPointObj, taskFinishedType); PointUtils.setUpdateByType(endPointObj, taskFinishedType);
pointService.updateById(endPointObj); pointService.updateById(endPointObj);
@ -240,7 +240,6 @@ public class HNMLTask extends AbstractTask {
TaskUtils.setGroupUpdateByType(groupEntity, taskFinishedType); TaskUtils.setGroupUpdateByType(groupEntity, taskFinishedType);
vehiclematerialgroupService.updateById(groupEntity); vehiclematerialgroupService.updateById(groupEntity);
// 起点清空 - 由ACS请求修改 // 起点清空 - 由ACS请求修改
// PointUtils.clearPoint(startPointObj);
taskObj.setRemark(GeneralDefinition.TASK_FINISH); taskObj.setRemark(GeneralDefinition.TASK_FINISH);
taskObj.setTask_status(TaskStatus.FINISHED.getCode()); taskObj.setTask_status(TaskStatus.FINISHED.getCode());
taskObj.setFinished_type(taskFinishedType.getCode()); taskObj.setFinished_type(taskFinishedType.getCode());
@ -288,17 +287,16 @@ public class HNMLTask extends AbstractTask {
if (vehicleCode == null || vehicleCode.equals(GeneralDefinition.NO)) { if (vehicleCode == null || vehicleCode.equals(GeneralDefinition.NO)) {
throw new BadRequestException("载具编码不能为空"); throw new BadRequestException("载具编码不能为空");
} }
SchBaseVehiclematerialgroup groupEntity = new SchBaseVehiclematerialgroup();
groupEntity.setGroup_id(IdUtil.getSnowflake(1, 1).nextIdStr());
// 找到相同组盘信息就直接返回id,避免任务取消组盘信息还存在,重复插入 // 找到相同组盘信息就直接返回id,避免任务取消组盘信息还存在,重复插入
// 找到不直接返回,用那条数据进行修改 // 找到不直接返回,用那条数据进行修改
SchBaseVehiclematerialgroup groupObject = vehiclematerialgroupService.getGroupInfo(vehicleCode, vehicleType, SchBaseVehiclematerialgroup groupEntity = vehiclematerialgroupService.getGroupInfo(vehicleCode, vehicleType,
GroupBindMaterialStatusEnum.BOUND.getValue()); GroupBindMaterialStatusEnum.BOUND.getValue());
if (groupObject != null) { if (groupEntity == null) {
groupEntity = groupObject; groupEntity = new SchBaseVehiclematerialgroup();
groupEntity.setGroup_id(IdUtil.getSnowflake(1, 1).nextIdStr());
} }
// 要把数据存到组盘表 // 要把数据存到组盘表
groupEntity.setMaterial_id("-"); groupEntity.setMaterial_id(GeneralDefinition.UNKNOWN); // 物料标识等任务完成后赋值
groupEntity.setRedundance_material_code(materialCode); groupEntity.setRedundance_material_code(materialCode);
groupEntity.setCreate_id(GeneralDefinition.ACS_ID); groupEntity.setCreate_id(GeneralDefinition.ACS_ID);
groupEntity.setCreate_name(GeneralDefinition.ACS_NAME); groupEntity.setCreate_name(GeneralDefinition.ACS_NAME);

332
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/hn/HNQKTask.java

@ -1,166 +1,166 @@
//package org.nl.wms.sch.task_manage.task.tasks.hn; package org.nl.wms.sch.task_manage.task.tasks.hn;
//
//import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
//import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
//import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
//import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
//import org.nl.common.exception.BadRequestException; import org.nl.common.exception.BadRequestException;
//import org.nl.wms.pdm.service.IPdmBdWorkorderService; import org.nl.wms.pdm.workorder.service.IPdmBdWorkorderService;
//import org.nl.wms.pdm.service.dao.PdmBdWorkorder; import org.nl.wms.sch.point.service.ISchBasePointService;
//import org.nl.wms.sch.point.service.ISchBasePointService; import org.nl.wms.sch.point.service.dao.SchBasePoint;
//import org.nl.wms.sch.point.service.dao.SchBasePoint; import org.nl.wms.sch.task.service.ISchBaseTaskService;
//import org.nl.wms.sch.task.service.ISchBaseTaskService; import org.nl.wms.sch.task.service.ISchBaseTaskconfigService;
//import org.nl.wms.sch.task.service.ISchBaseTaskconfigService; import org.nl.wms.sch.task.service.dao.SchBaseTask;
//import org.nl.wms.sch.task.service.dao.SchBaseTask; import org.nl.wms.sch.task.service.dao.SchBaseTaskconfig;
//import org.nl.wms.sch.task.service.dao.SchBaseTaskconfig; import org.nl.wms.sch.task_manage.AbstractTask;
//import org.nl.wms.sch.task_manage.AbstractTask; import org.nl.wms.sch.task_manage.GeneralDefinition;
//import org.nl.wms.sch.task_manage.enums.PointStatusEnum; import org.nl.wms.sch.task_manage.enums.PointStatusEnum;
//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.TaskType; 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.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 org.springframework.transaction.annotation.Transactional;
// import java.util.Arrays;
//import java.util.Arrays; import java.util.List;
//import java.util.List; import java.util.stream.Collectors;
//import java.util.stream.Collectors;
// /**
///** * @Author: lyd
// * @Author: lyd * @Description: 混料缺空呼叫空载具
// * @Description: 混料缺空:呼叫空载具 * @Date: 2023/5/19
// * @Date: 2023/5/19 */
// */ @Deprecated
//@Component @Component
//@TaskType("HLQKTask") @TaskType("--")
//public class HNQKTask extends AbstractTask { public class HNQKTask extends AbstractTask {
// private static String TASK_CONFIG_CODE = "HLQKTask"; private static String TASK_CONFIG_CODE = "--";
// private static String EMPTY_ZHONG = "1"; private static String EMPTY_ZHONG = "1";
//
// @Autowired @Autowired
// private ISchBasePointService pointService; private ISchBasePointService pointService;
// @Autowired @Autowired
// private ISchBaseTaskService taskService; private ISchBaseTaskService taskService;
// @Autowired @Autowired
// private ISchBaseTaskconfigService taskConfigService; private ISchBaseTaskconfigService taskConfigService;
// @Autowired @Autowired
// private IPdmBdWorkorderService workorderService; private IPdmBdWorkorderService workorderService;
//
// /** /**
// * 具体业务 * 具体业务
// */ */
// @Override @Override
// @Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
// protected void create() { protected void create() {
// // 获取任务 // 获取任务
// List<SchBaseTask> tasks = taskService.findTasksByTaskStatus(TASK_CONFIG_CODE, TaskStatus.APPLY); List<SchBaseTask> tasks = taskService.findTasksByTaskStatus(TASK_CONFIG_CODE, TaskStatus.APPLY);
// // 配置信息 // 配置信息
// SchBaseTaskconfig taskConfig = taskConfigService.getOne(new LambdaQueryWrapper<SchBaseTaskconfig>() SchBaseTaskconfig taskConfig = taskConfigService.getOne(new LambdaQueryWrapper<SchBaseTaskconfig>()
// .eq(SchBaseTaskconfig::getConfig_code, TASK_CONFIG_CODE)); .eq(SchBaseTaskconfig::getConfig_code, TASK_CONFIG_CODE));
// for (SchBaseTask task : tasks) { for (SchBaseTask task : tasks) {
// List<String> startRegionStr = Arrays.stream(taskConfig.getStart_region_str().split(",")).collect(Collectors.toList()); List<String> startRegionStr = Arrays.stream(taskConfig.getStart_region_str().split(",")).collect(Collectors.toList());
// // 找起点 // 找起点
// String extGroupData = task.getExt_group_data(); String extGroupData = task.getExt_group_data();
// JSONObject jsonObject = JSONObject.parseObject(extGroupData); JSONObject jsonObject = JSONObject.parseObject(extGroupData);
// SchBasePoint point = findStartPoint(startRegionStr, jsonObject); SchBasePoint point = findStartPoint(startRegionStr, jsonObject);
// if (ObjectUtil.isEmpty(point)) { if (ObjectUtil.isEmpty(point)) {
// task.setRemark("未找到所需点位!"); task.setRemark("未找到所需点位!");
// taskService.update(task); taskService.update(task);
// // 消息通知 // 消息通知
// continue; continue;
// } }
// // 设置终点并修改创建成功状态 // 设置终点并修改创建成功状态
// task.setPoint_code1(point.getPoint_code()); task.setPoint_code1(point.getPoint_code());
// task.setRemark(""); task.setRemark("");
// task.setTask_status(TaskStatus.CREATED.getCode()); task.setTask_status(TaskStatus.CREATED.getCode());
// taskService.update(task); taskService.update(task);
//
// point.setIng_task_code(task.getTask_code()); point.setIng_task_code(task.getTask_code());
// pointService.update(point); pointService.update(point);
//
// //下发 //下发
//// this.renotifyAcs(task); // this.renotifyAcs(task);
// } }
// } }
//
// /** /**
// * 找起点, 通过料盅睏料线区域的空盅位置找到空盅 * 找起点, 通过料盅睏料线区域的空盅位置找到空盅
// * *
// * @param startRegionStr * @param startRegionStr
// * @param extGroupData * @param extGroupData
// * @return * @return
// */ */
// private SchBasePoint findStartPoint(List<String> startRegionStr, JSONObject extGroupData) { private SchBasePoint findStartPoint(List<String> startRegionStr, JSONObject extGroupData) {
// LambdaQueryWrapper<SchBasePoint> lam = new LambdaQueryWrapper<>(); LambdaQueryWrapper<SchBasePoint> lam = new LambdaQueryWrapper<>();
// lam.in(SchBasePoint::getRegion_code, startRegionStr) lam.in(SchBasePoint::getRegion_code, startRegionStr)
// .eq(SchBasePoint::getPoint_status, PointStatusEnum.EMPTY_VEHICLE.getCode()) .eq(SchBasePoint::getPoint_status, PointStatusEnum.EMPTY_VEHICLE.getCode())
// .eq(SchBasePoint::getPoint_type, EMPTY_ZHONG) .eq(SchBasePoint::getPoint_type, EMPTY_ZHONG)
// .and(la -> la.isNull(SchBasePoint::getIng_task_code) // 当前执行的任务为空或者NULL,有数据表示锁住 .and(la -> la.isNull(SchBasePoint::getIng_task_code) // 当前执行的任务为空或者NULL,有数据表示锁住
// .or() .or()
// .eq(SchBasePoint::getIng_task_code, "")) .eq(SchBasePoint::getIng_task_code, ""))
// .orderByAsc(SchBasePoint::getIn_order_seq) .orderByAsc(SchBasePoint::getIn_order_seq)
// .orderByAsc(SchBasePoint::getPoint_code); .orderByAsc(SchBasePoint::getPoint_code);
// List<SchBasePoint> schBasePoints = pointService.list(lam); List<SchBasePoint> schBasePoints = pointService.list(lam);
// return ObjectUtil.isNotEmpty(schBasePoints) ? schBasePoints.get(0) : null; return ObjectUtil.isNotEmpty(schBasePoints) ? schBasePoints.get(0) : null;
// } }
//
// @Override @Override
// @Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
// protected void updateStatus(String task_code, TaskStatus status) { protected void updateStatus(String task_code, TaskStatus status) {
// // 校验任务 // 校验任务
// SchBaseTask taskObj = taskService.getByCode(task_code); SchBaseTask taskObj = taskService.getByCode(task_code);
// if (taskObj.getTask_status().equals(TaskStatus.FINISHED.getCode())) { if (taskObj.getTask_status().equals(TaskStatus.FINISHED.getCode())) {
// throw new BadRequestException("该任务已完成!"); throw new BadRequestException("该任务已完成!");
// } }
// if (taskObj.getTask_status().equals(TaskStatus.CANCELED.getCode())) { if (taskObj.getTask_status().equals(TaskStatus.CANCELED.getCode())) {
// throw new BadRequestException("该任务已取消!"); throw new BadRequestException("该任务已取消!");
// } }
// // 获取参数 // 获取参数
// String startPoint = taskObj.getPoint_code1(); // 获取起点 String startPoint = taskObj.getPoint_code1(); // 获取起点
// String endPoint = taskObj.getPoint_code2(); // 获取起点 String endPoint = taskObj.getPoint_code2(); // 获取起点
// SchBasePoint startPointObj = pointService.getById(startPoint); SchBasePoint startPointObj = pointService.getById(startPoint);
// SchBasePoint endPointObj = pointService.getById(endPoint); SchBasePoint endPointObj = pointService.getById(endPoint);
// // 根据传来的类型去对任务进行操作 // 根据传来的类型去对任务进行操作
// if (status.equals(TaskStatus.EXECUTING)) { // 执行中 if (status.equals(TaskStatus.EXECUTING)) { // 执行中
// taskObj.setTask_status(TaskStatus.EXECUTING.getCode()); taskObj.setTask_status(TaskStatus.EXECUTING.getCode());
// taskObj.setRemark("执行中"); taskObj.setRemark("执行中");
// } }
// if (status.equals(TaskStatus.FINISHED)) { // 完成 if (status.equals(TaskStatus.FINISHED)) { // 完成
// // 起点清空 // 起点清空
// if (ObjectUtil.isNotEmpty(startPointObj)) { if (ObjectUtil.isNotEmpty(startPointObj)) {
// PointUtils.clearPoint(startPointObj); PointUtils.clearPoint(startPointObj);
// taskObj.setVehicle_code(startPointObj.getVehicle_code()); taskObj.setVehicle_code(startPointObj.getVehicle_code());
// endPointObj.setPoint_status(PointStatusEnum.EMPTY_VEHICLE.getCode()); endPointObj.setPoint_status(PointStatusEnum.EMPTY_VEHICLE.getCode());
// endPointObj.setVehicle_type("1"); endPointObj.setVehicle_type("1");
// endPointObj.setVehicle_code(startPointObj.getVehicle_code()); endPointObj.setVehicle_code(startPointObj.getVehicle_code());
// endPointObj.setVehicle_qty(1); endPointObj.setVehicle_qty(1);
// endPointObj.setUpdate_time(DateUtil.now()); endPointObj.setUpdate_time(DateUtil.now());
// pointService.updateById(endPointObj); pointService.updateById(endPointObj);
// } }
// // 任务完成 // 任务完成
// taskObj.setTask_status(TaskStatus.FINISHED.getCode()); taskObj.setTask_status(TaskStatus.FINISHED.getCode());
// taskObj.setRemark(GeneralDefinition.TASK_FINISH); taskObj.setRemark(GeneralDefinition.TASK_FINISH);
// } }
// if (status.equals(TaskStatus.CANCELED)) { // 取消 if (status.equals(TaskStatus.CANCELED)) { // 取消
// // 起点解锁 // 起点解锁
// if (ObjectUtil.isNotEmpty(startPointObj)) { if (ObjectUtil.isNotEmpty(startPointObj)) {
// startPointObj.setIng_task_code(""); startPointObj.setIng_task_code("");
// pointService.update(startPointObj); pointService.update(startPointObj);
// } }
// taskObj.setTask_status(TaskStatus.CANCELED.getCode()); taskObj.setTask_status(TaskStatus.CANCELED.getCode());
// } }
// taskService.update(taskObj); taskService.update(taskObj);
// } }
//
// @Override @Override
// public void forceFinish(String task_code) { public void forceFinish(String task_code) {
// this.updateStatus(task_code, TaskStatus.FINISHED); this.updateStatus(task_code, TaskStatus.FINISHED);
// } }
//
// @Override @Override
// public void cancel(String task_code) { public void cancel(String task_code) {
// this.updateStatus(task_code, TaskStatus.CANCELED); this.updateStatus(task_code, TaskStatus.CANCELED);
// } }
//} }
//

342
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/yz/YZQLTask.java

@ -1,171 +1,171 @@
//package org.nl.wms.sch.task_manage.task.tasks.yz; package org.nl.wms.sch.task_manage.task.tasks.yz;
//
//import cn.hutool.core.lang.Assert; import cn.hutool.core.lang.Assert;
//import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
//import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
//import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
//import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
//import org.nl.common.exception.BadRequestException; import org.nl.common.exception.BadRequestException;
//import org.nl.wms.pdm.service.IPdmBdWorkorderService; import org.nl.wms.pdm.workorder.service.IPdmBdWorkorderService;
//import org.nl.wms.pdm.service.dao.PdmBdWorkorder; import org.nl.wms.pdm.workorder.service.dao.PdmBdWorkorder;
//import org.nl.wms.sch.group.service.ISchBaseVehiclematerialgroupService; import org.nl.wms.sch.group.service.ISchBaseVehiclematerialgroupService;
//import org.nl.wms.sch.group.service.dao.SchBaseVehiclematerialgroup; import org.nl.wms.sch.group.service.dao.SchBaseVehiclematerialgroup;
//import org.nl.wms.sch.point.service.ISchBasePointService; import org.nl.wms.sch.point.service.ISchBasePointService;
//import org.nl.wms.sch.point.service.dao.SchBasePoint; import org.nl.wms.sch.point.service.dao.SchBasePoint;
//import org.nl.wms.sch.task.service.ISchBaseTaskService; import org.nl.wms.sch.task.service.ISchBaseTaskService;
//import org.nl.wms.sch.task.service.ISchBaseTaskconfigService; import org.nl.wms.sch.task.service.ISchBaseTaskconfigService;
//import org.nl.wms.sch.task.service.dao.SchBaseTask; import org.nl.wms.sch.task.service.dao.SchBaseTask;
//import org.nl.wms.sch.task.service.dao.SchBaseTaskconfig; import org.nl.wms.sch.task.service.dao.SchBaseTaskconfig;
//import org.nl.wms.sch.task_manage.AbstractTask; import org.nl.wms.sch.task_manage.AbstractTask;
//import org.nl.wms.sch.task_manage.enums.GroupBindMaterialStatusEnum; import org.nl.wms.sch.task_manage.enums.GroupBindMaterialStatusEnum;
//import org.nl.wms.sch.task_manage.enums.PointStatusEnum; import org.nl.wms.sch.task_manage.task.TaskType;
//import org.nl.wms.sch.task_manage.task.TaskType; 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.tasks.yz.mapper.YZMapper;
//import org.nl.wms.sch.task_manage.task.tasks.yz.mapper.YZMapper; import org.nl.wms.util.PointUtils;
//import org.nl.wms.util.PointUtils; 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 java.util.Arrays;
//import java.util.Arrays; import java.util.List;
//import java.util.List; import java.util.stream.Collectors;
//import java.util.stream.Collectors;
// /**
///** * @Author: lyd
// * @Author: lyd * @Description: 压制缺料任务
// * @Description: 压制缺料任务 * @Date: 2023/5/25
// * @Date: 2023/5/25 */
// */ @Slf4j
//@Slf4j @Deprecated
//@Component @Component
//@TaskType("YZQLTask") @TaskType("-")
//public class YZQLTask extends AbstractTask { public class YZQLTask extends AbstractTask {
// private static String TASK_CONFIG_CODE = "YZQLTask"; private static String TASK_CONFIG_CODE = "-";
//
// @Autowired @Autowired
// private ISchBasePointService pointService; private ISchBasePointService pointService;
// @Autowired @Autowired
// private ISchBaseTaskService taskService; private ISchBaseTaskService taskService;
// @Autowired @Autowired
// private ISchBaseTaskconfigService taskConfigService; private ISchBaseTaskconfigService taskConfigService;
// @Autowired @Autowired
// private ISchBaseVehiclematerialgroupService vehiclematerialgroupService; private ISchBaseVehiclematerialgroupService vehiclematerialgroupService;
// @Autowired @Autowired
// private IPdmBdWorkorderService workorderService; private IPdmBdWorkorderService workorderService;
// @Autowired @Autowired
// private YZMapper yzMapper; private YZMapper yzMapper;
//
// @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);
// // 配置信息 // 配置信息
// SchBaseTaskconfig taskConfig = taskConfigService.getOne(new LambdaQueryWrapper<SchBaseTaskconfig>() SchBaseTaskconfig taskConfig = taskConfigService.getOne(new LambdaQueryWrapper<SchBaseTaskconfig>()
// .eq(SchBaseTaskconfig::getConfig_code, TASK_CONFIG_CODE)); .eq(SchBaseTaskconfig::getConfig_code, TASK_CONFIG_CODE));
// for (SchBaseTask task : tasks) { for (SchBaseTask task : tasks) {
// List<String> startRegionStr = Arrays.stream(taskConfig.getStart_region_str().split(",")).collect(Collectors.toList()); List<String> startRegionStr = Arrays.stream(taskConfig.getStart_region_str().split(",")).collect(Collectors.toList());
// // 找起点 // 找起点
// String extGroupData = task.getExt_group_data(); String extGroupData = task.getExt_group_data();
// JSONObject jsonObject = JSONObject.parseObject(extGroupData); JSONObject jsonObject = JSONObject.parseObject(extGroupData);
// jsonObject.put("vehicle_type", task.getVehicle_type()); jsonObject.put("vehicle_type", task.getVehicle_type());
// SchBasePoint point = findStartPoint(startRegionStr, jsonObject); SchBasePoint point = findStartPoint(startRegionStr, jsonObject);
// if (ObjectUtil.isEmpty(point)) { if (ObjectUtil.isEmpty(point)) {
// task.setRemark("未找到所需点位!"); task.setRemark("未找到所需点位!");
// taskService.update(task); taskService.update(task);
// // 消息通知 // 消息通知
// continue; continue;
// } }
// // 设置起点并修改创建成功状态 // 设置起点并修改创建成功状态
// task.setPoint_code1(point.getPoint_code()); task.setPoint_code1(point.getPoint_code());
// task.setTask_status(TaskStatus.CREATED.getCode()); task.setTask_status(TaskStatus.CREATED.getCode());
// task.setVehicle_code(point.getVehicle_code()); task.setVehicle_code(point.getVehicle_code());
// taskService.update(task); taskService.update(task);
//
// point.setIng_task_code(task.getTask_code()); point.setIng_task_code(task.getTask_code());
// pointService.update(point); pointService.update(point);
//
// //下发 //下发
//// this.renotifyAcs(task); // this.renotifyAcs(task);
// } }
// } }
//
// /** /**
// * 找起点业务:混碾机工单的物料标识相同的位置 * 找起点业务混碾机工单的物料标识相同的位置
// * *
// * @param startRegionStr : 区域列表 * @param startRegionStr : 区域列表
// * @param extGroupData : 外部参数,包含条件所需的信息 * @param extGroupData : 外部参数包含条件所需的信息
// * @return * @return
// * @description : JSONObject获取不到就是null * @description : JSONObject获取不到就是null
// */ */
// private SchBasePoint findStartPoint(List<String> startRegionStr, JSONObject extGroupData) { private SchBasePoint findStartPoint(List<String> startRegionStr, JSONObject extGroupData) {
// // 获取当前工单 // 获取当前工单
// String workorderCode = extGroupData.getString("workorder_code"); String workorderCode = extGroupData.getString("workorder_code");
// PdmBdWorkorder workOrder = ObjectUtil.isNotEmpty(workorderCode) PdmBdWorkorder workOrder = ObjectUtil.isNotEmpty(workorderCode)
// ? workorderService.getOne(new LambdaQueryWrapper<PdmBdWorkorder>() ? workorderService.getOne(new LambdaQueryWrapper<PdmBdWorkorder>()
// .eq(PdmBdWorkorder::getWorkorder_code, workorderCode)) .eq(PdmBdWorkorder::getWorkorder_code, workorderCode))
// : null; : null;
// Assert.notNull(workOrder, "工单不能为空!"); Assert.notNull(workOrder, "工单不能为空!");
// // 查找混碾机工单的物料相同的位置 // 查找混碾机工单的物料相同的位置
// List<SchBasePoint> points = yzMapper.findPointForYZQL(startRegionStr, workOrder.getMaterial_id()); List<SchBasePoint> points = yzMapper.findPointForYZQL(startRegionStr, workOrder.getMaterial_id());
// return ObjectUtil.isNotEmpty(points) ? points.get(0) : null; return ObjectUtil.isNotEmpty(points) ? points.get(0) : null;
// } }
//
//
// @Override @Override
// protected void updateStatus(String task_code, TaskStatus status) { protected void updateStatus(String task_code, TaskStatus status) {
// // 校验任务 // 校验任务
// SchBaseTask taskObj = taskService.getByCode(task_code); SchBaseTask taskObj = taskService.getByCode(task_code);
// if (taskObj.getTask_status().equals(TaskStatus.FINISHED.getCode())) { if (taskObj.getTask_status().equals(TaskStatus.FINISHED.getCode())) {
// throw new BadRequestException("该任务已完成!"); throw new BadRequestException("该任务已完成!");
// } }
// if (taskObj.getTask_status().equals(TaskStatus.CANCELED.getCode())) { if (taskObj.getTask_status().equals(TaskStatus.CANCELED.getCode())) {
// throw new BadRequestException("该任务已取消!"); throw new BadRequestException("该任务已取消!");
// } }
// // 获取参数 // 获取参数
// String startPoint = taskObj.getPoint_code1(); // 起点 String startPoint = taskObj.getPoint_code1(); // 起点
// JSONObject extGroupData = ObjectUtil.isNotEmpty(taskObj.getExt_group_data()) JSONObject extGroupData = ObjectUtil.isNotEmpty(taskObj.getExt_group_data())
// ? JSONObject.parseObject(taskObj.getExt_group_data()) ? JSONObject.parseObject(taskObj.getExt_group_data())
// : null; : null;
// SchBasePoint startPointObj = pointService.getById(startPoint); SchBasePoint startPointObj = pointService.getById(startPoint);
// // 根据传来的类型去对任务进行操作 // 根据传来的类型去对任务进行操作
// if (status.equals(TaskStatus.EXECUTING)) { // 执行中 if (status.equals(TaskStatus.EXECUTING)) { // 执行中
// taskObj.setTask_status(TaskStatus.EXECUTING.getCode()); taskObj.setTask_status(TaskStatus.EXECUTING.getCode());
// taskObj.setRemark("执行中"); taskObj.setRemark("执行中");
// } }
// if (status.equals(TaskStatus.FINISHED)) { // 完成 if (status.equals(TaskStatus.FINISHED)) { // 完成
// // 任务上有载具编码 -> 获取当前载具编码的组盘信息 // 任务上有载具编码 -> 获取当前载具编码的组盘信息
// SchBaseVehiclematerialgroup one = vehiclematerialgroupService.getOne(new LambdaQueryWrapper<SchBaseVehiclematerialgroup>() SchBaseVehiclematerialgroup one = vehiclematerialgroupService.getOne(new LambdaQueryWrapper<SchBaseVehiclematerialgroup>()
// .eq(SchBaseVehiclematerialgroup::getVehicle_code, taskObj.getVehicle_code()) .eq(SchBaseVehiclematerialgroup::getVehicle_code, taskObj.getVehicle_code())
// .eq(SchBaseVehiclematerialgroup::getVehicle_type, taskObj.getVehicle_type()) .eq(SchBaseVehiclematerialgroup::getVehicle_type, taskObj.getVehicle_type())
// .eq(SchBaseVehiclematerialgroup::getGroup_bind_material_status, GroupBindMaterialStatusEnum.BOUND.getValue())); .eq(SchBaseVehiclematerialgroup::getGroup_bind_material_status, GroupBindMaterialStatusEnum.BOUND.getValue()));
// // 将载具设置为已解绑 // 将载具设置为已解绑
// one.setGroup_bind_material_status(GroupBindMaterialStatusEnum.UNBOUND.getValue()); one.setGroup_bind_material_status(GroupBindMaterialStatusEnum.UNBOUND.getValue());
// vehiclematerialgroupService.update(one); vehiclematerialgroupService.update(one);
// // 释放点位,将点位设置为空位,清空数据 // 释放点位,将点位设置为空位,清空数据
// if (ObjectUtil.isNotEmpty(startPointObj)) { if (ObjectUtil.isNotEmpty(startPointObj)) {
// PointUtils.clearPoint(startPointObj); PointUtils.clearPoint(startPointObj);
// // todo: 终点暂时无设置 // todo: 终点暂时无设置
// } }
// // 任务修改成完成 // 任务修改成完成
// taskObj.setTask_status(TaskStatus.FINISHED.getCode()); taskObj.setTask_status(TaskStatus.FINISHED.getCode());
// } }
// if (status.equals(TaskStatus.CANCELED)) { // 取消 if (status.equals(TaskStatus.CANCELED)) { // 取消
// taskObj.setTask_status(TaskStatus.CANCELED.getCode()); taskObj.setTask_status(TaskStatus.CANCELED.getCode());
// // 释放点位,起点正在执行的任务清空 // 释放点位,起点正在执行的任务清空
// if (ObjectUtil.isNotEmpty(startPointObj)) { if (ObjectUtil.isNotEmpty(startPointObj)) {
// startPointObj.setIng_task_code(""); startPointObj.setIng_task_code("");
// pointService.update(startPointObj); pointService.update(startPointObj);
// } }
// } }
// taskService.update(taskObj); taskService.update(taskObj);
// } }
//
// @Override @Override
// public void forceFinish(String task_code) { public void forceFinish(String task_code) {
// this.updateStatus(task_code, TaskStatus.FINISHED); this.updateStatus(task_code, TaskStatus.FINISHED);
// } }
//
// @Override @Override
// public void cancel(String task_code) { public void cancel(String task_code) {
// this.updateStatus(task_code, TaskStatus.CANCELED); this.updateStatus(task_code, TaskStatus.CANCELED);
// } }
//} }

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

@ -211,15 +211,15 @@ public class YZSLTask extends AbstractTask {
Integer qty = param.getInteger("qty"); Integer qty = param.getInteger("qty");
SchBasePoint basePoint = pointService.getById(deviceCode); SchBasePoint basePoint = pointService.getById(deviceCode);
PdmBdWorkorder workorderObject = workorderService.getDeviceProductionTask(basePoint.getParent_point_code()); PdmBdWorkorder workorderObject = workorderService.getDeviceProductionTask(basePoint.getParent_point_code());
// 找到相同组盘信息就直接返回id,避免任务取消组盘信息还存在,重复插入 // 找到相同组盘信息就修改,避免任务取消组盘信息还存在,重复插入
SchBaseVehiclematerialgroup groupEntity = new SchBaseVehiclematerialgroup();
groupEntity.setGroup_id(IdUtil.getSnowflake(1, 1).nextIdStr());
SchBaseVehiclematerialgroup groupObject = vehiclematerialgroupService.getGroupInfo(vehicleCode, vehicleType, SchBaseVehiclematerialgroup groupObject = vehiclematerialgroupService.getGroupInfo(vehicleCode, vehicleType,
GroupBindMaterialStatusEnum.WAIT_BIND.getValue(), workorderObject.getMaterial_id()); GroupBindMaterialStatusEnum.WAIT_BIND.getValue(), workorderObject.getMaterial_id());
if (groupObject != null) { if (groupObject != null) {
return groupObject.getGroup_id(); groupEntity = groupObject;
} }
// 要把数据存到组盘表 // 要把数据存到组盘表
SchBaseVehiclematerialgroup groupEntity = new SchBaseVehiclematerialgroup();
groupEntity.setGroup_id(IdUtil.getSnowflake(1, 1).nextIdStr());
groupEntity.setMaterial_id(ObjectUtil.isNotEmpty(workorderObject) groupEntity.setMaterial_id(ObjectUtil.isNotEmpty(workorderObject)
? workorderObject.getMaterial_id() ? workorderObject.getMaterial_id()
: ""); : "");
@ -246,7 +246,7 @@ public class YZSLTask extends AbstractTask {
groupEntity.setGroup_status(GroupStatusEnum.IN_STORAGE.getType()); // 暂时不维护。 groupEntity.setGroup_status(GroupStatusEnum.IN_STORAGE.getType()); // 暂时不维护。
groupEntity.setIs_delete(false); groupEntity.setIs_delete(false);
groupEntity.setIs_full(isFull.equals(GeneralDefinition.YES) ? true : false); groupEntity.setIs_full(isFull.equals(GeneralDefinition.YES) ? true : false);
vehiclematerialgroupService.save(groupEntity); vehiclematerialgroupService.saveOrUpdate(groupEntity);
// 将所有当前位置的砖块设置组盘标识 // 将所有当前位置的砖块设置组盘标识
baseBrickInfoService.setGroupByCurrentAllBrick(deviceCode, groupEntity.getGroup_id()); baseBrickInfoService.setGroupByCurrentAllBrick(deviceCode, groupEntity.getGroup_id());
// 返回组盘id记录任务中 // 返回组盘id记录任务中

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

@ -350,8 +350,8 @@
{{ scope.row.is_lock_next?'是':'否' }} {{ scope.row.is_lock_next?'是':'否' }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="request_param" label="生成任务的请求参数" :min-width="flexWidth('request_param',crud.data,'生成任务的请求参数')" /> <el-table-column v-if="false" prop="request_param" label="生成任务的请求参数" :min-width="flexWidth('request_param',crud.data,'生成任务的请求参数')" />
<el-table-column prop="response_param" label="下发任务的请求参数" :min-width="flexWidth('response_param',crud.data,'下发任务的请求参数')" /> <el-table-column v-if="false" prop="response_param" label="下发任务的请求参数" :min-width="flexWidth('response_param',crud.data,'下发任务的请求参数')" />
<el-table-column v-if="false" prop="is_group_congrol_issue_seq" label="是否按组控制下发顺序" :min-width="flexWidth('is_group_congrol_issue_seq',crud.data,'是否按组控制下发顺序')"> <el-table-column v-if="false" prop="is_group_congrol_issue_seq" label="是否按组控制下发顺序" :min-width="flexWidth('is_group_congrol_issue_seq',crud.data,'是否按组控制下发顺序')">
<template slot-scope="scope"> <template slot-scope="scope">
{{ scope.row.is_group_congrol_issue_seq?'是':'否' }} {{ scope.row.is_group_congrol_issue_seq?'是':'否' }}

Loading…
Cancel
Save