Commit fc8303c0 LN

增加扫码方式配置,datalogic=0,halcon=1

1 个父辈 aa4cd176
此文件类型无法预览
...@@ -53,6 +53,10 @@ ...@@ -53,6 +53,10 @@
<ApplicationIcon>box.ico</ApplicationIcon> <ApplicationIcon>box.ico</ApplicationIcon>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="CodeLibrary, Version=1.0.7499.24663, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\dll\CodeLibrary.dll</HintPath>
</Reference>
<Reference Include="log4net"> <Reference Include="log4net">
<HintPath>..\..\dll\log4net.dll</HintPath> <HintPath>..\..\dll\log4net.dll</HintPath>
</Reference> </Reference>
......
...@@ -6,8 +6,7 @@ ...@@ -6,8 +6,7 @@
<appSettings> <appSettings>
<!--是否开机自动启动料仓--> <!--是否开机自动启动料仓-->
<add key="App_AutoRun" value="1"/> <add key="App_AutoRun" value="1"/>
<add key="App_Title" value="AC_SA_料仓_1"/> <add key="App_Title" value="AC_SA_料仓_1"/>
<add key="scanner_start_command" value="S"/>
<!-- 开始吹气的判断值(配置值=服务器发送的湿度值-开始吹气值)--> <!-- 开始吹气的判断值(配置值=服务器发送的湿度值-开始吹气值)-->
<add key="StartBlowValue" value="4"/> <add key="StartBlowValue" value="4"/>
<!-- 停止吹气的判断值(配置值=服务器发送的湿度值-停止吹气值)--> <!-- 停止吹气的判断值(配置值=服务器发送的湿度值-停止吹气值)-->
...@@ -16,8 +15,7 @@ ...@@ -16,8 +15,7 @@
<!--Server address--> <!--Server address-->
<!--<add key="http.server" value="http://localhost:80/"/>--> <!--<add key="http.server" value="http://localhost:80/"/>-->
<!--storeType--> <!--storeType-->
<add key="store_count" value="1"/> <add key="store_count" value="1"/>
<!--start one store config-->
<add key="Store_Position_Config" value="\StoreConfig\AC\linePositions.csv"/> <add key="Store_Position_Config" value="\StoreConfig\AC\linePositions.csv"/>
<add key="Store_ConfigPath" value="\StoreConfig\AC\StoreConfig.csv"/> <add key="Store_ConfigPath" value="\StoreConfig\AC\StoreConfig.csv"/>
<add key="Store_Type" value="RC_AC_SA"/> <add key="Store_Type" value="RC_AC_SA"/>
...@@ -26,21 +24,19 @@ ...@@ -26,21 +24,19 @@
<add key="InOutDefaultPosition" value="8000"/> <add key="InOutDefaultPosition" value="8000"/>
<add key="Config_Pwd" value="123456"/> <add key="Config_Pwd" value="123456"/>
<add key="Config_Pwd" value="123456"/>
<!--出库等待料盘拿走的时间,秒--> <!--出库等待料盘拿走的时间,秒-->
<add key="OutStoreWaitSeconds" value="10"/> <add key="OutStoreWaitSeconds" value="10"/>
<!--温控器类型,0=壁挂王字壳温湿度变送器,1=妙昕温湿度记录仪--> <!--温控器类型,0=壁挂王字壳温湿度变送器,1=妙昕温湿度记录仪-->
<add key="HumitureControllerType" value="0"/> <add key="HumitureControllerType" value="0"/>
<!--解码方式,0=halcon 解码,1=西安料仓 使用zxing解码,2=成都料仓-->
<add key="DeCodeType" value="0"/>
<add key ="DefaultPWD" value ="123456"/>
<add key="UseAIOBOX" value="1"/> <add key="UseAIOBOX" value="1"/>
<!--是否使用蜂鸣器--> <!--是否使用蜂鸣器-->
<add key ="UseBuzzer" value ="1"/> <add key ="UseBuzzer" value ="1"/>
<add key ="StartScan_CMD" value ="S"/>
<add key ="ShowLanguageMsg" value ="1"/> <add key ="ShowLanguageMsg" value ="1"/>
<!--每盘料扫码的次数--> <!--每盘料扫码的次数-->
<add key ="MaxScanCount" value ="2"/> <add key ="MaxScanCount" value ="2"/>
<!--halcon扫码参数文件所在路径,文件名与二维码类型名一样-->
<add key="CodeParamPath" value="\CodeParam\"/>
</appSettings> </appSettings>
<log4net> <log4net>
<appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender"> <appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender">
......
...@@ -15,7 +15,8 @@ using System.Reflection; ...@@ -15,7 +15,8 @@ using System.Reflection;
using log4net; using log4net;
using OnlineStore.DeviceLibrary; using OnlineStore.DeviceLibrary;
using System.IO.Ports; using System.IO.Ports;
using OnlineStore.LoadCSVLibrary; using OnlineStore.LoadCSVLibrary;
using CodeLibrary;
namespace OnlineStore.ACSingleStore namespace OnlineStore.ACSingleStore
{ {
...@@ -168,8 +169,9 @@ namespace OnlineStore.ACSingleStore ...@@ -168,8 +169,9 @@ namespace OnlineStore.ACSingleStore
{ {
groupHistory.Visible = false; groupHistory.Visible = false;
} }
btnCodeLearn.Visible = store.Config.ScanCodeType.Equals(1);
// this.tabControl1.TabPages.Remove(tabPage3); // this.tabControl1.TabPages.Remove(tabPage3);
// groupCode.Visible = false; // groupCode.Visible = false;
} }
private string WaitStart = ResourceCulture.GetString("等待启动"); private string WaitStart = ResourceCulture.GetString("等待启动");
private string dooropen = ResourceCulture.GetString("前门未关"); private string dooropen = ResourceCulture.GetString("前门未关");
...@@ -787,7 +789,7 @@ namespace OnlineStore.ACSingleStore ...@@ -787,7 +789,7 @@ namespace OnlineStore.ACSingleStore
private void 扫码测试ToolStripMenuItem_Click(object sender, EventArgs e) private void 扫码测试ToolStripMenuItem_Click(object sender, EventArgs e)
{ {
store.dlScanSocket.StartConnect(); ScanManager.Instance.StartConnect();
store.GetCameraCode(); store.GetCameraCode();
} }
...@@ -1233,5 +1235,19 @@ namespace OnlineStore.ACSingleStore ...@@ -1233,5 +1235,19 @@ namespace OnlineStore.ACSingleStore
bool result= store.BtnNextPro(); bool result= store.BtnNextPro();
btnHul.Visible = store.NeedShowBtn(); btnHul.Visible = store.NeedShowBtn();
} }
private void btnCodeLearn_Click(object sender, EventArgs e)
{
if(store.Config.ScanCodeType.Equals(1))
{
if (Camera._cam != null)
{
Camera._cam.CloseAll();
}
CodeLibrary.FrmCodeDecode frm = new CodeLibrary.FrmCodeDecode();
frm.ShowDialog();
frm.Dispose();
}
}
} }
} }
...@@ -19,11 +19,7 @@ namespace OnlineStore.Common ...@@ -19,11 +19,7 @@ namespace OnlineStore.Common
/// <summary> /// <summary>
/// 系统主界面标题 /// 系统主界面标题
/// </summary> /// </summary>
public static string App_Title = "App_Title"; public static string App_Title = "App_Title";
/// <summary>
/// 扫码枪开始命令发送给socket的消息
/// </summary>
public static string StartScan_CMD = "StartScan_CMD";
public static string http_server = "http.server"; public static string http_server = "http.server";
public static string Store_CID = "Store_CID"; public static string Store_CID = "Store_CID";
...@@ -39,14 +35,7 @@ namespace OnlineStore.Common ...@@ -39,14 +35,7 @@ namespace OnlineStore.Common
public static string Store_ConfigPath = "Store_ConfigPath"; public static string Store_ConfigPath = "Store_ConfigPath";
public static string Store_Position_Config = "Store_Position_Config"; public static string Store_Position_Config = "Store_Position_Config";
///// <summary>
///// 摄像机名称,多个中间使用#分割
///// </summary>
//public static string CameraName = "CameraName";
///// <summary>
///// 需要识别的二维码类型,多个中间使用#分割
///// </summary>
//public static string CodeType = "CodeType";
/// <summary> /// <summary>
/// 开始吹气的判断值(配置值=服务器发送的湿度值-开始吹气值) /// 开始吹气的判断值(配置值=服务器发送的湿度值-开始吹气值)
...@@ -56,12 +45,7 @@ namespace OnlineStore.Common ...@@ -56,12 +45,7 @@ namespace OnlineStore.Common
/// 停止吹气的判断值(配置值=服务器发送的湿度值-停止吹气值) /// 停止吹气的判断值(配置值=服务器发送的湿度值-停止吹气值)
/// </summary> /// </summary>
public static string StopBlowValue = "StopBlowValue"; public static string StopBlowValue = "StopBlowValue";
///// <summary>
///// 配置文件路径 Data Matrix ECC 200.dcm
///// </summary>
//public static string CodeParamPath = "CodeParamPath";
/// <summary> /// <summary>
/// 进出轴最大待机点,需要小于3000 /// 进出轴最大待机点,需要小于3000
/// </summary> /// </summary>
...@@ -104,5 +88,7 @@ namespace OnlineStore.Common ...@@ -104,5 +88,7 @@ namespace OnlineStore.Common
public static string Default_Language= "Default_Language"; public static string Default_Language= "Default_Language";
public static string MaxScanCount = "MaxScanCount"; public static string MaxScanCount = "MaxScanCount";
public static string CodeParamPath = "CodeParamPath";
} }
} }
...@@ -39,6 +39,12 @@ ...@@ -39,6 +39,12 @@
<Reference Include="Asa.IOModule.AIOBOX"> <Reference Include="Asa.IOModule.AIOBOX">
<HintPath>..\..\dll\Asa.IOModule.AIOBOX.dll</HintPath> <HintPath>..\..\dll\Asa.IOModule.AIOBOX.dll</HintPath>
</Reference> </Reference>
<Reference Include="CodeLibrary">
<HintPath>..\..\dll\CodeLibrary.dll</HintPath>
</Reference>
<Reference Include="halcondotnet">
<HintPath>..\..\dll\halcondotnet.dll</HintPath>
</Reference>
<Reference Include="log4net, Version=1.2.15.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL"> <Reference Include="log4net, Version=1.2.15.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion> <SpecificVersion>False</SpecificVersion>
<HintPath>..\..\dll\log4net.dll</HintPath> <HintPath>..\..\dll\log4net.dll</HintPath>
...@@ -59,7 +65,8 @@ ...@@ -59,7 +65,8 @@
<Compile Include="acSingleStore\AC_SA_BoxBean.cs" /> <Compile Include="acSingleStore\AC_SA_BoxBean.cs" />
<Compile Include="acSingleStore\AC_SA_BoxBean_Partial.cs" /> <Compile Include="acSingleStore\AC_SA_BoxBean_Partial.cs" />
<Compile Include="acSingleStore\StoreManager.cs" /> <Compile Include="acSingleStore\StoreManager.cs" />
<Compile Include="dataLogic\DLScanSocket.cs" /> <Compile Include="scanCode\dataLogic\DLScanSocket.cs" />
<Compile Include="scanCode\halcon\HalconScan.cs" />
<Compile Include="IO\AIManager.cs" /> <Compile Include="IO\AIManager.cs" />
<Compile Include="IO\AIOBOX\AIOAIManager.cs" /> <Compile Include="IO\AIOBOX\AIOAIManager.cs" />
<Compile Include="IO\AIOBOX\AIOBOXManager.cs" /> <Compile Include="IO\AIOBOX\AIOBOXManager.cs" />
...@@ -72,6 +79,7 @@ ...@@ -72,6 +79,7 @@
<Compile Include="PanasonicServo\ACServerManager.cs" /> <Compile Include="PanasonicServo\ACServerManager.cs" />
<Compile Include="PanasonicServo\ACServerManager_Partial.cs" /> <Compile Include="PanasonicServo\ACServerManager_Partial.cs" />
<Compile Include="ResourceControl.cs" /> <Compile Include="ResourceControl.cs" />
<Compile Include="scanCode\ScanManager.cs" />
<Compile Include="store\LineMoveP.cs" /> <Compile Include="store\LineMoveP.cs" />
<Compile Include="store\LineAlarm.cs"> <Compile Include="store\LineAlarm.cs">
<SubType>Code</SubType> <SubType>Code</SubType>
......
...@@ -132,8 +132,13 @@ PRO,模拟转换系数,AI_ConvertPosition,55,,,,,,, ...@@ -132,8 +132,13 @@ PRO,模拟转换系数,AI_ConvertPosition,55,,,,,,,
,,,,,,,,, , ,,,,,,,,, ,
PRO,默认的料盘宽度(多种尺寸为0),Default_TrayWidth,7,,,,,,, PRO,默认的料盘宽度(多种尺寸为0),Default_TrayWidth,7,,,,,,,
PRO,特殊二维码尺寸配置,CodeSizeConfig,XA=13x48#XB=13x32,,,,,,, PRO,特殊二维码尺寸配置,CodeSizeConfig,XA=13x48#XB=13x32,,,,,,,
PRO,大盘宽度(13寸或15寸),Big_TrayWidth,15,,,,,, ,
,,,,,,,,,,
PRO,解码方式0=datalogic;1=halcon,ScanCodeType,1,,,,,,,
,,,,,,,,, , ,,,,,,,,, ,
PRO,扫码枪IP,Scanner_Ip,192.168.201.21,,,,,,, PRO,DataLogic扫码枪-IP,Scanner_Ip,192.168.201.21,,,,,,,
PRO,扫码枪端口号,Scanner_Port,51236,,,,,,, PRO,DataLogic扫码枪端口号,Scanner_Port,51236,,,,,,,
PRO,DataLogic扫码枪-开始扫码命令,StartScan_CMD,51236,,,,,,,
,,,,,,,,, , ,,,,,,,,, ,
PRO,大盘宽度(13寸或15寸),Big_TrayWidth,15,,,,,,, PRO,halcon-相机名称多个用#分割,CameraName,GigE:MV-CE100-30GC (00C69898483),,,,,,,
PRO,halcon-条码类型多个用#分割,CodeType,QR Code#Data Matrix ECC 200#Micro QR Code,,,,,,,
...@@ -15,8 +15,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -15,8 +15,7 @@ namespace OnlineStore.DeviceLibrary
/// 流水线自动料仓-Box类 /// 流水线自动料仓-Box类
/// </summary> /// </summary>
public partial class AC_SA_BoxBean : KTK_Store public partial class AC_SA_BoxBean : KTK_Store
{ {
public DLScanSocket dlScanSocket;
private static bool IsIntSlvBlock = false; private static bool IsIntSlvBlock = false;
/// <summary> /// <summary>
/// 开始运行 /// 开始运行
...@@ -46,21 +45,14 @@ namespace OnlineStore.DeviceLibrary ...@@ -46,21 +45,14 @@ namespace OnlineStore.DeviceLibrary
public int MaxScanCount = ConfigAppSettings.GetIntValue(Setting_Init.MaxScanCount); public int MaxScanCount = ConfigAppSettings.GetIntValue(Setting_Init.MaxScanCount);
public int CurrScanCount = 1; public int CurrScanCount = 1;
//public ScanSocket scanSocket = new ScanSocket(); //public ScanSocket scanSocket = new ScanSocket();
private System.Timers.Timer serverConnectTimer = new System.Timers.Timer();
private System.Timers.Timer IoCheckTimer = new System.Timers.Timer();
public AC_SA_BoxBean(AC_SA_Config config) public AC_SA_BoxBean(AC_SA_Config config)
{ {
// int value= CalHeight(37); // int value= CalHeight(37);
Init(); Init();
serverConnectTimer = new System.Timers.Timer();
serverConnectTimer.Interval = 1000;
serverConnectTimer.AutoReset = true;
serverConnectTimer.Enabled = false;
serverConnectTimer.Elapsed += server_connect_timer_Tick; serverConnectTimer.Elapsed += server_connect_timer_Tick;
IoCheckTimer = new System.Timers.Timer();
IoCheckTimer.Interval = 400;
IoCheckTimer.AutoReset = true;
IoCheckTimer.Enabled = false;
IoCheckTimer.Elapsed += IoCheckTimer_Elapsed; IoCheckTimer.Elapsed += IoCheckTimer_Elapsed;
//添加调试 //添加调试
if (config.IsInDebug == 1) if (config.IsInDebug == 1)
...@@ -90,8 +82,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -90,8 +82,7 @@ namespace OnlineStore.DeviceLibrary
} }
} }
} }
ScanManager.LoadConfig( config, onCodeReceived);
dlScanSocket = new DLScanSocket(config.Scanner_Ip, config.Scanner_Port, onCodeReceived);
//初始化摄像机配置 //初始化摄像机配置
// CodeManager.LoadConfig( ); // CodeManager.LoadConfig( );
IOManager.Init(); IOManager.Init();
...@@ -208,7 +199,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -208,7 +199,7 @@ namespace OnlineStore.DeviceLibrary
storeStatus = StoreStatus.ResetMove; storeStatus = StoreStatus.ResetMove;
//启动温湿度服务器 //启动温湿度服务器
HumitureController.Init(Config.Humiture_Port); HumitureController.Init(Config.Humiture_Port);
dlScanSocket.StartConnect(); ScanManager.Instance.StartConnect();
ReturnHome(); ReturnHome();
StartTime = DateTime.Now; StartTime = DateTime.Now;
mainTimer.Enabled = true; mainTimer.Enabled = true;
...@@ -675,7 +666,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -675,7 +666,7 @@ namespace OnlineStore.DeviceLibrary
mainTimer.Enabled = false; mainTimer.Enabled = false;
TimeSpan span = DateTime.Now - StartTime; TimeSpan span = DateTime.Now - StartTime;
IsRun = false; IsRun = false;
dlScanSocket.Close(); ScanManager.Instance.Close();
IOManager.instance.CloseAllDO(); IOManager.instance.CloseAllDO();
LogUtil.info(LOGGER, StoreName + ",停止运行,总运行时间:" + span.ToString()); LogUtil.info(LOGGER, StoreName + ",停止运行,总运行时间:" + span.ToString());
...@@ -1128,7 +1119,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -1128,7 +1119,7 @@ namespace OnlineStore.DeviceLibrary
// GetCameraCode(); // GetCameraCode();
IOManager.IOMove(IO_Type.Camera_Led, IO_VALUE.HIGH); IOManager.IOMove(IO_Type.Camera_Led, IO_VALUE.HIGH);
LastScanTime = DateTime.Now; LastScanTime = DateTime.Now;
dlScanSocket.BeginScan(); ScanManager.Instance.BeginScan();
} }
} }
else else
...@@ -1549,7 +1540,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -1549,7 +1540,7 @@ namespace OnlineStore.DeviceLibrary
{ {
IOManager.IOMove(IO_Type.Camera_Led, IO_VALUE.HIGH); IOManager.IOMove(IO_Type.Camera_Led, IO_VALUE.HIGH);
LastScanTime = DateTime.Now; LastScanTime = DateTime.Now;
dlScanSocket.BeginScan(); ScanManager.Instance.BeginScan();
} }
else else
{ {
...@@ -1582,7 +1573,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -1582,7 +1573,7 @@ namespace OnlineStore.DeviceLibrary
} }
if (!String.IsNullOrEmpty(code)) if (!String.IsNullOrEmpty(code))
{ {
message = message +"="+codeSize+"="+ code + dlScanSocket.spiltStr; message = message +"="+codeSize+"="+ code + ScanManager.Instance.spiltStr;
} }
} }
return message; return message;
......
...@@ -248,7 +248,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -248,7 +248,7 @@ namespace OnlineStore.DeviceLibrary
LogUtil.error(LOGGER, StoreName + " 启动入库【" + posId + "】出错,叉子料盘检测有料"); LogUtil.error(LOGGER, StoreName + " 启动入库【" + posId + "】出错,叉子料盘检测有料");
return; return;
} }
LogUtil.info(LOGGER, StoreName + " 启动入库【" + posId + "】", storeMoveColor); LogUtil.info(LOGGER, StoreName + " 启动入库【" + posId + "】");
storeRunStatus = StoreRunStatus.Busy; storeRunStatus = StoreRunStatus.Busy;
storeStatus = StoreStatus.InStoreExecute; storeStatus = StoreStatus.InStoreExecute;
StoreMove.NewMove(StoreMoveType.InStore, param); StoreMove.NewMove(StoreMoveType.InStore, param);
...@@ -478,7 +478,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -478,7 +478,7 @@ namespace OnlineStore.DeviceLibrary
{ {
TimeSpan span = DateTime.Now - startInStoreTime; TimeSpan span = DateTime.Now - startInStoreTime;
string posId = StoreMove.MoveParam != null ? StoreMove.MoveParam.PositionNum : ""; string posId = StoreMove.MoveParam != null ? StoreMove.MoveParam.PositionNum : "";
LogUtil.info(LOGGER, StoreName + " 【" + posId + "】 入库结束[" + FormUtil.GetSpanStr(span) + "]", storeMoveColor); LogUtil.info(LOGGER, StoreName + " 【" + posId + "】 入库结束[" + FormUtil.GetSpanStr(span) + "]");
StoreMove.EndMove(); StoreMove.EndMove();
storeRunStatus = StoreRunStatus.Runing; storeRunStatus = StoreRunStatus.Runing;
//设备连接,入库后,BOX恢复原始状态 //设备连接,入库后,BOX恢复原始状态
...@@ -518,7 +518,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -518,7 +518,7 @@ namespace OnlineStore.DeviceLibrary
return false; return false;
} }
storeStatus = StoreStatus.OutStoreExecute; storeStatus = StoreStatus.OutStoreExecute;
LogUtil.info(LOGGER, StoreName + "启动出库【" + posId + "】 ", storeMoveColor); LogUtil.info(LOGGER, StoreName + "启动出库【" + posId + "】 ");
storeRunStatus = StoreRunStatus.Busy; storeRunStatus = StoreRunStatus.Busy;
StoreMove.NewMove(StoreMoveType.OutStore, param); StoreMove.NewMove(StoreMoveType.OutStore, param);
if (IsHasCompress_Axis || Config.IsHasLocationCylinder.Equals(0)) if (IsHasCompress_Axis || Config.IsHasLocationCylinder.Equals(0))
...@@ -718,7 +718,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -718,7 +718,7 @@ namespace OnlineStore.DeviceLibrary
string posId = StoreMove.MoveParam != null ? StoreMove.MoveParam.PositionNum : ""; string posId = StoreMove.MoveParam != null ? StoreMove.MoveParam.PositionNum : "";
storeStatus = StoreStatus.StoreOnline; storeStatus = StoreStatus.StoreOnline;
LogUtil.info(LOGGER, StoreName + " 【" + posId + "】出库结束[" + FormUtil.GetSpanStr(span) + "]", storeMoveColor); LogUtil.info(LOGGER, StoreName + " 【" + posId + "】出库结束[" + FormUtil.GetSpanStr(span) + "]");
StoreMove.EndMove(); StoreMove.EndMove();
storeRunStatus = StoreRunStatus.Runing; storeRunStatus = StoreRunStatus.Runing;
//InOutEndProcess(StoreMoveType.OutStore); //InOutEndProcess(StoreMoveType.OutStore);
...@@ -896,12 +896,12 @@ namespace OnlineStore.DeviceLibrary ...@@ -896,12 +896,12 @@ namespace OnlineStore.DeviceLibrary
private void InStoreLog(string msg) private void InStoreLog(string msg)
{ {
string posId = StoreMove.MoveParam != null ? StoreMove.MoveParam.PositionNum : ""; string posId = StoreMove.MoveParam != null ? StoreMove.MoveParam.PositionNum : "";
LogUtil.info(LOGGER, "【" + posId + "】" + msg, storeMoveColor); LogUtil.info(LOGGER, "【" + posId + "】" + msg);
} }
private void OutStoreLog(string msg) private void OutStoreLog(string msg)
{ {
string posId = StoreMove.MoveParam != null ? StoreMove.MoveParam.PositionNum : ""; string posId = StoreMove.MoveParam != null ? StoreMove.MoveParam.PositionNum : "";
LogUtil.info(LOGGER, "【" + posId + "】" + msg, storeMoveColor); LogUtil.info(LOGGER, "【" + posId + "】" + msg);
} }
......
...@@ -23,6 +23,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -23,6 +23,7 @@ namespace OnlineStore.DeviceLibrary
public static AC_SA_Config Config = null; public static AC_SA_Config Config = 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 = !ConfigAppSettings.GetValue(Setting_Init.http_server).Equals("");
public StoreManager() public StoreManager()
{ {
} }
...@@ -95,10 +96,8 @@ namespace OnlineStore.DeviceLibrary ...@@ -95,10 +96,8 @@ namespace OnlineStore.DeviceLibrary
} }
return Store; return Store;
} }
/// <summary>
/// 修改了料仓配置,更新缓存,更新配置文件(只能更新PRO的配置)
/// </summary>
/// <param name="kTK_LA_Store_Config"></param>
public static void UpdateBoxConfig(AC_SA_Config storeConfig) public static void UpdateBoxConfig(AC_SA_Config storeConfig)
{ {
try try
...@@ -155,4 +154,11 @@ namespace OnlineStore.DeviceLibrary ...@@ -155,4 +154,11 @@ namespace OnlineStore.DeviceLibrary
return host + api_nextFeeder; return host + api_nextFeeder;
} }
} }
public class ScanType
{
public const int DataLogic = 0;
public const int Halcon = 1;
}
} }
using OnlineStore.LoadCSVLibrary;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace OnlineStore.DeviceLibrary
{
public abstract class ScanManager
{
public string spiltStr = "##";
public static ScanManager Instance = null;
public static void LoadConfig(AC_SA_Config config, OnCodeRevice onCodeReceived)
{
if (config.ScanCodeType.Equals(0))
{
Instance = new DLScanSocket(config.Scanner_Ip, config.Scanner_Port, onCodeReceived);
}
else
{
Instance = new HalconScan(config.CameraName, config.CodeType, onCodeReceived);
}
}
public delegate void OnCodeRevice(string[] codeList);
public abstract bool StartConnect(bool isMustCon = false);
public abstract void Close();
public abstract void BeginScan();
}
}
\ No newline at end of file \ No newline at end of file
...@@ -7,8 +7,9 @@ using System.Threading.Tasks; ...@@ -7,8 +7,9 @@ using System.Threading.Tasks;
namespace OnlineStore.DeviceLibrary namespace OnlineStore.DeviceLibrary
{ {
public class DLScanSocket public class DLScanSocket: ScanManager
{ /// <summary> {
/// <summary>
/// 扫码枪链接 /// 扫码枪链接
/// </summary> /// </summary>
private TcpClient scannerSocket; private TcpClient scannerSocket;
...@@ -18,7 +19,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -18,7 +19,7 @@ namespace OnlineStore.DeviceLibrary
private bool isScannerRun = false; private bool isScannerRun = false;
private string ScannerIP = ""; private string ScannerIP = "";
private int ScannerPort = 0; private int ScannerPort = 0;
public delegate void OnCodeRevice(string[] codeList);
public event OnCodeRevice CodeReviceEvent; public event OnCodeRevice CodeReviceEvent;
public DLScanSocket(string serverIp, int port,OnCodeRevice revicePro) public DLScanSocket(string serverIp, int port,OnCodeRevice revicePro)
{ {
...@@ -29,7 +30,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -29,7 +30,7 @@ namespace OnlineStore.DeviceLibrary
/// <summary> /// <summary>
/// 开启扫码枪 /// 开启扫码枪
/// </summary> /// </summary>
public bool StartConnect( bool isMustCon = false) public override bool StartConnect( bool isMustCon = false)
{ {
bool result = true; bool result = true;
try try
...@@ -53,18 +54,8 @@ namespace OnlineStore.DeviceLibrary ...@@ -53,18 +54,8 @@ namespace OnlineStore.DeviceLibrary
} }
return result; return result;
} }
//public void TimerCheck()
//{ public override void Close()
// if (!scannerSocket.IsConnected())
// {
// StartConnect( false );
// LogUtil.info( "重新连接扫码枪【" + ScannerIP + "】 ");
// }
//}
/// <summary>
/// 停止扫码枪
/// </summary>
public void Close()
{ {
try try
{ {
...@@ -76,15 +67,12 @@ namespace OnlineStore.DeviceLibrary ...@@ -76,15 +67,12 @@ namespace OnlineStore.DeviceLibrary
LogUtil.error("出错:" + ex); LogUtil.error("出错:" + ex);
} }
} }
/// <summary>
/// 发送扫码命令开始扫码 public override void BeginScan()
/// </summary>
public void BeginScan()
{ {
try try
{ {
string str = ConfigAppSettings.GetValue(Setting_Init.StartScan_CMD); scannerSocket.send(StoreManager.Config.StartScan_CMD);
scannerSocket.send(str);
} }
catch (Exception ex) catch (Exception ex)
{ {
...@@ -92,13 +80,11 @@ namespace OnlineStore.DeviceLibrary ...@@ -92,13 +80,11 @@ namespace OnlineStore.DeviceLibrary
} }
} }
public string spiltStr = "##";
/// <summary> /// <summary>
/// 扫码枪数据接收 /// 扫码枪数据接收
/// </summary> /// </summary>
/// <param name="message"></param> /// <param name="message"></param>
protected virtual void onCodeReceived(string message) protected void onCodeReceived(string message)
{ {
try try
{ {
......
...@@ -25,14 +25,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -25,14 +25,7 @@ namespace OnlineStore.DeviceLibrary
/// 9=出库执行,10=出仓完成,11=出库失败 /// 9=出库执行,10=出仓完成,11=出库失败
/// </summary> /// </summary>
public StoreStatus storeStatus = StoreStatus.ResetMove; public StoreStatus storeStatus = StoreStatus.ResetMove;
/// <summary>
/// 提示消息,一般发给服务器后清空(LineBean表示报警提示消息,BoxBean表示出入库失败的原因记录)
/// </summary>
// public string WarnMsg = "";
/// <summary>
/// 日志颜色
/// </summary>
protected static Color storeMoveColor = Color.Blue;
protected static readonly ILog LOGGER = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); protected static readonly ILog LOGGER = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
public string StoreName { get; set; } public string StoreName { get; set; }
public int StoreID { get; set; } public int StoreID { get; set; }
...@@ -44,7 +37,8 @@ namespace OnlineStore.DeviceLibrary ...@@ -44,7 +37,8 @@ namespace OnlineStore.DeviceLibrary
/// 定时器 /// 定时器
/// </summary> /// </summary>
protected System.Timers.Timer mainTimer; protected System.Timers.Timer mainTimer;
protected System.Timers.Timer serverConnectTimer = new System.Timers.Timer();
protected System.Timers.Timer IoCheckTimer = new System.Timers.Timer();
private bool isInit = false; private bool isInit = false;
/// <summary> /// <summary>
/// 初始化 /// 初始化
...@@ -54,6 +48,14 @@ namespace OnlineStore.DeviceLibrary ...@@ -54,6 +48,14 @@ namespace OnlineStore.DeviceLibrary
if (!isInit) if (!isInit)
{ {
StoreMove = new StoreMoveInfo(StoreID); StoreMove = new StoreMoveInfo(StoreID);
IoCheckTimer = new System.Timers.Timer();
IoCheckTimer.Interval = 400;
IoCheckTimer.AutoReset = true;
IoCheckTimer.Enabled = false;
serverConnectTimer = new System.Timers.Timer();
serverConnectTimer.Interval = 1000;
serverConnectTimer.AutoReset = true;
serverConnectTimer.Enabled = false;
mainTimer = new System.Timers.Timer(); mainTimer = new System.Timers.Timer();
mainTimer.Enabled = false; mainTimer.Enabled = false;
......
...@@ -16,17 +16,7 @@ namespace OnlineStore.LoadCSVLibrary ...@@ -16,17 +16,7 @@ namespace OnlineStore.LoadCSVLibrary
: base(id, cid, type, filepath) : base(id, cid, type, filepath)
{ {
} }
///// <summary>
///// 温湿度传感器地址/COM口配置
///// </summary>
//[ConfigProAttribute("TemperateServer_Port")]
//public int TemperateServer_Port { get; set; }
///// <summary>
///// 温湿度 传感器地址
///// </summary>
//[ConfigProAttribute("Temperate_ServerAddress")]
//public string Temperate_Serveraddress { get; set; }
/// <summary> /// <summary>
/// 预警温度 /// 预警温度
/// </summary> /// </summary>
...@@ -57,16 +47,16 @@ namespace OnlineStore.LoadCSVLibrary ...@@ -57,16 +47,16 @@ namespace OnlineStore.LoadCSVLibrary
/// </summary> /// </summary>
[ConfigProAttribute("IsHasDoorLimit")] [ConfigProAttribute("IsHasDoorLimit")]
public int IsHasDoorLimit { get; set; } public int IsHasDoorLimit { get; set; }
/// <summary> ///// <summary>
/// PRO 扫码枪IP Scanner_Ip 192.168.200.13 ///// PRO 扫码枪IP Scanner_Ip 192.168.200.13
/// </summary> ///// </summary>
[ConfigProAttribute("Scanner_Ip")] //[ConfigProAttribute("Scanner_Ip")]
public string Scanner_Ip { get; set; } //public string Scanner_Ip { get; set; }
/// <summary> ///// <summary>
/// PRO 扫码枪端口号 Scanner_Port 51236 ///// PRO 扫码枪端口号 Scanner_Port 51236
/// </summary> ///// </summary>
[ConfigProAttribute("Scanner_Port")] //[ConfigProAttribute("Scanner_Port")]
public int Scanner_Port { get; set; } //public int Scanner_Port { get; set; }
/// <summary> /// <summary>
/// PRO (轴一)旋转轴原点目标速度 MiddleAxis_TargetSpeed 30000 /// PRO (轴一)旋转轴原点目标速度 MiddleAxis_TargetSpeed 30000
/// </summary> /// </summary>
...@@ -567,6 +557,39 @@ namespace OnlineStore.LoadCSVLibrary ...@@ -567,6 +557,39 @@ namespace OnlineStore.LoadCSVLibrary
[ConfigProAttribute("Big_TrayWidth")] [ConfigProAttribute("Big_TrayWidth")]
public int Big_TrayWidth { get; set; } public int Big_TrayWidth { get; set; }
private Dictionary<string, string> CodeSizeMap =null ; private Dictionary<string, string> CodeSizeMap =null ;
/// <summary>
/// PPRO,解码方式0=datalogic;1=halcon,ScanCodeType,1,,,,,,,
/// /// </summary>
[ConfigProAttribute("ScanCodeType")]
public int ScanCodeType { get; set; }
/// <summary>
/// PRO,DataLogic扫码枪-IP,Scanner_Ip,192.168.201.21,,,,,,,
/// /// </summary>
[ConfigProAttribute("Scanner_Ip")]
public string Scanner_Ip { get; set; }
/// <summary>
/// PRO,DataLogic扫码枪端口号,Scanner_Port,51236
/// /// </summary>
[ConfigProAttribute("Scanner_Port")]
public int Scanner_Port { get; set; }
/// <summary>
/// PRO,DataLogic扫码枪-开始扫码命令,StartScan_CMD,S,,,,,,,,,
/// /// </summary>
[ConfigProAttribute("StartScan_CMD")]
public string StartScan_CMD { get; set; }
/// <summary>
/// PRO,halcon-相机名称多个用#分割,CameraName,GigE:MV-CE100-30GC (00C69898483),,,,,,,
/// /// </summary>
[ConfigProAttribute("CameraName")]
public string CameraName { get; set; }
/// <summary>
/// PRO, halcon-条码类型,CodeType,QR Code#Data Matrix ECC 200#Micro QR Code
/// /// </summary>
[ConfigProAttribute("CodeType")]
public string CodeType { get; set; }
private static char codeSpilt= '#'; private static char codeSpilt= '#';
public string GetCodeSize(string code) public string GetCodeSize(string code)
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!