opt:任务优先级

This commit is contained in:
zhangzhiqiang
2023-08-16 14:25:07 +08:00
parent f23bb88d63
commit 2300b7db66
8 changed files with 60 additions and 13 deletions

View File

@@ -26,6 +26,7 @@ public class PointEvent<T> extends PublishEvent {
private String vehicle_code;
private String product_area;
private String task_group_id;
private String priority;
private Map extParam;
}

View File

@@ -4,6 +4,8 @@ package org.nl.wms.pda_manage.pda.controller;
* @Date 2023/7/12 21:13
*/
import cn.dev33.satoken.annotation.SaIgnore;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUnit;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.lang.Assert;
import cn.hutool.core.util.StrUtil;
@@ -18,6 +20,7 @@ import org.jetbrains.annotations.NotNull;
import org.nl.common.TableDataInfo;
import org.nl.common.anno.Log;
import org.nl.common.domain.query.PageQuery;
import org.nl.common.enums.AcsTaskEnum;
import org.nl.common.enums.StatusEnum;
import org.nl.common.utils.MapOf;
import org.nl.common.utils.RedissonUtils;
@@ -182,6 +185,19 @@ public class PdaWashController {
if (sum>LIMIT_WEIGHT){
throw new BadRequestException("选择的储料仓物料总重量大于"+LIMIT_WEIGHT+"公斤");
}
Param limit_time = paramService.getOne(new QueryWrapper<Param>().eq("code", "pda_wash_time"));
//开启清洗上料时间限制
if (limit_time!=null &&limit_time.getValue().equals("1")){
SchBaseTask lastTask = taskService.getOne(new QueryWrapper<SchBaseTask>()
.eq("task_type", AcsTaskEnum.REQUEST_WASH_SEND_MATERIAL.getCode()).orderByDesc("task_code").last("limit 1"));
String materialId = lastTask.getMaterial_id();
if (!list.get(0).getMaterial_id().equals(materialId)){
long between = DateUtil.between(new Date(), lastTask.getCreate_time(), DateUnit.MINUTE);
if (between<5){
throw new BadRequestException("不同物料任务间隔小于5分钟,任务:"+lastTask.getTask_code());
}
}
}
return list;
}

View File

