Browse Source

add: 下发获取木托盘信号

master
李永德 1 year ago
parent
commit
d2c3a0d9ab
  1. BIN
      lms/nladmin-system/doc/wms.xls
  2. 9
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/acs/service/WmsToAcsService.java
  3. 18
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/acs/service/impl/WmsToAcsServiceImpl.java
  4. 10
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/fj/FJMKTask.java
  5. 14
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/fj/FJQKTask.java
  6. 16
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/hn/HNMLTask.java
  7. 36
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/hn/mapper/HNMapper.xml
  8. 2
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/yz/YZSKTask.java
  9. 22
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/util/CommonUtils.java

BIN
lms/nladmin-system/doc/wms.xls

Binary file not shown.

9
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<PutActionRequest> list);
}

18
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<PutActionRequest> 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;
}
}

10
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;
}

14
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<SignalData> signalList = new ArrayList<>();
// signalList.add(signalData);
// PutActionRequest putActionRequest = (PutActionRequest) BaseRequest.createRequest();
// putActionRequest.setDevice_code(endPointObj.getDevice_code());
// putActionRequest.setList(signalList);
// AcsUtil.notifyAcs("", putActionRequest);
// List<PutActionRequest> list = new ArrayList<>();
// list.add(putActionRequest);
wmsToAcsService.getVehicleForLaminatingMachine(list);
// 这个点的父点位为起点
return ObjectUtil.isNotEmpty(endPointObj) ? endPointObj : null;
}

16
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);

36
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/hn/mapper/HNMapper.xml

@ -23,23 +23,31 @@
</select>
<select id="findPointForHNMLAndWorkOrder" resultType="org.nl.wms.sch.point.service.dao.SchBasePoint">
SELECT
p.*
p.*,
p2.point_code AS device_code
FROM
`sch_base_point` p
LEFT JOIN (
SELECT
p2.point_code
FROM
sch_base_point p2
WHERE
p2.point_code IN (
SELECT w.point_code FROM pdm_bd_workorder w
WHERE w.raw_material_code = #{materialCode} AND w.workorder_status = '3'
)
AND p2.point_status = '1'
ORDER BY p2.update_time LIMIT 1
) p2 ON p.parent_point_code LIKE CONCAT('%', p2.point_code, '%')
WHERE
p.point_type = '5'
AND p.point_status = '1'
AND (p.ing_task_code = '' OR p.ing_task_code IS NULL)
AND p.parent_point_code LIKE CONCAT('%',
(SELECT p2.point_code FROM sch_base_point p2
WHERE p2.point_code IN (
SELECT w.point_code FROM pdm_bd_workorder w WHERE w.raw_material_code = #{materialCode} AND w.workorder_status = '3'
)
AND p2.point_status = '1'
ORDER BY p2.update_time LIMIT 1), '%')
AND p.region_code IN
<foreach collection="regionCode" item="code" separator="," open="(" close=")">
#{code}
</foreach>
AND p.point_status = '1'
AND (p.ing_task_code = '' OR p.ing_task_code IS NULL)
AND p.region_code IN
<foreach collection="regionCode" item="code" separator="," open="(" close=")">
#{code}
</foreach>
AND p2.point_code IS NOT NULL
</select>
</mapper>

2
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

22
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<PutActionRequest> requestAcsReleaseVehicle(HashMap<String, String> map, String deviceCode) {
List<PutActionRequest> list = new CopyOnWriteArrayList<>();
PutActionRequest putActionRequest = (PutActionRequest) BaseRequest.createRequest();
putActionRequest.setDevice_code(deviceCode);
List<SignalData> signalList = new CopyOnWriteArrayList<>();
for (Map.Entry<String, String> entry : map.entrySet()) {
SignalData signalData = SignalData.buildSignalData(entry.getKey(), entry.getValue());
signalList.add(signalData);
}
putActionRequest.setList(signalList);
list.add(putActionRequest);
return list;
}
}

Loading…
Cancel
Save