add 新增驱动
This commit is contained in:
@@ -1,7 +1,11 @@
|
||||
package org.nl.acs.device_driver;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import org.nl.acs.opc.Device;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public interface DeviceDriver {
|
||||
default String getDeviceCode() {
|
||||
return this.getDevice().getDevice_code();
|
||||
@@ -17,4 +21,20 @@ public interface DeviceDriver {
|
||||
return this.getDriverDefination().getDriverCode();
|
||||
}
|
||||
|
||||
//将扩展表中的字符串数组数据转换成集合
|
||||
default List<String> getExtraDeviceCodes(String extraName) {
|
||||
String extraValue = (String) this.getDevice().getExtraValue().get(extraName);
|
||||
if (StrUtil.isEmpty(extraValue)) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
String devicesString = extraValue.substring(1, extraValue.length() - 1);
|
||||
List<String> devicesList = new ArrayList<>();
|
||||
String[] devices = devicesString.split(",");
|
||||
for (int i = 0; i < devices.length; i++) {
|
||||
String s = devices[i].replace("\"", "").replace("\"", "");
|
||||
devicesList.add(s);
|
||||
}
|
||||
return devicesList;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.http.HttpResponse;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
@@ -80,10 +81,10 @@ public class LnshMixingMillDeviceDriver extends AbstractOpcDeviceDriver implemen
|
||||
private Date instruction_require_time = new Date();
|
||||
private Date instruction_finished_time = new Date();
|
||||
|
||||
private int instruction_require_time_out;
|
||||
private int instruction_require_time_out = 3000;
|
||||
boolean requireSucess = false;
|
||||
|
||||
private int instruction_finished_time_out;
|
||||
private int instruction_finished_time_out = 3000;
|
||||
|
||||
int branchProtocol = 0;
|
||||
|
||||
@@ -149,6 +150,8 @@ public class LnshMixingMillDeviceDriver extends AbstractOpcDeviceDriver implemen
|
||||
|
||||
|
||||
} catch (Exception var17) {
|
||||
log.info(var17.getMessage());
|
||||
message = "错误:" + var17.getMessage();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -390,74 +393,45 @@ public class LnshMixingMillDeviceDriver extends AbstractOpcDeviceDriver implemen
|
||||
|
||||
public synchronized boolean order_verify() {
|
||||
if (!"0".equals(order_No) && StrUtil.isNotBlank(order_No)) {
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("workorder_code", order_No);
|
||||
json.put("type", "1");
|
||||
ApplyTaskRequest request = new ApplyTaskRequest();
|
||||
request.setDevice_code(this.getDevice_code());
|
||||
request.setRequest_medthod_code(Thread.currentThread().getStackTrace()[1].getMethodName());
|
||||
request.setRequest_medthod_name(RequestMethodEnum.getName(Thread.currentThread().getStackTrace()[1].getMethodName()));
|
||||
request.setOrder_code(this.getOrder_No());
|
||||
message = RequestMethodEnum.getName("order_verify") + "order_verify 接口请求LMS...";
|
||||
lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message + "参数:" + json));
|
||||
HttpResponse result = acsToWmsService.enterOrder(json);
|
||||
if (ObjectUtil.isNotEmpty(result)) {
|
||||
if (result.getStatus() == HttpStatus.OK.value()) {
|
||||
JSONObject jsonObject = JSONObject.parseObject(result.body());
|
||||
if (ObjectUtil.isNotEmpty(jsonObject) && "200".equals(jsonObject.getString("status"))) {
|
||||
this.writing(mode);
|
||||
this.setRequireSucess(true);
|
||||
}
|
||||
lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, RequestMethodEnum.getName("order_verify") + jsonObject));
|
||||
}
|
||||
lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message + "参数:" + JSON.toJSONString(request)));
|
||||
Resp resp = acsToWmsService.applyTask(request);
|
||||
if (StrUtil.equals(resp.result, "true")) {
|
||||
this.writing(this.mode);
|
||||
this.setRequireSucess(true);
|
||||
} else {
|
||||
message = "order_verify接口请求失败,无返回信息";
|
||||
lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message));
|
||||
this.writing(400);
|
||||
message = RequestMethodEnum.getName("order_verify") + "order_verify 接口请求失败" + resp.getComment();;
|
||||
}
|
||||
lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public synchronized boolean order_finish() {
|
||||
if (!"0".equals(order_No) && StrUtil.isNotBlank(order_No)) {
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("workorder_code", order_No);
|
||||
json.put("type", "1");
|
||||
ApplyTaskRequest request = new ApplyTaskRequest();
|
||||
request.setDevice_code(this.getDevice_code());
|
||||
request.setRequest_medthod_code(Thread.currentThread().getStackTrace()[1].getMethodName());
|
||||
request.setRequest_medthod_name(RequestMethodEnum.getName(Thread.currentThread().getStackTrace()[1].getMethodName()));
|
||||
request.setOrder_code(this.getOrder_No());
|
||||
message = RequestMethodEnum.getName("order_finish") + "order_finish 接口请求LMS...";
|
||||
lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message + "参数:" + json));
|
||||
HttpResponse result = acsToWmsService.enterOrder(json);
|
||||
if (ObjectUtil.isNotEmpty(result)) {
|
||||
if (result.getStatus() == HttpStatus.OK.value()) {
|
||||
JSONObject jsonObject = JSONObject.parseObject(result.body());
|
||||
if (ObjectUtil.isNotEmpty(jsonObject) && "200".equals(jsonObject.getString("status"))) {
|
||||
this.writing(mode);
|
||||
this.setRequireSucess(true);
|
||||
}
|
||||
lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, RequestMethodEnum.getName("order_verify") + jsonObject));
|
||||
}
|
||||
lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message + "参数:" + JSON.toJSONString(request)));
|
||||
Resp resp = acsToWmsService.applyTask(request);
|
||||
if (StrUtil.equals(resp.result, "true")) {
|
||||
this.writing(this.mode);
|
||||
this.setRequireSucess(true);
|
||||
} else {
|
||||
message = RequestMethodEnum.getName("order_finish") + "order_finish 接口请求失败,无返回信息";
|
||||
lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message));
|
||||
this.writing(400);
|
||||
message = RequestMethodEnum.getName("order_finish") + "order_finish 接口请求失败" + resp.getComment();;
|
||||
}
|
||||
lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 申请补空料盅托盘
|
||||
*
|
||||
* @param
|
||||
*/
|
||||
public synchronized boolean apply_put_empty_vehicle() {
|
||||
ApplyTaskRequest request = new ApplyTaskRequest();
|
||||
request.setDevice_code(this.getDevice_code());
|
||||
request.setRequest_medthod_code(Thread.currentThread().getStackTrace()[1].getMethodName());
|
||||
request.setRequest_medthod_name(RequestMethodEnum.getName(Thread.currentThread().getStackTrace()[1].getMethodName()));
|
||||
request.setRequestNo(IdUtil.simpleUUID());
|
||||
request.setRequestDate(AgvUtil.getDate());
|
||||
Resp resp = acsToWmsService.applyTask(request);
|
||||
if (StrUtil.equals(resp.result, "true")) {
|
||||
this.writing(this.mode);
|
||||
this.setRequireSucess(true);
|
||||
} else {
|
||||
this.writing(400);
|
||||
}
|
||||
return true;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
package org.nl.acs.device_driver.lnsh.lnsh_palletizing_manipulator;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.http.HttpResponse;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
@@ -10,9 +12,14 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.acs.device.device_driver.standard_inspect.ReadUtil;
|
||||
import org.nl.acs.device.service.DeviceService;
|
||||
import org.nl.acs.device_driver.DeviceDriver;
|
||||
import org.nl.acs.device_driver.RequestMethodEnum;
|
||||
import org.nl.acs.device_driver.RouteableDeviceDriver;
|
||||
import org.nl.acs.device_driver.StandardRequestMethod;
|
||||
import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver;
|
||||
import org.nl.acs.device_driver.driver.ExecutableDeviceDriver;
|
||||
import org.nl.acs.ext.wms.data.Resp;
|
||||
import org.nl.acs.ext.wms.data.applyTask.ApplyTaskRequest;
|
||||
import org.nl.acs.ext.wms.data.grab.GrabRequest;
|
||||
import org.nl.acs.ext.wms.service.AcsToWmsService;
|
||||
import org.nl.acs.instruction.service.InstructionService;
|
||||
import org.nl.acs.instruction.service.dto.Instruction;
|
||||
@@ -21,10 +28,13 @@ import org.nl.acs.monitor.DeviceStageMonitor;
|
||||
import org.nl.acs.opc.Device;
|
||||
import org.nl.acs.route.service.RouteLineService;
|
||||
import org.nl.acs.task.service.TaskService;
|
||||
import org.nl.modules.lucene.service.LuceneExecuteLogService;
|
||||
import org.nl.modules.lucene.service.dto.LuceneLogDto;
|
||||
import org.nl.modules.wql.util.SpringContextHolder;
|
||||
import org.openscada.opc.lib.da.Server;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
@@ -37,7 +47,7 @@ import java.util.Map;
|
||||
@Getter
|
||||
@Setter
|
||||
@RequiredArgsConstructor
|
||||
public class LnshPalletizingManipulatorDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver, DeviceStageMonitor {
|
||||
public class LnshPalletizingManipulatorDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver, DeviceStageMonitor, StandardRequestMethod {
|
||||
protected ItemProtocol itemProtocol = new ItemProtocol(this);
|
||||
|
||||
InstructionService instructionService = SpringContextHolder.getBean("instructionServiceImpl");
|
||||
@@ -52,6 +62,9 @@ public class LnshPalletizingManipulatorDeviceDriver extends AbstractOpcDeviceDri
|
||||
|
||||
AcsToWmsService acsToWmsService = SpringContextHolder.getBean("acsToWmsServiceImpl");
|
||||
|
||||
LuceneExecuteLogService lucene = SpringContextHolder.getBean("luceneExecuteLogServiceImpl");
|
||||
|
||||
|
||||
int mode = 0;
|
||||
int error = 0;
|
||||
int action = 0;
|
||||
@@ -279,41 +292,22 @@ public class LnshPalletizingManipulatorDeviceDriver extends AbstractOpcDeviceDri
|
||||
message = "";
|
||||
Instruction instruction = null;
|
||||
List toInstructions;
|
||||
switch (mode) {
|
||||
case 1:
|
||||
log.debug("设备运转模式:等待工作");
|
||||
return;
|
||||
case 2:
|
||||
break;
|
||||
case 3:
|
||||
break;
|
||||
// case 4:
|
||||
// //获取托盘信息
|
||||
// if (!requireSucess) {
|
||||
// getVehicle();
|
||||
// }
|
||||
// break;
|
||||
// case 5:
|
||||
// //码垛完成
|
||||
// if (!requireSucess) {
|
||||
// palletizing();
|
||||
// }
|
||||
// break;
|
||||
// case 6:
|
||||
// //码垛强制完成
|
||||
// if (!requireSucess) {
|
||||
// mandatoryPalletizing();
|
||||
// }
|
||||
// break;
|
||||
// case 7:
|
||||
// //申请空盘
|
||||
// if (!requireSucess) {
|
||||
// applyEmpty();
|
||||
// }
|
||||
// break;
|
||||
if (mode > 2) {
|
||||
if (ObjectUtil.isNotEmpty(this.device.getExtraValue().get(String.valueOf(mode)))) {
|
||||
String modethod = this.device.getExtraValue().get(String.valueOf(mode)).toString();
|
||||
try {
|
||||
applyRequest(modethod);
|
||||
} catch (Exception e) {
|
||||
message = "错误:" + e.getMessage();
|
||||
this.setIserror(true);
|
||||
}
|
||||
} else {
|
||||
message = "无效模式请求,驱动未配置此请求方法";
|
||||
}
|
||||
} else {
|
||||
message = "无请求";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
last_mode = mode;
|
||||
last_status = status;
|
||||
@@ -341,6 +335,60 @@ public class LnshPalletizingManipulatorDeviceDriver extends AbstractOpcDeviceDri
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 请求
|
||||
*
|
||||
* @param
|
||||
*/
|
||||
public synchronized boolean applyRequest(String modethod) throws Exception {
|
||||
Date date = new Date();
|
||||
if (date.getTime() - this.instruction_require_time.getTime() < (long) this.instruction_require_time_out) {
|
||||
log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out);
|
||||
return false;
|
||||
} else {
|
||||
this.instruction_require_time = date;
|
||||
Method method1 = this.getClass().getMethod(modethod, null);
|
||||
method1.invoke(this, null);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean apply_one_grab() {
|
||||
GrabRequest request = new GrabRequest();
|
||||
request.setDevice_code(this.getDevice_code());
|
||||
request.setRequest_medthod_code(Thread.currentThread().getStackTrace()[1].getMethodName());
|
||||
request.setRequest_medthod_name(RequestMethodEnum.getName(Thread.currentThread().getStackTrace()[1].getMethodName()));
|
||||
List<String> getDeviceCodeList = this.getExtraDeviceCodes("get_station");
|
||||
List<String> putDeviceCodeList = this.getExtraDeviceCodes("put_station");
|
||||
request.setGet_station(getDeviceCodeList.get(get_station));
|
||||
request.setPut_station(putDeviceCodeList.get(put_station));
|
||||
request.setLaser_marking_code(laser_marking_code);
|
||||
request.setGrinding_number(grinding_number);
|
||||
request.setHeight1(height1);
|
||||
request.setHeight2(height2);
|
||||
request.setHeight3(height3);
|
||||
request.setHeight4(height4);
|
||||
request.setWidth1(width1);
|
||||
request.setWidth2(width2);
|
||||
request.setLen(len);
|
||||
request.setVolume(volume);
|
||||
request.setFlatness(flatness);
|
||||
request.setUnqualified_qty(unqualified_qty);
|
||||
message = RequestMethodEnum.getName("apply_one_grab") + "apply_one_grab 接口请求LMS...";
|
||||
lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message + "参数:" + JSON.toJSONString(request)));
|
||||
Resp resp = acsToWmsService.applyTask(request);
|
||||
if (StrUtil.equals(resp.result, "true")) {
|
||||
this.writing(this.mode);
|
||||
this.setRequireSucess(true);
|
||||
} else {
|
||||
this.writing(400);
|
||||
message = RequestMethodEnum.getName("apply_one_grab") + "apply_one_grab 接口请求失败" + resp.getComment();;
|
||||
}
|
||||
lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message));
|
||||
return true;
|
||||
|
||||
}
|
||||
/**
|
||||
* 获取托盘信息
|
||||
*
|
||||
@@ -488,86 +536,6 @@ public class LnshPalletizingManipulatorDeviceDriver extends AbstractOpcDeviceDri
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 码垛完成
|
||||
*
|
||||
* @param
|
||||
*/
|
||||
public synchronized boolean palletizing() {
|
||||
Date date = new Date();
|
||||
if (date.getTime() - this.instruction_require_time.getTime() < (long) this.instruction_require_time_out) {
|
||||
log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out);
|
||||
return false;
|
||||
} else {
|
||||
this.instruction_require_time = date;
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("device_code", device_code);
|
||||
json.put("is_full", "1");
|
||||
|
||||
HttpResponse result = acsToWmsService.applyTaskManipulatorToWms(json);
|
||||
if (ObjectUtil.isNotEmpty(result)) {
|
||||
if (result.getStatus() == 200) {
|
||||
this.writing(this.mode);
|
||||
requireSucess = true;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 码垛强制完成
|
||||
*
|
||||
* @param
|
||||
*/
|
||||
public synchronized boolean mandatoryPalletizing() {
|
||||
Date date = new Date();
|
||||
if (date.getTime() - this.instruction_require_time.getTime() < (long) this.instruction_require_time_out) {
|
||||
log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out);
|
||||
return false;
|
||||
} else {
|
||||
this.instruction_require_time = date;
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("device_code", device_code);
|
||||
json.put("is_full", "0");
|
||||
|
||||
HttpResponse result = acsToWmsService.applyTaskManipulatorToWms(json);
|
||||
if (ObjectUtil.isNotEmpty(result)) {
|
||||
if (result.getStatus() == 200) {
|
||||
this.writing(this.mode);
|
||||
requireSucess = true;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 申请空盘
|
||||
*
|
||||
* @param
|
||||
*/
|
||||
public synchronized boolean applyEmpty() {
|
||||
Date date = new Date();
|
||||
if (date.getTime() - this.instruction_require_time.getTime() < (long) this.instruction_require_time_out) {
|
||||
log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out);
|
||||
return false;
|
||||
} else {
|
||||
this.instruction_require_time = date;
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("device_code", device_code);
|
||||
json.put("type", "4");
|
||||
HttpResponse result = acsToWmsService.lnshApplyTaskToWms(json);
|
||||
if (ObjectUtil.isNotEmpty(result)) {
|
||||
if (result.getStatus() == 200) {
|
||||
this.writing(this.mode);
|
||||
requireSucess = true;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean exe_error() {
|
||||
if (this.error == 0) {
|
||||
|
||||
@@ -4,6 +4,7 @@ import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.http.HttpResponse;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
@@ -29,6 +30,7 @@ import org.nl.acs.opc.Device;
|
||||
import org.nl.acs.route.service.RouteLineService;
|
||||
import org.nl.acs.task.service.TaskService;
|
||||
import org.nl.modules.lucene.service.LuceneExecuteLogService;
|
||||
import org.nl.modules.lucene.service.dto.LuceneLogDto;
|
||||
import org.nl.modules.wql.util.SpringContextHolder;
|
||||
import org.openscada.opc.lib.da.Server;
|
||||
import org.springframework.http.HttpStatus;
|
||||
@@ -470,29 +472,38 @@ public class LnshStationDeviceDriver extends AbstractOpcDeviceDriver implements
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 申请补满料盅托盘
|
||||
*
|
||||
* @param
|
||||
*/
|
||||
public synchronized boolean apply_put_full_vehicle() {
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("device_code", this.device_code);
|
||||
json.put("type", "2");
|
||||
json.put("qty", weight);
|
||||
json.put("vehicle_code", barcode);
|
||||
json.put("is_full", "1");
|
||||
HttpResponse result = acsToWmsService.lnshApplyTaskToWms(json);
|
||||
if (ObjectUtil.isNotEmpty(result)) {
|
||||
if (result.getStatus() == HttpStatus.OK.value()) {
|
||||
JSONObject jsonObject = JSONObject.parseObject(result.body());
|
||||
if (ObjectUtil.isNotEmpty(jsonObject) && "200".equals(jsonObject.getString("status"))) {
|
||||
this.writing(this.mode);
|
||||
this.setRequireSucess(true);
|
||||
}
|
||||
if(move == 0) {
|
||||
ApplyTaskRequest request = new ApplyTaskRequest();
|
||||
request.setDevice_code(this.getDevice_code());
|
||||
request.setRequest_medthod_code(Thread.currentThread().getStackTrace()[1].getMethodName());
|
||||
request.setRequest_medthod_name(RequestMethodEnum.getName(Thread.currentThread().getStackTrace()[1].getMethodName()));
|
||||
request.setWeight(String.valueOf(weight));
|
||||
request.setVehicle_code(String.valueOf(barcode));
|
||||
message = RequestMethodEnum.getName("apply_put_full_vehicle") + "apply_put_full_vehicle 接口请求LMS...";
|
||||
lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message + "参数:" + JSON.toJSONString(request)));
|
||||
Resp resp = acsToWmsService.applyTask(request);
|
||||
if (StrUtil.equals(resp.result, "true")) {
|
||||
this.writing(this.mode);
|
||||
this.setRequireSucess(true);
|
||||
} else {
|
||||
this.writing(400);
|
||||
message = RequestMethodEnum.getName("apply_put_full_vehicle") + "apply_put_full_vehicle 接口请求失败" + resp.getComment();;
|
||||
}
|
||||
lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message));
|
||||
return true;
|
||||
} else {
|
||||
message = RequestMethodEnum.getName("apply_put_full_vehicle") + "apply_put_full_vehicle 设备有货未请求LMS...";
|
||||
lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message));
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -501,21 +512,30 @@ public class LnshStationDeviceDriver extends AbstractOpcDeviceDriver implements
|
||||
* @param
|
||||
*/
|
||||
public synchronized boolean apply_put_empty_vehicle() {
|
||||
ApplyTaskRequest request = new ApplyTaskRequest();
|
||||
request.setDevice_code(this.getDevice_code());
|
||||
request.setRequest_medthod_code(this.getClass().getName());
|
||||
request.setRequest_medthod_name(RequestMethodEnum.getName(this.getClass().getName()));
|
||||
request.setRequestNo(IdUtil.simpleUUID());
|
||||
request.setRequestDate(AgvUtil.getDate());
|
||||
Resp resp = acsToWmsService.applyTask(request);
|
||||
if (StrUtil.equals(resp.result, "true")) {
|
||||
this.writing(this.mode);
|
||||
this.setRequireSucess(true);
|
||||
} else {
|
||||
this.writing(400);
|
||||
}
|
||||
return true;
|
||||
if(move == 0) {
|
||||
ApplyTaskRequest request = new ApplyTaskRequest();
|
||||
request.setDevice_code(this.getDevice_code());
|
||||
request.setRequest_medthod_code(this.getClass().getName());
|
||||
request.setRequest_medthod_name(RequestMethodEnum.getName(this.getClass().getName()));
|
||||
request.setWeight(String.valueOf(weight));
|
||||
request.setVehicle_code(String.valueOf(barcode));
|
||||
Resp resp = acsToWmsService.applyTask(request);
|
||||
message = RequestMethodEnum.getName("apply_put_empty_vehicle") + "apply_put_empty_vehicle 接口请求LMS...";
|
||||
lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message + "参数:" + JSON.toJSONString(request)));
|
||||
|
||||
if (StrUtil.equals(resp.result, "true")) {
|
||||
this.writing(this.mode);
|
||||
this.setRequireSucess(true);
|
||||
} else {
|
||||
this.writing(400);
|
||||
message = RequestMethodEnum.getName("apply_put_empty_vehicle") + "apply_put_empty_vehicle 接口请求失败" + resp.getComment();;
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
message = RequestMethodEnum.getName("apply_put_empty_vehicle") + "apply_put_empty_vehicle 设备有货未请求LMS...";
|
||||
lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -524,21 +544,30 @@ public class LnshStationDeviceDriver extends AbstractOpcDeviceDriver implements
|
||||
* @param
|
||||
*/
|
||||
public synchronized boolean apply_take_empty_vehicle() {
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("device_code", this.device_code);
|
||||
json.put("type", "2");
|
||||
json.put("is_full", "1");
|
||||
HttpResponse result = acsToWmsService.lnshApplyTaskToWms(json);
|
||||
if (ObjectUtil.isNotEmpty(result)) {
|
||||
if (result.getStatus() == HttpStatus.OK.value()) {
|
||||
JSONObject jsonObject = JSONObject.parseObject(result.body());
|
||||
if (ObjectUtil.isNotEmpty(jsonObject) && "200".equals(jsonObject.getString("status"))) {
|
||||
this.writing(this.mode);
|
||||
this.setRequireSucess(true);
|
||||
}
|
||||
if(move == 0) {
|
||||
ApplyTaskRequest request = new ApplyTaskRequest();
|
||||
request.setDevice_code(this.getDevice_code());
|
||||
request.setRequest_medthod_code(this.getClass().getName());
|
||||
request.setRequest_medthod_name(RequestMethodEnum.getName(this.getClass().getName()));
|
||||
request.setWeight(String.valueOf(weight));
|
||||
request.setVehicle_code(String.valueOf(barcode));
|
||||
Resp resp = acsToWmsService.applyTask(request);
|
||||
message = RequestMethodEnum.getName("apply_take_empty_vehicle") + "apply_take_empty_vehicle 接口请求LMS...";
|
||||
lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message + "参数:" + JSON.toJSONString(request)));
|
||||
|
||||
if (StrUtil.equals(resp.result, "true")) {
|
||||
this.writing(this.mode);
|
||||
this.setRequireSucess(true);
|
||||
} else {
|
||||
this.writing(400);
|
||||
message = RequestMethodEnum.getName("apply_take_empty_vehicle") + "apply_take_empty_vehicle 接口请求失败" + resp.getComment();;
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
message = RequestMethodEnum.getName("apply_take_empty_vehicle") + "apply_take_empty_vehicle 设备有货未请求LMS...";
|
||||
lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message));
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -548,27 +577,30 @@ public class LnshStationDeviceDriver extends AbstractOpcDeviceDriver implements
|
||||
* @param
|
||||
*/
|
||||
public synchronized boolean apply_take_full_vehicle() {
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("device_code", this.device_code);
|
||||
json.put("type", "1");
|
||||
json.put("weight", weight);
|
||||
json.put("vehicle_code", barcode);
|
||||
json.put("is_full", "1");
|
||||
HttpResponse result = acsToWmsService.lnshApplyTaskToWms(json);
|
||||
if (ObjectUtil.isNotEmpty(result)) {
|
||||
if (result.getStatus() == HttpStatus.OK.value()) {
|
||||
JSONObject jsonObject = JSONObject.parseObject(result.body());
|
||||
if (ObjectUtil.isNotEmpty(jsonObject) && "200".equals(jsonObject.getString("status"))) {
|
||||
this.writing(this.mode);
|
||||
this.setRequireSucess(true);
|
||||
} else {
|
||||
this.writing(400);
|
||||
}
|
||||
if(move > 0) {
|
||||
ApplyTaskRequest request = new ApplyTaskRequest();
|
||||
request.setDevice_code(this.getDevice_code());
|
||||
request.setRequest_medthod_code(this.getClass().getName());
|
||||
request.setRequest_medthod_name(RequestMethodEnum.getName(this.getClass().getName()));
|
||||
request.setWeight(String.valueOf(weight));
|
||||
request.setVehicle_code(String.valueOf(barcode));
|
||||
Resp resp = acsToWmsService.applyTask(request);
|
||||
message = RequestMethodEnum.getName("apply_take_full_vehicle") + "apply_take_full_vehicle 接口请求LMS...";
|
||||
lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message + "参数:" + JSON.toJSONString(request)));
|
||||
|
||||
if (StrUtil.equals(resp.result, "true")) {
|
||||
this.writing(this.mode);
|
||||
this.setRequireSucess(true);
|
||||
} else {
|
||||
this.writing(400);
|
||||
message = RequestMethodEnum.getName("apply_take_full_vehicle") + "apply_take_full_vehicle 接口请求失败" + resp.getComment();;
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
message = RequestMethodEnum.getName("apply_take_full_vehicle") + "apply_take_full_vehicle 设备无货未请求LMS...";
|
||||
lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message));
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -577,27 +609,30 @@ public class LnshStationDeviceDriver extends AbstractOpcDeviceDriver implements
|
||||
* @param
|
||||
*/
|
||||
public synchronized boolean apply_force_take_full_vehicle() {
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("device_code", this.device_code);
|
||||
json.put("type", "1");
|
||||
json.put("weight", weight);
|
||||
json.put("vehicle_code", barcode);
|
||||
json.put("is_full", "1");
|
||||
HttpResponse result = acsToWmsService.lnshApplyTaskToWms(json);
|
||||
if (ObjectUtil.isNotEmpty(result)) {
|
||||
if (result.getStatus() == HttpStatus.OK.value()) {
|
||||
JSONObject jsonObject = JSONObject.parseObject(result.body());
|
||||
if (ObjectUtil.isNotEmpty(jsonObject) && "200".equals(jsonObject.getString("status"))) {
|
||||
this.writing(this.mode);
|
||||
this.setRequireSucess(true);
|
||||
} else {
|
||||
this.writing(400);
|
||||
}
|
||||
if(move > 0) {
|
||||
ApplyTaskRequest request = new ApplyTaskRequest();
|
||||
request.setDevice_code(this.getDevice_code());
|
||||
request.setRequest_medthod_code(this.getClass().getName());
|
||||
request.setRequest_medthod_name(RequestMethodEnum.getName(this.getClass().getName()));
|
||||
request.setWeight(String.valueOf(weight));
|
||||
request.setVehicle_code(String.valueOf(barcode));
|
||||
Resp resp = acsToWmsService.applyTask(request);
|
||||
message = RequestMethodEnum.getName("apply_force_take_full_vehicle") + "apply_force_take_full_vehicle 接口请求LMS...";
|
||||
lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message + "参数:" + JSON.toJSONString(request)));
|
||||
|
||||
if (StrUtil.equals(resp.result, "true")) {
|
||||
this.writing(this.mode);
|
||||
this.setRequireSucess(true);
|
||||
} else {
|
||||
this.writing(400);
|
||||
message = RequestMethodEnum.getName("apply_force_take_full_vehicle") + "apply_force_take_full_vehicle 接口请求失败" + resp.getComment();;
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
message = RequestMethodEnum.getName("apply_force_take_full_vehicle") + "apply_force_take_full_vehicle 设备无货未请求LMS...";
|
||||
lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message));
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -606,27 +641,30 @@ public class LnshStationDeviceDriver extends AbstractOpcDeviceDriver implements
|
||||
* @param
|
||||
*/
|
||||
public synchronized boolean apply_force_take_full_vehicle_in_storage() {
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("device_code", this.device_code);
|
||||
json.put("type", "1");
|
||||
json.put("weight", weight);
|
||||
json.put("vehicle_code", barcode);
|
||||
json.put("is_full", "1");
|
||||
HttpResponse result = acsToWmsService.lnshApplyTaskToWms(json);
|
||||
if (ObjectUtil.isNotEmpty(result)) {
|
||||
if (result.getStatus() == HttpStatus.OK.value()) {
|
||||
JSONObject jsonObject = JSONObject.parseObject(result.body());
|
||||
if (ObjectUtil.isNotEmpty(jsonObject) && "200".equals(jsonObject.getString("status"))) {
|
||||
this.writing(this.mode);
|
||||
this.setRequireSucess(true);
|
||||
} else {
|
||||
this.writing(400);
|
||||
}
|
||||
if(move > 0) {
|
||||
ApplyTaskRequest request = new ApplyTaskRequest();
|
||||
request.setDevice_code(this.getDevice_code());
|
||||
request.setRequest_medthod_code(this.getClass().getName());
|
||||
request.setRequest_medthod_name(RequestMethodEnum.getName(this.getClass().getName()));
|
||||
request.setWeight(String.valueOf(weight));
|
||||
request.setVehicle_code(String.valueOf(barcode));
|
||||
Resp resp = acsToWmsService.applyTask(request);
|
||||
message = RequestMethodEnum.getName("apply_force_take_full_vehicle_in_storage") + "apply_force_take_full_vehicle_in_storage 接口请求LMS...";
|
||||
lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message + "参数:" + JSON.toJSONString(request)));
|
||||
|
||||
if (StrUtil.equals(resp.result, "true")) {
|
||||
this.writing(this.mode);
|
||||
this.setRequireSucess(true);
|
||||
} else {
|
||||
this.writing(400);
|
||||
message = RequestMethodEnum.getName("apply_force_take_full_vehicle_in_storage") + "apply_force_take_full_vehicle_in_storage 接口请求失败" + resp.getComment();;
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
message = RequestMethodEnum.getName("apply_force_take_full_vehicle_in_storage") + "apply_force_take_full_vehicle_in_storage 设备无货未请求LMS...";
|
||||
lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message));
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -635,24 +673,30 @@ public class LnshStationDeviceDriver extends AbstractOpcDeviceDriver implements
|
||||
* @param
|
||||
*/
|
||||
public synchronized boolean barcode_sucess_apply() {
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("device_code", this.device_code);
|
||||
json.put("vehicle_code", barcode);
|
||||
HttpResponse result = acsToWmsService.applyOuttoKiln(json);
|
||||
if (ObjectUtil.isNotEmpty(result)) {
|
||||
if (result.getStatus() == HttpStatus.OK.value()) {
|
||||
JSONObject jsonObject = JSONObject.parseObject(result.body());
|
||||
if (ObjectUtil.isNotEmpty(jsonObject) && "200".equals(jsonObject.getString("status"))) {
|
||||
this.writing(this.mode);
|
||||
this.setRequireSucess(true);
|
||||
} else {
|
||||
this.writing(400);
|
||||
}
|
||||
if(move > 0) {
|
||||
ApplyTaskRequest request = new ApplyTaskRequest();
|
||||
request.setDevice_code(this.getDevice_code());
|
||||
request.setRequest_medthod_code(this.getClass().getName());
|
||||
request.setRequest_medthod_name(RequestMethodEnum.getName(this.getClass().getName()));
|
||||
request.setWeight(String.valueOf(weight));
|
||||
request.setVehicle_code(String.valueOf(barcode));
|
||||
Resp resp = acsToWmsService.applyTask(request);
|
||||
message = RequestMethodEnum.getName("barcode_sucess_apply") + "barcode_sucess_apply 接口请求LMS...";
|
||||
lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message + "参数:" + JSON.toJSONString(request)));
|
||||
|
||||
if (StrUtil.equals(resp.result, "true")) {
|
||||
this.writing(this.mode);
|
||||
this.setRequireSucess(true);
|
||||
} else {
|
||||
this.writing(400);
|
||||
message = RequestMethodEnum.getName("barcode_sucess_apply") + "barcode_sucess_apply 接口请求失败" + resp.getComment();;
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
message = RequestMethodEnum.getName("barcode_sucess_apply") + "barcode_sucess_apply 设备无货未请求LMS...";
|
||||
lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message));
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -661,26 +705,30 @@ public class LnshStationDeviceDriver extends AbstractOpcDeviceDriver implements
|
||||
* @param
|
||||
*/
|
||||
public synchronized boolean get_vehicle_info() {
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("device_code", this.device_code);
|
||||
json.put("type", "1");
|
||||
json.put("weight", weight);
|
||||
json.put("vehicle_code", barcode);
|
||||
json.put("is_full", "1");
|
||||
HttpResponse result = acsToWmsService.lnshApplyTaskToWms(json);
|
||||
if (ObjectUtil.isNotEmpty(result)) {
|
||||
if (result.getStatus() == HttpStatus.OK.value()) {
|
||||
JSONObject jsonObject = JSONObject.parseObject(result.body());
|
||||
if (ObjectUtil.isNotEmpty(jsonObject) && "200".equals(jsonObject.getString("status"))) {
|
||||
this.writing(this.mode);
|
||||
this.setRequireSucess(true);
|
||||
} else {
|
||||
this.writing(400);
|
||||
}
|
||||
}
|
||||
}
|
||||
if(move > 0) {
|
||||
ApplyTaskRequest request = new ApplyTaskRequest();
|
||||
request.setDevice_code(this.getDevice_code());
|
||||
request.setRequest_medthod_code(this.getClass().getName());
|
||||
request.setRequest_medthod_name(RequestMethodEnum.getName(this.getClass().getName()));
|
||||
request.setWeight(String.valueOf(weight));
|
||||
request.setVehicle_code(String.valueOf(barcode));
|
||||
Resp resp = acsToWmsService.applyTask(request);
|
||||
message = RequestMethodEnum.getName("get_vehicle_info") + "get_vehicle_info 接口请求LMS...";
|
||||
lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message + "参数:" + JSON.toJSONString(request)));
|
||||
|
||||
return true;
|
||||
if (StrUtil.equals(resp.result, "true")) {
|
||||
this.writing(this.mode);
|
||||
this.setRequireSucess(true);
|
||||
} else {
|
||||
this.writing(400);
|
||||
message = RequestMethodEnum.getName("get_vehicle_info") + "get_vehicle_info 接口请求失败" + resp.getComment();;
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
message = RequestMethodEnum.getName("get_vehicle_info") + "get_vehicle_info 设备无货未请求LMS...";
|
||||
lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message));
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -688,23 +736,30 @@ public class LnshStationDeviceDriver extends AbstractOpcDeviceDriver implements
|
||||
* 强制去包装-不包装
|
||||
*/
|
||||
public synchronized boolean force_no_package() {
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("type", "5");
|
||||
json.put("device_code", device_code);
|
||||
if(move > 0) {
|
||||
ApplyTaskRequest request = new ApplyTaskRequest();
|
||||
request.setDevice_code(this.getDevice_code());
|
||||
request.setRequest_medthod_code(this.getClass().getName());
|
||||
request.setRequest_medthod_name(RequestMethodEnum.getName(this.getClass().getName()));
|
||||
request.setWeight(String.valueOf(weight));
|
||||
request.setVehicle_code(String.valueOf(barcode));
|
||||
Resp resp = acsToWmsService.applyTask(request);
|
||||
message = RequestMethodEnum.getName("force_no_package") + "force_no_package 接口请求LMS...";
|
||||
lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message + "参数:" + JSON.toJSONString(request)));
|
||||
|
||||
HttpResponse result = acsToWmsService.lnshApplyTaskToWms(json);
|
||||
if (ObjectUtil.isNotEmpty(result)) {
|
||||
if (result.getStatus() == HttpStatus.OK.value()) {
|
||||
JSONObject jsonObject = JSONObject.parseObject(result.body());
|
||||
if (ObjectUtil.isNotEmpty(jsonObject) && "200".equals(jsonObject.getString("status"))) {
|
||||
this.writing(this.mode);
|
||||
this.setRequireSucess(true);
|
||||
} else {
|
||||
this.writing(400);
|
||||
}
|
||||
if (StrUtil.equals(resp.result, "true")) {
|
||||
this.writing(this.mode);
|
||||
this.setRequireSucess(true);
|
||||
} else {
|
||||
this.writing(400);
|
||||
message = RequestMethodEnum.getName("force_no_package") + "force_no_package 接口请求失败" + resp.getComment();;
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
message = RequestMethodEnum.getName("force_no_package") + "force_no_package 设备无货未请求LMS...";
|
||||
lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message));
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -712,22 +767,29 @@ public class LnshStationDeviceDriver extends AbstractOpcDeviceDriver implements
|
||||
* 申请贴标
|
||||
*/
|
||||
public synchronized boolean apply_labelling() {
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("type", "5");
|
||||
json.put("device_code", device_code);
|
||||
if(move > 0) {
|
||||
ApplyTaskRequest request = new ApplyTaskRequest();
|
||||
request.setDevice_code(this.getDevice_code());
|
||||
request.setRequest_medthod_code(this.getClass().getName());
|
||||
request.setRequest_medthod_name(RequestMethodEnum.getName(this.getClass().getName()));
|
||||
request.setWeight(String.valueOf(weight));
|
||||
request.setVehicle_code(String.valueOf(barcode));
|
||||
Resp resp = acsToWmsService.applyTask(request);
|
||||
message = RequestMethodEnum.getName("apply_labelling") + "apply_labelling 接口请求LMS...";
|
||||
lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message + "参数:" + JSON.toJSONString(request)));
|
||||
|
||||
HttpResponse result = acsToWmsService.lnshApplyTaskToWms(json);
|
||||
if (ObjectUtil.isNotEmpty(result)) {
|
||||
if (result.getStatus() == HttpStatus.OK.value()) {
|
||||
JSONObject jsonObject = JSONObject.parseObject(result.body());
|
||||
if (ObjectUtil.isNotEmpty(jsonObject) && "200".equals(jsonObject.getString("status"))) {
|
||||
this.writing(this.mode);
|
||||
this.setRequireSucess(true);
|
||||
} else {
|
||||
this.writing(400);
|
||||
}
|
||||
if (StrUtil.equals(resp.result, "true")) {
|
||||
this.writing(this.mode);
|
||||
this.setRequireSucess(true);
|
||||
} else {
|
||||
this.writing(400);
|
||||
message = RequestMethodEnum.getName("apply_labelling") + "apply_labelling 接口请求失败" + resp.getComment();;
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
message = RequestMethodEnum.getName("apply_labelling") + "apply_labelling 设备无货未请求LMS...";
|
||||
lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message));
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,7 +26,13 @@ public class LmsUtil {
|
||||
//判断是否连接立库WCS系统
|
||||
String isConnect = paramService.findByCode("hasWms").getValue();
|
||||
if (StrUtil.equals("0", isConnect)) {
|
||||
throw new BadRequestException("参数配置表中-hasWms为:0");
|
||||
JSONObject result = new JSONObject();
|
||||
result.put("result", "false");
|
||||
result.put("code", "1");
|
||||
result.put("comment", "参数配置表中-hasWms为:0");
|
||||
log.info("请求LMS异常返回参数:{}", String.valueOf(result));
|
||||
return String.valueOf(result);
|
||||
//throw new BadRequestException("参数配置表中-hasWms为:0");
|
||||
}
|
||||
String liKu_wcs_url = paramService.findByCode("wmsurl").getValue();
|
||||
try {
|
||||
|
||||
@@ -1,22 +1,30 @@
|
||||
package org.nl.acs.ext.wms.data;
|
||||
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.nl.acs.agv.AgvUtil;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class BaseRequest {
|
||||
|
||||
/**
|
||||
* 请求号:uuid 唯一,LMS需要返回对应值
|
||||
*/
|
||||
private String requestNo;
|
||||
private String requestNo = IdUtil.simpleUUID();
|
||||
|
||||
/**
|
||||
* 请求时间
|
||||
*/
|
||||
private String requestDate;
|
||||
private String requestDate = AgvUtil.getDate();
|
||||
|
||||
/**
|
||||
* 请求方法编号
|
||||
@@ -28,6 +36,11 @@ public class BaseRequest {
|
||||
*/
|
||||
private String request_medthod_name;
|
||||
|
||||
/**
|
||||
* 设备号
|
||||
*/
|
||||
private String device_code;
|
||||
|
||||
|
||||
/**
|
||||
* 系统编号
|
||||
@@ -39,4 +52,6 @@ public class BaseRequest {
|
||||
*/
|
||||
private Map<String, String> parameters = new HashMap();
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,11 +1,17 @@
|
||||
package org.nl.acs.ext.wms.data;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class BaseResponse {
|
||||
|
||||
/**
|
||||
|
||||
@@ -6,16 +6,16 @@ import org.nl.acs.ext.wms.data.BaseRequest;
|
||||
@Data
|
||||
public class ApplyTaskRequest extends BaseRequest {
|
||||
|
||||
/**
|
||||
* 请求设备
|
||||
*/
|
||||
private String device_code;
|
||||
|
||||
/**
|
||||
* 载具号
|
||||
*/
|
||||
private String vehicle_code;
|
||||
|
||||
/**
|
||||
* 载具类型
|
||||
*/
|
||||
private String vehicle_type;
|
||||
|
||||
/**
|
||||
* 重量
|
||||
*/
|
||||
|
||||
@@ -3,4 +3,12 @@ package org.nl.acs.ext.wms.data.applyTask;
|
||||
import org.nl.acs.ext.wms.data.BaseResponse;
|
||||
|
||||
public class ApplyTaskResponse extends BaseResponse {
|
||||
|
||||
/**
|
||||
* 是否静置完成
|
||||
*/
|
||||
private String is_standing_finish;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,81 @@
|
||||
package org.nl.acs.ext.wms.data.grab;
|
||||
|
||||
|
||||
import lombok.Data;
|
||||
import org.nl.acs.ext.wms.data.BaseRequest;
|
||||
|
||||
@Data
|
||||
public class GrabRequest extends BaseRequest {
|
||||
|
||||
/**
|
||||
* 抓取位
|
||||
*/
|
||||
private String get_station;
|
||||
|
||||
/**
|
||||
* 放置位
|
||||
*/
|
||||
private String put_station;
|
||||
|
||||
/**
|
||||
* 激光标刻码
|
||||
*/
|
||||
private String laser_marking_code;
|
||||
|
||||
|
||||
/**
|
||||
* 碾次
|
||||
*/
|
||||
private String grinding_number;
|
||||
|
||||
/**
|
||||
* 高度1
|
||||
*/
|
||||
private String height1;
|
||||
|
||||
/**
|
||||
* 高度2
|
||||
*/
|
||||
private String height2;
|
||||
|
||||
/**
|
||||
* 高度3
|
||||
*/
|
||||
private String height3;
|
||||
|
||||
/**
|
||||
* 高度4
|
||||
*/
|
||||
private String height4;
|
||||
|
||||
/**
|
||||
* 宽度1
|
||||
*/
|
||||
private String width1;
|
||||
|
||||
/**
|
||||
* 宽度2
|
||||
*/
|
||||
private String width2;
|
||||
|
||||
/**
|
||||
* 长度
|
||||
*/
|
||||
private String len;
|
||||
|
||||
/**
|
||||
* 体积
|
||||
*/
|
||||
private String volume;
|
||||
|
||||
/**
|
||||
* 平面度
|
||||
*/
|
||||
private String flatness;
|
||||
|
||||
/**
|
||||
* 缺陷个数
|
||||
*/
|
||||
private String unqualified_qty;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package org.nl.acs.ext.wms.data.grab;
|
||||
|
||||
import org.nl.acs.ext.wms.data.BaseResponse;
|
||||
|
||||
public class GrabResponse extends BaseResponse {
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -3,6 +3,8 @@ package org.nl.acs.ext.wms.service;
|
||||
import cn.hutool.http.HttpResponse;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.nl.acs.ext.wms.data.BaseRequest;
|
||||
import org.nl.acs.ext.wms.data.BaseResponse;
|
||||
import org.nl.acs.ext.wms.data.Resp;
|
||||
import org.nl.acs.ext.wms.data.applyTask.ApplyTaskRequest;
|
||||
import org.nl.acs.ext.wms.data.applyTask.ApplyTaskResponse;
|
||||
@@ -25,7 +27,7 @@ public interface AcsToWmsService {
|
||||
/**
|
||||
* ACS向WMS申请晟华任务
|
||||
*/
|
||||
public Resp<ApplyTaskResponse> applyTask(ApplyTaskRequest request);
|
||||
public Resp<BaseResponse> applyTask(BaseRequest request);
|
||||
|
||||
/**
|
||||
* ACS向WMS申请贴标
|
||||
|
||||
@@ -15,6 +15,8 @@ import org.nl.acs.device.address.service.dto.AddressDto;
|
||||
import org.nl.acs.device.service.DeviceService;
|
||||
import org.nl.acs.ext.wms.LmsUtil;
|
||||
import org.nl.acs.ext.wms.RespUtil;
|
||||
import org.nl.acs.ext.wms.data.BaseRequest;
|
||||
import org.nl.acs.ext.wms.data.BaseResponse;
|
||||
import org.nl.acs.ext.wms.data.Resp;
|
||||
import org.nl.acs.ext.wms.data.applyTask.ApplyTaskRequest;
|
||||
import org.nl.acs.ext.wms.data.applyTask.ApplyTaskResponse;
|
||||
@@ -275,14 +277,14 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
|
||||
|
||||
@Override
|
||||
public Resp<ApplyTaskResponse> applyTask(ApplyTaskRequest requestParam) {
|
||||
public Resp<BaseResponse> applyTask(BaseRequest requestParam) {
|
||||
try {
|
||||
MDC.put(log_file_type, log_type);
|
||||
String api = addressService.findByCode("lnshApplyTaskToWms").getMethods_url();
|
||||
log.info("lnshApplyTaskToWms-----输入参数{}", JSON.toJSONString(requestParam));
|
||||
String result = LmsUtil.notifyAcs(api, requestParam);
|
||||
log.info("lnshApplyTaskToWms-----输出参数{}", result);
|
||||
return RespUtil.getResp(result, new ApplyTaskResponse());
|
||||
return RespUtil.getResp(result, new BaseResponse());
|
||||
} finally {
|
||||
MDC.remove(log_file_type);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user