Skip to content

Commit

Permalink
新增三菱PLC、欧姆龙PLC、AB(罗克韦尔)PLC驱动;优化页面
Browse files Browse the repository at this point in the history
  • Loading branch information
iioter committed Jan 15, 2022
1 parent 9d7aa0d commit abcdcd9
Show file tree
Hide file tree
Showing 59 changed files with 1,903 additions and 30 deletions.
Binary file modified .vs/IoTGateway/DesignTimeBuild/.dtbcache.v2
Binary file not shown.
22 changes: 21 additions & 1 deletion .vs/IoTGateway/project-colors.json
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,27 @@
"ProjectGuid": "dabb562d-5eb7-4f9d-90ef-424c2bf63a4d",
"DisplayName": "DriverOPCUaClient",
"ColorIndex": 15
},
"0602dc6c-fb26-41b1-972e-298679826e3f": {
"ProjectGuid": "0602dc6c-fb26-41b1-972e-298679826e3f",
"DisplayName": "DriverMTConnect",
"ColorIndex": 0
},
"6d926cd7-5ff9-489b-9049-7030ae8059c9": {
"ProjectGuid": "6d926cd7-5ff9-489b-9049-7030ae8059c9",
"DisplayName": "DriverMitsubishi",
"ColorIndex": 1
},
"92e2bb84-c7ec-418e-879a-40b891cae6e7": {
"ProjectGuid": "92e2bb84-c7ec-418e-879a-40b891cae6e7",
"DisplayName": "DriverOmronFins",
"ColorIndex": 2
},
"c8c82c05-defd-4e79-9772-b5ea3d2e5d88": {
"ProjectGuid": "c8c82c05-defd-4e79-9772-b5ea3d2e5d88",
"DisplayName": "DriverAllenBradley",
"ColorIndex": 3
}
},
"NextColorIndex": 0
"NextColorIndex": 4
}
Binary file modified .vs/IoTGateway/v17/.futdcache.v1
Binary file not shown.
Binary file modified .vs/IoTGateway/v17/.suo
Binary file not shown.
Binary file modified .vs/IoTGateway/v17/fileList.bin
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,14 @@
using IoTGateway.Model;
using PluginInterface;
using Plugin;
using Newtonsoft.Json;

namespace IoTGateway.ViewModel.BasicData.DeviceVariableVMs
{
public partial class DeviceVariableListVM : BasePagedListVM<DeviceVariable_View, DeviceVariableSearcher>
{
public List<TreeSelectListItem> AllDevices { get; set; }
public List<LayuiTreeItem> DevicesTree { get; set; }
protected override List<GridAction> InitGridAction()
{
return new List<GridAction>
Expand All @@ -36,15 +38,20 @@ protected override void InitListVM()
.OrderBy(x => x.Parent.Index).ThenBy(x => x.Parent.DeviceName)
.OrderBy(x => x.Index).ThenBy(x => x.DeviceName)
.GetTreeSelectListItems(Wtm, x => x.DeviceName);

var deviceService = Wtm.ServiceProvider.GetService(typeof(DeviceService)) as DeviceService;
foreach (var device in AllDevices)
{
foreach (var item in device.Children)
{
var deviceThread = deviceService.DeviceThreads.Where(x => x.Device.ID.ToString() == (string)item.Value).FirstOrDefault();

item.Text = item.Text;
item.Icon = "layui-icon layui-icon-link";
item.Icon = deviceThread.Device.AutoStart ? (deviceThread.Driver.IsConnected ? "layui-icon-link" : "layui-icon-unlink") : "layui-icon-pause";
item.Expended = true;
}
}
DevicesTree = GetLayuiTree(AllDevices);
base.InitListVM();
}
protected override IEnumerable<IGridColumn<DeviceVariable_View>> InitGridHeader()
Expand Down Expand Up @@ -114,6 +121,60 @@ public override IOrderedQueryable<DeviceVariable_View> GetSearchQuery()
return query;
}

private List<LayuiTreeItem> GetLayuiTree(List<TreeSelectListItem> tree, int level = 0)
{
List<LayuiTreeItem> rv = new List<LayuiTreeItem>();
foreach (var s in tree)
{
var news = new LayuiTreeItem
{
Id = (string)s.Value,
Title = s.Text,
Icon = s.Icon,
Url = s.Url,
Expand = s.Expended,
Level = level,
Checked = s.Selected
//Children = new List<LayuiTreeItem>()
};
if (s.Children != null && s.Children.Count > 0)
{
news.Children = GetLayuiTree(s.Children, level + 1);
if (news.Children.Where(x => x.Checked == true || x.Expand == true).Count() > 0)
{
news.Expand = true;
}
}
rv.Add(news);
}
return rv;
}
public class LayuiTreeItem
{
[JsonProperty(PropertyName = "title")]
public string Title { get; set; }

[JsonProperty(PropertyName = "icon")]
public string Icon { get; set; }

[JsonProperty(PropertyName = "id")]
public string Id { get; set; }

[JsonProperty(PropertyName = "children")]
public List<LayuiTreeItem> Children { get; set; }

[JsonProperty(PropertyName = "href")]
public string Url { get; set; }

[JsonProperty(PropertyName = "spread")]
public bool Expand { get; set; }

[JsonProperty(PropertyName = "checked")]
public bool Checked { get; set; }

[JsonProperty(PropertyName = "level")]
public int Level { get; set; }
}
}

