代码更新
This commit is contained in:
@@ -0,0 +1,551 @@
|
|||||||
|
package org.nl.acs.agv.server.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import cn.hutool.http.HttpRequest;
|
||||||
|
import cn.hutool.http.HttpResponse;
|
||||||
|
import com.alibaba.fastjson.JSONArray;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.nl.acs.agv.server.ZheDaAgvService;
|
||||||
|
import org.nl.acs.config.AcsConfig;
|
||||||
|
import org.nl.acs.config.server.AcsConfigService;
|
||||||
|
import org.nl.acs.instruction.service.InstructionService;
|
||||||
|
import org.nl.acs.instruction.service.dto.Instruction;
|
||||||
|
import org.nl.acs.opc.Device;
|
||||||
|
import org.nl.acs.opc.DeviceAppService;
|
||||||
|
import org.nl.acs.opc.DeviceAppServiceImpl;
|
||||||
|
import org.nl.utils.SpringContextHolder;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.text.DateFormat;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.Calendar;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.TimeZone;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
@Service
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class ZheDaAgvServiceImpl implements ZheDaAgvService {
|
||||||
|
private final AcsConfigService acsConfigService;
|
||||||
|
@Override
|
||||||
|
//ZDAGV
|
||||||
|
public HttpResponse sendAgvInstToZDAgv(Instruction inst) throws Exception {
|
||||||
|
JSONObject jo = new JSONObject();
|
||||||
|
String start_point_code = inst.getStart_point_code();
|
||||||
|
String next_point_code = inst.getNext_point_code();
|
||||||
|
//1、叠盘架追加任务;2、养生区需要追加任务,在缓存点等待3、二楼普通任务4、一楼普通任务
|
||||||
|
String task_type = inst.getInstruction_type();
|
||||||
|
jo.put("deadline", getNextDay(1));
|
||||||
|
//判断是否追加任务
|
||||||
|
if (task_type.equals("2") || task_type.equals("1")) {
|
||||||
|
jo.put("complete", "false");
|
||||||
|
} else {
|
||||||
|
jo.put("complete", "true");
|
||||||
|
}
|
||||||
|
jo.put("task_code", inst.getInstruction_code());
|
||||||
|
//根据任务,下发指令类型
|
||||||
|
JSONArray destinations = new JSONArray();
|
||||||
|
if (task_type.equals("1")) {
|
||||||
|
destinations.add(destination(start_point_code, "Wait", "5", "1"));
|
||||||
|
} else {
|
||||||
|
destinations.add(destination(start_point_code, "Load", "1", "1"));
|
||||||
|
if (task_type.equals("2")) {
|
||||||
|
destinations.add(destination(next_point_code, "Wait", "5", "1"));
|
||||||
|
} else {
|
||||||
|
destinations.add(destination(next_point_code, "Unload", "5", "1"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
jo.put("destinations", destinations);
|
||||||
|
|
||||||
|
if (StrUtil.equals(acsConfigService.findConfigFromCache().get(AcsConfig.FORKAGV).toString(), "1")) {
|
||||||
|
String url = "";
|
||||||
|
String agvurl = acsConfigService.findConfigFromCache().get(AcsConfig.AGVURL);
|
||||||
|
String agvurl2 = acsConfigService.findConfigFromCache().get(AcsConfig.AGVURL2);
|
||||||
|
String agvport = acsConfigService.findConfigFromCache().get(AcsConfig.AGVPORT);
|
||||||
|
//不同楼层下发不同的agv系统
|
||||||
|
if (task_type.equals("8")) {
|
||||||
|
url = agvurl2;
|
||||||
|
} else {
|
||||||
|
url = agvurl;
|
||||||
|
}
|
||||||
|
url = url + ":" + agvport + "v1/transportOrders/" + inst.getInstruction_code();
|
||||||
|
log.info("下发agv任务请求:{}", url);
|
||||||
|
|
||||||
|
HttpResponse result = HttpRequest.post(agvurl)
|
||||||
|
.body(String.valueOf(jo))//表单内容
|
||||||
|
.timeout(20000)//超时,毫秒
|
||||||
|
.execute();
|
||||||
|
log.info("下发agv任务请求反馈:{}", result);
|
||||||
|
return result;
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
//ZDAGV
|
||||||
|
public HttpResponse queryZDAgvInstStatus(String type) {
|
||||||
|
if (StrUtil.equals(acsConfigService.findConfigFromCache().get(AcsConfig.FORKAGV).toString(), "1")) {
|
||||||
|
String agvurl = "";
|
||||||
|
if (type.equals("1")) {
|
||||||
|
agvurl = acsConfigService.findConfigFromCache().get(AcsConfig.AGVURL);
|
||||||
|
}
|
||||||
|
if (type.equals("2")) {
|
||||||
|
agvurl = acsConfigService.findConfigFromCache().get(AcsConfig.AGVURL2);
|
||||||
|
}
|
||||||
|
String agvport = acsConfigService.findConfigFromCache().get(AcsConfig.AGVPORT);
|
||||||
|
|
||||||
|
agvurl = agvurl + ":" + agvport + "/transportOrders";
|
||||||
|
|
||||||
|
HttpResponse result = HttpRequest.get(agvurl)
|
||||||
|
.timeout(20000)//超时,毫秒
|
||||||
|
.execute();
|
||||||
|
System.out.println("查询agv指令数据:" + result.body());
|
||||||
|
|
||||||
|
return result;
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
//ZDAGV
|
||||||
|
public synchronized String process(String jobno, String type, String address, String action, String processingVehicle) {
|
||||||
|
log.info("查询到AGV请求参数,jobno:{},address:{}", jobno + ",address:" + address + ",type:" + type + ",action:" + action);
|
||||||
|
//释放AGV资源,继续后续动作
|
||||||
|
boolean is_feedback = false;
|
||||||
|
String str = "";
|
||||||
|
String backaddress = address;
|
||||||
|
if (address.indexOf(".") > 0) {
|
||||||
|
str = address.substring(address.indexOf(".") + 1, address.length());
|
||||||
|
address = address.substring(0, address.indexOf("."));
|
||||||
|
} else if (address.indexOf("-") > 0) {
|
||||||
|
address = address.substring(0, address.indexOf("-"));
|
||||||
|
}
|
||||||
|
InstructionService instructionService = SpringContextHolder.getBean("instructionServiceImpl");
|
||||||
|
Instruction inst = instructionService.findByCodeFromCache(jobno);
|
||||||
|
|
||||||
|
|
||||||
|
DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class);
|
||||||
|
Device addressdevice = appService.findDeviceByCode(address);
|
||||||
|
|
||||||
|
CargoLiftConveyorDeviceDriver cargoLiftConveyorDeviceDriver;
|
||||||
|
EmptyVehicleStackingPositionDeviceDriver emptyVehicleStackingPositionDeviceDriver;
|
||||||
|
HailiangSmartplcTestDeviceDriver hailiangSmartplcTestDeviceDriver;
|
||||||
|
HaoKaiAutoConveyorDeviceDriver haoKaiAutoConveyorDeviceDriver;
|
||||||
|
PaintConveyorDeviceDriver paintConveyorDeviceDriver;
|
||||||
|
|
||||||
|
//取货的进入前等待和离开等待
|
||||||
|
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 HaoKaiAutoConveyorDeviceDriver) {
|
||||||
|
haoKaiAutoConveyorDeviceDriver = (HaoKaiAutoConveyorDeviceDriver) addressdevice.getDeviceDriver();
|
||||||
|
if ((haoKaiAutoConveyorDeviceDriver.getAction() == 1 || haoKaiAutoConveyorDeviceDriver.getAction() == 3) && haoKaiAutoConveyorDeviceDriver.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 HaoKaiAutoConveyorDeviceDriver) {
|
||||||
|
haoKaiAutoConveyorDeviceDriver = (HaoKaiAutoConveyorDeviceDriver) addressdevice.getDeviceDriver();
|
||||||
|
inst.setExecute_status("2");
|
||||||
|
haoKaiAutoConveyorDeviceDriver.writing(2);
|
||||||
|
is_feedback = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (addressdevice.getDeviceDriver() instanceof PaintConveyorDeviceDriver) {
|
||||||
|
paintConveyorDeviceDriver = (PaintConveyorDeviceDriver) addressdevice.getDeviceDriver();
|
||||||
|
inst.setExecute_status("2");
|
||||||
|
paintConveyorDeviceDriver.writing(2);
|
||||||
|
is_feedback = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//等待点等待
|
||||||
|
if (action.equals("Wait")) {
|
||||||
|
if ("Wait".equals(type)) {
|
||||||
|
JSONObject jo = new JSONObject();
|
||||||
|
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"));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//如果任务类型为2,在点位进行等待,则调用LMS的货位申请接口
|
||||||
|
if ("2".equals(inst_type)) {
|
||||||
|
String next_point_code = "";
|
||||||
|
//调用LMS接口
|
||||||
|
|
||||||
|
|
||||||
|
destinations.add(destination(next_point_code, "Unload", "5", "1"));
|
||||||
|
}
|
||||||
|
jo.put("destinations", destinations);
|
||||||
|
|
||||||
|
String agvurl = acsConfigService.findConfigFromCache().get(AcsConfig.AGVURL);
|
||||||
|
String agvport = acsConfigService.findConfigFromCache().get(AcsConfig.AGVPORT);
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//放货的进入前等待和离开等待
|
||||||
|
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 HaoKaiAutoConveyorDeviceDriver) {
|
||||||
|
haoKaiAutoConveyorDeviceDriver = (HaoKaiAutoConveyorDeviceDriver) addressdevice.getDeviceDriver();
|
||||||
|
if ((haoKaiAutoConveyorDeviceDriver.getAction() == 2 || haoKaiAutoConveyorDeviceDriver.getAction() == 3) && haoKaiAutoConveyorDeviceDriver.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;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (addressdevice.getDeviceDriver() instanceof CargoLiftConveyorDeviceDriver) {
|
||||||
|
cargoLiftConveyorDeviceDriver = (CargoLiftConveyorDeviceDriver) addressdevice.getDeviceDriver();
|
||||||
|
inst.setExecute_status("4");
|
||||||
|
cargoLiftConveyorDeviceDriver.writing(3);
|
||||||
|
is_feedback = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (addressdevice.getDeviceDriver() instanceof HaoKaiAutoConveyorDeviceDriver) {
|
||||||
|
haoKaiAutoConveyorDeviceDriver = (HaoKaiAutoConveyorDeviceDriver) addressdevice.getDeviceDriver();
|
||||||
|
inst.setExecute_status("4");
|
||||||
|
haoKaiAutoConveyorDeviceDriver.writing(3);
|
||||||
|
is_feedback = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (addressdevice.getDeviceDriver() instanceof PaintConveyorDeviceDriver) {
|
||||||
|
paintConveyorDeviceDriver = (PaintConveyorDeviceDriver) addressdevice.getDeviceDriver();
|
||||||
|
inst.setExecute_status("4");
|
||||||
|
paintConveyorDeviceDriver.writing(3);
|
||||||
|
is_feedback = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
JSONObject requestjo = new JSONObject();
|
||||||
|
if (is_feedback) {
|
||||||
|
requestjo.put("task_code",jobno);
|
||||||
|
requestjo.put("operation",action);
|
||||||
|
if (type.equals("entryRequired") || type.equals("EntryRequired")){
|
||||||
|
requestjo.put("entryRequired","true");
|
||||||
|
}else {
|
||||||
|
requestjo.put("pauseOnStation","true");
|
||||||
|
}
|
||||||
|
log.info("反馈AGV请求数据:{}", requestjo);
|
||||||
|
System.out.println("back agv:" + requestjo);
|
||||||
|
|
||||||
|
String agvurl = acsConfigService.findConfigFromCache().get(AcsConfig.AGVURL);
|
||||||
|
String agvport = acsConfigService.findConfigFromCache().get(AcsConfig.AGVPORT);
|
||||||
|
|
||||||
|
if (inst.getInstruction_type().equals("4")){
|
||||||
|
agvurl = acsConfigService.findConfigFromCache().get(AcsConfig.AGVURL2);
|
||||||
|
}
|
||||||
|
agvurl = agvurl + ":" + agvport + "/v1/transportOrders/" + jobno + "/interact";
|
||||||
|
|
||||||
|
HttpResponse result = HttpRequest.post(agvurl)
|
||||||
|
.body(String.valueOf(requestjo))
|
||||||
|
.timeout(20000)//超时,毫秒
|
||||||
|
.execute();
|
||||||
|
}
|
||||||
|
|
||||||
|
return requestjo.toString();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
//ZDAGV
|
||||||
|
public HttpResponse markComplete(String code) throws Exception {
|
||||||
|
|
||||||
|
if (StrUtil.equals(acsConfigService.findConfigFromCache().get(AcsConfig.FORKAGV).toString(), "1")) {
|
||||||
|
String agvurl = acsConfigService.findConfigFromCache().get(AcsConfig.AGVURL);
|
||||||
|
String agvport = acsConfigService.findConfigFromCache().get(AcsConfig.AGVPORT);
|
||||||
|
|
||||||
|
agvurl = agvurl + ":" + agvport + "/v1/" + code + "/markComplete";
|
||||||
|
log.info("关闭agv运单序列请求:{}", agvurl);
|
||||||
|
|
||||||
|
HttpResponse result = HttpRequest.post(agvurl)
|
||||||
|
//.body(String.valueOf(orderjo))//表单内容
|
||||||
|
.timeout(20000)//超时,毫秒
|
||||||
|
.execute();
|
||||||
|
log.info("关闭agv运单序列请求反馈:{}", result);
|
||||||
|
|
||||||
|
return result;
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 返回一个点位操作子任务
|
||||||
|
*
|
||||||
|
* @param locationName 点位
|
||||||
|
* @param operation 点位操作
|
||||||
|
* @param propertiesType 子任务类型
|
||||||
|
* @param pro 子任务参数
|
||||||
|
* 调用demo:destination("sh15p", "Spin", "2", "3.14")
|
||||||
|
* demo:destination("cz14", "JackUnload", "3", "")
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
//ZDAGV
|
||||||
|
public static JSONObject destination(String locationName, String operation, String propertiesType, String pro) {
|
||||||
|
//新增业务订单
|
||||||
|
JSONObject destinationOrder = new JSONObject();
|
||||||
|
//目标工作站
|
||||||
|
destinationOrder.put("locationName", locationName);
|
||||||
|
//机器人在工作站要执行的操作
|
||||||
|
destinationOrder.put("operation", operation);
|
||||||
|
if (propertiesType.equals("1")) {//取货前等待、取货后等待
|
||||||
|
|
||||||
|
//pro 1 进入离开等待
|
||||||
|
if ("1".equals(pro)) {
|
||||||
|
JSONArray properties = new JSONArray();
|
||||||
|
JSONObject pro1 = new JSONObject();
|
||||||
|
pro1.put("key", "EntryRequired");
|
||||||
|
pro1.put("value", "True");
|
||||||
|
properties.add(pro1);
|
||||||
|
JSONObject pro2 = new JSONObject();
|
||||||
|
pro2.put("key", "PauseOnStation");
|
||||||
|
pro2.put("value", "True");
|
||||||
|
properties.add(pro2);
|
||||||
|
destinationOrder.put("properties", properties);
|
||||||
|
//进入等待 离开不等待
|
||||||
|
} else if ("2".equals(pro)) {
|
||||||
|
JSONArray properties = new JSONArray();
|
||||||
|
JSONObject pro1 = new JSONObject();
|
||||||
|
pro1.put("key", "EntryRequired");
|
||||||
|
pro1.put("value", "True");
|
||||||
|
properties.add(pro1);
|
||||||
|
JSONObject pro2 = new JSONObject();
|
||||||
|
pro2.put("key", "PauseOnStation");
|
||||||
|
pro2.put("value", "False");
|
||||||
|
properties.add(pro2);
|
||||||
|
destinationOrder.put("properties", properties);
|
||||||
|
//进入不等待 离开等待
|
||||||
|
} else if ("3".equals(pro)) {
|
||||||
|
JSONArray properties = new JSONArray();
|
||||||
|
JSONObject pro1 = new JSONObject();
|
||||||
|
pro1.put("key", "EntryRequired");
|
||||||
|
pro1.put("value", "False");
|
||||||
|
properties.add(pro1);
|
||||||
|
JSONObject pro2 = new JSONObject();
|
||||||
|
pro2.put("key", "PauseOnStation");
|
||||||
|
pro2.put("value", "True");
|
||||||
|
properties.add(pro2);
|
||||||
|
destinationOrder.put("properties", properties);
|
||||||
|
//不等待
|
||||||
|
} else {
|
||||||
|
JSONArray properties = new JSONArray();
|
||||||
|
JSONObject pro1 = new JSONObject();
|
||||||
|
pro1.put("key", "EntryRequired");
|
||||||
|
pro1.put("value", "False");
|
||||||
|
properties.add(pro1);
|
||||||
|
JSONObject pro2 = new JSONObject();
|
||||||
|
pro2.put("key", "PauseOnStation");
|
||||||
|
pro2.put("value", "False");
|
||||||
|
properties.add(pro2);
|
||||||
|
destinationOrder.put("properties", properties);
|
||||||
|
}
|
||||||
|
|
||||||
|
} else if (propertiesType.equals("2")) {//Spin转动
|
||||||
|
JSONArray properties = new JSONArray();
|
||||||
|
JSONObject pro1 = new JSONObject();
|
||||||
|
pro1.put("key", "global_spin_angle");//坐标系类型,global_spin_angle为全局坐标系
|
||||||
|
pro1.put("value", pro);//弧度值,如3.14
|
||||||
|
properties.add(pro1);
|
||||||
|
JSONObject pro2 = new JSONObject();
|
||||||
|
pro2.put("key", "spin_direction");//固定值
|
||||||
|
pro2.put("value", "0");//弧度值,如0
|
||||||
|
properties.add(pro2);
|
||||||
|
destinationOrder.put("properties", properties);
|
||||||
|
} else if (propertiesType.equals("3")) {//JackUnload,Jackload不操作
|
||||||
|
JSONArray properties = new JSONArray();
|
||||||
|
JSONObject pro1 = new JSONObject();
|
||||||
|
pro1.put("key", "recognize");//固定值
|
||||||
|
pro1.put("value", "false");//固定值
|
||||||
|
properties.add(pro1);
|
||||||
|
destinationOrder.put("properties", properties);
|
||||||
|
} else if (propertiesType.equals("4")) {
|
||||||
|
JSONArray properties = new JSONArray();
|
||||||
|
JSONObject pro1 = new JSONObject();
|
||||||
|
pro1.put("key", "robot_spin_angle");//坐标系类型,robot_spin_angle为机器人坐标系
|
||||||
|
pro1.put("value", pro);//弧度值,如3.14
|
||||||
|
properties.add(pro1);
|
||||||
|
JSONObject pro2 = new JSONObject();
|
||||||
|
pro2.put("key", "spin_direction");//固定值
|
||||||
|
pro2.put("value", "0");//弧度值,如0
|
||||||
|
properties.add(pro2);
|
||||||
|
destinationOrder.put("properties", properties);
|
||||||
|
} else if (propertiesType.equals("5")) {//在该点进行等待
|
||||||
|
JSONArray properties = new JSONArray();
|
||||||
|
JSONObject pro1 = new JSONObject();
|
||||||
|
pro1.put("key", "Wait");
|
||||||
|
pro1.put("value", "True");
|
||||||
|
properties.add(pro1);
|
||||||
|
destinationOrder.put("properties", properties);
|
||||||
|
}
|
||||||
|
return destinationOrder;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得之后num个天的时间
|
||||||
|
*
|
||||||
|
* @param num
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static String getNextDay(int num) {
|
||||||
|
Calendar calendar = Calendar.getInstance();
|
||||||
|
calendar.add(Calendar.DAY_OF_MONTH, num);
|
||||||
|
Date date = calendar.getTime();
|
||||||
|
TimeZone tz = TimeZone.getTimeZone("Asia/Shanghai");
|
||||||
|
DateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");
|
||||||
|
df.setTimeZone(tz);
|
||||||
|
String nowAsISO = df.format(date);
|
||||||
|
return nowAsISO;
|
||||||
|
}
|
||||||
|
}
|
||||||
1
wms/hd/.gitignore
vendored
1
wms/hd/.gitignore
vendored
@@ -40,3 +40,4 @@ spring-*/src/main/java/META-INF/MANIFEST.MF
|
|||||||
test-output
|
test-output
|
||||||
atlassian-ide-plugin.xml
|
atlassian-ide-plugin.xml
|
||||||
.gradletasknamecache
|
.gradletasknamecache
|
||||||
|
/logPath_IS_UNDEFINED/
|
||||||
|
|||||||
@@ -16,21 +16,9 @@
|
|||||||
<jjwt.version>0.11.1</jjwt.version>
|
<jjwt.version>0.11.1</jjwt.version>
|
||||||
<!-- oshi监控需要指定jna版本, 问题详见 https://github.com/oshi/oshi/issues/1040 -->
|
<!-- oshi监控需要指定jna版本, 问题详见 https://github.com/oshi/oshi/issues/1040 -->
|
||||||
<jna.version>5.5.0</jna.version>
|
<jna.version>5.5.0</jna.version>
|
||||||
<elasticsearch.version>7.6.1</elasticsearch.version>
|
|
||||||
</properties>
|
</properties>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>net.logstash.logback</groupId>
|
|
||||||
<artifactId>logstash-logback-encoder</artifactId>
|
|
||||||
<version>6.6</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.mongodb</groupId>
|
|
||||||
<artifactId>mongo-java-driver</artifactId>
|
|
||||||
<version>3.4.2</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.reflections</groupId>
|
<groupId>org.reflections</groupId>
|
||||||
<artifactId>reflections</artifactId>
|
<artifactId>reflections</artifactId>
|
||||||
@@ -43,23 +31,6 @@
|
|||||||
</exclusions>
|
</exclusions>
|
||||||
|
|
||||||
</dependency>
|
</dependency>
|
||||||
<!-- JetCache Redis 依赖-->
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.alicp.jetcache</groupId>
|
|
||||||
<artifactId>jetcache-starter-redis</artifactId>
|
|
||||||
<version>2.5.14</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.alicp.jetcache</groupId>
|
|
||||||
<artifactId>jetcache-starter-redis-lettuce</artifactId>
|
|
||||||
<version>2.5.14</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.boot</groupId>
|
|
||||||
<artifactId>spring-boot-starter-data-mongodb</artifactId>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<!-- ip地址解析-->
|
<!-- ip地址解析-->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>net.dreamlu</groupId>
|
<groupId>net.dreamlu</groupId>
|
||||||
@@ -73,28 +44,6 @@
|
|||||||
<version>4.8.1</version>
|
<version>4.8.1</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!--lucene相关-->
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.apache.lucene</groupId>
|
|
||||||
<artifactId>lucene-core</artifactId>
|
|
||||||
<version>8.4.0</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.apache.lucene</groupId>
|
|
||||||
<artifactId>lucene-analyzers-common</artifactId>
|
|
||||||
<version>8.4.0</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.apache.lucene</groupId>
|
|
||||||
<artifactId>lucene-analyzers-smartcn</artifactId>
|
|
||||||
<version>8.4.0</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.apache.lucene</groupId>
|
|
||||||
<artifactId>lucene-queryparser</artifactId>
|
|
||||||
<version>8.4.0</version>
|
|
||||||
</dependency>
|
|
||||||
<!--导入excel相关-->
|
<!--导入excel相关-->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.alibaba</groupId>
|
<groupId>com.alibaba</groupId>
|
||||||
|
|||||||
@@ -1,8 +1,5 @@
|
|||||||
package org.nl;
|
package org.nl;
|
||||||
|
|
||||||
import com.alicp.jetcache.Cache;
|
|
||||||
import com.alicp.jetcache.anno.config.EnableCreateCacheAnnotation;
|
|
||||||
import com.alicp.jetcache.anno.config.EnableMethodCache;
|
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import org.nl.annotation.rest.AnonymousGetMapping;
|
import org.nl.annotation.rest.AnonymousGetMapping;
|
||||||
import org.nl.utils.SpringContextHolder;
|
import org.nl.utils.SpringContextHolder;
|
||||||
@@ -34,13 +31,7 @@ import org.springframework.web.bind.annotation.RestController;
|
|||||||
@ServletComponentScan
|
@ServletComponentScan
|
||||||
@EnableTransactionManagement
|
@EnableTransactionManagement
|
||||||
@EnableJpaAuditing(auditorAwareRef = "auditorAware")
|
@EnableJpaAuditing(auditorAwareRef = "auditorAware")
|
||||||
|
|
||||||
@EnableMethodCache(basePackages = "org.nl")
|
|
||||||
@EnableCreateCacheAnnotation
|
|
||||||
public class AppRun implements CommandLineRunner {
|
public class AppRun implements CommandLineRunner {
|
||||||
|
|
||||||
private Cache<String, Object> userCache;
|
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
|
|
||||||
SpringApplication.run(AppRun.class, args);
|
SpringApplication.run(AppRun.class, args);
|
||||||
|
|||||||
@@ -1,19 +0,0 @@
|
|||||||
package org.nl.modules.cache;
|
|
||||||
|
|
||||||
import com.alicp.jetcache.Cache;
|
|
||||||
import com.alicp.jetcache.anno.CacheType;
|
|
||||||
import com.alicp.jetcache.anno.CreateCache;
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
@Data
|
|
||||||
public class BothCacheManager extends NlCacheManager {
|
|
||||||
/**
|
|
||||||
* 使用 @CreateCache 注解创建Cache实例;
|
|
||||||
* 未定义默认值的参数,将使用yml中指定的全局配置;
|
|
||||||
* 缓存在 Local,也可以配置成 both 开启两级缓存
|
|
||||||
*/
|
|
||||||
@CreateCache(expire = 5 * 60, cacheType = CacheType.BOTH, localLimit = 10)
|
|
||||||
private Cache<Object, Object> defaultCache;
|
|
||||||
@CreateCache(expire = 5 * 60, cacheType = CacheType.BOTH, localLimit = 10)
|
|
||||||
private Cache<Object, Object> systemCache;
|
|
||||||
}
|
|
||||||
@@ -1,23 +0,0 @@
|
|||||||
package org.nl.modules.cache;
|
|
||||||
|
|
||||||
import com.alicp.jetcache.anno.CacheConsts;
|
|
||||||
import com.alicp.jetcache.anno.CacheType;
|
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
|
||||||
import org.springframework.context.annotation.Bean;
|
|
||||||
import org.springframework.context.annotation.Configuration;
|
|
||||||
|
|
||||||
@Configuration
|
|
||||||
public class CacheConfig {
|
|
||||||
@Value("${jetcache.defaultCacheType}")
|
|
||||||
private String cacheType;
|
|
||||||
|
|
||||||
@Bean(name = "sysCacheManager")
|
|
||||||
public NlCacheManager sysCacheManager() {
|
|
||||||
CacheConsts.isUndefined(2);
|
|
||||||
if (CacheType.BOTH.name().equals(cacheType)) return new BothCacheManager();
|
|
||||||
if (CacheType.LOCAL.name().equals(cacheType)) return new LocalCacheManager();
|
|
||||||
if (CacheType.REMOTE.name().equals(cacheType)) return new RemoteCacheManager();
|
|
||||||
return new LocalCacheManager();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
package org.nl.modules.cache;
|
|
||||||
|
|
||||||
import com.alicp.jetcache.Cache;
|
|
||||||
import com.alicp.jetcache.anno.CacheType;
|
|
||||||
import com.alicp.jetcache.anno.CreateCache;
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
@Data
|
|
||||||
public class LocalCacheManager extends NlCacheManager {
|
|
||||||
/**
|
|
||||||
* 使用 @CreateCache 注解创建Cache实例;
|
|
||||||
* 未定义默认值的参数,将使用yml中指定的全局配置;
|
|
||||||
* 缓存在 Local,也可以配置成 both 开启两级缓存
|
|
||||||
*/
|
|
||||||
@CreateCache(expire = 5 * 60, cacheType = CacheType.LOCAL, localLimit = 10)
|
|
||||||
private Cache<Object, Object> defaultCache;
|
|
||||||
@CreateCache(expire = 5 * 60, cacheType = CacheType.LOCAL, localLimit = 10)
|
|
||||||
private Cache<Object, Object> systemCache;
|
|
||||||
}
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
package org.nl.modules.cache;
|
|
||||||
|
|
||||||
import com.alicp.jetcache.Cache;
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
@Data
|
|
||||||
public abstract class NlCacheManager {
|
|
||||||
private Cache<Object, Object> defaultCache;
|
|
||||||
private Cache<Object, Object> systemCache;
|
|
||||||
public void test(){
|
|
||||||
System.out.println(this.getClass().getName());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,24 +0,0 @@
|
|||||||
package org.nl.modules.cache;
|
|
||||||
|
|
||||||
import com.alicp.jetcache.Cache;
|
|
||||||
import com.alicp.jetcache.anno.CacheType;
|
|
||||||
import com.alicp.jetcache.anno.CreateCache;
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
@Data
|
|
||||||
public class RemoteCacheManager extends NlCacheManager {
|
|
||||||
/**
|
|
||||||
* 使用 @CreateCache 注解创建Cache实例;
|
|
||||||
* 未定义默认值的参数,将使用yml中指定的全局配置;
|
|
||||||
* 缓存在 Local,也可以配置成 both 开启两级缓存
|
|
||||||
*/
|
|
||||||
@CreateCache(expire = 5 * 60, cacheType = CacheType.REMOTE, localLimit = 10)
|
|
||||||
private Cache<Object, Object> defaultCache;
|
|
||||||
@CreateCache(expire = 5 * 60, cacheType = CacheType.REMOTE, localLimit = 10)
|
|
||||||
private Cache<Object, Object> systemCache;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void test() {
|
|
||||||
System.out.println(this.getClass().getName());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,43 +0,0 @@
|
|||||||
package org.nl.modules.log;
|
|
||||||
|
|
||||||
import ch.qos.logback.classic.spi.ILoggingEvent;
|
|
||||||
import cn.hutool.core.date.DateUtil;
|
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
|
||||||
import org.bson.Document;
|
|
||||||
import org.slf4j.Marker;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* https://www.cnblogs.com/lzghyh/p/14913230.html
|
|
||||||
* https://juejin.cn/post/6844903488896385037
|
|
||||||
* https://cloud.tencent.com/developer/article/1384035
|
|
||||||
* https://www.freesion.com/article/229560377/
|
|
||||||
*/
|
|
||||||
public class MongoDBAppender extends MongoDBAppenderBase<ILoggingEvent> {
|
|
||||||
public MongoDBAppender() {
|
|
||||||
super("loggingEvents");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected Document toMongoDocument(ILoggingEvent eventObject) {
|
|
||||||
final Document doc = new Document();
|
|
||||||
doc.append("date", DateUtil.now());
|
|
||||||
doc.append("source", source);
|
|
||||||
|
|
||||||
Marker marker = eventObject.getMarker();
|
|
||||||
if (ObjectUtil.isEmpty(marker)) {
|
|
||||||
doc.append("marker", "root");
|
|
||||||
} else {
|
|
||||||
doc.append("marker", marker.getName());
|
|
||||||
}
|
|
||||||
|
|
||||||
doc.append("level", eventObject.getLevel().toString());
|
|
||||||
doc.append("logger", eventObject.getLoggerName());
|
|
||||||
doc.append("thread", eventObject.getThreadName());
|
|
||||||
doc.append("message", eventObject.getFormattedMessage());
|
|
||||||
if (eventObject.getMDCPropertyMap() != null && !eventObject.getMDCPropertyMap().isEmpty())
|
|
||||||
doc.append("mdc", eventObject.getMDCPropertyMap());
|
|
||||||
// ...
|
|
||||||
return doc;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,101 +0,0 @@
|
|||||||
package org.nl.modules.log;
|
|
||||||
|
|
||||||
import ch.qos.logback.core.UnsynchronizedAppenderBase;
|
|
||||||
import com.mongodb.MongoClient;
|
|
||||||
import com.mongodb.MongoClientOptions;
|
|
||||||
import com.mongodb.MongoCredential;
|
|
||||||
import com.mongodb.ServerAddress;
|
|
||||||
import com.mongodb.client.MongoCollection;
|
|
||||||
import com.mongodb.client.MongoDatabase;
|
|
||||||
import lombok.Data;
|
|
||||||
import org.bson.Document;
|
|
||||||
|
|
||||||
import java.net.UnknownHostException;
|
|
||||||
import java.util.Collections;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* MongoDBAppender适配类
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
public abstract class MongoDBAppenderBase<E> extends UnsynchronizedAppenderBase<E> {
|
|
||||||
private MongoClient mongo;
|
|
||||||
private MongoCollection<Document> eventsCollection;
|
|
||||||
|
|
||||||
private String host = "10.10.8.10"; // 地址
|
|
||||||
private int port = 27017; // 端口号
|
|
||||||
private String dbName = "db"; // 库名
|
|
||||||
private String collectionName; // 集合名
|
|
||||||
private String username; // 用户名
|
|
||||||
private String password; // 密码
|
|
||||||
protected String source;
|
|
||||||
|
|
||||||
private int connectionsPerHost = 10; // 空闲线程池中最大链接数
|
|
||||||
private int threadsAllowedToBlockForConnectionMultiplier = 5; //一个线程等待链接可用的最大等待毫秒数
|
|
||||||
private int maxWaitTime = 1000 * 60 * 2; // 最长等待时间
|
|
||||||
private int connectTimeout;
|
|
||||||
private int socketTimeout;
|
|
||||||
private int wtimeout;
|
|
||||||
|
|
||||||
MongoDBAppenderBase(String collectionName) {
|
|
||||||
this.collectionName = collectionName;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void start() {
|
|
||||||
/*try {
|
|
||||||
connectToMongoDB();
|
|
||||||
super.start();
|
|
||||||
} catch (UnknownHostException e) {
|
|
||||||
addError( "Error connecting to MongoDB server: " + host + ":" + port,
|
|
||||||
e);
|
|
||||||
}*/
|
|
||||||
}
|
|
||||||
|
|
||||||
private void connectToMongoDB() throws UnknownHostException {
|
|
||||||
// 用户名 数据库 密码
|
|
||||||
if (username != null && password != null){
|
|
||||||
|
|
||||||
MongoCredential credential = MongoCredential.createCredential(
|
|
||||||
username, dbName, password.toCharArray());
|
|
||||||
|
|
||||||
ServerAddress serverAddress = new ServerAddress(host, port);
|
|
||||||
mongo = new MongoClient(serverAddress, Collections.singletonList(credential),buildOptions());
|
|
||||||
System.out.println();
|
|
||||||
|
|
||||||
/* MongoCredential credential = MongoCredential.createCredential(username, dbName, password.toCharArray());
|
|
||||||
mongo = new MongoClient(new ServerAddress(host, port), Collections.singletonList(credential), buildOptions());*/
|
|
||||||
}else{
|
|
||||||
mongo = new MongoClient(new ServerAddress(host, port), buildOptions());
|
|
||||||
}
|
|
||||||
|
|
||||||
MongoDatabase db = mongo.getDatabase(dbName);
|
|
||||||
eventsCollection = db.getCollection(collectionName);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private MongoClientOptions buildOptions() {
|
|
||||||
final MongoClientOptions.Builder options = new MongoClientOptions.Builder();
|
|
||||||
options.connectionsPerHost(connectionsPerHost) ;
|
|
||||||
options.threadsAllowedToBlockForConnectionMultiplier(threadsAllowedToBlockForConnectionMultiplier) ;
|
|
||||||
options.maxWaitTime(maxWaitTime) ;
|
|
||||||
options.connectTimeout(connectTimeout) ;
|
|
||||||
options.socketTimeout(socketTimeout) ;
|
|
||||||
options.maxWaitTime(wtimeout) ;
|
|
||||||
return options.build();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected abstract Document toMongoDocument(E event);
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void append(E eventObject) {
|
|
||||||
eventsCollection.insertOne(toMongoDocument(eventObject));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void stop() {
|
|
||||||
if (mongo != null)
|
|
||||||
mongo.close();
|
|
||||||
super.stop();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,42 +0,0 @@
|
|||||||
|
|
||||||
package org.nl.modules.log.rest;
|
|
||||||
|
|
||||||
|
|
||||||
import io.swagger.annotations.Api;
|
|
||||||
import io.swagger.annotations.ApiOperation;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
import org.nl.annotation.Log;
|
|
||||||
import org.nl.modules.log.service.RootLogService;
|
|
||||||
import org.springframework.data.domain.Pageable;
|
|
||||||
import org.springframework.http.HttpStatus;
|
|
||||||
import org.springframework.http.ResponseEntity;
|
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author ldjun
|
|
||||||
* @date 2021-08-19
|
|
||||||
**/
|
|
||||||
@RestController
|
|
||||||
@RequiredArgsConstructor
|
|
||||||
@Api(tags = "系统日志")
|
|
||||||
@RequestMapping("/api/rootLog")
|
|
||||||
@Slf4j
|
|
||||||
public class RootLogController {
|
|
||||||
|
|
||||||
private final RootLogService rootLogService;
|
|
||||||
|
|
||||||
@GetMapping
|
|
||||||
@Log("查询系统日志")
|
|
||||||
@ApiOperation("查询系统日志")
|
|
||||||
//@PreAuthorize("@el.check('point:list')")
|
|
||||||
public ResponseEntity<Object> query(@RequestParam Map whereJson, Pageable page) {
|
|
||||||
return new ResponseEntity<>(rootLogService.queryAll(whereJson, page), HttpStatus.OK);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
package org.nl.modules.log.service;
|
|
||||||
|
|
||||||
import org.springframework.data.domain.Pageable;
|
|
||||||
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 系统日志查询
|
|
||||||
*/
|
|
||||||
public interface RootLogService {
|
|
||||||
/**
|
|
||||||
* 查询数据分页
|
|
||||||
* @param whereJson 条件
|
|
||||||
* @param page 分页参数
|
|
||||||
* @return Map<String,Object>
|
|
||||||
*/
|
|
||||||
Map<String,Object> queryAll(Map whereJson, Pageable page);
|
|
||||||
}
|
|
||||||
@@ -1,46 +0,0 @@
|
|||||||
package org.nl.modules.log.service.impl;
|
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSONObject;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
import org.nl.modules.log.service.RootLogService;
|
|
||||||
import org.springframework.data.domain.Pageable;
|
|
||||||
import org.springframework.data.mongodb.core.MongoTemplate;
|
|
||||||
import org.springframework.data.mongodb.core.query.Criteria;
|
|
||||||
import org.springframework.data.mongodb.core.query.Query;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author ldjun
|
|
||||||
* @description 服务实现
|
|
||||||
* @date 2021-08-19
|
|
||||||
**/
|
|
||||||
@Service
|
|
||||||
@RequiredArgsConstructor
|
|
||||||
@Slf4j
|
|
||||||
public class RootLogServiceImpl implements RootLogService {
|
|
||||||
|
|
||||||
private final MongoTemplate mongoTemplate;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Map<String, Object> queryAll(Map whereJson, Pageable page) {
|
|
||||||
//查询条件
|
|
||||||
Query query = Query.query(Criteria.where("level").is("INFO"));
|
|
||||||
|
|
||||||
//根据条件得到的总条数
|
|
||||||
long totalSize = mongoTemplate.count(query, Map.class, "log_root");
|
|
||||||
|
|
||||||
//处理分页
|
|
||||||
query.skip(page.getPageNumber()).limit(page.getPageSize());
|
|
||||||
List<Map> list = mongoTemplate.find(query, Map.class, "log_root");
|
|
||||||
|
|
||||||
//封装前端分页查询结果
|
|
||||||
JSONObject result = new JSONObject();
|
|
||||||
result.put("content", list);
|
|
||||||
result.put("totalElements", totalSize);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -17,9 +17,6 @@ package org.nl.modules.security.rest;
|
|||||||
|
|
||||||
import cn.hutool.core.util.IdUtil;
|
import cn.hutool.core.util.IdUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.alicp.jetcache.Cache;
|
|
||||||
import com.alicp.jetcache.anno.CacheType;
|
|
||||||
import com.alicp.jetcache.anno.CreateCache;
|
|
||||||
import com.wf.captcha.base.Captcha;
|
import com.wf.captcha.base.Captcha;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
@@ -78,20 +75,15 @@ public class AuthorizationController {
|
|||||||
private LoginProperties loginProperties;
|
private LoginProperties loginProperties;
|
||||||
|
|
||||||
|
|
||||||
@CreateCache(cacheType = CacheType.LOCAL)
|
|
||||||
private Cache<String, Object> authCache;
|
|
||||||
|
|
||||||
@ApiOperation("登录授权")
|
@ApiOperation("登录授权")
|
||||||
@AnonymousPostMapping(value = "/login")
|
@AnonymousPostMapping(value = "/login")
|
||||||
public ResponseEntity<Object> login(@Validated @RequestBody AuthUserDto authUser, HttpServletRequest request) throws Exception {
|
public ResponseEntity<Object> login(@Validated @RequestBody AuthUserDto authUser, HttpServletRequest request) throws Exception {
|
||||||
// 密码解密
|
// 密码解密
|
||||||
String password = RsaUtils.decryptByPrivateKey(RsaProperties.privateKey, authUser.getPassword());
|
String password = RsaUtils.decryptByPrivateKey(RsaProperties.privateKey, authUser.getPassword());
|
||||||
// 查询验证码
|
// 查询验证码
|
||||||
// String code = (String) redisUtils.get(authUser.getUuid());
|
String code = (String) redisUtils.get(authUser.getUuid());
|
||||||
String code = (String) authCache.get(authUser.getUuid());
|
|
||||||
// 清除验证码
|
// 清除验证码
|
||||||
// redisUtils.del(authUser.getUuid());
|
redisUtils.del(authUser.getUuid());
|
||||||
authCache.remove(authUser.getUuid());
|
|
||||||
if (StrUtil.isEmpty(code)) {
|
if (StrUtil.isEmpty(code)) {
|
||||||
throw new BadRequestException("验证码不存在或已过期");
|
throw new BadRequestException("验证码不存在或已过期");
|
||||||
}
|
}
|
||||||
@@ -137,8 +129,7 @@ public class AuthorizationController {
|
|||||||
captchaValue = captchaValue.split("\\.")[0];
|
captchaValue = captchaValue.split("\\.")[0];
|
||||||
}
|
}
|
||||||
// 保存
|
// 保存
|
||||||
// redisUtils.set(uuid, captchaValue, loginProperties.getLoginCode().getExpiration(), TimeUnit.MINUTES);
|
redisUtils.set(uuid, captchaValue, loginProperties.getLoginCode().getExpiration(), TimeUnit.MINUTES);
|
||||||
authCache.put(uuid, captchaValue, loginProperties.getLoginCode().getExpiration(), TimeUnit.MINUTES);
|
|
||||||
// 验证码信息
|
// 验证码信息
|
||||||
Map<String, Object> imgResult = new HashMap<String, Object>(2) {{
|
Map<String, Object> imgResult = new HashMap<String, Object>(2) {{
|
||||||
put("img", captcha.toBase64());
|
put("img", captcha.toBase64());
|
||||||
|
|||||||
@@ -1,7 +0,0 @@
|
|||||||
package org.nl.wms.buss.service;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 窑业务,主要包含入窑和出窑业务
|
|
||||||
*/
|
|
||||||
public interface KilnBuss {
|
|
||||||
}
|
|
||||||
@@ -1,27 +0,0 @@
|
|||||||
package org.nl.wms.buss.service;
|
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSONObject;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 混碾工序业务,主要包含混砂下料和混砂补空盅功能
|
|
||||||
*/
|
|
||||||
public interface MixBuss {
|
|
||||||
/**
|
|
||||||
* 满料请求参数
|
|
||||||
*
|
|
||||||
* @param param
|
|
||||||
*/
|
|
||||||
void sendMaterial(JSONObject param);
|
|
||||||
|
|
||||||
void sendMaterialUpdateTaskStatus(JSONObject param);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 呼叫空盅业务
|
|
||||||
*
|
|
||||||
* @param param
|
|
||||||
*/
|
|
||||||
void callEmptyVehicle(JSONObject param);
|
|
||||||
|
|
||||||
|
|
||||||
void callEmptyVehicleUpdateTaskStatus(JSONObject param);
|
|
||||||
}
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
package org.nl.wms.buss.service;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 分拣业务,从钢托盘转换为木托的业务过程
|
|
||||||
*/
|
|
||||||
public interface SeparateBuss {
|
|
||||||
}
|
|
||||||
@@ -1,36 +0,0 @@
|
|||||||
package org.nl.wms.buss.service;
|
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSONObject;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public interface SuppressBuss {
|
|
||||||
/**
|
|
||||||
* 压制叫料,从困料货架出
|
|
||||||
*
|
|
||||||
* @param param
|
|
||||||
*/
|
|
||||||
void callMaterial(JSONObject param);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 机械手码盘完成,送半成品
|
|
||||||
*
|
|
||||||
* @param param
|
|
||||||
*/
|
|
||||||
void sendMaterial(JSONObject param);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 机械手码盘缺钢托盘的时候,呼叫钢托盘请求
|
|
||||||
*
|
|
||||||
* @param param
|
|
||||||
*/
|
|
||||||
void callEmptyVehicle(JSONObject param);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 上料位完成以后送空载具
|
|
||||||
*
|
|
||||||
* @param param
|
|
||||||
*/
|
|
||||||
void sendEmptyVehicle(JSONObject param);
|
|
||||||
}
|
|
||||||
@@ -1,38 +0,0 @@
|
|||||||
package org.nl.wms.buss.service.impl;
|
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSONObject;
|
|
||||||
import lombok.Data;
|
|
||||||
import org.nl.wms.buss.service.MixBuss;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 混碾工序业务,主要包含混砂下料和混砂补空盅功能
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
public class MixBussImpl implements MixBuss {
|
|
||||||
// 入库计量单位
|
|
||||||
private String in_qty_unit_id = "";
|
|
||||||
//入库重量单位
|
|
||||||
private String in_weight_unit_id = "";
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void sendMaterial(JSONObject param) {
|
|
||||||
//1 入库单 2生成任务 (任务完成)
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void sendMaterialUpdateTaskStatus(JSONObject param) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void callEmptyVehicle(JSONObject param) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void callEmptyVehicleUpdateTaskStatus(JSONObject param) {
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
package org.nl.wms.buss.service.impl;
|
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSONObject;
|
|
||||||
import org.nl.wms.buss.service.SuppressBuss;
|
|
||||||
|
|
||||||
public class SuppressBussImpl implements SuppressBuss {
|
|
||||||
@Override
|
|
||||||
public void callMaterial(JSONObject param) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void sendMaterial(JSONObject param) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void callEmptyVehicle(JSONObject param) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void sendEmptyVehicle(JSONObject param) {
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
数据采集
|
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
package org.nl.wms.collect.device;
|
|
||||||
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
@Data
|
|
||||||
public abstract class AbstractDevice {
|
|
||||||
//设备属性
|
|
||||||
private String device_id;
|
|
||||||
private String device_code;
|
|
||||||
private String device_name;
|
|
||||||
|
|
||||||
//工序属性
|
|
||||||
private String workprocedure_id;
|
|
||||||
private String workprocedure_code;
|
|
||||||
private String workprocedure_name;
|
|
||||||
|
|
||||||
|
|
||||||
public abstract void updateStatus(AbstractDevice device);
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,22 +0,0 @@
|
|||||||
package org.nl.wms.collect.device;
|
|
||||||
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 混料设备
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
public class HLDevice extends StatusAndTimeDevice {
|
|
||||||
//当前生产物料标识
|
|
||||||
private String currentMaterialId;
|
|
||||||
//当前生产数量
|
|
||||||
private String currentProduceQty;
|
|
||||||
//当前生产数量
|
|
||||||
private String currentProduceWeight;
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void updateStatus(AbstractDevice device) {
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
package org.nl.wms.collect.device;
|
|
||||||
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 码盘机器人设备
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
public class MPJQRDevice {
|
|
||||||
}
|
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
package org.nl.wms.collect.device;
|
|
||||||
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 更新设备状态和对应的状态时间
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
public abstract class StatusAndTimeDevice extends AbstractDevice {
|
|
||||||
//设备状态:生产,待机,故障,关机
|
|
||||||
private String status;
|
|
||||||
//待机时间、生产时间、故障时间、关机时间
|
|
||||||
private String status_time;
|
|
||||||
//开机时间
|
|
||||||
private String open_time;
|
|
||||||
|
|
||||||
public void updateStatusAndTime() {
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
package org.nl.wms.collect.device;
|
|
||||||
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 压力设备
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
public class YLDevice {
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,21 +0,0 @@
|
|||||||
package org.nl.wms.collect.manage;
|
|
||||||
|
|
||||||
public class Context {
|
|
||||||
private Strategy strategy;
|
|
||||||
|
|
||||||
public Context(Strategy strategy){
|
|
||||||
this.strategy = strategy;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int executeStrategy(int num1, int num2){
|
|
||||||
return strategy.doOperation(num1, num2);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void main(String[] args) {
|
|
||||||
Context context = new Context(new OperationAdd());
|
|
||||||
System.out.println("10 + 5 = " + context.executeStrategy(10, 5));
|
|
||||||
|
|
||||||
context = new Context(new OperationSubtract());
|
|
||||||
System.out.println("10 - 5 = " + context.executeStrategy(10, 5));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
package org.nl.wms.collect.manage;
|
|
||||||
|
|
||||||
public class OperationAdd implements Strategy{
|
|
||||||
@Override
|
|
||||||
public int doOperation(int num1, int num2) {
|
|
||||||
return num1 + num2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
package org.nl.wms.collect.manage;
|
|
||||||
|
|
||||||
public class OperationSubtract implements Strategy{
|
|
||||||
@Override
|
|
||||||
public int doOperation(int num1, int num2) {
|
|
||||||
return num1 - num2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
package org.nl.wms.collect.manage;
|
|
||||||
|
|
||||||
public interface Strategy {
|
|
||||||
public int doOperation(int num1, int num2);
|
|
||||||
}
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
package org.nl.wms.collect.strategy;
|
|
||||||
|
|
||||||
public class BinaryObserver extends Observer{
|
|
||||||
|
|
||||||
public BinaryObserver(Subject subject){
|
|
||||||
this.subject = subject;
|
|
||||||
this.subject.attach(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void update() {
|
|
||||||
System.out.println( "Binary String: "
|
|
||||||
+ Integer.toBinaryString( subject.getState() ) );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
package org.nl.wms.collect.strategy;
|
|
||||||
|
|
||||||
public class HexaObserver extends Observer{
|
|
||||||
|
|
||||||
public HexaObserver(Subject subject){
|
|
||||||
this.subject = subject;
|
|
||||||
this.subject.attach(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void update() {
|
|
||||||
System.out.println( "Hex String: "
|
|
||||||
+ Integer.toHexString( subject.getState() ).toUpperCase() );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
package org.nl.wms.collect.strategy;
|
|
||||||
|
|
||||||
public abstract class Observer {
|
|
||||||
protected Subject subject;
|
|
||||||
public abstract void update();
|
|
||||||
}
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
package org.nl.wms.collect.strategy;
|
|
||||||
|
|
||||||
public class ObserverPatternDemo {
|
|
||||||
public static void main(String[] args) {
|
|
||||||
Subject subject = new Subject();
|
|
||||||
|
|
||||||
new HexaObserver(subject);
|
|
||||||
new OctalObserver(subject);
|
|
||||||
new BinaryObserver(subject);
|
|
||||||
|
|
||||||
System.out.println("First state change: 15");
|
|
||||||
subject.setState(15);
|
|
||||||
System.out.println("Second state change: 10");
|
|
||||||
subject.setState(10);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
package org.nl.wms.collect.strategy;
|
|
||||||
|
|
||||||
public class OctalObserver extends Observer{
|
|
||||||
|
|
||||||
public OctalObserver(Subject subject){
|
|
||||||
this.subject = subject;
|
|
||||||
this.subject.attach(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void update() {
|
|
||||||
System.out.println( "Octal String: "
|
|
||||||
+ Integer.toOctalString( subject.getState() ) );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,29 +0,0 @@
|
|||||||
package org.nl.wms.collect.strategy;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class Subject {
|
|
||||||
|
|
||||||
private List<Observer> observers
|
|
||||||
= new ArrayList<Observer>();
|
|
||||||
private int state;
|
|
||||||
|
|
||||||
public int getState() {
|
|
||||||
return state;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setState(int state) {
|
|
||||||
this.state = state;
|
|
||||||
notifyAllObservers();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void attach(Observer observer){
|
|
||||||
observers.add(observer);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void notifyAllObservers(){
|
|
||||||
for (Observer observer : observers) {
|
|
||||||
observer.update();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -8,7 +8,6 @@ import com.alibaba.fastjson.JSONArray;
|
|||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.checkerframework.checker.units.qual.A;
|
|
||||||
import org.nl.exception.BadRequestException;
|
import org.nl.exception.BadRequestException;
|
||||||
import org.nl.modules.system.util.CodeUtil;
|
import org.nl.modules.system.util.CodeUtil;
|
||||||
import org.nl.utils.SecurityUtils;
|
import org.nl.utils.SecurityUtils;
|
||||||
|
|||||||
@@ -2,19 +2,16 @@ server:
|
|||||||
port: 8010
|
port: 8010
|
||||||
#配置数据源
|
#配置数据源
|
||||||
spring:
|
spring:
|
||||||
profiles:
|
|
||||||
dev
|
|
||||||
datasource:
|
datasource:
|
||||||
druid:
|
druid:
|
||||||
db-type: com.alibaba.druid.pool.DruidDataSource
|
db-type: com.alibaba.druid.pool.DruidDataSource
|
||||||
driverClassName: net.sf.log4jdbc.sql.jdbcapi.DriverSpy
|
driverClassName: net.sf.log4jdbc.sql.jdbcapi.DriverSpy
|
||||||
#url: jdbc:log4jdbc:mysql://${DB_HOST:192.168.81.252}:${DB_PORT:3306}/${DB_NAME:jl_wms}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true
|
#url: jdbc:log4jdbc:mysql://${DB_HOST:192.168.81.252}:${DB_PORT:3306}/${DB_NAME:jl_wms}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true
|
||||||
#url: jdbc:log4jdbc:mysql://${DB_HOST:192.168.81.252}:${DB_PORT:3306}/${DB_NAME:jl_wms}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true
|
url: jdbc:log4jdbc:mysql://${DB_HOST:192.168.81.252}:${DB_PORT:3306}/${DB_NAME:jl_wms}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true
|
||||||
url: jdbc:log4jdbc:mysql://${DB_HOST:localhost}:${DB_PORT:3306}/${DB_NAME:jl_wms}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true&allowPublicKeyRetrieval=true
|
|
||||||
username: ${DB_USER:root}
|
username: ${DB_USER:root}
|
||||||
#password: ${DB_PWD:P@ssw0rd}
|
#password: ${DB_PWD:P@ssw0rd}
|
||||||
password: ${DB_PWD:root}
|
# password: ${DB_PWD:root}
|
||||||
#password: ${DB_PWD:Root.123456}
|
password: ${DB_PWD:Root.123456}
|
||||||
# 初始连接数
|
# 初始连接数
|
||||||
initial-size: 5
|
initial-size: 5
|
||||||
# 最小连接数
|
# 最小连接数
|
||||||
|
|||||||
@@ -2,8 +2,6 @@ server:
|
|||||||
port: 8010
|
port: 8010
|
||||||
#配置数据源
|
#配置数据源
|
||||||
spring:
|
spring:
|
||||||
profiles:
|
|
||||||
prod
|
|
||||||
datasource:
|
datasource:
|
||||||
druid:
|
druid:
|
||||||
db-type: com.alibaba.druid.pool.DruidDataSource
|
db-type: com.alibaba.druid.pool.DruidDataSource
|
||||||
|
|||||||
@@ -0,0 +1,167 @@
|
|||||||
|
server:
|
||||||
|
port: 8010
|
||||||
|
#配置数据源
|
||||||
|
spring:
|
||||||
|
datasource:
|
||||||
|
druid:
|
||||||
|
db-type: com.alibaba.druid.pool.DruidDataSource
|
||||||
|
driverClassName: net.sf.log4jdbc.sql.jdbcapi.DriverSpy
|
||||||
|
#url: jdbc:log4jdbc:mysql://${DB_HOST:192.168.81.252}:${DB_PORT:3306}/${DB_NAME:jl_wms}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true
|
||||||
|
#url: jdbc:log4jdbc:mysql://${DB_HOST:192.168.81.252}:${DB_PORT:3306}/${DB_NAME:jl_wms}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true
|
||||||
|
url: jdbc:log4jdbc:mysql://${DB_HOST:localhost}:${DB_PORT:3306}/${DB_NAME:jl_wms}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true&allowPublicKeyRetrieval=true
|
||||||
|
username: ${DB_USER:root}
|
||||||
|
#password: ${DB_PWD:P@ssw0rd}
|
||||||
|
password: ${DB_PWD:root}
|
||||||
|
#password: ${DB_PWD:Root.123456}
|
||||||
|
# 初始连接数
|
||||||
|
initial-size: 5
|
||||||
|
# 最小连接数
|
||||||
|
min-idle: 15
|
||||||
|
# 最大连接数
|
||||||
|
max-active: 30
|
||||||
|
# 是否自动回收超时连接
|
||||||
|
remove-abandoned: true
|
||||||
|
# 超时时间(以秒数为单位)
|
||||||
|
remove-abandoned-timeout: 180
|
||||||
|
# 获取连接超时时间
|
||||||
|
max-wait: 3000
|
||||||
|
# 连接有效性检测时间
|
||||||
|
time-between-eviction-runs-millis: 60000
|
||||||
|
# 连接在池中最小生存的时间
|
||||||
|
min-evictable-idle-time-millis: 300000
|
||||||
|
# 连接在池中最大生存的时间
|
||||||
|
max-evictable-idle-time-millis: 900000
|
||||||
|
# 指明连接是否被空闲连接回收器(如果有)进行检验.如果检测失败,则连接将被从池中去除
|
||||||
|
test-while-idle: true
|
||||||
|
# 指明是否在从池中取出连接前进行检验,如果检验失败, 则从池中去除连接并尝试取出另一个
|
||||||
|
test-on-borrow: true
|
||||||
|
# 是否在归还到池中前进行检验
|
||||||
|
test-on-return: false
|
||||||
|
# 检测连接是否有效
|
||||||
|
validation-query: select 1
|
||||||
|
# 配置监控统计
|
||||||
|
webStatFilter:
|
||||||
|
enabled: true
|
||||||
|
stat-view-servlet:
|
||||||
|
enabled: true
|
||||||
|
url-pattern: /druid/*
|
||||||
|
reset-enable: false
|
||||||
|
filter:
|
||||||
|
stat:
|
||||||
|
enabled: true
|
||||||
|
# 记录慢SQL
|
||||||
|
log-slow-sql: true
|
||||||
|
slow-sql-millis: 1000
|
||||||
|
merge-sql: true
|
||||||
|
wall:
|
||||||
|
config:
|
||||||
|
multi-statement-alagvslow: true
|
||||||
|
data:
|
||||||
|
mongodb:
|
||||||
|
host: 192.168.81.251
|
||||||
|
port: 27017
|
||||||
|
database: nlacs
|
||||||
|
redis:
|
||||||
|
#数据库索引
|
||||||
|
|
||||||
|
database: ${REDIS_DB:11}
|
||||||
|
#host: ${REDIS_HOST:47.111.78.178}
|
||||||
|
host: ${REDIS_HOST:localhost}
|
||||||
|
port: ${REDIS_PORT:6379}
|
||||||
|
password: ${REDIS_PWD:}
|
||||||
|
#连接超时时间
|
||||||
|
timeout: 5000
|
||||||
|
# 登录相关配置
|
||||||
|
login:
|
||||||
|
# 登录缓存
|
||||||
|
cache-enable: true
|
||||||
|
# 是否限制单用户登录
|
||||||
|
single-login: false
|
||||||
|
# 验证码
|
||||||
|
login-code:
|
||||||
|
# 验证码类型配置 查看 LoginProperties 类
|
||||||
|
code-type: arithmetic
|
||||||
|
# 登录图形验证码有效时间/分钟
|
||||||
|
expiration: 2
|
||||||
|
# 验证码高度
|
||||||
|
width: 111
|
||||||
|
# 验证码宽度
|
||||||
|
heigth: 36
|
||||||
|
# 内容长度
|
||||||
|
length: 2
|
||||||
|
# 字体名称,为空则使用默认字体
|
||||||
|
font-name:
|
||||||
|
# 字体大小
|
||||||
|
font-size: 25
|
||||||
|
|
||||||
|
#jwt
|
||||||
|
jwt:
|
||||||
|
header: Authorization
|
||||||
|
# 令牌前缀
|
||||||
|
token-start-with: Bearer
|
||||||
|
# 必须使用最少88位的Base64对该令牌进行编码
|
||||||
|
base64-secret: ZmQ0ZGI5NjQ0MDQwY2I4MjMxY2Y3ZmI3MjdhN2ZmMjNhODViOTg1ZGE0NTBjMGM4NDA5NzYxMjdjOWMwYWRmZTBlZjlhNGY3ZTg4Y2U3YTE1ODVkZDU5Y2Y3OGYwZWE1NzUzNWQ2YjFjZDc0NGMxZWU2MmQ3MjY1NzJmNTE0MzI=
|
||||||
|
# 令牌过期时间 此处单位/毫秒 ,默认4小时,可在此网站生成 https://www.convertworld.com/zh-hans/time/milliseconds.html
|
||||||
|
token-validity-in-seconds: 14400000
|
||||||
|
# 在线用户key
|
||||||
|
online-key: online-token-
|
||||||
|
# 验证码
|
||||||
|
code-key: code-key-
|
||||||
|
# token 续期检查时间范围(默认30分钟,单位毫秒),在token即将过期的一段时间内用户操作了,则给用户的token续期
|
||||||
|
detect: 1800000
|
||||||
|
# 续期时间范围,默认1小时,单位毫秒
|
||||||
|
renew: 3600000
|
||||||
|
|
||||||
|
#是否允许生成代码,生产环境设置为false
|
||||||
|
generator:
|
||||||
|
enabled: true
|
||||||
|
|
||||||
|
#是否开启 swagger-ui
|
||||||
|
swagger:
|
||||||
|
enabled: true
|
||||||
|
|
||||||
|
# IP 本地解析
|
||||||
|
ip:
|
||||||
|
local-parsing: true
|
||||||
|
|
||||||
|
# 文件存储路径
|
||||||
|
file:
|
||||||
|
mac:
|
||||||
|
path: ~/file/
|
||||||
|
avatar: ~/avatar/
|
||||||
|
linux:
|
||||||
|
path: /home/eladmin/file/
|
||||||
|
avatar: /home/eladmin/avatar/
|
||||||
|
windows:
|
||||||
|
path: C:\eladmin\file\
|
||||||
|
avatar: C:\eladmin\avatar\
|
||||||
|
# 文件大小 /M
|
||||||
|
maxSize: 100
|
||||||
|
avatarMaxSize: 5
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
jetcache:
|
||||||
|
defaultCacheType: LOCAL
|
||||||
|
statIntervalMinutes: 15
|
||||||
|
areaInCacheName: false
|
||||||
|
hiddenPackages: com.yb
|
||||||
|
local:
|
||||||
|
default:
|
||||||
|
type: caffeine
|
||||||
|
limit: 100
|
||||||
|
keyConvertor: fastjson
|
||||||
|
expireAfterWriteInMillis: 60000
|
||||||
|
remote:
|
||||||
|
default:
|
||||||
|
type: redis.lettuce
|
||||||
|
keyConvertor: fastjson
|
||||||
|
valueEncoder: kryo
|
||||||
|
valueDecoder: kryo
|
||||||
|
poolConfig:
|
||||||
|
minIdle: 5
|
||||||
|
maxIdle: 200
|
||||||
|
maxTotal: 1000
|
||||||
|
uri:
|
||||||
|
- redis://localhost:6379
|
||||||
|
|
||||||
@@ -16,7 +16,7 @@ https://juejin.cn/post/6844903775631572999
|
|||||||
<springProperty scope="context" name="logPath" source="logging.file.path" defaultValue="logs"/>
|
<springProperty scope="context" name="logPath" source="logging.file.path" defaultValue="logs"/>
|
||||||
<property name="LOG_HOME" value="${logPath}"/>
|
<property name="LOG_HOME" value="${logPath}"/>
|
||||||
<!--引入默认的一些设置-->
|
<!--引入默认的一些设置-->
|
||||||
<!-- <include resource="log/AutoCreateInst.xml"/>-->
|
<!-- <include resource="log/AutoCreateInst.xml"/>-->
|
||||||
<!--引入默认的一些设置-->
|
<!--引入默认的一些设置-->
|
||||||
<include resource="WmsToJn.xml"/>
|
<include resource="WmsToJn.xml"/>
|
||||||
<include resource="AutoWmsToJn.xml"/>
|
<include resource="AutoWmsToJn.xml"/>
|
||||||
@@ -27,43 +27,8 @@ https://juejin.cn/post/6844903775631572999
|
|||||||
<charset>${log.charset}</charset>
|
<charset>${log.charset}</charset>
|
||||||
</encoder>
|
</encoder>
|
||||||
|
|
||||||
<!-- 转为JSON https://www.zoleet.com/details/328.html-->
|
|
||||||
<!-- <encoder class="net.logstash.logback.encoder.LoggingEventCompositeJsonEncoder">
|
|
||||||
<providers>
|
|
||||||
<pattern>
|
|
||||||
<pattern>
|
|
||||||
{
|
|
||||||
"appName": "logistics-core",
|
|
||||||
"time": "%date{yyyy-MM-dd HH:mm:ss.SSS}",
|
|
||||||
"level": "%level",
|
|
||||||
"pid": "${PID:-}",
|
|
||||||
"thread": "%thread",
|
|
||||||
"class": "%logger",
|
|
||||||
"method": "%method",
|
|
||||||
"line": "%line",
|
|
||||||
"message": "%message",
|
|
||||||
"statck_trace": "%xEx"
|
|
||||||
}
|
|
||||||
</pattern>
|
|
||||||
</pattern>
|
|
||||||
</providers>
|
|
||||||
</encoder>-->
|
|
||||||
</appender>
|
</appender>
|
||||||
|
|
||||||
<appender name="MONGO" class="org.nl.modules.log.MongoDBAppender">
|
|
||||||
<host>47.111.78.178</host>
|
|
||||||
<port>27017</port>
|
|
||||||
<!-- <username>admin</username>
|
|
||||||
<password>123456</password>-->
|
|
||||||
<dbName>nlacs</dbName>
|
|
||||||
<collectionName>log_root</collectionName>
|
|
||||||
<source>${CONTEXT_NAME}</source>
|
|
||||||
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
|
|
||||||
<level>info</level>
|
|
||||||
</filter>
|
|
||||||
</appender>
|
|
||||||
|
|
||||||
|
|
||||||
<!--定义日志文件的存储地址 勿在 LogBack 的配置中使用相对路径-->
|
<!--定义日志文件的存储地址 勿在 LogBack 的配置中使用相对路径-->
|
||||||
<property name="LOG_HOME" value="${logPath}"/>
|
<property name="LOG_HOME" value="${logPath}"/>
|
||||||
<!-- 按照每天生成日志文件 -->
|
<!-- 按照每天生成日志文件 -->
|
||||||
@@ -92,34 +57,43 @@ https://juejin.cn/post/6844903775631572999
|
|||||||
</appender>
|
</appender>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<!--开发环境:打印控制台-->
|
<!--开发环境:打印控制台-->
|
||||||
<springProfile name="dev">
|
<springProfile name="dev">
|
||||||
<root level="debugger">
|
<root level="debug">
|
||||||
<appender-ref ref="CONSOLE"/>
|
<appender-ref ref="asyncFileAppender"/>
|
||||||
<appender-ref ref="MONGO"/>
|
|
||||||
</root>
|
</root>
|
||||||
|
<logger name="org.springframework" level="ERROR" additivity="false">
|
||||||
<logger name="jdbc.audit" level="ERROR" additivity="false">
|
<appender-ref ref="asyncFileAppender"/>
|
||||||
<appender-ref ref="CONSOLE"/>
|
|
||||||
</logger>
|
</logger>
|
||||||
<logger name="jdbc.resultset" level="ERROR" additivity="false">
|
<logger name="org.hibernate" level="ERROR" additivity="false">
|
||||||
<appender-ref ref="CONSOLE"/>
|
<appender-ref ref="asyncFileAppender"/>
|
||||||
</logger>
|
</logger>
|
||||||
<logger name="springfox.documentation" level="ERROR" additivity="false">
|
<logger name="io.netty" level="ERROR" additivity="false">
|
||||||
<appender-ref ref="CONSOLE"/>
|
<appender-ref ref="asyncFileAppender"/>
|
||||||
</logger>
|
</logger>
|
||||||
<logger name="jdbc.resultsettable" level="ERROR" additivity="false">
|
<logger name="jdbc" level="ERROR" additivity="false">
|
||||||
<appender-ref ref="CONSOLE"/>
|
<appender-ref ref="asyncFileAppender"/>
|
||||||
</logger>
|
</logger>
|
||||||
<logger name="jdbc.sqlonly" level="ERROR" additivity="false">
|
<logger name="io.lettuce" level="ERROR" additivity="false">
|
||||||
<appender-ref ref="CONSOLE"/>
|
<appender-ref ref="asyncFileAppender"/>
|
||||||
</logger>
|
</logger>
|
||||||
<logger name="jdbc.sqltiming" level="ERROR" additivity="false">
|
<logger name="com.fasterxml" level="ERROR" additivity="false">
|
||||||
<appender-ref ref="CONSOLE"/>
|
<appender-ref ref="asyncFileAppender"/>
|
||||||
</logger>
|
</logger>
|
||||||
<logger name="org.jinterop" level="ERROR" additivity="false">
|
<logger name="org.quartz" level="ERROR" additivity="false">
|
||||||
<appender-ref ref="CONSOLE"/>
|
<appender-ref ref="asyncFileAppender"/>
|
||||||
|
</logger>
|
||||||
|
<logger name="com.google" level="ERROR" additivity="false">
|
||||||
|
<appender-ref ref="asyncFileAppender"/>
|
||||||
|
</logger>
|
||||||
|
<logger name="springfox" level="ERROR" additivity="false">
|
||||||
|
<appender-ref ref="asyncFileAppender"/>
|
||||||
|
</logger>
|
||||||
|
<logger name="log4jdbc" level="ERROR" additivity="false">
|
||||||
|
<appender-ref ref="asyncFileAppender"/>
|
||||||
|
</logger>
|
||||||
|
<logger name="nl.basjes" level="ERROR" additivity="false">
|
||||||
|
<appender-ref ref="asyncFileAppender"/>
|
||||||
</logger>
|
</logger>
|
||||||
</springProfile>
|
</springProfile>
|
||||||
<!--测试环境:打印控制台-->
|
<!--测试环境:打印控制台-->
|
||||||
@@ -135,9 +109,42 @@ https://juejin.cn/post/6844903775631572999
|
|||||||
|
|
||||||
<!--生产环境:打印控制台和输出到文件-->
|
<!--生产环境:打印控制台和输出到文件-->
|
||||||
<springProfile name="prod">
|
<springProfile name="prod">
|
||||||
<root level="off">
|
<root level="debug">
|
||||||
<appender-ref ref="asyncFileAppender"/>
|
<appender-ref ref="asyncFileAppender"/>
|
||||||
</root>
|
</root>
|
||||||
|
<logger name="org.springframework" level="ERROR" additivity="false">
|
||||||
|
<appender-ref ref="asyncFileAppender"/>
|
||||||
|
</logger>
|
||||||
|
<logger name="org.hibernate" level="ERROR" additivity="false">
|
||||||
|
<appender-ref ref="asyncFileAppender"/>
|
||||||
|
</logger>
|
||||||
|
<logger name="io.netty" level="ERROR" additivity="false">
|
||||||
|
<appender-ref ref="asyncFileAppender"/>
|
||||||
|
</logger>
|
||||||
|
<logger name="jdbc" level="ERROR" additivity="false">
|
||||||
|
<appender-ref ref="asyncFileAppender"/>
|
||||||
|
</logger>
|
||||||
|
<logger name="io.lettuce" level="ERROR" additivity="false">
|
||||||
|
<appender-ref ref="asyncFileAppender"/>
|
||||||
|
</logger>
|
||||||
|
<logger name="com.fasterxml" level="ERROR" additivity="false">
|
||||||
|
<appender-ref ref="asyncFileAppender"/>
|
||||||
|
</logger>
|
||||||
|
<logger name="org.quartz" level="ERROR" additivity="false">
|
||||||
|
<appender-ref ref="asyncFileAppender"/>
|
||||||
|
</logger>
|
||||||
|
<logger name="com.google" level="ERROR" additivity="false">
|
||||||
|
<appender-ref ref="asyncFileAppender"/>
|
||||||
|
</logger>
|
||||||
|
<logger name="springfox" level="ERROR" additivity="false">
|
||||||
|
<appender-ref ref="asyncFileAppender"/>
|
||||||
|
</logger>
|
||||||
|
<logger name="log4jdbc" level="ERROR" additivity="false">
|
||||||
|
<appender-ref ref="asyncFileAppender"/>
|
||||||
|
</logger>
|
||||||
|
<logger name="nl.basjes" level="ERROR" additivity="false">
|
||||||
|
<appender-ref ref="asyncFileAppender"/>
|
||||||
|
</logger>
|
||||||
</springProfile>
|
</springProfile>
|
||||||
|
|
||||||
</configuration>
|
</configuration>
|
||||||
|
|||||||
@@ -1,28 +0,0 @@
|
|||||||
package org.nl;
|
|
||||||
|
|
||||||
import org.junit.After;
|
|
||||||
import org.junit.Before;
|
|
||||||
import org.junit.runner.RunWith;
|
|
||||||
import org.nl.wql.WQLCore;
|
|
||||||
import org.springframework.boot.test.context.SpringBootTest;
|
|
||||||
import org.springframework.test.context.junit4.SpringRunner;
|
|
||||||
|
|
||||||
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
|
|
||||||
@RunWith(SpringRunner.class)
|
|
||||||
public class BaseTest {
|
|
||||||
@Before
|
|
||||||
public void init() {
|
|
||||||
WQLCore.defalutDBName = "eladmin";
|
|
||||||
WQLCore.ROOT = "org.nl";
|
|
||||||
try {
|
|
||||||
WQLCore.init();
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@After
|
|
||||||
public void after() {
|
|
||||||
System.out.println("测试结束-----------------");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
package org.nl;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 模拟从1001--1002的AGV搬运指令。比如从入库口---库内等
|
|
||||||
* 0、生成指令之前需要判断光电状态,最大指令数等条件
|
|
||||||
* 1、定时器查询任务,判断任务状态比如status=0这种。
|
|
||||||
* 2、根据起点找路由next,A-->B
|
|
||||||
* 3、更新任务状态,下发给PLC、AGV
|
|
||||||
* 4、指令完成,
|
|
||||||
* 4.1 PLC型号类型:比如A task和B的task点位任务号相同,相当于指令结束
|
|
||||||
* 4.2 AGV类型:定时器查接口数据
|
|
||||||
*/
|
|
||||||
public class InstructCreate {
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
package org.nl;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 模拟从1001-1002的AGV搬运任务生成,如从入库口到库内
|
|
||||||
* 任务触发,比如mode变为2
|
|
||||||
* 1、申请任务,需要判断路由是否存在。
|
|
||||||
* 1.1、电器按钮:mode=2,3,4代表任务类型:申请空盘,申请入库等
|
|
||||||
* 1.2、光电信号:move:0,1 有货,无货等
|
|
||||||
* 2、相关接口
|
|
||||||
* 2.1 申请WMS,WMS直接返回任务
|
|
||||||
* 2.2 申请WMS,直接返回false或true,然后WMS通过定时器下发给ACS
|
|
||||||
*/
|
|
||||||
public class TaskCreate {
|
|
||||||
}
|
|
||||||
@@ -1,460 +0,0 @@
|
|||||||
package org.nl;
|
|
||||||
|
|
||||||
import cn.hutool.core.date.DateUtil;
|
|
||||||
import cn.hutool.core.util.IdUtil;
|
|
||||||
import cn.hutool.json.JSONUtil;
|
|
||||||
import com.alibaba.fastjson.JSONArray;
|
|
||||||
import com.alibaba.fastjson.JSONObject;
|
|
||||||
import com.sun.swing.internal.plaf.synth.resources.synth_sv;
|
|
||||||
import org.junit.Test;
|
|
||||||
import org.nl.wql.core.bean.WQLObject;
|
|
||||||
|
|
||||||
import java.text.ParseException;
|
|
||||||
import java.text.SimpleDateFormat;
|
|
||||||
import java.util.Calendar;
|
|
||||||
import java.util.Date;
|
|
||||||
import java.util.Queue;
|
|
||||||
import java.util.concurrent.ArrayBlockingQueue;
|
|
||||||
|
|
||||||
public class Test3 extends BaseTest {
|
|
||||||
@org.junit.Test
|
|
||||||
public void test() {
|
|
||||||
|
|
||||||
JSONArray array = WQLObject.getWQLObject("acs_route_line").query("device_code='A11'").getResultJSONArray(0);
|
|
||||||
WQLObject tab = WQLObject.getWQLObject("acs_route_line");
|
|
||||||
for (int i = 1; i < 5; i++) {
|
|
||||||
JSONObject json = array.getJSONObject(0);
|
|
||||||
|
|
||||||
json.put("next_device_code", "B2" + i);
|
|
||||||
|
|
||||||
json.put("line_uuid", IdUtil.simpleUUID());
|
|
||||||
json.put("device_code", "D22");
|
|
||||||
tab.insert(json);
|
|
||||||
json.put("line_uuid", IdUtil.simpleUUID());
|
|
||||||
json.put("device_code", "E22");
|
|
||||||
tab.insert(json);
|
|
||||||
json.put("line_uuid", IdUtil.simpleUUID());
|
|
||||||
json.put("device_code", "F22");
|
|
||||||
tab.insert(json);
|
|
||||||
json.put("line_uuid", IdUtil.simpleUUID());
|
|
||||||
json.put("device_code", "G22");
|
|
||||||
tab.insert(json);
|
|
||||||
json.put("line_uuid", IdUtil.simpleUUID());
|
|
||||||
json.put("device_code", "H22");
|
|
||||||
tab.insert(json);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void test3() {
|
|
||||||
String stor_id = "1518109007364100096";
|
|
||||||
String is_used = "1";
|
|
||||||
String is_delete = "0";
|
|
||||||
String create_id = "1";
|
|
||||||
String create_time = "2022-04-24 14:12:26";
|
|
||||||
int flag = 0;
|
|
||||||
String sect_id = "1518109805401739264";//满托货架库区
|
|
||||||
for (int k = 1; k < 8; k++) {
|
|
||||||
for (int i = 1; i < 3; i++) {
|
|
||||||
if (k == 1) {
|
|
||||||
flag = 10 + 1;
|
|
||||||
sect_id = "1518109502010953728";
|
|
||||||
}
|
|
||||||
if (k == 2) {
|
|
||||||
flag = 10 + 1;
|
|
||||||
sect_id = "1518109502010953728";
|
|
||||||
}
|
|
||||||
if (k == 3) {
|
|
||||||
flag = 6 + 1;
|
|
||||||
sect_id = "1518109805401739264";
|
|
||||||
}
|
|
||||||
if (k == 4) {
|
|
||||||
flag = 6 + 1;
|
|
||||||
sect_id = "1518109805401739264";
|
|
||||||
}
|
|
||||||
if (k == 5) {
|
|
||||||
flag = 20 + 1;
|
|
||||||
sect_id = "1518109805401739264";
|
|
||||||
}
|
|
||||||
if (k == 6) {
|
|
||||||
flag = 26 + 1;
|
|
||||||
sect_id = "1518121250239680512";
|
|
||||||
}
|
|
||||||
if (k == 7) {
|
|
||||||
flag = 11 + 1;
|
|
||||||
sect_id = "1518121250239684212";
|
|
||||||
}
|
|
||||||
if (k == 7 && i == 2) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
for (int j = 1; j < flag; j++) {
|
|
||||||
String struct_id = IdUtil.getSnowflake(1, 1).nextId() + "";
|
|
||||||
String row_seq = String.valueOf(k);//排
|
|
||||||
String col = String.valueOf(j);//列
|
|
||||||
String layer = String.valueOf(i);//层
|
|
||||||
String struct_code = "L" + row_seq + "-" + col + "-" + layer;
|
|
||||||
String struct_name = row_seq + "排" + col + "列" + layer + "层";
|
|
||||||
String simple_name = struct_name;
|
|
||||||
JSONObject jo = new JSONObject();
|
|
||||||
jo.put("struct_id", struct_id);
|
|
||||||
jo.put("struct_code", struct_code);
|
|
||||||
jo.put("struct_name", struct_name);
|
|
||||||
jo.put("simple_name", simple_name);
|
|
||||||
jo.put("sect_id", sect_id);
|
|
||||||
jo.put("stor_id", stor_id);
|
|
||||||
jo.put("row_seq", row_seq);
|
|
||||||
jo.put("col", col);
|
|
||||||
jo.put("layer", layer);
|
|
||||||
jo.put("is_used", is_used);
|
|
||||||
jo.put("is_delete", is_delete);
|
|
||||||
jo.put("create_id", create_id);
|
|
||||||
jo.put("create_name", "管理员");
|
|
||||||
jo.put("create_time", create_time);
|
|
||||||
WQLObject.getWQLObject("st_ivt_structattr").insert(jo);
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void syncStruct() {
|
|
||||||
|
|
||||||
JSONArray structArray = WQLObject.getWQLObject("st_ivt_structattr").query("1=1").getResultJSONArray(0);
|
|
||||||
WQLObject wo = WQLObject.getWQLObject("st_rule_iodisstruct");
|
|
||||||
String now = DateUtil.now();
|
|
||||||
for (int i = 0; i < structArray.size(); i++) {
|
|
||||||
JSONObject structObject = structArray.getJSONObject(i);
|
|
||||||
JSONObject iodObject = new JSONObject();
|
|
||||||
iodObject.put("disrule_uuid", String.valueOf(IdUtil.getSnowflake(1, 1).nextId()));
|
|
||||||
iodObject.put("disrule_type", "00");
|
|
||||||
iodObject.put("struct_uuid", structObject.getString("struct_id"));
|
|
||||||
iodObject.put("struct_code", structObject.getString("struct_code"));
|
|
||||||
iodObject.put("struct_name", structObject.getString("struct_name"));
|
|
||||||
iodObject.put("sect_uuid", structObject.getString("sect_id"));
|
|
||||||
iodObject.put("store_uuid", structObject.getString("stor_id"));
|
|
||||||
iodObject.put("row_num", structObject.getString("row_seq"));
|
|
||||||
iodObject.put("col_num", structObject.getString("col"));
|
|
||||||
iodObject.put("layer_num", structObject.getString("layer"));
|
|
||||||
iodObject.put("height", 10);
|
|
||||||
iodObject.put("out_seq_no", i * 10);
|
|
||||||
iodObject.put("in_seq_no", i * 10);
|
|
||||||
iodObject.put("load_series", 1);
|
|
||||||
iodObject.put("create_id", 1);
|
|
||||||
iodObject.put("create_name", "管理员");
|
|
||||||
iodObject.put("create_time", now);
|
|
||||||
iodObject.put("update_optid", 1);
|
|
||||||
iodObject.put("update_optname", "管理员");
|
|
||||||
iodObject.put("update_time", now);
|
|
||||||
wo.insert(iodObject);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void syncStruct1() {
|
|
||||||
JSONArray structArray = WQLObject.getWQLObject("st_ivt_structattr").query("is_delete='0' and struct_code like 'YZJ1%'").getResultJSONArray(0);
|
|
||||||
WQLObject wo = WQLObject.getWQLObject("ST_IVT_StructRelaMaterial");
|
|
||||||
String now = DateUtil.now();
|
|
||||||
for (int i = 0; i < structArray.size(); i++) {
|
|
||||||
String material_id = "";
|
|
||||||
for (int j = 0; j < 4; j++) {
|
|
||||||
if (j == 0) {
|
|
||||||
material_id = "1515940603542769664";
|
|
||||||
}
|
|
||||||
if (j == 1) {
|
|
||||||
material_id = "1515940976307343360";
|
|
||||||
}
|
|
||||||
if (j == 2) {
|
|
||||||
material_id = "1515947921256878080";
|
|
||||||
}
|
|
||||||
if (j == 3) {
|
|
||||||
material_id = "1516309702840029184";
|
|
||||||
}
|
|
||||||
JSONObject jsonObject = structArray.getJSONObject(i);
|
|
||||||
JSONObject map = new JSONObject();
|
|
||||||
map.put("relation_id", String.valueOf(IdUtil.getSnowflake(1, 1).nextId()));
|
|
||||||
map.put("struct_id", jsonObject.getString("struct_id"));
|
|
||||||
map.put("material_id", material_id);
|
|
||||||
map.put("create_id", 1);
|
|
||||||
map.put("create_name", "管理员");
|
|
||||||
map.put("create_time", now);
|
|
||||||
map.put("update_optid", 1);
|
|
||||||
map.put("update_optname", "管理员");
|
|
||||||
map.put("update_time", now);
|
|
||||||
wo.insert(map);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void syncStruct2() {
|
|
||||||
JSONArray structArray = WQLObject.getWQLObject("st_ivt_structattr").query("is_delete='0' and struct_code like 'YZJ%'").getResultJSONArray(0);
|
|
||||||
WQLObject wo = WQLObject.getWQLObject("st_ivt_structrelavehicletype");
|
|
||||||
String now = DateUtil.now();
|
|
||||||
for (int i = 0; i < structArray.size(); i++) {
|
|
||||||
for (int j = 1; j <= 3; j++) {
|
|
||||||
JSONObject jsonObject = structArray.getJSONObject(i);
|
|
||||||
JSONObject map = new JSONObject();
|
|
||||||
map.put("relation_id", String.valueOf(IdUtil.getSnowflake(1, 1).nextId()));
|
|
||||||
map.put("struct_id", jsonObject.getString("struct_id"));
|
|
||||||
map.put("vehicle_type", "0" + j);
|
|
||||||
map.put("create_id", 1);
|
|
||||||
map.put("create_name", "管理员");
|
|
||||||
map.put("create_time", now);
|
|
||||||
map.put("update_optid", 1);
|
|
||||||
map.put("update_optname", "管理员");
|
|
||||||
map.put("update_time", now);
|
|
||||||
wo.insert(map);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void compare() {
|
|
||||||
try {
|
|
||||||
/* Date instorage_time_parse = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse("2028-09-23 23:00:45");
|
|
||||||
Date now_parse = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(DateUtil.now());
|
|
||||||
if (instorage_time_parse.){
|
|
||||||
System.out.println();
|
|
||||||
}*/
|
|
||||||
Date instorage_time_parse = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse("2022-05-13 21:00:45");
|
|
||||||
System.out.println("----------------------------------------");
|
|
||||||
Date now_parse = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(DateUtil.now());
|
|
||||||
Date now = new Date();
|
|
||||||
System.out.println(instorage_time_parse);
|
|
||||||
System.out.println(DateUtil.now());
|
|
||||||
|
|
||||||
System.out.println(now_parse);
|
|
||||||
long min = (now.getTime() - instorage_time_parse.getTime()) / (1000 * 60);
|
|
||||||
System.out.println(min);
|
|
||||||
min = (now_parse.getTime() - instorage_time_parse.getTime()) / (1000 * 60);
|
|
||||||
System.out.println(min);
|
|
||||||
System.out.println("----------------------------------------");
|
|
||||||
|
|
||||||
} catch (ParseException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
//初始化入窑缓存货架
|
|
||||||
@Test
|
|
||||||
public void syncStruct4() {
|
|
||||||
WQLObject structTable = WQLObject.getWQLObject("st_ivt_structattr");
|
|
||||||
for (int i = 1; i < 4; i++) {
|
|
||||||
for (int j = 1; j < 7; j++) {
|
|
||||||
for (int k = 1; k < 3; k++) {
|
|
||||||
String struct_id = IdUtil.getSnowflake(1, 1).nextIdStr();
|
|
||||||
String struct_code = "L" + i + "-" + j + "-" + k;
|
|
||||||
String struct_name = 1 + "排" + j + "列" + k + "层";
|
|
||||||
String simple_name = struct_name;
|
|
||||||
String sect_id = "1518109502010953728";
|
|
||||||
String stor_id = "1518109007364100096";
|
|
||||||
String row_seq = i + "";
|
|
||||||
String col = j + "";
|
|
||||||
String layer = j + "";
|
|
||||||
String is_used = "1";
|
|
||||||
String is_delete = "0";
|
|
||||||
String create_id = "1";
|
|
||||||
String create_name = "qinx";
|
|
||||||
String create_time = DateUtil.now();
|
|
||||||
JSONObject jo = new JSONObject();
|
|
||||||
jo.put("struct_id", struct_id);
|
|
||||||
jo.put("struct_code", struct_code);
|
|
||||||
jo.put("struct_name", struct_name);
|
|
||||||
jo.put("simple_name", simple_name);
|
|
||||||
jo.put("sect_id", sect_id);
|
|
||||||
jo.put("stor_id", stor_id);
|
|
||||||
jo.put("row_seq", row_seq);
|
|
||||||
jo.put("col", col);
|
|
||||||
jo.put("layer", layer);
|
|
||||||
jo.put("is_used", is_used);
|
|
||||||
jo.put("is_delete", is_delete);
|
|
||||||
jo.put("create_id", create_id);
|
|
||||||
jo.put("create_name", create_name);
|
|
||||||
jo.put("create_time", create_time);
|
|
||||||
structTable.insert(jo);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//初始化成品货架
|
|
||||||
@Test
|
|
||||||
public void syncStruct5() {
|
|
||||||
WQLObject structTable = WQLObject.getWQLObject("st_ivt_structattr");
|
|
||||||
for (int i = 4; i < 5; i++) {
|
|
||||||
for (int j = 1; j < 19; j++) {
|
|
||||||
for (int k = 1; k < 3; k++) {
|
|
||||||
String struct_id = IdUtil.getSnowflake(1, 1).nextIdStr();
|
|
||||||
String struct_code = "L" + i + "-" + j + "-" + k;
|
|
||||||
String struct_name = i + "排" + j + "列" + k + "层";
|
|
||||||
String simple_name = struct_name;
|
|
||||||
String sect_id = "1518109805401739264";
|
|
||||||
String stor_id = "1518109007364100096";
|
|
||||||
String row_seq = i + "";
|
|
||||||
String col = j + "";
|
|
||||||
String layer = j + "";
|
|
||||||
String is_used = "1";
|
|
||||||
String is_delete = "0";
|
|
||||||
String create_id = "1";
|
|
||||||
String create_name = "qinx";
|
|
||||||
String create_time = DateUtil.now();
|
|
||||||
JSONObject jo = new JSONObject();
|
|
||||||
jo.put("struct_id", struct_id);
|
|
||||||
jo.put("struct_code", struct_code);
|
|
||||||
jo.put("struct_name", struct_name);
|
|
||||||
jo.put("simple_name", simple_name);
|
|
||||||
jo.put("sect_id", sect_id);
|
|
||||||
jo.put("stor_id", stor_id);
|
|
||||||
jo.put("row_seq", row_seq);
|
|
||||||
jo.put("col", col);
|
|
||||||
jo.put("layer", layer);
|
|
||||||
jo.put("is_used", is_used);
|
|
||||||
jo.put("is_delete", is_delete);
|
|
||||||
jo.put("create_id", create_id);
|
|
||||||
jo.put("create_name", create_name);
|
|
||||||
jo.put("create_time", create_time);
|
|
||||||
structTable.insert(jo);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//初始化分配规则
|
|
||||||
@Test
|
|
||||||
public void syncStruct6() {
|
|
||||||
WQLObject structTable = WQLObject.getWQLObject("st_ivt_structattr");
|
|
||||||
WQLObject ruleTable = WQLObject.getWQLObject("st_rule_iodisstruct");
|
|
||||||
JSONArray arr = structTable.query("1=1").getResultJSONArray(0);
|
|
||||||
for (int i = 0; i < arr.size(); i++) {
|
|
||||||
JSONObject jo = arr.getJSONObject(i);
|
|
||||||
String disrule_uuid = IdUtil.getSnowflake(1, 1).nextIdStr();
|
|
||||||
String disrule_type = "00";
|
|
||||||
String struct_uuid = jo.getString("struct_id");
|
|
||||||
String struct_code = jo.getString("struct_code");
|
|
||||||
String struct_name = jo.getString("struct_name");
|
|
||||||
String sect_uuid = jo.getString("sect_id");
|
|
||||||
String store_uuid = jo.getString("store_id");
|
|
||||||
String row_num = jo.getString("row_seq");
|
|
||||||
String col_num = jo.getString("col");
|
|
||||||
String layer_num = jo.getString("layer");
|
|
||||||
String height = "10";
|
|
||||||
String out_seq_no = i * 10 + "";
|
|
||||||
String in_seq_no = i * 10 + "";
|
|
||||||
String load_series = "10";
|
|
||||||
String create_time = DateUtil.now();
|
|
||||||
String create_name = "qinx";
|
|
||||||
String create_id = "1";
|
|
||||||
JSONObject joObj = new JSONObject();
|
|
||||||
joObj.put("create_id", create_id);
|
|
||||||
joObj.put("create_name", create_name);
|
|
||||||
joObj.put("create_time", create_time);
|
|
||||||
joObj.put("load_series", load_series);
|
|
||||||
joObj.put("in_seq_no", in_seq_no);
|
|
||||||
joObj.put("out_seq_no", out_seq_no);
|
|
||||||
joObj.put("height", height);
|
|
||||||
joObj.put("layer_num", layer_num);
|
|
||||||
joObj.put("sect_uuid", sect_uuid);
|
|
||||||
joObj.put("col_num", col_num);
|
|
||||||
joObj.put("row_num", row_num);
|
|
||||||
joObj.put("store_uuid", store_uuid);
|
|
||||||
joObj.put("struct_name", struct_name);
|
|
||||||
joObj.put("struct_code", struct_code);
|
|
||||||
joObj.put("struct_uuid", struct_uuid);
|
|
||||||
joObj.put("disrule_type", disrule_type);
|
|
||||||
joObj.put("disrule_uuid", disrule_uuid);
|
|
||||||
ruleTable.insert(joObj);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//初始化仓位载具
|
|
||||||
@Test
|
|
||||||
public void syncStruct7() {
|
|
||||||
WQLObject structTable = WQLObject.getWQLObject("st_ivt_structattr");
|
|
||||||
WQLObject ruleTable = WQLObject.getWQLObject("st_ivt_structrelavehicletype");
|
|
||||||
JSONArray arr = structTable.query("1=1").getResultJSONArray(0);
|
|
||||||
for (int i = 0; i < arr.size(); i++) {
|
|
||||||
JSONObject jo = arr.getJSONObject(i);
|
|
||||||
String relation_id = IdUtil.getSnowflake(1, 1).nextIdStr();
|
|
||||||
String struct_id = jo.getString("struct_id");
|
|
||||||
String vehicle_type = "02";
|
|
||||||
String create_time = DateUtil.now();
|
|
||||||
String create_name = "qinx";
|
|
||||||
String create_id = "1";
|
|
||||||
JSONObject joObj = new JSONObject();
|
|
||||||
joObj.put("relation_id", relation_id);
|
|
||||||
joObj.put("struct_id", struct_id);
|
|
||||||
joObj.put("vehicle_type", vehicle_type);
|
|
||||||
joObj.put("create_time", create_time);
|
|
||||||
joObj.put("create_name", create_name);
|
|
||||||
joObj.put("create_id", create_id);
|
|
||||||
ruleTable.insert(joObj);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//初始化仓位载具
|
|
||||||
@Test
|
|
||||||
public void syncStruct8() {
|
|
||||||
WQLObject structTable = WQLObject.getWQLObject("st_ivt_structattr");
|
|
||||||
WQLObject ruleTable = WQLObject.getWQLObject("st_ivt_structrelamaterial");
|
|
||||||
JSONArray arr = structTable.query("1=1").getResultJSONArray(0);
|
|
||||||
for (int i = 0; i < arr.size(); i++) {
|
|
||||||
JSONObject jo = arr.getJSONObject(i);
|
|
||||||
String relation_id = IdUtil.getSnowflake(1, 1).nextIdStr();
|
|
||||||
String struct_id = jo.getString("struct_id");
|
|
||||||
String material_id = "1515940603542769664";
|
|
||||||
String create_time = DateUtil.now();
|
|
||||||
String create_name = "qinx";
|
|
||||||
String create_id = "1";
|
|
||||||
JSONObject joObj = new JSONObject();
|
|
||||||
joObj.put("relation_id", relation_id);
|
|
||||||
joObj.put("struct_id", struct_id);
|
|
||||||
joObj.put("material_id", material_id);
|
|
||||||
joObj.put("create_time", create_time);
|
|
||||||
joObj.put("create_name", create_name);
|
|
||||||
joObj.put("create_id", create_id);
|
|
||||||
ruleTable.insert(joObj);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public static void main6435(String[] args) {
|
|
||||||
Queue<String> ma = new ArrayBlockingQueue<>(10);
|
|
||||||
for (int i = 0; i <9 ; i++) {
|
|
||||||
ma.offer("pla00"+i);
|
|
||||||
}
|
|
||||||
ma.poll();
|
|
||||||
for (String str:ma){
|
|
||||||
System.out.println(str);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
@Test
|
|
||||||
public void testqinx (){
|
|
||||||
WQLObject logTable = WQLObject.getWQLObject("sys_log");
|
|
||||||
System.out.println("开始测试!");
|
|
||||||
JSONObject json = logTable.query("1=1").uniqueResult(0);
|
|
||||||
System.out.println("测试完成!");
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void main(String[] args) {
|
|
||||||
String a = "0"+1+1;
|
|
||||||
String b ="0"+(1+1);
|
|
||||||
System.out.println(a);
|
|
||||||
System.out.println(b);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,86 +0,0 @@
|
|||||||
package org.nl.mongodb;
|
|
||||||
|
|
||||||
import cn.hutool.core.util.StrUtil;
|
|
||||||
import org.nl.exception.BadRequestException;
|
|
||||||
import org.springframework.data.domain.Page;
|
|
||||||
|
|
||||||
public class Test {
|
|
||||||
|
|
||||||
|
|
||||||
public Page test2(Integer currentPage, Integer pageSize, Long loanApplyId) {
|
|
||||||
/* //创建查询对象
|
|
||||||
Query query = new Query();
|
|
||||||
//设置起始数
|
|
||||||
query.skip((currentPage - 1) * pageSize);
|
|
||||||
//设置查询条数
|
|
||||||
query.limit(pageSize);
|
|
||||||
Criteria criteria = new Criteria();
|
|
||||||
criteria.where("loanApplyId").is(loanApplyId);
|
|
||||||
//查询当前页数据集合
|
|
||||||
List<ApplyLog> ApplyLogList = mongoTemplate.find(query, ApplyLog.class);
|
|
||||||
//查询总记录数
|
|
||||||
int count = (int) mongoTemplate.count(query, ApplyLog.class);
|
|
||||||
//创建分页实体对象
|
|
||||||
Page<ApplyLog> page = new Page<>();
|
|
||||||
//添加每页的集合、数据总条数、总页数
|
|
||||||
page.setRecords(ApplyLogList);
|
|
||||||
page.setSize(count);
|
|
||||||
page.setTotal(count % pageSize == 0 ? 1 : count / pageSize + 1);
|
|
||||||
return page;
|
|
||||||
*/
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void test() {
|
|
||||||
/* int pageNo = 1;
|
|
||||||
int pageSize = 10;
|
|
||||||
|
|
||||||
// limit限定查询2条
|
|
||||||
Query query = Query.query(Criteria.where("user").is("一灰灰blog").and("a").is("b").and("")).with(Sort.by("age")).limit(2);
|
|
||||||
//Query query = Query.query(Criteria.where("user").is("一灰灰blog")).with(Sort.by("age")).limit(2);
|
|
||||||
// Pageable pageable = PageRequest.of(page,size);
|
|
||||||
List<Map> result = mongoTemplate.find(query, Map.class, "logdb");
|
|
||||||
System.out.println("query: " + query + " | limitPageQuery " + result);
|
|
||||||
|
|
||||||
|
|
||||||
// skip()方法来跳过指定数量的数据
|
|
||||||
query = Query.query(Criteria.where("user").is("一灰灰blog")).with(Sort.by("age")).skip(2);
|
|
||||||
result = mongoTemplate.find(query, Map.class, "logdb");
|
|
||||||
System.out.println("query: " + query + " | skipPageQuery " + result);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Query query = new Query(new Criteria());
|
|
||||||
query.with(Sort.by(Sort.Direction.DESC, "time"));
|
|
||||||
mongoUtil.start(2, 2, query);
|
|
||||||
List<Teacher> teachers = mongoTemplate.find(query, Teacher.class);
|
|
||||||
long count = mongoTemplate.count(query, Teacher.class);
|
|
||||||
PageHelper pageHelper = mongoUtil.pageHelper(count, teachers);*/
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void main(String[] args) {
|
|
||||||
String a = "231";
|
|
||||||
String b = "8";
|
|
||||||
String c = "23";
|
|
||||||
String d = "3242";
|
|
||||||
String e = "43243";
|
|
||||||
String aa = String.format("%0" + 4 + "d", Integer.parseInt(a) + 1);
|
|
||||||
String bb = String.format("%0" + 4 + "d", Integer.parseInt(b) + 1);
|
|
||||||
String cc = String.format("%0" + 4 + "d", Integer.parseInt(c) + 1);
|
|
||||||
String dd = String.format("%0" + 4 + "d", Integer.parseInt(d) + 1);
|
|
||||||
String ee = String.format("%0" + 4 + "d", Integer.parseInt(e) + 1);
|
|
||||||
System.out.println(aa);
|
|
||||||
System.out.println(bb);
|
|
||||||
System.out.println(cc);
|
|
||||||
System.out.println(dd);
|
|
||||||
System.out.println(ee);
|
|
||||||
}
|
|
||||||
|
|
||||||
public String autoGenericCode(String vehicle_code) {
|
|
||||||
if (StrUtil.isEmpty(vehicle_code)) {
|
|
||||||
throw new BadRequestException("托盘号不能为空!");
|
|
||||||
}
|
|
||||||
return String.format("%0" + 4 + "d", Integer.parseInt(vehicle_code) + 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,27 +0,0 @@
|
|||||||
package org.nl.mongodb;
|
|
||||||
|
|
||||||
import java.util.Scanner;
|
|
||||||
|
|
||||||
class Tx {
|
|
||||||
static int[] arr = {100,50,20,5,1}; //用来存纸币面额
|
|
||||||
static int[] num = new int[5]; //每种纸币的数量
|
|
||||||
public static void main(String[] args) {
|
|
||||||
|
|
||||||
Scanner sc = new Scanner(System.in);
|
|
||||||
int n = sc.nextInt();
|
|
||||||
|
|
||||||
f(n);
|
|
||||||
|
|
||||||
for (int i = 0; i < arr.length; i++) {
|
|
||||||
System.out.println(arr[i]+":"+num[i]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
static void f(int n) {
|
|
||||||
//遍历arr数组
|
|
||||||
for (int i = 0; i < arr.length; i++) {
|
|
||||||
// 求出每类纸币需要多少张
|
|
||||||
num[i] = n / arr[i];
|
|
||||||
n = n % arr[i];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -17,7 +17,7 @@
|
|||||||
|
|
||||||
.cell {
|
.cell {
|
||||||
.el-tag {
|
.el-tag {
|
||||||
margin-right: 0;
|
margin-right: 0px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -41,7 +41,7 @@
|
|||||||
text-align: center;
|
text-align: center;
|
||||||
|
|
||||||
.el-tag {
|
.el-tag {
|
||||||
margin-right: 0;
|
margin-right: 0px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -69,7 +69,7 @@
|
|||||||
// dropdown
|
// dropdown
|
||||||
.el-dropdown-menu {
|
.el-dropdown-menu {
|
||||||
a {
|
a {
|
||||||
display: block
|
display: block;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -77,3 +77,46 @@
|
|||||||
.el-range-editor.el-input__inner {
|
.el-range-editor.el-input__inner {
|
||||||
display: inline-flex !important;
|
display: inline-flex !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// to fix el-date-picker css style
|
||||||
|
.el-range-separator {
|
||||||
|
box-sizing: content-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
.el-menu--collapse
|
||||||
|
> div
|
||||||
|
> .el-submenu
|
||||||
|
> .el-submenu__title
|
||||||
|
.el-submenu__icon-arrow {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.el-form-search {
|
||||||
|
float: right;
|
||||||
|
.el-form-search-item {
|
||||||
|
margin-bottom: 0px;
|
||||||
|
.el-input__inner {
|
||||||
|
width: 140px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
el-table .el-table__cell {
|
||||||
|
padding: 8px 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.el-table--medium .el-table__cell {
|
||||||
|
padding: 6px 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.el-table--small .el-table__cell {
|
||||||
|
padding: 3px 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.el-table--mini .el-table__cell {
|
||||||
|
padding: 1px 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.el-dialog__body {
|
||||||
|
padding: 20px 20px;
|
||||||
|
}
|
||||||
|
|||||||
@@ -8,9 +8,9 @@
|
|||||||
<template v-if="device!=='mobile'">
|
<template v-if="device!=='mobile'">
|
||||||
<search id="header-search" class="right-menu-item" />
|
<search id="header-search" class="right-menu-item" />
|
||||||
|
|
||||||
<el-tooltip content="项目文档" effect="dark" placement="bottom">
|
<!--<el-tooltip content="项目文档" effect="dark" placement="bottom">
|
||||||
<Doc class="right-menu-item hover-effect" />
|
<Doc class="right-menu-item hover-effect" />
|
||||||
</el-tooltip>
|
</el-tooltip>-->
|
||||||
|
|
||||||
<el-tooltip content="全屏缩放" effect="dark" placement="bottom">
|
<el-tooltip content="全屏缩放" effect="dark" placement="bottom">
|
||||||
<screenfull id="screenfull" class="right-menu-item hover-effect" />
|
<screenfull id="screenfull" class="right-menu-item hover-effect" />
|
||||||
|
|||||||
Reference in New Issue
Block a user