fix : 测试流程

This commit is contained in:
2024-02-02 14:34:06 +08:00
parent f7f27a4f58
commit 2ce8ed9ae1
3 changed files with 77 additions and 12 deletions

View File

@@ -19,12 +19,12 @@ public class FoldDiscSiteDefination implements OpcDeviceDriverDefination {
@Override @Override
public String getDriverName() { public String getDriverName() {
return "叠盘机"; return "叠盘机";
} }
@Override @Override
public String getDriverDescription() { public String getDriverDescription() {
return "叠盘机"; return "叠盘机";
} }
@Override @Override

View File

@@ -4,7 +4,6 @@ import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.IdUtil; import cn.hutool.core.util.IdUtil;
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 com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import lombok.Data; import lombok.Data;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
@@ -18,17 +17,18 @@ import org.nl.acs.device_driver.FeedLmsRealFailed;
import org.nl.acs.device_driver.RouteableDeviceDriver; import org.nl.acs.device_driver.RouteableDeviceDriver;
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.enums.StorageTypeEnum; import org.nl.acs.ext.wms.data.one.ApplyLabelingAndBindingRequest;
import org.nl.acs.ext.wms.data.one.ApplyLabelingAndBindingResponse;
import org.nl.acs.ext.wms.service.AcsToWmsService; import org.nl.acs.ext.wms.service.AcsToWmsService;
import org.nl.acs.history.ErrorUtil; import org.nl.acs.history.ErrorUtil;
import org.nl.acs.history.service.DeviceErrorLogService; import org.nl.acs.history.service.DeviceErrorLogService;
import org.nl.acs.history.service.dto.DeviceErrorLogDto;
import org.nl.acs.history.service.impl.DeviceErrorLogServiceImpl; import org.nl.acs.history.service.impl.DeviceErrorLogServiceImpl;
import org.nl.acs.instruction.domain.Instruction; import org.nl.acs.instruction.domain.Instruction;
import org.nl.acs.instruction.service.InstructionService; import org.nl.acs.instruction.service.InstructionService;
import org.nl.acs.log.service.DeviceExecuteLogService; import org.nl.acs.log.service.DeviceExecuteLogService;
import org.nl.acs.monitor.DeviceStageMonitor; import org.nl.acs.monitor.DeviceStageMonitor;
import org.nl.acs.opc.DeviceAppService; import org.nl.acs.opc.DeviceAppService;
import org.nl.acs.opc.DeviceAppServiceImpl;
import org.nl.acs.route.service.RouteLineService; import org.nl.acs.route.service.RouteLineService;
import org.nl.acs.route.service.dto.RouteLineDto; import org.nl.acs.route.service.dto.RouteLineDto;
import org.nl.acs.task.enums.TaskStatusEnum; import org.nl.acs.task.enums.TaskStatusEnum;
@@ -71,6 +71,8 @@ public class UnBoxLableConveyorDeviceDriver extends AbstractOpcDeviceDriver impl
NDCAgvService agvService = SpringContextHolder.getBean(NDCAgvService.class); NDCAgvService agvService = SpringContextHolder.getBean(NDCAgvService.class);
DeviceErrorLogService deviceErrorLogService = SpringContextHolder.getBean(DeviceErrorLogServiceImpl.class); DeviceErrorLogService deviceErrorLogService = SpringContextHolder.getBean(DeviceErrorLogServiceImpl.class);
DeviceAppService deviceAppService = SpringContextHolder.getBean(DeviceAppServiceImpl.class);
//当前指令 //当前指令
Instruction inst = null; Instruction inst = null;
@@ -192,11 +194,11 @@ public class UnBoxLableConveyorDeviceDriver extends AbstractOpcDeviceDriver impl
} }
List toInstructions; List toInstructions;
Instruction instruction = instructionService.findByCode(String.valueOf(task));
//空箱出库开盖位,申请开盖 //空箱出库开盖位,申请开盖
if (mode == 7 && move == 1 && task > 0) { if (mode == 7 && move == 1 && task > 0) {
//不允许开盖,完成出库任务,自动去扫码位 //不允许开盖,完成出库任务,自动去扫码位
if (!applyUnbox()){ if (!applyUnbox(instruction)){
Instruction instruction = instructionService.findByCode(String.valueOf(task));
if (ObjectUtil.isNotEmpty(instruction)) { if (ObjectUtil.isNotEmpty(instruction)) {
try { try {
instructionService.finish(instruction); instructionService.finish(instruction);
@@ -225,7 +227,7 @@ public class UnBoxLableConveyorDeviceDriver extends AbstractOpcDeviceDriver impl
last_to_height =to_height; last_to_height =to_height;
} }
private Boolean applyUnbox() { private Boolean applyUnbox(Instruction instruction) {
Date date = new Date(); Date date = new Date();
if (date.getTime() - this.require_apply_strangulation_time.getTime() if (date.getTime() - this.require_apply_strangulation_time.getTime()
< (long) this.instruction_require_time_out) { < (long) this.instruction_require_time_out) {
@@ -233,15 +235,20 @@ public class UnBoxLableConveyorDeviceDriver extends AbstractOpcDeviceDriver impl
return false; return false;
} else { } else {
try { try {
ApplyLabelingAndBindingRequest applyLabelingAndBindingRequest = new ApplyLabelingAndBindingRequest();
JSONObject param = new JSONObject(); JSONObject param = new JSONObject();
param.put("device_code", device_code); param.put("device_code", device_code);
param.put("task", task); param.put("task", task);
logServer.deviceExecuteLog(this.device_code, "", "", "木箱申请开盖任务,参数:" + param); logServer.deviceExecuteLog(this.device_code, "", "", "木箱申请开盖任务,参数:" + param);
HttpResponse response = acsToWmsService.shipDeviceUpdate(param); ApplyLabelingAndBindingResponse response = acsToWmsService.applyLabelingAndBindingRequest(applyLabelingAndBindingRequest);
if (response == null || response.getStatus() == 200) { if (response == null || response.getstatus() == 200) {
logServer.deviceExecuteLog(this.device_code, "", "", "木箱申请开盖任务,接口返回:" + response.body()); Map datas = response.getData();
packagePLCData(datas,instruction);
this.setRequireSucess(true);
return true; return true;
} }
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
@@ -249,6 +256,64 @@ public class UnBoxLableConveyorDeviceDriver extends AbstractOpcDeviceDriver impl
return false; return false;
} }
private void packagePLCData(Map datas, Instruction instruction) {
String length = datas.get("length").toString();
String weight = datas.get("weight").toString();
String height = datas.get("height").toString();
String printQty = datas.get("printQty").toString();
String printDevice = datas.get("printDevice").toString();
String bundleTimes = datas.get("bundleTimes").toString();
String next_device_code = instruction.getNext_device_code();
Device nextDevice = deviceAppService.findDeviceByCode(next_device_code);
String next_addr = nextDevice.getExtraValue().get("address").toString();
List list = new ArrayList();
Map map = new HashMap();
map.put("code", "to_task");
map.put("value", task);
list.add(map);
Map map2 = new HashMap();
map2.put("code", "to_container_type");
map2.put("value", instruction.getVehicle_code());
list.add(map2);
Map map3 = new HashMap();
map3.put("code", "to_target");
map3.put("value", next_addr);
list.add(map3);
Map map4 = new HashMap();
map4.put("code", "to_leight");
map4.put("value", length);
list.add(map4);
Map map5 = new HashMap();
map5.put("code", "to_wedth");
map5.put("value", weight);
list.add(map5);
Map map6 = new HashMap();
map6.put("code", "to_height");
map6.put("value", height);
list.add(map6);
Map map7 = new HashMap();
map7.put("code", "to_print_qty");
map7.put("value", printQty);
list.add(map7);
Map map9 = new HashMap();
map9.put("code", "to_print_device");
map9.put("value", printDevice);
list.add(map9);
Map map11 = new HashMap();
map11.put("code", "to_binding_times");
map11.put("value", bundleTimes);
list.add(map11);
try {
this.writing(list);
} catch (Exception e) {
message = "写入信号失败";
}
this.setRequireSucess(true);
}
public boolean exe_error() { public boolean exe_error() {
if (this.error == 0) { if (this.error == 0) {
return true; return true;

View File

@@ -9,7 +9,7 @@ public class ApplyLabelingAndBindingRequest extends BaseRequest {
/** /**
* 1:贴标、捆扎申请 * 1:贴标、捆扎申请
* 2:烘箱 * 2:烘箱
* * 3:开盖
*/ */
private String type; private String type;