public class DeviceVariable_View : DeviceVariable
Expand Down
25 changes: 23 additions & 2 deletions IoTGateway.sln
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.31313.79
# Visual Studio Version 17
VisualStudioVersion = 17.0.31919.166
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IoTGateway", "IoTGateway\IoTGateway.csproj", "{68ABBDF2-1485-4756-9A94-6AFA874D69A3}"
EndProject
Expand Down Expand Up @@ -35,6 +35,12 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DriverOPCUaClient", "Plugin
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DriverMTConnect", "Plugins\Drivers\DriverMTConnect\DriverMTConnect.csproj", "{0602DC6C-FB26-41B1-972E-298679826E3F}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DriverMitsubishi", "Plugins\Drivers\DriverMitsubishi\DriverMitsubishi.csproj", "{6D926CD7-5FF9-489B-9049-7030AE8059C9}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DriverOmronFins", "Plugins\Drivers\OmronFins\DriverOmronFins.csproj", "{92E2BB84-C7EC-418E-879A-40B891CAE6E7}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DriverAllenBradley", "Plugins\Drivers\DriverAllenBradley\DriverAllenBradley.csproj", "{C8C82C05-DEFD-4E79-9772-B5EA3D2E5D88}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -93,6 +99,18 @@ Global
{0602DC6C-FB26-41B1-972E-298679826E3F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0602DC6C-FB26-41B1-972E-298679826E3F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0602DC6C-FB26-41B1-972E-298679826E3F}.Release|Any CPU.Build.0 = Release|Any CPU
{6D926CD7-5FF9-489B-9049-7030AE8059C9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6D926CD7-5FF9-489B-9049-7030AE8059C9}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6D926CD7-5FF9-489B-9049-7030AE8059C9}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6D926CD7-5FF9-489B-9049-7030AE8059C9}.Release|Any CPU.Build.0 = Release|Any CPU
{92E2BB84-C7EC-418E-879A-40B891CAE6E7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{92E2BB84-C7EC-418E-879A-40B891CAE6E7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{92E2BB84-C7EC-418E-879A-40B891CAE6E7}.Release|Any CPU.ActiveCfg = Release|Any CPU
{92E2BB84-C7EC-418E-879A-40B891CAE6E7}.Release|Any CPU.Build.0 = Release|Any CPU
{C8C82C05-DEFD-4E79-9772-B5EA3D2E5D88}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C8C82C05-DEFD-4E79-9772-B5EA3D2E5D88}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C8C82C05-DEFD-4E79-9772-B5EA3D2E5D88}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C8C82C05-DEFD-4E79-9772-B5EA3D2E5D88}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -108,6 +126,9 @@ Global
{B884FBE3-C8C5-471E-B629-12ECA0FC5DAC} = {52D96C24-2F2F-49B5-9F29-00414DEA41D8}
{DABB562D-5EB7-4F9D-90EF-424C2BF63A4D} = {52D96C24-2F2F-49B5-9F29-00414DEA41D8}
{0602DC6C-FB26-41B1-972E-298679826E3F} = {52D96C24-2F2F-49B5-9F29-00414DEA41D8}
{6D926CD7-5FF9-489B-9049-7030AE8059C9} = {52D96C24-2F2F-49B5-9F29-00414DEA41D8}
{92E2BB84-C7EC-418E-879A-40B891CAE6E7} = {52D96C24-2F2F-49B5-9F29-00414DEA41D8}
{C8C82C05-DEFD-4E79-9772-B5EA3D2E5D88} = {52D96C24-2F2F-49B5-9F29-00414DEA41D8}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {1F219808-E6E8-4C1D-B846-41F2F7CF20FA}
Expand Down
Loading

0 comments on commit abcdcd9

Please sign in to comment.