Merge remote-tracking branch 'origin/master'

# Conflicts:
#	acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/plug_pull_device_site/PlugPullDeviceSiteDeviceDriver.java
#	acs2/nladmin-ui/src/views/system/monitor/device/index.vue
This commit is contained in:
2024-02-29 10:37:12 +08:00
37 changed files with 527 additions and 327 deletions

View File

@@ -1,5 +1,6 @@
package org.nl.acs.common.base;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
import com.baomidou.mybatisplus.extension.conditions.query.QueryChainWrapper;
@@ -7,6 +8,7 @@ import com.baomidou.mybatisplus.extension.conditions.update.LambdaUpdateChainWra
import com.baomidou.mybatisplus.extension.conditions.update.UpdateChainWrapper;
import com.baomidou.mybatisplus.extension.toolkit.ChainWrappers;
import org.apache.ibatis.annotations.Mapper;
import org.nl.acs.instruction.domain.Instruction;
/**
* 公共抽象Mapper接口类

View File

@@ -291,14 +291,12 @@ public class BeltConveyorDeviceDriver extends AbstractOpcDeviceDriver implements
break;
case 5:
//申请AGV任务
//TODO 申请AGV任务待确认
if (move == 1 && !requireSucess) {
applyAgvTask();
}
break;
case 6:
//二楼到一楼输送线申请行架任务
//TODO 申请行架任务
if (move == 1 && !requireSucess) {
applyManipulatorTask();
}
@@ -327,26 +325,31 @@ public class BeltConveyorDeviceDriver extends AbstractOpcDeviceDriver implements
private void applyManipulatorTask() {
JSONObject param = new JSONObject();
param.put("device_code", device_code);
param.put("material_barcode", material_barcode);
logServer.deviceExecuteLog(this.device_code, "", "", "二楼到一楼输送线申请行架任务,参数:" + param);
String response = acsToWmsService.applyTowToOne(param);
JSONObject jo = JSON.parseObject(response);
if (response == null || jo.getInteger("status") == 200) {
LuceneLogDto logDto2 = LuceneLogDto.builder()
.device_code(device_code)
.content("二楼到一楼输送线申请行架任务,参数,接口返回:" + jo)
.build();
luceneExecuteLogService.deviceExecuteLog(logDto2);
this.requireSucess = true;
}else {
LuceneLogDto logDto2 = LuceneLogDto.builder()
.device_code(device_code)
.content("二楼到一楼输送线申请行架任务,返回参数:" + jo.getString("body"))
.build();
luceneExecuteLogService.deviceExecuteLog(logDto2);
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;
} else {
JSONObject param = new JSONObject();
param.put("device_code", device_code);
param.put("material_barcode", material_barcode);
logServer.deviceExecuteLog(this.device_code, "", "", "二楼到一楼输送线申请行架任务,参数:" + param);
String response = acsToWmsService.applyTowToOne(param);
JSONObject jo = JSON.parseObject(response);
if (response == null || jo.getInteger("status") == 200) {
LuceneLogDto logDto2 = LuceneLogDto.builder()
.device_code(device_code)
.content("二楼到一楼输送线申请行架任务,参数,接口返回:" + jo)
.build();
luceneExecuteLogService.deviceExecuteLog(logDto2);
this.requireSucess = true;
} else {
LuceneLogDto logDto2 = LuceneLogDto.builder()
.device_code(device_code)
.content("二楼到一楼输送线申请行架任务,返回参数:" + jo.getString("body"))
.build();
luceneExecuteLogService.deviceExecuteLog(logDto2);
}
}
}
@@ -371,10 +374,8 @@ public class BeltConveyorDeviceDriver extends AbstractOpcDeviceDriver implements
if (StrUtil.equals(paramService.findByCode(AcsConfig.HASWMS).getValue(), "1")) {
//判断是否有手动补码 如果有就申请补码agv任务
if (StrUtil.isNotEmpty(hand_barcode)) {
message = "申请补码AGV搬运任务中...";
JSONObject apply = new JSONObject();
apply.put("device_code", device_code);
apply.put("type", AcsToLmsApplyTaskTypeEnum.AGV.getType());
apply.put("vehicle_code", hand_barcode);
String str = acsToWmsService.applyTaskToWms(apply);
@@ -385,10 +386,10 @@ public class BeltConveyorDeviceDriver extends AbstractOpcDeviceDriver implements
.build();
luceneExecuteLogService.deviceExecuteLog(logDto2);
if (ObjectUtil.isEmpty(jo)) {
message = "申请补码AGV搬运任务接口不通";
message = LangProcess.msg("one_message15");
} else {
if (jo.getInteger("status") == 200) {
message = "申请补码AGV搬运任务成功";
message = LangProcess.msg("one_message16");
List list = new ArrayList();
while (!StrUtil.equals(this.getOpcValueAccessor().getValue(this.getOpcServer() + "." + this.getOpcPlc() + "." + this.getDevice_code() + ".to_command").toString()
, "8")) {
@@ -407,38 +408,26 @@ public class BeltConveyorDeviceDriver extends AbstractOpcDeviceDriver implements
luceneExecuteLogService.deviceExecuteLog(logDto);
requireSucess = true;
} else {
message = "申请补码AGV搬运任务失败," + jo.get("message").toString();
message = LangProcess.msg("one_message17") + jo.get("message").toString();
}
}
return;
}
//没有就正常申请agv任务
Instruction instruction = instructionService.findByCode(String.valueOf(task));
if (ObjectUtil.isEmpty(instruction)) {
message = "指令号" + task + "未找到对应指令";
return;
}
if (StrUtil.isEmpty(instruction.getVehicle_code())) {
message = "指令号" + task + "未找到对应木箱号";
return;
}
message = "申请AGV搬运任务中...";
JSONObject apply = new JSONObject();
apply.put("device_code", device_code);
apply.put("type", AcsToLmsApplyTaskTypeEnum.AGV.getType());
apply.put("vehicle_code", instruction.getVehicle_code());
apply.put("vehicle_code", barcode);
String str = acsToWmsService.applySendOutTwo(apply);
logServer.deviceExecuteLog(this.device_code, "", "", "申请AGV任务,请求参数:" + apply + ",响应参数");
JSONObject jo = JSON.parseObject(str);
if (ObjectUtil.isEmpty(jo)) {
message = "申请AGV搬运任务接口不通";
message = LangProcess.msg("one_message15");
// requireSucess = true;
} else {
if (jo.getInteger("status") == 200) {
message = "申请AGV搬运任务成功";
message = LangProcess.msg("one_message16");
List list = new ArrayList();
Map map = new HashMap();
map.put("code", "to_command");
@@ -458,7 +447,7 @@ public class BeltConveyorDeviceDriver extends AbstractOpcDeviceDriver implements
logServer.deviceExecuteLog(this.device_code, "", "", "申请AGV任务,返回参数:" + jo);
requireSucess = true;
} else {
message = "申请AGV搬运任务失败," + jo.get("message").toString();
message = LangProcess.msg("one_message17") + jo.get("message").toString();
}
}
@@ -469,60 +458,6 @@ public class BeltConveyorDeviceDriver extends AbstractOpcDeviceDriver implements
/*public synchronized void request_for_shipment(String mode, String item_out_seq_arr, int[] item_out_qty_arr) {
Date date = new Date();
if (date.getTime() - this.require_apply_strangulation_time.getTime() < (long) this.instruction_require_time_out) {
log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out);
} else {
this.require_apply_strangulation_time = date;
ApplyPaperActionRequest applyPaperActionRequest = new ApplyPaperActionRequest();
applyPaperActionRequest.setDevice_code(this.device_code);
applyPaperActionRequest.setType(CommonFinalParam.ONE);
applyPaperActionRequest.setTask_code(String.valueOf(task));
//获取出库顺序
boolean contains = item_out_seq_arr.contains(",");
boolean contains1 = item_out_seq_arr.contains("");
if (contains) {
String[] split = item_out_seq_arr.split(",");
applyPaperActionRequest.setMaterial1(split[0]);
applyPaperActionRequest.setMaterial1(split[1]);
} else if (contains1) {
String[] split = item_out_seq_arr.split("");
applyPaperActionRequest.setMaterial1(split[0]);
applyPaperActionRequest.setMaterial1(split[1]);
} else {
applyPaperActionRequest.setMaterial1(item_out_seq_arr);
}
if (item_out_qty_arr.length >= 1 && item_out_qty_arr.length < 4) {
applyPaperActionRequest.setQty1(String.valueOf(item_out_qty_arr[0]));
applyPaperActionRequest.setQty2(String.valueOf(item_out_qty_arr[1]));
}
ApplyPaperActionResponse applyPaperActionResponse = acsToWmsService.applyPaperActionRequest(applyPaperActionRequest);
if (ObjectUtil.isNull(applyPaperActionResponse)) {
message = "请求失败";
requireSucess = false;
return;
}
Map map3 = new HashMap();
if (applyPaperActionResponse.getstatus() == 200) {
map3.put("to_command", "4");
this.writing(map3);
requireSucess = true;
logServer.deviceExecuteLog(this.device_code, "", "", "申请出纸管,返回参数:" + applyPaperActionResponse);
message = "申请出货成功";
} else {
message = applyPaperActionResponse.getMessage();
map3.put("to_command", "5");
this.writing(map3);
requireSucess = false;
message = "出库顺序错误";
logServer.deviceExecuteLog(this.device_code, "", "", "申请出纸管,返回参数:" + applyPaperActionResponse);
}
}
}
*/
/**
* 申请任务
*/

