This commit is contained in:
2023-03-01 11:09:00 +08:00
33 changed files with 1616 additions and 423 deletions

View File

@@ -8,6 +8,7 @@ import org.nl.acs.agv.server.NDCAgvService;
import org.nl.acs.device.service.DeviceService;
import org.nl.acs.device_driver.basedriver.agv.ndcone.AgvNdcOneDeviceDriver;
import org.nl.acs.device_driver.basedriver.agv.ndctwo.AgvNdcTwoDeviceDriver;
import org.nl.acs.device_driver.basedriver.standard_autodoor.StandardAutodoorDeviceDriver;
import org.nl.acs.ext.wms.service.AcsToWmsService;
import org.nl.acs.ext.wms.service.impl.AcsToWmsServiceImpl;
import org.nl.acs.instruction.service.InstructionService;
@@ -132,6 +133,8 @@ public class TwoNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
String device_code = null;
String old_device_code = null;
String emptyNum = null;
//自动门
StandardAutodoorDeviceDriver standardAutodoorDeviceDriver;
if (agvaddr != 0) {
old_device_code = deviceService.queryDeviceCodeByAddress(agvaddr);
if (StrUtil.contains(old_device_code, "-")) {
@@ -187,6 +190,34 @@ public class TwoNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
instructionService.cancelNOSendAgv(inst.getInstruction_id());
}
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
} else if (phase == 0x50) {
if (ObjectUtil.isEmpty(device_code)) {
log.info(agvaddr + "对应设备号为空!");
return;
}
if (device.getDeviceDriver() instanceof StandardAutodoorDeviceDriver) {
standardAutodoorDeviceDriver = (StandardAutodoorDeviceDriver) device.getDeviceDriver();
standardAutodoorDeviceDriver.writing("to_open","1");
standardAutodoorDeviceDriver.writing("to_close","0");
if(standardAutodoorDeviceDriver.getOpen() == 1){
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
}
}
} else if (phase == 0x51) {
if (ObjectUtil.isEmpty(device_code)) {
log.info(agvaddr + "对应设备号为空!");
return;
}
if (device.getDeviceDriver() instanceof StandardAutodoorDeviceDriver) {
standardAutodoorDeviceDriver = (StandardAutodoorDeviceDriver) device.getDeviceDriver();
standardAutodoorDeviceDriver.writing("to_close","1");
standardAutodoorDeviceDriver.writing(
"to_open","0");
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
}
} else {
//上报异常信息
//不需要WCS反馈

View File

@@ -47,7 +47,9 @@ public enum DriverTypeEnum {
SIEMENS_ONEFLOOR_AGV_CONVEYOR(17, "siemens_onefloor_agv_conveyor", "西门子-1LAGV-输送机驱动", "conveyor"),
PHOTOELECTRIC_INSPECTION_SITE(19, "photoelectric_inspection_site", "光电-检测站点", "conveyor");
PHOTOELECTRIC_INSPECTION_SITE(19, "photoelectric_inspection_site", "光电-检测站点", "conveyor"),
STANDARD_AUTODOOR(20, "standard_autodoor", "标准版-自动门", "autodoor");
//驱动索引

View File

@@ -12,6 +12,8 @@ import org.nl.acs.auto.run.TwoNDCSocketConnectionAutoRun;
import org.nl.acs.device.service.DeviceService;
import org.nl.acs.device_driver.DeviceDriver;
import org.nl.acs.device_driver.basedriver.photoelectric_inspection_site.PhotoelectricInspectionSiteDeviceDriver;
import org.nl.acs.device_driver.basedriver.standard_autodoor.StandardAutodoorDeviceDriver;
import org.nl.acs.device_driver.basedriver.standard_inspect_site.StandardInspectSiteDeviceDriver;
import org.nl.acs.device_driver.basedriver.standard_ordinary_site.StandardOrdinarySiteDeviceDriver;
import org.nl.acs.device_driver.basedriver.standard_storage.StandardStorageDeviceDriver;
import org.nl.acs.device_driver.driver.AbstractDeviceDriver;
@@ -114,6 +116,10 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
StandardStorageDeviceDriver standardStorageDeviceDriver;
//普通-光电检测
PhotoelectricInspectionSiteDeviceDriver photoelectricInspectionSiteDeviceDriver;
//标准-光电检测
StandardInspectSiteDeviceDriver standardInspectSiteDeviceDriver;
//自动门
StandardAutodoorDeviceDriver standardAutodoorDeviceDriver;
if (phase == 0x02) {
if (ObjectUtil.isEmpty(inst)) {
@@ -184,6 +190,12 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
photoelectricInspectionSiteDeviceDriver = (PhotoelectricInspectionSiteDeviceDriver) device.getDeviceDriver();
if(photoelectricInspectionSiteDeviceDriver.getMove() == 1)
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
} else if (device.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver){
standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) device.getDeviceDriver();
standardInspectSiteDeviceDriver.writing("to_command","1");
if(standardInspectSiteDeviceDriver.getMove() == 1 && standardInspectSiteDeviceDriver.getAction() == 1){
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
}
}
else {
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
@@ -240,6 +252,12 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
this.setPhase(phase);
} else if (device.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver){
standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) device.getDeviceDriver();
standardInspectSiteDeviceDriver.writing("to_command","0");
if(standardInspectSiteDeviceDriver.getMove() == 0 ){
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
}
} else {
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
}
@@ -419,6 +437,12 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
photoelectricInspectionSiteDeviceDriver = (PhotoelectricInspectionSiteDeviceDriver) device.getDeviceDriver();
if(photoelectricInspectionSiteDeviceDriver.getMove() == 0)
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
} else if (device.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver){
standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) device.getDeviceDriver();
standardInspectSiteDeviceDriver.writing("to_command","1");
if(standardInspectSiteDeviceDriver.getMove() == 0 && standardInspectSiteDeviceDriver.getAction() ==1 ){
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
}
}
else {
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
@@ -474,6 +498,12 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
}
this.setPhase(phase);
} else if (device.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver){
standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) device.getDeviceDriver();
standardInspectSiteDeviceDriver.writing("to_command","0");
if(standardInspectSiteDeviceDriver.getMove() == 1 ){
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
}
} else {
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
}
@@ -481,9 +511,6 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
//到达放货点
//Itype=1、3,需要WCS反馈
else if (phase == 0x10) {
if (agvaddr == 0) {
agvaddr = agvaddr_copy;
}
if (agvaddr < 1) {
logServer.deviceExecuteLog(this.device_code, "", "", "agv地址参数有误,phase:" + phase);
return;
@@ -601,22 +628,15 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
} //进入区域phase值
else if (phase == 0x50) {
if (ObjectUtil.isEmpty(inst)) {
log.info("未找到指令号{}对应的指令", ikey);
return;
}
region = agvaddr;
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
}
//离开区域phase值
else if (phase == 0x51) {
if (ObjectUtil.isEmpty(inst)) {
log.info("未找到指令号{}对应的指令", ikey);
return;
}
region = agvaddr;
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
}
//上报异常信息
//不需要WCS反馈

View File

@@ -16,6 +16,7 @@ import org.nl.acs.device_driver.RouteableDeviceDriver;
import org.nl.acs.device_driver.basedriver.hongxiang_conveyor.HongXiangStationDeviceDriver;
import org.nl.acs.device_driver.basedriver.hongxiang_device.HongXiangConveyorDeviceDriver;
import org.nl.acs.device_driver.basedriver.photoelectric_inspection_site.PhotoelectricInspectionSiteDeviceDriver;
import org.nl.acs.device_driver.basedriver.standard_inspect_site.StandardInspectSiteDeviceDriver;
import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver;
import org.nl.acs.device_driver.driver.ExecutableDeviceDriver;
import org.nl.acs.ext.wms.service.AcsToWmsService;
@@ -87,7 +88,7 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
Integer heartbeat_tag;
private Date instruction_require_time = new Date();
private int instruction_require_time_out;
private int instruction_require_time_out = 3000;
//行架机械手申请任务成功标识
boolean requireSucess = false;
@@ -531,33 +532,40 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
Device startdevice = deviceAppService.findDeviceByCode(start_device_code);
PhotoelectricInspectionSiteDeviceDriver photoelectricInspectionSiteDeviceDriver;
HongXiangConveyorDeviceDriver hongXiangConveyorDeviceDriver;
StandardInspectSiteDeviceDriver standardInspectSiteDeviceDriver;
if (startdevice.getDeviceDriver() instanceof PhotoelectricInspectionSiteDeviceDriver) {
photoelectricInspectionSiteDeviceDriver = (PhotoelectricInspectionSiteDeviceDriver) startdevice.getDeviceDriver();
if (photoelectricInspectionSiteDeviceDriver.getMove() != 1) {
notCreateInstMessage = "手动创建指令未下发电气信号原因->取货位-烘箱对接位:" + photoelectricInspectionSiteDeviceDriver.getDevice_code() + "无货,无法下发指令!";
notCreateInstMessage = "手动创建指令未下发电气信号原因->取货位-烘箱对接位:" + photoelectricInspectionSiteDeviceDriver.getDevice_code() + "无货,无法下发指令!指令号:"+instruction.getInstruction_code();
return false;
}
}
if (startdevice.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) {
standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) startdevice.getDeviceDriver();
if (standardInspectSiteDeviceDriver.getMove() != 1) {
notCreateInstMessage = "手动创建指令未下发电气信号原因->取货位-烘箱对接位:" + standardInspectSiteDeviceDriver.getDevice_code() + "无货,无法下发指令!指令号:"+instruction.getInstruction_code();
return false;
}
}
if (startdevice.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) {
hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) startdevice.getDeviceDriver();
if (hongXiangConveyorDeviceDriver.getMode() == 0 || hongXiangConveyorDeviceDriver.getMove() == 0) {
notCreateInstMessage = "手动创建指令未下发电气信号原因->取货位-烘箱:" + hongXiangConveyorDeviceDriver.getDevice_code() + "无货,无法下发指令!";
notCreateInstMessage = "手动创建指令未下发电气信号原因->取货位-烘箱:" + hongXiangConveyorDeviceDriver.getDevice_code() + "未联机或无货,无法下发指令!指令号:"+instruction.getInstruction_code();
return false;
}
}
if (nextdevice.getDeviceDriver() instanceof PhotoelectricInspectionSiteDeviceDriver) {
photoelectricInspectionSiteDeviceDriver = (PhotoelectricInspectionSiteDeviceDriver) nextdevice.getDeviceDriver();
if (photoelectricInspectionSiteDeviceDriver.getMove() != 0) {
notCreateInstMessage = "手动创建指令未下发电气信号原因->放货位-烘箱对接位:" + photoelectricInspectionSiteDeviceDriver.getDevice_code() + "有货,无法下发指令!";
if (nextdevice.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) {
standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) nextdevice.getDeviceDriver();
if (standardInspectSiteDeviceDriver.getMove() != 0) {
notCreateInstMessage = "手动创建指令未下发电气信号原因->放货位-烘箱对接位:" + standardInspectSiteDeviceDriver.getDevice_code() + "有货,无法下发指令!指令号:"+instruction.getInstruction_code();
return false;
}
}
if (nextdevice.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) {
hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) nextdevice.getDeviceDriver();
if (hongXiangConveyorDeviceDriver.getMode() == 0 || hongXiangConveyorDeviceDriver.getMove() == 1) {
notCreateInstMessage = "手动创建指令未下发电气信号原因->放货位-烘箱:" + hongXiangConveyorDeviceDriver.getDevice_code() + "有货,无法下发指令!";
notCreateInstMessage = "手动创建指令未下发电气信号原因->放货位-烘箱:" + hongXiangConveyorDeviceDriver.getDevice_code() + "未联机或者有货,无法下发指令!指令号:"+instruction.getInstruction_code();
return false;
}
}
@@ -584,7 +592,10 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
this.writing("to_target", next_addr);
this.writing("to_task", instruction.getInstruction_code());
this.writing("to_command", "1");
if (nextdevice.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) {
hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) nextdevice.getDeviceDriver();
hongXiangConveyorDeviceDriver.writing("to_open_door","1");
}
this.setNow_steps_type(2);
this.setRequireSucess(true);
return true;
@@ -603,6 +614,7 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
Device startdevice = deviceAppService.findDeviceByCode(task.getStart_device_code());
PhotoelectricInspectionSiteDeviceDriver photoelectricInspectionSiteDeviceDriver;
HongXiangConveyorDeviceDriver hongXiangConveyorDeviceDriver;
StandardInspectSiteDeviceDriver standardInspectSiteDeviceDriver;
if (startdevice.getDeviceDriver() instanceof PhotoelectricInspectionSiteDeviceDriver) {
photoelectricInspectionSiteDeviceDriver = (PhotoelectricInspectionSiteDeviceDriver) startdevice.getDeviceDriver();
if (photoelectricInspectionSiteDeviceDriver.getMove() != 1) {
@@ -610,6 +622,13 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
return false;
}
}
if (startdevice.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) {
standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) startdevice.getDeviceDriver();
if (standardInspectSiteDeviceDriver.getMove() != 1) {
notCreateInstMessage = "就绪任务未创建指令原因->取货位-烘箱对接位:" + standardInspectSiteDeviceDriver.getDevice_code() + "光电无货,无法生成指令!";
return false;
}
}
if (startdevice.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) {
hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) startdevice.getDeviceDriver();
if (hongXiangConveyorDeviceDriver.getMode() == 0 || hongXiangConveyorDeviceDriver.getMove() == 0) {
@@ -632,6 +651,13 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
return false;
}
}
if (nextdevice.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) {
standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) nextdevice.getDeviceDriver();
if (standardInspectSiteDeviceDriver.getMove() != 0) {
notCreateInstMessage = "就绪任务未创建指令原因->放货位-烘箱对接位:" + standardInspectSiteDeviceDriver.getDevice_code() + "光电有货,无法生成指令!";
return false;
}
}
String taskid = task.getTask_id();
String taskcode = task.getTask_code();
String vehiclecode = task.getVehicle_code();