@@ -28,6 +28,8 @@ import org.nl.wms.scheduler_manage.service.task.dao.SchBaseTask;
import org.nl.wms.storage_manage.IOSEnum;
import org.nl.wms.storage_manage.productmanage.util.DivRuleCpService;
import org.nl.wms.storage_manage.productmanage.util.RuleUtil;
import org.nl.wms.system_manage.service.param.ISysParamService;
import org.nl.wms.system_manage.service.param.dao.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -56,6 +58,8 @@ public class EngraveSendEmpTask extends AbstractAcsTask {
private IStIvtStructattrService structattrService;
@Autowired
private WmsToAcsService wms;
@Autowired
private ISysParamService paramService;
@Override
@@ -120,10 +124,14 @@ public class EngraveSendEmpTask extends AbstractAcsTask {
task.put("is_send", true);
task.put("create_name", SecurityUtils.getCurrentNickName());
task.put("create_time", DateUtil.now());
task.put("priority", "7");
task.put("priority", "1");
task.put("finished_type", "1");
task.put("agv_system_type", AcsTaskEnum.AGV_SYSTEM_XC.getCode());
SchBaseTask schBaseTask = task.toJavaObject(SchBaseTask.class);
Param one = paramService.getOne(new QueryWrapper<Param>().eq("code", "engrave_priority"));
if (one!=null){
schBaseTask.setPriority(one.getValue());
}
taskService.save(schBaseTask);
// 找终点
try {

View File

@@ -4,6 +4,7 @@ import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.IdUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import org.apache.commons.lang3.StringUtils;
import org.nl.common.enums.AcsTaskEnum;
import org.nl.common.enums.StatusEnum;
import org.nl.common.publish.AbstraceListener;
@@ -53,7 +54,7 @@ public class PointListener extends AbstraceListener<PointEvent> {
task.put("create_time", DateUtil.now());
task.put("is_auto_issue", "0");
task.put("agv_system_type", AcsTaskEnum.AGV_SYSTEM_XC.getCode());
task.put("priority", "1");}
task.put("priority", StringUtils.isEmpty(event.getPriority())?"1":event.getPriority());}
taskService.save(task.toJavaObject(SchBaseTask.class));
return task_id;
}

View File

@@ -31,6 +31,8 @@ import org.nl.wms.scheduler_manage.service.task.dao.SchBaseTask;
import org.nl.wms.storage_manage.IOSEnum;
import org.nl.wms.storage_manage.pda.PDAEnum;
import org.nl.wms.storage_manage.pda.service.PdaStBcpInService;
import org.nl.wms.system_manage.service.param.ISysParamService;
import org.nl.wms.system_manage.service.param.dao.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -47,19 +49,15 @@ import java.util.stream.Collectors;
@Slf4j
@Service
public class WashCallEmptyTask extends AbstractAcsTask {
@Autowired
private IPdmProduceWorkorderService workorderService;
@Autowired
private ISchBaseTaskService taskService;
@Autowired
private IStIvtStructattrService structattrService; // 仓位服务
@Autowired
private WmsToAcsService wms;
@Autowired
private PdaStBcpInService pdaStBcpInService;
private ISysParamService paramService;
@Override
@Transactional(rollbackFor = Exception.class)
@@ -120,6 +118,10 @@ public class WashCallEmptyTask extends AbstractAcsTask {
// 查找任务状态
JSONObject task = packageTask(param.getString("device_code"));
SchBaseTask schBaseTask = task.toJavaObject(SchBaseTask.class);
Param one = paramService.getOne(new QueryWrapper<Param>().eq("code", "wash_priority"));
if (one!=null){
schBaseTask.setPriority(one.getValue());
}
taskService.save(schBaseTask);
// 找终点
try {
@@ -168,7 +170,7 @@ public class WashCallEmptyTask extends AbstractAcsTask {
task.put("update_name", SecurityUtils.getCurrentNickName());
task.put("create_time", DateUtil.now());
task.put("update_time", DateUtil.now());
task.put("priority", "8");
task.put("priority", "1");
task.put("agv_system_type", AcsTaskEnum.AGV_SYSTEM_XC.getCode());
return task;
}

View File

@@ -137,7 +137,7 @@ public class WashMachineryTask extends AbstractAcsTask {
task.put("create_name", SecurityUtils.getCurrentNickName());
task.put("create_time", DateUtil.now());
task.put("is_auto_issue", false);
task.put("priority", "8");
task.put("priority", "1");
task.put("task_step", 1);
task.put("material_id",devices.get(0).getMaterial_id());
task.put("material_qty",devices.stream().mapToInt(a->a.getDeviceinstor_weight().intValue()).sum());

View File

@@ -54,6 +54,8 @@ import org.nl.wms.storage_manage.semimanage.service.iostorInv.dao.mapper.StIvtIo
import org.nl.wms.storage_manage.semimanage.service.iostorInv.dto.BcpIostorInvQuery;
import org.nl.wms.storage_manage.semimanage.service.structIvt.IStIvtStructivtBcpService;
import org.nl.wms.storage_manage.semimanage.service.structIvt.dao.StIvtStructivtBcp;
import org.nl.wms.system_manage.service.param.ISysParamService;
import org.nl.wms.system_manage.service.param.dao.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
@@ -95,6 +97,8 @@ public class StIvtIostorinvBcpOutServiceImpl extends ServiceImpl<StIvtIostorinvB
private IStIvtStructivtflowService iStIvtStructivtflowService; // 库存变动服务
@Autowired
protected IMdPbStoragevehicleextService iMdPbStoragevehicleextService; // 载具扩展属性信息表服务
@Autowired
private ISysParamService paramService;
@Override
public Object queryDtl(BcpIostorInvQuery query, PageQuery pageQuery) {
@@ -342,10 +346,17 @@ public class StIvtIostorinvBcpOutServiceImpl extends ServiceImpl<StIvtIostorinvB
mst.setCreate_id("1");
mst.setCreate_name("acs");
mst.setCreate_time(DateUtil.now());
Param one = paramService.getOne(new QueryWrapper<Param>().eq("code", "engrave_priority"));
String priority = "1";
if (one!=null){
priority=one.getValue();
}
PointEvent event = PointEvent.builder()
.type(AcsTaskEnum.TASK_STRUCT_OUT)
.point_code1(stIvtStructivtBcp.getStruct_code())
.point_code3(mst.getPoint_code())
.priority(priority)
.acs_task_type(AcsTaskEnum.ACS_TASK_TYPE_NON_WEIGHING_TASK_OF_PS20.getCode())
.task_group_id(IdUtil.getStringId())
.extParam(MapOf.of("material_qty",stIvtStructivtBcp.getCanuse_qty(),
@@ -478,7 +489,6 @@ public class StIvtIostorinvBcpOutServiceImpl extends ServiceImpl<StIvtIostorinvB
SchBaseTask taskDao = iSchBaseTaskService.getById(task_id);
JSONArray param = new JSONArray();
taskDao.setPriority("7");
param.add(JSON.parseObject(JSONUtil.toJsonStr(taskDao)));
// 1.下发任务
WmsToAcsService bean = SpringContextHolder.getBean(WmsToAcsService.class);

View File

@@ -54,6 +54,8 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.nl.wms.storage_manage.semimanage.service.iostorInv.dto.BcpIostorInvQuery;
import org.nl.wms.storage_manage.semimanage.service.structIvt.IStIvtStructivtBcpService;
import org.nl.wms.storage_manage.semimanage.service.structIvt.dao.StIvtStructivtBcp;
import org.nl.wms.system_manage.service.param.ISysParamService;
import org.nl.wms.system_manage.service.param.dao.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -84,6 +86,9 @@ public class StIvtIostorinvBcpServiceImpl extends ServiceImpl<StIvtIostorinvBcpM
private IStIvtStructattrService structattrService;
@Autowired
private DivRuleCpService divRuleCpService;
@Autowired
private ISysParamService paramService;
@Autowired
private IStIvtSectattrService sectattrService;
@Autowired
@@ -322,13 +327,18 @@ public class StIvtIostorinvBcpServiceImpl extends ServiceImpl<StIvtIostorinvBcpM
mst.setStruct_code(stIvtStructattr.getStruct_code());
mst.setStruct_name(stIvtStructattr.getStruct_name());
}
Param one = paramService.getOne(new QueryWrapper<Param>().eq("code", "wash_priority"));
String priority = "1";
if (one!=null){
priority = one.getValue();
}
PointEvent event = PointEvent.builder()
.type(AcsTaskEnum.TASK_STRUCT_IN)
.acs_task_type("7")
.task_group_id(IdUtil.getStringId())
.point_code1(mst.getPoint_code())
.point_code3(stIvtStructattr.getStruct_code())
.priority(priority)
.vehicle_code(mst.getStoragevehicle_code())
.product_area(mst.getWorkshop_id())
.extParam(MapOf.of("material_id",mst.getMaterial_id(),
@@ -448,7 +458,6 @@ public class StIvtIostorinvBcpServiceImpl extends ServiceImpl<StIvtIostorinvBcpM
SchBaseTask taskDao = iSchBaseTaskService.getById(task_id);
JSONArray param = new JSONArray();
taskDao.setPriority("8");
param.add(JSON.parseObject(JSONUtil.toJsonStr(taskDao)));
// 1.下发任务