|
|
@@ -5,6 +5,7 @@ using YSAI.Core.@interface;
|
|
|
using YSAI.Core.subscription;
|
|
|
using YSAI.Core.virtualAddress;
|
|
|
using YSAI.Unility;
|
|
|
+using static YSAI.Unility.ReflexTool;
|
|
|
|
|
|
namespace YSAI.Can
|
|
|
{
|
|
|
@@ -456,5 +457,109 @@ namespace YSAI.Can
|
|
|
{
|
|
|
return Task.Run(() => GetStatus());
|
|
|
}
|
|
|
+
|
|
|
+ public OperateResult GetParam()
|
|
|
+ {
|
|
|
+ string SN = Depart("GetParam");
|
|
|
+ try
|
|
|
+ {
|
|
|
+ //通过反射得到参数信息
|
|
|
+ List<LibInstanceParam>? libInstanceParams = ReflexTool.GetClassAllPropertyData<CanData.Basics>();
|
|
|
+ string message = TAG.Replace("Operate", string.Empty);
|
|
|
+ string nameSpace = "YSAI.Beckhoff.CanOperate";
|
|
|
+ CanData.Basics beckhoffData = new CanData.Basics();
|
|
|
+ LibParamStructure? libParamStructure = new LibParamStructure()
|
|
|
+ {
|
|
|
+ Code = message,
|
|
|
+ Name = message,
|
|
|
+ Description = message,
|
|
|
+ Subset = new List<LibParamStructure.subset>
|
|
|
+ {
|
|
|
+ new LibParamStructure.subset
|
|
|
+ {
|
|
|
+ Description = message,
|
|
|
+ Name = message,
|
|
|
+ Propertie = new List<LibParamStructure.subset.propertie>()
|
|
|
+ }
|
|
|
+ }
|
|
|
+ };
|
|
|
+ libParamStructure.Subset[0].Propertie.Add(new LibParamStructure.subset.propertie
|
|
|
+ {
|
|
|
+ PropertyName = "ServiceName",
|
|
|
+ Description = "实现类名",
|
|
|
+ IsShow = false,
|
|
|
+ IsMust = false,
|
|
|
+ Value = nameSpace,
|
|
|
+ DataCate = LibParamStructure.subset.propertie.dataCate.text
|
|
|
+ });
|
|
|
+ foreach (var lib in libInstanceParams)
|
|
|
+ {
|
|
|
+ string param = ReflexTool.GetModelValue(lib.Name, beckhoffData);
|
|
|
+ LibParamStructure.subset.propertie propertie = new LibParamStructure.subset.propertie
|
|
|
+ {
|
|
|
+ PropertyName = lib.Name,
|
|
|
+ Description = lib.Describe,
|
|
|
+ IsShow = true,
|
|
|
+ Default = param,
|
|
|
+ Value = param
|
|
|
+ };
|
|
|
+
|
|
|
+ switch (lib.ParamType)
|
|
|
+ {
|
|
|
+ case "Enum":
|
|
|
+ propertie.DataCate = LibParamStructure.subset.propertie.dataCate.select;
|
|
|
+ propertie.Options = new List<LibParamStructure.subset.propertie.options>();
|
|
|
+ foreach (var val in lib.EnumArray as List<dynamic>)
|
|
|
+ {
|
|
|
+ string des = val.Describe;
|
|
|
+ if (!string.IsNullOrEmpty(des))
|
|
|
+ {
|
|
|
+ des = $"({val.Describe})";
|
|
|
+ }
|
|
|
+ propertie.Options.Add(new LibParamStructure.subset.propertie.options
|
|
|
+ {
|
|
|
+ Key = val.Name + des,
|
|
|
+ Value = val.Value,
|
|
|
+ });
|
|
|
+ }
|
|
|
+ break;
|
|
|
+
|
|
|
+ case "Int32":
|
|
|
+ propertie.DataCate = LibParamStructure.subset.propertie.dataCate.unmber;
|
|
|
+ break;
|
|
|
+
|
|
|
+ case "String":
|
|
|
+ propertie.DataCate = LibParamStructure.subset.propertie.dataCate.text;
|
|
|
+ break;
|
|
|
+
|
|
|
+ case "Boolean":
|
|
|
+ propertie.DataCate = LibParamStructure.subset.propertie.dataCate.radio;
|
|
|
+ propertie.Options = new List<LibParamStructure.subset.propertie.options>();
|
|
|
+ propertie.Options.Add(new LibParamStructure.subset.propertie.options
|
|
|
+ {
|
|
|
+ Key = "是",
|
|
|
+ Value = true,
|
|
|
+ });
|
|
|
+ propertie.Options.Add(new LibParamStructure.subset.propertie.options
|
|
|
+ {
|
|
|
+ Key = "否",
|
|
|
+ Value = false,
|
|
|
+ });
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ libParamStructure.Subset[0].Propertie.Add(propertie);
|
|
|
+ }
|
|
|
+ return Break(SN, true, libParamStructure.ToJson().JsonFormatting(), libParamStructure, Core.@enum.ResultType.Object);
|
|
|
+ }
|
|
|
+ catch (Exception ex)
|
|
|
+ {
|
|
|
+ return Break(SN, false, ex.Message, Exception: ex);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ public Task<OperateResult> GetParamAsync()
|
|
|
+ {
|
|
|
+ return Task.Run(() => GetParam());
|
|
|
+ }
|
|
|
}
|
|
|
}
|