From 462f516c3f26565a25e847932dbd6e4eb0665df0 Mon Sep 17 00:00:00 2001 From: yanps Date: Wed, 20 Nov 2024 16:32:35 +0800 Subject: [PATCH] =?UTF-8?q?opt:=20=E7=89=A9=E6=96=99=E5=9B=BE=E7=89=87?= =?UTF-8?q?=E6=98=BE=E7=A4=BA,=E4=BF=AE=E5=A4=8D=E5=86=B2=E5=BA=8A?= =?UTF-8?q?=E5=85=88=E5=8F=96=E4=B8=8A=E5=86=8D=E5=8F=96=E4=B8=8B=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../agv/server/impl/NDCAgvServiceImpl.java | 6 +- .../agv/ndcone/AgvNdcOneDeviceDriver.java | 22 ++- .../wms/service/impl/AcsToWmsServiceImpl.java | 3 +- .../acs/service/impl/AcsToWmsServiceImpl.java | 58 +++++-- .../impl/ConnectorToWmsServiceImpl.java | 14 +- .../ISchBaseVehiclematerialgroupService.java | 5 + .../dao/SchBaseVehiclematerialgroup.java | 3 + .../SchBaseVehiclematerialgroupMapper.xml | 5 +- ...chBaseVehiclematerialgroupServiceImpl.java | 7 + .../service/impl/SchBasePointServiceImpl.java | 4 +- .../service/impl/SchBaseTaskServiceImpl.java | 2 +- .../sch/task_manage/AutoQueryFilePath.java | 80 ++++++++++ .../sch/task_manage/GeneralDefinition.java | 143 ++++++++++++++---- .../task/tasks/connector/CNTTask.java | 19 ++- .../src/main/resources/logback-spring.xml | 3 +- .../src/views/wms/sch/group/index.vue | 6 +- 16 files changed, 307 insertions(+), 73 deletions(-) create mode 100644 lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/AutoQueryFilePath.java diff --git a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/server/impl/NDCAgvServiceImpl.java b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/server/impl/NDCAgvServiceImpl.java index 84cea2c..3a4ada8 100644 --- a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/server/impl/NDCAgvServiceImpl.java +++ b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/server/impl/NDCAgvServiceImpl.java @@ -161,8 +161,8 @@ public class NDCAgvServiceImpl implements NDCAgvService { byte indexlow = (byte) IntToHexLow(index); byte phasehigh = (byte) IntToHexHigh(phase); byte phaselow = (byte) IntToHexLow(phase); - byte nextPointHigh =(byte) IntToHexHigh(nextPoint); - byte nextPointLow =(byte) IntToHexLow(nextPoint); + byte startPointHigh =(byte) IntToHexHigh(startPoint); + byte startPointLow =(byte) IntToHexLow(startPoint); byte[] b = new byte[]{(byte) 0X87, (byte) 0XCD, (byte) 0X00, (byte) 0X08, @@ -173,7 +173,7 @@ public class NDCAgvServiceImpl implements NDCAgvService { (byte) indexhigh, (byte) indexlow, (byte) 0X01, (byte) 0X12, (byte) phasehigh, (byte) phaselow, - (byte) nextPointHigh,(byte) nextPointLow + (byte) startPointHigh,(byte) startPointLow }; log.info("反馈agv动作数据--index:" + hexToString(indexhigh & 0xFF) + hexToString(indexlow & 0xFF) + ",phase:" + hexToString(phasehigh & 0xFF) + hexToString(phaselow & 0xFF)); diff --git a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/basedriver/agv/ndcone/AgvNdcOneDeviceDriver.java b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/basedriver/agv/ndcone/AgvNdcOneDeviceDriver.java index b9994cb..ef287a7 100644 --- a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/basedriver/agv/ndcone/AgvNdcOneDeviceDriver.java +++ b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/basedriver/agv/ndcone/AgvNdcOneDeviceDriver.java @@ -582,19 +582,27 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic private byte[] getData(byte[] data, int index, Instruction inst, TaskDto task) { - String hasWms = paramService.findByCode("hasWms").getValue(); - if ("3".equals(task.getTask_type()) && StrUtil.isNotEmpty(hasWms) && "1".equals(hasWms)) { - String resp = acsToWmsService.requestTaskAgain(task.getNext_point_code(), task.getExt_task_id(), inst.getVehicle_code()); + if ("2".equals(task.getTask_type())) { + String resp = acsToWmsService.requestTaskAgain(task.getStart_point_code(), task.getExt_task_id(), inst.getVehicle_code()); if (StrUtil.isEmpty(resp)) { log.info("申请分配二次点位失败,响应参数:{}", resp); + return null; } + String start_point_code = task.getStart_point_code(); JSONObject respjson = JSONObject.parseObject(resp); String point_code = respjson.getString("point_code"); - task.setStart_device_code2(point_code); - int start_address = deviceService.queryAddressBydeviceCode(inst.getStart_point_code()); - int next_address = deviceService.queryAddressBydeviceCode(point_code); + task.setStart_device_code(point_code); + task.setStart_point_code(point_code); + task.setPut_device_code(start_point_code); + task.setPut_point_code(start_point_code); + inst.setPut_device_code(start_point_code); + inst.setPut_point_code(start_point_code); + inst.setStart_device_code(point_code); + inst.setStart_point_code(point_code); taskService.update(task); - data = NDCAgvService.sendAgvOneModeInst(phase, index, 0, start_address, next_address, 0, 0); + instructionService.update(inst); + int start_address = deviceService.queryAddressBydeviceCode(point_code); + data = NDCAgvService.sendAgvOneModeInst(phase, index, 0, start_address, 0, 0, 0); log.info("指令号:{},phase:{},acs请求wms申请成功", inst.getInstruction_code(), phase); } else { data = NDCAgvService.sendAgvOneModeInst(phase, index, 0, 0, 0, 0, 0); diff --git a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/impl/AcsToWmsServiceImpl.java b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/impl/AcsToWmsServiceImpl.java index 72c9f5f..27322d5 100644 --- a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/impl/AcsToWmsServiceImpl.java +++ b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/impl/AcsToWmsServiceImpl.java @@ -157,8 +157,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { jo.put("device_code",address); String result2 = null; - AddressDto addressDto = addressService.findByCode("requestTaskAgain"); - String methods_url = addressDto.getMethods_url(); + String methods_url = "/api/wms/task/feedAgvAgain"; String url = wmsurl + methods_url; log.info("requestTaskAgain----请求参数{}", jo); diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/acs/service/impl/AcsToWmsServiceImpl.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/acs/service/impl/AcsToWmsServiceImpl.java index eaf19d3..4f66b92 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/acs/service/impl/AcsToWmsServiceImpl.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/acs/service/impl/AcsToWmsServiceImpl.java @@ -18,6 +18,7 @@ import org.apache.commons.lang3.StringUtils; import org.nl.common.enums.GoodsEnum; import org.nl.common.exception.BadRequestException; import org.nl.system.service.notice.ISysNoticeService; +import org.nl.system.service.param.ISysParamService; import org.nl.wms.cockpit.service.dao.DasDeviceFault; import org.nl.wms.cockpit.service.mapper.CockpitMapper; import org.nl.wms.database.material.service.IMdBaseMaterialService; @@ -41,14 +42,14 @@ 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.AbstractTask; import org.nl.wms.sch.task_manage.GeneralDefinition; import org.nl.wms.sch.task_manage.enums.NoticeTypeEnum; 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.core.TaskType; 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.stereotype.Service; import org.springframework.util.CollectionUtils; @@ -56,12 +57,11 @@ import org.springframework.util.CollectionUtils; import javax.annotation.PostConstruct; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; -import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.CopyOnWriteArrayList; +import java.util.concurrent.atomic.AtomicReference; /** * @Author: lyd @@ -104,6 +104,8 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { private IMdBaseMaterialService iMdBaseMaterialService; @Autowired private FabServiceImpl FabServiceImpl; + @Autowired + private ISysParamService sysParamService; /** * 初始化反射方法 @@ -338,13 +340,32 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { if (ObjectUtil.isEmpty(schBaseTask)) { throw new BadRequestException("任务不存在!task_id:" + task_id); } - if (device_code.equals(schBaseTask.getPoint_code2())) throw new BadRequestException("设备号与任务设备不匹配!"); //查询点位是否存在 SchBasePoint schBasePoint = pointService.selectByPointCode(device_code); if (ObjectUtil.isEmpty(schBasePoint)) throw new BadRequestException("点位不存在!device_code:" + device_code); - SchBasePoint schBasePoint1 = pointService.selectByNextWaitPoint(device_code, schBaseTask.getVehicle_code()); - if (ObjectUtil.isEmpty(schBasePoint1)) throw new BadRequestException("未查询到可用点位!等待点位:" + device_code); - return schBasePoint1; + SchBasePoint schBasePoint1 = null; + List list = GeneralDefinition.CYZZD01.get(device_code); + if (CollUtil.isEmpty(list)) { + list = GeneralDefinition.CYZZD02.get(device_code); + } + if (CollUtil.isNotEmpty(list)) { + for (String s : list) { + schBasePoint1 = pointService.getOne(Wrappers.lambdaQuery(SchBasePoint.class) + .eq(SchBasePoint::getPoint_code, s) + .eq(SchBasePoint::getIs_lock, false)); + if (ObjectUtil.isNotEmpty(schBasePoint1)) { + pointService.update(Wrappers.lambdaUpdate(SchBasePoint.class) + .eq(SchBasePoint::getPoint_code, schBasePoint1.getPoint_code()) + .set(SchBasePoint::getIs_lock, true)); + schBaseTask.setPoint_code1(schBasePoint1.getPoint_code()); + schBaseTask.setStart_wait_point(device_code); + TaskUtils.setUpdateByAcs(schBaseTask); + taskService.update(schBaseTask); + return schBasePoint1; + } + } + return null; + } } return null; } @@ -454,7 +475,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { json.put("status", status); json.put("device_code", schBaseTask.getPoint_code1()); json.put("task_code", schBaseTask.getTask_code()); - //AcsResponse acsResponse = connectorService.feedAgvTaskStatus(json); + AcsResponse acsResponse = connectorService.feedAgvTaskStatus(json); } if ("2".equals(is_connector)) { JSONObject json = new JSONObject(); @@ -488,6 +509,25 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { json.put("status", status); json.put("device_code", schBaseTask.getPoint_code1()); json.put("task_code", schBaseTask.getTask_code()); + if(schBaseTask.getPoint_code1().endsWith("1")){ + String replace = schBaseTask.getPoint_code1().replace("1", "2"); + SchBaseTask schBaseTask1 = taskService.getOne(Wrappers.lambdaQuery(SchBaseTask.class) + .eq(SchBaseTask::getPoint_code1, replace) + .eq(SchBaseTask::getTask_status,TaskStatus.TIMEOUT.getCode())); + if(ObjectUtil.isNotEmpty(schBaseTask1)){ + schBaseTask1.setTask_status(TaskStatus.CREATED.getCode()); + taskService.update(schBaseTask1); + } + } else if(schBaseTask.getPoint_code1().endsWith("3")){ + String replace = schBaseTask.getPoint_code1().replace("3", "4"); + SchBaseTask schBaseTask2 = taskService.getOne(Wrappers.lambdaQuery(SchBaseTask.class) + .eq(SchBaseTask::getPoint_code1, replace) + .eq(SchBaseTask::getTask_status,TaskStatus.TIMEOUT.getCode())); + if(ObjectUtil.isNotEmpty(schBaseTask2)){ + schBaseTask2.setTask_status(TaskStatus.CREATED.getCode()); + taskService.update(schBaseTask2); + } + } boolean flag = true; String jobName = null; iSchBaseVehiclematerialgroupService.remove(Wrappers.lambdaQuery(SchBaseVehiclematerialgroup.class) diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/connector/service/impl/ConnectorToWmsServiceImpl.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/connector/service/impl/ConnectorToWmsServiceImpl.java index 46517be..f50ea4f 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/connector/service/impl/ConnectorToWmsServiceImpl.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/connector/service/impl/ConnectorToWmsServiceImpl.java @@ -74,26 +74,23 @@ public class ConnectorToWmsServiceImpl implements ConnectorToWmsService { map1.put("status", HttpStatus.HTTP_INTERNAL_ERROR); map1.put("message", StrUtil.isEmpty(task_code) ? "任务号不能为空!" : StrUtil.isEmpty(start_device_code) ? "起点参数不能为空!" : StrUtil.isEmpty(vehicle_code) ? "载具号不能为空!" : "未知"); - objects.add(map1); log.info(StrUtil.isEmpty(task_code) ? "任务号不能为空!" : StrUtil.isEmpty(start_device_code) ? "起点参数不能为空!" : StrUtil.isEmpty(vehicle_code) ? "载具号不能为空!" : "未知"); - continue; + return map1; } SchBasePoint schBasePoint = schBasePointService.selectByPointCode(start_device_code); if (ObjectUtil.isEmpty(schBasePoint)) { map1.put("task_code", task_code); map1.put("status", HttpStatus.HTTP_INTERNAL_ERROR); map1.put("message", start_device_code + "点位设备不存在!"); - objects.add(map1); log.info(start_device_code + "点位设备不存在!"); - continue; + return map1; } else if (schBasePoint.getIs_lock()) { map1.put("task_code", task_code); map1.put("status", HttpStatus.HTTP_INTERNAL_ERROR); map1.put("message", start_device_code + "该设备正在执行任务!"); - objects.add(map1); log.info(start_device_code + "该设备正在执行任务!"); - continue; + return map1; } //TODO:固定的载具类型,根据载具类型来决定终点 String task_type = data.getString("task_type"); @@ -115,17 +112,12 @@ public class ConnectorToWmsServiceImpl implements ConnectorToWmsService { connectorTask.apply(param); schBasePoint.setIs_lock(true); schBasePointService.updateById(schBasePoint); - map1.put("task_code", task_code); - map1.put("status", HttpStatus.HTTP_OK); - map1.put("message", "操作成功!"); - objects.add(map1); } map.put("status", HttpStatus.HTTP_OK); map.put("message", "操作成功!"); } catch (Exception e) { map.put("status", HttpStatus.HTTP_INTERNAL_ERROR); map.put("message", e.getMessage()); - objects.add(map); log.info("connector下发agv任务异常:{}", e.getMessage()); return map; } diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/group/service/ISchBaseVehiclematerialgroupService.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/group/service/ISchBaseVehiclematerialgroupService.java index f4c777a..2320678 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/group/service/ISchBaseVehiclematerialgroupService.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/group/service/ISchBaseVehiclematerialgroupService.java @@ -94,4 +94,9 @@ public interface ISchBaseVehiclematerialgroupService extends IService selectMaterialPathIsEmpty(); } diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/group/service/dao/SchBaseVehiclematerialgroup.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/group/service/dao/SchBaseVehiclematerialgroup.java index 41b9ffd..8aa1308 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/group/service/dao/SchBaseVehiclematerialgroup.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/group/service/dao/SchBaseVehiclematerialgroup.java @@ -159,6 +159,9 @@ public class SchBaseVehiclematerialgroup implements Serializable { @ApiModelProperty(value = "移动途径") private String move_way; + @ApiModelProperty(value = "物料图片路径") + private String material_path; + @TableField(exist = false) private String material_name; diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/group/service/dao/mapper/SchBaseVehiclematerialgroupMapper.xml b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/group/service/dao/mapper/SchBaseVehiclematerialgroupMapper.xml index e97b36a..614f62e 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/group/service/dao/mapper/SchBaseVehiclematerialgroupMapper.xml +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/group/service/dao/mapper/SchBaseVehiclematerialgroupMapper.xml @@ -88,9 +88,12 @@ AND vg.job_name like CONCAT('%', #{query.job_name}, '%') - + AND vg.region_code = #{query.region_code} + + AND vg.region_code is null + AND vg.order_code like CONCAT('%', #{query.order_code}, '%') diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/group/service/impl/SchBaseVehiclematerialgroupServiceImpl.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/group/service/impl/SchBaseVehiclematerialgroupServiceImpl.java index cd42975..bb3d0ab 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/group/service/impl/SchBaseVehiclematerialgroupServiceImpl.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/group/service/impl/SchBaseVehiclematerialgroupServiceImpl.java @@ -212,6 +212,13 @@ public class SchBaseVehiclematerialgroupServiceImpl extends ServiceImpl selectMaterialPathIsEmpty() { + return this.list(Wrappers.lambdaQuery(SchBaseVehiclematerialgroup.class) + .isNull(SchBaseVehiclematerialgroup::getMaterial_path) + .eq(SchBaseVehiclematerialgroup::getGroup_id,"9434")); + } + private Long getTime(String dateString) { String pattern = "yyyy-MM-dd HH:mm:ss"; java.util.Date date = DateUtil.parse(dateString, pattern); diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/point/service/impl/SchBasePointServiceImpl.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/point/service/impl/SchBasePointServiceImpl.java index 69b895b..e90aefa 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/point/service/impl/SchBasePointServiceImpl.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/point/service/impl/SchBasePointServiceImpl.java @@ -345,7 +345,9 @@ public class SchBasePointServiceImpl extends ServiceImpl schBasePoints = pointMapper.selectList(Wrappers.lambdaQuery(SchBasePoint.class).eq(SchBasePoint::getNext_wait_point, device_code).eq(SchBasePoint::getIs_used, true) + List schBasePoints = pointMapper.selectList(Wrappers.lambdaQuery(SchBasePoint.class) + .eq(SchBasePoint::getNext_wait_point, device_code) + .eq(SchBasePoint::getIs_used, true) .eq(SchBasePoint::getIs_lock, false).isNull(SchBasePoint::getVehicle_code) .eq(SchBasePoint::getPoint_status, GoodsEnum.OUT_OF_STOCK.getValue())); if (CollUtil.isNotEmpty(schBasePoints) && schBasePoints.size() > 0) { diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task/service/impl/SchBaseTaskServiceImpl.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task/service/impl/SchBaseTaskServiceImpl.java index 762b2fa..57d909d 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task/service/impl/SchBaseTaskServiceImpl.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task/service/impl/SchBaseTaskServiceImpl.java @@ -76,7 +76,7 @@ public class SchBaseTaskServiceImpl extends ServiceImpl pages = new Page<>(page.getPage() + 1, page.getSize()); diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/AutoQueryFilePath.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/AutoQueryFilePath.java new file mode 100644 index 0000000..f0ee663 --- /dev/null +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/AutoQueryFilePath.java @@ -0,0 +1,80 @@ +package org.nl.wms.sch.task_manage; + +import cn.hutool.core.io.FileUtil; +import cn.hutool.core.util.StrUtil; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import lombok.SneakyThrows; +import lombok.extern.slf4j.Slf4j; +import org.nl.system.service.param.dao.Param; +import org.nl.system.service.param.impl.SysParamServiceImpl; +import org.nl.wms.sch.group.service.ISchBaseVehiclematerialgroupService; +import org.nl.wms.sch.group.service.dao.SchBaseVehiclematerialgroup; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import java.io.File; +import java.util.List; + +/** + * 查询物料图片路径 + * + * @author LENOVO + */ +@Slf4j +@Component +public class AutoQueryFilePath { + + @Autowired + private ISchBaseVehiclematerialgroupService iSchBaseVehiclematerialgroupService; + + @Autowired + private SysParamServiceImpl sysParamService; + + private String materialUrl = null; + + private File directory = null; + + @SneakyThrows + public void run() { + List schBaseVehiclematerialgroups = iSchBaseVehiclematerialgroupService.selectMaterialPathIsEmpty(); + if(StrUtil.isEmpty(materialUrl)){ + Param byCode = sysParamService.findByCode(GeneralDefinition.MATERIAL_URL); + materialUrl = byCode.getValue(); + directory = new File(materialUrl); + } + if (StrUtil.isNotEmpty(materialUrl)) { + schBaseVehiclematerialgroups.stream().forEach(schBaseVehiclematerialgroup -> { + if (directory.exists() && directory.isDirectory()) { + selectMaterialPath(directory, schBaseVehiclematerialgroup); + } + }); + } + } + + + /** + * 查找物料图片路径 + */ + public void selectMaterialPath(File directory,SchBaseVehiclematerialgroup schBaseVehiclematerialgroup) { + File[] files = directory.listFiles(); + if (files != null) { + for (File file : files) { + if (file.isDirectory()) { + selectMaterialPath(file,schBaseVehiclematerialgroup); + } else if (file.isFile() && file.getName().substring(0, file.getName().lastIndexOf('.')).equals(schBaseVehiclematerialgroup.getMaterial_id())) { + File parentFile = file.getParentFile(); + if(parentFile != null) { + String name = parentFile.getName(); + if (StrUtil.isNotEmpty(name)) { + iSchBaseVehiclematerialgroupService.update(Wrappers.lambdaUpdate(SchBaseVehiclematerialgroup.class) + .eq(SchBaseVehiclematerialgroup::getGroup_id, schBaseVehiclematerialgroup.getGroup_id()) + .set(SchBaseVehiclematerialgroup::getMaterial_path, parentFile.getPath() + "\\" + name + "_large.png")); + break; + } + } + } + } + } + } + +} diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/GeneralDefinition.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/GeneralDefinition.java index c3c8a5d..441254e 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/GeneralDefinition.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/GeneralDefinition.java @@ -1,62 +1,113 @@ package org.nl.wms.sch.task_manage; +import cn.hutool.core.collection.ListUtil; +import org.nl.config.MapOf; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + /** * @Author: lyd * @Description: 通用定义类型数据 * @Date: 2023/7/13 */ public class GeneralDefinition { - /** 未知 */ + /** + * 未知 + */ public static final String UNKNOWN = "-"; // 统一编码定义 - /** 窑自动任务开启 */ + /** + * 窑自动任务开启 + */ public static final String AUTO_KILN_CALL = "auto_kiln_call"; // 是否 - /**是/正确/可用... */ + /** + * 是/正确/可用... + */ public static final String YES = "1"; - /** 否/错误/不可用... */ + /** + * 否/错误/不可用... + */ public static final String NO = "0"; // 载具类型 - /** 料盅 */ + /** + * 料盅 + */ public static final String MATERIAL_CUP = "LZ"; - /** 钢托盘 */ + /** + * 钢托盘 + */ public static final String STEEL_TRAY = "GTP"; - /** 连涂 */ + /** + * 连涂 + */ public static final String CONTINUOUS_COATING = "2"; - /** 普涂 */ + /** + * 普涂 + */ public static final String COMMON_COATING = "1"; // 账号定义 - /** acs系统 */ + /** + * acs系统 + */ public static final String ACS_ID = "2"; - /** acs系统 */ + /** + * acs系统 + */ public static final String ACS_NAME = "ACS系统"; - /** mes系统 */ + /** + * mes系统 + */ public static final String MES_ID = "3"; - /** mes系统 */ + /** + * mes系统 + */ public static final String MES_NAME = "MES系统"; // 任务生产方式 - /**自动创建**/ + /** + * 自动创建 + **/ public static final String AUTO_CREATION = "1"; - /**ACS创建**/ + /** + * ACS创建 + **/ public static final String ACS_CREATION = "2"; - /**PDA手持**/ + /** + * PDA手持 + **/ public static final String PDA_CREATION = "3"; // 请求方向 - /**ACS->LMS**/ + /** + * ACS->LMS + **/ public static final String ACS_LMS = "1"; - /**LMS->ACS**/ + /** + * LMS->ACS + **/ public static final String LMS_ACS = "2"; - /**MES->LMS**/ + /** + * MES->LMS + **/ public static final String MES_LMS = "3"; - /**LMS->MES**/ + /** + * LMS->MES + **/ public static final String LMS_MES = "4"; // 特殊: 1-缓存输送线入口,2-缓存输送线出口,3-上输送线,4-下输送线 - /** 上输送线 */ + /** + * 上输送线 + */ public static final String UPPER_CONVEYOR_LINE = "3"; - /** 下输送线 */ + /** + * 下输送线 + */ public static final String LOWER_CONVEYOR_LINE = "4"; // 参数名称 - /** 是否连接 */ + /** + * 是否连接 + */ public static final String IS_CONNECT_ACS = "is_connect_acs"; public static final String IS_CONNECT_CONNECTOR = "is_connect_connector"; /** @@ -75,33 +126,61 @@ public class GeneralDefinition { * 手持登录时间 */ public static final String HANDHELD_LOGIN_TIME = "handheld_login_time"; - /** ACS路径 */ + /** + * ACS路径 + */ public static final String ACS_URL = "acs_url"; /** * CONNECTOR路径 */ public static final String CONNECTOR_URL = "connector_url"; public static final String SORTING_URL = "sorting_url"; - /** 是否连接 */ + /** + * 是否连接 + */ public static final String IS_CONNECT_MES = "is_connect_mes"; - /** MES路径 */ + /** + * MES路径 + */ public static final String MES_URL = "mes_url"; // 完成/取消 - /** 任务完成 */ + /** + * 任务完成 + */ public static final String TASK_FINISH = "任务完成"; - /** 任务取消 */ + /** + * 任务取消 + */ public static final String TASK_CANCEL = "任务取消"; // 固化方案 - /** 不混料 */ + /** + * 不混料 + */ public static final String NOT_MIXING = "1"; - /** 可混料 */ + /** + * 可混料 + */ public static final String CAN_MIXING = "2"; - /** 自定义混料 */ + /** + * 自定义混料 + */ public static final String CUSTOM_MIXING = "3"; // 出入口 - /**入口**/ + /** + * 入口 + **/ public static final String ENTRANCE = "4"; - /**出口**/ + /** + * 出口 + **/ public static final String EXIT = "3"; + /** + * 物料图片路径 + */ + public static final String MATERIAL_URL = "material_url"; + + public static final Map> CYZZD01 = MapOf.of("CYZZD01", ListUtil.of("CYXLDJW01", "CYXLDJW02")); + public static final Map> CYZZD02 = MapOf.of("CYZZD02", ListUtil.of("CYXLDJW03", "CYXLDJW04")); + } diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/connector/CNTTask.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/connector/CNTTask.java index 2425bcc..462fe83 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/connector/CNTTask.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/connector/CNTTask.java @@ -66,7 +66,6 @@ public class CNTTask extends AbstractTask { }; tasks = tasks.stream().sorted(numericSuffixComparator).collect(Collectors.toList()); for (SchBaseTask task : tasks) { - TaskUtils.setUpdateByAcs(task); // 找起点 SchBasePoint schBasePoint = null; if (TaskType.CARRY_TASK.getValue().equals(task.getTask_type())) { @@ -88,7 +87,25 @@ public class CNTTask extends AbstractTask { task.setTask_status(TaskStatus.CREATED.getCode()); if (task.getPoint_code1().endsWith("1") || task.getPoint_code1().endsWith("3")) { task.setAcs_trace_id("4"); + } else { + if(task.getPoint_code1().endsWith("2")){ + String replace = task.getPoint_code1().replace("2", "1"); + SchBaseTask schBaseTask = taskService.getOne(Wrappers.lambdaQuery(SchBaseTask.class) + .eq(SchBaseTask::getPoint_code1, replace) + .le(SchBaseTask::getTask_status,TaskStatus.EXECUTING.getCode())); + if(ObjectUtil.isNotEmpty(schBaseTask)){ + task.setTask_status(TaskStatus.TIMEOUT.getCode()); + } + } else if(task.getPoint_code1().endsWith("4")){ + String replace = task.getPoint_code1().replace("4", "3"); + SchBaseTask schBaseTask = taskService.getOne(Wrappers.lambdaQuery(SchBaseTask.class) + .eq(SchBaseTask::getPoint_code1, replace)); + if(ObjectUtil.isNotEmpty(schBaseTask)){ + task.setTask_status(TaskStatus.TIMEOUT.getCode()); + } + } } + TaskUtils.setUpdateByAcs(task); taskService.updateById(task); } } diff --git a/lms/nladmin-system/nlsso-server/src/main/resources/logback-spring.xml b/lms/nladmin-system/nlsso-server/src/main/resources/logback-spring.xml index 5ff53be..a277c31 100644 --- a/lms/nladmin-system/nlsso-server/src/main/resources/logback-spring.xml +++ b/lms/nladmin-system/nlsso-server/src/main/resources/logback-spring.xml @@ -113,7 +113,8 @@ - + + diff --git a/lms/nladmin-ui/src/views/wms/sch/group/index.vue b/lms/nladmin-ui/src/views/wms/sch/group/index.vue index a7da504..9d9114e 100644 --- a/lms/nladmin-ui/src/views/wms/sch/group/index.vue +++ b/lms/nladmin-ui/src/views/wms/sch/group/index.vue @@ -268,7 +268,7 @@ - 物料图片 + 物料图片 - + @@ -426,7 +425,6 @@ const defaultForm = { due_date: null, order_code: null, region_code: null - } export default { name: 'VehicleMaterialGroup',