|
|
|
|
using Aspose.Cells;
|
|
|
|
|
using Newtonsoft.Json;
|
|
|
|
|
using Prism.Mvvm;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Data;
|
|
|
|
|
using System.IO;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
|
|
|
|
namespace StartServerWPF.Models
|
|
|
|
|
{
|
|
|
|
|
public class ApmsModel : BindableBase
|
|
|
|
|
{
|
|
|
|
|
private string station1;
|
|
|
|
|
private List<TTime> ttime1;
|
|
|
|
|
private string push2wx1;
|
|
|
|
|
private string savepath1;
|
|
|
|
|
private string xmin1;
|
|
|
|
|
private string xmax1;
|
|
|
|
|
private string ymin1;
|
|
|
|
|
private string ymax1;
|
|
|
|
|
private string zref1;
|
|
|
|
|
private string zmin1;
|
|
|
|
|
private string zmax1;
|
|
|
|
|
private string minstep1;
|
|
|
|
|
private List<StationChannelsModel> channels1;
|
|
|
|
|
|
|
|
|
|
[JsonProperty("station")]
|
|
|
|
|
public string station { get => station1; set => SetProperty(ref station1, value); }
|
|
|
|
|
[JsonProperty("ttime")]
|
|
|
|
|
public List<TTime> ttime { get => ttime1; set => SetProperty(ref ttime1, value); }
|
|
|
|
|
[JsonProperty("Main.log_level")]
|
|
|
|
|
public string log_level { get; set; }
|
|
|
|
|
[JsonProperty("Main.slice_seconds")]
|
|
|
|
|
public string slice_seconds { get; set; }
|
|
|
|
|
[JsonProperty("Main.overlap_seconds")]
|
|
|
|
|
public string overlap_seconds { get; set; }
|
|
|
|
|
[JsonProperty("Main.is_mag")]
|
|
|
|
|
public string is_mag { get; set; }
|
|
|
|
|
[JsonProperty("Main.is_write_slice")]
|
|
|
|
|
public string is_write_slice { get; set; }
|
|
|
|
|
[JsonProperty("Main.lon")]
|
|
|
|
|
public string lon { get; set; }
|
|
|
|
|
[JsonProperty("Main.lat")]
|
|
|
|
|
public string lat { get; set; }
|
|
|
|
|
[JsonProperty("Main.height")]
|
|
|
|
|
public string height { get; set; }
|
|
|
|
|
[JsonProperty("Main.savepath")]
|
|
|
|
|
public string savepath { get => savepath1; set => SetProperty(ref savepath1, value); }
|
|
|
|
|
[JsonProperty("Main.push2wx")]
|
|
|
|
|
public string push2wx { get => push2wx1; set => SetProperty(ref push2wx1, value); }
|
|
|
|
|
[JsonProperty("Main.push_url")]
|
|
|
|
|
public string push_url { get; set; }
|
|
|
|
|
[JsonProperty("Main.push_mag")]
|
|
|
|
|
public string push_mag { get; set; }
|
|
|
|
|
[JsonProperty("Main.message_id")]
|
|
|
|
|
public string message_id { get; set; }
|
|
|
|
|
[JsonProperty("Main.company_id")]
|
|
|
|
|
public string company_id { get; set; }
|
|
|
|
|
[JsonProperty("Main.area_id")]
|
|
|
|
|
public string area_id { get; set; }
|
|
|
|
|
[JsonProperty("Main.content")]
|
|
|
|
|
public string content { get; set; }
|
|
|
|
|
[JsonProperty("Main.push_key")]
|
|
|
|
|
public string push_key { get; set; }
|
|
|
|
|
[JsonProperty("RServer.host")]
|
|
|
|
|
public string host { get; set; }
|
|
|
|
|
public List<StationChannelsModel> channels { get => channels1; set => SetProperty(ref channels1, value); }
|
|
|
|
|
|
|
|
|
|
[JsonProperty("Locate.log_level")]
|
|
|
|
|
public string llog_level { get; set; }
|
|
|
|
|
[JsonProperty("Locate.work_path")]
|
|
|
|
|
public string work_path { get; set; }
|
|
|
|
|
[JsonProperty("Locate.xmin")]
|
|
|
|
|
public string xmin { get => xmin1; set => SetProperty(ref xmin1, value); }
|
|
|
|
|
[JsonProperty("Locate.xmax")]
|
|
|
|
|
public string xmax { get => xmax1; set => SetProperty(ref xmax1, value); }
|
|
|
|
|
[JsonProperty("Locate.ymin")]
|
|
|
|
|
public string ymin { get => ymin1; set => SetProperty(ref ymin1, value); }
|
|
|
|
|
[JsonProperty("Locate.ymax")]
|
|
|
|
|
public string ymax { get => ymax1; set => SetProperty(ref ymax1, value); }
|
|
|
|
|
[JsonProperty("Locate.zref")]
|
|
|
|
|
public string zref { get => zref1; set => SetProperty(ref zref1, value); }
|
|
|
|
|
[JsonProperty("Locate.zmin")]
|
|
|
|
|
public string zmin { get => zmin1; set => SetProperty(ref zmin1, value); }
|
|
|
|
|
[JsonProperty("Locate.zmax")]
|
|
|
|
|
public string zmax { get => zmax1; set => SetProperty(ref zmax1, value); }
|
|
|
|
|
[JsonProperty("Locate.minstep")]
|
|
|
|
|
public string minstep { get => minstep1; set => SetProperty(ref minstep1, value); }
|
|
|
|
|
[JsonProperty("Locate.method")]
|
|
|
|
|
public string method { get; set; }
|
|
|
|
|
[JsonProperty("Locate.clusted_otime")]
|
|
|
|
|
public string clusted_otime { get; set; }
|
|
|
|
|
|
|
|
|
|
// public string delaytime { get; set; }
|
|
|
|
|
public List<StationControlModel> CreateStationFromCSV(string fn)
|
|
|
|
|
{
|
|
|
|
|
if (!File.Exists(fn)) return null;
|
|
|
|
|
List<StationControlModel> stations = new List<StationControlModel>();
|
|
|
|
|
Aspose.Cells.TxtLoadOptions lo = new TxtLoadOptions();
|
|
|
|
|
lo.Encoding = Encoding.Default;//设置编码方式
|
|
|
|
|
Workbook workbook = new Workbook(fn, lo);
|
|
|
|
|
|
|
|
|
|
//配置读取文件的类型(CSV)
|
|
|
|
|
workbook.FileFormat = FileFormatType.Csv;//可在此配置Excel文件类型
|
|
|
|
|
Worksheet worksheet = workbook.Worksheets[0];//默认第一个Sheet页
|
|
|
|
|
|
|
|
|
|
Cells cells = worksheet.Cells;
|
|
|
|
|
|
|
|
|
|
//读取到DataTable中
|
|
|
|
|
DataTable dt = cells.ExportDataTableAsString(0, 0, cells.MaxDataRow + 1, cells.MaxColumn + 1, true);
|
|
|
|
|
for (int i = 0; i < dt.Rows.Count; i++)
|
|
|
|
|
{
|
|
|
|
|
DataRow row = dt.Rows[i];
|
|
|
|
|
StationControlModel model = new StationControlModel();
|
|
|
|
|
model.NetWork = row[0].ToString();
|
|
|
|
|
model.Num = row[1].ToString();
|
|
|
|
|
model.Coordinate = new Coordinate3D(double.Parse(row[2].ToString()), double.Parse(row[3].ToString()), double.Parse(row[4].ToString()));
|
|
|
|
|
model.Sens = double.Parse(row[5].ToString());
|
|
|
|
|
model.BeginUseTime = DateTime.Parse(row[6].ToString());
|
|
|
|
|
model.StopUseTime = DateTime.Parse(row[7].ToString());
|
|
|
|
|
// model.Location = this.StationConfig.Location;
|
|
|
|
|
stations.Add(model);
|
|
|
|
|
}
|
|
|
|
|
//释放资源
|
|
|
|
|
workbook = null;
|
|
|
|
|
worksheet = null;
|
|
|
|
|
return stations;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public class TTime : BindableBase
|
|
|
|
|
{
|
|
|
|
|
private string ttime2d1;
|
|
|
|
|
|
|
|
|
|
[JsonProperty("station")]
|
|
|
|
|
public string station { get; set; }
|
|
|
|
|
|
|
|
|
|
[JsonProperty("ttime")]
|
|
|
|
|
public string ttime { get; set; }
|
|
|
|
|
|
|
|
|
|
[JsonProperty("ttime2d")]
|
|
|
|
|
public string ttime2d { get => ttime2d1;
|
|
|
|
|
set => SetProperty(ref ttime2d1, value);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
public class StationChannelsModel : BindableBase
|
|
|
|
|
{
|
|
|
|
|
private string station1;
|
|
|
|
|
|
|
|
|
|
public string network { get; set; }
|
|
|
|
|
|
|
|
|
|
public string location { get; set; }
|
|
|
|
|
|
|
|
|
|
public string channels { get; set; }
|
|
|
|
|
|
|
|
|
|
public string station { get => station1;
|
|
|
|
|
set => SetProperty(ref station1, value);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|