JSON 转化为LIST
string text = System.IO.File.ReadAllText("./temp/SPCConfig.json");
List<SPCConfigEntityInfo> all = Newtonsoft.Json.JsonConvert.DeserializeObject<List<SPCConfigEntityInfo>>(text);
public class SPCConfigEntityInfo
{
public int SPCID { get; set; }
public string Name { get; set; }
public string FilePath { get; set; }
public bool AllowSkip { get; set; }
public bool Skip { get; set; }
public bool ReadByPLC { get; set; }
public List<SPCParameter> Parameters { get; set; }
}
public class SPCParameter
{
public float UpperLimit { get; set; }
public float LowLimit { get; set; }
public float BaseValue { get; set; }
public int[] Pos { get; set; }
public int SortGroup { get; set; }
public List<string> SortNr { get; set; }
}
[{"SPCID":14,"Name":"涂胶称重","FilePath":"C:\\Users\\IPC\\Documents\\MahrResult\\F3180300747.txt","AllowSkip":false,"Skip":false,"ReadByPLC":false,"Parameters":[{"UpperLimit":100.0,"LowLimit":0.0,"BaseValue":0.0,"Pos":[1],"SortGroup":1,"SortNr":["00001","01201","01202","01203","01204","01205","01206","01207","01510"]},{"UpperLimit":100.0,"LowLimit":0.0,"BaseValue":0.0,"Pos":[1],"SortGroup":2,"SortNr":["01503","01508","01517","01518","01520"]}]},{"SPCID":14,"Name":"涂胶称重","FilePath":"C:\\Users\\IPC\\Documents\\MahrResult\\F3180300748.txt","AllowSkip":false,"Skip":false,"ReadByPLC":false,"Parameters":[{"UpperLimit":100.0,"LowLimit":0.0,"BaseValue":0.0,"Pos":[1],"SortGroup":1,"SortNr":["00001","01201","01202","01203","01204","01205","01206","01207","01510"]},{"UpperLimit":100.0,"LowLimit":0.0,"BaseValue":0.0,"Pos":[1],"SortGroup":1,"SortNr":["00001","01201","01202","01203","01204","01205","01206","01207","01510"]}]}]