Browse Source

rev 接口测试

master
汪菘 1 year ago
parent
commit
7df576b8de
  1. 2
      acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_mixing_mill/LnshMixingMillDeviceDriver.java
  2. 94
      acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_package_pallet_manipulator/LnshPackagePalletManipulatorDeviceDriver.java
  3. 2
      acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_palletizing_manipulator/LnshPalletizingManipulatorDeviceDriver.java
  4. 14
      acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_palletizing_manipulator_site/LnshPalletizingManipulatorSiteDeviceDriver.java
  5. 2
      acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/data/AcsToWmsData/getVehicle/GetPalletizeRequest.java
  6. 3
      acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/data/AcsToWmsData/getVehicle/GetPalletizeResponse.java
  7. 115
      acs/nladmin-ui/src/views/acs/device/driver/lnsh/lnsh_package_pallet_manipulator.vue

2
acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_mixing_mill/LnshMixingMillDeviceDriver.java

@ -169,7 +169,7 @@ public class LnshMixingMillDeviceDriver extends AbstractOpcDeviceDriver implemen
Instruction instruction = null; Instruction instruction = null;
List toInstructions; List toInstructions;
if (mode > 2) { if (mode > 2 && !requireSucess) {
if (ObjectUtil.isNotEmpty(this.device.getExtraValue().get(String.valueOf(mode)))) { if (ObjectUtil.isNotEmpty(this.device.getExtraValue().get(String.valueOf(mode)))) {
String modethod = this.device.getExtraValue().get(String.valueOf(mode)).toString(); String modethod = this.device.getExtraValue().get(String.valueOf(mode)).toString();
try { try {

94
acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_package_pallet_manipulator/LnshPackagePalletManipulatorDeviceDriver.java

@ -3,6 +3,7 @@ package org.nl.acs.device_driver.lnsh.lnsh_package_pallet_manipulator;
import cn.hutool.core.util.ObjectUtil; 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.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import lombok.Getter; import lombok.Getter;
import lombok.Setter; import lombok.Setter;
@ -11,9 +12,13 @@ import lombok.extern.slf4j.Slf4j;
import org.nl.acs.device.device_driver.standard_inspect.ReadUtil; import org.nl.acs.device.device_driver.standard_inspect.ReadUtil;
import org.nl.acs.device.service.DeviceService; import org.nl.acs.device.service.DeviceService;
import org.nl.acs.device_driver.DeviceDriver; 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.RouteableDeviceDriver;
import org.nl.acs.device_driver.StandardRequestMethod;
import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver; import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver;
import org.nl.acs.device_driver.driver.ExecutableDeviceDriver; import org.nl.acs.device_driver.driver.ExecutableDeviceDriver;
import org.nl.acs.ext.wms.data.AcsToWmsData.applyTask.ApplyTaskRequest;
import org.nl.acs.ext.wms.data.AcsToWmsData.applyTask.ApplyTaskResponse;
import org.nl.acs.ext.wms.service.AcsToWmsService; import org.nl.acs.ext.wms.service.AcsToWmsService;
import org.nl.acs.instruction.service.InstructionService; import org.nl.acs.instruction.service.InstructionService;
import org.nl.acs.instruction.service.dto.Instruction; import org.nl.acs.instruction.service.dto.Instruction;
@ -24,12 +29,15 @@ import org.nl.acs.order.service.ProduceshiftorderService;
import org.nl.acs.order.service.dto.ProduceshiftorderDto; import org.nl.acs.order.service.dto.ProduceshiftorderDto;
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.modules.lucene.service.LuceneExecuteLogService;
import org.nl.modules.lucene.service.dto.LuceneLogDto;
import org.nl.modules.wql.util.SpringContextHolder; import org.nl.modules.wql.util.SpringContextHolder;
import org.openscada.opc.lib.da.Server; import org.openscada.opc.lib.da.Server;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.util.*; import java.util.*;
/** /**
@ -39,9 +47,11 @@ import java.util.*;
@Getter @Getter
@Setter @Setter
@RequiredArgsConstructor @RequiredArgsConstructor
public class LnshPackagePalletManipulatorDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver, DeviceStageMonitor { public class LnshPackagePalletManipulatorDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver, DeviceStageMonitor, StandardRequestMethod {
protected ItemProtocol itemProtocol = new ItemProtocol(this); protected ItemProtocol itemProtocol = new ItemProtocol(this);
LuceneExecuteLogService lucene = SpringContextHolder.getBean("luceneExecuteLogServiceImpl");
InstructionService instructionService = SpringContextHolder.getBean("instructionServiceImpl"); InstructionService instructionService = SpringContextHolder.getBean("instructionServiceImpl");
DeviceService deviceservice = SpringContextHolder.getBean("deviceServiceImpl"); DeviceService deviceservice = SpringContextHolder.getBean("deviceServiceImpl");
@ -247,6 +257,22 @@ public class LnshPackagePalletManipulatorDeviceDriver extends AbstractOpcDeviceD
List toInstructions; List toInstructions;
if (mode > 2 && !requireSucess) {
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_mode = mode;
last_status = status; last_status = status;
@ -270,6 +296,72 @@ public class LnshPackagePalletManipulatorDeviceDriver extends AbstractOpcDeviceD
} }
/**
* 请求
*
* @param
*/
public synchronized boolean applyRequest(String modethod) throws Exception {
Object obj1 = this;
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;
Object obj = this.getClass().getDeclaredConstructor().newInstance();
Method method1 = this.getClass().getMethod(modethod, null);
method1.invoke(this, null);
return true;
}
}
public synchronized boolean order_verify() {
if (!"0".equals(order_No) && StrUtil.isNotBlank(order_No)) {
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.toJSONString(request)));
ApplyTaskResponse resp = JSON.toJavaObject(JSONObject.parseObject(acsToWmsService.applyTask(request)),ApplyTaskResponse.class);
if (resp.getCode() == 200) {
this.writing(200);
this.setRequireSucess(true);
} else {
this.writing(400);
message = RequestMethodEnum.getName("order_verify") + "order_verify 接口请求失败" + resp.getMessage();;
}
lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message));
}
return true;
}
public synchronized boolean order_finish() {
if (!"0".equals(order_No) && StrUtil.isNotBlank(order_No)) {
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.toJSONString(request)));
ApplyTaskResponse resp = JSON.toJavaObject(JSONObject.parseObject(acsToWmsService.applyTask(request)),ApplyTaskResponse.class);
if (resp.getCode() == 200) {
this.writing(200);
this.setRequireSucess(true);
} else {
this.writing(400);
message = RequestMethodEnum.getName("order_finish") + "order_finish 接口请求失败" + resp.getMessage();;
}
lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message));
}
return true;
}
public boolean exe_error() { public boolean exe_error() {
if (this.error == 0) { if (this.error == 0) {

2
acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_palletizing_manipulator/LnshPalletizingManipulatorDeviceDriver.java

@ -297,7 +297,7 @@ public class LnshPalletizingManipulatorDeviceDriver extends AbstractOpcDeviceDri
message = ""; message = "";
Instruction instruction = null; Instruction instruction = null;
List toInstructions; List toInstructions;
if (mode > 2) { if (mode > 2 && !requireSucess) {
if (ObjectUtil.isNotEmpty(this.device.getExtraValue().get(String.valueOf(mode)))) { if (ObjectUtil.isNotEmpty(this.device.getExtraValue().get(String.valueOf(mode)))) {
String modethod = this.device.getExtraValue().get(String.valueOf(mode)).toString(); String modethod = this.device.getExtraValue().get(String.valueOf(mode)).toString();
try { try {

14
acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_palletizing_manipulator_site/LnshPalletizingManipulatorSiteDeviceDriver.java

@ -21,6 +21,9 @@ import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver;
import org.nl.acs.device_driver.driver.ExecutableDeviceDriver; import org.nl.acs.device_driver.driver.ExecutableDeviceDriver;
import org.nl.acs.device_driver.lnsh.lnsh_mixing_mill.LnshMixingMillDeviceDriver; import org.nl.acs.device_driver.lnsh.lnsh_mixing_mill.LnshMixingMillDeviceDriver;
import org.nl.acs.ext.wms.data.AcsToWmsData.applyTask.ApplyTaskResponse; import org.nl.acs.ext.wms.data.AcsToWmsData.applyTask.ApplyTaskResponse;
import org.nl.acs.ext.wms.data.AcsToWmsData.getVehicle.GetPalletizeRequest;
import org.nl.acs.ext.wms.data.AcsToWmsData.getVehicle.GetPalletizeResponse;
import org.nl.acs.ext.wms.data.PalletizeDto;
import org.nl.acs.ext.wms.data.Resp; import org.nl.acs.ext.wms.data.Resp;
import org.nl.acs.ext.wms.data.AcsToWmsData.applyTask.ApplyTaskRequest; import org.nl.acs.ext.wms.data.AcsToWmsData.applyTask.ApplyTaskRequest;
import org.nl.acs.ext.wms.service.AcsToWmsService; import org.nl.acs.ext.wms.service.AcsToWmsService;
@ -794,7 +797,7 @@ public class LnshPalletizingManipulatorSiteDeviceDriver extends AbstractOpcDevic
* @param * @param
*/ */
public synchronized boolean apply_take_empty_vehicle() { public synchronized boolean apply_take_empty_vehicle() {
if(move == 0) { if(move == 1) {
ApplyTaskRequest request = new ApplyTaskRequest(); ApplyTaskRequest request = new ApplyTaskRequest();
request.setDevice_code(this.getDevice_code()); request.setDevice_code(this.getDevice_code());
request.setRequest_medthod_code(Thread.currentThread().getStackTrace()[1].getMethodName()); request.setRequest_medthod_code(Thread.currentThread().getStackTrace()[1].getMethodName());
@ -968,17 +971,20 @@ public class LnshPalletizingManipulatorSiteDeviceDriver extends AbstractOpcDevic
*/ */
public synchronized boolean get_vehicle_info() { public synchronized boolean get_vehicle_info() {
if(move > 0) { if(move > 0) {
ApplyTaskRequest request = new ApplyTaskRequest(); GetPalletizeRequest request = new GetPalletizeRequest();
request.setDevice_code(this.getDevice_code()); request.setDevice_code(this.getDevice_code());
request.setRequest_medthod_code(Thread.currentThread().getStackTrace()[1].getMethodName()); request.setRequest_medthod_code(Thread.currentThread().getStackTrace()[1].getMethodName());
request.setRequest_medthod_name(RequestMethodEnum.getName(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)); request.setVehicle_code(String.valueOf(barcode));
ApplyTaskResponse resp = JSON.toJavaObject(JSONObject.parseObject(acsToWmsService.applyTask(request)),ApplyTaskResponse.class); GetPalletizeResponse resp = JSON.toJavaObject(JSONObject.parseObject(acsToWmsService.applyTask(request)),GetPalletizeResponse.class);
message = RequestMethodEnum.getName("get_vehicle_info") + "get_vehicle_info 接口请求LMS..."; message = RequestMethodEnum.getName("get_vehicle_info") + "get_vehicle_info 接口请求LMS...";
lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message + "参数:" + JSON.toJSONString(request))); lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message + "参数:" + JSON.toJSONString(request)));
if (resp.getCode() == 200) { if (resp.getCode() == 200) {
if(ObjectUtil.isNotEmpty(resp.getPalletizeDto())){
PalletizeDto dto = resp.getPalletizeDto();
}
this.writing(200); this.writing(200);
this.setRequireSucess(true); this.setRequireSucess(true);
} else { } else {

2
acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/data/AcsToWmsData/getVehicle/GetPalletizeRequest.java

@ -1,7 +1,9 @@
package org.nl.acs.ext.wms.data.AcsToWmsData.getVehicle; package org.nl.acs.ext.wms.data.AcsToWmsData.getVehicle;
import lombok.Data;
import org.nl.acs.ext.wms.data.BaseRequest; import org.nl.acs.ext.wms.data.BaseRequest;
@Data
public class GetPalletizeRequest extends BaseRequest { public class GetPalletizeRequest extends BaseRequest {
/** /**

3
acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/data/AcsToWmsData/getVehicle/GetPalletizeResponse.java

@ -1,8 +1,9 @@
package org.nl.acs.ext.wms.data.AcsToWmsData.getVehicle; package org.nl.acs.ext.wms.data.AcsToWmsData.getVehicle;
import lombok.Data;
import org.nl.acs.ext.wms.data.BaseResponse; import org.nl.acs.ext.wms.data.BaseResponse;
import org.nl.acs.ext.wms.data.PalletizeDto; import org.nl.acs.ext.wms.data.PalletizeDto;
@Data
public class GetPalletizeResponse extends BaseResponse { public class GetPalletizeResponse extends BaseResponse {
private PalletizeDto palletizeDto; private PalletizeDto palletizeDto;

115
acs/nladmin-ui/src/views/acs/device/driver/lnsh/lnsh_package_pallet_manipulator.vue

@ -158,7 +158,66 @@
</el-row> </el-row>
</el-form> </el-form>
</el-card> </el-card>
<el-card class="box-card" shadow="never">
<div slot="header" class="clearfix">
<span class="role-span">交互相关</span>
</div>
<div class="crud-opts2" style="margin-bottom: 5px;">
<span class="crud-opts-right2">
<!--左侧插槽-->
<slot name="left" />
<el-button
slot="left"
class="filter-item"
type="primary"
icon="el-icon-plus"
size="mini"
@click="insertdtl()"
>
新增一行
</el-button>
</span>
</div>
<div class="app-container">
<el-table :data="modeform.tableData" border fit highlight-current-row style="width: 100%;" class="tb-edit">
<el-table-column label="mode" prop="模式" width="180">
<template scope="scope">
<el-input-number value="3" :min="3" v-model="scope.row.mode" size="mini" />
<span v-show="scope.row.edit">{{ scope.row.mode }}</span>
</template>
</el-table-column>
<el-table-column label="request" prop="请求方法" width="300">
<template scope="scope">
<el-select
v-model="scope.row.request"
filterable
clearable
placeholder="请选择"
>
<el-option
v-for="item in requestMethodList"
:key="item.code"
:label="item.name"
:value="item.code"
/>
</el-select>
</template>
</el-table-column>
<el-table-column align="center" label="操作" width="170" >
<template scope="scope">
<el-button
type="danger"
class="filter-item"
size="mini"
icon="el-icon-delete"
@click.native.prevent="deleteRow(scope.$index, modeform.tableData)"
/>
</template>
</el-table-column>
</el-table>
</div>
</el-card>
<el-card class="box-card" shadow="never"> <el-card class="box-card" shadow="never">
<div slot="header" class="clearfix"> <div slot="header" class="clearfix">
<span class="role-span">PLC读取字段</span> <span class="role-span">PLC读取字段</span>
@ -296,6 +355,59 @@ export default {
deviceList: [], deviceList: [],
data1: [], data1: [],
data2: [], data2: [],
requestMethodList: [],
modeform: {
tableData: [
{
mode: '3',
request: 'order_verify'
},
{
mode: '4',
request: 'order_finish'
},
{
mode: '5',
request: 'apply_put_full_vehicle'
},
{
mode: '6',
request: 'apply_put_empty_vehicle'
},
{
mode: '7',
request: 'apply_take_empty_vehicle'
},
{
mode: '8',
request: 'apply_take_full_vehicle'
},
{
mode: '9',
request: 'apply_force_take_full_vehicle'
},
{
mode: '10',
request: 'apply_force_take_full_vehicle_in_storage'
},
{
mode: '11',
request: 'barcode_success_apply'
},
{
mode: '12',
request: 'get_vehicle_info'
},
{
mode: '13',
request: 'force_no_package'
},
{
mode: '14',
request: 'apply_labelling'
}
]
},
form: { form: {
inspect_in_stocck: true, inspect_in_stocck: true,
ignore_pickup_check: true, ignore_pickup_check: true,
@ -349,6 +461,9 @@ export default {
deviceCrud.selectDeviceList().then(data => { deviceCrud.selectDeviceList().then(data => {
this.deviceList = data this.deviceList = data
}) })
deviceCrud.selectRequestMethodList().then(data => {
this.requestMethodList = data
})
}) })
}, },
methods: { methods: {

Loading…
Cancel
Save