Browse Source

fix:修复acs申请入库时,二维码乱码或者多扫载具导致任务异常,异常二维码拒绝申请任务

master
DESKTOP-5DIJMF9\admin 3 months ago
parent
commit
a01d3821b4
  1. 37
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/service/impl/AcsToWmsServiceImpl.java
  2. 9
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/pda/service/impl/PdaServiceImpl.java
  3. 27
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/AbstractTask.java
  4. 2
      lms/nladmin-ui/src/views/wms/ycl/outdetail/index.vue

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

@ -1,9 +1,7 @@
package org.nl.wms.ext.service.impl;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.lang.Assert;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.http.HttpStatus;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
@ -12,46 +10,30 @@ import lombok.extern.slf4j.Slf4j;
import org.nl.common.exception.BadRequestException;
import org.nl.common.utils.RedisUtils;
import org.nl.common.utils.SecurityUtils;
import org.nl.system.service.logicflow.dao.Stage;
import org.nl.system.service.notice.ISysNoticeService;
import org.nl.system.service.param.ISysParamService;
import org.nl.wms.database.material.service.IMdBaseMaterialService;
import org.nl.wms.database.material.service.dao.MdBaseMaterial;
import org.nl.wms.ext.service.AcsToWmsService;
import org.nl.wms.ext.service.dto.to.BaseResponse;
import org.nl.wms.ext.service.dto.to.wms.FeedBackTaskStatusRequest;
import org.nl.wms.sch.group.service.ISchBaseVehiclematerialgroupService;
import org.nl.wms.sch.group.service.dao.SchBaseVehiclematerialgroup;
import org.nl.wms.sch.material.service.dao.Material;
import org.nl.wms.sch.material.service.dao.mapper.MaterialMapper;
import org.nl.wms.sch.point.service.ISchBasePointService;
import org.nl.wms.sch.point.service.dao.SchBasePoint;
import org.nl.wms.sch.point.service.impl.SchBasePointServiceImpl;
import org.nl.wms.sch.task.service.ISchBaseTaskService;
import org.nl.wms.sch.task.service.dao.SchBaseTask;
import org.nl.wms.sch.task_manage.AbstractTask;
import org.nl.wms.sch.task_manage.GeneralDefinition;
import org.nl.wms.sch.task_manage.enums.GroupBindMaterialStatusEnum;
import org.nl.wms.sch.task_manage.enums.NoticeTypeEnum;
import org.nl.wms.sch.task_manage.enums.PointStatusEnum;
import org.nl.wms.sch.task_manage.enums.WorkOrderStatusEnum;
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.tasks.mapper.PointMapper;
import org.nl.wms.util.PointUtils;
import org.nl.wms.util.TaskUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.PostConstruct;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.TimeUnit;
/**
* @Author: lyd
@ -71,15 +53,13 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
@Autowired
private ISchBasePointService pointService;
@Autowired
private ISchBaseVehiclematerialgroupService vehiclematerialgroupService;
@Autowired
private TaskFactory taskFactory;
@Autowired
private ISysNoticeService noticeService;
@Autowired
private PointMapper pointMapper;
@Autowired
private RedisUtils redisUtils;
@Autowired
private MaterialMapper materialMapper;
// 初始化反射方法
@PostConstruct
@ -152,6 +132,13 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
String device_code = param.getString("device_code");
//设置任务类型
param.put("config_code",requestMethodCode);
//统一托盘码字段
if(ObjectUtil.isNotEmpty(param.getString("sub_tray"))){
param.put("vehicle_code2",param.getString("sub_tray"));
}
if(ObjectUtil.isNotEmpty(param.getString("mother_tray"))){
param.put("vehicle_code",param.getString("mother_tray"));
}
AbstractTask task = taskFactory.getTask(requestMethodCode);
if(ObjectUtil.isEmpty(requestMethodCode)){
throw new BadRequestException("任务类型不能为空!requestMethodCode:"+requestMethodName+",device_code:"+device_code);

9
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/pda/service/impl/PdaServiceImpl.java

@ -6,8 +6,6 @@ import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import lombok.extern.slf4j.Slf4j;
import org.nl.common.exception.BadRequestException;
import org.nl.wms.database.material.service.IMdBaseMaterialService;
import org.nl.wms.ext.service.AcsToWmsService;
import org.nl.wms.ext.service.dto.to.BaseResponse;
import org.nl.wms.pda.service.PdaService;
@ -19,14 +17,12 @@ import org.nl.wms.sch.material.service.dao.Material;
import org.nl.wms.sch.material.service.dao.mapper.MaterialMapper;
import org.nl.wms.sch.point.service.ISchBasePointService;
import org.nl.wms.sch.point.service.dao.SchBasePoint;
import org.nl.wms.sch.task.service.ISchBaseTaskService;
import org.nl.wms.sch.task_manage.GeneralDefinition;
import org.nl.wms.sch.task_manage.enums.GroupBindMaterialStatusEnum;
import org.nl.wms.sch.task_manage.task.tasks.mapper.PointMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
import java.util.List;
/**
@ -43,18 +39,13 @@ public class PdaServiceImpl implements PdaService {
@Autowired
private ISchBasePointService pointService;
@Autowired
private IMdBaseMaterialService materialService;
@Autowired
private ISchBaseVehiclematerialgroupService vehiclematerialgroupService;
@Autowired
private ISchBaseTaskService taskService;
@Autowired
private AcsToWmsService acsToWmsService;
@Autowired
private PointMapper pointMapper;
@Autowired
private MaterialMapper materialMapper;
@Override
public PdaResponseVo dwzt(JSONObject param) {
return PdaResponseVo.pdaResultOk("回温状态查询成功");

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

@ -7,12 +7,15 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import org.nl.common.exception.BadRequestException;
import org.nl.common.utils.SecurityUtils;
import org.nl.wms.ext.service.dto.to.BaseResponse;
import org.nl.wms.sch.material.service.dao.Material;
import org.nl.wms.sch.material.service.dao.mapper.MaterialMapper;
import org.nl.wms.sch.point.service.ISchBasePointService;
import org.nl.wms.sch.point.service.dao.SchBasePoint;
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.service.dao.SchBaseTaskconfig;
import org.nl.wms.sch.task_manage.enums.GroupBindMaterialStatusEnum;
import org.nl.wms.sch.task_manage.enums.TaskDirectionEnum;
import org.nl.wms.sch.task_manage.task.AcsUtil;
import org.nl.wms.sch.task_manage.task.core.TaskStatus;
@ -43,7 +46,8 @@ public abstract class AbstractTask {
private IWorkorderService workorderService;
@Autowired
private WorkorderMapper workorderMapper;
@Autowired
private MaterialMapper materialMapper;
/**
* 任务创建
* 根据配置生成任务如并发控制等
@ -169,14 +173,23 @@ public abstract class AbstractTask {
String apply_point_code = param.getString("device_code"); // 请求点
String next_point = param.getString("next_point"); // 目的点
String config_code = param.getString("config_code");
String sub_tray = param.getString("sub_tray");
String sub_tray = param.getString("vehicle_code2");//子托盘
// 1、校验数据
SchBaseTaskconfig taskConfig = taskConfigService.getOne(new LambdaQueryWrapper<SchBaseTaskconfig>()
.eq(SchBaseTaskconfig::getConfig_code, config_code));
Assert.notNull(taskConfig, "找不到配置文件,请确认[" + config_code + "]配置是否存在!");
//输送线相关任务不做处理
if(apply_point_code.startsWith("SSX")){
//放行
//输送线入库任务,校验入库单是否存在载具号
if("YCLRKTask".equals(config_code)){
//组盘表需要关联外部mes晶棒数据,一对多
LambdaQueryWrapper<Material> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(Material::getPalletSN,sub_tray);
wrapper.eq(Material::getGroup_bind_material_status, GroupBindMaterialStatusEnum.BOUND.getValue());
Integer list_size = materialMapper.selectCount(wrapper);
Assert.isFalse(list_size<=0,
"该任务申请子托盘["+sub_tray+"]异常,无原材料入库单据信息!");
}
}else{
//判断该申请点位是否存在起点或终点的未完成任务
List<SchBaseTask> apply_point_lists = taskService.findUnFinishTasksByPoint_code2("",apply_point_code);
@ -190,14 +203,6 @@ public abstract class AbstractTask {
Assert.isFalse(apply_sub_tray_lists.size()>0,
"该任务申请子托盘["+sub_tray+"]已存在未完成的任务,无法申请任务!");
}
//子托盘非空
String vehicle_code2 = param.getString("vehicle_code2");
if(ObjectUtil.isNotEmpty(vehicle_code2)) {
//判断该子托盘是否存在未完成任务
List<SchBaseTask> apply_vehicle_code2_lists = taskService.findUnFinishTasksBySub_tray("",vehicle_code2);
Assert.isFalse(apply_vehicle_code2_lists.size()>0,
"该任务申请子托盘["+vehicle_code2+"]已存在未完成的任务,无法申请任务!");
}
// 最大可创建任务数
Integer tcmn = taskConfig.getTask_create_max_num();
// 获取申请的任务

2
lms/nladmin-ui/src/views/wms/ycl/outdetail/index.vue

@ -185,7 +185,7 @@ export default {
return CRUD({
title: '晶棒库出库库存明细',
url: 'api/report/yl/outdetail',
idField: 'group_id',
idField: 'pointCode',
sort: 'pointCode,desc',
optShow: {
add: false,

Loading…
Cancel
Save