Compare commits

..

No commits in common. "develop" and "master" have entirely different histories.

4379 changed files with 179003 additions and 511388 deletions

9
.gitignore vendored
View File

@ -28,18 +28,10 @@ x86/
[Aa][Rr][Mm]64/
bld/
[Bb]in/
# NSIS 工具链 - 强制纳入版本管理
!App/SicSetup/Sic_Setup/NSIS/Bin/
!App/SicSetup/Sic_Setup/NSIS/Bin/**
[Oo]bj/
[Oo]ut/
[Ll]og/
[Ll]ogs/
# Framework 源码 Log 模块 - 强制纳入版本管理
!Framework/**/Log/
!Framework/**/Log/**
!Framework/**/Logs/
!Framework/**/Logs/**
# Visual Studio 2015/2017 cache/options directory
.vs/
@ -98,6 +90,7 @@ StyleCopReport.xml
*.tmp
*.tmp_proj
*_wpftmp.csproj
*.log
*.vspscc
*.vssscc
.builds

View File

@ -1,116 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<IoProviders system="Sic" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >
<!--
如果PLC模拟器配置中增加了Block节点则相应的在 “D:\MyProjects\芯三代\Sicentury\SIC-12\App\SicSimulator\Instances\SimulatorModulePlc.cs”
对象中增加调整Block的数量。如下
public const int DiBlockCount = 1;
public const int DoBlockCount = 1;
public const int AiBlockCount = 5;
public const int AoBlockCount = 5;
-->
<!--TM Simulator-->
<IoProvider load_condition="0" module="TM" name="io" map_module="TM" map_file="tm\IODefinePlatform.xml"
class="MECF.Framework.RT.Core.IoProviders.MCProtocolPlc" assembly="MECF.Framework.RT.Core">
<Parameter ip="127.0.0.1" port="6833" network_id="1" station_id="1"></Parameter>
<Blocks>
<Block type="di" index="0" size="640" value_type="" variable=""></Block>
<Block type="do" index="0" size="640" value_type="" variable=""></Block>
<Block type="ai" index="0" size="640" value_type="float"></Block>
<Block type="ao" index="0" size="640" value_type="float" variable=""></Block>
</Blocks>
</IoProvider>
<!--PM1 Simulator-->
<IoProvider load_condition="0" module="PM1" name="io" map_module="PM1" map_file="pm\pm1\_ioDefinePM1.xml"
class="Aitex.Core.RT.Device.Devices.AdsIoProvider" assembly="MECF.Framework.RT.EquipmentLibrary" >
<Parameter></Parameter>
<Blocks>
<Block type="di" index="0" size="416" value_type="" variable="GVL_IO.PM1_DI_G"/>
<Block type="do" index="0" size="256" value_type="" variable="GVL_IO.PM1_DO_G"/>
<Block type="ai" index="0" size="181" value_type="float" variable="GVL_IO.PM1_AI_G"/>
<Block type="ao" index="0" size="181" value_type="float" variable="GVL_IO.PM1_AO_G"/>
<Block type="ai" index="1" size="100" value_type="float" variable="GVL_IO.PM1_AI_G_2"/>
<Block type="ao" index="1" size="100" value_type="float" variable="GVL_IO.PM1_AO_G_2"/>
<Block type="ai" index="2" size="40" value_type="float" variable="GVL_IO.PM1_AI_G_3"/>
<Block type="ao" index="2" size="40" value_type="float" variable="GVL_IO.PM1_AO_G_3"/>
<Block type="ai" index="3" size="10" value_type="float" variable="GVL_IO.PM1_AI_G_4"/>
<Block type="ao" index="3" size="10" value_type="float" variable="GVL_IO.PM1_AO_G_4"/>
<Block type="ai" index="4" size="10" value_type="float" variable="GVL_IO.PM1_AI_G_5"/>
<Block type="ao" index="4" size="10" value_type="float" variable="GVL_IO.PM1_AO_G_5"/>
</Blocks>
</IoProvider>
<!--PM2 Simulator-->
<IoProvider load_condition="0" module="PM2" name="io" map_module="PM2" map_file="pm\pm2\_ioDefinePM2.xml"
class="Aitex.Core.RT.Device.Devices.AdsIoProvider" assembly="MECF.Framework.RT.EquipmentLibrary" >
<Parameter></Parameter>
<Blocks>
<Block type="di" index="0" size="416" value_type="" variable="GVL_IO.PM2_DI_G"></Block>
<Block type="do" index="0" size="256" value_type="" variable="GVL_IO.PM2_DO_G"></Block>
<Block type="ai" index="0" size="181" value_type="float" variable="GVL_IO.PM2_AI_G"></Block>
<Block type="ao" index="0" size="181" value_type="float" variable="GVL_IO.PM2_AO_G"></Block>
<Block type="ai" index="1" size="100" value_type="float" variable="GVL_IO.PM2_AI_G_2"></Block>
<Block type="ao" index="1" size="100" value_type="float" variable="GVL_IO.PM2_AO_G_2"></Block>
<Block type="ai" index="2" size="40" value_type="float" variable="GVL_IO.PM2_AI_G_3"></Block>
<Block type="ao" index="2" size="40" value_type="float" variable="GVL_IO.PM2_AO_G_3"></Block>
<Block type="ai" index="3" size="10" value_type="float" variable="GVL_IO.PM1_AI_G_4"/>
<Block type="ao" index="3" size="10" value_type="float" variable="GVL_IO.PM1_AO_G_4"/>
<Block type="ai" index="4" size="10" value_type="float" variable="GVL_IO.PM1_AI_G_5"/>
<Block type="ao" index="4" size="10" value_type="float" variable="GVL_IO.PM1_AO_G_5"/>
</Blocks>
</IoProvider>
<IoProvider load_condition="1" module="TM" name="io" map_module="TM" map_file="tm\IODefinePlatform.xml" class="SicModules.Devices.SiemensIoProvider" assembly="SicModules" >
<Parameter ip="192.168.1.102" port="102" plcType="4"></Parameter>
<Blocks>
<Block type="di" index="0" size="224" value_type="" variable="DB100.DBB100" comment=""/>
<Block type="do" index="0" size="160" value_type="" variable="DB100.DBB128" comment=""/>
<Block type="ai" index="0" size="17" value_type="float" variable="DB100.DBD148" comment=""/>
<Block type="ao" index="0" size="17" value_type="float" variable="DB100.DBD216" comment=""/>
<Block type="ai" index="1" size="20" value_type="float" variable="DB100.DBD284" comment=""/>
</Blocks>
</IoProvider>
<IoProvider load_condition="1" module="PM1" name="io" map_module="PM1" map_file="pm\pm1\_ioDefinePM1.xml" class="Aitex.Core.RT.Device.Devices.SiemensIoProvider" assembly="MECF.Framework.RT.EquipmentLibrary" >
<Parameter ip="192.168.1.105" port="102" plcType="4"/>
<Blocks>
<Block type="di" index="0" size="416" value_type="" variable="DB100.DBB100"></Block>
<Block type="do" index="0" size="256" value_type="" variable="DB100.DBB152"></Block>
<Block type="ai" index="0" size="181" value_type="float" variable="DB100.DBD184"></Block>
<Block type="ao" index="0" size="181" value_type="float" variable="DB100.DBD908"></Block>
<Block type="ai" index="1" size="100" value_type="float" variable="DB100.DBD1632"></Block>
<Block type="ao" index="1" size="100" value_type="float" variable="DB100.DBD2032"></Block>
<Block type="ai" index="2" size="40" value_type="float" variable="DB100.DBD2432"></Block>
<Block type="ao" index="2" size="40" value_type="float" variable="DB100.DBD2592"></Block>
<Block type="ai" index="3" size="10" value_type="float" variable="DB100.DBD2752"/>
<Block type="ao" index="3" size="10" value_type="float" variable="DB100.DBD2792"/>
<Block type="ai" index="4" size="10" value_type="float" variable="DB100.DBD2832"/>
<Block type="ao" index="4" size="10" value_type="float" variable="DB100.DBD2872"/>
</Blocks>
</IoProvider>
<IoProvider load_condition="1" module="PM2" name="io" map_module="PM2" map_file="pm\pm2\_ioDefinePM2.xml" class="Aitex.Core.RT.Device.Devices.SiemensIoProvider" assembly="MECF.Framework.RT.EquipmentLibrary" >
<Parameter ip="192.168.1.205" port="102" plcType="4"></Parameter>
<Blocks>
<Block type="di" index="0" size="416" value_type="" variable="DB100.DBB100"></Block>
<Block type="do" index="0" size="256" value_type="" variable="DB100.DBB152"></Block>
<Block type="ai" index="0" size="181" value_type="float" variable="DB100.DBD184"></Block>
<Block type="ao" index="0" size="181" value_type="float" variable="DB100.DBD908"></Block>
<Block type="ai" index="1" size="100" value_type="float" variable="DB100.DBD1632"></Block>
<Block type="ao" index="1" size="100" value_type="float" variable="DB100.DBD2032"></Block>
<Block type="ai" index="2" size="40" value_type="float" variable="DB100.DBD2432"></Block>
<Block type="ao" index="2" size="40" value_type="float" variable="DB100.DBD2592"></Block>
<Block type="ai" index="3" size="10" value_type="float" variable="DB100.DBD2752"/>
<Block type="ao" index="3" size="10" value_type="float" variable="DB100.DBD2792"/>
<Block type="ai" index="4" size="10" value_type="float" variable="DB100.DBD2832"/>
<Block type="ao" index="4" size="10" value_type="float" variable="DB100.DBD2872"/>
</Blocks>
</IoProvider>
</IoProviders>

View File

@ -1,13 +0,0 @@
# Sic Manual-GE 系统更新历史记录
Manual-GE 手动通用版适用无EFEM设备
------
## Version 1.1.1.60324
- Bug修复
- 无
- 功能优化
- 无
- 新特性
- 无

BIN
App/SicSetup/Sic_Setup/NSIS/Bin/GenPat.exe (Stored with Git LFS)

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
App/SicSetup/Sic_Setup/NSIS/Bin/zlib1.dll (Stored with Git LFS)

Binary file not shown.

View File

@ -1,301 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<IO_DEFINE xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<VersionID Name="V2.2.3.0" />
<Dig_In>
<Block Index="0">
<DI_ITEM Index="0" Name="DI_LoadDoorClosed" BufferOffset="0" Addr="0" Description="" />
<DI_ITEM Index="1" Name="DI_LoadDoorOpened" BufferOffset="1" Addr="1" Description="" />
<DI_ITEM Index="2" Name="DI_UnloadStationDoorClosed" BufferOffset="2" Addr="2" Description="" />
<DI_ITEM Index="3" Name="DI_UnloadStationDoorOpened" BufferOffset="3" Addr="3" Description="" />
<DI_ITEM Index="4" Name="DI_ReactorADoorClosed" BufferOffset="4" Addr="4" Description="" />
<DI_ITEM Index="5" Name="DI_ReactorADoorOpened" BufferOffset="5" Addr="5" Description="" />
<DI_ITEM Index="6" Name="DI_ReactorBDoorClosed" BufferOffset="6" Addr="6" Description="" />
<DI_ITEM Index="7" Name="DI_ReactorBDoorOpened" BufferOffset="7" Addr="7" Description="" />
<DI_ITEM Index="8" Name="DI_UnloadSubStationDoorClosed" BufferOffset="8" Addr="8" Description="" Visible="false"/>
<DI_ITEM Index="9" Name="DI_UnloadSubStationDoorOpened" BufferOffset="9" Addr="9" Description="" Visible="false"/>
<DI_ITEM Index="10" Name="DI_BufferStationDoorClosed" BufferOffset="10" Addr="10" Description="" />
<DI_ITEM Index="11" Name="DI_BufferStationDoorOpened" BufferOffset="11" Addr="11" Description="" />
<DI_ITEM Index="12" Name="DI_TMLidClosed" BufferOffset="12" Addr="12" Description="" />
<DI_ITEM Index="14" Name="DI_UnloadStationLidClosed" BufferOffset="14" Addr="14" Description="" Visible="false"/>
<DI_ITEM Index="15" Name="DI_BufferStationLidClosed" BufferOffset="15" Addr="15" Description="" />
<DI_ITEM Index="22" Name="DI_LoadLockGateClosed" BufferOffset="22" Addr="22" Description="" />
<DI_ITEM Index="24" Name="DI_LoadLSideDoorClosed" BufferOffset="24" Addr="24" Description="" Visible="false"/>
<DI_ITEM Index="25" Name="DI_LoadLSideDoorOpened" BufferOffset="25" Addr="25" Description="" Visible="false"/>
<DI_ITEM Index="26" Name="DI_LoadRSideDoorClosed" BufferOffset="26" Addr="26" Description="" Visible="false"/>
<DI_ITEM Index="27" Name="DI_LoadRSideDoorOpened" BufferOffset="27" Addr="27" Description="" Visible="false"/>
<DI_ITEM Index="31" Name="DI_RobotOnBackPos" BufferOffset="31" Addr="31" Description="" />
<DI_ITEM Index="33" Name="DI_LoadLeftGateINTK" BufferOffset="33" Addr="33" Description="" Visible="false"/>
<DI_ITEM Index="34" Name="DI_LoadRightGateINTK" BufferOffset="34" Addr="34" Description="" Visible="false"/>
<DI_ITEM Index="35" Name="DI_LoadWaferPlaced" BufferOffset="35" Addr="35" Description="" Visible="false"/>
<DI_ITEM Index="36" Name="DI_LoadHomeTraySensor" BufferOffset="36" Addr="36" Description="" Visible="false"/>
<DI_ITEM Index="37" Name="DI_BufferStationOptSensorHigh" BufferOffset="37" Addr="37" Description="" />
<DI_ITEM Index="38" Name="DI_BufferStationOptSensorMid" BufferOffset="38" Addr="38" Description="" />
<DI_ITEM Index="39" Name="DI_BufferStationOptSensorLow" BufferOffset="39" Addr="39" Description="" />
<DI_ITEM Index="40" Name="DI_UnloadStationWaferPresence" BufferOffset="40" Addr="40" Description="" Visible="false"/>
<DI_ITEM Index="41" Name="DI_UnloadStationGateINTK" BufferOffset="41" Addr="41" Description="" Visible="false"/>
<DI_ITEM Index="43" Name="DI_TMDryPump1Alarm" BufferOffset="43" Addr="43" Description="" />
<DI_ITEM Index="44" Name="DI_TMDryPump1Warning" BufferOffset="44" Addr="44" Description="" />
<DI_ITEM Index="47" Name="DI_LoadLidClosed" BufferOffset="47" Addr="47" Description="" />
<DI_ITEM Index="49" Name="DI_TMDryPump1Running" BufferOffset="49" Addr="49" Description="" />
<DI_ITEM Index="50" Name="DI_WaferCassetLeftInch6" BufferOffset="50" Addr="50" Description="" Visible="false"/>
<DI_ITEM Index="52" Name="DI_WaferCassetRightInch6" BufferOffset="52" Addr="52" Description="" Visible="false"/>
<DI_ITEM Index="54" Name="DI_WaferCassetLeftConvexSensor" BufferOffset="54" Addr="54" Description="" Visible="false"/>
<DI_ITEM Index="55" Name="DI_WaferCassetRightConvexSensor" BufferOffset="55" Addr="55" Description="" Visible="false"/>
<DI_ITEM Index="56" Name="DI_TrayCassetInch6" BufferOffset="56" Addr="56" Description="" Visible="false"/>
<DI_ITEM Index="58" Name="DI_TrayCassetConvexSensor" BufferOffset="58" Addr="58" Description="" Visible="false"/>
<DI_ITEM Index="59" Name="DI_LoadLidOpen" BufferOffset="59" Addr="59" Description=""/>
<DI_ITEM Index="60" Name="DI_LoadLidClose" BufferOffset="60" Addr="60" Description=""/>
<DI_ITEM Index="61" Name="DI_LoaderWaferPresence" BufferOffset="61" Addr="61" Description=""/>
<DI_ITEM Index="62" Name="DI_LoadLidLockedR" BufferOffset="62" Addr="62" Description=""/>
<DI_ITEM Index="63" Name="DI_LoadLidUnlockedR" BufferOffset="63" Addr="63" Description=""/>
<DI_ITEM Index="64" Name="DI_LoadLidLocked" BufferOffset="64" Addr="64" Description=""/>
<DI_ITEM Index="65" Name="DI_LoadLidUnlocked" BufferOffset="65" Addr="65" Description="" />
<DI_ITEM Index="66" Name="DI_LoadWaferCYClamped" BufferOffset="66" Addr="66" Description="" Visible="false"/>
<DI_ITEM Index="67" Name="DI_LoadWafeCYOpened" BufferOffset="67" Addr="67" Description="" Visible="false"/>
<DI_ITEM Index="68" Name="DI_LoadTrayCYClamped" BufferOffset="68" Addr="68" Description="" Visible="false"/>
<DI_ITEM Index="69" Name="DI_LoadTrayCYOpend" BufferOffset="69" Addr="69" Description="" Visible="false"/>
<DI_ITEM Index="72" Name="DI_UnloadStationWaferCYClamped" BufferOffset="72" Addr="72" Description="" Visible="false"/>
<DI_ITEM Index="73" Name="DI_UnloadStationWaferCYOpened" BufferOffset="73" Addr="73" Description="" Visible="false"/>
<DI_ITEM Index="74" Name="DI_UnloadStationLifterCYUp" BufferOffset="74" Addr="74" Description="" Visible="false"/>
<DI_ITEM Index="75" Name="DI_UnloadStationLifterCYDown" BufferOffset="75" Addr="75" Description="" Visible="false"/>
<DI_ITEM Index="78" Name="DI_TMDryPump2Alarm" BufferOffset="78" Addr="78" Description="" Visible="false"/>
<DI_ITEM Index="79" Name="DI_TMDryPump2Warning" BufferOffset="79" Addr="79" Description="" Visible="false"/>
<DI_ITEM Index="86" Name="DI_TMDryPump2Running" BufferOffset="86" Addr="86" Description="" Visible="false"/>
<DI_ITEM Index="88" Name="DI_TMPressure1ATM" BufferOffset="88" Addr="88" Description="" />
<DI_ITEM Index="89" Name="DI_TMPressure1VAC" BufferOffset="89" Addr="89" Description="" />
<DI_ITEM Index="90" Name="DI_LoadPressureATM" BufferOffset="90" Addr="90" Description="" />
<DI_ITEM Index="91" Name="DI_LoadPressureVAC" BufferOffset="91" Addr="91" Description="" />
<DI_ITEM Index="92" Name="DI_TMPressure2ATM" BufferOffset="92" Addr="92" Description="" />
<DI_ITEM Index="93" Name="DI_TMPressure2VAC" BufferOffset="93" Addr="93" Description="" />
<DI_ITEM Index="94" Name="DI_UnloadPressureATM" BufferOffset="94" Addr="94" Description="" Visible="false"/>
<DI_ITEM Index="95" Name="DI_UnloadPressureVAC" BufferOffset="95" Addr="95" Description="" Visible="false"/>
<DI_ITEM Index="96" Name="DI_LoadSlowPumpFB" BufferOffset="96" Addr="96" Description="V84" />
<DI_ITEM Index="97" Name="DI_LoadFastPumpFB" BufferOffset="97" Addr="97" Description="V83" />
<DI_ITEM Index="98" Name="DI_TMSlowPumpFB" BufferOffset="98" Addr="98" Description="V82" />
<DI_ITEM Index="99" Name="DI_TMFastPumpFB" BufferOffset="99" Addr="99" Description="V81" />
<DI_ITEM Index="100" Name="DI_BufferVentFB" BufferOffset="100" Addr="100" Description="V80" />
<DI_ITEM Index="101" Name="DI_LoadVentFB" BufferOffset="101" Addr="101" Description="V79" />
<DI_ITEM Index="102" Name="DI_TMVentFB" BufferOffset="102" Addr="102" Description="V77" />
<DI_ITEM Index="103" Name="DI_UnloadVentFB" BufferOffset="103" Addr="103" Description="V78" Visible="false"/>
<DI_ITEM Index="104" Name="DI_TMLoadBanlanceFB" BufferOffset="104" Addr="104" Description="V85" />
<DI_ITEM Index="105" Name="DI_LoadDoorCloseFB" BufferOffset="105" Addr="105" Description="" />
<DI_ITEM Index="106" Name="DI_LoadDoorOpenFB" BufferOffset="106" Addr="106" Description="" />
<DI_ITEM Index="107" Name="DI_UnloadStationDoorCloseFB" BufferOffset="107" Addr="107" Description="" />
<DI_ITEM Index="108" Name="DI_UnloadStationDoorOpenFB" BufferOffset="108" Addr="108" Description="" />
<DI_ITEM Index="109" Name="DI_RectorADoorCloseFB" BufferOffset="109" Addr="109" Description="" />
<DI_ITEM Index="110" Name="DI_RectorADoorOpenFB" BufferOffset="110" Addr="110" Description="" />
<DI_ITEM Index="111" Name="DI_RectorBDoorCloseFB" BufferOffset="111" Addr="111" Description="" />
<DI_ITEM Index="112" Name="DI_RectorBDoorOpenFB" BufferOffset="112" Addr="112" Description="" />
<DI_ITEM Index="113" Name="DI_TMToUnloadBanlanceFB" BufferOffset="113" Addr="113" Description="V124" Visible="false"/>
<DI_ITEM Index="114" Name="DI_VacRobotEstopFB" BufferOffset="114" Addr="114" Description="" />
<DI_ITEM Index="115" Name="DI_VacRobotExtenLoadEnableFB" BufferOffset="115" Addr="115" Description="" />
<DI_ITEM Index="116" Name="DI_VacRobotExtendUnloadEnableFB" BufferOffset="116" Addr="116" Description="" />
<DI_ITEM Index="117" Name="DI_VacRobotExtendPMAEnableFB" BufferOffset="117" Addr="117" Description="" />
<DI_ITEM Index="118" Name="DI_VacRobotExtendPMBEnableFB" BufferOffset="118" Addr="118" Description="" />
<DI_ITEM Index="119" Name="DI_VacRobotExtendBufferEnableFB" BufferOffset="119" Addr="119" Description="" />
<DI_ITEM Index="120" Name="DI_ATMRobotExtendUnloadEnableFB" BufferOffset="120" Addr="120" Description="" Visible="false"/>
<DI_ITEM Index="121" Name="DI_ATMRobotExtendLoadLSideEnableFB" BufferOffset="121" Addr="121" Description="" Visible="false"/>
<DI_ITEM Index="122" Name="DI_ATMRobotExtendLoadRSideEnableFB" BufferOffset="122" Addr="122" Description="" Visible="false"/>
<DI_ITEM Index="123" Name="DI_LoadLSideDoorCloseFB" BufferOffset="123" Addr="123" Description="" Visible="false"/>
<DI_ITEM Index="124" Name="DI_LoadLSideDoorOpenFB" BufferOffset="124" Addr="124" Description="" Visible="false"/>
<DI_ITEM Index="125" Name="DI_LoadRSideDoorCloseFB" BufferOffset="125" Addr="125" Description="" Visible="false"/>
<DI_ITEM Index="126" Name="DI_LoadRSideDoorOpenFB" BufferOffset="126" Addr="126" Description="" Visible="false"/>
<DI_ITEM Index="127" Name="DI_UnloadSubStationDoorCloseFB" BufferOffset="127" Addr="127" Description="" Visible="false"/>
<DI_ITEM Index="128" Name="DI_UnloadSubStationDoorOpenFB" BufferOffset="128" Addr="128" Description="" Visible="false"/>
<DI_ITEM Index="129" Name="DI_BufferStationDoorCloseFB" BufferOffset="129" Addr="129" Description="" />
<DI_ITEM Index="130" Name="DI_BufferStationDoorOpenFB" BufferOffset="130" Addr="130" Description="" />
<DI_ITEM Index="133" Name="DI_LoadWaferCYClampFB" BufferOffset="133" Addr="133" Description="" Visible="false"/>
<DI_ITEM Index="134" Name="DI_LoadWaferCYOpenFB" BufferOffset="134" Addr="134" Description="" Visible="false"/>
<DI_ITEM Index="135" Name="DI_LoadTrayCYClampFB" BufferOffset="135" Addr="135" Description="" Visible="false"/>
<DI_ITEM Index="136" Name="DI_LoadTrayCYOpenFB" BufferOffset="136" Addr="136" Description="" Visible="false"/>
<DI_ITEM Index="139" Name="DI_UnloadStationWaferCYClampFB" BufferOffset="139" Addr="139" Description="" Visible="false"/>
<DI_ITEM Index="140" Name="DI_UnloadStationWaferCYOpenFB" BufferOffset="140" Addr="140" Description="" Visible="false"/>
<DI_ITEM Index="141" Name="DI_UnloadStationLifterCYUpFB" BufferOffset="141" Addr="141" Description="" Visible="false"/>
<DI_ITEM Index="142" Name="DI_UnloadStationLifterCYDownFB" BufferOffset="142" Addr="142" Description="" Visible="false"/>
<DI_ITEM Index="143" Name="DI_TMToPMABanlanceFB" BufferOffset="143" Addr="143" Description="" />
<DI_ITEM Index="144" Name="DI_TMToPMBBanlanceFB" BufferOffset="144" Addr="144" Description="" />
<DI_ITEM Index="157" Name="DI_UnloadFastPumpFB" BufferOffset="157" Addr="157" Description="V122"/>
<DI_ITEM Index="158" Name="DI_UnloadSlowPumpFB" BufferOffset="158" Addr="158" Description="V123"/>
<DI_ITEM Index="160" Name="DI_ReactorAATMTransferReadyFB" BufferOffset="160" Addr="160" Description="" />
<DI_ITEM Index="161" Name="DI_ReactorAProcessTransferReadyFB" BufferOffset="161" Addr="161" Description="" />
<DI_ITEM Index="162" Name="DI_ReactorBATMTransferReadyFB" BufferOffset="162" Addr="162" Description="" />
<DI_ITEM Index="163" Name="DI_ReactorBProcessTransferReadyFB" BufferOffset="163" Addr="163" Description="" />
<DI_ITEM Index="164" Name="DI_PreheatATMTransferReadyFB" BufferOffset="164" Addr="164" Description="" />
<DI_ITEM Index="165" Name="DI_PreheatProcessTransferReadyFB" BufferOffset="165" Addr="165" Description="" />
<DI_ITEM Index="167" Name="DI_TMWaferPresenceLLFB" BufferOffset="167" Addr="167" Description="" />
<DI_ITEM Index="168" Name="DI_TMWaferPresenceAFB" BufferOffset="168" Addr="168" Description="" />
<DI_ITEM Index="169" Name="DI_TMWaferPresenceBFB" BufferOffset="169" Addr="169" Description="" />
<DI_ITEM Index="170" Name="DI_TMWaferPresenceBufFB" BufferOffset="170" Addr="170" Description="" />
<DI_ITEM Index="171" Name="DI_TMWaferPresenceUnloadFB" BufferOffset="171" Addr="171" Description="" />
<DI_ITEM Index="174" Name="DI_ForelineBasePressureReadyFB" BufferOffset="174" Addr="174" Description="" />
<DI_ITEM Index="175" Name="DI_TMatATMFB" BufferOffset="175" Addr="175" Description="" />
<DI_ITEM Index="176" Name="DI_LoadAtATMFB" BufferOffset="176" Addr="176" Description="" />
<DI_ITEM Index="177" Name="DI_TMUnderVacFB" BufferOffset="177" Addr="177" Description="" />
<DI_ITEM Index="178" Name="DI_LoadUnderVACFB" BufferOffset="178" Addr="178" Description="" />
<DI_ITEM Index="179" Name="DI_TMAtProcessPressFB" BufferOffset="179" Addr="179" Description="" />
<DI_ITEM Index="180" Name="DI_LLAtProcessPressFB" BufferOffset="180" Addr="180" Description="" />
<DI_ITEM Index="181" Name="DI_LoadTempReadyFB" BufferOffset="181" Addr="181" Description="" />
<DI_ITEM Index="182" Name="DI_BufferTempReadyFB" BufferOffset="182" Addr="182" Description="" />
<DI_ITEM Index="185" Name="DI_TMCyclePurgeRoutineRunningFB" BufferOffset="185" Addr="185" Description="" />
<DI_ITEM Index="186" Name="DI_TMLeakCheckRoutineRunningFB" BufferOffset="186" Addr="186" Description="" />
<DI_ITEM Index="187" Name="DI_TMPumpDownRoutineRunningFB" BufferOffset="187" Addr="187" Description="" />
<DI_ITEM Index="188" Name="DI_TMServoPressRoutineRunningFB" BufferOffset="188" Addr="188" Description="" />
<DI_ITEM Index="189" Name="DI_TMVentUpRoutineRunningFB" BufferOffset="189" Addr="189" Description="" />
<DI_ITEM Index="190" Name="DI_LLCyclePurgeRoutineRunningFB" BufferOffset="190" Addr="190" Description="" />
<DI_ITEM Index="191" Name="DI_LLLeakCheckRoutineRunningFB" BufferOffset="191" Addr="191" Description="" />
<DI_ITEM Index="192" Name="DI_LLPumpDownRoutineRunningFB" BufferOffset="192" Addr="192" Description="" />
<DI_ITEM Index="193" Name="DI_LLVentUpRoutineRunningFB" BufferOffset="193" Addr="193" Description="" />
<DI_ITEM Index="208" Name="DI_LdRotationServoOn" BufferOffset="208" Addr="208" Description="" Visible="false"/>
<DI_ITEM Index="209" Name="DI_LdRotationBusy" BufferOffset="209" Addr="209" Description="" Visible="false"/>
<DI_ITEM Index="210" Name="DI_LdRotationServoError" BufferOffset="210" Addr="210" Description="" Visible="false"/>
<DI_ITEM Index="211" Name="DI_LdRotationMoveDone" BufferOffset="211" Addr="211" Description="" Visible="false"/>
<DI_ITEM Index="212" Name="DI_LdRotationRelativeHomeDone" BufferOffset="212" Addr="212" Description="" Visible="false"/>
<DI_ITEM Index="213" Name="DI_LdRotationOneCircleDone" BufferOffset="213" Addr="213" Description="" Visible="false"/>
<DI_ITEM Index="214" Name="DI_LdRotationCCD1PosDone" BufferOffset="214" Addr="214" Description="" Visible="false"/>
<DI_ITEM Index="215" Name="DI_LdRotationCCD2PosDone" BufferOffset="215" Addr="215" Description="" Visible="false"/>
</Block>
</Dig_In>
<Dig_Out>
<Block Index="0">
<DO_ITEM Index="0" Name="DO_LoadSlowPump" BufferOffset="0" Addr="0" Description="V84" />
<DO_ITEM Index="1" Name="DO_LoadFastPump" BufferOffset="1" Addr="1" Description="V83" />
<DO_ITEM Index="2" Name="DO_TMSlowPump" BufferOffset="2" Addr="2" Description="V82" />
<DO_ITEM Index="3" Name="DO_TMFastPump" BufferOffset="3" Addr="3" Description="V81" />
<DO_ITEM Index="4" Name="DO_BufferVent" BufferOffset="4" Addr="4" Description="V80" />
<DO_ITEM Index="5" Name="DO_LoadVent" BufferOffset="5" Addr="5" Description="V79" />
<DO_ITEM Index="6" Name="DO_TMVent" BufferOffset="6" Addr="6" Description="V77" />
<DO_ITEM Index="7" Name="DO_UnloadVent" BufferOffset="7" Addr="7" Description="V78" />
<DO_ITEM Index="8" Name="DO_TMLoadBanlance" BufferOffset="8" Addr="8" Description="V85" />
<DO_ITEM Index="9" Name="DO_LoadDoorClose" BufferOffset="9" Addr="9" Description="" />
<DO_ITEM Index="10" Name="DO_LoadDoorOpen" BufferOffset="10" Addr="10" Description="" />
<DO_ITEM Index="11" Name="DO_LoadLidOpen" BufferOffset="11" Addr="11" Description="" />
<DO_ITEM Index="12" Name="DO_LoadLidClose" BufferOffset="12" Addr="12" Description="" />
<DO_ITEM Index="13" Name="DO_RectorADoorClose" BufferOffset="13" Addr="13" Description="" />
<DO_ITEM Index="14" Name="DO_RectorADoorOpen" BufferOffset="14" Addr="14" Description="" />
<DO_ITEM Index="15" Name="DO_RectorBDoorClose" BufferOffset="15" Addr="15" Description="" />
<DO_ITEM Index="16" Name="DO_RectorBDoorOpen" BufferOffset="16" Addr="16" Description="" />
<DO_ITEM Index="17" Name="DO_TMToUnloadBanlance" BufferOffset="17" Addr="17" Description="V124" />
<DO_ITEM Index="18" Name="DO_VacRobotEstop" BufferOffset="18" Addr="18" Description="" />
<DO_ITEM Index="19" Name="DO_VacRobotExtenLoadEnable" BufferOffset="19" Addr="19" Description="" />
<DO_ITEM Index="20" Name="DO_VacRobotExtendUnloadEnable" BufferOffset="20" Addr="20" Description="" />
<DO_ITEM Index="21" Name="DO_VacRobotExtendPMAEnable" BufferOffset="21" Addr="21" Description="" />
<DO_ITEM Index="22" Name="DO_VacRobotExtendPMBEnable" BufferOffset="22" Addr="22" Description="" />
<DO_ITEM Index="23" Name="DO_VacRobotExtendBufferEnable" BufferOffset="23" Addr="23" Description="" />
<DO_ITEM Index="24" Name="DO_ATMRobotExtendUnloadEnable" BufferOffset="24" Addr="24" Description="" />
<DO_ITEM Index="25" Name="DO_ATMRobotExtendLoaLSideEnable" BufferOffset="25" Addr="25" Description="" />
<DO_ITEM Index="26" Name="DO_ATMRobotExtendLoaRSideEnable" BufferOffset="26" Addr="26" Description="" />
<DO_ITEM Index="27" Name="DO_LoadLSideDoorClose" BufferOffset="27" Addr="27" Description="" Visible="false"/>
<DO_ITEM Index="28" Name="DO_LoadLSideDoorOpen" BufferOffset="28" Addr="28" Description="" Visible="false"/>
<DO_ITEM Index="29" Name="DO_LoadRSideDoorClose" BufferOffset="29" Addr="29" Description="" Visible="false"/>
<DO_ITEM Index="30" Name="DO_LoadRSideDoorOpen" BufferOffset="30" Addr="30" Description="" Visible="false"/>
<DO_ITEM Index="31" Name="DO_UnloadSubStationDoorClose" BufferOffset="31" Addr="31" Description="" Visible="false"/>
<DO_ITEM Index="32" Name="DO_UnloadSubStationDoorOpen" BufferOffset="32" Addr="32" Description="" Visible="false"/>
<DO_ITEM Index="33" Name="DO_BufferStationDoorClose" BufferOffset="33" Addr="33" Description="" Visible="false"/>
<DO_ITEM Index="34" Name="DO_BufferStationDoorOpen" BufferOffset="34" Addr="34" Description="" Visible="false"/>
<DO_ITEM Index="35" Name="DO_LoadLidLock" BufferOffset="35" Addr="35" Description="" />
<DO_ITEM Index="36" Name="DO_LoadLidUnlock" BufferOffset="36" Addr="36" Description="" />
<DO_ITEM Index="37" Name="DO_LoadWaferCYClamp" BufferOffset="37" Addr="37" Description="" Visible="false"/>
<DO_ITEM Index="38" Name="DO_LoadWaferCYOpen" BufferOffset="38" Addr="38" Description="" Visible="false"/>
<DO_ITEM Index="39" Name="DO_LoadTrayCYClamp" BufferOffset="39" Addr="39" Description="" Visible="false"/>
<DO_ITEM Index="40" Name="DO_LoadTrayCYOpen" BufferOffset="40" Addr="40" Description="" Visible="false"/>
<DO_ITEM Index="43" Name="DO_UnloadStationWaferCYClamp" BufferOffset="43" Addr="43" Description="" Visible="false"/>
<DO_ITEM Index="44" Name="DO_UnloadStationWaferCYOpen" BufferOffset="44" Addr="44" Description="" Visible="false"/>
<DO_ITEM Index="45" Name="DO_UnloadStationLifterCYUp" BufferOffset="45" Addr="45" Description="" Visible="false"/>
<DO_ITEM Index="46" Name="DO_UnloadStationLifterCYDown" BufferOffset="46" Addr="46" Description="" Visible="false"/>
<DO_ITEM Index="47" Name="DO_TMToPMABanlance(V70-1)" BufferOffset="47" Addr="47" Description="" />
<DO_ITEM Index="48" Name="DO_TMToPMBBanlance(V70-2)" BufferOffset="48" Addr="48" Description="" />
<DO_ITEM Index="49" Name="DO_BufferStationBDoorClose" BufferOffset="49" Addr="49" Description="" />
<DO_ITEM Index="50" Name="DO_BufferStationBDoorOpen" BufferOffset="50" Addr="50" Description="" />
<DO_ITEM Index="55" Name="DO_TowerGreen" BufferOffset="55" Addr="55" Description="" />
<DO_ITEM Index="56" Name="DO_TowerYellow" BufferOffset="56" Addr="56" Description="" />
<DO_ITEM Index="57" Name="DO_TowerRed" BufferOffset="57" Addr="57" Description="" />
<DO_ITEM Index="58" Name="DO_Buzzer" BufferOffset="58" Addr="58" Description="" />
<DO_ITEM Index="61" Name="DO_UnloadFastPump" BufferOffset="61" Addr="61" Description="V122" Visible="false"/>
<DO_ITEM Index="62" Name="DO_UnloadSlowPump" BufferOffset="62" Addr="62" Description="V123" Visible="false"/>
<DO_ITEM Index="64" Name="DO_ReactorAATMTransferReady" BufferOffset="64" Addr="64" Description="" />
<DO_ITEM Index="65" Name="DO_ReactorAProcessTransferReady" BufferOffset="65" Addr="65" Description="" />
<DO_ITEM Index="66" Name="DO_ReactorBATMTransferReady" BufferOffset="66" Addr="66" Description="" />
<DO_ITEM Index="67" Name="DO_ReactorBProcessTransferReady" BufferOffset="67" Addr="67" Description="" />
<DO_ITEM Index="68" Name="DO_PreheatATMTransferReady" BufferOffset="68" Addr="68" Description="" />
<DO_ITEM Index="69" Name="DO_PreheatProcessTransferReady" BufferOffset="69" Addr="69" Description="" />
<DO_ITEM Index="71" Name="DO_TMWaferPresenceLL" BufferOffset="71" Addr="71" Description="" />
<DO_ITEM Index="72" Name="DO_TMWaferPresenceA" BufferOffset="72" Addr="72" Description="" />
<DO_ITEM Index="73" Name="DO_TMWaferPresenceB" BufferOffset="73" Addr="73" Description="" />
<DO_ITEM Index="74" Name="DO_TMWaferPresenceBuf" BufferOffset="74" Addr="74" Description="" />
<DO_ITEM Index="75" Name="DO_TMWaferPresenceUnload" BufferOffset="75" Addr="75" Description="" />
<DO_ITEM Index="78" Name="DO_ForelineBasePressureReady" BufferOffset="78" Addr="78" Description="" />
<DO_ITEM Index="79" Name="DO_TMatATM" BufferOffset="79" Addr="79" Description="" />
<DO_ITEM Index="80" Name="DO_LoadAtATM" BufferOffset="80" Addr="80" Description="" />
<DO_ITEM Index="81" Name="DO_TMUnderVac" BufferOffset="81" Addr="81" Description="" />
<DO_ITEM Index="82" Name="DO_LoadUnderVAC" BufferOffset="82" Addr="82" Description="" />
<DO_ITEM Index="83" Name="DO_TMAtProcessPress" BufferOffset="83" Addr="83" Description="" />
<DO_ITEM Index="84" Name="DO_LoadAtProcessPress" BufferOffset="84" Addr="84" Description="" />
<DO_ITEM Index="85" Name="DO_LoadTempReady" BufferOffset="85" Addr="85" Description="" />
<DO_ITEM Index="86" Name="DO_BufferTempReady" BufferOffset="86" Addr="86" Description="" />
<DO_ITEM Index="88" Name="DO_TMCyclePurgeRoutineSuccessed" BufferOffset="88" Addr="88" Description="" />
<DO_ITEM Index="89" Name="DO_TMCyclePurgeRoutineRunning" BufferOffset="89" Addr="89" Description="" />
<DO_ITEM Index="90" Name="DO_TMLeakCheckRoutineRunning" BufferOffset="90" Addr="90" Description="" />
<DO_ITEM Index="91" Name="DO_TMPumpDownRoutineRunning" BufferOffset="91" Addr="91" Description="" />
<DO_ITEM Index="92" Name="DO_TMServoPressRoutineRunning" BufferOffset="92" Addr="92" Description="" />
<DO_ITEM Index="93" Name="DO_TMVentUpRoutineRunning" BufferOffset="93" Addr="93" Description="" />
<DO_ITEM Index="94" Name="DO_LoadCyclePurgeRoutineRunning" BufferOffset="94" Addr="94" Description="" />
<DO_ITEM Index="95" Name="DO_LoadLeakCheckRoutineRunning" BufferOffset="95" Addr="95" Description="" />
<DO_ITEM Index="96" Name="DO_LoadPumpDownRoutineRunning" BufferOffset="96" Addr="96" Description="" />
<DO_ITEM Index="97" Name="DO_LoadVentUpRoutineRunning" BufferOffset="97" Addr="97" Description="" />
<DO_ITEM Index="98" Name="DO_UnLoadCyclePurgeRoutineRunning" BufferOffset="98" Addr="98" Description="" Visible="false"/>
<DO_ITEM Index="99" Name="DO_UnLoadLeakCheckRoutineRunning" BufferOffset="99" Addr="99" Description="" Visible="false"/>
<DO_ITEM Index="100" Name="DO_UnLoadPumpDownRoutineRunning" BufferOffset="100" Addr="100" Description="" Visible="false"/>
<DO_ITEM Index="101" Name="DO_UnLoadVentUpRoutineRunning" BufferOffset="101" Addr="101" Description="" Visible="false"/>
<DO_ITEM Index="144" Name="DO_LdRotationServoOn" BufferOffset="144" Addr="144" Description="" Visible="false"/>
<DO_ITEM Index="145" Name="DO_LdRotationReset" BufferOffset="145" Addr="145" Description="" Visible="false"/>
<DO_ITEM Index="146" Name="DO_LdRotationJogCW" BufferOffset="146" Addr="146" Description="" Visible="false"/>
<DO_ITEM Index="147" Name="DO_LdRotationJogCCW" BufferOffset="147" Addr="147" Description="" Visible="false"/>
<DO_ITEM Index="148" Name="DO_LdRotationStop" BufferOffset="148" Addr="148" Description="" Visible="false"/>
<DO_ITEM Index="149" Name="DO_LdRotationCCD1Teah" BufferOffset="149" Addr="149" Description="" Visible="false"/>
<DO_ITEM Index="150" Name="DO_LdRotationCCD2Teah" BufferOffset="150" Addr="150" Description="" Visible="false"/>
<DO_ITEM Index="151" Name="DO_LdRotationMoveRelativeHome" BufferOffset="151" Addr="151" Description="" Visible="false"/>
<DO_ITEM Index="152" Name="DO_LdRotationMoveOneCircle" BufferOffset="152" Addr="152" Description="" Visible="false"/>
<DO_ITEM Index="153" Name="DO_LdRotationMoveCCD1Pos" BufferOffset="153" Addr="153" Description="" Visible="false"/>
<DO_ITEM Index="154" Name="DO_LdRotationMoveCCD2Pos" BufferOffset="154" Addr="154" Description="" Visible="false"/>
</Block>
</Dig_Out>
<Ana_In>
<Block Index="0">
<AI_ITEM Index="0" Name="AI_TMPressure1" BufferOffset="0" Addr="0" Description="" />
<AI_ITEM Index="1" Name="AI_LoadPressure" BufferOffset="1" Addr="1" Description="" />
<AI_ITEM Index="2" Name="AI_PM1Pressure2" BufferOffset="2" Addr="2" Description="" />
<AI_ITEM Index="3" Name="AI_PM2Pressure2" BufferOffset="3" Addr="3" Description="" />
<AI_ITEM Index="4" Name="AI_UnloadPressure" BufferOffset="4" Addr="4" Description="" />
<AI_ITEM Index="5" Name="AI_UnloadTemp" BufferOffset="5" Addr="5" Description="" />
<AI_ITEM Index="7" Name="AI_BufferTemp" BufferOffset="7" Addr="7" Description="" />
<AI_ITEM Index="8" Name="AI_M60FlowRead" BufferOffset="8" Addr="8" Description="" />
<AI_ITEM Index="9" Name="AI_M61FlowRead" BufferOffset="9" Addr="9" Description="" />
<AI_ITEM Index="13" Name="AI_LdRotationRelativeDegree" BufferOffset="13" Addr="13" Description="" />
<AI_ITEM Index="14" Name="AI_LdRotationCCD1Degree" BufferOffset="14" Addr="14" Description="" />
<AI_ITEM Index="15" Name="AI_LdRotationCCD2Degree" BufferOffset="15" Addr="15" Description="" />
</Block>
</Ana_In>
<Ana_Out>
<Block Index="0">
<AO_ITEM Index="8" Name="AO_M60FlowSetpoint" BufferOffset="8" Addr="8" Description="" />
<AO_ITEM Index="9" Name="AO_M61FlowSetpoint" BufferOffset="9" Addr="9" Description="" />
<AO_ITEM Index="10" Name="AO_LdRotationHomeOffset" BufferOffset="10" Addr="10" Description="" Visible="false"/>
<AO_ITEM Index="11" Name="AO_HomeOffsetDegreeLU" BufferOffset="11" Addr="11" Description="" />
<AO_ITEM Index="12" Name="AO_LdRotationCCD1Degree" BufferOffset="12" Addr="12" Description="" />
<AO_ITEM Index="13" Name="AO_LdRotationSpeed" BufferOffset="13" Addr="13" Description="" />
<AO_ITEM Index="14" Name="AO_LdRotationPosSpeed" BufferOffset="14" Addr="14" Description="" />
<AO_ITEM Index="15" Name="AO_LdRotationCCD2Degree" BufferOffset="15" Addr="15" Description="" />
</Block>
</Ana_Out>
</IO_DEFINE>

View File

@ -1,148 +0,0 @@
using System;
using Aitex.Core.RT.IOCore;
using MECF.Framework.Common.IOCore;
using MECF.Framework.Common.PLC;
namespace SicSimulator.Instances
{
public class SimulatorAdsPlcService : IWcfPlcService
{
//diVariable="" doVariable="" aiVariable="" aoVariable=""
public bool CheckIsConnected()
{
return true;
}
public bool Read(string variable, out object data, string type, int length, out string reason)
{
reason = string.Empty;
data = null;
if (!TryParseIoVariable(variable, out var pmSource, out var ioType, out var bufferIndex))
return true;
switch (ioType)
{
case "DI":
data = IoManager.Instance.GetDiBuffer(pmSource)[bufferIndex];
break;
case "DO":
data = IoManager.Instance.GetDoBuffer(pmSource)[bufferIndex];
break;
case "AI":
data = IoManager.Instance.GetAiBuffer(pmSource)[bufferIndex];
break;
case "AO":
data = IoManager.Instance.GetAoBuffer(pmSource)[bufferIndex];
break;
}
return true;
}
public bool WriteArrayElement(string variable, int index, object value, out string reason)
{
reason = string.Empty;
if (!TryParseIoVariable(variable, out var pmSource, out var ioType, out var bufferIndex))
return true;
switch (ioType)
{
case "DI":
break;
case "DO":
IoManager.Instance.GetDoBuffer(pmSource)[bufferIndex][index] = (bool)value;
break;
case "AI":
IoManager.Instance.GetAiBuffer(pmSource)[bufferIndex][index] = (float)value;
break;
case "AO":
IoManager.Instance.GetAoBuffer(pmSource)[bufferIndex][index] = (float)value;
break;
}
return true;
}
public bool[] ReadDi(int offset, int size, out string reason)
{
throw new System.NotImplementedException();
}
public float[] ReadAiFloat(int offset, int size, out string reason)
{
throw new System.NotImplementedException();
}
public int[] ReadAiInt(int offset, int size, out string reason)
{
throw new System.NotImplementedException();
}
public bool WriteDo(int offset, bool[] buffer, out string reason)
{
throw new System.NotImplementedException();
}
public bool WriteAoFloat(int offset, float[] buffer, out string reason)
{
throw new System.NotImplementedException();
}
public bool WriteAoInt(int offset, int[] buffer, out string reason)
{
throw new System.NotImplementedException();
}
public int Heartbeat(int counter)
{
return counter;
}
// GVL_IO.PM{n}_{DI|DO|AI|AO}_G[_N] => PM{n}.PLC, type, index (N-1, default 0)
private static bool TryParseIoVariable(string variable, out string pmSource, out string ioType, out int bufferIndex)
{
pmSource = null;
ioType = null;
bufferIndex = 0;
var dotIndex = variable.LastIndexOf('.');
if (dotIndex < 0)
return false;
var name = variable.Substring(dotIndex + 1);
var pmEnd = name.IndexOf('_');
if (pmEnd <= 2 || !name.StartsWith("PM"))
return false;
pmSource = name.Substring(0, pmEnd) + ".PLC";
var rest = name.Substring(pmEnd + 1);
if (rest.StartsWith("DI_")) ioType = "DI";
else if (rest.StartsWith("DO_")) ioType = "DO";
else if (rest.StartsWith("AI_")) ioType = "AI";
else if (rest.StartsWith("AO_")) ioType = "AO";
else return false;
const string groupMarker = "_G";
var gIndex = rest.LastIndexOf(groupMarker, StringComparison.Ordinal);
if (gIndex < 0)
return false;
var indexPart = rest.Substring(gIndex + groupMarker.Length);
if (indexPart.Length == 0)
bufferIndex = 0;
else if (indexPart.StartsWith("_") && int.TryParse(indexPart.Substring(1), out var suffixNum))
bufferIndex = suffixNum - 1;
else
return false;
return true;
}
}
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1,284 +0,0 @@
<UserControl
x:Class="SicUI.Controls.M2C4Parts.M2C4EFEMView3"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="clr-namespace:SicUI.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:SicUI.Controls.M2C4Parts"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:unitControls="clr-namespace:MECF.Framework.UI.Client.Ctrlib.UnitControls;assembly=MECF.Framework.UI.Client"
Width="771"
Height="699"
mc:Ignorable="d">
<Grid
x:Name="root"
Height="800"
VerticalAlignment="Top">
<Canvas Margin="-47,52,47,20">
<Image
Canvas.Left="250"
Canvas.Top="224"
Width="275"
Height="275"
HorizontalAlignment="Left"
VerticalAlignment="Center"
Source="Images/tm4.png" />
<Image
Canvas.Left="341"
Canvas.Top="327.333"
Source="Images/tm3.png" />
<TextBlock
Canvas.Left="360"
Canvas.Top="269"
HorizontalAlignment="Left"
VerticalAlignment="Center"
FontFamily="Arial"
FontSize="18"
Text="TM" />
<Canvas Visibility="{Binding IsPM1Installed, Converter={StaticResource BoolVisibilityConverter}}">
<TextBlock
Canvas.Left="207"
Canvas.Top="146"
HorizontalAlignment="Center"
VerticalAlignment="Top"
FontFamily="Arial"
FontSize="18"
Text="PM1"
Visibility="{Binding IsPM1Installed, Converter={StaticResource BoolVisibilityConverter}}" />
<Image
Canvas.Left="189"
Canvas.Top="141"
Width="160"
HorizontalAlignment="Center"
VerticalAlignment="Top"
Source="Images/pmbg51.png">
<Image.RenderTransform>
<TransformGroup>
<RotateTransform Angle="-5.5" />
</TransformGroup>
</Image.RenderTransform>
</Image>
<unitControls:Door
Canvas.Left="278"
Canvas.Top="272"
Width="90"
Height="9"
HorizontalAlignment="Center"
VerticalAlignment="Top"
IsDoorOpen="{Binding IsPM1DoorOpen}"
RenderTransformOrigin="0.5,0.5">
<unitControls:Door.RenderTransform>
<TransformGroup>
<ScaleTransform />
<SkewTransform />
<RotateTransform Angle="-36" />
<TranslateTransform />
</TransformGroup>
</unitControls:Door.RenderTransform>
</unitControls:Door>
</Canvas>
<Canvas Visibility="{Binding IsPM2Installed, Converter={StaticResource BoolVisibilityConverter}}">
<TextBlock
Canvas.Left="510"
Canvas.Top="146"
HorizontalAlignment="Center"
VerticalAlignment="Top"
FontFamily="Arial"
FontSize="18"
Text="PM2"
Visibility="{Binding IsPM2Installed, Converter={StaticResource BoolVisibilityConverter}}" />
<Image
Canvas.Left="410"
Canvas.Top="129"
Width="160"
HorizontalAlignment="Center"
VerticalAlignment="Top"
Source="Images/pmbg41.png">
<Image.RenderTransform>
<TransformGroup>
<ScaleTransform />
<SkewTransform />
<RotateTransform Angle="5.5" />
<TranslateTransform />
</TransformGroup>
</Image.RenderTransform>
</Image>
<unitControls:Door
Canvas.Left="389"
Canvas.Top="274"
Width="90"
Height="8"
HorizontalAlignment="Center"
VerticalAlignment="Top"
IsDoorOpen="{Binding IsPM2DoorOpen}"
RenderTransformOrigin="0.5,0.5">
<unitControls:Door.RenderTransform>
<TransformGroup>
<ScaleTransform />
<SkewTransform />
<RotateTransform Angle="35.8" />
<TranslateTransform />
</TransformGroup>
</unitControls:Door.RenderTransform>
</unitControls:Door>
<!-- Tray和晶圆 -->
</Canvas>
<Canvas Visibility="{Binding IsLoadLockInstalled, Converter={StaticResource BoolVisibilityConverter}}">
<TextBlock
Canvas.Left="536"
Canvas.Top="418"
HorizontalAlignment="Left"
VerticalAlignment="Center"
FontFamily="Arial"
FontSize="18"
Text="Load"
Visibility="{Binding IsLLInstalled, Converter={StaticResource BoolVisibilityConverter}}" />
<unitControls:Door
Canvas.Left="404"
Canvas.Top="428"
Width="83"
Height="9"
HorizontalAlignment="Center"
VerticalAlignment="Top"
IsDoorOpen="{Binding IsLLDoorOpen}"
RenderTransformOrigin="0.5,0.5">
<unitControls:Door.RenderTransform>
<TransformGroup>
<RotateTransform Angle="-46" />
</TransformGroup>
</unitControls:Door.RenderTransform>
</unitControls:Door>
<Image
Canvas.Left="406"
Canvas.Top="470"
Width="110"
Height="126"
HorizontalAlignment="Center"
VerticalAlignment="Top"
Source="Images/wf-2.png">
<Image.RenderTransform>
<TransformGroup>
<RotateTransform Angle="-46" />
</TransformGroup>
</Image.RenderTransform>
</Image>
</Canvas>
<local:AtmRobotMultiLP
Canvas.Left="349"
Canvas.Top="316"
Width="550"
Height="80"
HasTray="{Binding TMRobotHaveTray}"
HasWafer="{Binding IsArmWater}"
IsEnabled="{Binding TMEnableWaferClick}"
RobotMoveInfo="{Binding TmRobotMoveInfo}"
RotateAngle="123"
ShowDock="False"
TranslateX="120"
Wafer1="{Binding TMRobotWafer1}" />
<Canvas Visibility="{Binding IsBufferInstalled, Converter={StaticResource BoolVisibilityConverter}}">
<TextBlock
Canvas.Left="166"
Canvas.Top="418"
HorizontalAlignment="Left"
VerticalAlignment="Center"
FontFamily="Arial"
FontSize="18"
Text="Buffer"
Visibility="{Binding IsBufferInstalled, Converter={StaticResource BoolVisibilityConverter}}" />
<Image
Canvas.Left="212"
Canvas.Top="407"
Width="100"
Height="120"
HorizontalAlignment="Left"
VerticalAlignment="Top"
RenderTransformOrigin="0.5,0.5"
Source="Images/Buffer.png">
<Image.RenderTransform>
<TransformGroup>
<RotateTransform Angle="45" />
</TransformGroup>
</Image.RenderTransform>
</Image>
<unitControls:Door
Canvas.Left="263"
Canvas.Top="420"
Width="82"
Height="9"
IsDoorOpen="{Binding IsBufferDoorOpen}"
RenderTransformOrigin="0.5,0.5">
<unitControls:Door.RenderTransform>
<TransformGroup>
<ScaleTransform />
<SkewTransform />
<RotateTransform Angle="45" />
<TranslateTransform />
</TransformGroup>
</unitControls:Door.RenderTransform>
</unitControls:Door>
</Canvas>
<Canvas Visibility="{Binding IsPM1Installed, Converter={StaticResource BoolVisibilityConverter}}">
<Image
Canvas.Left="247"
Canvas.Top="180"
Width="82"
HorizontalAlignment="Center"
VerticalAlignment="Top"
Source="Images/pm52.png"
Visibility="{Binding PM1HaveTray}" />
<controls:WaferCtrl
Canvas.Left="258"
Canvas.Top="192"
Width="58"
Height="58"
IsEnabled="{Binding PM1EnableWaferClick}"
IsRotary="{Binding IsPm1WaferRotary}"
WaferData="{Binding PM1Wafer}" />
</Canvas>
<Canvas Visibility="{Binding IsPM2Installed, Converter={StaticResource BoolVisibilityConverter}}">
<Image
Canvas.Left="431"
Canvas.Top="185"
Width="82"
Source="Images/pm52.png"
Visibility="{Binding PM2HaveTray}" />
<controls:WaferCtrl
Canvas.Left="442"
Canvas.Top="197"
Width="58"
Height="58"
IsEnabled="{Binding PM2EnableWaferClick}"
IsRotary="{Binding IsPm2WaferRotary}"
WaferData="{Binding PM2Wafer}" />
</Canvas>
<Canvas Visibility="{Binding IsLoadLockInstalled, Converter={StaticResource BoolVisibilityConverter}}">
<Image
Canvas.Left="449"
Canvas.Top="435"
Width="82"
HorizontalAlignment="Left"
VerticalAlignment="Center"
Source="Images/pm52.png"
Visibility="{Binding LoadLockHaveTray}" />
<controls:WaferCtrl
Canvas.Left="460"
Canvas.Top="446"
Width="58"
Height="58"
IsEnabled="{Binding LLEnableWaferClick}"
WaferData="{Binding LoadLockWafer}" />
</Canvas>
</Canvas>
</Grid>
</UserControl>

View File

@ -1,55 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace SicUI.Controls.M2C4Parts
{
/// <summary>
/// M2C4EFEMView3.xaml 的交互逻辑
/// </summary>
public partial class M2C4EFEMView3 : UserControl
{
public M2C4EFEMView3()
{
InitializeComponent();
}
public bool IsPM1DoorOpen
{
get { return (bool)GetValue(IsPM1DoorOpenProperty); }
set { SetValue(IsPM1DoorOpenProperty, value); }
}
public static readonly DependencyProperty IsPM1DoorOpenProperty =
DependencyProperty.Register("IsPM1DoorOpen", typeof(bool), typeof(M2C4EFEMView3), new FrameworkPropertyMetadata(false));
public bool IsPM2DoorOpen
{
get { return (bool)GetValue(IsPM2DoorOpenProperty); }
set { SetValue(IsPM2DoorOpenProperty, value); }
}
public static readonly DependencyProperty IsPM2DoorOpenProperty =
DependencyProperty.Register("IsPM2DoorOpen", typeof(bool), typeof(M2C4EFEMView3), new FrameworkPropertyMetadata(false));
public bool IsLLDoorOpen
{
get { return (bool)GetValue(IsLLDoorOpenProperty); }
set { SetValue(IsLLDoorOpenProperty, value); }
}
public static readonly DependencyProperty IsLLDoorOpenProperty =
DependencyProperty.Register("IsLLDoorOpen", typeof(bool), typeof(M2C4EFEMView3), new FrameworkPropertyMetadata(false));
}
}

BIN
Dependencies/Abt.Controls.SciChart.Wpf.dll (Stored with Git LFS) vendored

Binary file not shown.

BIN
Dependencies/Advantech.Adam.dll (Stored with Git LFS) vendored

Binary file not shown.

BIN
Dependencies/Advantech.Common.DLL (Stored with Git LFS) vendored

Binary file not shown.

BIN
Dependencies/Advantech.Graph.dll (Stored with Git LFS) vendored

Binary file not shown.

BIN
Dependencies/Advantech.Protocol.DLL (Stored with Git LFS) vendored

Binary file not shown.

BIN
Dependencies/Aitex.Sorter.Common.dll (Stored with Git LFS) vendored

Binary file not shown.

BIN
Dependencies/Aitex.Sorter.UI.dll (Stored with Git LFS) vendored

Binary file not shown.

BIN
Dependencies/Aitex.Sorter.UI.resources.dll (Stored with Git LFS) vendored

Binary file not shown.

BIN
Dependencies/Automation.BDaq4.Design.dll (Stored with Git LFS) vendored

Binary file not shown.

BIN
Dependencies/Automation.BDaq4.dll (Stored with Git LFS) vendored

Binary file not shown.

BIN
Dependencies/BAI.ClientInitLib.dll (Stored with Git LFS) vendored

Binary file not shown.

BIN
Dependencies/BAI.InfrasLib.dll (Stored with Git LFS) vendored

Binary file not shown.

BIN
Dependencies/BAI.SystemsLib.dll (Stored with Git LFS) vendored

Binary file not shown.

BIN
Dependencies/Caliburn.Micro.dll (Stored with Git LFS) vendored

Binary file not shown.

BIN
Dependencies/DePacker.dll (Stored with Git LFS) vendored

Binary file not shown.

BIN
Dependencies/Efem.Common.dll (Stored with Git LFS) vendored

Binary file not shown.

BIN
Dependencies/ExcelLibrary.dll (Stored with Git LFS) vendored

Binary file not shown.

BIN
Dependencies/Global.dll (Stored with Git LFS) vendored

Binary file not shown.

BIN
Dependencies/Hardcodet.Wpf.TaskbarNotification.dll (Stored with Git LFS) vendored

Binary file not shown.

BIN
Dependencies/HslCommunication.dll (Stored with Git LFS) vendored

Binary file not shown.

BIN
Dependencies/ILNumerics.Net.dll (Stored with Git LFS) vendored

Binary file not shown.

BIN
Dependencies/InfoHelp.dll (Stored with Git LFS) vendored

Binary file not shown.

BIN
Dependencies/Interop.VBIDE.dll (Stored with Git LFS) vendored

Binary file not shown.

BIN
Dependencies/LicenseCalc.dll (Stored with Git LFS) vendored

Binary file not shown.

BIN
Dependencies/Loya.Dameer.dll (Stored with Git LFS) vendored

Binary file not shown.

BIN
Dependencies/LuaInterface.dll (Stored with Git LFS) vendored

Binary file not shown.

BIN
Dependencies/Microsoft.Expression.Drawing.dll (Stored with Git LFS) vendored

Binary file not shown.

BIN
Dependencies/Microsoft.Expression.Interactions.dll (Stored with Git LFS) vendored

Binary file not shown.

BIN
Dependencies/Microsoft.Office.Interop.Excel.dll (Stored with Git LFS) vendored

Binary file not shown.

BIN
Dependencies/OpenSEMI.ClientBase.dll (Stored with Git LFS) vendored

Binary file not shown.

BIN
Dependencies/Parser.dll (Stored with Git LFS) vendored

Binary file not shown.

BIN
Dependencies/RTOverEthernet.dll (Stored with Git LFS) vendored

Binary file not shown.

BIN
Dependencies/SNMPAnalyze.dll (Stored with Git LFS) vendored

Binary file not shown.

BIN
Dependencies/SessionLayer.dll (Stored with Git LFS) vendored

Binary file not shown.

BIN
Dependencies/SuperSocket.Facility.dll (Stored with Git LFS) vendored

Binary file not shown.

BIN
Dependencies/SuperSocket.SocketBase.dll (Stored with Git LFS) vendored

Binary file not shown.

BIN
Dependencies/SuperSocket.SocketEngine.dll (Stored with Git LFS) vendored

Binary file not shown.

BIN
Dependencies/System.Data.SQLite.dll (Stored with Git LFS) vendored

Binary file not shown.

BIN
Dependencies/TcAdsDll.dll (Stored with Git LFS) vendored

Binary file not shown.

BIN
Dependencies/Tools.dll (Stored with Git LFS) vendored

Binary file not shown.

BIN
Dependencies/TwinCAT.Ads.dll (Stored with Git LFS) vendored

Binary file not shown.

BIN
Dependencies/WinSECS.dll (Stored with Git LFS) vendored

Binary file not shown.

BIN
Dependencies/WinSECSpe.dll (Stored with Git LFS) vendored

Binary file not shown.

BIN
Dependencies/XPTable.dll (Stored with Git LFS) vendored

Binary file not shown.

BIN
Dependencies/Xceed.Wpf.AvalonDock.Themes.Aero.dll (Stored with Git LFS) vendored

Binary file not shown.

BIN
Dependencies/Xceed.Wpf.AvalonDock.Themes.Metro.dll (Stored with Git LFS) vendored

Binary file not shown.

BIN
Dependencies/Xceed.Wpf.AvalonDock.Themes.VS2010.dll (Stored with Git LFS) vendored

Binary file not shown.

BIN
Dependencies/alibm_32.dll (Stored with Git LFS) vendored

Binary file not shown.

BIN
Dependencies/csmatio.dll (Stored with Git LFS) vendored

Binary file not shown.

BIN
Dependencies/cwrlib.DLL (Stored with Git LFS) vendored

Binary file not shown.

BIN
Dependencies/cwrlib32.dll (Stored with Git LFS) vendored

Binary file not shown.

BIN
Dependencies/cwrlib64.dll (Stored with Git LFS) vendored

Binary file not shown.

BIN
Dependencies/lua51.dll (Stored with Git LFS) vendored

Binary file not shown.

BIN
Dependencies/selfbuild/ZedGraph.dll (Stored with Git LFS) vendored

Binary file not shown.

BIN
Dependencies/tptools_ml.dll (Stored with Git LFS) vendored

Binary file not shown.

BIN
Dependencies/zlib.net.dll (Stored with Git LFS) vendored

Binary file not shown.

View File

@ -1,66 +0,0 @@
using System.Diagnostics;
using System.IO;
using Aitex.Core.RT.DBCore;
namespace Aitex.Common.Util
{
public class PathManager
{
private static string _appPath;
public static string GetAppDir()
{
return (!string.IsNullOrWhiteSpace(_appPath)) ? _appPath : (_appPath = GetAppStartupDirectory());
}
public static string GetCfgDir()
{
return GetDirectory("Config");
}
public static string GetLogDir()
{
return GetDirectory("Logs");
}
public static string GetRecipeDir()
{
return GetDirectory("Recipes");
}
public static string GetAccountFilePath()
{
return GetDirectory("Account");
}
public static string GetMaintainFilePath()
{
return GetDirectory("Maintain");
}
private static string GetAppStartupDirectory()
{
string fileName = Process.GetCurrentProcess().MainModule.FileName;
return Path.GetDirectoryName(fileName);
}
public static string GetDirectory(string directoryPath)
{
string text = Path.Combine(GetAppDir(), directoryPath);
if (!text.EndsWith(Path.DirectorySeparatorChar.ToString()))
{
text += Path.DirectorySeparatorChar;
}
if (!Directory.Exists(text))
{
Directory.CreateDirectory(text);
}
return text;
}
public static string GetDBDictionary()
{
return DB.GetLocalDictionary();
}
}
}

View File

@ -1,43 +0,0 @@
using System;
using Aitex.Core.Util;
namespace Aitex.Core.Account
{
[Serializable]
public class Account
{
public string AccountId { get; set; }
public string Role { get; set; }
public string RealName { get; set; }
public string Touxian { get; set; }
public string Company { get; set; }
public string Department { get; set; }
public bool AccountStatus { get; set; }
public string Email { get; set; }
public string Telephone { get; set; }
public string Description { get; set; }
public string LastLoginTime { get; set; }
public string LastAccountUpdateTime { get; set; }
public string AccountCreationTime { get; set; }
public SerializableDictionary<string, ViewPermission> Permission { get; set; }
public string Md5Pwd { get; set; }
public string LoginIP { get; set; }
public string LoginId { get; set; }
}
}

View File

@ -1,673 +0,0 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Xml;
using Aitex.Common.Util;
using Aitex.Core.RT.Event;
using Aitex.Core.RT.Log;
using Aitex.Core.Util;
using Aitex.Core.Utilities;
namespace Aitex.Core.Account
{
public class AccountManager : Singleton<AccountManager>
{
#region Variables
private readonly Dictionary<string, Tuple<Guid, DateTime, string>> _userList;
private readonly string _accountPath;
private readonly string _rolePath;
private readonly string _viewPath;
private readonly XmlDocument _accountXml;
private readonly XmlDocument _roleXml;
private readonly XmlDocument _viewsXml;
#endregion
#region Constructors
public AccountManager()
{
SerialNumber = "001";
Module = "System";
try
{
_userList = new Dictionary<string, Tuple<Guid, DateTime, string>>();
_accountPath = Path.Combine(PathManager.GetAccountFilePath(), "Account.xml");
_rolePath = Path.Combine(PathManager.GetAccountFilePath(), "Roles.xml");
_viewPath = Path.Combine(PathManager.GetAccountFilePath(), "Views.xml");
_accountXml = new XmlDocument();
_roleXml = new XmlDocument();
var fileInfo = new FileInfo(_rolePath);
if (!fileInfo.Directory.Exists)
{
fileInfo.Directory.Create();
}
if (!fileInfo.Exists)
{
_roleXml.LoadXml("<?xml version=\"1.0\" encoding=\"utf-8\"?><Aitex><Roles></Roles></Aitex>");
Save(_roleXml, _rolePath);
}
else
{
_roleXml.Load(_rolePath);
}
var fileInfo2 = new FileInfo(_accountPath);
if (!fileInfo2.Directory.Exists)
{
fileInfo2.Directory.Create();
}
if (!fileInfo2.Exists)
{
_accountXml.LoadXml("<?xml version='1.0' encoding='utf-8' ?><AccountManagement></AccountManagement>");
Save(_accountXml, _accountPath);
}
else
{
_accountXml.Load(_accountPath);
}
_viewsXml = new XmlDocument();
fileInfo2 = new FileInfo(_viewPath);
if (!fileInfo2.Directory.Exists)
{
fileInfo2.Directory.Create();
}
if (!fileInfo2.Exists)
{
_viewsXml.LoadXml("<?xml version='1.0' encoding='utf-8' ?><root><Views></Views></root>");
Save(_viewsXml, _viewPath);
}
else
{
_viewsXml.Load(_viewPath);
}
var text = Path.Combine(PathManager.GetCfgDir(), "RolePermission.xml");
if (!File.Exists(text))
{
var xmlDocument = new XmlDocument();
xmlDocument.LoadXml("<?xml version=\"1.0\" encoding=\"utf-8\" ?><Aitex></Aitex>");
xmlDocument.Save(text);
}
}
catch (Exception ex)
{
LOG.Write(ex);
}
}
#endregion
#region Properties
public string SerialNumber { get; }
public string Module { get; }
public GetAccountListResult Accounts { get; private set; }
#endregion
#region Methods
public List<Account> GetLoginUserList()
{
var list = new List<Account>();
foreach (var key in _userList.Keys)
{
var accountInfo = GetAccountInfo(key).AccountInfo;
accountInfo.LoginIP = _userList[key].Item3;
list.Add(accountInfo);
}
return list;
}
public void RegisterViews(List<string> views)
{
try
{
var xmlNode = _viewsXml.SelectSingleNode("/root/Views");
foreach (var view in views)
{
if (xmlNode.SelectSingleNode($"View[@Name='{view}']") == null)
{
var xmlElement = _viewsXml.CreateElement("View");
xmlElement.SetAttribute("Name", view);
xmlElement.SetAttribute("Description", view);
xmlNode.AppendChild(xmlElement);
}
}
Save(_viewsXml, _viewPath);
}
catch (Exception ex)
{
LOG.Write(ex);
}
}
private void Save(XmlDocument doc, string path)
{
doc.Save(path);
FileSigner.Sign(path);
GetAccountList();
}
public void Logout(string accountId)
{
try
{
LOG.Write($"用户{accountId}注销登录");
accountId = accountId.ToLower();
if (_userList.ContainsKey(accountId))
{
_userList.Remove(accountId);
}
EV.PostMessage("System", EventEnum.UserLoggedOff, accountId);
}
catch (Exception ex)
{
LOG.Write(ex, $"注销用户{accountId}发生异常");
}
}
public void Kickout(string accountId, string kickOutReason)
{
try
{
LOG.Write($"用户{accountId}强制注销登录");
accountId = accountId.ToLower();
if (_userList.ContainsKey(accountId))
{
EV.PostKickoutMessage($"用户{accountId}强制注销登录,{kickOutReason}");
_userList.Remove(accountId);
}
EV.PostMessage(Module, EventEnum.UserLoggedOff, accountId);
}
catch (Exception ex)
{
LOG.Write(ex, $"强制注销用户{accountId}发生异常");
}
}
public GetAccountInfoResult GetAccountInfo(string accountId)
{
try
{
accountId = accountId.ToLower();
var getAccountInfoResult = new GetAccountInfoResult();
if (!FileSigner.IsValid(_accountPath))
{
getAccountInfoResult.Description = "账号文件数字签名校验失败";
getAccountInfoResult.ActSuccess = false;
}
else
{
var accountNode = GetAccountNode(accountId);
if (accountNode == null)
{
if (accountId == "admin")
{
var account = new Account
{
Role = "Admin",
Permission = GetSingleRolePermission("Admin"),
AccountId = "admin",
RealName = "admin",
Email = "admin@admin.com",
Telephone = "86-21-88886666",
Touxian = "Admin",
Company = "MY Tech",
Department = "IT",
Description = "Administrator拥有用户权限修改、菜单修改定序器修改等权限.",
AccountStatus = true,
Md5Pwd = Md5Helper.GetMd5Hash("admin")
};
CreateAccount(account);
getAccountInfoResult.ActSuccess = true;
getAccountInfoResult.AccountInfo = account;
getAccountInfoResult.Description = $"成功获取账号信息{accountId}";
}
else
{
getAccountInfoResult.Description = $"账号{accountId}不存在";
getAccountInfoResult.ActSuccess = false;
}
}
else
{
getAccountInfoResult.AccountInfo = new Account
{
Role = accountNode.SelectSingleNode("Role").InnerText,
Permission = GetSingleRolePermission((accountId == "admin")
? "Admin"
: accountNode.SelectSingleNode("Role").InnerText),
AccountId = accountId,
RealName = accountNode.SelectSingleNode("RealName").InnerText,
Email = accountNode.SelectSingleNode("Email").InnerText,
Telephone = accountNode.SelectSingleNode("Telephone").InnerText,
Touxian = accountNode.SelectSingleNode("Touxian").InnerText,
Company = accountNode.SelectSingleNode("Company").InnerText,
Department = accountNode.SelectSingleNode("Department").InnerText,
Description = accountNode.SelectSingleNode("Description").InnerText,
AccountStatus = (string.Compare(accountNode.SelectSingleNode("AccountState").InnerText,
"Enable", ignoreCase: true) == 0),
AccountCreationTime = accountNode.SelectSingleNode("CreationTime").InnerText,
LastAccountUpdateTime = accountNode.SelectSingleNode("LastUpdateTime").InnerText,
LastLoginTime = accountNode.SelectSingleNode("LastLoginTime").InnerText,
Md5Pwd = accountNode.SelectSingleNode("Password").InnerText
};
getAccountInfoResult.Description = $"获取账号{accountId}成功";
getAccountInfoResult.ActSuccess = true;
}
}
return getAccountInfoResult;
}
catch (Exception ex)
{
var text = $"获取账号{accountId}发生异常";
LOG.Write(ex, text);
return new GetAccountInfoResult
{
ActSuccess = false,
Description = text
};
}
}
public ChangePwdResult ChangePassword(string accountId, string newPassword)
{
try
{
LOG.Write($"修改账号{accountId}的密码");
accountId = accountId.ToLower();
var changePwdResult = new ChangePwdResult();
if (!FileSigner.IsValid(_accountPath))
{
changePwdResult.Description = "修改密码失败,账号文件数字签名损坏!";
changePwdResult.ActSucc = false;
}
else
{
var accountNode = GetAccountNode(accountId);
if (accountNode == null)
{
changePwdResult.Description = $"账号{accountId}不存在";
changePwdResult.ActSucc = false;
}
else
{
accountNode.SelectSingleNode("Password").InnerText = Md5Helper.GetMd5Hash(newPassword);
Save(_accountXml, _accountPath);
changePwdResult.Description = "修改密码成功!";
changePwdResult.ActSucc = true;
EV.PostMessage(Module, EventEnum.PasswordChanged, accountId);
}
}
return changePwdResult;
}
catch (Exception ex)
{
var text = $"修改账号{accountId}的密码失败";
LOG.Write(ex, text);
return new ChangePwdResult
{
ActSucc = false,
Description = text
};
}
}
public CreateAccountResult CreateAccount(Account newAccount)
{
try
{
LOG.Write($"创建账号{newAccount.AccountId}");
var createAccountResult = new CreateAccountResult();
if (newAccount == null)
{
createAccountResult.Description = "账号有误";
createAccountResult.ActSucc = false;
}
else if (!FileSigner.IsValid(_accountPath))
{
createAccountResult.Description = $"创建账号失败,数字签名损坏!";
createAccountResult.ActSucc = false;
}
else if (GetAccountNode(newAccount.AccountId) != null)
{
createAccountResult.Description = $"创建账号失败,账号 {newAccount.AccountId} 已存在!";
createAccountResult.ActSucc = false;
}
else
{
var xmlElement = _accountXml.CreateElement("Account");
xmlElement.SetAttribute("AccountId", newAccount.AccountId.ToLower());
_accountXml.DocumentElement.AppendChild(xmlElement);
var xmlElement2 = _accountXml.CreateElement("RealName");
xmlElement2.InnerText = newAccount.RealName;
xmlElement.AppendChild(xmlElement2);
xmlElement2 = _accountXml.CreateElement("Role");
xmlElement2.InnerText = newAccount.Role.ToString();
xmlElement.AppendChild(xmlElement2);
xmlElement2 = _accountXml.CreateElement("Password");
xmlElement2.InnerText = Md5Helper.GetMd5Hash(newAccount.AccountId);
xmlElement.AppendChild(xmlElement2);
xmlElement2 = _accountXml.CreateElement("AccountState");
xmlElement2.InnerText = (newAccount.AccountStatus ? "Enable" : "Disable");
xmlElement.AppendChild(xmlElement2);
xmlElement2 = _accountXml.CreateElement("Email");
xmlElement2.InnerText = newAccount.Email;
xmlElement.AppendChild(xmlElement2);
xmlElement2 = _accountXml.CreateElement("Telephone");
xmlElement2.InnerText = newAccount.Telephone;
xmlElement.AppendChild(xmlElement2);
xmlElement2 = _accountXml.CreateElement("Touxian");
xmlElement2.InnerText = newAccount.Touxian;
xmlElement.AppendChild(xmlElement2);
xmlElement2 = _accountXml.CreateElement("Company");
xmlElement2.InnerText = newAccount.Company;
xmlElement.AppendChild(xmlElement2);
xmlElement2 = _accountXml.CreateElement("Department");
xmlElement2.InnerText = newAccount.Department;
xmlElement.AppendChild(xmlElement2);
xmlElement2 = _accountXml.CreateElement("Description");
xmlElement2.InnerText = newAccount.Description;
xmlElement.AppendChild(xmlElement2);
xmlElement2 = _accountXml.CreateElement("CreationTime");
xmlElement2.InnerText = DateTime.Now.ToString();
xmlElement.AppendChild(xmlElement2);
xmlElement2 = _accountXml.CreateElement("LastLoginTime");
xmlElement2.InnerText = string.Empty;
xmlElement.AppendChild(xmlElement2);
xmlElement2 = _accountXml.CreateElement("LastUpdateTime");
xmlElement2.InnerText = string.Empty;
xmlElement.AppendChild(xmlElement2);
Save(_accountXml, _accountPath);
createAccountResult.Description = $"创建新账号{newAccount.AccountId}成功";
createAccountResult.ActSucc = true;
EV.PostMessage(Module, EventEnum.AccountCreated, newAccount.AccountId);
}
return createAccountResult;
}
catch (Exception ex)
{
var text = $"创建账号{newAccount.AccountId}失败";
LOG.Write(ex, text);
return new CreateAccountResult
{
ActSucc = false,
Description = text
};
}
}
public DeleteAccountResult DeleteAccount(string accountId)
{
try
{
LOG.Write($"删除账号{accountId}");
accountId = accountId.ToLower();
var deleteAccountResult = new DeleteAccountResult();
if (accountId == "admin")
{
deleteAccountResult.Description = "Admin'admin'账号不能删除";
deleteAccountResult.ActSucc = false;
}
else if (!FileSigner.IsValid(_accountPath))
{
deleteAccountResult.Description = "删除账号失败,账号文件数字签名损坏!";
deleteAccountResult.ActSucc = false;
}
else
{
var accountNode = GetAccountNode(accountId);
if (accountNode == null)
{
deleteAccountResult.Description = $"删除账号 {accountId} 失败,账号不存在!";
deleteAccountResult.ActSucc = false;
}
else
{
_accountXml.DocumentElement.RemoveChild(accountNode);
Save(_accountXml, _accountPath);
deleteAccountResult.Description = $"删除账号 {accountId} 成功!";
deleteAccountResult.ActSucc = true;
EV.PostMessage(Module, EventEnum.AccountDeleted, accountId);
}
}
return deleteAccountResult;
}
catch (Exception ex)
{
var text = $"删除账号{accountId}发生异常";
LOG.Write(ex, text);
return new DeleteAccountResult
{
ActSucc = false,
Description = text
};
}
}
public UpdateAccountResult UpdateAccount(Account account)
{
try
{
var updateAccountResult = new UpdateAccountResult();
if (account == null)
{
updateAccountResult.Description = "账号有误";
updateAccountResult.ActSucc = false;
}
else if (!FileSigner.IsValid(_accountPath))
{
updateAccountResult.Description = $"更新账号资料失败,账号文件数字签名损坏!";
updateAccountResult.ActSucc = false;
}
else
{
var accountNode = GetAccountNode(account.AccountId.ToLower());
if (accountNode == null)
{
updateAccountResult.Description = $"更新账号 {account.AccountId} 失败,账号不存在!";
updateAccountResult.ActSucc = false;
}
else
{
accountNode.SelectSingleNode("RealName").InnerText = account.RealName;
accountNode.SelectSingleNode("Role").InnerText = ((account.AccountId.ToLower() == "admin") ? "Admin" : account.Role.ToString());
accountNode.SelectSingleNode("AccountState").InnerText = (account.AccountStatus ? "Enable" : "Disable");
accountNode.SelectSingleNode("Email").InnerText = account.Email;
accountNode.SelectSingleNode("Telephone").InnerText = account.Telephone;
accountNode.SelectSingleNode("Touxian").InnerText = account.Touxian;
accountNode.SelectSingleNode("Company").InnerText = account.Company;
accountNode.SelectSingleNode("Department").InnerText = account.Department;
accountNode.SelectSingleNode("Description").InnerText = account.Description;
accountNode.SelectSingleNode("CreationTime").InnerText = account.AccountCreationTime;
accountNode.SelectSingleNode("LastLoginTime").InnerText = account.LastLoginTime;
accountNode.SelectSingleNode("LastUpdateTime").InnerText = account.LastAccountUpdateTime;
Save(_accountXml, _accountPath);
updateAccountResult.Description = $"成功更新 {account.AccountId} 的账号资料!";
updateAccountResult.ActSucc = true;
EV.PostMessage(Module, EventEnum.AccountChanged, account.AccountId);
}
}
return updateAccountResult;
}
catch (Exception ex)
{
var text = $"更新账号{account.AccountId}资料发生异常";
LOG.Write(ex, text);
return new UpdateAccountResult
{
ActSucc = false,
Description = text
};
}
}
public GetAccountListResult GetAccountList()
{
try
{
LOG.Write("获取所有的账号信息列表");
var getAccountListResult = new GetAccountListResult();
if (!FileSigner.IsValid(_accountPath))
{
getAccountListResult.Description = "获取账号列表失败,账号文件数字签名文件损坏!";
getAccountListResult.ActSuccess = false;
getAccountListResult.AccountList = null;
}
else
{
var xmlNodeList = _accountXml.SelectNodes("AccountManagement/Account");
var list = new List<Account>();
foreach (XmlNode item in xmlNodeList)
{
list.Add(GetAccountInfo(item.Attributes["AccountId"].Value).AccountInfo);
}
getAccountListResult.AccountList = list;
getAccountListResult.Description = "成功获取账号列表!";
getAccountListResult.ActSuccess = true;
}
Accounts = getAccountListResult;
return getAccountListResult;
}
catch (Exception ex)
{
var text = "获取账号列表发生异常";
LOG.Write(ex, text);
return new GetAccountListResult
{
AccountList = null,
ActSuccess = false,
Description = text
};
}
}
public void CheckAlive(string accountId)
{
try
{
if (_userList.ContainsKey(accountId))
{
_userList[accountId] = new Tuple<Guid, DateTime, string>(_userList[accountId].Item1, DateTime.Now, _userList[accountId].Item3);
}
else
{
EV.PostKickoutMessage($"账号{accountId}已在服务器上注销");
}
}
catch (Exception ex)
{
LOG.Write(ex);
}
}
private XmlElement GetAccountNode(string accountId)
{
var xmlNode = _accountXml.SelectSingleNode($"/AccountManagement/Account[@AccountId='{accountId.ToLower()}']");
return (XmlElement)xmlNode;
}
public static SerializableDictionary<string, string> GetAllViewList()
{
var serializableDictionary = new SerializableDictionary<string, string>();
try
{
var xmlDocument = new XmlDocument();
var filename = Path.Combine(PathManager.GetAccountFilePath(), "Views.xml");
xmlDocument.Load(filename);
var xmlNodeList = xmlDocument.SelectNodes("/root/Views/View");
if (xmlNodeList != null)
{
foreach (XmlElement item in xmlNodeList)
{
serializableDictionary.Add(item.Attributes["Name"].Value, item.Attributes["Description"].Value);
}
}
}
catch (Exception ex)
{
LOG.Write(ex);
serializableDictionary = new SerializableDictionary<string, string>();
}
return serializableDictionary;
}
public bool SaveAllRolesPermission(Dictionary<string, Dictionary<string, ViewPermission>> data)
{
try
{
var xmlElement = _roleXml.SelectSingleNode("/Aitex/Roles") as XmlElement;
xmlElement.RemoveAll();
foreach (var datum in data)
{
if (datum.Key == "Admin")
{
continue;
}
var xmlElement2 = _roleXml.CreateElement("Role");
xmlElement2.SetAttribute("Name", datum.Key);
xmlElement.AppendChild(xmlElement2);
foreach (var key in data[datum.Key].Keys)
{
var xmlElement3 = _roleXml.CreateElement("View");
xmlElement2.AppendChild(xmlElement3);
xmlElement3.SetAttribute("Name", key);
xmlElement3.SetAttribute("Permission", data[datum.Key][key].ToString());
}
}
_roleXml.Save(_rolePath);
}
catch (Exception ex)
{
LOG.Write(ex);
return false;
}
return true;
}
public SerializableDictionary<string, ViewPermission> GetSingleRolePermission(string roleName)
{
var serializableDictionary = new SerializableDictionary<string, ViewPermission>();
try
{
var allViewList = GetAllViewList();
if (roleName == "Admin")
{
foreach (var item in allViewList)
{
serializableDictionary.Add(item.Key, ViewPermission.FullyControl);
}
}
else
{
var xmlNode = _roleXml.SelectSingleNode($"/Aitex/Roles/Role[@Name='{roleName}']");
if (xmlNode != null)
{
foreach (XmlElement item2 in xmlNode)
{
var value = item2.Attributes["Name"].Value;
var value2 = item2.Attributes["Permission"].Value;
if (allViewList.ContainsKey(value))
{
serializableDictionary.Add(value, (ViewPermission)Enum.Parse(typeof(ViewPermission), value2, ignoreCase: true));
}
}
}
}
}
catch (Exception ex)
{
LOG.Write(ex);
serializableDictionary = new SerializableDictionary<string, ViewPermission>();
}
return serializableDictionary;
}
#endregion
}
}

View File

@ -1,302 +0,0 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using System.Xml;
using Aitex.Common.Util;
using Aitex.Core.RT.Event;
using Aitex.Core.RT.Key;
using Aitex.Core.RT.Log;
using Aitex.Core.Util;
using MECF.Framework.Common.Account;
using MECF.Framework.Common.Account.Extends;
using MECF.Framework.Common.Account.Permissions;
namespace Aitex.Core.Account
{
public sealed class AccountService : IAccountService
{
#region Properties
public string Module => "System";
#endregion
#region Common Operations
public void RegisterViews(List<string> views)
{
AccountManager.Instance.RegisterViews(views);
}
public bool SaveAllRolesPermission(Dictionary<string, Dictionary<string, ViewPermission>> data)
{
if (Singleton<KeyManager>.Instance.IsExpired)
{
EV.PostMessage("System", EventEnum.DefaultWarning, "Software is expired. Can not do the operation");
return false;
}
return AccountManager.Instance.SaveAllRolesPermission(data);
}
public SerializableDictionary<string, string> GetAllViewList()
{
return AccountManager.GetAllViewList();
}
public string GetProcessViewPermission()
{
string filename = Path.Combine(PathManager.GetCfgDir(), "RolePermission.xml");
XmlDocument xmlDocument = new XmlDocument();
try
{
xmlDocument.Load(filename);
return xmlDocument.InnerXml;
}
catch (Exception ex)
{
LOG.Write(ex);
return "<Aitex></Aitex>";
}
finally
{
}
}
public bool SaveProcessViewPermission(string viewXML)
{
try
{
string filename = Path.Combine(PathManager.GetCfgDir(), "RolePermission.xml");
XmlDocument xmlDocument = new XmlDocument();
xmlDocument.LoadXml(viewXML);
XmlTextWriter xmlTextWriter = new XmlTextWriter(filename, null);
xmlTextWriter.Formatting = Formatting.Indented;
xmlDocument.Save(xmlTextWriter);
xmlTextWriter.Close();
return true;
}
catch (Exception ex)
{
LOG.Write(ex);
return false;
}
}
public List<AppMenu> GetAllMenus()
{
return AccountExManager.Instance.RoleAccountLoader.GetAllMenus();
}
#endregion
#region Roles Operations
public IEnumerable<Role> GetRolesIncludeSuper()
{
return AccountExManager.Instance.RoleAccountLoader.GetRoles(true);
}
public List<Role> GetRoles()
{
return AccountExManager.Instance.RoleAccountLoader.GetRoles();
}
public bool UpdateRole(Role role)
{
return AccountExManager.Instance.RoleAccountLoader.UpdateRole(role);
}
public bool DeleteRole(string roleId)
{
return AccountExManager.Instance.RoleAccountLoader.DeleteRole(roleId);
}
/// <inheritdoc />
public string GetAvailableRoleID()
{
return AccountExManager.Instance.RoleAccountLoader.GetAvailableRoleID();
}
/// <inheritdoc />
public Role GetRoleByID(string id)
{
return AccountExManager.Instance.RoleAccountLoader.GetRoles().FirstOrDefault(x => x.RoleId == id);
}
public Role GetRoleByName(string name)
{
return AccountExManager.Instance.RoleAccountLoader.GetRoles().FirstOrDefault(x => x.RoleName == name);
}
/// <inheritdoc />
public bool CheckRoleNotDuplicated(string id, string name)
{
var sameNameRole = GetRoleByName(name);
return sameNameRole == null || sameNameRole.RoleId == id;
}
#endregion
#region Accounts Operations
public GetAccountInfoResult GetAccountInfo(string accountId)
{
return AccountManager.Instance.GetAccountInfo(accountId);
}
public List<AccountEx> GetAccountsIncludeSuper()
{
return AccountExManager.Instance.RoleAccountLoader.GetAccounts(true);
}
public List<AccountEx> GetAccounts()
{
return AccountExManager.Instance.RoleAccountLoader.GetAccounts();
}
public CreateAccountResult CreateAccount(Account newAccount)
{
if (Singleton<KeyManager>.Instance.IsExpired)
{
EV.PostMessage("System", EventEnum.DefaultWarning, "Software is expired. Can not do the operation");
return new CreateAccountResult();
}
EV.PostInfoLog(Module, $"Create account{newAccount}.");
LOG.Write($"Account operation, Create user {newAccount.AccountId}.");
return AccountManager.Instance.CreateAccount(newAccount);
}
public DeleteAccountResult DeleteAccount(string accountId)
{
if (Singleton<KeyManager>.Instance.IsExpired)
{
EV.PostMessage("System", EventEnum.DefaultWarning, "Software is expired. Can not do the operation");
return new DeleteAccountResult();
}
EV.PostInfoLog(Module, $"Delete account {accountId}.");
return AccountManager.Instance.DeleteAccount(accountId);
}
public UpdateAccountResult UpdateAccount(Account account)
{
if (Singleton<KeyManager>.Instance.IsExpired)
{
EV.PostMessage("System", EventEnum.DefaultWarning, "Software is expired. Can not do the operation");
return new UpdateAccountResult();
}
EV.PostInfoLog(Module, $"Update {account} account information.");
return AccountManager.Instance.UpdateAccount(account);
}
public bool UpdateAccountEx(AccountEx account)
{
return AccountExManager.Instance.RoleAccountLoader.UpdateAccount(account);
}
public bool DeleteAccountEx(string loginName)
{
return AccountExManager.Instance.RoleAccountLoader.DeleteAccount(loginName);
}
public ChangePwdResult ChangePassword(string accountId, string newPassword)
{
if (Singleton<KeyManager>.Instance.IsExpired)
{
EV.PostMessage("System", EventEnum.DefaultWarning, "Software is expired. Can not do the operation");
return new ChangePwdResult();
}
EV.PostInfoLog(Module, $"Change user {accountId} password.");
LOG.Write($"Account operation, change user {accountId} password.");
return AccountManager.Instance.ChangePassword(accountId, newPassword);
}
public bool CheckPassword(string accountId, string passwordMD5)
{
return AccountExManager.Instance.CheckPassword(accountId, passwordMD5);
}
#endregion
#region Login Sessions Operations
public List<Account> GetLoginUsers()
{
return AccountManager.Instance.GetLoginUserList();
}
public async Task<LoginResult> LoginEx(string userName, string password, string role,
LoginClientInfo clientInfo)
{
return await AccountExManager.Instance.Login(userName, password, role, clientInfo);
}
public void CancelLoginRequest(string userName)
{
AccountExManager.Instance.CancelLoginRequest(userName);
}
public void ConfirmLoginRequest(string userName)
{
AccountExManager.Instance.ConfirmedLoginRequest(userName);
}
public void RejectLoginRequest(string userName)
{
AccountExManager.Instance.RejectLoginRequest(userName);
}
public void LogoutEx(Guid myToken)
{
AccountExManager.Instance.Logout(myToken);
}
public void KickUserOut(string accountId, string kickoutReason)
{
EV.PostInfoLog(Module, $"Force user {accountId} logout systemreason{kickoutReason}.");
try
{
}
catch
{
}
AccountManager.Instance.Kickout(accountId, kickoutReason);
}
/// <summary>
/// 报告客户端处于活动状态。
/// </summary>
/// <param name="myToken">客户端登录凭据令牌。</param>
/// <returns></returns>
public CredentialKeepAliveCheckResult KeepAlive(Guid myToken)
{
return CredentialManager.Instance.KeepAlive(myToken);
}
#endregion
#region Permission Operations
public List<AppMenu> GetAccessibleMenusByRole(string roleId)
{
return AccountExManager.Instance.RoleAccountLoader.GetAccessibleMenusByRole(roleId);
}
public MenuPermissionEnum GetMenuPermission(string roleId, string menuName)
{
return AccountExManager.Instance.RoleAccountLoader.GetMenuPermission(roleId, menuName);
}
#endregion
}
}

View File

@ -1,140 +0,0 @@
using System.Timers;
using Aitex.Core.RT.Event;
using Aitex.Core.Utilities;
namespace Aitex.Core.Account
{
public static class Authorization
{
private static Timer _timer;
private static AuthorizationStatusEnum _status;
public static string Module { get; set; }
public static AuthorizationStatusEnum Status => _status;
public static string AuthorizedAccount { get; private set; }
public static string AuthorizedIP { get; private set; }
public static string AuthorizingAccount { get; private set; }
public static string AuthorizingIP { get; private set; }
static Authorization()
{
_timer = new Timer();
_status = AuthorizationStatusEnum.NoAuthorization;
Module = "System";
AuthorizedAccount = string.Empty;
AuthorizedIP = string.Empty;
AuthorizingAccount = string.Empty;
AuthorizingIP = string.Empty;
_timer = new Timer(180000.0);
_timer.AutoReset = false;
_timer.Elapsed += Timer_Elapsed;
}
private static void Timer_Elapsed(object sender, ElapsedEventArgs e)
{
if (_status == AuthorizationStatusEnum.Authorizing)
{
Grant(isGranted: true);
}
}
public static bool IsAuthorizedAccount(string accountId, string ip)
{
if (string.IsNullOrWhiteSpace(AuthorizedAccount))
{
EV.PostMessage(Module, EventEnum.AccountWithoutAuthorization, accountId);
return false;
}
if (ip == Network.LocalIP && AuthorizedIP == Network.LocalIP)
{
return true;
}
if (AuthorizedAccount != accountId)
{
EV.PostMessage(Module, EventEnum.AccountWithoutAuthorization, accountId);
return false;
}
return true;
}
private static bool CanAutoAuthorize(string accountId, string ip)
{
return string.IsNullOrWhiteSpace(AuthorizedAccount) || ip == Network.LocalIP || accountId == AuthorizedAccount;
}
public static void Request(string accountId, string ip)
{
EV.PostMessage(Module, EventEnum.OperationAuthorization, $"{accountId} 在申请操控权");
if (CanAutoAuthorize(accountId, ip))
{
AuthorizedAccount = accountId;
AuthorizedIP = ip;
EV.PostMessage(Module, EventEnum.OperationAuthorization, $"{AuthorizedAccount} 获得操控权");
_status = AuthorizationStatusEnum.Granted;
Update();
}
else
{
AuthorizingAccount = accountId;
AuthorizingIP = ip;
_status = AuthorizationStatusEnum.Authorizing;
Update();
_timer.Start();
}
}
public static void Abort()
{
_timer.Stop();
_status = AuthorizationStatusEnum.NoAuthorization;
AuthorizingAccount = string.Empty;
AuthorizingIP = string.Empty;
Update();
}
public static void Grant(bool isGranted)
{
_timer.Stop();
if (_status != AuthorizationStatusEnum.Granted)
{
if (isGranted)
{
AuthorizedAccount = AuthorizingAccount;
AuthorizedIP = AuthorizingIP;
_status = AuthorizationStatusEnum.Granted;
EV.PostMessage(Module, EventEnum.OperationAuthorization, $"{AuthorizedAccount} 获得操控权");
}
else
{
_status = AuthorizationStatusEnum.Rejected;
EV.PostMessage(Module, EventEnum.OperationAuthorization, $"{AuthorizedAccount} 拒绝转交操控权");
}
Update();
}
}
public static void Exit(string accountId)
{
if (accountId == AuthorizedAccount)
{
AuthorizedAccount = string.Empty;
AuthorizedIP = string.Empty;
Abort();
}
else if (accountId == AuthorizingAccount)
{
Abort();
}
}
private static void Update()
{
}
}
}

View File

@ -1,10 +0,0 @@
namespace Aitex.Core.Account
{
public enum AuthorizationStatusEnum
{
NoAuthorization = 0,
Authorizing = 1,
Granted = 2,
Rejected = 3
}
}

View File

@ -1,12 +0,0 @@
using System;
namespace Aitex.Core.Account
{
[Serializable]
public class ChangePwdResult
{
public bool ActSucc { get; set; }
public string Description { get; set; }
}
}

View File

@ -1,12 +0,0 @@
using System;
namespace Aitex.Core.Account
{
[Serializable]
public class CreateAccountResult
{
public bool ActSucc { get; set; }
public string Description { get; set; }
}
}

View File

@ -1,145 +0,0 @@
using System;
using System.Runtime.Serialization;
using System.Threading;
using MECF.Framework.Common.Account.Extends;
namespace Aitex.Core.Account;
/// <summary>
/// 登录凭据。
/// </summary>
/// <remarks>
/// RT使用该对象维护用户登录信息包括登录激活状态维持、WCF远程调用权限验证。
/// </remarks>
[Serializable]
[DataContract]
public class Credential
{
#region Consturctors
/// <summary>
/// 创建登录凭据的实例。
/// </summary>
/// <remarks>
/// 该构造函数用于WCF通讯RT中创建该对象是请使用有参数的构造函数。
/// </remarks>
public Credential()
{
Token = Guid.Empty;
State = CredentialState.Requesting;
LoginTime = DateTime.MinValue;
LastAliveTime = DateTime.Now;
LoginRequestCancellationTokenSource = new CancellationTokenSource();
}
/// <summary>
/// 创建登录凭据的实例。
/// </summary>
/// <param name="token">登录令牌。</param>
/// <param name="accountInfo">登录账户信息。</param>
public Credential(Guid token, AccountEx accountInfo) : this()
{
Token = token;
AccountInfo = accountInfo;
}
#endregion
#region Properties
/// <summary>
/// 登录请求取消。
/// </summary>
internal CancellationTokenSource LoginRequestCancellationTokenSource { get; }
/// <summary>
/// 设置或返回当前凭据包含的令牌。
/// </summary>
[DataMember]
public Guid Token { get; set; }
/// <summary>
/// 设置或返回当前凭据状态
/// </summary>
[DataMember]
public CredentialState State { get; set; }
/// <summary>
/// 设置或返回最后一次激活时间。
/// </summary>
[DataMember]
public DateTime LastAliveTime { get; set; }
/// <summary>
/// 设置或返回账户角色。
/// </summary>
[DataMember]
public string RoleID { get; set; }
/// <summary>
/// 设置或返回登录的账户信息。
/// </summary>
[DataMember]
public AccountEx AccountInfo { get; set; }
/// <summary>
/// 返回当前凭据对应客户端信息。
/// </summary>
[DataMember]
public LoginClientInfo ClientInfo { get; set; }
/// <summary>
/// 设置或返回客户端IP地址。
/// </summary>
[DataMember]
public string LoginIP { get; set; }
/// <summary>
/// 设置或返回客户端Port。
/// </summary>
[DataMember]
public int LoginPort { get; set; }
/// <summary>
/// 设置或返回登录时间。
/// </summary>
[DataMember]
public DateTime LoginTime { get; set; }
/// <summary>
/// 设置或返回登录结果描述。
/// </summary>
[DataMember]
public string Description { get; set; }
/// <summary>
/// 返回空凭据。
/// </summary>
public static Credential Empty => new Credential();
public static Credential ReadOnlyOne =>
new Credential(Guid.Empty, new AccountEx("", "Read-Only", "", "", "", "", null));
#endregion
#region Methods
/// <summary>
/// 检查指定的凭据是否为空凭据。
/// </summary>
/// <param name="cred"></param>
/// <returns></returns>
public static bool IsEmpty(Credential cred)
{
return cred == null || cred.Token == Guid.Empty;
}
/// <inheritdoc />
public override string ToString()
{
return $"{AccountInfo.LoginName}@{LoginIP}:{LoginPort}";
}
#endregion
}

View File

@ -1,42 +0,0 @@
using System;
namespace Aitex.Core.Account
{
[Serializable]
public class CredentialKeepAliveCheckResult
{
#region Constructors
public CredentialKeepAliveCheckResult() : this(CredentialKeepAliveStates.NotFound)
{
}
public CredentialKeepAliveCheckResult(CredentialKeepAliveStates state) : this(state, null)
{
State = state;
}
public CredentialKeepAliveCheckResult(CredentialKeepAliveStates state, Credential credRequesting)
{
State = state;
RequestingCredential = credRequesting;
}
#endregion
#region Properties
/// <summary>
/// 返回凭据存活状态。
/// </summary>
public CredentialKeepAliveStates State { get; set; }
/// <summary>
/// 如果<see cref="State"/>等于<see cref="CredentialKeepAliveStates.RequestingLogin"/>,则返回正在发起登录请求的用户名。
/// </summary>
public Credential RequestingCredential { get; set; }
#endregion
}
}

View File

@ -1,496 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Aitex.Core.RT.DBCore;
using Aitex.Core.Util;
namespace Aitex.Core.Account;
/// <summary>
/// 登录凭据管理器。
/// </summary>
public class CredentialManager : Singleton<CredentialManager>
{
#region Variables
/// <summary>
/// 已登录的凭据激活超时时间。
/// </summary>
/// <remarks>
/// 如果凭据超过此时间没有被激活,则自动移除此凭据。
/// </remarks>
public const int LOGIN_CRED_KEEP_ALIVE_TIMEOUT_SEC = 60;
/// <summary>
/// 正在请求登录的凭据的生命时长。
/// </summary>
public const int REQ_LOGIN_CRED_LIFT_TIME_SEC = REQ_LOGIN_DIALOG_LIFT_TIME_SEC + 5;
/// <summary>
/// UI中的请求登录/授权登录对话框存活时间
/// </summary>
public const int REQ_LOGIN_DIALOG_LIFT_TIME_SEC = 30;
private readonly object _syncRoot = new();
/// <summary>
/// 已登录的凭据。
/// </summary>
private readonly Dictionary<Guid, Credential> _dictCredentialsLoggedIn = new ();
/// <summary>
/// 正在等在登录请求确认的凭据LoginName为字典Key。
/// </summary>
private readonly Dictionary<string, Credential> _dictCredentialsRequesting = new ();
private readonly PeriodicJob _threadMonitorCred;
private bool _isInitialized;
private int _maxCredentialAllowed;
#endregion
#region Constructors
/// <summary>
/// 登录凭据管理的构造函数。
/// </summary>
public CredentialManager()
{
_threadMonitorCred = new(1000, OnTimer, "CredentialAliveMonitorThread", true, true);
}
#endregion
#region Properties
/// <summary>
/// 返回当前凭据管理器是否支持多用户登录。
/// </summary>
public bool IsSupportMultiUserLogin => _maxCredentialAllowed > 1;
/// <summary>
/// 返回已登录的用户凭据的数量。
/// </summary>
public int LoggedInCount
{
get
{
lock (_syncRoot)
{
return _dictCredentialsLoggedIn.Count;
}
}
}
/// <summary>
/// 返回正在请求登录的用户凭据的数量。
/// </summary>
public int LoginRequestingCount
{
get
{
lock (_syncRoot)
{
return _dictCredentialsRequesting.Count;
}
}
}
#endregion
#region Methods
/// <summary>
/// 初始化登录凭据管理器。
/// </summary>
/// <param name="isSupportMultiUsersLogin">是否支持多用户同时登录。</param>
public void Initialize(bool isSupportMultiUsersLogin)
{
if (_isInitialized)
throw new InvalidOperationException($"{nameof(CredentialManager)} has been initialized.");
_isInitialized = true;
_maxCredentialAllowed = isSupportMultiUsersLogin ? int.MaxValue : 1;
}
private bool OnTimer()
{
lock (_syncRoot)
{
#region
var loginRemovableList = new List<Guid>();
foreach (var kvp in _dictCredentialsLoggedIn)
{
var cred = kvp.Value;
if ((DateTime.Now - cred.LastAliveTime).TotalSeconds > LOGIN_CRED_KEEP_ALIVE_TIMEOUT_SEC)
loginRemovableList.Add(cred.Token);
}
if (loginRemovableList.Count > 0)
{
foreach (var token in loginRemovableList)
{
WriteHistory(_dictCredentialsLoggedIn[token], "EXPIRED");
_dictCredentialsLoggedIn.Remove(token);
}
}
#endregion
#region
var requestRemovableList = new List<string>();
foreach (var kvp in _dictCredentialsRequesting)
{
var cred = kvp.Value;
if ((DateTime.Now - cred.LastAliveTime).TotalSeconds > REQ_LOGIN_CRED_LIFT_TIME_SEC)
requestRemovableList.Add(kvp.Key);
// 移除被取消或拒绝的凭据
if(cred.State is CredentialState.RequestCanceled or CredentialState.Reject)
requestRemovableList.Add(kvp.Key);
}
if (requestRemovableList.Count > 0)
{
foreach (var loginName in requestRemovableList)
{
var reason = "";
switch (_dictCredentialsRequesting[loginName].State)
{
case CredentialState.RequestCanceled:
reason = "REQ CANCELED";
break;
case CredentialState.Reject:
reason = "REQ REJECTED";
break;
default:
reason = "REQ EXPIRED";
break;
}
WriteHistory(_dictCredentialsRequesting[loginName], reason);
_dictCredentialsRequesting.Remove(loginName);
}
}
return true;
#endregion
}
}
/// <summary>
/// 检查指定的用户名是否已经登录。
/// </summary>
/// <param name="userName"></param>
/// <returns></returns>
internal bool IsLoggedIn(string userName)
{
lock (_syncRoot)
{
return _dictCredentialsLoggedIn.Values.FirstOrDefault(x => x.AccountInfo.LoginName == userName) != null;
}
}
/// <summary>
/// 检查指定令牌的登录凭据是否存在。
/// </summary>
/// <param name="token"></param>
/// <returns></returns>
internal bool IsLoggedIn(Guid token)
{
lock (_syncRoot)
{
return _dictCredentialsLoggedIn.ContainsKey(token);
}
}
/// <summary>
/// 检查指定的令牌是否已经过期。
/// </summary>
/// <param name="token"></param>
/// <returns></returns>
internal bool IsTokenExpired(Guid token)
{
lock (_syncRoot)
{
return _dictCredentialsLoggedIn.ContainsKey(token);
}
}
/// <summary>
/// 报告客户端处于活动状态。
/// </summary>
/// <param name="myToken">客户端登录凭据</param>
/// <returns></returns>
public CredentialKeepAliveCheckResult KeepAlive(Guid myToken)
{
lock (_syncRoot)
{
if (_dictCredentialsLoggedIn.TryGetValue(myToken, out var loginCred))
{
loginCred.LastAliveTime = DateTime.Now; // 刷新时间
if (IsSupportMultiUserLogin)
{
// 如果当前用户名在请求登录列表中则返回CredentialKeepAliveResults.RequestingLogin通知
// 已登录的客户端,当前用户正在请求异地登录。
if (_dictCredentialsRequesting.TryGetValue(loginCred.AccountInfo.LoginName,
out var requestingLoginCred) && requestingLoginCred.State == CredentialState.Requesting)
{
return new(CredentialKeepAliveStates.RequestingLogin,
requestingLoginCred);
}
}
else
{
// 如果仅允许单一用户登录并且登录请求列表中有等待确认的凭据则通知当前凭据的Session弹出确认对话框
if (LoginRequestingCount > 0)
{
var requestingLoginCred = _dictCredentialsRequesting.Values.FirstOrDefault();
if (requestingLoginCred != null)
return new(CredentialKeepAliveStates.RequestingLogin,
requestingLoginCred);
}
}
return new (CredentialKeepAliveStates.Alive);
}
return new (CredentialKeepAliveStates.NotFound);
}
}
/// <summary>
/// 将凭据加入请求列表。
/// </summary>
/// <param name="cred"></param>
/// <exception cref="InvalidOperationException"></exception>
public void AddRequestingList(Credential cred)
{
lock (_syncRoot)
{
if (IsSupportMultiUserLogin)
{
if (_dictCredentialsRequesting.ContainsKey(cred.AccountInfo.LoginName))
throw new InvalidOperationException("the credential has been existed in requesting list.");
}
else
{
if (LoginRequestingCount > 0)
{
var credRequesting = _dictCredentialsRequesting.Values.FirstOrDefault();
throw new InvalidOperationException($"User {credRequesting} are requesting to login, new request is not allowed.");
}
}
WriteHistory(cred, "REQ LOGIN");
_dictCredentialsRequesting[cred.AccountInfo.LoginName] = cred;
}
}
/// <summary>
/// 将指定的凭据加入字典。
/// </summary>
/// <param name="cred">待授权的凭据</param>
/// <remarks>
/// 给凭据授权前必须调用<see cref="AddRequestingList"/>方法将凭据加入到等待列表中。
/// </remarks>
/// <exception cref="Exception"></exception>
public void Grant(Credential cred)
{
if (IsLoggedIn(cred.AccountInfo.LoginName))
throw new Exception($"user {cred.AccountInfo.LoginName} has been logged in.");
lock (_syncRoot)
{
if (_dictCredentialsLoggedIn.Count >= _maxCredentialAllowed)
throw new InvalidOperationException("maximum number of login credentials reached");
if (!_dictCredentialsRequesting.ContainsKey(cred.AccountInfo.LoginName))
throw new InvalidOperationException("the credential is not found in requesting list.");
cred.State = CredentialState.Alive;
_dictCredentialsLoggedIn[cred.Token] = cred;
_dictCredentialsRequesting.Remove(cred.AccountInfo.LoginName);
WriteHistory(cred, "LOGIN");
}
}
/// <summary>
/// 强制放行登录授权绕过Single-Session机制。
/// </summary>
/// <param name="cred"></param>
public void ForceGrant(Credential cred)
{
lock (_syncRoot)
{
if (_dictCredentialsLoggedIn.Count >= _maxCredentialAllowed)
throw new InvalidOperationException("maximum number of login credentials reached");
cred.State = CredentialState.Alive;
_dictCredentialsLoggedIn[cred.Token] = cred;
WriteHistory(cred, "LOGIN");
}
}
/// <summary>
/// 接受指定用户名的登录请求。
/// </summary>
/// <param name="userName"></param>
public void Accept(string userName)
{
var cred = GetRequestingCredential(userName);
if (cred != null)
cred.State = CredentialState.Confirmed;
}
/// <summary>
/// 拒绝指定用户名的登录请求。
/// </summary>
/// <param name="userName"></param>
public void Reject(string userName)
{
lock (_syncRoot)
{
var cred = GetRequestingCredential(userName);
if (cred != null)
cred.State = CredentialState.Reject;
}
}
/// <summary>
/// 取消登录请求。
/// </summary>
/// <param name="userName"></param>
public void Cancel(string userName)
{
var cred = GetRequestingCredential(userName);
if (cred != null)
{
cred.LoginRequestCancellationTokenSource.Cancel();
cred.State = CredentialState.RequestCanceled;
}
}
/// <summary>
/// 移除指定令牌的凭据。
/// </summary>
/// <param name="token"></param>
public void Remove(Guid token)
{
lock (_syncRoot)
{
if (_dictCredentialsLoggedIn.TryGetValue(token, out var cred))
{
WriteHistory(cred, "LOGOUT");
}
_dictCredentialsLoggedIn.Remove(token);
}
}
/// <summary>
/// 获取字典中第一个凭据。
/// </summary>
/// <returns></returns>
public Credential GetCredential()
{
lock (_syncRoot)
{
return _dictCredentialsLoggedIn.Values.FirstOrDefault();
}
}
/// <summary>
/// 获取指定用户名的登录凭据。
/// </summary>
/// <param name="userName"></param>
/// <returns></returns>
public Credential GetCredential(string userName)
{
lock (_syncRoot)
{
return _dictCredentialsLoggedIn.Values.FirstOrDefault(x => x.AccountInfo.LoginName == userName);
}
}
/// <summary>
/// 获取指定用户名的登录凭据。
/// </summary>
/// <param name="token"></param>
/// <returns></returns>
public Credential GetCredential(Guid token)
{
lock (_syncRoot)
{
return _dictCredentialsLoggedIn.TryGetValue(token, out var cred) ? cred : null;
}
}
/// <summary>
/// 获取指定用户名的正在等在登录请求的凭据。
/// </summary>
/// <param name="userName">用户名</param>
/// <returns></returns>
public Credential GetRequestingCredential(string userName)
{
lock (_syncRoot)
{
return _dictCredentialsRequesting.TryGetValue(userName, out var cred) ? cred : null;
}
}
/// <summary>
/// 校验指定令牌的凭据是否有效。
/// </summary>
/// <param name="token"></param>
/// <returns></returns>
public bool ValidateCredential(Guid token)
{
lock (_syncRoot)
{
if (_dictCredentialsLoggedIn.TryGetValue(token, out var cred))
{
return cred.State == CredentialState.Alive;
}
return false;
}
}
#endregion
#region Static Methods
private static void WriteHistory(Credential cred, string operation)
{
DB.InsertSql(
"insert into credentials_history (\"login_name\", \"role_id\", \"host_name\", \"host_ip\", \"host_port\", " +
"\"os_version\", \"computer_info\", \"cpu_info\", \"disk_info\", \"operation\", \"operation_time\") " +
"values" +
$"($sic${cred.AccountInfo.LoginName}$sic$, $sic${cred.RoleID}$sic$, $sic${cred.ClientInfo?.HostName??""}$sic$, " +
$"$sic${cred.LoginIP}$sic$, $sic${cred.LoginPort}$sic$, $sic${cred.ClientInfo?.OSVersion??""}$sic$," +
$"$sic${cred.ClientInfo?.ComputerSystem??""}$sic$, $sic${cred.ClientInfo?.CpuInfo??""}$sic$, $sic${cred.ClientInfo?.LogicalDisk??""}$sic$, " +
$"$sic${operation}$sic$, NOW())");
}
/// <summary>
/// 创建一个令牌。
/// </summary>
/// <returns></returns>
public static Guid GenerateToken()
{
return Guid.NewGuid();
}
#endregion
}

View File

@ -1,12 +0,0 @@
using System;
namespace Aitex.Core.Account
{
[Serializable]
public class DeleteAccountResult
{
public bool ActSucc { get; set; }
public string Description { get; set; }
}
}

View File

@ -1,14 +0,0 @@
using System;
namespace Aitex.Core.Account
{
[Serializable]
public class GetAccountInfoResult
{
public bool ActSuccess { get; set; }
public Account AccountInfo { get; set; }
public string Description { get; set; }
}
}

View File

@ -1,15 +0,0 @@
using System;
using System.Collections.Generic;
namespace Aitex.Core.Account
{
[Serializable]
public class GetAccountListResult
{
public bool ActSuccess { get; set; }
public IEnumerable<Account> AccountList { get; set; }
public string Description { get; set; }
}
}

View File

@ -1,318 +0,0 @@
using System;
using System.Collections.Generic;
using System.ServiceModel;
using System.Threading;
using System.Threading.Tasks;
using Aitex.Core.Util;
using MECF.Framework.Common.Account.Extends;
using MECF.Framework.Common.Account.Permissions;
using MECF.Framework.Common.CommonData;
namespace Aitex.Core.Account
{
[ServiceKnownType(typeof(CredentialKeepAliveStates))]
[ServiceKnownType(typeof(CredentialState))]
[ServiceKnownType(typeof(LoginRequestResults))]
[ServiceKnownType(typeof(MenuPermissionEnum))]
[ServiceKnownType(typeof(NotifiableItem))]
[ServiceKnownType(typeof(Role))]
[ServiceKnownType(typeof(List<Role>))]
[ServiceKnownType(typeof(AppMenu))]
[ServiceKnownType(typeof(List<AppMenu>))]
[ServiceKnownType(typeof(Credential))]
[ServiceKnownType(typeof(LoginClientInfo))]
[ServiceKnownType(typeof(AccountEx))]
[ServiceKnownType(typeof(LoginResult))]
[ServiceKnownType(typeof(CredentialKeepAliveCheckResult))]
[ServiceKnownType(typeof(CancellationTokenSource))]
[ServiceContract]
public interface IAccountService
{
#region Common Operations
/// <summary>
/// 注册视图。
/// </summary>
/// <param name="views"></param>
[OperationContract]
void RegisterViews(List<string> views);
/// <summary>
/// 获取所有视图。
/// </summary>
/// <returns></returns>
[OperationContract]
SerializableDictionary<string, string> GetAllViewList();
/// <summary>
/// TBD
/// </summary>
/// <returns></returns>
[OperationContract]
string GetProcessViewPermission();
/// <summary>
/// TBD
/// </summary>
/// <param name="viewXML"></param>
/// <returns></returns>
[OperationContract]
bool SaveProcessViewPermission(string viewXML);
/// <summary>
/// 获取系统支持的所有菜单。
/// </summary>
/// <returns></returns>
[OperationContract]
List<AppMenu> GetAllMenus();
#endregion
#region Permission Operations
/// <summary>
/// 获取指定角色ID和菜单名称的访问权限。
/// </summary>
/// <param name="roleId">角色ID</param>
/// <param name="menuName">菜单名称</param>
/// <returns></returns>
[OperationContract]
MenuPermissionEnum GetMenuPermission(string roleId, string menuName);
/// <summary>
/// 保存所有角色的权限。
/// </summary>
/// <param name="data"></param>
/// <returns></returns>
[OperationContract]
bool SaveAllRolesPermission(Dictionary<string, Dictionary<string, ViewPermission>> data);
#endregion
#region Role Operations
/// <summary>
///获取包含超级角色的角色列表。
/// </summary>
/// <returns></returns>
[OperationContract]
IEnumerable<Role> GetRolesIncludeSuper();
/// <summary>
/// 获取不包含超级角色的角色列表。
/// </summary>
/// <returns></returns>
[OperationContract]
List<Role> GetRoles();
/// <summary>
/// 获取指定ID的角色。
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
[OperationContract]
Role GetRoleByID(string id);
/// <summary>
/// 获取指定名称的角色。
/// </summary>
/// <param name="name"></param>
/// <returns></returns>
[OperationContract]
Role GetRoleByName(string name);
/// <summary>
/// 更新指定的角色。
/// </summary>
/// <param name="role">角色信息</param>
/// <returns></returns>
[OperationContract]
bool UpdateRole(Role role);
/// <summary>
/// 删除指定的角色。
/// </summary>
/// <param name="roleId">角色ID</param>
/// <returns></returns>
[OperationContract]
bool DeleteRole(string roleId);
/// <summary>
/// 获取指定角色的可访问菜单列表。
/// </summary>
/// <param name="roleId"></param>
/// <returns></returns>
[OperationContract]
List<AppMenu> GetAccessibleMenusByRole(string roleId);
/// <summary>
/// 获取一个可用的角色ID。
/// </summary>
/// <returns></returns>
[OperationContract]
string GetAvailableRoleID();
/// <summary>
/// 检查指定名称的角色是否存在如果存在它们的ID是否相同如果ID不同则表示当前角色名称已存在不允许保存。
/// </summary>
/// <param name="id"></param>
/// <param name="name"></param>
/// <returns></returns>
[OperationContract]
bool CheckRoleNotDuplicated(string id, string name);
#endregion
#region Account Operations
/// <summary>
/// 获取指定账号信息。
/// </summary>
/// <param name="accountId">账号ID</param>
/// <returns></returns>
[OperationContract]
GetAccountInfoResult GetAccountInfo(string accountId);
/// <summary>
/// 获取包含超级账号的列表。
/// </summary>
/// <returns></returns>
[OperationContract]
List<AccountEx> GetAccountsIncludeSuper();
/// <summary>
/// 获取账号列表。
/// </summary>
/// <returns></returns>
[OperationContract]
List<AccountEx> GetAccounts();
/// <summary>
/// 创建账号。
/// </summary>
/// <param name="newAccount">新账号</param>
/// <returns></returns>
[OperationContract]
CreateAccountResult CreateAccount(Account newAccount);
/// <summary>
/// 删除账号。
/// </summary>
/// <param name="accountId">账号ID</param>
/// <returns></returns>
[OperationContract]
DeleteAccountResult DeleteAccount(string accountId);
/// <summary>
/// 更新指定的账号。
/// </summary>
/// <param name="account">账号信息</param>
/// <returns></returns>
[OperationContract]
UpdateAccountResult UpdateAccount(Account account);
/// <summary>
/// 更新指定的账号。
/// </summary>
/// <param name="account">账号</param>
/// <returns></returns>
[OperationContract]
bool UpdateAccountEx(AccountEx account);
/// <summary>
/// 删除指定的账号。
/// </summary>
/// <param name="loginName">账号名</param>
/// <returns></returns>
[OperationContract]
bool DeleteAccountEx(string loginName);
/// <summary>
/// 修改账号密码。
/// </summary>
/// <param name="accountId">账号ID</param>
/// <param name="newPassword">新密码</param>
/// <returns></returns>
[OperationContract]
ChangePwdResult ChangePassword(string accountId, string newPassword);
/// <summary>
/// 校验指定账户的密码。
/// </summary>
/// <param name="accountId"></param>
/// <param name="passwordMD5"></param>
/// <returns></returns>
[OperationContract]
bool CheckPassword(string accountId, string passwordMD5);
/// <summary>
/// 获取登录用户列表。
/// </summary>
/// <returns></returns>
[OperationContract]
List<Account> GetLoginUsers();
/// <summary>
/// 踢出指定的账号。
/// </summary>
/// <param name="accountId">账号ID</param>
/// <param name="reason">踢出原因</param>
[OperationContract]
void KickUserOut(string accountId, string reason);
#endregion
#region Login/Logout Operations
/// <summary>
/// 登录RT。
/// </summary>
/// <param name="userName">用户名</param>
/// <param name="password">密码</param>
/// <param name="roleID">角色ID</param>
/// <param name="clientInfo">登录客户端信息</param>
/// <returns></returns>
[OperationContract]
Task<LoginResult> LoginEx(string userName, string password, string roleID,
LoginClientInfo clientInfo);
/// <summary>
/// 注销登录。
/// </summary>
/// <param name="myToken">当前登录的令牌</param>
[OperationContract]
void LogoutEx(Guid myToken);
/// <summary>
/// 取消登录请求。
/// </summary>
/// <param name="userName"></param>
[OperationContract]
void CancelLoginRequest(string userName);
/// <summary>
/// 确认异地登录请求。
/// </summary>
/// <param name="userName">正在请求登录的令牌</param>
[OperationContract]
void ConfirmLoginRequest(string userName);
/// <summary>
/// 拒绝异地登录请求。
/// </summary>
/// <param name="userName">正在请求登录的令牌</param>
[OperationContract]
void RejectLoginRequest(string userName);
/// <summary>
/// 激活凭据。
/// </summary>
/// <param name="myToken">当前登录的令牌</param>
/// <returns></returns>
[OperationContract]
CredentialKeepAliveCheckResult KeepAlive(Guid myToken);
#endregion
}
}

View File

@ -1,42 +0,0 @@
using System;
namespace Aitex.Core.Account
{
/// <summary>
/// 客户端登录信息。
/// </summary>
[Serializable]
public class LoginClientInfo
{
/// <summary>
/// 设置或返回客户端主机名称。
/// </summary>
public string HostName { get; set; }
/// <summary>
/// 设置或返回操作系统版本
/// </summary>
public string OSVersion { get; set; }
/// <summary>
/// 设置或返回Windows用户名称
/// </summary>
public string UserName { get; set; }
/// <summary>
/// 设置或返回系统信息。
/// </summary>
public string ComputerSystem { get; set; }
/// <summary>
/// 设置或返回CPU信息。
/// </summary>
public string CpuInfo { get; set; }
/// <summary>
/// 设置或返回磁盘信息。
/// </summary>
public string LogicalDisk { get; set; }
}
}

View File

@ -1,48 +0,0 @@
using System;
namespace Aitex.Core.Account
{
[Serializable]
public class LoginResult
{
#region Constructors
public LoginResult() : this(LoginRequestResults.Error, Credential.Empty)
{
}
public LoginResult(LoginRequestResults result) : this(result, Credential.Empty)
{
}
public LoginResult(LoginRequestResults result, Credential cred)
{
Result = result;
Credential = cred;
}
#endregion
#region Properties
/// <summary>
/// 设置或返回是否登录成功。
/// </summary>
public LoginRequestResults Result { get; set; }
/// <summary>
/// 登录凭据。
/// </summary>
public Credential Credential { get; set; }
#endregion
/// <inheritdoc />
public override string ToString()
{
return Result.ToString();
}
}
}

View File

@ -1,73 +0,0 @@
namespace Aitex.Core.Account;
/// <summary>
/// 登录请求执行结果。
/// </summary>
public enum LoginRequestResults
{
Error,
WrongPwd,
NoMatchRole,
NoMatchUser,
Confirmed,
Rejected,
Timeout,
RequstingLogin
}
/// <summary>
/// 凭据状态。
/// </summary>
public enum CredentialState
{
/// <summary>
/// 等待系统校验登录请求。
/// </summary>
Requesting,
/// <summary>
/// 登录请求被取消。
/// </summary>
RequestCanceled,
/// <summary>
/// 凭据有效。
/// </summary>
Alive,
/// <summary>
/// 已登录的用户确认了新的登录请求。
/// </summary>
Confirmed,
/// <summary>
/// 已登录的用户拒绝新的登录请求。
/// </summary>
Reject
}
/// <summary>
/// 凭据激活结果
/// </summary>
public enum CredentialKeepAliveStates
{
/// <summary>
/// 未找到凭据
/// </summary>
NotFound,
/// <summary>
/// 凭据被激活
/// </summary>
Alive,
/// <summary>
/// 其它客户端正在请求登录
/// </summary>
RequestingLogin
}
public class Misc
{
}

View File

@ -1,29 +0,0 @@
using System;
using System.ServiceModel;
namespace Aitex.Core.Account
{
public sealed class NotificationService
{
public static string ClientHostName => null;
public static string ClientUserName
{
get
{
if (OperationContext.Current == null || OperationContext.Current.IncomingMessageHeaders == null)
{
return "";
}
int num = OperationContext.Current.IncomingMessageHeaders.FindHeader("IdentityUserName", "ns");
if (num == -1)
{
return "";
}
return OperationContext.Current.IncomingMessageHeaders.GetHeader<string>("IdentityUserName", "ns");
}
}
public static Guid ClientGuid => Guid.Empty;
}
}

View File

@ -1,12 +0,0 @@
using System;
namespace Aitex.Core.Account
{
[Serializable]
public class UpdateAccountResult
{
public bool ActSucc { get; set; }
public string Description { get; set; }
}
}

View File

@ -1,21 +0,0 @@
using System;
using System.Runtime.Serialization;
namespace Aitex.Core.Account
{
[Serializable]
[DataContract]
public enum ViewPermission
{
[EnumMember]
Invisiable = 1,
[EnumMember]
Readonly = 2,
[EnumMember]
PartlyControl = 3,
[EnumMember]
FullyControl = 4,
[EnumMember]
ProcessOPControl = 5
}
}

View File

@ -1,110 +0,0 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
using Aitex.Core.RT.IOCore;
using Aitex.Core.Util;
namespace Aitex.Core.Backend
{
public class AI : UserControl, IIOView
{
private PeriodicJob _thread;
private IContainer components = null;
public AI()
{
InitializeComponent();
base.Load += AI_Load;
}
private void AI_Load(object sender, EventArgs e)
{
if (base.Controls.Count > 0)
{
return;
}
List<Tuple<int, int, string>> iONameList = IO.GetIONameList("", IOType.AI);
int num = 0;
foreach (Tuple<int, int, string> item in iONameList)
{
AICtrl aICtrl = new AICtrl();
aICtrl.Location = new Point(num % 3 * 305, num / 3 * 55);
aICtrl.SetName($"AI-{item.Item1}.{item.Item3}");
aICtrl.SetIoName("local", item.Item3);
aICtrl.Name = $"AI_{item.Item1}";
aICtrl.Size = new Size(300, 50);
aICtrl.Visible = true;
aICtrl.Tag = item.Item3;
base.Controls.Add(aICtrl);
num++;
}
_thread = new PeriodicJob(500, OnTimer, "AITimer");
base.VisibleChanged += delegate
{
if (base.Visible)
{
_thread.Start();
}
else
{
_thread.Pause();
}
};
}
private bool OnTimer()
{
Invoke((Action)delegate
{
foreach (AICtrl control in base.Controls)
{
control?.SetValue(IO.AI[(string)control.Tag].Value);
}
});
return true;
}
public void EnableTimer(bool enable)
{
if (enable)
{
_thread.Start();
}
else
{
_thread.Pause();
}
}
public void Close()
{
if (_thread != null)
{
_thread.Stop();
}
}
protected override void Dispose(bool disposing)
{
if (disposing && components != null)
{
components.Dispose();
}
base.Dispose(disposing);
}
private void InitializeComponent()
{
base.SuspendLayout();
base.AutoScaleDimensions = new System.Drawing.SizeF(6f, 12f);
base.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.SystemColors.Control;
base.Name = "AI";
base.Size = new System.Drawing.Size(1065, 746);
base.ResumeLayout(false);
}
}
}

View File

@ -1,135 +0,0 @@
using System;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
using Aitex.Core.RT.Simulator;
using Aitex.Core.Util;
namespace Aitex.Core.Backend
{
public class AICtrl : UserControl
{
private string _ioName;
private IContainer components = null;
private Label labelName;
private CheckBox checkBox1;
private TextBox textBox1;
private TextBox textBox2;
private Button button1;
public AICtrl()
{
InitializeComponent();
}
public void SetName(string name)
{
labelName.Text = name;
}
public void SetIoName(string group, string ioName)
{
_ioName = ioName;
}
public void SetValue(float value)
{
textBox1.Text = $"{value:f2}";
}
private void checkBox1_CheckedChanged(object sender, EventArgs e)
{
if (checkBox1.Checked)
{
textBox2.Text = textBox1.Text;
float.TryParse(textBox2.Text.Trim(), out var result);
Singleton<AiForce>.Instance.Set(_ioName, result);
button1.Enabled = true;
textBox2.Enabled = true;
BackColor = Color.DodgerBlue;
}
else
{
Singleton<AiForce>.Instance.Unset(_ioName);
button1.Enabled = false;
textBox2.Enabled = false;
BackColor = Color.White;
}
}
private void button1_Click(object sender, EventArgs e)
{
if (float.TryParse(textBox2.Text.Trim(), out var result))
{
Singleton<AiForce>.Instance.Set(_ioName, result);
}
}
protected override void Dispose(bool disposing)
{
if (disposing && components != null)
{
components.Dispose();
}
base.Dispose(disposing);
}
private void InitializeComponent()
{
this.labelName = new System.Windows.Forms.Label();
this.checkBox1 = new System.Windows.Forms.CheckBox();
this.textBox1 = new System.Windows.Forms.TextBox();
this.textBox2 = new System.Windows.Forms.TextBox();
this.button1 = new System.Windows.Forms.Button();
base.SuspendLayout();
this.labelName.Font = new System.Drawing.Font("Microsoft Sans Serif", 9f, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 0);
this.labelName.Location = new System.Drawing.Point(24, 3);
this.labelName.Name = "labelName";
this.labelName.Size = new System.Drawing.Size(233, 23);
this.labelName.TabIndex = 5;
this.labelName.Text = "123.Leak_Senor_Alarm(SW)";
this.checkBox1.AutoSize = true;
this.checkBox1.Location = new System.Drawing.Point(4, 6);
this.checkBox1.Name = "checkBox1";
this.checkBox1.Size = new System.Drawing.Size(15, 14);
this.checkBox1.TabIndex = 6;
this.checkBox1.UseVisualStyleBackColor = true;
this.checkBox1.CheckedChanged += new System.EventHandler(checkBox1_CheckedChanged);
this.textBox1.Location = new System.Drawing.Point(3, 26);
this.textBox1.Name = "textBox1";
this.textBox1.ReadOnly = true;
this.textBox1.Size = new System.Drawing.Size(100, 21);
this.textBox1.TabIndex = 7;
this.textBox2.Location = new System.Drawing.Point(109, 26);
this.textBox2.Name = "textBox2";
this.textBox2.Size = new System.Drawing.Size(100, 21);
this.textBox2.TabIndex = 8;
this.button1.Location = new System.Drawing.Point(215, 24);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(42, 23);
this.button1.TabIndex = 9;
this.button1.Text = "Set";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(button1_Click);
base.AutoScaleDimensions = new System.Drawing.SizeF(6f, 12f);
base.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.SystemColors.ControlLight;
base.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
base.Controls.Add(this.button1);
base.Controls.Add(this.textBox2);
base.Controls.Add(this.textBox1);
base.Controls.Add(this.checkBox1);
base.Controls.Add(this.labelName);
base.Name = "AICtrl";
base.Size = new System.Drawing.Size(260, 50);
base.ResumeLayout(false);
base.PerformLayout();
}
}
}

View File

@ -1,110 +0,0 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
using Aitex.Core.RT.IOCore;
using Aitex.Core.Util;
namespace Aitex.Core.Backend
{
public class AO : UserControl, IIOView
{
private PeriodicJob _thread;
private IContainer components = null;
public AO()
{
InitializeComponent();
base.Load += AO_Load;
}
private void AO_Load(object sender, EventArgs e)
{
if (base.Controls.Count > 0)
{
return;
}
List<Tuple<int, int, string>> iONameList = IO.GetIONameList("", IOType.AO);
int num = 0;
foreach (Tuple<int, int, string> item in iONameList)
{
AOCtrl aOCtrl = new AOCtrl();
aOCtrl.Location = new Point(num % 3 * 305, num / 3 * 55);
aOCtrl.SetName($"AO-{item.Item1}.{item.Item3}");
aOCtrl.SetIoName("local", item.Item3);
aOCtrl.Name = $"AO_{item.Item1}";
aOCtrl.Size = new Size(300, 50);
aOCtrl.Visible = true;
aOCtrl.Tag = item.Item3;
base.Controls.Add(aOCtrl);
num++;
}
_thread = new PeriodicJob(500, OnTimer, "AOTimer");
base.VisibleChanged += delegate
{
if (base.Visible)
{
_thread.Start();
}
else
{
_thread.Pause();
}
};
}
private bool OnTimer()
{
Invoke((Action)delegate
{
foreach (AOCtrl control in base.Controls)
{
control?.SetValue(IO.AO[(string)control.Tag].Value);
}
});
return true;
}
public void EnableTimer(bool enable)
{
if (enable)
{
_thread.Start();
}
else
{
_thread.Pause();
}
}
public void Close()
{
if (_thread != null)
{
_thread.Stop();
}
}
protected override void Dispose(bool disposing)
{
if (disposing && components != null)
{
components.Dispose();
}
base.Dispose(disposing);
}
private void InitializeComponent()
{
base.SuspendLayout();
base.AutoScaleDimensions = new System.Drawing.SizeF(6f, 12f);
base.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.SystemColors.Control;
base.Name = "AO";
base.Size = new System.Drawing.Size(987, 756);
base.ResumeLayout(false);
}
}
}

View File

@ -1,102 +0,0 @@
using System;
using System.ComponentModel;
using System.Windows.Forms;
using Aitex.Core.RT.IOCore;
namespace Aitex.Core.Backend
{
public class AOCtrl : UserControl
{
private string _ioName;
private IContainer components = null;
private Label labelName;
private TextBox textBox1;
private TextBox textBox2;
private Button button1;
public AOCtrl()
{
InitializeComponent();
}
public void SetIoName(string group, string ioName)
{
_ioName = ioName;
}
public void SetName(string name)
{
labelName.Text = name;
}
public void SetValue(float value)
{
textBox1.Text = $"{value:f2}";
}
private void button1_Click(object sender, EventArgs e)
{
if (double.TryParse(textBox2.Text, out var result))
{
IO.AO[_ioName].Value = (short)result;
}
}
protected override void Dispose(bool disposing)
{
if (disposing && components != null)
{
components.Dispose();
}
base.Dispose(disposing);
}
private void InitializeComponent()
{
this.labelName = new System.Windows.Forms.Label();
this.textBox1 = new System.Windows.Forms.TextBox();
this.textBox2 = new System.Windows.Forms.TextBox();
this.button1 = new System.Windows.Forms.Button();
base.SuspendLayout();
this.labelName.Font = new System.Drawing.Font("Microsoft Sans Serif", 9f, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 0);
this.labelName.Location = new System.Drawing.Point(-1, 1);
this.labelName.Name = "labelName";
this.labelName.Size = new System.Drawing.Size(236, 22);
this.labelName.TabIndex = 5;
this.labelName.Text = "123.Leak_Senor_Alarm(SW)";
this.textBox1.Location = new System.Drawing.Point(3, 22);
this.textBox1.Name = "textBox1";
this.textBox1.ReadOnly = true;
this.textBox1.Size = new System.Drawing.Size(100, 21);
this.textBox1.TabIndex = 10;
this.textBox2.Location = new System.Drawing.Point(109, 22);
this.textBox2.Name = "textBox2";
this.textBox2.Size = new System.Drawing.Size(100, 21);
this.textBox2.TabIndex = 11;
this.button1.Location = new System.Drawing.Point(215, 20);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(42, 23);
this.button1.TabIndex = 12;
this.button1.Text = "Set";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(button1_Click);
base.AutoScaleDimensions = new System.Drawing.SizeF(6f, 12f);
base.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.SystemColors.ControlLight;
base.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
base.Controls.Add(this.button1);
base.Controls.Add(this.textBox2);
base.Controls.Add(this.textBox1);
base.Controls.Add(this.labelName);
base.Name = "AOCtrl";
base.Size = new System.Drawing.Size(260, 50);
base.ResumeLayout(false);
base.PerformLayout();
}
}
}

View File

@ -1,34 +0,0 @@
using System.ComponentModel;
using System.Windows.Forms;
namespace Aitex.Core.Backend
{
public class AboutView : UserControl
{
private IContainer components = null;
public AboutView()
{
InitializeComponent();
}
protected override void Dispose(bool disposing)
{
if (disposing && components != null)
{
components.Dispose();
}
base.Dispose(disposing);
}
private void InitializeComponent()
{
base.SuspendLayout();
base.AutoScaleDimensions = new System.Drawing.SizeF(6f, 12f);
base.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
base.Name = "AboutView";
base.Size = new System.Drawing.Size(410, 372);
base.ResumeLayout(false);
}
}
}

Some files were not shown because too many files have changed in this diff Show More