Browse Source

交互接口调整

psh
psh 1 year ago
parent
commit
66af1d20d2
  1. 9
      acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/RequestMethodEnum.java
  2. 11
      acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/basedriver/standard_inspect_site/StandardInspectSiteDeviceDriver.java
  3. 1
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/AbstractTask.java
  4. 89
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/KGHJRKTask.java
  5. 2
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/MJXLTask.java
  6. 93
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/TBXBKJTask.java
  7. 17
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/XSCKTask.java

9
acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/RequestMethodEnum.java

@ -10,9 +10,12 @@ import com.alibaba.fastjson.JSONObject;
* https://blog.csdn.net/moneyshi/article/details/82978073
*/
public enum RequestMethodEnum {
apply_mjxl(1, "MJXLTask", "涂板线满架下料","1"),
feedback_task_status(2, "feedback_task_status", "反馈任务状态","1"),
apply_bpsl(3, "BPSLTask", "包片上料","1");
feedback_task_status(1, "feedback_task_status", "反馈任务状态","1"),
apply_mjxl(2, "MJXLTask", "涂板线满架下料","1"),
apply_bpsl(3, "BPSLTask", "包片上料","1"),
apply_tbxbkj(4, "TBXBKJTask", "涂板线补空架","1"),
apply_kghjrk(5, "KGHJRKTask", "空固化架入库","1");
//驱动索引

11
acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/basedriver/standard_inspect_site/StandardInspectSiteDeviceDriver.java

@ -443,9 +443,18 @@ public class StandardInspectSiteDeviceDriver extends AbstractOpcDeviceDriver imp
FeedBackTaskStatusRequest request = new FeedBackTaskStatusRequest();
request.setDevice_code(devicecode);
request.setVehicle_code(String.valueOf(barcode));
if (devicecode.startsWith("TBX")) {
if (devicecode.startsWith("TBX")&&type==5) {
//满架下料
request.setRequest_medthod_code(RequestMethodEnum.apply_mjxl.getCode());
request.setRequest_medthod_name(RequestMethodEnum.apply_mjxl.getName());
}else if (devicecode.startsWith("TBX")&&type==6) {
//补空架
request.setRequest_medthod_code(RequestMethodEnum.apply_tbxbkj.getCode());
request.setRequest_medthod_name(RequestMethodEnum.apply_tbxbkj.getName());
}else if (type==7) {
//空托盘出库,包片机和销售出库空位都可以
request.setRequest_medthod_code(RequestMethodEnum.apply_kghjrk.getCode());
request.setRequest_medthod_name(RequestMethodEnum.apply_kghjrk.getName());
}else if(devicecode.startsWith("BP")){
request.setRequest_medthod_code(RequestMethodEnum.apply_bpsl.getCode());
request.setRequest_medthod_name(RequestMethodEnum.apply_bpsl.getName());

1
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/AbstractTask.java

@ -195,7 +195,6 @@ public abstract class AbstractTask {
}
MdBaseMaterial mdBaseMaterial=materialService.getOne(new LambdaQueryWrapper<MdBaseMaterial>()
.eq(MdBaseMaterial::getMaterial_id,workorder.getMaterial_id()));
param.put("material_type",mdBaseMaterial.getMaterial_code());
param.put("workorder_code", workorder.getWorkorder_code()); // 静置时间
// 设置任务数据
task.setVehicle_type(workorder.getVehicle_type());

89
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/KGHJRKTask.java

@ -66,17 +66,104 @@ public class KGHJRKTask extends AbstractTask {
@Override
// @Transactional(rollbackFor = Exception.class)
protected void create() throws BadRequestException {
// 获取任务
List<SchBaseTask> tasks = taskService.findTasksByTaskStatus(TASK_CONFIG_CODE, TaskStatus.APPLY);
}
for (SchBaseTask task : tasks) {
// 找终点
SchBasePoint startPoint = pointService.getOne(new LambdaQueryWrapper<SchBasePoint>()
.eq(SchBasePoint::getPoint_code, task.getPoint_code1()));
SchBasePoint point = findNextPoint(startPoint);
if (ObjectUtil.isEmpty(point)) {
task.setRemark("未找到所需点位!");
taskService.update(task);
// 消息通知
log.info("空固化架入库未找到当前符合条件的点位");
continue;
}
// 设置终点并修改创建成功状态
task.setPoint_code2(point.getPoint_code());
task.setTask_status(TaskStatus.CREATED.getCode());
task.setRemark("");
taskService.update(task);
//发起任务时先把点位占用,防止发起重复任务
point.setIng_task_code(task.getTask_code());
pointService.update(point);
//下发
this.renotifyAcs(task);
}
}
/**
* 判断目标点位
* 1.A区的去A区缓存点,B区的去B区
* 2.倒叙查找找到满足当前位置数量不足3的即可
*/
private SchBasePoint findNextPoint(SchBasePoint startPoint) {
String regionCode = null;
if (startPoint.getRegion_code().endsWith("1")) {
//1找A区
regionCode = "KGHJ1";
} else if (startPoint.getRegion_code().endsWith("2")) {
//2找B区
regionCode = "KGHJ2";
}
List<SchBasePoint> schBasePointList = pointMapper.findPointByRegion(regionCode,null);
for(int i=schBasePointList.size()-1;i>=0;i--) {
SchBasePoint schBasePoint = schBasePointList.get(i);
if(schBasePoint.getVehicle_qty()<3&&
ObjectUtil.isEmpty(schBasePoint.getIng_task_code())){
log.info("空固化架放货找到当前符合条件的点位{}",schBasePoint.getPoint_code());
return schBasePoint;
}
}
return null;
}
@Override
// @Transactional(rollbackFor = Exception.class)
protected void updateStatus(String task_code, TaskStatus status) {
// 校验任务
SchBaseTask taskObj = taskService.getById(task_code);
if (taskObj.getTask_status().equals(TaskStatus.FINISHED.getCode())) {
throw new BadRequestException("该任务已完成!");
}
if (taskObj.getTask_status().equals(TaskStatus.CANCELED.getCode())) {
throw new BadRequestException("该任务已取消!");
}
String startPoint = taskObj.getPoint_code1(); // 获取起点
String endPoint = taskObj.getPoint_code2(); // 获取终点
SchBasePoint startPointObj = pointService.getById(startPoint);
SchBasePoint endPointObj = pointService.getById(endPoint);
// 根据传来的类型去对任务进行操作
if (status.equals(TaskStatus.EXECUTING)) { // 执行中
taskObj.setTask_status(TaskStatus.EXECUTING.getCode());
taskObj.setRemark("执行中");
}
if (status.equals(TaskStatus.FINISHED)) { // 完成
// 终点解锁,库存增加
startPointObj.setIng_task_code("");
startPointObj.setVehicle_qty(startPointObj.getVehicle_qty()+1);
pointService.update(endPointObj);
// 任务完成
taskObj.setTask_status(TaskStatus.FINISHED.getCode());
taskObj.setRemark("任务完成");
}
if (status.equals(TaskStatus.CANCELED)) { // 取消
// 终点解锁
if (ObjectUtil.isNotEmpty(endPointObj)) {
endPointObj.setIng_task_code("");
pointService.update(endPointObj);
}
taskObj.setRemark("任务取消");
taskObj.setTask_status(TaskStatus.CANCELED.getCode());
}
taskService.update(taskObj);
}
@Override

2
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/MJXLTask.java

@ -130,7 +130,7 @@ public class MJXLTask extends AbstractTask {
materialType.equals(schBasePoint.getVehicle_type()))
&& "2".equals(schBasePoint.getPoint_status())
&& schBasePoint.getVehicle_qty() < 3) {
log.info("找到当前符合条件的点位{}",schBasePoint.getPoint_code());
log.info("满架下料找到当前符合条件的点位{}",schBasePoint.getPoint_code());
return schBasePoint;
}
}

93
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/TBXBKJTask.java

@ -63,20 +63,113 @@ public class TBXBKJTask extends AbstractTask {
@Autowired
private WmsToAcsService wmsToAcsService;
/**
* 涂版线工位发起叫料请求
* 从对应AB区的空固化架缓存位生成搬运任务
* 不记录组盘不考虑点位状态
*/
@Override
// @Transactional(rollbackFor = Exception.class)
protected void create() throws BadRequestException {
// 获取任务
List<SchBaseTask> tasks = taskService.findTasksByTaskStatus(TASK_CONFIG_CODE, TaskStatus.APPLY);
// 配置信息
SchBaseTaskconfig taskConfig = taskConfigService.getOne(new LambdaQueryWrapper<SchBaseTaskconfig>()
.eq(SchBaseTaskconfig::getConfig_code, TASK_CONFIG_CODE));
for (SchBaseTask task : tasks) {
// 找起点
SchBasePoint startPoint = pointService.getOne(new LambdaQueryWrapper<SchBasePoint>()
.eq(SchBasePoint::getPoint_code, task.getPoint_code1()));
SchBasePoint point = findNextPoint(startPoint);
if (ObjectUtil.isEmpty(point)) {
task.setRemark("未找到所需点位!");
taskService.update(task);
// 消息通知
log.info("涂板线补空架未找到空架缓存点存在空架!");
continue;
}
// 设置终点并修改创建成功状态
task.setPoint_code2(point.getPoint_code());
task.setTask_status(TaskStatus.CREATED.getCode());
task.setRemark("");
taskService.update(task);
//发起任务时先把点位占用,防止发起重复任务
point.setIng_task_code(task.getTask_code());
//空固化架区别于组盘,任务完成后再扣除库存
// point.setVehicle_qty(point.getVehicle_qty() - 1);
pointService.update(point);
//下发
this.renotifyAcs(task);
}
}
/**
* 从01到10顺序判断最先有货的工位
*/
private SchBasePoint findNextPoint(SchBasePoint startPoint) {
String regionCode = null;
if ("TBX1".equals(startPoint.getRegion_code())) {
//KGHJ1找A区
regionCode = "KGHJ1";
} else if ("TBX2".equals(startPoint.getRegion_code())) {
//KGHJ2找B区
regionCode = "KGHJ2";
}
List<SchBasePoint> schBasePointList = pointMapper.findPointByRegion(regionCode,null);
for (SchBasePoint schBasePoint : schBasePointList) {
if (schBasePoint.getVehicle_qty() > 0) {
log.info("涂板线补空架找到当前符合条件的点位{}",schBasePoint.getPoint_code());
return schBasePoint;
}
}
return null;
}
@Override
// @Transactional(rollbackFor = Exception.class)
protected void updateStatus(String task_code, TaskStatus status) {
// 校验任务
SchBaseTask taskObj = taskService.getById(task_code);
if (taskObj.getTask_status().equals(TaskStatus.FINISHED.getCode())) {
throw new BadRequestException("该任务已完成!");
}
if (taskObj.getTask_status().equals(TaskStatus.CANCELED.getCode())) {
throw new BadRequestException("该任务已取消!");
}
String startPoint = taskObj.getPoint_code1(); // 获取起点
String endPoint = taskObj.getPoint_code2(); // 获取终点
SchBasePoint startPointObj = pointService.getById(startPoint);
SchBasePoint endPointObj = pointService.getById(endPoint);
// 根据传来的类型去对任务进行操作
if (status.equals(TaskStatus.EXECUTING)) { // 执行中
taskObj.setTask_status(TaskStatus.EXECUTING.getCode());
taskObj.setRemark("执行中");
}
if (status.equals(TaskStatus.FINISHED)) { // 完成
// 起点解锁,库存减少
startPointObj.setIng_task_code("");
startPointObj.setVehicle_qty(startPointObj.getVehicle_qty()-1);
pointService.update(endPointObj);
// 任务完成
taskObj.setTask_status(TaskStatus.FINISHED.getCode());
taskObj.setRemark("任务完成");
}
if (status.equals(TaskStatus.CANCELED)) { // 取消
// 终点解锁
if (ObjectUtil.isNotEmpty(endPointObj)) {
endPointObj.setIng_task_code("");
pointService.update(endPointObj);
}
taskObj.setRemark("任务取消");
taskObj.setTask_status(TaskStatus.CANCELED.getCode());
}
taskService.update(taskObj);
}
@Override

17
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/XSCKTask.java

@ -73,10 +73,13 @@ public class XSCKTask extends AbstractTask {
SchBaseTaskconfig taskConfig = taskConfigService.getOne(new LambdaQueryWrapper<SchBaseTaskconfig>()
.eq(SchBaseTaskconfig::getConfig_code, TASK_CONFIG_CODE));
for (SchBaseTask task : tasks) {
// 找起点
SchBasePoint nextPoint = pointService.getOne(new LambdaQueryWrapper<SchBasePoint>()
.eq(SchBasePoint::getPoint_code, task.getPoint_code2()));
String extGroupData = task.getExt_group_data();
JSONObject jsonObject = JSONObject.parseObject(extGroupData);
String materialType = jsonObject.getString("material_type");
SchBasePoint point = findNextPoint(jsonObject);
SchBasePoint point = findNextPoint(nextPoint,jsonObject);
if (ObjectUtil.isEmpty(point)) {
task.setRemark("未找到所需点位!");
taskService.update(task);
@ -109,9 +112,17 @@ public class XSCKTask extends AbstractTask {
* @param extGroupData
* @return
*/
private SchBasePoint findNextPoint(JSONObject extGroupData) {
String regionCode = "HCQ1";
private SchBasePoint findNextPoint(SchBasePoint nextPoint,JSONObject extGroupData) {
String regionCode = null;
String materialType = extGroupData.getString("material_type");
if ("XSQ1".equals(nextPoint.getRegion_code())) {
//XSQ1找A区
regionCode = "HCQ1";
} else if ("XSQ2".equals(nextPoint.getRegion_code())) {
//XSQ2找B区
regionCode = "HCQ2";
}
List<SchBasePoint> schBasePointList = pointMapper.findPointByRegion(regionCode,"2");
for(int i=schBasePointList.size()-1;i>=0;i--){
SchBasePoint schBasePoint=schBasePointList.get(i);

Loading…
Cancel
Save