Commit 5229fc72 张东亮

治具出入库更改

1 个父辈 7c97fdf2
正在显示 43 个修改的文件 包含 561 行增加451 行删除
 
Microsoft Visual Studio Solution File, Format Version 12.00 Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15 # Visual Studio Version 17
VisualStudioVersion = 15.0.27130.2024 VisualStudioVersion = 17.5.33414.496
MinimumVisualStudioVersion = 10.0.40219.1 MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Common", "source\Common\Common.csproj", "{43CDD09E-FCF3-4960-A01D-3BBFE9933122}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Common", "source\Common\Common.csproj", "{43CDD09E-FCF3-4960-A01D-3BBFE9933122}"
EndProject EndProject
...@@ -13,6 +13,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LoadCSVLibrary", "source\Lo ...@@ -13,6 +13,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LoadCSVLibrary", "source\Lo
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ACPackingStore", "source\ACPackingStore\ACPackingStore.csproj", "{0D2542F5-DD62-4352-82D0-383D9A045E74}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ACPackingStore", "source\ACPackingStore\ACPackingStore.csproj", "{0D2542F5-DD62-4352-82D0-383D9A045E74}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConfigHelper", "..\..\..\CSharp-Workspace\MyProject\DLL\ConfigHelper\ConfigHelper\ConfigHelper.csproj", "{290182DB-D949-434E-9FF7-C59BDE3F433A}"
EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU Debug|Any CPU = Debug|Any CPU
...@@ -39,6 +41,10 @@ Global ...@@ -39,6 +41,10 @@ Global
{0D2542F5-DD62-4352-82D0-383D9A045E74}.Debug|Any CPU.Build.0 = Debug|Any CPU {0D2542F5-DD62-4352-82D0-383D9A045E74}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0D2542F5-DD62-4352-82D0-383D9A045E74}.Release|Any CPU.ActiveCfg = Release|Any CPU {0D2542F5-DD62-4352-82D0-383D9A045E74}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0D2542F5-DD62-4352-82D0-383D9A045E74}.Release|Any CPU.Build.0 = Release|Any CPU {0D2542F5-DD62-4352-82D0-383D9A045E74}.Release|Any CPU.Build.0 = Release|Any CPU
{290182DB-D949-434E-9FF7-C59BDE3F433A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{290182DB-D949-434E-9FF7-C59BDE3F433A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{290182DB-D949-434E-9FF7-C59BDE3F433A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{290182DB-D949-434E-9FF7-C59BDE3F433A}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE
......
...@@ -181,6 +181,10 @@ ...@@ -181,6 +181,10 @@
</None> </None>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\..\..\..\..\CSharp-Workspace\MyProject\DLL\ConfigHelper\ConfigHelper\ConfigHelper.csproj">
<Project>{290182DB-D949-434E-9FF7-C59BDE3F433A}</Project>
<Name>ConfigHelper</Name>
</ProjectReference>
<ProjectReference Include="..\Common\Common.csproj"> <ProjectReference Include="..\Common\Common.csproj">
<Project>{43cdd09e-fcf3-4960-a01d-3bbfe9933122}</Project> <Project>{43cdd09e-fcf3-4960-a01d-3bbfe9933122}</Project>
<Name>Common</Name> <Name>Common</Name>
......
...@@ -3,64 +3,6 @@ ...@@ -3,64 +3,6 @@
<configSections> <configSections>
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net" /> <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net" />
</configSections> </configSections>
<appSettings>
<!--是否开机自动启动料仓-->
<add key="App_AutoRun" value="1" />
<add key="App_Title" value="包装料料仓" />
<!-- 开始吹气的判断值(配置值=服务器发送的湿度值-开始吹气值)-->
<add key="StartBlowValue" value="4" />
<!-- 停止吹气的判断值(配置值=服务器发送的湿度值-停止吹气值)-->
<add key="StopBlowValue" value="4" />
<!--Server address-->
<add key="http.server" value="http://10.85.160.25/myproject/" />
<!--storeType-->
<add key="store_count" value="2" />
<add key="Store_ConfigPath" value="\StoreConfig\StoreConfig.csv" />
<!--start one store config-->
<add key="Shelf_Position_Config" value="\StoreConfig\shelfPosition.csv" />
<add key="Store_Position_Config" value="\StoreConfig\linePositions.csv" />
<add key="BOX_ConfigPath" value="\StoreConfig\BoxConfig.csv" />
<add key="Store_Type" value="RC_AC_PA" />
<add key="Store_CID" value="packing-store" />
<add key="Store_CID_1" value="packing-19" />
<add key="Store_CID_2" value="packing-20" />
<!--end one store config-->
<add key="ACBaudRate" value="115200" />
<add key="InOutDefaultPosition" value="52000" />
<add key="Config_Pwd" value="123456" />
<!--二维码类型列表配置,用#分割,一维码=Barcode 二维码: QR Code#Data Matrix ECC 200#Micro QR Code-->
<add key="CodeType" value="QR Code#Data Matrix ECC 200" />
<!--二维码参数文件所在路径,文件名与二维码类型名一样-->
<add key="CodeParamPath" value="\CodeParam\" />
<!--出库等待料盘拿走的时间,秒-->
<add key="OutStoreWaitSeconds" value="1" />
<!--温控器类型,0=壁挂王字壳温湿度变送器,1=妙昕温湿度记录仪-->
<add key="HumitureControllerType" value="0" />
<add key="UseAIOBOX" value="1" />
<add key="DIMS" value="60" />
<add key="DOMS" value="300" />
<!--流水线地址和端口配置-->
<add key="LineServerIp" value="192.168.101.11" />
<add key="LineServerPort" value="5246" />
<!--是否调试状态-->
<add key="IsInDebug" value="1" />
<add key="UseBuzzer" value="0" />
<!--IO模块是否主动上传-->
<add key="AIOAutoUpload" value="0" />
<!--AGV调度服务器地址-->
<add key="AgvServerIp" value="10.85.160.20" />
<add key="CodeCount" value="3" />
<add key="Tool_P3_Offset" value="7000" />
<add key="Tool_P4_Offset" value="-2000" />
<add key="Tool_P5_Offset" value="-2000" />
<add key="Tool_P6_Offset" value="7000" />
<add key="Tool_TargetSpeed" value="20" />
<add key="Tool_TargetPosition" value="1835000" />
<!--是否启用入料口移门,1=启用,0=禁用-->
<add key="UseDoor" value="1" />
<add key="Agv_Log_Open" value="1" />
<add key="AutoShelfInstore" value="1" />
</appSettings>
<log4net> <log4net>
<appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender"> <appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender">
<file value="logs/Packing-store-19-20.log" /> <file value="logs/Packing-store-19-20.log" />
...@@ -69,7 +11,7 @@ ...@@ -69,7 +11,7 @@
<rollingStyle value="Date" /> <rollingStyle value="Date" />
<datePattern value="yyyy-MM-dd" /> <datePattern value="yyyy-MM-dd" />
<layout type="log4net.Layout.PatternLayout"> <layout type="log4net.Layout.PatternLayout">
<conversionPattern value="[%date][%t]%-5p %m%n" /> <conversionPattern value="[%d][%t]%-5p %m%n" />
</layout> </layout>
</appender> </appender>
<appender name="TheRFID" type="log4net.Appender.RollingFileAppender"> <appender name="TheRFID" type="log4net.Appender.RollingFileAppender">
...@@ -79,7 +21,7 @@ ...@@ -79,7 +21,7 @@
<rollingStyle value="Date" /> <rollingStyle value="Date" />
<datePattern value="yyyy-MM-dd" /> <datePattern value="yyyy-MM-dd" />
<layout type="log4net.Layout.PatternLayout"> <layout type="log4net.Layout.PatternLayout">
<conversionPattern value="[%date][%t]%-5p %m%n" /> <conversionPattern value="[%d][%t]%-5p %m%n" />
</layout> </layout>
</appender> </appender>
<logger name="RollingLogFileAppender"> <logger name="RollingLogFileAppender">
...@@ -87,13 +29,9 @@ ...@@ -87,13 +29,9 @@
<appender-ref ref="RollingLogFileAppender" /> <appender-ref ref="RollingLogFileAppender" />
</logger> </logger>
<logger name="TheRFID"> <logger name="TheRFID">
<level value="Debug" /> <level value="info" />
<appender-ref ref="TheRFID" /> <appender-ref ref="TheRFID" />
</logger> </logger>
<root>
<level value="Info" />
<appender-ref ref="RollingLogFileAppender" />
</root>
</log4net> </log4net>
<startup> <startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" /> <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
......
...@@ -59,6 +59,7 @@ ...@@ -59,6 +59,7 @@
this.lblVersion.TabIndex = 276; this.lblVersion.TabIndex = 276;
this.lblVersion.Text = "版本号:1.1.0000.0000"; this.lblVersion.Text = "版本号:1.1.0000.0000";
this.lblVersion.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; this.lblVersion.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
this.lblVersion.Click += new System.EventHandler(this.lblVersion_Click);
// //
// lblTime // lblTime
// //
...@@ -94,7 +95,7 @@ ...@@ -94,7 +95,7 @@
// //
// FrmAbout // FrmAbout
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 17F); this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 20F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(553, 222); this.ClientSize = new System.Drawing.Size(553, 222);
this.Controls.Add(this.btnCopy); this.Controls.Add(this.btnCopy);
......
...@@ -37,5 +37,10 @@ namespace OnlineStore.ACPackingStore ...@@ -37,5 +37,10 @@ namespace OnlineStore.ACPackingStore
{ {
Clipboard.SetDataObject(GetCodeNum(), true); Clipboard.SetDataObject(GetCodeNum(), true);
} }
private void lblVersion_Click(object sender, EventArgs e)
{
ConfigHelper.AdvanceConfigForm.ShowEditDialog(this);
}
} }
} }
...@@ -61,7 +61,7 @@ namespace OnlineStore.ACPackingStore ...@@ -61,7 +61,7 @@ namespace OnlineStore.ACPackingStore
/// </summary> /// </summary>
private bool InOutIsIsP1() private bool InOutIsIsP1()
{ {
int InOutDefaultPosition = ConfigAppSettings.GetIntValue(Setting_Init.InOutDefaultPosition); int InOutDefaultPosition = Setting_Init.InOutDefaultPosition;
//if (InOutDefaultPosition > 3000 || InOutDefaultPosition.Equals(0)) //if (InOutDefaultPosition > 3000 || InOutDefaultPosition.Equals(0))
//{ //{
// InOutDefaultPosition = 3000; // InOutDefaultPosition = 3000;
......
...@@ -383,7 +383,7 @@ namespace OnlineStore.ACPackingStore ...@@ -383,7 +383,7 @@ namespace OnlineStore.ACPackingStore
//位置配置 //位置配置
string appPath = Application.StartupPath; string appPath = Application.StartupPath;
//如果总配置文件存在,保存到总的配置文件 //如果总配置文件存在,保存到总的配置文件
string positionConfigFile = appPath + ConfigAppSettings.GetValue(Setting_Init.Store_Position_Config); string positionConfigFile = appPath + Setting_Init.Store_Position_Config;
if (!File.Exists(positionConfigFile)) if (!File.Exists(positionConfigFile))
{ {
string nameStr = BoxBean.DeviceID.ToString(); string nameStr = BoxBean.DeviceID.ToString();
...@@ -476,7 +476,7 @@ namespace OnlineStore.ACPackingStore ...@@ -476,7 +476,7 @@ namespace OnlineStore.ACPackingStore
/// </summary> /// </summary>
private bool InOutIsIsP1() private bool InOutIsIsP1()
{ {
int InOutDefaultPosition = ConfigAppSettings.GetIntValue(Setting_Init.InOutDefaultPosition); int InOutDefaultPosition = Setting_Init.InOutDefaultPosition;
int currValue = ACServerManager.GetActualtPosition(BoxBean.Config.InOut_Axis.DeviceName, BoxBean.Config.InOut_Axis.GetAxisValue()); int currValue = ACServerManager.GetActualtPosition(BoxBean.Config.InOut_Axis.DeviceName, BoxBean.Config.InOut_Axis.GetAxisValue());
if (currValue <= InOutDefaultPosition) if (currValue <= InOutDefaultPosition)
{ {
...@@ -869,7 +869,7 @@ namespace OnlineStore.ACPackingStore ...@@ -869,7 +869,7 @@ namespace OnlineStore.ACPackingStore
pso.UpDownAxis_HP102 = FormUtil.GetIntValue(txtUpdownP102); pso.UpDownAxis_HP102 = FormUtil.GetIntValue(txtUpdownP102);
} }
//位置配置 //位置配置
string positionConfigFile = Application.StartupPath + ConfigAppSettings.GetValue(Setting_Init.Shelf_Position_Config); string positionConfigFile = Application.StartupPath + Setting_Init.Shelf_Position_Config;
if (!File.Exists(positionConfigFile)) if (!File.Exists(positionConfigFile))
{ {
string nameStr = BoxBean.DeviceID.ToString(); string nameStr = BoxBean.DeviceID.ToString();
...@@ -970,10 +970,10 @@ namespace OnlineStore.ACPackingStore ...@@ -970,10 +970,10 @@ namespace OnlineStore.ACPackingStore
private void btnSaveCID_Click(object sender, EventArgs e) private void btnSaveCID_Click(object sender, EventArgs e)
{ {
string cid = txtCID.Text.Trim(); string cid = txtCID.Text.Trim();
DialogResult result = MessageBox.Show("确定将CID修改为【" + cid + "】,修改后需要重启生效", "", MessageBoxButtons.YesNo); DialogResult result = MessageBox.Show("确定将CID修改为【" + cid + "】", "", MessageBoxButtons.YesNo);
if (result.Equals(DialogResult.Yes)) if (result.Equals(DialogResult.Yes))
{ {
ConfigAppSettings.SaveValue(Setting_Init.Store_CID + "_" + BoxBean.DeviceID, cid); ConfigAppSettings.SaveValue("Store_CID" + "_" + BoxBean.DeviceID, cid);
} }
} }
...@@ -1019,7 +1019,7 @@ namespace OnlineStore.ACPackingStore ...@@ -1019,7 +1019,7 @@ namespace OnlineStore.ACPackingStore
{ {
string appPath = Application.StartupPath; string appPath = Application.StartupPath;
//如果总配置文件存在,保存到总的配置文件 //如果总配置文件存在,保存到总的配置文件
string positionConfigFile = appPath + ConfigAppSettings.GetValue(Setting_Init.Store_Position_Config); string positionConfigFile = appPath + Setting_Init.Store_Position_Config;
if (!File.Exists(positionConfigFile)) if (!File.Exists(positionConfigFile))
{ {
string nameStr = BoxBean.DeviceID.ToString(); string nameStr = BoxBean.DeviceID.ToString();
......
...@@ -31,11 +31,11 @@ namespace OnlineStore.ACPackingStore ...@@ -31,11 +31,11 @@ namespace OnlineStore.ACPackingStore
private void btnNext_Click(object sender, EventArgs e) private void btnNext_Click(object sender, EventArgs e)
{ {
string pwd = txtPwd.Text; string pwd = txtPwd.Text;
string configPwd = ConfigAppSettings.GetValue(Setting_Init.Config_Pwd); string configPwd = Setting_Init.Config_Pwd;
if (configPwd.Equals("")) if (configPwd.Equals(""))
{ {
configPwd = "123456"; configPwd = "123456";
ConfigAppSettings.SaveValue(Setting_Init.Config_Pwd,configPwd); Setting_Init.Config_Pwd=configPwd;
} }
if (pwd.Equals(configPwd)) if (pwd.Equals(configPwd))
{ {
......
...@@ -9,6 +9,8 @@ using System.Linq; ...@@ -9,6 +9,8 @@ using System.Linq;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
using OnlineStore.DeviceLibrary;
using log4net.Repository.Hierarchy;
namespace OnlineStore.ACPackingStore namespace OnlineStore.ACPackingStore
{ {
...@@ -59,9 +61,8 @@ namespace OnlineStore.ACPackingStore ...@@ -59,9 +61,8 @@ namespace OnlineStore.ACPackingStore
// 因为方法三只能是最小化的窗体显示出来,如果隐藏到托盘中则不能把运行的程序显示出来 // 因为方法三只能是最小化的窗体显示出来,如果隐藏到托盘中则不能把运行的程序显示出来
Process currentproc = Process.GetCurrentProcess(); Process currentproc = Process.GetCurrentProcess();
Process[] processcollection = Process.GetProcessesByName(currentproc.ProcessName.Replace(".vshost", string.Empty)); Process[] processcollection = Process.GetProcessesByName(currentproc.ProcessName.Replace(".vshost", string.Empty));
bool isShow=false;
// 该程序已经运行, // 该程序已经运行,
bool isShow = false;
if (processcollection.Length >= 1) if (processcollection.Length >= 1)
{ {
foreach (Process process in processcollection) foreach (Process process in processcollection)
...@@ -71,7 +72,7 @@ namespace OnlineStore.ACPackingStore ...@@ -71,7 +72,7 @@ namespace OnlineStore.ACPackingStore
// 如果进程的句柄为0,即代表没有找到该窗体,即该窗体隐藏的情况时 // 如果进程的句柄为0,即代表没有找到该窗体,即该窗体隐藏的情况时
if (process.MainWindowHandle.ToInt32().Equals(0)) if (process.MainWindowHandle.ToInt32().Equals(0))
{ {
string formTitle = ConfigAppSettings.GetValue(Setting_Init.App_Title); string formTitle = Setting_Init.App_Title;
// 获得窗体句柄 // 获得窗体句柄
formhwnd = FindWindow(null, formTitle); formhwnd = FindWindow(null, formTitle);
// 重新显示该窗体并切换到带入到前台 // 重新显示该窗体并切换到带入到前台
...@@ -94,6 +95,7 @@ namespace OnlineStore.ACPackingStore ...@@ -94,6 +95,7 @@ namespace OnlineStore.ACPackingStore
if (!isShow) if (!isShow)
{ {
System.Net.ServicePointManager.DefaultConnectionLimit = 512; System.Net.ServicePointManager.DefaultConnectionLimit = 512;
Setting_Init.Init();
XmlConfigurator.Configure(); XmlConfigurator.Configure();
Application.EnableVisualStyles(); Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false); Application.SetCompatibleTextRenderingDefault(false);
......
...@@ -66,12 +66,12 @@ namespace OnlineStore.ACPackingStore ...@@ -66,12 +66,12 @@ namespace OnlineStore.ACPackingStore
IOManager.instance.ConnectionIOList(new List<string> { /*IoIp*/ }); IOManager.instance.ConnectionIOList(new List<string> { /*IoIp*/ });
} }
P3Offset = ConfigAppSettings.GetIntValue(Setting_Init.Tool_P3_Offset); P3Offset = Setting_Init.Tool_P3_Offset;
P4Offset = ConfigAppSettings.GetIntValue(Setting_Init.Tool_P4_Offset); P4Offset = Setting_Init.Tool_P4_Offset;
P5Offset = ConfigAppSettings.GetIntValue(Setting_Init.Tool_P5_Offset); P5Offset = Setting_Init.Tool_P5_Offset;
P6Offset = ConfigAppSettings.GetIntValue(Setting_Init.Tool_P6_Offset); P6Offset = Setting_Init.Tool_P6_Offset;
int tSpeed = ConfigAppSettings.GetIntValue(Setting_Init.Tool_TargetSpeed); int tSpeed = Setting_Init.Tool_TargetSpeed;
int tPosition = ConfigAppSettings.GetIntValue(Setting_Init.Tool_TargetPosition); int tPosition = Setting_Init.Tool_TargetPosition;
if (P3Offset.Equals(0)) P3Offset = 6000; if (P3Offset.Equals(0)) P3Offset = 6000;
if (P4Offset.Equals(0)) P4Offset = -6000; if (P4Offset.Equals(0)) P4Offset = -6000;
...@@ -197,12 +197,12 @@ namespace OnlineStore.ACPackingStore ...@@ -197,12 +197,12 @@ namespace OnlineStore.ACPackingStore
private void SaveConfig(int speed, int position) private void SaveConfig(int speed, int position)
{ {
//保存配置 //保存配置
ConfigAppSettings.SaveValue(Setting_Init.Tool_P3_Offset, P3Offset); Setting_Init.Tool_P3_Offset= P3Offset;
ConfigAppSettings.SaveValue(Setting_Init.Tool_P4_Offset, P4Offset); Setting_Init.Tool_P4_Offset=P4Offset;
ConfigAppSettings.SaveValue(Setting_Init.Tool_P5_Offset, P5Offset); Setting_Init.Tool_P5_Offset=P5Offset;
ConfigAppSettings.SaveValue(Setting_Init.Tool_P6_Offset, P6Offset); Setting_Init.Tool_P6_Offset=P6Offset;
ConfigAppSettings.SaveValue(Setting_Init.Tool_TargetSpeed, speed); Setting_Init.Tool_TargetSpeed=speed;
ConfigAppSettings.SaveValue(Setting_Init.Tool_TargetPosition, position); Setting_Init.Tool_TargetPosition= position;
} }
private void btnAbsMove_Click(object sender, EventArgs e) private void btnAbsMove_Click(object sender, EventArgs e)
{ {
......
...@@ -66,7 +66,7 @@ namespace OnlineStore.ACPackingStore ...@@ -66,7 +66,7 @@ namespace OnlineStore.ACPackingStore
/// </summary> /// </summary>
private bool InOutIsIsP1() private bool InOutIsIsP1()
{ {
int InOutDefaultPosition = ConfigAppSettings.GetIntValue(Setting_Init.InOutDefaultPosition); int InOutDefaultPosition = Setting_Init.InOutDefaultPosition;
int currValue = ACServerManager.GetActualtPosition(BoxBean.Config.InOut_Axis.DeviceName, BoxBean.Config.InOut_Axis.GetAxisValue()); int currValue = ACServerManager.GetActualtPosition(BoxBean.Config.InOut_Axis.DeviceName, BoxBean.Config.InOut_Axis.GetAxisValue());
if (currValue <= InOutDefaultPosition) if (currValue <= InOutDefaultPosition)
{ {
......
...@@ -74,6 +74,12 @@ ...@@ -74,6 +74,12 @@
<ItemGroup> <ItemGroup>
<WCFMetadata Include="Service References\" /> <WCFMetadata Include="Service References\" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\..\..\CSharp-Workspace\MyProject\DLL\ConfigHelper\ConfigHelper\ConfigHelper.csproj">
<Project>{290182db-d949-434e-9ff7-c59bde3f433a}</Project>
<Name>ConfigHelper</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. <!-- 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. Other similar extension points exist, see Microsoft.Common.targets.
......
using System; using ConfigHelper;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace OnlineStore.Common namespace OnlineStore.Common
{ {
...@@ -11,97 +8,92 @@ namespace OnlineStore.Common ...@@ -11,97 +8,92 @@ namespace OnlineStore.Common
/// </summary> /// </summary>
public class Setting_Init public class Setting_Init
{ {
public static string Agv_Log_Open = "Agv_Log_Open"; public static void Init()
public static string Server_Log_Open = "Server_Log_Open"; {
/// <summary> ConfigHelper.Config.MyConfig = typeof(Setting_Init);
/// 系统启动时自动启动料仓,=1时自动启动,并隐藏窗口,=0时不需要 }
/// </summary> [MyConfigComment("是否打开AGV日志")]
public static string App_AutoRun = "App_AutoRun"; public static MyConfig<bool> Log_OpenAgv = true;
/// <summary> [MyConfigComment("是否打开AGV日志")]
/// 系统主界面标题 public static MyConfig<bool> Log_OpenServer = true;
/// </summary>
public static string App_Title = "App_Title"; [MyConfigComment("系统启动时自动启动料仓,true时自动启动,并隐藏窗口;false时不需要")]
public static MyConfig<bool> App_AutoRun = true;
[MyConfigComment("系统主界面标题")]
public static string http_server = "http.server"; public static MyConfig<string> App_Title = "包装料仓";
public static string Store_CID = "Store_CID"; [MyConfigComment("料仓配置路径")]
public static MyConfig<string> BOX_ConfigPath = "\\StoreConfig\\BoxConfig.csv";
[MyConfigComment("料仓点位配置路径")]
public static MyConfig<string> Store_Position_Config = "\\StoreConfig\\linePositions.csv";
/// <summary> [MyConfigComment("服务器地址")]
/// 料仓数量 public static MyConfig<string> http_server = "http://172.16.77.86/myproject/";
/// </summary> [MyConfigComment("料仓CID,每个仓唯一")]
public static string store_count = "store_count"; public static MyConfig<string> Store_CID = "packing-store";
/// <summary>
/// 料仓类型,1=在线料仓
/// </summary>
public static string Store_Type = "Store_Type";
public static string BOX_ConfigPath = "BOX_ConfigPath";
public static string Store_Position_Config = "Store_Position_Config";
/// <summary>
/// 摄像机名称,多个中间使用#分割
/// </summary>
public static string CameraName = "CameraName";
/// <summary>
/// 需要识别的二维码类型,多个中间使用#分割
/// </summary>
public static string CodeType = "CodeType";
/// <summary> [MyConfigComment("软件上料仓数量")]
/// 开始吹气的判断值(配置值=服务器发送的湿度值-开始吹气值) public static MyConfig<int> store_count = 2;
/// </summary> [MyConfigComment("料仓类型")]
public static string StartBlowValue = "StartBlowValue"; public static MyConfig<string> Store_Type = "RC_AC_PA";
/// <summary>
/// 停止吹气的判断值(配置值=服务器发送的湿度值-停止吹气值)
/// </summary>
public static string StopBlowValue = "StopBlowValue";
/// <summary> [MyConfigComment("摄像机名称,多个中间使用#分割")]
/// 配置文件路径 Data Matrix ECC 200.dcm public static MyConfig<string> CameraName = "";
/// </summary> [MyConfigComment("需要识别的二维码类型,多个中间使用#分割")]
public static string CodeParamPath = "CodeParamPath"; public static MyConfig<string> CodeType = "QR Code#Data Matrix ECC 200";
[MyConfigComment("是否开启吹气")]
/// <summary> public static MyConfig<bool> OpenBlow = false;
/// 进出轴最大待机点,需要小于3000 [MyConfigComment("开始吹气的判断值(配置值=服务器发送的湿度值-开始吹气值)")]
/// </summary> public static MyConfig<int> StartBlowValue = 4;
public static string InOutDefaultPosition = "InOutDefaultPosition"; [MyConfigComment("停止吹气的判断值(配置值=服务器发送的湿度值-停止吹气值)")]
public static MyConfig<int> StopBlowValue = 4;
[MyConfigComment("二维码参数文件所在路径,文件名与二维码类型名一样")]
public static MyConfig<string> CodeParamPath = "\\CodeParam\\";
public static string Config_Pwd = "Config_Pwd"; [MyConfigComment("进出轴最大待机点,需要小于3000")]
/// <summary> public static MyConfig<int> InOutDefaultPosition = 52000;
/// 出库等待料盘拿走的时间,秒 [MyConfigComment("配置的登录密码")]
/// </summary> public static MyConfig<string> Config_Pwd = "123456";
public static string OutStoreWaitSeconds = "OutStoreWaitSeconds";
/// <summary> [MyConfigComment("出库等待料盘拿走的时间,秒")]
/// 温控器类型,0=壁挂王字壳温湿度变送器,1=妙昕温湿度记录仪 public static MyConfig<int> OutStoreWaitSeconds = 30;
/// </summary>
public static string HumitureControllerType = "HumitureControllerType";
public static string UseAIOBOX = "UseAIOBOX"; [MyConfigComment("温控器类型,0=壁挂王字壳温湿度变送器,1=妙昕温湿度记录仪")]
public static MyConfig<int> HumitureControllerType = 0;
public static string LineServerIp = "LineServerIp"; [MyConfigComment("是否使用零点IO模块")]
public static string LineServerPort = "LineServerPort"; public static MyConfig<bool> UseAIOBOX = true;
public static string ACBaudRate = "ACBaudRate"; [MyConfigComment("伺服通讯波特率")]
public static MyConfig<int> ACBaudRate = 115200;
public static string Store_ConfigPath = "Store_ConfigPath"; [MyConfigComment("料仓配置文件路径")]
public static MyConfig<string> Store_ConfigPath = "\\StoreConfig\\StoreConfig.csv";
public static string UseBuzzer = "UseBuzzer";
public static string Shelf_Position_Config = "Shelf_Position_Config";
[MyConfigComment("是否使用蜂鸣器")]
public static string Tool_P3_Offset = "Tool_P3_Offset"; public static MyConfig<bool> UseBuzzer = false;
public static string Tool_P4_Offset = "Tool_P4_Offset"; [MyConfigComment("料架点位配置文件路径")]
public static string Tool_P5_Offset = "Tool_P5_Offset"; public static MyConfig<string> Shelf_Position_Config = "\\StoreConfig\\shelfPosition.csv";
public static string Tool_P6_Offset = "Tool_P6_Offset";
public static string Tool_TargetSpeed = "Tool_TargetSpeed"; [MyConfigComment("")]
public static string Tool_TargetPosition = "Tool_TargetPosition"; public static MyConfig<int> Tool_P3_Offset = 7000;
[MyConfigComment("")]
public static MyConfig<int> Tool_P4_Offset = -2000;
[MyConfigComment("")]
public static MyConfig<int> Tool_P5_Offset = -2000;
[MyConfigComment("")]
public static MyConfig<int> Tool_P6_Offset = 7000;
public static string AgvServerIp = "AgvServerIp"; [MyConfigComment("")]
public static string CodeCount = "CodeCount"; public static MyConfig<int> Tool_TargetSpeed = 20;
public static string AutoShelfInstore = "AutoShelfInstore"; [MyConfigComment("")]
public static string UseDoor = "UseDoor"; public static MyConfig<int> Tool_TargetPosition = 1835000;
[MyConfigComment("AGV调度服务器IP")]
public static MyConfig<string> AgvServerIp = "172.16.77.76";
[MyConfigComment("条码数量")]
public static MyConfig<int> CodeCount = 3;
[MyConfigComment("是否检测到料架自动入库")]
public static MyConfig<bool> AutoShelfInstore = true;
[MyConfigComment("是否启用入料口移门")]
public static MyConfig<bool> UseDoor = true;
} }
} }
...@@ -12,7 +12,7 @@ namespace OnlineStore.Common ...@@ -12,7 +12,7 @@ namespace OnlineStore.Common
{ {
public class ConfigAppSettings public class ConfigAppSettings
{ {
// public static readonly ILog LOGGER = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); // public static readonly ILog LOGGER = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
private static int seq = 1; private static int seq = 1;
...@@ -25,53 +25,19 @@ namespace OnlineStore.Common ...@@ -25,53 +25,19 @@ namespace OnlineStore.Common
} }
Interlocked.Increment(ref seq); Interlocked.Increment(ref seq);
return seq; return seq;
} }
public static string GetValue(string key) public static string GetValue(string key,string defaultVal="")
{ {
System.Configuration.Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None); return ConfigHelper.Config.Get(key, defaultVal);
if (config.AppSettings.Settings[key] == null)
{
LogUtil.error("未找到配置:" + key + ",请检查配置是否完整!");
return "";
}
else
{
return config.AppSettings.Settings[key].Value;
}
} }
public static decimal GetNumValue(string key) public static decimal GetNumValue(string key)
{ {
decimal a = 0; return ConfigHelper.Config.Get<decimal>(key);
System.Configuration.Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
if (config.AppSettings.Settings[key] == null)
{
LogUtil.error("未找到配置:" + key + ",请检查配置是否完整!");
return a;
}
else
{
{
Decimal.TryParse(config.AppSettings.Settings[key].Value, out a);
}
}
return a;
} }
public static int GetIntValue(string key) public static int GetIntValue(string key,int val=0)
{ {
int a = 0; return ConfigHelper.Config.Get<int>(key,val);
System.Configuration.Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
if (config.AppSettings.Settings[key] == null)
{
LogUtil.error("未找到配置:" + key + ",请检查配置是否完整!");
return a;
}
else
{
{
Int32.TryParse(config.AppSettings.Settings[key].Value, out a);
}
} return a;
} }
public static void SaveValue(string key, int value) public static void SaveValue(string key, int value)
{ {
...@@ -79,81 +45,7 @@ namespace OnlineStore.Common ...@@ -79,81 +45,7 @@ namespace OnlineStore.Common
} }
public static void SaveValue(string key, string value) public static void SaveValue(string key, string value)
{ {
try ConfigHelper.Config.Set(key, value);
{
if (key.Equals("") || value.Equals(""))
{
return;
}
//增加的内容写在appSettings段下 <add key="RegCode" value="0"/>
System.Configuration.Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
if (config.AppSettings.Settings[key] == null)
{
SetValue(key, value);
}
else
{
UpdateConfig(key, value);
}
}
catch (Exception ex)
{
LogUtil.error( "SaveValue保存配置出错:AppKey=" + key + ",AppValue=" + value + "," + ex.StackTrace);
}
}
/// <summary>
/// 更新配置文件信息
/// </summary>
/// <param name="name">配置文件字段名称</param>
/// <param name="Xvalue">值</param>
private static void UpdateConfig(string name, string Xvalue)
{
try
{
XmlDocument doc = new XmlDocument();
doc.Load(Application.ExecutablePath + ".config");
XmlNode node = doc.SelectSingleNode(@"//add[@key='" + name + "']");
XmlElement ele = (XmlElement)node;
ele.SetAttribute("value", Xvalue);
doc.Save(Application.ExecutablePath + ".config");
}
catch (Exception ex)
{
LogUtil.error( "UpdateConfig保存配置出错:name=" + name + ",Xvalue=" + Xvalue + "," + ex.StackTrace);
}
}
///<summary>
///向.config文件的appKey结写入信息AppValue 保存设置
///</summary>
///<param name="AppKey">节点名</param>
///<param name="AppValue">值</param>
private static void SetValue(String AppKey, String AppValue)
{
try
{
XmlDocument xDoc = new XmlDocument();
xDoc.Load(System.Windows.Forms.Application.ExecutablePath + ".config");
XmlNode xNode;
XmlElement xElem1;
XmlElement xElem2;
xNode = xDoc.SelectSingleNode("//appSettings");
xElem1 = (XmlElement)xNode.SelectSingleNode("//add[@key='" + AppKey + "']");
if (xElem1 != null)
xElem1.SetAttribute("value", AppValue);
else
{
xElem2 = xDoc.CreateElement("add");
xElem2.SetAttribute("key", AppKey);
xElem2.SetAttribute("value", AppValue);
xNode.AppendChild(xElem2);
}
xDoc.Save(System.Windows.Forms.Application.ExecutablePath + ".config");
}
catch (Exception ex)
{
LogUtil.error( "SetValue保存配置出错:AppKey=" + AppKey + ",AppValue=" + AppValue + "," + ex.StackTrace);
}
} }
} }
} }
...@@ -120,12 +120,11 @@ namespace OnlineStore.Common ...@@ -120,12 +120,11 @@ namespace OnlineStore.Common
} }
return null; return null;
} }
private static int isLog = ConfigAppSettings.GetIntValue(Setting_Init.Server_Log_Open);
public static string LastServerMsg = ""; public static string LastServerMsg = "";
private static string PostJson(string url, string paramData, Encoding encoding, out bool isTimeOut) private static string PostJson(string url, string paramData, Encoding encoding, out bool isTimeOut)
{ {
isTimeOut = false; isTimeOut = false;
if (isLog == 1) if (Setting_Init.Log_OpenServer)
{ {
LogUtil.info("给服务器发送数据【" + paramData + "】 "); LogUtil.info("给服务器发送数据【" + paramData + "】 ");
} }
...@@ -156,7 +155,7 @@ namespace OnlineStore.Common ...@@ -156,7 +155,7 @@ namespace OnlineStore.Common
{ {
LogUtil.error("POST ERROR:" + ex.ToString(), 1); LogUtil.error("POST ERROR:" + ex.ToString(), 1);
} }
if (isLog == 1) if (Setting_Init.Log_OpenServer)
{ {
LogUtil.info("收到服务器数据【" + result + "】"); LogUtil.info("收到服务器数据【" + result + "】");
} }
...@@ -186,7 +185,7 @@ namespace OnlineStore.Common ...@@ -186,7 +185,7 @@ namespace OnlineStore.Common
} }
IsTimeOut = false; IsTimeOut = false;
if (isLog == 1) if (Setting_Init.Log_OpenServer)
{ {
LogUtil.info("给服务器发送数据【" + url + "】【" + paramData + "】 "); LogUtil.info("给服务器发送数据【" + url + "】【" + paramData + "】 ");
} }
...@@ -216,7 +215,7 @@ namespace OnlineStore.Common ...@@ -216,7 +215,7 @@ namespace OnlineStore.Common
LogUtil.error("POST [" + url + "] ERROR:" + e.ToString(), 101); LogUtil.error("POST [" + url + "] ERROR:" + e.ToString(), 101);
} }
if (isLog == 1) if (Setting_Init.Log_OpenServer)
{ {
LogUtil.info("收到服务器数据【" + result + "】"); LogUtil.info("收到服务器数据【" + result + "】");
} }
......
...@@ -24,7 +24,7 @@ namespace OnlineStore.Common ...@@ -24,7 +24,7 @@ namespace OnlineStore.Common
private static string LogName = ""; private static string LogName = "";
private static Dictionary<string, AcSerialBean> serialBeanMap = new Dictionary<string, AcSerialBean>(); private static Dictionary<string, AcSerialBean> serialBeanMap = new Dictionary<string, AcSerialBean>();
public static int HumitureControllerType = ConfigAppSettings.GetIntValue(Setting_Init.HumitureControllerType); public static int HumitureControllerType = Setting_Init.HumitureControllerType;
public static bool Init(string port) public static bool Init(string port)
{ {
if (serialBeanMap.ContainsKey(port)) if (serialBeanMap.ContainsKey(port))
......
using System; using log4net;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using System.Text;
using log4net;
using System.Reflection;
using System.Drawing; using System.Drawing;
namespace OnlineStore.Common namespace OnlineStore.Common
{ {
public class LogUtil public class LogUtil
{ {
public static readonly ILog AIOLog = LogManager.GetLogger("AIOBOXLog");
private static LogUtil instance = new LogUtil();
public delegate void ShowLog(string msg, Color color); public delegate void ShowLog(string msg, Color color);
public static readonly ILog LOGGER = LogManager.GetLogger("RollingLogFileAppender"); public static readonly ILog LOGGER = LogManager.GetLogger("RollingLogFileAppender");
...@@ -29,19 +23,7 @@ namespace OnlineStore.Common ...@@ -29,19 +23,7 @@ namespace OnlineStore.Common
log.Info(" - " + msg); log.Info(" - " + msg);
AddToBox(msg, Color.Black); AddToBox(msg, Color.Black);
} }
public static void info(ILog log, string msg, Color color)
{
log.Info(" - " + msg);
AddToBox(msg, color);
}
public static void debug(ILog log, string msg, Color color)
{
log.Debug(" - " + msg);
if (debug_opened)
{
AddToBox(msg, color);
}
}
public static void debug(ILog log, string msg) public static void debug(ILog log, string msg)
{ {
log.Debug(" - " + msg); log.Debug(" - " + msg);
...@@ -125,18 +107,23 @@ namespace OnlineStore.Common ...@@ -125,18 +107,23 @@ namespace OnlineStore.Common
LastText = text; LastText = text;
if (logBox.Visible) if (logBox.Visible)
{ {
logBox.Text = text; logBox.Invoke(new Action(() =>
// logBox.Focus(); //使文本框获取焦点
logBox.AppendText(now.ToLongTimeString() + " " + msg + Environment.NewLine); //增加文本
TimeSpan span = DateTime.Now - lastTime;
if (span.TotalSeconds > 3000000)
{ {
lastTime = DateTime.Now; logBox.Text = text;
logBox.Select(logBox.Text.Length, 0); //设置光标的位置到文本尾 logBox.ForeColor = color;
logBox.ScrollToCaret(); //滚动到控件光标处 // logBox.Focus(); //使文本框获取焦点
logBox.AppendText(now.ToLongTimeString() + " " + msg + Environment.NewLine); //增加文本
TimeSpan span = DateTime.Now - lastTime;
if (span.TotalSeconds > 3000000)
{
lastTime = DateTime.Now;
logBox.Select(logBox.Text.Length, 0); //设置光标的位置到文本尾
logBox.ScrollToCaret(); //滚动到控件光标处
}
} }
));
} }
} }
catch (Exception ex) catch (Exception ex)
...@@ -184,7 +171,7 @@ namespace OnlineStore.Common ...@@ -184,7 +171,7 @@ namespace OnlineStore.Common
public static void error(string errorMsg, Exception ex = null) public static void error(string errorMsg, Exception ex = null)
{ {
if (ex == null) if (ex == null)
{ {
error(LOGGER, errorMsg); error(LOGGER, errorMsg);
} }
else else
......
...@@ -69,13 +69,18 @@ ...@@ -69,13 +69,18 @@
<Reference Include="System.Xml" /> <Reference Include="System.Xml" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="ACPackingStore\AC_BOX_Bean.cs" /> <Compile Include="PackingStore\AC_BOX_Bean_server_connect.cs" />
<Compile Include="ACPackingStore\AC_BOX_Bean_Partial.cs" /> <Compile Include="PackingStore\AC_BOX_Bean.cs" />
<Compile Include="ACPackingStore\AC_BOX_Bean_Shelf.cs" /> <Compile Include="PackingStore\AC_BOX_Bean_OutStore.cs" />
<Compile Include="ACPackingStore\EnteryDoorBean.cs" /> <Compile Include="PackingStore\AC_BOX_Bean_InStore.cs" />
<Compile Include="ACPackingStore\HumitureBean.cs" /> <Compile Include="PackingStore\AC_BOX_Bean_Partial.cs" />
<Compile Include="ACPackingStore\PackingStoreBean.cs" /> <Compile Include="PackingStore\AC_BOX_Bean_AGV.cs" />
<Compile Include="ACPackingStore\StoreManager.cs" /> <Compile Include="PackingStore\AC_BOX_Bean_ScanCode.cs" />
<Compile Include="PackingStore\AC_BOX_Bean_Shelf.cs" />
<Compile Include="PackingStore\EnteryDoorBean.cs" />
<Compile Include="PackingStore\HumitureBean.cs" />
<Compile Include="PackingStore\PackingStoreBean.cs" />
<Compile Include="PackingStore\StoreManager.cs" />
<Compile Include="agvClient\AgvClient.cs" /> <Compile Include="agvClient\AgvClient.cs" />
<Compile Include="device\halcon\CodeManager.cs" /> <Compile Include="device\halcon\CodeManager.cs" />
<Compile Include="device\IO\AIOBOX\AIOBOXManager.cs" /> <Compile Include="device\IO\AIOBOX\AIOBOXManager.cs" />
...@@ -96,7 +101,7 @@ ...@@ -96,7 +101,7 @@
<Compile Include="store\InOutParam.cs"> <Compile Include="store\InOutParam.cs">
<SubType>Code</SubType> <SubType>Code</SubType>
</Compile> </Compile>
<Compile Include="store\model\StoreMoveInfo.cs"> <Compile Include="store\model\DeviceMoveInfo.cs">
<SubType>Code</SubType> <SubType>Code</SubType>
</Compile> </Compile>
<Compile Include="store\KTK_Store.cs" /> <Compile Include="store\KTK_Store.cs" />
...@@ -110,6 +115,10 @@ ...@@ -110,6 +115,10 @@
</Content> </Content>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\..\..\..\..\CSharp-Workspace\MyProject\DLL\ConfigHelper\ConfigHelper\ConfigHelper.csproj">
<Project>{290182DB-D949-434E-9FF7-C59BDE3F433A}</Project>
<Name>ConfigHelper</Name>
</ProjectReference>
<ProjectReference Include="..\Common\Common.csproj"> <ProjectReference Include="..\Common\Common.csproj">
<Project>{43cdd09e-fcf3-4960-a01d-3bbfe9933122}</Project> <Project>{43cdd09e-fcf3-4960-a01d-3bbfe9933122}</Project>
<Name>Common</Name> <Name>Common</Name>
......
...@@ -45,6 +45,11 @@ namespace OnlineStore.DeviceLibrary ...@@ -45,6 +45,11 @@ namespace OnlineStore.DeviceLibrary
/// </summary> /// </summary>
public bool WaitShelfEnter=false; public bool WaitShelfEnter=false;
private int logType = 1000; private int logType = 1000;
/// <summary>
/// 当前料架编号
/// </summary>
private string CurrShelfID = "";
public AC_BOX_Bean(AC_BOX_Config config) public AC_BOX_Bean(AC_BOX_Config config)
{ {
Init(); Init();
...@@ -92,8 +97,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -92,8 +97,7 @@ namespace OnlineStore.DeviceLibrary
} }
} }
mainTimer.Enabled = false; mainTimer.Enabled = false;
int isAuto = ConfigAppSettings.GetIntValue(Setting_Init.App_AutoRun); if (Setting_Init.App_AutoRun)
if (isAuto == 1)
{ {
mainTimer.Enabled = true; mainTimer.Enabled = true;
} }
...@@ -266,7 +270,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -266,7 +270,7 @@ namespace OnlineStore.DeviceLibrary
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(2000)); MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(2000));
LineStop(); LineStop();
ACAxisHomeMove(Config.InOut_Axis); ACAxisHomeMove(Config.InOut_Axis);
AgvClient.SetStatus(Config.AgvNodeName,"","",ClientAction.None,ClientLevel.High,true); setAgvStatus("","",ClientAction.None,ClientLevel.High,true);
} }
/// <summary> /// <summary>
...@@ -460,7 +464,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -460,7 +464,7 @@ namespace OnlineStore.DeviceLibrary
/// </summary> /// </summary>
public override void StopRun() public override void StopRun()
{ {
AgvClient.SetStatus(Config.AgvNodeName); setAgvStatus();
lastPosId = ""; lastPosId = "";
lastPosIdStatus = StoreStatus.StoreOnline; lastPosIdStatus = StoreStatus.StoreOnline;
WarnMsg = ""; WarnMsg = "";
...@@ -698,7 +702,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -698,7 +702,7 @@ namespace OnlineStore.DeviceLibrary
} }
if (IsDebug) if (IsDebug)
{ {
AgvClient.SetStatus(Config.AgvNodeName); setAgvStatus();
} }
else else
{ {
...@@ -836,7 +840,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -836,7 +840,7 @@ namespace OnlineStore.DeviceLibrary
/// </summary> /// </summary>
public override void StopMove() public override void StopMove()
{ {
AgvClient.SetStatus(Config.AgvNodeName); setAgvStatus();
DoorBean.Stop(); DoorBean.Stop();
IOMove(IO_Type.Axis_Brake, IO_VALUE.LOW); IOMove(IO_Type.Axis_Brake, IO_VALUE.LOW);
MoveInfo.EndMove(); MoveInfo.EndMove();
......
using Asa;
using OnlineStore.Common;
using OnlineStore.LoadCSVLibrary;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace OnlineStore.DeviceLibrary
{
public partial class AC_BOX_Bean
{
/// <summary>
/// 设置出入口AGV状态
/// </summary>
/// <param name="mark"></param>
/// <param name="shelfId"></param>
/// <param name="action"></param>
/// <param name="level"></param>
/// <param name="isMust"></param>
void setAgvStatus(string mark = "0", string shelfId = "", ClientAction action = ClientAction.None, ClientLevel level = ClientLevel.Low, bool isMust = false)
{
AgvClient.SetStatus(Config.AgvNodeName, mark, shelfId, action, level, isMust);
}
internal bool ProcessAGVAction(string name, string rfid, ClientAction action)
{
string logN = name + "收到调度" + name + "=" + action + ",RFID[" + rfid + "]";
//Arrive收到后打开门
if (!action.Equals(ClientAction.Arrive))
{
LogUtil.info(Name + logN + " ,未找到相关处理");
return false;
}
//出库处理中不处理
if (MoveInfo.MoveStep.Equals(StoreMoveStep.BS_03_WaitEmptyAgv))
{
if (!rfid.Equals(""))
{
string mark = GetMarkInfo();
LogUtil.error(Name + logN + " 当前 BS_03_WaitEmptyAgv,RFID[" + rfid + "]不是空车,不处理agv,重发 NeedLeave [" + mark + "][" + CurrShelfID + "]");
Task.Factory.StartNew(new Action(()=> {
setAgvStatus(mark, CurrShelfID, ClientAction.MayNot, ClientLevel.High, true);
Thread.Sleep(10000);
setAgvStatus(mark, CurrShelfID, ClientAction.NeedLeave, ClientLevel.High, true);
}));
return false;
}
//等待空车到达
LogUtil.info(Name + logN + ",当前 BS_03_WaitEmptyAgv,正在等待料架到达");
MoveInfo.NextMoveStep(StoreMoveStep.BS_04_DoorOpen);
InOutStoreLog("送出料架等待空车,agv到达,打开入料口移门");
DoorBean.StartOpen(MoveInfo);
return true;
}
else if (MoveInfo.MoveType.Equals(StoreMoveType.OutStore) && MoveInfo.MoveStep.Equals(StoreMoveStep.BI_00_ReadyShelf))
{
if (rfid.Equals(""))
{
string mark = GetMarkInfo();
LogUtil.error(Name + logN + " 当前出库中 BI_00_ReadyShelf,RFID无效,不处理agv,重发 NeedEnter [" + mark + "][" + MoveInfo.MoveParam.rfid + "]");
Task.Factory.StartNew(new Action(() => {
setAgvStatus(mark, CurrShelfID, ClientAction.MayNot, ClientLevel.High, true);
Thread.Sleep(10000);
setAgvStatus(mark, MoveInfo.MoveParam.rfid, ClientAction.NeedEnter, ClientLevel.High, true);
}));
return false;
}
//出库等待料架到达
LogUtil.info(Name + logN + ",当前出库中 BI_00_ReadyShelf,正在等待料架到达");
MoveInfo.NextMoveStep(StoreMoveStep.BI_01_DoorOpen);
InOutStoreLog("出库等待料架,agv已到达,打开入料口移门");
DoorBean.StartOpen(MoveInfo);
return true;
}
else if (storeRunStatus.Equals(StoreRunStatus.Runing) &&
MoveInfo.MoveType.Equals(StoreMoveType.None) &&
IOValue(IO_Type.LineTake_Check).Equals(IO_VALUE.LOW))
{
//agv到达,开始处理
if (rfid.Equals(""))
{
LogUtil.error(Name + logN + " ,RFID无效,不需要入库处理");
return false;
}
LogUtil.info(Name + logN + " ,检测到料架,开始料架入库");
StartShelfInStore();
return true;
}
else
{
LogUtil.error(Name + logN + " ,[" + MoveInfo.MoveType + "][" + MoveInfo.MoveStep + "]未找到相关处理");
}
return false;
}
}
}
...@@ -101,9 +101,9 @@ namespace OnlineStore.DeviceLibrary ...@@ -101,9 +101,9 @@ namespace OnlineStore.DeviceLibrary
} }
} }
public bool StartOpen(StoreMoveInfo moveInfo) public bool StartOpen(DeviceMoveInfo moveInfo)
{ {
bool UseDoor = ConfigAppSettings.GetIntValue(Setting_Init.UseDoor).Equals(1); bool UseDoor = Setting_Init.UseDoor;
if (!UseDoor) if (!UseDoor)
{ {
return false; return false;
...@@ -124,9 +124,9 @@ namespace OnlineStore.DeviceLibrary ...@@ -124,9 +124,9 @@ namespace OnlineStore.DeviceLibrary
return Start(IO_Type.EntranceDoor_Open, IO_Type.EntranceDoor_Open); return Start(IO_Type.EntranceDoor_Open, IO_Type.EntranceDoor_Open);
} }
public bool StartClose(StoreMoveInfo moveInfo) public bool StartClose(DeviceMoveInfo moveInfo)
{ {
bool UseDoor = ConfigAppSettings.GetIntValue(Setting_Init.UseDoor).Equals(1); bool UseDoor = Setting_Init.UseDoor;
if (!UseDoor) if (!UseDoor)
{ {
return false; return false;
......
...@@ -65,8 +65,8 @@ namespace OnlineStore.DeviceLibrary ...@@ -65,8 +65,8 @@ namespace OnlineStore.DeviceLibrary
public bool TempOrHumidityIsAlarm = false; public bool TempOrHumidityIsAlarm = false;
public DateTime TempAlarmTime = DateTime.Now; public DateTime TempAlarmTime = DateTime.Now;
private float StartBlowValue = (float)ConfigAppSettings.GetNumValue(Setting_Init.StartBlowValue); private float StartBlowValue = (float)Setting_Init.StartBlowValue;
private float StopBlowValue = (float)ConfigAppSettings.GetNumValue(Setting_Init.StopBlowValue); private float StopBlowValue = (float)Setting_Init.StopBlowValue;
public string currTempStr = ""; public string currTempStr = "";
internal void HumidityProcess(AC_BOX_Bean box) internal void HumidityProcess(AC_BOX_Bean box)
{ {
......
...@@ -29,8 +29,11 @@ namespace OnlineStore.DeviceLibrary ...@@ -29,8 +29,11 @@ namespace OnlineStore.DeviceLibrary
public Dictionary<int, AC_BOX_Bean> BoxMap = new Dictionary<int, AC_BOX_Bean>(); public Dictionary<int, AC_BOX_Bean> BoxMap = new Dictionary<int, AC_BOX_Bean>();
public Store_Config Config { get; set; } public Store_Config Config { get; set; }
public bool UseBuzzer = ConfigAppSettings.GetIntValue(Setting_Init.UseBuzzer).Equals(1); public bool UseBuzzer = Setting_Init.UseBuzzer;
public bool AutoShelfInstore = ConfigAppSettings.GetIntValue(Setting_Init.AutoShelfInstore).Equals(1); /// <summary>
/// 入口有料架自动入库
/// </summary>
public bool AutoShelfInstore = Setting_Init.AutoShelfInstore;
List<string> rfidList = new List<string>(); List<string> rfidList = new List<string>();
#region 初始化 #region 初始化
...@@ -49,7 +52,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -49,7 +52,7 @@ namespace OnlineStore.DeviceLibrary
this.Config = lineConfig; this.Config = lineConfig;
this.DeviceID = lineConfig.DeviceID; this.DeviceID = lineConfig.DeviceID;
MoveInfo = new StoreMoveInfo(DeviceID); MoveInfo = new DeviceMoveInfo(DeviceID);
Name = (" Store_" + Config.CID + " ").ToUpper(); Name = (" Store_" + Config.CID + " ").ToUpper();
List<string> ioList = new List<string>(); List<string> ioList = new List<string>();
...@@ -324,7 +327,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -324,7 +327,7 @@ namespace OnlineStore.DeviceLibrary
{ {
//取新的Io状态 //取新的Io状态
IO_VALUE autoSingle = IOValue(IO_Type.Reset_BTN); IO_VALUE autoSingle = IOValue(IO_Type.Reset_BTN);
if (ConfigAppSettings.GetIntValue(Setting_Init.App_AutoRun).Equals(1)) if (Setting_Init.App_AutoRun)
{ {
if (autoSingle.Equals(IO_VALUE.HIGH) && lastAutoRun.Equals(IO_VALUE.LOW)) if (autoSingle.Equals(IO_VALUE.HIGH) && lastAutoRun.Equals(IO_VALUE.LOW))
{ {
......
...@@ -23,7 +23,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -23,7 +23,7 @@ namespace OnlineStore.DeviceLibrary
public static Store_Config Config = null; public static Store_Config Config = null;
public static Dictionary<int, BaseConfig> AllConfigMap = null; public static Dictionary<int, BaseConfig> AllConfigMap = null;
private static bool isInit = false; private static bool isInit = false;
public static bool IsConnectServer = !ConfigAppSettings.GetValue(Setting_Init.http_server).Equals(""); public static bool IsConnectServer = !Setting_Init.http_server.Equals("");
public StoreManager() public StoreManager()
{ {
} }
...@@ -55,7 +55,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -55,7 +55,7 @@ namespace OnlineStore.DeviceLibrary
BaseConfig.ProIOIpMap = new Dictionary<string, string>(); BaseConfig.ProIOIpMap = new Dictionary<string, string>();
if (!isInit) if (!isInit)
{ {
string server = ConfigAppSettings.GetValue(Setting_Init.http_server); string server = Setting_Init.http_server;
if (server.Equals("")) if (server.Equals(""))
{ {
IsConnectServer = false; IsConnectServer = false;
...@@ -69,31 +69,29 @@ namespace OnlineStore.DeviceLibrary ...@@ -69,31 +69,29 @@ namespace OnlineStore.DeviceLibrary
CheckEnum(typeof(StoreRunStatus)); CheckEnum(typeof(StoreRunStatus));
isInit = true; isInit = true;
string storeType = ConfigAppSettings.GetValue(Setting_Init.Store_Type); string storeType = Setting_Init.Store_Type;
int count = ConfigAppSettings.GetIntValue(Setting_Init.store_count); int count = Setting_Init.store_count;
LogUtil.info("配置的料仓 类型=" + storeType + ",开始加载料仓配置"); LogUtil.info("配置的料仓 类型=" + storeType + ",开始加载料仓配置");
string appPath = Application.StartupPath; string appPath = Application.StartupPath;
string CID = ConfigAppSettings.GetValue(Setting_Init.Store_CID);
Dictionary<int, AC_BOX_Config> storeConfig = new Dictionary<int, AC_BOX_Config>(); Dictionary<int, AC_BOX_Config> storeConfig = new Dictionary<int, AC_BOX_Config>();
if (storeType == StoreType.RC_AC_PA) if (storeType == StoreType.RC_AC_PA)
{ {
string linefilePath = appPath + ConfigAppSettings.GetValue(Setting_Init.Store_ConfigPath); string linefilePath = appPath + Setting_Init.Store_ConfigPath;
Config = CSVConfigReader.LoadLineConfig(0, CID, "Line", linefilePath); Config = CSVConfigReader.LoadLineConfig(0, Setting_Init.Store_CID, "Line", linefilePath);
AllConfigMap.Add(0, Config); AllConfigMap.Add(0, Config);
string moveEquipConfig = ConfigAppSettings.GetValue(Setting_Init.BOX_ConfigPath); string moveEquipConfig = Setting_Init.BOX_ConfigPath;
for (int i = 1; i <= count; i++) for (int i = 1; i <= count; i++)
{ {
string nameStr = i.ToString().PadLeft(1, '0'); string nameStr = i.ToString().PadLeft(1, '0');
string config = appPath + moveEquipConfig.Replace(".csv", "_" + nameStr + ".csv"); string config = appPath + moveEquipConfig.Replace(".csv", "_" + nameStr + ".csv");
string storeIdConfig = Setting_Init.Store_CID + "_" + i; string boxCid = ConfigAppSettings.GetValue("Store_CID" + "_" + i, "packing-");
string boxCid = ConfigAppSettings.GetValue(storeIdConfig);
AC_BOX_Config moveConfig = CSVConfigReader.LoadBoxConfig(i, boxCid, "BOX", config); AC_BOX_Config moveConfig = CSVConfigReader.LoadBoxConfig(i, boxCid, "BOX", config);
AllConfigMap.Add(i, moveConfig); AllConfigMap.Add(i, moveConfig);
storeConfig.Add(i, moveConfig); storeConfig.Add(i, moveConfig);
} }
string positionConfigFile = appPath + ConfigAppSettings.GetValue(Setting_Init.Store_Position_Config); string positionConfigFile = appPath + Setting_Init.Store_Position_Config;
if (count > 1 || (!File.Exists(positionConfigFile))) if (count > 1 || (!File.Exists(positionConfigFile)))
{ {
for (int i = 1; i <= count; i++) for (int i = 1; i <= count; i++)
...@@ -111,7 +109,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -111,7 +109,7 @@ namespace OnlineStore.DeviceLibrary
} }
string shelfConfig = appPath + ConfigAppSettings.GetValue(Setting_Init.Shelf_Position_Config); string shelfConfig = appPath + Setting_Init.Shelf_Position_Config;
//if (File.Exists(shelfConfig)) //if (File.Exists(shelfConfig))
//{ //{
// CSVPositionReader<ShelfPosition>.AddCSVFile(shelfConfig); // CSVPositionReader<ShelfPosition>.AddCSVFile(shelfConfig);
...@@ -150,7 +148,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -150,7 +148,7 @@ namespace OnlineStore.DeviceLibrary
{ {
//位置配置到文件中 //位置配置到文件中
string appPath = Application.StartupPath; string appPath = Application.StartupPath;
string configFile = appPath + ConfigAppSettings.GetValue(Setting_Init.BOX_ConfigPath); string configFile = appPath + Setting_Init.BOX_ConfigPath;
if (!Directory.Exists(configFile)) if (!Directory.Exists(configFile))
{ {
...@@ -191,10 +189,10 @@ namespace OnlineStore.DeviceLibrary ...@@ -191,10 +189,10 @@ namespace OnlineStore.DeviceLibrary
LogUtil.error(box.Name + "GetPositon[" + param.PosID + "]=null,没有库位不能执行出入库"); LogUtil.error(box.Name + "GetPositon[" + param.PosID + "]=null,没有库位不能执行出入库");
return false; return false;
} }
ShelfPosition sp = CSVPositionReader<ShelfPosition>.GetPositon(param.ShelfPosID); ShelfPosition sp = CSVPositionReader<ShelfPosition>.GetPositon(param.CurShelfPosID);
if (sp == null && needCheckShelf) if (sp == null && needCheckShelf)
{ {
LogUtil.error(box.Name + "GetPositon[" + param.ShelfPosID + "]=null,没有库位不能执行出入库"); LogUtil.error(box.Name + "GetPositon[" + param.CurShelfPosID + "]=null,没有库位不能执行出入库");
return false; return false;
} }
if (param.PlateH <= 0) if (param.PlateH <= 0)
...@@ -256,7 +254,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -256,7 +254,7 @@ namespace OnlineStore.DeviceLibrary
{ {
if (host == "") if (host == "")
{ {
host = ConfigAppSettings.GetValue(Setting_Init.http_server); host = Setting_Init.http_server;
} }
if (!host.StartsWith("http://")) if (!host.StartsWith("http://"))
{ {
...@@ -270,7 +268,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -270,7 +268,7 @@ namespace OnlineStore.DeviceLibrary
} }
private static string GetAddr(string addr, Dictionary<string, string> paramsMap) private static string GetAddr(string addr, Dictionary<string, string> paramsMap)
{ {
string server = ConfigAppSettings.GetValue(Setting_Init.http_server); string server = Setting_Init.http_server;
if (server.EndsWith("/")) if (server.EndsWith("/"))
{ {
server = server.Substring(0, server.Length - 1); server = server.Substring(0, server.Length - 1);
...@@ -559,6 +557,54 @@ namespace OnlineStore.DeviceLibrary ...@@ -559,6 +557,54 @@ namespace OnlineStore.DeviceLibrary
return msg; return msg;
} }
private static string Addr_findRealRfid = "/rest/api/qisda/device/findRealRfid";
/// <summary>
/// 根据tempRfid查找真实rfid
///
/// </summary>
/// <param name="tempRfid"></param>
/// <returns>"":未找到真实料架,即改任务还未出库</returns>
public static string FindRealRfidByTempRfid(string tempRfid)
{
string msg = "";
try
{
Dictionary<string, string> paramMap = new Dictionary<string, string>();
paramMap.Add("tempRfid", tempRfid);
string server = GetAddr(Addr_findRealRfid, paramMap);
DateTime startTime = DateTime.Now;
string resultStr = HttpHelper.Post(server, "");
LogUtil.info("根据虚拟rfid【" + tempRfid + "】 查询包装料架绑定情况 " + " 【" + server + "】【" + resultStr + "】");
RfidData serverResult = JsonHelper.DeserializeJsonToObject<RfidData>(resultStr);
if (serverResult == null)
{
msg = "虚拟rfid【" + tempRfid + "】没有收到服务器反馈";
LogUtil.error(msg);
return "";
}
if (serverResult.data["realRfid"].Equals("")) //虚拟料架未绑定料架
{
msg = "虚拟rfid【" + tempRfid + "】 未绑定真实料架";
LogUtil.debug(msg);
return "";
}
else //虚拟料架绑定料架
{
LogUtil.debug("虚拟rfid【" + tempRfid + "】 已绑定真实料架" + serverResult.data["realRfid"]);
return serverResult.data["realRfid"];
}
}
catch (Exception ex)
{
LogUtil.error(ex.Message);
}
return "";
}
private static string Addr_getShelfLockInfo = "/rest/api/qisda/device/getShelfLockInfo"; //包装仓获取料架锁定状态地址 private static string Addr_getShelfLockInfo = "/rest/api/qisda/device/getShelfLockInfo"; //包装仓获取料架锁定状态地址
public static bool GetShelfLockInfo(string deviceName, string cid, string rfid, out List<ShelfLockData> shelfLockDatas) public static bool GetShelfLockInfo(string deviceName, string cid, string rfid, out List<ShelfLockData> shelfLockDatas)
...@@ -624,10 +670,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -624,10 +670,7 @@ namespace OnlineStore.DeviceLibrary
/// <summary> /// <summary>
/// 检查是否是入库料架 /// 检查是否是入库料架
/// </summary> /// </summary>
/// <param name="deviceName"></param>
/// <param name="cid"></param>
/// <param name="rfid"></param> /// <param name="rfid"></param>
/// <param name="shelfLockDatas"></param>
/// <returns></returns> /// <returns></returns>
public static bool CheckShelfInfo(string rfid) public static bool CheckShelfInfo(string rfid)
{ {
......
using Asa; using Asa;
using log4net;
using OnlineStore.Common; using OnlineStore.Common;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
namespace OnlineStore.DeviceLibrary namespace OnlineStore.DeviceLibrary
{ {
...@@ -14,7 +9,6 @@ namespace OnlineStore.DeviceLibrary ...@@ -14,7 +9,6 @@ namespace OnlineStore.DeviceLibrary
{ {
public static bool CurrCancelState = false ; public static bool CurrCancelState = false ;
// public static readonly ILog LOGGER = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); // public static readonly ILog LOGGER = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private static string ServerIp = ConfigAppSettings.GetValue(Setting_Init.AgvServerIp);
private static Asa.AgvClient agvClient; private static Asa.AgvClient agvClient;
private static Dictionary<string, Asa.ClientAction> actionMap = new Dictionary<string, Asa.ClientAction>(); private static Dictionary<string, Asa.ClientAction> actionMap = new Dictionary<string, Asa.ClientAction>();
public static List<string> NodeList = new List<string>(); public static List<string> NodeList = new List<string>();
...@@ -26,7 +20,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -26,7 +20,7 @@ namespace OnlineStore.DeviceLibrary
if (!isInit) if (!isInit)
{ {
isInit = true; isInit = true;
agvClient = new Asa.AgvClient(ServerIp); agvClient = new Asa.AgvClient(Setting_Init.AgvServerIp);
agvClient.CancelState = true; agvClient.CancelState = true;
agvClient.Log += AgvClient_Log; agvClient.Log += AgvClient_Log;
agvClient.Arrive += AgvClient_Arrive; agvClient.Arrive += AgvClient_Arrive;
...@@ -50,7 +44,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -50,7 +44,7 @@ namespace OnlineStore.DeviceLibrary
} }
catch (Exception ex) catch (Exception ex)
{ {
LogUtil.error("初始化agvClient " + ServerIp + " 出错:"+ ex.ToString()); LogUtil.error("初始化agvClient " + Setting_Init.AgvServerIp + " 出错:"+ ex.ToString());
} }
} }
...@@ -183,10 +177,9 @@ namespace OnlineStore.DeviceLibrary ...@@ -183,10 +177,9 @@ namespace OnlineStore.DeviceLibrary
{ {
try try
{ {
bool isLog = ConfigAppSettings.GetIntValue(Setting_Init.Agv_Log_Open).Equals(1); if (Setting_Init.Log_OpenAgv)
if (isLog)
{ {
LogUtil. debug(" AGV " + ServerIp + " Log : " + s); LogUtil. debug(" AGV " + Setting_Init.AgvServerIp + " Log : " + s);
} }
} }
catch (Exception ex) catch (Exception ex)
...@@ -225,7 +218,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -225,7 +218,7 @@ namespace OnlineStore.DeviceLibrary
} }
catch (Exception ex) catch (Exception ex)
{ {
LogUtil.error("释放 agvClient " + ServerIp + " 出错:"+ ex.ToString()); LogUtil.error("释放 agvClient " + Setting_Init.AgvServerIp + " 出错:"+ ex.ToString());
} }
} }
} }
......
...@@ -134,12 +134,12 @@ namespace OnlineStore.DeviceLibrary ...@@ -134,12 +134,12 @@ namespace OnlineStore.DeviceLibrary
{ {
DOValueMap.Remove(ioIp); DOValueMap.Remove(ioIp);
} }
int DIMS = ConfigAppSettings.GetIntValue("DIMS"); int DIMS = ConfigAppSettings.GetIntValue("DIMS",60);
if (DIMS < 20) if (DIMS < 20)
{ {
DIMS = 20; DIMS = 20;
} }
int DOMS = ConfigAppSettings.GetIntValue("DOMS"); int DOMS = ConfigAppSettings.GetIntValue("DOMS",300);
if (DOMS < 200) if (DOMS < 200)
{ {
DOMS = 200; DOMS = 200;
...@@ -220,14 +220,6 @@ namespace OnlineStore.DeviceLibrary ...@@ -220,14 +220,6 @@ namespace OnlineStore.DeviceLibrary
private DateTime lastLogTime = DateTime.Now; private DateTime lastLogTime = DateTime.Now;
private void AioBox_Log_Out_Event(AIOBOX box, string[] s)
{
foreach (string str in s)
{
LogUtil.AIOLog.Debug("[" + box.IP + "]" + str);
}
}
private void AioBox_DI_Changed_Event(AIOBOX box, Box_Sta[] sta) private void AioBox_DI_Changed_Event(AIOBOX box, Box_Sta[] sta)
{ {
try try
......
...@@ -148,7 +148,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -148,7 +148,7 @@ namespace OnlineStore.DeviceLibrary
#endregion #endregion
public static void Init() public static void Init()
{ {
bool isAIOBox = ConfigAppSettings.GetIntValue(Setting_Init.UseAIOBOX).Equals(1); bool isAIOBox = Setting_Init.UseAIOBOX;
if (isAIOBox) if (isAIOBox)
{ {
instance = new AIOBOXManager(); instance = new AIOBOXManager();
......
...@@ -86,7 +86,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -86,7 +86,7 @@ namespace OnlineStore.DeviceLibrary
{ {
return true; return true;
} }
int ACBaudRate = ConfigAppSettings.GetIntValue(Setting_Init.ACBaudRate); int ACBaudRate = Setting_Init.ACBaudRate;
if (ACBaudRate <= 0) if (ACBaudRate <= 0)
{ {
ACBaudRate = 9600; ACBaudRate = 9600;
......
...@@ -25,7 +25,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -25,7 +25,7 @@ namespace OnlineStore.DeviceLibrary
/// </summary> /// </summary>
public static void LoadConfig() public static void LoadConfig()
{ {
string codeStr = ConfigAppSettings.GetValue(Setting_Init.CodeType); string codeStr = Setting_Init.CodeType;
codeTypeList = new List<string>(); codeTypeList = new List<string>();
HDLogUtil.LogName = "RollingLogFileAppender"; HDLogUtil.LogName = "RollingLogFileAppender";
try try
...@@ -98,7 +98,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -98,7 +98,7 @@ namespace OnlineStore.DeviceLibrary
} }
private static int ScanCount = 0; private static int ScanCount = 0;
private static int codeCount = ConfigAppSettings.GetIntValue(Setting_Init.CodeCount); private static int codeCount = Setting_Init.CodeCount;
[HandleProcessCorruptedStateExceptions] [HandleProcessCorruptedStateExceptions]
public static List<string> CameraScan(List<string> cameraList, string deviceName, int timeOut = 1500) public static List<string> CameraScan(List<string> cameraList, string deviceName, int timeOut = 1500)
{ {
...@@ -272,7 +272,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -272,7 +272,7 @@ namespace OnlineStore.DeviceLibrary
public static string GetCodeParamFilePath(string codePath) public static string GetCodeParamFilePath(string codePath)
{ {
string appPath = Application.StartupPath; string appPath = Application.StartupPath;
string path = appPath + ConfigAppSettings.GetValue(Setting_Init.CodeParamPath); string path = appPath + Setting_Init.CodeParamPath;
string filePath = path + codePath + ".dcm"; string filePath = path + codePath + ".dcm";
if (File.Exists(filePath)) if (File.Exists(filePath))
{ {
......
...@@ -17,6 +17,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -17,6 +17,7 @@ namespace OnlineStore.DeviceLibrary
{ {
public InOutParam(string wareNo="", string posId="", string ShelfPosID="", int platew = 0, int plateh =0, bool urgentReel = false, bool cutReel = false, bool smallReel = false, string rfid = "", int rfidLoc = 0,int taskCount=0,string realRfid="") public InOutParam(string wareNo="", string posId="", string ShelfPosID="", int platew = 0, int plateh =0, bool urgentReel = false, bool cutReel = false, bool smallReel = false, string rfid = "", int rfidLoc = 0,int taskCount=0,string realRfid="")
{ {
this.CurShelfPosID = ShelfPosID;
this.ShelfPosID = ShelfPosID; this.ShelfPosID = ShelfPosID;
WareCode = wareNo; WareCode = wareNo;
PosID = posId; PosID = posId;
...@@ -34,6 +35,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -34,6 +35,7 @@ namespace OnlineStore.DeviceLibrary
public InOutParam(string wareNo, string posId, string ShelfPosID,LineMoveP linePosition ) public InOutParam(string wareNo, string posId, string ShelfPosID,LineMoveP linePosition )
{ {
WareCode = wareNo; WareCode = wareNo;
this.CurShelfPosID = ShelfPosID;
this.ShelfPosID = ShelfPosID; this.ShelfPosID = ShelfPosID;
PosID = posId; PosID = posId;
MoveP = linePosition; MoveP = linePosition;
...@@ -50,7 +52,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -50,7 +52,7 @@ namespace OnlineStore.DeviceLibrary
} }
public InOutParam NewParam() public InOutParam NewParam()
{ {
InOutParam newp = new InOutParam(WareCode,PosID,ShelfPosID, PlateW, PlateH, urgentReel,cutReel,smallReel,rfid,rfidLoc,taskCount,realRfid); InOutParam newp = new InOutParam(WareCode,PosID,CurShelfPosID, PlateW, PlateH, urgentReel,cutReel,smallReel,rfid,rfidLoc,taskCount,realRfid);
return newp; return newp;
} }
/// <summary> /// <summary>
...@@ -62,7 +64,11 @@ namespace OnlineStore.DeviceLibrary ...@@ -62,7 +64,11 @@ namespace OnlineStore.DeviceLibrary
/// </summary> /// </summary>
public string PosID { get; set; } public string PosID { get; set; }
/// <summary> /// <summary>
/// 料架对应的库位号 /// 当前料架对应的库位号
/// </summary>
public string CurShelfPosID = "";
/// <summary>
/// 需要取放的料架对应的库位号
/// </summary> /// </summary>
public string ShelfPosID = ""; public string ShelfPosID = "";
public LineMoveP MoveP { get; set; } public LineMoveP MoveP { get; set; }
...@@ -145,21 +151,21 @@ namespace OnlineStore.DeviceLibrary ...@@ -145,21 +151,21 @@ namespace OnlineStore.DeviceLibrary
} }
public string ToStr() public string ToStr()
{ {
return " 库位 [" + PosID + "] [" + ShelfPosID + "], [" + WareCode + "], [" + PlateW + "x" + PlateH + "] ," + return " 库位 [" + PosID + "] [" + CurShelfPosID + "], [" + WareCode + "], [" + PlateW + "x" + PlateH + "] ," +
"urgentReel [" + urgentReel + "],cutReel [" + cutReel + "],smallReel [" + smallReel + "],rfid [" + rfid + "],rfidLoc [" + rfidLoc + "],taskCount ["+ taskCount + "]"; "urgentReel [" + urgentReel + "],cutReel [" + cutReel + "],smallReel [" + smallReel + "],rfid [" + rfid + "],rfidLoc [" + rfidLoc + "],taskCount ["+ taskCount + "]";
} }
public string ToShortStr() public string ToShortStr()
{ {
return "["+rfid+"][" + PosID + "][" + ShelfPosID + "][" + PlateW + "x" + PlateH + "][" + WareCode + "]"; return "["+rfid+"][" + PosID + "][" + CurShelfPosID + "][" + PlateW + "x" + PlateH + "][" + WareCode + "]";
} }
internal void UpdateShelfPosId(string pId) internal void UpdateShelfPosId(string pId)
{ {
this.ShelfPosID = pId; this.CurShelfPosID = pId;
ShelfPosition sp = CSVPositionReader<ShelfPosition>.GetPositon(ShelfPosID); ShelfPosition sp = CSVPositionReader<ShelfPosition>.GetPositon(CurShelfPosID);
if (sp == null) if (sp == null)
{ {
LogUtil.error( "GetPositon[" + ShelfPosID + "]=null,没有库位不能执行出入库"); LogUtil.error( "GetPositon[" + CurShelfPosID + "]=null,没有库位不能执行出入库");
} }
MoveP.InOut_P101 = sp.InoutAxis_P101; MoveP.InOut_P101 = sp.InoutAxis_P101;
...@@ -168,7 +174,21 @@ namespace OnlineStore.DeviceLibrary ...@@ -168,7 +174,21 @@ namespace OnlineStore.DeviceLibrary
MoveP.Middle_P101 = sp.MiddleAxis_P101; MoveP.Middle_P101 = sp.MiddleAxis_P101;
} }
internal void RestoreShelfPosId()
{
this.CurShelfPosID = ShelfPosID;
ShelfPosition sp = CSVPositionReader<ShelfPosition>.GetPositon(CurShelfPosID);
if (sp == null)
{
LogUtil.error("GetPositon[" + CurShelfPosID + "]=null,没有库位不能执行出入库");
}
MoveP.InOut_P101 = sp.InoutAxis_P101;
MoveP.UpDown_LP101 = sp.UpDownAxis_LP101;
MoveP.UpDown_HP102 = sp.UpDownAxis_HP102;
MoveP.Middle_P101 = sp.MiddleAxis_P101;
}
internal void UpdatePosId(string message, string posId, int plateW, int plateH,int comP2,int comP3) internal void UpdatePosId(string message, string posId, int plateW, int plateH,int comP2,int comP3)
{ {
this.WareCode = message; this.WareCode = message;
...@@ -196,7 +216,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -196,7 +216,7 @@ namespace OnlineStore.DeviceLibrary
internal void UpdatePosIdAndShelfId(string wareNo,string rfid,string posId, string ShelfPosID) internal void UpdatePosIdAndShelfId(string wareNo,string rfid,string posId, string ShelfPosID)
{ {
WareCode = wareNo; WareCode = wareNo;
this.ShelfPosID = ShelfPosID; this.CurShelfPosID = ShelfPosID;
this.rfid = rfid; this.rfid = rfid;
ShelfPosition sp = CSVPositionReader<ShelfPosition>.GetPositon(ShelfPosID); ShelfPosition sp = CSVPositionReader<ShelfPosition>.GetPositon(ShelfPosID);
if (sp == null) if (sp == null)
......
using log4net; using log4net;
using OnlineStore.Common; using OnlineStore.Common;
using OnlineStore.LoadCSVLibrary; using OnlineStore.LoadCSVLibrary;
using System; using System;
...@@ -7,6 +7,7 @@ using System.Drawing; ...@@ -7,6 +7,7 @@ using System.Drawing;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading; using System.Threading;
using System.Web.UI.WebControls;
namespace OnlineStore.DeviceLibrary namespace OnlineStore.DeviceLibrary
...@@ -30,7 +31,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -30,7 +31,7 @@ namespace OnlineStore.DeviceLibrary
/// <summary> /// <summary>
/// 日志颜色 /// 日志颜色
/// </summary> /// </summary>
protected static Color storeMoveColor = Color.Blue; protected static Color storeMoveColor = Color.Blue;
public string Name { get; set; } public string Name { get; set; }
public int DeviceID { get; set; } public int DeviceID { get; set; }
public BaseConfig baseConfig = null; public BaseConfig baseConfig = null;
...@@ -45,7 +46,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -45,7 +46,7 @@ namespace OnlineStore.DeviceLibrary
private bool isInit = false; private bool isInit = false;
public bool IsDebug = false; public bool IsDebug = false;
public KTK_Store() public KTK_Store()
{ {
...@@ -67,7 +68,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -67,7 +68,7 @@ namespace OnlineStore.DeviceLibrary
/// 是否没有检测到气压 /// 是否没有检测到气压
/// </summary> /// </summary>
public bool isNoAirCheck = false; public bool isNoAirCheck = false;
/// <summary> /// <summary>
/// 是否再报警中 /// 是否再报警中
/// </summary> /// </summary>
...@@ -116,7 +117,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -116,7 +117,7 @@ namespace OnlineStore.DeviceLibrary
{ {
return new TimeSpan(0); return new TimeSpan(0);
} }
} }
/// <summary> /// <summary>
/// 运动处理 /// 运动处理
/// </summary> /// </summary>
...@@ -219,13 +220,13 @@ namespace OnlineStore.DeviceLibrary ...@@ -219,13 +220,13 @@ namespace OnlineStore.DeviceLibrary
/// <summary> /// <summary>
/// 停止所有运动 /// 停止所有运动
/// </summary> /// </summary>
public abstract void StopMove( ); public abstract void StopMove();
/// <summary> /// <summary>
/// 重置处理 /// 重置处理
/// </summary> /// </summary>
protected abstract void ResetProcess(); protected abstract void ResetProcess();
/// <summary> /// <summary>
/// 松下伺服轴原点返回运动,等待收到反馈后才会返回 /// 松下伺服轴原点返回运动,等待收到反馈后才会返回
...@@ -233,8 +234,8 @@ namespace OnlineStore.DeviceLibrary ...@@ -233,8 +234,8 @@ namespace OnlineStore.DeviceLibrary
protected void ACAxisHomeMove(ConfigMoveAxis moveAxis) protected void ACAxisHomeMove(ConfigMoveAxis moveAxis)
{ {
moveAxis.TargetPosition = 0; moveAxis.TargetPosition = 0;
LogUtil.info(Name+ moveAxis.DisplayStr + "speed[" + moveAxis.TargetSpeed + "]开始原点返回"); LogUtil.info(Name + moveAxis.DisplayStr + "speed[" + moveAxis.TargetSpeed + "]开始原点返回");
MoveInfo.WaitList.Add(WaitResultInfo.WaitAxis(moveAxis, true)); MoveInfo.WaitList.Add(WaitResultInfo.WaitAxis(moveAxis, true));
ACServerManager.HomeMove(moveAxis.DeviceName, (short)moveAxis.GetAxisValue(), moveAxis.HomeHighSpeed); ACServerManager.HomeMove(moveAxis.DeviceName, (short)moveAxis.GetAxisValue(), moveAxis.HomeHighSpeed);
} }
...@@ -244,7 +245,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -244,7 +245,7 @@ namespace OnlineStore.DeviceLibrary
protected void ACAxisMove(ConfigMoveAxis moveAxis, int targetPosition, int targetSpeed) protected void ACAxisMove(ConfigMoveAxis moveAxis, int targetPosition, int targetSpeed)
{ {
MoveInfo.WaitList.Add(WaitResultInfo.WaitAxis(moveAxis, targetPosition, targetSpeed)); MoveInfo.WaitList.Add(WaitResultInfo.WaitAxis(moveAxis, targetPosition, targetSpeed));
moveAxis.TargetPosition = targetPosition; moveAxis.TargetPosition = targetPosition;
ACServerManager.AbsMove(moveAxis.DeviceName, moveAxis.GetAxisValue(), targetPosition, targetSpeed); ACServerManager.AbsMove(moveAxis.DeviceName, moveAxis.GetAxisValue(), targetPosition, targetSpeed);
} }
...@@ -256,7 +257,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -256,7 +257,7 @@ namespace OnlineStore.DeviceLibrary
msg = ""; msg = "";
string deviceName = moveAxis.DeviceName; string deviceName = moveAxis.DeviceName;
short axisNo = moveAxis.GetAxisValue(); short axisNo = moveAxis.GetAxisValue();
bool isOk = ACServerManager.GetBusyStatus(deviceName, axisNo).Equals(0); bool isOk = ACServerManager.GetBusyStatus(deviceName, axisNo).Equals(0);
int outCount = ACServerManager.GetActualtPosition(deviceName, axisNo); int outCount = ACServerManager.GetActualtPosition(deviceName, axisNo);
int errorCount = Math.Abs(outCount - targetPosition); int errorCount = Math.Abs(outCount - targetPosition);
...@@ -269,7 +270,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -269,7 +270,7 @@ namespace OnlineStore.DeviceLibrary
//判断是否需要重新运动 //判断是否需要重新运动
if (MoveInfo.CanWhileCount > 0) if (MoveInfo.CanWhileCount > 0)
{ {
LogUtil.error(Name+ moveAxis.DisplayStr + "目标位置[" + targetPosition + "]当前位置[" + outCount + LogUtil.error(Name + moveAxis.DisplayStr + "目标位置[" + targetPosition + "]当前位置[" + outCount +
"],误差过大,重新开始运动,剩余[" + MoveInfo.CanWhileCount + "]次"); "],误差过大,重新开始运动,剩余[" + MoveInfo.CanWhileCount + "]次");
ACServerManager.AbsMove(moveAxis.DeviceName, moveAxis.GetAxisValue(), targetPosition, targetSpeed); ACServerManager.AbsMove(moveAxis.DeviceName, moveAxis.GetAxisValue(), targetPosition, targetSpeed);
MoveInfo.CanWhileCount--; MoveInfo.CanWhileCount--;
...@@ -278,7 +279,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -278,7 +279,7 @@ namespace OnlineStore.DeviceLibrary
{ {
msg = Name + " storeMoveStep=" + MoveInfo.MoveStep + moveAxis.DisplayStr + "目标位置[" + targetPosition + "]当前位置[" + outCount msg = Name + " storeMoveStep=" + MoveInfo.MoveStep + moveAxis.DisplayStr + "目标位置[" + targetPosition + "]当前位置[" + outCount
+ "],误差过大,需要报警"; + "],误差过大,需要报警";
LogUtil.error(Name+ msg); LogUtil.error(Name + msg);
} }
} }
return false; return false;
...@@ -298,7 +299,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -298,7 +299,7 @@ namespace OnlineStore.DeviceLibrary
//判断是否需要重新运动 //判断是否需要重新运动
if (MoveInfo.CanWhileCount > 0) if (MoveInfo.CanWhileCount > 0)
{ {
LogUtil.error(Name+ moveAxis.DisplayStr + "收到原点完成信号,当前位置[" + outCount + "],重新回原点,剩余[" + MoveInfo.CanWhileCount + "]次"); LogUtil.error(Name + moveAxis.DisplayStr + "收到原点完成信号,当前位置[" + outCount + "],重新回原点,剩余[" + MoveInfo.CanWhileCount + "]次");
//LogUtil.error(LOGGER, StoreName + moveAxis.DisplayStr + "重新回原点"); //LogUtil.error(LOGGER, StoreName + moveAxis.DisplayStr + "重新回原点");
ACServerManager.HomeMove(moveAxis.DeviceName, moveAxis.GetAxisValue(), moveAxis.HomeHighSpeed); ACServerManager.HomeMove(moveAxis.DeviceName, moveAxis.GetAxisValue(), moveAxis.HomeHighSpeed);
MoveInfo.CanWhileCount--; MoveInfo.CanWhileCount--;
...@@ -306,7 +307,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -306,7 +307,7 @@ namespace OnlineStore.DeviceLibrary
else else
{ {
msg = Name + " storeMoveStep=" + MoveInfo.MoveStep + moveAxis.DisplayStr + "收到原点完成信号,当前位置[" + outCount + "],误差过大,需要报警"; msg = Name + " storeMoveStep=" + MoveInfo.MoveStep + moveAxis.DisplayStr + "收到原点完成信号,当前位置[" + outCount + "],误差过大,需要报警";
LogUtil.error(Name+ msg); LogUtil.error(Name + msg);
} }
} }
return false; return false;
...@@ -324,7 +325,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -324,7 +325,7 @@ namespace OnlineStore.DeviceLibrary
{ {
if (!isInit) if (!isInit)
{ {
MoveInfo = new StoreMoveInfo(DeviceID); MoveInfo = new DeviceMoveInfo(DeviceID);
mainTimer = new System.Timers.Timer(); mainTimer = new System.Timers.Timer();
mainTimer.Enabled = false; mainTimer.Enabled = false;
...@@ -350,7 +351,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -350,7 +351,7 @@ namespace OnlineStore.DeviceLibrary
/// <summary> /// <summary>
/// 移动信息 /// 移动信息
/// </summary> /// </summary>
public StoreMoveInfo MoveInfo = null; public DeviceMoveInfo MoveInfo = null;
/// <summary> /// <summary>
/// 定时处理,监听信号,监听IO /// 定时处理,监听信号,监听IO
...@@ -449,8 +450,8 @@ namespace OnlineStore.DeviceLibrary ...@@ -449,8 +450,8 @@ namespace OnlineStore.DeviceLibrary
return sta; return sta;
} }
} }
public void CylinderMove(StoreMoveInfo moveInfo, string IoLowType, string IoHighType) public void CylinderMove(DeviceMoveInfo moveInfo, string IoLowType, string IoHighType)
{ {
IOMove(IoLowType, IO_VALUE.LOW); IOMove(IoLowType, IO_VALUE.LOW);
IOMove(IoHighType, IO_VALUE.HIGH); IOMove(IoHighType, IO_VALUE.HIGH);
if (moveInfo != null) if (moveInfo != null)
...@@ -472,27 +473,35 @@ namespace OnlineStore.DeviceLibrary ...@@ -472,27 +473,35 @@ namespace OnlineStore.DeviceLibrary
/// </summary>c /// </summary>c
protected bool WaitIo(string ioType, IO_VALUE value, int timeOut, string errName = "") protected bool WaitIo(string ioType, IO_VALUE value, int timeOut, string errName = "")
{ {
return WaitUtil.Wait(timeOut, delegate () { return WaitUtil.Wait(timeOut, delegate ()
{
return value.Equals(IOValue(ioType)); return value.Equals(IOValue(ioType));
}, errName); }, errName);
} }
public void LogInfo(string logInfo) public void LogError(string msg)
{ {
LogUtil.info(Name + logInfo); LogUtil.info($"{Name}{MoveInfo?.MoveType}{msg}");
} }
protected void InOutStoreLog(string msg,bool isDebug=false ) public void LogInfo(string msg)
{ {
string posId = MoveInfo.MoveParam != null ? "["+MoveInfo.MoveParam.PosID+"]" : ""; LogUtil.info($"{Name}{MoveInfo?.MoveType}{msg}");
string shelfId = MoveInfo.MoveParam != null ? "[" + MoveInfo.MoveParam.ShelfPosID+"]" : "";
if (isDebug)
{
LogUtil.debug (Name + " " + posId + "" + shelfId + " :" + msg);
}
else
{
LogInfo(" " + posId + "" + shelfId + " :" + msg);
}
} }
public void LogRunStepInfo(string msg)
{
LogInfo($"{MoveInfo?.SLog}{msg}");
}
public void LogRunStepError(string msg)
{
LogError($"{MoveInfo?.SLog}{msg}");
}
protected void InOutStoreLog(string msg)
{
string posId = MoveInfo.MoveParam != null ? "[" + MoveInfo.MoveParam.PosID + "]" : "";
string shelfId = MoveInfo.MoveParam != null ? "[" + MoveInfo.MoveParam.CurShelfPosID + "]" : "";
LogRunStepInfo($"posId={posId} shelfId={shelfId}: {msg}");
}
protected int GetAlarmCodeByAxis(ConfigMoveAxis axis) protected int GetAlarmCodeByAxis(ConfigMoveAxis axis)
{ {
int alarmCode = LineAlarm.InOutAxisAlarm; int alarmCode = LineAlarm.InOutAxisAlarm;
...@@ -529,4 +538,4 @@ namespace OnlineStore.DeviceLibrary ...@@ -529,4 +538,4 @@ namespace OnlineStore.DeviceLibrary
} }
} }
} }
...@@ -206,6 +206,102 @@ namespace OnlineStore.DeviceLibrary ...@@ -206,6 +206,102 @@ namespace OnlineStore.DeviceLibrary
#endregion #endregion
#region 检查出库料架上是否有治具
/// <summary>
/// 出库料架检查:开始循环从第一个空位逐个取料盘
/// </summary>
SO_PreCheck_01_StartGetTray,
/// <summary>
/// 出库料架检查:叉子后退到待机点P1
/// </summary>
SO_PreCheck_02_InoutToP1,
/// <summary>
/// 出库料架检查:升降轴移动到P101低点,旋转轴移动到P101点,压紧轴到压紧前点
/// </summary>
SO_PreCheck_03_MoveToShelf,
/// <summary>
/// 出库料架检查:叉子前进到P101点
/// </summary>
SO_PreCheck_04_InoutToP101,
/// <summary>
/// 出库料架检查:升降轴上升到P102点
/// </summary>
SO_PreCheck_05_UpdownToP102,
/// <summary>
/// 出库料架检查:压紧轴开始缓慢压紧
/// </summary>
SO_PreCheck_06_StartCompress,
/// <summary>
/// 出库料架检查:检测到料叉压紧确认信号,再次向下压紧指定的值
/// </summary>
SO_PreCheck_07_ComDownMove,
/// <summary>
/// 出库料架检查:记录压紧高度,叉子后退到P1
/// </summary>
SO_PreCheck_08_InoutBack,
/// <summary>
/// 到扫码位置:升降轴移动到P2,旋转轴移动到P1
/// </summary>
SO_PreCheck_09_ToScanPosition,
/// <summary>
/// 到扫码位置:进出轴到P2
/// </summary>
SO_PreCheck_10_InOutToP2,
/// <summary>
/// 到扫码位置:升降轴缓慢下降到P1,压紧轴返回压紧前点
/// </summary>
SO_PreCheck_11_PutTrayDown,
/// <summary>
/// 到扫码位置:进出轴返回待机点
/// </summary>
SO_PreCheck_12_InOutToP1,
/// <summary>
/// 检查治具:检查是否有治具
/// </summary>
SO_PreCheck_13_CheckFix,
/// <summary>
/// 检查治具:检查完成,获取结果
/// 有治具,将该治具返回料架位置
/// 无治具,到下一个位置
/// </summary>
SO_PreCheck_14_GetCheckResult,
/// <summary>
/// 检查治具:有治具
/// </summary>
SO_PreCheck_15_InoutToP2,
/// <summary>
/// 检查治具:升降轴到P1,压紧轴压紧
/// </summary>
SO_PreCheck_16_GetScanPTray,
/// <summary>
/// 检查治具:进出轴返回
/// </summary>
SO_PreCheck_17_InoutBackP1,
/// <summary>
/// 检查治具:有治具,返回料架位置
/// </summary>
SO_PreCheck_18_ToShelfPosition,
/// <summary>
/// 检查治具:叉子到料架,进出轴至P20
/// /// </summary>
SO_PreCheck_19_ToShelf,
/// <summary>
/// 检查治具:把物品放下,压紧轴到P1,升降轴至P20
/// </summary>
SO_PreCheck_20_PutReel,
/// <summary>
/// 检查治具:叉子从出料口返回,,进出轴到P1
/// 不再检查下一个位置,料架直接作为NG返回
/// </summary>
SO_PreCheck_21_InoutBack,
SO_PreCheck_22_GoBack,
#endregion
#region 出库步骤 2000开始 #region 出库步骤 2000开始
......
...@@ -11,15 +11,15 @@ using System.Text; ...@@ -11,15 +11,15 @@ using System.Text;
namespace OnlineStore.DeviceLibrary namespace OnlineStore.DeviceLibrary
{ {
/// <summary> /// <summary>
/// 料仓当前运动信息类(出入库状态,步骤记录) /// 设备当前运动信息类(出入库状态,步骤记录)
/// </summary> /// </summary>
public class StoreMoveInfo public class DeviceMoveInfo
{ {
/// <summary> /// <summary>
/// 超时时间 /// 超时时间
/// </summary> /// </summary>
public int TimeOutSeconds = 60; public int TimeOutSeconds = 60;
public StoreMoveInfo(int storeId) public DeviceMoveInfo(int storeId)
{ {
moveType = StoreMoveType.None; moveType = StoreMoveType.None;
...@@ -41,7 +41,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -41,7 +41,7 @@ namespace OnlineStore.DeviceLibrary
public string SLog public string SLog
{ {
get { return " " + MoveStep + " "; } get { return $" {MoveStep} "; }
} }
...@@ -138,9 +138,9 @@ namespace OnlineStore.DeviceLibrary ...@@ -138,9 +138,9 @@ namespace OnlineStore.DeviceLibrary
WaitList = new List<WaitResultInfo>(); WaitList = new List<WaitResultInfo>();
CanWhileCount = 0; CanWhileCount = 0;
} }
public StoreMoveInfo clone() public DeviceMoveInfo clone()
{ {
return (StoreMoveInfo)this.MemberwiseClone(); return (DeviceMoveInfo)this.MemberwiseClone();
} }
public List<WaitResultInfo> WaitList = new List<WaitResultInfo>(); public List<WaitResultInfo> WaitList = new List<WaitResultInfo>();
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!