mirror of
https://github.com/MickMake/GoSungrow.git
synced 2025-04-01 00:18:23 +02:00
v3.0.0-alpha - tidy up/docs
This commit is contained in:
parent
cd52de490f
commit
583f6f16dc
141
.idea/workspace.xml
generated
141
.idea/workspace.xml
generated
@ -6,27 +6,11 @@
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="76adadc9-ae71-42a6-82a1-66dbc8ecb14c" name="Changes" comment="">
|
||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/iSolarCloud/AppService/getDevicePointMinuteDataList/data.go" beforeDir="false" afterPath="$PROJECT_DIR$/iSolarCloud/AppService/getDevicePointMinuteDataList/data.go" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/iSolarCloud/AppService/getReportData/data.go" beforeDir="false" afterPath="$PROJECT_DIR$/iSolarCloud/AppService/getReportData/data.go" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/iSolarCloud/AppService/getUpTimePoint/data.go" beforeDir="false" afterPath="$PROJECT_DIR$/iSolarCloud/AppService/getUpTimePoint/data.go" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/iSolarCloud/AppService/queryDeviceList/data.go" beforeDir="false" afterPath="$PROJECT_DIR$/iSolarCloud/AppService/queryDeviceList/data.go" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/iSolarCloud/AppService/queryDeviceListForApp/data.go" beforeDir="false" afterPath="$PROJECT_DIR$/iSolarCloud/AppService/queryDeviceListForApp/data.go" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/iSolarCloud/AppService/queryMutiPointDataList/data.go" beforeDir="false" afterPath="$PROJECT_DIR$/iSolarCloud/AppService/queryMutiPointDataList/data.go" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/iSolarCloud/AppService/queryPsProfit/data.go" beforeDir="false" afterPath="$PROJECT_DIR$/iSolarCloud/AppService/queryPsProfit/data.go" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/iSolarCloud/AppService/queryUnitList/data.go" beforeDir="false" afterPath="$PROJECT_DIR$/iSolarCloud/AppService/queryUnitList/data.go" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/iSolarCloud/AppService/reportList/data.go" beforeDir="false" afterPath="$PROJECT_DIR$/iSolarCloud/AppService/reportList/data.go" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/iSolarCloud/WebIscmAppService/modelPointsPage/data.go" beforeDir="false" afterPath="$PROJECT_DIR$/iSolarCloud/WebIscmAppService/modelPointsPage/data.go" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/iSolarCloud/api/GoStruct/const.go" beforeDir="false" afterPath="$PROJECT_DIR$/iSolarCloud/api/GoStruct/const.go" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/iSolarCloud/api/GoStruct/output/struct_table.go" beforeDir="false" afterPath="$PROJECT_DIR$/iSolarCloud/api/GoStruct/output/struct_table.go" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/iSolarCloud/api/GoStruct/struct_reflect.go" beforeDir="false" afterPath="$PROJECT_DIR$/iSolarCloud/api/GoStruct/struct_reflect.go" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/iSolarCloud/AppService/queryDeviceInfoForApp/data.go" beforeDir="false" afterPath="$PROJECT_DIR$/iSolarCloud/AppService/queryDeviceInfoForApp/data.go" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/iSolarCloud/api/GoStruct/structmap.go" beforeDir="false" afterPath="$PROJECT_DIR$/iSolarCloud/api/GoStruct/structmap.go" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/iSolarCloud/api/GoStruct/valueTypes/datetime.go" beforeDir="false" afterPath="$PROJECT_DIR$/iSolarCloud/api/GoStruct/valueTypes/datetime.go" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/iSolarCloud/api/GoStruct/valueTypes/float.go" beforeDir="false" afterPath="$PROJECT_DIR$/iSolarCloud/api/GoStruct/valueTypes/float.go" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/iSolarCloud/api/GoStruct/valueTypes/integers.go" beforeDir="false" afterPath="$PROJECT_DIR$/iSolarCloud/api/GoStruct/valueTypes/integers.go" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/iSolarCloud/api/GoStruct/valueTypes/types.go" beforeDir="false" afterPath="$PROJECT_DIR$/iSolarCloud/api/GoStruct/valueTypes/types.go" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/iSolarCloud/api/GoStruct/valueTypes/uv.go" beforeDir="false" afterPath="$PROJECT_DIR$/iSolarCloud/api/GoStruct/valueTypes/uv.go" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/iSolarCloud/api/struct_data.go" beforeDir="false" afterPath="$PROJECT_DIR$/iSolarCloud/api/struct_data.go" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/iSolarCloud/data_request.go" beforeDir="false" afterPath="$PROJECT_DIR$/iSolarCloud/data_request.go" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/iSolarCloud/data.go" beforeDir="false" afterPath="$PROJECT_DIR$/iSolarCloud/data.go" afterDir="false" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
@ -100,7 +84,7 @@
|
||||
<configuration name="GoSungrow" type="GoApplicationRunConfiguration" factoryName="Go Application">
|
||||
<module name="GoSungrow" />
|
||||
<working_directory value="$PROJECT_DIR$" />
|
||||
<parameters value="data table AppService.getPowerDevicePointNames DeviceType:14" />
|
||||
<parameters value="data list AppService.getSysMsg" />
|
||||
<envs>
|
||||
<env name="GOCACHE" value="/Volumes/Media/GoCache" />
|
||||
</envs>
|
||||
@ -344,17 +328,12 @@
|
||||
</line-breakpoint>
|
||||
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
|
||||
<url>file://$PROJECT_DIR$/iSolarCloud/api/struct_data.go</url>
|
||||
<line>410</line>
|
||||
<line>407</line>
|
||||
<option name="timeStamp" value="3848" />
|
||||
</line-breakpoint>
|
||||
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
|
||||
<url>file://$PROJECT_DIR$/iSolarCloud/data.go</url>
|
||||
<line>76</line>
|
||||
<option name="timeStamp" value="3872" />
|
||||
</line-breakpoint>
|
||||
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
|
||||
<url>file://$PROJECT_DIR$/iSolarCloud/data.go</url>
|
||||
<line>64</line>
|
||||
<line>91</line>
|
||||
<option name="timeStamp" value="3875" />
|
||||
</line-breakpoint>
|
||||
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
|
||||
@ -369,7 +348,7 @@
|
||||
</line-breakpoint>
|
||||
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
|
||||
<url>file://$PROJECT_DIR$/iSolarCloud/data.go</url>
|
||||
<line>68</line>
|
||||
<line>95</line>
|
||||
<option name="timeStamp" value="4070" />
|
||||
</line-breakpoint>
|
||||
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
|
||||
@ -429,7 +408,7 @@
|
||||
</line-breakpoint>
|
||||
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
|
||||
<url>file://$PROJECT_DIR$/iSolarCloud/api/GoStruct/structmap.go</url>
|
||||
<line>127</line>
|
||||
<line>128</line>
|
||||
<option name="timeStamp" value="4518" />
|
||||
</line-breakpoint>
|
||||
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
|
||||
@ -464,17 +443,17 @@
|
||||
</line-breakpoint>
|
||||
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
|
||||
<url>file://$PROJECT_DIR$/iSolarCloud/api/GoStruct/structmap.go</url>
|
||||
<line>116</line>
|
||||
<line>117</line>
|
||||
<option name="timeStamp" value="5494" />
|
||||
</line-breakpoint>
|
||||
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
|
||||
<url>file://$PROJECT_DIR$/iSolarCloud/api/GoStruct/structmap.go</url>
|
||||
<line>120</line>
|
||||
<line>121</line>
|
||||
<option name="timeStamp" value="5495" />
|
||||
</line-breakpoint>
|
||||
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
|
||||
<url>file://$PROJECT_DIR$/iSolarCloud/api/GoStruct/structmap.go</url>
|
||||
<line>112</line>
|
||||
<line>113</line>
|
||||
<option name="timeStamp" value="5496" />
|
||||
</line-breakpoint>
|
||||
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
|
||||
@ -489,14 +468,9 @@
|
||||
</line-breakpoint>
|
||||
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
|
||||
<url>file://$PROJECT_DIR$/iSolarCloud/data.go</url>
|
||||
<line>245</line>
|
||||
<line>263</line>
|
||||
<option name="timeStamp" value="5709" />
|
||||
</line-breakpoint>
|
||||
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
|
||||
<url>file://$PROJECT_DIR$/iSolarCloud/api/struct_data.go</url>
|
||||
<line>111</line>
|
||||
<option name="timeStamp" value="5732" />
|
||||
</line-breakpoint>
|
||||
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
|
||||
<url>file://$PROJECT_DIR$/iSolarCloud/api/GoStruct/struct_reflect.go</url>
|
||||
<line>855</line>
|
||||
@ -507,26 +481,11 @@
|
||||
<line>864</line>
|
||||
<option name="timeStamp" value="5786" />
|
||||
</line-breakpoint>
|
||||
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
|
||||
<url>file://$PROJECT_DIR$/iSolarCloud/data.go</url>
|
||||
<line>81</line>
|
||||
<option name="timeStamp" value="5861" />
|
||||
</line-breakpoint>
|
||||
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
|
||||
<url>file://$PROJECT_DIR$/iSolarCloud/api/struct_data.go</url>
|
||||
<line>78</line>
|
||||
<line>85</line>
|
||||
<option name="timeStamp" value="5873" />
|
||||
</line-breakpoint>
|
||||
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
|
||||
<url>file://$PROJECT_DIR$/iSolarCloud/api/struct_data.go</url>
|
||||
<line>94</line>
|
||||
<option name="timeStamp" value="5875" />
|
||||
</line-breakpoint>
|
||||
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
|
||||
<url>file://$PROJECT_DIR$/iSolarCloud/api/struct_data.go</url>
|
||||
<line>101</line>
|
||||
<option name="timeStamp" value="5886" />
|
||||
</line-breakpoint>
|
||||
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
|
||||
<url>file://$PROJECT_DIR$/iSolarCloud/api/GoStruct/struct_reflect.go</url>
|
||||
<line>817</line>
|
||||
@ -534,7 +493,7 @@
|
||||
</line-breakpoint>
|
||||
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
|
||||
<url>file://$PROJECT_DIR$/iSolarCloud/api/GoStruct/structmap.go</url>
|
||||
<line>147</line>
|
||||
<line>148</line>
|
||||
<option name="timeStamp" value="5911" />
|
||||
</line-breakpoint>
|
||||
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
|
||||
@ -544,22 +503,22 @@
|
||||
</line-breakpoint>
|
||||
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
|
||||
<url>file://$PROJECT_DIR$/iSolarCloud/api/GoStruct/structmap.go</url>
|
||||
<line>143</line>
|
||||
<line>144</line>
|
||||
<option name="timeStamp" value="5931" />
|
||||
</line-breakpoint>
|
||||
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
|
||||
<url>file://$PROJECT_DIR$/iSolarCloud/data.go</url>
|
||||
<line>260</line>
|
||||
<line>278</line>
|
||||
<option name="timeStamp" value="5954" />
|
||||
</line-breakpoint>
|
||||
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
|
||||
<url>file://$PROJECT_DIR$/iSolarCloud/data.go</url>
|
||||
<line>316</line>
|
||||
<line>334</line>
|
||||
<option name="timeStamp" value="5956" />
|
||||
</line-breakpoint>
|
||||
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
|
||||
<url>file://$PROJECT_DIR$/iSolarCloud/data.go</url>
|
||||
<line>250</line>
|
||||
<line>268</line>
|
||||
<option name="timeStamp" value="5957" />
|
||||
</line-breakpoint>
|
||||
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
|
||||
@ -569,7 +528,7 @@
|
||||
</line-breakpoint>
|
||||
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
|
||||
<url>file://$PROJECT_DIR$/iSolarCloud/api/struct_data.go</url>
|
||||
<line>414</line>
|
||||
<line>411</line>
|
||||
<option name="timeStamp" value="6019" />
|
||||
</line-breakpoint>
|
||||
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
|
||||
@ -632,60 +591,30 @@
|
||||
<line>291</line>
|
||||
<option name="timeStamp" value="6115" />
|
||||
</line-breakpoint>
|
||||
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
|
||||
<url>file://$PROJECT_DIR$/iSolarCloud/api/GoStruct/structmap.go</url>
|
||||
<line>388</line>
|
||||
<option name="timeStamp" value="6121" />
|
||||
</line-breakpoint>
|
||||
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
|
||||
<url>file://$PROJECT_DIR$/iSolarCloud/api/GoStruct/structmap.go</url>
|
||||
<line>995</line>
|
||||
<option name="timeStamp" value="6127" />
|
||||
</line-breakpoint>
|
||||
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
|
||||
<url>file://$PROJECT_DIR$/iSolarCloud/api/struct_data.go</url>
|
||||
<line>108</line>
|
||||
<option name="timeStamp" value="6132" />
|
||||
</line-breakpoint>
|
||||
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
|
||||
<url>file://$PROJECT_DIR$/iSolarCloud/api/struct_data.go</url>
|
||||
<line>106</line>
|
||||
<option name="timeStamp" value="6134" />
|
||||
</line-breakpoint>
|
||||
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
|
||||
<url>file://$PROJECT_DIR$/iSolarCloud/api/GoStruct/structmap.go</url>
|
||||
<line>921</line>
|
||||
<option name="timeStamp" value="6142" />
|
||||
</line-breakpoint>
|
||||
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
|
||||
<url>file://$PROJECT_DIR$/iSolarCloud/api/GoStruct/structmap.go</url>
|
||||
<line>926</line>
|
||||
<option name="timeStamp" value="6143" />
|
||||
</line-breakpoint>
|
||||
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
|
||||
<url>file://$PROJECT_DIR$/iSolarCloud/api/struct_data.go</url>
|
||||
<line>100</line>
|
||||
<option name="timeStamp" value="6161" />
|
||||
</line-breakpoint>
|
||||
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
|
||||
<url>file://$PROJECT_DIR$/iSolarCloud/api/GoStruct/struct_reflect.go</url>
|
||||
<line>908</line>
|
||||
<option name="timeStamp" value="6166" />
|
||||
</line-breakpoint>
|
||||
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
|
||||
<url>file://$PROJECT_DIR$/iSolarCloud/api/GoStruct/struct_reflect.go</url>
|
||||
<line>606</line>
|
||||
<option name="timeStamp" value="6186" />
|
||||
</line-breakpoint>
|
||||
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
|
||||
<url>file://$PROJECT_DIR$/iSolarCloud/api/struct_data.go</url>
|
||||
<line>173</line>
|
||||
<option name="timeStamp" value="6198" />
|
||||
<url>file://$PROJECT_DIR$/iSolarCloud/api/GoStruct/structmap.go</url>
|
||||
<line>389</line>
|
||||
<option name="timeStamp" value="6202" />
|
||||
</line-breakpoint>
|
||||
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
|
||||
<url>file://$PROJECT_DIR$/iSolarCloud/api/GoStruct/structmap.go</url>
|
||||
<line>1029</line>
|
||||
<option name="timeStamp" value="6221" />
|
||||
</line-breakpoint>
|
||||
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
|
||||
<url>file://$PROJECT_DIR$/iSolarCloud/data.go</url>
|
||||
<line>62</line>
|
||||
<option name="timeStamp" value="6229" />
|
||||
</line-breakpoint>
|
||||
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
|
||||
<url>file://$PROJECT_DIR$/iSolarCloud/api/struct_data.go</url>
|
||||
<line>166</line>
|
||||
<option name="timeStamp" value="6200" />
|
||||
<line>90</line>
|
||||
<option name="timeStamp" value="6233" />
|
||||
</line-breakpoint>
|
||||
</breakpoints>
|
||||
<default-breakpoints>
|
||||
@ -694,8 +623,8 @@
|
||||
</breakpoint-manager>
|
||||
<watches-manager>
|
||||
<configuration name="GoApplicationRunConfiguration">
|
||||
<watch expression="de.Current.DataStructure.DataTable" language="go" />
|
||||
<watch expression="de.Current.DataStructure.DataTableChild" language="go" />
|
||||
<watch expression="Current.FieldPath" language="go" />
|
||||
<watch expression="Current.Value" language="go" />
|
||||
</configuration>
|
||||
</watches-manager>
|
||||
</component>
|
||||
|
@ -27,17 +27,17 @@ func (rd RequestData) Help() string {
|
||||
|
||||
type ResultData struct {
|
||||
DeviceModelList []struct {
|
||||
ModelId valueTypes.Integer `json:"model_id"`
|
||||
DeviceModel valueTypes.String `json:"device_model"`
|
||||
DeviceModelCode valueTypes.String `json:"device_model_code"`
|
||||
ModelId valueTypes.Integer `json:"model_id"`
|
||||
} `json:"deviceModelList" PointId:"device_model_list" PointIdFromChild:"ModelId" PointArrayFlatten:"false" DataTable:"true"`
|
||||
DevicePropertyValueList []struct {
|
||||
UUID valueTypes.String `json:"uuid"`
|
||||
DeviceType valueTypes.Integer `json:"device_type"`
|
||||
PropertyCode valueTypes.Integer `json:"property_code"`
|
||||
PropertyDefVal valueTypes.String `json:"property_def_val"`
|
||||
PropertyName valueTypes.String `json:"property_name"`
|
||||
PropertyValue valueTypes.String `json:"property_value"`
|
||||
UUID valueTypes.String `json:"uuid"`
|
||||
PropertyDefVal valueTypes.String `json:"property_def_val"`
|
||||
} `json:"devicePropertyValueList" PointId:"device_property_value_list" PointArrayFlatten:"false" DataTable:"true"`
|
||||
|
||||
ArmVersion interface{} `json:"arm_version"`
|
||||
|
@ -8,6 +8,7 @@ import (
|
||||
"os"
|
||||
"reflect"
|
||||
"sort"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
@ -949,67 +950,7 @@ func (ta *StructTable) GetRow(row int) ReflectArrayRow {
|
||||
}
|
||||
|
||||
func (ta *StructTable) GetHeaders() []string {
|
||||
var ret []string
|
||||
|
||||
for range Only.Once {
|
||||
if !ta.IsValid {
|
||||
break
|
||||
}
|
||||
|
||||
for colIndex := range ta.Columns {
|
||||
header := ta.Reflects[0][colIndex]
|
||||
if header == nil {
|
||||
name := fmt.Sprintf("Column %d", colIndex)
|
||||
ret = append(ret, name)
|
||||
continue
|
||||
}
|
||||
|
||||
if len(header.ChildReflect) > 0 {
|
||||
for _, sub := range header.ChildReflect {
|
||||
name := header.DataStructure.PointName + " " + sub.DataStructure.PointName
|
||||
switch header.Value.Unit() {
|
||||
case "--":
|
||||
case "":
|
||||
default:
|
||||
name += " (" + sub.Value.Unit() + ")"
|
||||
}
|
||||
// ret = append(ret, sub.Value.KeysSorted()...)
|
||||
ret = append(ret, name)
|
||||
}
|
||||
continue
|
||||
}
|
||||
|
||||
if header.IsKnown() {
|
||||
name := header.DataStructure.PointName
|
||||
unit := header.Value.Unit()
|
||||
for _, n := range header.Value.KeysSorted() {
|
||||
if unit == "" {
|
||||
ret = append(ret, name + " " + n)
|
||||
continue
|
||||
}
|
||||
ret = append(ret, name + " " + n + " (" + unit + ")")
|
||||
}
|
||||
continue
|
||||
}
|
||||
|
||||
name := header.DataStructure.PointName
|
||||
switch header.Value.Unit() {
|
||||
case "--":
|
||||
case "":
|
||||
default:
|
||||
name += " (" + header.Value.Unit() + ")"
|
||||
}
|
||||
ret = append(ret, name)
|
||||
}
|
||||
}
|
||||
// if ta.ShowIndex {
|
||||
// ret := []string{ta.IndexTitle}
|
||||
// ret = append(ret, ta.Headers...)
|
||||
// return ret
|
||||
// }
|
||||
// return ta.Headers
|
||||
|
||||
return ret
|
||||
return ta.Columns
|
||||
}
|
||||
|
||||
func (ta *StructTable) Get() ReflectArray {
|
||||
@ -1033,6 +974,24 @@ func (ta *StructTable) GetValues() StructValues {
|
||||
}
|
||||
}
|
||||
|
||||
var colName = func(sub *Reflect, value *valueTypes.UnitValue, length int) string {
|
||||
name := sub.DataStructure.PointName
|
||||
if value.ValueKey() == "" {
|
||||
if name == "" {
|
||||
name = "Column " + strconv.Itoa(length)
|
||||
}
|
||||
} else {
|
||||
name += " " + value.ValueKey()
|
||||
}
|
||||
switch value.Unit() {
|
||||
case "--":
|
||||
case "":
|
||||
default:
|
||||
name += " (" + sub.Value.Unit() + ")"
|
||||
}
|
||||
return name
|
||||
}
|
||||
|
||||
for rowIndex := range ta.Reflects {
|
||||
// fmt.Printf("ROW[%d] - size:%d\n", rowIndex, len(ta.Reflects[rowIndex]))
|
||||
data := make(StructValue)
|
||||
@ -1061,17 +1020,13 @@ func (ta *StructTable) GetValues() StructValues {
|
||||
}
|
||||
|
||||
for colIndex, col := range ta.Reflects[rowIndex] {
|
||||
|
||||
|
||||
|
||||
// It's important that the values are sorted by table header.
|
||||
// This is so that the headers match with data.
|
||||
if len(col.ChildReflect) > 0 {
|
||||
// Handles
|
||||
for _, sub := range col.ChildReflect {
|
||||
// data = append(data, sub.Value.Range(valueTypes.SortOrder)...)
|
||||
for _, val := range sub.Value.Range(valueTypes.LoadOrder) {
|
||||
name := val.ValueKey()
|
||||
name := colName(sub, &val, len(data))
|
||||
data[name] = val
|
||||
addCol(name)
|
||||
}
|
||||
@ -1083,7 +1038,7 @@ func (ta *StructTable) GetValues() StructValues {
|
||||
value := ta.Reflects[rowIndex][colIndex].Value
|
||||
// data = append(data, value.Range(valueTypes.SortOrder)...)
|
||||
for _, val := range value.Range(valueTypes.LoadOrder) {
|
||||
name := val.ValueKey()
|
||||
name := colName(col, &val, len(data))
|
||||
data[name] = val
|
||||
addCol(name)
|
||||
}
|
||||
@ -1099,7 +1054,7 @@ func (ta *StructTable) GetValues() StructValues {
|
||||
|
||||
// data = append(data, value.Range(valueTypes.SortOrder)...)
|
||||
for _, val := range value.Range(valueTypes.LoadOrder) {
|
||||
name := val.ValueKey()
|
||||
name := colName(col, &val, len(data))
|
||||
data[name] = val
|
||||
addCol(name)
|
||||
}
|
||||
|
@ -295,12 +295,12 @@ func (t *UnitValue) ValueKey() string {
|
||||
switch {
|
||||
case t.key != "":
|
||||
return t.key
|
||||
case t.UnitValue != "":
|
||||
return t.UnitValue
|
||||
case t.TypeValue != "":
|
||||
return t.TypeValue
|
||||
// case t.UnitValue != "":
|
||||
// return t.UnitValue
|
||||
// case t.TypeValue != "":
|
||||
// return t.TypeValue
|
||||
}
|
||||
return "nokey"
|
||||
return ""
|
||||
}
|
||||
|
||||
func (t UnitValue) String() string {
|
||||
|
@ -9,6 +9,7 @@ import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
datatable "go.pennock.tech/tabular/auto"
|
||||
"os"
|
||||
"sort"
|
||||
"strings"
|
||||
"time"
|
||||
@ -17,6 +18,7 @@ import (
|
||||
|
||||
type DataMap struct {
|
||||
Map map[string]*DataEntries
|
||||
List output.Table
|
||||
Table output.Table
|
||||
DataTables output.Tables
|
||||
// Order []string
|
||||
@ -71,7 +73,12 @@ func (dm *DataMap) StructToDataMap(endpoint EndPoint, parentDeviceId string, nam
|
||||
dm.AddPointUnitValues(Child, pdi, when)
|
||||
}
|
||||
|
||||
dm.Error = dm.CreateResultTable(endpoint, sm)
|
||||
dm.List, dm.Error = dm.CreateResultTable(endpoint, sm, true)
|
||||
if dm.Error != nil {
|
||||
break
|
||||
}
|
||||
|
||||
dm.Table, dm.Error = dm.CreateResultTable(endpoint, sm, false)
|
||||
if dm.Error != nil {
|
||||
break
|
||||
}
|
||||
@ -142,9 +149,10 @@ func (dm *DataMap) CreateDataTables(sm GoStruct.StructMap) error {
|
||||
return dm.Error
|
||||
}
|
||||
|
||||
func (dm *DataMap) CreateResultTable(endpoint EndPoint, sm GoStruct.StructMap) error {
|
||||
func (dm *DataMap) CreateResultTable(endpoint EndPoint, sm GoStruct.StructMap, full bool) (output.Table, error) {
|
||||
var ret output.Table
|
||||
for range Only.Once {
|
||||
dm.Table = output.NewTable(
|
||||
ret = output.NewTable(
|
||||
"Date",
|
||||
"Point Id",
|
||||
"Value",
|
||||
@ -159,25 +167,31 @@ func (dm *DataMap) CreateResultTable(endpoint EndPoint, sm GoStruct.StructMap) e
|
||||
for _, p := range dm.Sort() {
|
||||
entries := dm.Map[p].Entries
|
||||
for _, de := range entries {
|
||||
if de.Hide {
|
||||
continue
|
||||
if full {
|
||||
if de.Current.DataStructure.DataTable {
|
||||
continue // We already have the children.
|
||||
}
|
||||
} else {
|
||||
if de.Hide {
|
||||
continue // Ignore hidden entries.
|
||||
}
|
||||
if de.Current.DataStructure.DataTableChild {
|
||||
continue // Ignore data table children.
|
||||
}
|
||||
// child, i := de.Current.IsTableChild()
|
||||
// fmt.Printf("%t[%d]\n", child, i)
|
||||
// if child {
|
||||
// if !de.Current.IsTable() {
|
||||
// continue
|
||||
// }
|
||||
// }
|
||||
}
|
||||
if de.Current.DataStructure.DataTableChild {
|
||||
continue
|
||||
}
|
||||
// child, i := de.Current.IsTableChild()
|
||||
// fmt.Printf("%t[%d]\n", child, i)
|
||||
// if child {
|
||||
// if !de.Current.IsTable() {
|
||||
// continue
|
||||
// }
|
||||
// }
|
||||
|
||||
v := de.Value.String()
|
||||
if de.Current.IsTable() {
|
||||
v = "See table: " + de.Current.Name()
|
||||
}
|
||||
dm.Error = dm.Table.AddRow(
|
||||
dm.Error = ret.AddRow(
|
||||
de.Date.Format(valueTypes.DateTimeLayout),
|
||||
p,
|
||||
v,
|
||||
@ -191,29 +205,6 @@ func (dm *DataMap) CreateResultTable(endpoint EndPoint, sm GoStruct.StructMap) e
|
||||
if dm.Error != nil {
|
||||
break
|
||||
}
|
||||
|
||||
// values := de.Current.ValuesRange()
|
||||
// for _, key := range de.Current.Value.KeysSorted() {
|
||||
// value := values[key]
|
||||
// v := value.String()
|
||||
// if de.Current.IsTable() {
|
||||
// v = "See table: " + de.Current.Name()
|
||||
// }
|
||||
// dm.Error = dm.Table.AddRow(
|
||||
// de.Date.Format(valueTypes.DateTimeLayout),
|
||||
// p,
|
||||
// v,
|
||||
// // de.Value.String(),
|
||||
// de.Point.Unit,
|
||||
// de.Point.ValueType,
|
||||
// de.Point.GroupName,
|
||||
// de.Point.Description,
|
||||
// de.Point.UpdateFreq,
|
||||
// )
|
||||
// if dm.Error != nil {
|
||||
// break
|
||||
// }
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
@ -221,17 +212,19 @@ func (dm *DataMap) CreateResultTable(endpoint EndPoint, sm GoStruct.StructMap) e
|
||||
// title = sm.Name.String()
|
||||
// title = valueTypes.PointToName(sm.Start.DataStructure.DataTableId)
|
||||
|
||||
// dm.Table.SetTitle("EndPoint Data: %s.%s", endpoint.GetArea(), endpoint.GetName())
|
||||
dm.Table.SetTitle("EndPoint Data %s - %s", sm.Name.String(), title)
|
||||
// dm.Table.SetFilePrefix("%s_%s", endpoint.GetArea(), endpoint.GetName())
|
||||
dm.Table.SetFilePrefix(sm.Name.String())
|
||||
dm.Table.SetGraphFilter("")
|
||||
dm.Table.Sort("Point Id")
|
||||
dm.Table.SetJson([]byte(endpoint.GetJsonData(false)))
|
||||
dm.Table.SetRaw([]byte(endpoint.GetJsonData(true)))
|
||||
// ret.SetTitle("EndPoint Data: %s.%s", endpoint.GetArea(), endpoint.GetName())
|
||||
ret.SetTitle("EndPoint Data %s - %s", sm.Name.String(), title)
|
||||
// ret.SetFilePrefix("%s_%s", endpoint.GetArea(), endpoint.GetName())
|
||||
ret.SetFilePrefix(sm.Name.String())
|
||||
ret.SetGraphFilter("")
|
||||
ret.Sort("Point Id")
|
||||
if full {
|
||||
ret.SetJson([]byte(endpoint.GetJsonData(false)))
|
||||
ret.SetRaw([]byte(endpoint.GetJsonData(true)))
|
||||
}
|
||||
}
|
||||
|
||||
return dm.Error
|
||||
return ret, dm.Error
|
||||
}
|
||||
|
||||
func (dm *DataMap) AddPointUnitValues(Current *GoStruct.Reflect, parentDeviceId string, date valueTypes.DateTime) {
|
||||
@ -256,7 +249,8 @@ func (dm *DataMap) AddPointUnitValues(Current *GoStruct.Reflect, parentDeviceId
|
||||
point.SetName(Current.DataStructure.PointName)
|
||||
|
||||
if Current.Value.Unit() != point.Unit {
|
||||
fmt.Printf("OOOPS: Unit mismatch - %s != %f %s\n", point.Unit, Current.Value.First().ValueFloat(), Current.Value.Unit())
|
||||
_, _ = fmt.Fprintf(os.Stderr,"OOOPS FP['%s'] - Point/Value unit mismatch - Point:%s != Value:%s (%f)\n",
|
||||
Current.FieldPath.String(), point.Unit, Current.Value.Unit(), Current.Value.First().ValueFloat())
|
||||
point.Unit = Current.Value.Unit()
|
||||
}
|
||||
|
||||
@ -268,7 +262,7 @@ func (dm *DataMap) AddPointUnitValues(Current *GoStruct.Reflect, parentDeviceId
|
||||
}
|
||||
|
||||
if Current.Value.Length() == 0 {
|
||||
fmt.Printf("OOOPS - UVS is nil for %s\n", Current.PointId())
|
||||
_, _ = fmt.Fprintf(os.Stderr,"OOOPS FP['%s'] - UVS is nil\n", Current.FieldPath.String())
|
||||
break
|
||||
}
|
||||
|
||||
|
@ -60,26 +60,44 @@ type SunGrowDataResponses map[string]SunGrowDataResponse
|
||||
|
||||
func (sgd *SunGrowDataResponse) GetOutput(outputType output.OutputType, saveAsFile bool) error {
|
||||
for range Only.Once {
|
||||
if sgd.Data.Table.OutputType.IsTable() {
|
||||
var ok bool
|
||||
for _, t := range sgd.Data.DataTables {
|
||||
ok = true
|
||||
t.OutputType = outputType
|
||||
t.SetSaveFile(saveAsFile)
|
||||
sgd.Error = t.Output()
|
||||
if sgd.Error != nil {
|
||||
break
|
||||
}
|
||||
}
|
||||
if !ok {
|
||||
fmt.Printf("No data table results for '%s'\n", sgd.Title)
|
||||
}
|
||||
if sgd.Data.Table.OutputType.IsList() {
|
||||
sgd.Data.List.OutputType = outputType
|
||||
sgd.Data.List.SetSaveFile(saveAsFile)
|
||||
sgd.Error = sgd.Data.List.Output()
|
||||
break
|
||||
}
|
||||
|
||||
if sgd.Data.Table.OutputType.IsRaw() {
|
||||
sgd.Data.List.OutputType = outputType
|
||||
sgd.Data.List.SetSaveFile(saveAsFile)
|
||||
sgd.Error = sgd.Data.List.Output()
|
||||
break
|
||||
}
|
||||
|
||||
if !sgd.Data.Table.OutputType.IsTable() {
|
||||
break
|
||||
}
|
||||
|
||||
sgd.Data.Table.OutputType = outputType
|
||||
sgd.Data.Table.SetSaveFile(saveAsFile)
|
||||
sgd.Error = sgd.Data.Table.Output()
|
||||
if sgd.Error != nil {
|
||||
break
|
||||
}
|
||||
|
||||
if len(sgd.Data.DataTables) == 0 {
|
||||
fmt.Printf("No data table results for '%s'\n", sgd.Title)
|
||||
break
|
||||
}
|
||||
for _, t := range sgd.Data.DataTables {
|
||||
fmt.Println()
|
||||
t.OutputType = outputType
|
||||
t.SetSaveFile(saveAsFile)
|
||||
sgd.Error = t.Output()
|
||||
if sgd.Error != nil {
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return sgd.Error
|
||||
|
Loading…
x
Reference in New Issue
Block a user