add :堆垛机异样处理

This commit is contained in:
2024-02-28 16:14:34 +08:00
parent 42e572a003
commit c010166c28
27 changed files with 375 additions and 229 deletions

View File

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

View File

@@ -291,14 +291,12 @@ public class BeltConveyorDeviceDriver extends AbstractOpcDeviceDriver implements
break; break;
case 5: case 5:
//申请AGV任务 //申请AGV任务
//TODO 申请AGV任务待确认
if (move == 1 && !requireSucess) { if (move == 1 && !requireSucess) {
applyAgvTask(); applyAgvTask();
} }
break; break;
case 6: case 6:
//二楼到一楼输送线申请行架任务 //二楼到一楼输送线申请行架任务
//TODO 申请行架任务
if (move == 1 && !requireSucess) { if (move == 1 && !requireSucess) {
applyManipulatorTask(); applyManipulatorTask();
} }
@@ -327,7 +325,11 @@ public class BeltConveyorDeviceDriver extends AbstractOpcDeviceDriver implements
private void applyManipulatorTask() { private void applyManipulatorTask() {
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(); JSONObject param = new JSONObject();
param.put("device_code", device_code); param.put("device_code", device_code);
param.put("material_barcode", material_barcode); param.put("material_barcode", material_barcode);
@@ -341,7 +343,7 @@ public class BeltConveyorDeviceDriver extends AbstractOpcDeviceDriver implements
.build(); .build();
luceneExecuteLogService.deviceExecuteLog(logDto2); luceneExecuteLogService.deviceExecuteLog(logDto2);
this.requireSucess = true; this.requireSucess = true;
}else { } else {
LuceneLogDto logDto2 = LuceneLogDto.builder() LuceneLogDto logDto2 = LuceneLogDto.builder()
.device_code(device_code) .device_code(device_code)
.content("二楼到一楼输送线申请行架任务,返回参数:" + jo.getString("body")) .content("二楼到一楼输送线申请行架任务,返回参数:" + jo.getString("body"))
@@ -349,6 +351,7 @@ public class BeltConveyorDeviceDriver extends AbstractOpcDeviceDriver implements
luceneExecuteLogService.deviceExecuteLog(logDto2); luceneExecuteLogService.deviceExecuteLog(logDto2);
} }
} }
}
public void writing(int command) { public void writing(int command) {
@@ -371,10 +374,8 @@ public class BeltConveyorDeviceDriver extends AbstractOpcDeviceDriver implements
if (StrUtil.equals(paramService.findByCode(AcsConfig.HASWMS).getValue(), "1")) { if (StrUtil.equals(paramService.findByCode(AcsConfig.HASWMS).getValue(), "1")) {
//判断是否有手动补码 如果有就申请补码agv任务 //判断是否有手动补码 如果有就申请补码agv任务
if (StrUtil.isNotEmpty(hand_barcode)) { if (StrUtil.isNotEmpty(hand_barcode)) {
message = "申请补码AGV搬运任务中...";
JSONObject apply = new JSONObject(); JSONObject apply = new JSONObject();
apply.put("device_code", device_code); apply.put("device_code", device_code);
apply.put("type", AcsToLmsApplyTaskTypeEnum.AGV.getType());
apply.put("vehicle_code", hand_barcode); apply.put("vehicle_code", hand_barcode);
String str = acsToWmsService.applyTaskToWms(apply); String str = acsToWmsService.applyTaskToWms(apply);
@@ -385,10 +386,10 @@ public class BeltConveyorDeviceDriver extends AbstractOpcDeviceDriver implements
.build(); .build();
luceneExecuteLogService.deviceExecuteLog(logDto2); luceneExecuteLogService.deviceExecuteLog(logDto2);
if (ObjectUtil.isEmpty(jo)) { if (ObjectUtil.isEmpty(jo)) {
message = "申请补码AGV搬运任务接口不通"; message = LangProcess.msg("one_message15");
} else { } else {
if (jo.getInteger("status") == 200) { if (jo.getInteger("status") == 200) {
message = "申请补码AGV搬运任务成功"; message = LangProcess.msg("one_message16");
List list = new ArrayList(); List list = new ArrayList();
while (!StrUtil.equals(this.getOpcValueAccessor().getValue(this.getOpcServer() + "." + this.getOpcPlc() + "." + this.getDevice_code() + ".to_command").toString() while (!StrUtil.equals(this.getOpcValueAccessor().getValue(this.getOpcServer() + "." + this.getOpcPlc() + "." + this.getDevice_code() + ".to_command").toString()
, "8")) { , "8")) {
@@ -407,38 +408,26 @@ public class BeltConveyorDeviceDriver extends AbstractOpcDeviceDriver implements
luceneExecuteLogService.deviceExecuteLog(logDto); luceneExecuteLogService.deviceExecuteLog(logDto);
requireSucess = true; requireSucess = true;
} else { } else {
message = "申请补码AGV搬运任务失败," + jo.get("message").toString(); message = LangProcess.msg("one_message17") + jo.get("message").toString();
} }
} }
return; 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(); JSONObject apply = new JSONObject();
apply.put("device_code", device_code); 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); String str = acsToWmsService.applySendOutTwo(apply);
logServer.deviceExecuteLog(this.device_code, "", "", "申请AGV任务,请求参数:" + apply + ",响应参数"); logServer.deviceExecuteLog(this.device_code, "", "", "申请AGV任务,请求参数:" + apply + ",响应参数");
JSONObject jo = JSON.parseObject(str); JSONObject jo = JSON.parseObject(str);
if (ObjectUtil.isEmpty(jo)) { if (ObjectUtil.isEmpty(jo)) {
message = "申请AGV搬运任务接口不通"; message = LangProcess.msg("one_message15");
// requireSucess = true; // requireSucess = true;
} else { } else {
if (jo.getInteger("status") == 200) { if (jo.getInteger("status") == 200) {
message = "申请AGV搬运任务成功"; message = LangProcess.msg("one_message16");
List list = new ArrayList(); List list = new ArrayList();
Map map = new HashMap(); Map map = new HashMap();
map.put("code", "to_command"); map.put("code", "to_command");
@@ -458,7 +447,7 @@ public class BeltConveyorDeviceDriver extends AbstractOpcDeviceDriver implements
logServer.deviceExecuteLog(this.device_code, "", "", "申请AGV任务,返回参数:" + jo); logServer.deviceExecuteLog(this.device_code, "", "", "申请AGV任务,返回参数:" + jo);
requireSucess = true; requireSucess = true;
} else { } 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_to_target = "to_target";
/**
* 托盘条码
*/
public static String item_barcode = "barcode";
@@ -128,6 +133,11 @@ public class ItemProtocol {
return this.getOpcIntegerValue(item_to_task); return this.getOpcIntegerValue(item_to_task);
} }
public String getBarcode() {
return this.getOpcStringValue(item_barcode);
}
public int getTotarget() { public int getTotarget() {
return this.getOpcIntegerValue(item_to_target); 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_action, "动作类型", "DB101.B6"));
list.add(new ItemDto(item_error, "报警", "DB101.B58")); list.add(new ItemDto(item_error, "报警", "DB101.B58"));
list.add(new ItemDto(item_task, "任务号", "DB101.D68")); 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; 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.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 com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
import lombok.Data; import lombok.Data;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; 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.AbstractOpcDeviceDriver;
import org.nl.acs.device_driver.driver.ExecutableDeviceDriver; import org.nl.acs.device_driver.driver.ExecutableDeviceDriver;
import org.nl.acs.enums.AcsToLmsApplyTaskTypeEnum; 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.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;
@@ -33,7 +31,6 @@ import org.nl.acs.monitor.DeviceStageMonitor;
import org.nl.acs.opc.DeviceAppService; import org.nl.acs.opc.DeviceAppService;
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.storage_cell.domain.StorageCell;
import org.nl.acs.storage_cell.service.mapper.StorageCellMapper; import org.nl.acs.storage_cell.service.mapper.StorageCellMapper;
import org.nl.acs.task.enums.TaskStatusEnum; import org.nl.acs.task.enums.TaskStatusEnum;
import org.nl.acs.task.service.TaskService; 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.lucene.service.dto.LuceneLogDto;
import org.nl.config.thread.ThreadPoolExecutorUtil; import org.nl.config.thread.ThreadPoolExecutorUtil;
import org.openscada.opc.lib.da.Server; import org.openscada.opc.lib.da.Server;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.*; import java.util.*;
import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.ThreadPoolExecutor;
@@ -80,8 +76,8 @@ public class FinishedProductOutBindLableDeviceDriver extends AbstractOpcDeviceDr
DeviceErrorLogService deviceErrorLogService = SpringContextHolder.getBean(DeviceErrorLogServiceImpl.class); DeviceErrorLogService deviceErrorLogService = SpringContextHolder.getBean(DeviceErrorLogServiceImpl.class);
@Autowired LuceneExecuteLogService luceneExecuteLogService = SpringContextHolder.getBean(LuceneExecuteLogService.class);
LuceneExecuteLogService luceneExecuteLogService;
//当前指令 //当前指令
Instruction inst = null; Instruction inst = null;
@@ -123,6 +119,10 @@ public class FinishedProductOutBindLableDeviceDriver extends AbstractOpcDeviceDr
int to_height = 0; int to_height = 0;
int last_to_height = 0; int last_to_height = 0;
//托盘条码
String barcode = null;
String last_barcode = null;
String material_barcode = null; String material_barcode = null;
String last_material_barcode = null; String last_material_barcode = null;
@@ -164,8 +164,7 @@ public class FinishedProductOutBindLableDeviceDriver extends AbstractOpcDeviceDr
String device_code; String device_code;
String vehicle_code;
String last_vehicle_code;
@Override @Override
public Device getDevice() { public Device getDevice() {
@@ -187,6 +186,7 @@ public class FinishedProductOutBindLableDeviceDriver extends AbstractOpcDeviceDr
to_task = this.itemProtocol.getTo_task(); to_task = this.itemProtocol.getTo_task();
heartbeat = this.itemProtocol.getHeartbeat(); heartbeat = this.itemProtocol.getHeartbeat();
material_barcode = this.itemProtocol.getMaterialBarCode(); material_barcode = this.itemProtocol.getMaterialBarCode();
barcode = this.itemProtocol.getBarcode();
if (mode != last_mode) { if (mode != last_mode) {
JSONObject param = new JSONObject(); JSONObject param = new JSONObject();
@@ -268,76 +268,53 @@ public class FinishedProductOutBindLableDeviceDriver extends AbstractOpcDeviceDr
return; return;
} else { } else {
this.require_apply_strangulation_time = date; this.require_apply_strangulation_time = date;
String vehicle_code = ""; // String vehicle_code = "";
if (task > 0) { //
Instruction instruction = instructionService.findByCodeFromCache(String.valueOf(task)); // if (StrUtil.isEmpty(vehicle_code)) {
if (ObjectUtil.isEmpty(instruction)) { // message = LangProcess.msg("one_message8") + ": " + task + LangProcess.msg("one_message11");
message = LangProcess.msg("one_message8") + ": " + task + LangProcess.msg("one_message9"); // return;
return; // }
}
vehicle_code = instruction.getVehicle_code(); JSONObject param = new JSONObject();
} else { param.put("device_code", device_code);
message = LangProcess.msg("one_message8") + ": " + task + LangProcess.msg("one_message10"); param.put("vehicle_code", material_barcode);
return; param.put("type", AcsToLmsApplyTaskTypeEnum.LABEL_BIND.getType());
} String response = acsToWmsService.deviceApplyTwo(param);
if (StrUtil.isEmpty(vehicle_code)) { JSONObject jo = JSON.parseObject(response);
message = LangProcess.msg("one_message8") + ": " + task + LangProcess.msg("one_message11"); if (StrUtil.isNotEmpty(jo.getString("body")) || jo.getInteger("status") == 200) {
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())) {
LuceneLogDto logDto2 = LuceneLogDto.builder() LuceneLogDto logDto2 = LuceneLogDto.builder()
.device_code(device_code) .device_code(device_code)
.content("申请贴标捆扎信息,接口返回:" + applyLabelingAndBindingResponse.getData()) .content("申请捆扎,参数,接口返回:" + jo)
.build(); .build();
luceneExecuteLogService.deviceExecuteLog(logDto2); luceneExecuteLogService.deviceExecuteLog(logDto2);
Map datas = applyLabelingAndBindingResponse.getData(); // Map datas = applyLabelingAndBindingResponse.getData();
packagePLCData(datas); packagePLCData(jo.getString("body"));
requireSucess = true; requireSucess = true;
} else { } else {
LuceneLogDto logDto2 = LuceneLogDto.builder() LuceneLogDto logDto2 = LuceneLogDto.builder()
.device_code(device_code) .device_code(device_code)
.content("申请捆扎失败,接口返回:" + applyLabelingAndBindingResponse.getData()) .content("申请捆扎失败,接口返回:" + jo.getString("body"))
.build(); .build();
luceneExecuteLogService.deviceExecuteLog(logDto2); luceneExecuteLogService.deviceExecuteLog(logDto2);
} }
} else {
message = applyLabelingAndBindingResponse.getMessage();
} }
} }
}
private void packagePLCData(Map datas) { private void packagePLCData(String datas) {
String length = datas.get("length").toString();
String weight = datas.get("weight").toString(); JSONObject jo = JSON.parseObject(datas);
String height = datas.get("height").toString(); String length = jo.get("length").toString();
String isBinding = datas.get("isBinding").toString(); String weight = jo.get("weight").toString();
String isLabeling = datas.get("isLabeling").toString(); String height = jo.get("height").toString();
String printQty = datas.get("printQty").toString(); String isBinding = jo.get("isBinding").toString();
String labelingTemplate = datas.get("labelingTemplate").toString(); String isLabeling = jo.get("isLabeling").toString();
String bindingTemplate = datas.get("bindingTemplate").toString(); String printQty = jo.get("printQty").toString();
String printDevice = datas.get("printDevice").toString(); String labelingTemplate = jo.get("labelingTemplate").toString();
String bundleTimes = datas.get("bundleTimes").toString(); String bindingTemplate = jo.get("bindingTemplate").toString();
String printDevice = jo.get("printDevice").toString();
String bundleTimes = jo.get("bundleTimes").toString();
List list = new ArrayList(); List list = new ArrayList();
Map map = new HashMap(); Map map = new HashMap();
@@ -358,7 +335,7 @@ public class FinishedProductOutBindLableDeviceDriver extends AbstractOpcDeviceDr
list.add(map4); list.add(map4);
Map map5 = new HashMap(); Map map5 = new HashMap();
map5.put("code", "to_command"); map5.put("code", "to_command");
map5.put("value", "10"); map5.put("value", 10);
list.add(map5); list.add(map5);
Map map6 = new HashMap(); Map map6 = new HashMap();
map6.put("code", "to_is_labeling"); map6.put("code", "to_is_labeling");
@@ -483,7 +460,7 @@ public class FinishedProductOutBindLableDeviceDriver extends AbstractOpcDeviceDr
jo.put("isError", this.getIserror()); jo.put("isError", this.getIserror());
jo.put("message", this.getMessage()); jo.put("message", this.getMessage());
jo.put("hand_barcode", hand_barcode); 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("is_click", true);
jo.put("requireSucess", requireSucess); jo.put("requireSucess", requireSucess);
jo.put("driver_type", "siemens_conveyor"); jo.put("driver_type", "siemens_conveyor");
@@ -751,7 +728,6 @@ public class FinishedProductOutBindLableDeviceDriver extends AbstractOpcDeviceDr
inst = checkInst(); inst = checkInst();
if (inst != null) { if (inst != null) {
inst_message = "当前指令号:" + inst.getInstruction_code() + " " + inst.getStart_point_code() + "->" + inst.getNext_point_code() + " 载具号:" + inst.getVehicle_code(); 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(); task_code = inst.getTask_code();
if (StrUtil.equals(inst.getInstruction_status(), "0") && StrUtil.equals(this.getDeviceCode(), inst.getStart_device_code())) { if (StrUtil.equals(inst.getInstruction_status(), "0") && StrUtil.equals(this.getDeviceCode(), inst.getStart_device_code())) {
inst.setInstruction_status("1"); 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(inst.getInstruction_status(), "1") || StrUtil.equals(inst.getInstruction_status(), "0")) {
if (StrUtil.equals(this.getDeviceCode(), inst.getNext_device_code())) { if (StrUtil.equals(this.getDeviceCode(), inst.getNext_device_code())) {
vehicle_code = inst.getVehicle_code();
inst.setExecute_device_code(this.device_code); inst.setExecute_device_code(this.device_code);
if (mode == 2) { if (mode == 2) {
finish_instruction(); finish_instruction();

View File

@@ -48,6 +48,11 @@ public class ItemProtocol {
*/ */
public static String item_task = "task"; public static String item_task = "task";
/**
* 托盘条码
*/
public static String item_barcode = "barcode";
/** /**
* 动作信号 * 动作信号
*/ */
@@ -175,7 +180,9 @@ public class ItemProtocol {
return this.getOpcIntegerValue(item_action); return this.getOpcIntegerValue(item_action);
} }
public String getBarcode() {
return this.getOpcStringValue(item_barcode);
}
Boolean isonline; Boolean isonline;
@@ -218,7 +225,8 @@ public class ItemProtocol {
list.add(new ItemDto(item_error, "报警信号", "DB600.B6")); list.add(new ItemDto(item_error, "报警信号", "DB600.B6"));
list.add(new ItemDto(item_container_type, "托盘类型", "DB101.B7")); list.add(new ItemDto(item_container_type, "托盘类型", "DB101.B7"));
list.add(new ItemDto(item_task, "任务号", "DB600.D8")); 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; 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.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.Data; import lombok.Data;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
@@ -73,8 +74,7 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv
DeviceAppService deviceAppservice = SpringContextHolder.getBean(DeviceAppService.class); DeviceAppService deviceAppservice = SpringContextHolder.getBean(DeviceAppService.class);
@Autowired LuceneExecuteLogService luceneExecuteLogService = SpringContextHolder.getBean(LuceneExecuteLogService.class);
LuceneExecuteLogService luceneExecuteLogService;
//工作模式 //工作模式
int mode = 0; int mode = 0;
int last_mode = 0; int last_mode = 0;
@@ -244,7 +244,12 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv
List toInstructions; List toInstructions;
//木箱入库申请入库任务 //木箱入库申请入库任务
if (mode == 6 && !requireSucess){ 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(); 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) {
@@ -343,13 +348,30 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv
param.put("device_code", device_code); param.put("device_code", device_code);
param.put("vehicle_code", barcode); param.put("vehicle_code", barcode);
param.put("material_barcode", material_barcode); param.put("material_barcode", material_barcode);
param.put("type", StorageTypeEnum.STORAGE.getType()); param.put("type", type);
logServer.deviceExecuteLog(this.device_code, "", "", "木箱入库申请入库任务,参数:" + param); LuceneLogDto logDto = LuceneLogDto.builder()
HttpResponse response = acsToWmsService.shipDeviceUpdate(param); .device_code(device_code)
if (response == null || response.getStatus() == 200) { .content("申请空托盘出入库,参数:" + param)
logServer.deviceExecuteLog(this.device_code, "", "", "木箱入库申请入库任务,接口返回:" + response.body()); .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(); 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_carrier_direction, "托盘方向", "DB1.B8"));
list.add(new ItemDto(item_qty, "数量", "DB1.B9")); list.add(new ItemDto(item_qty, "数量", "DB1.B9"));
list.add(new ItemDto(item_weight, "重量", "DB1.B10")); list.add(new ItemDto(item_weight, "重量", "DB1.B10"));
list.add(new ItemDto(item_barcode, "托盘条码", "DB1.B11")); list.add(new ItemDto(item_barcode, "托盘条码", "DB602.STRING1.50"));
list.add(new ItemDto(item_material_barcode, "子卷条码", "DB1.B12")); list.add(new ItemDto(item_material_barcode, "子卷条码", "DB601.STRING1.50"));
return list; return list;
} }

View File

@@ -23,9 +23,15 @@ public class InteractionJsonDTO {
*/ */
private String template; 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); list.add(map8);
} }
if (ObjectUtil.isNotEmpty(interactionJsonDTO.getTemplate())) { if (ObjectUtil.isNotEmpty(interactionJsonDTO.getTemplate())) {
map9.put("code", "to_last_one"); map9.put("code", "to_is_leave");
map9.put("value", interactionJsonDTO.getIsLastOne()); map9.put("value", interactionJsonDTO.getIsLeave());
list.add(map9); list.add(map9);
} }
if (ObjectUtil.isNotEmpty(interactionJsonDTO.getIsBinding())) { 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.date.DateUtil;
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.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import lombok.Data; import lombok.Data;
import lombok.RequiredArgsConstructor; 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.conveyor.siemens_conveyor.SiemensConveyorDeviceDriver;
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.service.AcsToWmsService;
import org.nl.acs.ext.wms.service.impl.AcsToWmsServiceImpl;
import org.nl.acs.history.ErrorUtil; import org.nl.acs.history.ErrorUtil;
import org.nl.acs.history.domain.AcsDeviceErrorLog; import org.nl.acs.history.domain.AcsDeviceErrorLog;
import org.nl.acs.history.service.DeviceErrorLogService; 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.RouteLineService;
import org.nl.acs.route.service.dto.RouteLineDto; import org.nl.acs.route.service.dto.RouteLineDto;
import org.nl.acs.route.service.impl.RouteLineServiceImpl; 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.TaskService;
import org.nl.acs.task.service.dto.TaskDto; import org.nl.acs.task.service.dto.TaskDto;
import org.nl.config.SpringContextHolder; import org.nl.config.SpringContextHolder;
import org.nl.config.language.LangProcess; import org.nl.config.language.LangProcess;
import org.nl.config.lucene.service.LuceneExecuteLogService;
import org.nl.config.lucene.service.dto.LuceneLogDto;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import java.util.*; import java.util.*;
@@ -67,6 +74,9 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
@Autowired @Autowired
DeviceErrorLogService errorLogServer = SpringContextHolder.getBean(DeviceErrorLogServiceImpl.class); 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"); message = LangProcess.msg("universal_message3");
//指定库位满入 //指定库位满入
if (error == 5) { if (error == 5) {
applyUpdatePointCode(StandarStirageErroEnum.FILL.getType());
} }
//空出 //空出
if (error == 6) { if (error == 6) {
applyUpdatePointCode(StandarStirageErroEnum.VOIDANCE.getType());
} }
//浅货位有货 //浅货位有货
if (error == 16) { if (error == 16) {
//放货 //放货
if (cargoMove == 1) { if (cargoMove == 1) {
applyUpdatePointCode(StandarStirageErroEnum.BLOCK_OUT.getType());
} else if (cargoMove == 0) { } else if (cargoMove == 0) {
//取货 //取货
applyUpdatePointCode(StandarStirageErroEnum.BLOCK_IN.getType());
} }
@@ -543,6 +555,91 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
last_fork_runingTimes = fork_runingTimes;*/ 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

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

View File

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

View File

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

View File

@@ -174,4 +174,5 @@ public interface AcsToWmsService {
void sendDeviceStatus(JSONObject param); 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); MDC.put(log_file_type, log_type);
log.info("applyTaskToWms-----输入参数{}", param); log.info("applyTaskToWms-----输入参数{}", param);
String wmsurl = paramService.findByCode(AcsConfig.WMSURL).getValue(); String wmsurl = paramService.findByCode(AcsConfig.WMSURL).getValue();
AddressDto addressDto = addressService.findByCode("applyTwo"); AddressDto addressDto = addressService.findByCode("deviceApplyTwo");
String url = wmsurl + addressDto.getMethods_url(); String url = wmsurl + addressDto.getMethods_url();
HttpResponse result2 = null; HttpResponse result2 = null;
try { try {
@@ -279,7 +279,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
MDC.put(log_file_type, log_type); MDC.put(log_file_type, log_type);
log.info("applyTaskToWms-----输入参数{}", param); log.info("applyTaskToWms-----输入参数{}", param);
String wmsurl = paramService.findByCode(AcsConfig.WMSURL).getValue(); String wmsurl = paramService.findByCode(AcsConfig.WMSURL).getValue();
AddressDto addressDto = addressService.findByCode("applyTwo"); AddressDto addressDto = addressService.findByCode("sendProductToFirstFloor");
String url = wmsurl + addressDto.getMethods_url(); String url = wmsurl + addressDto.getMethods_url();
HttpResponse result2 = null; HttpResponse result2 = null;
try { 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

@@ -345,7 +345,9 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
TaskDto task_dto = jo.toJavaObject(TaskDto.class); TaskDto task_dto = jo.toJavaObject(TaskDto.class);
try { try {
if (ObjectUtil.isNotEmpty(request.getInteraction_json())) {
task_dto.setInteractionJson(request.getInteraction_json());
}
taskserver.create(task_dto); taskserver.create(task_dto);
} catch (Exception e) { } catch (Exception e) {

View File

@@ -444,4 +444,6 @@ public interface InstructionService extends CommonService<InstructionMybatis> {
* @return * @return
*/ */
Boolean querySameNextDeviceCodeInstByOut(String nextDeviceCode); 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.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; 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.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.StringUtils; import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; 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.auto.initial.ApplicationAutoInitial;
import org.nl.acs.common.base.CommonFinalParam; import org.nl.acs.common.base.CommonFinalParam;
import org.nl.acs.device.domain.Device; 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.enums.DeviceType;
import org.nl.acs.device.service.DeviceService; import org.nl.acs.device.service.DeviceService;
import org.nl.acs.device.service.impl.DeviceServiceImpl; import org.nl.acs.device.service.impl.DeviceServiceImpl;
@@ -907,28 +909,7 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
log.debug("地址对应设备未找到"); log.debug("地址对应设备未找到");
return; 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()); removeByCodeFromCache(dto.getInstruction_code());
// this.reload(); // this.reload();
@@ -1331,7 +1312,8 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
} }
if (StrUtil.contains(start_point_code, commonFinalParam.getBARRE()) && StrUtil.count(start_point_code, commonFinalParam.getBARRE()) == 2) { 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()); 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.setStart_device_code(start_point[0]);
inst.setFrom_y(start_point[1]); inst.setFrom_y(start_point[1]);
inst.setFrom_z(start_point[2]); inst.setFrom_z(start_point[2]);
@@ -1344,8 +1326,9 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
.get(0) .get(0)
.name(); .name();
if (StrUtil.equals("storage", start_device)) { if (StrUtil.equals("storage", start_device)) {
String[] start_point = start_point_code.split("-"); 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.setStart_device_code(start_point[0]);
inst.setFrom_y(start_point[1]); inst.setFrom_y(start_point[1]);
inst.setFrom_z(start_point[2]); inst.setFrom_z(start_point[2]);
@@ -1732,6 +1715,14 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
.isEmpty(); .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) { private boolean regional( String start_device_code, String next_device_code) {
Device startdevice = deviceAppService.findDeviceByCode(start_device_code); Device startdevice = deviceAppService.findDeviceByCode(start_device_code);
Device nextdevice = deviceAppService.findDeviceByCode(next_device_code); Device nextdevice = deviceAppService.findDeviceByCode(next_device_code);

View File

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

View File

@@ -148,11 +148,13 @@ public class LimitRegionalServiceImpl extends CommonServiceImpl<LimitRegionalMap
@Override @Override
public LimitRegionalDto selectByReging(String startRegion, String nextRegion) { public LimitRegionalDto selectByReging(String startRegion, String nextRegion) {
if (StrUtil.isNotEmpty(startRegion)&&StrUtil.isNotEmpty(nextRegion)) {
for (LimitRegional limitRegional : dataList) { for (LimitRegional limitRegional : dataList) {
if (startRegion.equals(limitRegional.getStart_regional()) && nextRegion.equals(limitRegional.getNext_regional())){ if (startRegion.equals(limitRegional.getStart_regional()) && nextRegion.equals(limitRegional.getNext_regional())) {
return ConvertUtil.convert(limitRegional, LimitRegionalDto.class); return ConvertUtil.convert(limitRegional, LimitRegionalDto.class);
} }
} }
}
return null; return null;
} }

View File

@@ -510,4 +510,6 @@ public interface TaskService extends CommonService<Task> {
* @return AcsTask * @return AcsTask
*/ */
TaskDto findByTaskCode(String task_code); 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.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.json.JSONUtil;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; 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.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper; 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)) { if (!StrUtil.isEmpty(point_code)) {
wrapper.and(task -> task.like(Task::getStart_point_code, point_code).or().like(Task::getNext_point_code, 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); wrapper.eq(Task::getTask_type, task_type);
} }
if (!StrUtil.isEmpty(is_over)) { if (!StrUtil.isEmpty(is_over)) {
@@ -498,7 +500,7 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
Iterator<TaskDto> iterator = tasks.iterator(); Iterator<TaskDto> iterator = tasks.iterator();
if (iterator.hasNext()) { if (iterator.hasNext()) {
TaskDto task = iterator.next(); TaskDto task = iterator.next();
if(StrUtil.equals(task.getTask_status(), status)){ if (StrUtil.equals(task.getTask_status(), status)) {
taskDtoList.add(task); taskDtoList.add(task);
} }
} }
@@ -559,12 +561,12 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
DeviceService deviceService = SpringContextHolder.getBean(DeviceServiceImpl.class); DeviceService deviceService = SpringContextHolder.getBean(DeviceServiceImpl.class);
DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class); DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class);
Device nextdevice = appService.findDeviceByCode(next_device_code); Device nextdevice = appService.findDeviceByCode(next_device_code);
if (nextdevice == null){ if (nextdevice == null) {
//TODO 国际化处理 //TODO 国际化处理
throw new BadRequestException("终点设备未配置"); throw new BadRequestException("终点设备未配置");
} }
Device startdevice = appService.findDeviceByCode(start_device_code); Device startdevice = appService.findDeviceByCode(start_device_code);
if (startdevice == null){ if (startdevice == null) {
//TODO 国际化处理 //TODO 国际化处理
throw new BadRequestException("起点设备未配置"); throw new BadRequestException("起点设备未配置");
} }
@@ -1517,6 +1519,13 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
return null; 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解析成集合 * 把多个字符串拼接的inst_nextDevice_code解析成集合
* *

View File

@@ -11,6 +11,9 @@ one_message10=\u4EFB\u52A1\u53F7\u4E3A\u7A7A
one_message11=\u672A\u627E\u5230\u8F7D\u5177\u53F7 one_message11=\u672A\u627E\u5230\u8F7D\u5177\u53F7
one_message13=\u7533\u8BF7\u4EFB\u52A1\u6210\u529F one_message13=\u7533\u8BF7\u4EFB\u52A1\u6210\u529F
one_message14=\u7533\u8BF7\u4EFB\u52A1\u5931\u8D25 one_message14=\u7533\u8BF7\u4EFB\u52A1\u5931\u8D25
one_message15=\u7533\u8BF7AGV\u642C\u8FD0\u4EFB\u52A1\u63A5\u53E3\u4E0D\u901A
one_message16=\u7533\u8BF7AGV\u642C\u8FD0\u4EFB\u52A1\u6210\u529F
one_message17=\u7533\u8BF7AGV\u642C\u8FD0\u4EFB\u52A1\u5931\u8D25
one_mode1=\u7533\u8BF7\u5165\u5E93\u4EFB\u52A1 one_mode1=\u7533\u8BF7\u5165\u5E93\u4EFB\u52A1
one_mode2=\u7533\u8BF7\u7A7A\u6258\u76D8\u5165\u5E93 one_mode2=\u7533\u8BF7\u7A7A\u6258\u76D8\u5165\u5E93
one_mode3=\u7533\u8BF7AGV\u4EFB\u52A1 one_mode3=\u7533\u8BF7AGV\u4EFB\u52A1

View File

@@ -11,6 +11,9 @@ one_message10=The task number is empty
one_message11=Vehicle number not found one_message11=Vehicle number not found
one_message13=Request task successfully one_message13=Request task successfully
one_message14=Task request failed one_message14=Task request failed
one_message15=The interface for applying for a complement to the AGV carrying task fails. Procedure
one_message16=Succeeded in applying for the AGV transfer task. Procedure
one_message17=Failed to apply for the AGV transfer task. Procedure
one_mode1=Request a warehouse entry task one_mode1=Request a warehouse entry task
one_mode2=Request empty pallets for storage one_mode2=Request empty pallets for storage
one_mode3=Request AGV one_mode3=Request AGV

View File

@@ -11,6 +11,9 @@ one_message10=Nomor misi kosong
one_message11=Tidak ada nomor muatan yang ditemukan one_message11=Tidak ada nomor muatan yang ditemukan
one_message13=Sukses menerapkan misi one_message13=Sukses menerapkan misi
one_message14=Misi aplikasi gagal one_message14=Misi aplikasi gagal
one_message15=Permintaan kode tambahan AGV memindahkan antarmuka misi tidak tersedia
one_message16=Minta ijin ke operasi AGV
one_message17=Aplikasi bantuan AGV pemindahan gagal
one_mode1=Berlaku untuk tugas pustaka one_mode1=Berlaku untuk tugas pustaka
one_mode2=Pendaftaran nampan kosong one_mode2=Pendaftaran nampan kosong
one_mode3=Permintaan AGV one_mode3=Permintaan AGV

View File

@@ -11,6 +11,9 @@ one_message10=\u4EFB\u52A1\u53F7\u4E3A\u7A7A
one_message11=\u672A\u627E\u5230\u8F7D\u5177\u53F7 one_message11=\u672A\u627E\u5230\u8F7D\u5177\u53F7
one_message13=\u7533\u8BF7\u4EFB\u52A1\u6210\u529F one_message13=\u7533\u8BF7\u4EFB\u52A1\u6210\u529F
one_message14=\u7533\u8BF7\u4EFB\u52A1\u5931\u8D25 one_message14=\u7533\u8BF7\u4EFB\u52A1\u5931\u8D25
one_message15=\u7533\u8BF7\u8865\u7801AGV\u642C\u8FD0\u4EFB\u52A1\u63A5\u53E3\u4E0D\u901A
one_message16=\u7533\u8BF7\u8865\u7801AGV\u642C\u8FD0\u4EFB\u52A1\u6210\u529F
one_message17=\u7533\u8BF7\u8865\u7801AGV\u642C\u8FD0\u4EFB\u52A1\u5931\u8D25
one_mode1=\u7533\u8BF7\u5165\u5E93\u4EFB\u52A1 one_mode1=\u7533\u8BF7\u5165\u5E93\u4EFB\u52A1
one_mode2=\u7533\u8BF7\u7A7A\u6258\u76D8\u5165\u5E93 one_mode2=\u7533\u8BF7\u7A7A\u6258\u76D8\u5165\u5E93
one_mode3=\u7533\u8BF7AGV\u4EFB\u52A1 one_mode3=\u7533\u8BF7AGV\u4EFB\u52A1