diff --git a/lms/nladmin-system/doc/wms.xls b/lms/nladmin-system/doc/wms.xls index 9f3fd9e..a27399d 100644 Binary files a/lms/nladmin-system/doc/wms.xls and b/lms/nladmin-system/doc/wms.xls differ diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/acs/service/WmsToAcsService.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/acs/service/WmsToAcsService.java index a62cec5..29a2b3a 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/acs/service/WmsToAcsService.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/acs/service/WmsToAcsService.java @@ -2,8 +2,10 @@ package org.nl.wms.ext.acs.service; import com.alibaba.fastjson.JSONArray; import org.nl.wms.ext.acs.service.dto.ResultForAcs; +import org.nl.wms.ext.acs.service.dto.to.acs.PutActionRequest; import org.nl.wms.pdm.workorder.service.dao.PdmBdWorkorder; +import java.util.List; import java.util.Map; /** @@ -19,4 +21,11 @@ public interface WmsToAcsService { * @return */ ResultForAcs order(PdmBdWorkorder workorder); + + /** + * 下发信号 - 覆膜机释放托盘 + * @param list + * @return + */ + ResultForAcs getVehicleForLaminatingMachine(List list); } diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/acs/service/impl/WmsToAcsServiceImpl.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/acs/service/impl/WmsToAcsServiceImpl.java index 75d467f..0db6851 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/acs/service/impl/WmsToAcsServiceImpl.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/acs/service/impl/WmsToAcsServiceImpl.java @@ -5,6 +5,7 @@ import cn.hutool.http.HttpStatus; import lombok.extern.slf4j.Slf4j; import org.nl.wms.ext.acs.service.WmsToAcsService; import org.nl.wms.ext.acs.service.dto.ResultForAcs; +import org.nl.wms.ext.acs.service.dto.to.acs.PutActionRequest; import org.nl.wms.ext.record.service.ISysInteractRecordService; import org.nl.wms.pdm.workorder.service.dao.PdmBdWorkorder; import org.nl.wms.sch.task_manage.GeneralDefinition; @@ -43,4 +44,21 @@ public class WmsToAcsServiceImpl implements WmsToAcsService { interactRecordService.saveRecord(workorder, resultForAcs, GeneralDefinition.LMS_ACS); return resultForAcs; } + + @Override + public ResultForAcs getVehicleForLaminatingMachine(List list) { + String api = "api/wms/order"; // todo: ??? + ResultForAcs resultForAcs = ResultForAcs.requestOk(); + try { + resultForAcs = AcsUtil.notifyAcs(api, list); + } catch (Exception e) { + log.error(api + ": {}", e.getMessage()); + resultForAcs.setTimestamp(DateUtil.now()); + resultForAcs.setStatus(HttpStatus.HTTP_BAD_REQUEST); + resultForAcs.setMessage(e.getMessage()); + } + // 记录日志 +// interactRecordService.saveRecord(workorder, resultForAcs, GeneralDefinition.LMS_ACS); + return resultForAcs; + } } diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/fj/FJMKTask.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/fj/FJMKTask.java index f8d2c09..42c22ce 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/fj/FJMKTask.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/fj/FJMKTask.java @@ -7,7 +7,9 @@ import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import org.nl.common.exception.BadRequestException; import org.nl.common.utils.CodeUtil; +import org.nl.config.MapOf; import org.nl.system.service.notice.ISysNoticeService; +import org.nl.wms.ext.acs.service.WmsToAcsService; import org.nl.wms.pdm.workorder.service.IPdmBdWorkorderService; import org.nl.wms.pdm.workorder.service.dao.PdmBdWorkorder; import org.nl.wms.sch.group.service.ISchBaseVehiclematerialgroupService; @@ -24,6 +26,7 @@ import org.nl.wms.sch.task_manage.enums.*; import org.nl.wms.sch.task_manage.task.TaskType; import org.nl.wms.sch.task_manage.task.core.TaskStatus; import org.nl.wms.sch.task_manage.task.tasks.fj.mapper.FJMapper; +import org.nl.wms.util.CommonUtils; import org.nl.wms.util.PointUtils; import org.nl.wms.util.TaskUtils; import org.springframework.beans.factory.annotation.Autowired; @@ -57,6 +60,8 @@ public class FJMKTask extends AbstractTask { private FJMapper fjMapper; @Autowired private ISchBaseVehiclematerialgroupService vehiclematerialgroupService; + @Autowired + private WmsToAcsService wmsToAcsService; @Override protected void create() throws BadRequestException { // 获取任务 @@ -205,7 +210,10 @@ public class FJMKTask extends AbstractTask { // 向ACS请求所需木托盘在那个栈拆盘机?已经实时更新,故只需要自己查询即可 SchBasePoint endPointObj = fjMapper.findPointForFJQK(startRegionStr, new JSONObject() .fluentPut("vehicleType", vehicleType).fluentPut("pointType", GeneralDefinition.DEVICE_POINT)); - // todo: 请求ACS释放一个木托盘 + // 请求ACS释放一个木托盘 + List list = CommonUtils.requestAcsReleaseVehicle(MapOf.of("to_command", "1"), + endPointObj.getDevice_code()); + wmsToAcsService.getVehicleForLaminatingMachine(list); // 这个点的父点位为起点 return ObjectUtil.isNotEmpty(endPointObj) ? endPointObj : null; } diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/fj/FJQKTask.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/fj/FJQKTask.java index 1df8f2d..6aa55c4 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/fj/FJQKTask.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/fj/FJQKTask.java @@ -5,7 +5,9 @@ import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import org.nl.common.exception.BadRequestException; import org.nl.common.utils.CodeUtil; +import org.nl.config.MapOf; import org.nl.system.service.notice.ISysNoticeService; +import org.nl.wms.ext.acs.service.WmsToAcsService; import org.nl.wms.ext.acs.service.dto.SignalData; import org.nl.wms.ext.acs.service.dto.to.BaseRequest; import org.nl.wms.ext.acs.service.dto.to.acs.PutActionRequest; @@ -26,6 +28,7 @@ import org.nl.wms.sch.task_manage.task.AcsUtil; import org.nl.wms.sch.task_manage.task.TaskType; import org.nl.wms.sch.task_manage.task.core.TaskStatus; import org.nl.wms.sch.task_manage.task.tasks.fj.mapper.FJMapper; +import org.nl.wms.util.CommonUtils; import org.nl.wms.util.PointUtils; import org.nl.wms.util.TaskUtils; import org.springframework.beans.factory.annotation.Autowired; @@ -53,10 +56,11 @@ public class FJQKTask extends AbstractTask { private ISchBaseTaskconfigService taskConfigService; @Autowired private IPdmBdWorkorderService workorderService; - @Autowired private ISysNoticeService noticeService; @Autowired + private WmsToAcsService wmsToAcsService; + @Autowired private FJMapper fjMapper; @Override protected void create() throws BadRequestException { @@ -124,14 +128,18 @@ public class FJQKTask extends AbstractTask { // 向ACS请求所需木托盘在那个栈拆盘机?已经实时更新,故只需要自己查询即可 SchBasePoint endPointObj = fjMapper.findPointForFJQK(startRegionStr, new JSONObject() .fluentPut("vehicleType", vehicleType).fluentPut("pointType", GeneralDefinition.DEVICE_POINT)); - // todo: 请求ACS释放一个木托盘 + // 请求ACS释放一个木托盘 + List list = CommonUtils.requestAcsReleaseVehicle(MapOf.of("to_command", "1"), + endPointObj.getDevice_code()); // SignalData signalData = SignalData.buildSignalData("to_command", "1"); // List signalList = new ArrayList<>(); // signalList.add(signalData); // PutActionRequest putActionRequest = (PutActionRequest) BaseRequest.createRequest(); // putActionRequest.setDevice_code(endPointObj.getDevice_code()); // putActionRequest.setList(signalList); -// AcsUtil.notifyAcs("", putActionRequest); +// List list = new ArrayList<>(); +// list.add(putActionRequest); + wmsToAcsService.getVehicleForLaminatingMachine(list); // 这个点的父点位为起点 return ObjectUtil.isNotEmpty(endPointObj) ? endPointObj : null; } diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/hn/HNMLTask.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/hn/HNMLTask.java index d76e795..52aa2f7 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/hn/HNMLTask.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/hn/HNMLTask.java @@ -124,7 +124,7 @@ public class HNMLTask extends AbstractTask { task.setRemark(""); task.setVehicle_type(GeneralDefinition.MATERIAL_CUP); // 告知acs去左边右边 - String deviceCode = point.getParent_point_code(); + String deviceCode = point.getDevice_code(); // 获取设备编码 int number = Integer.parseInt(deviceCode.replaceAll("[^0-9]", "")); // 1左边2右边 number = (number % 2) == 0 ? 2 : (number % 2); @@ -136,7 +136,7 @@ public class HNMLTask extends AbstractTask { pointService.updateById(point); //下发 -// this.renotifyAcs(task); + this.renotifyAcs(task); } } @@ -234,11 +234,11 @@ public class HNMLTask extends AbstractTask { } } // 更新组盘数据 - groupEntity.setGroup_bind_material_status(GroupBindMaterialStatusEnum.BOUND.getValue()); + groupEntity.setGroup_bind_material_status(GroupBindMaterialStatusEnum.UNBOUND.getValue()); TaskUtils.setGroupUpdateByType(groupEntity, taskFinishedType); vehiclematerialgroupService.updateById(groupEntity); - // 起点清空 - PointUtils.clearPoint(startPointObj); + // 起点清空 - 由ACS请求修改 +// PointUtils.clearPoint(startPointObj); taskObj.setRemark("任务完成"); taskObj.setTask_status(TaskStatus.FINISHED.getCode()); taskObj.setFinished_type(taskFinishedType.getCode()); @@ -273,7 +273,7 @@ public class HNMLTask extends AbstractTask { String vehicleType = param.getString("vehicle_type"); // 泥料物料对应不出物料标识 String materialCode = param.getString("material_code"); // 泥料编码 - String mixTimes = param.getString("mix_times"); // 碾次 + String mixTimes = param.getString("grinding_number"); // 碾次 // 载具类型默认料盅 if (vehicleType == null) { vehicleType = GeneralDefinition.MATERIAL_CUP; @@ -288,7 +288,7 @@ public class HNMLTask extends AbstractTask { } // 找到相同组盘信息就直接返回id,避免任务取消组盘信息还存在,重复插入 SchBaseVehiclematerialgroup groupObject = vehiclematerialgroupService.getGroupInfo(vehicleCode, vehicleType, - GroupBindMaterialStatusEnum.WAIT_BIND.getValue()); + GroupBindMaterialStatusEnum.BOUND.getValue()); if (groupObject != null) { return groupObject.getGroup_id(); } @@ -311,7 +311,7 @@ public class HNMLTask extends AbstractTask { groupEntity.setMaterial_weight(ObjectUtil.isNotEmpty(weight)// 重量 ? weight : BigDecimal.valueOf(0)); - groupEntity.setGroup_bind_material_status(GroupBindMaterialStatusEnum.WAIT_BIND.getValue()); // 待绑定 + groupEntity.setGroup_bind_material_status(GroupBindMaterialStatusEnum.BOUND.getValue()); // 待绑定 groupEntity.setGroup_status(GroupStatusEnum.IN_STORAGE.getType()); // 暂时不维护。 groupEntity.setIs_delete(false); vehiclematerialgroupService.save(groupEntity); diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/hn/mapper/HNMapper.xml b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/hn/mapper/HNMapper.xml index 374e787..04536bf 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/hn/mapper/HNMapper.xml +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/hn/mapper/HNMapper.xml @@ -23,23 +23,31 @@ diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/yz/YZSKTask.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/yz/YZSKTask.java index a789a25..c75fdf9 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/yz/YZSKTask.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/yz/YZSKTask.java @@ -33,7 +33,7 @@ import java.util.stream.Collectors; /** * @Author: lyd - * @Description: 压制送空载具任务 x + * @Description: 压制送空盅任务 * @Date: 2023/5/25 */ @Component diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/util/CommonUtils.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/util/CommonUtils.java index 2939914..3eaadb8 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/util/CommonUtils.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/util/CommonUtils.java @@ -2,10 +2,18 @@ package org.nl.wms.util; import com.alibaba.fastjson.JSONObject; import org.nl.wms.ext.acs.service.dto.PalletizeDto; +import org.nl.wms.ext.acs.service.dto.SignalData; +import org.nl.wms.ext.acs.service.dto.to.BaseRequest; +import org.nl.wms.ext.acs.service.dto.to.acs.PutActionRequest; import java.time.Duration; import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.concurrent.CopyOnWriteArrayList; /** * @Author: lyd @@ -33,4 +41,18 @@ public class CommonUtils { return jsonObject.toJavaObject(clazz); } + // 请求ACS释放一个木托盘 + public static List requestAcsReleaseVehicle(HashMap map, String deviceCode) { + List list = new CopyOnWriteArrayList<>(); + PutActionRequest putActionRequest = (PutActionRequest) BaseRequest.createRequest(); + putActionRequest.setDevice_code(deviceCode); + List signalList = new CopyOnWriteArrayList<>(); + for (Map.Entry entry : map.entrySet()) { + SignalData signalData = SignalData.buildSignalData(entry.getKey(), entry.getValue()); + signalList.add(signalData); + } + putActionRequest.setList(signalList); + list.add(putActionRequest); + return list; + } }