opt:输送线逻辑优化
This commit is contained in:
@@ -190,6 +190,11 @@ public class Device implements Serializable {
|
|||||||
*/
|
*/
|
||||||
private String zh_device_name;
|
private String zh_device_name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 出库任务数量
|
||||||
|
*/
|
||||||
|
private Integer outbound_task_num;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 设备英文名称
|
* 设备英文名称
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -17,7 +17,6 @@ import org.nl.acs.device_driver.DeviceDriver;
|
|||||||
import org.nl.acs.device_driver.FeedLmsRealFailed;
|
import org.nl.acs.device_driver.FeedLmsRealFailed;
|
||||||
import org.nl.acs.device_driver.agv.utils.TwoAgvPhase;
|
import org.nl.acs.device_driver.agv.utils.TwoAgvPhase;
|
||||||
import org.nl.acs.device_driver.conveyor.belt_conveyor.BeltConveyorDeviceDriver;
|
import org.nl.acs.device_driver.conveyor.belt_conveyor.BeltConveyorDeviceDriver;
|
||||||
import org.nl.acs.device_driver.conveyor.standard_inspect_site.StandardInspectSiteDeviceDriver;
|
|
||||||
import org.nl.acs.device_driver.conveyor.standard_ordinary_site.StandardOrdinarySiteDeviceDriver;
|
import org.nl.acs.device_driver.conveyor.standard_ordinary_site.StandardOrdinarySiteDeviceDriver;
|
||||||
import org.nl.acs.device_driver.driver.AbstractDeviceDriver;
|
import org.nl.acs.device_driver.driver.AbstractDeviceDriver;
|
||||||
import org.nl.acs.ext.wms.service.AcsToWmsService;
|
import org.nl.acs.ext.wms.service.AcsToWmsService;
|
||||||
@@ -481,7 +480,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
|
|||||||
map1.put("value", "2");
|
map1.put("value", "2");
|
||||||
Map map2 = new HashMap();
|
Map map2 = new HashMap();
|
||||||
map2.put("code", "to_target");//目标楼层从wms下发的参数字段取
|
map2.put("code", "to_target");//目标楼层从wms下发的参数字段取
|
||||||
map2.put("value", "3");
|
map2.put("value", task.getFloor_code());
|
||||||
list.add(map2);
|
list.add(map2);
|
||||||
Map map3 = new HashMap();
|
Map map3 = new HashMap();
|
||||||
map3.put("code", "to_task");
|
map3.put("code", "to_task");
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import cn.hutool.core.util.ObjectUtil;
|
|||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import cn.hutool.http.HttpResponse;
|
import cn.hutool.http.HttpResponse;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
@@ -33,12 +34,14 @@ import org.nl.acs.rfid_manage.service.IbmVehicleRfidService;
|
|||||||
import org.nl.acs.rfid_manage.service.dao.BmVehicleRfid;
|
import org.nl.acs.rfid_manage.service.dao.BmVehicleRfid;
|
||||||
import org.nl.acs.route.service.RouteLineService;
|
import org.nl.acs.route.service.RouteLineService;
|
||||||
import org.nl.acs.task.service.TaskService;
|
import org.nl.acs.task.service.TaskService;
|
||||||
|
import org.nl.acs.task.service.dto.TaskDto;
|
||||||
import org.nl.acs.utils.DeviceErrorUtil;
|
import org.nl.acs.utils.DeviceErrorUtil;
|
||||||
import org.nl.config.SpringContextHolder;
|
import org.nl.config.SpringContextHolder;
|
||||||
import org.nl.config.language.LangProcess;
|
import org.nl.config.language.LangProcess;
|
||||||
import org.nl.config.lucene.service.LuceneExecuteLogService;
|
import org.nl.config.lucene.service.LuceneExecuteLogService;
|
||||||
import org.nl.config.lucene.service.dto.LuceneLogDto;
|
import org.nl.config.lucene.service.dto.LuceneLogDto;
|
||||||
import org.nl.system.service.param.ISysParamService;
|
import org.nl.system.service.param.ISysParamService;
|
||||||
|
import org.nl.system.service.user.dao.SysUser;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|
||||||
import java.io.PrintWriter;
|
import java.io.PrintWriter;
|
||||||
@@ -108,7 +111,7 @@ public class BeltConveyorDeviceDriver extends AbstractOpcDeviceDriver implements
|
|||||||
int move = 0;
|
int move = 0;
|
||||||
int last_move = 0;
|
int last_move = 0;
|
||||||
/**
|
/**
|
||||||
* 托盘方向
|
* 动作请求
|
||||||
*/
|
*/
|
||||||
int actionRequest = 0;
|
int actionRequest = 0;
|
||||||
int last_actionRequest = 0;
|
int last_actionRequest = 0;
|
||||||
@@ -318,8 +321,41 @@ public class BeltConveyorDeviceDriver extends AbstractOpcDeviceDriver implements
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 6:
|
case 6:
|
||||||
//更新出库任务数
|
// 更新出库任务数
|
||||||
|
if (move == 1 && !requireSucess) {
|
||||||
|
synchronized(this) { // 添加同步锁
|
||||||
|
if (!requireSucess) { // 双重检查锁定
|
||||||
|
try {
|
||||||
|
// 1. 查询设备
|
||||||
|
Device device = deviceAppService.findDeviceByCode(device_code);
|
||||||
|
|
||||||
|
// 2. 更新任务数
|
||||||
|
device.setOutbound_task_num(device.getOutbound_task_num() - 1);
|
||||||
|
|
||||||
|
// 3. 保存更新(假设需要显式保存)
|
||||||
|
deviceservice.update(new UpdateWrapper<Device>()
|
||||||
|
.set("outbound_task_num",device.getOutbound_task_num())
|
||||||
|
.eq("device_code",device.getDevice_code()));
|
||||||
|
|
||||||
|
// 更新task的出库完成数
|
||||||
|
TaskDto taskDto = new TaskDto();
|
||||||
|
taskDto.setTask_id(instruction.getTask_id());
|
||||||
|
taskDto.setOutbound_complete_flag(true);
|
||||||
|
taskserver.updateById(taskDto);
|
||||||
|
|
||||||
|
// 5. 只有成功后才设置标记
|
||||||
|
requireSucess = true;
|
||||||
|
|
||||||
|
log.info(this.device_code + ",成功更新出库任务数");
|
||||||
|
} catch (Exception e) {
|
||||||
|
// 处理异常,不设置成功标记
|
||||||
|
log.error(this.device_code + ",更新出库任务数失败: {}", e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
log.info(this.device_code + ",运行中");
|
log.info(this.device_code + ",运行中");
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -64,6 +64,11 @@ public class CreateTaskRequest extends BaseRequest {
|
|||||||
*/
|
*/
|
||||||
String remark;
|
String remark;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 目标楼层
|
||||||
|
*/
|
||||||
|
String floor_code;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 扩展属性
|
* 扩展属性
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -112,6 +112,7 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
|||||||
String size = request.getSize();
|
String size = request.getSize();
|
||||||
String version = request.getVersion();
|
String version = request.getVersion();
|
||||||
String bushing_num = request.getBushing_num();
|
String bushing_num = request.getBushing_num();
|
||||||
|
String floor_code = request.getFloor_code();
|
||||||
String storage_task_type = request.getDtl_type();
|
String storage_task_type = request.getDtl_type();
|
||||||
String agv_system_type = request.getAgv_system_type();
|
String agv_system_type = request.getAgv_system_type();
|
||||||
String remark = request.getRemark();
|
String remark = request.getRemark();
|
||||||
@@ -332,6 +333,7 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
|||||||
jo.put("size", JSONUtil.toJsonStr(size));
|
jo.put("size", JSONUtil.toJsonStr(size));
|
||||||
jo.put("version", JSONUtil.toJsonStr(version));
|
jo.put("version", JSONUtil.toJsonStr(version));
|
||||||
jo.put("bushing_num", JSONUtil.toJsonStr(bushing_num));
|
jo.put("bushing_num", JSONUtil.toJsonStr(bushing_num));
|
||||||
|
jo.put("floor_code", JSONUtil.toJsonStr(floor_code));
|
||||||
if (!StrUtil.isEmpty(ext_task_id)) {
|
if (!StrUtil.isEmpty(ext_task_id)) {
|
||||||
jo.put("ext_task_id", ext_task_id);
|
jo.put("ext_task_id", ext_task_id);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -76,6 +76,11 @@ public class DeviceManageDto {
|
|||||||
*/
|
*/
|
||||||
private String barrels_status;
|
private String barrels_status;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 出库任务数量
|
||||||
|
*/
|
||||||
|
private Integer outbound_task_num;
|
||||||
|
|
||||||
private List<DeviceExtraManageDto> extra = new LinkedList();
|
private List<DeviceExtraManageDto> extra = new LinkedList();
|
||||||
private String perfix;
|
private String perfix;
|
||||||
private Map<String, Object> extra_map = new LinkedHashMap();
|
private Map<String, Object> extra_map = new LinkedHashMap();
|
||||||
|
|||||||
@@ -51,6 +51,11 @@ public class Task extends CommonModel<Task> implements Serializable {
|
|||||||
private String vehicle_code2;
|
private String vehicle_code2;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 出库完成标志
|
||||||
|
*/
|
||||||
|
private Boolean outbound_complete_flag;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private String vehicle_type;
|
private String vehicle_type;
|
||||||
@@ -257,6 +262,8 @@ public class Task extends CommonModel<Task> implements Serializable {
|
|||||||
*/
|
*/
|
||||||
private String class_type;
|
private String class_type;
|
||||||
|
|
||||||
|
private String floor_code;
|
||||||
|
|
||||||
public void copyFrom(Task source) {
|
public void copyFrom(Task source) {
|
||||||
BeanUtil.copyProperties(source, this, CopyOptions.create().setIgnoreNullValue(true));
|
BeanUtil.copyProperties(source, this, CopyOptions.create().setIgnoreNullValue(true));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -370,4 +370,12 @@ public class TaskDto implements Serializable {
|
|||||||
* 15 RGV输送任务
|
* 15 RGV输送任务
|
||||||
*/
|
*/
|
||||||
private String class_type;
|
private String class_type;
|
||||||
|
|
||||||
|
private String floor_code;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 出库完成标志
|
||||||
|
*/
|
||||||
|
private Boolean outbound_complete_flag;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -146,10 +146,6 @@ public class AutoCreateInst {
|
|||||||
log.info("当前输送线出入库信号不为出库");
|
log.info("当前输送线出入库信号不为出库");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
//满足出库,查询当前出库任务
|
|
||||||
// int count = instructionService.queryInstructionCount(next_device_code);
|
|
||||||
// count = count + 1;
|
|
||||||
// beltConveyorDeviceDriver.writing("to_taskNum",count+"");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -194,6 +190,19 @@ public class AutoCreateInst {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
instructionService.create(instdto);
|
instructionService.create(instdto);
|
||||||
|
|
||||||
|
beltConveyorDeviceDriver = (BeltConveyorDeviceDriver) nextdevice.getDeviceDriver();
|
||||||
|
//满足出库,查询当前出库任务,+1后返回给
|
||||||
|
if (beltConveyorDeviceDriver.getType() == 2) {
|
||||||
|
synchronized (this) {
|
||||||
|
if (beltConveyorDeviceDriver.getType() == 2) {
|
||||||
|
//因为已经创建成功,因此这个时候可以+1了
|
||||||
|
int count = instructionService.queryInstructionCount(next_device_code);
|
||||||
|
beltConveyorDeviceDriver.writing("to_taskNum", count + "");
|
||||||
|
nextdevice.setOutbound_task_num(count);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
acsTask.setRemark(e.getMessage());
|
acsTask.setRemark(e.getMessage());
|
||||||
taskserver.updateByCodeFromCache(acsTask);
|
taskserver.updateByCodeFromCache(acsTask);
|
||||||
|
|||||||
Reference in New Issue
Block a user