View File

@@ -76,6 +76,11 @@ public class ItemProtocol {
*/
public static String item_to_target = "to_target";
/**
* 托盘条码
*/
public static String item_barcode = "barcode";
@@ -128,6 +133,11 @@ public class ItemProtocol {
return this.getOpcIntegerValue(item_to_task);
}
public String getBarcode() {
return this.getOpcStringValue(item_barcode);
}
public int getTotarget() {
return this.getOpcIntegerValue(item_to_target);
@@ -192,7 +202,8 @@ public class ItemProtocol {
list.add(new ItemDto(item_action, "动作类型", "DB101.B6"));
list.add(new ItemDto(item_error, "报警", "DB101.B58"));
list.add(new ItemDto(item_task, "任务号", "DB101.D68"));
list.add(new ItemDto(item_material_barcode, "子卷条码", "DB1.B12"));
list.add(new ItemDto(item_material_barcode, "子卷条码", "DB601.STRING1.50"));
list.add(new ItemDto(item_barcode, "托盘条码", "DB602.STRING1.50"));
return list;
}

View File

@@ -4,8 +4,8 @@ import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
import lombok.Data;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
@@ -20,8 +20,6 @@ import org.nl.acs.device_driver.RouteableDeviceDriver;
import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver;
import org.nl.acs.device_driver.driver.ExecutableDeviceDriver;
import org.nl.acs.enums.AcsToLmsApplyTaskTypeEnum;
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.history.ErrorUtil;
import org.nl.acs.history.service.DeviceErrorLogService;
@@ -33,7 +31,6 @@ import org.nl.acs.monitor.DeviceStageMonitor;
import org.nl.acs.opc.DeviceAppService;
import org.nl.acs.route.service.RouteLineService;
import org.nl.acs.route.service.dto.RouteLineDto;
import org.nl.acs.storage_cell.domain.StorageCell;
import org.nl.acs.storage_cell.service.mapper.StorageCellMapper;
import org.nl.acs.task.enums.TaskStatusEnum;
import org.nl.acs.task.service.TaskService;
@@ -44,7 +41,6 @@ import org.nl.config.lucene.service.LuceneExecuteLogService;
import org.nl.config.lucene.service.dto.LuceneLogDto;
import org.nl.config.thread.ThreadPoolExecutorUtil;
import org.openscada.opc.lib.da.Server;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.*;
import java.util.concurrent.ThreadPoolExecutor;
@@ -80,8 +76,8 @@ public class FinishedProductOutBindLableDeviceDriver extends AbstractOpcDeviceDr
DeviceErrorLogService deviceErrorLogService = SpringContextHolder.getBean(DeviceErrorLogServiceImpl.class);
@Autowired
LuceneExecuteLogService luceneExecuteLogService;
LuceneExecuteLogService luceneExecuteLogService = SpringContextHolder.getBean(LuceneExecuteLogService.class);
//当前指令
Instruction inst = null;
@@ -123,6 +119,10 @@ public class FinishedProductOutBindLableDeviceDriver extends AbstractOpcDeviceDr
int to_height = 0;
int last_to_height = 0;
//托盘条码
String barcode = null;
String last_barcode = null;
String material_barcode = null;
String last_material_barcode = null;
@@ -164,8 +164,7 @@ public class FinishedProductOutBindLableDeviceDriver extends AbstractOpcDeviceDr
String device_code;
String vehicle_code;
String last_vehicle_code;
@Override
public Device getDevice() {
@@ -187,6 +186,7 @@ public class FinishedProductOutBindLableDeviceDriver extends AbstractOpcDeviceDr
to_task = this.itemProtocol.getTo_task();
heartbeat = this.itemProtocol.getHeartbeat();
material_barcode = this.itemProtocol.getMaterialBarCode();
barcode = this.itemProtocol.getBarcode();
if (mode != last_mode) {
JSONObject param = new JSONObject();
@@ -268,76 +268,53 @@ public class FinishedProductOutBindLableDeviceDriver extends AbstractOpcDeviceDr
return;
} else {
this.require_apply_strangulation_time = date;
String vehicle_code = "";
if (task > 0) {
Instruction instruction = instructionService.findByCodeFromCache(String.valueOf(task));
if (ObjectUtil.isEmpty(instruction)) {
message = LangProcess.msg("one_message8") + ": " + task + LangProcess.msg("one_message9");
return;
}
vehicle_code = instruction.getVehicle_code();
} else {
message = LangProcess.msg("one_message8") + ": " + task + LangProcess.msg("one_message10");
return;
}
if (StrUtil.isEmpty(vehicle_code)) {
message = LangProcess.msg("one_message8") + ": " + task + LangProcess.msg("one_message11");
return;
}
ApplyLabelingAndBindingRequest applyLabelingAndBindingRequest =
new ApplyLabelingAndBindingRequest();
StorageCell storageCell = new LambdaQueryChainWrapper<>(storageCellMapper)
.eq(StorageCell::getStorage_code, this.device_code)
.one();
String start_point_code = null;
if (!ObjectUtil.isEmpty(storageCell)) {
start_point_code = (String) storageCell.getParent_storage_code() == null ? this.device_code : (String) storageCell.getParent_storage_code();
}
applyLabelingAndBindingRequest.setDevice_code(start_point_code);
applyLabelingAndBindingRequest.setType(AcsToLmsApplyTaskTypeEnum.LABEL_BIND.getType());
applyLabelingAndBindingRequest.setVehicle_code(vehicle_code);
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content("申请贴标捆扎信息,参数:" + applyLabelingAndBindingRequest)
.build();
luceneExecuteLogService.deviceExecuteLog(logDto);
ApplyLabelingAndBindingResponse applyLabelingAndBindingResponse = acsToWmsService.applyLabelingAndBindingRequest(applyLabelingAndBindingRequest);
if (applyLabelingAndBindingResponse.getstatus() == 200) {
if (ObjectUtil.isNotEmpty(applyLabelingAndBindingResponse.getData())) {
// String vehicle_code = "";
//
// if (StrUtil.isEmpty(vehicle_code)) {
// message = LangProcess.msg("one_message8") + ": " + task + LangProcess.msg("one_message11");
// return;
// }
JSONObject param = new JSONObject();
param.put("device_code", device_code);
param.put("vehicle_code", material_barcode);
param.put("type", AcsToLmsApplyTaskTypeEnum.LABEL_BIND.getType());
String response = acsToWmsService.deviceApplyTwo(param);
JSONObject jo = JSON.parseObject(response);
if (StrUtil.isNotEmpty(jo.getString("body")) || jo.getInteger("status") == 200) {
LuceneLogDto logDto2 = LuceneLogDto.builder()
.device_code(device_code)
.content("申请贴标捆扎信息,接口返回:" + applyLabelingAndBindingResponse.getData())
.content("申请捆扎,参数,接口返回:" + jo)
.build();
luceneExecuteLogService.deviceExecuteLog(logDto2);
Map datas = applyLabelingAndBindingResponse.getData();
packagePLCData(datas);
// Map datas = applyLabelingAndBindingResponse.getData();
packagePLCData(jo.getString("body"));
requireSucess = true;
} else {
LuceneLogDto logDto2 = LuceneLogDto.builder()
.device_code(device_code)
.content("申请捆扎失败,接口返回:" + applyLabelingAndBindingResponse.getData())
.content("申请捆扎失败,接口返回:" + jo.getString("body"))
.build();
luceneExecuteLogService.deviceExecuteLog(logDto2);
}
} else {
message = applyLabelingAndBindingResponse.getMessage();
}
}
}
private void packagePLCData(Map datas) {
String length = datas.get("length").toString();
String weight = datas.get("weight").toString();
String height = datas.get("height").toString();
String isBinding = datas.get("isBinding").toString();
String isLabeling = datas.get("isLabeling").toString();
String printQty = datas.get("printQty").toString();
String labelingTemplate = datas.get("labelingTemplate").toString();
String bindingTemplate = datas.get("bindingTemplate").toString();
String printDevice = datas.get("printDevice").toString();
String bundleTimes = datas.get("bundleTimes").toString();
private void packagePLCData(String datas) {
JSONObject jo = JSON.parseObject(datas);
String length = jo.get("length").toString();
String weight = jo.get("weight").toString();
String height = jo.get("height").toString();
String isBinding = jo.get("isBinding").toString();
String isLabeling = jo.get("isLabeling").toString();
String printQty = jo.get("printQty").toString();
String labelingTemplate = jo.get("labelingTemplate").toString();
String bindingTemplate = jo.get("bindingTemplate").toString();
String printDevice = jo.get("printDevice").toString();
String bundleTimes = jo.get("bundleTimes").toString();
List list = new ArrayList();
Map map = new HashMap();
@@ -358,7 +335,7 @@ public class FinishedProductOutBindLableDeviceDriver extends AbstractOpcDeviceDr
list.add(map4);
Map map5 = new HashMap();
map5.put("code", "to_command");
map5.put("value", "10");
map5.put("value", 10);
list.add(map5);
Map map6 = new HashMap();
map6.put("code", "to_is_labeling");
@@ -483,7 +460,7 @@ public class FinishedProductOutBindLableDeviceDriver extends AbstractOpcDeviceDr
jo.put("isError", this.getIserror());
jo.put("message", this.getMessage());
jo.put("hand_barcode", hand_barcode);
jo.put("barcode", this.getMove() == 0 ? null : checkInst() == null ? vehicle_code : checkInst().getVehicle_code());
jo.put("barcode", this.getMove() == 0 ? null : checkInst() == null ? barcode : checkInst().getVehicle_code());
jo.put("is_click", true);
jo.put("requireSucess", requireSucess);
jo.put("driver_type", "siemens_conveyor");
@@ -751,7 +728,6 @@ public class FinishedProductOutBindLableDeviceDriver extends AbstractOpcDeviceDr
inst = checkInst();
if (inst != null) {
inst_message = "当前指令号:" + inst.getInstruction_code() + " " + inst.getStart_point_code() + "->" + inst.getNext_point_code() + " 载具号:" + inst.getVehicle_code();
vehicle_code = inst.getVehicle_code();
task_code = inst.getTask_code();
if (StrUtil.equals(inst.getInstruction_status(), "0") && StrUtil.equals(this.getDeviceCode(), inst.getStart_device_code())) {
inst.setInstruction_status("1");
@@ -761,7 +737,6 @@ public class FinishedProductOutBindLableDeviceDriver extends AbstractOpcDeviceDr
}
if (StrUtil.equals(inst.getInstruction_status(), "1") || StrUtil.equals(inst.getInstruction_status(), "0")) {
if (StrUtil.equals(this.getDeviceCode(), inst.getNext_device_code())) {
vehicle_code = inst.getVehicle_code();
inst.setExecute_device_code(this.device_code);
if (mode == 2) {
finish_instruction();

View File

@@ -48,6 +48,11 @@ public class ItemProtocol {
*/
public static String item_task = "task";
/**
* 托盘条码
*/
public static String item_barcode = "barcode";
/**
* 动作信号
*/
@@ -175,7 +180,9 @@ public class ItemProtocol {
return this.getOpcIntegerValue(item_action);
}
public String getBarcode() {
return this.getOpcStringValue(item_barcode);
}
Boolean isonline;
@@ -218,7 +225,8 @@ public class ItemProtocol {
list.add(new ItemDto(item_error, "报警信号", "DB600.B6"));
list.add(new ItemDto(item_container_type, "托盘类型", "DB101.B7"));
list.add(new ItemDto(item_task, "任务号", "DB600.D8"));
list.add(new ItemDto(item_material_barcode, "物料条码", "DB600.D9"));
list.add(new ItemDto(item_material_barcode, "物料条码", "DB81.STRING14.50"));
list.add(new ItemDto(item_barcode, "托盘条码", "DB602.STRING1.50"));
return list;
}

View File

@@ -6,6 +6,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.Data;
import lombok.RequiredArgsConstructor;
@@ -73,8 +74,7 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv
DeviceAppService deviceAppservice = SpringContextHolder.getBean(DeviceAppService.class);
@Autowired
LuceneExecuteLogService luceneExecuteLogService;
LuceneExecuteLogService luceneExecuteLogService = SpringContextHolder.getBean(LuceneExecuteLogService.class);
//工作模式
int mode = 0;
int last_mode = 0;
@@ -244,7 +244,12 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv
List toInstructions;
//木箱入库申请入库任务
if (mode == 6 && !requireSucess){
applyIn();
applyIn(StorageTypeEnum.BOX_IN.getType());
}
//子卷入库申请入库任务
if (mode == 7 && !requireSucess){
applyIn(StorageTypeEnum.STORAGE.getType());
}
//申请入库指令、异常位指令
@@ -331,7 +336,7 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv
}
}
private void applyIn() {
private void applyIn(String type) {
Date date = new Date();
if (date.getTime() - this.require_apply_strangulation_time.getTime()
< (long) this.instruction_require_time_out) {
@@ -339,17 +344,34 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv
return;
} else {
try {
JSONObject param = new JSONObject();
param.put("device_code", device_code);
param.put("vehicle_code", barcode);
param.put("material_barcode", material_barcode);
param.put("type", StorageTypeEnum.STORAGE.getType());
logServer.deviceExecuteLog(this.device_code, "", "", "木箱入库申请入库任务,参数:" + param);
HttpResponse response = acsToWmsService.shipDeviceUpdate(param);
if (response == null || response.getStatus() == 200) {
logServer.deviceExecuteLog(this.device_code, "", "", "木箱入库申请入库任务,接口返回:" + response.body());
JSONObject param = new JSONObject();
param.put("device_code", device_code);
param.put("vehicle_code", barcode);
param.put("material_barcode", material_barcode);
param.put("type", type);
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content("申请空托盘出入库,参数:" + param)
.build();
luceneExecuteLogService.deviceExecuteLog(logDto);
String response = acsToWmsService.applyTwo(param);
JSONObject jo = JSON.parseObject(response);
if (response == null || jo.getInteger("status") == 200) {
LuceneLogDto logDto2 = LuceneLogDto.builder()
.device_code(device_code)
.content("木箱入库申请入库任务,参数,接口返回:" + jo)
.build();
luceneExecuteLogService.deviceExecuteLog(logDto2);
this.requireSucess = true;
}else {
LuceneLogDto logDto2 = LuceneLogDto.builder()
.device_code(device_code)
.content("木箱入库申请入库任务,返回参数:" + jo.getString("body"))
.build();
luceneExecuteLogService.deviceExecuteLog(logDto2);
}
}
} catch (Exception e) {
catch (Exception e) {
e.printStackTrace();
}
}

View File

@@ -191,8 +191,8 @@ public class ItemProtocol {
list.add(new ItemDto(item_carrier_direction, "托盘方向", "DB1.B8"));
list.add(new ItemDto(item_qty, "数量", "DB1.B9"));
list.add(new ItemDto(item_weight, "重量", "DB1.B10"));
list.add(new ItemDto(item_barcode, "托盘条码", "DB1.B11"));
list.add(new ItemDto(item_material_barcode, "子卷条码", "DB1.B12"));
list.add(new ItemDto(item_barcode, "托盘条码", "DB602.STRING1.50"));
list.add(new ItemDto(item_material_barcode, "子卷条码", "DB601.STRING1.50"));
return list;
}

View File

@@ -23,9 +23,15 @@ public class InteractionJsonDTO {
*/
private String template;
/**
*是否是最后一个
*是否离开
*/
private String isLastOne;
private String isLeave;
/**
*捆扎次数
*/
private String bindingTimes;
/**
*是否捆轧

View File

@@ -449,8 +449,8 @@ public class TrappedManipulatorManipulatorDeviceDriver extends AbstractOpcDevice
list.add(map8);
}
if (ObjectUtil.isNotEmpty(interactionJsonDTO.getTemplate())) {
map9.put("code", "to_last_one");
map9.put("value", interactionJsonDTO.getIsLastOne());
map9.put("code", "to_is_leave");
map9.put("value", interactionJsonDTO.getIsLeave());
list.add(map9);
}
if (ObjectUtil.isNotEmpty(interactionJsonDTO.getIsBinding())) {

View File

@@ -0,0 +1,25 @@
package org.nl.acs.device_driver.stacker.standard_stacker;
import lombok.AllArgsConstructor;
import lombok.Getter;
@Getter
@AllArgsConstructor
public enum StandarStirageErroEnum {
FILL("1", "入库货位满"),
VOIDANCE("2", "出库货位空"),
BLOCK_OUT("3", "取货潜货位阻挡"),
BLOCK_IN("4", "放货潜货位阻挡");
/**
* 索引
*/
private String type;
/**
* 编码
*/
private String value;
}

View File

@@ -5,6 +5,8 @@ import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
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.Data;
import lombok.RequiredArgsConstructor;
@@ -21,6 +23,8 @@ import org.nl.acs.device_driver.conveyor.belt_conveyor.BeltConveyorDeviceDriver;
import org.nl.acs.device_driver.conveyor.siemens_conveyor.SiemensConveyorDeviceDriver;
import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver;
import org.nl.acs.device_driver.driver.ExecutableDeviceDriver;
import org.nl.acs.ext.wms.service.AcsToWmsService;
import org.nl.acs.ext.wms.service.impl.AcsToWmsServiceImpl;
import org.nl.acs.history.ErrorUtil;
import org.nl.acs.history.domain.AcsDeviceErrorLog;
import org.nl.acs.history.service.DeviceErrorLogService;
@@ -35,10 +39,13 @@ import org.nl.acs.opc.DeviceAppServiceImpl;
import org.nl.acs.route.service.RouteLineService;
import org.nl.acs.route.service.dto.RouteLineDto;
import org.nl.acs.route.service.impl.RouteLineServiceImpl;
import org.nl.acs.task.domain.Task;
import org.nl.acs.task.service.TaskService;
import org.nl.acs.task.service.dto.TaskDto;
import org.nl.config.SpringContextHolder;
import org.nl.config.language.LangProcess;
import org.nl.config.lucene.service.LuceneExecuteLogService;
import org.nl.config.lucene.service.dto.LuceneLogDto;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.*;
@@ -67,6 +74,9 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
@Autowired
DeviceErrorLogService errorLogServer = SpringContextHolder.getBean(DeviceErrorLogServiceImpl.class);
AcsToWmsService acsToWmsService = SpringContextHolder.getBean(AcsToWmsServiceImpl.class);
LuceneExecuteLogService luceneExecuteLogService = SpringContextHolder.getBean("luceneExecuteLogServiceImpl");
/**
* 禁止入库
@@ -344,19 +354,21 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
message = LangProcess.msg("universal_message3");
//指定库位满入
if (error == 5) {
applyUpdatePointCode(StandarStirageErroEnum.FILL.getType());
}
//空出
if (error == 6) {
applyUpdatePointCode(StandarStirageErroEnum.VOIDANCE.getType());
}
//浅货位有货
if (error == 16) {
//放货
if (cargoMove == 1) {
applyUpdatePointCode(StandarStirageErroEnum.BLOCK_OUT.getType());
} else if (cargoMove == 0) {
//取货
applyUpdatePointCode(StandarStirageErroEnum.BLOCK_IN.getType());
}
@@ -543,6 +555,91 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
last_fork_runingTimes = fork_runingTimes;*/
}
/**
* 申请更新点位
* @param type
*/
private void applyUpdatePointCode(String type) {
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;
} else {
Instruction instruction = instructionService.findByCode(String.valueOf(task));
if (ObjectUtil.isNotEmpty(instruction)){
message = LangProcess.msg("one_message9");
return;
}
JSONObject param = new JSONObject();
param.put("task_code", instruction.getTask_code());
param.put("type", type);
String response = acsToWmsService.applyUpdatePointCode(param);
JSONObject jo = JSON.parseObject(response);
if (StrUtil.isNotEmpty(jo.getString("body")) || jo.getInteger("status") == 200) {
LuceneLogDto logDto2 = LuceneLogDto.builder()
.device_code(device_code)
.content("申请更新点位,参数,接口返回:" + jo)
.build();
luceneExecuteLogService.deviceExecuteLog(logDto2);
JSONObject pointCodeJson = JSON.parseObject(jo.getString("body"));
String poinCode = pointCodeJson.getString("poin_code").toString();
if (type.equals(StandarStirageErroEnum.BLOCK_OUT.getType()) || type.equals(StandarStirageErroEnum.VOIDANCE.getType())){
updateData1(poinCode, instruction);
}
if (type.equals(StandarStirageErroEnum.BLOCK_IN.getType()) || type.equals(StandarStirageErroEnum.FILL.getType())){
updateData2(poinCode, instruction);
}
this.requireSucess = true;
} else {
LuceneLogDto logDto2 = LuceneLogDto.builder()
.device_code(device_code)
.content("申请更新点位,返回参数:" + jo.getString("body"))
.build();
luceneExecuteLogService.deviceExecuteLog(logDto2);
}
}
}
private void updateData2(String poinCode, Instruction instruction) {
Instruction instructionUpdate = new Instruction();
instructionUpdate.setNext_point_code(poinCode);
String[] split = poinCode.split("-");
Device endPoint = deviceAppService.findDeviceByCode(split[0]);
instructionUpdate.setTo_x(endPoint.getExtraValue().get("x").toString());
instructionUpdate.setNext_device_code(split[0]);
instructionUpdate.setTo_y(split[1]);
instructionUpdate.setTo_z(split[2]);
instructionUpdate.setInstruction_code(String.valueOf(task));
instructionService.updateByInstructionCode(instructionUpdate);
Task taskUpdate = new Task();
taskUpdate.setTo_x(endPoint.getExtraValue().get("x").toString());
taskUpdate.setNext_device_code(split[0]);
taskUpdate.setTo_y(split[1]);
taskUpdate.setTo_z(split[2]);
taskUpdate.setTask_code(instruction.getTask_code());
taskserver.updateByTaskCode(taskUpdate);
}
private void updateData1(String poinCode, Instruction instruction) {
Instruction instructionUpdate = new Instruction();
instructionUpdate.setStart_point_code(poinCode);
String[] split = poinCode.split("-");
Device starPoint = deviceAppService.findDeviceByCode(split[0]);
instructionUpdate.setFrom_x(starPoint.getExtraValue().get("x").toString());
instructionUpdate.setStart_device_code(split[0]);
instructionUpdate.setFrom_y(split[1]);
instructionUpdate.setFrom_z(split[2]);
instructionUpdate.setInstruction_code(String.valueOf(task));
instructionService.updateByInstructionCode(instructionUpdate);
Task taskUpdate = new Task();
taskUpdate.setFrom_x(starPoint.getExtraValue().get("x").toString());
taskUpdate.setStart_device_code(split[0]);
taskUpdate.setFrom_y(split[1]);
taskUpdate.setFrom_z(split[2]);
taskUpdate.setTask_code(instruction.getTask_code());
taskserver.updateByTaskCode(taskUpdate);
}
/**
* 申请任务

View File

@@ -71,7 +71,7 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
@Autowired
DeviceErrorLogService deviceErrorLogService = SpringContextHolder.getBean(DeviceErrorLogServiceImpl.class);
@Autowired
private LimitRegionalService limitRegionalService=SpringContextHolder.getBean(LimitRegionalService.class);
private LimitRegionalService limitRegionalService = SpringContextHolder.getBean(LimitRegionalService.class);
@Autowired
LuceneExecuteLogService luceneExecuteLogService = SpringContextHolder.getBean(LuceneExecuteLogService.class);
@@ -177,51 +177,11 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
y_position = this.itemProtocol.getY_position();
iserror = this.itemProtocol.device_status;
if (to_onset != last_to_onset) {
logServer.deviceExecuteLog(this.device_code, "", "", "信号to_onset" + last_to_onset + "->" + to_onset);
}
if (to_command != last_to_command) {
logServer.deviceExecuteLog(this.device_code, "", "", "信号to_command" + last_to_command + "->" + to_command);
}
if (to_target != last_to_target) {
logServer.deviceExecuteLog(this.device_code, "", "", "信号to_target" + last_to_target + "->" + to_target);
}
if (to_task != last_to_task) {
logServer.deviceExecuteLog(this.device_code, "", "", "信号to_task" + last_to_task + "->" + to_task);
}
if (mode != last_mode) {
if(mode != last_mode){
requireSucess = false;
logServer.deviceItemValue(this.device_code, "mode", String.valueOf(mode));
logServer.deviceExecuteLog(this.device_code, "", "", "信号mode" + last_mode + "->" + mode);
}
if (move != last_move) {
logServer.deviceItemValue(this.device_code, "move", String.valueOf(move));
logServer.deviceExecuteLog(this.device_code, "", "", "信号move" + last_move + "->" + move);
}
if (action != last_action) {
logServer.deviceItemValue(this.device_code, "action", String.valueOf(action));
logServer.deviceExecuteLog(this.device_code, "", "", "信号action" + last_action + "->" + action);
}
if (error != last_error) {
logServer.deviceItemValue(this.device_code, "error", String.valueOf(error));
logServer.deviceExecuteLog(this.device_code, "", "", "信号error" + last_error + "->" + error);
}
if (walk_y != last_walk_y) {
logServer.deviceItemValue(this.device_code, "walk_y", String.valueOf(walk_y));
logServer.deviceExecuteLog(this.device_code, "", "", "信号walk_y" + last_walk_y + "->" + walk_y);
}
if (task != last_task) {
logServer.deviceItemValue(this.device_code, "task", String.valueOf(task));
logServer.deviceExecuteLog(this.device_code, "", "", "信号task" + last_task + "->" + task);
}
if (x_position != last_x_position) {
logServer.deviceItemValue(this.device_code, "x_position", String.valueOf(x_position));
logServer.deviceExecuteLog(this.device_code, "", "", "信号x_position" + last_x_position + "->" + x_position);
}
if (y_position != last_y_position) {
logServer.deviceItemValue(this.device_code, "y_position", String.valueOf(y_position));
logServer.deviceExecuteLog(this.device_code, "", "", "信号y_position" + last_y_position + "->" + y_position);
}
update_instruction_status();
} catch (Exception var17) {
@@ -356,32 +316,32 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
HongXiangConveyorDeviceDriver hongXiangConveyorDeviceDriver;
StandardInspectSiteDeviceDriver standardInspectSiteDeviceDriver;
OvenInspectSiteDeviceDriver ovenInspectSiteDeviceDriver;
if(startdevice.getDeviceDriver() instanceof OvenInspectSiteDeviceDriver && nextdevice.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver){
if (startdevice.getDeviceDriver() instanceof OvenInspectSiteDeviceDriver && nextdevice.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) {
ovenInspectSiteDeviceDriver = (OvenInspectSiteDeviceDriver) startdevice.getDeviceDriver();
standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) nextdevice.getDeviceDriver();
if(ovenInspectSiteDeviceDriver.getMove() != 1 || standardInspectSiteDeviceDriver.getMove() == 1){
if (ovenInspectSiteDeviceDriver.getMove() != 1 || standardInspectSiteDeviceDriver.getMove() == 1) {
notCreateInstMessage = "手动创建指令未下发电气信号原因->烘箱检测站点-普通检测站点:" + ovenInspectSiteDeviceDriver.getDevicecode() +
"无货,无法下发指令或"+standardInspectSiteDeviceDriver.getDevicecode()+ "有货,无法下发指令!" +"!指令号:" + instruction.getInstruction_code();
"无货,无法下发指令或" + standardInspectSiteDeviceDriver.getDevicecode() + "有货,无法下发指令!" + "!指令号:" + instruction.getInstruction_code();
return false;
}
//判断经过的烘箱是否关门
boolean hongxiangCloseDoor = this.hongxiangCloseDoor(start_device_code, next_device_code);
if(!hongxiangCloseDoor){
if (!hongxiangCloseDoor) {
notCreateInstMessage = "手动创建指令未下发电气信号原因->取货位:" + start_device_code + ",放货位:" + next_device_code + ",存在关联的同一列烘箱设备未关门!指令号:" + instruction.getInstruction_code();
return false;
}
}
if(nextdevice.getDeviceDriver() instanceof OvenInspectSiteDeviceDriver && startdevice.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver){
if (nextdevice.getDeviceDriver() instanceof OvenInspectSiteDeviceDriver && startdevice.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) {
ovenInspectSiteDeviceDriver = (OvenInspectSiteDeviceDriver) nextdevice.getDeviceDriver();
standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) startdevice.getDeviceDriver();
if(ovenInspectSiteDeviceDriver.getMove() != 1 || standardInspectSiteDeviceDriver.getMove() == 1){
if (ovenInspectSiteDeviceDriver.getMove() != 1 || standardInspectSiteDeviceDriver.getMove() == 1) {
notCreateInstMessage = "手动创建指令未下发电气信号原因->烘箱检测站点-普通检测站点:" + ovenInspectSiteDeviceDriver.getDevicecode() +
"无货,无法下发指令或"+standardInspectSiteDeviceDriver.getDevicecode()+ "有货,无法下发指令!" +"!指令号:" + instruction.getInstruction_code();
"无货,无法下发指令或" + standardInspectSiteDeviceDriver.getDevicecode() + "有货,无法下发指令!" + "!指令号:" + instruction.getInstruction_code();
return false;
}
//判断经过的烘箱是否关门
boolean hongxiangCloseDoor = this.hongxiangCloseDoor( next_device_code, start_device_code);
if(!hongxiangCloseDoor){
boolean hongxiangCloseDoor = this.hongxiangCloseDoor(next_device_code, start_device_code);
if (!hongxiangCloseDoor) {
notCreateInstMessage = "手动创建指令未下发电气信号原因->取货位:" + start_device_code + ",放货位:" + next_device_code + ",存在关联的同一列烘箱设备未关门!指令号:" + instruction.getInstruction_code();
return false;
}
@@ -435,9 +395,14 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
}
String start_addr = startDevice.getExtraValue().get("address").toString();
String next_addr = nextDevice.getExtraValue().get("address").toString();
logServer.deviceExecuteLog(device_code, "", "", "当前设备:" + device_code + ",下发指令:"
String msg = "当前设备:" + device_code + ",下发指令:"
+ instruction.getInstruction_code() + ",指令起点:" + instruction.getStart_device_code()
+ ",指令终点:" + instruction.getNext_device_code());
+ ",指令终点:" + instruction.getNext_device_code();
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content(msg)
.build();
luceneExecuteLogService.deviceExecuteLog(logDto);
List list = new ArrayList<>();
Map map = new HashMap();
map.put("to_onset", start_addr);
@@ -482,32 +447,32 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
HongXiangConveyorDeviceDriver hongXiangConveyorDeviceDriver;
StandardInspectSiteDeviceDriver standardInspectSiteDeviceDriver;
OvenInspectSiteDeviceDriver ovenInspectSiteDeviceDriver;
if(startdevice.getDeviceDriver() instanceof OvenInspectSiteDeviceDriver && nextdevice.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver){
if (startdevice.getDeviceDriver() instanceof OvenInspectSiteDeviceDriver && nextdevice.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) {
ovenInspectSiteDeviceDriver = (OvenInspectSiteDeviceDriver) startdevice.getDeviceDriver();
standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) nextdevice.getDeviceDriver();
if(ovenInspectSiteDeviceDriver.getMove() != 1 || standardInspectSiteDeviceDriver.getMove() == 1){
if (ovenInspectSiteDeviceDriver.getMove() != 1 || standardInspectSiteDeviceDriver.getMove() == 1) {
notCreateInstMessage = "手动创建指令未下发电气信号原因->烘箱检测站点-普通检测站点:" + ovenInspectSiteDeviceDriver.getDevicecode() +
"无货,无法下发指令或"+standardInspectSiteDeviceDriver.getDevicecode()+ "有货,无法下发指令!" +"!任务号:" + task.getTask_code();
"无货,无法下发指令或" + standardInspectSiteDeviceDriver.getDevicecode() + "有货,无法下发指令!" + "!任务号:" + task.getTask_code();
return false;
}
//判断经过的烘箱是否关门
boolean hongxiangCloseDoor = this.hongxiangCloseDoor(task.getStart_device_code(), task.getNext_device_code());
if(!hongxiangCloseDoor){
if (!hongxiangCloseDoor) {
notCreateInstMessage = "手动创建指令未下发电气信号原因->取货位:" + task.getStart_device_code() + ",放货位:" + task.getNext_device_code() + ",存在关联的同一列烘箱设备未关门!任务号:" + task.getTask_code();
return false;
}
}
if(nextdevice.getDeviceDriver() instanceof OvenInspectSiteDeviceDriver && startdevice.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver){
if (nextdevice.getDeviceDriver() instanceof OvenInspectSiteDeviceDriver && startdevice.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) {
ovenInspectSiteDeviceDriver = (OvenInspectSiteDeviceDriver) nextdevice.getDeviceDriver();
standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) startdevice.getDeviceDriver();
if(ovenInspectSiteDeviceDriver.getMove() != 1 || standardInspectSiteDeviceDriver.getMove() == 1){
if (ovenInspectSiteDeviceDriver.getMove() != 1 || standardInspectSiteDeviceDriver.getMove() == 1) {
notCreateInstMessage = "手动创建指令未下发电气信号原因->烘箱检测站点-普通检测站点:" + ovenInspectSiteDeviceDriver.getDevicecode() +
"无货,无法下发指令或"+standardInspectSiteDeviceDriver.getDevicecode()+ "有货,无法下发指令!" +"!任务号:" + task.getTask_code();
"无货,无法下发指令或" + standardInspectSiteDeviceDriver.getDevicecode() + "有货,无法下发指令!" + "!任务号:" + task.getTask_code();
return false;
}
//判断经过的烘箱是否关门
boolean hongxiangCloseDoor = this.hongxiangCloseDoor(task.getStart_device_code(), task.getNext_device_code());
if(!hongxiangCloseDoor){
if (!hongxiangCloseDoor) {
notCreateInstMessage = "手动创建指令未下发电气信号原因->取货位:" + task.getStart_device_code() + ",放货位:" + task.getNext_device_code() + ",存在关联的同一列烘箱设备未关门!任务号:" + task.getTask_code();
return false;
}
@@ -616,6 +581,9 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
}
String start_addr = startDevice.getExtraValue().get("address").toString();
String next_addr = nextDevice.getExtraValue().get("address").toString();
if(ObjectUtil.isEmpty(start_addr) || ObjectUtil.isEmpty(next_addr)){
throw new BadRequestException("设备:" + startDevice.getDevice_code() + "或设备:" + nextDevice.getDevice_code() + "地址值!");
}
String msg = "当前设备:" + device_code + ",下发指令:"
+ instdto.getInstruction_code() + ",指令起点:" + instdto.getStart_device_code()
+ ",指令终点:" + instdto.getNext_device_code();
@@ -627,16 +595,16 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
List list = new ArrayList<>();
Map map = new HashMap();
map.put("code", "to_onset");
map.put("value",StrUtil.isNotBlank(start_addr)? start_addr : "0");
map.put("value", StrUtil.isNotBlank(start_addr) ? start_addr : "0");
Map map1 = new HashMap();
map1.put("code", "to_target");
map1.put("value",StrUtil.isNotBlank(next_addr)? next_addr : "0");
map1.put("value", StrUtil.isNotBlank(next_addr) ? next_addr : "0");
Map map2 = new HashMap();
map2.put("code", "to_task");
map2.put("value",instdto.getInstruction_code());
map2.put("value", instdto.getInstruction_code());
Map map3 = new HashMap();
map3.put("code", "to_command");
map3.put("value","1");
map3.put("value", "1");
list.add(map);
list.add(map1);
list.add(map2);
@@ -667,7 +635,7 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
/**
* 判断经过的烘箱是否关门
*/
private boolean hongxiangCloseDoor(String start_device_code,String next_device_code) {
private boolean hongxiangCloseDoor(String start_device_code, String next_device_code) {
boolean flag = true;
List<String> ovenDeviceCodeList = null;
Device startDevice = deviceAppService.findDeviceByCode(start_device_code);
@@ -682,14 +650,14 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
ovenDeviceCodeList = ovenInspectSiteDeviceDriver.getExtraDeviceCodes("link_device_code");
}
HongXiangConveyorDeviceDriver hongXiangConveyorDeviceDriver;
if(CollUtil.isNotEmpty(ovenDeviceCodeList)){
if (CollUtil.isNotEmpty(ovenDeviceCodeList)) {
for (String s : ovenDeviceCodeList) {
Device device = deviceAppService.findDeviceByCode(s);
if (device.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) {
hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) device.getDeviceDriver();
//判断关联设备是否开门
if (hongXiangConveyorDeviceDriver.getDoor() == 1) {
notCreateInstMessage = "关联设备->" + device + "烘箱门未关闭!";
notCreateInstMessage = "关联设备->" + device + "烘箱门未关闭!";
flag = false;
break;
}
@@ -701,6 +669,7 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
/**
* 判断取货位或放货位为烘箱设备时关联的同一列烘箱设备是否有开门
*
* @param start_device_code
* @param next_device_code
* @return
@@ -1087,7 +1056,7 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
} else if (this.getAction() == 4) {
action = "放货完成";
}
if(error == 0 && iserror){
if (error == 0 && iserror) {
this.setMessage(LangProcess.msg("universal_message4"));
}
jo.put("device_name", this.getDevice().getDevice_name());
@@ -1195,4 +1164,51 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
return null;
}
/*if (to_onset != last_to_onset) {
logServer.deviceExecuteLog(this.device_code, "", "", "信号to_onset" + last_to_onset + "->" + to_onset);
}
if (to_command != last_to_command) {
logServer.deviceExecuteLog(this.device_code, "", "", "信号to_command" + last_to_command + "->" + to_command);
}
if (to_target != last_to_target) {
logServer.deviceExecuteLog(this.device_code, "", "", "信号to_target" + last_to_target + "->" + to_target);
}
if (to_task != last_to_task) {
logServer.deviceExecuteLog(this.device_code, "", "", "信号to_task" + last_to_task + "->" + to_task);
}
if (mode != last_mode) {
requireSucess = false;
logServer.deviceItemValue(this.device_code, "mode", String.valueOf(mode));
logServer.deviceExecuteLog(this.device_code, "", "", "信号mode" + last_mode + "->" + mode);
}
if (move != last_move) {
logServer.deviceItemValue(this.device_code, "move", String.valueOf(move));
logServer.deviceExecuteLog(this.device_code, "", "", "信号move" + last_move + "->" + move);
}
if (action != last_action) {
logServer.deviceItemValue(this.device_code, "action", String.valueOf(action));
logServer.deviceExecuteLog(this.device_code, "", "", "信号action" + last_action + "->" + action);
}
if (error != last_error) {
logServer.deviceItemValue(this.device_code, "error", String.valueOf(error));
logServer.deviceExecuteLog(this.device_code, "", "", "信号error" + last_error + "->" + error);
}
if (walk_y != last_walk_y) {
logServer.deviceItemValue(this.device_code, "walk_y", String.valueOf(walk_y));
logServer.deviceExecuteLog(this.device_code, "", "", "信号walk_y" + last_walk_y + "->" + walk_y);
}
if (task != last_task) {
logServer.deviceItemValue(this.device_code, "task", String.valueOf(task));
logServer.deviceExecuteLog(this.device_code, "", "", "信号task" + last_task + "->" + task);
}
if (x_position != last_x_position) {
logServer.deviceItemValue(this.device_code, "x_position", String.valueOf(x_position));
logServer.deviceExecuteLog(this.device_code, "", "", "信号x_position" + last_x_position + "->" + x_position);
}
if (y_position != last_y_position) {
logServer.deviceItemValue(this.device_code, "y_position", String.valueOf(y_position));
logServer.deviceExecuteLog(this.device_code, "", "", "信号y_position" + last_y_position + "->" + y_position);
}*/
}

View File

@@ -159,6 +159,7 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
task = this.itemProtocol.getTask();
x_position = this.itemProtocol.getX_position();
y_position = this.itemProtocol.getY_position();
heartbeat = this.itemProtocol.getHeartbeat();
if (mode != last_mode) {
requireSucess = false;
logServer.deviceItemValue(this.device_code, "mode", String.valueOf(mode));

View File

@@ -14,7 +14,9 @@ public enum StorageTypeEnum {
DISKS_OUT("3", "空盘出库"),
ERROR("4", "异常处理位");
ERROR("4", "异常处理位"),
BOX_IN("5", "木箱入库");
/**
* 索引
*/

View File

@@ -1,5 +1,6 @@
package org.nl.acs.ext.wms.data;
import com.alibaba.fastjson.JSONObject;
import lombok.Data;
import org.nl.acs.common.base.CommonFinalParam;
@@ -194,4 +195,5 @@ public class CreateTaskRequest extends BaseRequest {
private String bushing_num;
private String paper_array;
private JSONObject interaction_json;
}

View File

@@ -6,6 +6,7 @@ import lombok.Data;
public class ApplyLabelingAndBindingRequest extends BaseRequest {
private String vehicle_code;
private String device_code;
private Integer task_code;
/**
* 1:贴标、捆扎申请
* 2:烘箱

View File

@@ -174,4 +174,5 @@ public interface AcsToWmsService {
void sendDeviceStatus(JSONObject param);
String applyUpdatePointCode(JSONObject param);
}

View File

@@ -239,7 +239,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
MDC.put(log_file_type, log_type);
log.info("applyTaskToWms-----输入参数{}", param);
String wmsurl = paramService.findByCode(AcsConfig.WMSURL).getValue();
AddressDto addressDto = addressService.findByCode("applyTwo");
AddressDto addressDto = addressService.findByCode("deviceApplyTwo");
String url = wmsurl + addressDto.getMethods_url();
HttpResponse result2 = null;
try {
@@ -279,7 +279,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
MDC.put(log_file_type, log_type);
log.info("applyTaskToWms-----输入参数{}", param);
String wmsurl = paramService.findByCode(AcsConfig.WMSURL).getValue();
AddressDto addressDto = addressService.findByCode("applyTwo");
AddressDto addressDto = addressService.findByCode("sendProductToFirstFloor");
String url = wmsurl + addressDto.getMethods_url();
HttpResponse result2 = null;
try {
@@ -573,5 +573,45 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
}
}
@Override
public String applyUpdatePointCode(JSONObject param) {
try {
MDC.put(log_file_type, log_type);
log.info("applyTaskToWms-----输入参数{}", param);
String wmsurl = paramService.findByCode(AcsConfig.WMSURL).getValue();
AddressDto addressDto = addressService.findByCode("applyUpdatePointCode");
String url = wmsurl + addressDto.getMethods_url();
HttpResponse result2 = null;
try {
result2 = HttpRequest.post(url)
.header("Authorization", token)
.body(String.valueOf(param))
.execute();
} catch (Exception e) {
String msg = e.getMessage();
log.info("applyTaskToWms-----输出参数{}", msg);
//网络不通
}
if (ObjectUtil.isEmpty(result2)) {
log.info("applyTaskToWms-----输出参数{}", "返回结果为空");
return null;
}
String type = "";
if (result2.getStatus() == 200) {
type = "info";
} else {
type = "error";
}
log.info("applyTaskToWms-----输出参数{}", result2.body());
LuceneLogDto luceneLogDto = new LuceneLogDto("applyTaskToWms", String.valueOf(result2.getStatus()),
JSON.toJSONString(param), String.valueOf(result2.body()), "申请更新点位");
luceneLogService.interfaceExecuteLog(luceneLogDto);
return result2.body();
} finally {
MDC.remove(log_file_type);
}
}
}

View File

@@ -82,7 +82,7 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
public CreateTaskResponse crateTask(String param) {
try {
MDC.put(log_file_type, log_type);
log.info("crateTask-----输入参数{}", param);
log.info("crateTask-----输入参数{}", param);
JSONArray datas = JSONArray.parseArray(param);
CreateTaskResponse response = new CreateTaskResponse();
// ParamService paramService = SpringContextHolder.getBean(ParamService.class);
@@ -347,7 +347,9 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
TaskDto task_dto = jo.toJavaObject(TaskDto.class);
try {
if (ObjectUtil.isNotEmpty(request.getInteraction_json())) {
task_dto.setInteractionJson(request.getInteraction_json());
}
taskserver.create(task_dto);
} catch (Exception e) {

View File

@@ -40,7 +40,6 @@ public class DeviceErrorLogController {
*/
@GetMapping
@Log("查询设备报警记录")
public ResponseEntity<Object> query(@RequestParam Map whereJson, Pageable page){
return new ResponseEntity<>(acsDeviceErrorLogService.queryAll(whereJson,page),HttpStatus.OK);
}
@@ -52,7 +51,6 @@ public class DeviceErrorLogController {
*/
@PostMapping
@Log("新增设备报警记录")
public ResponseEntity<Object> create(@Validated @RequestBody DeviceErrorLogDto dto){
acsDeviceErrorLogService.create(dto);
return new ResponseEntity<>(HttpStatus.CREATED);
@@ -65,7 +63,6 @@ public class DeviceErrorLogController {
*/
@PutMapping
@Log("修改设备报警记录")
public ResponseEntity<Object> update(@Validated @RequestBody DeviceErrorLogDto dto){
acsDeviceErrorLogService.update(dto);
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
@@ -77,7 +74,6 @@ public class DeviceErrorLogController {
* @return
*/
@Log("删除设备报警记录")
@DeleteMapping
public ResponseEntity<Object> delete(@RequestBody String[] ids) {
acsDeviceErrorLogService.deleteAll(ids);
@@ -91,7 +87,6 @@ public class DeviceErrorLogController {
* @throws IOException
*/
@Log("导出设备报警记录")
@GetMapping(value = "/download")
public void download(HttpServletResponse response, @RequestParam Map whereJson) throws IOException {
acsDeviceErrorLogService.download(acsDeviceErrorLogService.queryAll(whereJson), response);

View File

@@ -444,4 +444,6 @@ public interface InstructionService extends CommonService<InstructionMybatis> {
* @return
*/
Boolean querySameNextDeviceCodeInstByOut(String nextDeviceCode);
void updateByInstructionCode(Instruction instructionUpdate);
}

View File

@@ -14,6 +14,7 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
@@ -27,6 +28,7 @@ import org.nl.acs.agv.server.XianGongAgvService;
import org.nl.acs.auto.initial.ApplicationAutoInitial;
import org.nl.acs.common.base.CommonFinalParam;
import org.nl.acs.device.domain.Device;
import org.nl.acs.device.domain.DeviceErpmapping;
import org.nl.acs.device.enums.DeviceType;
import org.nl.acs.device.service.DeviceService;
import org.nl.acs.device.service.impl.DeviceServiceImpl;
@@ -524,7 +526,9 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
dto = foramte(dto);
String task_code = dto.getTask_code();
TaskDto task = taskService.findByCodeFromCache(task_code);
if(regional(dto.getStart_device_code(), dto.getNext_device_code())){
throw new BadRequestException(LangProcess.msg("error_regional_max"));
}
String currentUsername = SecurityUtils.getCurrentUsername();
String now = DateUtil.now();
if (StrUtil.isEmpty(dto.getRoute_plan_code())) {
@@ -907,28 +911,7 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
log.debug("地址对应设备未找到");
return;
}
// 如果是无光电的设备 放货任务完成需要变更有货状态
// XgAgvCarDeviceDriver standardOrdinarySiteDeviceDriver;
// if(device.getDeviceDriver() instanceof XgAgvCarDeviceDriver) {
// standardOrdinarySiteDeviceDriver = (XgAgvCarDeviceDriver)
// device.getDeviceDriver();
// standardOrdinarySiteDeviceDriver.setMove(2);
// }
// 如果是无光电的设备 指令完成变更起点、终点状态
JSONObject jo = new JSONObject();
jo.put("device_code", dto.getStart_point_code());
jo.put("hasGoodStatus", "0");
jo.put("material_type", "");
jo.put("batch", "");
deviceService.changeDeviceStatus(jo);
JSONObject jo1 = new JSONObject();
jo1.put("device_code", dto.getNext_point_code());
jo1.put("hasGoodStatus", CommonFinalParam.ONE);
jo1.put("material_type", dto.getMaterial());
jo1.put("batch", dto.getBatch());
deviceService.changeDeviceStatus(jo1);
removeByCodeFromCache(dto.getInstruction_code());
// this.reload();
@@ -1331,7 +1314,8 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
}
if (StrUtil.contains(start_point_code, commonFinalParam.getBARRE()) && StrUtil.count(start_point_code, commonFinalParam.getBARRE()) == 2) {
String[] start_point = start_point_code.split(commonFinalParam.getBARRE());
inst.setFrom_x(start_point[0]);
Device starPoint = deviceAppService.findDeviceByCode(start_point[0]);
inst.setFrom_x(starPoint.getExtraValue().get("x").toString());
inst.setStart_device_code(start_point[0]);
inst.setFrom_y(start_point[1]);
inst.setFrom_z(start_point[2]);
@@ -1344,8 +1328,9 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
.get(0)
.name();
if (StrUtil.equals("storage", start_device)) {
String[] start_point = start_point_code.split("-");
inst.setFrom_x(start_point[0]);
String[] start_point = start_point_code.split(commonFinalParam.getBARRE());
Device starPoint = deviceAppService.findDeviceByCode(start_point[0]);
inst.setFrom_x(starPoint.getExtraValue().get("x").toString());
inst.setStart_device_code(start_point[0]);
inst.setFrom_y(start_point[1]);
inst.setFrom_z(start_point[2]);
@@ -1732,6 +1717,14 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
.isEmpty();
}
@Override
public void updateByInstructionCode(Instruction instructionUpdate) {
InstructionMybatis entity = ConvertUtil.convert(instructionUpdate, InstructionMybatis.class);
UpdateWrapper<InstructionMybatis> updateWrapper = new UpdateWrapper<>();
updateWrapper.eq("instruction_code", instructionUpdate.getInstruction_code());
instructionMapper.update(entity,updateWrapper);
}
private boolean regional( String start_device_code, String next_device_code) {
Device startdevice = deviceAppService.findDeviceByCode(start_device_code);
Device nextdevice = deviceAppService.findDeviceByCode(next_device_code);
@@ -1740,6 +1733,9 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
int count = 0;
boolean startRegionalExit = true;
boolean nextRegionalExit = true;
if(StrUtil.isEmpty(startRegion) || StrUtil.isEmpty(nextRegion)){
return true;
}
//控制指令生成
LimitRegionalDto limitRegionalDtos = limitRegionalService.selectByReging(startRegion, nextRegion);
if (ObjectUtil.isNotEmpty(limitRegionalDtos)) {

View File

@@ -11,7 +11,6 @@ import java.util.List;
import java.util.Map;
import java.util.TreeSet;
@Service
public interface LimitRegionalService extends CommonService<LimitRegional> {
/**

View File

@@ -2,6 +2,7 @@ package org.nl.acs.limit_regional.server.impl;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.RandomUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSON;
@@ -21,7 +22,9 @@ import org.nl.acs.limit_regional.server.mapper.LimitRegionalMapper;
import org.nl.acs.opc.DeviceAppService;
import org.nl.acs.utils.ConvertUtil;
import org.nl.acs.utils.PageUtil;
import org.nl.common.exception.BadRequestException;
import org.nl.common.utils.SecurityUtils;
import org.nl.config.language.LangProcess;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
@@ -45,7 +48,7 @@ public class LimitRegionalServiceImpl extends CommonServiceImpl<LimitRegionalMap
@Autowired
private DeviceAppService deviceAppService;
private List<LimitRegional> dataList;
public List<LimitRegional> dataList;
@Override
@@ -82,7 +85,7 @@ public class LimitRegionalServiceImpl extends CommonServiceImpl<LimitRegionalMap
@Override
public void add(JSONObject json) {
LimitRegional limitRegional = new LimitRegional();
limitRegional.setId(String.valueOf(RandomUtil.randomInt(8)));
limitRegional.setId(RandomUtil.randomNumbers(8));
limitRegional.setStart_regional(json.getString("start_regional"));
limitRegional.setNext_regional(json.getString("next_regional"));
limitRegional.setStart_exclude_device(json.getString("startExcludeDevice"));
@@ -91,12 +94,14 @@ public class LimitRegionalServiceImpl extends CommonServiceImpl<LimitRegionalMap
String regex = "\\d+";
boolean isNumeric = max_num.matches(regex);
if(!isNumeric){
throw new RuntimeException("最大数请输入纯数字");
throw new BadRequestException("请输入纯数字");
}
limitRegional.setIs_active("1");
limitRegional.setMax_num(max_num);
limitRegional.setCreate_by("auto");
limitRegional.setCreate_time(DateUtil.now());
limitRegionalMapper.insert(limitRegional);
dataList.add(limitRegional);
}
@@ -106,13 +111,25 @@ public class LimitRegionalServiceImpl extends CommonServiceImpl<LimitRegionalMap
return;
}
for (String id : ids) {
LimitRegional limitRegional = limitRegionalMapper.selectById(id);
if(ObjectUtil.isNull(limitRegional)){
throw new BadRequestException("这个对象不存在");
}
limitRegionalMapper.deleteById(id);
}
dataList.removeIf(limitRegional -> CollUtil.contains(Arrays.asList(ids), limitRegional.getId()));
}
@Override
public void update(JSONObject json) {
if(StrUtil.isEmpty(json.getString("id"))){
throw new BadRequestException(LangProcess.msg("error_checkNull", "流量限制id"));
}
LimitRegional id = limitRegionalMapper.selectById(json.getString("id"));
if(ObjectUtil.isNull(id)){
throw new BadRequestException(LangProcess.msg("error_isNull", "流量限制id="+json.getString("id")));
}
LimitRegional limitRegional = new LimitRegional();
String currentUsername = SecurityUtils.getCurrentUsername();
limitRegional.setId(json.getString("id"));
@@ -124,19 +141,30 @@ public class LimitRegionalServiceImpl extends CommonServiceImpl<LimitRegionalMap
String regex = "\\d+";
boolean isNumeric = max_num.matches(regex);
if(!isNumeric){
throw new RuntimeException("最大数请输入纯数字");
throw new RuntimeException("请输入纯数字");
}
limitRegional.setMax_num(max_num);
limitRegional.setUpdate_by(currentUsername);
limitRegional.setUpdate_time(DateUtil.now());
limitRegionalMapper.updateById(limitRegional);
dataList.forEach(limitRegional1 -> {
if (limitRegional.getId().equals(limitRegional1.getId())) {
limitRegional1.setStart_regional(limitRegional.getStart_regional());
limitRegional1.setNext_regional(limitRegional.getNext_regional());
limitRegional1.setStart_exclude_device(limitRegional.getStart_exclude_device());
limitRegional1.setNext_exclude_device(limitRegional.getNext_exclude_device());
limitRegional1.setMax_num(limitRegional.getMax_num());
limitRegional1.setUpdate_by(limitRegional.getUpdate_by());
limitRegional1.setUpdate_time(limitRegional.getUpdate_time());
}
});
}
@Override
public void updateStatusById(Map whereJson) {
String id = whereJson.get("id").toString();
if(StrUtil.isEmpty(id)){
return;
throw new BadRequestException("id为空");
}
LimitRegional limitRegional = new LimitRegional();
limitRegional.setId(id);
@@ -144,13 +172,21 @@ public class LimitRegionalServiceImpl extends CommonServiceImpl<LimitRegionalMap
limitRegional.setUpdate_by(SecurityUtils.getCurrentUsername());
limitRegional.setUpdate_time(DateUtil.now());
limitRegionalMapper.updateById(limitRegional);
dataList.forEach(limitRegional1 -> {if (limitRegional.getId().equals(limitRegional1.getId())) {
limitRegional1.setIs_active(limitRegional.getIs_active());
limitRegional1.setUpdate_by(limitRegional.getUpdate_by());
limitRegional1.setUpdate_time(limitRegional.getUpdate_time());
}
});
}
@Override
public LimitRegionalDto selectByReging(String startRegion, String nextRegion) {
for (LimitRegional limitRegional : dataList) {
if (startRegion.equals(limitRegional.getStart_regional()) && nextRegion.equals(limitRegional.getNext_regional())){
return ConvertUtil.convert(limitRegional, LimitRegionalDto.class);
if (StrUtil.isNotEmpty(startRegion)&&StrUtil.isNotEmpty(nextRegion)) {
for (LimitRegional limitRegional : dataList) {
if (startRegion.equals(limitRegional.getStart_regional()) && nextRegion.equals(limitRegional.getNext_regional())) {
return ConvertUtil.convert(limitRegional, LimitRegionalDto.class);
}
}
}
return null;

View File

@@ -290,6 +290,7 @@ public class DeviceOpcProtocolRunable implements Runnable, DataCallback, ServerC
}
private void runNew() {
Async20Access accessor = null;

View File

@@ -510,4 +510,6 @@ public interface TaskService extends CommonService<Task> {
* @return AcsTask
*/
TaskDto findByTaskCode(String task_code);
void updateByTaskCode(Task taskUpdate);
}

View File

@@ -8,10 +8,12 @@ import cn.hutool.core.text.CharSequenceUtil;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
@@ -256,7 +258,7 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
if (!StrUtil.isEmpty(point_code)) {
wrapper.and(task -> task.like(Task::getStart_point_code, point_code).or().like(Task::getNext_point_code, point_code));
}
if(StrUtil.isNotEmpty(task_type)){
if (StrUtil.isNotEmpty(task_type)) {
wrapper.eq(Task::getTask_type, task_type);
}
if (!StrUtil.isEmpty(is_over)) {
@@ -498,7 +500,7 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
Iterator<TaskDto> iterator = tasks.iterator();
if (iterator.hasNext()) {
TaskDto task = iterator.next();
if(StrUtil.equals(task.getTask_status(), status)){
if (StrUtil.equals(task.getTask_status(), status)) {
taskDtoList.add(task);
}
}
@@ -559,12 +561,12 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
DeviceService deviceService = SpringContextHolder.getBean(DeviceServiceImpl.class);
DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class);
Device nextdevice = appService.findDeviceByCode(next_device_code);
if (nextdevice == null){
if (nextdevice == null) {
//TODO 国际化处理
throw new BadRequestException("终点设备未配置");
}
Device startdevice = appService.findDeviceByCode(start_device_code);
if (startdevice == null){
if (startdevice == null) {
//TODO 国际化处理
throw new BadRequestException("起点设备未配置");
}
@@ -1063,7 +1065,7 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
Optional<TaskDto> optionalTask = tasks.stream()
.filter(task -> StrUtil.equals(task.getNext_device_code(), device_code)
&& StrUtil.equals(task.getTask_status(), TaskStatusEnum.READY.getIndex())
)
)
.findFirst();
return optionalTask.orElse(null);
}
@@ -1517,6 +1519,13 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
return null;
}
@Override
public void updateByTaskCode(Task taskUpdate) {
UpdateWrapper<Task> updateWrapper = new UpdateWrapper<>();
updateWrapper.eq("task_code", taskUpdate.getTask_code());
taskMapper.update(taskUpdate,updateWrapper);
}
/**
* 把多个字符串拼接的inst_nextDevice_code解析成集合
*

View File

@@ -138,14 +138,14 @@ public class LogAspect {
@AfterThrowing(pointcut = "logPointcut()", throwing = "e")
/*@AfterThrowing(pointcut = "logPointcut()", throwing = "e")
public void logAfterThrowing(JoinPoint joinPoint, Throwable e) {
SysLog log = new SysLog("ERROR",System.currentTimeMillis() - currentTime.get());
currentTime.remove();
log.setException_detail(ThrowableUtil.getStackTrace(e).getBytes());
HttpServletRequest request = RequestHolder.getHttpServletRequest();
logService.save(getUsername(), StringUtils.getBrowser(request), StringUtils.getIp(request), (ProceedingJoinPoint)joinPoint, log);
}
}*/
public String getUsername() {
try {

View File

@@ -30,15 +30,12 @@ public class SysLogController {
@Autowired
private ISysLogService logService;
@GetMapping
//@SaCheckPermission("@el.check()")
public ResponseEntity<Object> query(@RequestParam Map criteria, PageQuery pageable){
criteria.put("log_type","INFO");
return new ResponseEntity<>(TableDataInfo.build(logService.queryAll(criteria,pageable)), HttpStatus.OK);
}
@GetMapping(value = "/user")
//
public ResponseEntity<Object> queryUserLog(@RequestParam Map criteria, PageQuery pageable){
criteria.put("log_type","INFO");
criteria.put("username", SecurityUtils.getCurrentUsername());
@@ -46,7 +43,6 @@ public class SysLogController {
}
@GetMapping(value = "/error")
// @SaCheckPermission("@el.check()")
public ResponseEntity<Object> queryErrorLog(@RequestParam Map criteria, PageQuery pageable){
criteria.put("log_type","ERROR");
@@ -54,7 +50,6 @@ public class SysLogController {
}
@GetMapping(value = "/error/{id}")
// @SaCheckPermission("@el.check()")
public ResponseEntity<Object> queryErrorLogs(@PathVariable String id){
return new ResponseEntity<>(logService.findByErrDetail(id), HttpStatus.OK);
@@ -62,7 +57,6 @@ public class SysLogController {
@DeleteMapping(value = "/del/error")
@Log("删除所有ERROR日志")
// @SaCheckPermission("@el.check()")
public ResponseEntity<Object> delAllErrorLog(){
logService.delAllByError();
@@ -71,7 +65,6 @@ public class SysLogController {
@DeleteMapping(value = "/del/info")
@Log("删除所有INFO日志")
// @SaCheckPermission("@el.check()")
public ResponseEntity<Object> delAllInfoLog(){
logService.delAllByInfo();