ecef缓存在device类里,单位改为mm

This commit is contained in:
weidong 2024-07-18 10:12:39 +08:00
parent edd0882302
commit 097a6b97bc
13 changed files with 495 additions and 48 deletions

View File

@ -22,6 +22,9 @@ public class GnssDevice {
public static final short OP_MODE_CHECK = 1; public static final short OP_MODE_CHECK = 1;
public static final short OP_MODE_UNUSE = 2; public static final short OP_MODE_UNUSE = 2;
public static final short MODEL_G505 = 0; //F9P
public static final short MODEL_G510 = 1; //博通
@TableId(value = "id", type = IdType.AUTO) @TableId(value = "id", type = IdType.AUTO)
private Long id; private Long id;
private Integer tenantid; private Integer tenantid;
@ -48,4 +51,13 @@ public class GnssDevice {
private Double iposn; //初始位置 private Double iposn; //初始位置
private Double iposd; //初始位置 private Double iposd; //初始位置
private Double ecefx;
private Double ecefy;
private Double ecefz;
private String sector;//桩号
private String appver;
private String imei;
private Short model;
} }

View File

@ -1,44 +1,81 @@
package com.imdroid.sideslope.bd; package com.imdroid.sideslope.bd;
import com.imdroid.sideslope.sal.Device;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.*; import java.util.*;
import static com.imdroid.sideslope.bd.GeoCoordConverterUtil.*;
/** /**
* 博通用GGA绝对坐标代替相对位置 * 博通用GGA绝对坐标代替相对位置
*/ */
public class FocusCalculator3 extends FocusCalculator1{ public class FocusCalculator3 extends FocusCalculator1{
Device bsDevice;
public FocusCalculator3(Device bsDevice){
super();
this.bsDevice = bsDevice;
}
final static long scale = 100000000L;//地球1°111km放大到mm乘以100,000,000
static class EComparator implements Comparator<double[]>{ static class EComparator implements Comparator<double[]>{
@Override @Override
public int compare(double[] point1, double[] point2) { public int compare(double[] point1, double[] point2) {
return (int) ((point1[0] - point2[0])*100); return Double.compare(point1[1], point2[1]);
//return (int) ((point1[0] - point2[0])*100);
} }
} }
static class NComparator implements Comparator<double[]>{ static class NComparator implements Comparator<double[]>{
@Override @Override
public int compare(double[] point1, double[] point2) { public int compare(double[] point1, double[] point2) {
return (int) ((point1[1] - point2[1])*100); return Double.compare(point1[1], point2[1]);
//return (int) ((point1[1] - point2[1])*100);
} }
} }
static class DComparator implements Comparator<double[]>{ static class DComparator implements Comparator<double[]>{
@Override @Override
public int compare(double[] point1, double[] point2) { public int compare(double[] point1, double[] point2) {
return (int) ((point1[2] - point2[2])*100); return Double.compare(point1[1], point2[1]);
//return (int) ((point1[2] - point2[2])*100);
} }
} }
@Override @Override
public void addGGA(Gga gga) { public void addGGA(Gga gga) {
if(gga == null) return; if(gga == null) return;
double[] end;
double[] xyz = new double[]{gga.getLongitude()*scale, gga.getLatitude()*scale, gga.getAltitude()*1000, gga.getQuality()}; // 测站的GGA - 测站 LLA 数据
LLA_Coordinate rover_lla = new LLA_Coordinate(gga.getLatitude(),gga.getLongitude(),gga.getAltitude());
// 测站 LLA 坐标转 ECEF 坐标单位米
ECEF_Coordinate rover_ecef = LLA2ECEF(rover_lla);
if(bsDevice==null || bsDevice.getEcefx()==null){
end = new double[]{
rover_ecef.getECEF_X()*1000,
rover_ecef.getECEF_Y()*1000,
rover_ecef.getECEF_Z()*1000,
gga.getQuality()};
}
else {
// 查询测站的绑定的基站
ECEF_Coordinate reference_ecef = new ECEF_Coordinate(bsDevice.getEcefx(), bsDevice.getEcefy(), bsDevice.getEcefz());
// 以基站为站心的 ENU 坐标
ENU_Coordinate difference_enu = ECEF2ENU(reference_ecef, rover_ecef);
System.out.println("DIFF ENU:" + difference_enu.ENU_E + " " + difference_enu.ENU_N + " " + difference_enu.ENU_U);
end = new double[]{
difference_enu.ENU_E*1000,
difference_enu.ENU_N*1000,
difference_enu.ENU_U*1000,
gga.getQuality()};
}
if(gga.isFixed()) { if(gga.isFixed()) {
counterFixedResult++; counterFixedResult++;
pointList.add(xyz); //pointList.add(xyz);
pointList.add(end);
} }
else if(gga.getQuality() == 5) counterNoFixed++; else if(gga.getQuality() == 5) counterNoFixed++;
else counterNoB562 ++; else counterNoB562 ++;

View File

@ -0,0 +1,302 @@
package com.imdroid.sideslope.bd;
import static java.lang.Math.*;
public class GeoCoordConverterUtil {
// WGS84 模型常量
public static final double WGS84_A = 6378137.0;
public static final double WGS84_B = 6356752.3142;
public static final double WGS84_F = (1.0 / 298.257223563);
public static final double WGS84_E2 = 0.00669437999014;
public static final double EPSILON = 1e-12;
public static class LLA_Coordinate {
double Latitude;
double Longitude;
double Altitude;
public double getLatitude() {
return Latitude;
}
public void setLatitude(double latitude) {
Latitude = latitude;
}
public double getLongitude() {
return Longitude;
}
public void setLongitude(double longitude) {
Longitude = longitude;
}
public double getAltitude() {
return Altitude;
}
public void setAltitude(double altitude) {
Altitude = altitude;
}
public LLA_Coordinate(double latitude, double longitude, double altitude) {
if (Double.isNaN(latitude) || Double.isNaN(longitude) || Double.isNaN(altitude)) {
throw new IllegalArgumentException("Invalid LLA coordinates: NaN values are not allowed.");
}
if (Double.isInfinite(latitude) || Double.isInfinite(longitude) || Double.isInfinite(altitude)) {
throw new IllegalArgumentException("Invalid LLA coordinates: Infinite values are not allowed.");
}
if (latitude < -90.0 || latitude > 90.0) {
throw new IllegalArgumentException("Invalid latitude value: must be between -90 and 90 degrees.");
}
if (longitude < -180.0 || longitude > 180.0) {
throw new IllegalArgumentException("Invalid longitude value: must be between -180 and 180 degrees.");
}
this.Latitude = latitude;
this.Longitude = longitude;
this.Altitude = altitude;
}
public String toString() {
return "LLA_Coordinate{" +
"Latitude=" + Latitude +
", Longitude=" + Longitude +
", Altitude=" + Altitude +
'}';
}
}
public static class ECEF_Coordinate{
double ECEF_X;
double ECEF_Y;
double ECEF_Z;
public double getECEF_X() {
return ECEF_X;
}
public double getECEF_Y() {
return ECEF_Y;
}
public double getECEF_Z() {
return ECEF_Z;
}
public void setECEF_X(double ECEF_X) {
this.ECEF_X = ECEF_X;
}
public void setECEF_Y(double ECEF_Y) {
this.ECEF_Y = ECEF_Y;
}
public void setECEF_Z(double ECEF_Z) {
this.ECEF_Z = ECEF_Z;
}
public ECEF_Coordinate(double ecefX, double ecefY, double ecefZ) {
if (Double.isNaN(ecefX) || Double.isNaN(ecefY) || Double.isNaN(ecefZ)) {
throw new IllegalArgumentException("Invalid ECEF coordinates: NaN values are not allowed.");
}
if (Double.isInfinite(ecefX) || Double.isInfinite(ecefY) || Double.isInfinite(ecefZ)) {
throw new IllegalArgumentException("Invalid ECEF coordinates: Infinite values are not allowed.");
}
this.ECEF_X = ecefX;
this.ECEF_Y = ecefY;
this.ECEF_Z = ecefZ;
}
public String toString() {
return "ECEF_Coordinate{" +
"ECEF_X=" + ECEF_X +
", ECEF_Y=" + ECEF_Y +
", ECEF_Z=" + ECEF_Z +
'}';
}
}
public static class ENU_Coordinate{
double ENU_E;
double ENU_N;
double ENU_U;
public ENU_Coordinate(double E, double N, double U) {
if (Double.isNaN(E) || Double.isNaN(N) || Double.isNaN(U)) {
throw new IllegalArgumentException("Invalid ENU coordinates: NaN values are not allowed.");
}
if (Double.isInfinite(E) || Double.isInfinite(N) || Double.isInfinite(U)) {
throw new IllegalArgumentException("Invalid ENU coordinates: Infinite values are not allowed.");
}
this.ENU_E = E;
this.ENU_N = N;
this.ENU_U = U;
}
public String toString() {
return "ENU_Coordinate{" +
"ENU_E=" + ENU_E +
", ENU_N=" + ENU_N +
", ENU_U=" + ENU_U +
'}';
}
public double getENU_E() {
return ENU_E;
}
public void setENU_E(double ENU_E) {
this.ENU_E = ENU_E;
}
public double getENU_N() {
return ENU_N;
}
public void setENU_N(double ENU_N) {
this.ENU_N = ENU_N;
}
public double getENU_U() {
return ENU_U;
}
public void setENU_U(double ENU_U) {
this.ENU_U = ENU_U;
}
}
/**
* 将地理坐标纬度经度海拔转换为地心地固坐标ECEF
*
* <p>该方法将给定的纬度经度和高程LLA转换为 WGS84 参考系下的 ECEF 坐标
* 转换过程中使用了 WGS84 椭球体模型常数</p>
*
* <p>使用的公式参考自
* <a href="https://en.wikipedia.org/wiki/Geographic_coordinate_conversion#From_geodetic_to_ECEF_coordinates">
* 地理坐标转换 - 维基百科</a></p>
*
* @param LLA 要转换的地理坐标纬度和经度以度为单位海拔以米为单位
* @return 一个 {@link ECEF_Coordinate} 对象表示转换后的 ECEF 坐标XY Z 的值以米为单位
*/
public static ECEF_Coordinate LLA2ECEF(LLA_Coordinate LLA){
// 度转弧度
double lat_rad = LLA.Latitude * PI / 180.0;
double lon_rad = LLA.Longitude * PI / 180.0;
// 中间变量
double N = WGS84_A / sqrt(1.0 - WGS84_E2 * sin(lat_rad) * sin(lat_rad));
//结果
double x = (N + LLA.Altitude) * cos(lat_rad) * cos(lon_rad);
double y = (N + LLA.Altitude) * cos(lat_rad) * sin(lon_rad);
double z = ((1.0 - WGS84_E2) * N + LLA.Altitude) * sin(lat_rad);
return new ECEF_Coordinate(x, y, z);
}
/**
* 将地心地固坐标ECEF转换为地理坐标纬度经度海拔
*
* <p>该方法将给定的 ECEF 坐标转换为 WGS84 参考系下的地理坐标LLA
* 转换过程中使用了 WGS84 椭球体模型常数</p>
*
* <p>使用的公式参考自
* <a href="https://en.wikipedia.org/wiki/Geographic_coordinate_conversion#From_geodetic_to_ECEF_coordinates">
* 地理坐标转换 - 维基百科</a></p>
*
* @param ECEF 要转换的 ECEF 坐标XY Z 的值以米为单位
* @return 一个 {@link LLA_Coordinate} 对象表示转换后的地理坐标纬度和经度以度为单位海拔以米为单位
*/
public static LLA_Coordinate ECEF2LLA(ECEF_Coordinate ECEF){
double X = ECEF.ECEF_X;
double Y = ECEF.ECEF_Y;
double Z = ECEF.ECEF_Z;
if (X == 0 && Y == 0) {
double lat = Z > 0 ? 90.0 : -90.0;
double lon = 0.0;
double h = abs(Z) - WGS84_A * sqrt(1 - WGS84_E2);
return new LLA_Coordinate(lat, lon, h);
}
// 公式涉及的中间变量
double lambda = atan2(Y, X);
double phi;
double h;
double N;
double p = sqrt(X*X + Y*Y);
// 第一个猜测 h0 开始然后更新 N
double phi_new = atan2(Z, p*(1-WGS84_E2));
// 迭代公式
do {
phi = phi_new;
N = WGS84_A / sqrt(1 - WGS84_E2 * sin(phi) * sin(phi));
h = p / cos(phi) - N;
phi_new = atan2(Z, (1-(WGS84_E2*N)/(N+h))*p);
} while (abs(phi_new - phi) > EPSILON);
double lat = phi_new * 180.0 / PI;
double lon = lambda * 180.0 / PI;
return new LLA_Coordinate(lat, lon, h);
}
/**
* 将地心地固ECEF坐标转换为东--ENU坐标
*
* <p>该方法将给定的两个 ECEF 坐标基准站和流动站转换为以基准站为原点的 ENU 坐标
* 转换过程中使用了 WGS84 参考系</p>
*
* <p>使用的公式参考自
* <a href="https://en.wikipedia.org/wiki/Geographic_coordinate_conversion#From_geodetic_to_ECEF_coordinates">
* 地理坐标转换 - 维基百科</a></p>
*
* @param referenceStationECEF 基准站的 ECEF 坐标XY Z 的值以米为单位
* @param roverStationECEF 流动站的 ECEF 坐标XY Z 的值以米为单位
* @return 一个 {@link ENU_Coordinate} 对象表示转换后的 ENU 坐标EN U 的值以米为单位
*/
public static ENU_Coordinate ECEF2ENU(ECEF_Coordinate referenceStationECEF, ECEF_Coordinate roverStationECEF) {
ECEF_Coordinate differenceECEF = new ECEF_Coordinate(0,0,0);
differenceECEF.ECEF_X = roverStationECEF.ECEF_X - referenceStationECEF.ECEF_X;
differenceECEF.ECEF_Y = roverStationECEF.ECEF_Y - referenceStationECEF.ECEF_Y;
differenceECEF.ECEF_Z = roverStationECEF.ECEF_Z - referenceStationECEF.ECEF_Z;
// 得到计算中所需要的 基站的 LLA
LLA_Coordinate referenceStationLLA = ECEF2LLA(referenceStationECEF);
// 将经纬度转换为弧度用于三角函数计算
double lat = referenceStationLLA.Latitude * Math.PI / 180;
double lon = referenceStationLLA.Longitude * Math.PI / 180;
double sin_lat = Math.sin(lat);
double cos_lat = Math.cos(lat);
double sin_lon = Math.sin(lon);
double cos_lon = Math.cos(lon);
// 构建计算中所用到的矩阵S
double[][] S = {
{-sin_lon, cos_lon, 0},
{-sin_lat * cos_lon, -sin_lat * sin_lon, cos_lat},
{cos_lat * cos_lon, cos_lat * sin_lon, sin_lat}
};
ENU_Coordinate enu = new ENU_Coordinate(0,0,0);
enu.ENU_E = S[0][0] * differenceECEF.ECEF_X + S[0][1] * differenceECEF.ECEF_Y + S[0][2] * differenceECEF.ECEF_Z;
enu.ENU_N = S[1][0] * differenceECEF.ECEF_X + S[1][1] * differenceECEF.ECEF_Y + S[1][2] * differenceECEF.ECEF_Z;
enu.ENU_U = S[2][0] * differenceECEF.ECEF_X + S[2][1] * differenceECEF.ECEF_Y + S[2][2] * differenceECEF.ECEF_Z;
return enu;
}
}

View File

@ -85,7 +85,8 @@ public class SingleLineGNSSCalcService implements GNSSDataCalcService {
focusCalculator = calculatorMap.computeIfAbsent(deviceId,s -> new FocusCalculator4()); focusCalculator = calculatorMap.computeIfAbsent(deviceId,s -> new FocusCalculator4());
} }
else if(groupCalc!=null && groupCalc.getVer() == 3){ else if(groupCalc!=null && groupCalc.getVer() == 3){
focusCalculator = calculatorMap.computeIfAbsent(deviceId,s -> new FocusCalculator3()); Device bsDevice = deviceService.findByDeviceId(device.getParentId());
focusCalculator = calculatorMap.computeIfAbsent(deviceId,s -> new FocusCalculator3(bsDevice));
} }
else if(groupCalc!=null && groupCalc.getVer() == 2){ else if(groupCalc!=null && groupCalc.getVer() == 2){
focusCalculator = calculatorMap.computeIfAbsent(deviceId,s -> new FocusCalculator2()); focusCalculator = calculatorMap.computeIfAbsent(deviceId,s -> new FocusCalculator2());

View File

@ -21,6 +21,7 @@ public class D3F0SelfCheckMessage extends BaseMessage {
GnssStatusMsg statusMsg = new GnssStatusMsg(); GnssStatusMsg statusMsg = new GnssStatusMsg();
String firmwareVersion; String firmwareVersion;
String imei; String imei;
String auxInfo;
@Override @Override
public void decodeBody(ByteBuf src) { public void decodeBody(ByteBuf src) {
@ -41,7 +42,7 @@ public class D3F0SelfCheckMessage extends BaseMessage {
int ver = src.readUnsignedShort(); int ver = src.readUnsignedShort();
short verType = (short) ((ver >> 12) & 0xF); short verType = (short) ((ver >> 12) & 0xF);
firmwareVersion = ((ver >> 8) & 0xF) + "." + ((ver >> 4) & 0xF) + "." + (ver & 0xF); firmwareVersion = ((ver >> 8) & 0xF) + "." + ((ver >> 4) & 0xF) + "." + (ver & 0xF);
if (verType > 0) firmwareVersion = firmwareVersion + " type:" + verType; if (verType > 0) auxInfo = " type:" + verType;
if(src.readableBytes()>=4) { if(src.readableBytes()>=4) {
statusMsg.setTemperature((float) (src.readUnsignedShort() / 10)); statusMsg.setTemperature((float) (src.readUnsignedShort() / 10));
@ -52,8 +53,8 @@ public class D3F0SelfCheckMessage extends BaseMessage {
imei = src.readCharSequence(15, StandardCharsets.UTF_8).toString(); imei = src.readCharSequence(15, StandardCharsets.UTF_8).toString();
} }
if(src.readableBytes()>=3){ if(src.readableBytes()>=3){
firmwareVersion = firmwareVersion + auxInfo = auxInfo +
" bVer:"+src.readUnsignedByte() + " blVer:"+src.readUnsignedByte() +
" reboot:"+src.readUnsignedShort(); " reboot:"+src.readUnsignedShort();
} }

View File

@ -39,6 +39,9 @@ public class DbDeviceServiceImpl implements DeviceService {
device.setIPose(gnssDevice.getIpose()); device.setIPose(gnssDevice.getIpose());
device.setIPosn(gnssDevice.getIposn()); device.setIPosn(gnssDevice.getIposn());
device.setIPosd(gnssDevice.getIposd()); device.setIPosd(gnssDevice.getIposd());
device.setEcefx(gnssDevice.getEcefx());
device.setEcefy(gnssDevice.getEcefy());
device.setEcefz(gnssDevice.getEcefz());
return device; return device;
} }
@ -61,6 +64,9 @@ public class DbDeviceServiceImpl implements DeviceService {
device.setIPose(gnssDevice.getIpose()); device.setIPose(gnssDevice.getIpose());
device.setIPosn(gnssDevice.getIposn()); device.setIPosn(gnssDevice.getIposn());
device.setIPosd(gnssDevice.getIposd()); device.setIPosd(gnssDevice.getIposd());
device.setEcefx(gnssDevice.getEcefx());
device.setEcefy(gnssDevice.getEcefy());
device.setEcefz(gnssDevice.getEcefz());
deviceList.add(device); deviceList.add(device);
} }
return deviceList; return deviceList;

View File

@ -51,6 +51,9 @@ public class Device {
Double latitude; Double latitude;
Double longitude; Double longitude;
Double altitude; Double altitude;
Double ecefx;
Double ecefy;
Double ecefz;
Double iPose; Double iPose;
Double iPosn; Double iPosn;

View File

@ -29,6 +29,8 @@ public class DataPersistServiceImpl implements DataPersistService {
private GnssMsgMapper msgMapper; private GnssMsgMapper msgMapper;
@Autowired @Autowired
WarningService warningService; WarningService warningService;
@Autowired
GnssDeviceMapper deviceMapper;
@Override @Override
public GnssStatus getDeviceState(String deviceId) public GnssStatus getDeviceState(String deviceId)
@ -75,13 +77,28 @@ public class DataPersistServiceImpl implements DataPersistService {
if(new_flag) deviceStateRepository.insert(deviceState); if(new_flag) deviceStateRepository.insert(deviceState);
else deviceStateRepository.updateById(deviceState); else deviceStateRepository.updateById(deviceState);
// 检查版本号
boolean needSave = false;
GnssDevice gnssDevice = deviceMapper.queryByDeviceId(message.getId());
if(gnssDevice != null){
String appVer = gnssDevice.getAppver();
if(appVer==null || !appVer.equals(message.getFirmwareVersion())){
gnssDevice.setAppver(message.getFirmwareVersion());
needSave = true;
}
String imei = gnssDevice.getImei();
if(imei==null || !imei.equals(message.getImei())){
gnssDevice.setImei(message.getImei());
needSave = true;
}
}
if(needSave){
deviceMapper.updateById(gnssDevice);
}
// 保存消息摘要 // 保存消息摘要
if(message.getImei()!=null) { saveMsg(message, message.getAuxInfo());
saveMsg(message, "IMEI:" + message.getImei() + ", ver:" + message.getFirmwareVersion());
}
else{
saveMsg(message, "ver:" + message.getFirmwareVersion());
}
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }

View File

@ -2,9 +2,9 @@
#spring.datasource.url=jdbc:mysql://192.168.101.54:3306/beidou?useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai&useSSL=true #spring.datasource.url=jdbc:mysql://192.168.101.54:3306/beidou?useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai&useSSL=true
#spring.datasource.username=beidou #spring.datasource.username=beidou
#spring.datasource.password=Passw0rd#123! #spring.datasource.password=Passw0rd#123!
#spring.datasource.url=jdbc:mysql://127.0.0.1:3306/beidou?useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai&useSSL=true spring.datasource.url=jdbc:mysql://127.0.0.1:3306/beidou?useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai&useSSL=true
spring.datasource.url=jdbc:mysql://139.9.51.237:3306/beidou?useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai&useSSL=true #spring.datasource.url=jdbc:mysql://139.9.51.237:3306/beidou?useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai&useSSL=true
spring.datasource.username=radmin spring.datasource.username=admin
spring.datasource.password=DBMgr_2022 spring.datasource.password=DBMgr_2022
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.jpa.properties.hibernate.hbm2ddl.auto=update spring.jpa.properties.hibernate.hbm2ddl.auto=update

View File

@ -60,6 +60,13 @@ CREATE TABLE IF NOT EXISTS `gnssdevices` (
`ipose` double DEFAULT NULL COMMENT '初始位置东E', `ipose` double DEFAULT NULL COMMENT '初始位置东E',
`iposn` double DEFAULT NULL COMMENT '初始位置北N', `iposn` double DEFAULT NULL COMMENT '初始位置北N',
`iposd` double DEFAULT NULL COMMENT '初始位置天D', `iposd` double DEFAULT NULL COMMENT '初始位置天D',
`ecefx` double DEFAULT NULL COMMENT '初始位置X',
`ecefy` double DEFAULT NULL COMMENT '初始位置Y',
`ecefz` double DEFAULT NULL COMMENT '初始位置Z',
`section` varchar(64) DEFAULT NULL COMMENT '桩号',
`appver` varchar(16) DEFAULT NULL COMMENT '固件版本',
`imei` varchar(16) DEFAULT NULL,
`model` smallint DEFAULT 0,
PRIMARY KEY (`id`) PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

View File

@ -85,22 +85,26 @@
form = layui.form, form = layui.form,
table = layui.table; table = layui.table;
var cfg_cols = [ var cfg_cols = [
{field: 'deviceid', title: '设备号', sort: true}, {field: 'deviceid', title: '设备号', width: 100, sort: true},
{field: 'name', title: '设备名称'}, {field: 'project_id', title: '项目号', width: 120, sort: true},
{field: 'devicetype', title: '类型',templet: '#typeTrans'}, {field: 'sector', title: '桩号', width: 120, sort: true},
{field: 'parentid', title: '基站编号', sort: true}, {field: 'name', title: '设备名称', width: 80},
{field: 'tenantname', title: '所属组织'}, {field: 'devicetype', title: '类型', width: 80,templet: '#typeTrans'},
{field: 'project_id', title: '项目号', sort: true}, {field: 'group_id', title: '基本参数组', width: 60, sort: true},
{field: 'group_id', title: '基本参数组', sort: true}, {field: 'calc_group_id', title: '解算参数组', width: 60, sort: true},
{field: 'calc_group_id', title: '解算参数组', sort: true}, {field: 'parentid', title: '基站编号', width: 80, sort: true},
{field: 'fwd_group_id', title: '推送组'}, {field: 'tenantname', title: '所属组织', width: 120},
{field: 'fwd_group_id2', title: '推送2'}, {field: 'fwd_group_id', title: '推送组', width: 80},
{field: 'opmode', title: '使用状态',templet: '#modeTrans'}, {field: 'fwd_group_id2', title: '推送2', width: 80},
{field: 'syn', title: '参数同步',templet: '#synTrans'}, {field: 'opmode', title: '使用状态', width: 80,templet: '#modeTrans'},
{title: '操作', toolbar: '#currentTableBar', align: "center", minWidth: 120} {field: 'syn', title: '参数同步', width: 80,templet: '#synTrans'},
{field: 'model', title: '型号', width: 80,templet: "<div>{{d.model==0?'G505':'G510'}}</div>"},
{field: 'appver', title: '固件版本', width: 80},
{field: 'imei', title: 'IMEI', width: 100},
{title: '操作', toolbar: '#currentTableBar', fixed: "right", width: 120}
]; ];
if([[${role}]] == "USER") { if([[${role}]] == "USER") {
cfg_cols[12].hide = true; cfg_cols[15].hide = true;
} }
/** /**
* 初始化表单,要加上,不然刷新部分组件可能会不加载 * 初始化表单,要加上,不然刷新部分组件可能会不加载

View File

@ -105,7 +105,7 @@
{field: 'satelliteinuse', title: '使用卫星数'}, {field: 'satelliteinuse', title: '使用卫星数'},
{field: 'longitude', title: '经度'}, {field: 'longitude', title: '经度'},
{field: 'latitude', title: '纬度'}, {field: 'latitude', title: '纬度'},
{title: '操作', toolbar: '#currentTableBar', align: "center"} {title: '操作', toolbar: '#currentTableBar', fixed: "right", width: 80}
]; ];
/** /**
* 初始化表单,要加上,不然刷新部分组件可能会不加载 * 初始化表单,要加上,不然刷新部分组件可能会不加载

View File

@ -25,9 +25,13 @@
</div> </div>
</div> </div>
<div class="layui-inline"> <div class="layui-inline">
<label class="layui-form-label required">设备名称</label> <label class="layui-form-label required">使用状态</label>
<div class="layui-input-block"> <div class="layui-input-inline">
<input type="text" name="name" id="name" placeholder="请输入设备名称" value="" class="layui-input"> <select name="opmode" id="opmode" lay-verify="required" lay-search="">
<option value="0">正常</option>
<option value="1">维护</option>
<option value="2">停用</option>
</select>
</div> </div>
</div> </div>
</div> </div>
@ -35,7 +39,7 @@
<div class="layui-inline"> <div class="layui-inline">
<label class="layui-form-label required">设备类型</label> <label class="layui-form-label required">设备类型</label>
<div class="layui-input-inline"> <div class="layui-input-inline">
<select name="devicetype" id="devicetype" lay-verify="required" lay-search=""> <select name="devicetype" id="devicetype" lay-verify="required" lay-search="" lay-filter="device_type">
<option value="0">监测站</option> <option value="0">监测站</option>
<option value="1">基准站</option> <option value="1">基准站</option>
</select> </select>
@ -47,8 +51,35 @@
<input type="number" name="parentid" id="parentid" placeholder="请输入关联基准站编号" value="" class="layui-input"> <input type="number" name="parentid" id="parentid" placeholder="请输入关联基准站编号" value="" class="layui-input">
</div> </div>
</div> </div>
<div class="layui-inline">
<label class="layui-form-label required">型号</label>
<div class="layui-input-inline">
<select name="model" id="model" lay-verify="required" lay-search="" lay-filter="device_model">
<option value="0">G505</option>
<option value="1">G510</option>
</select>
</div>
</div>
</div>
<div class="layui-form-item" id="ecef_div">
<div class="layui-inline">
<label class="layui-form-label">ECEF X</label>
<div class="layui-input-block">
<input type="text" name="ecefx" id="ecefx" class="layui-input">
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label">Y</label>
<div class="layui-input-block">
<input type="text" name="ecefy" id="ecefy" class="layui-input">
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label">Z</label>
<div class="layui-input-block">
<input type="text" name="ecefz" id="ecefz" class="layui-input">
</div>
</div>
</div> </div>
<div class="layui-form-item"> <div class="layui-form-item">
<div class="layui-inline"> <div class="layui-inline">
@ -68,6 +99,8 @@
</div> </div>
</div> </div>
</div> </div>
<hr>
<div class="layui-form-item"> <div class="layui-form-item">
<div class="layui-inline"> <div class="layui-inline">
<label class="layui-form-label required">所属部门</label> <label class="layui-form-label required">所属部门</label>
@ -92,13 +125,15 @@
</div> </div>
<div class="layui-form-item"> <div class="layui-form-item">
<div class="layui-inline"> <div class="layui-inline">
<label class="layui-form-label required">使用状态</label> <label class="layui-form-label required">断面</label>
<div class="layui-input-inline"> <div class="layui-input-block">
<select name="opmode" id="opmode" lay-verify="required" lay-search=""> <input type="text" name="sector" id="sector" value="" class="layui-input">
<option value="0">正常</option> </div>
<option value="1">维护</option> </div>
<option value="2">停用</option> <div class="layui-inline">
</select> <label class="layui-form-label required">工点名称</label>
<div class="layui-input-block">
<input type="text" name="name" id="name" value="" class="layui-input">
</div> </div>
</div> </div>
</div> </div>
@ -150,7 +185,6 @@
</div> </div>
</div> </div>
</div> </div>
<hr> <hr>
<div class="layui-form-item"> <div class="layui-form-item">
<div class="layui-input-block" style="float:right" > <div class="layui-input-block" style="float:right" >
@ -210,9 +244,26 @@
return false; return false;
}); });
form.on('select(device_type)', function (data) {
setEcefEditor();
});
form.on('select(device_model)', function (data) {
setEcefEditor();
});
}); });
function setEcefEditor(){
var $ = layui.$;
console.log($('#devicetype').val(), $('#model').val());
if($('#devicetype').val()==1 && $('#model').val()==1){
$('#ecef_div').show();
}
else {
$('#ecef_div').hide();
}
}
function setParams(data){ function setParams(data){
var form = layui.form, var form = layui.form,
$ = layui.$; $ = layui.$;
@ -234,6 +285,12 @@
$('#ipose').val(data.ipose); $('#ipose').val(data.ipose);
$('#iposn').val(data.iposn); $('#iposn').val(data.iposn);
$('#iposd').val(data.iposd); $('#iposd').val(data.iposd);
$('#ecefx').val(data.ecefx);
$('#ecefy').val(data.ecefy);
$('#ecefz').val(data.ecefz);
$('#model').val(data.model);
$('#sector').val(data.sector);
setEcefEditor();
form.render(); form.render();
} }
</script> </script>