Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
李娜
/
VerticalStore
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit 4be59287
由
LN
编写于
2020-06-17 08:54:03 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
修改名称
1 个父辈
62061a75
显示空白字符变更
内嵌
并排
正在显示
39 个修改的文件
包含
1500 行增加
和
5937 行删除
source/Common/Common.csproj
source/Common/Setting_Init.cs
source/DeviceLibrary/DeviceLibrary.csproj
source/DeviceLibrary/StoreConfig/StoreConfig.csv
source/DeviceLibrary/StoreConfig/linePositions.csv
source/DeviceLibrary/acVerticalStore/StoreManager.cs
source/DeviceLibrary/acVerticalStore/VerticalStoreBean.cs
source/DeviceLibrary/acVerticalStore/VerticalStoreBean_InOut.cs
source/DeviceLibrary/acVerticalStore/VerticalStoreBean_Partial.cs
source/DeviceLibrary/device/IO/AIOBOX/AIOBOXManager.cs
source/DeviceLibrary/device/PanasonicServo/ACCMDManager.cs
source/DeviceLibrary/device/PanasonicServo/ACServerManager.cs
source/DeviceLibrary/device/PanasonicServo/ACServerManager_Partial.cs
source/DeviceLibrary/device/led/BaseLedManager.cs
source/DeviceLibrary/device/led/LEDColorArtNet.cs
source/DeviceLibrary/device/weights/OKLE.cs
source/DeviceLibrary/device/weights/OKLEController.cs
source/DeviceLibrary/store/InOutParam.cs
source/DeviceLibrary/store/KTK_Store.cs
source/DeviceLibrary/store/StoreMoveP.cs
source/DeviceLibrary/store/model/StoreMoveInfo.cs
source/LoadCVSLibrary/LoadCSVLibrary.csproj
source/LoadCVSLibrary/position/PostionBase.cs
source/LoadCVSLibrary/position/VerticalPosition.cs
source/LoadCVSLibrary/position/VerticalStorePosition.cs
source/LoadCVSLibrary/storeConfig/config/IO_Type.cs
source/LoadCVSLibrary/storeConfig/config/StoreConfig.cs
source/LoadCVSLibrary/storeConfig/config/VerticalStoreConfig.cs
source/VerticalStoreClinet/FormManager.cs
source/VerticalStoreClinet/FrmBase.cs
source/VerticalStoreClinet/FrmIOStatus.Designer.cs
source/VerticalStoreClinet/FrmIOStatus.cs
source/VerticalStoreClinet/FrmStoreBox.Designer.cs
source/VerticalStoreClinet/FrmStoreBox.cs
source/VerticalStoreClinet/Program.cs
source/VerticalStoreClinet/VerticalStoreClient.csproj
source/VerticalStoreClinet/useControl/AxisJogControl.cs
source/VerticalStoreClinet/useControl/AxisMoveControl.Designer.cs
source/VerticalStoreClinet/useControl/AxisMoveControl.cs
source/Common/Common.csproj
查看文件 @
4be5928
...
...
@@ -69,9 +69,6 @@
<Compile Include="util\TcpServer.cs" />
<Compile Include="util\UdpServer.cs" />
</ItemGroup>
<ItemGroup>
<WCFMetadata Include="Service References\" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
...
...
source/Common/Setting_Init.cs
查看文件 @
4be5928
...
...
@@ -11,6 +11,10 @@ namespace OnlineStore.Common
/// </summary>
public
class
Setting_Init
{
public
static
readonly
string
DefaultDeviceIP
=
"DefaultDeviceIP"
;
public
static
readonly
string
ColorRuleConfig
=
"ColorRuleConfig"
;
public
static
readonly
string
DeviceLedType
=
"DeviceLedType"
;
public
static
readonly
string
StatusLedDmx
=
"StatusLedDmx"
;
public
static
string
Server_Log_Open
=
"Server_Log_Open"
;
/// <summary>
/// 系统启动时自动启动料仓,=1时自动启动,并隐藏窗口,=0时不需要
...
...
source/DeviceLibrary/DeviceLibrary.csproj
查看文件 @
4be5928
...
...
@@ -66,14 +66,13 @@
</ItemGroup>
<ItemGroup>
<Compile Include="acVerticalStore\VerticalStoreBean.cs" />
<Compile Include="acVerticalStore\VerticalStoreBean_Partial.cs" />
<Compile Include="acVerticalStore\VerticalStoreBean_InOut.cs" />
<Compile Include="acVerticalStore\StoreManager.cs" />
<Compile Include="device\halcon\CodeManager.cs" />
<Compile Include="device\IO\AIOBOX\AIOBOXManager.cs" />
<Compile Include="device\IO\IOManager.cs" />
<Compile Include="device\
weights\OKLE
.cs" />
<Compile Include="device\
weights\OKLEController
.cs" />
<Compile Include="device\
led\BaseLedManager
.cs" />
<Compile Include="device\
led\LEDColorArtNet
.cs" />
<Compile Include="store\StoreMoveP.cs" />
<Compile Include="store\StoreAlarm.cs">
<SubType>Code</SubType>
...
...
source/DeviceLibrary/StoreConfig/StoreConfig.csv
查看文件 @
4be5928
类型,说明,名称,属性值,设备名称,描述,电器定义,代码定义,目标速度,加速时间,减速时间,原点低速度,原点高速,原点加速度,脉冲最小误差,脉冲最大误差,脉冲最小限位,脉冲最大限位
,,,,,,,,,,,,,,,,,
AXIS,(轴一)取料旋转轴,Middle_Axis,1,COM1,,,,250,80,80,80,60,50,10,1000,0,0
AXIS,(轴二)取料上下轴,UpDown_Axis,2,COM1,,,,100,300,200,20,50,200,10,1000,0,0
AXIS,(轴三)取料进出轴,InOut_Axis,3,COM1,,,,100,300,200,20,50,200,10,1000,0,0
AXIS,(轴四)回温区旋转轴,Warming_Axis,4,COM1,,,,100,300,200,20,50,200,10,1000,0,0
AXIS,(轴五)冷藏区旋转轴,Colding_Axis,5,COM1,,,,100,300,200,20,50,200,10,1000,0,0
AXIS,(轴六)搅拌旋转轴,Stir_Axis,6,COM1,,,,100,300,200,20,50,200,10,1000,0,0
PRO,IO模块对应的DI数量,IO_DILength,192.168.200.21#16;192.168.200.22#8,,,,,,,,,,,,,,
PRO,模块对应的DO数量,IO_DOLength,192.168.200.21#16;192.168.200.22#8,,,,,,,,,,,,,,
AXIS,(轴一)料斗旋转轴,Middle_Axis,1,COM1,,,,250,80,80,80,60,50,10,1000,0,0
PRO,IO模块对应的DI数量,IO_DILength,192.168.200.21#16,,,,,,,,,,,,,,
PRO,模块对应的DO数量,IO_DOLength,192.168.200.21#16,,,,,,,,,,,,,,
,,,,,,,,,,,,,,,,,
DI,急停,SuddenStop_BTN,0,192.168.200.21,急停,X01,X01,,,,,,,,,,
DI,复位,Reset_BTN,1,192.168.200.21,复位,X02,X02,,,,,,,,,,
DI,
自动启动,AutoRun_Signal,2,192.168.200.21,自动启动
,X03,X03,,,,,,,,,,
DI,
气压检测,Airpressure_Check,3,192.168.200.21,气压检测
,X04,X04,,,,,,,,,,
DI,
安全光栅,SafetyLightCurtains,4,192.168.200.21,安全光栅
,X05,X05,,,,,,,,,,
DI,左侧门禁信号,Door_LeftLimit,5,192.168.200.21,左侧门禁
信号,X06,X06,,,,,,,,,,
DI,右侧门禁信号,Door_RightLimit,6,192.168.200.21,右侧门禁信号
,X07,X07,,,,,,,,,,
DI,左侧锡膏检测,TinCheck_DoorLeft,7,192.168.200.21,左侧锡膏检测
,X08,X08,,,,,,,,,,
DI,右侧锡膏检测,TinCheck_DoorRight,8,192.168.200.21,右侧锡膏检测
,X09,X09,,,,,,,,,,
DI,夹具检测,TinCheck_Fixture,9,192.168.200.21,夹具检测
,X10,X10,,,,,,,,,,
DI,搅拌区锡膏检测,TinCheck_Stir,10,192.168.200.21,搅拌区锡膏检测
,X11,X11,,,,,,,,,,
DI,进料口门上升端,Door_Up,11,192.168.200.21,进料口门上升端
,X12,X12,,,,,,,,,,
DI,进料口门下降端,Door_Down,12,192.168.200.21,进料口门下降端
,X13,X13,,,,,,,,,,
DI,夹爪气缸夹紧端,Clamping_Tighten,13,192.168.200.21,夹爪气缸夹紧端
,X14,X14,,,,,,,,,,
DI,夹爪气缸放松端,Clamping_Relax,14,192.168.200.21,夹爪气缸放松端
,X15,X15,,,,,,,,,,
DI,夹爪锡膏检测,TinCheck_Clamping,15,192.168.200.21,夹爪锡膏检测
,X16,X16,,,,,,,,,,
DI,
安全光栅,SafetyLightCurtains,2,192.168.200.21,安全光栅
,X03,X03,,,,,,,,,,
DI,
升降门上升端,Door_Up,3,192.168.200.21,升降门上升端
,X04,X04,,,,,,,,,,
DI,
升降门下降端,Door_Down,4,192.168.200.21,升降门下降端
,X05,X05,,,,,,,,,,
,链轮计数信号,,5,192.168.200.21,链轮计数
信号,X06,X06,,,,,,,,,,
,,,6,192.168.200.21,
,X07,X07,,,,,,,,,,
,,,7,192.168.200.21,
,X08,X08,,,,,,,,,,
,,,8,192.168.200.21,
,X09,X09,,,,,,,,,,
,,,9,192.168.200.21,
,X10,X10,,,,,,,,,,
,,,10,192.168.200.21,
,X11,X11,,,,,,,,,,
,,,11,192.168.200.21,
,X12,X12,,,,,,,,,,
,,,12,192.168.200.21,
,X13,X13,,,,,,,,,,
,,,13,192.168.200.21,
,X14,X14,,,,,,,,,,
,,,14,192.168.200.21,
,X15,X15,,,,,,,,,,
,,,15,192.168.200.21,
,X16,X16,,,,,,,,,,
,,,,,,,,,,,,,,,,,
DO,自动指示灯,AutoRun_HddLed,0,192.168.200.21,自动指示灯,Y01,Y01,,,,,,,,,,
DO,故障指示灯,Alarm_HddLed,1,192.168.200.21,故障指示灯,Y02,Y02,,,,,,,,,,
DO,待机指示灯,RunSign_HddLed,2,192.168.200.21,待机指示灯,Y03,Y03,,,,,,,,,,
DO,报警蜂鸣器,Alarm_Buzzer,3,192.168.200.21,报警蜂鸣器,Y04,Y04,,,,,,,,,,
DO,料仓运转ON,Run_Signal,4,192.168.200.21,料仓运转ON,Y05,Y05,,,,,,,,,,
DO,取料机构刹车电源ON,Axis_Brake,5,192.168.200.21,取料机构刹车电源ON,Y06,Y06,,,,,,,,,,
DO,相机照明开,Camera_Led,6,192.168.200.21,相机照明开,Y07,Y07,,,,,,,,,,
DO,门禁功能屏蔽,Door_Limit,7,192.168.200.21,门禁功能屏蔽,Y08,Y08,,,,,,,,,,
DO,冷气机启动,Colding_Start,8,192.168.200.21,冷气机启动,Y09,Y09,,,,,,,,,,
DO,回温区风机启动,Warming_Start,9,192.168.200.21,回温区风机启动,Y10,Y10,,,,,,,,,,
DO,进料口门上升SOL,Door_Up,10,192.168.200.21,进料口门上升SOL,Y11,Y11,,,,,,,,,,
DO,进料口门下降SOL,Door_Down,11,192.168.200.21,进料口门下降SOL,Y12,Y12,,,,,,,,,,
DO,夹爪气缸夹紧SOL,Clamping_Tighten,12,192.168.200.21,夹爪气缸夹紧SOL,Y13,Y13,,,,,,,,,,
DO,夹爪气缸放松SOL,Clamping_Relax,13,192.168.200.21,夹爪气缸放松SOL,Y14,Y14,,,,,,,,,,
DO,搅拌定位气缸上升SOL,StirLocation_Up,14,192.168.200.21,搅拌定位气缸上升SOL,Y15,Y15,,,,,,,,,,
DO,搅拌定位气缸下降SOL,StirLocation_Down,15,192.168.200.21,搅拌定位气缸下降SOL,Y16,Y16,,,,,,,,,,
,,,,,,,,,,,,,,,,,
DI,搅拌定位气缸上升端,StirLocation_Up,0,192.168.200.22,搅拌定位气缸上升端,X21,X21,,,,,,,,,,
DI,搅拌定位气缸下降端,StirLocation_Down,1,192.168.200.22,搅拌定位气缸下降端,X22,X22,,,,,,,,,,
DI,冷藏区门关闭端,ColdDoor_Close,2,192.168.200.22,冷藏区门关闭端,X23,X23,,,,,,,,,,
DI,冷藏区门打开端,ColdDoor_Open,3,192.168.200.22,冷藏区门打开端,X24,X24,,,,,,,,,,
,,,4,192.168.200.22,,X25,X25,,,,,,,,,,
,,,5,192.168.200.22,,X26,X26,,,,,,,,,,
,,,6,192.168.200.22,,X27,X27,,,,,,,,,,
,,,7,192.168.200.22,,X28,X28,,,,,,,,,,
DO,冷藏区门关闭SOL,ColdDoor_Close,0,192.168.200.22,冷藏区门关闭SOL,Y21,Y21,,,,,,,,,,
DO,冷藏区门打开SOL,ColdDoor_Open,1,192.168.200.22,冷藏区门打开SOL,Y22,Y22,,,,,,,,,,
,,,2,192.168.200.22,,Y23,Y23,,,,,,,,,,
,,,3,192.168.200.22,,Y24,Y24,,,,,,,,,,
,,,4,192.168.200.22,,Y25,Y25,,,,,,,,,,
,,,5,192.168.200.22,,Y26,Y26,,,,,,,,,,
,,,6,192.168.200.22,,Y27,Y27,,,,,,,,,,
,,,7,192.168.200.22,,Y28,Y28,,,,,,,,,,
,,,,,,,, ,,,,,,,,,
,,,,,,,,,,,,,,,,,
PRO,升降轴 进料口取料点 P1(夹具),UpDownAxis_OL_P1,403000,,,,,,,,,,,,,,
PRO,升降轴 进料口出料前点 P2(夹具),UpDownAxis_IH_P2,415000,,,,,,,,,,,,,,
PRO,升降轴 进料口取料缓冲点 P7(夹具),UpDownAxis_OH_P7,415000,,,,,,,,,,,,,,
PRO,升降轴 进料口出料缓冲点 P8(夹具),UpDownAxis_IL_P8,403000,,,,,,,,,,,,,,
,,,,,,,,,,,,,,,,,
PRO,升降轴 进料口取料点 P11(锡膏),UpDownAxis_OL_P11,403099,,,,,,,,,,,,,,
PRO,升降轴 进料口出料前点 P21(锡膏),UpDownAxis_IH_P21,415099,,,,,,,,,,,,,,
PRO,升降轴 进料口取料缓冲点 P71(锡膏),UpDownAxis_OH_P71,415099,,,,,,,,,,,,,,
PRO,升降轴 进料口出料缓冲点 P81(锡膏),UpDownAxis_IL_P81,403099,,,,,,,,,,,,,,
,,,,,,,,,,,,,,,,,
PRO,升降轴 搅拌位置高点P101(搅拌区),UpDownAxis_StirH_P101,415099,,,,,,,,,,,,,,
PRO,升降轴 搅拌位置低点P102(搅拌区),UpDownAxis_StirL_P102,403099,,,,,,,,,,,,,,
,,,,,,,,,,,,,,,,,
PRO,旋转轴 P1待机原位点(夹具取料点),MiddleAxis_P1,268000,,,,,,,,,,,,,,
PRO,旋转轴 P11左侧取放料点(左侧锡膏),MiddleAxis_P11,260000,,,,,,,,,,,,,,
PRO,旋转轴 P12右侧取放料点(右侧锡膏),MiddleAxis_P12,280000,,,,,,,,,,,,,,
PRO,旋转轴 P101搅拌取放料点(搅拌区),MiddleAxis_Stir_P101,280000,,,,,,,,,,,,,,
,,,,,,,,,,,,,,,,,
PRO,进出轴 P1待机原位点,InOutAxis_P1,1000,,,,,,,,,,,,,,
PRO,进出轴 P20(夹具取料点),InOutAxis_P20,2000,,,,,,,,,,,,,,
PRO,进出轴 P21(左侧锡膏取料点),InOutAxis_P21,2800,,,,,,,,,,,,,,
PRO,进出轴 P22(右侧锡膏取料点),InOutAxis_P22,2900,,,,,,,,,,,,,,
PRO,进出轴 P101(搅拌区取放料点),InOutAxis_Stir_P101,2900,,,,,,,,,,,,,,
,,,,,,,,,,,,,,,,,
PRO,(轴四)回温区旋转轴 P1待机原位点,Warming_Axis_P1,2000,,,,,,,,,,,,,,
PRO,(轴五)冷藏区旋转轴 P1待机原位点,Colding_Axis_P1,2000,,,,,,,,,,,,,,
PRO,(轴六)搅拌旋转轴 P1搅拌点1,Stir_Axis_P1,2000,,,,,,,,,,,,,,
PRO,(轴六)搅拌旋转轴 P2搅拌点2,Stir_Axis_P2,8000,,,,,,,,,,,,,,
,,,,,,,,,,,,,,,,,
PRO,是否有左右侧门,IsHasDoorLimit,1,,,,,,,,,,,,,,
PRO,设备是否处于调试状态(1=调试,0=正常),IsInDebug,0,,,,,,,,,,,,,,
PRO,气压检测IO关闭需要持续的时间,AirCheckSeconds,3,,,,,,,,,,,,,,
PRO,出入库多少次,会自动重置所有轴操作,Box_ResetACount,100,,,,, ,,,,,,,,,
PRO,IO信号超时时间(毫秒),IOSingle_TimerOut,10000,,,,,,,,,,,,,,
PRO,是否使用料盘检测信号,IsUse_Tray_Check,0,,,,,,,,,,,,,,
,,,,,,,,,,,,,,,,,
,,,,,,,,,,,,,,,,,
,,,,,,,,,,,,,,,,,
PRO,升降轴(轴2)P1速度,UpDownAxis_P1_Speed,250,,,,,,,,,,,,,,
PRO,升降轴(轴2)P2速度,UpDownAxis_P2_Speed,250,,,,,,,,,,,,,,
PRO,升降轴(轴2)P3速度,UpDownAxis_P3_Speed,250,,,,,,,,,,,,,,
PRO,升降轴(轴2)P4速度,UpDownAxis_P4_Speed,150,,,,,,,,,,,,,,
PRO,升降轴(轴2)P5速度,UpDownAxis_P5_Speed,250,,,,,,,,,,,,,,
PRO,升降轴(轴2)P6速度,UpDownAxis_P6_Speed,100,,,,,,,,,,,,,,
PRO,升降轴(轴2)P7速度,UpDownAxis_P7_Speed,100,,,,,,,,,,,,,,
PRO,升降轴(轴2)P8速度,UpDownAxis_P8_Speed,100,,,,,,,,,,,,,,
PRO,升降轴(轴2)P101速度,UpDownAxis_P101_Speed,100,,,,,,,,,,,,,,
PRO,升降轴(轴2)P102速度,UpDownAxis_P102_Speed,100,,,,,,,,,,,,,,
,,,,,,,,,,,,,,,,,
PRO,旋转轴(轴1)P1速度,MiddleAxis_P1_Speed,120,,,,,,,,,,,,,,
PRO,旋转轴(轴1)P2速度,MiddleAxis_P2_Speed,120,,,,,,,,,,,,,,
PRO,旋转轴(轴1)P101速度,MiddleAxis_P101_Speed,120,,,,,,,,,,,,,,
,,,,,,,,,,,,,,,,,
PRO,进出轴(轴3)P1速度,InOutAxis_P1_Speed,100,,,,,,,,,,,,,,
PRO,进出轴(轴3)P2速度,InOutAxis_P2_Speed,100,,,,,,,,,,,,,,
PRO,进出轴(轴3)P3速度,InOutAxis_P3_Speed,100,,,,,,,,,,,,,,
PRO,进出轴(轴3)P101速度,InOutAxis_P101_Speed,100,,,,,,,,,,,,,,
,,,,,,,,,,,,,,,,,
,,,,,,,,,,,,,,,,,
PRO,回温区旋转轴(轴4)P1速度,WarmingAxis_P1_Speed,120,,,,,,,,,,,,,,
PRO,回温区旋转轴(轴4)P2速度,WarmingAxis_P2_Speed,120,,,,,,,,,,,,,,
PRO,冷藏区旋转轴(轴5)P1速度(匀速运动速度),ColdingAxis_P1_Speed,20,,,,,,,,,,,,,,
PRO,冷藏区旋转轴(轴5)P2速度,ColdingAxis_P2_Speed,120,,,,,,,,,,,,,,
PRO,搅拌区旋转轴(轴6)P1速度(匀速运动速度),StirAxis_P1_Speed,20,,,,,,,,,,,,,,
PRO,搅拌区旋转轴(轴6)P2速度,StirAxis_P2_Speed,120,,,,,,,,,,,,,,
,,,,,,,,,,,,,,,,,
DO,设备运转ON,Run_Signal,4,192.168.200.21,设备运转ON,Y05,Y05,,,,,,,,,,
DO,料斗伺服刹车ON,Axis_Brake,5,192.168.200.21,料斗伺服刹车ON,Y06,Y06,,,,,,,,,,
DO,升降门刹车ON,Camera_Led,6,192.168.200.21,升降门刹车ON,Y07,Y07,,,,,,,,,,
DO,升降门电机上升,Door_Up,7,192.168.200.21,升降门电机上升,Y08,Y08,,,,,,,,,,
DO,升降门电机下降,Door_Down,8,192.168.200.21,升降门电机下降,Y09,Y09,,,,,,,,,,
DO,设备照明ON,Device_Led,9,192.168.200.21,设备照明ON,Y10,Y10,,,,,,,,,,
,,,10,192.168.200.21,,Y11,Y11,,,,,,,,,,
,,,11,192.168.200.21,,Y12,Y12,,,,,,,,,,
,,,12,192.168.200.21,,Y13,Y13,,,,,,,,,,
,,,13,192.168.200.21,,Y14,Y14,,,,,,,,,,
,,,14,192.168.200.21,,Y15,Y15,,,,,,,,,,
,,,15,192.168.200.21,,Y16,Y16,,,,,,,,,,
,,,,,,,,,,,,,,,,,
PRO,旋转轴 P1待机原位点 ,MiddleAxis_P1,268000,,,,,,,,,,,,,,
PRO,伺服停止时可误差的脉冲数的最小值,Axis_ErrorCountMin,10,,,,,,,,,,,,,,
PRO,伺服停止时可误差的脉冲数的最大值,Axis_ErrorCountMax,1000,,,,,,,,,,,,,,
,,,,,,,,,,,,,,,,,
PRO,(轴一)旋转轴最小限位,MiddleAxis_PositionMin,0,,,,,,,,,,,,,,
PRO,(轴二)升降轴最小限位,UpdownAxis_PositionMin,0,,,,,,,,,,,,,,
PRO,(轴三)进出轴最小限位,InoutAxis_PositionMin,0,,,,,,,,,,,,,,
PRO,(轴一)旋转轴最大限位,MiddleAxis_PositionMax,0,,,,,,,,,,,,,,
PRO,
(轴二)升降轴最大限位,UpdownAxis_PositionMax,
0,,,,,,,,,,,,,,
PRO,
(轴三)进出轴最大限位,InoutAxis_PositionMax,
0,,,,,,,,,,,,,,
PRO,
旋转轴(轴1)P1速度,MiddleAxis_P1_Speed,12
0,,,,,,,,,,,,,,
PRO,
旋转轴(轴1)P2速度,MiddleAxis_P2_Speed,12
0,,,,,,,,,,,,,,
,,,,,,,,,,,,,,,,,
,,,,,,,,,,,,,,,,,
PRO,
每次吹气的时间(分钟),BlowAir_Time,1
0,,,,,,,,,,,,,,
PRO,
两次吹气间隔(分钟),BlowAir_Interval,10,,,,,
,,,,,,,,,
PRO,
设备是否处于调试状态(1=调试,0=正常),IsInDebug,
0,,,,,,,,,,,,,,
PRO,
IO信号超时时间(毫秒),IOSingle_TimerOut,10000,,,,,
,,,,,,,,,
,,,,,,,,,,,,,,,,,
\ No newline at end of file
PRO,冷藏区温湿度端口号,Humiture_Colding_Port,COM3,,,,,,,,,,,,,,
PRO,回温区温湿度端口号,Humiture_Warming_Port,COM4,,,,,,,,,,,,,,
PRO,左侧测重控制器端口号,Weight_Left_Port,COM5,,,,,,,,,,,,,,
PRO,右侧测重控制器端口号,Weight_Right_Port,COM6,,,,,,,,,,,,,,
PRO,左侧测重空夹具重量,LeftDefWeight,30,,,,,,,,,,,,,,
PRO,右侧测重空夹具重量,RightDefWeight,45,,,,,,,,,,,,,,
,,,,,,,, ,,,,,,,,,
PRO,锡膏宽度,Tin_Width,100,,,,,,,,,,,,,,
PRO,锡膏高度,Tin_Height,50,,,,,,,,,,,,,,
PRO,夹具宽度,Fixture_Width,185,,,,,,,,,,,,,,
PRO,夹具高度,Fixture_Height,60,,,,,,,,,,,,,,
PRO,特殊二维码尺寸配置,CodeSizeConfig,XA=13x48#FA;PartNum;1=7x32,,,,,,,
source/DeviceLibrary/StoreConfig/linePositions.csv
查看文件 @
4be5928
位置,库位类型,优先级,高度,宽度,料仓ID,旋转轴位置P2,升降轴库位出料前点P5,升降轴库位出料缓冲点P6,升降轴库位入料前点P3,升降轴库位入料缓冲点P4,进出轴库位点取料点P3,回温区旋转轴库位点P2,冷藏区旋转轴库位点P2
1#AC1_1_1_4,1,1,50,50,1,211783,51884,55245,55245,51884,68000,20000,10000
1#AC1_1_1_5,1,2,50,50,1,211783,67807,71168,71168,67807,68000,20000,10000
1#AC1_1_1_6,1,3,50,50,1,211783,83730,87091,87091,83730,68000,20000,10000
1#AC1_1_1_7,1,4,50,50,1,211783,99653,103014,103014,99653,68000,20000,10000
1#AC1_1_1_8,1,5,50,50,1,211783,115576,118937,118937,115576,68000,20000,10000
1#AC1_1_1_9,1,6,50,50,1,211783,131499,134860,134860,131499,68000,20000,10000
1#AC1_1_1_10,1,7,50,50,1,211783,147422,150783,150783,147422,68000,20000,10000
1#AC1_1_2_3,1,8,50,50,1,211783,385700,389433,389433,385700,68000,20000,10000
1#AC1_1_2_4,2,9,50,50,1,211783,403000,405356,405356,403000,68000,20000,10000
1#AC1_1_2_5,2,10,50,50,1,211783,418345,421279,421279,418345,68000,20000,10000
1#AC1_1_2_6,2,11,50,50,1,211783,434000,437202,437202,434000,68000,20000,10000
1#AC1_1_2_7,2,12,50,50,1,211783,450000,453125,453125,450000,68000,20000,10000
1#AC1_1_2_8,2,13,50,50,1,211783,465900,469048,469048,465900,68000,20000,10000
1#AC1_1_2_9,2,14,50,50,1,211783,481800,484971,484971,481800,68000,20000,10000
1#AC1_1_3_1,2,15,50,50,1,211400,706257,709866,709866,706257,68000,20000,10000
1#AC1_1_3_2,2,16,50,50,1,211400,722180,725789,725789,722180,68000,20000,10000
1#AC1_1_3_3,2,17,50,50,1,211400,738103,741712,741712,738103,68000,20000,10000
1#AC1_1_3_4,2,18,50,50,1,211400,753026,757635,757635,753026,68000,20000,10000
1#AC1_1_3_5,2,19,50,50,1,211400,767949,773558,773558,767949,68000,20000,10000
1#AC1_1_3_6,2,20,50,50,1,211400,783872,789481,789481,783872,68000,20000,10000
1#AC1_1_3_7,2,21,50,50,1,211400,799795,805404,805404,799795,68000,20000,10000
1#AC1_1_3_8,2,22,50,50,1,211800,814218,819327,819327,814218,68000,20000,10000
1#AC1_1_3_9,2,23,50,50,1,211800,832141,835250,835250,832141,68000,20000,10000
1#AC1_1_3_10,2,24,50,50,1,211800,848064,851173,851173,848064,68000,20000,10000
1#AC1_1_3_11,2,25,50,50,1,212000,861987,867096,867096,861987,68000,20000,10000
1#AC1_1_3_12,2,26,50,50,1,212000,877910,883019,883019,877910,68000,20000,10000
1#AC1_2_1_1,2,27,50,50,1,169650,5600,9900,9900,5600,68000,20000,10000
1#AC1_2_1_2,2,28,50,50,1,169650,21365,25665,25665,21365,68000,20000,10000
1#AC1_2_1_3,2,29,50,50,1,169650,37130,41430,41430,37130,68000,20000,10000
1#AC1_2_1_4,2,30,50,50,1,169650,52895,57195,57195,52895,68000,20000,10000
1#AC1_2_1_5,2,31,50,50,1,169650,68660,72960,72960,68660,68000,20000,10000
1#AC1_2_1_6,2,32,50,50,1,169650,84425,88725,88725,84425,68000,20000,10000
1#AC1_2_1_7,2,33,50,50,1,169650,100190,104490,104490,100190,68000,20000,10000
1#AC1_2_1_8,2,34,50,50,1,169650,115955,120255,120255,115955,68000,20000,10000
1#AC1_2_1_9,2,35,50,50,1,169650,131720,136020,136020,131720,68000,20000,10000
1#AC1_2_1_10,2,36,50,50,1,169650,147485,151785,151785,147485,68000,20000,10000
1#AC1_2_1_11,2,37,50,50,1,169650,163250,167550,167550,163250,68000,20000,10000
1#AC1_2_2_1,2,38,50,50,1,169650,354811,358235,358235,354811,68000,20000,10000
1#AC1_2_2_2,2,39,50,100,1,169650,370576,374000,374000,370576,68000,20000,10000
1#AC1_2_2_3,2,40,50,100,1,169650,386341,389765,389765,386341,68000,20000,10000
1#AC1_2_2_4,2,41,50,100,1,169650,402106,405530,405530,402106,68000,20000,10000
1#AC1_2_2_5,2,42,50,100,1,169650,417871,421295,421295,417871,68000,20000,10000
1#AC1_2_2_6,2,43,50,100,1,169650,433636,437060,437060,433636,68000,20000,10000
1#AC1_2_2_7,2,44,50,100,1,169650,449401,452825,452825,449401,68000,20000,10000
1#AC1_2_2_8,100,45,50,50,1,169650,465166,468590,468590,465166,68000,20000,10000
1#AC1_2_2_9,200,46,50,50,1,169650,480931,484355,484355,480931,68000,20000,10000
1#AC1_2_2_10,300,47,50,50,1,169650,496696,500120,500120,496696,68000,20000,10000
1#AC1_2_2_11,400,48,50,50,1,169650,512461,515885,515885,512461,68000,20000,10000
1#AC1_2_2_12,500,49,50,50,1,169650,528226,531650,531650,528226,68000,20000,10000
貫零,욋貫잚謹,膽邱섬,죕분욱똑,죕분멕똑,죕꾑ID,좋됐乞多,죕떱旗瘻菉貫零P2
P_1_1,1,1,210,300,1,1,10000
P_1_2,1,2,210,300,1,2,10000
P_1_3,1,3,210,300,1,3,10000
P_1_4,1,4,210,300,1,4,10000
P_1_5,1,5,210,300,1,5,10000
P_1_6,1,6,210,300,1,6,10000
P_1_7,1,7,210,300,1,7,10000
P_1_8,1,8,210,300,1,8,10000
P_1_9,1,9,210,300,1,9,10000
P_1_10,1,10,210,300,1,10,10000
P_2_1,1,11,210,300,1,11,50000
P_2_2,1,12,210,300,1,12,50000
P_2_3,1,13,210,300,1,13,50000
P_2_4,1,14,210,300,1,14,50000
P_2_5,1,15,210,300,1,15,50000
P_2_6,1,16,210,300,1,16,50000
P_2_7,1,17,210,300,1,17,50000
P_2_8,1,18,210,300,1,18,50000
P_2_9,1,19,210,300,1,19,50000
P_2_10,1,20,210,300,1,20,50000
P_3_1,2,21,400,300,1,21;22,90000
P_3_2,2,22,400,300,1,23;24,90000
P_3_3,2,23,400,300,1,25;26,90000
P_3_4,2,24,400,300,1,21;23,90000
P_3_5,2,25,400,300,1,23;25,90000
P_4_1,2,26,400,300,1,25;27,130000
P_4_2,2,27,400,300,1,21;24,130000
P_4_3,2,28,400,300,1,23;26,130000
P_4_4,2,29,400,300,1,25;28,130000
P_4_5,2,30,400,300,1,21;25,130000
source/DeviceLibrary/acVerticalStore/StoreManager.cs
查看文件 @
4be5928
...
...
@@ -72,7 +72,7 @@ namespace OnlineStore.DeviceLibrary
if
(
File
.
Exists
(
positionConfigFile
))
{
LogUtil
.
info
(
"加载位置文件:"
+
positionConfigFile
);
CSVPositionReader
<
Vertical
Store
Position
>.
ReloadCSVFile
(
positionConfigFile
);
CSVPositionReader
<
VerticalPosition
>.
ReloadCSVFile
(
positionConfigFile
);
}
Config
=
(
VerticalStoreConfig
)
storeConfig
;
Store
=
new
VerticalStoreBean
(
Config
);
...
...
source/DeviceLibrary/acVerticalStore/VerticalStoreBean.cs
查看文件 @
4be5928
...
...
@@ -48,13 +48,13 @@ namespace OnlineStore.DeviceLibrary
moveAxisList
=
new
List
<
ConfigMoveAxis
>();
MoveAxisConfig
();
List
<
Vertical
StorePosition
>
positionList
=
CSVPositionReader
<
VerticalStore
Position
>.
getPositionList
();
List
<
Vertical
Position
>
positionList
=
CSVPositionReader
<
Vertical
Position
>.
getPositionList
();
PositionNumList
=
new
List
<
string
>();
foreach
(
Vertical
Store
Position
position
in
positionList
)
foreach
(
VerticalPosition
position
in
positionList
)
{
if
(
position
.
StoreId
.
Equals
(
StoreID
))
{
bool
result
=
Vertical
Store
Position
.
CheckPosition
(
position
,
Config
);
bool
result
=
VerticalPosition
.
CheckPosition
(
position
,
Config
);
if
(
result
)
{
PositionNumList
.
Add
(
position
.
PositionNum
);
...
...
@@ -68,7 +68,6 @@ namespace OnlineStore.DeviceLibrary
IOManager
.
instance
.
ConnectionIOList
(
Config
.
DIODeviceNameList
);
ACServerManager
.
LogEvent
+=
ACServerManager_LogEvent
;
LoadCurrStirInfo
();
mainTimer
.
Enabled
=
false
;
if
(
ConfigAppSettings
.
GetIntValue
(
Setting_Init
.
App_AutoRun
).
Equals
(
1
))
...
...
@@ -90,18 +89,15 @@ namespace OnlineStore.DeviceLibrary
//急停按钮和气压检测需要一起判断
IO_VALUE
suddenBtn
=
IOManager
.
IOValue
(
IO_Type
.
SuddenStop_BTN
);
IO_VALUE
airCheck
=
IOManager
.
IOValue
(
IO_Type
.
Airpressure_Check
);
if
(
suddenBtn
==
IO_VALUE
.
HIGH
&&
airCheck
==
IO_VALUE
.
HIGH
)
if
(
suddenBtn
==
IO_VALUE
.
HIGH
)
{
lastAirCloseTime
=
DateTime
.
Now
;
if
(!
RunAxis
(
true
))
{
return
false
;
}
//启动温湿度服务器
HumitureController
.
OpenAll
(
new
string
[]
{
Config
.
Humiture_Warming_Port
,
Config
.
Humiture_Colding_Port
});
OKLEController
.
OpenAll
(
new
string
[]
{
Config
.
Weight_Left_Port
,
Config
.
Weight_Right_Port
});
runStatus
=
StoreRunStatus
.
HomeMoving
;
StartReset
();
StartTime
=
DateTime
.
Now
;
...
...
@@ -134,7 +130,7 @@ namespace OnlineStore.DeviceLibrary
MoveInfo
.
NewMove
(
MoveType
.
StoreReset
);
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
P01_InOutToP1
);
LogUtil
.
info
(
Name
+
"到待机状态,进出轴到P1"
);
ACAxisMove
(
Config
.
InOut_Axis
,
Config
.
InOutAxis_P1
,
Config
.
InOutAxis_P1_Speed
);
//
ACAxisMove(Config.InOut_Axis, Config.InOutAxis_P1, Config.InOutAxis_P1_Speed);
}
public
override
void
Reset
(
bool
isNeedClearAuto
=
true
)
...
...
@@ -178,7 +174,7 @@ namespace OnlineStore.DeviceLibrary
storeStatus
=
StoreStatus
.
ResetMove
;
MoveInfo
.
NewMove
(
MoveType
.
StoreReset
);
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
R01_InOutBack
);
ACAxisHomeMove
(
Config
.
InOut_Axis
);
//
ACAxisHomeMove(Config.InOut_Axis);
LogUtil
.
info
(
Name
+
"开始原点返回,先把进出轴回原点"
);
MoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitTime
(
2000
));
}
...
...
@@ -193,84 +189,84 @@ namespace OnlineStore.DeviceLibrary
{
return
;
}
switch
(
MoveInfo
.
MoveStep
)
{
case
StoreMoveStep
.
R01_InOutBack
:
Thread
.
Sleep
(
200
);
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
R02_InOutToP1
);
ResetLog
(
"复位: 进出轴回P1,关闭仓门,冷藏门"
);
MoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitTime
(
1000
));
ACAxisMove
(
Config
.
InOut_Axis
,
Config
.
InOutAxis_P1
,
Config
.
InOutAxis_P1_Speed
);
CylinderMove
(
MoveInfo
,
IO_Type
.
Door_Up
,
IO_Type
.
Door_Down
);
break
;
case
StoreMoveStep
.
R02_InOutToP1
:
//如果此时轴三还在报警,需要提示错误并等待
if
(
ACServerManager
.
GetAlarmStatus
(
Config
.
InOut_Axis
.
DeviceName
,
Config
.
InOut_Axis
.
GetAxisValue
())
>
0
)
{
WarnMsg
=
"进出轴报警!复位失败,请检查!"
;
LogUtil
.
error
(
"进出轴报警!复位失败,请检查!"
);
return
;
}
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
R03_OtherAxisBack
);
MoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitTime
(
1000
));
ResetLog
(
" 复位:升降轴,旋转轴,搅拌轴,回温轴,冷藏轴原点返回"
);
ACAxisHomeMove
(
Config
.
Middle_Axis
);
ACAxisHomeMove
(
Config
.
UpDown_Axis
);
ACAxisHomeMove
(
Config
.
Stir_Axis
);
ACAxisHomeMove
(
Config
.
Warming_Axis
);
ACAxisHomeMove
(
Config
.
Colding_Axis
);
break
;
case
StoreMoveStep
.
R03_OtherAxisBack
:
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
R04_AxisToP1
);
MoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitTime
(
1000
));
ResetLog
(
"复位:旋转轴,升降轴,搅拌轴到待机点"
);
ACAxisMove
(
Config
.
Middle_Axis
,
Config
.
MiddleAxis_P1
,
Config
.
MiddleAxis_P1_Speed
);
ACAxisMove
(
Config
.
UpDown_Axis
,
Config
.
UpDownAxis_OL_P1
,
Config
.
UpDownAxis_P1_Speed
);
ACAxisMove
(
Config
.
Stir_Axis
,
Config
.
Stir_Axis_P1
,
Config
.
StirAxis_P1_Speed
);
break
;
case
StoreMoveStep
.
R04_AxisToP1
:
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
R05_StartWork
);
MoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitTime
(
1000
));
ResetLog
(
"复位:启动吹气冷气,冷藏旋转,回温旋转 "
);
StartWork
();
break
;
case
StoreMoveStep
.
R05_StartWork
:
LogUtil
.
info
(
Name
+
"复位完成"
);
runStatus
=
StoreRunStatus
.
Runing
;
MoveInfo
.
EndMove
();
storeStatus
=
StoreStatus
.
StoreOnline
;
if
(
alarmType
.
Equals
(
StoreAlarmType
.
None
))
{
WarnMsg
=
""
;
}
break
;
case
StoreMoveStep
.
P01_InOutToP1
:
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
P02_AxisToP1
);
MoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitTime
(
1000
));
ResetLog
(
"复位: 进出轴回P1,关闭仓门,冷藏门"
);
ACAxisMove
(
Config
.
InOut_Axis
,
Config
.
InOutAxis_P1
,
Config
.
InOutAxis_P1_Speed
);
CylinderMove
(
MoveInfo
,
IO_Type
.
Door_Up
,
IO_Type
.
Door_Down
);
break
;
case
StoreMoveStep
.
P02_AxisToP1
:
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
P03_StartWork
);
MoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitTime
(
1000
));
ResetLog
(
"复位:启动吹气冷气,冷藏旋转,回温旋转 "
);
StartWork
();
break
;
case
StoreMoveStep
.
P03_StartWork
:
LogUtil
.
info
(
Name
+
"到待机状态完成"
);
MoveInfo
.
EndMove
();
storeStatus
=
StoreStatus
.
StoreOnline
;
runStatus
=
StoreRunStatus
.
Runing
;
if
(
alarmType
.
Equals
(
StoreAlarmType
.
None
))
{
WarnMsg
=
""
;
}
break
;
//
switch (MoveInfo.MoveStep)
//
{
//
case StoreMoveStep.R01_InOutBack:
//
Thread.Sleep(200);
//
MoveInfo.NextMoveStep(StoreMoveStep.R02_InOutToP1);
//
ResetLog("复位: 进出轴回P1,关闭仓门,冷藏门");
//
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000));
//
ACAxisMove(Config.InOut_Axis, Config.InOutAxis_P1, Config.InOutAxis_P1_Speed);
//
CylinderMove(MoveInfo, IO_Type.Door_Up, IO_Type.Door_Down);
//
break;
//
case StoreMoveStep.R02_InOutToP1:
//
//如果此时轴三还在报警,需要提示错误并等待
//
if (ACServerManager.GetAlarmStatus(Config.InOut_Axis.DeviceName, Config.InOut_Axis.GetAxisValue()) > 0)
//
{
//
WarnMsg = "进出轴报警!复位失败,请检查!";
//
LogUtil.error ( "进出轴报警!复位失败,请检查!");
//
return;
//
}
//
MoveInfo.NextMoveStep(StoreMoveStep.R03_OtherAxisBack);
//
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000));
//
ResetLog(" 复位:升降轴,旋转轴,搅拌轴,回温轴,冷藏轴原点返回");
//
ACAxisHomeMove(Config.Middle_Axis);
//
ACAxisHomeMove(Config.UpDown_Axis);
//
ACAxisHomeMove(Config.Stir_Axis);
//
ACAxisHomeMove(Config.Warming_Axis);
//
ACAxisHomeMove(Config.Colding_Axis);
//
break;
//
case StoreMoveStep.R03_OtherAxisBack:
//
MoveInfo.NextMoveStep(StoreMoveStep.R04_AxisToP1);
//
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000));
//
ResetLog( "复位:旋转轴,升降轴,搅拌轴到待机点");
//
ACAxisMove(Config.Middle_Axis, Config.MiddleAxis_P1, Config.MiddleAxis_P1_Speed);
//
ACAxisMove(Config.UpDown_Axis, Config.UpDownAxis_OL_P1, Config.UpDownAxis_P1_Speed);
//
ACAxisMove(Config.Stir_Axis, Config.Stir_Axis_P1, Config.StirAxis_P1_Speed);
//
break;
//
case StoreMoveStep.R04_AxisToP1:
//
MoveInfo.NextMoveStep(StoreMoveStep.R05_StartWork);
//
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000));
//
ResetLog("复位:启动吹气冷气,冷藏旋转,回温旋转 ");
//
StartWork();
//
break;
//
case StoreMoveStep.R05_StartWork:
//
LogUtil.info(Name + "复位完成");
//
runStatus = StoreRunStatus.Runing;
//
MoveInfo.EndMove();
//
storeStatus = StoreStatus.StoreOnline;
//
if (alarmType.Equals(StoreAlarmType.None))
//
{
//
WarnMsg = "";
//
}
//
break;
//
case StoreMoveStep.P01_InOutToP1:
//
MoveInfo.NextMoveStep(StoreMoveStep.P02_AxisToP1);
//
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000));
//
ResetLog("复位: 进出轴回P1,关闭仓门,冷藏门");
//
ACAxisMove(Config.InOut_Axis, Config.InOutAxis_P1, Config.InOutAxis_P1_Speed);
//
CylinderMove(MoveInfo, IO_Type.Door_Up, IO_Type.Door_Down);
//
break;
//
case StoreMoveStep.P02_AxisToP1:
//
MoveInfo.NextMoveStep(StoreMoveStep.P03_StartWork);
//
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000));
//
ResetLog("复位:启动吹气冷气,冷藏旋转,回温旋转 ");
//
StartWork();
//
break;
//
case StoreMoveStep.P03_StartWork:
//
LogUtil.info( Name + "到待机状态完成");
//
MoveInfo.EndMove();
//
storeStatus = StoreStatus.StoreOnline;
//
runStatus = StoreRunStatus.Runing;
//
if (alarmType.Equals(StoreAlarmType.None))
//
{
//
WarnMsg = "";
//
}
//
break;
default
:
break
;
}
//
default: break;
//
}
}
internal
void
MoveAxisConfig
()
...
...
@@ -279,11 +275,6 @@ namespace OnlineStore.DeviceLibrary
moveAxisList
=
new
List
<
ConfigMoveAxis
>();
moveAxisList
.
Add
(
Config
.
Middle_Axis
);
moveAxisList
.
Add
(
Config
.
UpDown_Axis
);
moveAxisList
.
Add
(
Config
.
InOut_Axis
);
moveAxisList
.
Add
(
Config
.
Warming_Axis
);
moveAxisList
.
Add
(
Config
.
Colding_Axis
);
moveAxisList
.
Add
(
Config
.
Stir_Axis
);
this
.
AxisAlarmCodeMap
=
new
Dictionary
<
string
,
AxisAlarmInfo
>();
foreach
(
ConfigMoveAxis
axis
in
moveAxisList
)
...
...
@@ -293,31 +284,7 @@ namespace OnlineStore.DeviceLibrary
}
#
endregion
/// <summary>
/// 冷藏和回温区开始工作
/// </summary>
/// <param name="posType">1=冷藏区匀速旋转。2=回温区匀速旋转</param>
private
void
StartWork
(
int
posType
=
0
)
{
IOManager
.
IOMove
(
IO_Type
.
Colding_Start
,
IO_VALUE
.
HIGH
);
IOManager
.
IOMove
(
IO_Type
.
Warming_Start
,
IO_VALUE
.
HIGH
);
//匀速旋转
if
(
posType
.
Equals
(
0
)
||
posType
.
Equals
(
1
))
{
if
(
ACServerManager
.
GetBusyStatus
(
Config
.
Colding_Axis
.
DeviceName
,
Config
.
Colding_Axis
.
GetAxisValue
()).
Equals
(
0
))
{
ACServerManager
.
SpeedMove
(
Config
.
Colding_Axis
.
DeviceName
,
Config
.
Colding_Axis
.
GetAxisValue
(),
Config
.
ColdingAxis_P1_Speed
);
}
}
if
(
posType
.
Equals
(
0
)
||
posType
.
Equals
(
2
))
{
if
(
ACServerManager
.
GetBusyStatus
(
Config
.
Warming_Axis
.
DeviceName
,
Config
.
Warming_Axis
.
GetAxisValue
()).
Equals
(
0
))
{
ACServerManager
.
SpeedMove
(
Config
.
Warming_Axis
.
DeviceName
,
Config
.
Warming_Axis
.
GetAxisValue
(),
Config
.
WarmingAxis_P1_Speed
);
}
}
}
public
bool
RunAxis
(
bool
isCheck
)
{
...
...
@@ -482,44 +449,6 @@ namespace OnlineStore.DeviceLibrary
}
InProcess
=
false
;
}
private
void
AirCheckProcess
()
{
IO_VALUE
currAirValue
=
IOManager
.
IOValue
(
IO_Type
.
Airpressure_Check
);
if
(
isInSuddenDown
)
{
return
;
}
if
(
isNoAirCheck
)
{
return
;
}
if
(
currAirValue
.
Equals
(
IO_VALUE
.
LOW
))
{
//判断是否持续了3秒
if
(
preAirValue
.
Equals
(
IO_VALUE
.
LOW
))
{
TimeSpan
span
=
DateTime
.
Now
-
lastAirCloseTime
;
if
(
span
.
TotalSeconds
>
Config
.
AirCheckSeconds
)
{
WarnMsg
=
"未检测到气压信号"
;
preAirValue
=
IO_VALUE
.
LOW
;
LogUtil
.
info
(
"已持续【"
+
FormUtil
.
GetSpanStr
(
span
)
+
"】未检测到气压信号,报警"
);
Alarm
(
StoreAlarmType
.
NoAirCheck
,
"2"
,
WarnMsg
,
MoveType
.
None
);
return
;
}
}
else
{
lastAirCloseTime
=
DateTime
.
Now
;
isNoAirCheck
=
false
;
}
}
else
{
isNoAirCheck
=
false
;
}
preAirValue
=
currAirValue
;
}
private
void
IoCheckProcess
()
{
...
...
@@ -527,7 +456,7 @@ namespace OnlineStore.DeviceLibrary
if
(
runStatus
.
Equals
(
StoreRunStatus
.
Wait
))
{
//取新的Io状态
IO_VALUE
autoSingle
=
IOManager
.
IOValue
(
IO_Type
.
AutoRun_Signal
);
IO_VALUE
autoSingle
=
IOManager
.
IOValue
(
IO_Type
.
Reset_BTN
);
if
(
ConfigAppSettings
.
GetIntValue
(
Setting_Init
.
App_AutoRun
).
Equals
(
1
))
{
if
(
autoSingle
.
Equals
(
IO_VALUE
.
HIGH
)
&&
lastAutoRun
.
Equals
(
IO_VALUE
.
LOW
))
...
...
@@ -553,12 +482,7 @@ namespace OnlineStore.DeviceLibrary
IO_VALUE
suddenBtn
=
IOManager
.
IOValue
(
IO_Type
.
SuddenStop_BTN
);
IO_VALUE
resetBtn
=
IOManager
.
IOValue
(
IO_Type
.
Reset_BTN
);
//急停按钮
if
(
suddenBtn
.
Equals
(
IO_VALUE
.
LOW
))
{
AirCheckProcess
();
}
else
if
(
resetBtn
.
Equals
(
IO_VALUE
.
HIGH
))
if
(
resetBtn
.
Equals
(
IO_VALUE
.
HIGH
))
{
//收到复位信号,若报警直接复位,若不报警且无操作,回到待机点
if
(
alarmType
.
Equals
(
StoreAlarmType
.
None
)
&&
isInSuddenDown
.
Equals
(
false
)
&&
isNoAirCheck
.
Equals
(
false
))
...
...
@@ -592,14 +516,6 @@ namespace OnlineStore.DeviceLibrary
}
}
//ShowTimeLog("复位和启动按钮");
////检查运动轴报警
//if (storeRunStatus > StoreRunStatus.Wait && (!isInSuddenDown) )
//{
// ShowTimeLog("开始检测轴报警");
// CheckAxisAlarm();
// ShowTimeLog("轴报警检测完成");
//}
}
private
void
IoCheckTimer_Elapsed
(
object
sender
,
System
.
Timers
.
ElapsedEventArgs
e
)
...
...
@@ -639,18 +555,10 @@ namespace OnlineStore.DeviceLibrary
}
else
if
(
runStatus
.
Equals
(
StoreRunStatus
.
Runing
))
{
InstoreCheck
();
AutoResetProcess
();
IOTimeOutProcess
();
}
if
(
CurrStirInfo
.
InStirWork
&&
CurrStirInfo
.
MoveStatus
.
Equals
(
3
)
&&
CurrStirInfo
.
StopTime
<=
DateTime
.
Now
)
{
UpdateCurrStirState
(
4
);
LogUtil
.
info
(
CurrStirInfo
.
StirParam
.
LogName
+
"到达搅拌结束时间,搅拌轴停止运动,更新状态=4 "
);
AxisSuddenStop
(
Config
.
Stir_Axis
);
}
}
catch
(
Exception
ex
)
{
...
...
@@ -658,68 +566,6 @@ namespace OnlineStore.DeviceLibrary
}
}
private
Stopwatch
checkWatch_0
=
new
Stopwatch
();
private
Stopwatch
checkWatch_1
=
new
Stopwatch
();
private
Stopwatch
checkWatch_2
=
new
Stopwatch
();
//判断是否需要出入库
private
void
InstoreCheck
()
{
if
(
MoveInfo
.
MoveType
.
Equals
(
MoveType
.
None
)
&&
alarmType
.
Equals
(
StoreAlarmType
.
None
))
{
if
(
IsScanCode
)
{
return
;
}
//判断料门口是否有料
if
(
IOManager
.
IOValue
(
IO_Type
.
TinCheck_Fixture
).
Equals
(
IO_VALUE
.
HIGH
))
{
checkWatch_1
.
Stop
();
checkWatch_2
.
Stop
();
if
(
StoreManager
.
checkWatch
(
checkWatch_0
,
1500
,
true
))
{
LogUtil
.
info
(
Name
+
"检测到 夹具信号,开始扫码"
);
StartScan
(
0
);
}
}
else
if
(
IOManager
.
IOValue
(
IO_Type
.
TinCheck_DoorLeft
).
Equals
(
IO_VALUE
.
HIGH
))
{
checkWatch_0
.
Stop
();
checkWatch_2
.
Stop
();
double
leftWeight
=
OKLEController
.
queryData
(
Config
.
Weight_Left_Port
);
if
(
leftWeight
>=
50
)
{
if
(
StoreManager
.
checkWatch
(
checkWatch_1
,
1500
,
true
))
{
LogUtil
.
info
(
Name
+
"检测到 左侧锡膏,开始扫码"
);
StartScan
(
1
,
leftWeight
);
}
}
}
else
if
(
IOManager
.
IOValue
(
IO_Type
.
TinCheck_DoorRight
).
Equals
(
IO_VALUE
.
HIGH
))
{
checkWatch_0
.
Stop
();
checkWatch_1
.
Stop
();
double
rightWeight
=
OKLEController
.
queryData
(
Config
.
Weight_Right_Port
);
if
(
rightWeight
>=
50
)
{
if
(
StoreManager
.
checkWatch
(
checkWatch_2
,
1500
,
true
))
{
LogUtil
.
info
(
Name
+
"检测到 右侧锡膏,开始扫码"
);
StartScan
(
2
,
rightWeight
);
}
}
}
else
{
checkWatch_0
.
Stop
();
checkWatch_1
.
Stop
();
checkWatch_2
.
Stop
();
}
}
}
private
DateTime
preIoTimerOutTime
=
DateTime
.
Now
;
private
void
IOTimeOutProcess
()
...
...
@@ -758,67 +604,6 @@ namespace OnlineStore.DeviceLibrary
}
}
private
void
AutoResetProcess
()
{
try
{
if
(
CurrInOutACount
>=
this
.
Config
.
Box_ResetACount
)
{
if
(
runStatus
.
Equals
(
StoreRunStatus
.
Runing
)
&&
MoveInfo
.
MoveType
.
Equals
(
MoveType
.
None
))
{
LogUtil
.
info
(
Name
+
"已经累计出入库"
+
CurrInOutACount
+
"次,需要复位一下"
);
Reset
();
}
}
else
if
(
CurrStirInfo
.
InStirWork
&&
CurrStirInfo
.
MoveStatus
.
Equals
(
4
)
&&
CurrStirInfo
.
StirParam
!=
null
)
{
if
(
runStatus
.
Equals
(
StoreRunStatus
.
Runing
)
&&
MoveInfo
.
MoveType
.
Equals
(
MoveType
.
None
))
{
LogUtil
.
info
(
Name
+
CurrStirInfo
.
StirParam
.
LogName
+
",搅拌已完成,开始回库操作"
);
StartStirBackPos
(
CurrStirInfo
.
StirParam
);
}
}
else
{
InOutParam
param
=
null
;
if
(
WaitMoveParamList
.
Count
>
0
&&
CanStarInOut
())
{
bool
result
=
WaitMoveParamList
.
TryDequeue
(
out
param
);
}
if
(
param
!=
null
)
{
//出库
if
(
param
.
PosCode
.
Equals
(
""
))
{
LogUtil
.
info
(
Name
+
"开始执行排队中的 "
+
param
.
LogName
+
""
);
bool
result
=
false
;
if
(
param
.
paramType
.
Equals
(
MoveType
.
OutStore
))
{
result
=
StartOutStore
(
param
);
}
else
if
(
param
.
paramType
.
Equals
(
MoveType
.
MovePos
))
{
result
=
StartMovement
(
param
);
}
else
if
(
param
.
paramType
.
Equals
(
MoveType
.
Stirring
))
{
result
=
StartStirring
(
param
);
}
if
(!
result
)
{
LogUtil
.
info
(
Name
+
" 执行排队中的 "
+
param
.
LogName
+
"失败,重新加入等待队列"
);
AddWaitMoveParam
(
param
);
}
}
}
}
}
catch
(
Exception
ex
)
{
LogUtil
.
error
(
"处理出入库排队列表出错:"
+
ex
.
ToString
());
}
}
private
DateTime
checkAlarmTime
=
DateTime
.
Now
;
private
bool
CheckAxisAlarm
()
...
...
@@ -892,34 +677,34 @@ namespace OnlineStore.DeviceLibrary
{
if
(
NeedCheckSafetyLight
.
Equals
(
1
))
{
if
(
MoveInfo
.
MoveType
.
Equals
(
MoveType
.
OutStore
)
&&
MoveInfo
.
IsStep
(
StoreMoveStep
.
SO_13_InoutToP2
))
{
NeedCheckSafetyLight
=
2
;
LogUtil
.
info
(
"出库 "
+
MoveInfo
.
MoveStep
+
" 运动中,光栅被遮挡,停止进出轴运动"
);
ACServerManager
.
SuddenStop
(
Config
.
InOut_Axis
.
DeviceName
,
Config
.
InOut_Axis
.
GetAxisValue
());
}
else
if
(
MoveInfo
.
MoveType
.
Equals
(
MoveType
.
InStore
)
&&
MoveInfo
.
IsStep
(
StoreMoveStep
.
SI_05_InoutToP2
))
{
NeedCheckSafetyLight
=
2
;
LogUtil
.
info
(
"入库 "
+
MoveInfo
.
MoveStep
+
" 运动中,光栅被遮挡,停止进出轴运动"
);
ACServerManager
.
SuddenStop
(
Config
.
InOut_Axis
.
DeviceName
,
Config
.
InOut_Axis
.
GetAxisValue
());
}
//
if (MoveInfo.MoveType.Equals(MoveType.OutStore) && MoveInfo.IsStep(StoreMoveStep.SO_13_InoutToP2))
//
{
//
NeedCheckSafetyLight = 2;
//
LogUtil.info("出库 " + MoveInfo.MoveStep + " 运动中,光栅被遮挡,停止进出轴运动");
//
ACServerManager.SuddenStop(Config.InOut_Axis.DeviceName, Config.InOut_Axis.GetAxisValue());
//
}
//
else if (MoveInfo.MoveType.Equals(MoveType.InStore) && MoveInfo.IsStep(StoreMoveStep.SI_05_InoutToP2))
//
{
//
NeedCheckSafetyLight = 2;
//
LogUtil.info("入库 "+ MoveInfo.MoveStep + " 运动中,光栅被遮挡,停止进出轴运动");
//
ACServerManager.SuddenStop(Config.InOut_Axis.DeviceName, Config.InOut_Axis.GetAxisValue());
//
}
}
}
else
{
if
(
NeedCheckSafetyLight
.
Equals
(
2
))
{
if
(
MoveInfo
.
MoveType
.
Equals
(
MoveType
.
OutStore
)
&&
MoveInfo
.
IsStep
(
StoreMoveStep
.
SO_13_InoutToP2
))
{
LogUtil
.
info
(
"出库 "
+
MoveInfo
.
MoveStep
+
" 运动中,光栅已恢复,继续进出轴运动"
);
SO_13_InoutToP2
();
}
else
if
(
MoveInfo
.
MoveType
.
Equals
(
MoveType
.
InStore
)
&&
MoveInfo
.
IsStep
(
StoreMoveStep
.
SI_05_InoutToP2
))
{
LogUtil
.
info
(
"入库 "
+
MoveInfo
.
MoveStep
+
" 运动中,光栅已恢复,继续进出轴运动"
);
SI_05_InoutToP2
();
}
//
if (MoveInfo.MoveType.Equals(MoveType.OutStore) && MoveInfo.IsStep(StoreMoveStep.SO_13_InoutToP2))
//
{
//
LogUtil.info("出库 " + MoveInfo.MoveStep + " 运动中,光栅已恢复,继续进出轴运动");
//
SO_13_InoutToP2();
//
}
//
else if (MoveInfo.MoveType.Equals(MoveType.InStore) && MoveInfo.IsStep(StoreMoveStep.SI_05_InoutToP2))
//
{
//
LogUtil.info("入库 " + MoveInfo.MoveStep + " 运动中,光栅已恢复,继续进出轴运动");
//
SI_05_InoutToP2();
//
}
}
}
}
...
...
@@ -974,159 +759,6 @@ namespace OnlineStore.DeviceLibrary
}
#
region
扫码
代码
private
DateTime
StartWaitScanTime
=
DateTime
.
Now
;
private
bool
IsNotScanCode
=
false
;
private
bool
IsScanCode
=
false
;
private
void
onCodeReceived
(
string
message
)
{
try
{
message
=
ScanCodeManager
.
ReplaceCode
(
message
);
if
(
message
.
Equals
(
""
)
||
string
.
IsNullOrEmpty
(
message
))
{
IsNotScanCode
=
true
;
IsScanCode
=
false
;
CodeMsg
=
"没有收到二维码信息,请重新放入料盘"
;
LogUtil
.
info
(
Name
+
"没有收到二维码信息,请重新放入料盘"
);
return
;
}
IsNotScanCode
=
false
;
if
(
runStatus
.
Equals
(
StoreRunStatus
.
Wait
))
{
LogUtil
.
info
(
Name
+
"收到二维码【 "
+
message
+
"】,设备未启动,不需要发送服务器"
);
IsScanCode
=
false
;
return
;
}
// CodeMsg = "收到二维码【 " + message + "】,发送给服务器获取入库PosID";
LogUtil
.
info
(
Name
+
"收到二维码【 "
+
message
+
"】,发送给服务器获取入库PosID"
);
//发送扫码内容到服务器进行入库操作
Operation
operation
=
getLineBoxStatus
();
operation
.
op
=
1
;
operation
.
data
=
new
Dictionary
<
string
,
string
>()
{
{
"code"
,
message
},
{
"boxId"
,
StoreID
.
ToString
()
}
};
string
server
=
ConfigAppSettings
.
GetValue
(
Setting_Init
.
http_server
);
Operation
resultOperation
=
HttpHelper
.
Post
(
StoreManager
.
GetPostApi
(
server
),
operation
,
false
);
if
(
resultOperation
==
null
)
{
// CodeMsg = "二维码【" + message + "】没有收到服务器反馈";
LogUtil
.
info
(
Name
+
"二维码【"
+
message
+
"】没有收到服务器反馈!"
);
IsScanCode
=
false
;
return
;
}
else
if
(!
string
.
IsNullOrEmpty
(
resultOperation
.
msg
))
{
//如果有提示消息,直接显示提示
LogUtil
.
info
(
Name
+
"服务器反馈 二维码【"
+
message
+
"】 :"
+
resultOperation
.
msg
);
IsScanCode
=
false
;
return
;
}
IsScanCode
=
false
;
if
(
resultOperation
.
op
.
Equals
(
1
))
{
ReviceInStoreProcess
(
message
,
resultOperation
);
}
else
if
(
resultOperation
.
op
.
Equals
(
2
))
{
ReviceOutStoreProcess
(
resultOperation
);
}
else
if
(
resultOperation
.
op
.
Equals
(
5
))
{
ProcessHumidityCMD
(
resultOperation
);
}
else
{
LogUtil
.
error
(
"收到服务器命令:op="
+
resultOperation
.
op
+
",未找到对应处理"
);
}
}
catch
(
Exception
ex
)
{
IsScanCode
=
false
;
LogUtil
.
error
(
Name
+
ex
.
StackTrace
);
}
}
#
endregion
#
region
扫码
private
string
CodeMsg
=
""
;
private
string
spiltStr
=
"##"
;
private
DateTime
LastScanTime
=
DateTime
.
Now
;
public
void
StartScan
(
int
wareType
=
0
,
double
weight
=
0
)
{
if
(
IsInScan
())
{
LogUtil
.
info
(
"上次扫码还未执行完毕,请稍后!"
);
return
;
}
IsScanCode
=
true
;
Task
.
Factory
.
StartNew
(
delegate
{
LastScanTime
=
DateTime
.
Now
;
IOManager
.
IOMove
(
IO_Type
.
Camera_Led
,
IO_VALUE
.
HIGH
);
string
message
=
""
;
List
<
CodeInfo
>
codeList
=
CodeManager
.
CameraScan
();
foreach
(
CodeInfo
obj
in
codeList
)
{
string
codeR
=
""
;
string
ncode
=
obj
.
CodeStr
;
//判断左右,默认左侧条码X<1500
if
(
wareType
.
Equals
(
1
)
&&
codeList
.
Count
>=
2
&&
obj
.
X
>
1500
)
{
LogUtil
.
info
(
Name
+
"左侧锡膏,弃用条码:"
+
obj
.
X
+
"x"
+
obj
.
Y
+
"="
+
obj
.
CodeStr
);
continue
;
}
if
(
wareType
.
Equals
(
2
)
&&
codeList
.
Count
>=
2
&&
obj
.
X
<
1500
)
{
LogUtil
.
info
(
Name
+
"右侧锡膏,弃用条码:"
+
obj
.
X
+
"x"
+
obj
.
Y
+
"="
+
obj
.
CodeStr
);
continue
;
}
//根据二维码开头获取固定尺寸
string
codeSize
=
Config
.
GetCodeSize
(
ref
ncode
);
if
(
String
.
IsNullOrEmpty
(
codeSize
))
{
codeSize
=
Config
.
Tin_Width
+
"x"
+
Config
.
Tin_Height
;
if
(
wareType
.
Equals
(
0
))
{
codeSize
=
Config
.
Fixture_Width
+
"x"
+
Config
.
Fixture_Height
;
}
}
if
(!
String
.
IsNullOrEmpty
(
ncode
))
{
codeR
=
"=1+"
+
obj
.
X
+
"x"
+
obj
.
Y
+
"-"
+
codeSize
+
"="
+
ncode
;
message
=
message
+
codeR
+
spiltStr
;
}
}
IOManager
.
IOMove
(
IO_Type
.
Camera_Led
,
IO_VALUE
.
LOW
);
onCodeReceived
(
message
);
});
}
private
bool
IsInScan
()
{
if
(!
IsScanCode
)
{
return
false
;
}
TimeSpan
span
=
DateTime
.
Now
-
LastScanTime
;
if
(
span
.
TotalSeconds
>
60
)
{
//大于60秒表示超时了,可以重新开始扫码
return
false
;
}
return
true
;
}
#
endregion
#
region
与服务器通信定时器
private
float
Max_Humidity
=
0
;
...
...
@@ -1173,8 +805,6 @@ namespace OnlineStore.DeviceLibrary
LogUtil
.
error
(
"定时给服务器发送消息出错:"
+
ex
.
ToString
());
}
}
HumitureController
.
QueryColdData
(
Config
.
Humiture_Colding_Port
);
HumitureController
.
QueryWarmData
(
Config
.
Humiture_Warming_Port
);
HumidityProcess
();
LedProcess
();
isInProcess
=
false
;
...
...
@@ -1210,21 +840,7 @@ namespace OnlineStore.DeviceLibrary
boxStatus
.
msg
=
WarnMsg
;
lineOperation
.
msg
=
WarnMsg
;
if
(
WarnMsg
.
Equals
(
""
))
{
boxStatus
.
msg
=
CodeMsg
;
lineOperation
.
msg
=
CodeMsg
;
}
if
(
CodeMsg
.
Equals
(
""
))
{
if
(
runStatus
.
Equals
(
StoreRunStatus
.
Runing
)
&&
IOManager
.
IOValue
(
IO_Type
.
TinCheck_Fixture
).
Equals
(
IO_VALUE
.
HIGH
))
{
boxStatus
.
msg
=
"叉子料盘检测有料,请检查"
;
lineOperation
.
msg
=
"叉子料盘检测有料,请检查"
;
}
}
CodeMsg
=
""
;
//WarnMsg = "";
//状态
boxStatus
.
status
=
(
int
)
storeStatus
;
if
(
IsDebug
)
...
...
@@ -1360,7 +976,7 @@ namespace OnlineStore.DeviceLibrary
int
storeId
=
int
.
Parse
(
posArray
[
0
]);
//根据发送的posId获取位置列表
Vertical
StorePosition
position
=
CSVPositionReader
<
VerticalStore
Position
>.
GetPositon
(
posId
);
Vertical
Position
position
=
CSVPositionReader
<
Vertical
Position
>.
GetPositon
(
posId
);
if
(
position
==
null
)
{
//出入库没有找到服务器发送的库位,需要打印日志方便查询原因
...
...
@@ -1371,20 +987,20 @@ namespace OnlineStore.DeviceLibrary
else
{
InOutParam
currInOutFixture
=
new
InOutParam
(
MoveType
.
OutStore
,
posId
,
""
,
plateW
,
plateH
);
if
(
CanStarInOut
())
{
bool
result
=
StartOutStore
(
currInOutFixture
);
if
(!
result
)
{
LogUtil
.
info
(
Name
+
" 执行出库【"
+
currInOutFixture
.
ToStr
()
+
"】失败,加入等待队列"
);
AddWaitMoveParam
(
currInOutFixture
);
}
}
else
{
LogUtil
.
error
(
"执行出库【"
+
currInOutFixture
.
ToStr
()
+
"】失败,当前在忙碌中,加入等待队列"
);
AddWaitMoveParam
(
currInOutFixture
);
}
//
if (CanStarInOut())
//
{
//
bool result = StartOutStore(currInOutFixture);
//
if (!result)
//
{
//
LogUtil.info(Name + " 执行出库【" + currInOutFixture.ToStr() + "】失败,加入等待队列");
//
AddWaitMoveParam(currInOutFixture);
//
}
//
}
//
else
//
{
//
LogUtil.error("执行出库【" + currInOutFixture.ToStr() + "】失败,当前在忙碌中,加入等待队列");
//
AddWaitMoveParam(currInOutFixture);
//
}
}
}
...
...
@@ -1416,7 +1032,7 @@ namespace OnlineStore.DeviceLibrary
int
storeId
=
int
.
Parse
(
posArray
[
0
]);
//根据发送的posId获取位置列表
Vertical
StorePosition
position
=
CSVPositionReader
<
VerticalStore
Position
>.
GetPositon
(
posId
);
Vertical
Position
position
=
CSVPositionReader
<
Vertical
Position
>.
GetPositon
(
posId
);
if
(
position
==
null
)
{
//出入库没有找到服务器发送的库位,需要打印日志方便查询原因
...
...
@@ -1427,7 +1043,6 @@ namespace OnlineStore.DeviceLibrary
//TODO:判断BOX是否处于可以入库状态,如果调试或急停中,需要返回给服务器;
if
(
CanStarInOut
())
{
IsScanCode
=
false
;
InOutParam
param
=
new
InOutParam
(
MoveType
.
InStore
,
posId
,
message
,
plateH
,
plateW
);
StartInStore
(
param
);
...
...
@@ -1437,7 +1052,6 @@ namespace OnlineStore.DeviceLibrary
else
{
LogUtil
.
info
(
Name
+
" 收到服务器入库命令:库位号【"
+
posId
+
"】二维码【"
+
message
+
"】 正在忙碌中,无法入库!"
);
IsScanCode
=
false
;
}
}
...
...
source/DeviceLibrary/acVerticalStore/VerticalStoreBean_InOut.cs
查看文件 @
4be5928
...
...
@@ -140,11 +140,7 @@ namespace OnlineStore.DeviceLibrary
LogUtil
.
error
(
Name
+
" 启动 "
+
param
.
LogName
+
"失败,找不到库位信息"
);
return
false
;
}
if
(
IOManager
.
IOValue
(
IO_Type
.
TinCheck_Fixture
).
Equals
(
IO_VALUE
.
HIGH
))
{
LogUtil
.
error
(
Name
+
" 启动 "
+
param
.
LogName
+
"失败,叉子料盘检测有料"
);
return
false
;
}
LogUtil
.
info
(
Name
+
" 启动 "
+
param
.
LogName
);
moveWatch
.
Restart
();
runStatus
=
StoreRunStatus
.
Busy
;
...
...
@@ -170,211 +166,201 @@ namespace OnlineStore.DeviceLibrary
protected
override
void
InStoreProcess
()
{
StoreMoveP
moveP
=
MoveInfo
.
MoveParam
.
MoveP
;
if
(
MoveInfo
.
IsInWait
)
{
CheckWait
();
}
if
(
MoveInfo
.
IsInWait
)
{
return
;
}
if
(
MoveInfo
.
IsStep
(
StoreMoveStep
.
SI_01_TrayCheck
))
{
SI_02_InOutToP1
(
moveP
);
}
else
if
(
MoveInfo
.
IsStep
(
StoreMoveStep
.
SI_02_InOutToP1
))
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
SI_03_Clamping_Relax
);
InStoreLog
(
" 夹爪放松"
);
CylinderMove
(
MoveInfo
,
IO_Type
.
Clamping_Tighten
,
IO_Type
.
Clamping_Relax
);
}
else
if
(
MoveInfo
.
IsStep
(
StoreMoveStep
.
SI_03_Clamping_Relax
))
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
SI_04_AxisToP1
);
InStoreLog
(
" 轴2、轴1 动作到P1 "
);
ACAxisMove
(
Config
.
UpDown_Axis
,
moveP
.
UpDown_P1
,
Config
.
UpDownAxis_P1_Speed
);
ACAxisMove
(
Config
.
Middle_Axis
,
moveP
.
Middle_P1
,
Config
.
MiddleAxis_P1_Speed
);
}
else
if
(
MoveInfo
.
IsStep
(
StoreMoveStep
.
SI_04_AxisToP1
))
{
SI_05_InoutToP2
();
}
else
if
(
MoveInfo
.
IsStep
(
StoreMoveStep
.
SI_05_InoutToP2
))
{
NeedCheckSafetyLight
=
0
;
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
SI_06_Clamping_Work
);
InStoreLog
(
"夹爪夹紧 "
);
CylinderMove
(
MoveInfo
,
IO_Type
.
Clamping_Relax
,
IO_Type
.
Clamping_Tighten
);
}
else
if
(
MoveInfo
.
IsStep
(
StoreMoveStep
.
SI_06_Clamping_Work
))
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
SI_07_UpdownToP7
);
InStoreLog
(
"升降轴到P7 "
);
ACAxisMove
(
Config
.
UpDown_Axis
,
moveP
.
UpDown_P7
,
Config
.
UpDownAxis_P7_Speed
);
}
else
if
(
MoveInfo
.
IsStep
(
StoreMoveStep
.
SI_07_UpdownToP7
))
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
SI_08_InOutToP1
);
InOutBackToP1
(
moveP
.
InOut_P1
);
ConfigMoveAxis
axis
=
GetPosTAxis
();
InStoreLog
(
"进出轴返回待机点P1, "
+
axis
.
ProName
+
"停止匀速运动 "
);
AxisSuddenStop
(
axis
);
}
else
if
(
MoveInfo
.
IsStep
(
StoreMoveStep
.
SI_08_InOutToP1
))
{
ConfigMoveAxis
axis
=
GetPosTAxis
();
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
SI_09_MoveToBag
);
MoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitTime
(
1000
));
InStoreLog
(
"移动到库位点,旋转轴 至P2( 库位点)升降轴至P3(库位入库前点)关闭仓门 "
+
axis
.
ProName
+
"开始原点返回"
);
ACAxisMove
(
Config
.
Middle_Axis
,
moveP
.
Middle_P2
,
Config
.
MiddleAxis_P2_Speed
);
ACAxisMove
(
Config
.
UpDown_Axis
,
moveP
.
UpDown_P3
,
Config
.
UpDownAxis_P3_Speed
);
CylinderMove
(
null
,
IO_Type
.
Door_Up
,
IO_Type
.
Door_Down
);
ACAxisHomeMove
(
axis
);
}
else
if
(
MoveInfo
.
IsStep
(
StoreMoveStep
.
SI_09_MoveToBag
))
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
SI_10_TargetAxisToP2
);
if
(
MoveInfo
.
MoveParam
.
Position
.
PosType
.
Equals
(
1
))
{
InStoreLog
(
"冷藏旋转轴到P2 "
);
ACAxisMove
(
Config
.
Colding_Axis
,
moveP
.
Cold_P2
,
Config
.
ColdingAxis_P2_Speed
);
}
else
{
InStoreLog
(
"回温旋转轴到P2 "
);
ACAxisMove
(
Config
.
Warming_Axis
,
moveP
.
Warm_P2
,
Config
.
WarmingAxis_P2_Speed
);
}
}
else
if
(
MoveInfo
.
IsStep
(
StoreMoveStep
.
SI_10_TargetAxisToP2
))
{
if
(
MoveInfo
.
MoveParam
.
Position
.
PosType
.
Equals
(
1
))
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
SI_11_OpenColddoor
);
InStoreLog
(
"打开冷藏门,关闭仓门 "
);
CylinderMove
(
MoveInfo
,
IO_Type
.
Door_Up
,
IO_Type
.
Door_Down
);
CylinderMove
(
MoveInfo
,
IO_Type
.
ColdDoor_Close
,
IO_Type
.
ColdDoor_Open
);
}
else
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
SI_12_InoutToP3
);
InStoreLog
(
"进出轴到P3 "
);
ACAxisMove
(
Config
.
InOut_Axis
,
moveP
.
InOut_P3
,
Config
.
InOutAxis_P3_Speed
);
}
}
else
if
(
MoveInfo
.
IsStep
(
StoreMoveStep
.
SI_11_OpenColddoor
))
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
SI_12_InoutToP3
);
InStoreLog
(
"进出轴到P3 "
);
ACAxisMove
(
Config
.
InOut_Axis
,
moveP
.
InOut_P3
,
Config
.
InOutAxis_P3_Speed
);
}
else
if
(
MoveInfo
.
IsStep
(
StoreMoveStep
.
SI_12_InoutToP3
))
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
SI_13_UpdownToP4
);
InStoreLog
(
"升降轴到入料缓冲点P4 "
);
ACAxisMove
(
Config
.
UpDown_Axis
,
moveP
.
UpDown_P4
,
Config
.
UpDownAxis_P4_Speed
);
}
else
if
(
MoveInfo
.
IsStep
(
StoreMoveStep
.
SI_13_UpdownToP4
))
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
SI_14_Clamping_Relax
);
InStoreLog
(
" 夹爪放松"
);
CylinderMove
(
MoveInfo
,
IO_Type
.
Clamping_Tighten
,
IO_Type
.
Clamping_Relax
);
}
else
if
(
MoveInfo
.
IsStep
(
StoreMoveStep
.
SI_14_Clamping_Relax
))
{
// 5= 入仓位完成(料仓Box把料盘放入对应的库位中,装置还未恢复原始状态)
UpdateLastStatus
(
StoreStatus
.
InStoreEnd
);
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
SI_15_InOutToP1
);
InStoreLog
(
" 进出轴返回待机点P1"
);
InOutBackToP1
(
moveP
.
InOut_P1
);
}
else
if
(
MoveInfo
.
IsStep
(
StoreMoveStep
.
SI_15_InOutToP1
))
{
if
(
MoveInfo
.
MoveParam
.
Position
.
PosType
.
Equals
(
1
))
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
SI_16_CloseColddoor
);
InStoreLog
(
" 关闭冷藏区门"
);
CylinderMove
(
MoveInfo
,
IO_Type
.
ColdDoor_Open
,
IO_Type
.
ColdDoor_Close
);
}
else
{
SI_17_GoBack
();
}
}
else
if
(
MoveInfo
.
IsStep
(
StoreMoveStep
.
SI_16_CloseColddoor
))
{
SI_17_GoBack
();
}
else
if
(
MoveInfo
.
IsStep
(
StoreMoveStep
.
SI_17_GoBack
))
{
TimeSpan
span
=
moveWatch
.
Elapsed
;
moveWatch
.
Stop
();
LogUtil
.
info
(
Name
+
" 【"
+
MoveInfo
.
MoveParam
.
LogName
+
"】 结束,开始旋转,耗时【"
+
FormUtil
.
GetSpanStr
(
span
)
+
"】!"
);
MoveInfo
.
EndMove
();
runStatus
=
StoreRunStatus
.
Runing
;
//设备连接,入库后,BOX恢复原始状态
storeStatus
=
StoreStatus
.
StoreOnline
;
InOutEndProcess
(
MoveType
.
InStore
);
}
else
{
LogUtil
.
info
(
Name
+
" 入库,moveStatus="
+
MoveInfo
.
MoveStep
+
",没有对应的处理!"
);
}
//
StoreMoveP moveP = MoveInfo.MoveParam.MoveP;
//
if (MoveInfo.IsInWait)
//
{
//
CheckWait();
//
}
//
if (MoveInfo.IsInWait)
//
{
//
return;
//
}
//
if (MoveInfo.IsStep(StoreMoveStep.SI_01_TrayCheck))
//
{
//
SI_02_InOutToP1(moveP);
//
}
//
else if (MoveInfo.IsStep(StoreMoveStep.SI_02_InOutToP1))
//
{
//
MoveInfo.NextMoveStep(StoreMoveStep.SI_03_Clamping_Relax);
//
InStoreLog(" 夹爪放松");
//
CylinderMove(MoveInfo, IO_Type.Clamping_Tighten, IO_Type.Clamping_Relax);
//
}
//
else if (MoveInfo.IsStep(StoreMoveStep.SI_03_Clamping_Relax))
//
{
//
MoveInfo.NextMoveStep(StoreMoveStep.SI_04_AxisToP1);
//
InStoreLog(" 轴2、轴1 动作到P1 ");
//
ACAxisMove(Config.UpDown_Axis, moveP.UpDown_P1, Config.UpDownAxis_P1_Speed);
//
ACAxisMove(Config.Middle_Axis, moveP.Middle_P1, Config.MiddleAxis_P1_Speed);
//
}
//
else if (MoveInfo.IsStep(StoreMoveStep.SI_04_AxisToP1))
//
{
//
SI_05_InoutToP2();
//
}
//
else if (MoveInfo.IsStep(StoreMoveStep.SI_05_InoutToP2))
//
{
//
NeedCheckSafetyLight = 0;
//
MoveInfo.NextMoveStep(StoreMoveStep.SI_06_Clamping_Work);
//
InStoreLog("夹爪夹紧 ");
//
CylinderMove(MoveInfo, IO_Type.Clamping_Relax, IO_Type.Clamping_Tighten);
//
}
//
else if (MoveInfo.IsStep(StoreMoveStep.SI_06_Clamping_Work))
//
{
//
MoveInfo.NextMoveStep(StoreMoveStep.SI_07_UpdownToP7);
//
InStoreLog("升降轴到P7 ");
//
ACAxisMove(Config.UpDown_Axis, moveP.UpDown_P7, Config.UpDownAxis_P7_Speed);
//
}
//
else if (MoveInfo.IsStep(StoreMoveStep.SI_07_UpdownToP7))
//
{
//
MoveInfo.NextMoveStep(StoreMoveStep.SI_08_InOutToP1);
//
InOutBackToP1(moveP.InOut_P1);
//
ConfigMoveAxis axis = GetPosTAxis();
//
InStoreLog("进出轴返回待机点P1, " + axis.ProName + "停止匀速运动 ");
//
AxisSuddenStop(axis);
//
}
//
else if (MoveInfo.IsStep(StoreMoveStep.SI_08_InOutToP1))
//
{
//
ConfigMoveAxis axis = GetPosTAxis();
//
MoveInfo.NextMoveStep(StoreMoveStep.SI_09_MoveToBag);
//
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000));
//
InStoreLog("移动到库位点,旋转轴 至P2( 库位点)升降轴至P3(库位入库前点)关闭仓门 " + axis.ProName + "开始原点返回");
//
ACAxisMove(Config.Middle_Axis, moveP.Middle_P2, Config.MiddleAxis_P2_Speed);
//
ACAxisMove(Config.UpDown_Axis, moveP.UpDown_P3, Config.UpDownAxis_P3_Speed);
//
CylinderMove(null, IO_Type.Door_Up, IO_Type.Door_Down);
//
ACAxisHomeMove(axis);
//
}
//
else if (MoveInfo.IsStep(StoreMoveStep.SI_09_MoveToBag))
//
{
//
MoveInfo.NextMoveStep(StoreMoveStep.SI_10_TargetAxisToP2);
//
if (MoveInfo.MoveParam.Position.PosType.Equals(1))
//
{
//
InStoreLog("冷藏旋转轴到P2 ");
//
ACAxisMove(Config.Colding_Axis, moveP.Cold_P2, Config.ColdingAxis_P2_Speed);
//
}
//
else
//
{
//
InStoreLog("回温旋转轴到P2 ");
//
ACAxisMove(Config.Warming_Axis, moveP.Warm_P2, Config.WarmingAxis_P2_Speed);
//
}
//
}
//
else if (MoveInfo.IsStep(StoreMoveStep.SI_10_TargetAxisToP2))
//
{
//
if (MoveInfo.MoveParam.Position.PosType.Equals(1))
//
{
//
MoveInfo.NextMoveStep(StoreMoveStep.SI_11_OpenColddoor);
//
InStoreLog("打开冷藏门,关闭仓门 ");
//
CylinderMove(MoveInfo, IO_Type.Door_Up, IO_Type.Door_Down);
//
CylinderMove(MoveInfo, IO_Type.ColdDoor_Close, IO_Type.ColdDoor_Open);
//
}
//
else
//
{
//
MoveInfo.NextMoveStep(StoreMoveStep.SI_12_InoutToP3);
//
InStoreLog("进出轴到P3 ");
//
ACAxisMove(Config.InOut_Axis, moveP.InOut_P3, Config.InOutAxis_P3_Speed);
//
}
//
}
//
else if (MoveInfo.IsStep(StoreMoveStep.SI_11_OpenColddoor))
//
{
//
MoveInfo.NextMoveStep(StoreMoveStep.SI_12_InoutToP3);
//
InStoreLog("进出轴到P3 ");
//
ACAxisMove(Config.InOut_Axis, moveP.InOut_P3, Config.InOutAxis_P3_Speed);
//
}
//
else if (MoveInfo.IsStep(StoreMoveStep.SI_12_InoutToP3))
//
{
//
MoveInfo.NextMoveStep(StoreMoveStep.SI_13_UpdownToP4);
//
InStoreLog("升降轴到入料缓冲点P4 ");
//
ACAxisMove(Config.UpDown_Axis, moveP.UpDown_P4, Config.UpDownAxis_P4_Speed);
//
}
//
else if (MoveInfo.IsStep(StoreMoveStep.SI_13_UpdownToP4))
//
{
//
MoveInfo.NextMoveStep(StoreMoveStep.SI_14_Clamping_Relax);
//
InStoreLog(" 夹爪放松");
//
CylinderMove(MoveInfo, IO_Type.Clamping_Tighten, IO_Type.Clamping_Relax);
//
}
//
else if (MoveInfo.IsStep(StoreMoveStep.SI_14_Clamping_Relax))
//
{
//
// 5= 入仓位完成(料仓Box把料盘放入对应的库位中,装置还未恢复原始状态)
//
UpdateLastStatus(StoreStatus.InStoreEnd);
//
MoveInfo.NextMoveStep(StoreMoveStep.SI_15_InOutToP1);
//
InStoreLog(" 进出轴返回待机点P1");
//
InOutBackToP1(moveP.InOut_P1);
//
}
//
else if (MoveInfo.IsStep(StoreMoveStep.SI_15_InOutToP1))
//
{
//
if (MoveInfo.MoveParam.Position.PosType.Equals(1))
//
{
//
MoveInfo.NextMoveStep(StoreMoveStep.SI_16_CloseColddoor);
//
InStoreLog(" 关闭冷藏区门");
//
CylinderMove(MoveInfo, IO_Type.ColdDoor_Open, IO_Type.ColdDoor_Close);
//
}
//
else
//
{
//
SI_17_GoBack();
//
}
//
}
//
else if (MoveInfo.IsStep(StoreMoveStep.SI_16_CloseColddoor))
//
{
//
SI_17_GoBack();
//
}
//
else if (MoveInfo.IsStep(StoreMoveStep.SI_17_GoBack))
//
{
//
TimeSpan span = moveWatch.Elapsed;
//
moveWatch.Stop();
//
LogUtil.info(Name + " 【" + MoveInfo.MoveParam.LogName + "】 结束,开始旋转,耗时【" + FormUtil.GetSpanStr(span) + "】!");
//
MoveInfo.EndMove();
//
runStatus = StoreRunStatus.Runing;
//
//设备连接,入库后,BOX恢复原始状态
//
storeStatus = StoreStatus.StoreOnline;
//
InOutEndProcess(MoveType.InStore);
//
}
//
else
//
{
//
LogUtil.info(Name + " 入库,moveStatus=" + MoveInfo.MoveStep + ",没有对应的处理!");
//
}
}
private
void
SI_02_InOutToP1
(
StoreMoveP
moveP
)
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
SI_02_InOutToP1
);
InStoreLog
(
" 进出轴到P1,打开舱门"
);
CylinderMove
(
MoveInfo
,
IO_Type
.
Door_Down
,
IO_Type
.
Door_Up
);
InOutBackToP1
(
moveP
.
InOut_P1
);
//
MoveInfo.NextMoveStep(StoreMoveStep.SI_02_InOutToP1);
//
InStoreLog(" 进出轴到P1,打开舱门");
//
CylinderMove(MoveInfo, IO_Type.Door_Down, IO_Type.Door_Up);
//
InOutBackToP1(moveP.InOut_P1);
}
private
void
SI_05_InoutToP2
()
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
SI_05_InoutToP2
);
InStoreLog
(
"进出轴到P2"
);
ACAxisMove
(
Config
.
InOut_Axis
,
MoveInfo
.
MoveParam
.
MoveP
.
InOut_P2
,
Config
.
InOutAxis_P2_Speed
);
NeedCheckSafetyLight
=
1
;
}
private
ConfigMoveAxis
GetPosTAxis
()
{
if
(
MoveInfo
.
MoveParam
.
Position
.
PosType
.
Equals
(
1
))
{
return
Config
.
Colding_Axis
;
}
else
{
return
Config
.
Warming_Axis
;
}
//MoveInfo.NextMoveStep(StoreMoveStep.SI_05_InoutToP2);
//InStoreLog("进出轴到P2");
//ACAxisMove(Config.InOut_Axis, MoveInfo.MoveParam.MoveP.InOut_P2, Config.InOutAxis_P2_Speed);
//NeedCheckSafetyLight = 1;
}
private
void
SI_17_GoBack
()
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
SI_17_GoBack
);
ConfigMoveAxis
axis
=
GetPosTAxis
();
InStoreLog
(
" 升降轴,旋转轴返回P1,"
+
axis
.
ProName
+
"开始匀速运转"
);
ACAxisMove
(
Config
.
Middle_Axis
,
MoveInfo
.
MoveParam
.
MoveP
.
Middle_P1
,
Config
.
MiddleAxis_P1_Speed
);
ACAxisMove
(
Config
.
UpDown_Axis
,
MoveInfo
.
MoveParam
.
MoveP
.
UpDown_P1
,
Config
.
UpDownAxis_P1_Speed
);
StartWork
(
MoveInfo
.
MoveParam
.
Position
.
PosType
);
//
MoveInfo.NextMoveStep(StoreMoveStep.SI_17_GoBack);
//
ConfigMoveAxis axis = GetPosTAxis();
//
InStoreLog(" 升降轴,旋转轴返回P1," + axis.ProName + "开始匀速运转");
//
ACAxisMove(Config.Middle_Axis, MoveInfo.MoveParam.MoveP.Middle_P1, Config.MiddleAxis_P1_Speed);
//
ACAxisMove(Config.UpDown_Axis, MoveInfo.MoveParam.MoveP.UpDown_P1, Config.UpDownAxis_P1_Speed);
//
StartWork(MoveInfo.MoveParam.Position.PosType);
}
private
void
InOutBackToP1
(
int
InOut_P1
)
{
//判断是否在P1,如果是,不需要运行
int
outCount
=
ACServerManager
.
GetActualtPosition
(
Config
.
InOut_Axis
.
DeviceName
,
Config
.
InOut_Axis
.
GetAxisValue
());
int
errorCount
=
Math
.
Abs
(
outCount
-
InOut_P1
);
if
(
errorCount
<=
Config
.
InOut_Axis
.
CanErrorCountMin
)
{
LogUtil
.
info
(
"进出轴当前位置:"
+
outCount
+
",已经在P1,不需要再回P1"
);
}
else
{
ACAxisMove
(
Config
.
InOut_Axis
,
InOut_P1
,
Config
.
InOutAxis_P1_Speed
);
}
//
//
判断是否在P1,如果是,不需要运行
//
int outCount = ACServerManager.GetActualtPosition(Config.InOut_Axis.DeviceName, Config.InOut_Axis.GetAxisValue());
//
int errorCount = Math.Abs(outCount - InOut_P1);
//
if (errorCount <= Config.InOut_Axis.CanErrorCountMin)
//
{
//
LogUtil.info("进出轴当前位置:" + outCount + ",已经在P1,不需要再回P1");
//
}
//
else
//
{
//
ACAxisMove(Config.InOut_Axis, InOut_P1, Config.InOutAxis_P1_Speed);
//
}
//StoreMove.WaitList.Add(WaitResultInfo.WaitAxisOrg(Config.InOut_Axis,IO_VALUE.HIGH));
}
#
endregion
...
...
@@ -384,38 +370,38 @@ namespace OnlineStore.DeviceLibrary
public
override
bool
StartOutStore
(
InOutParam
param
)
{
param
.
paramType
=
MoveType
.
OutStore
;
if
(
runStatus
.
Equals
(
StoreRunStatus
.
Runing
)
&&
MoveInfo
.
MoveType
.
Equals
(
MoveType
.
None
))
{
if
(!
param
.
LoadParam
(
Config
))
{
LogUtil
.
error
(
Name
+
" 启动 "
+
param
.
LogName
+
"失败,找不到库位"
);
//param.paramType = MoveType.OutStore;
//if (runStatus.Equals(StoreRunStatus.Runing) && MoveInfo.MoveType.Equals(MoveType.None))
//{
// if (!param.LoadParam(Config))
// {
// LogUtil.error(Name + " 启动 " + param.LogName + "失败,找不到库位");
// return false;
// }
// if (IOManager.IOValue(IO_Type.TinCheck_Fixture).Equals(IO_VALUE.HIGH))
// {
// LogUtil.error(Name + " 启动 " + param.LogName + "失败,叉子料盘检测有料");
// return false;
// }
// moveWatch.Restart();
// LogUtil.info(Name + "启动 " + param.LogName + " ");
// runStatus = StoreRunStatus.Busy;
// storeStatus = StoreStatus.OutStoreExecute;
// MoveInfo.NewMove(MoveType.OutStore, param);
// MoveInfo.NextMoveStep(StoreMoveStep.SO_01_InoutToP1);
// ConfigMoveAxis axis = GetPosTAxis();
// OutStoreLog(" 叉子先运动到P1 ," + axis.ProName + "停止匀速运动");
// InOutBackToP1(MoveInfo.MoveParam.MoveP.InOut_P1);
// AxisSuddenStop(axis);
// return true;
//}
//else
//{
// LogUtil.error(Name + " 启动 " + param.LogName + "出错,当前状态:[" + runStatus + "],[" + MoveInfo.MoveType + "]");
return
false
;
}
if
(
IOManager
.
IOValue
(
IO_Type
.
TinCheck_Fixture
).
Equals
(
IO_VALUE
.
HIGH
))
{
LogUtil
.
error
(
Name
+
" 启动 "
+
param
.
LogName
+
"失败,叉子料盘检测有料"
);
return
false
;
}
moveWatch
.
Restart
();
LogUtil
.
info
(
Name
+
"启动 "
+
param
.
LogName
+
" "
);
runStatus
=
StoreRunStatus
.
Busy
;
storeStatus
=
StoreStatus
.
OutStoreExecute
;
MoveInfo
.
NewMove
(
MoveType
.
OutStore
,
param
);
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
SO_01_InoutToP1
);
ConfigMoveAxis
axis
=
GetPosTAxis
();
OutStoreLog
(
" 叉子先运动到P1 ,"
+
axis
.
ProName
+
"停止匀速运动"
);
InOutBackToP1
(
MoveInfo
.
MoveParam
.
MoveP
.
InOut_P1
);
AxisSuddenStop
(
axis
);
return
true
;
}
else
{
LogUtil
.
error
(
Name
+
" 启动 "
+
param
.
LogName
+
"出错,当前状态:["
+
runStatus
+
"],["
+
MoveInfo
.
MoveType
+
"]"
);
return
false
;
}
//}
}
protected
override
void
OutStoreProcess
()
...
...
@@ -429,189 +415,189 @@ namespace OnlineStore.DeviceLibrary
{
return
;
}
if
(
MoveInfo
.
MoveStep
.
Equals
(
StoreMoveStep
.
SO_01_InoutToP1
))
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
SO_02_AxisHome
);
ConfigMoveAxis
axis
=
GetPosTAxis
();
OutStoreLog
(
" "
+
axis
.
ProName
+
"开始原点返回"
);
MoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitTime
(
1000
));
ACAxisHomeMove
(
axis
);
}
else
if
(
MoveInfo
.
IsStep
(
StoreMoveStep
.
SO_02_AxisHome
))
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
SO_03_ToBag
);
MoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitTime
(
1000
));
ConfigMoveAxis
axis
=
GetPosTAxis
();
OutStoreLog
(
" 旋转轴至P2(库位点),升降轴至P5(库位出库前点),"
+
axis
.
ProName
+
"到P2"
);
ACAxisMove
(
Config
.
Middle_Axis
,
MoveInfo
.
MoveParam
.
MoveP
.
Middle_P2
,
Config
.
MiddleAxis_P2_Speed
);
ACAxisMove
(
Config
.
UpDown_Axis
,
MoveInfo
.
MoveParam
.
MoveP
.
UpDown_P5
,
Config
.
UpDownAxis_P5_Speed
);
if
(
MoveInfo
.
MoveParam
.
Position
.
PosType
.
Equals
(
1
))
{
ACAxisMove
(
Config
.
Colding_Axis
,
moveP
.
Cold_P2
,
Config
.
ColdingAxis_P2_Speed
);
}
else
{
ACAxisMove
(
Config
.
Warming_Axis
,
moveP
.
Warm_P2
,
Config
.
WarmingAxis_P2_Speed
);
}
}
else
if
(
MoveInfo
.
IsStep
(
StoreMoveStep
.
SO_03_ToBag
))
{
if
(
MoveInfo
.
MoveParam
.
Position
.
PosType
.
Equals
(
1
))
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
SO_04_OpenCold
);
OutStoreLog
(
"打开冷藏区门 "
);
CylinderMove
(
MoveInfo
,
IO_Type
.
ColdDoor_Close
,
IO_Type
.
ColdDoor_Open
);
}
else
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
SO_05_InoutToP3
);
OutStoreLog
(
" 进出轴至P3(库位取放料点) "
);
ACAxisMove
(
Config
.
InOut_Axis
,
moveP
.
InOut_P3
,
Config
.
InOutAxis_P3_Speed
);
}
}
else
if
(
MoveInfo
.
IsStep
(
StoreMoveStep
.
SO_04_OpenCold
))
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
SO_05_InoutToP3
);
OutStoreLog
(
" 进出轴至P3(库位取放料点) "
);
ACAxisMove
(
Config
.
InOut_Axis
,
moveP
.
InOut_P3
,
Config
.
InOutAxis_P3_Speed
);
}
else
if
(
MoveInfo
.
IsStep
(
StoreMoveStep
.
SO_05_InoutToP3
))
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
SO_06_Clamping_Work
);
OutStoreLog
(
"夹爪夹紧 "
);
CylinderMove
(
MoveInfo
,
IO_Type
.
Clamping_Relax
,
IO_Type
.
Clamping_Tighten
);
}
else
if
(
MoveInfo
.
IsStep
(
StoreMoveStep
.
SO_06_Clamping_Work
))
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
SO_07_UpdownToP6
);
OutStoreLog
(
" 升降轴至P6(库位出料缓冲点) "
);
ACAxisMove
(
Config
.
UpDown_Axis
,
moveP
.
UpDown_P6
,
Config
.
UpDownAxis_P6_Speed
);
}
else
if
(
MoveInfo
.
IsStep
(
StoreMoveStep
.
SO_07_UpdownToP6
))
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
SO_08_InoutToP1
);
OutStoreLog
(
" 进出轴至P1(待机点) "
);
InOutBackToP1
(
moveP
.
InOut_P1
);
//把库位的物品放到取到叉子上之后是出仓完成
UpdateLastStatus
(
StoreStatus
.
OutStoreBoxEnd
);
}
else
if
(
MoveInfo
.
IsStep
(
StoreMoveStep
.
SO_08_InoutToP1
))
{
if
(
IOManager
.
IOValue
(
IO_Type
.
TinCheck_Fixture
).
Equals
(
IO_VALUE
.
LOW
))
{
CodeMsg
=
MoveInfo
.
MoveParam
.
LogName
+
" 叉子从库位退出后,未检测到料盘有料"
;
LogUtil
.
error
(
CodeMsg
);
}
if
(
MoveInfo
.
MoveParam
.
Position
.
PosType
.
Equals
(
1
))
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
SO_09_CloseCold
);
OutStoreLog
(
"关闭冷藏区门 "
);
CylinderMove
(
MoveInfo
,
IO_Type
.
ColdDoor_Open
,
IO_Type
.
ColdDoor_Close
);
}
else
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
SO_10_ToDoorPosition
);
MoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitTime
(
1000
));
OutStoreLog
(
"旋转轴至P1(待机点)升降轴至P2(进料口出料前点),"
);
ACAxisMove
(
Config
.
UpDown_Axis
,
moveP
.
UpDown_P2
,
Config
.
UpDownAxis_P2_Speed
);
ACAxisMove
(
Config
.
Middle_Axis
,
moveP
.
Middle_P1
,
Config
.
MiddleAxis_P1_Speed
);
}
}
else
if
(
MoveInfo
.
IsStep
(
StoreMoveStep
.
SO_09_CloseCold
))
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
SO_10_ToDoorPosition
);
MoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitTime
(
1000
));
OutStoreLog
(
"旋转轴至P1(待机点)升降轴至P2(进料口出料前点),"
);
ACAxisMove
(
Config
.
UpDown_Axis
,
moveP
.
UpDown_P2
,
Config
.
UpDownAxis_P2_Speed
);
ACAxisMove
(
Config
.
Middle_Axis
,
moveP
.
Middle_P1
,
Config
.
MiddleAxis_P1_Speed
);
}
else
if
(
MoveInfo
.
IsStep
(
StoreMoveStep
.
SO_10_ToDoorPosition
))
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
SO_11_OpenDoor
);
ConfigMoveAxis
axis
=
GetPosTAxis
();
OutStoreLog
(
"打开仓门 ,"
+
axis
.
ProName
+
"开始匀速运转"
);
CylinderMove
(
MoveInfo
,
IO_Type
.
Door_Down
,
IO_Type
.
Door_Up
);
StartWork
(
MoveInfo
.
MoveParam
.
Position
.
PosType
);
}
else
if
(
MoveInfo
.
IsStep
(
StoreMoveStep
.
SO_11_OpenDoor
))
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
SO_12_WaitNoTray
);
OutStoreLog
(
"等待仓门口无料盘 "
);
MoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitIO
(
MoveInfo
.
MoveParam
.
GetDoorTinCheck
(),
IO_VALUE
.
LOW
));
}
else
if
(
MoveInfo
.
IsStep
(
StoreMoveStep
.
SO_12_WaitNoTray
))
{
SO_13_InoutToP2
();
}
else
if
(
MoveInfo
.
IsStep
(
StoreMoveStep
.
SO_13_InoutToP2
))
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
SO_14_UpdownToP8
);
OutStoreLog
(
"进出轴到出料缓冲点P8 "
);
ACAxisMove
(
Config
.
UpDown_Axis
,
moveP
.
UpDown_P8
,
Config
.
UpDownAxis_P8_Speed
);
}
//此处需要等待移栽没有工作,才能把盘放入出料口
else
if
(
MoveInfo
.
IsStep
(
StoreMoveStep
.
SO_14_UpdownToP8
))
{
NeedCheckSafetyLight
=
0
;
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
SO_15_Clamping_Relax
);
OutStoreLog
(
"夹爪放松 "
);
CylinderMove
(
MoveInfo
,
IO_Type
.
Clamping_Tighten
,
IO_Type
.
Clamping_Relax
);
}
else
if
(
MoveInfo
.
IsStep
(
StoreMoveStep
.
SO_15_Clamping_Relax
))
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
SO_16_InoutToP1
);
OutStoreLog
(
"进出轴动作至P1(待机点) "
);
InOutBackToP1
(
moveP
.
InOut_P1
);
}
else
if
(
MoveInfo
.
IsStep
(
StoreMoveStep
.
SO_16_InoutToP1
))
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
SO_17_CloseDoor
);
OutStoreLog
(
"关闭仓门 "
);
CylinderMove
(
MoveInfo
,
IO_Type
.
Door_Up
,
IO_Type
.
Door_Down
);
}
else
if
(
MoveInfo
.
IsStep
(
StoreMoveStep
.
SO_17_CloseDoor
))
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
SO_18_WaitTake
);
int
OutStoreWaitSeconds
=
ConfigAppSettings
.
GetIntValue
(
Setting_Init
.
OutStoreWaitSeconds
);
if
(
OutStoreWaitSeconds
<=
0
)
{
OutStoreWaitSeconds
=
600
;
}
int
ms
=
OutStoreWaitSeconds
*
1000
;
OutStoreLog
(
" 等待拿走物品,最多等待"
+
OutStoreWaitSeconds
+
"秒"
);
MoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitTime
(
ms
));
MoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitIO
(
MoveInfo
.
MoveParam
.
GetDoorTinCheck
(),
IO_VALUE
.
LOW
));
MoveInfo
.
OneWaitCanEndStep
=
true
;
}
else
if
(
MoveInfo
.
IsStep
(
StoreMoveStep
.
SO_18_WaitTake
))
{
TimeSpan
span
=
moveWatch
.
Elapsed
;
moveWatch
.
Stop
();
storeStatus
=
StoreStatus
.
StoreOnline
;
LogUtil
.
info
(
Name
+
" 【"
+
MoveInfo
.
MoveParam
.
LogName
+
"】 结束,耗时【"
+
FormUtil
.
GetSpanStr
(
span
)
+
"】!"
);
MoveInfo
.
EndMove
();
runStatus
=
StoreRunStatus
.
Runing
;
InOutEndProcess
(
MoveType
.
OutStore
);
}
else
{
LogUtil
.
error
(
Name
+
" 出库处理,moveStatus="
+
MoveInfo
.
MoveStep
+
",没有对应的处理!"
);
}
//
if (MoveInfo.MoveStep .Equals( StoreMoveStep.SO_01_InoutToP1))
//
{
//
MoveInfo.NextMoveStep(StoreMoveStep.SO_02_AxisHome);
//
ConfigMoveAxis axis = GetPosTAxis();
//
OutStoreLog(" " + axis.ProName + "开始原点返回");
//
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000));
//
ACAxisHomeMove(axis);
//
}
//
else if (MoveInfo.IsStep(StoreMoveStep.SO_02_AxisHome))
//
{
//
MoveInfo.NextMoveStep(StoreMoveStep.SO_03_ToBag);
//
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000));
//
ConfigMoveAxis axis = GetPosTAxis();
//
OutStoreLog(" 旋转轴至P2(库位点),升降轴至P5(库位出库前点)," + axis.ProName + "到P2");
//
ACAxisMove(Config.Middle_Axis, MoveInfo.MoveParam.MoveP.Middle_P2, Config.MiddleAxis_P2_Speed);
//
ACAxisMove(Config.UpDown_Axis, MoveInfo.MoveParam.MoveP.UpDown_P5, Config.UpDownAxis_P5_Speed);
//
if (MoveInfo.MoveParam.Position.PosType.Equals(1))
//
{
//
ACAxisMove(Config.Colding_Axis, moveP.Cold_P2, Config.ColdingAxis_P2_Speed);
//
}
//
else
//
{
//
ACAxisMove(Config.Warming_Axis, moveP.Warm_P2, Config.WarmingAxis_P2_Speed);
//
}
//
}
//
else if (MoveInfo.IsStep(StoreMoveStep.SO_03_ToBag))
//
{
//
if (MoveInfo.MoveParam.Position.PosType.Equals(1))
//
{
//
MoveInfo.NextMoveStep(StoreMoveStep.SO_04_OpenCold);
//
OutStoreLog("打开冷藏区门 ");
//
CylinderMove(MoveInfo, IO_Type.ColdDoor_Close, IO_Type.ColdDoor_Open);
//
}
//
else
//
{
//
MoveInfo.NextMoveStep(StoreMoveStep.SO_05_InoutToP3);
//
OutStoreLog(" 进出轴至P3(库位取放料点) ");
//
ACAxisMove(Config.InOut_Axis, moveP.InOut_P3, Config.InOutAxis_P3_Speed);
//
}
//
}
//
else if (MoveInfo.IsStep(StoreMoveStep.SO_04_OpenCold))
//
{
//
MoveInfo.NextMoveStep(StoreMoveStep.SO_05_InoutToP3);
//
OutStoreLog(" 进出轴至P3(库位取放料点) ");
//
ACAxisMove(Config.InOut_Axis, moveP.InOut_P3, Config.InOutAxis_P3_Speed);
//
}
//
else if (MoveInfo.IsStep(StoreMoveStep.SO_05_InoutToP3))
//
{
//
MoveInfo.NextMoveStep(StoreMoveStep.SO_06_Clamping_Work);
//
OutStoreLog("夹爪夹紧 ");
//
CylinderMove(MoveInfo, IO_Type.Clamping_Relax, IO_Type.Clamping_Tighten);
//
}
//
else if (MoveInfo.IsStep(StoreMoveStep.SO_06_Clamping_Work))
//
{
//
MoveInfo.NextMoveStep(StoreMoveStep.SO_07_UpdownToP6);
//
OutStoreLog(" 升降轴至P6(库位出料缓冲点) ");
//
ACAxisMove(Config.UpDown_Axis, moveP.UpDown_P6, Config.UpDownAxis_P6_Speed);
//
}
//
else if (MoveInfo.IsStep(StoreMoveStep.SO_07_UpdownToP6))
//
{
//
MoveInfo.NextMoveStep(StoreMoveStep.SO_08_InoutToP1);
//
OutStoreLog(" 进出轴至P1(待机点) ");
//
InOutBackToP1(moveP.InOut_P1);
//
//把库位的物品放到取到叉子上之后是出仓完成
//
UpdateLastStatus(StoreStatus.OutStoreBoxEnd);
//
}
//
else if (MoveInfo.IsStep(StoreMoveStep.SO_08_InoutToP1))
//
{
//
if (IOManager.IOValue(IO_Type.TinCheck_Fixture).Equals(IO_VALUE.LOW))
//
{
//
CodeMsg = MoveInfo.MoveParam.LogName + " 叉子从库位退出后,未检测到料盘有料";
//
LogUtil.error(CodeMsg);
//
}
//
if (MoveInfo.MoveParam.Position.PosType.Equals(1))
//
{
//
MoveInfo.NextMoveStep(StoreMoveStep.SO_09_CloseCold);
//
OutStoreLog("关闭冷藏区门 ");
//
CylinderMove(MoveInfo, IO_Type.ColdDoor_Open, IO_Type.ColdDoor_Close);
//
}
//
else
//
{
//
MoveInfo.NextMoveStep(StoreMoveStep.SO_10_ToDoorPosition);
//
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000));
//
OutStoreLog("旋转轴至P1(待机点)升降轴至P2(进料口出料前点),");
//
ACAxisMove(Config.UpDown_Axis, moveP.UpDown_P2, Config.UpDownAxis_P2_Speed);
//
ACAxisMove(Config.Middle_Axis, moveP.Middle_P1, Config.MiddleAxis_P1_Speed);
//
}
//
}
//
else if (MoveInfo.IsStep(StoreMoveStep.SO_09_CloseCold))
//
{
//
MoveInfo.NextMoveStep(StoreMoveStep.SO_10_ToDoorPosition);
//
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000));
//
OutStoreLog("旋转轴至P1(待机点)升降轴至P2(进料口出料前点),");
//
ACAxisMove(Config.UpDown_Axis, moveP.UpDown_P2, Config.UpDownAxis_P2_Speed);
//
ACAxisMove(Config.Middle_Axis, moveP.Middle_P1, Config.MiddleAxis_P1_Speed);
//
}
//
else if (MoveInfo.IsStep(StoreMoveStep.SO_10_ToDoorPosition))
//
{
//
MoveInfo.NextMoveStep(StoreMoveStep.SO_11_OpenDoor);
//
ConfigMoveAxis axis = GetPosTAxis();
//
OutStoreLog("打开仓门 ," + axis.ProName + "开始匀速运转");
//
CylinderMove(MoveInfo, IO_Type.Door_Down, IO_Type.Door_Up);
//
StartWork(MoveInfo.MoveParam.Position.PosType);
//
}
//
else if (MoveInfo.IsStep(StoreMoveStep.SO_11_OpenDoor))
//
{
//
MoveInfo.NextMoveStep(StoreMoveStep.SO_12_WaitNoTray);
//
OutStoreLog("等待仓门口无料盘 ");
//
MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(MoveInfo.MoveParam.GetDoorTinCheck(), IO_VALUE.LOW));
//
}
//
else if (MoveInfo.IsStep(StoreMoveStep.SO_12_WaitNoTray))
//
{
//
SO_13_InoutToP2();
//
}
//
else if (MoveInfo.IsStep(StoreMoveStep.SO_13_InoutToP2))
//
{
//
MoveInfo.NextMoveStep(StoreMoveStep.SO_14_UpdownToP8);
//
OutStoreLog("进出轴到出料缓冲点P8 ");
//
ACAxisMove(Config.UpDown_Axis, moveP.UpDown_P8, Config.UpDownAxis_P8_Speed);
//
}
//
//
此处需要等待移栽没有工作,才能把盘放入出料口
//
else if (MoveInfo.IsStep(StoreMoveStep.SO_14_UpdownToP8))
//
{
//
NeedCheckSafetyLight = 0;
//
MoveInfo.NextMoveStep(StoreMoveStep.SO_15_Clamping_Relax);
//
OutStoreLog("夹爪放松 ");
//
CylinderMove(MoveInfo, IO_Type.Clamping_Tighten, IO_Type.Clamping_Relax);
//
}
//
else if (MoveInfo.IsStep(StoreMoveStep.SO_15_Clamping_Relax))
//
{
//
MoveInfo.NextMoveStep(StoreMoveStep.SO_16_InoutToP1);
//
OutStoreLog("进出轴动作至P1(待机点) ");
//
InOutBackToP1(moveP.InOut_P1);
//
}
//
else if (MoveInfo.IsStep(StoreMoveStep.SO_16_InoutToP1))
//
{
//
MoveInfo.NextMoveStep(StoreMoveStep.SO_17_CloseDoor);
//
OutStoreLog("关闭仓门 ");
//
CylinderMove(MoveInfo, IO_Type.Door_Up, IO_Type.Door_Down);
//
}
//
else if (MoveInfo.IsStep(StoreMoveStep.SO_17_CloseDoor))
//
{
//
MoveInfo.NextMoveStep(StoreMoveStep.SO_18_WaitTake);
//
int OutStoreWaitSeconds = ConfigAppSettings.GetIntValue(Setting_Init.OutStoreWaitSeconds);
//
if (OutStoreWaitSeconds <= 0)
//
{
//
OutStoreWaitSeconds = 600;
//
}
//
int ms = OutStoreWaitSeconds * 1000;
//
OutStoreLog(" 等待拿走物品,最多等待" + OutStoreWaitSeconds + "秒");
//
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(ms));
//
MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(MoveInfo.MoveParam.GetDoorTinCheck(), IO_VALUE.LOW));
//
MoveInfo.OneWaitCanEndStep = true;
//
}
//
else if (MoveInfo.IsStep(StoreMoveStep.SO_18_WaitTake))
//
{
//
TimeSpan span = moveWatch.Elapsed;
//
moveWatch.Stop();
//
storeStatus = StoreStatus.StoreOnline;
//
LogUtil.info(Name + " 【" + MoveInfo.MoveParam.LogName + "】 结束,耗时【" + FormUtil.GetSpanStr(span) + "】!");
//
MoveInfo.EndMove();
//
runStatus = StoreRunStatus.Runing;
//
InOutEndProcess(MoveType.OutStore);
//
}
//
else
//
{
//
LogUtil.error(Name + " 出库处理,moveStatus=" + MoveInfo.MoveStep + ",没有对应的处理!");
//
}
}
private
void
SO_13_InoutToP2
()
{
StoreMoveP
moveP
=
MoveInfo
.
MoveParam
.
MoveP
;
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
SO_13_InoutToP2
);
OutStoreLog
(
" 进出轴至P2(进料口取料点) "
);
ACAxisMove
(
Config
.
InOut_Axis
,
moveP
.
InOut_P2
,
Config
.
InOutAxis_P2_Speed
);
NeedCheckSafetyLight
=
1
;
//
StoreMoveP moveP = MoveInfo.MoveParam.MoveP;
//
MoveInfo.NextMoveStep(StoreMoveStep.SO_13_InoutToP2);
//
OutStoreLog(" 进出轴至P2(进料口取料点) ");
//
ACAxisMove(Config.InOut_Axis, moveP.InOut_P2, Config.InOutAxis_P2_Speed);
//
NeedCheckSafetyLight = 1;
}
public
bool
InOutAxisCanMove
()
{
...
...
@@ -663,21 +649,11 @@ namespace OnlineStore.DeviceLibrary
autoPositionIndex
=
newIndex
;
string
posid
=
PositionNumList
[
autoPositionIndex
];
InOutParam
newParam
=
new
InOutParam
(
MoveType
.
OutStore
,
posid
);
//判断是否需要重置
if
(
CurrInOutACount
>=
Config
.
Box_ResetACount
)
{
LogUtil
.
info
(
Name
+
"自动进入下一个出库:posid="
+
posid
+
",当时已经出入库"
+
CurrInOutACount
+
"次,需要重置BOX,先把出库信息存入排队列表中"
);
Reset
(
false
);
autoMsg
=
"自动出库:"
+
posid
;
AddWaitMoveParam
(
newParam
);
}
else
{
LogUtil
.
info
(
Name
+
"自动进入下一个出库:posid="
+
posid
);
autoMsg
=
"自动出库:"
+
posid
;
StartOutStore
(
newParam
);
}
}
}
else
if
(
storeMoveType
.
Equals
(
MoveType
.
OutStore
))
...
...
@@ -701,21 +677,11 @@ namespace OnlineStore.DeviceLibrary
{
string
posid
=
PositionNumList
[
newIndex
];
InOutParam
newParam
=
new
InOutParam
(
MoveType
.
InStore
,
posid
,
"AAAAA"
);
//判断是否需要重置
if
(
CurrInOutACount
>=
Config
.
Box_ResetACount
)
{
LogUtil
.
info
(
Name
+
"自动进入下一个入库:posid="
+
posid
+
",当时已经出入库"
+
CurrInOutACount
+
"次,需要重置BOX,先把入库信息存入排队列表中"
);
Reset
(
false
);
autoMsg
=
"自动入库:"
+
posid
;
AddWaitMoveParam
(
newParam
);
}
else
{
LogUtil
.
info
(
Name
+
"自动进入下一个入库:posid="
+
posid
);
autoMsg
=
"自动入库:"
+
posid
;
StartInStore
(
newParam
);
}
}
}
}
...
...
@@ -725,6 +691,11 @@ namespace OnlineStore.DeviceLibrary
}
}
private
void
AddWaitMoveParam
(
InOutParam
newParam
)
{
throw
new
NotImplementedException
();
}
private
void
InStoreLog
(
string
msg
)
{
string
LogName
=
MoveInfo
.
MoveParam
!=
null
?
MoveInfo
.
MoveParam
.
LogName
:
""
;
...
...
source/DeviceLibrary/acVerticalStore/VerticalStoreBean_Partial.cs
deleted
100644 → 0
查看文件 @
62061a7
using
OnlineStore.Common
;
using
OnlineStore.LoadCSVLibrary
;
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
using
System.Threading.Tasks
;
using
System.Collections.Concurrent
;
using
DeviceLib
;
namespace
OnlineStore.DeviceLibrary
{
partial
class
VerticalStoreBean
{
public
StirInfo
CurrStirInfo
=
null
;
public
ConcurrentQueue
<
InOutParam
>
WaitMoveParamList
=
new
ConcurrentQueue
<
InOutParam
>();
public
void
AddWaitMoveParam
(
InOutParam
code
)
{
WaitMoveParamList
.
Enqueue
(
code
);
}
#
region
回温移库
public
bool
StartMovement
(
InOutParam
param
)
{
if
(
runStatus
==
StoreRunStatus
.
Runing
&&
MoveInfo
.
MoveType
.
Equals
(
MoveType
.
None
))
{
if
(!
param
.
LoadParam
(
Config
))
{
LogUtil
.
error
(
Name
+
" 启动 "
+
param
.
LogName
+
"失败,找不到库位 "
+
param
.
PosId
+
""
);
return
false
;
}
if
(
IOManager
.
IOValue
(
IO_Type
.
TinCheck_Fixture
).
Equals
(
IO_VALUE
.
HIGH
))
{
LogUtil
.
error
(
Name
+
" 启动 "
+
param
.
LogName
+
"失败,叉子料盘检测有料"
);
return
false
;
}
if
(
param
.
TarPosition
==
null
)
{
LogUtil
.
error
(
Name
+
" 启动 "
+
param
.
LogName
+
"失败,未找到目标位置"
+
param
.
TarPosId
+
""
);
return
false
;
}
if
(
param
.
Position
.
PosType
.
Equals
(
1
)
&&
param
.
Position
.
PosType
.
Equals
(
2
))
{
moveWatch
.
Restart
();
LogUtil
.
info
(
Name
+
"启动 "
+
param
.
LogName
+
" "
);
runStatus
=
StoreRunStatus
.
Busy
;
storeStatus
=
StoreStatus
.
MovementExecute
;
MoveInfo
.
NewMove
(
MoveType
.
MovePos
,
param
);
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
MG_01_InoutToP1
);
MoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitTime
(
1000
));
ConfigMoveAxis
axis
=
GetPosTAxis
();
MovePosLog
(
" 移库:进出轴到P1,"
+
axis
.
ProName
+
"停止匀速旋转"
);
InOutBackToP1
(
MoveInfo
.
MoveParam
.
MoveP
.
InOut_P1
);
ACServerManager
.
SuddenStop
(
axis
.
DeviceName
,
axis
.
GetAxisValue
());
return
true
;
}
else
{
LogUtil
.
error
(
Name
+
" 启动 "
+
param
.
LogName
+
"失败,库位不匹配,需要 冷藏区->回温区"
);
return
false
;
}
}
else
{
LogUtil
.
error
(
Name
+
" 启动 "
+
param
.
LogName
+
"出错,当前状态:["
+
runStatus
+
"],["
+
MoveInfo
.
MoveType
+
"]"
);
return
false
;
}
}
protected
override
void
MovementProcess
()
{
StoreMoveP
moveP
=
MoveInfo
.
MoveParam
.
MoveP
;
if
(
MoveInfo
.
IsInWait
)
{
CheckWait
();
}
if
(
MoveInfo
.
IsInWait
)
{
return
;
}
if
(
MoveInfo
.
IsStep
(
StoreMoveStep
.
MG_01_InoutToP1
))
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
MG_02_AxisHome
);
MoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitTime
(
1000
));
ConfigMoveAxis
axis
=
GetPosTAxis
();
MovePosLog
(
"移库:"
+
axis
.
ProName
+
"回原点"
);
ACAxisHomeMove
(
axis
);
}
else
if
(
MoveInfo
.
IsStep
(
StoreMoveStep
.
MG_02_AxisHome
))
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
MG_03_ToBag
);
MoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitTime
(
1000
));
MovePosLog
(
"移库:旋转轴至P2( 库位点),升降轴至P5(库位出库前点) ,冷藏轴到P2"
);
ACAxisMove
(
Config
.
Middle_Axis
,
moveP
.
Middle_P2
,
Config
.
MiddleAxis_P2_Speed
);
ACAxisMove
(
Config
.
UpDown_Axis
,
moveP
.
UpDown_P5
,
Config
.
UpDownAxis_P5_Speed
);
ACAxisMove
(
Config
.
Colding_Axis
,
moveP
.
Cold_P2
,
Config
.
ColdingAxis_P2_Speed
);
}
else
if
(
MoveInfo
.
IsStep
(
StoreMoveStep
.
MG_03_ToBag
))
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
MG_04_OpenCold
);
MovePosLog
(
"移库:开冷藏门"
);
CylinderMove
(
MoveInfo
,
IO_Type
.
ColdDoor_Close
,
IO_Type
.
ColdDoor_Open
);
}
else
if
(
MoveInfo
.
IsStep
(
StoreMoveStep
.
MG_04_OpenCold
))
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
MG_05_InoutToP3
);
MovePosLog
(
"移库:进出轴 至P3(库位取放料点)"
);
ACAxisMove
(
Config
.
InOut_Axis
,
moveP
.
InOut_P3
,
Config
.
InOutAxis_P3_Speed
);
}
else
if
(
MoveInfo
.
IsStep
(
StoreMoveStep
.
MG_05_InoutToP3
))
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
MG_06_Clamping_Work
);
MovePosLog
(
"移库: 夹爪夹紧"
);
CylinderMove
(
MoveInfo
,
IO_Type
.
Clamping_Relax
,
IO_Type
.
Clamping_Tighten
);
}
else
if
(
MoveInfo
.
IsStep
(
StoreMoveStep
.
MG_06_Clamping_Work
))
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
MG_07_UpdownToP6
);
MovePosLog
(
"移库:升降轴到缓冲点P6"
);
ACAxisMove
(
Config
.
UpDown_Axis
,
moveP
.
UpDown_P6
,
Config
.
UpDownAxis_P6_Speed
);
}
else
if
(
MoveInfo
.
IsStep
(
StoreMoveStep
.
MG_07_UpdownToP6
))
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
MG_08_InoutToP1
);
MoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitTime
(
1000
));
MovePosLog
(
"移库:进出轴返回P1,停止回温轴匀速运动"
);
InOutBackToP1
(
moveP
.
InOut_P1
);
AxisSuddenStop
(
Config
.
Warming_Axis
);
}
else
if
(
MoveInfo
.
IsStep
(
StoreMoveStep
.
MG_08_InoutToP1
))
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
MG_09_CloseCold
);
MovePosLog
(
"移库:关闭冷藏区门 "
);
CylinderMove
(
MoveInfo
,
IO_Type
.
ColdDoor_Open
,
IO_Type
.
ColdDoor_Close
);
}
else
if
(
MoveInfo
.
IsStep
(
StoreMoveStep
.
MG_09_CloseCold
))
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
MP_11_MoveToTBag
);
MoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitTime
(
1000
));
MovePosLog
(
"移库:移动到库位点,旋转轴 至P2( 库位点)升降轴至P3(库位入库前点),回温区旋转轴回原点"
);
ACAxisMove
(
Config
.
Middle_Axis
,
moveP
.
Middle_P2
,
Config
.
MiddleAxis_P2_Speed
);
ACAxisMove
(
Config
.
UpDown_Axis
,
moveP
.
UpDown_P3
,
Config
.
UpDownAxis_P3_Speed
);
ACAxisHomeMove
(
Config
.
Warming_Axis
);
}
else
if
(
MoveInfo
.
IsStep
(
StoreMoveStep
.
MP_11_MoveToTBag
))
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
MP_12_TargetAxisToP2
);
MovePosLog
(
"移库:回温轴到P2点"
);
ACAxisMove
(
Config
.
Warming_Axis
,
moveP
.
Warm_P2
,
Config
.
WarmingAxis_P2_Speed
);
}
else
if
(
MoveInfo
.
IsStep
(
StoreMoveStep
.
MP_12_TargetAxisToP2
))
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
MP_14_InoutToP3
);
MovePosLog
(
"移库:叉子进入库位中,进出轴至P3(库位取放料点)"
);
ACAxisMove
(
Config
.
InOut_Axis
,
moveP
.
InOut_P3
,
Config
.
InOutAxis_P3_Speed
);
}
else
if
(
MoveInfo
.
IsStep
(
StoreMoveStep
.
MP_14_InoutToP3
))
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
MP_15_UpdownToP4
);
MovePosLog
(
"移库:放下物品,升降轴至P4( 库位入料缓冲点)"
);
ACAxisMove
(
Config
.
UpDown_Axis
,
moveP
.
UpDown_P4
,
Config
.
UpDownAxis_P4_Speed
);
}
else
if
(
MoveInfo
.
IsStep
(
StoreMoveStep
.
MP_15_UpdownToP4
))
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
MP_16_Clamping_Relax
);
MovePosLog
(
"移库:夹爪放松"
);
CylinderMove
(
MoveInfo
,
IO_Type
.
Clamping_Tighten
,
IO_Type
.
Clamping_Relax
);
UpdateLastStatus
(
StoreStatus
.
MovementEnd
);
}
else
if
(
MoveInfo
.
IsStep
(
StoreMoveStep
.
MP_16_Clamping_Relax
))
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
MP_17_InOutToP1
);
MovePosLog
(
"入库。。叉子从库位中返回,进出轴动作至P1"
);
InOutBackToP1
(
moveP
.
InOut_P1
);
}
else
if
(
MoveInfo
.
IsStep
(
StoreMoveStep
.
MP_17_InOutToP1
))
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
MP_19_GoBack
);
MoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitTime
(
1000
));
MovePosLog
(
"移库:返回待机点,轴2/轴1动作至P1, 回温轴冷藏轴开始匀速旋转,"
);
ACAxisMove
(
Config
.
Middle_Axis
,
MoveInfo
.
MoveParam
.
MoveP
.
Middle_P1
,
Config
.
MiddleAxis_P1_Speed
);
ACAxisMove
(
Config
.
UpDown_Axis
,
MoveInfo
.
MoveParam
.
MoveP
.
UpDown_P1
,
Config
.
UpDownAxis_P1_Speed
);
StartWork
();
}
else
if
(
MoveInfo
.
IsStep
(
StoreMoveStep
.
MP_19_GoBack
))
{
TimeSpan
span
=
moveWatch
.
Elapsed
;
moveWatch
.
Stop
();
LogUtil
.
info
(
Name
+
" "
+
MoveInfo
.
MoveParam
.
LogName
+
" 结束,耗时【"
+
FormUtil
.
GetSpanStr
(
span
)
+
"】!"
);
MoveInfo
.
EndMove
();
runStatus
=
StoreRunStatus
.
Runing
;
storeStatus
=
StoreStatus
.
StoreOnline
;
}
}
#
endregion
#
region
搅拌数据加载
private
void
LoadCurrStirInfo
()
{
string
jsonData
=
ConfigAppSettings
.
GetValue
(
Setting_Init
.
CurrStirInfo
);
CurrStirInfo
=
JsonHelper
.
DeserializeJsonToObject
<
StirInfo
>(
jsonData
);
if
(
CurrStirInfo
==
null
)
{
LogUtil
.
info
(
Name
+
"读取搅拌区信息【"
+
jsonData
+
"】为空,重新初始化搅拌信息"
);
CurrStirInfo
=
new
StirInfo
();
jsonData
=
JsonHelper
.
SerializeObject
(
CurrStirInfo
);
ConfigAppSettings
.
SaveValue
(
Setting_Init
.
CurrStirInfo
,
jsonData
);
}
}
public
bool
UpdateCurrStirInfo
(
bool
isStir
,
InOutParam
param
)
{
LogUtil
.
info
(
Name
+
"更新搅拌区信息:【"
+
isStir
+
"】 【"
+
param
.
LogName
+
"】"
);
if
(
CurrStirInfo
==
null
)
{
CurrStirInfo
=
new
StirInfo
();
}
CurrStirInfo
.
InStirWork
=
isStir
;
CurrStirInfo
.
StartTime
=
DateTime
.
Now
;
CurrStirInfo
.
StirParam
=
param
;
CurrStirInfo
.
MoveStatus
=
0
;
string
jsonData
=
JsonHelper
.
SerializeObject
(
CurrStirInfo
);
ConfigAppSettings
.
SaveValue
(
Setting_Init
.
CurrStirInfo
,
jsonData
);
return
true
;
}
/// <summary>
/// 更新搅拌区状态,1=物料1已放入,2=物料2已放入,3=搅拌中,4=搅拌完成,等待取出物料,5=物料1已取出,6=物料2已取出,7=全部完成
/// </summary>
/// <param name="state">搅拌区状态:1=物料1已放入,2=物料2已放入,3=搅拌中,4=搅拌完成,等待取出物料,5=物料1已取出,6=物料2已取出,7=全部完成</param>
/// <returns></returns>
private
bool
UpdateCurrStirState
(
int
state
,
int
stirSeconds
=
0
)
{
if
(
CurrStirInfo
==
null
||
CurrStirInfo
.
StirParam
==
null
)
{
return
false
;
}
LogUtil
.
info
(
Name
+
"更新搅拌区【"
+
CurrStirInfo
.
StirParam
.
LogName
+
"】状态=【"
+
state
+
"】 "
);
CurrStirInfo
.
MoveStatus
=
state
;
CurrStirInfo
.
StartTime
=
DateTime
.
Now
;
CurrStirInfo
.
StopTime
=
DateTime
.
Now
.
AddSeconds
(
stirSeconds
);
string
jsonData
=
JsonHelper
.
SerializeObject
(
CurrStirInfo
);
ConfigAppSettings
.
SaveValue
(
Setting_Init
.
CurrStirInfo
,
jsonData
);
return
true
;
}
#
endregion
#
region
搅拌
public
bool
StartStirring
(
InOutParam
param
)
{
if
(
runStatus
==
StoreRunStatus
.
Runing
&&
MoveInfo
.
MoveType
.
Equals
(
MoveType
.
None
))
{
if
(
CurrStirInfo
!=
null
&&
CurrStirInfo
.
InStirWork
)
{
LogUtil
.
error
(
Name
+
" 启动 "
+
param
.
LogName
+
"失败,搅拌区已被占用: "
+
CurrStirInfo
.
StirParam
.
LogName
+
""
);
return
false
;
}
if
(!
param
.
LoadParam
(
Config
))
{
LogUtil
.
error
(
Name
+
" 启动 "
+
param
.
LogName
+
"失败,找不到库位 "
+
param
.
PosId
+
""
);
return
false
;
}
if
(
IOManager
.
IOValue
(
IO_Type
.
TinCheck_Fixture
).
Equals
(
IO_VALUE
.
HIGH
))
{
LogUtil
.
error
(
Name
+
" 启动 "
+
param
.
LogName
+
"失败,叉子料盘检测有料"
);
return
false
;
}
if
(!
param
.
Position
.
PosType
.
Equals
(
2
))
{
LogUtil
.
error
(
Name
+
" 启动 "
+
param
.
LogName
+
"失败,["
+
param
.
PosId
+
"]不是回温区库位"
);
return
false
;
}
//判断是否需要使用砝码
if
(
param
.
TarPosId
.
Equals
(
""
))
{
VerticalStorePosition
wPostion
=
GetStriWeightPos
(
param
.
Weight
);
if
(
wPostion
==
null
)
{
LogUtil
.
error
(
Name
+
" 启动 "
+
param
.
LogName
+
"失败,未找到匹配的砝码"
);
return
false
;
}
param
.
TarPosCode
=
"weight-"
+
wPostion
.
PosType
+
"G"
;
param
.
TarPosId
=
wPostion
.
PositionNum
;
param
.
TarWeight
=
wPostion
.
PosType
;
LogUtil
.
info
(
Name
+
" "
+
param
.
LogName
+
"搅拌前,找到匹配砝码:["
+
param
.
TarPosId
+
"]["
+
param
.
TarWeight
+
"]G"
);
}
moveWatch
.
Restart
();
LogUtil
.
info
(
Name
+
"启动 "
+
param
.
LogName
+
",保存搅拌区参数 "
);
UpdateCurrStirInfo
(
true
,
param
);
runStatus
=
StoreRunStatus
.
Busy
;
storeStatus
=
StoreStatus
.
StirringExecute
;
MoveInfo
.
NewMove
(
MoveType
.
Stirring
,
param
);
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
ST_01_InoutToP1
);
ConfigMoveAxis
axis
=
GetPosTAxis
();
OutStoreLog
(
" 送料1搅拌:进出轴到P1,"
+
axis
.
ProName
+
"停止匀速旋转"
);
InOutBackToP1
(
MoveInfo
.
MoveParam
.
MoveP
.
InOut_P1
);
AxisSuddenStop
(
axis
);
return
true
;
}
else
{
LogUtil
.
error
(
Name
+
" 启动 "
+
param
.
LogName
+
"出错,当前状态:["
+
runStatus
+
"],["
+
MoveInfo
.
MoveType
+
"]"
);
return
false
;
}
}
private
VerticalStorePosition
GetStriWeightPos
(
int
weight
)
{
//根据重量获取砝码库位
List
<
VerticalStorePosition
>
allList
=
new
List
<
VerticalStorePosition
>(
CSVPositionReader
<
VerticalStorePosition
>.
allPositionMap
.
Values
);
List
<
VerticalStorePosition
>
weightList
=
(
from
m
in
allList
where
m
.
PosType
>=
100
orderby
m
.
PosType
descending
select
m
).
ToList
<
VerticalStorePosition
>();
foreach
(
VerticalStorePosition
p
in
weightList
)
{
if
(
weight
>=
p
.
PosType
)
{
return
p
;
}
int
cha
=
weight
-
p
.
PosType
;
if
((
Math
.
Abs
(
cha
)
<
50
))
{
return
p
;
}
}
if
(
weightList
!=
null
)
{
return
weightList
[
weightList
.
Count
-
1
];
}
return
null
;
}
protected
override
void
StirringProcess
()
{
StoreMoveP
moveP
=
MoveInfo
.
MoveParam
.
MoveP
;
VerticalStorePosition
tPosition
=
MoveInfo
.
MoveParam
.
TarPosition
;
if
(
MoveInfo
.
IsInWait
)
{
CheckWait
();
}
if
(
MoveInfo
.
IsInWait
)
{
return
;
}
#
region
送料
1
去搅拌位
1
if
(
MoveInfo
.
IsStep
(
StoreMoveStep
.
Wait
))
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
ST_01_InoutToP1
);
ConfigMoveAxis
axis
=
GetPosTAxis
();
OutStoreLog
(
" 送料1搅拌:进出轴到P1,"
+
axis
.
ProName
+
"停止匀速旋转"
);
InOutBackToP1
(
MoveInfo
.
MoveParam
.
MoveP
.
InOut_P1
);
AxisSuddenStop
(
axis
);
}
else
if
(
MoveInfo
.
IsStep
(
StoreMoveStep
.
ST_01_InoutToP1
))
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
ST_02_AxisHome
);
MoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitTime
(
1000
));
OutStoreLog
(
" 送料1搅拌:,回温轴回原点"
);
ACAxisHomeMove
(
Config
.
Warming_Axis
);
}
else
if
(
MoveInfo
.
IsStep
(
StoreMoveStep
.
ST_02_AxisHome
))
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
ST_03_ToBag
);
MoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitTime
(
1000
));
OutStoreLog
(
" 送料1搅拌: 旋转轴至P2( 库位点),升降轴至P5(库位出库前点), 回温轴到P2"
);
ACAxisMove
(
Config
.
Middle_Axis
,
moveP
.
Middle_P2
,
Config
.
MiddleAxis_P2_Speed
);
ACAxisMove
(
Config
.
UpDown_Axis
,
moveP
.
UpDown_P5
,
Config
.
UpDownAxis_P5_Speed
);
ACAxisMove
(
Config
.
Warming_Axis
,
moveP
.
Warm_P2
,
Config
.
WarmingAxis_P2_Speed
);
}
else
if
(
MoveInfo
.
IsStep
(
StoreMoveStep
.
ST_03_ToBag
))
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
ST_05_InoutToP3
);
OutStoreLog
(
" 送料1搅拌:进出轴 至P3(库位取放料点)"
);
ACAxisMove
(
Config
.
InOut_Axis
,
moveP
.
InOut_P3
,
Config
.
InOutAxis_P3_Speed
);
}
else
if
(
MoveInfo
.
IsStep
(
StoreMoveStep
.
ST_05_InoutToP3
))
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
ST_06_Clamping_Work
);
OutStoreLog
(
" 送料1搅拌: 夹爪夹紧"
);
CylinderMove
(
MoveInfo
,
IO_Type
.
Clamping_Relax
,
IO_Type
.
Clamping_Tighten
);
}
else
if
(
MoveInfo
.
IsStep
(
StoreMoveStep
.
ST_06_Clamping_Work
))
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
ST_07_UpdownToP6
);
OutStoreLog
(
" 送料1搅拌:升降轴到缓冲点P6"
);
ACAxisMove
(
Config
.
UpDown_Axis
,
moveP
.
UpDown_P6
,
Config
.
UpDownAxis_P6_Speed
);
}
else
if
(
MoveInfo
.
IsStep
(
StoreMoveStep
.
ST_07_UpdownToP6
))
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
ST_08_InoutToP1
);
OutStoreLog
(
" 送料1搅拌:进出轴返回P1,搅拌气缸上升"
);
InOutBackToP1
(
moveP
.
InOut_P1
);
CylinderMove
(
MoveInfo
,
IO_Type
.
StirLocation_Down
,
IO_Type
.
StirLocation_Up
);
}
else
if
(
MoveInfo
.
IsStep
(
StoreMoveStep
.
ST_08_InoutToP1
))
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
ST_09_MoveToStir
);
MoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitTime
(
1000
));
OutStoreLog
(
" 送料1搅拌:移动到搅拌位置,升降轴到搅拌区高点P101,旋转轴到P101, 搅拌轴到P1"
);
ACAxisMove
(
Config
.
UpDown_Axis
,
Config
.
UpDownAxis_StirH_P101
,
Config
.
UpDownAxis_P101_Speed
);
ACAxisMove
(
Config
.
Middle_Axis
,
moveP
.
Middle_P2
,
Config
.
MiddleAxis_P2_Speed
);
ACAxisMove
(
Config
.
Stir_Axis
,
Config
.
Stir_Axis_P1
,
Config
.
StirAxis_P1_Speed
);
}
else
if
(
MoveInfo
.
IsStep
(
StoreMoveStep
.
ST_09_MoveToStir
))
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
ST_10_LocationDown
);
OutStoreLog
(
" 送料1搅拌:搅拌气缸下降"
);
CylinderMove
(
MoveInfo
,
IO_Type
.
StirLocation_Up
,
IO_Type
.
StirLocation_Down
);
}
else
if
(
MoveInfo
.
IsStep
(
StoreMoveStep
.
ST_10_LocationDown
))
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
ST_11_InoutToP101
);
OutStoreLog
(
" 送料1搅拌:进出轴移动到搅拌区取放料点P101"
);
ACAxisMove
(
Config
.
InOut_Axis
,
Config
.
InOutAxis_Stir_P101
,
Config
.
InOutAxis_P101_Speed
);
}
else
if
(
MoveInfo
.
IsStep
(
StoreMoveStep
.
ST_11_InoutToP101
))
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
ST_12_UpdownToP102
);
OutStoreLog
(
" 送料1搅拌:升降轴下降到P102,更新搅拌区信息"
);
ACAxisMove
(
Config
.
UpDown_Axis
,
Config
.
UpDownAxis_StirL_P102
,
Config
.
UpDownAxis_P102_Speed
);
}
else
if
(
MoveInfo
.
IsStep
(
StoreMoveStep
.
ST_12_UpdownToP102
))
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
ST_13_Clamping_Relax
);
OutStoreLog
(
" 送料1搅拌:夹爪放松,更新搅拌状态:物料1已放入搅拌区"
);
CylinderMove
(
MoveInfo
,
IO_Type
.
Clamping_Tighten
,
IO_Type
.
Clamping_Relax
);
UpdateCurrStirState
(
1
);
}
else
if
(
MoveInfo
.
IsStep
(
StoreMoveStep
.
ST_13_Clamping_Relax
))
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
ST_14_InoutToP1
);
OutStoreLog
(
" 送料1搅拌:进出轴后退到P1"
);
InOutBackToP1
(
Config
.
InOutAxis_P1
);
}
#
endregion
#
region
送料
2
去搅拌位
2
else
if
(
MoveInfo
.
IsStep
(
StoreMoveStep
.
ST_14_InoutToP1
))
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
ST_23_ToBag
);
MoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitTime
(
1000
));
OutStoreLog
(
" 送料2搅拌: 旋转轴至P2( 库位点),升降轴至P5(库位出库前点) ,回温轴到P2"
);
ACAxisMove
(
Config
.
Middle_Axis
,
tPosition
.
MiddleAxis_P2
,
Config
.
MiddleAxis_P2_Speed
);
ACAxisMove
(
Config
.
UpDown_Axis
,
tPosition
.
UpDownAxis_OH_P5
,
Config
.
UpDownAxis_P5_Speed
);
ACAxisMove
(
Config
.
Warming_Axis
,
tPosition
.
WarmAxis_P2
,
Config
.
WarmingAxis_P2_Speed
);
}
else
if
(
MoveInfo
.
IsStep
(
StoreMoveStep
.
ST_23_ToBag
))
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
ST_25_InoutToP3
);
OutStoreLog
(
" 送料2搅拌:进出轴 至P3(库位取放料点)"
);
ACAxisMove
(
Config
.
InOut_Axis
,
tPosition
.
InOutAxis_P3
,
Config
.
InOutAxis_P3_Speed
);
}
else
if
(
MoveInfo
.
IsStep
(
StoreMoveStep
.
ST_25_InoutToP3
))
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
ST_26_Clamping_Work
);
OutStoreLog
(
" 送料2搅拌: 夹爪夹紧"
);
CylinderMove
(
MoveInfo
,
IO_Type
.
Clamping_Relax
,
IO_Type
.
Clamping_Tighten
);
}
else
if
(
MoveInfo
.
IsStep
(
StoreMoveStep
.
ST_26_Clamping_Work
))
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
ST_27_UpdownToP6
);
OutStoreLog
(
" 送料2搅拌:升降轴到缓冲点P6"
);
ACAxisMove
(
Config
.
UpDown_Axis
,
tPosition
.
UpDownAxis_OL_P6
,
Config
.
UpDownAxis_P6_Speed
);
}
else
if
(
MoveInfo
.
IsStep
(
StoreMoveStep
.
ST_27_UpdownToP6
))
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
ST_28_InoutToP1
);
OutStoreLog
(
" 送料2搅拌:进出轴返回P1,搅拌气缸上升"
);
InOutBackToP1
(
Config
.
InOutAxis_P1
);
CylinderMove
(
MoveInfo
,
IO_Type
.
StirLocation_Down
,
IO_Type
.
StirLocation_Up
);
}
else
if
(
MoveInfo
.
IsStep
(
StoreMoveStep
.
ST_28_InoutToP1
))
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
ST_29_MoveToStir
);
MoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitTime
(
1000
));
OutStoreLog
(
" 送料2搅拌:移动到搅拌位置,升降轴到搅拌区高点P101,旋转轴到P101, 搅拌轴到P2"
);
ACAxisMove
(
Config
.
Middle_Axis
,
Config
.
MiddleAxis_Stir_P101
,
Config
.
MiddleAxis_P101_Speed
);
ACAxisMove
(
Config
.
UpDown_Axis
,
Config
.
UpDownAxis_StirH_P101
,
Config
.
UpDownAxis_P101_Speed
);
ACAxisMove
(
Config
.
Stir_Axis
,
Config
.
Stir_Axis_P2
,
Config
.
StirAxis_P2_Speed
);
}
else
if
(
MoveInfo
.
IsStep
(
StoreMoveStep
.
ST_29_MoveToStir
))
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
ST_30_LocationDown
);
OutStoreLog
(
" 送料2搅拌:搅拌气缸下降"
);
CylinderMove
(
MoveInfo
,
IO_Type
.
StirLocation_Up
,
IO_Type
.
StirLocation_Down
);
}
else
if
(
MoveInfo
.
IsStep
(
StoreMoveStep
.
ST_30_LocationDown
))
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
ST_31_InoutToP101
);
OutStoreLog
(
" 送料2搅拌:进出轴移动到搅拌区取放料点P101"
);
ACAxisMove
(
Config
.
InOut_Axis
,
Config
.
InOutAxis_Stir_P101
,
Config
.
InOutAxis_P101_Speed
);
}
else
if
(
MoveInfo
.
IsStep
(
StoreMoveStep
.
ST_31_InoutToP101
))
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
ST_32_UpdownToP102
);
OutStoreLog
(
" 送料2搅拌:升降轴下降到P102"
);
ACAxisMove
(
Config
.
UpDown_Axis
,
Config
.
UpDownAxis_StirL_P102
,
Config
.
UpDownAxis_P102_Speed
);
}
else
if
(
MoveInfo
.
IsStep
(
StoreMoveStep
.
ST_32_UpdownToP102
))
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
ST_33_Clamping_Relax
);
OutStoreLog
(
" 送料2搅拌:夹爪放松,更新搅拌状态:物料2已放入搅拌区"
);
CylinderMove
(
MoveInfo
,
IO_Type
.
Clamping_Tighten
,
IO_Type
.
Clamping_Relax
);
UpdateCurrStirState
(
2
);
}
else
if
(
MoveInfo
.
IsStep
(
StoreMoveStep
.
ST_33_Clamping_Relax
))
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
ST_34_InoutToP1
);
OutStoreLog
(
" 送料2搅拌:进出轴后退到P1"
);
InOutBackToP1
(
Config
.
InOutAxis_P1
);
}
else
if
(
MoveInfo
.
IsStep
(
StoreMoveStep
.
ST_34_InoutToP1
))
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
ST_35_LocationUp
);
OutStoreLog
(
" 送料2搅拌:搅拌气缸上升"
);
CylinderMove
(
MoveInfo
,
IO_Type
.
StirLocation_Down
,
IO_Type
.
StirLocation_Up
);
}
else
if
(
MoveInfo
.
IsStep
(
StoreMoveStep
.
ST_35_LocationUp
))
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
ST_41_StartStir
);
OutStoreLog
(
" 搅拌:开始搅拌,回温轴,搅拌轴,开始匀速旋转"
);
StartWork
(
2
);
UpdateCurrStirState
(
3
,
MoveInfo
.
MoveParam
.
StirSecsond
);
}
else
if
(
MoveInfo
.
IsStep
(
StoreMoveStep
.
ST_41_StartStir
))
{
TimeSpan
span
=
moveWatch
.
Elapsed
;
moveWatch
.
Stop
();
LogUtil
.
info
(
Name
+
" "
+
MoveInfo
.
MoveParam
.
LogName
+
" 送料去搅拌结束,耗时【"
+
FormUtil
.
GetSpanStr
(
span
)
+
"】!"
);
MoveInfo
.
EndMove
();
runStatus
=
StoreRunStatus
.
Runing
;
storeStatus
=
StoreStatus
.
StoreOnline
;
}
#
endregion
#
region
搅拌完成:搅拌位
1
物料回库位
else
if
(
MoveInfo
.
IsStep
(
StoreMoveStep
.
SR_51_InoutBack
))
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
SR_52_MoveToStir
);
MoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitTime
(
1000
));
OutStoreLog
(
" 搅拌1回库:移动到搅拌位置,升降轴到搅拌区低点P102,旋转轴到P101, 搅拌轴到P1"
);
ACAxisMove
(
Config
.
UpDown_Axis
,
Config
.
UpDownAxis_StirL_P102
,
Config
.
UpDownAxis_P102_Speed
);
ACAxisMove
(
Config
.
Middle_Axis
,
Config
.
MiddleAxis_Stir_P101
,
Config
.
MiddleAxis_P101_Speed
);
ACAxisMove
(
Config
.
Stir_Axis
,
Config
.
Stir_Axis_P1
,
Config
.
StirAxis_P1_Speed
);
}
else
if
(
MoveInfo
.
IsStep
(
StoreMoveStep
.
SR_52_MoveToStir
))
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
SR_53_LocationDown
);
OutStoreLog
(
" 搅拌1回库:搅拌气缸下降"
);
CylinderMove
(
MoveInfo
,
IO_Type
.
StirLocation_Up
,
IO_Type
.
StirLocation_Down
);
}
else
if
(
MoveInfo
.
IsStep
(
StoreMoveStep
.
SR_53_LocationDown
))
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
SR_54_InoutToP101
);
OutStoreLog
(
" 搅拌1回库:进出轴到P101"
);
ACAxisMove
(
Config
.
InOut_Axis
,
Config
.
InOutAxis_Stir_P101
,
Config
.
InOutAxis_P101_Speed
);
}
else
if
(
MoveInfo
.
IsStep
(
StoreMoveStep
.
SR_54_InoutToP101
))
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
SR_55_Clamping_Work
);
OutStoreLog
(
" 搅拌1回库:夹爪气缸夹紧"
);
CylinderMove
(
MoveInfo
,
IO_Type
.
Clamping_Relax
,
IO_Type
.
Clamping_Tighten
);
}
else
if
(
MoveInfo
.
IsStep
(
StoreMoveStep
.
SR_55_Clamping_Work
))
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
SR_56_UpdownToP101
);
OutStoreLog
(
" 搅拌1回库:升降轴上升到高点P101"
);
ACAxisMove
(
Config
.
UpDown_Axis
,
Config
.
UpDownAxis_StirH_P101
,
Config
.
UpDownAxis_P101_Speed
);
}
else
if
(
MoveInfo
.
IsStep
(
StoreMoveStep
.
SR_56_UpdownToP101
))
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
SR_57_InoutToP1
);
OutStoreLog
(
" 搅拌1回库:进出轴返回P1,更新搅拌状态为物料1已取出"
);
InOutBackToP1
(
Config
.
InOutAxis_P1
);
UpdateCurrStirState
(
5
);
}
else
if
(
MoveInfo
.
IsStep
(
StoreMoveStep
.
SR_57_InoutToP1
))
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
SR_58_MoveToBag
);
MoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitTime
(
1000
));
OutStoreLog
(
" 搅拌1回库:移动到库位点,旋转轴 至P2( 库位点)升降轴至P3(库位入库前点),回温轴回原点"
);
ACAxisMove
(
Config
.
UpDown_Axis
,
moveP
.
UpDown_P3
,
Config
.
UpDownAxis_P3_Speed
);
ACAxisMove
(
Config
.
Middle_Axis
,
moveP
.
Middle_P2
,
Config
.
MiddleAxis_P2_Speed
);
ACAxisHomeMove
(
Config
.
Warming_Axis
);
}
else
if
(
MoveInfo
.
IsStep
(
StoreMoveStep
.
SR_58_MoveToBag
))
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
SR_59_TargetAxisToP2
);
OutStoreLog
(
" 搅拌1回库:回温轴到P2点"
);
ACAxisMove
(
Config
.
Warming_Axis
,
moveP
.
Warm_P2
,
Config
.
WarmingAxis_P2_Speed
);
}
else
if
(
MoveInfo
.
IsStep
(
StoreMoveStep
.
SR_59_TargetAxisToP2
))
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
SR_61_InoutToP3
);
OutStoreLog
(
" 搅拌1回库:叉子进入库位中,进出轴至P3(库位取放料点)"
);
ACAxisMove
(
Config
.
InOut_Axis
,
moveP
.
InOut_P3
,
Config
.
InOutAxis_P3_Speed
);
}
else
if
(
MoveInfo
.
IsStep
(
StoreMoveStep
.
SR_61_InoutToP3
))
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
SR_62_UpdownToP4
);
OutStoreLog
(
" 搅拌1回库:放下物品,升降轴至P4( 库位入料缓冲点)"
);
ACAxisMove
(
Config
.
UpDown_Axis
,
moveP
.
UpDown_P4
,
Config
.
UpDownAxis_P4_Speed
);
}
else
if
(
MoveInfo
.
IsStep
(
StoreMoveStep
.
SR_62_UpdownToP4
))
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
SR_63_Clamping_Relax
);
OutStoreLog
(
" 搅拌1回库:夹爪放松"
);
CylinderMove
(
MoveInfo
,
IO_Type
.
Clamping_Tighten
,
IO_Type
.
Clamping_Relax
);
}
else
if
(
MoveInfo
.
IsStep
(
StoreMoveStep
.
SR_63_Clamping_Relax
))
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
SR_64_InOutToP1
);
OutStoreLog
(
" 搅拌1回库:叉子从库位中返回,进出轴动作至P1"
);
InOutBackToP1
(
moveP
.
InOut_P1
);
}
else
if
(
MoveInfo
.
IsStep
(
StoreMoveStep
.
SR_64_InOutToP1
))
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
SR_71_LocationUp
);
OutStoreLog
(
" 搅拌2回库:进出轴返回,定位气缸上升,"
);
CylinderMove
(
MoveInfo
,
IO_Type
.
StirLocation_Down
,
IO_Type
.
StirLocation_Up
);
}
#
endregion
#
region
搅拌完成:搅拌位
2
物料回库位
else
if
(
MoveInfo
.
IsStep
(
StoreMoveStep
.
SR_71_LocationUp
))
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
SR_72_MoveToStir
);
MoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitTime
(
1000
));
OutStoreLog
(
" 搅拌2回库:移动到搅拌位置,升降轴到搅拌区低点P102,旋转轴到P101, 搅拌轴到P2"
);
ACAxisMove
(
Config
.
UpDown_Axis
,
Config
.
UpDownAxis_StirL_P102
,
Config
.
UpDownAxis_P102_Speed
);
ACAxisMove
(
Config
.
Middle_Axis
,
Config
.
MiddleAxis_Stir_P101
,
Config
.
MiddleAxis_P101_Speed
);
ACAxisMove
(
Config
.
Stir_Axis
,
Config
.
Stir_Axis_P2
,
Config
.
StirAxis_P2_Speed
);
}
else
if
(
MoveInfo
.
IsStep
(
StoreMoveStep
.
SR_72_MoveToStir
))
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
SR_73_LocationDown
);
OutStoreLog
(
" 搅拌2回库:搅拌气缸下降"
);
CylinderMove
(
MoveInfo
,
IO_Type
.
StirLocation_Up
,
IO_Type
.
StirLocation_Down
);
}
else
if
(
MoveInfo
.
IsStep
(
StoreMoveStep
.
SR_73_LocationDown
))
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
SR_74_InoutToP101
);
OutStoreLog
(
" 搅拌2回库:进出轴到P101"
);
ACAxisMove
(
Config
.
InOut_Axis
,
Config
.
InOutAxis_Stir_P101
,
Config
.
InOutAxis_P101_Speed
);
}
else
if
(
MoveInfo
.
IsStep
(
StoreMoveStep
.
SR_74_InoutToP101
))
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
SR_75_Clamping_Work
);
OutStoreLog
(
" 搅拌2回库:夹爪气缸夹紧"
);
CylinderMove
(
MoveInfo
,
IO_Type
.
Clamping_Relax
,
IO_Type
.
Clamping_Tighten
);
}
else
if
(
MoveInfo
.
IsStep
(
StoreMoveStep
.
SR_75_Clamping_Work
))
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
SR_76_UpdownToP101
);
OutStoreLog
(
" 搅拌2回库:升降轴上升到高点P101"
);
ACAxisMove
(
Config
.
UpDown_Axis
,
Config
.
UpDownAxis_StirH_P101
,
Config
.
UpDownAxis_P101_Speed
);
}
else
if
(
MoveInfo
.
IsStep
(
StoreMoveStep
.
SR_76_UpdownToP101
))
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
SR_77_InoutToP1
);
OutStoreLog
(
" 搅拌2回库:进出轴返回P1,更改搅拌状态为物料2已取出 "
);
InOutBackToP1
(
Config
.
InOutAxis_P1
);
UpdateCurrStirState
(
6
);
}
else
if
(
MoveInfo
.
IsStep
(
StoreMoveStep
.
SR_77_InoutToP1
))
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
SR_78_MoveToBag
);
MoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitTime
(
1000
));
OutStoreLog
(
" 搅拌2回库:移动到库位点,旋转轴 至P2( 库位点)升降轴至P3(库位入库前点),回温轴到P2点"
);
ACAxisMove
(
Config
.
Middle_Axis
,
MoveInfo
.
MoveParam
.
TarPosition
.
MiddleAxis_P2
,
Config
.
MiddleAxis_P2_Speed
);
ACAxisMove
(
Config
.
UpDown_Axis
,
MoveInfo
.
MoveParam
.
TarPosition
.
UpDownAxis_IH_P3
,
Config
.
UpDownAxis_P3_Speed
);
ACAxisMove
(
Config
.
Warming_Axis
,
MoveInfo
.
MoveParam
.
TarPosition
.
WarmAxis_P2
,
Config
.
WarmingAxis_P2_Speed
);
}
else
if
(
MoveInfo
.
IsStep
(
StoreMoveStep
.
SR_78_MoveToBag
))
{
// MoveInfo.NextMoveStep(StoreMoveStep.SR_79_TargetAxisToP2);
// OutStoreLog(" 搅拌2回库:冷藏轴或回温轴到P2点");
//}
//else if (MoveInfo.IsStep(StoreMoveStep.SR_79_TargetAxisToP2))
//{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
SR_81_InoutToP3
);
OutStoreLog
(
" 搅拌2回库:叉子进入库位中,进出轴至P3(库位取放料点)"
);
ACAxisMove
(
Config
.
InOut_Axis
,
MoveInfo
.
MoveParam
.
TarPosition
.
InOutAxis_P3
,
Config
.
InOutAxis_P3_Speed
);
}
else
if
(
MoveInfo
.
IsStep
(
StoreMoveStep
.
SR_81_InoutToP3
))
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
SR_82_UpdownToP4
);
OutStoreLog
(
" 搅拌2回库:放下物品,升降轴至P4( 库位入料缓冲点) "
);
ACAxisMove
(
Config
.
UpDown_Axis
,
MoveInfo
.
MoveParam
.
TarPosition
.
UpDownAxis_IL_P4
,
Config
.
UpDownAxis_P4_Speed
);
}
else
if
(
MoveInfo
.
IsStep
(
StoreMoveStep
.
SR_82_UpdownToP4
))
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
SR_83_Clamping_Relax
);
OutStoreLog
(
" 搅拌2回库:夹爪放松"
);
CylinderMove
(
MoveInfo
,
IO_Type
.
Clamping_Tighten
,
IO_Type
.
Clamping_Relax
);
}
else
if
(
MoveInfo
.
IsStep
(
StoreMoveStep
.
SR_83_Clamping_Relax
))
{
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
SR_84_InOutToP1
);
OutStoreLog
(
" 搅拌2回库:叉子从库位中返回,进出轴动作至P1,更新搅拌状态为全部完成"
);
InOutBackToP1
(
Config
.
InOutAxis_P1
);
UpdateCurrStirState
(
7
);
}
else
if
(
MoveInfo
.
IsStep
(
StoreMoveStep
.
SR_84_InOutToP1
))
{
TimeSpan
span
=
moveWatch
.
Elapsed
;
moveWatch
.
Stop
();
LogUtil
.
info
(
Name
+
" "
+
MoveInfo
.
MoveParam
.
LogName
+
" 搅拌物料回库完成,耗时【"
+
FormUtil
.
GetSpanStr
(
span
)
+
"】!"
);
MoveInfo
.
EndMove
();
runStatus
=
StoreRunStatus
.
Runing
;
storeStatus
=
StoreStatus
.
StoreOnline
;
UpdateCurrStirInfo
(
false
,
new
InOutParam
(
MoveType
.
None
,
""
));
}
#
endregion
}
private
bool
StartStirBackPos
(
InOutParam
param
)
{
if
(
runStatus
==
StoreRunStatus
.
Runing
&&
MoveInfo
.
MoveType
.
Equals
(
MoveType
.
None
))
{
if
(!
param
.
LoadParam
(
Config
))
{
LogUtil
.
error
(
Name
+
" 启动 "
+
param
.
LogName
+
"失败,找不到库位 "
+
param
.
PosId
+
""
);
return
false
;
}
if
(
IOManager
.
IOValue
(
IO_Type
.
TinCheck_Fixture
).
Equals
(
IO_VALUE
.
HIGH
))
{
LogUtil
.
error
(
Name
+
" 启动 "
+
param
.
LogName
+
"失败,叉子料盘检测有料"
);
return
false
;
}
if
(!
param
.
Position
.
PosType
.
Equals
(
2
))
{
LogUtil
.
error
(
Name
+
" 启动 "
+
param
.
LogName
+
"失败,["
+
param
.
PosId
+
"]不是回温区库位"
);
return
false
;
}
if
(
param
.
TarPosition
==
null
)
{
LogUtil
.
error
(
Name
+
" 启动 "
+
param
.
LogName
+
"失败,找不到库位 ["
+
param
.
TarPosition
+
"]"
);
return
false
;
}
moveWatch
.
Restart
();
LogUtil
.
info
(
Name
+
"启动 "
+
param
.
LogName
+
",回库操作 "
);
runStatus
=
StoreRunStatus
.
Busy
;
storeStatus
=
StoreStatus
.
StirringExecute
;
MoveInfo
.
NewMove
(
MoveType
.
Stirring
,
param
);
MoveInfo
.
NextMoveStep
(
StoreMoveStep
.
SR_51_InoutBack
);
MoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitTime
(
1500
));
OutStoreLog
(
" 搅拌1回库:进出轴到P1,搅拌轴停止转动,回温区停止匀速运动,搅拌气缸上升"
);
InOutBackToP1
(
MoveInfo
.
MoveParam
.
MoveP
.
InOut_P1
);
AxisSuddenStop
(
Config
.
Warming_Axis
);
AxisSuddenStop
(
Config
.
Stir_Axis
);
CylinderMove
(
MoveInfo
,
IO_Type
.
StirLocation_Down
,
IO_Type
.
StirLocation_Up
);
return
true
;
}
else
{
LogUtil
.
error
(
Name
+
" 启动 "
+
param
.
LogName
+
"出错,当前状态:["
+
runStatus
+
"],["
+
MoveInfo
.
MoveType
+
"]"
);
return
false
;
}
}
#
endregion
public
bool
StirAxisCanMove
()
{
if
(
IOManager
.
IOValue
(
IO_Type
.
StirLocation_Up
).
Equals
(
IO_VALUE
.
HIGH
)
&&
IOManager
.
IOValue
(
IO_Type
.
StirLocation_Down
).
Equals
(
IO_VALUE
.
LOW
)
)
{
return
true
;
}
return
false
;
}
}
}
source/DeviceLibrary/device/IO/AIOBOX/AIOBOXManager.cs
查看文件 @
4be5928
...
...
@@ -15,8 +15,6 @@ namespace OnlineStore.DeviceLibrary
{
public
class
AIOBOXManager
:
IOManager
{
//public static uint DefaultDICount = 16;
//public static uint DefaultDOCount = 16;
public
readonly
ILog
LOGGER
=
LogManager
.
GetLogger
(
MethodBase
.
GetCurrentMethod
().
DeclaringType
);
public
Dictionary
<
string
,
AIOBOX
>
AIOMap
=
new
Dictionary
<
string
,
AIOBOX
>();
...
...
source/DeviceLibrary/device/PanasonicServo/ACCMDManager.cs
deleted
100644 → 0
查看文件 @
62061a7
using
OnlineStore.Common
;
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
namespace
OnlineStore.DeviceLibrary
{
public
class
ACCMDManager
{
/// <summary>
/// 0132h 原点接近传感器输入 (HOME) 状态 ReadOnly 0: 输入 OFF 1: 输入 ON
/// </summary>
public
static
string
Home_Single
=
"0132"
;
/// <summary>
/// 0022h 负方向驱动禁止输入(NOT) ReadOnly 0: 输入 OFF、 1: 输入 ON
/// </summary>
public
static
string
Limit_Negative_Single
=
"0022"
;
/// <summary>
/// 0023h 正方向驱动禁止输入(POT) ReadOnly 0: 输入 OFF、 1: 输入 ON
/// </summary>
public
static
string
Limit_Positive_Single
=
"0023"
;
/// <summary>
///速度 4601
/// </summary>
public
static
string
Speed_Addr
=
"4601"
;
/// <summary>
/// 0060h 伺服 On 输入 (SRV-ON) 操作 R/W 0000h:输入 OFF、FF00h:输入 ON
/// </summary>
public
static
string
ServerOn_Addr
=
"0060"
;
/// <summary>
/// 0120h 选通输入 (STB) 操作 R/W 0000h:输入 OFF、FF00h:输入 ON
/// </summary>
public
static
string
STB_Addr
=
"0120"
;
/// <summary>
/// 0124h 减速停止输入 (S-STOP) 操作 R/W 0000h:输入 OFF、FF00h:输入 ON
/// </summary>
public
static
string
Stop_Addr
=
"0124"
;
/// <summary>
/// 0123h 紧急停止输入 (H-STOP) 操作 R/W 0000h:输入 OFF、FF00h:输入 ON
/// </summary>
public
static
string
SDStop_Addr
=
"0123"
;
/// <summary>
/// 0061h 报警清除输入 (A-CLR) 操作 R/W 0000h:输入 OFF、FF00h:输入 ON
/// </summary>
public
static
string
Clear_Alarm_Addr
=
"0061"
;
/// <summary>
/// 1020h Save all parameters - 0 - 4294967295 2 R/W 参数写入 EEPROM 写入“6173h”后,实行 EEPROM 写入
/// </summary>
public
static
string
EEPROM_Param_Addr
=
"1020"
;
/// <summary>
/// 目标位置=600B
/// </summary>
public
static
string
TargetPostion
=
"600B"
;
/// <summary>
/// 实际位置=600F
/// </summary>
public
static
string
ActualPosition
=
"600F"
;
/// <summary>
/// BUSY状态=0140,0140h 动作执行状态 (BUSY) ReadOnly 0:未执行 1:执行中
public
static
string
BUSYStatus
=
"0140"
;
/// <summary>
/// HOME-CMP=0141,0141h 回原点完成状态 (HOME-CMP) ReadOnly 0:未完成 1:完成
/// </summary>
public
static
string
HOME_CMP_Status
=
"0141"
;
/// <summary>
/// 私服Ready状态,00A0h 伺服 Ready 状态 (S-RDY) ReadOnly 0:Ready OFF 1:Ready ON
/// </summary>
public
static
string
ServerOn_Status
=
"00A0"
;
/// <summary>
/// 报警状态=00A1,00A1h 报警状态 (ALM) ReadOnly 0:报警未发生 1:报警发生
/// </summary>
public
static
string
Alarm_Status
=
"00A1"
;
/// <summary>
/// 指定BlockNo=4414
/// </summary>
public
static
string
BlockNo
=
"4414"
;
/// <summary>
/// 读线圈01
/// </summary>
public
static
byte
CMD_ReadCoil
=
0x01
;
/// <summary>
/// 写线圈 05
/// </summary>
public
static
byte
CMD_WriteCoil
=
0x05
;
/// <summary>
/// 读寄存器03
/// </summary>
public
static
byte
CMD_ReadRegisters
=
0x03
;
/// <summary>
/// 写寄存器06
/// </summary>
public
static
byte
CMD_WriteRegisters
=
0x06
;
/// <summary>
/// 写多个线圈 0f
/// </summary>
public
static
byte
CMD_WriteMCoil
=
0x0F
;
/// <summary>
/// 写多个寄存器10
/// </summary>
public
static
byte
CMD_WriteMRegisters
=
0x10
;
/// <summary>
/// block0=原点返回,正方向
/// </summary>
public
static
string
Block_HomeMove0
=
"0"
;
/// <summary>
/// block1=原点返回,反方向
/// </summary>
public
static
string
Block_HomeMove1
=
"1"
;
/// <summary>
/// block2=绝对位置运动
/// </summary>
public
static
string
Block_AbsMove
=
"2"
;
/// <summary>
/// block3=相对位置运动
/// </summary>
public
static
string
Block_RelMove
=
"3"
;
/// <summary>
/// block4=正方向匀速运动
/// </summary>
public
static
string
Block_VolMove0
=
"4"
;
/// <summary>
/// block5=反方向匀速运动
/// </summary>
public
static
string
Block_VolMove1
=
"5"
;
/// <summary>
/// block6=减速停止
/// </summary>
public
static
string
Block_DelSpeedStop
=
"6"
;
/// <summary>
/// block7=紧急停止
/// </summary>
public
static
string
Block_SuddenStop
=
"7"
;
public
static
byte
[]
buildCheckData
(
byte
[]
sendData
,
int
length
)
{
ushort
pChecksum
=
0
;
AcSerialBean
.
CalculateCRC
(
sendData
,
length
,
out
pChecksum
);
string
checkStr
=
Convert
.
ToString
(
pChecksum
,
16
);
byte
[]
checkByte
=
AcSerialBean
.
StringToByte
(
checkStr
);
if
(
checkByte
.
Length
==
1
)
{
sendData
[
length
]
=
checkByte
[
0
];
sendData
[
length
+
1
]
=
0x00
;
}
else
{
sendData
[
length
+
1
]
=
checkByte
[
0
];
sendData
[
length
]
=
checkByte
[
1
];
}
return
sendData
;
}
public
static
byte
[]
GetWriteData
(
int
slvAddr
,
byte
cmd
,
string
addr
,
string
dataValue
,
int
length
)
{
// ( 2) 读取寄存器( 03h)
if
(
cmd
.
Equals
(
CMD_ReadRegisters
))
{
return
Get03WriteData
(
slvAddr
,
addr
,
length
);
}
else
if
(
cmd
.
Equals
(
CMD_WriteRegisters
))
{
// ( 4) 写入寄存器( 06h)
return
Get06WriteData
(
slvAddr
,
addr
,
dataValue
);
}
else
if
(
cmd
.
Equals
(
CMD_WriteCoil
))
{
return
Get05WriteData
(
slvAddr
,
addr
,
dataValue
);
}
else
if
(
cmd
.
Equals
(
CMD_ReadCoil
))
{
return
Get01WriteData
(
slvAddr
,
addr
,
length
);
}
return
null
;
}
private
static
byte
[]
Get05WriteData
(
int
slvAddr
,
string
addr
,
string
dataValue
)
{
byte
[]
sendData
=
new
byte
[
8
];
sendData
[
0
]
=
(
byte
)
slvAddr
;
sendData
[
1
]
=
CMD_WriteCoil
;
byte
[]
addrByte
=
AcSerialBean
.
StringToByte
(
addr
.
ToString
());
if
(
addrByte
.
Length
==
1
)
{
sendData
[
2
]
=
0x00
;
sendData
[
3
]
=
addrByte
[
0
];
}
else
if
(
addrByte
.
Length
==
2
)
{
sendData
[
3
]
=
addrByte
[
1
];
sendData
[
2
]
=
addrByte
[
0
];
}
byte
[]
dataByte
=
AcSerialBean
.
StringToByte
(
dataValue
);
if
(
dataByte
.
Length
==
1
)
{
sendData
[
4
]
=
0x00
;
sendData
[
5
]
=
dataByte
[
0
];
}
else
if
(
dataByte
.
Length
==
2
)
{
sendData
[
5
]
=
dataByte
[
1
];
sendData
[
4
]
=
dataByte
[
0
];
}
sendData
=
buildCheckData
(
sendData
,
sendData
.
Length
-
2
);
return
sendData
;
}
private
static
byte
[]
Get01WriteData
(
int
slvAddr
,
string
addr
,
int
length
)
{
byte
[]
sendData
=
new
byte
[
8
];
sendData
[
0
]
=
(
byte
)
slvAddr
;
sendData
[
1
]
=
CMD_ReadCoil
;
byte
[]
addrByte
=
AcSerialBean
.
StringToByte
(
addr
.
ToString
());
if
(
addrByte
.
Length
==
1
)
{
sendData
[
2
]
=
0x00
;
sendData
[
3
]
=
addrByte
[
0
];
}
else
if
(
addrByte
.
Length
==
2
)
{
sendData
[
3
]
=
addrByte
[
1
];
sendData
[
2
]
=
addrByte
[
0
];
}
byte
[]
dataByte
=
AcSerialBean
.
StringToByte
(
length
.
ToString
());
if
(
dataByte
.
Length
==
1
)
{
sendData
[
4
]
=
0x00
;
sendData
[
5
]
=
dataByte
[
0
];
}
else
if
(
dataByte
.
Length
==
2
)
{
sendData
[
4
]
=
dataByte
[
1
];
sendData
[
5
]
=
dataByte
[
0
];
}
sendData
=
buildCheckData
(
sendData
,
sendData
.
Length
-
2
);
return
sendData
;
}
private
static
byte
[]
Get03WriteData
(
int
slvAddr
,
string
addr
,
int
length
)
{
// ( 2) 读取寄存器( 03h)
//发送
//从站地址
//03h
//寄存器起始地址 高位
//低位
//寄存器数(N) 高位
//低位
//CRC 低位
//高位
byte
[]
sendData
=
new
byte
[
8
];
sendData
[
0
]
=
(
byte
)
slvAddr
;
sendData
[
1
]
=
CMD_ReadRegisters
;
byte
[]
addrByte
=
AcSerialBean
.
StringToByte
(
addr
.
ToString
());
if
(
addrByte
.
Length
==
1
)
{
sendData
[
2
]
=
0x00
;
sendData
[
3
]
=
addrByte
[
0
];
}
else
if
(
addrByte
.
Length
==
2
)
{
sendData
[
3
]
=
addrByte
[
1
];
sendData
[
2
]
=
addrByte
[
0
];
}
byte
[]
dataByte
=
AcSerialBean
.
StringToByte
(
length
.
ToString
());
if
(
dataByte
.
Length
==
1
)
{
sendData
[
4
]
=
0x00
;
sendData
[
5
]
=
dataByte
[
0
];
}
else
if
(
dataByte
.
Length
==
2
)
{
sendData
[
4
]
=
dataByte
[
1
];
sendData
[
5
]
=
dataByte
[
0
];
}
sendData
=
buildCheckData
(
sendData
,
sendData
.
Length
-
2
);
return
sendData
;
}
private
static
byte
[]
Get06WriteData
(
int
slvAddr
,
string
addr
,
string
dataValue
)
{
// ( 4) 写入寄存器( 06h)
//从站地址
//06h
//地址 高位
//低位
//変更数据 高位
//低位
//CRC 低位
//高位
byte
[]
sendData
=
new
byte
[
8
];
sendData
[
0
]
=
(
byte
)
slvAddr
;
sendData
[
1
]
=
CMD_WriteRegisters
;
byte
[]
addrByte
=
AcSerialBean
.
StringToByte
(
addr
.
ToString
());
if
(
addrByte
.
Length
==
1
)
{
sendData
[
2
]
=
0x00
;
sendData
[
3
]
=
addrByte
[
0
];
}
else
if
(
addrByte
.
Length
==
2
)
{
sendData
[
3
]
=
addrByte
[
1
];
sendData
[
2
]
=
addrByte
[
0
];
}
byte
[]
dataByte
=
AcSerialBean
.
StringToByte
(
dataValue
);
if
(
dataByte
.
Length
==
1
)
{
sendData
[
4
]
=
0x00
;
sendData
[
5
]
=
dataByte
[
0
];
}
else
if
(
dataByte
.
Length
==
2
)
{
sendData
[
4
]
=
dataByte
[
0
];
sendData
[
5
]
=
dataByte
[
1
];
//sendData[4] = dataByte[1];
//sendData[5] = dataByte[0];
}
sendData
=
buildCheckData
(
sendData
,
sendData
.
Length
-
2
);
return
sendData
;
}
}
}
source/DeviceLibrary/device/PanasonicServo/ACServerManager.cs
deleted
100644 → 0
查看文件 @
62061a7
using
OnlineStore.Common
;
using
OnlineStore.LoadCSVLibrary
;
using
System
;
using
System.Collections.Generic
;
using
System.IO.Ports
;
using
System.Linq
;
using
System.Text
;
using
System.Threading
;
namespace
OnlineStore.DeviceLibrary
{
/// <summary>
/// 外部调用的接口放在此文件中
/// </summary>
public
partial
class
ACServerManager
{
public
static
bool
IsShowMsg
=
false
;
private
static
int
SleepMSendons
=
20
;
private
static
int
ReviceOutTimeMS
=
100
;
private
static
Dictionary
<
string
,
Dictionary
<
string
,
int
>>
ComAddrValue
=
new
Dictionary
<
string
,
Dictionary
<
string
,
int
>>();
private
static
string
mapObj
=
""
;
private
static
int
GetAddrValue
(
string
portName
,
int
slvAddr
,
string
addr
)
{
int
value
=
-
1
;
try
{
string
name
=
portName
+
"_"
+
slvAddr
;
Dictionary
<
string
,
int
>
map
=
null
;
ComAddrValue
.
TryGetValue
(
name
,
out
map
);
if
(
map
==
null
)
{
return
-
1
;
}
if
(
map
.
ContainsKey
(
addr
))
{
return
map
[
addr
];
}
}
catch
(
Exception
ex
)
{
LogUtil
.
error
(
"UpdateAddrValue出错:"
+
ex
.
ToString
());
}
return
value
;
}
private
static
void
UpdateAddrValue
(
string
portName
,
int
slvAddr
,
string
addr
,
int
value
)
{
try
{
lock
(
mapObj
)
{
string
name
=
portName
+
"_"
+
slvAddr
;
Dictionary
<
string
,
int
>
map
=
null
;
ComAddrValue
.
TryGetValue
(
name
,
out
map
);
if
(
map
==
null
)
{
map
=
new
Dictionary
<
string
,
int
>();
ComAddrValue
.
Add
(
name
,
map
);
}
if
(
map
.
ContainsKey
(
addr
))
{
ComAddrValue
[
name
][
addr
]
=
value
;
}
else
{
ComAddrValue
[
name
].
Add
(
addr
,
value
);
}
}
}
catch
(
Exception
ex
)
{
LogUtil
.
error
(
"UpdateAddrValue出错:"
+
ex
.
ToString
());
}
}
public
static
void
ClearSpeed
()
{
LogUtil
.
info
(
"清理之前设置保存的速度列表"
);
ComAddrValue
=
new
Dictionary
<
string
,
Dictionary
<
string
,
int
>>();
}
public
static
bool
OpenPort
(
string
portName
)
{
if
(
serialBeanMap
.
ContainsKey
(
portName
))
{
return
true
;
}
int
ACBaudRate
=
ConfigAppSettings
.
GetIntValue
(
Setting_Init
.
ACBaudRate
);
if
(
ACBaudRate
<=
0
)
{
ACBaudRate
=
9600
;
}
AcSerialBean
bean
=
new
AcSerialBean
(
portName
,
ACBaudRate
,
Parity
.
Even
,
8
,
StopBits
.
One
);
bool
result
=
bean
.
openPort
();
if
(!
result
)
{
LogUtil
.
info
(
"打开串口【"
+
portName
+
"】【"
+
ACBaudRate
+
"】失败"
);
return
false
;
}
LogUtil
.
info
(
"打开串口【"
+
portName
+
"】【"
+
ACBaudRate
+
"】成功"
);
//bean.DataReceived += DataReceived;
if
(
serialBeanMap
.
ContainsKey
(
portName
))
{
serialBeanMap
.
Remove
(
portName
);
}
serialBeanMap
.
Add
(
portName
,
bean
);
return
true
;
}
public
static
void
ColsePort
(
string
portName
)
{
AcSerialBean
bean
=
GetSerialBean
(
portName
);
if
(
bean
==
null
)
{
LogUtil
.
info
(
"串口【"
+
portName
+
"】未打开,不需要关闭"
);
return
;
}
//清理缓存
bean
.
clearInBuffer
();
bean
.
clearOutBuffer
();
bean
.
closePort
();
if
(
serialBeanMap
.
ContainsKey
(
portName
))
{
serialBeanMap
.
Remove
(
portName
);
}
LogUtil
.
info
(
"ACServerManager 关闭串口【"
+
portName
+
"】 "
);
}
public
static
void
CloseAllPort
()
{
List
<
string
>
kes
=
new
List
<
string
>(
serialBeanMap
.
Keys
);
foreach
(
string
key
in
kes
)
{
ColsePort
(
key
);
}
}
/// <summary>
/// 是否成功打开伺服
/// </summary>
public
static
bool
ServerOnStatus
(
string
portName
,
int
slvAddr
)
{
if
(!
serialBeanMap
.
ContainsKey
(
portName
))
{
return
false
;
}
PreReadCoilAddr
=
ACCMDManager
.
ServerOn_Addr
;
byte
[]
dataArray
=
ACCMDManager
.
GetWriteData
(
slvAddr
,
ACCMDManager
.
CMD_ReadCoil
,
PreReadCoilAddr
,
"0000"
,
1
);
//SendData(portName,dataArray);
byte
[]
reviceData
=
SendCommand
(
portName
,
dataArray
,
ReviceOutTimeMS
,
6
);
int
result
=
GetCoilData
(
portName
,
reviceData
,
PreReadCoilAddr
);
//TODO
return
result
>=
1
;
}
/// <summary>
/// 是否原点返回完成
/// </summary>
public
static
bool
IsHomeMoveEnd
(
string
portName
,
int
slvAddr
)
{
int
status
=
GetHomeEndStatus
(
portName
,
slvAddr
);
if
(
status
>=
1
)
{
return
true
;
}
return
false
;
}
public
static
void
InitSlvAddr
(
string
portName
,
int
slvAddr
)
{
InitSlvAddr
(
portName
,
slvAddr
,
100
,
30
,
30
);
//InitSlvAddr(portName, slvAddr, 100, 30, 30, 100, 50, 30);
}
//把数字转换为四位的字符串
public
static
string
SpeedToStr
(
int
speed
,
int
length
)
{
string
str
=
String
.
Format
(
"{0:X}"
,
speed
);
return
str
.
PadLeft
(
length
,
'0'
);
}
public
static
void
InitSlvAddr
(
string
portName
,
int
slvAddr
,
int
targetSpeed
,
int
addSpeed
,
int
delSpeed
)
//public static void InitSlvAddr(string portName, int slvAddr,int targetSpeed,int addSpeed,int delSpeed,int homeHighSpeed,int homeLowSpeed,int homeAddSpeed)
{
LogUtil
.
info
(
"开始初始化伺服【"
+
portName
+
"】【"
+
slvAddr
+
"】"
);
//写入block
int
sleep
=
20
;
string
slvAddrStr
=
string
.
Format
(
strFromat
,
slvAddr
);
//block0=原点返回,正方向
string
str0
=
slvAddrStr
+
"104800 000408 00000420 00000000 ffff"
;
SendStrAndSleep
(
portName
,
str0
,
sleep
);
//block1=原点返回,反方向
string
str1
=
slvAddrStr
+
"104804 000408 04000420 00000000 ffff"
;
SendStrAndSleep
(
portName
,
str1
,
sleep
);
//block2=绝对位置运动
string
str2
=
slvAddrStr
+
"104808 000408 10000211EC78FFFF ffff"
;
SendStrAndSleep
(
portName
,
str2
,
sleep
);
//block3=相对位置运动
string
str3
=
slvAddrStr
+
"10480C 000408 10000111EC78FFFF ffff"
;
SendStrAndSleep
(
portName
,
str3
,
sleep
);
//block4=正方向匀速运动
string
str4
=
slvAddrStr
+
"104810 000408 10000311 00000000 ffff"
;
SendStrAndSleep
(
portName
,
str4
,
sleep
);
//block5=反方向匀速运动
string
str5
=
slvAddrStr
+
"104814 000408 14000311 00000000 ffff"
;
SendStrAndSleep
(
portName
,
str5
,
sleep
);
//block6=减速停止
string
str6
=
slvAddrStr
+
"104818 000408 00000500 00000000 ffff"
;
SendStrAndSleep
(
portName
,
str6
,
sleep
);
//block7=紧急停止
string
str7
=
slvAddrStr
+
"10481c 000408 00000510 00000000 ffff"
;
SendStrAndSleep
(
portName
,
str7
,
sleep
);
//0106460001009D12
//速度 V1 =100
string
v1
=
slvAddrStr
+
"064601 "
+
SpeedToStr
(
targetSpeed
,
4
)
+
" ffff"
;
SendStrAndSleep
(
portName
,
v1
,
sleep
);
//加速度 A1 =30
string
a1
=
slvAddrStr
+
"064611 "
+
SpeedToStr
(
addSpeed
,
4
)
+
" ffff"
;
SendStrAndSleep
(
portName
,
a1
,
sleep
);
//减速度 D1=30
string
d1
=
slvAddrStr
+
"064621 "
+
SpeedToStr
(
delSpeed
,
4
)
+
" ffff"
;
SendStrAndSleep
(
portName
,
d1
,
sleep
);
////原点返回高速 homeHighSpeed=100
//SendStrAndSleep(portName, slvAddrStr + "06 4637 " + SpeedToStr(homeHighSpeed, 4) + " ffff", sleep);
////原点返回抵速 homeLowSpeed=50
//SendStrAndSleep(portName, slvAddrStr + "06 4638 " + SpeedToStr(homeLowSpeed, 4) + " ffff", sleep);
////原点返回加速度=30
//SendStrAndSleep(portName, slvAddrStr + "06 4639 " + SpeedToStr(homeAddSpeed, 4) + " ffff", sleep);
//UpdateEEPROM(portName, slvAddr);
}
public
static
void
UpdateEEPROM
(
string
portName
,
int
slvAddr
)
{
string
addr
=
ACCMDManager
.
EEPROM_Param_Addr
;
string
data
=
"6173"
;
int
length
=
2
;
byte
[]
dataArray
=
ACCMDManager
.
GetWriteData
(
slvAddr
,
ACCMDManager
.
CMD_WriteRegisters
,
addr
,
data
,
length
);
SendData
(
portName
,
dataArray
,
5
);
}
public
static
void
ServoOn
(
string
portName
,
int
slvAddr
)
{
string
addr
=
ACCMDManager
.
ServerOn_Addr
;
string
data
=
"FF00"
;
//byte cmd = 0x05;
int
length
=
2
;
byte
[]
dataArray
=
ACCMDManager
.
GetWriteData
(
slvAddr
,
ACCMDManager
.
CMD_WriteCoil
,
addr
,
data
,
length
);
SendData
(
portName
,
dataArray
);
}
public
static
void
ServoOff
(
string
portName
,
int
slvAddr
)
{
string
addr
=
ACCMDManager
.
ServerOn_Addr
;
string
data
=
"0000"
;
//byte cmd = 0x05;
int
length
=
2
;
byte
[]
dataArray
=
ACCMDManager
.
GetWriteData
(
slvAddr
,
ACCMDManager
.
CMD_WriteCoil
,
addr
,
data
,
length
);
SendData
(
portName
,
dataArray
);
}
public
static
void
RelMove
(
string
portName
,
int
slvAddr
,
int
position
,
int
targetSpeed
)
{
//先更新速度
string
slvAddrStr
=
string
.
Format
(
strFromat
,
slvAddr
);
string
v1
=
slvAddrStr
+
"064601 "
+
SpeedToStr
(
targetSpeed
,
4
)
+
" ffff"
;
SendStrAndSleep
(
portName
,
v1
,
SleepMSendons
);
RelMove
(
portName
,
slvAddr
,
position
);
}
public
static
void
RelMove
(
string
portName
,
int
slvAddr
,
int
position
)
{
//int position = Convert.ToInt32(txtPosition.Text);
byte
[]
positionData
=
AcSerialBean
.
StringToByte
(
position
.
ToString
(
"X8"
));
byte
[]
data
=
AcSerialBean
.
StringToByte
(
"0110480C 000408 10000111EC78FFFF ffff"
);
data
[
0
]
=
(
byte
)
slvAddr
;
data
[
data
.
Length
-
1
]
=
0x00
;
data
[
data
.
Length
-
2
]
=
0x00
;
if
(
positionData
.
Length
==
4
)
{
data
[
11
]
=
positionData
[
2
];
data
[
12
]
=
positionData
[
3
];
data
[
13
]
=
positionData
[
0
];
data
[
14
]
=
positionData
[
1
];
}
else
if
(
positionData
.
Length
==
3
)
{
data
[
11
]
=
positionData
[
1
];
data
[
12
]
=
positionData
[
2
];
data
[
13
]
=
0x00
;
data
[
14
]
=
positionData
[
0
];
}
else
if
(
positionData
.
Length
==
2
)
{
data
[
11
]
=
positionData
[
0
];
data
[
12
]
=
positionData
[
1
];
data
[
13
]
=
0x00
;
data
[
14
]
=
0x00
;
}
else
if
(
positionData
.
Length
==
1
)
{
data
[
11
]
=
0x00
;
data
[
12
]
=
positionData
[
0
];
data
[
13
]
=
0x00
;
data
[
14
]
=
0x00
;
}
data
=
ACCMDManager
.
buildCheckData
(
data
,
data
.
Length
-
2
);
SendData
(
portName
,
data
);
System
.
Threading
.
Thread
.
Sleep
(
SleepMSendons
);
UpdateBlock
(
portName
,
slvAddr
,
ACCMDManager
.
Block_RelMove
);
OpenAndCloseSTB
(
portName
,
slvAddr
);
}
public
static
void
HomeMove
(
string
portName
,
int
slvAddr
,
int
speed
)
{
try
{
//先判断是否在原点,如果已经在原点,先向正方向走2000
int
homeSingle
=
GetHomeSingle
(
portName
,
slvAddr
);
if
(
homeSingle
.
Equals
(
1
))
{
int
isHomeEnd
=
GetHomeEndStatus
(
portName
,
slvAddr
);
if
(
isHomeEnd
.
Equals
(
1
))
{
int
value
=
2000
;
LogUtil
.
info
(
"轴【"
+
portName
+
"_"
+
slvAddr
+
"】原点返回时发现原点已亮且回过原点,需要先相对走"
+
value
);
RelMove
(
portName
,
slvAddr
,
value
);
bool
isStop
=
false
;
for
(
int
i
=
0
;
i
<=
10
;
i
++)
{
Thread
.
Sleep
(
200
);
if
(
GetBusyStatus
(
portName
,
slvAddr
).
Equals
(
0
))
{
isStop
=
true
;
LogUtil
.
info
(
"轴【"
+
portName
+
"_"
+
slvAddr
+
"】 相对走"
+
value
+
"已结束"
);
break
;
}
}
if
(!
isStop
)
{
LogUtil
.
info
(
"轴【"
+
portName
+
"_"
+
slvAddr
+
"】 相对走"
+
value
+
"已等待2分钟,直接停止"
);
SuddenStop
(
portName
,
slvAddr
);
}
}
else
{
int
volSpeed
=
Math
.
Abs
(
speed
/
5
);
int
time
=
1500
;
LogUtil
.
info
(
"轴【"
+
portName
+
"_"
+
slvAddr
+
"】原点返回时发现原点已亮但未回过原点,先匀速向上走"
+
time
+
",速度["
+
volSpeed
+
"]"
);
//需要匀速向上走
ACServerManager
.
SpeedMove
(
portName
,
slvAddr
,
volSpeed
);
Thread
.
Sleep
(
time
);
LogUtil
.
info
(
"轴【"
+
portName
+
"_"
+
slvAddr
+
"】匀速 已等待"
+
time
+
",直接停止"
);
SuddenStop
(
portName
,
slvAddr
);
Thread
.
Sleep
(
100
);
}
}
}
catch
(
Exception
ex
)
{
LogUtil
.
error
(
"轴【"
+
portName
+
"_"
+
slvAddr
+
"】原点返回前验证是否在原点出错:"
+
ex
.
StackTrace
);
}
//默认负方向原点返回
UpdateBlock
(
portName
,
slvAddr
,
ACCMDManager
.
Block_HomeMove1
);
Thread
.
Sleep
(
SleepMSendons
);
OpenAndCloseSTB
(
portName
,
slvAddr
);
}
public
static
void
SetSpeed
(
string
portName
,
int
slvAddr
,
int
speed
)
{
int
preSpeed
=
GetAddrValue
(
portName
,
slvAddr
,
ACCMDManager
.
Speed_Addr
);
if
((
preSpeed
.
Equals
(-
1
))
||
(!
preSpeed
.
Equals
(
Math
.
Abs
(
speed
))))
{
string
v1
=
slvAddr
+
"064601 "
+
ACServerManager
.
SpeedToStr
(
speed
,
4
)
+
" ffff"
;
LogUtil
.
debug
(
"轴【"
+
portName
+
"_"
+
slvAddr
+
"】更新速度为【"
+
speed
+
"】,发送数据【"
+
v1
+
"】"
);
Thread
.
Sleep
(
SleepMSendons
);
for
(
int
i
=
1
;
i
<=
3
;
i
++)
{
bool
result
=
SendStrAndSleep
(
portName
,
v1
,
SleepMSendons
);
if
(
result
)
{
break
;
}
else
{
LogUtil
.
error
(
"轴【"
+
portName
+
"_"
+
slvAddr
+
"】更新速度为【"
+
speed
+
"】,发送数据【"
+
v1
+
"】,第【"
+
i
+
"】次失败"
);
Thread
.
Sleep
(
SleepMSendons
);
}
}
UpdateAddrValue
(
portName
,
slvAddr
,
ACCMDManager
.
Speed_Addr
,
Math
.
Abs
(
speed
));
Thread
.
Sleep
(
SleepMSendons
);
}
}
public
static
void
SpeedMove
(
string
portName
,
int
slvAddr
,
int
speed
)
{
SetSpeed
(
portName
,
slvAddr
,
speed
);
if
(
speed
>
0
)
{
UpdateBlock
(
portName
,
slvAddr
,
ACCMDManager
.
Block_VolMove0
);
}
else
{
UpdateBlock
(
portName
,
slvAddr
,
ACCMDManager
.
Block_VolMove1
);
}
//Thread.Sleep(SleepMSendons);
OpenAndCloseSTB
(
portName
,
slvAddr
);
}
public
static
bool
isInPosition
(
ConfigMoveAxis
Axis
,
int
PPosition
)
{
int
outCount
=
ACServerManager
.
GetActualtPosition
(
Axis
.
DeviceName
,
Axis
.
GetAxisValue
());
int
errorCount
=
Math
.
Abs
(
outCount
-
PPosition
);
if
(
errorCount
<=
Axis
.
CanErrorCountMin
)
{
return
true
;
}
else
{
return
false
;
}
}
public
static
void
AbsMove
(
string
portName
,
int
slvAddr
,
int
targetPosition
,
int
targetSpeed
)
{
//先更新速度
string
slvAddrStr
=
string
.
Format
(
strFromat
,
slvAddr
);
int
preSpeed
=
GetAddrValue
(
portName
,
slvAddr
,
ACCMDManager
.
Speed_Addr
);
if
((
preSpeed
.
Equals
(-
1
))
||
(!
preSpeed
.
Equals
(
targetSpeed
)))
{
//速度 V1 =100
string
v1
=
slvAddrStr
+
"064601 "
+
SpeedToStr
(
targetSpeed
,
4
)
+
" ffff"
;
SendStrAndSleep
(
portName
,
v1
,
SleepMSendons
);
UpdateAddrValue
(
portName
,
slvAddr
,
ACCMDManager
.
Speed_Addr
,
targetSpeed
);
}
//绝对运动
AbsMove
(
portName
,
slvAddr
,
targetPosition
);
}
public
static
void
AbsMove
(
string
portName
,
int
slvAddr
,
int
position
)
{
//int position = Convert.ToInt32(txtPosition.Text, 10);
byte
[]
positionData
=
AcSerialBean
.
StringToByte
(
position
.
ToString
(
"X8"
));
byte
[]
data
=
AcSerialBean
.
StringToByte
(
"01104808 000408 10000211 EC78FFFF ffff"
);
data
[
0
]
=
(
byte
)
slvAddr
;
data
[
data
.
Length
-
1
]
=
0x00
;
data
[
data
.
Length
-
2
]
=
0x00
;
if
(
positionData
.
Length
==
4
)
{
data
[
11
]
=
positionData
[
2
];
data
[
12
]
=
positionData
[
3
];
data
[
13
]
=
positionData
[
0
];
data
[
14
]
=
positionData
[
1
];
}
else
if
(
positionData
.
Length
==
3
)
{
data
[
11
]
=
positionData
[
1
];
data
[
12
]
=
positionData
[
2
];
data
[
13
]
=
0x00
;
data
[
14
]
=
positionData
[
0
];
}
else
if
(
positionData
.
Length
==
2
)
{
data
[
11
]
=
positionData
[
0
];
data
[
12
]
=
positionData
[
1
];
data
[
13
]
=
0x00
;
data
[
14
]
=
0x00
;
}
else
if
(
positionData
.
Length
==
1
)
{
data
[
11
]
=
0x00
;
data
[
12
]
=
positionData
[
0
];
data
[
13
]
=
0x00
;
data
[
14
]
=
0x00
;
}
data
=
ACCMDManager
.
buildCheckData
(
data
,
data
.
Length
-
2
);
SendData
(
portName
,
data
);
Thread
.
Sleep
(
SleepMSendons
);
UpdateBlock
(
portName
,
slvAddr
,
ACCMDManager
.
Block_AbsMove
);
//data = ACCMDManager.GetWriteData(slvAddr, ACCMDManager.CMD_WriteRegisters, ACCMDManager.BlockNo, ACCMDManager.Block_AbsMove, 2);
//SendData(portName, data);
//Thread.Sleep(SleepMSendons);
OpenAndCloseSTB
(
portName
,
slvAddr
);
}
}
}
source/DeviceLibrary/device/PanasonicServo/ACServerManager_Partial.cs
deleted
100644 → 0
查看文件 @
62061a7
using
OnlineStore.Common
;
using
OnlineStore.LoadCSVLibrary
;
using
System
;
using
System.Collections.Generic
;
using
System.IO.Ports
;
using
System.Linq
;
using
System.Text
;
using
System.Threading
;
namespace
OnlineStore.DeviceLibrary
{
partial
class
ACServerManager
{
private
static
Dictionary
<
int
,
Dictionary
<
string
,
RegisterInfo
>>
LastDataMap
=
new
Dictionary
<
int
,
Dictionary
<
string
,
RegisterInfo
>>();
//private static SerialBean bean = null;
private
static
string
strFromat
=
"{0:X2}"
;
private
static
Dictionary
<
string
,
AcSerialBean
>
serialBeanMap
=
new
Dictionary
<
string
,
AcSerialBean
>();
private
static
AcSerialBean
GetSerialBean
(
string
portName
)
{
if
(
serialBeanMap
.
ContainsKey
(
portName
))
{
return
serialBeanMap
[
portName
];
}
return
null
;
}
public
static
bool
SendStrAndSleep
(
string
portName
,
string
str
,
int
sleepS
)
{
byte
[]
data
=
AcSerialBean
.
StringToByte
(
str
);
data
[
data
.
Length
-
1
]
=
0x00
;
data
[
data
.
Length
-
2
]
=
0x00
;
data
=
ACCMDManager
.
buildCheckData
(
data
,
data
.
Length
-
2
);
bool
result
=
SendData
(
portName
,
data
);
System
.
Threading
.
Thread
.
Sleep
(
sleepS
);
return
result
;
}
public
static
void
SaveData
(
string
portName
,
byte
slvAddr
,
string
regAddr
,
int
value
)
{
if
(
LastDataMap
.
ContainsKey
(
slvAddr
))
{
if
(
LastDataMap
[
slvAddr
].
ContainsKey
(
regAddr
))
{
LastDataMap
[
slvAddr
][
regAddr
]
=
new
RegisterInfo
(
slvAddr
,
regAddr
,
value
);
}
else
{
LastDataMap
[
slvAddr
].
Add
(
regAddr
,
new
RegisterInfo
(
slvAddr
,
regAddr
,
value
));
}
}
else
{
Dictionary
<
string
,
RegisterInfo
>
map
=
new
Dictionary
<
string
,
RegisterInfo
>();
map
.
Add
(
regAddr
,
new
RegisterInfo
(
slvAddr
,
regAddr
,
value
));
LastDataMap
.
Add
(
slvAddr
,
map
);
}
}
public
static
RegisterInfo
GetData
(
string
portName
,
byte
slvAddr
,
string
regAddr
)
{
if
(
LastDataMap
.
ContainsKey
(
slvAddr
))
{
if
(
LastDataMap
[
slvAddr
].
ContainsKey
(
regAddr
))
{
return
LastDataMap
[
slvAddr
][
regAddr
];
}
}
return
null
;
}
public
static
void
SendData
(
string
portName
,
byte
[]
data
,
int
reviceLength
)
{
if
(
data
==
null
)
{
return
;
}
byte
[]
returnData
=
SendCommand
(
portName
,
data
,
ReviceOutTimeMS
,
reviceLength
);
string
strSend
=
""
;
for
(
int
i
=
0
;
i
<
returnData
.
Length
;
i
++)
{
strSend
+=
string
.
Format
(
"{0:X2} "
,
returnData
[
i
]);
}
if
(
IsShowMsg
)
{
LogUtil
.
info
(
"串口"
+
portName
+
" 收到数据:"
+
strSend
+
""
);
}
}
public
static
bool
SendData
(
string
portName
,
byte
[]
data
)
{
if
(
data
==
null
)
{
return
false
;
}
bool
result
=
false
;
byte
[]
returnData
=
SendCommand
(
portName
,
data
,
ReviceOutTimeMS
,
8
,
out
result
);
if
(
returnData
!=
null
)
{
string
strSend
=
""
;
for
(
int
i
=
0
;
i
<
returnData
.
Length
;
i
++)
{
strSend
+=
string
.
Format
(
"{0:X2} "
,
returnData
[
i
]);
}
if
(
IsShowMsg
)
{
LogUtil
.
info
(
"串口"
+
portName
+
" 收到数据:"
+
strSend
+
""
);
}
}
return
result
;
}
/// <summary>
/// 发送数据并获取返回值
/// </summary>
/// <param name="data">发送的数据</param>
/// <param name="outTime">超时时间</param>
/// <returns>返回值的长度</returns>
public
static
byte
[]
SendCommand
(
string
portName
,
byte
[]
data
,
int
outTime
,
int
reviceLength
)
{
if
(
outTime
<
100
)
{
outTime
=
100
;
}
byte
[]
returnData
=
null
;
try
{
if
(
data
==
null
)
{
return
returnData
;
}
string
strSend
=
""
;
for
(
int
i
=
0
;
i
<
data
.
Length
;
i
++)
{
strSend
+=
string
.
Format
(
"{0:X2} "
,
data
[
i
]);
}
if
(
strSend
.
Equals
(
""
))
{
return
returnData
;
}
if
(
IsShowMsg
)
{
LogUtil
.
info
(
"串口"
+
portName
+
" 写入数据:"
+
strSend
+
""
);
}
AcSerialBean
bean
=
GetSerialBean
(
portName
);
if
(
bean
==
null
)
{
LogUtil
.
debug
(
"ACServerManager SendCommand 试图向未打开串口【"
+
portName
+
"】写入数据:"
+
strSend
+
"。"
);
}
else
{
int
ret
=
bean
.
SendCommand
(
data
,
ref
returnData
,
outTime
,
reviceLength
);
if
(!
ret
.
Equals
(
reviceLength
))
{
LogUtil
.
error
(
"串口"
+
portName
+
" 写入数据:"
+
strSend
+
",预计返回字节数【"
+
reviceLength
+
"】实际返回【"
+
ret
+
"】"
);
}
System
.
Threading
.
Thread
.
Sleep
(
2
);
}
}
catch
(
Exception
ex
)
{
LogUtil
.
info
(
ex
.
ToString
());
}
return
returnData
;
}
/// <summary>
/// 发送数据并获取返回值
/// </summary>
/// <param name="data">发送的数据</param>
/// <param name="outTime">超时时间</param>
/// <param name="result">返回结果,是否发送成功</param>
/// <returns>返回值的长度</returns>
public
static
byte
[]
SendCommand
(
string
portName
,
byte
[]
data
,
int
outTime
,
int
reviceLength
,
out
bool
result
)
{
if
(
outTime
<
100
)
{
outTime
=
100
;
}
byte
[]
returnData
=
null
;
result
=
false
;
try
{
if
(
data
==
null
)
{
return
returnData
;
}
string
strSend
=
""
;
for
(
int
i
=
0
;
i
<
data
.
Length
;
i
++)
{
strSend
+=
string
.
Format
(
"{0:X2} "
,
data
[
i
]);
}
if
(
strSend
.
Equals
(
""
))
{
return
returnData
;
}
if
(
IsShowMsg
)
{
LogUtil
.
info
(
"串口"
+
portName
+
" 写入数据:"
+
strSend
+
""
);
}
AcSerialBean
bean
=
GetSerialBean
(
portName
);
if
(
bean
==
null
)
{
LogUtil
.
debug
(
"ACServerManager SendCommand 试图向未打开串口【"
+
portName
+
"】写入数据:"
+
strSend
+
"。"
);
}
else
{
int
ret
=
bean
.
SendCommand
(
data
,
ref
returnData
,
outTime
,
reviceLength
);
if
(!
ret
.
Equals
(
reviceLength
))
{
LogUtil
.
error
(
"串口"
+
portName
+
" 写入数据:"
+
strSend
+
",预计返回字节数【"
+
reviceLength
+
"】实际返回【"
+
ret
+
"】"
);
}
else
{
result
=
true
;
}
System
.
Threading
.
Thread
.
Sleep
(
2
);
}
}
catch
(
Exception
ex
)
{
LogUtil
.
info
(
ex
.
ToString
());
}
return
returnData
;
}
public
static
void
WriteData
(
string
portName
,
int
slvAddr
,
string
addr
,
string
data
,
byte
cmd
,
int
length
)
{
byte
[]
dataArray
=
ACCMDManager
.
GetWriteData
(
slvAddr
,
cmd
,
addr
,
data
,
length
);
SendData
(
portName
,
dataArray
);
}
public
static
void
SendStr
(
string
portName
,
int
slvAddr
,
string
str
)
{
//string str = txtSendStr.Text;
byte
[]
data
=
AcSerialBean
.
StringToByte
(
str
);
data
[
data
.
Length
-
1
]
=
0x00
;
data
[
data
.
Length
-
2
]
=
0x00
;
data
=
ACCMDManager
.
buildCheckData
(
data
,
data
.
Length
-
2
);
SendData
(
portName
,
data
);
}
public
static
void
Stop
(
string
portName
,
int
slvAddr
)
{
//RunBlock(6);
string
addr
=
ACCMDManager
.
Stop_Addr
;
string
data
=
"FF00"
;
//byte cmd = 0x05;
int
length
=
2
;
byte
[]
dataArray
=
ACCMDManager
.
GetWriteData
(
slvAddr
,
ACCMDManager
.
CMD_WriteCoil
,
addr
,
data
,
length
);
SendData
(
portName
,
dataArray
);
System
.
Threading
.
Thread
.
Sleep
(
1000
);
data
=
"0000"
;
dataArray
=
ACCMDManager
.
GetWriteData
(
slvAddr
,
ACCMDManager
.
CMD_WriteCoil
,
addr
,
data
,
length
);
SendData
(
portName
,
dataArray
);
}
public
static
void
SuddenStop
(
ConfigMoveAxis
axis
)
{
if
(
GetBusyStatus
(
axis
.
DeviceName
,
axis
.
GetAxisValue
()).
Equals
(
1
))
{
SuddenStop
(
axis
.
DeviceName
,
axis
.
GetAxisValue
());
}
}
public
static
void
SuddenStop
(
string
portName
,
int
slvAddr
)
{
// RunBlock(7);
string
addr
=
ACCMDManager
.
SDStop_Addr
;
string
data
=
"FF00"
;
//byte cmd = 0x05;
int
length
=
2
;
byte
[]
dataArray
=
ACCMDManager
.
GetWriteData
(
slvAddr
,
ACCMDManager
.
CMD_WriteCoil
,
addr
,
data
,
length
);
SendData
(
portName
,
dataArray
);
System
.
Threading
.
Thread
.
Sleep
(
500
);
data
=
"0000"
;
dataArray
=
ACCMDManager
.
GetWriteData
(
slvAddr
,
ACCMDManager
.
CMD_WriteCoil
,
addr
,
data
,
length
);
SendData
(
portName
,
dataArray
);
}
public
static
void
OpenAndCloseSTB
(
string
portName
,
int
slvAddr
)
{
OnlyOpenSTB
(
portName
,
slvAddr
);
System
.
Threading
.
Thread
.
Sleep
(
200
);
CloseSTB
(
portName
,
slvAddr
);
System
.
Threading
.
Thread
.
Sleep
(
SleepMSendons
);
}
public
static
void
OnlyOpenSTB
(
string
portName
,
int
slvAddr
)
{
string
addr
=
ACCMDManager
.
STB_Addr
;
string
data
=
"FF00"
;
int
length
=
2
;
byte
[]
dataArray
=
ACCMDManager
.
GetWriteData
(
slvAddr
,
ACCMDManager
.
CMD_WriteCoil
,
addr
,
data
,
length
);
SendData
(
portName
,
dataArray
);
}
public
static
void
CloseSTB
(
string
portName
,
int
slvAddr
)
{
string
addr
=
ACCMDManager
.
STB_Addr
;
string
data
=
"0000"
;
int
length
=
2
;
byte
[]
dataArray
=
ACCMDManager
.
GetWriteData
(
slvAddr
,
ACCMDManager
.
CMD_WriteCoil
,
addr
,
data
,
length
);
SendData
(
portName
,
dataArray
);
}
public
static
void
UpdateBlock
(
string
portName
,
int
slvAddr
,
string
blockNum
)
{
int
preNum
=
GetAddrValue
(
portName
,
slvAddr
,
ACCMDManager
.
BlockNo
);
if
(
preNum
.
Equals
(-
1
)
||
(!
preNum
.
ToString
().
Equals
(
blockNum
)))
{
byte
[]
data
=
ACCMDManager
.
GetWriteData
(
slvAddr
,
ACCMDManager
.
CMD_WriteRegisters
,
ACCMDManager
.
BlockNo
,
blockNum
,
2
);
SendData
(
portName
,
data
);
int
value
=
Convert
.
ToInt16
(
blockNum
);
UpdateAddrValue
(
portName
,
slvAddr
,
ACCMDManager
.
BlockNo
,
value
);
Thread
.
Sleep
(
SleepMSendons
);
}
}
public
static
void
AlarmClear
(
string
portName
,
int
slvAddr
)
{
string
addr
=
ACCMDManager
.
Clear_Alarm_Addr
;
string
data
=
"FF00"
;
//byte cmd = 0x05;
int
length
=
2
;
byte
[]
dataArray
=
ACCMDManager
.
GetWriteData
(
slvAddr
,
ACCMDManager
.
CMD_WriteCoil
,
addr
,
data
,
length
);
SendData
(
portName
,
dataArray
);
System
.
Threading
.
Thread
.
Sleep
(
200
);
data
=
"0000"
;
dataArray
=
ACCMDManager
.
GetWriteData
(
slvAddr
,
ACCMDManager
.
CMD_WriteCoil
,
addr
,
data
,
length
);
SendData
(
portName
,
dataArray
);
}
public
static
void
CloseAlarmClear
(
string
portName
,
int
slvAddr
)
{
string
addr
=
ACCMDManager
.
Clear_Alarm_Addr
;
string
data
=
"0000"
;
//byte cmd = 0x05;
int
length
=
2
;
byte
[]
dataArray
=
ACCMDManager
.
GetWriteData
(
slvAddr
,
ACCMDManager
.
CMD_WriteCoil
,
addr
,
data
,
length
);
SendData
(
portName
,
dataArray
);
}
private
static
string
PreReadAddr
=
""
;
private
static
string
PreReadCoilAddr
=
""
;
public
static
int
GetRegisterData
(
string
portName
,
byte
[]
reviceData
,
string
Address
)
{
if
(
reviceData
!=
null
&&
reviceData
.
Length
>
0
)
{
string
strSend
=
""
;
for
(
int
i
=
0
;
i
<
reviceData
.
Length
;
i
++)
{
strSend
+=
string
.
Format
(
"{0:X2} "
,
reviceData
[
i
]);
}
if
(
IsShowMsg
)
{
LogUtil
.
info
(
"串口"
+
portName
+
" 收到数据:"
+
strSend
+
""
);
}
string
strFromat
=
"{0:X2}"
;
byte
slvAddrR
=
reviceData
[
0
];
int
lenth
=
reviceData
[
2
];
byte
cmd
=
reviceData
[
1
];
if
(
cmd
.
Equals
(
ACCMDManager
.
CMD_ReadRegisters
)
&&
reviceData
.
Length
>
6
&&
lenth
==
4
)
{
string
str
=
string
.
Format
(
strFromat
,
reviceData
[
5
])
+
string
.
Format
(
strFromat
,
reviceData
[
6
])
+
string
.
Format
(
strFromat
,
reviceData
[
3
])
+
string
.
Format
(
strFromat
,
reviceData
[
4
]);
int
value
=
Convert
.
ToInt32
(
str
.
Trim
().
Replace
(
" "
,
""
),
16
);
SaveData
(
portName
,
slvAddrR
,
Address
,
value
);
return
value
;
}
}
return
-
1
;
}
public
static
int
GetTargetPosition
(
string
portName
,
int
slvAddr
)
{
PreReadAddr
=
ACCMDManager
.
TargetPostion
;
byte
[]
dataArray
=
ACCMDManager
.
GetWriteData
(
slvAddr
,
ACCMDManager
.
CMD_ReadRegisters
,
ACCMDManager
.
TargetPostion
,
"0000"
,
2
);
// SendData(portName,dataArray);
byte
[]
reviceData
=
SendCommand
(
portName
,
dataArray
,
ReviceOutTimeMS
,
9
);
return
GetRegisterData
(
portName
,
reviceData
,
ACCMDManager
.
TargetPostion
);
}
public
static
int
GetActualtPosition
(
ConfigMoveAxis
axis
)
{
return
GetActualtPosition
(
axis
.
DeviceName
,
axis
.
GetAxisValue
());
}
public
static
int
GetActualtPosition
(
string
portName
,
int
slvAddr
)
{
PreReadAddr
=
ACCMDManager
.
ActualPosition
;
byte
[]
dataArray
=
ACCMDManager
.
GetWriteData
(
slvAddr
,
ACCMDManager
.
CMD_ReadRegisters
,
ACCMDManager
.
ActualPosition
,
"0000"
,
2
);
// SendData(portName,dataArray);
byte
[]
reviceData
=
SendCommand
(
portName
,
dataArray
,
ReviceOutTimeMS
,
9
);
int
result
=
-
1
;
for
(
int
i
=
1
;
i
<=
3
;
i
++)
{
result
=
GetRegisterData
(
portName
,
reviceData
,
ACCMDManager
.
ActualPosition
);
if
(!
result
.
Equals
(-
1
))
{
break
;
}
else
{
LogUtil
.
error
(
"第"
+
i
+
"次获取"
+
portName
+
"_"
+
slvAddr
+
"的实时位置"
+
result
);
}
}
return
result
;
}
public
static
int
GetCoilData
(
string
portName
,
byte
[]
reviceData
,
string
Address
)
{
if
(
reviceData
!=
null
&&
reviceData
.
Length
>
0
)
{
string
strSend
=
""
;
for
(
int
i
=
0
;
i
<
reviceData
.
Length
;
i
++)
{
strSend
+=
string
.
Format
(
"{0:X2} "
,
reviceData
[
i
]);
}
if
(
IsShowMsg
)
{
LogUtil
.
info
(
"串口"
+
portName
+
" 收到数据:"
+
strSend
+
""
);
}
string
strFromat
=
"{0:X2}"
;
byte
slvAddrR
=
reviceData
[
0
];
int
lenth
=
reviceData
[
2
];
byte
cmd
=
reviceData
[
1
];
if
(
cmd
.
Equals
(
ACCMDManager
.
CMD_ReadCoil
)
&&
reviceData
.
Length
>=
6
&&
lenth
==
1
)
{
string
str
=
string
.
Format
(
strFromat
,
reviceData
[
3
]);
int
value
=
Convert
.
ToInt32
(
str
.
Trim
().
Replace
(
" "
,
""
),
16
);
SaveData
(
portName
,
slvAddrR
,
Address
,
value
);
return
value
;
}
}
return
-
1
;
}
public
static
int
GetAlarmStatus
(
string
portName
,
int
slvAddr
)
{
PreReadCoilAddr
=
ACCMDManager
.
Alarm_Status
;
byte
[]
dataArray
=
ACCMDManager
.
GetWriteData
(
slvAddr
,
ACCMDManager
.
CMD_ReadCoil
,
PreReadCoilAddr
,
"0000"
,
1
);
//SendData(portName,dataArray);
byte
[]
reviceData
=
SendCommand
(
portName
,
dataArray
,
ReviceOutTimeMS
,
6
);
return
GetCoilData
(
portName
,
reviceData
,
PreReadCoilAddr
);
}
public
static
int
GetBusyStatus
(
string
portName
,
int
slvAddr
)
{
PreReadCoilAddr
=
ACCMDManager
.
BUSYStatus
;
byte
[]
dataArray
=
ACCMDManager
.
GetWriteData
(
slvAddr
,
ACCMDManager
.
CMD_ReadCoil
,
ACCMDManager
.
BUSYStatus
,
"0000"
,
1
);
//SendData(portName,dataArray);
byte
[]
reviceData
=
SendCommand
(
portName
,
dataArray
,
ReviceOutTimeMS
,
6
);
return
GetCoilData
(
portName
,
reviceData
,
ACCMDManager
.
BUSYStatus
);
}
public
static
int
GetHomeEndStatus
(
string
portName
,
int
slvAddr
)
{
PreReadCoilAddr
=
ACCMDManager
.
HOME_CMP_Status
;
byte
[]
dataArray
=
ACCMDManager
.
GetWriteData
(
slvAddr
,
ACCMDManager
.
CMD_ReadCoil
,
ACCMDManager
.
HOME_CMP_Status
,
"0000"
,
1
);
//SendData(portName,dataArray);
byte
[]
reviceData
=
SendCommand
(
portName
,
dataArray
,
ReviceOutTimeMS
,
6
);
return
GetCoilData
(
portName
,
reviceData
,
ACCMDManager
.
HOME_CMP_Status
);
}
public
static
int
GetHomeSingle
(
string
portName
,
int
slvAddr
)
{
PreReadCoilAddr
=
ACCMDManager
.
Home_Single
;
byte
[]
dataArray
=
ACCMDManager
.
GetWriteData
(
slvAddr
,
ACCMDManager
.
CMD_ReadCoil
,
ACCMDManager
.
Home_Single
,
"0000"
,
1
);
byte
[]
reviceData
=
SendCommand
(
portName
,
dataArray
,
ReviceOutTimeMS
,
6
);
return
GetCoilData
(
portName
,
reviceData
,
ACCMDManager
.
Home_Single
);
}
/// <summary>
/// 负极限
/// </summary>
public
static
int
GetLimitNegativeSingle
(
string
portName
,
int
slvAddr
)
{
PreReadCoilAddr
=
ACCMDManager
.
Home_Single
;
byte
[]
dataArray
=
ACCMDManager
.
GetWriteData
(
slvAddr
,
ACCMDManager
.
CMD_ReadCoil
,
ACCMDManager
.
Limit_Negative_Single
,
"0000"
,
1
);
byte
[]
reviceData
=
SendCommand
(
portName
,
dataArray
,
ReviceOutTimeMS
,
6
);
return
GetCoilData
(
portName
,
reviceData
,
ACCMDManager
.
Home_Single
);
}
/// <summary>
/// 负极限
/// </summary>
public
static
int
GetLimitNegativeSingle
(
ConfigMoveAxis
axis
)
{
return
GetLimitNegativeSingle
(
axis
.
DeviceName
,
axis
.
GetAxisValue
());
}
/// <summary>
/// 正极限
/// </summary>
public
static
int
GetLimitPositiveSingle
(
ConfigMoveAxis
axis
)
{
return
GetLimitPositiveSingle
(
axis
.
DeviceName
,
axis
.
GetAxisValue
());
}
/// <summary>
/// 正极限
/// </summary>
public
static
int
GetLimitPositiveSingle
(
string
portName
,
int
slvAddr
)
{
PreReadCoilAddr
=
ACCMDManager
.
Home_Single
;
byte
[]
dataArray
=
ACCMDManager
.
GetWriteData
(
slvAddr
,
ACCMDManager
.
CMD_ReadCoil
,
ACCMDManager
.
Limit_Positive_Single
,
"0000"
,
1
);
byte
[]
reviceData
=
SendCommand
(
portName
,
dataArray
,
ReviceOutTimeMS
,
6
);
return
GetCoilData
(
portName
,
reviceData
,
ACCMDManager
.
Home_Single
);
}
}
/// <summary>
/// 记录最后一次获得的寄存器的值
/// </summary>
public
class
RegisterInfo
{
public
RegisterInfo
(
int
slv
,
string
addr
,
int
data
)
{
this
.
SlvAddr
=
slv
;
this
.
RegisterAddr
=
addr
;
this
.
LastData
=
data
;
this
.
LastTime
=
new
DateTime
();
}
public
int
SlvAddr
{
get
;
set
;
}
public
string
RegisterAddr
{
get
;
set
;
}
public
int
LastData
{
get
;
set
;
}
public
DateTime
LastTime
{
get
;
set
;
}
}
}
source/DeviceLibrary/device/led/BaseLedManager.cs
0 → 100644
查看文件 @
4be5928
using
OnlineStore.Common
;
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Net
;
using
System.Text
;
using
System.Threading.Tasks
;
namespace
OnlineStore.DeviceLibrary
{
public
class
LEDManager
{
public
static
Dictionary
<
string
,
LEDBaseModule
>
deviceMap
=
new
Dictionary
<
string
,
LEDBaseModule
>();
public
static
byte
DefaultLight
=
100
;
public
static
int
DeviceLedType
=
ConfigAppSettings
.
GetIntValue
(
Setting_Init
.
DeviceLedType
);
public
static
string
ColorRule
=
ConfigAppSettings
.
GetValue
(
Setting_Init
.
ColorRuleConfig
).
ToUpper
();
public
static
string
DefaultIP
=
ConfigAppSettings
.
GetValue
(
Setting_Init
.
DefaultDeviceIP
);
public
static
LEDBaseModule
GetLedModule
(
string
ip
)
{
LEDBaseModule
led
=
null
;
if
(
deviceMap
.
ContainsKey
(
ip
))
{
led
=
deviceMap
[
ip
];
}
else
{
led
=
LEDBaseModule
.
GetModule
(
ip
);
deviceMap
.
Add
(
ip
,
led
);
}
return
led
;
}
public
static
void
Init
()
{
ColorRule
=
ConfigAppSettings
.
GetValue
(
Setting_Init
.
ColorRuleConfig
).
ToUpper
();
if
(
ColorRule
.
Length
==
3
&&
ColorRule
.
Contains
(
"R"
)
&&
ColorRule
.
Contains
(
"G"
)
&&
ColorRule
.
Contains
(
"B"
))
{
}
else
{
LEDManager
.
ColorRule
=
"RGB"
;
ConfigAppSettings
.
SaveValue
(
Setting_Init
.
ColorRuleConfig
,
LEDManager
.
ColorRule
);
}
LoadStatusDMX
();
}
public
static
void
LoadStatusDMX
()
{
StatusLedDmx
=
new
List
<
int
>();
string
str
=
ConfigAppSettings
.
GetValue
(
Setting_Init
.
StatusLedDmx
);
if
(
String
.
IsNullOrEmpty
(
str
))
{
str
=
"0"
;
ConfigAppSettings
.
SaveValue
(
Setting_Init
.
StatusLedDmx
,
str
);
}
string
[]
array
=
str
.
Split
(
';'
);
foreach
(
string
s
in
array
)
{
try
{
int
a
=
Convert
.
ToInt32
(
s
);
StatusLedDmx
.
Add
(
a
);
}
catch
(
Exception
ex
)
{
}
}
}
/// <summary>
/// 1=绿灯,2=黄灯
/// </summary>
public
static
int
CurrLedStatus
=
-
1
;
private
static
List
<
int
>
StatusLedDmx
=
new
List
<
int
>();
/// <summary>
/// 打开状态灯
/// </summary>
public
static
void
OpenStatusLights
(
string
color
=
"green"
)
{
CloseStatusLights
(
""
);
foreach
(
LEDBaseModule
module
in
deviceMap
.
Values
)
{
List
<
Light
>
sLed
=
new
List
<
Light
>();
foreach
(
int
dmx
in
StatusLedDmx
)
{
for
(
int
index
=
0
;
index
<
module
.
Max_Light
;
index
++)
{
if
(
"green"
.
Equals
(
color
))
{
CurrLedStatus
=
1
;
sLed
.
Add
(
Light
.
GreenLight
(
dmx
,
index
));
}
else
if
(
"yellow"
.
Equals
(
color
))
{
CurrLedStatus
=
2
;
sLed
.
Add
(
Light
.
BlueLight
(
dmx
,
index
));
}
}
}
module
.
LightOn
(
sLed
.
ToArray
());
}
}
/// <summary>
/// 关闭状态灯
/// </summary>
/// <param name="color"></param>
public
static
void
CloseStatusLights
(
string
color
=
""
)
{
CurrLedStatus
=
0
;
foreach
(
LEDBaseModule
module
in
deviceMap
.
Values
)
{
foreach
(
int
dmx
in
StatusLedDmx
)
{
module
.
AllLightOff
(
dmx
);
}
}
}
}
public
abstract
class
LEDBaseModule
{
protected
ushort
Max_DMX
=
16
;
public
int
Max_Light
=
170
;
public
string
ModuleIP
=
""
;
public
static
LEDBaseModule
GetModule
(
string
ip
)
{
//if (LEDManager.DeviceLedType.Equals(1))
//{
// LEDColorModule module = new LEDColorModule(ip);
// return module;
//}
//else if (LEDManager.DeviceLedType.Equals(2))
//{
LEDColorArtNet
module
=
new
LEDColorArtNet
(
ip
);
return
module
;
//}
//else
//{
// LEDSingleModule module = new LEDSingleModule(ip);
// return module;
//}
}
internal
LEDBaseModule
(
string
ip
)
{
ModuleIP
=
ip
;
}
public
abstract
void
AllLightOff
(
int
dmx
=
-
1
);
public
abstract
void
AllLightOn
(
int
dmx
=
-
1
);
public
abstract
void
AllLightOn
(
Light
light
);
public
abstract
void
OnlyLightOn
(
params
Light
[]
lights
);
public
abstract
void
LightOn
(
params
Light
[]
lights
);
public
abstract
void
LightOff
(
int
dmx
,
params
int
[]
lightIndexs
);
public
abstract
void
LightOff
(
params
Light
[]
lights
);
/// <summary>
/// 打包方法,可以将十六制字符串转成byte[] ,字符串没有空格
/// </summary>
/// <param name="s"></param>
/// <returns></returns>
protected
byte
[]
StringToByte
(
string
s
)
{
string
temps
=
s
.
Replace
(
" "
,
""
).
Replace
(
":"
,
""
);
if
(
temps
.
Length
%
2
!=
0
)
{
temps
=
"0"
+
temps
;
}
byte
[]
tempb
=
new
byte
[
temps
.
Length
/
2
];
int
j
=
0
;
for
(
int
i
=
0
;
i
<
temps
.
Length
;
i
=
i
+
2
,
j
++)
{
tempb
[
j
]
=
Convert
.
ToByte
(
temps
.
Substring
(
i
,
2
),
16
);
}
byte
[]
send
=
new
byte
[
j
];
Array
.
Copy
(
tempb
,
send
,
j
);
return
send
;
}
}
public
class
Light
{
public
static
string
defaultColor
=
"green"
;
public
static
byte
defaultR
=
0
;
public
static
byte
defaultG
=
50
;
public
static
byte
defaultB
=
0
;
public
static
Light
DefaultLight
(
int
dmxId
,
int
index
)
{
return
new
Light
(
dmxId
,
index
,
defaultR
,
defaultG
,
defaultB
,
200
);
}
public
static
Light
GetLight
(
int
dmxId
,
int
index
,
string
color
=
"green"
)
{
return
GetLight
(
dmxId
,
index
,
color
,
50
);
}
public
static
Light
[]
GetLights
(
int
dmxId
,
string
color
,
params
int
[]
indexes
)
{
List
<
Light
>
lights
=
new
List
<
Light
>();
foreach
(
int
index
in
indexes
)
{
lights
.
Add
(
GetLight
(
dmxId
,
index
,
color
));
}
return
lights
.
ToArray
();
}
public
static
Light
GetLight
(
int
dmxId
,
int
index
,
string
color
,
byte
bright
)
{
color
=
color
.
ToLower
();
switch
(
color
)
{
case
"green"
:
return
GreenLight
(
dmxId
,
index
,
bright
);
case
"red"
:
return
RedLight
(
dmxId
,
index
,
bright
);
case
"yellow"
:
return
YellowLight
(
dmxId
,
index
,
bright
);
case
"blue"
:
return
BlueLight
(
dmxId
,
index
,
bright
);
}
return
DefaultLight
(
dmxId
,
index
);
}
public
static
Light
RedLight
(
int
dmxId
,
int
index
,
byte
bright
=
50
)
{
return
new
Light
(
dmxId
,
index
,
bright
,
0
,
0
);
}
public
static
Light
YellowLight
(
int
dmxId
,
int
index
,
byte
bright
=
50
)
{
return
new
Light
(
dmxId
,
index
,
bright
,
bright
,
0
);
}
public
static
Light
BlueLight
(
int
dmxId
,
int
index
,
byte
bright
=
50
)
{
return
new
Light
(
dmxId
,
index
,
0
,
0
,
bright
);
}
public
static
Light
GreenLight
(
int
dmxId
,
int
index
,
byte
bright
=
50
)
{
return
new
Light
(
dmxId
,
index
,
0
,
bright
,
0
);
}
public
static
Light
CyanLight
(
int
dmxId
,
int
index
)
{
return
new
Light
(
dmxId
,
index
,
0
,
255
,
255
);
}
public
static
Light
ChocolateLight
(
int
dmxId
,
int
index
)
{
return
new
Light
(
dmxId
,
index
,
210
,
105
,
30
);
}
public
Light
(
int
dmxId
,
int
index
,
byte
Red
,
byte
Green
,
byte
Blue
,
byte
lightValue
=
200
)
{
this
.
dmx
=
dmxId
;
this
.
index
=
index
;
this
.
Red
=
Red
;
this
.
Green
=
Green
;
this
.
Blue
=
Blue
;
this
.
lightValue
=
lightValue
;
}
public
int
index
{
get
;
set
;
}
public
byte
Red
{
get
;
set
;
}
public
byte
Green
{
get
;
set
;
}
public
byte
Blue
{
get
;
set
;
}
/// <summary>
/// 单色灯
/// </summary>
public
static
Light
[]
GetLights
(
int
dmx
,
List
<
int
>
leds
,
byte
light
=
200
)
{
Light
[]
lights
=
new
Light
[
leds
.
Count
];
int
i
=
0
;
foreach
(
int
led
in
leds
)
{
lights
[
i
]
=
new
Light
(
dmx
,
led
,
light
);
i
++;
}
return
lights
;
}
/// <summary>
/// 单色灯
/// </summary>
/// <param name="dmx">区域ID</param>
/// <param name="index">索引号</param>
/// <param name="lightValue">亮度</param>
public
Light
(
int
dmx
,
int
index
,
byte
lightValue
)
{
this
.
index
=
index
;
this
.
dmx
=
dmx
;
this
.
lightValue
=
lightValue
;
}
public
int
dmx
=
-
1
;
public
byte
lightValue
=
LEDManager
.
DefaultLight
;
}
}
source/DeviceLibrary/device/led/LEDColorArtNet.cs
0 → 100644
查看文件 @
4be5928
using
OnlineStore.Common
;
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Net
;
using
System.Net.Sockets
;
using
System.Text
;
using
System.Threading.Tasks
;
namespace
OnlineStore.DeviceLibrary
{
/// <summary>
/// 三色灯ArtNet协议,RGB,红蓝绿
/// </summary>
public
class
LEDColorArtNet
:
LEDBaseModule
{
//private const ushort Max_DMX = 16;
//private int Max_Light = 170;
private
int
datalength
=
512
;
private
List
<
byte
[
]>
dmxDatas
=
null
;
private
string
phyIP
=
""
;
private
string
phyAddr
=
"00"
;
private
IPEndPoint
iep
=
null
;
internal
LEDColorArtNet
(
string
ip
)
:
base
(
ip
)
{
this
.
phyIP
=
ip
;
if
(!
String
.
IsNullOrEmpty
(
LEDManager
.
DefaultIP
))
{
try
{
string
[]
array
=
phyIP
.
Split
(
'.'
);
if
(
array
.
Length
==
4
)
{
int
addr
=
Convert
.
ToInt32
(
array
[
3
]);
phyAddr
=
((
byte
)
addr
).
ToString
(
"X2"
);
}
}
catch
(
Exception
ex
)
{
LogUtil
.
error
(
"IP【"
+
ip
+
"】解析phyAddr出错:"
+
ex
.
ToString
());
}
iep
=
new
IPEndPoint
(
IPAddress
.
Parse
(
LEDManager
.
DefaultIP
),
6454
);
}
else
{
phyAddr
=
"00"
;
iep
=
new
IPEndPoint
(
IPAddress
.
Parse
(
ip
),
6454
);
}
Max_Light
=
170
;
Max_DMX
=
16
;
datalength
=
512
;
Max_Light
=
datalength
/
3
;
dmxDatas
=
new
List
<
byte
[
]>
(
Max_DMX
);
AllLightOff
();
}
private
void
InitDatas
()
{
dmxDatas
=
new
List
<
byte
[
]>
(
Max_DMX
);
for
(
int
i
=
0
;
i
<
Max_DMX
;
i
++)
{
dmxDatas
.
Add
(
new
byte
[
datalength
]);
}
}
private
void
UpdateLightData
(
int
dmx
,
int
index
,
byte
red
=
0
,
byte
green
=
0
,
byte
blue
=
0
)
{
int
ldmx
=
dmx
;
int
lIndex
=
index
;
if
(
index
>=
Max_Light
)
{
ldmx
=
index
/
Max_Light
;
lIndex
=
index
%
Max_Light
;
}
if
(
ldmx
>=
dmxDatas
.
Count
)
{
LogUtil
.
error
(
" UpdateLightData error: dmx ["
+
ldmx
+
"] MAX_UNI["
+
Max_DMX
+
"]"
);
return
;
}
byte
[]
data
=
dmxDatas
[
ldmx
];
int
redIndex
=
LEDManager
.
ColorRule
.
IndexOf
(
'R'
);
int
greedIndex
=
LEDManager
.
ColorRule
.
IndexOf
(
'G'
);
int
blueIndex
=
LEDManager
.
ColorRule
.
IndexOf
(
'B'
);
//SPI第二通道为蓝色,DMX第二通道为绿色
data
[
lIndex
*
3
+
redIndex
]
=
red
;
data
[
lIndex
*
3
+
greedIndex
]
=
green
;
data
[
lIndex
*
3
+
blueIndex
]
=
blue
;
////SPI第二通道为蓝色,DMX第二通道为绿色
//data[lIndex * 3] = red;
//data[lIndex * 3 + 1] = green;
//data[lIndex * 3 + 2] = blue;
}
public
override
void
AllLightOff
(
int
dmx
=
-
1
)
{
InitDatas
();
PushToDevice
();
}
public
override
void
AllLightOn
(
int
dmx
=
-
1
)
{
AllLightOn
(
Light
.
DefaultLight
(
dmx
,
1
));
}
public
override
void
AllLightOn
(
Light
light
)
{
for
(
int
i
=
0
;
i
<
Max_DMX
;
i
++)
{
byte
[]
data
=
dmxDatas
[
i
];
for
(
int
index
=
0
;
index
<
Max_Light
;
index
++)
{
UpdateLightData
(
i
,
index
,
light
.
Red
,
light
.
Green
,
light
.
Blue
);
}
}
PushToDevice
();
}
/// <summary>
/// 只有某些灯亮,其他灯灭掉
/// </summary>
/// <param name="lights"></param>
public
override
void
OnlyLightOn
(
params
Light
[]
lights
)
{
AllLightOff
();
LightOn
(
lights
);
}
/// <summary>
/// 在之前的状态之上点亮某些灯
/// </summary>
/// <param name="lights"></param>
public
override
void
LightOn
(
params
Light
[]
lights
)
{
foreach
(
Light
light
in
lights
)
{
UpdateLightData
(
light
.
dmx
,
light
.
index
,
light
.
Red
,
light
.
Green
,
light
.
Blue
);
}
PushToDevice
();
}
public
override
void
LightOff
(
int
dmx
,
params
int
[]
lightIndexs
)
{
foreach
(
int
lightId
in
lightIndexs
)
{
UpdateLightData
(
dmx
,
lightId
,
0
,
0
,
0
);
}
PushToDevice
();
}
public
override
void
LightOff
(
params
Light
[]
lights
)
{
foreach
(
Light
light
in
lights
)
{
UpdateLightData
(
light
.
dmx
,
light
.
index
,
0
,
0
,
0
);
}
PushToDevice
();
}
private
void
PushToDevice
()
{
//闲置的时候会有不起作用的情况,这里多发几遍
for
(
int
time
=
0
;
time
<
2
;
time
++)
{
UdpClient
myUdpClient
=
new
UdpClient
();
try
{
for
(
int
i
=
0
;
i
<
dmxDatas
.
Count
;
i
++)
{
byte
[]
toSend
=
ToSPIData
(
i
,
dmxDatas
[
i
]);
myUdpClient
.
Send
(
toSend
,
toSend
.
Length
,
iep
);
}
}
catch
(
Exception
err
)
{
Console
.
WriteLine
(
"发送失败"
);
}
finally
{
myUdpClient
.
Close
();
}
}
}
/// <summary>
/// 46:51:35:31:32:4e:65:74: 数据包头[16]
//0b:00: OpCode
//40:
//06: 序列号
//00:
//01: 更新标准:0=写到缓存,未输出到dmxData;1=无缓存,立即输出到dmxData
//03: 0=没有广播,只控制指定域;1=对设备的所有端口广播;2=对某个子网内的所有域广播;3,对网络下的所有子网广播;0xff=对所有网络设备的所有口广播
//34: 字节的高4位为子网,字节的低4位为dmxData域,;子网:0~15,DMX域:0~15;
//02: IP灯光网络地址:0~127
//02:00: 通道数512
//00:00:00: 第0个灯RBG
//00:00:00: 第1个灯RBG
//...: 第n个灯RBG
/// </summary>
/// <returns></returns>
private
byte
[]
ToSPIData
(
int
dmxIndex
,
byte
[]
dmxData
)
{
string
ID
=
"41:72:74:2D:4E:65:74:00:"
;
// 8字节数据包头: "FQ512Net"
//string head = "46:51:35:31:32:4e:65:74:";// 8字节数据包头: "FQ512Net"
string
OpCode
=
"00:50:"
;
//指令2字节
string
ProVer
=
"000e"
;
string
seq
=
"00"
;
string
phy
=
"00"
;
phy
=
phyAddr
;
string
SubUni
=
"00"
;
SubUni
=
String
.
Format
(
"{0:X}"
,
dmxIndex
).
PadLeft
(
2
,
'0'
);
string
Net
=
"00"
;
int
len
=
dmxData
.
Length
;
string
str
=
String
.
Format
(
"{0:X}"
,
dmxData
.
Length
).
PadLeft
(
4
,
'0'
);
string
length
=
"0200"
;
length
=
str
;
//string Broadcast = "0";//0=没有广播,只控制指定域;1=对设备的所有端口广播;2=对某个子网内的所有域广播;3,对网络下的所有子网广播;0xff=对所有网络设备的所有口广播
//string SubUni = "00";// IP灯光子网地址:0~255;子网又可分,字节的高4位为子网,字节的低4位为dmxData域,;子网:0~15,DMX域:0~15;
//string net = "" + dmxIndex + "00"; //IP灯光网络地址:0~127
string
preStr
=
ID
+
OpCode
+
ProVer
+
seq
+
phy
+
SubUni
+
Net
+
length
;
// preStr = "4172742d4e657400:0050:";
byte
[]
preBytes
=
StringToByte
(
preStr
);
byte
[]
toSend
=
new
byte
[
preBytes
.
Length
+
dmxData
.
Length
];
Array
.
Copy
(
preBytes
,
0
,
toSend
,
0
,
preBytes
.
Length
);
Array
.
Copy
(
dmxData
,
0
,
toSend
,
preBytes
.
Length
,
dmxData
.
Length
);
return
toSend
;
}
//41 72 74 2D 4E 65 74 00 00 20 00 0E 00 00
// Artnet 地址
//Artnet 协议中,设备的设置一般为 X:Y,其中 X 为 subnet, Y 为 universe,均为 16
//进制,共可以容纳 256 个 Universe。此时对应的控台端,当设置对应的 Universe
//的时候应注意 16 进制到 10 进制的转换。比如 Artnet 协议设备端(Arkaos)设
//置为 2:1,则控台端应设备为 16*2+1 = 33.
//控台的 IP 地址应设置为:2.B.C.D ,其中 BCD 为 0-255
//41 72 74 2D 4E 65 74 00 00 50 00 0E 00 00 00 00 02 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
}
}
source/DeviceLibrary/device/weights/OKLE.cs
deleted
100644 → 0
查看文件 @
62061a7
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
using
System.Threading.Tasks
;
namespace
OnlineStore.DeviceLibrary
{
public
class
OKLE
{
private
byte
[]
buffer
;
private
bool
receive
;
private
System
.
IO
.
Ports
.
SerialPort
port
;
public
OKLE
()
{
port
=
new
System
.
IO
.
Ports
.
SerialPort
{
BaudRate
=
9600
,
//设备支持4800,9600,19200,38400,57600,115200
DataBits
=
8
,
StopBits
=
System
.
IO
.
Ports
.
StopBits
.
One
,
Parity
=
System
.
IO
.
Ports
.
Parity
.
None
};
port
.
DataReceived
+=
Port_DataReceived
;
}
/// <summary>
/// 打开或关闭状态
/// </summary>
public
bool
IsOpen
{
get
{
return
port
.
IsOpen
;
}
}
/// <summary>
/// 打开串口
/// </summary>
/// <param name="comName">串口名</param>
public
void
Open
(
string
comName
)
{
port
.
PortName
=
comName
;
try
{
port
.
Open
();
}
catch
(
Exception
ex
)
{
}
}
/// <summary>
/// 关闭串口
/// </summary>
public
void
Close
()
{
port
.
Close
();
}
/// <summary>
/// 读取数据
/// </summary>
/// <param name="addr">起始地址</param>
/// <returns></returns>
public
int
Read
(
short
addr
)
{
if
(!
IsOpen
)
return
0
;
byte
[]
cmd
=
ReadCmd
(
addr
,
1
);
receive
=
false
;
port
.
Write
(
cmd
,
0
,
cmd
.
Length
);
bool
rtn
=
WaitReceive
();
if
(
rtn
)
rtn
=
SameReturn
(
cmd
);
if
(
rtn
)
{
int
num
=
buffer
[
3
]
*
256
+
buffer
[
4
];
return
num
;
}
else
{
return
0
;
}
}
/// <summary>
/// 读取数据
/// </summary>
/// <param name="addr">起始地址</param>
/// <param name="count">寄存器数量</param>
/// <returns></returns>
public
int
[]
Read
(
short
addr
,
short
count
)
{
if
(!
IsOpen
)
return
null
;
byte
[]
cmd
=
ReadCmd
(
addr
,
count
);
receive
=
false
;
port
.
Write
(
cmd
,
0
,
cmd
.
Length
);
bool
rtn
=
WaitReceive
();
if
(
rtn
)
rtn
=
SameReturn
(
cmd
);
if
(
rtn
)
{
int
len
=
buffer
[
2
];
//字节数
int
[]
num
=
new
int
[
len
/
2
];
for
(
int
i
=
0
;
i
<
num
.
Length
;
i
++)
{
int
idx
=
3
+
i
*
2
;
num
[
i
]
=
buffer
[
idx
]
*
256
+
buffer
[
idx
+
1
];
}
return
num
;
}
else
{
return
null
;
}
}
/// <summary>
/// 等待数据接收
/// </summary>
/// <returns></returns>
private
bool
WaitReceive
()
{
int
sum
=
0
;
while
(
true
)
{
System
.
Threading
.
Thread
.
Sleep
(
50
);
sum
+=
50
;
if
(
receive
)
return
true
;
if
(!
IsOpen
)
return
false
;
if
(
sum
>=
3000
)
return
false
;
}
}
/// <summary>
/// 串口数据接收
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private
void
Port_DataReceived
(
object
sender
,
System
.
IO
.
Ports
.
SerialDataReceivedEventArgs
e
)
{
System
.
Threading
.
Thread
.
Sleep
(
50
);
byte
[]
buff
=
new
byte
[
port
.
ReadBufferSize
];
int
len
=
port
.
Read
(
buff
,
0
,
buff
.
Length
);
Array
.
Copy
(
buff
,
buffer
,
len
);
receive
=
true
;
}
/// <summary>
/// CRC16冗余校验
/// </summary>
/// <param name="buff"></param>
/// <param name="count"></param>
/// <param name="high"></param>
/// <param name="low"></param>
private
void
CRC16
(
byte
[]
buff
,
int
count
,
out
byte
high
,
out
byte
low
)
{
int
crc
=
0xFFFF
;
int
bit
;
for
(
int
i
=
0
;
i
<
count
;
i
++)
{
crc
^=
buff
[
i
];
for
(
int
j
=
0
;
j
<
8
;
j
++)
{
bit
=
crc
&
1
;
crc
>>=
1
;
if
(
bit
==
0
)
{
//crc >>= 1;
}
else
crc
^=
0xA001
;
}
}
low
=
Convert
.
ToByte
(
crc
&
255
);
high
=
Convert
.
ToByte
((
crc
>>
8
)
&
255
);
}
/// <summary>
/// 读取命令,功能码03
/// </summary>
/// <param name="addr"></param>
/// <param name="count"></param>
/// <returns></returns>
private
byte
[]
ReadCmd
(
short
addr
,
short
count
)
{
byte
[]
addrArr
=
BitConverter
.
GetBytes
(
addr
);
byte
[]
countArr
=
BitConverter
.
GetBytes
(
count
);
byte
[]
cmd
=
new
byte
[
8
];
cmd
[
0
]
=
0x01
;
//模块地址
cmd
[
1
]
=
0x03
;
//功能码
cmd
[
2
]
=
addrArr
[
1
];
//高8位
cmd
[
3
]
=
addrArr
[
0
];
//低8位
cmd
[
4
]
=
countArr
[
1
];
//高8位
cmd
[
5
]
=
countArr
[
0
];
//低8位
//CRC16校验
CRC16
(
cmd
,
6
,
out
byte
high
,
out
byte
low
);
cmd
[
6
]
=
low
;
cmd
[
7
]
=
high
;
return
cmd
;
}
/// <summary>
/// 判断是同一条命令的返回值
/// </summary>
/// <param name="cmd"></param>
/// <returns></returns>
private
bool
SameReturn
(
byte
[]
cmd
)
{
//同一个功能码应答
if
(
cmd
[
0
]
==
buffer
[
0
]
&&
cmd
[
1
]
==
buffer
[
1
])
{
//CRC校验是否相同
int
len
=
cmd
.
Length
-
2
;
CRC16
(
cmd
,
len
,
out
byte
high
,
out
byte
low
);
return
cmd
[
len
]
==
low
&&
cmd
[
len
+
1
]
==
high
;
}
else
{
return
false
;
}
}
}
}
source/DeviceLibrary/device/weights/OKLEController.cs
deleted
100644 → 0
查看文件 @
62061a7
using
OnlineStore.Common
;
using
System
;
using
System.Collections.Generic
;
using
System.IO.Ports
;
using
System.Linq
;
using
System.Text
;
using
System.Threading.Tasks
;
namespace
OnlineStore.DeviceLibrary
{
public
class
OKLEController
{
private
static
int
bautRate
=
9600
;
//波特率
private
static
Parity
parity
=
Parity
.
None
;
//校验位
private
static
int
dataBits
=
8
;
//数据位
private
static
StopBits
stopBits
=
StopBits
.
One
;
//停止位
private
static
Dictionary
<
string
,
AcSerialBean
>
SerialMap
=
new
Dictionary
<
string
,
AcSerialBean
>();
private
static
string
LogName
=
""
;
private
static
AcSerialBean
GetSerialBean
(
string
port
)
{
if
(
SerialMap
.
ContainsKey
(
port
))
{
return
SerialMap
[
port
];
}
return
null
;
}
public
static
void
OpenAll
(
string
[]
ports
)
{
foreach
(
string
port
in
ports
)
{
Init
(
port
);
}
}
public
static
bool
Init
(
string
port
)
{
if
(
SerialMap
.
ContainsKey
(
port
))
{
return
true
;
}
LogName
=
"[OKLE_"
+
port
+
"]"
;
AcSerialBean
sb
=
new
AcSerialBean
(
port
,
bautRate
,
parity
,
dataBits
,
stopBits
);
try
{
if
(
sb
.
openPort
())
{
if
(
SerialMap
.
ContainsKey
(
port
))
{
SerialMap
.
Remove
(
port
);
}
SerialMap
.
Add
(
port
,
sb
);
return
true
;
}
else
{
LogUtil
.
error
(
LogName
+
"串口打开失败!"
);
return
false
;
}
}
catch
(
Exception
ex
)
{
LogUtil
.
error
(
LogName
+
"打开出错:"
+
ex
.
ToString
());
}
return
true
;
}
public
static
bool
IsRun
(
string
port
)
{
if
(
GetSerialBean
(
port
)
!=
null
)
{
return
true
;
}
return
false
;
}
/// <summary>
/// 释放资源
/// </summary>
public
static
void
Release
(
params
string
[]
ports
)
{
if
(
ports
.
Length
<=
0
)
{
ports
=
(
new
List
<
string
>(
SerialMap
.
Keys
)).
ToArray
();
}
foreach
(
string
port
in
ports
)
{
try
{
AcSerialBean
sb
=
GetSerialBean
(
port
);
if
(
sb
!=
null
)
{
sb
.
closePort
();
}
//IsRun = false;
SerialMap
.
Remove
(
port
);
}
catch
(
Exception
ex
)
{
LogUtil
.
error
(
"Release OKLE port ["
+
port
+
"] error :"
+
ex
.
ToString
());
}
}
}
public
static
bool
Reset
(
string
port
)
{
AcSerialBean
sb
=
GetSerialBean
(
port
);
if
(
sb
==
null
)
{
return
false
;
}
LogName
=
"[OKLE_"
+
port
+
"]"
;
//12.1.4执行手动置零
//指令格式:01 10 00 5E 00 01 02 00 01 6A EE
byte
[]
sendData
=
new
byte
[
11
];
sendData
[
0
]
=
0x01
;
sendData
[
1
]
=
0x10
;
sendData
[
2
]
=
0x00
;
sendData
[
3
]
=
0x5E
;
sendData
[
4
]
=
0x00
;
sendData
[
5
]
=
0x01
;
sendData
[
6
]
=
0x02
;
sendData
[
7
]
=
0x00
;
sendData
[
8
]
=
0x01
;
sendData
[
9
]
=
0x00
;
sendData
[
10
]
=
0x00
;
sendData
=
buildCheckData
(
sendData
,
sendData
.
Length
-
2
);
string
str
=
AcSerialBean
.
byteToHexStr
(
sendData
);
LogUtil
.
debug
(
LogName
+
"发送数据:"
+
str
);
byte
[]
reviceData
=
new
byte
[
9
];
bool
isOk
=
false
;
sb
.
SendCommand
(
sendData
,
ref
reviceData
,
100
,
out
isOk
);
return
isOk
;
}
public
static
double
queryData
(
string
port
)
{
double
weight
=
0d
;
AcSerialBean
sb
=
GetSerialBean
(
port
);
if
(
sb
==
null
)
{
return
weight
;
}
LogName
=
"[OKLE_"
+
port
+
"]"
;
//12..1.2读取力值(毛重)指令,指令格式:01 03 00 50 00 02 C4 1A
byte
[]
sendData
=
new
byte
[
8
];
sendData
[
0
]
=
0x01
;
sendData
[
1
]
=
0x03
;
sendData
[
2
]
=
0x00
;
sendData
[
3
]
=
0x50
;
sendData
[
4
]
=
0x00
;
sendData
[
5
]
=
0x02
;
sendData
[
6
]
=
0x00
;
sendData
[
7
]
=
0x00
;
sendData
=
buildCheckData
(
sendData
,
sendData
.
Length
-
2
);
string
str
=
AcSerialBean
.
byteToHexStr
(
sendData
);
LogUtil
.
debug
(
LogName
+
"发送数据:"
+
str
);
byte
[]
reviceData
=
new
byte
[
9
];
bool
isOk
=
false
;
sb
.
SendCommand
(
sendData
,
ref
reviceData
,
100
,
out
isOk
);
return
getReviceData
(
reviceData
);
}
private
static
double
getReviceData
(
byte
[]
dataArray
)
{
double
value
=
0d
;
try
{
if
(
dataArray
.
Length
>=
9
)
{
//返回格式:01 03 04 FF FF C1 F0 AB C3(数据根据实际情况变化)
//地址 功能码 字节数 第一组寄存器数据 第二组寄存器数据 CRC16校验
//01 03 04 FF FF C1 F0 AB C3
string
highV
=
String
.
Format
(
"{0:X2}"
,
dataArray
[
3
])
+
String
.
Format
(
"{0:X2}"
,
dataArray
[
4
]);
string
lowV
=
String
.
Format
(
"{0:X2}"
,
dataArray
[
5
])
+
String
.
Format
(
"{0:X2}"
,
dataArray
[
6
]);
value
=
(
double
)
Convert
.
ToInt32
(
highV
+
lowV
,
16
)
/
10000
;
}
}
catch
(
Exception
ex
)
{
LogUtil
.
info
(
LogName
+
"转换出错:"
+
ex
.
ToString
());
}
return
value
;
}
private
static
byte
[]
buildCheckData
(
byte
[]
sendData
,
int
length
)
{
ushort
pChecksum
=
0
;
AcSerialBean
.
CalculateCRC
(
sendData
,
length
,
out
pChecksum
);
string
checkStr
=
Convert
.
ToString
(
pChecksum
,
16
);
byte
[]
checkByte
=
AcSerialBean
.
StringToByte
(
checkStr
);
if
(
checkByte
.
Length
==
1
)
{
sendData
[
length
]
=
checkByte
[
0
];
sendData
[
length
+
1
]
=
0x00
;
}
else
{
sendData
[
length
+
1
]
=
checkByte
[
0
];
sendData
[
length
]
=
checkByte
[
1
];
}
return
sendData
;
}
}
}
source/DeviceLibrary/store/InOutParam.cs
查看文件 @
4be5928
...
...
@@ -9,8 +9,7 @@ namespace OnlineStore.DeviceLibrary
public
class
InOutParam
{
public
MoveType
paramType
=
MoveType
.
None
;
public
InOutParam
(
MoveType
type
,
string
posId
,
string
code
=
""
,
int
plateH
=
0
,
int
plateW
=
0
,
int
weight
=
0
,
string
targetPosId
=
""
,
string
targetCode
=
""
,
int
targetWeight
=
0
,
int
stirSeconds
=
0
)
public
InOutParam
(
MoveType
type
,
string
posId
,
string
code
=
""
,
int
plateH
=
0
,
int
plateW
=
0
)
{
position
=
null
;
PosCode
=
code
;
...
...
@@ -19,10 +18,6 @@ namespace OnlineStore.DeviceLibrary
this
.
PlateW
=
plateW
;
this
.
PlateH
=
plateH
;
this
.
paramType
=
type
;
this
.
TarPosId
=
targetPosId
;
this
.
TarPosCode
=
targetCode
;
this
.
TarWeight
=
targetWeight
;
this
.
StirSecsond
=
stirSeconds
;
}
public
InOutParam
(
MoveType
paramType
,
string
posId
,
StoreMoveP
linePosition
,
string
wareNo
=
""
)
...
...
@@ -33,58 +28,29 @@ namespace OnlineStore.DeviceLibrary
MoveP
=
linePosition
;
this
.
paramType
=
paramType
;
}
public
static
InOutParam
NewMovePosParam
(
string
posId
,
string
code
,
int
weight
,
string
targetPosId
,
string
tcode
,
int
tweight
)
{
InOutParam
p
=
new
InOutParam
(
MoveType
.
MovePos
,
posId
,
code
,
0
,
0
,
weight
,
targetPosId
,
tcode
,
tweight
);
return
p
;
}
public
static
InOutParam
NewStirParam
(
string
posId1
,
string
code1
,
int
weight1
,
string
targetPosId2
,
string
tcode2
,
int
tweight2
,
int
stirSeconds
)
{
InOutParam
p
=
new
InOutParam
(
MoveType
.
MovePos
,
posId1
,
code1
,
0
,
0
,
weight1
,
targetPosId2
,
tcode2
,
tweight2
,
stirSeconds
);
return
p
;
}
public
string
ToStr
()
{
string
doorT
=
"中间夹具"
;
if
(
DoorPosType
.
Equals
(
1
))
{
doorT
=
"左侧锡膏"
;
}
else
if
(
DoorPosType
.
Equals
(
1
))
if
(
paramType
.
Equals
(
MoveType
.
InStore
))
{
doorT
=
"右侧锡膏"
;
}
if
(
paramType
.
Equals
(
MoveType
.
MovePos
))
{
return
"【回温移库:"
+
PosId
+
" -> "
+
TarPosId
+
",["
+
PosCode
+
"]["
+
PlateW
+
"X"
+
PlateH
+
"]】"
;
}
else
if
(
paramType
.
Equals
(
MoveType
.
Stirring
))
{
return
"【搅拌:"
+
PosId
+
"(["
+
Weight
+
"]["
+
PosCode
+
"]) -> "
+
TarPosId
+
"(["
+
TarWeight
+
"]["
+
TarPosCode
+
"]) 】"
;
}
else
if
(
paramType
.
Equals
(
MoveType
.
InStore
))
{
return
"【入库:"
+
doorT
+
" -> "
+
PosId
+
",["
+
PosCode
+
"]["
+
PlateW
+
"X"
+
PlateH
+
"]】"
;
return
"【入库:"
+
PosId
+
" ,["
+
PosCode
+
"]["
+
PlateW
+
"X"
+
PlateH
+
"]】"
;
}
else
if
(
paramType
.
Equals
(
MoveType
.
OutStore
))
{
return
"【出库:"
+
PosId
+
" -> "
+
doorT
+
",["
+
PosCode
+
"]["
+
PlateW
+
"X"
+
PlateH
+
"]】"
;
return
"【出库:"
+
PosId
+
",["
+
PosCode
+
"]["
+
PlateW
+
"X"
+
PlateH
+
"]】"
;
}
return
"["
+
PosId
+
"]["
+
PosCode
+
"]["
+
PlateW
+
"X"
+
PlateH
+
"]"
;
}
private
Vertical
Store
Position
position
=
null
;
private
VerticalPosition
position
=
null
;
public
Vertical
Store
Position
Position
public
VerticalPosition
Position
{
get
{
if
(
position
==
null
)
{
position
=
CSVPositionReader
<
Vertical
Store
Position
>.
GetPositon
(
PosId
);
position
=
CSVPositionReader
<
VerticalPosition
>.
GetPositon
(
PosId
);
}
return
position
;
}
...
...
@@ -98,10 +64,7 @@ namespace OnlineStore.DeviceLibrary
/// 位置坐标名(对应配置表的位置)
/// </summary>
public
string
PosId
=
""
;
/// <summary>
/// 门类型,0=中间夹具,1=左侧锡膏,2=右侧锡膏
/// </summary>
public
int
DoorPosType
=
0
;
public
StoreMoveP
MoveP
{
get
;
set
;
}
/// <summary>
...
...
@@ -113,47 +76,7 @@ namespace OnlineStore.DeviceLibrary
/// </summary>
public
int
PlateW
=
0
;
/// <summary>
/// 重量 单位 g
/// </summary>
public
int
Weight
=
0
;
/// <summary>
/// 搅拌时间,秒
/// </summary>
public
int
StirSecsond
=
600
;
/// <summary>
/// 目标库位号,回温移库时表示回温区库位
/// </summary>
public
string
TarPosId
=
""
;
public
string
TarPosCode
=
""
;
public
int
TarWeight
=
0
;
private
VerticalStorePosition
tarPosition
=
null
;
public
VerticalStorePosition
TarPosition
{
get
{
if
(
tarPosition
==
null
)
{
tarPosition
=
CSVPositionReader
<
VerticalStorePosition
>.
GetPositon
(
TarPosId
);
}
return
tarPosition
;
}
}
public
string
GetDoorTinCheck
()
{
if
(
DoorPosType
.
Equals
(
1
))
{
return
IO_Type
.
TinCheck_DoorLeft
;
}
else
{
return
IO_Type
.
TinCheck_DoorRight
;
}
}
internal
bool
LoadParam
(
VerticalStoreConfig
Config
)
{
...
...
@@ -162,50 +85,14 @@ namespace OnlineStore.DeviceLibrary
if
(
MoveP
==
null
)
{
StoreMoveP
p
=
new
StoreMoveP
();
Vertical
Store
Position
position
=
Position
;
VerticalPosition
position
=
Position
;
if
(
position
==
null
)
{
LogUtil
.
error
(
"出入库时发现param中取到的Position=null,没有库位不能执行出入库"
);
return
false
;
}
p
.
InOut_P1
=
Config
.
InOutAxis_P1
;
p
.
Middle_P1
=
Config
.
MiddleAxis_P1
;
p
.
InOut_P2
=
Config
.
InOutAxis_P20
;
p
.
UpDown_P1
=
Config
.
UpDownAxis_OL_P1
;
p
.
UpDown_P8
=
Config
.
UpDownAxis_IL_P8
;
p
.
UpDown_P2
=
Config
.
UpDownAxis_IH_P2
;
p
.
UpDown_P7
=
Config
.
UpDownAxis_OH_P7
;
if
(
this
.
DoorPosType
.
Equals
(
1
)
||
this
.
DoorPosType
.
Equals
(
2
))
{
p
.
UpDown_P1
=
Config
.
UpDownAxis_OL_P11
;
p
.
UpDown_P8
=
Config
.
UpDownAxis_IL_P81
;
p
.
UpDown_P2
=
Config
.
UpDownAxis_IH_P21
;
p
.
UpDown_P7
=
Config
.
UpDownAxis_OH_P71
;
}
if
(
this
.
DoorPosType
.
Equals
(
1
))
{
p
.
Middle_P1
=
Config
.
MiddleAxis_P11
;
p
.
InOut_P2
=
Config
.
InOutAxis_P21
;
}
else
if
(
this
.
DoorPosType
.
Equals
(
2
))
{
p
.
Middle_P1
=
Config
.
MiddleAxis_P12
;
p
.
InOut_P2
=
Config
.
InOutAxis_P22
;
}
p
.
Warm_P2
=
position
.
WarmAxis_P2
;
p
.
Cold_P2
=
position
.
ColdAxis_P2
;
p
.
InOut_P3
=
position
.
InOutAxis_P3
;
p
.
Middle_P2
=
position
.
MiddleAxis_P2
;
p
.
UpDown_P3
=
position
.
UpDownAxis_IH_P3
;
p
.
UpDown_P4
=
position
.
UpDownAxis_IL_P4
;
p
.
UpDown_P5
=
position
.
UpDownAxis_OH_P5
;
p
.
UpDown_P6
=
position
.
UpDownAxis_OL_P6
;
this
.
MoveP
=
p
;
return
true
;
}
...
...
@@ -216,31 +103,14 @@ namespace OnlineStore.DeviceLibrary
{
get
{
string
doorT
=
"中间夹具"
;
if
(
DoorPosType
.
Equals
(
1
))
{
doorT
=
"左侧锡膏"
;
}
else
if
(
DoorPosType
.
Equals
(
1
))
{
doorT
=
"右侧锡膏"
;
}
if
(
paramType
.
Equals
(
MoveType
.
MovePos
))
{
return
"【回温移库:"
+
PosId
+
" -> "
+
TarPosId
+
"】"
;
}
else
if
(
paramType
.
Equals
(
MoveType
.
Stirring
))
{
return
"【搅拌:"
+
PosId
+
" -> "
+
TarPosId
+
"】"
;
}
else
if
(
paramType
.
Equals
(
MoveType
.
InStore
))
if
(
paramType
.
Equals
(
MoveType
.
InStore
))
{
return
"【入库:"
+
doorT
+
" -> "
+
PosId
+
"】"
;
return
"【入库:"
+
PosId
+
"】"
;
}
else
if
(
paramType
.
Equals
(
MoveType
.
OutStore
))
{
return
"【出库:"
+
PosId
+
" -> "
+
doorT
+
"】"
;
return
"【出库:"
+
PosId
+
"】"
;
}
else
{
...
...
source/DeviceLibrary/store/KTK_Store.cs
查看文件 @
4be5928
...
...
@@ -128,15 +128,7 @@ namespace OnlineStore.DeviceLibrary
isInPro
=
false
;
break
;
case
MoveType
.
MovePos
:
MovementProcess
();
isInPro
=
false
;
break
;
case
MoveType
.
Stirring
:
StirringProcess
();
isInPro
=
false
;
break
;
default
:
break
;
}
}
...
...
@@ -215,8 +207,6 @@ namespace OnlineStore.DeviceLibrary
/// </summary>
protected
abstract
void
ResetProcess
();
protected
abstract
void
StirringProcess
();
protected
abstract
void
MovementProcess
();
/// <summary>
/// 松下伺服轴原点返回运动,等待收到反馈后才会返回
/// </summary>
...
...
source/DeviceLibrary/store/StoreMoveP.cs
查看文件 @
4be5928
...
...
@@ -9,120 +9,9 @@ namespace OnlineStore.DeviceLibrary
public
class
StoreMoveP
{
/// <summary>
/// 轴3进出轴 待机原位点P1
/// </summary>
public
int
InOut_P1
=
0
;
#
region
仓门口位置
/// <summary>
/// 轴2( 升降轴) 进料口取料点 P1
/// </summary>
public
int
UpDown_P1
=
0
;
/// <summary>
/// 轴2( 升降轴) 进料口出料前点P2
/// </summary>
public
int
UpDown_P2
=
0
;
/// <summary>
/// 轴2( 升降轴) 进料口取料缓冲点P7
/// </summary>
public
int
UpDown_P7
=
0
;
/// <summary>
/// 轴2( 升降轴) 进料口出料缓冲点P8
/// </summary>
public
int
UpDown_P8
=
0
;
/// <summary>
/// 轴1旋转轴 待机原位点 P1
/// </summary>
public
int
Middle_P1
=
0
;
/// <summary>
/// 轴3进出轴 进料口取料点P2
/// </summary>
public
int
InOut_P2
=
0
;
#
endregion
#
region
库位点
/// <summary>
/// 轴2( 升降轴) 库位入料前点P3
/// </summary>
public
int
UpDown_P3
=
0
;
/// <summary>
/// 轴2( 升降轴) 库位入料缓冲点P4
/// </summary>
public
int
UpDown_P4
=
0
;
/// <summary>
/// 轴2( 升降轴) 库位出料前点P5
/// </summary>
public
int
UpDown_P5
=
0
;
/// <summary>
/// 轴2( 升降轴) 库位出料缓冲点P6
/// </summary>
public
int
UpDown_P6
=
0
;
/// <summary>
/// 轴1旋转轴 库位点 P2
/// </summary>
public
int
Middle_P2
=
0
;
/// <summary>
/// 轴3进出轴 库位点取料点P3
/// </summary>
public
int
InOut_P3
=
0
;
#
endregion
#
region
目标库位点
/// <summary>
/// 轴2( 升降轴) 库位入料前点P3
/// </summary>
public
int
T_UpDown_P3
=
0
;
/// <summary>
/// 轴2( 升降轴) 库位入料缓冲点P4
/// </summary>
public
int
T_UpDown_P4
=
0
;
/// <summary>
/// 轴2( 升降轴) 库位出料前点P5
/// </summary>
public
int
T_UpDown_P5
=
0
;
/// <summary>
/// 轴2( 升降轴) 库位出料缓冲点P6
/// </summary>
public
int
T_UpDown_P6
=
0
;
/// <summary>
/// 轴1旋转轴 库位点 P2
/// </summary>
public
int
T_Middle_P2
=
0
;
/// <summary>
/// 轴3进出轴 库位点取料点P3
/// </summary>
public
int
T_InOut_P3
=
0
;
#
endregion
/// <summary>
/// (轴四)回温区旋转轴库位点P2
/// </summary>
public
int
Warm_P2
=
0
;
/// <summary>
///(轴五)冷藏区旋转轴库位点P2
/// </summary>
public
int
Cold_P2
=
0
;
/// <summary>
///(轴六)搅拌旋转轴 搅拌点
/// </summary>
public
int
StirAxis_P
=
0
;
}
}
source/DeviceLibrary/store/model/StoreMoveInfo.cs
查看文件 @
4be5928
...
...
@@ -340,13 +340,6 @@ namespace OnlineStore.DeviceLibrary
/// 出库
/// </summary>
OutStore
=
6
,
/// <summary>
/// 回温移库
/// </summary>
MovePos
=
7
,
/// <summary>
/// 搅拌
/// </summary>
Stirring
=
8
,
}
}
source/LoadCVSLibrary/LoadCSVLibrary.csproj
查看文件 @
4be5928
...
...
@@ -47,7 +47,7 @@
</ItemGroup>
<ItemGroup>
<Compile Include="CSVExection.cs" />
<Compile Include="position\Vertical
Store
Position.cs" />
<Compile Include="position\VerticalPosition.cs" />
<Compile Include="storeConfig\ConfigItemBase.cs" />
<Compile Include="storeConfig\ConfigProAttribute.cs" />
<Compile Include="storeConfig\config\VerticalStoreConfig.cs" />
...
...
source/LoadCVSLibrary/position/PostionBase.cs
查看文件 @
4be5928
...
...
@@ -21,12 +21,12 @@ namespace OnlineStore.LoadCSVLibrary
/// <summary>
/// 高
/// </summary>
[
CSVAttribute
(
"高度"
)]
[
CSVAttribute
(
"
料盒
高度"
)]
public
int
BagHigh
{
get
;
set
;
}
/// <summary>
/// 宽
/// </summary>
[
CSVAttribute
(
"宽度"
)]
[
CSVAttribute
(
"
料盒
宽度"
)]
public
int
BagWidth
{
get
;
set
;
}
}
}
source/LoadCVSLibrary/position/VerticalPosition.cs
0 → 100644
查看文件 @
4be5928
using
OnlineStore.Common
;
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
namespace
OnlineStore.LoadCSVLibrary
{
/// <summary>
/// 松下伺服485控制,单台料仓
/// </summary>
public
class
VerticalPosition
:
PostionBase
{
/// <summary>
/// 对应的料仓ID(流水线料仓需要用此字段区分哪个BOX)
/// </summary>
[
CSVAttribute
(
"料仓ID"
)]
public
int
StoreId
{
get
;
set
;
}
/// <summary>
/// 库位类型 ,1=小料盒,2=大料盒
/// </summary>
[
CSVAttribute
(
"库位类型"
)]
public
int
PosType
{
get
;
set
;
}
/// <summary>
/// 料斗旋转轴位置P2
/// </summary>
[
CSVAttribute
(
"料斗旋转轴位置P2"
)]
public
int
MiddleAxis_P2
{
get
;
set
;
}
/// <summary>
/// 亮灯索引
/// </summary>
[
CSVAttribute
(
"亮灯索引"
)]
public
string
Led_Index
{
get
;
set
;
}
public
static
bool
CheckPosition
(
VerticalPosition
position
,
VerticalStoreConfig
Config
)
{
try
{
if
(
Config
.
Middle_Axis
.
PositionIsHasLimit
())
{
int
mMin
=
Config
.
Middle_Axis
.
PositionMin
;
int
mMax
=
Config
.
Middle_Axis
.
PositionMax
;
if
(
mMin
>
position
.
MiddleAxis_P2
||
mMax
<
position
.
MiddleAxis_P2
)
{
LogUtil
.
error
(
position
.
PositionNum
+
" MiddleAxis_Position_P2位置超出"
+
Config
.
Middle_Axis
.
Explain
+
"上下限("
+
mMin
+
"-"
+
mMax
+
")"
);
return
false
;
}
}
}
catch
(
Exception
ex
)
{
LogUtil
.
error
(
"验证"
+
position
.
PositionNum
+
"的位置范围出错:"
+
ex
.
ToString
());
}
return
true
;
}
public
string
PosTypeStr
()
{
if
(
PosType
.
Equals
(
1
))
{
return
"小料盒"
;
}
else
{
return
"大料盒"
;
}
}
}
}
source/LoadCVSLibrary/position/VerticalStorePosition.cs
deleted
100644 → 0
查看文件 @
62061a7
using
OnlineStore.Common
;
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
namespace
OnlineStore.LoadCSVLibrary
{
/// <summary>
/// 松下伺服485控制,单台料仓
/// </summary>
public
class
VerticalStorePosition
:
PostionBase
{
/// <summary>
/// 对应的料仓ID(流水线料仓需要用此字段区分哪个BOX)
/// </summary>
[
CSVAttribute
(
"料仓ID"
)]
public
int
StoreId
{
get
;
set
;
}
/// <summary>
/// 库位类型 (1=冷藏区库位,2=回温区库位,>=100的为砝码区)
/// </summary>
[
CSVAttribute
(
"库位类型"
)]
public
int
PosType
{
get
;
set
;
}
/// <summary>
/// 中轴位置(旋转轴库位点)P2
/// </summary>
[
CSVAttribute
(
"旋转轴位置P2"
)]
public
int
MiddleAxis_P2
{
get
;
set
;
}
/// <summary>
/// 升降轴(库位出料前点)P5
/// </summary>
[
CSVAttribute
(
"升降轴库位出料前点P5"
)]
public
int
UpDownAxis_OH_P5
{
get
;
set
;
}
/// <summary>
/// 升降轴(库位出料缓冲点)P6
/// </summary>
[
CSVAttribute
(
"升降轴库位出料缓冲点P6"
)]
public
int
UpDownAxis_OL_P6
{
get
;
set
;
}
/// <summary>
/// 升降轴(库位入料前点)P3
/// </summary>
[
CSVAttribute
(
"升降轴库位入料前点P3"
)]
public
int
UpDownAxis_IH_P3
{
get
;
set
;
}
/// <summary>
/// 升降轴(库位入料缓冲点)P4
/// </summary>
[
CSVAttribute
(
"升降轴库位入料缓冲点P4"
)]
public
int
UpDownAxis_IL_P4
{
get
;
set
;
}
/// <summary>
/// 进出轴(库位点取料点)P3
/// </summary>
[
CSVAttribute
(
"进出轴库位点取料点P3"
)]
public
int
InOutAxis_P3
{
get
;
set
;
}
/// <summary>
/// 回温区旋转轴库位点P2
/// </summary>
[
CSVAttribute
(
"回温区旋转轴库位点P2"
)]
public
int
WarmAxis_P2
{
get
;
set
;
}
/// <summary>
/// 冷藏区旋转轴P2
/// </summary>
[
CSVAttribute
(
"冷藏区旋转轴库位点P2"
)]
public
int
ColdAxis_P2
{
get
;
set
;
}
public
static
bool
CheckPosition
(
VerticalStorePosition
position
,
VerticalStoreConfig
Config
)
{
try
{
if
(
Config
.
Middle_Axis
.
PositionIsHasLimit
())
{
int
mMin
=
Config
.
Middle_Axis
.
PositionMin
;
int
mMax
=
Config
.
Middle_Axis
.
PositionMax
;
if
(
mMin
>
position
.
MiddleAxis_P2
||
mMax
<
position
.
MiddleAxis_P2
)
{
LogUtil
.
error
(
position
.
PositionNum
+
" MiddleAxis_Position_P2位置超出"
+
Config
.
Middle_Axis
.
Explain
+
"上下限("
+
mMin
+
"-"
+
mMax
+
")"
);
return
false
;
}
}
if
(
Config
.
InOut_Axis
.
PositionIsHasLimit
())
{
int
iMin
=
Config
.
InOut_Axis
.
PositionMin
;
int
iMax
=
Config
.
InOut_Axis
.
PositionMax
;
//if (iMin > position.InOutAxis_DoorPosition_P2 || iMax < position.InOutAxis_DoorPosition_P2)
//{
// LogUtil.error(position.PositionNum + " InOutAxis_DoorPosition_P2位置超出" + Config.InOut_Axis.Explain + "上下限(" + iMin + "-" + iMax + ")");
// return false;
//}
if
(
iMin
>
position
.
InOutAxis_P3
||
iMax
<
position
.
InOutAxis_P3
)
{
LogUtil
.
error
(
position
.
PositionNum
+
" InOutAxis_P3 位置超出"
+
Config
.
InOut_Axis
.
Explain
+
"上下限("
+
iMin
+
"-"
+
iMax
+
")"
);
return
false
;
}
}
if
(
Config
.
UpDown_Axis
.
PositionIsHasLimit
())
{
int
uMin
=
Config
.
UpDown_Axis
.
PositionMin
;
int
uMax
=
Config
.
UpDown_Axis
.
PositionMax
;
if
(
uMin
>
position
.
UpDownAxis_IH_P3
||
uMax
<
position
.
UpDownAxis_IH_P3
)
{
LogUtil
.
error
(
position
.
PositionNum
+
" UpDownAxis_IH_P3 位置超出"
+
Config
.
UpDown_Axis
.
Explain
+
"上下限("
+
uMin
+
"-"
+
uMax
+
")"
);
return
false
;
}
if
(
uMin
>
position
.
UpDownAxis_IL_P4
||
uMax
<
position
.
UpDownAxis_IL_P4
)
{
LogUtil
.
error
(
position
.
PositionNum
+
" UpDownAxis_IL_P4 位置超出"
+
Config
.
UpDown_Axis
.
Explain
+
"上下限("
+
uMin
+
"-"
+
uMax
+
")"
);
return
false
;
}
if
(
uMin
>
position
.
UpDownAxis_OH_P5
||
uMax
<
position
.
UpDownAxis_OH_P5
)
{
LogUtil
.
error
(
position
.
PositionNum
+
" UpDownAxis_OH_P5 位置超出"
+
Config
.
UpDown_Axis
.
Explain
+
"上下限("
+
uMin
+
"-"
+
uMax
+
")"
);
return
false
;
}
if
(
uMin
>
position
.
UpDownAxis_OL_P6
||
uMax
<
position
.
UpDownAxis_OL_P6
)
{
LogUtil
.
error
(
position
.
PositionNum
+
" UpDownAxis_OL_P6 位置超出"
+
Config
.
UpDown_Axis
.
Explain
+
"上下限("
+
uMin
+
"-"
+
uMax
+
")"
);
return
false
;
}
}
}
catch
(
Exception
ex
)
{
LogUtil
.
error
(
"验证"
+
position
.
PositionNum
+
"的位置范围出错:"
+
ex
.
ToString
());
}
return
true
;
}
public
string
PosTypeStr
()
{
if
(
PosType
.
Equals
(
1
))
{
return
"冷藏区库位"
;
}
else
if
(
PosType
.
Equals
(
2
))
{
return
"回温区库位"
;
}
else
{
return
"砝码"
+
PosType
+
"g库位"
;
}
}
/// <summary>
/// 是否是锡膏库位
/// </summary>
/// <returns></returns>
public
bool
IsTieBag
()
{
if
(
BagWidth
.
Equals
(
50
)
&&
BagHigh
.
Equals
(
50
))
{
return
true
;
}
return
false
;
}
}
}
source/LoadCVSLibrary/storeConfig/config/IO_Type.cs
查看文件 @
4be5928
...
...
@@ -26,130 +26,68 @@ namespace OnlineStore.LoadCSVLibrary
return
TypeList
;
}
/// <summary>
/// DI,急停,SuddenStop_BTN,0,192.168.200.21,
0,急停,X01,X01,0
,
/// DI,急停,SuddenStop_BTN,0,192.168.200.21,
急停,X01,X01,,,,,,,,,
,
/// </summary>
public
static
string
SuddenStop_BTN
=
"SuddenStop_BTN"
;
/// <summary>
/// DI,复位,Reset_BTN,1,192.168.200.21,
0,复位,X02,X02,0
,
/// DI,复位,Reset_BTN,1,192.168.200.21,
复位,X02,X02,,,,,,,,,
,
/// </summary>
public
static
string
Reset_BTN
=
"Reset_BTN"
;
/// <summary>
/// DI,自动启动,AutoRun_Signal,2,192.168.200.21,0,自动启动,X03,X03,0,
/// </summary>
public
static
string
AutoRun_Signal
=
"AutoRun_Signal"
;
/// <summary>
/// DI,气压检测,Airpressure_Check,3,192.168.200.21,0,气压检测,X04,X04,0,
/// </summary>
public
static
string
Airpressure_Check
=
"Airpressure_Check"
;
/// <summary>
/// DI,安全光栅,SafetyLightCurtains,4,192.168.200.21,0,安全光栅,X05,X05,0,
/// DI,安全光栅,SafetyLightCurtains,2,192.168.200.21,安全光栅,X03,X03,,,,,,,,,,
/// </summary>
public
static
string
SafetyLightCurtains
=
"SafetyLightCurtains"
;
/// <summary>
/// DI,左侧门禁信号,Door_LeftLimit,5,192.168.200.21,0,左侧门禁信号,X06,X06,0,
/// </summary>
public
static
string
Door_LeftLimit
=
"Door_LeftLimit"
;
/// <summary>
/// DI,右侧门禁信号,Door_RightLimit,6,192.168.200.21,0,右侧门禁信号,X07,X07,0,
/// </summary>
public
static
string
Door_RightLimit
=
"Door_RightLimit"
;
/// <summary>
/// DI,左侧锡膏检测,TinCheck_DoorLeft,7,192.168.200.21,0,左侧锡膏检测,X08,X08,0,
/// </summary>
public
static
string
TinCheck_DoorLeft
=
"TinCheck_DoorLeft"
;
/// <summary>
/// DI,右侧锡膏检测,TinCheck_DoorRight,8,192.168.200.21,0,右侧锡膏检测,X09,X09,0,
/// </summary>
public
static
string
TinCheck_DoorRight
=
"TinCheck_DoorRight"
;
/// <summary>
/// DI,夹具检测,TinCheck_Fixture,9,192.168.200.21,0,夹具检测,X10,X10,0,
/// </summary>
public
static
string
TinCheck_Fixture
=
"TinCheck_Fixture"
;
/// <summary>
/// DI,搅拌区锡膏检测,TinCheck_Stir,10,192.168.200.21,0,搅拌区锡膏检测,X11,X11,0,
/// </summary>
public
static
string
TinCheck_Stir
=
"TinCheck_Stir"
;
/// <summary>
/// DI,进料口门上升端,Door_Up,11,192.168.200.21,0,进料口门上升端,X12,X12,0,
/// DI,升降门上升端,Door_Up,3,192.168.200.21,升降门上升端,X04,X04,,,,,,,,,,
/// </summary>
public
static
string
Door_Up
=
"Door_Up"
;
/// <summary>
/// DI,
进料口门下降端,Door_Down,12,192.168.200.21,0,进料口门下降端,X13,X13,0
,
/// DI,
升降门下降端,Door_Down,4,192.168.200.21,升降门下降端,X05,X05,,,,,,,,,
,
/// </summary>
public
static
string
Door_Down
=
"Door_Down"
;
/// <summary>
/// DI,夹爪气缸夹紧端,Clamping_Tighten,13,192.168.200.21,0,夹爪气缸夹紧端,X14,X14,0,
/// </summary>
public
static
string
Clamping_Tighten
=
"Clamping_Tighten"
;
/// <summary>
/// DI,夹爪气缸放松端,Clamping_Relax,14,192.168.200.21,0,夹爪气缸放松端,X15,X15,0,
/// </summary>
public
static
string
Clamping_Relax
=
"Clamping_Relax"
;
/// <summary>
/// DI,夹爪锡膏检测,TinCheck_Clamping,15,192.168.200.21,0,夹爪锡膏检测,X16,X16,0,
/// </summary>
public
static
string
TinCheck_Clamping
=
"TinCheck_Clamping"
;
/// <summary>
/// DO,自动指示灯,AutoRun_HddLed,0,192.168.200.21,0,自动指示灯,Y01,Y01,0,
/// DO,自动指示灯,AutoRun_HddLed,0,192.168.200.21,自动指示灯,Y01,Y01,,,,,,,,,,
/// </summary>
public
static
string
AutoRun_HddLed
=
"AutoRun_HddLed"
;
/// <summary>
/// DO,故障指示灯,Alarm_HddLed,1,192.168.200.21,
0,故障指示灯,Y02,Y02,0
,
/// DO,故障指示灯,Alarm_HddLed,1,192.168.200.21,
故障指示灯,Y02,Y02,,,,,,,,,
,
/// </summary>
public
static
string
Alarm_HddLed
=
"Alarm_HddLed"
;
/// <summary>
/// DO,待机指示灯,RunSign_HddLed,2,192.168.200.21,
0,待机指示灯,Y03,Y03,0
,
/// DO,待机指示灯,RunSign_HddLed,2,192.168.200.21,
待机指示灯,Y03,Y03,,,,,,,,,
,
/// </summary>
public
static
string
RunSign_HddLed
=
"RunSign_HddLed"
;
/// <summary>
/// DO,报警蜂鸣器,Alarm_Buzzer,3,192.168.200.21,
0,报警蜂鸣器,Y04,Y04,0
,
/// DO,报警蜂鸣器,Alarm_Buzzer,3,192.168.200.21,
报警蜂鸣器,Y04,Y04,,,,,,,,,
,
/// </summary>
public
static
string
Alarm_Buzzer
=
"Alarm_Buzzer"
;
/// <summary>
/// DO,
料仓运转ON,Run_Signal,4,192.168.200.21,0,料仓运转ON,Y05,Y05,0
,
/// DO,
设备运转ON,Run_Signal,4,192.168.200.21,设备运转ON,Y05,Y05,,,,,,,,,
,
/// </summary>
public
static
string
Run_Signal
=
"Run_Signal"
;
/// <summary>
/// DO,
取料机构刹车电源ON,Axis_Brake,5,192.168.200.21,0,取料机构刹车电源ON,Y06,Y06,0
,
/// DO,
料斗伺服刹车ON,Axis_Brake,5,192.168.200.21,料斗伺服刹车ON,Y06,Y06,,,,,,,,,
,
/// </summary>
public
static
string
Axis_Brake
=
"Axis_Brake"
;
/// <summary>
/// DO,
相机照明开,Camera_Led,6,192.168.200.21,0,相机照明开,Y07,Y07,0
,
/// DO,
升降门刹车ON,Camera_Led,6,192.168.200.21,升降门刹车ON,Y07,Y07,,,,,,,,,
,
/// </summary>
public
static
string
Camera_Led
=
"Camera_Led"
;
/// <summary>
/// DO,门禁功能屏蔽,Door_Limit,7,192.168.200.21,0,门禁功能屏蔽,Y08,Y08,0,
/// </summary>
public
static
string
Door_Limit
=
"Door_Limit"
;
/// <summary>
/// DO,冷气机启动,Colding_Start,8,192.168.200.21,0,冷气机启动,Y09,Y09,0,
/// </summary>
public
static
string
Colding_Start
=
"Colding_Start"
;
/// <summary>
/// DO,回温区风机启动,Warming_Start,9,192.168.200.21,0,回温区风机启动,Y10,Y10,0,
/// </summary>
public
static
string
Warming_Start
=
"Warming_Start"
;
/// <summary>
/// DO,搅拌定位气缸上升SOL,StirLocation_Up,14,192.168.200.21,0,搅拌定位气缸上升SOL,Y15,Y15,0,
/// </summary>
public
static
string
StirLocation_Up
=
"StirLocation_Up"
;
/// <summary>
/// DO,搅拌定位气缸下降SOL,StirLocation_Down,15,192.168.200.21,0,搅拌定位气缸下降SOL,Y16,Y16,0,
/// </summary>
public
static
string
StirLocation_Down
=
"StirLocation_Down"
;
/// <summary>
/// DI,冷藏区门关闭端,ColdDoor_Close,2,192.168.200.22,,冷藏区门关闭端,X23,X23,,
/// </summary>
public
static
string
ColdDoor_Close
=
"ColdDoor_Close"
;
/// <summary>
/// DI,冷藏区门打开端,ColdDoor_Open,3,192.168.200.22,,冷藏区门打开端,X24,X24,,
/// </summary>
public
static
string
ColdDoor_Open
=
"ColdDoor_Open"
;
///// <summary>
///// DO,升降门电机上升,Door_Up,7,192.168.200.21,升降门电机上升,Y08,Y08,,,,,,,,,,
///// </summary>
//public static string Door_Up = "Door_Up";
///// <summary>
///// DO,升降门电机下降,Door_Down,8,192.168.200.21,升降门电机下降,Y09,Y09,,,,,,,,,,
///// </summary>
//public static string Door_Down = "Door_Down";
/// <summary>
/// DO,设备照明ON,Device_Led,9,192.168.200.21,设备照明ON,Y10,Y10,,,,,,,,,,
/// </summary>
public
static
string
Device_Led
=
"Device_Led"
;
// public static string StartOrStopBlow = "StartOrStopBlow";
}
public
enum
IO_VALUE
...
...
source/LoadCVSLibrary/storeConfig/config/StoreConfig.cs
查看文件 @
4be5928
...
...
@@ -161,7 +161,7 @@ namespace OnlineStore.LoadCSVLibrary
}
if
(
String
.
IsNullOrEmpty
(
builder
.
ToString
()).
Equals
(
false
)
&&
builder
.
ToString
().
Equals
(
"\r\n"
).
Equals
(
false
))
{
//
LOGGER.Error(builder.ToString());
LOGGER
.
Error
(
builder
.
ToString
());
}
if
(
checkProList
.
Count
>=
0
)
{
...
...
source/LoadCVSLibrary/storeConfig/config/VerticalStoreConfig.cs
查看文件 @
4be5928
...
...
@@ -17,420 +17,65 @@ namespace OnlineStore.LoadCSVLibrary
{
}
/// <summary>
/// PRO,IO模块对应的DI数量,IO_DILength,192.168.200.21#16;192.168.200.22#8,,,,,,,
/// </summary>
[
ConfigProAttribute
(
"IO_DILength"
)]
public
string
IO_DILength
{
get
;
set
;
}
/// <summary>
/// PRO,模块对应的DO数量,IO_DOLength,192.168.200.21#16;192.168.200.22#8,,,,,,,
/// </summary>
[
ConfigProAttribute
(
"IO_DOLength"
)]
public
string
IO_DOLength
{
get
;
set
;
}
/// <summary>
/// AXIS,(轴一)取料旋转轴,Middle_Axis,1,COM1,0,,,,,
/// AXIS,(轴一)料斗旋转轴,Middle_Axis,1,COM1,,,,250,80,80,80,60,50,10,1000,0,0
/// </summary>
[
ConfigProAttribute
(
"Middle_Axis"
)]
public
ConfigMoveAxis
Middle_Axis
{
get
;
set
;
}
/// <summary>
/// AXIS,(轴二)取料上下轴,UpDown_Axis,2,COM1,0,,,,,
/// </summary>
[
ConfigProAttribute
(
"UpDown_Axis"
)]
public
ConfigMoveAxis
UpDown_Axis
{
get
;
set
;
}
/// <summary>
/// AXIS,(轴三)取料进出轴,InOut_Axis,3,COM1,0,,,,,
/// </summary>
[
ConfigProAttribute
(
"InOut_Axis"
)]
public
ConfigMoveAxis
InOut_Axis
{
get
;
set
;
}
/// <summary>
/// AXIS,(轴四)回温区旋转轴,Warming_Axis,4,COM1,0,,,,,
/// </summary>
[
ConfigProAttribute
(
"Warming_Axis"
)]
public
ConfigMoveAxis
Warming_Axis
{
get
;
set
;
}
/// <summary>
/// AXIS,(轴五)冷藏区旋转轴,Colding_Axis,5,COM1,0,,,,,
/// </summary>
[
ConfigProAttribute
(
"Colding_Axis"
)]
public
ConfigMoveAxis
Colding_Axis
{
get
;
set
;
}
/// <summary>
/// AXIS,(轴六)搅拌旋转轴,Stir_Axis,6,COM1,0,,,,,
/// </summary>
[
ConfigProAttribute
(
"Stir_Axis"
)]
public
ConfigMoveAxis
Stir_Axis
{
get
;
set
;
}
/// <summary>
/// PRO,升降轴 进料口取料点 P1(夹具),UpDownAxis_OL_P1,403000,,,,,,,
/// </summary>
[
ConfigProAttribute
(
"UpDownAxis_OL_P1"
)]
public
int
UpDownAxis_OL_P1
{
get
;
set
;
}
/// <summary>
/// PRO,升降轴 进料口出料前点 P2(夹具),UpDownAxis_IH_P2,415000,,,,,,,
/// </summary>
[
ConfigProAttribute
(
"UpDownAxis_IH_P2"
)]
public
int
UpDownAxis_IH_P2
{
get
;
set
;
}
/// <summary>
/// PRO,升降轴 进料口取料缓冲点 P7(夹具),UpDownAxis_OH_P7,415000,,,,,,,
/// </summary>
[
ConfigProAttribute
(
"UpDownAxis_OH_P7"
)]
public
int
UpDownAxis_OH_P7
{
get
;
set
;
}
/// <summary>
/// PRO,升降轴 进料口出料缓冲点 P8(夹具),UpDownAxis_IL_P8,403000,,,,,,,
/// PRO,IO模块对应的DI数量,IO_DILength,192.168.200.21#16,,,,,,,,,,,,,,
/// </summary>
[
ConfigProAttribute
(
"UpDownAxis_IL_P8"
)]
public
int
UpDownAxis_IL_P8
{
get
;
set
;
}
/// <summary>
/// PRO,升降轴 进料口取料点 P11(锡膏),UpDownAxis_OL_P11,403099,,,,,,,
/// </summary>
[
ConfigProAttribute
(
"UpDownAxis_OL_P11"
)]
public
int
UpDownAxis_OL_P11
{
get
;
set
;
}
/// <summary>
/// PRO,升降轴 进料口出料前点 P21(锡膏),UpDownAxis_IH_P21,415099,,,,,,,
/// </summary>
[
ConfigProAttribute
(
"UpDownAxis_IH_P21"
)]
public
int
UpDownAxis_IH_P21
{
get
;
set
;
}
/// <summary>
/// PRO,升降轴 进料口取料缓冲点 P71(锡膏),UpDownAxis_OH_P71,415099,,,,,,,
/// </summary>
[
ConfigProAttribute
(
"UpDownAxis_OH_P71"
)]
public
int
UpDownAxis_OH_P71
{
get
;
set
;
}
/// <summary>
/// PRO,升降轴 进料口出料缓冲点 P81(锡膏),UpDownAxis_IL_P81,403099,,,,,,,
/// </summary>
[
ConfigProAttribute
(
"UpDownAxis_IL_P81"
)]
public
int
UpDownAxis_IL_P81
{
get
;
set
;
}
/// <summary>
/// PRO,升降轴 搅拌位置高点P101(搅拌区),UpDownAxis_StirH_P101,415099,,,,,,,
/// </summary>
[
ConfigProAttribute
(
"UpDownAxis_StirH_P101"
)]
public
int
UpDownAxis_StirH_P101
{
get
;
set
;
}
[
ConfigProAttribute
(
"IO_DILength"
)]
public
string
IO_DILength
{
get
;
set
;
}
/// <summary>
/// PRO,
升降轴 搅拌位置低点P102(搅拌区),UpDownAxis_StirL_P102,403099
,,,,,,,
/// PRO,
模块对应的DO数量,IO_DOLength,192.168.200.21#16,,,,,,,
,,,,,,,
/// </summary>
[
ConfigProAttribute
(
"
UpDownAxis_StirL_P102
"
)]
public
int
UpDownAxis_StirL_P102
{
get
;
set
;
}
[
ConfigProAttribute
(
"
IO_DOLength
"
)]
public
string
IO_DOLength
{
get
;
set
;
}
/// <summary>
/// PRO,旋转轴 P1待机原位点
(夹具取料点),MiddleAxis_P1,268000
,,,,,,,
/// PRO,旋转轴 P1待机原位点
,MiddleAxis_P1,268000,,,,,,,
,,,,,,,
/// </summary>
[
ConfigProAttribute
(
"MiddleAxis_P1"
)]
public
int
MiddleAxis_P1
{
get
;
set
;
}
/// <summary>
/// PRO,旋转轴 P11左侧取放料点(左侧锡膏),MiddleAxis_P11,260000,,,,,,,
/// </summary>
[
ConfigProAttribute
(
"MiddleAxis_P11"
)]
public
int
MiddleAxis_P11
{
get
;
set
;
}
/// <summary>
/// PRO,旋转轴 P12右侧取放料点(右侧锡膏),MiddleAxis_P12,280000,,,,,,,
/// </summary>
[
ConfigProAttribute
(
"MiddleAxis_P12"
)]
public
int
MiddleAxis_P12
{
get
;
set
;
}
/// <summary>
/// PRO,旋转轴 P101搅拌取放料点(搅拌区),MiddleAxis_Stir_P101,280000,,,,,,,
/// </summary>
[
ConfigProAttribute
(
"MiddleAxis_Stir_P101"
)]
public
int
MiddleAxis_Stir_P101
{
get
;
set
;
}
/// <summary>
/// PRO,进出轴 P1待机原位点,InOutAxis_P1,1000,,,,,,,
/// </summary>
[
ConfigProAttribute
(
"InOutAxis_P1"
)]
public
int
InOutAxis_P1
{
get
;
set
;
}
/// <summary>
/// PRO,进出轴 P20(夹具取料点),InOutAxis_P20,2000,,,,,,,
/// </summary>
[
ConfigProAttribute
(
"InOutAxis_P20"
)]
public
int
InOutAxis_P20
{
get
;
set
;
}
/// <summary>
/// PRO,进出轴 P21(左侧锡膏取料点),InOutAxis_P21,2800,,,,,,,
/// </summary>
[
ConfigProAttribute
(
"InOutAxis_P21"
)]
public
int
InOutAxis_P21
{
get
;
set
;
}
/// <summary>
/// PRO,进出轴 P22(右侧锡膏取料点),InOutAxis_P22,2900,,,,,,,
/// </summary>
[
ConfigProAttribute
(
"InOutAxis_P22"
)]
public
int
InOutAxis_P22
{
get
;
set
;
}
/// <summary>
/// PRO,进出轴 P101(搅拌区取放料点),InOutAxis_Stir_P101,2900,,,,,,,
/// </summary>
[
ConfigProAttribute
(
"InOutAxis_Stir_P101"
)]
public
int
InOutAxis_Stir_P101
{
get
;
set
;
}
/// <summary>
/// PRO,(轴四)回温区旋转轴 P1待机原位点,Warming_Axis_P1,2000,,,,,,,
/// </summary>
[
ConfigProAttribute
(
"Warming_Axis_P1"
)]
public
int
Warming_Axis_P1
{
get
;
set
;
}
/// <summary>
/// PRO,(轴五)冷藏区旋转轴 P1待机原位点,Colding_Axis_P1,2000,,,,,,,
/// </summary>
[
ConfigProAttribute
(
"Colding_Axis_P1"
)]
public
int
Colding_Axis_P1
{
get
;
set
;
}
/// <summary>
/// PRO,(轴六)搅拌旋转轴 P1搅拌点1,Stir_Axis_P1,2000,,,,,,,
/// </summary>
[
ConfigProAttribute
(
"Stir_Axis_P1"
)]
public
int
Stir_Axis_P1
{
get
;
set
;
}
/// <summary>
/// PRO,(轴六)搅拌旋转轴 P2搅拌点2,Stir_Axis_P2,8000,,,,,,,
/// </summary>
[
ConfigProAttribute
(
"Stir_Axis_P2"
)]
public
int
Stir_Axis_P2
{
get
;
set
;
}
/// <summary>
/// PRO,是否有左右侧门,IsHasDoorLimit,1,,,,,,,
/// </summary>
[
ConfigProAttribute
(
"IsHasDoorLimit"
)]
public
int
IsHasDoorLimit
{
get
;
set
;
}
/// <summary>
/// PRO,设备是否处于调试状态(1=调试,0=正常),IsInDebug,0,,,,,,,
/// PRO,设备是否处于调试状态(1=调试,0=正常),IsInDebug,0,,,,,,,,,,,,,,
/// </summary>
[
ConfigProAttribute
(
"IsInDebug"
)]
public
int
IsInDebug
{
get
;
set
;
}
/// <summary>
/// PRO,气压检测IO关闭需要持续的时间,AirCheckSeconds,3,,,,,,,
/// </summary>
[
ConfigProAttribute
(
"AirCheckSeconds"
)]
public
int
AirCheckSeconds
{
get
;
set
;
}
/// <summary>
/// PRO,出入库多少次,会自动重置所有轴操作,Box_ResetACount,100,,,,,,,
/// </summary>
[
ConfigProAttribute
(
"Box_ResetACount"
)]
public
int
Box_ResetACount
{
get
;
set
;
}
/// <summary>
/// PRO,IO信号超时时间(毫秒),IOSingle_TimerOut,10000,,,,,,,
/// PRO,IO信号超时时间(毫秒),IOSingle_TimerOut,10000,,,,,,,,,,,,,,
/// </summary>
[
ConfigProAttribute
(
"IOSingle_TimerOut"
)]
public
int
IOSingle_TimerOut
{
get
;
set
;
}
/// <summary>
/// PRO,是否使用料盘检测信号,IsUse_Tray_Check,0,,,,,,,
/// </summary>
[
ConfigProAttribute
(
"IsUse_Tray_Check"
)]
public
int
IsUse_Tray_Check
{
get
;
set
;
}
/// <summary>
/// PRO,升降轴(轴2)P1速度,UpDownAxis_P1_Speed,250,,,,,,,
/// </summary>
[
ConfigProAttribute
(
"UpDownAxis_P1_Speed"
)]
public
int
UpDownAxis_P1_Speed
{
get
;
set
;
}
/// <summary>
/// PRO,升降轴(轴2)P2速度,UpDownAxis_P2_Speed,250,,,,,,,
/// </summary>
[
ConfigProAttribute
(
"UpDownAxis_P2_Speed"
)]
public
int
UpDownAxis_P2_Speed
{
get
;
set
;
}
/// <summary>
/// PRO,升降轴(轴2)P3速度,UpDownAxis_P3_Speed,250,,,,,,,
/// </summary>
[
ConfigProAttribute
(
"UpDownAxis_P3_Speed"
)]
public
int
UpDownAxis_P3_Speed
{
get
;
set
;
}
/// <summary>
/// PRO,升降轴(轴2)P4速度,UpDownAxis_P4_Speed,150,,,,,, ,
/// </summary>
[
ConfigProAttribute
(
"UpDownAxis_P4_Speed"
)]
public
int
UpDownAxis_P4_Speed
{
get
;
set
;
}
/// <summary>
/// PRO,升降轴(轴2)P5速度,UpDownAxis_P5_Speed,250,,,,,,,
/// </summary>
[
ConfigProAttribute
(
"UpDownAxis_P5_Speed"
)]
public
int
UpDownAxis_P5_Speed
{
get
;
set
;
}
/// <summary>
/// PRO,升降轴(轴2)P6速度,UpDownAxis_P6_Speed,100,,,,,,,
/// </summary>
[
ConfigProAttribute
(
"UpDownAxis_P6_Speed"
)]
public
int
UpDownAxis_P6_Speed
{
get
;
set
;
}
/// <summary>
/// PRO,升降轴(轴2)P7速度,UpDownAxis_P7_Speed,100,,,,,,,
/// </summary>
[
ConfigProAttribute
(
"UpDownAxis_P7_Speed"
)]
public
int
UpDownAxis_P7_Speed
{
get
;
set
;
}
/// <summary>
/// PRO,升降轴(轴2)P8速度,UpDownAxis_P8_Speed,100,,,,,,,
/// </summary>
[
ConfigProAttribute
(
"UpDownAxis_P8_Speed"
)]
public
int
UpDownAxis_P8_Speed
{
get
;
set
;
}
/// <summary>
/// PRO,升降轴(轴2)P101速度,UpDownAxis_P101_Speed,100,,,,,,,,,,,,,,
/// </summary>
[
ConfigProAttribute
(
"UpDownAxis_P101_Speed"
)]
public
int
UpDownAxis_P101_Speed
{
get
;
set
;
}
/// <summary>
/// PRO,升降轴(轴2)P102速度,UpDownAxis_P102_Speed,100,,,,,,,,,,,,,,
/// </summary>
[
ConfigProAttribute
(
"UpDownAxis_P102_Speed"
)]
public
int
UpDownAxis_P102_Speed
{
get
;
set
;
}
/// <summary>
/// PRO,旋转轴(轴1)P1速度,MiddleAxis_P1_Speed,120,,,,,,,
/// PRO,旋转轴(轴1)P1速度,MiddleAxis_P1_Speed,120,,,,,,,,,,,,,,
/// </summary>
[
ConfigProAttribute
(
"MiddleAxis_P1_Speed"
)]
public
int
MiddleAxis_P1_Speed
{
get
;
set
;
}
/// <summary>
/// PRO,旋转轴(轴1)P2速度,MiddleAxis_P2_Speed,120,,,,,,,
/// PRO,旋转轴(轴1)P2速度,MiddleAxis_P2_Speed,120,,,,,,,
,,,,,,,
/// </summary>
[
ConfigProAttribute
(
"MiddleAxis_P2_Speed"
)]
public
int
MiddleAxis_P2_Speed
{
get
;
set
;
}
/// <summary>
/// PRO,旋转轴(轴1)P101速度,MiddleAxis_P101_Speed,120,,,,,,,,,,,,,,
/// </summary>
[
ConfigProAttribute
(
"MiddleAxis_P101_Speed"
)]
public
int
MiddleAxis_P101_Speed
{
get
;
set
;
}
/// <summary>
/// PRO,进出轴(轴3)P1速度,InOutAxis_P1_Speed,100,,,,,,,
/// </summary>
[
ConfigProAttribute
(
"InOutAxis_P1_Speed"
)]
public
int
InOutAxis_P1_Speed
{
get
;
set
;
}
/// <summary>
/// PRO,进出轴(轴3)P2速度,InOutAxis_P2_Speed,100,,,,,,,
/// </summary>
[
ConfigProAttribute
(
"InOutAxis_P2_Speed"
)]
public
int
InOutAxis_P2_Speed
{
get
;
set
;
}
/// <summary>
/// PRO,进出轴(轴3)P3速度,InOutAxis_P3_Speed,1000,,,,,,,
/// </summary>
[
ConfigProAttribute
(
"InOutAxis_P3_Speed"
)]
public
int
InOutAxis_P3_Speed
{
get
;
set
;
}
/// <summary>
/// PRO,进出轴(轴3)P101速度,InOutAxis_P101_Speed,100,,,,,,,,,,,,,,
/// </summary>
[
ConfigProAttribute
(
"InOutAxis_P101_Speed"
)]
public
int
InOutAxis_P101_Speed
{
get
;
set
;
}
/// <summary>
/// PRO,回温区旋转轴(轴4)P1速度,WarmingAxis_P1_Speed,120,,,,,,,
/// </summary>
[
ConfigProAttribute
(
"WarmingAxis_P1_Speed"
)]
public
int
WarmingAxis_P1_Speed
{
get
;
set
;
}
/// <summary>
/// PRO,回温区旋转轴(轴4)P2速度,WarmingAxis_P2_Speed,120,,,,,,,
/// </summary>
[
ConfigProAttribute
(
"WarmingAxis_P2_Speed"
)]
public
int
WarmingAxis_P2_Speed
{
get
;
set
;
}
/// <summary>
/// PRO,冷藏区旋转轴(轴5)P1速度,ColdingAxis_P1_Speed,120,,,,,,,
/// </summary>
[
ConfigProAttribute
(
"ColdingAxis_P1_Speed"
)]
public
int
ColdingAxis_P1_Speed
{
get
;
set
;
}
/// <summary>
/// PRO,冷藏区旋转轴(轴5)P2速度,ColdingAxis_P2_Speed,120,,,,,,,
/// </summary>
[
ConfigProAttribute
(
"ColdingAxis_P2_Speed"
)]
public
int
ColdingAxis_P2_Speed
{
get
;
set
;
}
/// <summary>
/// PRO,搅拌区旋转轴(轴6)P1速度,StirAxis_P1_Speed,120,,,,,,,
/// </summary>
[
ConfigProAttribute
(
"StirAxis_P1_Speed"
)]
public
int
StirAxis_P1_Speed
{
get
;
set
;
}
/// <summary>
/// PRO,搅拌区旋转轴(轴6)P2速度,StirAxis_P2_Speed,120,,,,,,,
/// </summary>
[
ConfigProAttribute
(
"StirAxis_P2_Speed"
)]
public
int
StirAxis_P2_Speed
{
get
;
set
;
}
/// <summary>
/// PRO,伺服停止时可误差的脉冲数的最小值,Axis_ErrorCountMin,10,,,,,,,
/// PRO,伺服停止时可误差的脉冲数的最小值,Axis_ErrorCountMin,10,,,,,,,,,,,,,,
/// </summary>
[
ConfigProAttribute
(
"Axis_ErrorCountMin"
)]
public
int
Axis_ErrorCountMin
{
get
;
set
;
}
/// <summary>
/// PRO,伺服停止时可误差的脉冲数的最大值,Axis_ErrorCountMax,1000,,,,,,,
/// PRO,伺服停止时可误差的脉冲数的最大值,Axis_ErrorCountMax,1000,,,,,,,
,,,,,,,
/// </summary>
[
ConfigProAttribute
(
"Axis_ErrorCountMax"
)]
public
int
Axis_ErrorCountMax
{
get
;
set
;
}
/// <summary>
/// PRO,(轴一)旋转轴最小限位,MiddleAxis_PositionMin,0,,,,,,,
/// PRO,(轴一)旋转轴最小限位,MiddleAxis_PositionMin,0,,,,,,,
,,,,,,,
/// </summary>
[
ConfigProAttribute
(
"MiddleAxis_PositionMin"
)]
public
int
MiddleAxis_PositionMin
{
get
;
set
;
}
/// <summary>
/// PRO,(轴二)升降轴最小限位,UpdownAxis_PositionMin,0,,,,,,,
/// </summary>
[
ConfigProAttribute
(
"UpdownAxis_PositionMin"
)]
public
int
UpdownAxis_PositionMin
{
get
;
set
;
}
/// <summary>
/// PRO,(轴三)进出轴最小限位,InoutAxis_PositionMin,0,,,,,,,
/// </summary>
[
ConfigProAttribute
(
"InoutAxis_PositionMin"
)]
public
int
InoutAxis_PositionMin
{
get
;
set
;
}
/// <summary>
/// PRO,(轴一)旋转轴最大限位,MiddleAxis_PositionMax,0,,,,,,,
/// PRO,(轴一)旋转轴最大限位,MiddleAxis_PositionMax,0,,,,,,,,,,,,,,
/// </summary>
[
ConfigProAttribute
(
"MiddleAxis_PositionMax"
)]
public
int
MiddleAxis_PositionMax
{
get
;
set
;
}
/// <summary>
/// PRO,(轴二)升降轴最大限位,UpdownAxis_PositionMax,0,,,,,,,
/// </summary>
[
ConfigProAttribute
(
"UpdownAxis_PositionMax"
)]
public
int
UpdownAxis_PositionMax
{
get
;
set
;
}
/// <summary>
/// PRO,(轴三)进出轴最大限位,InoutAxis_PositionMax,0,,,,,,,
/// </summary>
[
ConfigProAttribute
(
"InoutAxis_PositionMax"
)]
public
int
InoutAxis_PositionMax
{
get
;
set
;
}
/// <summary>
/// PRO,每次吹气的时间(分钟),BlowAir_Time,10,,,,,,,
/// </summary>
[
ConfigProAttribute
(
"BlowAir_Time"
)]
public
int
BlowAir_Time
{
get
;
set
;
}
/// <summary>
/// PRO,两次吹气间隔(分钟),BlowAir_Interval,10,,,,,,,
/// </summary>
[
ConfigProAttribute
(
"BlowAir_Interval"
)]
public
int
BlowAir_Interval
{
get
;
set
;
}
/// <summary>
/// PRO,冷藏区温湿度端口号,Humiture_Colding_Port,COM3,,,,,,,
/// </summary>
[
ConfigProAttribute
(
"Humiture_Colding_Port"
)]
public
string
Humiture_Colding_Port
{
get
;
set
;
}
/// <summary>
/// PRO,回温区温湿度端口号,Humiture_Warming_Port,COM4,,,,,,,
/// </summary>
[
ConfigProAttribute
(
"Humiture_Warming_Port"
)]
public
string
Humiture_Warming_Port
{
get
;
set
;
}
/// <summary>
/// PRO,左侧测重控制器,Weight_Left_Port,COM5,,,,,,,
/// </summary>
[
ConfigProAttribute
(
"Weight_Left_Port"
)]
public
string
Weight_Left_Port
{
get
;
set
;
}
/// <summary>
/// PRO,右侧测重控制器,Weight_Right_Port,COM6,,,,,,,
/// </summary>
[
ConfigProAttribute
(
"Weight_Right_Port"
)]
public
string
Weight_Right_Port
{
get
;
set
;
}
/// <summary>
/// PRO,锡膏宽度,Tin_Width,100,,,,,,,
/// </summary>
[
ConfigProAttribute
(
"Tin_Width"
)]
public
int
Tin_Width
{
get
;
set
;
}
/// <summary>
/// PRO,锡膏高度,Tin_Height,50,,,,,,,
/// </summary>
[
ConfigProAttribute
(
"Tin_Height"
)]
public
int
Tin_Height
{
get
;
set
;
}
/// <summary>
/// PRO,夹具宽度,Fixture_Width,185,,,,,,,
/// </summary>
[
ConfigProAttribute
(
"Fixture_Width"
)]
public
int
Fixture_Width
{
get
;
set
;
}
/// <summary>
/// PRO,夹具高度,Fixture_Height,60,,,,,,,
/// </summary>
[
ConfigProAttribute
(
"Fixture_Height"
)]
public
int
Fixture_Height
{
get
;
set
;
}
/// <summary>
/// PRO,左侧测重空夹具重量,LeftDefWeight,30,,,,,,,,,,,,,,
/// </summary>
[
ConfigProAttribute
(
"LeftDefWeight"
)]
public
double
LeftDefWeight
{
get
;
set
;
}
/// <summary>
/// PRO,右侧测重空夹具重量,RightDefWeight,45,,,,,,,,,,,,,,
/// </summary>
[
ConfigProAttribute
(
"RightDefWeight"
)]
public
double
RightDefWeight
{
get
;
set
;
}
/// <summary>
/// PRO,特殊二维码尺寸配置,CodeSizeConfig,XA=13x48#XB=13x32#FA=7x32,,,,,,,
/// </summary>
[
ConfigProAttribute
(
"CodeSizeConfig"
,
false
)]
public
string
CodeSizeConfig
{
get
;
set
;
}
protected
override
void
initMustHavePro
()
{
...
...
@@ -438,19 +83,11 @@ namespace OnlineStore.LoadCSVLibrary
MustHaveDOList
=
new
List
<
string
>();
// MustHaveDIList.Add(IO_Type.SuddenStop_BTN);
MustHaveDIList
.
Add
(
IO_Type
.
Reset_BTN
);
MustHaveDIList
.
Add
(
IO_Type
.
AutoRun_Signal
);
MustHaveDIList
.
Add
(
IO_Type
.
Airpressure_Check
);
// MustHaveDIList.Add(IO_Type.TrayCheck_Door);
// MustHaveDIList.Add(IO_Type.TrayCheck_Fixture);
MustHaveDIList
.
Add
(
IO_Type
.
Door_Up
);
MustHaveDIList
.
Add
(
IO_Type
.
Door_Down
);
MustHaveDIList
.
Add
(
IO_Type
.
SafetyLightCurtains
);
MustHaveDIList
.
Add
(
IO_Type
.
SafetyLightCurtains
);
MustHaveDIList
.
Add
(
IO_Type
.
Door_Limit
);
MustHaveDIList
.
Add
(
IO_Type
.
Door_LeftLimit
);
MustHaveDIList
.
Add
(
IO_Type
.
Door_RightLimit
);
MustHaveDOList
.
Add
(
IO_Type
.
AutoRun_HddLed
);
MustHaveDOList
.
Add
(
IO_Type
.
Alarm_HddLed
);
...
...
@@ -465,39 +102,11 @@ namespace OnlineStore.LoadCSVLibrary
}
public
static
void
ConfigAxis
(
VerticalStoreConfig
con
)
{
con
.
Middle_Axis
.
CanErrorCountMin
=
con
.
Axis_ErrorCountMin
;
con
.
InOut_Axis
.
CanErrorCountMin
=
con
.
Axis_ErrorCountMin
;
con
.
UpDown_Axis
.
CanErrorCountMin
=
con
.
Axis_ErrorCountMin
;
con
.
Warming_Axis
.
CanErrorCountMin
=
con
.
Axis_ErrorCountMin
;
con
.
Colding_Axis
.
CanErrorCountMin
=
con
.
Axis_ErrorCountMin
;
con
.
Stir_Axis
.
CanErrorCountMin
=
con
.
Axis_ErrorCountMin
;
con
.
Middle_Axis
.
CanErrorCountMax
=
con
.
Axis_ErrorCountMax
;
con
.
InOut_Axis
.
CanErrorCountMax
=
con
.
Axis_ErrorCountMax
;
con
.
UpDown_Axis
.
CanErrorCountMax
=
con
.
Axis_ErrorCountMax
;
con
.
Warming_Axis
.
CanErrorCountMax
=
con
.
Axis_ErrorCountMax
;
con
.
Colding_Axis
.
CanErrorCountMax
=
con
.
Axis_ErrorCountMax
;
con
.
Stir_Axis
.
CanErrorCountMax
=
con
.
Axis_ErrorCountMax
;
con
.
Middle_Axis
.
PositionMin
=
con
.
MiddleAxis_PositionMin
;
con
.
Middle_Axis
.
PositionMax
=
con
.
MiddleAxis_PositionMax
;
con
.
InOut_Axis
.
PositionMin
=
con
.
InoutAxis_PositionMin
;
con
.
InOut_Axis
.
PositionMax
=
con
.
InoutAxis_PositionMax
;
con
.
UpDown_Axis
.
PositionMin
=
con
.
UpdownAxis_PositionMin
;
con
.
UpDown_Axis
.
PositionMax
=
con
.
UpdownAxis_PositionMax
;
//Config.InOut_Axis.ResolveSpeed = Config.InoutAxis_ResolveSpeed;
//Config.UpDown_Axis.ResolveSpeed = Config.UpdownAxis_ResolveSpeed;
//Config.Middle_Axis.ResolveSpeed = Config.MiddleAxis_ResolveSpeed;
con
.
Middle_Axis
.
DefaultPosition
=
con
.
MiddleAxis_P1
;
con
.
InOut_Axis
.
DefaultPosition
=
con
.
InOutAxis_P1
;
con
.
UpDown_Axis
.
DefaultPosition
=
con
.
UpDownAxis_OL_P1
;
con
.
Warming_Axis
.
DefaultPosition
=
con
.
Warming_Axis_P1
;
con
.
Colding_Axis
.
DefaultPosition
=
con
.
Colding_Axis_P1
;
con
.
Stir_Axis
.
DefaultPosition
=
con
.
Stir_Axis_P1
;
}
private
Dictionary
<
string
,
ushort
>
DILengthMap
=
null
;
private
Dictionary
<
string
,
ushort
>
DOLengthMap
=
null
;
...
...
@@ -562,57 +171,57 @@ namespace OnlineStore.LoadCSVLibrary
return
16
;
}
private
Dictionary
<
string
,
string
>
CodeSizeMap
=
null
;
private
static
char
codeSpilt
=
'#'
;
public
string
GetCodeSize
(
ref
string
code
)
{
try
{
if
(
CodeSizeMap
==
null
)
{
CodeSizeMap
=
new
Dictionary
<
string
,
string
>();
string
[]
array
=
CodeSizeConfig
.
Split
(
codeSpilt
);
if
(
array
.
Length
>
0
)
{
foreach
(
string
str
in
array
)
{
string
[]
codeStr
=
str
.
Split
(
'='
);
if
(
codeStr
.
Length
==
2
)
{
string
key
=
codeStr
[
0
].
Trim
();
string
value
=
codeStr
[
1
].
Trim
();
CodeSizeMap
.
Add
(
key
,
value
);
}
}
}
}
foreach
(
string
key
in
CodeSizeMap
.
Keys
)
{
string
[]
array
=
key
.
Split
(
';'
);
if
(
array
.
Length
==
1
&&
code
.
Trim
().
StartsWith
(
key
))
{
return
CodeSizeMap
[
key
];
}
else
if
(
array
.
Length
>=
2
)
{
if
(
code
.
Trim
().
StartsWith
(
array
[
0
]))
{
int
leng
=
array
[
0
].
Length
;
code
=
code
.
Trim
()
+
key
.
Substring
(
leng
,
key
.
Length
-
leng
);
return
CodeSizeMap
[
key
];
}
}
}
}
catch
(
Exception
ex
)
{
LOGGER
.
Error
(
"获取二维码【"
+
code
+
"】的固定尺寸出错:"
+
ex
.
ToString
());
}
return
""
;
}
//
private Dictionary<string, string> CodeSizeMap = null;
//
private static char codeSpilt = '#';
//
public string GetCodeSize(ref string code)
//
{
//
try
//
{
//
if (CodeSizeMap == null)
//
{
//
CodeSizeMap = new Dictionary<string, string>();
//
string[] array = CodeSizeConfig.Split(codeSpilt);
//
if (array.Length > 0)
//
{
//
foreach (string str in array)
//
{
//
string[] codeStr = str.Split('=');
//
if (codeStr.Length == 2)
//
{
//
string key = codeStr[0].Trim();
//
string value = codeStr[1].Trim();
//
CodeSizeMap.Add(key, value);
//
}
//
}
//
}
//
}
//
foreach (string key in CodeSizeMap.Keys)
//
{
//
string[] array = key.Split(';');
//
if (array.Length == 1 && code.Trim().StartsWith(key))
//
{
//
return CodeSizeMap[key];
//
}
//
else if (array.Length >= 2)
//
{
//
if (code.Trim().StartsWith(array[0]))
//
{
//
int leng = array[0].Length;
//
code = code.Trim() + key.Substring(leng, key.Length - leng);
//
return CodeSizeMap[key];
//
}
//
}
//
}
//
}
//
catch (Exception ex)
//
{
//
LOGGER.Error("获取二维码【" + code + "】的固定尺寸出错:" + ex.ToString());
//
}
//
return "";
//
}
}
}
source/VerticalStoreClinet/FormManager.cs
查看文件 @
4be5928
...
...
@@ -67,54 +67,27 @@ namespace OnlineStore.TinPasteStore
return
returnList
;
}
//public static FrmAxisMoveConfig FrmAxisConfig = null;
//public static void ShowAxisConfig(AC_SA_BoxBean boxBean)
//private static FrmAxisDebug debug = null;
//public static void ShowAxisDebug(VerticalStoreBean store)
//{
// if (
FormManager.FrmAxisConfi
g == null)
// if (
debu
g == null)
// {
//
FormManager.FrmAxisConfig = new FrmAxisMoveConfig(boxBean
);
//
FormManager.FrmAxisConfi
g.Show();
//
debug = new FrmAxisDebug(store
);
//
debu
g.Show();
// }
// else
// {
// //FormManager.FrmAxisConfig.ShowDialog();
// if (FormManager.FrmAxisConfig.IsDisposed)
// if (debug.IsDisposed)
// {
//
FormManager.FrmAxisConfig = new FrmAxisMoveConfig(boxBean
);
//
FormManager.FrmAxisConfi
g.Show();
//
debug = new FrmAxisDebug(store
);
//
debu
g.Show();
// }
// else
// {
//
FormManager.FrmAxisConfi
g.Activate();
//
debu
g.Activate();
// }
// }
//}
private
static
FrmAxisDebug
debug
=
null
;
public
static
void
ShowAxisDebug
(
VerticalStoreBean
store
)
{
if
(
debug
==
null
)
{
debug
=
new
FrmAxisDebug
(
store
);
debug
.
Show
();
}
else
{
if
(
debug
.
IsDisposed
)
{
debug
=
new
FrmAxisDebug
(
store
);
debug
.
Show
();
}
else
{
debug
.
Activate
();
}
}
}
private
static
FrmIOStatus
frmIo
=
null
;
public
static
void
ShowIOShow
(
VerticalStoreBean
store
)
{
...
...
source/VerticalStoreClinet/FrmBase.cs
查看文件 @
4be5928
...
...
@@ -44,7 +44,7 @@ namespace OnlineStore.TinPasteStore
}
return
str
;
}
internal
static
string
GetCodeNum
(
string
codeName
=
"
TinPasteStore
"
)
internal
static
string
GetCodeNum
(
string
codeName
=
"
VerticalStoreClient
"
)
{
byte
[]
byteArray
=
System
.
Text
.
Encoding
.
ASCII
.
GetBytes
(
codeName
);
string
result
=
""
;
...
...
source/VerticalStoreClinet/FrmIOStatus.Designer.cs
查看文件 @
4be5928
...
...
@@ -18,20 +18,8 @@
this
.
components
=
new
System
.
ComponentModel
.
Container
();
this
.
timer1
=
new
System
.
Windows
.
Forms
.
Timer
(
this
.
components
);
this
.
groupBox2
=
new
System
.
Windows
.
Forms
.
GroupBox
();
this
.
btn_Warming_Stop
=
new
System
.
Windows
.
Forms
.
Button
();
this
.
btn_Warming_Start
=
new
System
.
Windows
.
Forms
.
Button
();
this
.
btn_Colding_Stop
=
new
System
.
Windows
.
Forms
.
Button
();
this
.
btn_Colding_Start
=
new
System
.
Windows
.
Forms
.
Button
();
this
.
btn_ColdDoor_Close
=
new
System
.
Windows
.
Forms
.
Button
();
this
.
btn_ColdDoor_Open
=
new
System
.
Windows
.
Forms
.
Button
();
this
.
btn_StirLocation_Up
=
new
System
.
Windows
.
Forms
.
Button
();
this
.
btn_StirLocation_Down
=
new
System
.
Windows
.
Forms
.
Button
();
this
.
btn_Clamping_Tighten
=
new
System
.
Windows
.
Forms
.
Button
();
this
.
btn_Clamping_Relax
=
new
System
.
Windows
.
Forms
.
Button
();
this
.
btnCloseLed
=
new
System
.
Windows
.
Forms
.
Button
();
this
.
btn_Door_Up
=
new
System
.
Windows
.
Forms
.
Button
();
this
.
btnOpenLed
=
new
System
.
Windows
.
Forms
.
Button
();
this
.
btn_Door_Down
=
new
System
.
Windows
.
Forms
.
Button
();
this
.
btnCloseAxisBreak
=
new
System
.
Windows
.
Forms
.
Button
();
this
.
btnOpenAxisBreak
=
new
System
.
Windows
.
Forms
.
Button
();
this
.
button1
=
new
System
.
Windows
.
Forms
.
Button
();
...
...
@@ -66,149 +54,17 @@
this
.
groupBox2
.
Anchor
=
((
System
.
Windows
.
Forms
.
AnchorStyles
)((((
System
.
Windows
.
Forms
.
AnchorStyles
.
Top
|
System
.
Windows
.
Forms
.
AnchorStyles
.
Bottom
)
|
System
.
Windows
.
Forms
.
AnchorStyles
.
Left
)
|
System
.
Windows
.
Forms
.
AnchorStyles
.
Right
)));
this
.
groupBox2
.
Controls
.
Add
(
this
.
btn_Warming_Stop
);
this
.
groupBox2
.
Controls
.
Add
(
this
.
btn_Warming_Start
);
this
.
groupBox2
.
Controls
.
Add
(
this
.
btn_Colding_Stop
);
this
.
groupBox2
.
Controls
.
Add
(
this
.
btn_Colding_Start
);
this
.
groupBox2
.
Controls
.
Add
(
this
.
btn_ColdDoor_Close
);
this
.
groupBox2
.
Controls
.
Add
(
this
.
btn_ColdDoor_Open
);
this
.
groupBox2
.
Controls
.
Add
(
this
.
btn_StirLocation_Up
);
this
.
groupBox2
.
Controls
.
Add
(
this
.
btn_StirLocation_Down
);
this
.
groupBox2
.
Controls
.
Add
(
this
.
btn_Clamping_Tighten
);
this
.
groupBox2
.
Controls
.
Add
(
this
.
btn_Clamping_Relax
);
this
.
groupBox2
.
Controls
.
Add
(
this
.
btnCloseLed
);
this
.
groupBox2
.
Controls
.
Add
(
this
.
btn_Door_Up
);
this
.
groupBox2
.
Controls
.
Add
(
this
.
btnOpenLed
);
this
.
groupBox2
.
Controls
.
Add
(
this
.
btn_Door_Down
);
this
.
groupBox2
.
Controls
.
Add
(
this
.
btnCloseAxisBreak
);
this
.
groupBox2
.
Controls
.
Add
(
this
.
btnOpenAxisBreak
);
this
.
groupBox2
.
Location
=
new
System
.
Drawing
.
Point
(
482
,
163
);
this
.
groupBox2
.
Name
=
"groupBox2"
;
this
.
groupBox2
.
Size
=
new
System
.
Drawing
.
Size
(
335
,
417
);
this
.
groupBox2
.
Size
=
new
System
.
Drawing
.
Size
(
335
,
296
);
this
.
groupBox2
.
TabIndex
=
255
;
this
.
groupBox2
.
TabStop
=
false
;
this
.
groupBox2
.
Text
=
"操作测试"
;
//
// btn_Warming_Stop
//
this
.
btn_Warming_Stop
.
FlatStyle
=
System
.
Windows
.
Forms
.
FlatStyle
.
Flat
;
this
.
btn_Warming_Stop
.
Font
=
new
System
.
Drawing
.
Font
(
"微软雅黑"
,
9F
,
System
.
Drawing
.
FontStyle
.
Regular
,
System
.
Drawing
.
GraphicsUnit
.
Point
,
((
byte
)(
134
)));
this
.
btn_Warming_Stop
.
Location
=
new
System
.
Drawing
.
Point
(
176
,
164
);
this
.
btn_Warming_Stop
.
Name
=
"btn_Warming_Stop"
;
this
.
btn_Warming_Stop
.
Size
=
new
System
.
Drawing
.
Size
(
120
,
34
);
this
.
btn_Warming_Stop
.
TabIndex
=
266
;
this
.
btn_Warming_Stop
.
Text
=
"回温区风机停止"
;
this
.
btn_Warming_Stop
.
UseVisualStyleBackColor
=
true
;
this
.
btn_Warming_Stop
.
Click
+=
new
System
.
EventHandler
(
this
.
btn_Warming_Stop_Click
);
//
// btn_Warming_Start
//
this
.
btn_Warming_Start
.
FlatStyle
=
System
.
Windows
.
Forms
.
FlatStyle
.
Flat
;
this
.
btn_Warming_Start
.
Font
=
new
System
.
Drawing
.
Font
(
"微软雅黑"
,
9F
,
System
.
Drawing
.
FontStyle
.
Regular
,
System
.
Drawing
.
GraphicsUnit
.
Point
,
((
byte
)(
134
)));
this
.
btn_Warming_Start
.
Location
=
new
System
.
Drawing
.
Point
(
176
,
127
);
this
.
btn_Warming_Start
.
Name
=
"btn_Warming_Start"
;
this
.
btn_Warming_Start
.
Size
=
new
System
.
Drawing
.
Size
(
120
,
34
);
this
.
btn_Warming_Start
.
TabIndex
=
265
;
this
.
btn_Warming_Start
.
Text
=
"回温区风机启动"
;
this
.
btn_Warming_Start
.
UseVisualStyleBackColor
=
true
;
this
.
btn_Warming_Start
.
Click
+=
new
System
.
EventHandler
(
this
.
btn_Warming_Start_Click
);
//
// btn_Colding_Stop
//
this
.
btn_Colding_Stop
.
FlatStyle
=
System
.
Windows
.
Forms
.
FlatStyle
.
Flat
;
this
.
btn_Colding_Stop
.
Font
=
new
System
.
Drawing
.
Font
(
"微软雅黑"
,
9F
,
System
.
Drawing
.
FontStyle
.
Regular
,
System
.
Drawing
.
GraphicsUnit
.
Point
,
((
byte
)(
134
)));
this
.
btn_Colding_Stop
.
Location
=
new
System
.
Drawing
.
Point
(
37
,
164
);
this
.
btn_Colding_Stop
.
Name
=
"btn_Colding_Stop"
;
this
.
btn_Colding_Stop
.
Size
=
new
System
.
Drawing
.
Size
(
120
,
34
);
this
.
btn_Colding_Stop
.
TabIndex
=
264
;
this
.
btn_Colding_Stop
.
Text
=
"冷气机停止"
;
this
.
btn_Colding_Stop
.
UseVisualStyleBackColor
=
true
;
this
.
btn_Colding_Stop
.
Click
+=
new
System
.
EventHandler
(
this
.
btn_Colding_Stop_Click
);
//
// btn_Colding_Start
//
this
.
btn_Colding_Start
.
FlatStyle
=
System
.
Windows
.
Forms
.
FlatStyle
.
Flat
;
this
.
btn_Colding_Start
.
Font
=
new
System
.
Drawing
.
Font
(
"微软雅黑"
,
9F
,
System
.
Drawing
.
FontStyle
.
Regular
,
System
.
Drawing
.
GraphicsUnit
.
Point
,
((
byte
)(
134
)));
this
.
btn_Colding_Start
.
Location
=
new
System
.
Drawing
.
Point
(
37
,
127
);
this
.
btn_Colding_Start
.
Name
=
"btn_Colding_Start"
;
this
.
btn_Colding_Start
.
Size
=
new
System
.
Drawing
.
Size
(
120
,
34
);
this
.
btn_Colding_Start
.
TabIndex
=
263
;
this
.
btn_Colding_Start
.
Text
=
"冷气机启动"
;
this
.
btn_Colding_Start
.
UseVisualStyleBackColor
=
true
;
this
.
btn_Colding_Start
.
Click
+=
new
System
.
EventHandler
(
this
.
btn_Colding_Start_Click
);
//
// btn_ColdDoor_Close
//
this
.
btn_ColdDoor_Close
.
FlatStyle
=
System
.
Windows
.
Forms
.
FlatStyle
.
Flat
;
this
.
btn_ColdDoor_Close
.
Font
=
new
System
.
Drawing
.
Font
(
"微软雅黑"
,
9F
,
System
.
Drawing
.
FontStyle
.
Regular
,
System
.
Drawing
.
GraphicsUnit
.
Point
,
((
byte
)(
134
)));
this
.
btn_ColdDoor_Close
.
Location
=
new
System
.
Drawing
.
Point
(
176
,
310
);
this
.
btn_ColdDoor_Close
.
Name
=
"btn_ColdDoor_Close"
;
this
.
btn_ColdDoor_Close
.
Size
=
new
System
.
Drawing
.
Size
(
120
,
34
);
this
.
btn_ColdDoor_Close
.
TabIndex
=
261
;
this
.
btn_ColdDoor_Close
.
Text
=
"冷藏区门关闭"
;
this
.
btn_ColdDoor_Close
.
UseVisualStyleBackColor
=
true
;
this
.
btn_ColdDoor_Close
.
Click
+=
new
System
.
EventHandler
(
this
.
btn_ColdDoor_Close_Click
);
//
// btn_ColdDoor_Open
//
this
.
btn_ColdDoor_Open
.
FlatStyle
=
System
.
Windows
.
Forms
.
FlatStyle
.
Flat
;
this
.
btn_ColdDoor_Open
.
Font
=
new
System
.
Drawing
.
Font
(
"微软雅黑"
,
9F
,
System
.
Drawing
.
FontStyle
.
Regular
,
System
.
Drawing
.
GraphicsUnit
.
Point
,
((
byte
)(
134
)));
this
.
btn_ColdDoor_Open
.
Location
=
new
System
.
Drawing
.
Point
(
176
,
347
);
this
.
btn_ColdDoor_Open
.
Name
=
"btn_ColdDoor_Open"
;
this
.
btn_ColdDoor_Open
.
Size
=
new
System
.
Drawing
.
Size
(
120
,
34
);
this
.
btn_ColdDoor_Open
.
TabIndex
=
262
;
this
.
btn_ColdDoor_Open
.
Text
=
"冷藏区门打开"
;
this
.
btn_ColdDoor_Open
.
UseVisualStyleBackColor
=
true
;
this
.
btn_ColdDoor_Open
.
Click
+=
new
System
.
EventHandler
(
this
.
btn_ColdDoor_Open_Click
);
//
// btn_StirLocation_Up
//
this
.
btn_StirLocation_Up
.
FlatStyle
=
System
.
Windows
.
Forms
.
FlatStyle
.
Flat
;
this
.
btn_StirLocation_Up
.
Font
=
new
System
.
Drawing
.
Font
(
"微软雅黑"
,
9F
,
System
.
Drawing
.
FontStyle
.
Regular
,
System
.
Drawing
.
GraphicsUnit
.
Point
,
((
byte
)(
134
)));
this
.
btn_StirLocation_Up
.
Location
=
new
System
.
Drawing
.
Point
(
37
,
310
);
this
.
btn_StirLocation_Up
.
Name
=
"btn_StirLocation_Up"
;
this
.
btn_StirLocation_Up
.
Size
=
new
System
.
Drawing
.
Size
(
120
,
34
);
this
.
btn_StirLocation_Up
.
TabIndex
=
259
;
this
.
btn_StirLocation_Up
.
Text
=
"搅拌气缸上升"
;
this
.
btn_StirLocation_Up
.
UseVisualStyleBackColor
=
true
;
this
.
btn_StirLocation_Up
.
Click
+=
new
System
.
EventHandler
(
this
.
btn_StirLocation_Up_Click
);
//
// btn_StirLocation_Down
//
this
.
btn_StirLocation_Down
.
FlatStyle
=
System
.
Windows
.
Forms
.
FlatStyle
.
Flat
;
this
.
btn_StirLocation_Down
.
Font
=
new
System
.
Drawing
.
Font
(
"微软雅黑"
,
9F
,
System
.
Drawing
.
FontStyle
.
Regular
,
System
.
Drawing
.
GraphicsUnit
.
Point
,
((
byte
)(
134
)));
this
.
btn_StirLocation_Down
.
Location
=
new
System
.
Drawing
.
Point
(
37
,
347
);
this
.
btn_StirLocation_Down
.
Name
=
"btn_StirLocation_Down"
;
this
.
btn_StirLocation_Down
.
Size
=
new
System
.
Drawing
.
Size
(
120
,
34
);
this
.
btn_StirLocation_Down
.
TabIndex
=
260
;
this
.
btn_StirLocation_Down
.
Text
=
"搅拌气缸下降"
;
this
.
btn_StirLocation_Down
.
UseVisualStyleBackColor
=
true
;
this
.
btn_StirLocation_Down
.
Click
+=
new
System
.
EventHandler
(
this
.
btn_StirLocation_Down_Click
);
//
// btn_Clamping_Tighten
//
this
.
btn_Clamping_Tighten
.
FlatStyle
=
System
.
Windows
.
Forms
.
FlatStyle
.
Flat
;
this
.
btn_Clamping_Tighten
.
Font
=
new
System
.
Drawing
.
Font
(
"微软雅黑"
,
9F
,
System
.
Drawing
.
FontStyle
.
Regular
,
System
.
Drawing
.
GraphicsUnit
.
Point
,
((
byte
)(
134
)));
this
.
btn_Clamping_Tighten
.
Location
=
new
System
.
Drawing
.
Point
(
176
,
219
);
this
.
btn_Clamping_Tighten
.
Name
=
"btn_Clamping_Tighten"
;
this
.
btn_Clamping_Tighten
.
Size
=
new
System
.
Drawing
.
Size
(
120
,
34
);
this
.
btn_Clamping_Tighten
.
TabIndex
=
257
;
this
.
btn_Clamping_Tighten
.
Text
=
"夹爪气缸夹紧"
;
this
.
btn_Clamping_Tighten
.
UseVisualStyleBackColor
=
true
;
this
.
btn_Clamping_Tighten
.
Click
+=
new
System
.
EventHandler
(
this
.
btn_Clamping_Tighten_Click
);
//
// btn_Clamping_Relax
//
this
.
btn_Clamping_Relax
.
FlatStyle
=
System
.
Windows
.
Forms
.
FlatStyle
.
Flat
;
this
.
btn_Clamping_Relax
.
Font
=
new
System
.
Drawing
.
Font
(
"微软雅黑"
,
9F
,
System
.
Drawing
.
FontStyle
.
Regular
,
System
.
Drawing
.
GraphicsUnit
.
Point
,
((
byte
)(
134
)));
this
.
btn_Clamping_Relax
.
Location
=
new
System
.
Drawing
.
Point
(
176
,
256
);
this
.
btn_Clamping_Relax
.
Name
=
"btn_Clamping_Relax"
;
this
.
btn_Clamping_Relax
.
Size
=
new
System
.
Drawing
.
Size
(
120
,
34
);
this
.
btn_Clamping_Relax
.
TabIndex
=
258
;
this
.
btn_Clamping_Relax
.
Text
=
"夹爪气缸放松"
;
this
.
btn_Clamping_Relax
.
UseVisualStyleBackColor
=
true
;
this
.
btn_Clamping_Relax
.
Click
+=
new
System
.
EventHandler
(
this
.
btn_Clamping_Relax_Click
);
//
// btnCloseLed
//
this
.
btnCloseLed
.
FlatStyle
=
System
.
Windows
.
Forms
.
FlatStyle
.
Flat
;
...
...
@@ -221,18 +77,6 @@
this
.
btnCloseLed
.
UseVisualStyleBackColor
=
true
;
this
.
btnCloseLed
.
Click
+=
new
System
.
EventHandler
(
this
.
btnCloseLed_Click
);
//
// btn_Door_Up
//
this
.
btn_Door_Up
.
FlatStyle
=
System
.
Windows
.
Forms
.
FlatStyle
.
Flat
;
this
.
btn_Door_Up
.
Font
=
new
System
.
Drawing
.
Font
(
"微软雅黑"
,
9F
,
System
.
Drawing
.
FontStyle
.
Regular
,
System
.
Drawing
.
GraphicsUnit
.
Point
,
((
byte
)(
134
)));
this
.
btn_Door_Up
.
Location
=
new
System
.
Drawing
.
Point
(
37
,
219
);
this
.
btn_Door_Up
.
Name
=
"btn_Door_Up"
;
this
.
btn_Door_Up
.
Size
=
new
System
.
Drawing
.
Size
(
120
,
34
);
this
.
btn_Door_Up
.
TabIndex
=
248
;
this
.
btn_Door_Up
.
Text
=
"进料口门上升"
;
this
.
btn_Door_Up
.
UseVisualStyleBackColor
=
true
;
this
.
btn_Door_Up
.
Click
+=
new
System
.
EventHandler
(
this
.
btnOpenDoor_Click
);
//
// btnOpenLed
//
this
.
btnOpenLed
.
FlatStyle
=
System
.
Windows
.
Forms
.
FlatStyle
.
Flat
;
...
...
@@ -245,18 +89,6 @@
this
.
btnOpenLed
.
UseVisualStyleBackColor
=
true
;
this
.
btnOpenLed
.
Click
+=
new
System
.
EventHandler
(
this
.
btnOpenLed_Click
);
//
// btn_Door_Down
//
this
.
btn_Door_Down
.
FlatStyle
=
System
.
Windows
.
Forms
.
FlatStyle
.
Flat
;
this
.
btn_Door_Down
.
Font
=
new
System
.
Drawing
.
Font
(
"微软雅黑"
,
9F
,
System
.
Drawing
.
FontStyle
.
Regular
,
System
.
Drawing
.
GraphicsUnit
.
Point
,
((
byte
)(
134
)));
this
.
btn_Door_Down
.
Location
=
new
System
.
Drawing
.
Point
(
37
,
256
);
this
.
btn_Door_Down
.
Name
=
"btn_Door_Down"
;
this
.
btn_Door_Down
.
Size
=
new
System
.
Drawing
.
Size
(
120
,
34
);
this
.
btn_Door_Down
.
TabIndex
=
249
;
this
.
btn_Door_Down
.
Text
=
"进料口门下降"
;
this
.
btn_Door_Down
.
UseVisualStyleBackColor
=
true
;
this
.
btn_Door_Down
.
Click
+=
new
System
.
EventHandler
(
this
.
btnCloseDoor_Click
);
//
// btnCloseAxisBreak
//
this
.
btnCloseAxisBreak
.
FlatStyle
=
System
.
Windows
.
Forms
.
FlatStyle
.
Flat
;
...
...
@@ -284,7 +116,7 @@
// button1
//
this
.
button1
.
Anchor
=
((
System
.
Windows
.
Forms
.
AnchorStyles
)((
System
.
Windows
.
Forms
.
AnchorStyles
.
Bottom
|
System
.
Windows
.
Forms
.
AnchorStyles
.
Left
)));
this
.
button1
.
Location
=
new
System
.
Drawing
.
Point
(
683
,
598
);
this
.
button1
.
Location
=
new
System
.
Drawing
.
Point
(
683
,
477
);
this
.
button1
.
Name
=
"button1"
;
this
.
button1
.
Size
=
new
System
.
Drawing
.
Size
(
126
,
37
);
this
.
button1
.
TabIndex
=
254
;
...
...
@@ -427,7 +259,7 @@
this
.
groupBox4
.
Controls
.
Add
(
this
.
tableLayoutPanel2
);
this
.
groupBox4
.
Location
=
new
System
.
Drawing
.
Point
(
247
,
8
);
this
.
groupBox4
.
Name
=
"groupBox4"
;
this
.
groupBox4
.
Size
=
new
System
.
Drawing
.
Size
(
229
,
629
);
this
.
groupBox4
.
Size
=
new
System
.
Drawing
.
Size
(
229
,
508
);
this
.
groupBox4
.
TabIndex
=
104
;
this
.
groupBox4
.
TabStop
=
false
;
this
.
groupBox4
.
Text
=
"DO列表"
;
...
...
@@ -444,7 +276,7 @@
this
.
tableLayoutPanel2
.
RowCount
=
2
;
this
.
tableLayoutPanel2
.
RowStyles
.
Add
(
new
System
.
Windows
.
Forms
.
RowStyle
(
System
.
Windows
.
Forms
.
SizeType
.
Absolute
,
17F
));
this
.
tableLayoutPanel2
.
RowStyles
.
Add
(
new
System
.
Windows
.
Forms
.
RowStyle
(
System
.
Windows
.
Forms
.
SizeType
.
Absolute
,
17F
));
this
.
tableLayoutPanel2
.
Size
=
new
System
.
Drawing
.
Size
(
218
,
609
);
this
.
tableLayoutPanel2
.
Size
=
new
System
.
Drawing
.
Size
(
218
,
488
);
this
.
tableLayoutPanel2
.
TabIndex
=
103
;
//
// groupBox3
...
...
@@ -454,7 +286,7 @@
this
.
groupBox3
.
Controls
.
Add
(
this
.
tableLayoutPanel1
);
this
.
groupBox3
.
Location
=
new
System
.
Drawing
.
Point
(
12
,
8
);
this
.
groupBox3
.
Name
=
"groupBox3"
;
this
.
groupBox3
.
Size
=
new
System
.
Drawing
.
Size
(
229
,
629
);
this
.
groupBox3
.
Size
=
new
System
.
Drawing
.
Size
(
229
,
508
);
this
.
groupBox3
.
TabIndex
=
103
;
this
.
groupBox3
.
TabStop
=
false
;
this
.
groupBox3
.
Text
=
"DI列表"
;
...
...
@@ -471,7 +303,7 @@
this
.
tableLayoutPanel1
.
RowCount
=
2
;
this
.
tableLayoutPanel1
.
RowStyles
.
Add
(
new
System
.
Windows
.
Forms
.
RowStyle
(
System
.
Windows
.
Forms
.
SizeType
.
Absolute
,
17F
));
this
.
tableLayoutPanel1
.
RowStyles
.
Add
(
new
System
.
Windows
.
Forms
.
RowStyle
(
System
.
Windows
.
Forms
.
SizeType
.
Absolute
,
17F
));
this
.
tableLayoutPanel1
.
Size
=
new
System
.
Drawing
.
Size
(
218
,
609
);
this
.
tableLayoutPanel1
.
Size
=
new
System
.
Drawing
.
Size
(
218
,
488
);
this
.
tableLayoutPanel1
.
TabIndex
=
102
;
//
// chbAutoRead
...
...
@@ -481,7 +313,7 @@
this
.
chbAutoRead
.
Checked
=
true
;
this
.
chbAutoRead
.
CheckState
=
System
.
Windows
.
Forms
.
CheckState
.
Checked
;
this
.
chbAutoRead
.
Font
=
new
System
.
Drawing
.
Font
(
"微软雅黑"
,
9F
,
System
.
Drawing
.
FontStyle
.
Regular
,
System
.
Drawing
.
GraphicsUnit
.
Point
,
((
byte
)(
134
)));
this
.
chbAutoRead
.
Location
=
new
System
.
Drawing
.
Point
(
498
,
603
);
this
.
chbAutoRead
.
Location
=
new
System
.
Drawing
.
Point
(
498
,
482
);
this
.
chbAutoRead
.
Name
=
"chbAutoRead"
;
this
.
chbAutoRead
.
Size
=
new
System
.
Drawing
.
Size
(
75
,
21
);
this
.
chbAutoRead
.
TabIndex
=
244
;
...
...
@@ -492,7 +324,7 @@
//
this
.
AutoScaleDimensions
=
new
System
.
Drawing
.
SizeF
(
7F
,
17F
);
this
.
AutoScaleMode
=
System
.
Windows
.
Forms
.
AutoScaleMode
.
Font
;
this
.
ClientSize
=
new
System
.
Drawing
.
Size
(
828
,
647
);
this
.
ClientSize
=
new
System
.
Drawing
.
Size
(
828
,
526
);
this
.
Controls
.
Add
(
this
.
groupBox2
);
this
.
Controls
.
Add
(
this
.
button1
);
this
.
Controls
.
Add
(
this
.
groupBox1
);
...
...
@@ -531,8 +363,6 @@
private
System
.
Windows
.
Forms
.
ComboBox
cmbWriteIO
;
private
System
.
Windows
.
Forms
.
CheckBox
chbAutoRead
;
private
System
.
Windows
.
Forms
.
TextBox
txtDoName
;
private
System
.
Windows
.
Forms
.
Button
btn_Door_Down
;
private
System
.
Windows
.
Forms
.
Button
btn_Door_Up
;
private
System
.
Windows
.
Forms
.
Button
btnCloseAxisBreak
;
private
System
.
Windows
.
Forms
.
Button
btnOpenAxisBreak
;
private
System
.
Windows
.
Forms
.
Button
button1
;
...
...
@@ -542,16 +372,6 @@
private
System
.
Windows
.
Forms
.
Button
btnOpenDo
;
private
System
.
Windows
.
Forms
.
Button
btnWriteSingleDO
;
private
System
.
Windows
.
Forms
.
Button
btnCloseAll
;
private
System
.
Windows
.
Forms
.
Button
btn_Clamping_Tighten
;
private
System
.
Windows
.
Forms
.
Button
btn_Clamping_Relax
;
private
System
.
Windows
.
Forms
.
Button
btn_Warming_Stop
;
private
System
.
Windows
.
Forms
.
Button
btn_Warming_Start
;
private
System
.
Windows
.
Forms
.
Button
btn_Colding_Stop
;
private
System
.
Windows
.
Forms
.
Button
btn_Colding_Start
;
private
System
.
Windows
.
Forms
.
Button
btn_ColdDoor_Close
;
private
System
.
Windows
.
Forms
.
Button
btn_ColdDoor_Open
;
private
System
.
Windows
.
Forms
.
Button
btn_StirLocation_Up
;
private
System
.
Windows
.
Forms
.
Button
btn_StirLocation_Down
;
}
}
source/VerticalStoreClinet/FrmIOStatus.cs
查看文件 @
4be5928
...
...
@@ -30,14 +30,10 @@ namespace OnlineStore.TinPasteStore
Control
.
CheckForIllegalCrossThreadCalls
=
false
;
InitializeComponent
();
}
public
FrmIOStatus
(
VerticalStoreBean
store
)
public
void
SetStore
(
VerticalStoreBean
store
)
{
Control
.
CheckForIllegalCrossThreadCalls
=
false
;
InitializeComponent
();
this
.
boxBean
=
store
;
this
.
StoreId
=
store
.
StoreID
;
LoadIOList
();
}
Dictionary
<
string
,
IOTextControl
>
DIControlList
=
new
Dictionary
<
string
,
IOTextControl
>();
...
...
@@ -146,6 +142,7 @@ namespace OnlineStore.TinPasteStore
private
void
FrmStoreIOStatus_Load
(
object
sender
,
EventArgs
e
)
{
LoadIOList
();
}
private
void
cmbWriteIO_DrawItem
(
object
sender
,
DrawItemEventArgs
e
)
...
...
@@ -192,18 +189,6 @@ namespace OnlineStore.TinPasteStore
}
}
private
void
btnOpenDoor_Click
(
object
sender
,
EventArgs
e
)
{
IOManager
.
IOMove
(
IO_Type
.
Door_Up
,
IO_VALUE
.
HIGH
);
IOManager
.
IOMove
(
IO_Type
.
Door_Down
,
IO_VALUE
.
LOW
);
}
private
void
btnCloseDoor_Click
(
object
sender
,
EventArgs
e
)
{
IOManager
.
IOMove
(
IO_Type
.
Door_Down
,
IO_VALUE
.
HIGH
);
IOManager
.
IOMove
(
IO_Type
.
Door_Up
,
IO_VALUE
.
LOW
);
}
private
void
FrmIOStatus_Shown
(
object
sender
,
EventArgs
e
)
{
timer1
.
Start
();
...
...
@@ -259,57 +244,6 @@ namespace OnlineStore.TinPasteStore
WriteDO
(
IO_VALUE
.
LOW
);
}
private
void
btn_Colding_Start_Click
(
object
sender
,
EventArgs
e
)
{
IOManager
.
IOMove
(
IO_Type
.
Colding_Start
,
IO_VALUE
.
HIGH
);
}
private
void
btn_Colding_Stop_Click
(
object
sender
,
EventArgs
e
)
{
IOManager
.
IOMove
(
IO_Type
.
Colding_Start
,
IO_VALUE
.
LOW
);
}
private
void
btn_Warming_Start_Click
(
object
sender
,
EventArgs
e
)
{
IOManager
.
IOMove
(
IO_Type
.
Warming_Start
,
IO_VALUE
.
HIGH
);
}
private
void
btn_Warming_Stop_Click
(
object
sender
,
EventArgs
e
)
{
IOManager
.
IOMove
(
IO_Type
.
Warming_Start
,
IO_VALUE
.
LOW
);
}
private
void
btn_Clamping_Tighten_Click
(
object
sender
,
EventArgs
e
)
{
StoreManager
.
Store
.
CylinderMove
(
null
,
IO_Type
.
Clamping_Relax
,
IO_Type
.
Clamping_Tighten
);
}
private
void
btn_Clamping_Relax_Click
(
object
sender
,
EventArgs
e
)
{
StoreManager
.
Store
.
CylinderMove
(
null
,
IO_Type
.
Clamping_Tighten
,
IO_Type
.
Clamping_Relax
);
}
private
void
btn_StirLocation_Up_Click
(
object
sender
,
EventArgs
e
)
{
StoreManager
.
Store
.
CylinderMove
(
null
,
IO_Type
.
StirLocation_Down
,
IO_Type
.
StirLocation_Up
);
}
private
void
btn_StirLocation_Down_Click
(
object
sender
,
EventArgs
e
)
{
StoreManager
.
Store
.
CylinderMove
(
null
,
IO_Type
.
StirLocation_Up
,
IO_Type
.
StirLocation_Down
);
}
private
void
btn_ColdDoor_Close_Click
(
object
sender
,
EventArgs
e
)
{
StoreManager
.
Store
.
CylinderMove
(
null
,
IO_Type
.
ColdDoor_Open
,
IO_Type
.
ColdDoor_Close
);
}
private
void
btn_ColdDoor_Open_Click
(
object
sender
,
EventArgs
e
)
{
StoreManager
.
Store
.
CylinderMove
(
null
,
IO_Type
.
ColdDoor_Close
,
IO_Type
.
ColdDoor_Open
);
}
}
}
source/VerticalStoreClinet/FrmStoreBox.Designer.cs
查看文件 @
4be5928
此文件的差异太大,无法显示。
source/VerticalStoreClinet/FrmStoreBox.cs
查看文件 @
4be5928
...
...
@@ -44,25 +44,14 @@ namespace OnlineStore.TinPasteStore
LogUtil
.
error
(
LOGGER
,
"找不到对应的料仓"
);
return
;
}
Vertical
Store
Position
ktkPosition
=
null
;
VerticalPosition
ktkPosition
=
null
;
if
(
store
.
PositionNumList
.
Count
>
0
)
{
cmbPosition
.
DataSource
=
store
.
PositionNumList
;
cmbPosition
.
SelectedIndex
=
0
;
ktkPosition
=
CSVPositionReader
<
VerticalStorePosition
>.
GetPositon
(
cmbPosition
.
Text
);
//store.PositionNumList = positionNumList;
List
<
VerticalStorePosition
>
allList
=
CSVPositionReader
<
VerticalStorePosition
>.
getPositionList
();
List
<
VerticalStorePosition
>
position
=
(
from
m
in
allList
where
m
.
PosType
.
Equals
(
2
)
select
m
).
ToList
<
VerticalStorePosition
>();
cmbTargetPos
.
DataSource
=
position
;
cmbTargetPos
.
DisplayMember
=
"PositionNum"
;
cmbTargetPos
.
SelectedIndex
=
0
;
ktkPosition
=
CSVPositionReader
<
VerticalPosition
>.
GetPositon
(
cmbPosition
.
Text
);
cmbWeight
.
SelectedIndex
=
cmbWeight
.
Items
.
Count
-
1
;
}
ShowDoorPosition
();
ShowGPostion
();
ShowPosition
(
ktkPosition
);
timer1
.
Enabled
=
true
;
}
...
...
@@ -122,11 +111,12 @@ namespace OnlineStore.TinPasteStore
this
.
chbBuzzer
.
Checked
=
store
.
UseBuzzer
;
axisMoveControl1
.
LoadData
(
store
,
store
.
moveAxisList
.
ToArray
());
FrmDeviceDebug
frmd
=
new
FrmDeviceDebug
();
AddForm
(
" 温湿度/称重 "
,
frmd
);
FrmIOStatus
frm
=
new
FrmIOStatus
();
frm
.
SetStore
(
store
);
AddForm
(
"IO状态查看"
,
frm
);
LoadOk
=
true
;
HideForm
();
this
.
Opacity
=
1
;
}
...
...
@@ -156,9 +146,7 @@ namespace OnlineStore.TinPasteStore
return
;
}
lblMoveState
.
Text
=
store
.
GetMoveStr
();
lblThisSta
.
Text
=
store
.
GetRunStr
()
+
" "
;
lblStirInfo
.
Text
=
store
.
CurrStirInfo
.
toStr
();
if
(
store
.
MoveInfo
.
MoveType
.
Equals
(
MoveType
.
None
).
Equals
(
false
))
{
lblThisSta
.
Text
+=
store
.
MoveInfo
.
MoveParam
.
ToStr
();
...
...
@@ -200,26 +188,26 @@ namespace OnlineStore.TinPasteStore
}
lblWarnMsg
.
Text
=
store
.
WarnMsg
;
if
(
store
.
Config
.
IsHasDoorLimit
.
Equals
(
1
))
{
if
(
IOManager
.
IOValue
(
IO_Type
.
Door_Limit
).
Equals
(
IO_VALUE
.
LOW
))
{
lblWarnMsg
.
Text
=
lblWarnMsg
.
Text
+
" 前门未关"
;
}
else
if
(
store
.
Config
.
StoreDIList
.
ContainsKey
(
IO_Type
.
Door_LeftLimit
)
&&
IOManager
.
IOValue
(
IO_Type
.
Door_LeftLimit
).
Equals
(
IO_VALUE
.
LOW
))
{
lblWarnMsg
.
Text
=
lblWarnMsg
.
Text
+
" 左侧门未关"
;
}
else
if
(
store
.
Config
.
StoreDIList
.
ContainsKey
(
IO_Type
.
Door_RightLimit
)
&&
IOManager
.
IOValue
(
IO_Type
.
Door_RightLimit
).
Equals
(
IO_VALUE
.
LOW
))
{
lblWarnMsg
.
Text
=
lblWarnMsg
.
Text
+
" 右侧门未关"
;
}
}
//如果不在出入库中,且叉子上有信号,需要提示检查叉子
if
(
store
.
runStatus
.
Equals
(
StoreRunStatus
.
Runing
)
&&
IOManager
.
IOValue
(
IO_Type
.
TinCheck_Fixture
).
Equals
(
IO_VALUE
.
HIGH
))
{
lblWarnMsg
.
Text
=
lblWarnMsg
.
Text
+
" 叉子料盘检测有料,请检查"
;
}
//
if (store.Config.IsHasDoorLimit.Equals(1))
//
{
//
if (IOManager.IOValue(IO_Type.Door_Limit).Equals(IO_VALUE.LOW))
//
{
//
lblWarnMsg.Text = lblWarnMsg.Text + " 前门未关";
//
}
//
else if (store.Config.StoreDIList.ContainsKey(IO_Type.Door_LeftLimit) && IOManager.IOValue(IO_Type.Door_LeftLimit).Equals(IO_VALUE.LOW))
//
{
//
lblWarnMsg.Text = lblWarnMsg.Text + " 左侧门未关";
//
}
//
else if (store.Config.StoreDIList.ContainsKey(IO_Type.Door_RightLimit) && IOManager.IOValue(IO_Type.Door_RightLimit).Equals(IO_VALUE.LOW))
//
{
//
lblWarnMsg.Text = lblWarnMsg.Text + " 右侧门未关";
//
}
//
}
//
//
如果不在出入库中,且叉子上有信号,需要提示检查叉子
//
if (store.runStatus.Equals(StoreRunStatus.Runing) && IOManager.IOValue(IO_Type.TinCheck_Fixture).Equals(IO_VALUE.HIGH))
//
{
//
lblWarnMsg.Text = lblWarnMsg.Text + " 叉子料盘检测有料,请检查";
//
}
if
(
store
.
autoNext
)
{
...
...
@@ -296,170 +284,26 @@ namespace OnlineStore.TinPasteStore
}
}
private
void
cmbPosition_SelectedIndexChanged
(
object
sender
,
EventArgs
e
)
{
if
(
cmbPosition
.
SelectedIndex
>=
0
)
{
string
PosId
=
cmbPosition
.
Text
;
VerticalStorePosition
position
=
CSVPositionReader
<
VerticalStorePosition
>.
GetPositon
(
PosId
);
ShowPosition
(
position
);
if
(
position
.
IsTieBag
())
{
rdbFixture
.
Checked
=
false
;
rdbFixture
.
Enabled
=
false
;
rdbLeft
.
Enabled
=
true
;
rdbRight
.
Enabled
=
true
;
rdbLeft
.
Checked
=
true
;
}
else
{
rdbFixture
.
Enabled
=
true
;
rdbFixture
.
Checked
=
true
;
rdbLeft
.
Enabled
=
false
;
rdbRight
.
Enabled
=
false
;
}
btnBackwarm
.
Text
=
"["
+
PosId
+
"]->回温测试"
;
btnStirTest
.
Text
=
"["
+
PosId
+
"]->搅拌测试"
;
if
(
position
.
PosType
.
Equals
(
1
))
{
groWarm
.
Enabled
=
true
;
groStir
.
Enabled
=
false
;
btnOutStore
.
Enabled
=
true
;
}
else
if
(
position
.
PosType
.
Equals
(
2
))
{
groWarm
.
Enabled
=
false
;
groStir
.
Enabled
=
true
;
btnOutStore
.
Enabled
=
true
;
}
else
private
StoreMoveP
GetMoveP
()
{
groWarm
.
Enabled
=
false
;
groStir
.
Enabled
=
false
;
btnOutStore
.
Enabled
=
false
;
}
throw
new
NotImplementedException
();
}
}
#
region
库位配置
private
void
ShowGPostion
()
{
txtInOutP1
.
Text
=
store
.
Config
.
InOutAxis_P1
.
ToString
();
txtStirP1
.
Text
=
store
.
Config
.
Stir_Axis_P1
.
ToString
();
txtStirP2
.
Text
=
store
.
Config
.
Stir_Axis_P2
.
ToString
();
txtWarmP1
.
Text
=
store
.
Config
.
Warming_Axis_P1
.
ToString
();
txtColdP1
.
Text
=
store
.
Config
.
Colding_Axis_P1
.
ToString
();
txtUpdownP101
.
Text
=
store
.
Config
.
UpDownAxis_StirH_P101
.
ToString
();
txtUpdownP102
.
Text
=
store
.
Config
.
UpDownAxis_StirL_P102
.
ToString
();
txtMiddleP101
.
Text
=
store
.
Config
.
MiddleAxis_Stir_P101
.
ToString
();
txtInOutP101
.
Text
=
store
.
Config
.
InOutAxis_Stir_P101
.
ToString
();
}
private
void
ShowDoorPosition
()
private
void
cmbPosition_SelectedIndexChanged
(
object
sender
,
EventArgs
e
)
{
txtUpDownP21
.
Text
=
store
.
Config
.
UpDownAxis_IH_P21
.
ToString
();
txtUpDownP71
.
Text
=
store
.
Config
.
UpDownAxis_OH_P71
.
ToString
();
txtUpDownP81
.
Text
=
store
.
Config
.
UpDownAxis_IL_P81
.
ToString
();
txtUpDownP11
.
Text
=
store
.
Config
.
UpDownAxis_OL_P11
.
ToString
();
txtMiddleP11
.
Text
=
store
.
Config
.
MiddleAxis_P11
.
ToString
();
txtInOutP21
.
Text
=
store
.
Config
.
InOutAxis_P21
.
ToString
();
txtMiddleP12
.
Text
=
store
.
Config
.
MiddleAxis_P12
.
ToString
();
txtInOutP22
.
Text
=
store
.
Config
.
InOutAxis_P22
.
ToString
();
txtInOutP20
.
Text
=
store
.
Config
.
InOutAxis_P20
.
ToString
();
txtMiddleP1
.
Text
=
store
.
Config
.
MiddleAxis_P1
.
ToString
();
txtUpDownP1
.
Text
=
store
.
Config
.
UpDownAxis_OL_P1
.
ToString
();
txtUpDownP2
.
Text
=
store
.
Config
.
UpDownAxis_IH_P2
.
ToString
();
txtUpDownP7
.
Text
=
store
.
Config
.
UpDownAxis_OH_P7
.
ToString
();
txtUpDownP8
.
Text
=
store
.
Config
.
UpDownAxis_IL_P8
.
ToString
();
}
private
StoreMoveP
GetMoveP
()
if
(
cmbPosition
.
SelectedIndex
>=
0
)
{
StoreMoveP
ktk
=
new
StoreMoveP
();
ktk
.
Warm_P2
=
FormUtil
.
GetIntValue
(
txtWarmP2
);
ktk
.
Cold_P2
=
FormUtil
.
GetIntValue
(
txtColdP2
);
// ktk.StirAxis_P = FormUtil.GetIntValue( );
ktk
.
InOut_P1
=
FormUtil
.
GetIntValue
(
txtInOutP1
);
ktk
.
InOut_P3
=
FormUtil
.
GetIntValue
(
txtInOutP3
);
ktk
.
Middle_P2
=
FormUtil
.
GetIntValue
(
txtMiddleP2
);
ktk
.
UpDown_P3
=
FormUtil
.
GetIntValue
(
txtUpDownP3
);
ktk
.
UpDown_P4
=
FormUtil
.
GetIntValue
(
txtUpDownP4
);
ktk
.
UpDown_P5
=
FormUtil
.
GetIntValue
(
txtUpDownP5
);
ktk
.
UpDown_P6
=
FormUtil
.
GetIntValue
(
txtUpDownP6
);
string
PosId
=
cmbPosition
.
Text
;
VerticalPosition
position
=
CSVPositionReader
<
VerticalPosition
>.
GetPositon
(
PosId
);
if
(
rdbFixture
.
Checked
)
{
ktk
.
UpDown_P1
=
FormUtil
.
GetIntValue
(
txtUpDownP1
);
ktk
.
UpDown_P2
=
FormUtil
.
GetIntValue
(
txtUpDownP2
);
ktk
.
UpDown_P7
=
FormUtil
.
GetIntValue
(
txtUpDownP7
);
ktk
.
UpDown_P8
=
FormUtil
.
GetIntValue
(
txtUpDownP8
);
ktk
.
InOut_P2
=
FormUtil
.
GetIntValue
(
txtInOutP20
);
ktk
.
Middle_P1
=
FormUtil
.
GetIntValue
(
txtMiddleP1
);
}
else
if
(
rdbLeft
.
Checked
)
{
ktk
.
UpDown_P1
=
FormUtil
.
GetIntValue
(
txtUpDownP11
);
ktk
.
UpDown_P2
=
FormUtil
.
GetIntValue
(
txtUpDownP21
);
ktk
.
UpDown_P7
=
FormUtil
.
GetIntValue
(
txtUpDownP71
);
ktk
.
UpDown_P8
=
FormUtil
.
GetIntValue
(
txtUpDownP81
);
ktk
.
InOut_P2
=
FormUtil
.
GetIntValue
(
txtInOutP21
);
ktk
.
Middle_P2
=
FormUtil
.
GetIntValue
(
txtMiddleP11
);
}
else
if
(
rdbRight
.
Checked
)
{
ktk
.
UpDown_P1
=
FormUtil
.
GetIntValue
(
txtUpDownP11
);
ktk
.
UpDown_P2
=
FormUtil
.
GetIntValue
(
txtUpDownP21
);
ktk
.
UpDown_P7
=
FormUtil
.
GetIntValue
(
txtUpDownP71
);
ktk
.
UpDown_P8
=
FormUtil
.
GetIntValue
(
txtUpDownP81
);
ktk
.
InOut_P2
=
FormUtil
.
GetIntValue
(
txtInOutP22
);
ktk
.
Middle_P2
=
FormUtil
.
GetIntValue
(
txtMiddleP12
);
}
return
ktk
;
}
private
void
ShowPosition
(
VerticalStorePosition
position
)
{
if
(
position
!=
null
)
{
txtMiddleP2
.
Text
=
position
.
MiddleAxis_P2
.
ToString
();
txtUpDownP3
.
Text
=
position
.
UpDownAxis_IH_P3
.
ToString
();
txtUpDownP4
.
Text
=
position
.
UpDownAxis_IL_P4
.
ToString
();
txtUpDownP5
.
Text
=
position
.
UpDownAxis_OH_P5
.
ToString
();
txtUpDownP6
.
Text
=
position
.
UpDownAxis_OL_P6
.
ToString
();
txtWarmP2
.
Text
=
position
.
WarmAxis_P2
.
ToString
();
txtColdP2
.
Text
=
position
.
ColdAxis_P2
.
ToString
();
txtInOutP3
.
Text
=
position
.
InOutAxis_P3
.
ToString
();
lblPosType
.
Text
=
position
.
PosTypeStr
();
}
}
private
VerticalStorePosition
GetPosition
(
VerticalStorePosition
position
)
{
position
.
MiddleAxis_P2
=
FormUtil
.
GetIntValue
(
txtMiddleP2
);
position
.
UpDownAxis_IH_P3
=
FormUtil
.
GetIntValue
(
txtUpDownP3
);
position
.
UpDownAxis_IL_P4
=
FormUtil
.
GetIntValue
(
txtUpDownP4
);
position
.
InOutAxis_P3
=
FormUtil
.
GetIntValue
(
txtInOutP3
);
position
.
ColdAxis_P2
=
FormUtil
.
GetIntValue
(
txtColdP2
);
position
.
UpDownAxis_OH_P5
=
FormUtil
.
GetIntValue
(
txtUpDownP5
);
position
.
UpDownAxis_OL_P6
=
FormUtil
.
GetIntValue
(
txtUpDownP6
);
position
.
WarmAxis_P2
=
FormUtil
.
GetIntValue
(
txtWarmP2
);
return
position
;
}
private
void
btnSavePosition_Click
(
object
sender
,
EventArgs
e
)
{
string
selectPositionNum
=
cmbPosition
.
Text
;
Vertical
StorePosition
position
=
CSVPositionReader
<
VerticalStore
Position
>.
GetPositon
(
selectPositionNum
);
Vertical
Position
position
=
CSVPositionReader
<
Vertical
Position
>.
GetPositon
(
selectPositionNum
);
position
=
GetPosition
(
position
);
string
appPath
=
Application
.
StartupPath
;
string
positionConfigFile
=
appPath
+
ConfigAppSettings
.
GetValue
(
Setting_Init
.
Store_Position_Config
);
...
...
@@ -467,7 +311,7 @@ namespace OnlineStore.TinPasteStore
{
positionConfigFile
=
appPath
+
ConfigAppSettings
.
GetValue
(
Setting_Init
.
Store_Position_Config
,
"_"
+
store
.
StoreID
.
ToString
());
}
bool
result
=
CSVPositionReader
<
Vertical
Store
Position
>.
SavePostion
(
positionConfigFile
,
position
);
bool
result
=
CSVPositionReader
<
VerticalPosition
>.
SavePostion
(
positionConfigFile
,
position
);
if
(!
result
)
{
MessageBox
.
Show
(
"库位["
+
selectPositionNum
+
"]保存失败 "
);
...
...
@@ -478,89 +322,26 @@ namespace OnlineStore.TinPasteStore
}
}
#
endregion
#
region
轴运动测试
private
bool
InOutIsIsP1
()
{
int
InOutDefaultPosition
=
ConfigAppSettings
.
GetIntValue
(
Setting_Init
.
InOutDefaultPosition
);
int
currValue
=
ACServerManager
.
GetActualtPosition
(
store
.
Config
.
InOut_Axis
.
DeviceName
,
store
.
Config
.
InOut_Axis
.
GetAxisValue
());
if
(
currValue
<=
InOutDefaultPosition
)
{
return
true
;
}
MessageBox
.
Show
(
"叉子不在待机位,请先将叉子退回待机位("
+
InOutDefaultPosition
+
")"
,
"警告(叉子在待机位时,才能移动升降轴和旋转轴) "
,
MessageBoxButtons
.
OK
,
MessageBoxIcon
.
Exclamation
);
return
false
;
}
private
void
AxisABSMove
(
ConfigMoveAxis
moveAxis
,
TextBox
txt
,
int
targetSpeed
)
{
if
(
store
.
Config
.
InOut_Axis
.
IsSameAxis
(
moveAxis
.
DeviceName
,
moveAxis
.
GetAxisValue
()))
{
if
(
store
.
InOutAxisCanMove
().
Equals
(
false
))
{
MessageBox
.
Show
(
"定位气缸不在下降端,不能移动进出轴"
,
"警告"
,
MessageBoxButtons
.
OK
,
MessageBoxIcon
.
Warning
);
return
;
}
}
else
{
if
(!
InOutIsIsP1
())
private
VerticalPosition
GetPosition
(
VerticalPosition
position
)
{
return
;
}
}
int
targetPosition
=
FormUtil
.
GetIntValue
(
txt
);
moveAxis
.
TargetPosition
=
targetPosition
;
ACServerManager
.
AbsMove
(
moveAxis
.
DeviceName
,
moveAxis
.
GetAxisValue
(),
targetPosition
,
targetSpeed
);
throw
new
NotImplementedException
();
}
private
void
btnUpDownP1_Click
(
object
sender
,
EventArgs
e
)
{
AxisABSMove
(
store
.
Config
.
UpDown_Axis
,
txtUpDownP1
,
store
.
Config
.
UpDownAxis_P1_Speed
);
}
private
void
btnUpDownP2_Click
(
object
sender
,
EventArgs
e
)
{
AxisABSMove
(
store
.
Config
.
UpDown_Axis
,
txtUpDownP2
,
store
.
Config
.
UpDownAxis_P2_Speed
);
}
private
void
btnUpDownP7_Click
(
object
sender
,
EventArgs
e
)
{
AxisABSMove
(
store
.
Config
.
UpDown_Axis
,
txtUpDownP7
,
store
.
Config
.
UpDownAxis_P7_Speed
);
}
#
region
轴运动测试
private
void
btnUpDownP8_Click
(
object
sender
,
EventArgs
e
)
{
AxisABSMove
(
store
.
Config
.
UpDown_Axis
,
txtUpDownP8
,
store
.
Config
.
UpDownAxis_P8_Speed
);
}
private
void
btnUpDownP3_Click
(
object
sender
,
EventArgs
e
)
{
AxisABSMove
(
store
.
Config
.
UpDown_Axis
,
txtUpDownP3
,
store
.
Config
.
UpDownAxis_P3_Speed
);
}
private
void
btnUpDownP4_Click
(
object
sender
,
EventArgs
e
)
private
void
AxisABSMove
(
ConfigMoveAxis
moveAxis
,
TextBox
txt
,
int
targetSpeed
)
{
AxisABSMove
(
store
.
Config
.
UpDown_Axis
,
txtUpDownP4
,
store
.
Config
.
UpDownAxis_P4_Speed
);
}
private
void
btnUpDownP5_Click
(
object
sender
,
EventArgs
e
)
{
A
xisABSMove
(
store
.
Config
.
UpDown_Axis
,
txtUpDownP5
,
store
.
Config
.
UpDownAxis_P5_
Speed
);
int
targetPosition
=
FormUtil
.
GetIntValue
(
txt
);
moveAxis
.
TargetPosition
=
targetPosition
;
A
CServerManager
.
AbsMove
(
moveAxis
.
DeviceName
,
moveAxis
.
GetAxisValue
(),
targetPosition
,
target
Speed
);
}
private
void
btnUpDownP6_Click
(
object
sender
,
EventArgs
e
)
{
AxisABSMove
(
store
.
Config
.
UpDown_Axis
,
txtUpDownP6
,
store
.
Config
.
UpDownAxis_P6_Speed
);
}
private
void
btnMiddleP1_Click
(
object
sender
,
EventArgs
e
)
{
AxisABSMove
(
store
.
Config
.
Middle_Axis
,
txtMiddleP1
,
store
.
Config
.
MiddleAxis_P1_Speed
);
}
private
void
btnMiddleP2_Click
(
object
sender
,
EventArgs
e
)
{
...
...
@@ -569,108 +350,16 @@ namespace OnlineStore.TinPasteStore
private
void
btnInOutP1_Click
(
object
sender
,
EventArgs
e
)
{
AxisABSMove
(
store
.
Config
.
InOut_Axis
,
txtInOutP1
,
store
.
Config
.
InOutAxis_P1_Speed
);
//
AxisABSMove(store.Config.InOut_Axis, txtInOutP1, store.Config.InOutAxis_P1_Speed);
}
private
void
btnInOutP3_Click
(
object
sender
,
EventArgs
e
)
{
AxisABSMove
(
store
.
Config
.
InOut_Axis
,
txtInOutP3
,
store
.
Config
.
InOutAxis_P3_Speed
);
// AxisABSMove(store.Config.InOut_Axis, txtMP1
, store.Config.InOutAxis_P3_Speed);
}
private
void
btnInOutP2_Click
(
object
sender
,
EventArgs
e
)
{
AxisABSMove
(
store
.
Config
.
InOut_Axis
,
txtInOutP20
,
store
.
Config
.
InOutAxis_P2_Speed
);
}
private
void
btnUpDownP11_Click
(
object
sender
,
EventArgs
e
)
{
AxisABSMove
(
store
.
Config
.
UpDown_Axis
,
txtUpDownP11
,
store
.
Config
.
UpDownAxis_P1_Speed
);
}
private
void
btnUpDownP71_Click
(
object
sender
,
EventArgs
e
)
{
AxisABSMove
(
store
.
Config
.
UpDown_Axis
,
txtUpDownP71
,
store
.
Config
.
UpDownAxis_P7_Speed
);
}
private
void
btnUpDownP21_Click
(
object
sender
,
EventArgs
e
)
{
AxisABSMove
(
store
.
Config
.
UpDown_Axis
,
txtUpDownP21
,
store
.
Config
.
UpDownAxis_P2_Speed
);
}
private
void
btnUpDownP81_Click
(
object
sender
,
EventArgs
e
)
{
AxisABSMove
(
store
.
Config
.
UpDown_Axis
,
txtUpDownP81
,
store
.
Config
.
UpDownAxis_P8_Speed
);
}
private
void
btnUpDownP101_Click
(
object
sender
,
EventArgs
e
)
{
AxisABSMove
(
store
.
Config
.
UpDown_Axis
,
txtUpdownP101
,
store
.
Config
.
UpDownAxis_P101_Speed
);
}
private
void
btnUpDownP102_Click
(
object
sender
,
EventArgs
e
)
{
AxisABSMove
(
store
.
Config
.
UpDown_Axis
,
txtUpdownP102
,
store
.
Config
.
UpDownAxis_P102_Speed
);
}
private
void
btnMiddleP11_Click
(
object
sender
,
EventArgs
e
)
{
AxisABSMove
(
store
.
Config
.
Middle_Axis
,
txtMiddleP11
,
store
.
Config
.
MiddleAxis_P1_Speed
);
}
private
void
btnMiddleP12_Click
(
object
sender
,
EventArgs
e
)
{
AxisABSMove
(
store
.
Config
.
Middle_Axis
,
txtMiddleP12
,
store
.
Config
.
MiddleAxis_P1_Speed
);
}
private
void
btnMiddleP101_Click
(
object
sender
,
EventArgs
e
)
{
AxisABSMove
(
store
.
Config
.
Middle_Axis
,
txtMiddleP101
,
store
.
Config
.
MiddleAxis_P101_Speed
);
}
private
void
btnInOutP21_Click
(
object
sender
,
EventArgs
e
)
{
AxisABSMove
(
store
.
Config
.
InOut_Axis
,
txtInOutP21
,
store
.
Config
.
InOutAxis_P2_Speed
);
}
private
void
btnInOutP22_Click
(
object
sender
,
EventArgs
e
)
{
AxisABSMove
(
store
.
Config
.
InOut_Axis
,
txtInOutP22
,
store
.
Config
.
InOutAxis_P2_Speed
);
}
private
void
btnInOutP101_Click
(
object
sender
,
EventArgs
e
)
{
AxisABSMove
(
store
.
Config
.
InOut_Axis
,
txtInOutP101
,
store
.
Config
.
InOutAxis_P101_Speed
);
}
private
void
btnWarmP2_Click
(
object
sender
,
EventArgs
e
)
{
AxisABSMove
(
store
.
Config
.
Warming_Axis
,
txtWarmP2
,
store
.
Config
.
WarmingAxis_P2_Speed
);
}
private
void
btnWarmP1_Click
(
object
sender
,
EventArgs
e
)
{
AxisABSMove
(
store
.
Config
.
Warming_Axis
,
txtWarmP1
,
store
.
Config
.
WarmingAxis_P1_Speed
);
}
private
void
btnColdP2_Click
(
object
sender
,
EventArgs
e
)
{
AxisABSMove
(
store
.
Config
.
Colding_Axis
,
txtColdP2
,
store
.
Config
.
ColdingAxis_P2_Speed
);
}
private
void
btnColdP1_Click
(
object
sender
,
EventArgs
e
)
{
AxisABSMove
(
store
.
Config
.
Colding_Axis
,
txtColdP1
,
store
.
Config
.
ColdingAxis_P1_Speed
);
}
private
void
btnStirP1_Click
(
object
sender
,
EventArgs
e
)
{
AxisABSMove
(
store
.
Config
.
Stir_Axis
,
txtStirP1
,
store
.
Config
.
StirAxis_P1_Speed
);
}
private
void
btnStirP2_Click
(
object
sender
,
EventArgs
e
)
{
AxisABSMove
(
store
.
Config
.
Stir_Axis
,
txtStirP2
,
store
.
Config
.
StirAxis_P2_Speed
);
}
#
endregion
...
...
@@ -679,7 +368,7 @@ namespace OnlineStore.TinPasteStore
private
void
button1_Click
(
object
sender
,
EventArgs
e
)
{
FormManager
.
ShowAxisDebug
(
store
);
//
FormManager.ShowAxisDebug(store);
}
private
void
btnStartAuTo_Click
(
object
sender
,
EventArgs
e
)
...
...
@@ -740,27 +429,6 @@ namespace OnlineStore.TinPasteStore
this
.
store
.
Reset
();
}
private
void
btnIO_Click
(
object
sender
,
EventArgs
e
)
{
FormManager
.
ShowIOShow
(
store
);
}
private
void
btnLogDebug_Click
(
object
sender
,
EventArgs
e
)
{
if
(
LogUtil
.
debug_opened
==
false
)
{
btnLogDebug
.
Text
=
"关闭DEBUG"
;
LogUtil
.
debug_opened
=
true
;
}
else
{
btnLogDebug
.
Text
=
"开启DEBUG"
;
LogUtil
.
debug_opened
=
false
;
}
}
private
void
料仓运转
ONToolStripMenuItem_Click
(
object
sender
,
EventArgs
e
)
{
this
.
Enabled
=
false
;
...
...
@@ -782,11 +450,7 @@ namespace OnlineStore.TinPasteStore
IOManager
.
IOMove
(
IO_Type
.
Camera_Led
,
IO_VALUE
.
LOW
);
}
private
void
打开舱门
ToolStripMenuItem_Click
(
object
sender
,
EventArgs
e
)
{
IOManager
.
IOMove
(
IO_Type
.
Door_Up
,
IO_VALUE
.
HIGH
);
IOManager
.
IOMove
(
IO_Type
.
Door_Down
,
IO_VALUE
.
LOW
);
}
private
void
料仓运转
OFFToolStripMenuItem_Click
(
object
sender
,
EventArgs
e
)
{
...
...
@@ -794,11 +458,7 @@ namespace OnlineStore.TinPasteStore
LogUtil
.
info
(
"料仓运转OFF完成"
);
}
private
void
关闭仓门
ToolStripMenuItem_Click
(
object
sender
,
EventArgs
e
)
{
IOManager
.
IOMove
(
IO_Type
.
Door_Down
,
IO_VALUE
.
HIGH
);
IOManager
.
IOMove
(
IO_Type
.
Door_Up
,
IO_VALUE
.
LOW
);
}
private
void
回待机点
ToolStripMenuItem_Click
(
object
sender
,
EventArgs
e
)
{
...
...
@@ -819,10 +479,6 @@ namespace OnlineStore.TinPasteStore
}
}
private
void
换肤
ToolStripMenuItem_Click
(
object
sender
,
EventArgs
e
)
{
FormManager
.
NextSkin
();
}
private
void
chbAuto_CheckedChanged
(
object
sender
,
EventArgs
e
)
{
if
(!
LoadOk
)
...
...
@@ -907,23 +563,23 @@ namespace OnlineStore.TinPasteStore
}
}
private
void
btnUpdown_Click
(
object
sender
,
EventArgs
e
)
{
string
PortName
=
store
.
Config
.
UpDown_Axis
.
DeviceName
;
int
slvAddr
=
store
.
Config
.
UpDown_Axis
.
GetAxisValue
();
string
ioIP
=
"192.168.200.13"
;
int
ioIndex
=
0
;
// if (store.Config.StoreDIList.ContainsKey(IO_Type.UpdownPositionSingal))
if
(
store
.
Config
.
StoreDIList
.
ContainsKey
(
IO_Type
.
TinCheck_Fixture
))
{
ioIP
=
store
.
Config
.
StoreDIList
[
IO_Type
.
TinCheck_Fixture
].
IO_IP
;
ioIndex
=
store
.
Config
.
StoreDIList
[
IO_Type
.
TinCheck_Fixture
].
GetIOAddr
();
}
FrmPositionTool
frm
=
new
FrmPositionTool
(
PortName
,
slvAddr
,
ioIP
,
ioIndex
);
frm
.
ShowDialog
();
LogUtil
.
logBox
=
this
.
richTextBox1
;
}
//
private void btnUpdown_Click(object sender, EventArgs e)
//
{
//
string PortName = store.Config.UpDown_Axis.DeviceName;
//
int slvAddr = store.Config.UpDown_Axis.GetAxisValue();
//
string ioIP = "192.168.200.13";
//
int ioIndex = 0;
//
// if (store.Config.StoreDIList.ContainsKey(IO_Type.UpdownPositionSingal))
//
if (store.Config.StoreDIList.ContainsKey(IO_Type.TinCheck_Fixture))
//
{
//
ioIP = store.Config.StoreDIList[IO_Type.TinCheck_Fixture].IO_IP;
//
ioIndex = store.Config.StoreDIList[IO_Type.TinCheck_Fixture].GetIOAddr();
//
}
//
FrmPositionTool frm = new FrmPositionTool(PortName, slvAddr, ioIP, ioIndex);
//
frm.ShowDialog();
//
LogUtil.logBox = this.richTextBox1;
//
}
#
endregion
...
...
@@ -945,7 +601,6 @@ namespace OnlineStore.TinPasteStore
IOManager
.
instance
.
CloseAllConnection
();
ACServerManager
.
CloseAllPort
();
HumitureController
.
Release
();
OKLEController
.
Release
();
System
.
Environment
.
Exit
(
System
.
Environment
.
ExitCode
);
}
...
...
@@ -993,17 +648,7 @@ namespace OnlineStore.TinPasteStore
}
axisMoveControl1
.
Enabled
=
status
;
groupInout
.
Enabled
=
status
;
groupBox1
.
Enabled
=
status
;
groupBox4
.
Enabled
=
status
;
if
(!
status
)
{
groWarm
.
Enabled
=
status
;
groStir
.
Enabled
=
status
;
}
else
{
cmbPosition_SelectedIndexChanged
(
null
,
null
);
}
}
private
void
rdbLeft_CheckedChanged
(
object
sender
,
EventArgs
e
)
{
...
...
@@ -1012,34 +657,7 @@ namespace OnlineStore.TinPasteStore
private
void
btnDoorPSave_Click
(
object
sender
,
EventArgs
e
)
{
store
.
Config
.
UpDownAxis_OL_P1
=
FormUtil
.
GetIntValue
(
txtUpDownP1
);
store
.
Config
.
UpDownAxis_IH_P2
=
FormUtil
.
GetIntValue
(
txtUpDownP2
);
store
.
Config
.
UpDownAxis_OH_P7
=
FormUtil
.
GetIntValue
(
txtUpDownP7
);
store
.
Config
.
UpDownAxis_IL_P8
=
FormUtil
.
GetIntValue
(
txtUpDownP8
);
store
.
Config
.
UpDownAxis_OL_P11
=
FormUtil
.
GetIntValue
(
txtUpDownP11
);
store
.
Config
.
UpDownAxis_IH_P21
=
FormUtil
.
GetIntValue
(
txtUpDownP21
);
store
.
Config
.
UpDownAxis_OH_P71
=
FormUtil
.
GetIntValue
(
txtUpDownP71
);
store
.
Config
.
UpDownAxis_IL_P81
=
FormUtil
.
GetIntValue
(
txtUpDownP81
);
store
.
Config
.
UpDownAxis_StirH_P101
=
FormUtil
.
GetIntValue
(
txtUpdownP101
);
store
.
Config
.
UpDownAxis_StirL_P102
=
FormUtil
.
GetIntValue
(
txtUpdownP102
);
store
.
Config
.
InOutAxis_P1
=
FormUtil
.
GetIntValue
(
txtInOutP1
);
store
.
Config
.
InOutAxis_P20
=
FormUtil
.
GetIntValue
(
txtInOutP20
);
store
.
Config
.
InOutAxis_P21
=
FormUtil
.
GetIntValue
(
txtInOutP21
);
store
.
Config
.
InOutAxis_P22
=
FormUtil
.
GetIntValue
(
txtInOutP22
);
store
.
Config
.
InOutAxis_Stir_P101
=
FormUtil
.
GetIntValue
(
txtInOutP101
);
store
.
Config
.
MiddleAxis_P1
=
FormUtil
.
GetIntValue
(
txtMiddleP1
);
store
.
Config
.
MiddleAxis_P11
=
FormUtil
.
GetIntValue
(
txtMiddleP11
);
store
.
Config
.
MiddleAxis_P12
=
FormUtil
.
GetIntValue
(
txtMiddleP12
);
store
.
Config
.
MiddleAxis_Stir_P101
=
FormUtil
.
GetIntValue
(
txtMiddleP101
);
store
.
Config
.
Warming_Axis_P1
=
FormUtil
.
GetIntValue
(
txtWarmP1
);
store
.
Config
.
Colding_Axis_P1
=
FormUtil
.
GetIntValue
(
txtColdP1
);
store
.
Config
.
Stir_Axis_P1
=
FormUtil
.
GetIntValue
(
txtStirP1
);
store
.
Config
.
Stir_Axis_P2
=
FormUtil
.
GetIntValue
(
txtStirP2
);
//更新缓存
bool
result
=
StoreManager
.
UpdateBoxConfig
(
store
.
Config
);
...
...
@@ -1052,68 +670,23 @@ namespace OnlineStore.TinPasteStore
MessageBox
.
Show
(
"仓门/搅拌/待机 位置保存成功 "
);
}
}
private
void
btnBackwarm_Click
(
object
sender
,
EventArgs
e
)
{
string
posId
=
cmbPosition
.
Text
;
string
targetPos
=
cmbTargetPos
.
Text
;
LogUtil
.
info
(
"点击 回温测试 按钮:【"
+
posId
+
"】 【"
+
targetPos
+
"】"
);
InOutParam
param
=
InOutParam
.
NewMovePosParam
(
posId
,
"ABC"
,
500
,
targetPos
,
"XYZ"
,
500
);
VerticalStorePosition
pos
=
CSVPositionReader
<
VerticalStorePosition
>.
GetPositon
(
posId
);
VerticalStorePosition
tpos
=
CSVPositionReader
<
VerticalStorePosition
>.
GetPositon
(
targetPos
);
if
(
pos
!=
null
&&
tpos
!=
null
&&
pos
.
PosType
.
Equals
(
1
)
&&
tpos
.
PosType
.
Equals
(
2
))
{
if
(
store
.
MoveInfo
.
MoveType
.
Equals
(
MoveType
.
None
)
&&
store
.
runStatus
.
Equals
(
StoreRunStatus
.
Runing
))
{
bool
msg
=
store
.
StartMovement
(
param
);
}
}
else
{
MessageBox
.
Show
(
"请选择正确的库位!"
);
}
}
p
rivate
void
btnStirTest_Click
(
object
sender
,
EventArgs
e
)
p
ublic
int
getCount
(
int
[]
A
)
{
int
weight
=
Convert
.
ToInt32
(
cmbWeight
.
Text
);
int
seconds
=
(
int
)
numTime
.
Value
;
string
posId
=
cmbPosition
.
Text
;
LogUtil
.
info
(
"点击 搅拌测试 按钮:【"
+
posId
+
"】 【"
+
weight
+
"】"
);
InOutParam
param
=
new
InOutParam
(
MoveType
.
Stirring
,
posId
,
"ABC"
,
0
,
0
,
weight
);
VerticalStorePosition
pos
=
CSVPositionReader
<
VerticalStorePosition
>.
GetPositon
(
posId
);
if
(
pos
!=
null
&&
pos
.
PosType
.
Equals
(
1
))
int
i
=
0
;
for
(
int
nSize
=
0
;
nSize
<
A
.
Length
;
nSize
++)
{
if
(
store
.
MoveInfo
.
MoveType
.
Equals
(
MoveType
.
None
)
&&
store
.
runStatus
.
Equals
(
StoreRunStatus
.
Runing
)
)
if
(
A
[
nSize
]
!=
0
)
{
bool
msg
=
store
.
StartStirring
(
param
);
}
int
temp
=
A
[
0
];
A
[
0
]
=
A
[
nSize
];
A
[
nSize
]
=
temp
;
i
++;
}
else
{
MessageBox
.
Show
(
"请选择正确的库位!"
);
}
return
i
;
}
private
void
btnClearStir_Click
(
object
sender
,
EventArgs
e
)
{
LogUtil
.
error
(
store
.
Name
+
" 点击:"
+
btnClearStir
.
Text
);
if
(
store
.
CurrStirInfo
.
InStirWork
)
{
DialogResult
result
=
MessageBox
.
Show
(
"当前搅拌信息:"
+
store
.
CurrStirInfo
.
toStr
()
+
"\n"
+
"请确保搅拌位置物料已拿走,确定清理搅拌信息?"
,
"确认提示"
,
MessageBoxButtons
.
OKCancel
,
MessageBoxIcon
.
Asterisk
);
if
(
result
.
Equals
(
DialogResult
.
OK
))
{
LogUtil
.
info
(
store
.
Name
+
" 手动清理搅拌信息:"
+
store
.
CurrStirInfo
.
toStr
());
store
.
UpdateCurrStirInfo
(
false
,
new
InOutParam
(
MoveType
.
None
,
""
));
}
}
else
{
MessageBox
.
Show
(
"暂无搅拌信息"
);
}
}
}
}
source/VerticalStoreClinet/Program.cs
查看文件 @
4be5928
source/VerticalStoreClinet/VerticalStoreClient.csproj
查看文件 @
4be5928
...
...
@@ -83,25 +83,12 @@
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="FormManager.cs" />
<Compile Include="FrmAxisDebug.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="FrmAxisDebug.Designer.cs">
<DependentUpon>FrmAxisDebug.cs</DependentUpon>
</Compile>
<Compile Include="FrmBase.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="FrmBase.Designer.cs">
<DependentUpon>FrmBase.cs</DependentUpon>
</Compile>
<Compile Include="FrmDeviceDebug.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="FrmDeviceDebug.Designer.cs">
<DependentUpon>FrmDeviceDebug.cs</DependentUpon>
</Compile>
<Compile Include="FrmIOStatus.cs">
<SubType>Form</SubType>
</Compile>
...
...
@@ -147,15 +134,9 @@
<Compile Include="useControl\AxisJogControl.Designer.cs">
<DependentUpon>AxisJogControl.cs</DependentUpon>
</Compile>
<EmbeddedResource Include="FrmAxisDebug.resx">
<DependentUpon>FrmAxisDebug.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="FrmBase.resx">
<DependentUpon>FrmBase.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="FrmDeviceDebug.resx">
<DependentUpon>FrmDeviceDebug.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="FrmIOStatus.resx">
<DependentUpon>FrmIOStatus.cs</DependentUpon>
</EmbeddedResource>
...
...
source/VerticalStoreClinet/useControl/AxisJogControl.cs
查看文件 @
4be5928
...
...
@@ -63,20 +63,8 @@ namespace OnlineStore.TinPasteStore.useControl
/// </summary>
private
bool
InOutIsIsP1
()
{
int
InOutDefaultPosition
=
ConfigAppSettings
.
GetIntValue
(
Setting_Init
.
InOutDefaultPosition
);
//if (InOutDefaultPosition > 3000 || InOutDefaultPosition.Equals(0))
//{
// InOutDefaultPosition = 3000;
//}
ConfigMoveAxis
inout
=
StoreManager
.
Store
.
Config
.
InOut_Axis
;
int
currValue
=
ACServerManager
.
GetActualtPosition
(
inout
.
DeviceName
,
inout
.
GetAxisValue
());
if
(
currValue
<=
InOutDefaultPosition
)
{
return
true
;
}
MessageBox
.
Show
(
"进出轴不在待机位,请先将进出轴退回待机位("
+
InOutDefaultPosition
+
")"
,
"警告(进出轴在待机位时,才能移动其他轴) "
,
MessageBoxButtons
.
OK
,
MessageBoxIcon
.
Exclamation
);
return
false
;
}
private
void
AxisMove
(
int
speed
)
{
LogUtil
.
debug
(
"点动:["
+
AxisInfo
.
DeviceName
+
"_"
+
AxisInfo
.
GetAxisValue
()
+
"],speed="
+
speed
);
...
...
source/VerticalStoreClinet/useControl/AxisMoveControl.Designer.cs
查看文件 @
4be5928
...
...
@@ -29,6 +29,9 @@
private
void
InitializeComponent
()
{
this
.
groupAxis
=
new
System
.
Windows
.
Forms
.
GroupBox
();
this
.
linkLabel1
=
new
System
.
Windows
.
Forms
.
LinkLabel
();
this
.
btnMovej
=
new
System
.
Windows
.
Forms
.
Button
();
this
.
btnMove
=
new
System
.
Windows
.
Forms
.
Button
();
this
.
label7
=
new
System
.
Windows
.
Forms
.
Label
();
this
.
txtServoStatue
=
new
System
.
Windows
.
Forms
.
TextBox
();
this
.
label17
=
new
System
.
Windows
.
Forms
.
Label
();
...
...
@@ -65,36 +68,7 @@
this
.
label46
=
new
System
.
Windows
.
Forms
.
Label
();
this
.
comboBox1
=
new
System
.
Windows
.
Forms
.
ComboBox
();
this
.
label49
=
new
System
.
Windows
.
Forms
.
Label
();
this
.
groupBox1
=
new
System
.
Windows
.
Forms
.
GroupBox
();
this
.
axis_4_Alarm
=
new
UserFromControl
.
IOStatusControl
();
this
.
txt4Target
=
new
System
.
Windows
.
Forms
.
TextBox
();
this
.
lblTargetP4
=
new
System
.
Windows
.
Forms
.
TextBox
();
this
.
lblActual4
=
new
System
.
Windows
.
Forms
.
TextBox
();
this
.
label1
=
new
System
.
Windows
.
Forms
.
Label
();
this
.
axis_1_Alarm
=
new
UserFromControl
.
IOStatusControl
();
this
.
axis_3_Alarm
=
new
UserFromControl
.
IOStatusControl
();
this
.
axis_2_Alarm
=
new
UserFromControl
.
IOStatusControl
();
this
.
label38
=
new
System
.
Windows
.
Forms
.
Label
();
this
.
txtMiddleTarget
=
new
System
.
Windows
.
Forms
.
TextBox
();
this
.
txtInoutTarget
=
new
System
.
Windows
.
Forms
.
TextBox
();
this
.
txtUpdownTarget
=
new
System
.
Windows
.
Forms
.
TextBox
();
this
.
label12
=
new
System
.
Windows
.
Forms
.
Label
();
this
.
lblTargetP1
=
new
System
.
Windows
.
Forms
.
TextBox
();
this
.
lblActual1
=
new
System
.
Windows
.
Forms
.
TextBox
();
this
.
lblTargetP3
=
new
System
.
Windows
.
Forms
.
TextBox
();
this
.
lblActual3
=
new
System
.
Windows
.
Forms
.
TextBox
();
this
.
lblTargetP2
=
new
System
.
Windows
.
Forms
.
TextBox
();
this
.
lblActual2
=
new
System
.
Windows
.
Forms
.
TextBox
();
this
.
label4
=
new
System
.
Windows
.
Forms
.
Label
();
this
.
label3
=
new
System
.
Windows
.
Forms
.
Label
();
this
.
label5
=
new
System
.
Windows
.
Forms
.
Label
();
this
.
label43
=
new
System
.
Windows
.
Forms
.
Label
();
this
.
label42
=
new
System
.
Windows
.
Forms
.
Label
();
this
.
btnMovej
=
new
System
.
Windows
.
Forms
.
Button
();
this
.
btnMove
=
new
System
.
Windows
.
Forms
.
Button
();
this
.
linkLabel1
=
new
System
.
Windows
.
Forms
.
LinkLabel
();
this
.
groupAxis
.
SuspendLayout
();
this
.
groupBox1
.
SuspendLayout
();
this
.
SuspendLayout
();
//
// groupAxis
...
...
@@ -143,12 +117,51 @@
this
.
groupAxis
.
Font
=
new
System
.
Drawing
.
Font
(
"微软雅黑"
,
9F
,
System
.
Drawing
.
FontStyle
.
Regular
,
System
.
Drawing
.
GraphicsUnit
.
Point
,
((
byte
)(
134
)));
this
.
groupAxis
.
Location
=
new
System
.
Drawing
.
Point
(
9
,
6
);
this
.
groupAxis
.
Name
=
"groupAxis"
;
this
.
groupAxis
.
Size
=
new
System
.
Drawing
.
Size
(
541
,
3
99
);
this
.
groupAxis
.
Size
=
new
System
.
Drawing
.
Size
(
541
,
3
83
);
this
.
groupAxis
.
TabIndex
=
217
;
this
.
groupAxis
.
TabStop
=
false
;
this
.
groupAxis
.
Text
=
"伺服运动"
;
this
.
groupAxis
.
Enter
+=
new
System
.
EventHandler
(
this
.
groupAxis_Enter
);
//
// linkLabel1
//
this
.
linkLabel1
.
AutoSize
=
true
;
this
.
linkLabel1
.
Location
=
new
System
.
Drawing
.
Point
(
313
,
172
);
this
.
linkLabel1
.
Name
=
"linkLabel1"
;
this
.
linkLabel1
.
Size
=
new
System
.
Drawing
.
Size
(
56
,
17
);
this
.
linkLabel1
.
TabIndex
=
331
;
this
.
linkLabel1
.
TabStop
=
true
;
this
.
linkLabel1
.
Text
=
"复制位置"
;
this
.
linkLabel1
.
LinkClicked
+=
new
System
.
Windows
.
Forms
.
LinkLabelLinkClickedEventHandler
(
this
.
linkLabel1_LinkClicked
);
//
// btnMovej
//
this
.
btnMovej
.
BackColor
=
System
.
Drawing
.
SystemColors
.
Control
;
this
.
btnMovej
.
FlatStyle
=
System
.
Windows
.
Forms
.
FlatStyle
.
Flat
;
this
.
btnMovej
.
Font
=
new
System
.
Drawing
.
Font
(
"微软雅黑"
,
10.5F
,
System
.
Drawing
.
FontStyle
.
Regular
,
System
.
Drawing
.
GraphicsUnit
.
Point
,
((
byte
)(
134
)));
this
.
btnMovej
.
Location
=
new
System
.
Drawing
.
Point
(
260
,
326
);
this
.
btnMovej
.
Name
=
"btnMovej"
;
this
.
btnMovej
.
Size
=
new
System
.
Drawing
.
Size
(
140
,
45
);
this
.
btnMovej
.
TabIndex
=
330
;
this
.
btnMovej
.
Text
=
" 轴点动- "
;
this
.
btnMovej
.
UseVisualStyleBackColor
=
false
;
this
.
btnMovej
.
MouseDown
+=
new
System
.
Windows
.
Forms
.
MouseEventHandler
(
this
.
btnMovej_MouseDown
);
this
.
btnMovej
.
MouseUp
+=
new
System
.
Windows
.
Forms
.
MouseEventHandler
(
this
.
btnMovej_MouseUp
);
//
// btnMove
//
this
.
btnMove
.
BackColor
=
System
.
Drawing
.
SystemColors
.
Control
;
this
.
btnMove
.
FlatStyle
=
System
.
Windows
.
Forms
.
FlatStyle
.
Flat
;
this
.
btnMove
.
Font
=
new
System
.
Drawing
.
Font
(
"微软雅黑"
,
10.5F
,
System
.
Drawing
.
FontStyle
.
Regular
,
System
.
Drawing
.
GraphicsUnit
.
Point
,
((
byte
)(
134
)));
this
.
btnMove
.
Location
=
new
System
.
Drawing
.
Point
(
114
,
326
);
this
.
btnMove
.
Name
=
"btnMove"
;
this
.
btnMove
.
Size
=
new
System
.
Drawing
.
Size
(
140
,
45
);
this
.
btnMove
.
TabIndex
=
329
;
this
.
btnMove
.
Text
=
"轴点动+ "
;
this
.
btnMove
.
UseVisualStyleBackColor
=
false
;
this
.
btnMove
.
MouseDown
+=
new
System
.
Windows
.
Forms
.
MouseEventHandler
(
this
.
btnMove_MouseDown
);
this
.
btnMove
.
MouseUp
+=
new
System
.
Windows
.
Forms
.
MouseEventHandler
(
this
.
btnMove_MouseUp
);
//
// label7
//
this
.
label7
.
AutoSize
=
true
;
...
...
@@ -567,309 +580,14 @@
this
.
label49
.
Text
=
"AC伺服:"
;
this
.
label49
.
TextAlign
=
System
.
Drawing
.
ContentAlignment
.
MiddleRight
;
//
// groupBox1
//
this
.
groupBox1
.
Anchor
=
((
System
.
Windows
.
Forms
.
AnchorStyles
)(((
System
.
Windows
.
Forms
.
AnchorStyles
.
Top
|
System
.
Windows
.
Forms
.
AnchorStyles
.
Left
)
|
System
.
Windows
.
Forms
.
AnchorStyles
.
Right
)));
this
.
groupBox1
.
Controls
.
Add
(
this
.
axis_4_Alarm
);
this
.
groupBox1
.
Controls
.
Add
(
this
.
txt4Target
);
this
.
groupBox1
.
Controls
.
Add
(
this
.
lblTargetP4
);
this
.
groupBox1
.
Controls
.
Add
(
this
.
lblActual4
);
this
.
groupBox1
.
Controls
.
Add
(
this
.
label1
);
this
.
groupBox1
.
Controls
.
Add
(
this
.
axis_1_Alarm
);
this
.
groupBox1
.
Controls
.
Add
(
this
.
axis_3_Alarm
);
this
.
groupBox1
.
Controls
.
Add
(
this
.
axis_2_Alarm
);
this
.
groupBox1
.
Controls
.
Add
(
this
.
label38
);
this
.
groupBox1
.
Controls
.
Add
(
this
.
txtMiddleTarget
);
this
.
groupBox1
.
Controls
.
Add
(
this
.
txtInoutTarget
);
this
.
groupBox1
.
Controls
.
Add
(
this
.
txtUpdownTarget
);
this
.
groupBox1
.
Controls
.
Add
(
this
.
label12
);
this
.
groupBox1
.
Controls
.
Add
(
this
.
lblTargetP1
);
this
.
groupBox1
.
Controls
.
Add
(
this
.
lblActual1
);
this
.
groupBox1
.
Controls
.
Add
(
this
.
lblTargetP3
);
this
.
groupBox1
.
Controls
.
Add
(
this
.
lblActual3
);
this
.
groupBox1
.
Controls
.
Add
(
this
.
lblTargetP2
);
this
.
groupBox1
.
Controls
.
Add
(
this
.
lblActual2
);
this
.
groupBox1
.
Controls
.
Add
(
this
.
label4
);
this
.
groupBox1
.
Controls
.
Add
(
this
.
label3
);
this
.
groupBox1
.
Controls
.
Add
(
this
.
label5
);
this
.
groupBox1
.
Controls
.
Add
(
this
.
label43
);
this
.
groupBox1
.
Controls
.
Add
(
this
.
label42
);
this
.
groupBox1
.
Font
=
new
System
.
Drawing
.
Font
(
"微软雅黑"
,
9F
,
System
.
Drawing
.
FontStyle
.
Regular
,
System
.
Drawing
.
GraphicsUnit
.
Point
,
((
byte
)(
134
)));
this
.
groupBox1
.
Location
=
new
System
.
Drawing
.
Point
(
9
,
332
);
this
.
groupBox1
.
Name
=
"groupBox1"
;
this
.
groupBox1
.
Size
=
new
System
.
Drawing
.
Size
(
538
,
182
);
this
.
groupBox1
.
TabIndex
=
218
;
this
.
groupBox1
.
TabStop
=
false
;
this
.
groupBox1
.
Text
=
"伺服状态"
;
this
.
groupBox1
.
Visible
=
false
;
//
// axis_4_Alarm
//
this
.
axis_4_Alarm
.
IOName
=
""
;
this
.
axis_4_Alarm
.
IOValue
=
0
;
this
.
axis_4_Alarm
.
isCanClick
=
false
;
this
.
axis_4_Alarm
.
Location
=
new
System
.
Drawing
.
Point
(
432
,
39
);
this
.
axis_4_Alarm
.
Name
=
"axis_4_Alarm"
;
this
.
axis_4_Alarm
.
Size
=
new
System
.
Drawing
.
Size
(
43
,
39
);
this
.
axis_4_Alarm
.
TabIndex
=
271
;
//
// txt4Target
//
this
.
txt4Target
.
Location
=
new
System
.
Drawing
.
Point
(
409
,
143
);
this
.
txt4Target
.
Name
=
"txt4Target"
;
this
.
txt4Target
.
ReadOnly
=
true
;
this
.
txt4Target
.
Size
=
new
System
.
Drawing
.
Size
(
87
,
23
);
this
.
txt4Target
.
TabIndex
=
270
;
//
// lblTargetP4
//
this
.
lblTargetP4
.
Location
=
new
System
.
Drawing
.
Point
(
409
,
115
);
this
.
lblTargetP4
.
Name
=
"lblTargetP4"
;
this
.
lblTargetP4
.
ReadOnly
=
true
;
this
.
lblTargetP4
.
Size
=
new
System
.
Drawing
.
Size
(
87
,
23
);
this
.
lblTargetP4
.
TabIndex
=
269
;
//
// lblActual4
//
this
.
lblActual4
.
Location
=
new
System
.
Drawing
.
Point
(
409
,
87
);
this
.
lblActual4
.
Name
=
"lblActual4"
;
this
.
lblActual4
.
ReadOnly
=
true
;
this
.
lblActual4
.
Size
=
new
System
.
Drawing
.
Size
(
87
,
23
);
this
.
lblActual4
.
TabIndex
=
268
;
//
// label1
//
this
.
label1
.
AutoSize
=
true
;
this
.
label1
.
ImageAlign
=
System
.
Drawing
.
ContentAlignment
.
MiddleRight
;
this
.
label1
.
Location
=
new
System
.
Drawing
.
Point
(
406
,
14
);
this
.
label1
.
Name
=
"label1"
;
this
.
label1
.
Size
=
new
System
.
Drawing
.
Size
(
71
,
17
);
this
.
label1
.
TabIndex
=
267
;
this
.
label1
.
Text
=
"轴四:压紧轴"
;
//
// axis_1_Alarm
//
this
.
axis_1_Alarm
.
IOName
=
""
;
this
.
axis_1_Alarm
.
IOValue
=
0
;
this
.
axis_1_Alarm
.
isCanClick
=
false
;
this
.
axis_1_Alarm
.
Location
=
new
System
.
Drawing
.
Point
(
127
,
40
);
this
.
axis_1_Alarm
.
Name
=
"axis_1_Alarm"
;
this
.
axis_1_Alarm
.
Size
=
new
System
.
Drawing
.
Size
(
43
,
39
);
this
.
axis_1_Alarm
.
TabIndex
=
264
;
//
// axis_3_Alarm
//
this
.
axis_3_Alarm
.
IOName
=
""
;
this
.
axis_3_Alarm
.
IOValue
=
0
;
this
.
axis_3_Alarm
.
isCanClick
=
false
;
this
.
axis_3_Alarm
.
Location
=
new
System
.
Drawing
.
Point
(
329
,
40
);
this
.
axis_3_Alarm
.
Name
=
"axis_3_Alarm"
;
this
.
axis_3_Alarm
.
Size
=
new
System
.
Drawing
.
Size
(
43
,
39
);
this
.
axis_3_Alarm
.
TabIndex
=
266
;
//
// axis_2_Alarm
//
this
.
axis_2_Alarm
.
IOName
=
""
;
this
.
axis_2_Alarm
.
IOValue
=
0
;
this
.
axis_2_Alarm
.
isCanClick
=
false
;
this
.
axis_2_Alarm
.
Location
=
new
System
.
Drawing
.
Point
(
224
,
40
);
this
.
axis_2_Alarm
.
Name
=
"axis_2_Alarm"
;
this
.
axis_2_Alarm
.
Size
=
new
System
.
Drawing
.
Size
(
43
,
39
);
this
.
axis_2_Alarm
.
TabIndex
=
265
;
//
// label38
//
this
.
label38
.
AutoSize
=
true
;
this
.
label38
.
ImageAlign
=
System
.
Drawing
.
ContentAlignment
.
MiddleRight
;
this
.
label38
.
Location
=
new
System
.
Drawing
.
Point
(
49
,
40
);
this
.
label38
.
Name
=
"label38"
;
this
.
label38
.
Size
=
new
System
.
Drawing
.
Size
(
37
,
17
);
this
.
label38
.
TabIndex
=
263
;
this
.
label38
.
Text
=
"ALM:"
;
//
// txtMiddleTarget
//
this
.
txtMiddleTarget
.
Location
=
new
System
.
Drawing
.
Point
(
105
,
144
);
this
.
txtMiddleTarget
.
Name
=
"txtMiddleTarget"
;
this
.
txtMiddleTarget
.
ReadOnly
=
true
;
this
.
txtMiddleTarget
.
Size
=
new
System
.
Drawing
.
Size
(
87
,
23
);
this
.
txtMiddleTarget
.
TabIndex
=
262
;
//
// txtInoutTarget
//
this
.
txtInoutTarget
.
Location
=
new
System
.
Drawing
.
Point
(
306
,
144
);
this
.
txtInoutTarget
.
Name
=
"txtInoutTarget"
;
this
.
txtInoutTarget
.
ReadOnly
=
true
;
this
.
txtInoutTarget
.
Size
=
new
System
.
Drawing
.
Size
(
87
,
23
);
this
.
txtInoutTarget
.
TabIndex
=
260
;
//
// txtUpdownTarget
//
this
.
txtUpdownTarget
.
Location
=
new
System
.
Drawing
.
Point
(
206
,
144
);
this
.
txtUpdownTarget
.
Name
=
"txtUpdownTarget"
;
this
.
txtUpdownTarget
.
ReadOnly
=
true
;
this
.
txtUpdownTarget
.
Size
=
new
System
.
Drawing
.
Size
(
87
,
23
);
this
.
txtUpdownTarget
.
TabIndex
=
259
;
//
// label12
//
this
.
label12
.
AutoSize
=
true
;
this
.
label12
.
Font
=
new
System
.
Drawing
.
Font
(
"微软雅黑"
,
9F
,
System
.
Drawing
.
FontStyle
.
Regular
,
System
.
Drawing
.
GraphicsUnit
.
Point
,
((
byte
)(
134
)));
this
.
label12
.
Location
=
new
System
.
Drawing
.
Point
(
7
,
147
);
this
.
label12
.
Name
=
"label12"
;
this
.
label12
.
Size
=
new
System
.
Drawing
.
Size
(
83
,
17
);
this
.
label12
.
TabIndex
=
258
;
this
.
label12
.
Text
=
"出入库目标值:"
;
//
// lblTargetP1
//
this
.
lblTargetP1
.
Location
=
new
System
.
Drawing
.
Point
(
105
,
116
);
this
.
lblTargetP1
.
Name
=
"lblTargetP1"
;
this
.
lblTargetP1
.
ReadOnly
=
true
;
this
.
lblTargetP1
.
Size
=
new
System
.
Drawing
.
Size
(
87
,
23
);
this
.
lblTargetP1
.
TabIndex
=
257
;
//
// lblActual1
//
this
.
lblActual1
.
Location
=
new
System
.
Drawing
.
Point
(
105
,
88
);
this
.
lblActual1
.
Name
=
"lblActual1"
;
this
.
lblActual1
.
ReadOnly
=
true
;
this
.
lblActual1
.
Size
=
new
System
.
Drawing
.
Size
(
87
,
23
);
this
.
lblActual1
.
TabIndex
=
256
;
//
// lblTargetP3
//
this
.
lblTargetP3
.
Location
=
new
System
.
Drawing
.
Point
(
306
,
116
);
this
.
lblTargetP3
.
Name
=
"lblTargetP3"
;
this
.
lblTargetP3
.
ReadOnly
=
true
;
this
.
lblTargetP3
.
Size
=
new
System
.
Drawing
.
Size
(
87
,
23
);
this
.
lblTargetP3
.
TabIndex
=
178
;
//
// lblActual3
//
this
.
lblActual3
.
Location
=
new
System
.
Drawing
.
Point
(
306
,
88
);
this
.
lblActual3
.
Name
=
"lblActual3"
;
this
.
lblActual3
.
ReadOnly
=
true
;
this
.
lblActual3
.
Size
=
new
System
.
Drawing
.
Size
(
87
,
23
);
this
.
lblActual3
.
TabIndex
=
177
;
//
// lblTargetP2
//
this
.
lblTargetP2
.
Location
=
new
System
.
Drawing
.
Point
(
207
,
116
);
this
.
lblTargetP2
.
Name
=
"lblTargetP2"
;
this
.
lblTargetP2
.
ReadOnly
=
true
;
this
.
lblTargetP2
.
Size
=
new
System
.
Drawing
.
Size
(
87
,
23
);
this
.
lblTargetP2
.
TabIndex
=
176
;
//
// lblActual2
//
this
.
lblActual2
.
Location
=
new
System
.
Drawing
.
Point
(
206
,
88
);
this
.
lblActual2
.
Name
=
"lblActual2"
;
this
.
lblActual2
.
ReadOnly
=
true
;
this
.
lblActual2
.
Size
=
new
System
.
Drawing
.
Size
(
87
,
23
);
this
.
lblActual2
.
TabIndex
=
175
;
//
// label4
//
this
.
label4
.
AutoSize
=
true
;
this
.
label4
.
ImageAlign
=
System
.
Drawing
.
ContentAlignment
.
MiddleRight
;
this
.
label4
.
Location
=
new
System
.
Drawing
.
Point
(
303
,
15
);
this
.
label4
.
Name
=
"label4"
;
this
.
label4
.
Size
=
new
System
.
Drawing
.
Size
(
71
,
17
);
this
.
label4
.
TabIndex
=
100
;
this
.
label4
.
Text
=
"轴三:进出轴"
;
//
// label3
//
this
.
label3
.
AutoSize
=
true
;
this
.
label3
.
ImageAlign
=
System
.
Drawing
.
ContentAlignment
.
MiddleRight
;
this
.
label3
.
Location
=
new
System
.
Drawing
.
Point
(
204
,
15
);
this
.
label3
.
Name
=
"label3"
;
this
.
label3
.
Size
=
new
System
.
Drawing
.
Size
(
71
,
17
);
this
.
label3
.
TabIndex
=
99
;
this
.
label3
.
Text
=
"轴二:上下轴"
;
//
// label5
//
this
.
label5
.
AutoSize
=
true
;
this
.
label5
.
ImageAlign
=
System
.
Drawing
.
ContentAlignment
.
MiddleRight
;
this
.
label5
.
Location
=
new
System
.
Drawing
.
Point
(
106
,
15
);
this
.
label5
.
Name
=
"label5"
;
this
.
label5
.
Size
=
new
System
.
Drawing
.
Size
(
71
,
17
);
this
.
label5
.
TabIndex
=
97
;
this
.
label5
.
Text
=
"轴一:旋转轴"
;
//
// label43
//
this
.
label43
.
AutoSize
=
true
;
this
.
label43
.
Font
=
new
System
.
Drawing
.
Font
(
"微软雅黑"
,
9F
,
System
.
Drawing
.
FontStyle
.
Regular
,
System
.
Drawing
.
GraphicsUnit
.
Point
,
((
byte
)(
134
)));
this
.
label43
.
Location
=
new
System
.
Drawing
.
Point
(
15
,
90
);
this
.
label43
.
Name
=
"label43"
;
this
.
label43
.
Size
=
new
System
.
Drawing
.
Size
(
71
,
17
);
this
.
label43
.
TabIndex
=
23
;
this
.
label43
.
Text
=
"输出脉冲值:"
;
//
// label42
//
this
.
label42
.
AutoSize
=
true
;
this
.
label42
.
Font
=
new
System
.
Drawing
.
Font
(
"微软雅黑"
,
9F
,
System
.
Drawing
.
FontStyle
.
Regular
,
System
.
Drawing
.
GraphicsUnit
.
Point
,
((
byte
)(
134
)));
this
.
label42
.
Location
=
new
System
.
Drawing
.
Point
(
15
,
117
);
this
.
label42
.
Name
=
"label42"
;
this
.
label42
.
Size
=
new
System
.
Drawing
.
Size
(
71
,
17
);
this
.
label42
.
TabIndex
=
24
;
this
.
label42
.
Text
=
"编码器计数:"
;
//
// btnMovej
//
this
.
btnMovej
.
BackColor
=
System
.
Drawing
.
SystemColors
.
Control
;
this
.
btnMovej
.
FlatStyle
=
System
.
Windows
.
Forms
.
FlatStyle
.
Flat
;
this
.
btnMovej
.
Font
=
new
System
.
Drawing
.
Font
(
"微软雅黑"
,
10.5F
,
System
.
Drawing
.
FontStyle
.
Regular
,
System
.
Drawing
.
GraphicsUnit
.
Point
,
((
byte
)(
134
)));
this
.
btnMovej
.
Location
=
new
System
.
Drawing
.
Point
(
260
,
326
);
this
.
btnMovej
.
Name
=
"btnMovej"
;
this
.
btnMovej
.
Size
=
new
System
.
Drawing
.
Size
(
140
,
45
);
this
.
btnMovej
.
TabIndex
=
330
;
this
.
btnMovej
.
Text
=
" 轴点动- "
;
this
.
btnMovej
.
UseVisualStyleBackColor
=
false
;
this
.
btnMovej
.
MouseDown
+=
new
System
.
Windows
.
Forms
.
MouseEventHandler
(
this
.
btnMovej_MouseDown
);
this
.
btnMovej
.
MouseUp
+=
new
System
.
Windows
.
Forms
.
MouseEventHandler
(
this
.
btnMovej_MouseUp
);
//
// btnMove
//
this
.
btnMove
.
BackColor
=
System
.
Drawing
.
SystemColors
.
Control
;
this
.
btnMove
.
FlatStyle
=
System
.
Windows
.
Forms
.
FlatStyle
.
Flat
;
this
.
btnMove
.
Font
=
new
System
.
Drawing
.
Font
(
"微软雅黑"
,
10.5F
,
System
.
Drawing
.
FontStyle
.
Regular
,
System
.
Drawing
.
GraphicsUnit
.
Point
,
((
byte
)(
134
)));
this
.
btnMove
.
Location
=
new
System
.
Drawing
.
Point
(
114
,
326
);
this
.
btnMove
.
Name
=
"btnMove"
;
this
.
btnMove
.
Size
=
new
System
.
Drawing
.
Size
(
140
,
45
);
this
.
btnMove
.
TabIndex
=
329
;
this
.
btnMove
.
Text
=
"轴点动+ "
;
this
.
btnMove
.
UseVisualStyleBackColor
=
false
;
this
.
btnMove
.
MouseDown
+=
new
System
.
Windows
.
Forms
.
MouseEventHandler
(
this
.
btnMove_MouseDown
);
this
.
btnMove
.
MouseUp
+=
new
System
.
Windows
.
Forms
.
MouseEventHandler
(
this
.
btnMove_MouseUp
);
//
// linkLabel1
//
this
.
linkLabel1
.
AutoSize
=
true
;
this
.
linkLabel1
.
Location
=
new
System
.
Drawing
.
Point
(
313
,
172
);
this
.
linkLabel1
.
Name
=
"linkLabel1"
;
this
.
linkLabel1
.
Size
=
new
System
.
Drawing
.
Size
(
56
,
17
);
this
.
linkLabel1
.
TabIndex
=
331
;
this
.
linkLabel1
.
TabStop
=
true
;
this
.
linkLabel1
.
Text
=
"复制位置"
;
this
.
linkLabel1
.
LinkClicked
+=
new
System
.
Windows
.
Forms
.
LinkLabelLinkClickedEventHandler
(
this
.
linkLabel1_LinkClicked
);
//
// AxisMoveControl
//
this
.
AutoScaleMode
=
System
.
Windows
.
Forms
.
AutoScaleMode
.
None
;
this
.
Controls
.
Add
(
this
.
groupAxis
);
this
.
Controls
.
Add
(
this
.
groupBox1
);
this
.
Name
=
"AxisMoveControl"
;
this
.
Size
=
new
System
.
Drawing
.
Size
(
556
,
414
);
this
.
Size
=
new
System
.
Drawing
.
Size
(
556
,
396
);
this
.
groupAxis
.
ResumeLayout
(
false
);
this
.
groupAxis
.
PerformLayout
();
this
.
groupBox1
.
ResumeLayout
(
false
);
this
.
groupBox1
.
PerformLayout
();
this
.
ResumeLayout
(
false
);
}
...
...
@@ -913,31 +631,6 @@
private
System
.
Windows
.
Forms
.
Label
label46
;
private
System
.
Windows
.
Forms
.
ComboBox
comboBox1
;
private
System
.
Windows
.
Forms
.
Label
label49
;
private
System
.
Windows
.
Forms
.
GroupBox
groupBox1
;
private
UserFromControl
.
IOStatusControl
axis_4_Alarm
;
private
System
.
Windows
.
Forms
.
TextBox
txt4Target
;
private
System
.
Windows
.
Forms
.
TextBox
lblTargetP4
;
private
System
.
Windows
.
Forms
.
TextBox
lblActual4
;
private
System
.
Windows
.
Forms
.
Label
label1
;
private
UserFromControl
.
IOStatusControl
axis_1_Alarm
;
private
UserFromControl
.
IOStatusControl
axis_3_Alarm
;
private
UserFromControl
.
IOStatusControl
axis_2_Alarm
;
private
System
.
Windows
.
Forms
.
Label
label38
;
private
System
.
Windows
.
Forms
.
TextBox
txtMiddleTarget
;
private
System
.
Windows
.
Forms
.
TextBox
txtInoutTarget
;
private
System
.
Windows
.
Forms
.
TextBox
txtUpdownTarget
;
private
System
.
Windows
.
Forms
.
Label
label12
;
private
System
.
Windows
.
Forms
.
TextBox
lblTargetP1
;
private
System
.
Windows
.
Forms
.
TextBox
lblActual1
;
private
System
.
Windows
.
Forms
.
TextBox
lblTargetP3
;
private
System
.
Windows
.
Forms
.
TextBox
lblActual3
;
private
System
.
Windows
.
Forms
.
TextBox
lblTargetP2
;
private
System
.
Windows
.
Forms
.
TextBox
lblActual2
;
private
System
.
Windows
.
Forms
.
Label
label4
;
private
System
.
Windows
.
Forms
.
Label
label3
;
private
System
.
Windows
.
Forms
.
Label
label5
;
private
System
.
Windows
.
Forms
.
Label
label43
;
private
System
.
Windows
.
Forms
.
Label
label42
;
private
System
.
Windows
.
Forms
.
Button
btnMovej
;
private
System
.
Windows
.
Forms
.
Button
btnMove
;
private
System
.
Windows
.
Forms
.
LinkLabel
linkLabel1
;
...
...
source/VerticalStoreClinet/useControl/AxisMoveControl.cs
查看文件 @
4be5928
...
...
@@ -65,25 +65,18 @@ namespace OnlineStore.ACPackingStore
private
bool
AxisCanMove
()
{
if
(
BoxBean
.
Config
.
Middle_Axis
.
IsSameAxis
(
PortName
,
SlvAddr
)
||
BoxBean
.
Config
.
UpDown_Axis
.
IsSameAxis
(
PortName
,
SlvAddr
))
{
int
InOutDefaultPosition
=
ConfigAppSettings
.
GetIntValue
(
Setting_Init
.
InOutDefaultPosition
);
int
currValue
=
ACServerManager
.
GetActualtPosition
(
BoxBean
.
Config
.
InOut_Axis
.
DeviceName
,
BoxBean
.
Config
.
InOut_Axis
.
GetAxisValue
());
//旋转轴和升降轴运动时,叉子必须在待机位
if
(
currValue
>
InOutDefaultPosition
)
{
MessageBox
.
Show
(
"叉子不在待机位,请先将叉子退回待机位("
+
InOutDefaultPosition
+
")"
,
"警告(叉子在待机位时,才能移动升降轴和旋转轴) "
,
MessageBoxButtons
.
OK
,
MessageBoxIcon
.
Exclamation
);
return
false
;
}
}
if
(
BoxBean
.
Config
.
Stir_Axis
.
IsSameAxis
(
PortName
,
SlvAddr
))
{
if
(!
StoreManager
.
Store
.
StirAxisCanMove
())
{
MessageBox
.
Show
(
"搅拌气缸不在上升端,清先上升搅拌气缸"
,
"警告(搅拌气缸上升时,搅拌轴才能动作) "
,
MessageBoxButtons
.
OK
,
MessageBoxIcon
.
Exclamation
);
return
false
;
}
}
//if (BoxBean.Config.Middle_Axis.IsSameAxis(PortName, SlvAddr) || BoxBean.Config.UpDown_Axis.IsSameAxis(PortName, SlvAddr))
//{
// int InOutDefaultPosition = ConfigAppSettings.GetIntValue(Setting_Init.InOutDefaultPosition);
// int currValue = ACServerManager.GetActualtPosition(BoxBean.Config.InOut_Axis.DeviceName, BoxBean.Config.InOut_Axis.GetAxisValue());
// //旋转轴和升降轴运动时,叉子必须在待机位
// if (currValue > InOutDefaultPosition)
// {
// MessageBox.Show("叉子不在待机位,请先将叉子退回待机位(" + InOutDefaultPosition + ")", "警告(叉子在待机位时,才能移动升降轴和旋转轴) ", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
// return false;
// }
//}
return
true
;
}
private
void
btnAxisAMove_Click
(
object
sender
,
EventArgs
e
)
...
...
@@ -217,26 +210,7 @@ namespace OnlineStore.ACPackingStore
{
color
=
Color
.
Red
;
}
else
if
(
BoxBean
.
Config
.
UpDown_Axis
.
IsSameAxis
(
axis
.
DeviceName
,
axis
.
GetAxisValue
()))
{
color
=
Color
.
Blue
;
}
else
if
(
BoxBean
.
Config
.
InOut_Axis
.
IsSameAxis
(
axis
.
DeviceName
,
axis
.
GetAxisValue
()))
{
color
=
Color
.
Green
;
}
else
if
(
BoxBean
.
Config
.
Warming_Axis
.
IsSameAxis
(
axis
.
DeviceName
,
axis
.
GetAxisValue
()))
{
color
=
System
.
Drawing
.
Color
.
FromArgb
(((
int
)(((
byte
)(
192
)))),
((
int
)(((
byte
)(
0
)))),
((
int
)(((
byte
)(
192
)))));
;
}
else
if
(
BoxBean
.
Config
.
Colding_Axis
.
IsSameAxis
(
axis
.
DeviceName
,
axis
.
GetAxisValue
()))
{
color
=
System
.
Drawing
.
Color
.
FromArgb
(((
int
)(((
byte
)(
255
)))),
((
int
)(((
byte
)(
128
)))),
((
int
)(((
byte
)(
0
)))));
}
else
if
(
BoxBean
.
Config
.
Stir_Axis
.
IsSameAxis
(
axis
.
DeviceName
,
axis
.
GetAxisValue
()))
{
color
=
System
.
Drawing
.
Color
.
FromArgb
(((
int
)(((
byte
)(
64
)))),
((
int
)(((
byte
)(
0
)))),
((
int
)(((
byte
)(
0
)))));
}
btnOpenAxis
.
ForeColor
=
color
;
btnCloseAxis
.
ForeColor
=
color
;
btnAxisAMove
.
ForeColor
=
color
;
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论