This commit is contained in:
psh
2024-05-27 22:09:54 +08:00
parent 1dbc7494f2
commit 44f84111e0
29 changed files with 1381 additions and 261 deletions

View File

@@ -85,8 +85,8 @@ public class NDCAgvServiceImpl implements NDCAgvService {
int nextAddress = deviceService.queryAddressBydeviceCode(inst.getNext_point_code());
byte ikeyhigh = (byte) IntToHexHigh(Integer.parseInt(instcode));
byte ikeylow = (byte) IntToHexLow(Integer.parseInt(instcode));
byte typehigh = (byte) IntToHexHigh(type);
byte typelow = (byte) IntToHexLow(type);
byte typehigh = (byte) IntToHexHigh(1);
byte typelow = (byte) IntToHexLow(1);
byte qhdhigh = (byte) IntToHexHigh(startAddress);
byte qhdlow = (byte) IntToHexLow(startAddress);
byte fhdhigh = (byte) IntToHexHigh(nextAddress);
@@ -145,20 +145,15 @@ public class NDCAgvServiceImpl implements NDCAgvService {
byte[] b = new byte[]{(byte) 0X87, (byte) 0XCD,
(byte) 0X00, (byte) 0X08,
(byte) 0X00, (byte) 0X12,
(byte) 0X00, (byte) 0X0A,
(byte) 0X00, (byte) 0X01,
(byte) 0X00, (byte) 0X6D,
(byte) 0X00, (byte) 0X0E,
(byte) 0X00, (byte) 0X06,
(byte) indexhigh, (byte) indexlow,
(byte) 0X01, (byte) 0X14,
(byte) phasehigh, (byte) phaselow,
(byte) startPointHigh, (byte) startPointLow,
(byte) nextPointHigh, (byte) nextPointLow,
(byte) startHighHigh, (byte) startHighLow,
(byte) nextHighHigh, (byte) nextHighLow
(byte) 0X01, (byte) 0X12,
(byte) phasehigh, (byte) phaselow
};
log.info("反馈agv动作数据--index:" + hexToString(indexhigh & 0xFF) + hexToString(indexlow & 0xFF) + ",phase:" + hexToString(phasehigh & 0xFF) + hexToString(phaselow & 0xFF));
System.out.println("反馈agv动作数据:" + Bytes2HexString(b));

View File

@@ -77,9 +77,9 @@ public class ZheDaAgvServiceImpl implements ZheDaAgvService {
String agvurl = paramService.findByCode(AcsConfig.RGVURL).getValue();
String agvport = paramService.findByCode(AcsConfig.RGVPORT).getValue();
agvurl = agvurl + ":" + agvport + "/v1/transportOrders/" + inst.getInstruction_code();
agvurl = agvurl + ":" + agvport + "/transportOrders/" + inst.getInstruction_code();
log.info("下发agv任务请求:{}", agvurl);
log.info("下发agv任务请求:{}内容为:{}", agvurl,String.valueOf(jo));
HttpResponse result = HttpRequest.post(agvurl)
.body(String.valueOf(jo))//表单内容
@@ -103,12 +103,13 @@ public class ZheDaAgvServiceImpl implements ZheDaAgvService {
agvurl = paramService.findByCode(AcsConfig.RGVURL).getValue();
agvport = paramService.findByCode(AcsConfig.RGVPORT).getValue();
agvurl = agvurl + ":" + agvport + "/v1/transportOrders";
HttpResponse result = HttpRequest.get(agvurl)
agvurl = agvurl + ":" + agvport + "/transportOrders/query";
log.info("下发agv查询状态请求:{}内容为:{}", agvurl);
HttpResponse result = HttpRequest.post(agvurl)
.body(String.valueOf(new JSONObject()))//表单内容
.timeout(20000)//超时,毫秒
.execute();
System.out.println("查询agv指令数据:" + result.body());
log.info("查询agv指令数据:" + result.body());
return result;
} else {
@@ -149,85 +150,10 @@ public class ZheDaAgvServiceImpl implements ZheDaAgvService {
//取货的进入前等待和离开等待
if (action.equals("Load")) {
if ("EntryRequired".equals(type)) {
//共挤线三工位
if (addressdevice.getDeviceDriver() instanceof HailiangSmartplcTestDeviceDriver) {
hailiangSmartplcTestDeviceDriver = (HailiangSmartplcTestDeviceDriver) addressdevice.getDeviceDriver();
if ((hailiangSmartplcTestDeviceDriver.getAction() == 1 || hailiangSmartplcTestDeviceDriver.getAction() == 3) && hailiangSmartplcTestDeviceDriver.getMove() == 1) {
inst.setExecute_status("1");
is_feedback = true;
}
}
//叠盘位
if (addressdevice.getDeviceDriver() instanceof EmptyVehicleStackingPositionDeviceDriver) {
emptyVehicleStackingPositionDeviceDriver = (EmptyVehicleStackingPositionDeviceDriver) addressdevice.getDeviceDriver();
int number = emptyVehicleStackingPositionDeviceDriver.getNumber();
if (number < Integer.valueOf(str)) {
log.info("叠盘位:" + jobno + "当前层高为:" + number + ",不存在第" + str + "的托盘!");
return null;
}
inst.setExecute_status("1");
is_feedback = true;
}
//货梯对接线
if (addressdevice.getDeviceDriver() instanceof CargoLiftConveyorDeviceDriver) {
cargoLiftConveyorDeviceDriver = (CargoLiftConveyorDeviceDriver) addressdevice.getDeviceDriver();
if ((cargoLiftConveyorDeviceDriver.getAction() == 1 || cargoLiftConveyorDeviceDriver.getAction() == 3) && cargoLiftConveyorDeviceDriver.getMove() == 1) {
inst.setExecute_status("1");
is_feedback = true;
}
}
//豪凯自动线对接位
if (addressdevice.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) {
hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) addressdevice.getDeviceDriver();
if ((hongXiangConveyorDeviceDriver.getAction() == 1 || hongXiangConveyorDeviceDriver.getAction() == 3) && hongXiangConveyorDeviceDriver.getMove() == 1) {
inst.setExecute_status("1");
is_feedback = true;
}
}
//油漆线
if (addressdevice.getDeviceDriver() instanceof PaintConveyorDeviceDriver) {
paintConveyorDeviceDriver = (PaintConveyorDeviceDriver) addressdevice.getDeviceDriver();
if ((paintConveyorDeviceDriver.getAction() == 1 || paintConveyorDeviceDriver.getAction() == 3) && paintConveyorDeviceDriver.getMove() == 1) {
inst.setExecute_status("1");
is_feedback = true;
}
}
}
if ("PauseOnStation".equals(type)) {
if (addressdevice.getDeviceDriver() instanceof HailiangSmartplcTestDeviceDriver) {
hailiangSmartplcTestDeviceDriver = (HailiangSmartplcTestDeviceDriver) addressdevice.getDeviceDriver();
inst.setExecute_status("2");
hailiangSmartplcTestDeviceDriver.writing(2);
is_feedback = true;
}
if (addressdevice.getDeviceDriver() instanceof EmptyVehicleStackingPositionDeviceDriver) {
emptyVehicleStackingPositionDeviceDriver = (EmptyVehicleStackingPositionDeviceDriver) addressdevice.getDeviceDriver();
inst.setExecute_status("2");
emptyVehicleStackingPositionDeviceDriver.writing(2);
is_feedback = true;
}
if (addressdevice.getDeviceDriver() instanceof CargoLiftConveyorDeviceDriver) {
cargoLiftConveyorDeviceDriver = (CargoLiftConveyorDeviceDriver) addressdevice.getDeviceDriver();
inst.setExecute_status("2");
cargoLiftConveyorDeviceDriver.writing(2);
is_feedback = true;
}
if (addressdevice.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) {
hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) addressdevice.getDeviceDriver();
inst.setExecute_status("2");
hongXiangConveyorDeviceDriver.writing(2);
is_feedback = true;
}
if (addressdevice.getDeviceDriver() instanceof PaintConveyorDeviceDriver) {
paintConveyorDeviceDriver = (PaintConveyorDeviceDriver) addressdevice.getDeviceDriver();
inst.setExecute_status("2");
paintConveyorDeviceDriver.writing(2);
is_feedback = true;
}
}
}
@@ -238,21 +164,6 @@ public class ZheDaAgvServiceImpl implements ZheDaAgvService {
jo.put("task_code", inst.getInstruction_code());
JSONArray destinations = new JSONArray();
String inst_type = inst.getInstruction_type();
//如果任务类型为1在点位进行等待则查询当前叠盘位的数量取当前数量的层数进行追加任务
// if ("1".equals(inst_type)) {
// emptyVehicleStackingPositionDeviceDriver = (EmptyVehicleStackingPositionDeviceDriver) addressdevice.getDeviceDriver();
// int current_num = emptyVehicleStackingPositionDeviceDriver.getNumber();
// if (current_num > 12) {
// log.info("当前叠盘架:" + jobno + "已放满!");
// return null;
// }
// String start_point_code = inst.getStart_point_code();
// String next_point_code = inst.getNext_point_code();
// start_point_code = start_point_code + "." + (current_num + 1);
// destinations.add(destination(start_point_code, "Load", "1", "1"));
// destinations.add(destination(next_point_code, "Unload", "1", "1"));
//
// }
String resp = acsToWmsService.requestTaskAgain(address,task.getExt_task_id(),inst.getVehicle_code());
JSONObject respjson = JSONObject.parseObject(resp);
@@ -281,7 +192,7 @@ public class ZheDaAgvServiceImpl implements ZheDaAgvService {
JSONObject complete = new JSONObject();
complete.put("task_code", inst.getInstruction_code());
String url2 = agvurl + ":" + agvport + "markComplete";
String url2 = agvurl + ":" + agvport + "/markComplete";
log.info("下发agv任务请求:{}", url2);
HttpResponse result2 = HttpRequest.post(url2)
@@ -294,85 +205,51 @@ public class ZheDaAgvServiceImpl implements ZheDaAgvService {
//放货的进入前等待和离开等待
if (action.equals("Unload")) {
if ("EntryRequired".equals(type)) {
if (addressdevice.getDeviceDriver() instanceof HailiangSmartplcTestDeviceDriver) {
hailiangSmartplcTestDeviceDriver = (HailiangSmartplcTestDeviceDriver) addressdevice.getDeviceDriver();
if ((hailiangSmartplcTestDeviceDriver.getAction() == 2 || hailiangSmartplcTestDeviceDriver.getAction() == 3) && hailiangSmartplcTestDeviceDriver.getMove() == 0) {
inst.setExecute_status("3");
is_feedback = true;
}
}
if (addressdevice.getDeviceDriver() instanceof EmptyVehicleStackingPositionDeviceDriver) {
emptyVehicleStackingPositionDeviceDriver = (EmptyVehicleStackingPositionDeviceDriver) addressdevice.getDeviceDriver();
int number = emptyVehicleStackingPositionDeviceDriver.getNumber();
if (number >= Integer.valueOf(str)) {
log.info("叠盘位:" + jobno + "" + str + "上有货!");
return null;
}
inst.setExecute_status("3");
is_feedback = true;
}
if (addressdevice.getDeviceDriver() instanceof CargoLiftConveyorDeviceDriver) {
cargoLiftConveyorDeviceDriver = (CargoLiftConveyorDeviceDriver) addressdevice.getDeviceDriver();
if ((cargoLiftConveyorDeviceDriver.getAction() == 2 || cargoLiftConveyorDeviceDriver.getAction() == 3) && cargoLiftConveyorDeviceDriver.getMove() == 0) {
inst.setExecute_status("3");
is_feedback = true;
}
}
if (addressdevice.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) {
hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) addressdevice.getDeviceDriver();
if ((hongXiangConveyorDeviceDriver.getAction() == 2 || hongXiangConveyorDeviceDriver.getAction() == 3) && hongXiangConveyorDeviceDriver.getMove() == 0) {
inst.setExecute_status("3");
is_feedback = true;
}
}
if (addressdevice.getDeviceDriver() instanceof PaintConveyorDeviceDriver) {
paintConveyorDeviceDriver = (PaintConveyorDeviceDriver) addressdevice.getDeviceDriver();
if ((paintConveyorDeviceDriver.getAction() == 2 || paintConveyorDeviceDriver.getAction() == 3) && paintConveyorDeviceDriver.getMove() == 0) {
inst.setExecute_status("3");
is_feedback = true;
}
}
}
if ("PauseOnStation".equals(type)) {
if (addressdevice.getDeviceDriver() instanceof HailiangSmartplcTestDeviceDriver) {
hailiangSmartplcTestDeviceDriver = (HailiangSmartplcTestDeviceDriver) addressdevice.getDeviceDriver();
inst.setExecute_status("4");
hailiangSmartplcTestDeviceDriver.writing(3);
is_feedback = true;
}
if (addressdevice.getDeviceDriver() instanceof EmptyVehicleStackingPositionDeviceDriver) {
emptyVehicleStackingPositionDeviceDriver = (EmptyVehicleStackingPositionDeviceDriver) addressdevice.getDeviceDriver();
inst.setExecute_status("4");
emptyVehicleStackingPositionDeviceDriver.writing(3);
is_feedback = true;
}
JSONObject jo = new JSONObject();
jo.put("task_code", inst.getInstruction_code());
JSONArray destinations = new JSONArray();
if (addressdevice.getDeviceDriver() instanceof CargoLiftConveyorDeviceDriver) {
cargoLiftConveyorDeviceDriver = (CargoLiftConveyorDeviceDriver) addressdevice.getDeviceDriver();
inst.setExecute_status("4");
cargoLiftConveyorDeviceDriver.writing(3);
is_feedback = true;
}
String resp = acsToWmsService.requestTaskAgain(address,task.getExt_task_id(),inst.getVehicle_code());
JSONObject respjson = JSONObject.parseObject(resp);
if (addressdevice.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) {
hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) addressdevice.getDeviceDriver();
inst.setExecute_status("4");
hongXiangConveyorDeviceDriver.writing(3);
is_feedback = true;
}
if (addressdevice.getDeviceDriver() instanceof PaintConveyorDeviceDriver) {
paintConveyorDeviceDriver = (PaintConveyorDeviceDriver) addressdevice.getDeviceDriver();
inst.setExecute_status("4");
paintConveyorDeviceDriver.writing(3);
is_feedback = true;
}
String next_device_code = respjson.getString("next_point_code");
DeviceDto device= deviceService.findByCode(next_device_code);
destinations.add(destination(device.getRemark(), "Unload", "1", "1"));
jo.put("destinations", destinations);
String agvurl = paramService.findByCode(AcsConfig.RGVURL).getValue();
String agvport = paramService.findByCode(AcsConfig.RGVPORT).getValue();
String url = agvurl + ":" + agvport + "/addDestinations";
log.info("下发agv任务请求:{}", url);
HttpResponse result = HttpRequest.post(url)
.body(String.valueOf(jo))//表单内容
.timeout(20000)//超时,毫秒
.execute();
log.info("下发agv任务请求反馈:{}", result);
//对任务进行封口
JSONObject complete = new JSONObject();
complete.put("task_code", inst.getInstruction_code());
String url2 = agvurl + ":" + agvport + "/markComplete";
log.info("下发agv任务请求:{}", url2);
HttpResponse result2 = HttpRequest.post(url2)
.body(String.valueOf(complete))//表单内容
.timeout(20000)//超时,毫秒
.execute();
log.info("下发agv任务请求反馈:{}", result2);
}
}
JSONObject requestjo = new JSONObject();
if (is_feedback) {
@@ -388,7 +265,7 @@ public class ZheDaAgvServiceImpl implements ZheDaAgvService {
String agvurl = paramService.findByCode(AcsConfig.RGVURL).getValue();
String agvport = paramService.findByCode(AcsConfig.RGVPORT).getValue();
agvurl = agvurl + ":" + agvport + "/v1/transportOrders/" + jobno + "/interact";
agvurl = agvurl + ":" + agvport + "/transportOrders/" + jobno + "/interact";
HttpResponse result = HttpRequest.post(agvurl)
.body(String.valueOf(requestjo))
@@ -406,7 +283,7 @@ public class ZheDaAgvServiceImpl implements ZheDaAgvService {
String agvurl = paramService.findByCode(AcsConfig.RGVURL).getValue();
String agvport = paramService.findByCode(AcsConfig.RGVPORT).getValue();
agvurl = agvurl + ":" + agvport + "/v1/" + code + "/markComplete";
agvurl = agvurl + ":" + agvport + "/" + code + "/markComplete";
log.info("关闭agv运单序列请求:{}", agvurl);
HttpResponse result = HttpRequest.post(agvurl)
@@ -542,7 +419,7 @@ public class ZheDaAgvServiceImpl implements ZheDaAgvService {
String agvurl = paramService.findByCode(AcsConfig.RGVURL).getValue();
String agvport = paramService.findByCode(AcsConfig.RGVPORT).getValue();
Instruction instruction = instructionService.findByCode(instCode);
agvurl = agvurl + ":" + agvport + "/rmds/v1/transportOrders/" + instCode + "/withdrawal";
agvurl = agvurl + ":" + agvport + "/transportOrders/" + instCode + "/withdrawal";
log.info("删除agv指令请求agvurl:{}", agvurl);
HttpResponse result = HttpRequest.post(agvurl)
.body("{}")

View File

@@ -195,7 +195,7 @@ public class OneNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
if (phase == 0x67) {
device = deviceAppService.findDeviceByCode(Integer.toString(arr[27]));
} else {
device = deviceAppService.findDeviceByCode(Integer.toString(arr[20]));
device = deviceAppService.findDeviceByCode("AGV0" + Integer.toString(arr[20]));
}
if (ObjectUtil.isNotEmpty(device)) {
if (device.getDeviceDriver() instanceof AgvNdcOneDeviceDriver) {

View File

@@ -32,7 +32,9 @@ public enum DriverTypeEnum {
AUTODOOR(10, "standard_autodoor", "标准版-自动门", "autodoor"),
TUBANXIAN_SITE(11, "tubanxian_site", "涂板线", "conveyor"),
GUHUASHI_SITE(12, "guhuashi_site", "固化室", "conveyor"),
TIANNENG_SITE(13, "tianneng_site", "天能-检测站点", "conveyor");
TIANNENG_SITE(13, "tianneng_site", "天能-检测站点", "conveyor"),
BAOSHIJIAN_SITE(14,"baoshijian_site","保湿间","conveyor");

View File

@@ -1738,7 +1738,7 @@ public class DeviceServiceImpl extends CommonServiceImpl<DeviceMapper, Device> i
Iterator iterator = storageCells.iterator();
while (iterator.hasNext()) {
StorageCellDto storageCellDto = (StorageCellDto) iterator.next();
if (storageCellDto.getAddress() == code) {
if (storageCellDto.getAddress()!=null && storageCellDto.getAddress() == code) {
return storageCellDto.getStorage_code();
}
}

View File

@@ -0,0 +1,62 @@
package org.nl.acs.device_driver.tianneng.baoshijian;
import org.nl.acs.device.device_driver.standard_inspect.ItemDto;
import org.nl.acs.device.domain.Device;
import org.nl.acs.device.enums.DeviceType;
import org.nl.acs.device_driver.DeviceDriver;
import org.nl.acs.device_driver.defination.OpcDeviceDriverDefination;
import org.springframework.stereotype.Service;
import java.util.LinkedList;
import java.util.List;
/**
* 保湿间驱动
* 说明:该站点为保湿间驱动
*/
@Service
public class BaoshijianDefination implements OpcDeviceDriverDefination {
@Override
public String getDriverCode() {
return "baoshijian_site";
}
@Override
public String getDriverName() {
return "保湿间";
}
@Override
public String getDriverDescription() {
return "保湿间";
}
@Override
public DeviceDriver getDriverInstance(Device device) {
return (new BaoshijianSiteDeviceDriver()).setDevice(device).setDriverDefination(this);
}
@Override
public Class<? extends DeviceDriver> getDeviceDriverType() {
return BaoshijianSiteDeviceDriver.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,309 @@
package org.nl.acs.device_driver.tianneng.baoshijian;
import cn.hutool.core.util.IdUtil;
import com.alibaba.fastjson.JSONObject;
import lombok.Data;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.nl.acs.device.domain.Device;
import org.nl.acs.device.service.DeviceService;
import org.nl.acs.device_driver.DeviceDriver;
import org.nl.acs.device_driver.RouteableDeviceDriver;
import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver;
import org.nl.acs.device_driver.driver.ExecutableDeviceDriver;
import org.nl.acs.ext.wms.data.BaseRequest;
import org.nl.acs.ext.wms.service.AcsToWmsService;
import org.nl.acs.instruction.domain.Instruction;
import org.nl.acs.instruction.service.InstructionService;
import org.nl.acs.monitor.DeviceStageMonitor;
import org.nl.acs.route.service.RouteLineService;
import org.nl.acs.task.service.TaskService;
import org.nl.acs.task.service.mapper.TaskMapper;
import org.nl.config.SpringContextHolder;
import org.openscada.opc.lib.da.Server;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 检测站点驱动
*/
@Slf4j
@Data
@RequiredArgsConstructor
public class BaoshijianSiteDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver, DeviceStageMonitor {
protected ItemProtocol itemProtocol = new ItemProtocol(this);
InstructionService instructionService = SpringContextHolder.getBean("instructionServiceImpl");
DeviceService deviceservice = SpringContextHolder.getBean("deviceServiceImpl");
RouteLineService routelineserver = SpringContextHolder.getBean("routeLineServiceImpl");
TaskService taskserver = SpringContextHolder.getBean("taskServiceImpl");
TaskMapper taskMapper;
AcsToWmsService acsToWmsService = SpringContextHolder.getBean("acsToWmsServiceImpl");
String container;
String container_type_desc;
String last_container_type_desc;
String last_container;
//放货准备锁
String putReadyLock = null;
//有货标记
protected boolean has_goods_tag = false;
private Date time = new Date();
int mode = 0;
int error = 0;
int move = 0;
int task = 0;
int action = 0;
int last_mode = 0;
int last_error = 0;
int last_move = 0;
int last_task = 0;
Boolean isonline = true;
int hasGoods = 0;
String message = null;
Boolean iserror = false;
int io_action = 0;
int last_io_action = 0;
int material_type = 0;
int last_material_type = 0;
int barcode = 0;
int last_barcode = 0;
boolean hasVehicle = false;
boolean isReady = false;
protected int instruction_num = 0;
protected int instruction_num_truth = 0;
boolean isFold = false;
private String assemble_check_tag;
protected String current_stage_instruction_message;
protected String last_stage_instruction_message;
Integer heartbeat_tag;
private Date instruction_require_time = new Date();
private Date instruction_finished_time = new Date();
private int instruction_require_time_out;
boolean in = false;
boolean out =false;
private int instruction_finished_time_out;
int branchProtocol = 0;
//备注
String remark;
//数量
String qty;
//物料
String material;
//批次
String batch;
//当前指令
Instruction inst = null;
//上次指令
Instruction last_inst = null;
//触摸屏手动触发任务
private Boolean is_has_task = false;
//满盅入库请求标记
boolean Sucess = false;
//暂定 0就绪 1请求取货 2取货完成 3请求放货 4放货完成 5取货完成离开 6放货完成离开 7请求进入区域 8请求离开区域
int flag;
String devicecode;
int x0 = 0;
int last_x0 = 0;
int x1 = 0;
int last_x1 = 0;
int x2 = 0;
int last_x2 = 0;
int x3 = 0;
int last_x3 = 0;
int x4 = 0;
int last_x4 = 0;
int x5 = 0;
int last_x5 = 0;
int x6 = 0;
int last_x6 = 0;
int x7 = 0;
int last_x7 = 0;
int x8 = 0;
int last_x8 = 0;
int x9 = 0;
int last_x9 = 0;
int x10 = 0;
int last_x10 = 0;
int x35 = 0;
int last_x35 = 0;
int x36 = 0;
int last_x36 = 0;
int x37 = 0;
int last_x37 = 0;
@Override
public Device getDevice() {
return this.device;
}
@Override
public void execute() {
String message = null;
try {
devicecode = this.getDeviceCode();
log.info("123:"+devicecode);
x0 = this.itemProtocol.getX0();
x1 = this.itemProtocol.getX1();
x2 = this.itemProtocol.getX2();
x3 = this.itemProtocol.getX3();
x4 = this.itemProtocol.getX4();
x5 = this.itemProtocol.getX5();
x6 = this.itemProtocol.getX6();
x7 = this.itemProtocol.getX7();
x8 = this.itemProtocol.getX8();
x9 = this.itemProtocol.getX9();
x10 = this.itemProtocol.getX10();
x35 = this.itemProtocol.getX35();
x36 = this.itemProtocol.getX36();
x37 = this.itemProtocol.getX37();
if (x1 != last_x1 && x1 == 0) {
log.info("设备{}反馈收片任务完成", this.devicecode);
this.writing("x6", 0);
this.writing("x8", 0);
} else if (x1 != last_x1 && x1 == 1 ) {
JSONObject jsonObject = new JSONObject();
String device_code = this.devicecode + "DJW01";
jsonObject.put("device_code", device_code);
jsonObject.put("requestDate", new Date());
jsonObject.put("requestNo", IdUtil.simpleUUID());
jsonObject.put("request_method_code", "TBXMLTASK");
String result=acsToWmsService.applyTaskToWms(jsonObject);
JSONObject res_jo = JSONObject.parseObject(result);
if (res_jo.getString("status").equals("200")){
this.writing("x6", 1);
}
}
if (x2 != last_x2 && x2 == 0) {
log.info("设备{}反馈上空架完成", this.devicecode);
this.writing("x5", 0);
this.writing("x7", 0);
} else if (x2 != last_x2 && x2 == 1) {
JSONObject jsonObject = new JSONObject();
String device_code = this.devicecode + "DJW02";
jsonObject.put("device_code", device_code);
jsonObject.put("requestDate", new Date());
jsonObject.put("requestNo", IdUtil.simpleUUID());
jsonObject.put("request_method_code", "TBXQKTask");
String result=acsToWmsService.applyTaskToWms(jsonObject);
JSONObject res_jo = JSONObject.parseObject(result);
if (res_jo.getString("status").equals("200")){
this.writing("x5", 1);
}
}
} catch (Exception var17) {
return;
}
last_x0 = x0;
last_x1 = x1;
last_x2 = x2;
last_x3 = x3;
last_x4 = x4;
last_x5 = x5;
last_x6 = x6;
last_x7 = x7;
last_x8 = x8;
last_x9 = x9;
last_x10 = x10;
last_x35 = x35;
last_x36 = x36;
last_x37 = x37;
}
public boolean exe_error() {
if (this.error == 0) {
return true;
} else {
log.debug("设备报警");
return false;
}
}
public void executing(Server server, Map<String, Object> itemMap) {
this.control(itemMap);
}
public void writing(String param, int command) {
String to_command = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
+ "." + param;
Map<String, Object> itemMap = new HashMap<>();
itemMap.put(to_command, command);
this.control(itemMap);
}
@Override
public JSONObject getDeviceStatusName() {
JSONObject jo = new JSONObject();
String mode = "";
String action = "";
String move = "";
if (this.getMode() == 0) {
mode = "未联机";
} else if (this.getMode() == 1) {
mode = "单机";
} else if (this.getMode() == 2) {
mode = "联机";
} else if (this.getMode() == 3) {
mode = "运行中";
}
if (this.getMove() == 0) {
move = "无货";
jo.put("hasGoods", false);
} else if (this.getMove() == 1) {
move = "有货";
jo.put("hasGoods", true);
} else if (this.getMove() == 2) {
move = "有托盘有货";
jo.put("hasGoods", true);
}
jo.put("device_name", this.getDevice().getDevice_name());
jo.put("mode", mode);
jo.put("move", move);
jo.put("action", action);
jo.put("isOnline", this.getIsonline());
jo.put("error", this.getError());
jo.put("isError", this.getIserror());
jo.put("task", this.getTask());
return jo;
}
@Override
public void setDeviceStatus(JSONObject data) {
}
}

View File

@@ -0,0 +1,156 @@
package org.nl.acs.device_driver.tianneng.baoshijian;
import cn.hutool.core.util.StrUtil;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.nl.acs.device.device_driver.standard_inspect.ItemDto;
import org.nl.acs.device_driver.tianneng.guhuashi.GuhuashiSiteDeviceDriver;
import java.util.ArrayList;
import java.util.List;
@Slf4j
@Data
public class ItemProtocol {
public static String item_x0 = "x0";
public static String item_x1 = "x1";
public static String item_x2 = "x2";
public static String item_x3 = "x3";
public static String item_x4 = "x4";
public static String item_x5 = "x5";
public static String item_x6 = "x6";
public static String item_x7 = "x7";
public static String item_x8 = "x8";
public static String item_x9 = "x9";
public static String item_x10 = "x10";
public static String item_x35 = "x35";
public static String item_x36 = "x36";
public static String item_x37 = "x37";
private BaoshijianSiteDeviceDriver driver;
public ItemProtocol(BaoshijianSiteDeviceDriver driver) {
this.driver = driver;
}
public int getX0() {
return this.getOpcIntegerValue(item_x0);
}
public int getX1() {
return this.getOpcIntegerValue(item_x1);
}
public int getX2() {
return this.getOpcIntegerValue(item_x2);
}
public int getX3() {
return this.getOpcIntegerValue(item_x3);
}
public int getX4() {
return this.getOpcIntegerValue(item_x4);
}
public int getX5() {
return this.getOpcIntegerValue(item_x5);
}
public int getX6() {
return this.getOpcIntegerValue(item_x6);
}
public int getX7() {
return this.getOpcIntegerValue(item_x7);
}
public int getX8() {
return this.getOpcIntegerValue(item_x8);
}
public int getX9() {
return this.getOpcIntegerValue(item_x9);
}
public int getX10() {
return this.getOpcIntegerValue(item_x10);
}
public int getX35() {
return this.getOpcIntegerValue(item_x35);
}
public int getX36() {
return this.getOpcIntegerValue(item_x36);
}
public int getX37() {
return this.getOpcIntegerValue(item_x37);
}
Boolean isonline;
public int getOpcIntegerValue(String protocol) {
try {
Integer value = this.driver.getIntegeregerValue(protocol);
if (value == null) {
// log.error(this.getDriver().getDeviceCode() + ":protocol " + protocol + " 信号同步异常!");
setIsonline(false);
} else {
setIsonline(true);
return value;
}
} catch (Exception e) {
}
return 0;
}
public String getOpcStringValue(String protocol) {
try {
String value = this.driver.getStringValue(protocol);
if (value == null) {
// log.error(this.getDriver().getDeviceCode() + ":protocol " + protocol + " 信号同步异常!");
setIsonline(false);
} else {
setIsonline(true);
return value;
}
} catch (Exception e) {
}
return "0";
}
public static List<ItemDto> getReadableItemDtos() {
ArrayList list = new ArrayList();
list.add(new ItemDto(item_x0, "系统状态", "400001"));
list.add(new ItemDto(item_x1, "收片完成", "400002"));
list.add(new ItemDto(item_x2, "需上空架", "400003"));
list.add(new ItemDto(item_x3, "门开到位", "400004"));
list.add(new ItemDto(item_x4, "门关到位", "400005"));
list.add(new ItemDto(item_x10, "备用字", "400011"));
list.add(new ItemDto(item_x35, "架数", "400036"));
list.add(new ItemDto(item_x36, "备用字", "400037"));
list.add(new ItemDto(item_x37, "机号", "400038"));
return list;
}
public static List<ItemDto> getWriteableItemDtos() {
ArrayList list = new ArrayList();
list.add(new ItemDto(item_x5, "上空架中", "400006"));
list.add(new ItemDto(item_x6, "下满架中", "400007"));
list.add(new ItemDto(item_x7, "上架完成", "400008"));
list.add(new ItemDto(item_x8, "下架完成(关门)", "400009"));
list.add(new ItemDto(item_x9, "开门请求", "400010"));
return list;
}
}

View File

@@ -153,16 +153,19 @@ public class ItemProtocol {
Boolean isonline;
public int getOpcIntegerValue(String protocol) {
Integer value = this.driver.getIntegeregerValue(protocol);
if (value == null) {
// log.error(this.getDriver().getDeviceCode() + ":protocol " + protocol + " 信号同步异常!");
setIsonline(false);
} else {
setIsonline(true);
return value;
try {
Integer value = this.driver.getIntegeregerValue(protocol);
if (value == null) {
// log.error(this.getDriver().getDeviceCode() + ":protocol " + protocol + " 信号同步异常!");
setIsonline(false);
} else {
setIsonline(true);
return value;
}
} catch (Exception e) {
}
return 0;
}
public static List<ItemDto> getReadableItemDtos() {

View File

@@ -148,7 +148,6 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
@Override
public String requestTaskAgain(String address, String task_id, String vehicle_code) {
String wmsurl = paramService.findByCode(AcsConfig.WMSURL).getValue();
String device_code = deviceService.queryDeviceCodeByAddress(Integer.parseInt(address));
JSONObject jo = new JSONObject();
jo.put("task_id", task_id);
String result2 = null;

View File

@@ -1019,29 +1019,6 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
if (flag) {
if (StrUtil.equals(entity.getInstruction_type(), "7")) {
CancelTaskRequest cancelTaskRequest = new CancelTaskRequest();
cancelTaskRequest.setOrderId(entity.getInstruction_code());
cancelTaskRequest.setPalletCode(entity.getVehicle_code());
cancelTaskRequest.setSrcLocation(entity.getStart_point_code());
cancelTaskRequest.setDestLocation(entity.getNext_point_code());
// 1 入库2 出库3 移库4 空托盘入库5 空托盘出库
int type = 0;
if (StrUtil.equals(task.getStorage_task_type(), "1")) {
type = 1;
} else if (StrUtil.equals(task.getStorage_task_type(), "2")) {
type = 4;
} else if (StrUtil.equals(task.getStorage_task_type(), "3")) {
type = 2;
} else if (StrUtil.equals(task.getStorage_task_type(), "4")) {
type = 5;
} else if (StrUtil.equals(task.getStorage_task_type(), "5")) {
type = 3;
}
cancelTaskRequest.setTaskType(type);
acsToLiKuService.cancelTask(cancelTaskRequest);
}
String currentUsername = SecurityUtils.getCurrentUsername();
String now = DateUtil.now();
entity.setUpdate_time(now);
@@ -1086,6 +1063,7 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
return;
}
removeByCodeFromCache(entity.getInstruction_code());
// taskService.cancel(entity.getTask_id());
}
// this.reload();
}

View File

@@ -234,13 +234,14 @@ public class DeviceAppServiceImpl implements DeviceAppService, ApplicationAutoIn
@Override
public <T extends DeviceDriver> List<T> findDeviceDriver(Class<T> clazz) {
List<T> list = new ArrayList();
Iterator var3 = this.findAllDevice().iterator();
List<T> list = new ArrayList<>();
List<Device> devices = new ArrayList<>(this.findAllDevice()); // Create a copy of the collection
Iterator<Device> var3 = devices.iterator();
while (var3.hasNext()) {
Device device = (Device) var3.next();
Device device = var3.next();
DeviceDriver deviceDriver = device.getDeviceDriver();
//查找某驱动的所有子类
// 查找某驱动的所有子类
if (deviceDriver != null && clazz.isAssignableFrom(deviceDriver.getClass())) {
list.add((T) device.getDeviceDriver());
}
@@ -249,6 +250,7 @@ public class DeviceAppServiceImpl implements DeviceAppService, ApplicationAutoIn
return list;
}
@Override
public Map<String, String> findDeviceOptions(DeviceType deviceType) {
List<Device> list = this.findDevice(deviceType);

View File

@@ -871,6 +871,7 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
TaskFeedbackDto feefbackdto = taskFeedbackService.findByCode(entity.getTask_code());
FeedBackTaskStatusRequest request = new FeedBackTaskStatusRequest();
request.setTask_code(entity.getTask_code());
request.setTask_id(entity.getExt_task_id());
request.setTask_status(entity.getTask_status());
request.setRequest_medthod_code(RequestMethodEnum.feedback_task_status.getCode());
request.setRequest_medthod_name(RequestMethodEnum.feedback_task_status.getName());

View File

@@ -28,9 +28,11 @@ public class QueryZDAgvTaskStatus {
public void run() throws Exception {
try {
log.info("自动线程开始查询浙大AGV任务状态");
HttpResponse response2 = agvService.queryAgvInstStatus("1");
//查询AGV指令列表
JSONArray inst_rows2 = JSONArray.parseArray(response2.body());
// JSONArray inst_rows2 = JSONArray.parseArray("");
for (int i = 0; i < inst_rows2.size(); i++) {
JSONObject inst_jo = inst_rows2.getJSONObject(i);
String inst_code = inst_jo.getString("task_code");

View File

@@ -127,7 +127,7 @@ file:
avatarMaxSize: 5
logging:
file:
path: C:\log\wms
path: C:\log\acs
config: classpath:logback-spring.xml
# Sa-Token配置

View File

@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<included>
<springProperty scope="context" name="logPath" source="logging.file.path" defaultValue="logs"/>
<property name="LOG_HOME" value="${logPath}"/>
<!-- 按照每天生成日志文件 -->
<appender name="AgvNdcOneDeviceDriver" class="ch.qos.logback.core.rolling.RollingFileAppender">
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<!--日志文件输出的文件名-->
<FileNamePattern>${LOG_HOME}/AGV驱动与NDC交互/%d{yyyy-MM-dd}.%i.log</FileNamePattern>
<!--日志文件保留天数-->
<maxHistory>15</maxHistory>
<!--单个日志最大容量 至少10MB才能看得出来-->
<maxFileSize>50MB</maxFileSize>
<!--所有日志最多占多大容量-->
<totalSizeCap>2GB</totalSizeCap>
</rollingPolicy>
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<!--格式化输出:%d表示日期%thread表示线程名%-5level级别从左显示5个字符宽度%msg日志消息%n是换行符-->
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern>
<charset>${log.charset}</charset>
</encoder>
</appender>
<!-- <logger name="org.nl.start.Init" level="info" additivity="false">
<appender-ref ref="FILE3"/>
</logger>-->
<!-- 打印sql -->
<logger name="org.nl.acs.device_driver.basedriver.agv.ndcone.AgvNdcOneDeviceDriver" level="info" additivity="false">
<appender-ref ref="AgvNdcOneDeviceDriver"/>
</logger>
</included>

View File

@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<included>
<springProperty scope="context" name="logPath" source="logging.file.path" defaultValue="logs"/>
<property name="LOG_HOME" value="${logPath}"/>
<!-- 按照每天生成日志文件 -->
<appender name="AutoCreateInst" class="ch.qos.logback.core.rolling.RollingFileAppender">
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<!--日志文件输出的文件名-->
<FileNamePattern>${LOG_HOME}/自动创建指令/%d{yyyy-MM-dd}.%i.log</FileNamePattern>
<!--日志文件保留天数-->
<maxHistory>15</maxHistory>
<!--单个日志最大容量 至少10MB才能看得出来-->
<maxFileSize>50MB</maxFileSize>
<!--所有日志最多占多大容量-->
<totalSizeCap>2GB</totalSizeCap>
</rollingPolicy>
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<!--格式化输出:%d表示日期%thread表示线程名%-5level级别从左显示5个字符宽度%msg日志消息%n是换行符-->
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern>
<charset>${log.charset}</charset>
</encoder>
</appender>
<!-- <logger name="org.nl.start.Init" level="info" additivity="false">
<appender-ref ref="FILE3"/>
</logger>-->
<!-- 打印sql -->
<logger name="org.nl.modules.quartz.task.AutoCreateInst" level="info" additivity="false">
<appender-ref ref="AutoCreateInst"/>
</logger>
</included>

View File

@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<included>
<springProperty scope="context" name="logPath" source="logging.file.path" defaultValue="logs"/>
<property name="LOG_HOME" value="${logPath}"/>
<!-- 按照每天生成日志文件 -->
<appender name="LnshRGVDeviceDriver" class="ch.qos.logback.core.rolling.RollingFileAppender">
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<!--日志文件输出的文件名-->
<FileNamePattern>${LOG_HOME}/RGV日志/%d{yyyy-MM-dd}.%i.log</FileNamePattern>
<!--日志文件保留天数-->
<maxHistory>15</maxHistory>
<!--单个日志最大容量 至少10MB才能看得出来-->
<maxFileSize>50MB</maxFileSize>
<!--所有日志最多占多大容量-->
<totalSizeCap>2GB</totalSizeCap>
</rollingPolicy>
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<!--格式化输出:%d表示日期%thread表示线程名%-5level级别从左显示5个字符宽度%msg日志消息%n是换行符-->
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern>
<charset>${log.charset}</charset>
</encoder>
</appender>
<!-- <logger name="org.nl.start.Init" level="info" additivity="false">
<appender-ref ref="FILE3"/>
</logger>-->
<!-- 打印sql -->
<logger name="org.nl.acs.device_driver.lnsh.lnsh_rgv.LnshRGVDeviceDriver" level="info" additivity="false">
<appender-ref ref="LnshRGVDeviceDriver"/>
</logger>
</included>

View File

@@ -0,0 +1,41 @@
<?xml version="1.0" encoding="UTF-8"?>
<included>
<springProperty scope="context" name="logPath" source="logging.file.path" defaultValue="logs"/>
<property name="LOG_HOME" value="${logPath}"/>
<define name="DEVICECODE" class="org.nl.modules.logging.DeviceCodeDir"/>
<!-- 按照每天生成日志文件 -->
<appender name="FILE_LUCENE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<!--日志文件输出的文件名-->
<FileNamePattern>${LOG_HOME}/lucene/${DEVICECODE}/%d{yyyy-MM-dd}.%i.log</FileNamePattern>
<!--日志文件保留天数-->
<maxHistory>15</maxHistory>
<!--单个日志最大容量 至少10MB才能看得出来-->
<maxFileSize>50MB</maxFileSize>
<!--所有日志最多占多大容量-->
<totalSizeCap>2GB</totalSizeCap>
</rollingPolicy>
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<!--格式化输出:%d表示日期%thread表示线程名%-5level级别从左显示5个字符宽度%msg日志消息%n是换行符-->
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern>
<charset>${log.charset}</charset>
</encoder>
</appender>
<appender name="luceneAppender" class="org.nl.modules.lucene.common.LuceneAppender" />
<appender name="asyncLuceneAppender" class="ch.qos.logback.classic.AsyncAppender">
<appender-ref ref="luceneAppender" />
<!-- 设置队列大小,根据您的需求调整 -->
<queueSize>512</queueSize>
</appender>
<!-- <logger name="org.nl.start.Init" level="info" additivity="false">
<appender-ref ref="FILE3"/>
</logger>-->
<!-- 打印sql -->
<logger name="org.nl.modules.lucene.service.impl.LuceneExecuteLogServiceImpl" level="info" additivity="true">
<appender-ref ref="FILE_LUCENE"/>
<appender-ref ref="asyncLuceneAppender"/>
</logger>
</included>

View File

@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<included>
<springProperty scope="context" name="logPath" source="logging.file.path" defaultValue="logs"/>
<property name="LOG_HOME" value="${logPath}"/>
<!-- 按照每天生成日志文件 -->
<appender name="NDCAgvServiceImpl" class="ch.qos.logback.core.rolling.RollingFileAppender">
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<!--日志文件输出的文件名-->
<FileNamePattern>${LOG_HOME}/NDCAGV服务/%d{yyyy-MM-dd}.%i.log</FileNamePattern>
<!--日志文件保留天数-->
<maxHistory>15</maxHistory>
<!--单个日志最大容量 至少10MB才能看得出来-->
<maxFileSize>50MB</maxFileSize>
<!--所有日志最多占多大容量-->
<totalSizeCap>2GB</totalSizeCap>
</rollingPolicy>
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<!--格式化输出:%d表示日期%thread表示线程名%-5level级别从左显示5个字符宽度%msg日志消息%n是换行符-->
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern>
<charset>${log.charset}</charset>
</encoder>
</appender>
<!-- <logger name="org.nl.start.Init" level="info" additivity="false">
<appender-ref ref="FILE3"/>
</logger>-->
<!-- 打印sql -->
<logger name="org.nl.acs.agv.server.impl.NDCAgvServiceImpl" level="info" additivity="false">
<appender-ref ref="NDCAgvServiceImpl"/>
</logger>
</included>

View File

@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<included>
<springProperty scope="context" name="logPath" source="logging.file.path" defaultValue="logs"/>
<property name="LOG_HOME" value="${logPath}"/>
<!-- 按照每天生成日志文件 -->
<appender name="OneNDCSocketConnectionAutoRun" class="ch.qos.logback.core.rolling.RollingFileAppender">
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<!--日志文件输出的文件名-->
<FileNamePattern>${LOG_HOME}/NDC交互日志/%d{yyyy-MM-dd}.%i.log</FileNamePattern>
<!--日志文件保留天数-->
<maxHistory>15</maxHistory>
<!--单个日志最大容量 至少10MB才能看得出来-->
<maxFileSize>50MB</maxFileSize>
<!--所有日志最多占多大容量-->
<totalSizeCap>2GB</totalSizeCap>
</rollingPolicy>
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<!--格式化输出:%d表示日期%thread表示线程名%-5level级别从左显示5个字符宽度%msg日志消息%n是换行符-->
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern>
<charset>${log.charset}</charset>
</encoder>
</appender>
<!-- <logger name="org.nl.start.Init" level="info" additivity="false">
<appender-ref ref="FILE3"/>
</logger>-->
<!-- 打印sql -->
<logger name="org.nl.start.auto.run.OneNDCSocketConnectionAutoRun" level="info" additivity="false">
<appender-ref ref="OneNDCSocketConnectionAutoRun"/>
</logger>
</included>

View File

@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<included>
<springProperty scope="context" name="logPath" source="logging.file.path" defaultValue="logs"/>
<property name="LOG_HOME" value="${logPath}"/>
<!-- 按照每天生成日志文件 -->
<appender name="WmsToAcs" class="ch.qos.logback.core.rolling.RollingFileAppender">
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<!--日志文件输出的文件名-->
<FileNamePattern>${LOG_HOME}/WMS请求ACS/%d{yyyy-MM-dd}.%i.log</FileNamePattern>
<!--日志文件保留天数-->
<maxHistory>15</maxHistory>
<!--单个日志最大容量 至少10MB才能看得出来-->
<maxFileSize>50MB</maxFileSize>
<!--所有日志最多占多大容量-->
<totalSizeCap>2GB</totalSizeCap>
</rollingPolicy>
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<!--格式化输出:%d表示日期%thread表示线程名%-5level级别从左显示5个字符宽度%msg日志消息%n是换行符-->
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern>
<charset>${log.charset}</charset>
</encoder>
</appender>
<!-- <logger name="org.nl.start.Init" level="info" additivity="false">
<appender-ref ref="FILE3"/>
</logger>-->
<!-- 打印sql -->
<logger name="org.nl.acs.ext.wms.service.impl.WmsToAcsServiceImpl" level="info" additivity="false">
<appender-ref ref="WmsToAcs"/>
</logger>
</included>

View File

@@ -11,7 +11,7 @@
<!--日志文件保留天数-->
<maxHistory>15</maxHistory>
<!--单个日志最大容量 至少10MB才能看得出来-->
<maxFileSize>200MB</maxFileSize>
<maxFileSize>50MB</maxFileSize>
<!--所有日志最多占多大容量-->
<totalSizeCap>2GB</totalSizeCap>
</rollingPolicy>

View File

@@ -18,12 +18,19 @@ https://juejin.cn/post/6844903775631572999
<!--引入默认的一些设置-->
<!--<include resource="log/XrToMes.xml"/>
<include resource="log/MesToErp.xml"/>-->
<include resource="log/XgAgvDeviceDriver.xml"/>
<include resource="log/AutoCreateInst.xml"/>
<include resource="log/AcsToWms.xml"/>
<include resource="log/WmsToAcs.xml"/>
<include resource="log/OneNDCSocketConnectionAutoRun.xml"/>
<!-- <include resource="log/Lucene.xml"/>-->
<include resource="log/AgvNdcOneDeviceDriver.xml"/>
<include resource="log/NDCAgvServiceImpl.xml"/>
<include resource="log/LnshRGVDeviceDriver.xml"/>
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
<withJansi>true</withJansi>
<encoder class="com.yomahub.tlog.core.enhance.logback.AspectLogbackEncoder">
<!-- <encoder>-->
<!-- <encoder>-->
<pattern>${log.pattern}</pattern>
</encoder>
</appender>
@@ -38,13 +45,13 @@ https://juejin.cn/post/6844903775631572999
<!--日志文件保留天数-->
<maxHistory>15</maxHistory>
<!--单个日志最大容量 至少10MB才能看得出来-->
<maxFileSize>200MB</maxFileSize>
<maxFileSize>50MB</maxFileSize>
<!--所有日志最多占多大容量-->
<totalSizeCap>20GB</totalSizeCap>
</rollingPolicy>
<encoder class="com.yomahub.tlog.core.enhance.logback.AspectLogbackEncoder">
<!-- <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">-->
<!-- <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">-->
<!--格式化输出:%d表示日期%thread表示线程名%-5level级别从左显示5个字符宽度%msg日志消息%n是换行符-->
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern>
</encoder>
@@ -52,9 +59,9 @@ https://juejin.cn/post/6844903775631572999
</appender>
<!--异步到文件-->
<!-- <appender name="asyncFileAppender" class="ch.qos.logback.classic.AsyncAppender">-->
<!-- <appender name="asyncFileAppender" class="ch.qos.logback.classic.AsyncAppender">-->
<appender name="asyncFileAppender" class="com.yomahub.tlog.core.enhance.logback.async.AspectLogbackAsyncAppender">
<discardingThreshold>0</discardingThreshold>
<discardingThreshold>0</discardingThreshold>
<queueSize>500</queueSize>
<appender-ref ref="FILE"/>
</appender>
@@ -65,9 +72,8 @@ https://juejin.cn/post/6844903775631572999
<!--开发环境:打印控制台-->
<springProfile name="dev">
<root level="debug">
<appender-ref ref="CONSOLE"/>
<appender-ref ref="MY_FILE"/>
<root level="info">
<appender-ref ref="asyncFileAppender"/>
</root>
<logger name="org.springframework" level="ERROR" additivity="false">
<appender-ref ref="CONSOLE"/>