View File

@@ -102,7 +102,7 @@ public class SiemensConveyorLabelingDeviceDriver extends AbstractOpcDeviceDriver
private Date require_empty_in_time = new Date();
private Date require_empty_out_time = new Date();
private int instruction_require_time_out;
private int instruction_require_time_out =3000;
// 行架机械手申请任务成功标识
boolean requireSucess = false;
boolean requireApplyLabelingSuccess = false;
@@ -214,24 +214,12 @@ public class SiemensConveyorLabelingDeviceDriver extends AbstractOpcDeviceDriver
var17.printStackTrace();
inst_message = var17.getMessage();
logServer.deviceExecuteLog(this.getDevice_code(), "", "", "读取信号值时出现异常:" + var17.getMessage());
// return;
}
// if (!this.itemProtocol.getIsonline()) {
// this.setIsonline(false);
// this.setIserror(true);
// message = "信号量同步异常";
// //未联机
// } else
if (mode == 0) {
this.setIsonline(false);
message = "未联机";
// 有报警
// } else if (error != 0) {
// this.setIsonline(false);
// this.setIserror(true);
// message = "有报警";
// //无报警
} else {
this.setIsonline(true);
this.setIserror(false);

View File

@@ -225,19 +225,6 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
inst1.setInstruction_status("1");
inst1.setExecute_device_code(this.getDevice_code());
instructionService.update(inst1);
// TaskDto taskDto = taskserver.findByCodeFromCache(inst1.getTask_code());
// if (!ObjectUtil.isEmpty(taskDto)) {
// if (StrUtil.isNotEmpty(taskDto.getExt_task_id())) {
// JSONArray array = new JSONArray();
// JSONObject map = new JSONObject();
// map.put("task_id", taskDto.getExt_task_id());
// map.put("task_status", "1");
// array.add(map);
// acsToWmsService.feedbackTaskStatusToWms(array);
// }
// }
;
//this.setNow_steps_type1(1);
}
}
}
@@ -1213,8 +1200,6 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
public void writing(String param, String value) {
String to_param = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
+ "." + param;
//String opcservcerid = this.getDevice().getOpc_server_id();
//Server server = ReadUtil.getServer(opcservcerid);
Map<String, Object> itemMap = new HashMap<String, Object>();
itemMap.put(to_param, Integer.parseInt(value));

View File

@@ -0,0 +1,82 @@
package org.nl.acs.device_driver.basedriver.standard_autodoor;
import cn.hutool.core.util.StrUtil;
import lombok.extern.slf4j.Slf4j;
import org.nl.acs.device.device_driver.standard_inspect.ItemDto;
import java.util.ArrayList;
import java.util.List;
@Slf4j
public class ItemProtocol {
public static String item_open = "open";
public static String item_close = "close";
public static String item_to_open = "to_open";
public static String item_to_close = "to_close";
private StandardAutodoorDeviceDriver driver;
public ItemProtocol(StandardAutodoorDeviceDriver driver) {
this.driver = driver;
}
public int getOpen() {
return this.getOpcIntegerValue(item_open);
}
public int getClose() {
return this.getOpcIntegerValue(item_close);
}
public int getToOpen() {
return this.getOpcIntegerValue(item_to_open);
}
public int getToClose() {
return this.getOpcIntegerValue(item_to_close);
}
public int getOpcIntegerValue(String protocol) {
Integer value = this.driver.getIntegeregerValue(protocol);
if (value == null) {
// log.error(this.getDriver().getDeviceCode() + ":protocol " + protocol + " 信号同步异常!");
} else {
return value;
}
return 0;
}
public String getOpcStringValue(String protocol) {
String value = this.driver.getStringValue(protocol);
if (StrUtil.isEmpty(value)) {
} else {
return value;
}
return "0";
}
public static List<ItemDto> getReadableItemDtos() {
ArrayList list = new ArrayList();
list.add(new ItemDto(item_open, "开到位", "10001"));
list.add(new ItemDto(item_close, "关到位", "10002"));
return list;
}
public static List<ItemDto> getWriteableItemDtos() {
ArrayList list = new ArrayList();
list.add(new ItemDto(item_to_open, "下发开门", "00001" ));
list.add(new ItemDto(item_to_close, "下发关门", "00002"));
return list;
}
@Override
public String toString() {
return "";
}
}

View File

@@ -0,0 +1,63 @@
package org.nl.acs.device_driver.basedriver.standard_autodoor;
import org.nl.acs.device.device_driver.standard_inspect.ItemDto;
import org.nl.acs.device_driver.DeviceDriver;
import org.nl.acs.device_driver.defination.OpcDeviceDriverDefination;
import org.nl.acs.opc.Device;
import org.nl.acs.opc.DeviceType;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
/**
* 自动门驱动定义
*/
@Service
public class StandardAutodoorDefination implements OpcDeviceDriverDefination {
@Override
public String getDriverCode() {
return "standard_autodoor";
}
@Override
public String getDriverName() {
return "标准版-自动门";
}
@Override
public String getDriverDescription() {
return "标准版-自动门";
}
@Override
public DeviceDriver getDriverInstance(Device device) {
return (new StandardAutodoorDeviceDriver()).setDevice(device).setDriverDefination(this);
}
@Override
public Class<? extends DeviceDriver> getDeviceDriverType() {
return StandardAutodoorDeviceDriver.class;
}
@Override
public List<DeviceType> getFitDeviceTypes() {
List<DeviceType> types = new LinkedList();
types.add(DeviceType.conveyor);
return types;
}
@Override
public List<ItemDto> getReadableItemDtos() {
return ItemProtocol.getReadableItemDtos();
}
@Override
public List<ItemDto> getWriteableItemDtos() {
return ItemProtocol.getWriteableItemDtos();
}
}

View File

@@ -0,0 +1,69 @@
package org.nl.acs.device_driver.basedriver.standard_autodoor;
import lombok.Data;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.nl.acs.device_driver.DeviceDriver;
import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver;
import org.nl.acs.device_driver.driver.ExecutableDeviceDriver;
import org.nl.acs.log.service.DeviceExecuteLogService;
import org.nl.acs.opc.Device;
import org.nl.modules.wql.util.SpringContextHolder;
import java.util.HashMap;
import java.util.Map;
/**
* 自动门驱动
*/
@Slf4j
@Data
@RequiredArgsConstructor
public class StandardAutodoorDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver {
protected ItemProtocol itemProtocol = new ItemProtocol(this);
DeviceExecuteLogService logServer = SpringContextHolder.getBean("deviceExecuteLogServiceImpl");
int open = 0;
int close = 0;
int last_open = 0;
int last_close = 0;
String device_code = null;
@Override
public Device getDevice() {
return this.device;
}
@Override
public void execute() {
String message = null;
device_code = this.getDevice().getDevice_code();
open = this.itemProtocol.getOpen();
close = this.itemProtocol.getClose();
if (open != last_open) {
}
if (close != last_close) {
}
last_open = open;
last_close = close;
}
public void writing(String param, String value) {
String to_param = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
+ "." + param;
Map<String, Object> itemMap = new HashMap<String, Object>();
itemMap.put(to_param, Integer.parseInt(value));
this.control(itemMap);
logServer.deviceExecuteLog(device_code, "", "", "下发电气信号设备号:" + device_code + ",下发电气:" + to_param + ",下发电气值:" + value);
}
}

View File

@@ -507,22 +507,6 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe
message ="当前载具号"+container_code+"查找对应指令起点与当前设备不符";
logServer.deviceExecuteLog(this.device_code, "", "", "申请任务"
+"当前载具号"+container_code+"查找对应指令起点与当前设备不符");
// this.setIserror(true);
// List list = new ArrayList();
// Map map = new HashMap();
// map.put("code","to_target");
// map.put("value","1011");
// list.add(map);
// Map map2 = new HashMap();
// map2.put("code","to_command");
// map2.put("value","1");
// Map map3 = new HashMap();
// map3.put("code","to_task");
// map3.put("value","0");
// list.add(map3);
// this.writing(list);
// this.setRequireSucess(true);
// this.setApplySucess(true);
return false;
}
this.setIserror(false);
@@ -555,16 +539,22 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe
message = "下发电气任务号成功";
logServer.deviceExecuteLog(this.device_code, "", "", "申请任务时该载具号"+container_code
+"已存在对应任务,下发电气信号");
// if(task != Integer.parseInt(instdto.getInstruction_code()) ){
// this.writing(list);
// logServer.deviceExecuteLog(device_code, "", "", instdto.getInstruction_code() + "再次下发电气信号");
// }
requireSucess = true;
applySucess = true;
} else {
message = "任务号:" + taskdto.getTask_code() + "未找到指令";
}
return true;
} else {
//需要判断指令中的指令 再次请求不能生成
if (!ObjectUtils.isEmpty(instructionService.findByTaskcodeAndStatus(taskdto.getTask_code(),"1"))) {
{
logServer.deviceExecuteLog(this.device_code, "", "", "申请任务时该载具号" + container_code
+ "已存在对应任务");
requireSucess = true;
applySucess = true;
}
}
}
String taskid = taskdto.getTask_id();
@@ -722,6 +712,8 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe
map3.put("value","0");
list.add(map3);
this.writing(list);
requireSucess = true;
applySucess = true;
message = "申请任务失败接口不通下发退回";
} else {
if (jo.getInteger("status") == 200) {

View File

@@ -14,13 +14,12 @@ public class ItemProtocol {
public static String item_heartbeat = "heartbeat";
public static String item_mode = "mode";
public static String item_move = "move";
public static String item_ioaction = "ioaction";
public static String item_action = "action";
public static String item_error = "error";
public static String item_task = "task";
public static String item_to_command = "to_command";
public static String item_to_target = "to_target";
public static String item_to_task = "to_task";
public static String item_weight = "weight";
private StandardInspectSiteDeviceDriver driver;
@@ -40,8 +39,8 @@ public class ItemProtocol {
return this.getOpcIntegerValue(item_move);
}
public int getIoaction() {
return this.getOpcIntegerValue(item_ioaction);
public int getAction() {
return this.getOpcIntegerValue(item_action);
}
public int getError() {
@@ -87,16 +86,17 @@ public class ItemProtocol {
public static List<ItemDto> getReadableItemDtos() {
ArrayList list = new ArrayList();
list.add(new ItemDto(item_heartbeat, "心跳", "DB600.B0"));
list.add(new ItemDto(item_mode, "工作状态", "DB600.B1", Boolean.valueOf(true)));
list.add(new ItemDto(item_move, "光电开关信号", "DB600.B2"));
list.add(new ItemDto(item_error, "报警信号", "DB600.B6"));
list.add(new ItemDto(item_task, "任务", "DB600.D8"));
list.add(new ItemDto(item_mode, "工作状态", "DB600.B2"));
list.add(new ItemDto(item_move, "光电开关信号", "DB600.B3"));
list.add(new ItemDto(item_action, "动作信号", "DB600.B4"));
list.add(new ItemDto(item_error, "报警信", "DB600.B5"));
list.add(new ItemDto(item_task, "任务号", "DB600.D6"));
return list;
}
public static List<ItemDto> getWriteableItemDtos() {
ArrayList list = new ArrayList();
list.add(new ItemDto(item_to_command, "作业命令", "DB601.W2", Boolean.valueOf(true)));
list.add(new ItemDto(item_to_command, "作业命令", "DB601.W2"));
list.add(new ItemDto(item_to_target, "目标站", "DB601.W4"));
list.add(new ItemDto(item_to_task, "任务号", "DB601.D8"));
return list;

View File

@@ -50,19 +50,10 @@ public class StandardInspectSiteDefination implements OpcDeviceDriverDefination
return types;
}
@Override
public List<ItemDto> getReadableItemDtos() {
return getReadableItemDtos2();
}
public static List<ItemDto> getReadableItemDtos2() {
List<ItemDto> list = new ArrayList();
list.add(new ItemDto(ItemProtocol.item_heartbeat, "心跳", "DB600.B0"));
list.add(new ItemDto(ItemProtocol.item_mode, "工作状态", "DB600.B1", true));
list.add(new ItemDto(ItemProtocol.item_move, "光电开关信号", "DB600.B2"));
list.add(new ItemDto(ItemProtocol.item_error, "报警信号", "DB600.B6"));
list.add(new ItemDto(ItemProtocol.item_task, "任务号", "DB600.D8"));
return list;
return ItemProtocol.getReadableItemDtos();
}
@Override
@@ -70,4 +61,5 @@ public class StandardInspectSiteDefination implements OpcDeviceDriverDefination
return ItemProtocol.getWriteableItemDtos();
}
}

View File

@@ -15,6 +15,7 @@ import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver;
import org.nl.acs.device_driver.driver.ExecutableDeviceDriver;
import org.nl.acs.instruction.service.InstructionService;
import org.nl.acs.instruction.service.dto.Instruction;
import org.nl.acs.log.service.DeviceExecuteLogService;
import org.nl.acs.monitor.DeviceStageMonitor;
import org.nl.acs.opc.Device;
import org.nl.acs.opc.DeviceAppService;
@@ -43,14 +44,10 @@ import java.util.Map;
@RequiredArgsConstructor
public class StandardInspectSiteDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver , DeviceStageMonitor {
protected ItemProtocol itemProtocol = new ItemProtocol(this);
@Autowired
InstructionService instructionService = SpringContextHolder.getBean("instructionServiceImpl");
@Autowired
DeviceService deviceservice = SpringContextHolder.getBean("deviceServiceImpl");
@Autowired
RouteLineService routelineserver = SpringContextHolder.getBean("routeLineServiceImpl");
@Autowired
TaskService taskserver = SpringContextHolder.getBean("taskServiceImpl");
DeviceExecuteLogService logServer = SpringContextHolder.getBean("deviceExecuteLogServiceImpl");
String container;
String container_type_desc;
String last_container_type_desc;
@@ -64,6 +61,8 @@ public class StandardInspectSiteDeviceDriver extends AbstractOpcDeviceDriver imp
int error = 0;
int move = 0;
int task = 0;
int action = 0;
int last_action = 0;
int last_mode = 0;
int last_error = 0;
int last_move = 0;
@@ -117,7 +116,7 @@ public class StandardInspectSiteDeviceDriver extends AbstractOpcDeviceDriver imp
//暂定 0就绪 1请求取货 2取货完成 3请求放货 4放货完成 5取货完成离开 6放货完成离开 7请求进入区域 8请求离开区域
int flag;
String devicecode;
String device_code = null;
@Override
public Device getDevice() {
@@ -129,91 +128,41 @@ public class StandardInspectSiteDeviceDriver extends AbstractOpcDeviceDriver imp
public void execute() {
String message = null;
try {
String device_code = this.getDeviceCode();
device_code = this.getDeviceCode();
mode = this.itemProtocol.getMode();
error = this.itemProtocol.getError();
move = this.itemProtocol.getMove();
action = this.itemProtocol.getAction();
task = this.itemProtocol.getTask();
hasGoods = this.itemProtocol.getMove();
if (mode != last_mode) {
this.setRequireSucess(false);
logServer.deviceExecuteLog(this.device_code, "", "", "信号mode" + last_mode + "->" + mode + "复位请求标记");
}
if (move != last_move) {
logServer.deviceExecuteLog(this.device_code, "", "", "信号move" + last_move + "->" + move);
}
if (error != last_error) {
}
if (this.getApply_handling()) {
String link_device_code = this.getDevice().getExtraValue().get("link_device_code").toString();
DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class);
Device link_device = appService.findDeviceByCode(link_device_code);
StandardInspectSiteDeviceDriver standardInspectSiteDevicedriver;
if (link_device.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) {
standardInspectSiteDevicedriver = (StandardInspectSiteDeviceDriver) link_device.getDeviceDriver();
// if(standardInspectSiteDevicedriver.getMode() != 2){
// log.debug("设备未待机");
// return;
// }
// if(standardInspectSiteDevicedriver.getMove() != 0){
// log.debug("设备不满足放货条件");
// return;
// }
//如果目标设备申请叫料 则允许生成任务
if (standardInspectSiteDevicedriver.getApply_material()) {
TaskDto dto = new TaskDto();
String now = DateUtil.now();
dto.setTask_id(IdUtil.simpleUUID());
dto.setCreate_by(this.getDevice().getDevice_code());
dto.setUpdate_by(this.getDevice().getDevice_code());
dto.setStart_point_code(this.getDevice().getDevice_code());
String taskcode = CodeUtil.getNewCode("TASK_NO");
dto.setTask_code("-" + taskcode);
dto.setTask_status("0");
dto.setPriority("101");
// RouteLineDto jo = routelineserver.findByCode(this.getDevice().getDevice_code());
// String next_device_codecode = jo.getNext_device_code();
// if(StrUtil.isEmpty(next_device_codecode)){
// throw new RuntimeException("该设备未找到对应路由");
// }
dto.setNext_point_code(standardInspectSiteDevicedriver.getDevicecode());
dto.setUpdate_time(now);
dto.setCreate_time(now);
WQLObject wo = WQLObject.getWQLObject("acs_task");
JSONObject json = (JSONObject) JSONObject.toJSON(dto);
wo.insert(json);
standardInspectSiteDevicedriver.setApply_material(false);
}
}
this.setApply_handling(false);
if (action != last_action) {
logServer.deviceExecuteLog(this.device_code, "", "", "信号action" + last_action + "->" + action);
}
} catch (Exception var17) {
return;
}
if (!this.itemProtocol.getIsonline()) {
if (mode == 0) {
this.setIsonline(false);
this.setIserror(true);
message = "信号量同步异常";
//未联机
} else if (mode == 0) {
this.setIsonline(false);
this.setIserror(true);
message = "未联机";
//有报警
} else if (error != 0) {
this.setIsonline(false);
this.setIserror(true);
message = "有报警";
//无报警
} else {
this.setIsonline(true);
this.setIserror(false);
if (error != 0) {
this.setIserror(true);
message = "有报警";
}
message = "";
Instruction instruction = null;
List toInstructions;
@@ -222,76 +171,14 @@ public class StandardInspectSiteDeviceDriver extends AbstractOpcDeviceDriver imp
log.debug("设备运转模式:等待工作");
return;
case 2:
//申请任务
// if (this.getApply_handling()) {
// String link_device_code = this.getDevice().getExtraValue().get("link_device_code").toString();
// DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class);
// Device link_device = appService.findDeviceByCode(link_device_code);
// StandardInspectSiteDeviceDriver standardInspectSiteDevicedriver;
// if(link_device.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) {
// standardInspectSiteDevicedriver = (StandardInspectSiteDeviceDriver) link_device.getDeviceDriver();
// if(standardInspectSiteDevicedriver.getMode() != 2){
// log.debug("设备未待机");
// return;
// }
// if(standardInspectSiteDevicedriver.getMove() != 0){
// log.debug("设备不满足放货条件");
// return;
// }
//
// //如果目标设备申请叫料 则允许生成任务
// if(standardInspectSiteDevicedriver.getApply_material()){
// TaskDto dto = new TaskDto();
// String now = DateUtil.now();
// dto.setTask_id(IdUtil.simpleUUID());
// dto.setCreate_by(this.getDevice().getDevice_code());
// dto.setUpdate_by(this.getDevice().getDevice_code());
// dto.setStart_point_code(this.getDevice().getDevice_code());
//
// String taskcode = CodeGenerateUtil.getNewCode("TASK_NO");
// dto.setTask_code("-"+taskcode);
// dto.setTask_status("0");
// dto.setPriority("101");
// RouteLineDto jo = routelineserver.findByCode(this.getDevice().getDevice_code());
// String next_device_codecode = jo.getNext_device_code();
// if(StrUtil.isEmpty(next_device_codecode)){
// throw new RuntimeException("该设备未找到对应路由");
// }
// dto.setNext_point_code(next_device_codecode);
// dto.setUpdate_time(now);
// dto.setCreate_time(now);
//
// WQLObject wo = WQLObject.getWQLObject("acs_task");
// JSONObject json = (JSONObject) JSONObject.toJSON(dto);
// wo.insert(json);
// standardInspectSiteDevicedriver.setApply_material(false);
// }
// }
// this.setApply_handling(false);
// }
if (material.length() > 0 && qty.length() > 0 && !requireSucess) {
this.instruction_require(container);
}
}
switch (flag) {
//取货完成
case 1:
writing(2);
return;
//放货完成
case 2:
writing(3);
return;
break;
}
}
last_mode = mode;
last_error = error;
last_move = move;
last_action = action;
last_task = task;
}
@@ -306,137 +193,7 @@ public class StandardInspectSiteDeviceDriver extends AbstractOpcDeviceDriver imp
}
}
protected void thingToNothing() {
log.debug("从有货到无货 清理数据");
this.set_last_container(container, container_type_desc);
}
public void set_last_container(String barcode, String type_desc) {
this.set_last_container(barcode);
this.set_last_container_type_desc(type_desc);
}
public void set_last_container(String barcode) {
}
public void set_last_container_type_desc(String type) {
}
public boolean exe_business() {
return true;
}
protected void executing(Instruction instruction) {
this.executing(1, instruction, "");
}
public void executing(int command, Instruction instruction, String appendMessage) {
String to_command = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
+ "." + ItemProtocol.item_to_command;
String to_target = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
+ "." + ItemProtocol.item_to_target;
String to_task = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
+ "." + ItemProtocol.item_to_task;
if (appendMessage == null) {
appendMessage = "";
}
if (instruction != null) {
instruction_num = Integer.parseInt(instruction.getInstruction_code());
}
//String opcservcerid = this.getDevice().getOpc_server_id();
//Server server = ReadUtil.getServer(opcservcerid);
Map<String, Object> itemMap = new HashMap<String, Object>();
itemMap.put(to_command, 1);
itemMap.put(to_task, instruction_num);
this.control(itemMap);
}
public void executing(Server server, Map<String, Object> itemMap) {
this.control(itemMap);
}
public void writing(int command) {
String to_command = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
+ "." + ItemProtocol.item_to_command;
//String opcservcerid = this.getDevice().getOpc_server_id();
//Server server = ReadUtil.getServer(opcservcerid);
Map<String, Object> itemMap = new HashMap<String, Object>();
itemMap.put(to_command, command);
this.control(itemMap);
}
public void writing(int type, int command) {
String to_command = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
+ "." + ItemProtocol.item_to_command;
String to_target = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
+ "." + ItemProtocol.item_to_target;
String to_task = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
+ "." + ItemProtocol.item_to_task;
//String opcservcerid = this.getDevice().getOpc_server_id();
//Server server = ReadUtil.getServer(opcservcerid);
Map<String, Object> itemMap = new HashMap<String, Object>();
if (type == 1) {
itemMap.put(to_command, command);
} else if (type == 2) {
itemMap.put(to_target, command);
} else if (type == 3) {
itemMap.put(to_task, command);
}
this.control(itemMap);
}
public boolean instruction_require(String container_code) {
return instruction_require(container_code, WcsConfig.task_container_type_default_desc);
}
/**
* 请求指令
*
* @param container_code
* @param container_type
*/
public synchronized boolean instruction_require(String container_code, String container_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 false;
} else {
this.instruction_require_time = date;
TaskDto dto = new TaskDto();
String now = DateUtil.now();
dto.setTask_id(IdUtil.simpleUUID());
dto.setCreate_by(this.getDevice().getDevice_code());
dto.setUpdate_by(this.getDevice().getDevice_code());
dto.setStart_point_code(this.getDevice().getDevice_code());
dto.setVehicle_code(container_code);
dto.setVehicle_type(container_type);
String taskcode = CodeUtil.getNewCode("TASK_NO");
dto.setTask_code("-" + taskcode);
dto.setTask_status("0");
dto.setPriority("101");
RouteLineDto jo = routelineserver.findByCode(this.getDevice().getDevice_code());
String next_device_codecode = jo.getNext_device_code();
if (StrUtil.isEmpty(next_device_codecode)) {
throw new RuntimeException("该设备未找到对应路由");
}
dto.setNext_point_code(next_device_codecode);
dto.setUpdate_time(now);
dto.setCreate_time(now);
WQLObject wo = WQLObject.getWQLObject("acs_task");
JSONObject json = (JSONObject) JSONObject.toJSON(dto);
wo.insert(json);
requireSucess = false;
return true;
}
}
@Override
public JSONObject getDeviceStatusName() {
@@ -479,4 +236,14 @@ public class StandardInspectSiteDeviceDriver extends AbstractOpcDeviceDriver imp
public void setDeviceStatus(JSONObject data) {
}
public void writing(String param, String value) {
String to_param = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
+ "." + param;
Map<String, Object> itemMap = new HashMap<String, Object>();
itemMap.put(to_param, Integer.parseInt(value));
this.control(itemMap);
logServer.deviceExecuteLog(device_code, "", "", "下发电气信号设备号:" + device_code + ",下发电气:" + to_param + ",下发电气值:" + value);
}
}

View File

@@ -1,5 +1,6 @@
package org.nl.acs.ext.wms.service.impl;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSON;
@@ -527,6 +528,10 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
continue;
}
if(StrUtil.equals(task_type,"8")){
next_device_code = request.getPut_device_code();
put_device_code = request.getNext_device_code();
}
JSONObject start_device_json = WQLObject.getWQLObject("acs_storage_cell").query("parent_storage_code ='" + start_device_code + "'").uniqueResult(0);
if (!ObjectUtil.isEmpty(start_device_json)) {
@@ -654,8 +659,8 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
}
JSONObject jo = new JSONObject();
jo.put("task_id", IdUtil.simpleUUID());
jo.put("task_code", task_code);
jo.put("task_id", ext_task_id);
jo.put("start_point_code", start_point_code);
jo.put("next_point_code", next_point_code);
jo.put("start_point_code2", start_point_code2);
@@ -688,7 +693,17 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
if (StrUtil.equals(task_dto.getTask_type(), "7")) {
//创建临时指令 不创建、不生成
//等立库反馈成功才能创建任务和指令
Instruction inst = taskService.createTemporaryInst(task_dto);
Instruction inst = null;
try {
inst = taskService.createTemporaryInst(task_dto);
} catch (Exception e){
JSONObject json = new JSONObject();
json.put("task_code", task_code);
json.put("ext_task_id", ext_task_id);
json.put("message", e.getMessage());
errArr.add(json);
continue;
}
Resp resp = acsToLiKuService.sendInst(task_dto.getStorage_task_type(),inst);
if(StrUtil.equals(resp.result,"true")){
@@ -798,10 +813,11 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
}
JSONObject resultJson = new JSONObject();
if (ObjectUtil.isEmpty(errArr)) {
resultJson.put("status", HttpStatus.OK);
} else {
resultJson.put("status", HttpStatus.BAD_REQUEST);
resultJson.put("status", HttpStatus.OK.value());
resultJson.put("message", "操作成功");
} else {
resultJson.put("status", HttpStatus.BAD_REQUEST.value());
resultJson.put("message", "操作失败");
if(ObjectUtil.isNotEmpty(errArr)){
resultJson.put("errArr",errArr);
}

View File

@@ -88,6 +88,8 @@ public interface InstructionService {
Instruction findByTaskcodeAndStatus(String code);
Instruction findByTaskcodeAndStatus(String code,String status);
/**
* 根据任务id查询
*
@@ -158,6 +160,13 @@ public interface InstructionService {
void finishAndCreateNextInst(Instruction dto) throws Exception;
/**
* 完成并创建指令
*
* @param
*/
void finishAndCreateHXInst(Instruction dto) throws Exception;
/**
* 取消指令
*
@@ -261,14 +270,6 @@ public interface InstructionService {
*/
Integer querySameOriginInst(String code);
/**
* 查询相同起点、终点指令的数量
*
* @param code
* @return
*/
//Integer querySameOriginInst(String code);
boolean removeByCodeFromCache(String code);

View File

@@ -261,6 +261,21 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
return null;
}
@Override
public Instruction findByTaskcodeAndStatus(String code,String status) {
Iterator var3 = instructions.iterator();
while (var3.hasNext()) {
Instruction instruction = (Instruction) var3.next();
if (StrUtil.equals(instruction.getTask_code(), code)
&& StrUtil.equals(instruction.getInstruction_status(), status)) {
return instruction;
}
}
return null;
}
@Override
public Instruction findByTaskid(String id, String wherecaluse) {
if (!StrUtil.isEmpty(wherecaluse)) {
@@ -728,11 +743,30 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
TaskDto obj = taskjson.toJavaObject(TaskDto.class);
// =0 则不用再次请求
if (StrUtil.equals(obj.getRequest_again(), "0")) {
if (StrUtil.equals(obj.getNext_device_code(), instnextdevice)) {
taskService.finish(obj.getTask_id());
if(StrUtil.equals(obj.getTask_type(),"8")){
//中转为空
if(StrUtil.isEmpty(obj.getPut_device_code())){
if (StrUtil.equals(obj.getNext_device_code(), instnextdevice)) {
taskService.finish(obj.getTask_id());
} else {
finishAndCreateNextInst(entity);
}
} else {
if (StrUtil.equals(obj.getNext_device_code(), instnextdevice)) {
finishAndCreateHXInst(entity);
} else if (StrUtil.equals(obj.getPut_device_code(), instnextdevice)) {
taskService.finish(obj.getTask_id());
}
}
} else {
finishAndCreateNextInst(entity);
if (StrUtil.equals(obj.getNext_device_code(), instnextdevice)) {
taskService.finish(obj.getTask_id());
} else {
finishAndCreateNextInst(entity);
}
}
}
removeByCodeFromCache(entity.getInstruction_code());
@@ -755,11 +789,30 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
TaskDto obj = taskjson.toJavaObject(TaskDto.class);
// =0 则不用再次请求
if (StrUtil.equals(obj.getRequest_again(), "0")) {
if (StrUtil.equals(obj.getNext_device_code(), instnextdevice)) {
taskService.finish(obj.getTask_id());
if(StrUtil.equals(obj.getTask_type(),"8")){
//中转为空
if(StrUtil.isEmpty(obj.getPut_device_code())){
if (StrUtil.equals(obj.getNext_device_code(), instnextdevice)) {
taskService.finish(obj.getTask_id());
} else {
finishAndCreateNextInst(dto);
}
} else {
if (StrUtil.equals(obj.getNext_device_code(), instnextdevice)) {
finishAndCreateHXInst(dto);
} else if (StrUtil.equals(obj.getPut_device_code(), instnextdevice)) {
taskService.finish(obj.getTask_id());
}
}
} else {
finishAndCreateNextInst(dto);
if (StrUtil.equals(obj.getNext_device_code(), instnextdevice)) {
taskService.finish(obj.getTask_id());
} else {
finishAndCreateNextInst(dto);
}
}
}
DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class);
@@ -876,6 +929,71 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
}
}
@Override
@Transactional(rollbackFor = Exception.class)
public void finishAndCreateHXInst(Instruction dto) {
dto = foramte(dto);
String device_code = dto.getNext_device_code();
WQLObject taskwo = WQLObject.getWQLObject("acs_task");
JSONObject taskjson = taskwo.query("task_id ='" + dto.getTask_id() + "'").uniqueResult(0);
TaskDto acsTask = taskjson.toJavaObject(TaskDto.class);
String next_device_code = acsTask.getPut_device_code();
String start_device_code = dto.getNext_device_code();
String start_point_code = null;
String next_point_code = null;
String start_device =
deviceAppService
.findDeviceByCode(start_device_code)
.getDeviceDriverDefination()
.getFitDeviceTypes()
.get(0)
.name();
String next_device =
deviceAppService
.findDeviceByCode(next_device_code)
.getDeviceDriverDefination()
.getFitDeviceTypes()
.get(0)
.name();
if (StrUtil.equals("storage", start_device)) {
start_point_code = start_device_code + "-" + acsTask.getFrom_y() + "-" + acsTask.getFrom_z();
} else {
start_point_code = start_device_code;
}
if (StrUtil.equals("storage", next_device)) {
next_point_code = next_device_code + "-" + acsTask.getTo_y() + "-" + acsTask.getTo_z();
} else {
next_point_code = next_device_code;
}
Instruction instdto = new Instruction();
instdto.setInstruction_id(IdUtil.simpleUUID());
instdto.setRoute_plan_code(acsTask.getRoute_plan_code());
instdto.setRemark(acsTask.getRemark());
instdto.setMaterial(acsTask.getMaterial());
instdto.setQuantity(acsTask.getQuantity());
instdto.setTask_id(acsTask.getTask_id());
instdto.setTask_code(acsTask.getTask_code());
instdto.setVehicle_code(acsTask.getVehicle_code());
String now = DateUtil.now();
instdto.setCreate_time(now);
instdto.setCreate_by("auto");
instdto.setStart_device_code(start_device_code);
instdto.setNext_device_code(next_device_code);
instdto.setStart_point_code(start_point_code);
instdto.setNext_point_code(next_point_code);
instdto.setPriority(acsTask.getPriority());
instdto.setInstruction_status("0");
instdto.setExecute_device_code(dto.getNext_device_code());
try {
this.create(instdto);
} catch (Exception e) {
e.printStackTrace();
log.error("完成并创建下一条指令", e.getMessage());
}
}
@Override
public void cancel(String id) throws Exception {
// flag= true时取消指令

View File

@@ -367,6 +367,23 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
if (ObjectUtil.isNotEmpty(instruction)) {
list.add(task);
}
} else {
if(StrUtil.equals(task.getTask_type(),"8") && StrUtil.isNotEmpty(task.getPut_device_code()))
{
// if(task.getNext_device_code().equals(device_code)
// && StrUtil.equals(task.getTask_status(), "1")){
// Instruction instruction = instructionService.findByTaskcodeAndStatus(task.getTask_code());
// if (ObjectUtil.isNotEmpty(instruction)) {
// list.add(task);
// }
// }
Instruction instruction = instructionService.findByDeviceCodeFromCache(device_code);
if (ObjectUtil.isNotEmpty(instruction)) {
if(StrUtil.equals(instruction.getStart_device_code(),device_code)){
list.add(task);
}
}
}
}
}
return list;
@@ -777,7 +794,7 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
TaskFeedbackDto feefbackdto = taskFeedbackService.findByCode(entity.getTask_code());
System.out.println(feefbackdto == null);
JSONObject feed_jo = new JSONObject();
feed_jo.put("task_id", entity.getTask_id());
feed_jo.put("task_id", entity.getExt_task_id());
feed_jo.put("task_code", entity.getTask_code());
feed_jo.put("task_status", entity.getTask_status());
JSONArray ja = new JSONArray();
@@ -909,7 +926,7 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
String hasWms = paramService.findByCode(AcsConfig.HASWMS).getValue();
if (!StrUtil.startWith(entity.getTask_code(), "-") && StrUtil.equals(hasWms, "1")) {
JSONObject feed_jo = new JSONObject();
feed_jo.put("task_id", entity.getTask_id());
feed_jo.put("task_id", entity.getExt_task_id());
feed_jo.put("task_code", entity.getTask_code());
feed_jo.put("task_status", entity.getTask_status());
JSONArray ja = new JSONArray();
@@ -939,11 +956,6 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
ParamService paramService = SpringContextHolder.getBean(ParamService.class);
DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class);
InstructionService instructionservice = SpringContextHolder.getBean("instructionServiceImpl");
// InstructionDto inst = instructionservice.findByTaskid(acsTask, "instruction_status < 2
// ");
// if (inst != null) {
// throw new BadRequestException("有指令未完成!");
// }
String taskid = acsTask.getTask_id();
String taskcode = acsTask.getTask_code();
@@ -975,6 +987,9 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial {
List<RouteLineDto> shortPathsList =
routeLineService.getShortPathLines(
start_device_code, acsTask.getNext_device_code(), route_plan_code);
if(ObjectUtil.isEmpty(shortPathsList)){
throw new BadRequestException(start_device_code + "->" + acsTask.getNext_device_code() + "路由不通!");
}
RouteLineDto routeLineDto = shortPathsList.get(0);
String path = routeLineDto.getPath();
String type = routeLineDto.getType();

View File

@@ -65,7 +65,6 @@ public class AutoCreateInst {
String next_point_code2 = acsTask.getNext_point_code2();
String next_device_code2 = acsTask.getNext_device_code2();
String route_plan_code = acsTask.getRoute_plan_code();
String vehicleType = acsTask.getVehicle_type();
String agv_system_type = acsTask.getAgv_system_type();
@@ -158,6 +157,8 @@ public class AutoCreateInst {
instdto.setAgv_inst_type("2");
} else if (StrUtil.equals(task_type, "2")) {
instdto.setAgv_inst_type("3");
} else if (StrUtil.equals(task_type, "8")) {
instdto.setAgv_inst_type("2");
}
} else {
instdto.setAgv_inst_type("4");

View File

@@ -97,6 +97,7 @@ import siemens_conveyor_labeling from '@/views/acs/device/driver/siemens_conveyo
import siemens_conveyor_ckk from '@/views/acs/device/driver/siemens_conveyor_ckk'
import siemens_onefloor_agv_conveyor from '@/views/acs/device/driver/siemens_onefloor_agv_conveyor'
import photoelectric_inspection_site from '@/views/acs/device/driver/photoelectric_inspection_site'
import standard_autodoor from '@/views/acs/device/driver/standard_autodoor'
export default {
name: 'DeviceConfig',
@@ -124,7 +125,8 @@ export default {
siemens_conveyor_labeling,
siemens_conveyor_ckk,
siemens_onefloor_agv_conveyor,
photoelectric_inspection_site
photoelectric_inspection_site,
standard_autodoor
},
dicts: ['device_type'],
mixins: [crud],

View File

@@ -0,0 +1,352 @@
<template>
<!--自动门-->
<div>
<el-card class="box-card" shadow="never">
<div slot="header" class="clearfix">
<span class="role-span">设备协议</span>
</div>
<el-row>
<el-col :span="12">
OpcServer:
<el-select
v-model="opc_id"
placeholder="无"
clearable
@change="changeOpc"
>
<el-option
v-for="item in dataOpcservers"
:key="item.opc_id"
:label="item.opc_name"
:value="item.opc_id"
/>
</el-select>
</el-col>
<el-col :span="12">
PLC:
<el-select
v-model="plc_id"
placeholder="无"
clearable
@change="changePlc"
>
<el-option
v-for="item in dataOpcPlcs"
:key="item.plc_id"
:label="item.plc_name"
:value="item.plc_id"
/>
</el-select>
</el-col>
</el-row>
</el-card>
<el-card class="box-card" shadow="never">
<div slot="header" class="clearfix">
<span class="role-span">输送系统</span>
</div>
<el-form ref="form" :inline="true" :model="form" :rules="rules" size="small" label-width="78px">
<el-row>
<el-col :span="8">
<el-form-item label="电气调度号" label-width="150px">
<el-switch v-model="form.OPCServer" />
</el-form-item>
</el-col>
</el-row>
</el-form>
</el-card>
<el-card class="box-card" shadow="never">
<div slot="header" class="clearfix">
<span class="role-span">PLC读取字段</span>
</div>
<el-form ref="form" :inline="true" :model="form" :rules="rules" size="small" label-width="78px">
<el-table
v-loading="false"
:data="data1"
:max-height="550"
size="small"
style="width: 100%;margin-bottom: 15px"
>
<el-table-column prop="name" label="用途" />
<el-table-column prop="code" label="别名要求" />
<el-table-column prop="db" label="DB块">
<template slot-scope="scope">
<el-input
v-model="data1[scope.$index].db"
size="mini"
class="edit-input"
@input="finishReadEdit(data1[scope.$index])"
/>
</template>
</el-table-column>
<el-table-column prop="dbr_value">
<template slot="header">
<el-link type="primary" :underline="false" @click.native="test_read1()">测试读</el-link>
</template>
<template slot-scope="scope">
<el-input v-model="data1[scope.$index].dbr_value" size="mini" class="edit-input" />
</template>
</el-table-column>
</el-table>
</el-form>
</el-card>
<el-card class="box-card" shadow="never">
<div slot="header" class="clearfix">
<span class="role-span">PLC写入字段</span>
</div>
<el-form ref="form" :inline="true" :model="form" :rules="rules" size="small" label-width="78px">
<el-table
v-loading="false"
:data="data2"
:max-height="550"
size="small"
style="width: 100%;margin-bottom: 15px"
>
<el-table-column prop="name" label="用途" />
<el-table-column prop="code" label="别名要求" />
<el-table-column prop="db" label="DB块">
<template slot-scope="scope">
<el-input
v-model="data2[scope.$index].db"
size="mini"
class="edit-input"
@input="finishWriteEdit(data2[scope.$index])"
/>
</template>
</el-table-column>
<el-table-column prop="dbw_value">
<template slot="header">
<el-link type="primary" :underline="false" @click.native="test_write1()">测试写</el-link>
</template>
<template slot-scope="scope">
<el-input v-model="data2[scope.$index].dbw_value" size="mini" class="edit-input" />
</template>
</el-table-column>
</el-table>
</el-form>
</el-card>
<el-card class="box-card" shadow="never">
<div slot="header" class="clearfix">
<span class="role-span" />
<el-button
:loading="false"
icon="el-icon-check"
size="mini"
style="float: right; padding: 6px 9px"
type="primary"
@click="doSubmit"
>保存
</el-button>
</div>
</el-card>
</div>
</template>
<script>
import {
queryDriverConfig,
updateConfig,
testRead,
testwrite
} from '@/api/acs/device/driverConfig'
import { selectOpcList } from '@/api/acs/device/opc'
import { selectPlcList } from '@/api/acs/device/opcPlc'
import { selectListByOpcID } from '@/api/acs/device/opcPlc'
import crud from '@/mixins/crud'
export default {
name: 'StandardAutodoor',
mixins: [crud],
props: {
parentForm: {
type: Object,
require: true
}
},
data() {
return {
device_code: '',
device_id: '',
plc_id: '',
plc_code: '',
opc_id: '',
opc_code: '',
configLoading: false,
dataOpcservers: [],
dataOpcPlcs: [],
data1: [],
data2: [],
form: {
inspect_in_stocck: true,
ignore_pickup_check: true,
ignore_release_check: true,
apply_task: true,
manual_create_task: true,
is_pickup: true,
is_release: true
},
rules: {}
}
},
created() {
this.$nextTick(() => {
// 从父表单获取设备编码
this.device_id = this.$props.parentForm.device_id
this.device_code = this.$props.parentForm.device_code
queryDriverConfig(this.device_id, this.$props.parentForm.driver_code).then(data => {
// 给表单赋值,并且属性不能为空
if (data.form) {
const arr = Object.keys(data.form)
// 不为空
if (arr.length > 0) {
this.form = data.form
}
}
// 给表单赋值,并且属性不能为空
if (data.parentForm) {
const arr = Object.keys(data.parentForm)
// 不为空
if (arr.length > 0) {
this.opc_code = data.parentForm.opc_code
this.plc_code = data.parentForm.plc_code
}
}
this.data1 = data.rs
this.data2 = data.ws
this.sliceItem()
})
selectPlcList().then(data => {
this.dataOpcPlcs = data
this.plc_id = this.$props.parentForm.opc_plc_id
})
selectOpcList().then(data => {
this.dataOpcservers = data
this.opc_id = this.$props.parentForm.opc_server_id
})
})
},
methods: {
changeOpc(val) {
this.dataOpcservers.forEach(item => {
if (item.opc_id === val) {
this.opc_code = item.opc_code
}
})
selectListByOpcID(val).then(data => {
this.dataOpcPlcs = data
this.plc_id = ''
this.plc_code = ''
if (this.dataOpcPlcs && this.dataOpcPlcs.length > 0) {
this.plc_id = this.dataOpcPlcs[0].plc_id
this.plc_code = this.dataOpcPlcs[0].plc_code
}
this.sliceItem()
})
},
finishReadEdit(data) {
// 编辑的是code列,并且值包含mode
if (data.code.indexOf('mode') !== -1) {
const dbValue = data.db
// .之前的字符串
const beforeStr = dbValue.match(/(\S*)\./)[1]
// .之后的字符串
const afterStr = dbValue.match(/\.(\S*)/)[1]
// 取最后数字
const endNumber = afterStr.substring(1)
// 最后为非数字
if (isNaN(parseInt(endNumber))) {
return
}
for (const val in this.data1) {
if (this.data1[val].code.indexOf('action') !== -1) {
this.data1[val].db = beforeStr + '.' + afterStr.substring(0, 1) + (parseInt(endNumber) + 1)
}
if (this.data1[val].code.indexOf('error') !== -1) {
this.data1[val].db = beforeStr + '.' + afterStr.substring(0, 1) + (parseInt(endNumber) + 2)
}
}
}
},
changePlc(val) {
this.dataOpcPlcs.forEach(item => {
if (item.plc_id === val) {
this.plc_code = item.plc_code
this.sliceItem()
return
}
})
},
test_read1() {
testRead(this.data1, this.opc_id).then(data => {
this.data1 = data
this.notify('操作成功!', 'success')
}).catch(err => {
console.log(err.response.data.message)
})
},
test_write1() {
testwrite(this.data2, this.opc_id).then(data => {
this.notify('操作成功!', 'success')
}).catch(err => {
console.log(err.response.data.message)
})
},
doSubmit() {
this.$refs['form'].validate((valid) => {
if (valid) {
this.configLoading = true
// 根据驱动类型判断是否为路由设备
const parentForm = this.parentForm
parentForm.is_route = true
parentForm.plc_id = this.plc_id
parentForm.opc_id = this.opc_id
updateConfig(parentForm, this.form, this.data1, this.data2).then(res => {
this.notify('保存成功', 'success')
this.configLoading = false
}).catch(err => {
this.configLoading = false
console.log(err.response.data.message)
})
}
})
},
sliceItem() { // 拼接DB的Item值
this.data1.forEach(item => {
const str = item.code
// 是否包含.
if (str.search('.') !== -1) {
// 截取最后一位
item.code = this.opc_code + '.' + this.plc_code + '.' + this.device_code + '.' + str.slice(str.lastIndexOf('.') + 1)
} else {
item.code = this.opc_code + '.' + this.plc_code + '.' + this.device_code + '.' + item.code
}
})
this.data2.forEach(item => {
const str = item.code
// 是否包含.
if (str.search('.') !== -1) {
// 截取最后一位
item.code = this.opc_code + '.' + this.plc_code + '.' + this.device_code + '.' + str.slice(str.lastIndexOf('.') + 1)
} else {
item.code = this.opc_code + '.' + this.plc_code + '.' + this.device_code + '.' + item.code
}
})
}
}
}
</script>
<style scoped>
</style>

View File

@@ -147,27 +147,18 @@
<el-table-column prop="next_point_code" label="放货点1" />
<el-table-column prop="start_point_code2" label="取货点2" />
<el-table-column prop="next_point_code2" label="放货点2" />
<el-table-column prop="put_point_code" label="倒料" />
<el-table-column prop="put_point_code" label="中转" />
<el-table-column prop="execute_device_code" label="当前执行设备" />
<el-table-column prop="carno" label="车号" />
<el-table-column prop="weight" label="重量" />
<el-table-column prop="agv_jobno" label="AGV任务号" />
<el-table-column prop="agv_inst_type" label="AGV任务类型" />
<el-table-column prop="agv_system_type" label="AGV系统类型" />
<!-- <el-table-column prop="compound_inst" label="复合指令">-->
<!-- <template slot-scope="scope">-->
<!-- <span v-if="scope.row.compound_inst==='0' ">否</span>-->
<!-- <span v-if="scope.row.compound_inst==='1' ">是</span>-->
<!-- </template>-->
<!-- </el-table-column>-->
<!-- <el-table-column prop="compound_inst_data" width="200" label="复合路线" />-->
<!-- <el-table-column prop="matarial" label="物料" />-->
<!-- <el-table-column prop="quantity" label="数量" />-->
<el-table-column prop="agv_system_type" label="AGV系统类型" >
</el-table-column>
<el-table-column prop="remark" label="描述" />
<el-table-column prop="create_by" label="创建者" />
<el-table-column prop="create_time" label="创建时间" width="135" />
<!-- <el-table-column prop="update_by" label="修改者" />-->
<!-- <el-table-column prop="update_time" label="修改时间" width="135" />-->
<el-table-column
v-permission="['admin','instruction:edit','instruction:del']"
fixed="left"

View File

@@ -334,10 +334,8 @@
<!-- <el-table-column prop="link_num" label="关联编号" />-->
<el-table-column prop="vehicle_code" label="载具号" width="100" />
<el-table-column prop="task_status" label="任务状态" width="60">
<template slot-scope="scope" width="60">
<span v-if="scope.row.task_status==='0' ">就绪</span>
<span v-if="scope.row.task_status==='1' ">执行中</span>
<span v-if="scope.row.task_status==='2' ">完成</span>
<template slot-scope="scope">
{{ dict.label.task_status[scope.row.task_status] }}
</template>
</el-table-column>
<el-table-column prop="priority" label="优先级" width="100" />
@@ -345,20 +343,18 @@
<el-table-column prop="next_point_code" label="放货点1" width="120px" />
<el-table-column prop="start_point_code2" label="取货点2" width="120px" />
<el-table-column prop="next_point_code2" label="放货点2" width="120px" />
<el-table-column prop="put_point_code" label="倒料点" width="100px" />
<el-table-column prop="agv_task_type" label="AGV任务类型" width="120px" />
<el-table-column prop="agv_system_type" label="AGV系统类型" width="120px" />
<el-table-column prop="storage_task_type" label="立库任务类型" width="120px" />
<!-- <el-table-column prop="compound_task" label="复合任务">-->
<!-- <template slot-scope="scope">-->
<!-- <span v-if="scope.row.compound_task==='0' "></span>-->
<!-- <span v-if="scope.row.compound_task==='1' "></span>-->
<!-- </template>-->
<!-- </el-table-column>-->
<!-- <el-table-column prop="compound_task_data" width="200" label="复合路线" />-->
<!-- <el-table-column prop="matarial" label="物料" />-->
<!-- <el-table-column prop="quantity" label="数量" />-->
<el-table-column prop="put_point_code" label="中转点" width="100px" />
<!-- <el-table-column prop="agv_task_type" label="AGV任务类型" width="120px" />-->
<el-table-column prop="agv_system_type" label="AGV系统类型" width="120px">
<template slot-scope="scope">
{{ dict.label.agv_system_type[scope.row.agv_system_type] }}
</template>
</el-table-column>
<el-table-column prop="storage_task_type" label="立库任务类型" width="120px" >
<template slot-scope="scope">
{{ dict.label.storage_task_type[scope.row.storage_task_type] }}
</template>
</el-table-column>
<el-table-column prop="remark" label="备注" />
<el-table-column prop="create_by" label="创建者" />
<el-table-column prop="create_time" label="创建时间" width="135" />
@@ -478,6 +474,7 @@ export default {
vehicle_type: null,
task_type: '1',
storage_task_type: '',
agv_task_type: '',
task_status: null,
priority: 1,
start_point_code: null,

View File

@@ -58,4 +58,6 @@ public interface RawAssistIStorService {
JSONObject autoDis(JSONObject whereJson);
JSONObject autoDisMove(JSONObject whereJson);
}

View File

@@ -1093,6 +1093,300 @@ public class RawAssistIStorServiceImpl implements RawAssistIStorService {
return struct_jo;
}
@Override
public JSONObject autoDisMove(JSONObject whereJson) {
/*
* 分配逻辑:
* 1、先查找该木箱内属于什么物料、订单定位到具体的块、排查看是否存在空位
* a、存在的话优先放在这一块这一排中(遍历)
* b、不存在则根据该订单物料大概数量、选择数量相近的一个空巷道
* 1存在空巷道
* 2不存在则找一个双通有空位置、数量相近的巷道
* */
JSONObject struct_jo = new JSONObject();
String box_no = whereJson.getString("box_no");
String sect_id = whereJson.getString("sect_id");
String col_num = whereJson.getString("layer_num"); // 转库时用
JSONObject sub_jo = WQLObject.getWQLObject("pdm_bi_subpackagerelation").query("package_box_sn = '" + box_no + "' AND status < 3").uniqueResult(0);
String material_code = sub_jo.getString("product_name");
String sale_order_name = sub_jo.getString("sale_order_name");
HashMap<String, String> row_map = new HashMap<>();
row_map.put("material_code", material_code);
row_map.put("sale_order_name", sale_order_name);
row_map.put("col_num", col_num);
row_map.put("sect_id", sect_id);
row_map.put("flag", "11");
//查询到当前可用的巷道
JSONArray rowArr = WQL.getWO("QST_IVT_RAWASSISTISTOR").addParamMap(row_map).process().getResultJSONArray(0);
for (int i = 0; i < rowArr.size(); i++) {
JSONObject row_jo = rowArr.getJSONObject(i);
String block_num = row_jo.getString("block_num");
String row_num = row_jo.getString("row_num");
String placement_type = row_jo.getString("placement_type");
// 判断此排是否有除:入库锁、移入锁以外的锁
JSONArray isLock = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type not in ('1','2','7') AND block_num = '" + block_num + "'AND placement_type = '" + placement_type + "' AND row_num = '" + row_num + "' AND is_delete = '0' AND is_used = '1'").getResultJSONArray(0);
if (ObjectUtil.isEmpty(isLock)) {
if (placement_type.equals("02")) {
// 左通
struct_jo = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num + "'AND placement_type = '" + placement_type + "' AND row_num = '" + row_num + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') = '' order by out_order_seq ASC").uniqueResult(0);
break;
} else if (placement_type.equals("03")) {
// 右通
struct_jo = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num + "'AND placement_type = '" + placement_type + "' AND row_num = '" + row_num + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') = '' order by out_order_seq DESC").uniqueResult(0);
break;
} else {
// 双通
// 先倒序找到第一个木箱、判断上一个是否有货位
JSONObject jsonDescBox = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num + "'AND placement_type = '" + placement_type + "' AND row_num = '" + row_num + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') <> '' order by out_order_seq DESC").uniqueResult(0);
JSONObject jsonDescStruct = new JSONObject();
if (ObjectUtil.isNotEmpty(jsonDescBox)) {
String out_order_seq = jsonDescBox.getString("out_order_seq");
jsonDescStruct = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num + "'AND placement_type = '" + placement_type + "' AND row_num = '" + row_num + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') = '' and out_order_seq > '" + out_order_seq + "' order by out_order_seq ASC").uniqueResult(0);
} else {
// 先倒序找到第一个入库锁或者移库锁、判断上一个是否有货位
JSONObject jsonDescEmpStruct = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type in ('2','7') AND block_num = '" + block_num + "'AND placement_type = '" + placement_type + "' AND row_num = '" + row_num + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') = '' order by out_order_seq DESC").uniqueResult(0);
if (ObjectUtil.isNotEmpty(jsonDescEmpStruct)) {
String out_order_seq = jsonDescEmpStruct.getString("out_order_seq");
jsonDescStruct = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num + "'AND placement_type = '" + placement_type + "' AND row_num = '" + row_num + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') = '' and out_order_seq > '" + out_order_seq + "' order by out_order_seq ASC").uniqueResult(0);
}
}
if (ObjectUtil.isNotEmpty(jsonDescStruct)) {
struct_jo = jsonDescStruct;
break;
} else {
// 没有就正序找到第一个物料、判断上一个是否有货位
JSONObject jsonAscBox = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num + "'AND placement_type = '" + placement_type + "' AND row_num = '" + row_num + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') <> '' order by out_order_seq ASC").uniqueResult(0);
JSONObject jsonAscStruct = new JSONObject();
if (ObjectUtil.isNotEmpty(jsonAscBox)) {
String out_order_seq2 = jsonAscBox.getString("out_order_seq");
// 上一个货位顺序号
jsonAscStruct = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num + "'AND placement_type = '" + placement_type + "' AND row_num = '" + row_num + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') = '' and out_order_seq < '" + out_order_seq2 + "' order by out_order_seq DESC").uniqueResult(0);
} else {
JSONObject jsonAscEmpStruct = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type in ('2','7') AND block_num = '" + block_num + "'AND placement_type = '" + placement_type + "' AND row_num = '" + row_num + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') = '' order by out_order_seq ASC").uniqueResult(0);
if (ObjectUtil.isNotEmpty(jsonAscEmpStruct)) {
String out_order_seq2 = jsonAscEmpStruct.getString("out_order_seq");
jsonAscStruct = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num + "'AND placement_type = '" + placement_type + "' AND row_num = '" + row_num + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') = '' and out_order_seq < '" + out_order_seq2 + "' order by out_order_seq DESC").uniqueResult(0);
}
}
if (ObjectUtil.isNotEmpty(jsonAscStruct)) {
struct_jo = jsonAscStruct;
break;
} else {
// 说明这排有任务在执行,新开一排
//根据分切计划查询该订单物料大概还有多少未入
row_map.put("flag", "12");
JSONArray plan_rows = WQL.getWO("QST_IVT_RAWASSISTISTOR").addParamMap(row_map).process().getResultJSONArray(0);
if (ObjectUtil.isEmpty(plan_rows)) {
plan_rows = new JSONArray();
}
//查询该销售订单及行号有多少个生成状态的箱子
row_map.put("flag", "27");
JSONArray box_rows = WQL.getWO("QST_IVT_RAWASSISTISTOR").addParamMap(row_map).process().getResultJSONArray(0);
if (ObjectUtil.isEmpty(box_rows)) {
box_rows = new JSONArray();
}
int box_num = (int) Math.ceil(plan_rows.size() / 2) + box_rows.size();
//查询数量与订单物料箱子数量相近的一排
JSONObject empty_row = WQL.getWO("QST_IVT_RAWASSISTISTOR").addParam("col_num", col_num).addParam("sect_id", sect_id).addParam("flag", "13").addParam("sql_str", " ORDER BY abs(" + box_num + "-a.struct_num),block_num,row_num").process().uniqueResult(0);
if (ObjectUtil.isNotEmpty(empty_row)) {
String block_num2 = empty_row.getString("block_num");
String row_num2 = empty_row.getString("row_num");
String placement_type2 = empty_row.getString("placement_type");
if (placement_type.equals("02")) {
struct_jo = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num2 + "' AND row_num = '" + row_num2 + "' AND placement_type = '" + placement_type2 + "' AND is_delete = '0' AND is_used = '1' AND lock_type = '1' order by out_order_seq ASC").uniqueResult(0);
break;
} else {
struct_jo = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num2 + "' AND row_num = '" + row_num2 + "' AND placement_type = '" + placement_type2 + "'AND is_delete = '0' AND is_used = '1' AND lock_type = '1' order by out_order_seq DESC").uniqueResult(0);
break;
}
} else {
//如果查询不到空的一排,则查询有空位双通的一排
JSONArray haveArr = WQL.getWO("QST_IVT_RAWASSISTISTOR").addParam("col_num", col_num).addParam("sect_id", sect_id).addParam("flag", "14").addParam("sql_str", " ORDER BY abs(" + box_num + "-a.struct_num)").process().getResultJSONArray(0);
for (int j = 0; j < haveArr.size(); j++) {
JSONObject have_row = haveArr.getJSONObject(j);
String block_num3 = have_row.getString("block_num");
String row_num3 = have_row.getString("row_num");
JSONArray isLock2 = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type not in ('1','2','7') AND block_num = '" + block_num3 + "' AND row_num = '" + row_num3 + "' AND is_delete = '0' AND is_used = '1'").getResultJSONArray(0);
if (ObjectUtil.isEmpty(isLock2)) {
// 先倒序找到第一个木箱、判断上一个是否有货位
JSONObject jsonDescBox2 = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num3 + "' AND row_num = '" + row_num3 + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') <> '' order by out_order_seq DESC").uniqueResult(0);
JSONObject jsonDescStruct2 = new JSONObject();
if (ObjectUtil.isNotEmpty(jsonDescBox2)) {
String out_order_seq = jsonDescBox2.getString("out_order_seq");
jsonDescStruct2 = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num3 + "' AND row_num = '" + row_num3 + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') = '' and out_order_seq > '" + out_order_seq + "' order by out_order_seq ASC").uniqueResult(0);
} else {
// 先倒序找到第一个入库锁或者移库锁、判断上一个是否有货位
JSONObject jsonDescEmpStruct = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type in ('2','7') AND block_num = '" + block_num3 + "' AND row_num = '" + row_num3 + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') = '' order by out_order_seq DESC").uniqueResult(0);
if (ObjectUtil.isNotEmpty(jsonDescEmpStruct)) {
String out_order_seq = jsonDescEmpStruct.getString("out_order_seq");
jsonDescStruct2 = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num3 + "' AND row_num = '" + row_num3 + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') = '' and out_order_seq > '" + out_order_seq + "' order by out_order_seq ASC").uniqueResult(0);
}
}
if (ObjectUtil.isNotEmpty(jsonDescStruct2)) {
struct_jo = jsonDescStruct2;
break;
} else {
// 没有就正序找到第一个物料、判断上一个是否有货位
JSONObject jsonAscBox2 = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num3 + "' AND row_num = '" + row_num3 + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') <> '' order by out_order_seq ASC").uniqueResult(0);
JSONObject jsonAscStruct2 = new JSONObject();
if (ObjectUtil.isNotEmpty(jsonAscBox2)) {
String out_order_seq2 = jsonAscBox2.getString("out_order_seq");
// 上一个货位顺序号
jsonAscStruct2 = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num3 + "' AND row_num = '" + row_num3 + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') = '' and out_order_seq < '" + out_order_seq2 + "' order by out_order_seq DESC").uniqueResult(0);
} else {
JSONObject jsonAscEmpStruct = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type in ('2','7') AND block_num = '" + block_num3 + "' AND row_num = '" + row_num3 + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') = '' order by out_order_seq ASC").uniqueResult(0);
if (ObjectUtil.isNotEmpty(jsonAscEmpStruct)) {
String out_order_seq2 = jsonAscEmpStruct.getString("out_order_seq");
jsonAscStruct2 = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num3 + "' AND row_num = '" + row_num3 + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') = '' and out_order_seq < '" + out_order_seq2 + "' order by out_order_seq DESC").uniqueResult(0);
}
}
if (ObjectUtil.isNotEmpty(jsonAscStruct2)) {
struct_jo = jsonAscStruct2;
break;
}
}
} else {
continue;
}
}
}
}
}
}
} else {
continue;
}
}
if (ObjectUtil.isEmpty(rowArr) || ObjectUtil.isEmpty(struct_jo)) {
//如果不存在相同订单物料的巷道 或者未找到相同物料订单号巷道中的货位 则
//根据分切计划查询该订单物料大概还有多少未入
row_map.put("flag", "12");
JSONArray plan_rows = WQL.getWO("QST_IVT_RAWASSISTISTOR").addParamMap(row_map).process().getResultJSONArray(0);
if (ObjectUtil.isEmpty(plan_rows)) {
plan_rows = new JSONArray();
}
//查询该销售订单及行号有多少个生成状态的箱子
row_map.put("flag", "27");
JSONArray box_rows = WQL.getWO("QST_IVT_RAWASSISTISTOR").addParamMap(row_map).process().getResultJSONArray(0);
if (ObjectUtil.isEmpty(box_rows)) {
box_rows = new JSONArray();
}
int box_num = (int) Math.ceil(plan_rows.size() / 2) + box_rows.size();
//查询数量与订单物料箱子数量相近的一排
JSONObject empty_row = WQL.getWO("QST_IVT_RAWASSISTISTOR").addParam("col_num", col_num).addParam("sect_id", sect_id).addParam("flag", "13").addParam("sql_str", " ORDER BY abs(" + box_num + "-a.struct_num),block_num,row_num").process().uniqueResult(0);
if (ObjectUtil.isNotEmpty(empty_row)) {
String block_num = empty_row.getString("block_num");
String row_num = empty_row.getString("row_num");
String placement_type = empty_row.getString("placement_type");
if (placement_type.equals("02")) {
struct_jo = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num + "' AND row_num = '" + row_num + "' AND placement_type = '" + placement_type + "' AND is_delete = '0' AND is_used = '1' AND lock_type = '1' order by out_order_seq ASC").uniqueResult(0);
} else {
struct_jo = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num + "' AND row_num = '" + row_num + "' AND placement_type = '" + placement_type + "'AND is_delete = '0' AND is_used = '1' AND lock_type = '1' order by out_order_seq DESC").uniqueResult(0);
}
} else {
//如果查询不到空的一排,则查询有空位双通的一排
JSONArray haveArr = WQL.getWO("QST_IVT_RAWASSISTISTOR").addParam("col_num", col_num).addParam("sect_id", sect_id).addParam("flag", "14").addParam("sql_str", " ORDER BY abs(" + box_num + "-a.struct_num)").process().getResultJSONArray(0);
for (int j = 0; j < haveArr.size(); j++) {
JSONObject have_row = haveArr.getJSONObject(j);
String block_num3 = have_row.getString("block_num");
String row_num3 = have_row.getString("row_num");
JSONArray isLock2 = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type not in ('1','2','7') AND block_num = '" + block_num3 + "' AND row_num = '" + row_num3 + "' AND is_delete = '0' AND is_used = '1'").getResultJSONArray(0);
if (ObjectUtil.isEmpty(isLock2)) {
// 先倒序找到第一个木箱、判断上一个是否有货位
JSONObject jsonDescBox2 = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num3 + "' AND row_num = '" + row_num3 + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') <> '' order by out_order_seq DESC").uniqueResult(0);
JSONObject jsonDescStruct2 = new JSONObject();
if (ObjectUtil.isNotEmpty(jsonDescBox2)) {
String out_order_seq = jsonDescBox2.getString("out_order_seq");
jsonDescStruct2 = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num3 + "' AND row_num = '" + row_num3 + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') = '' and out_order_seq > '" + out_order_seq + "' order by out_order_seq ASC").uniqueResult(0);
} else {
// 先倒序找到第一个入库锁或者移库锁、判断上一个是否有货位
JSONObject jsonDescEmpStruct = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type in ('2','7') AND block_num = '" + block_num3 + "' AND row_num = '" + row_num3 + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') = '' order by out_order_seq DESC").uniqueResult(0);
if (ObjectUtil.isNotEmpty(jsonDescEmpStruct)) {
String out_order_seq = jsonDescEmpStruct.getString("out_order_seq");
jsonDescStruct2 = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num3 + "' AND row_num = '" + row_num3 + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') = '' and out_order_seq > '" + out_order_seq + "' order by out_order_seq ASC").uniqueResult(0);
}
}
if (ObjectUtil.isNotEmpty(jsonDescStruct2)) {
struct_jo = jsonDescStruct2;
break;
} else {
// 没有就正序找到第一个物料、判断上一个是否有货位
JSONObject jsonAscBox2 = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num3 + "' AND row_num = '" + row_num3 + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') <> '' order by out_order_seq ASC").uniqueResult(0);
JSONObject jsonAscStruct2 = new JSONObject();
if (ObjectUtil.isNotEmpty(jsonAscBox2)) {
String out_order_seq2 = jsonAscBox2.getString("out_order_seq");
// 上一个货位顺序号
jsonAscStruct2 = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num3 + "' AND row_num = '" + row_num3 + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') = '' and out_order_seq < '" + out_order_seq2 + "' order by out_order_seq DESC").uniqueResult(0);
} else {
JSONObject jsonAscEmpStruct = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type in ('2','7') AND block_num = '" + block_num3 + "' AND row_num = '" + row_num3 + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') = '' order by out_order_seq ASC").uniqueResult(0);
if (ObjectUtil.isNotEmpty(jsonAscEmpStruct)) {
String out_order_seq2 = jsonAscEmpStruct.getString("out_order_seq");
jsonAscStruct2 = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num3 + "' AND row_num = '" + row_num3 + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') = '' and out_order_seq < '" + out_order_seq2 + "' order by out_order_seq DESC").uniqueResult(0);
}
}
if (ObjectUtil.isNotEmpty(jsonAscStruct2)) {
struct_jo = jsonAscStruct2;
break;
}
}
} else {
continue;
}
}
}
}
if (ObjectUtil.isEmpty(struct_jo)) {
throw new BadRequestException("未查询到可用的仓位!");
}
return struct_jo;
}
public JSONObject queryEmpStruct(JSONObject whereJson) {
JSONObject struct_jo = new JSONObject();
String sect_id = whereJson.getString("sect_id");

View File

@@ -22,6 +22,7 @@
输入.stor_id TYPEAS s_string
输入.sap_pcsn TYPEAS s_string
输入.pcsn TYPEAS s_string
输入.col_num TYPEAS s_string
输入.bill_status TYPEAS s_string
输入.bill_type TYPEAS s_string
输入.box_no TYPEAS s_string
@@ -452,6 +453,9 @@
ENDOPTION
OPTION 输入.sale_order_name <> ""
sub.sale_order_name = 输入.sale_order_name
ENDOPTION
OPTION 输入.col_num <> ""
sa2.layer_num = 输入.col_num
ENDOPTION
GROUP BY
sa2.block_num,sa2.row_num,sa2.placement_type
@@ -498,6 +502,11 @@
sa.is_delete = '0'
AND is_used = '1'
AND sa.sect_id = 输入.sect_id
OPTION 输入.col_num <> ""
sa.layer_num = 输入.col_num
ENDOPTION
GROUP BY
sa.block_num,
sa.row_num,
@@ -553,6 +562,10 @@
AND is_used = '1'
AND placement_type = '01'
AND sa.sect_id = 输入.sect_id
OPTION 输入.col_num <> ""
sa.layer_num = 输入.col_num
ENDOPTION
GROUP BY
sa.block_num,
sa.row_num,

View File

@@ -3396,12 +3396,15 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
public void createMove(JSONObject whereJson) {
//任务表
WQLObject wo_Task = WQLObject.getWQLObject("SCH_BASE_Task");
WQLObject attrTab = WQLObject.getWQLObject("st_ivt_structattr");
JSONArray jsonAllBlockPoint = whereJson.getJSONArray("jsonAllBlockPoint");
for (int i = 0; i < jsonAllBlockPoint.size(); i++) {
JSONObject json = jsonAllBlockPoint.getJSONObject(i);
JSONObject jsonAttr = attrTab.query("struct_code = '" + json.getString("struct_code") + "'").uniqueResult(0);
JSONObject mapParam = new JSONObject();// 生成移库单传入参数
JSONArray table = new JSONArray(); // 明细参数
mapParam.put("bill_status", "10");
@@ -3417,7 +3420,8 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
JSONObject moveParam = new JSONObject();
moveParam.put("box_no", json.getString("storagevehicle_code"));
moveParam.put("sect_id", RegionTypeEnum.ZZ01.getId());
JSONObject jsonMove = rawAssistIStorService.autoDis(moveParam);
moveParam.put("layer_num", jsonAttr.getString("layer_num"));
JSONObject jsonMove = rawAssistIStorService.autoDisMove(moveParam);
// 查询移出货位的库存物料
JSONObject jsonMoveIvt = WQL.getWO("ST_OUTIVT03")
.addParam("flag", "6")

View File

@@ -257,6 +257,8 @@
AND attr.out_order_seq > 输入.out_order_seq
AND IFNULL( attr.storagevehicle_code, '' ) <> ''
ORDER BY out_order_seq DESC
ENDSELECT
ENDQUERY
ENDIF
@@ -274,6 +276,8 @@
AND attr.out_order_seq < 输入.out_order_seq
AND IFNULL( attr.storagevehicle_code, '' ) <> ''
ORDER BY out_order_seq
ENDSELECT
ENDQUERY
ENDIF

View File

@@ -2,6 +2,66 @@
<included>
<springProperty scope="context" name="logPath" source="logging.file.path" defaultValue="logs"/>
<property name="LOG_HOME" value="${logPath}"/>
<appender name="esLogAppender" class="com.internetitem.logback.elasticsearch.ElasticsearchAppender">
<url>http://10.1.3.90:9200/_bulk</url>
<index>${esIndex}</index>
<type>lms_log</type>
<loggerName>es-logger</loggerName> <!-- optional -->
<errorLoggerName>es-error-logger</errorLoggerName> <!-- optional -->
<connectTimeout>30000</connectTimeout> <!-- optional (in ms, default 30000) -->
<errorsToStderr>false</errorsToStderr> <!-- optional (default false) -->
<includeCallerData>false</includeCallerData> <!-- optional (default false) -->
<logsToStderr>false</logsToStderr> <!-- optional (default false) -->
<maxQueueSize>104857600</maxQueueSize> <!-- optional (default 104857600) -->
<maxRetries>3</maxRetries> <!-- optional (default 3) -->
<readTimeout>30000</readTimeout> <!-- optional (in ms, default 30000) -->
<sleepTime>250</sleepTime> <!-- optional (in ms, default 250) -->
<rawJsonMessage>false</rawJsonMessage> <!-- optional (default false) -->
<includeMdc>false</includeMdc> <!-- optional (default false) -->
<maxMessageSize>20000</maxMessageSize> <!-- optional (default -1 -->
<!-- <authentication class="com.internetitem.logback.elasticsearch.config.BasicAuthentication" /> &lt;!&ndash; optional &ndash;&gt;-->
<properties>
<property>
<name>system</name>
<value>lms</value>
</property>
<property>
<name>traceId</name>
<value>%X{traceId}</value>
</property>
<property>
<name>logLevel</name>
<value>%level</value>
</property>
<property>
<name>requestMethod</name>
<value>%X{requestMethod}</value>
</property>
<property>
<name>requestTime</name>
<value>%d{yyyy-MM-dd HH:mm:ss.SSS}</value>
</property>
<property>
<name>requestIp</name>
<value>%X{requestIp}</value>
</property>
<property>
<name>thread</name>
<value>%thread</value>
</property>
<property>
<name>logger</name>
<value>%logger</value>
</property>
</properties>
<headers>
<header>
<name>Content-Type</name>
<value>application/json</value>
</header>
</headers>
</appender>
<springProperty scope="context" name="esIndex" source="es.index"/>
<!-- 按照每天生成日志文件 -->
<appender name="FILE5" class="ch.qos.logback.core.rolling.RollingFileAppender">
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
@@ -23,6 +83,7 @@
<logger name="org.nl.wms.ext.acs.service.impl.AcsToWmsServiceImpl" level="info" additivity="false">
<appender-ref ref="FILE5"/>
<appender-ref ref="esLogAppender"/>
</logger>
<!-- 打印sql -->

View File

@@ -2,6 +2,66 @@
<included>
<springProperty scope="context" name="logPath" source="logging.file.path" defaultValue="logs"/>
<property name="LOG_HOME" value="${logPath}"/>
<appender name="esLogAppender" class="com.internetitem.logback.elasticsearch.ElasticsearchAppender">
<url>http://10.1.3.90:9200/_bulk</url>
<index>${esIndex}</index>
<type>lms_log</type>
<loggerName>es-logger</loggerName> <!-- optional -->
<errorLoggerName>es-error-logger</errorLoggerName> <!-- optional -->
<connectTimeout>30000</connectTimeout> <!-- optional (in ms, default 30000) -->
<errorsToStderr>false</errorsToStderr> <!-- optional (default false) -->
<includeCallerData>false</includeCallerData> <!-- optional (default false) -->
<logsToStderr>false</logsToStderr> <!-- optional (default false) -->
<maxQueueSize>104857600</maxQueueSize> <!-- optional (default 104857600) -->
<maxRetries>3</maxRetries> <!-- optional (default 3) -->
<readTimeout>30000</readTimeout> <!-- optional (in ms, default 30000) -->
<sleepTime>250</sleepTime> <!-- optional (in ms, default 250) -->
<rawJsonMessage>false</rawJsonMessage> <!-- optional (default false) -->
<includeMdc>false</includeMdc> <!-- optional (default false) -->
<maxMessageSize>20000</maxMessageSize> <!-- optional (default -1 -->
<!-- <authentication class="com.internetitem.logback.elasticsearch.config.BasicAuthentication" /> &lt;!&ndash; optional &ndash;&gt;-->
<properties>
<property>
<name>system</name>
<value>lms</value>
</property>
<property>
<name>traceId</name>
<value>%X{traceId}</value>
</property>
<property>
<name>logLevel</name>
<value>%level</value>
</property>
<property>
<name>requestMethod</name>
<value>%X{requestMethod}</value>
</property>
<property>
<name>requestTime</name>
<value>%d{yyyy-MM-dd HH:mm:ss.SSS}</value>
</property>
<property>
<name>requestIp</name>
<value>%X{requestIp}</value>
</property>
<property>
<name>thread</name>
<value>%thread</value>
</property>
<property>
<name>logger</name>
<value>%logger</value>
</property>
</properties>
<headers>
<header>
<name>Content-Type</name>
<value>application/json</value>
</header>
</headers>
</appender>
<springProperty scope="context" name="esIndex" source="es.index"/>
<!-- 按照每天生成日志文件 -->
<appender name="FILE6" class="ch.qos.logback.core.rolling.RollingFileAppender">
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
@@ -23,6 +83,7 @@
<logger name="org.nl.wms.sch.AcsUtil" level="info" additivity="false">
<appender-ref ref="FILE6"/>
<appender-ref ref="esLogAppender"/>
</logger>
<!-- 打印sql -->

View File

@@ -20,9 +20,70 @@
<charset>${log.charset}</charset>
</encoder>
</appender>
<appender name="esLogAppender" class="com.internetitem.logback.elasticsearch.ElasticsearchAppender">
<url>http://10.1.3.90:9200/_bulk</url>
<index>${esIndex}</index>
<type>lms_log</type>
<loggerName>es-logger</loggerName> <!-- optional -->
<errorLoggerName>es-error-logger</errorLoggerName> <!-- optional -->
<connectTimeout>30000</connectTimeout> <!-- optional (in ms, default 30000) -->
<errorsToStderr>false</errorsToStderr> <!-- optional (default false) -->
<includeCallerData>false</includeCallerData> <!-- optional (default false) -->
<logsToStderr>false</logsToStderr> <!-- optional (default false) -->
<maxQueueSize>104857600</maxQueueSize> <!-- optional (default 104857600) -->
<maxRetries>3</maxRetries> <!-- optional (default 3) -->
<readTimeout>30000</readTimeout> <!-- optional (in ms, default 30000) -->
<sleepTime>250</sleepTime> <!-- optional (in ms, default 250) -->
<rawJsonMessage>false</rawJsonMessage> <!-- optional (default false) -->
<includeMdc>false</includeMdc> <!-- optional (default false) -->
<maxMessageSize>20000</maxMessageSize> <!-- optional (default -1 -->
<!-- <authentication class="com.internetitem.logback.elasticsearch.config.BasicAuthentication" /> &lt;!&ndash; optional &ndash;&gt;-->
<properties>
<property>
<name>system</name>
<value>lms</value>
</property>
<property>
<name>traceId</name>
<value>%X{traceId}</value>
</property>
<property>
<name>logLevel</name>
<value>%level</value>
</property>
<property>
<name>requestMethod</name>
<value>%X{requestMethod}</value>
</property>
<property>
<name>requestTime</name>
<value>%d{yyyy-MM-dd HH:mm:ss.SSS}</value>
</property>
<property>
<name>requestIp</name>
<value>%X{requestIp}</value>
</property>
<property>
<name>thread</name>
<value>%thread</value>
</property>
<property>
<name>logger</name>
<value>%logger</value>
</property>
</properties>
<headers>
<header>
<name>Content-Type</name>
<value>application/json</value>
</header>
</headers>
</appender>
<springProperty scope="context" name="esIndex" source="es.index"/>
<logger name="org.nl.wms.ext.mes.service.impl.LmsToMesServiceImpl" level="info" additivity="false">
<logger name="org.nl.wms.ext.mes.service.impl.LmsToMesServiceImpl" level="info" additivity="false">
<appender-ref ref="FILE4"/>
<appender-ref ref="esLogAppender"/>
</logger>
<!-- 打印sql -->

View File

@@ -2,6 +2,66 @@
<included>
<springProperty scope="context" name="logPath" source="logging.file.path" defaultValue="logs"/>
<property name="LOG_HOME" value="${logPath}"/>
<appender name="esLogAppender" class="com.internetitem.logback.elasticsearch.ElasticsearchAppender">
<url>http://10.1.3.90:9200/_bulk</url>
<index>${esIndex}</index>
<type>lms_log</type>
<loggerName>es-logger</loggerName> <!-- optional -->
<errorLoggerName>es-error-logger</errorLoggerName> <!-- optional -->
<connectTimeout>30000</connectTimeout> <!-- optional (in ms, default 30000) -->
<errorsToStderr>false</errorsToStderr> <!-- optional (default false) -->
<includeCallerData>false</includeCallerData> <!-- optional (default false) -->
<logsToStderr>false</logsToStderr> <!-- optional (default false) -->
<maxQueueSize>104857600</maxQueueSize> <!-- optional (default 104857600) -->
<maxRetries>3</maxRetries> <!-- optional (default 3) -->
<readTimeout>30000</readTimeout> <!-- optional (in ms, default 30000) -->
<sleepTime>250</sleepTime> <!-- optional (in ms, default 250) -->
<rawJsonMessage>false</rawJsonMessage> <!-- optional (default false) -->
<includeMdc>false</includeMdc> <!-- optional (default false) -->
<maxMessageSize>20000</maxMessageSize> <!-- optional (default -1 -->
<!-- <authentication class="com.internetitem.logback.elasticsearch.config.BasicAuthentication" /> &lt;!&ndash; optional &ndash;&gt;-->
<properties>
<property>
<name>system</name>
<value>lms</value>
</property>
<property>
<name>traceId</name>
<value>%X{traceId}</value>
</property>
<property>
<name>logLevel</name>
<value>%level</value>
</property>
<property>
<name>requestMethod</name>
<value>%X{requestMethod}</value>
</property>
<property>
<name>requestTime</name>
<value>%d{yyyy-MM-dd HH:mm:ss.SSS}</value>
</property>
<property>
<name>requestIp</name>
<value>%X{requestIp}</value>
</property>
<property>
<name>thread</name>
<value>%thread</value>
</property>
<property>
<name>logger</name>
<value>%logger</value>
</property>
</properties>
<headers>
<header>
<name>Content-Type</name>
<value>application/json</value>
</header>
</headers>
</appender>
<springProperty scope="context" name="esIndex" source="es.index"/>
<!-- 按照每天生成日志文件 -->
<appender name="FILE2" class="ch.qos.logback.core.rolling.RollingFileAppender">
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
@@ -23,6 +83,7 @@
<logger name="org.nl.wms.ext.sap.service.impl.LmsToSapServiceImpl" level="info" additivity="false">
<appender-ref ref="FILE2"/>
<appender-ref ref="esLogAppender"/>
</logger>
<!-- 打印sql -->

View File

@@ -2,6 +2,66 @@
<included>
<springProperty scope="context" name="logPath" source="logging.file.path" defaultValue="logs"/>
<property name="LOG_HOME" value="${logPath}"/>
<appender name="esLogAppender" class="com.internetitem.logback.elasticsearch.ElasticsearchAppender">
<url>http://10.1.3.90:9200/_bulk</url>
<index>${esIndex}</index>
<type>lms_log</type>
<loggerName>es-logger</loggerName> <!-- optional -->
<errorLoggerName>es-error-logger</errorLoggerName> <!-- optional -->
<connectTimeout>30000</connectTimeout> <!-- optional (in ms, default 30000) -->
<errorsToStderr>false</errorsToStderr> <!-- optional (default false) -->
<includeCallerData>false</includeCallerData> <!-- optional (default false) -->
<logsToStderr>false</logsToStderr> <!-- optional (default false) -->
<maxQueueSize>104857600</maxQueueSize> <!-- optional (default 104857600) -->
<maxRetries>3</maxRetries> <!-- optional (default 3) -->
<readTimeout>30000</readTimeout> <!-- optional (in ms, default 30000) -->
<sleepTime>250</sleepTime> <!-- optional (in ms, default 250) -->
<rawJsonMessage>false</rawJsonMessage> <!-- optional (default false) -->
<includeMdc>false</includeMdc> <!-- optional (default false) -->
<maxMessageSize>20000</maxMessageSize> <!-- optional (default -1 -->
<!-- <authentication class="com.internetitem.logback.elasticsearch.config.BasicAuthentication" /> &lt;!&ndash; optional &ndash;&gt;-->
<properties>
<property>
<name>system</name>
<value>lms</value>
</property>
<property>
<name>traceId</name>
<value>%X{traceId}</value>
</property>
<property>
<name>logLevel</name>
<value>%level</value>
</property>
<property>
<name>requestMethod</name>
<value>%X{requestMethod}</value>
</property>
<property>
<name>requestTime</name>
<value>%d{yyyy-MM-dd HH:mm:ss.SSS}</value>
</property>
<property>
<name>requestIp</name>
<value>%X{requestIp}</value>
</property>
<property>
<name>thread</name>
<value>%thread</value>
</property>
<property>
<name>logger</name>
<value>%logger</value>
</property>
</properties>
<headers>
<header>
<name>Content-Type</name>
<value>application/json</value>
</header>
</headers>
</appender>
<springProperty scope="context" name="esIndex" source="es.index"/>
<!-- 按照每天生成日志文件 -->
<appender name="FILE3" class="ch.qos.logback.core.rolling.RollingFileAppender">
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
@@ -23,6 +83,7 @@
<logger name="org.nl.wms.ext.mes.service.impl.MesToLmsServiceImpl" level="info" additivity="false">
<appender-ref ref="FILE3"/>
<appender-ref ref="esLogAppender"/>
</logger>
<!-- 打印sql -->

View File

@@ -2,6 +2,66 @@
<included>
<springProperty scope="context" name="logPath" source="logging.file.path" defaultValue="logs"/>
<property name="LOG_HOME" value="${logPath}"/>
<appender name="esLogAppender" class="com.internetitem.logback.elasticsearch.ElasticsearchAppender">
<url>http://10.1.3.90:9200/_bulk</url>
<index>${esIndex}</index>
<type>lms_log</type>
<loggerName>es-logger</loggerName> <!-- optional -->
<errorLoggerName>es-error-logger</errorLoggerName> <!-- optional -->
<connectTimeout>30000</connectTimeout> <!-- optional (in ms, default 30000) -->
<errorsToStderr>false</errorsToStderr> <!-- optional (default false) -->
<includeCallerData>false</includeCallerData> <!-- optional (default false) -->
<logsToStderr>false</logsToStderr> <!-- optional (default false) -->
<maxQueueSize>104857600</maxQueueSize> <!-- optional (default 104857600) -->
<maxRetries>3</maxRetries> <!-- optional (default 3) -->
<readTimeout>30000</readTimeout> <!-- optional (in ms, default 30000) -->
<sleepTime>250</sleepTime> <!-- optional (in ms, default 250) -->
<rawJsonMessage>false</rawJsonMessage> <!-- optional (default false) -->
<includeMdc>false</includeMdc> <!-- optional (default false) -->
<maxMessageSize>20000</maxMessageSize> <!-- optional (default -1 -->
<!-- <authentication class="com.internetitem.logback.elasticsearch.config.BasicAuthentication" /> &lt;!&ndash; optional &ndash;&gt;-->
<properties>
<property>
<name>system</name>
<value>lms</value>
</property>
<property>
<name>traceId</name>
<value>%X{traceId}</value>
</property>
<property>
<name>logLevel</name>
<value>%level</value>
</property>
<property>
<name>requestMethod</name>
<value>%X{requestMethod}</value>
</property>
<property>
<name>requestTime</name>
<value>%d{yyyy-MM-dd HH:mm:ss.SSS}</value>
</property>
<property>
<name>requestIp</name>
<value>%X{requestIp}</value>
</property>
<property>
<name>thread</name>
<value>%thread</value>
</property>
<property>
<name>logger</name>
<value>%logger</value>
</property>
</properties>
<headers>
<header>
<name>Content-Type</name>
<value>application/json</value>
</header>
</headers>
</appender>
<springProperty scope="context" name="esIndex" source="es.index"/>
<!-- 按照每天生成日志文件 -->
<appender name="FILE1" class="ch.qos.logback.core.rolling.RollingFileAppender">
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
@@ -23,6 +83,7 @@
<logger name="org.nl.wms.ext.sap.service.impl.SapToLmsServiceImpl" level="info" additivity="false">
<appender-ref ref="FILE1"/>
<appender-ref ref="esLogAppender"/>
</logger>
<!-- 打印sql -->