rev:新增工序调度

This commit is contained in:
zhangzhiqiang
2023-05-23 16:21:14 +08:00
parent ffdcba0faf
commit 25075b9fcd
33 changed files with 791 additions and 108 deletions

View File

@@ -4,7 +4,8 @@ import lombok.extern.slf4j.Slf4j;
import org.nl.common.enums.AcsTaskEnum;
import org.nl.modules.wql.util.SpringContextHolder;
import org.nl.wms.ext.acs.service.impl.AcsToWmsServiceImpl;
import org.nl.wms.product_manage.sch.tasks.SpeMachineryTask;
import org.nl.wms.product_manage.sch.tasks.SpeMachinery.SpeEmpTask;
import org.nl.wms.product_manage.sch.tasks.SpeMachinery.SpeFullTask;
import org.nl.wms.product_manage.sch.tasks.WashMachineryTask;
import org.nl.wms.product_manage.sch.tasks.callMaterial.WrapCallMaterialTask;
import org.nl.wms.product_manage.sch.tasks.sendEmpty.WrapSendEmptyTask;
@@ -19,8 +20,8 @@ public class ConventConfig implements SmartLifecycle {
@Override
public void start() {
AcsToWmsServiceImpl.Task_Collent.put(AcsTaskEnum.REQUEST_CALLTYPE_FULL, SpringContextHolder.getBean(SpeMachineryTask.class));
AcsToWmsServiceImpl.Task_Collent.put(AcsTaskEnum.REQUEST_CALLTYPE_EMP, SpringContextHolder.getBean(SpeMachineryTask.class));
AcsToWmsServiceImpl.Task_Collent.put(AcsTaskEnum.REQUEST_CALLTYPE_FULL, SpringContextHolder.getBean(SpeFullTask.class));
AcsToWmsServiceImpl.Task_Collent.put(AcsTaskEnum.REQUEST_CALLTYPE_EMP, SpringContextHolder.getBean(SpeEmpTask.class));
AcsToWmsServiceImpl.Task_Collent.put(AcsTaskEnum.REQUEST_WASH_EMP, SpringContextHolder.getBean(WashMachineryTask.class));
AcsToWmsServiceImpl.Task_Collent.put(AcsTaskEnum.REQUEST_PLOTTER_SEND_FULL, SpringContextHolder.getBean(PlotterSendMaterialTask.class));
AcsToWmsServiceImpl.Task_Collent.put(AcsTaskEnum.REQUEST_WARP_CALL_FULL, SpringContextHolder.getBean(WrapCallMaterialTask.class));

View File

@@ -57,10 +57,10 @@ public class CodeGenerator {
mpg.setGlobalConfig(gc);
// 数据源配置
DataSourceConfig dsc = new DataSourceConfig();
dsc.setUrl("jdbc:mysql://192.168.81.252:3306/hl_one_mes?setUnicode=true&characterEncoding=utf8");
dsc.setUrl("jdbc:mysql://192.168.46.5:3306/hl_one_mes_test?serverTimezone=GMT&setUnicode=true&characterEncoding=utf8");
dsc.setDriverName("com.mysql.cj.jdbc.Driver");
dsc.setUsername("root");
dsc.setPassword("Root.123456");
dsc.setPassword("123456");
mpg.setDataSource(dsc);
// 包配置
PackageConfig pc = new PackageConfig();

View File

@@ -1,25 +1,33 @@
package org.nl.wms.ext.acs.service.impl;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.lang.Assert;
import cn.hutool.crypto.digest.MD5;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.nl.common.domain.ConstantParam;
import org.nl.common.enums.StatusEnum;
import org.nl.common.utils.MapOf;
import org.nl.modules.common.exception.BadRequestException;
import org.nl.modules.wql.WQL;
import org.nl.modules.wql.core.bean.WQLObject;
import org.nl.common.utils.PointLockUtils;
import org.nl.wms.product_manage.service.device.IPdmBiDeviceService;
import org.nl.wms.scheduler_manage.service.cacheline.ISchCachelineVehicleService;
import org.nl.wms.scheduler_manage.service.cacheline.dao.SchCachelineVehicle;
import org.nl.wms.scheduler_manage.service.point.ISchBasePointService;
import org.nl.wms.scheduler_manage.service.point.dao.SchBasePoint;
import org.nl.wms.scheduler_manage.service.scheduler.ISchProcessRouteService;
import org.nl.wms.scheduler_manage.service.scheduler.SchedulerService;
import org.nl.wms.scheduler_manage.service.scheduler.dao.SchProcessRoute;
import org.nl.wms.scheduler_manage.service.scheduler.labelConverter.impl.FlowElement;
import org.nl.wms.scheduler_manage.service.task.ISchBaseTaskService;
import org.nl.wms.scheduler_manage.service.task.dao.SchBaseTask;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/*
@@ -33,12 +41,18 @@ public class AgvInstService {
@Autowired
private ISchBasePointService basePointService;
@Autowired
private SchedulerService schedulerService;
@Autowired
private ISchProcessRouteService schProcessRouteService;
@Autowired
private IPdmBiDeviceService deviceService;
@Autowired
private ISchBaseTaskService taskService;
@Autowired
private ISchCachelineVehicleService cachelineVehicleService;
public static void main(String[] args) {
String a = "HCX04JG04_SHCX04";
MD5 md5 = MD5.create();
System.out.println(md5.digest(a));
}
//满料请求点位确认
//1.判断当前设备路由表是否配置下一道路由设备,如果不是则说明直接到清洗
@@ -47,59 +61,79 @@ public class AgvInstService {
//4.有则创建agv指令
// 没有则创建缓存架任务
public void fullMaster(JSONObject task){
String point_code = task.getString("point_code1");
String quantity = task.getString("material_qty");
//获取当前生产工序下一道工序
Map<String,String> workprodure = basePointService.findDeviceWorkprodure(task.getString("point_code"));
FlowElement next = getFlowElement(task,workprodure).next();
String nextPoint = null;
//判断缓存线是不是去深坑清洗深坑区域15个点判断空的物料坑位
String cacheVehile = "";
Map query = MapOf.of("workprocedure_id", workprodure.get("workprocedure_id")
, "qty", quantity);
if (next.getName().equals("深坑清洗")){
query.put("material_id",task.getString("material_id"));
}
List<Map<String,String>> list = deviceService.workproceduceDevices(query);
if (!CollectionUtils.isEmpty(list)){
nextPoint = list.get(0).get("point_code");
}else {
if (next.getParams().get("cacheLine") == null){
throw new BadRequestException("当前任务下一道工序无可用设备");
}
nextPoint = next.getParams().get("cacheLine");
cacheVehile = getCacheVehile(nextPoint, null);
}
if (StringUtils.isBlank(nextPoint)){
throw new BadRequestException("逻辑非配错误,请检查代码");
}
basePointService.update(new UpdateWrapper<SchBasePoint>()
.set("lock_type",StatusEnum.LOCK_ON.getCode()).set("task_id",task.getString("task_id")).eq("point_code",nextPoint));
SchBaseTask schBaseTask = task.toJavaObject(SchBaseTask.class);
schBaseTask.setVehicle_code(cacheVehile);
schBaseTask.setPoint_code2(nextPoint);
schBaseTask.setTask_status(StatusEnum.TASK_START_END_P.getCode());
schBaseTask.setUpdate_time(new Date());
taskService.updateById(schBaseTask);
};
public FlowElement getFlowElement(JSONObject task,Map<String,String> workprodure){
if (CollectionUtils.isEmpty(workprodure)){
throw new BadRequestException("当前点位所属设备无对应工序");
}
String point_code = task.getString("point_code1");
String material_id = task.getString("material_id");
SchBasePoint devicePoint = basePointService.getOne(new QueryWrapper<SchBasePoint>()
.eq("point_code", point_code)
.eq("is_delete", "0")
.eq("is_used", "1")
);
String nextPoint;
//判断缓存线是不是去深坑清洗深坑区域15个点判断空的物料坑位
String cacheVehile = "";
if (devicePoint.getNext_region_code().equals(ConstantParam.SK_REGION)){
//查询生坑重量是否超限:深坑需要乘以系数
JSONArray nextPointList = WQL.getWO("sch_point").addParamMap(MapOf.of("flag","7","region_code", devicePoint.getNext_region_code(),"qty",Integer.valueOf(quantity)*ConstantParam.MATERAIL_RATIO)).process().getResultJSONArray(0);
if (nextPointList.size() == 0){
throw new BadRequestException("深坑清洗储料仓:"+devicePoint.getNext_region_code()+"无可用点位");
}
nextPoint = nextPointList.getJSONObject(0).getString("point_code");
}else {
//专机的话:需要判断专机上料口物料是否满足数量
JSONArray nextPointList = WQL.getWO("sch_point").addParamMap(MapOf.of("flag","3","region_code", devicePoint.getNext_region_code(),"qty",quantity)).process().getResultJSONArray(0);
if (nextPointList.size() == 0){
JSONObject cacheLine = WQLObject.getWQLObject("SCH_cacheLine_region_relation").query("region_code = '"+devicePoint.getRegion_code()+"'").uniqueResult(0);
nextPoint = cacheLine.getString("cacheline_code");
//满料请求:查询缓存线空载具列表
cacheVehile = getCacheVehile(nextPoint, null);
if (StringUtils.isBlank(cacheVehile)) {
throw new BadRequestException("缓存线:"+nextPoint+"没有可用空载具");
}
}else {
nextPoint = nextPointList.getJSONObject(0).getString("point_code");
}
SchProcessRoute processRoute = schProcessRouteService.findByMaterialId(material_id,devicePoint.getRegion_code());
if (processRoute == null){
throw new BadRequestException("当前没有配置对应工序调度线路:"+material_id+"/"+devicePoint.getRegion_code());
}
if (StringUtils.isBlank(nextPoint)){
throw new BadRequestException("设备:"+point_code+"没有可用点位");
//workprocedure_code,r.workprocedure_id
FlowElement flowElement = schedulerService.currentFlow(processRoute.getProcess_id(), workprodure.get("workprocedure_code"));
if (flowElement == null){
throw new BadRequestException("当前工序调度线路:"+processRoute.getProcess_id()+"没有对应工序配置"+workprodure.get("workprocedure_code"));
}
WQLObject.getWQLObject("sch_base_point").update(MapOf.of("task_id",task.getString("task_id"),"lock_type",StatusEnum.LOCK_ON.getCode(),"point_code = '"+nextPoint+"'"));
task.put("vehicle_code",cacheVehile);
task.put("point_code2",nextPoint);
task.put("task_status",StatusEnum.TASK_START_END_P.getCode());
task.put("update_time", DateUtil.now());
WQLObject.getWQLObject("sch_base_task").update(task);
};
return flowElement;
}
//缺料请求:上料位
//1.判断当前设备表对应的缓存线是否开放
//2.根据当前设备绑定的物料id从缓存线中获取相同物料对应载具列表
//3.agv根据对应载具列表行进扫码匹配匹配到对应物料则创建点对点任务
public void callMatter(JSONObject task){
public void empMatter(JSONObject task){
//参数
String targetDevice = task.getString("next_point_code");
String material_id = task.getString("material_id");
JSONObject devicePoint = WQLObject.getWQLObject("SCH_BASE_Point").query("point_code = '" + targetDevice + "' and is_delete = 0 and is_used = 1").uniqueResult(0);
JSONObject cacheLine = WQLObject.getWQLObject("SCH_cacheLine_region_relation").query("region_code = '"+devicePoint.getString("region_code")+"' and is_active = '"+StatusEnum.STATUS_TRUE.getCode()+"'").uniqueResult(0);
Assert.notNull(cacheLine, String.format("区域%s对应缓存线信息不存在", devicePoint.getString("region_code")));
SchBasePoint devicePoint = basePointService.getOne(new QueryWrapper<SchBasePoint>()
.eq("point_code", targetDevice)
.eq("is_delete", "0")
.eq("is_used", "1"));
JSONObject cacheLine = WQLObject.getWQLObject("SCH_cacheLine_region_relation").query("region_code = '"+devicePoint.getRegion_code()+"' and is_active = '"+StatusEnum.STATUS_TRUE.getCode()+"'").uniqueResult(0);
Assert.notNull(cacheLine, String.format("区域%s对应缓存线信息不存在", devicePoint.getRegion_code()));
//缓存线位置编码 :缺料请求获取缓存线满载具列表
String startPoint = cacheLine.getString("cacheline_code");
String cacheVehile = getCacheVehile(startPoint, material_id);
@@ -107,27 +141,28 @@ public class AgvInstService {
throw new BadRequestException("缓存线:"+startPoint+"没有物料"+material_id+"对应可用载具");
}
//判断当前物料载具已经任务分配数量:如果>物料已经分配任务。说明满了,不允许再分配
JSONArray allocateTask = WQLObject.getWQLObject("SCH_base_task").query("point_code1 = '" + startPoint + "' and material_id = '" + material_id + "' and task_status <" + StatusEnum.TASK_FINISH.getCode()).getResultJSONArray(0);
List<SchBaseTask> allocateTask = taskService.list(new QueryWrapper<SchBaseTask>().eq("point_code1", startPoint).eq("material_id", material_id).lt("task_status", StatusEnum.TASK_FINISH.getCode()));
if (allocateTask.size()>=cacheVehile.split(",").length){
log.error("callMatter 缓存线:{}上含有物料:{}的载具分配完任务id:{}",startPoint,material_id,allocateTask.stream().map(o-> ((JSONObject)o).getString("task_id")).collect(Collectors.joining(",")));
log.error("callMatter 缓存线:{}上含有物料:{}的载具分配完任务id:{}",startPoint,material_id,allocateTask.stream().map(SchBaseTask::getTask_id).collect(Collectors.joining(",")));
throw new BadRequestException(String.format("缓存线%s上含物料%s的载具已分配完",startPoint,material_id));
}
task.put("vehicle_code",cacheVehile);
task.put("start_point_code",startPoint);
task.put("return_point_code",startPoint);
task.put("task_status",StatusEnum.TASK_START_END_P.getCode());
task.put("update_time", DateUtil.now());
WQLObject.getWQLObject("SCH_base_task").update(task);
SchBaseTask schBaseTask = task.toJavaObject(SchBaseTask.class);
schBaseTask.setVehicle_code(cacheVehile);
schBaseTask.setPoint_code1(startPoint);
schBaseTask.setPoint_code3(startPoint);
schBaseTask.setTask_status(StatusEnum.TASK_START_END_P.getCode());
schBaseTask.setUpdate_time(new Date());
taskService.updateById(schBaseTask);
}
public String getCacheVehile(String cacheLine,String materialId){
JSONArray runingTask = WQLObject.getWQLObject("sch_base_task").query("point_code2 = '" + cacheLine + "' and task_status < '" + StatusEnum.TASK_FINISH.getCode() + "'").getResultJSONArray(0);
int count = taskService.count(new QueryWrapper<SchBaseTask>().eq("point_code2", cacheLine).lt("task_status", StatusEnum.TASK_FINISH.getCode()));
String status = StringUtils.isBlank(materialId) ? StatusEnum.CACHE_VEL_EMT.getCode() : StatusEnum.CACHE_VEL_FULL.getCode();
JSONArray result = WQL.getWO("sch_point").addParamMap(MapOf.of("flag", "6", "vehicle_status", status, "material_id", materialId)).process().getResultJSONArray(0);
if (result.size()>0){
if (result.size()>runingTask.size()){
return result.stream().map(a -> ((JSONObject) a).getString("vehicle_code")).collect(Collectors.joining(","));
List<SchCachelineVehicle> vehicle = cachelineVehicleService.getCachelineVehicle(MapOf.of("vehicle_status", status, "material_id", materialId));
if (vehicle.size()>0){
if (vehicle.size()>count){
return vehicle.stream().map(SchCachelineVehicle::getVehicle_code).collect(Collectors.joining(","));
}
}
return "";

View File

@@ -249,6 +249,15 @@ public class CacheLineHandController {
return new ResponseEntity<>(HttpStatus.OK);
}
@PostMapping("/checkEnd")
@Log("修改缓存线盘点状态")
@ApiOperation("修改缓存线盘点状态")
public ResponseEntity<Object> checkEnd(@RequestBody JSONObject param) {
log.info("海亮缓存线手持服务 [盘点] 接口被请求, 请求参数-{}", param);
cacheLineHandService.check(param);
return new ResponseEntity<>(HttpStatus.OK);
}
@PostMapping("/agvInBoxExceptionQuery")
@Log("AGV入箱异常-查询")
@ApiOperation("AGV入箱异常-查询")

View File

@@ -890,7 +890,7 @@ public class CacheLineHandServiceImpl implements CacheLineHandService {
@Override
public void check(JSONObject param) {
String option = param.getString("option");
String option = param.getString("check_option");
if (StrUtil.isEmpty(option)) {
throw new BadRequestException("缺少关键参数option");
}

View File

@@ -0,0 +1,241 @@
package org.nl.wms.product_manage.sch.tasks.SpeMachinery;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.lang.Assert;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import lombok.extern.slf4j.Slf4j;
import org.nl.common.enums.AcsTaskEnum;
import org.nl.common.enums.InterfaceLogType;
import org.nl.common.enums.StatusEnum;
import org.nl.common.utils.MapOf;
import org.nl.common.utils.SecurityUtils;
import org.nl.modules.common.exception.BadRequestException;
import org.nl.modules.system.util.CodeUtil;
import org.nl.modules.wql.core.bean.WQLObject;
import org.nl.wms.ext.acs.service.impl.AgvInstService;
import org.nl.wms.product_manage.sch.manage.AbstractAcsTask;
import org.nl.wms.product_manage.sch.manage.TaskStatusEnum;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.HashMap;
import java.util.Map;
/**
* 专机任务
*/
@Slf4j
@Service
public class SpeEmpTask extends AbstractAcsTask {
@Autowired
AgvInstService agvInstService;
private final Map<String,SpeStatusHandler > SpeHandles= new HashMap<>();
private static String OPT_NAME = "ACS回调# ";
public SpeEmpTask() {
SpeHandles.put(AcsTaskEnum.TASK_PRODUCT_MAC.name() ,new Spe2Spe());
SpeHandles.put(AcsTaskEnum.TASK_PRODUCT_CACHE.name() ,new Spe2Cache());
SpeHandles.put(AcsTaskEnum.TASK_CACHELINE_OUT.name() ,new Cache2Spe());
}
@Override
public void updateTaskStatus(JSONObject param,String status) {
WQLObject taskTable = WQLObject.getWQLObject("sch_base_task");
log.info(InterfaceLogType.ACS_TO_LMS.getDesc());
// 指令执行中
JSONObject task = taskTable.query("task_id = '" + param.getString("task_id") + "'").uniqueResult(0);
AcsTaskEnum taskType = AcsTaskEnum.getType(task.getString("task_type"),"TASK_");
try {
SpeHandles.get(taskType.name()).handle(param,status,task);
}catch (Exception ex){
log.error(OPT_NAME+"updateStatus error:{}",ex);
throw ex;
}
}
@Override
@Transactional
public String createTask(JSONObject param) {
String point_code = param.getString("device_code");
String quantity = param.getString("quantity");
String type = param.getString("type");
JSONObject order = WQLObject.getWQLObject("PDM_produce_workOrder").query("workorder_code = '" + param.getString("workorder_code") + "' and is_delete = 0 and workorder_status != "+StatusEnum.TASK_FINISH.getCode()).uniqueResult(0);
Assert.notNull(order, String.format("下发工单%s不存在未完成工单", param.getString("workorder_code")));
JSONArray chectIndDatabase = WQLObject.getWQLObject("SCH_BASE_Task").query((AcsTaskEnum.REQUEST_CALLTYPE_FULL.getCode().equals(type) ? "point_code1" : "point_code2") + "= '" + point_code + "' and task_status < " + StatusEnum.TASK_FINISH.getCode()).getResultJSONArray(0);
if (ObjectUtil.isNotEmpty(chectIndDatabase)){
Assert.notNull(order, String.format("设备%s存在未完成任务", param.getString("point_code")));
}
JSONObject form = new JSONObject(MapOf.of("start_point_code","",
"next_point_code",point_code,"return_point_code", "","vehicle_code",
"","product_area",order.getString("product_area"),"quantity", quantity,"type",type,"material_id", order.getString("material_id")));
String taskId = IdUtil.getSnowflake(1, 1).nextId() + "";
JSONObject task = packageParam(form, taskId);
WQLObject.getWQLObject("SCH_BASE_Task").insert(task);
try {
pointConfirm(task);
//下发
}catch (Exception ex){
task.put("task_status", TaskStatusEnum.SURE_START_ERROR.getCode());
task.put("remark",ex.getMessage());
WQLObject.getWQLObject("sch_base_task").update(task);
}
return taskId;
}
private JSONObject packageParam(JSONObject form, String task_id) {
JSONObject task = new JSONObject();
参数封装:{
AcsTaskEnum taskEnum = AcsTaskEnum.getType(form.getString("type"), "REQUEST_");
task.put("task_id", task_id);
task.put("task_name", taskEnum.getDesc());
task.put("task_code", CodeUtil.getNewCode("TASK_CODE"));
task.put("task_type", form.getString("type"));
task.put("acs_task_type", AcsTaskEnum.ACS_TASK_TYPE_NOBLE_DOUBLE_TASK.getCode());
task.put("task_status", TaskStatusEnum.CREATED.getCode());
task.put("point_code1", form.getString("start_point_code"));
task.put("point_code2", form.getString("next_point_code"));
task.put("point_code3", form.getString("return_point_code"));
task.put("vehicle_code2", form.getString("vehicle_code2"));
task.put("vehicle_code", form.getString("vehicle_code"));
task.put("material_id", form.getString("material_id"));
task.put("material_qty", form.getString("quantity"));
task.put("handle_class", this.getClass().getName());
task.put("finished_type", "1");
task.put("is_delete", StatusEnum.LOCK_OFF.getCode());
task.put("create_id", SecurityUtils.getCurrentUserId());
task.put("create_name", SecurityUtils.getCurrentNickName());
task.put("update_optid", SecurityUtils.getCurrentUserId());
task.put("update_optname", SecurityUtils.getCurrentNickName());
task.put("create_time", DateUtil.now());
task.put("update_time", DateUtil.now());
task.put("priority", "1");}
return task;
}
@Override
public void cancel(String taskId) {
log.info(OPT_NAME+"cancel taskID:{}",taskId);
WQLObject taskTable = WQLObject.getWQLObject("sch_base_task");
//专机-专机
//专机-缓存线
//缓存线出库
taskTable.update(MapOf.of("task_status",StatusEnum.TASK_CANNEL.getCode()),"task_id = '"+taskId+"'");
}
interface SpeStatusHandler{
void handle(JSONObject param,String status,JSONObject task);
}
class Spe2Spe implements SpeStatusHandler{
@Override
public void handle(JSONObject param, String sta,JSONObject task) {
AcsTaskEnum status = AcsTaskEnum.getType(sta,"status_");
WQLObject taskTable = WQLObject.getWQLObject("sch_base_task");
WQLObject pointTable = WQLObject.getWQLObject("SCH_BASE_Point");
WQLObject deviceTable = WQLObject.getWQLObject("pdm_bi_device");
switch (status){
case STATUS_START:
taskTable.update(MapOf.of("task_status",StatusEnum.TASK_RUNNING.getCode(),"update_name","acs","update_time", DateUtil.now()),"task_id = '"+task.getString("task_id")+"'");
break;
case STATUS_FINISH:
taskTable.update(MapOf.of("task_status",StatusEnum.TASK_FINISH.getCode(),"update_name","acs","update_time", DateUtil.now()),"task_id = '"+task.getString("task_id")+"'");
//到专机:更新设备上料位物料数量
String point_code2 = task.getString("point_code2");
JSONObject pointInfo = pointTable.query("point_code = '" + point_code2 + "'").uniqueResult(0);
JSONObject device = deviceTable.query("device_code = '" + pointInfo.getString("device_code") + "'").uniqueResult(0);
task.getDouble("material_qty");
double currentQty = device.getDouble("deviceinstor_qty") + task.getDouble("material_qty");
deviceTable.update(MapOf.of("deviceinstor_qty", String.valueOf(currentQty)), "device_code = '" + pointInfo.getString("device_code") + "'");
break;
case STATUS_CANNEL:
cancel(param.getString("task_id"));
break;
default:
log.error(OPT_NAME+"未定义任务状态:{}",sta);
throw new BadRequestException(OPT_NAME+"未定义任务状态:"+sta);
}
}
}
class Spe2Cache implements SpeStatusHandler{
@Override
public void handle(JSONObject param, String sta,JSONObject task) {
AcsTaskEnum status = AcsTaskEnum.getType(sta,"status_");
WQLObject taskTable = WQLObject.getWQLObject("sch_base_task");
WQLObject cacheVehTable = WQLObject.getWQLObject("sch_cacheline_vehilematerial");
String workprocedureCode = param.getString("workorder_code");
String inboxtxm = param.getString("inboxtxm");
String outboxtxm = param.getString("outboxtxm");
switch (status){
case STATUS_START:
taskTable.update(MapOf.of("task_status",StatusEnum.TASK_RUNNING.getCode(),"update_name","acs","update_time", DateUtil.now()),"task_id = '"+task.getString("task_id")+"'");
cacheVehTable.delete("vehicle_code = '" + outboxtxm + "'");
break;
case STATUS_FINISH:
taskTable.update(MapOf.of("task_status",StatusEnum.TASK_FINISH.getCode(),"update_name","acs","update_time", DateUtil.now()),"task_id = '"+task.getString("task_id")+"'");
cacheVehTable.insert(MapOf.of("quantity", task.getString("material_qty"),
"material_id", task.getString("material_id"),
"vehicle_code", inboxtxm,
"vehicle_status", StatusEnum.CACHE_VEL_FULL.getCode(),
//工单,工序?
"workorder_code", workprocedureCode,
"create_time", DateUtil.now(),
"update_time", DateUtil.now()
//物料规格,物料名称 从物料信息表关联查询
));
break;
case STATUS_CANNEL:
cancel(param.getString("task_id"));
break;
default:
throw new BadRequestException(OPT_NAME+"未定义任务状态:"+sta);
}
}
}
class Cache2Spe implements SpeStatusHandler{
@Override
public void handle(JSONObject param, String sta,JSONObject task) {
AcsTaskEnum status = AcsTaskEnum.getType(sta,"status_");
WQLObject taskTable = WQLObject.getWQLObject("sch_base_task");
WQLObject cacheVehTable = WQLObject.getWQLObject("sch_cacheline_vehilematerial");
WQLObject pointTable = WQLObject.getWQLObject("SCH_BASE_Point");
WQLObject deviceTable = WQLObject.getWQLObject("pdm_bi_device");
String outboxtxm = param.getString("outboxtxm");
switch (status){
case STATUS_START:
taskTable.update(MapOf.of("task_status",StatusEnum.TASK_RUNNING.getCode(),"update_name","acs","update_time", DateUtil.now()),"task_id = '"+task.getString("task_id")+"'");
cacheVehTable.delete("vehicle_code = '" + outboxtxm + "'");
break;
case STATUS_FINISH:
taskTable.update(MapOf.of("task_status",StatusEnum.TASK_FINISH.getCode(),"update_name","acs","update_time", DateUtil.now()),"task_id = '"+task.getString("task_id")+"'");
String point_code2 = task.getString("point_code2");
JSONObject pointInfo = pointTable.query("point_code = '" + point_code2 + "'").uniqueResult(0);
JSONObject device = deviceTable.query("device_code = '" + pointInfo.getString("device_code") + "'").uniqueResult(0);
task.getDouble("material_qty");
double currentQty = device.getDouble("deviceinstor_qty") + task.getDouble("material_qty");
deviceTable.update(MapOf.of("deviceinstor_qty", String.valueOf(currentQty)), "device_code = '" + pointInfo.getString("device_code") + "'");
break;
case STATUS_CANNEL:
cancel(param.getString("task_id"));
break;
default:
throw new BadRequestException(OPT_NAME+"未定义任务状态:"+sta);
}
}
}
@Override
public void pointConfirm(JSONObject param) {
agvInstService.empMatter(param);
}
}

View File

@@ -1,4 +1,4 @@
package org.nl.wms.product_manage.sch.tasks;
package org.nl.wms.product_manage.sch.tasks.SpeMachinery;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.lang.Assert;
@@ -11,9 +11,9 @@ import org.nl.common.enums.AcsTaskEnum;
import org.nl.common.enums.InterfaceLogType;
import org.nl.common.enums.StatusEnum;
import org.nl.common.utils.MapOf;
import org.nl.common.utils.SecurityUtils;
import org.nl.modules.common.exception.BadRequestException;
import org.nl.modules.system.util.CodeUtil;
import org.nl.common.utils.SecurityUtils;
import org.nl.modules.wql.WQL;
import org.nl.modules.wql.core.bean.WQLObject;
import org.nl.wms.ext.acs.service.impl.AgvInstService;
@@ -23,7 +23,6 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.HashMap;
import java.util.Map;
@@ -32,7 +31,7 @@ import java.util.Map;
*/
@Slf4j
@Service
public class SpeMachineryTask extends AbstractAcsTask {
public class SpeFullTask extends AbstractAcsTask {
@Autowired
AgvInstService agvInstService;
@@ -40,7 +39,7 @@ public class SpeMachineryTask extends AbstractAcsTask {
private static String OPT_NAME = "ACS回调# ";
public SpeMachineryTask() {
public SpeFullTask() {
SpeHandles.put(AcsTaskEnum.TASK_PRODUCT_MAC.name() ,new Spe2Spe());
SpeHandles.put(AcsTaskEnum.TASK_PRODUCT_CACHE.name() ,new Spe2Cache());
SpeHandles.put(AcsTaskEnum.TASK_CACHELINE_OUT.name() ,new Cache2Spe());
@@ -73,23 +72,16 @@ public class SpeMachineryTask extends AbstractAcsTask {
JSONArray chectIndDatabase = WQLObject.getWQLObject("SCH_BASE_Task").query((AcsTaskEnum.REQUEST_CALLTYPE_FULL.getCode().equals(type) ? "point_code1" : "point_code2") + "= '" + point_code + "' and task_status < " + StatusEnum.TASK_FINISH.getCode()).getResultJSONArray(0);
if (ObjectUtil.isNotEmpty(chectIndDatabase)){
Assert.notNull(order, String.format("设备%s存在未完成任务", param.getString("point_code")));
}
JSONObject empPoint = WQL.getWO("sch_point").addParamMap(MapOf.of("flag", "2", "point_code", point_code, "point_type", StatusEnum.POINT_LOCATION_EMP.getCode())).process().uniqueResult(0);
JSONObject form = new JSONObject(MapOf.of("start_point_code",point_code,
"next_point_code","","return_point_code", empPoint.getString("point_code"),"vehicle_code",
"","product_area",order.getString("product_area"),"quantity", quantity,"type",type,"material_id", order.getString("material_id")));
}
JSONObject form = null;
if (AcsTaskEnum.REQUEST_CALLTYPE_FULL.getCode().equals(type)){
JSONObject empPoint = WQL.getWO("sch_point").addParamMap(MapOf.of("flag", "2", "point_code", point_code, "point_type", StatusEnum.POINT_LOCATION_EMP.getCode())).process().uniqueResult(0);
form = new JSONObject(MapOf.of("start_point_code",point_code,
"next_point_code","","return_point_code", empPoint.getString("point_code"),"vehicle_code",
"","product_area",order.getString("product_area"),"quantity", quantity,"type",type,"material_id", order.getString("material_id")));
}
if (AcsTaskEnum.REQUEST_CALLTYPE_EMP.getCode().equals(type)){
form = new JSONObject(MapOf.of("start_point_code","",
"next_point_code",point_code,"return_point_code", "","vehicle_code",
"","product_area",order.getString("product_area"),"quantity", quantity,"type",type,"material_id", order.getString("material_id")));
}
String taskId = IdUtil.getSnowflake(1, 1).nextId() + "";
JSONObject task = packageParam(form, taskId);
WQLObject.getWQLObject("SCH_BASE_Task").insert(task);
try {
pointConfirm(task);
//下发
@@ -246,12 +238,7 @@ public class SpeMachineryTask extends AbstractAcsTask {
@Override
public void pointConfirm(JSONObject param) {
String type = param.getString("task_type");
if (AcsTaskEnum.REQUEST_CALLTYPE_FULL.getCode().equals(type)){
agvInstService.fullMaster(param);
}
if (AcsTaskEnum.REQUEST_CALLTYPE_EMP.getCode().equals(type)){
agvInstService.callMatter(param);
}
agvInstService.fullMaster(param);
}
}

View File

@@ -19,4 +19,13 @@ public interface IPdmBiDeviceService extends IService<PdmBiDevice> {
List<Map> getNotWorkDeviceByWorkproceduceId(JSONObject param);
/**
* 获取生产工序对应可用设备
* 重量/物料校验
* @param param
* @return
*/
List<Map> workproceduceDevices(Map<String,Object> param);
}

View File

@@ -90,7 +90,7 @@ public class PdmBiDevice implements Serializable {
private BigDecimal deviceinitinstor_qty;
/**
* 设备实时来料仓数
* 设备实时来料仓数:用于数量校验
*/
private BigDecimal deviceinstor_qty;

View File

@@ -1,5 +1,6 @@
package org.nl.wms.product_manage.service.device.dao.mapper;
import com.alibaba.fastjson.JSONObject;
import org.nl.wms.product_manage.service.device.dao.PdmBiDevice;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
@@ -17,4 +18,6 @@ import java.util.Map;
public interface PdmBiDeviceMapper extends BaseMapper<PdmBiDevice> {
List<Map> getNotWorkDevice(Map<String,Object> query);
List<Map> workproceduceDevices(Map<String,Object> query);
}

View File

@@ -18,4 +18,22 @@
from PDM_produce_workOrder o
where '5' > o.workorder_status and o.is_delete = '0' )
</select>
<select id="workproceduceDevices" resultType="java.util.Map">
select
GROUP_CONCAT(sch_base_task.task_id),
pdm_bi_device.inupperlimit_qty - ifnull( sum( sch_base_task.material_qty ), 0 ) - pdm_bi_device.deviceinstor_qty AS currentQty,
pdm_bi_device.device_code,
sch_base_point.point_code,
from sch_base_point
left join pdm_bi_device on pdm_bi_device.device_code = sch_base_point.device_code
left JOIN sch_base_task ON sch_base_point.point_code = point_code2 and '7' > task_status
where
sch_base_point.point_type = '4'
and workprocedure_id = #{workprocedure_id}
<if test="material_id != null and material_id != ''">
and pdm_bi_device.material_id = #{material_id}
</if>
GROUP BY pdm_bi_device.device_code
HAVING currentQty > #{qty}
</select>
</mapper>

View File

@@ -25,4 +25,9 @@ public class PdmBiDeviceServiceImpl extends ServiceImpl<PdmBiDeviceMapper, PdmBi
public List<Map> getNotWorkDeviceByWorkproceduceId(JSONObject param) {
return this.baseMapper.getNotWorkDevice(param);
}
@Override
public List<Map> workproceduceDevices(Map<String, Object> param) {
return this.baseMapper.workproceduceDevices(param);
}
}

View File

@@ -6,14 +6,23 @@ package org.nl.wms.scheduler_manage.controller.scheduler;
*/
import cn.dev33.satoken.annotation.SaIgnore;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.apache.commons.lang3.StringUtils;
import org.nl.common.TableDataInfo;
import org.nl.modules.common.exception.BadRequestException;
import org.nl.wms.scheduler_manage.service.scheduler.ISchProcessRouteService;
import org.nl.wms.scheduler_manage.service.scheduler.SchedulerService;
import org.nl.wms.scheduler_manage.service.scheduler.dao.SchProcessRoute;
import org.nl.wms.scheduler_manage.service.scheduler.labelConverter.impl.FlowElement;
import org.nl.wms.scheduler_manage.service.scheduler.labelConverter.impl.ProcessElement;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import java.util.Arrays;
import java.util.List;
@RestController
@RequestMapping("/api/shceduler")
@@ -23,6 +32,9 @@ public class SchedulerController {
@Autowired
SchedulerService schedulerService;
@Autowired
ISchProcessRouteService processRouteService;
@GetMapping("/all")
public ResponseEntity<Object> allprocess(){
return new ResponseEntity<>(schedulerService.all(), HttpStatus.OK);
@@ -36,4 +48,49 @@ public class SchedulerController {
FlowElement element = schedulerService.currentFlow(process, flow);
return new ResponseEntity<>(element, HttpStatus.OK);
}
@GetMapping("/route")
public ResponseEntity<Object> route(String blurry){
QueryWrapper<SchProcessRoute> query = new QueryWrapper<>();
if (StringUtils.isNotEmpty(blurry)){
query.like("process_id", blurry)
.or()
.like("process_name", blurry)
.or()
.like("material_spec", blurry);
}
List<SchProcessRoute> list = processRouteService.list(query);
return new ResponseEntity<>(TableDataInfo.build(list), HttpStatus.OK);
}
@PostMapping("/routeDelete")
public ResponseEntity<Object> routeDelete(@RequestBody String[] materialSpecs){
processRouteService.removeByIds(Arrays.asList(materialSpecs));
return new ResponseEntity<>(HttpStatus.OK);
}
@PostMapping("/routeCreate")
public ResponseEntity<Object> routeCreate(@RequestBody JSONObject form){
SchProcessRoute route = form.toJavaObject(SchProcessRoute.class);
ProcessElement process = schedulerService.getProcess(route.getProcess_id());
if (process == null){
throw new BadRequestException("当前工序路由id"+route.getProcess_id()+"没有对应xml配置文件配置");
}
route.setProcess_name(process.getName());
processRouteService.save(route);
return new ResponseEntity<>(HttpStatus.OK);
}
@PostMapping("/routeUpdate")
public ResponseEntity<Object> routeUpdate(@RequestBody JSONObject form){
SchProcessRoute route = form.toJavaObject(SchProcessRoute.class);
ProcessElement process = schedulerService.getProcess(route.getProcess_id());
if (process == null){
throw new BadRequestException("当前工序路由id"+route.getProcess_id()+"没有对应xml配置文件配置");
}
route.setProcess_name(process.getName());
processRouteService.updateById(route);
return new ResponseEntity<>(HttpStatus.OK);
}
}

View File

@@ -3,6 +3,9 @@ package org.nl.wms.scheduler_manage.service.cacheline;
import org.nl.wms.scheduler_manage.service.cacheline.dao.SchCachelineVehicle;
import com.baomidou.mybatisplus.extension.service.IService;
import java.util.List;
import java.util.Map;
/**
* <p>
* 缓存线载具条码表 服务类
@@ -13,4 +16,5 @@ import com.baomidou.mybatisplus.extension.service.IService;
*/
public interface ISchCachelineVehicleService extends IService<SchCachelineVehicle> {
List<SchCachelineVehicle> getCachelineVehicle(Map query);
}

View File

@@ -3,6 +3,9 @@ package org.nl.wms.scheduler_manage.service.cacheline.dao.mapper;
import org.nl.wms.scheduler_manage.service.cacheline.dao.SchCachelineVehicle;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import java.util.List;
import java.util.Map;
/**
* <p>
* 缓存线载具条码表 Mapper 接口
@@ -13,4 +16,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
*/
public interface SchCachelineVehicleMapper extends BaseMapper<SchCachelineVehicle> {
List<SchCachelineVehicle> getCachelineVehicle(Map<String,String> query);
}

View File

@@ -2,4 +2,17 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.nl.wms.scheduler_manage.service.cacheline.dao.mapper.SchCachelineVehicleMapper">
<select id="getCachelineVehicle"
resultType="org.nl.wms.scheduler_manage.service.cacheline.dao.SchCachelineVehicle">
SELECT
v.vehicle_code,v.vehicle_status,v.material_id
FROM
sch_cacheline_vehilematerial v
LEFT JOIN sch_cacheline_position p ON p.vehicle_code = v.vehicle_code
WHERE p.vehicle_code <> '' and
v.vehicle_status = #{vehicle_status}
<if test="material_id != null and material_id != ''">
v.material_id = #{material_id}
</if>
</select>
</mapper>

View File

@@ -6,6 +6,9 @@ import org.nl.wms.scheduler_manage.service.cacheline.ISchCachelineVehicleService
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;
/**
* <p>
* 缓存线载具条码表 服务实现类
@@ -17,4 +20,8 @@ import org.springframework.stereotype.Service;
@Service
public class SchCachelineVehicleServiceImpl extends ServiceImpl<SchCachelineVehicleMapper, SchCachelineVehicle> implements ISchCachelineVehicleService {
@Override
public List<SchCachelineVehicle> getCachelineVehicle(Map query) {
return this.baseMapper.getCachelineVehicle(query);
}
}

View File

@@ -39,4 +39,11 @@ public interface ISchBasePointService extends IService<SchBasePoint> {
*/
void changeActive(JSONObject form);
/**
* 根据设备点位查询设备对应工序
* @param point_code
* @return
*/
Map findDeviceWorkprodure(String point_code);
}

View File

@@ -28,4 +28,6 @@ public interface SchBasePointMapper extends BaseMapper<SchBasePoint> {
* @return
*/
List<Map> selectPoint(Map<String,Object> map);
Map getDeviceWorkprodure(String pointCode);
}

View File

@@ -89,4 +89,11 @@
AND ruledis.load_series >= #{loadSeries}
</if>
</select>
<select id="getDeviceWorkprodure" resultType="java.util.Map">
select
r.workprocedure_code,r.workprocedure_id from pdm_bi_device dev
LEFT join sch_base_point p on p.device_code = dev.device_code
LEFT JOIN pdm_bi_workprocedure r on dev.workprocedure_id = r.workprocedure_id
where p.point_code = #{pointCode};
</select>
</mapper>

View File

@@ -140,4 +140,12 @@ public class SchBasePointServiceImpl extends ServiceImpl<SchBasePointMapper, Sch
WQLObject.getWQLObject("sch_base_point").update(form);
//BussEventMulticaster.Publish(new PointEvent());
}
@Override
public Map findDeviceWorkprodure(String point_code) {
if (StringUtils.isNotEmpty(point_code)){
return this.baseMapper.getDeviceWorkprodure(point_code);
}
return null;
}
}

View File

@@ -0,0 +1,17 @@
package org.nl.wms.scheduler_manage.service.scheduler;
import org.nl.wms.scheduler_manage.service.scheduler.dao.SchProcessRoute;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* <p>
* 物料系列调度线路配置表 服务类
* </p>
*
* @author generator
* @since 2023-05-23
*/
public interface ISchProcessRouteService extends IService<SchProcessRoute> {
SchProcessRoute findByMaterialId(String materialId,String regionCode);
}

View File

@@ -10,8 +10,6 @@ import org.nl.wms.scheduler_manage.service.scheduler.labelConverter.BaseElement;
import org.nl.wms.scheduler_manage.service.scheduler.labelConverter.impl.FlowElement;
import org.nl.wms.scheduler_manage.service.scheduler.labelConverter.impl.ProcessElement;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.beans.factory.config.BeanPostProcessor;
import org.springframework.core.io.FileSystemResourceLoader;
import org.springframework.core.io.Resource;
@@ -36,7 +34,6 @@ import java.util.function.Function;
*/
@Service
public class SchedulerService implements BeanPostProcessor {
@Value("${schedulerFile}")
private static Map<String,BaseConverter> converterMap =new HashMap<>();

View File

@@ -0,0 +1,38 @@
package org.nl.wms.scheduler_manage.service.scheduler.dao;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* <p>
* 物料系列调度线路配置表
* </p>
*
* @author generator
* @since 2023-05-23
*/
@Data
@EqualsAndHashCode(callSuper = false)
@TableName("sch_process_route")
public class SchProcessRoute implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 规则(物料系列/区域)
*/
@TableId(value ="rule_code" )
private String rule_code;
/**
* 袋唯一标识
*/
private String process_id;
private String process_name;
}

View File

@@ -0,0 +1,17 @@
package org.nl.wms.scheduler_manage.service.scheduler.dao.mapper;
import org.nl.wms.scheduler_manage.service.scheduler.dao.SchProcessRoute;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* <p>
* 物料系列调度线路配置表 Mapper 接口
* </p>
*
* @author generator
* @since 2023-05-23
*/
public interface SchProcessRouteMapper extends BaseMapper<SchProcessRoute> {
SchProcessRoute findByMaterialId(String materialId);
}

View File

@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.nl.wms.scheduler_manage.service.scheduler.dao.mapper.SchProcessRouteMapper">
<select id="findByMaterialId"
resultType="org.nl.wms.scheduler_manage.service.scheduler.dao.SchProcessRoute">
select
sch_process_route.* from sch_process_route
left join md_me_materialbase on sch_process_route.rule_code = md_me_materialbase.material_spec
where md_me_materialbase.material_id = #{materialId}
</select>
</mapper>

View File

@@ -0,0 +1,41 @@
package org.nl.wms.scheduler_manage.service.scheduler.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.apache.commons.lang3.StringUtils;
import org.nl.wms.scheduler_manage.service.scheduler.dao.SchProcessRoute;
import org.nl.wms.scheduler_manage.service.scheduler.dao.mapper.SchProcessRouteMapper;
import org.nl.wms.scheduler_manage.service.scheduler.ISchProcessRouteService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
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;
/**
* <p>
* 物料系列调度线路配置表 服务实现类
* </p>
*
* @author generator
* @since 2023-05-23
*/
@Service
public class SchProcessRouteServiceImpl extends ServiceImpl<SchProcessRouteMapper, SchProcessRoute> implements ISchProcessRouteService {
@Autowired
ISysParamService iSysParamService;
@Override
public SchProcessRoute findByMaterialId(String materialId, String regionCode) {
Param one = iSysParamService.getOne(new QueryWrapper<Param>().eq("code", "process_route"));
String value = one.getValue();
if (value.equals("1")){
return this.getOne(new QueryWrapper<SchProcessRoute>().eq("rule_code",regionCode));
}else {
if (StringUtils.isNotEmpty(materialId)){
return this.baseMapper.findByMaterialId(materialId);
}
}
return null;
}
}

View File

@@ -36,9 +36,7 @@ public class FlowConverter implements BaseConverter {
}
if (XMLStreamConstants.START_ELEMENT == xtr.next()){
System.out.println(xtr.getLocalName());
Map<String, String> param = new HashMap();
param.put(xtr.getAttributeValue(null,"id"),xtr.getAttributeValue(null,"value"));
element.getParams().add(param);
element.getParams().put(xtr.getAttributeValue(null,"id"),xtr.getAttributeValue(null,"value"));
i++;
}
}

View File

@@ -3,6 +3,7 @@ package org.nl.wms.scheduler_manage.service.scheduler.labelConverter.impl;
import org.nl.wms.scheduler_manage.service.scheduler.labelConverter.BaseElement;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -16,7 +17,7 @@ public class FlowElement extends BaseElement {
private FlowElement targetRef;
private String sourceRefId;
private String targetRefId;
private List<Map<String,String>> params = new ArrayList<>();
private Map<String,String> params = new HashMap<>();
@@ -54,11 +55,11 @@ public class FlowElement extends BaseElement {
this.targetRefId = targetRefId;
}
public List<Map<String, String>> getParams() {
public Map<String, String> getParams() {
return params;
}
public void setParams(List<Map<String, String>> params) {
public void setParams(Map<String, String> params) {
this.params = params;
}
}

View File

@@ -1,6 +1,8 @@
package org.nl.wms.scheduler_manage.service.task.dao;
import java.math.BigDecimal;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.util.Date;
@@ -26,6 +28,7 @@ public class SchBaseTask implements Serializable {
/**
* 任务标识
*/
@TableId(value = "task_id")
private String task_id;
/**

View File

@@ -2,8 +2,12 @@
<definitions>
<process id="JGXJ" name="机关下料">
<start id="start" name="Starter" targetRef="A1_JGXJ"></start>
<flow id="A1_JGXJ" name="机关下料工序" sourceRef="start" targetRef="A1_TWYTJ"></flow>
<flow id="A1_TWYTJ" name="推弯工序" sourceRef="A1_JGXJ" targetRef="A1_SKQX"></flow>
<flow id="A1_JGXJ" name="机关下料工序" has="1" sourceRef="start" targetRef="A1_TWYTJ">
<param id="cacheLine" value="A1_HCX_01"/>
</flow>
<flow id="A1_TWYTJ" name="推弯工序" has="1" sourceRef="A1_JGXJ" targetRef="A1_SKQX">
<param id="cacheLine" value="A1_HCX_01"/>
</flow>
<flow id="A1_SKQX" name="深坑清洗" sourceRef="A1_TWYTJ" targetRef="end"></flow>
<end id="end" name="Junior Reject End" sourceRef="A1_SKQX"></end>
</process>

View File

@@ -0,0 +1,102 @@
<template>
<div class="app-container">
<!--表单组件-->
<el-dialog append-to-body :close-on-click-modal="false" :before-close="crud.cancelCU" :visible="crud.status.cu > 0"
:title="crud.status.title" width="500px">
<el-form ref="form" :model="form" :rules="rules" size="mini" label-width="80px">
<el-form-item label="物料系列" prop="code">
<el-input v-model="form.material_spec" style="width: 370px;"/>
</el-form-item>
<el-form-item label="工序调度编号">
<el-input v-model="form.process_id" style="width: 370px;"/>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="text" @click="crud.cancelCU">取消</el-button>
<el-button :loading="crud.status.cu === 2" type="primary" @click="crud.submitCU">确认</el-button>
</div>
</el-dialog>
<!-- 字典列表 -->
<el-card class="box-card">
<!--工具栏-->
<div class="head-container">
<div v-if="crud.props.searchToggle">
<!-- 搜索 -->
<el-input v-model="query.blurry" clearable size="mini" placeholder="输入名称或者描述搜索" style="width: 200px;"
class="filter-item" @keyup.enter.native="crud.toQuery"/>
<rrOperation/>
</div>
<crudOperation :permission="permission"/>
</div>
<!--表格渲染-->
<el-table
ref="table"
v-loading="crud.loading"
:data="crud.data"
highlight-current-row
style="width: 100%;"
@selection-change="crud.selectionChangeHandler"
@current-change="handleCurrentChange">
<el-table-column type="selection" width="55"/>
<el-table-column show-overflow-tooltip prop="material_spec" label="物料系列"/>
<el-table-column show-overflow-tooltip prop="process_id" label="工序调度编号"/>
<el-table-column show-overflow-tooltip prop="process_name" label="工序调度名称"/>
<el-table-column v-permission="['admin','dict:edit','dict:del']" label="操作" width="130px" align="center"
fixed="right">
<template slot-scope="scope">
<udOperation
:data="scope.row"
:permission="permission"
/>
</template>
</el-table-column>
</el-table>
<!--分页组件-->
<pagination/>
</el-card>
</div>
</template>
<script>
import crudRoute from '@/views/wms/scheduler_manage/scheduler/schedulerRoute.js'
import CRUD, {presenter, header, form} from '@crud/crud'
import crudOperation from '@crud/CRUD.operation'
import pagination from '@crud/Pagination'
import rrOperation from '@crud/RR.operation'
import udOperation from '@crud/UD.operation'
const defaultForm = {material_spec: null, process_id: null, process_name: null}
export default {
name: 'SchedulerRoute',
components: {crudOperation, pagination, rrOperation, udOperation},
cruds() {
return [
CRUD({title: '物料对应工序调度', url: '/api/shceduler/route', idField: 'material_spec', crudMethod: {...crudRoute}})
]
},
mixins: [presenter(), header(), form(defaultForm)],
data() {
return {
queryTypeOptions: [
{key: 'name', display_name: '字典名称'},
{key: 'description', display_name: '描述'}
],
rules: {
material_spec: [
{required: true, message: '请输入编码', trigger: 'blur'}
]
},
permission: {
add: ['admin', 'dict:add'],
edit: ['admin', 'dict:edit'],
del: ['admin', 'dict:del']
}
}
},
methods: {}
}
</script>
<style scoped>
</style>

View File

@@ -0,0 +1,34 @@
import request from '@/utils/request'
export function getRoutes() {
return request({
url: '/api/shceduler/route',
method: 'get'
})
}
export function add(data) {
return request({
url: '/api/shceduler/routeCreate',
method: 'post',
data
})
}
export function del(ids) {
return request({
url: '/api/shceduler/routeDelete',
method: 'post',
data: ids
})
}
export function edit(data) {
return request({
url: '/api/shceduler/routeUpdate',
method: 'post',
data
})
}
export default { getRoutes, add, edit, del }