Commit a388f654 LN

Merge branch 'RC1252-AutoInOutStore-NScan' of http://106.15.194.121:8083/sunke/R…

…C30-AutoInOutStore into RC1252-AutoInOutStore-NScan
2 个父辈 02711ae8 9c954c62
......@@ -94,7 +94,11 @@
<logger name="AIOBOX">
<level value="Info" />
<appender-ref ref="AIOBOX" />
</logger>
</logger>
<logger name="HIK.IPCamera" additivity="false">
<level value="All" />
<appender-ref ref="Camera" />
</logger>
<root>
<level value="INFO" />
<appender-ref ref="RollingLogFileAppender" />
......@@ -135,4 +139,12 @@
</serviceBehaviors>
</behaviors>
</system.serviceModel>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name= "log4net" culture= "neutral" publicKeyToken= "669e0ddf0bb1aa2a" Retargetable= "Yes"/>
<bindingRedirect oldVersion= "0.0.0.0-9.9.9.0" newVersion= "2.0.12.0"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
\ No newline at end of file
......@@ -38,14 +38,16 @@
<ApplicationIcon>box.ico</ApplicationIcon>
</PropertyGroup>
<ItemGroup>
<Reference Include="CodeLibrary">
<HintPath>..\..\dll\CodeLibrary.dll</HintPath>
<Reference Include="CodeLibrary, Version=1.0.7844.17688, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\GeneralClassLibrary\CodeLibraryProject\CodeLibrary\bin\Debug\CodeLibrary.dll</HintPath>
</Reference>
<Reference Include="halcondotnet">
<HintPath>..\..\dll\halcondotnet.dll</HintPath>
</Reference>
<Reference Include="log4net">
<HintPath>..\..\dll\log4net.dll</HintPath>
<Reference Include="log4net, Version=2.0.8.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\增广夹爪\Rmaxis\bin\Debug\log4net.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
......@@ -101,6 +103,12 @@
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="ResourceCulture.cs" />
<Compile Include="userControl\uc_boxdebug.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="userControl\uc_boxdebug.designer.cs">
<DependentUpon>uc_boxdebug.cs</DependentUpon>
</Compile>
<EmbeddedResource Include="FrmAxisDebug.resx">
<DependentUpon>FrmAxisDebug.cs</DependentUpon>
</EmbeddedResource>
......@@ -152,6 +160,9 @@
<Content Include="model\sr.prototxt">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<EmbeddedResource Include="userControl\uc_boxdebug.resx">
<DependentUpon>uc_boxdebug.cs</DependentUpon>
</EmbeddedResource>
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
......
......@@ -60,7 +60,7 @@
// timer1
//
this.timer1.Enabled = true;
this.timer1.Interval = 1000;
this.timer1.Interval = 500;
this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
//
// groupBox1
......
......@@ -25,6 +25,7 @@ namespace OnlineStore.AutoInOutStore
private AC_SA_BoxBean store;
public static readonly ILog LOGGER = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
HIKCamera camera = new HIKCamera();
public FrmStoreBox()
{
Control.CheckForIllegalCrossThreadCalls = false;
......@@ -39,6 +40,15 @@ namespace OnlineStore.AutoInOutStore
private void initValue()
{
InitStoreValue();
camera.camera_event += Camera_camera_event;
camera.LoadCameraConfig();
}
private void Camera_camera_event(object sender, Bitmap e)
{
this.Invoke((EventHandler<Bitmap>)delegate {
pictureBox1.Visible = true;
pictureBox1.Image = e;
}, sender, e);
}
private void InitStoreValue()
{
......@@ -48,7 +58,7 @@ namespace OnlineStore.AutoInOutStore
LogUtil.error(LOGGER, "找不到对应的料仓");
return;
}
uc_boxdebug1.Init(store);
cmbAxisList.DataSource = new List<ConfigMoveAxis>(store.moveAxisList);
cmbAxisList.DisplayMember = "Explain";
cmbAxisList.ValueMember = "Explain";
......@@ -207,7 +217,6 @@ namespace OnlineStore.AutoInOutStore
启动ToolStripMenuItem.Enabled = !isOpen;
停止ToolStripMenuItem.Enabled = isOpen;
复位ToolStripMenuItem.Enabled = isOpen;
}
private bool LoadOk = false;
private void FrmTest_Load(object sender, EventArgs e)
......@@ -229,13 +238,14 @@ namespace OnlineStore.AutoInOutStore
this.Text = ConfigAppSettings.GetValue(Setting_Init.App_Title);
HideForm();
initValue();
CodeManager.LoadConfig();
this.toolStripMenuItem4.Visible = StoreManager.HasDisableDoorControl;
this.toolStripMenuItem5.Visible = StoreManager.HasDisableDoorControl;
this.toolStripSeparator16.Visible = StoreManager.HasDisableDoorControl;
this.toolStripSeparator18.Visible = StoreManager.HasDisableDoorControl;
txtTempPort.Text = store.Config.Humiture_Port;
LoadOk = true;
chbDebug.Checked = store.IsDebug;
LoadOk = true;
// cmbHomeType.SelectedIndex = 1;
timer1.Start();
store.ResetEvent += Store_ResetEvent;
......@@ -1266,7 +1276,12 @@ namespace OnlineStore.AutoInOutStore
return;
}
IOManager.IOMove(IO_Type.CameraLight_Power, IO_VALUE.HIGH);
CodeLibrary.FrmCodeDecode frm = new FrmCodeDecode(false,false );
if (Camera._cam != null)
{
Camera._cam.CloseAll();
}
CodeLibrary.FrmCodeDecode frm = new FrmCodeDecode();
frm.chbZxing.Checked = false;
frm.ShowDialog();
IOManager.IOMove(IO_Type.CameraLight_Power, IO_VALUE.LOW);
}
......@@ -1501,7 +1516,8 @@ namespace OnlineStore.AutoInOutStore
出入库调试ToolStripMenuItem.Text = ResourceCulture.GetString("启用调试", "启用调试");
}
groupAxis.Enabled = status;
// groupComAxis.Enabled = status;
uc_boxdebug1.Enabled = status;
// groupComAxis.Enabled = status;
//groupInout.Enabled = status;
if (!status)
{
......@@ -1514,7 +1530,7 @@ namespace OnlineStore.AutoInOutStore
btnSave.Enabled =false ;
checkBox1.Enabled =false ;
btnOutStore.Enabled = false;
btnBatchOutTest.Enabled = false;
btnBatchOutTest.Enabled = false;
}
else
{
......@@ -1718,5 +1734,24 @@ namespace OnlineStore.AutoInOutStore
StoreManager.UpdateBoxConfig(store.Config);
}
}
private void pictureBox1_DoubleClick(object sender, EventArgs e)
{
var obj = sender as PictureBox;
if (obj.Dock == DockStyle.Fill)
obj.Dock = DockStyle.None;
else
{
obj.BringToFront();
obj.Dock = DockStyle.Fill;
}
}
private void pictureBox1_Click(object sender, MouseEventArgs e)
{
var obj = sender as PictureBox;
if (obj.Dock == DockStyle.Fill)
obj.Dock = DockStyle.None;
}
}
}
......@@ -53,6 +53,7 @@ namespace OnlineStore.AutoInOutStore
[STAThread]
static void Main(string[] Args)
{
Environment.CurrentDirectory = Application.StartupPath;
Application.ThreadException += new System.Threading.ThreadExceptionEventHandler(Application_ThreadException);
AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
......@@ -94,6 +95,7 @@ namespace OnlineStore.AutoInOutStore
if (!isShow)
{
XmlConfigurator.Configure();
Environment.CurrentDirectory = Application.StartupPath;
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
#if PositionTool
......
......@@ -1212,4 +1212,10 @@
<data name="InstoreInfo" xml:space="preserve">
<value> batch storage and retrieval info: storage: </value>
</data>
<data name="FrmStoreBox_tabPage6_Text" xml:space="preserve">
<value>Storage Adjust</value>
</data>
<data name="FrmStoreBox_tabPage6_Text1" xml:space="preserve">
<value>Storage location</value>
</data>
</root>
\ No newline at end of file
......@@ -1215,4 +1215,7 @@
<data name="InstoreInfo" xml:space="preserve">
<value> マルチ入出庫情報:入庫: </value>
</data>
<data name="FrmStoreBox_tabPage6_Text" xml:space="preserve">
<value>ロケーションデバッグ</value>
</data>
</root>
\ No newline at end of file
......@@ -19,7 +19,7 @@ namespace OnlineStore.AutoInOutStore
{
public class ResourceCulture
{
public static bool ShowLog = false ;
public static bool ShowLog = true ;
public static string China = "zh-CN";
public static string English = "en-US";
public static string German = "ge-DE";
......
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="timer1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root>
\ No newline at end of file
......@@ -9,7 +9,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>OnlineStore.Common</RootNamespace>
<AssemblyName>Common</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
</PropertyGroup>
......@@ -33,9 +33,9 @@
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="log4net, Version=1.2.15.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
<Reference Include="log4net, Version=2.0.8.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\dll\log4net.dll</HintPath>
<HintPath>..\..\..\增广夹爪\Rmaxis\bin\Debug\log4net.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json">
<HintPath>..\..\dll\Newtonsoft.Json.dll</HintPath>
......
......@@ -36,19 +36,23 @@
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="Asa.Camera.VisionLib">
<HintPath>..\..\..\camera\Asa.Camera.VisionLib.dll</HintPath>
</Reference>
<Reference Include="Asa.IOModule.AIOBOX, Version=2.2.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\dll\Asa.IOModule.AIOBOX.dll</HintPath>
</Reference>
<Reference Include="CodeLibrary">
<HintPath>..\..\dll\CodeLibrary.dll</HintPath>
<Reference Include="CodeLibrary, Version=1.0.7844.17688, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\GeneralClassLibrary\CodeLibraryProject\CodeLibrary\bin\Debug\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=2.0.8.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\dll\log4net.dll</HintPath>
<HintPath>..\..\..\增广夹爪\Rmaxis\bin\Debug\log4net.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
......@@ -76,6 +80,7 @@
<Compile Include="DeviceLibrary\PanasonicServo\ACServerManager_Partial.cs" />
<Compile Include="DeviceLibrary\PanasonicServo\BatchAxisController.cs" />
<Compile Include="ResourceControl.cs" />
<Compile Include="store\Camera.cs" />
<Compile Include="store\LineMoveP.cs" />
<Compile Include="store\LineAlarm.cs">
<SubType>Code</SubType>
......
......@@ -74,17 +74,22 @@ namespace OnlineStore.DeviceLibrary
aioBox = new AIOBOX("AIOBOX");
aioBox.SetType(Asa.IOModule.Box_Type.DI, DILength, Asa.IOModule.Box_Type.DO, DOLength);
aioBox.IP = ioIp;
aioBox.Upload = false;
aioBox.Upload = true;
aioBox.DI_Changed_Event += AioBox_DI_Changed_Event; ;
aioBox.DI_Changed_Event += AioBox_DI_Changed_Event;
aioBox.DO_Changed_Event += AioBox_DO_Changed_Event;
LogUtil.info("开始连接:" + logName + ":");
aioBox.Connect();
AIOMap.Add(ioIp, aioBox);
Thread.Sleep(5);
for (int i=0;i<15;i++)
{
if (aioBox.IsConn)
break;
Thread.Sleep(1000);
}
LogUtil.info("连接成功:" + logName + ":");
//读取所有的DO
ReadAllDI(ioIp, 0);
Thread.Sleep(5);
......
......@@ -48,7 +48,8 @@ namespace OnlineStore.DeviceLibrary
continue;
}
//LogUtil.info("加载到配置摄像机名称:" + str.Trim());
cameraNameList.Add(str.Trim());
if (!cameraNameList.Contains(str.Trim()))
cameraNameList.Add(str.Trim());
}
string[] codeArray = codeStr.Split(spiltChar);
foreach (string str in codeArray)
......@@ -99,6 +100,7 @@ namespace OnlineStore.DeviceLibrary
catch (Exception ex)
{
LogUtil.error("加载HIK相机出错:" + ex.ToString());
return;
}
}
string[] names = Camera._cam.Name;
......@@ -155,44 +157,65 @@ namespace OnlineStore.DeviceLibrary
DateTime startTime = DateTime.Now;
LogUtil.info( " 【" + cameraName + "】开始取图片");
HalconDotNet.HObject ho_Image = null;
Bitmap bit=null;
try
{
ho_Image = Camera._cam.CaptureOnImage(cameraName);
if (ho_Image == null)
{
LogUtil.error( " 【" + cameraName + "】取图片失败[" + Camera._cam.ErrInfo + "],关闭相机");
CloseCamera(cameraName);
continue;
}
ho_Image = Camera._cam.CaptureOnImage(cameraName,out bit,true);
//if (ho_Image == null)
//{
// LogUtil.error( " 【" + cameraName + "】取图片失败[" + Camera._cam.ErrInfo + "],关闭相机");
// CloseCamera(cameraName);
// continue;
//}
LogUtil.info( " 【" + cameraName + "】取图片完成,开始扫码");
List<CodeInfo> cc = new List<CodeInfo>();
string r = "";
foreach (string codeType in codeTypeList)
//foreach (string codeType in codeTypeList)
//{
// //判断是否是一维码
// if (codeType.ToLower().Equals("barcode"))
// {
// cc = HDCodeHelper.DecodeBarCode(ho_Image);
// }
// else
// {
// cc = HDCodeHelper.DecodeCode(ho_Image, codeType, GetCodeParamFilePath(codeType), codeCount, 2000);
// }
// foreach (CodeInfo c in cc)
// {
// string str = CodeManager.ReplaceCode(c.CodeStr);
// if (!codeList.Contains(str))
// {
// codeList.Add(str);
// r = r + "##" + str;
// }
// }
//}
RemoteDecodeHelper.RemoteDecodeParam remoteDecodeParam = new RemoteDecodeHelper.RemoteDecodeParam
{
//判断是否是一维码
if (codeType.ToLower().Equals("barcode"))
{
cc = HDCodeHelper.DecodeBarCode(ho_Image);
}
else
{
cc = HDCodeHelper.DecodeCode(ho_Image, codeType, GetCodeParamFilePath(codeType), codeCount, 2000);
}
foreach (CodeInfo c in cc)
{
string str = CodeManager.ReplaceCode(c.CodeStr);
if (!codeList.Contains(str))
{
codeList.Add(str);
r = r + "##" + str;
}
}
codeTypeList = codeTypeList.ToArray(),
codeCount = QRCodeCount,
timeout = 3000
};
cc = RemoteDecodeHelper.DecodeRequest(bit, remoteDecodeParam);
if (cc==null || cc.Count==0)
{
cc = new List<CodeInfo>();
SaveImageToFile("MIMO", cameraName, bit);
LogUtil.info(" 【" + cameraName + "】" + " 扫码失败");
}
if (String.IsNullOrEmpty(r))
foreach (CodeInfo c in cc)
{
// SaveImageToFile(deviceName, cameraName, bit);
string str = CodeManager.ReplaceCode(c.CodeStr);
if (!codeList.Contains(str))
{
codeList.Add(str);
r = r + "##" + str;
}
}
LogUtil.info( " 【" + cameraName + "】"+ " 扫码完成【" + FormUtil.GetSpanStr(DateTime.Now - startTime) + "】 :" + r);
}
catch (AccessViolationException e)
{
......@@ -210,6 +233,8 @@ namespace OnlineStore.DeviceLibrary
{
ho_Image.Dispose();
}
if (bit != null)
bit.Dispose();
}
}
}
......
......@@ -505,10 +505,10 @@
1#AC1_9_3_14,10,8,7,1,1,173300,971572,977672,977672,971572,77000,417100,358300,101000,87000,,,,,,,
1#AC1_9_3_15,9,8,7,1,1,173300,987881,993981,993981,987881,77000,417100,358300,101000,87000,,,,,,,
1#AC1_9_3_16,8,8,7,1,1,173300,1003981,1010081,1010081,1003981,77000,417100,358300,101000,87000,,,,,,,
1#AC1_9_3_17,7,8,7,1,1,173300,1021500,1027600,1027600,1021500,77000,417100,358300,101000,87000,,,,,,,
1#AC1_9_3_18,6,8,7,1,1,173300,1037899,1043999,1043999,1037899,77000,417100,358300,101000,87000,,,,,,,
1#AC1_9_3_19,5,8,7,1,1,173300,1054258,1060358,1060358,1054258,77000,417100,358300,101000,87000,,,,,,,
1#AC1_9_3_20,4,8,7,1,1,173300,1071046,1077146,1077146,1071046,77000,417100,358300,101000,87000,,,,,,,
1#AC1_9_3_21,3,8,7,1,1,173300,1087092,1093192,1093192,1087092,77000,417100,358300,101000,87000,,,,,,,
1#AC1_9_3_22,2,8,7,1,1,173300,1103500,1109600,1109600,1103500,77000,417100,358300,101000,87000,,,,,,,
1#AC1_9_3_23,1,8,7,1,1,173300,1119409,1125509,1125509,1119409,77000,417100,358300,101000,87000,,,,,,,
1#AC1_10_3_17,7,8,7,1,1,173300,1021500,1027600,1027600,1021500,77000,417100,358300,101000,87000,,,,,,,
1#AC1_10_3_18,6,8,7,1,1,173300,1037899,1043999,1043999,1037899,77000,417100,358300,101000,87000,,,,,,,
1#AC1_10_3_19,5,8,7,1,1,173300,1054258,1060358,1060358,1054258,77000,417100,358300,101000,87000,,,,,,,
1#AC1_10_3_20,4,8,7,1,1,173300,1071046,1077146,1077146,1071046,77000,417100,358300,101000,87000,,,,,,,
1#AC1_10_3_21,3,8,7,1,1,173300,1087092,1093192,1093192,1087092,77000,417100,358300,101000,87000,,,,,,,
1#AC1_10_3_22,2,8,7,1,1,173300,1103500,1109600,1109600,1103500,77000,417100,358300,101000,87000,,,,,,,
1#AC1_10_3_23,1,8,7,1,1,173300,1119409,1125509,1125509,1119409,77000,417100,358300,101000,87000,,,,,,,
......@@ -1274,7 +1274,7 @@ namespace OnlineStore.DeviceLibrary
try
{
TimeSpan span = DateTime.Now - preProTime;
if (span.TotalSeconds < 10)
if (span.TotalSeconds < 2)
{
return;
}
......@@ -1513,7 +1513,7 @@ namespace OnlineStore.DeviceLibrary
}
public void LoguStatus()
{
LogUtil.error(StoreName + "当前状态:" + "isInSuddenDown[" + isInSuddenDown + "],isNoAirCheck[" + isNoAirCheck + "]," + "StoreMove.MoveType[" + StoreMove.MoveType + "],storeRunStatus[" + storeRunStatus + "]", 106);
LogUtil.error(StoreName + "当前状态:" + $"lastPosId[{lastPosId}], isInSuddenDown[" + isInSuddenDown + "],isNoAirCheck[" + isNoAirCheck + "]," + "StoreMove.MoveType[" + StoreMove.MoveType + "],storeRunStatus[" + storeRunStatus + "]", 106);
}
#region 温湿度处理
......@@ -1742,11 +1742,7 @@ namespace OnlineStore.DeviceLibrary
if (IsDebug)
{
boxStatus.status = (int)StoreStatus.Debugging;
}
else if (storeStatus.Equals(StoreStatus.OutStoreBoxEnd) || storeStatus.Equals(StoreStatus.InStoreEnd))
{
boxStatus.data.Add(ParamDefine.posId, lastPosId);
}
}
else if (!lastPosId.Equals(""))
{
boxStatus.data.Add(ParamDefine.posId, lastPosId);
......@@ -1757,6 +1753,10 @@ namespace OnlineStore.DeviceLibrary
}
lastPosId = "";
}
else if (storeStatus.Equals(StoreStatus.OutStoreBoxEnd) || storeStatus.Equals(StoreStatus.InStoreEnd))
{
boxStatus.data.Add(ParamDefine.posId, lastPosId);
}
ASTemperateParam param = HumitureController.LastData;
if (param != null)
......
......@@ -33,7 +33,10 @@ namespace OnlineStore.DeviceLibrary
//private static StoreMoveType lastMoveType = StoreMoveType.None;
#endregion
/// <summary>
/// PosId, InOut,isSuccess
/// </summary>
public event Action<string, StoreMoveType, bool> InOutEndProcessEvent;
#region 出入库参数
private int CurrInOutCount = 0;
......@@ -551,7 +554,7 @@ namespace OnlineStore.DeviceLibrary
lastPosIdStatus = StoreStatus.InStoreEnd;
storeStatus = StoreStatus.InStoreEnd;
//手动发给服务器状态,防止没有手动
//Task.Factory.StartNew(delegate { SendLineStatus(); });
Task.Run(delegate { SendLineStatus(); });
StoreMove.NextMoveStep(StoreMoveStep.SI_12_PutWareToBag);
ComMoveToPosition(moveP.ComPress_P3, Config.CompAxis_P3_Speed);
......@@ -582,7 +585,7 @@ namespace OnlineStore.DeviceLibrary
storeRunStatus = StoreRunStatus.Runing;
//设备连接,入库后,BOX恢复原始状态
storeStatus = StoreStatus.StoreOnline;
InOutEndProcess(StoreMoveType.InStore);
InOutEndProcess(posId,StoreMoveType.InStore);
}
#region 送出料盘处理
else if (StoreMove.MoveStep == StoreMoveStep.SI_21_DeviceToDoor)
......@@ -927,7 +930,7 @@ namespace OnlineStore.DeviceLibrary
LogUtil.error(LOGGER, StoreName + " 【" + posId + "】 出库中断,请检查料盘是否已满,耗时【" + FormUtil.GetSpanStr(InOutWatch.Elapsed) + "】!");
StoreMove.EndMove();
storeRunStatus = StoreRunStatus.Runing;
InOutEndProcess(StoreMoveType.OutStore);
InOutEndProcess(posId,StoreMoveType.OutStore);
return;
}
}
......@@ -1085,10 +1088,12 @@ namespace OnlineStore.DeviceLibrary
string posId = StoreMove.MoveParam != null ? StoreMove.MoveParam.PositionNum : "";
storeStatus = StoreStatus.StoreOnline;
LogUtil.info(LOGGER, "【" + posId + "】出库结束,耗时【" + FormUtil.GetSpanStr(InOutWatch.Elapsed) + "】累积出库: " + AutomaticBaiting.BatchOutStoreCount + "盘共" + AutomaticBaiting.BatchOutStoreHeight + "mm");
StoreMove.EndMove();
preProTime = DateTime.Now;
storeRunStatus = StoreRunStatus.Runing;
InOutEndProcess(StoreMoveType.OutStore);
lastPosId = "";
InOutEndProcess(posId,StoreMoveType.OutStore);
}
else
......@@ -1305,10 +1310,11 @@ namespace OnlineStore.DeviceLibrary
}
return posid;
}
private void InOutEndProcess(StoreMoveType storeMoveType)
private void InOutEndProcess(string posid,StoreMoveType storeMoveType)
{
try
{
InOutEndProcessEvent?.Invoke(posid, storeMoveType, true);
CurrInOutCount++;
CurrInOutACount++;
......
......@@ -344,7 +344,7 @@ namespace OnlineStore.DeviceLibrary
}
if (StoreMove.MoveStep.Equals(StoreMoveStep.AUTO_I01_Wait))
{
StoreMove.NextMoveStep(StoreMoveStep.AUTO_I02_MoveToUp);
StoreMove.NextMoveStep(StoreMoveStep.AUTO_I02_MoveToDown);
if (IOManager.IOValue(IO_Type.TrayCheck_LoadMaterial).Equals(IO_VALUE.HIGH))
{
InStoreLog(" 已检测到料盘,轴不需要上升");
......@@ -355,6 +355,21 @@ namespace OnlineStore.DeviceLibrary
ACAxisSpeedMove(StoreManager.Config.Batch_Axis, StoreManager.Config.BatchAxis_P3, StoreManager.Config.Batch_Axis.TargetSpeed, IO_Type.TrayCheck_LoadMaterial);
}
}
else if (StoreMove.MoveStep.Equals(StoreMoveStep.AUTO_I02_MoveToDown))
{
StoreMove.NextMoveStep(StoreMoveStep.AUTO_I02_MoveReUp);
int currBatchValue = ACServerManager.GetActualtPosition(StoreManager.Config.Batch_Axis.DeviceName, StoreManager.Config.Batch_Axis.GetAxisValue());
var tatget = currBatchValue - AutomaticBaiting.AxisChangeValue * 15;
InStoreLog($" 轴下降15mm,curr:{currBatchValue},target:{tatget}");
ACAxisAbsMove(StoreManager.Config.Batch_Axis, tatget, StoreManager.Config.BatchAxis_P1_Speed);
}
else if (StoreMove.MoveStep.Equals(StoreMoveStep.AUTO_I02_MoveReUp))
{
StoreMove.NextMoveStep(StoreMoveStep.AUTO_I02_MoveToUp);
InStoreLog(" 轴重新上升到检测到料盘,速度【" + StoreManager.Config.BatchAxis_SlowSpeed + "】");
ACAxisSpeedMove(StoreManager.Config.Batch_Axis, StoreManager.Config.BatchAxis_P3, StoreManager.Config.BatchAxis_SlowSpeed, IO_Type.TrayCheck_LoadMaterial);
}
else if (StoreMove.MoveStep.Equals(StoreMoveStep.AUTO_I02_MoveToUp))
{
IsNeedScanCode();
......@@ -362,7 +377,7 @@ namespace OnlineStore.DeviceLibrary
else if (StoreMove.MoveStep.Equals(StoreMoveStep.AUTO_I03_ScanCode))
{
if (ScanTask == null || ScanTask.IsCompleted)
{
{
StoreMove.NextMoveStep(StoreMoveStep.AUTO_I04_SuckingDisc_Down);
InStoreLog(" 扫码结束,二维码【" + LastCode + "】 吸盘开始下降");
CylinderMove(IO_Type.ClampingDisc_Down, IO_Type.ClampingDisc_Up, true);
......@@ -676,7 +691,7 @@ namespace OnlineStore.DeviceLibrary
{
StoreMove.NextMoveStep(StoreMoveStep.AUTO_I02_MoveToUp);
InStoreLog(" 轴上升到检测到料盘,速度【" + StoreManager.Config.Batch_Axis.TargetSpeed + "】");
ACAxisSpeedMove(StoreManager.Config.Batch_Axis, StoreManager.Config.BatchAxis_P3, StoreManager.Config.Batch_Axis.TargetSpeed, IO_Type.TrayCheck_LoadMaterial);
ACAxisSpeedMove(StoreManager.Config.Batch_Axis, StoreManager.Config.BatchAxis_P3, StoreManager.Config.BatchAxis_SlowSpeed, IO_Type.TrayCheck_LoadMaterial);
}
}
......
using Asa.Camera;
using OnlineStore.Common;
using OnlineStore.DeviceLibrary;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading;
using System.Threading.Tasks;
namespace OnlineStore
{
public class HIKCamera
{
Thread camerathread;
Asa.Camera.VisionLib camera;
public string Name = "";
public event EventHandler<Bitmap> camera_event;
public string DeviceName = "monitor1";
public void LoadCameraConfig()
{
string path = @".\StoreConfig\Camera.json";
if (!File.Exists(path))
{
LogUtil.error(Name + "找不到监控相机配置文件" + path);
return;
}
try
{
var configtxt = File.ReadAllText(path);
if (configtxt.IndexOf("Pwd") > 0)
{
configtxt = configtxt.Replace("Pwd", "Password");
configtxt = configtxt.Replace("\"8000\"", "8000");
File.WriteAllText(path, configtxt);
}
var m = Regex.Match(configtxt, "name\".*?\"(.+)\"", RegexOptions.IgnoreCase);
DeviceName = m.Groups[1].Value;
camera = new VisionLib(path, "HIK.IPCamera");
}
catch (Exception e)
{
LogUtil.error(Name + "加载监控相机配置文件失败:" + e.ToString());
return;
}
camera.Open(DeviceName);
Bitmap bmp = camera.GetImage(DeviceName);
if (bmp == null)
{
LogUtil.error(Name + $"监控相机打开失败");
}
camerathread = new Thread(new ThreadStart(startCamera));
camerathread.Start();
GC.KeepAlive(camerathread);
}
int errortimes = 0;
void startCamera()
{
while (true)
{
try
{
Bitmap bmp = camera.GetImage(DeviceName);
if (bmp != null)
{
errortimes = 0;
camera_event?.Invoke(this, bmp);
}
else if (bmp == null && errortimes < 5)
{
errortimes++;
LogUtil.error(Name + $"相机获取图像出错,{errortimes}");
}
else if (errortimes == 5)
{
camera.Open();
errortimes++;
LogUtil.error(Name + $"相机错误次数过多,重新打开,{errortimes}");
}
else if (errortimes == 6)
{
LogUtil.error(Name + $"相机连接失败, 相机线程退出,{errortimes}");
break;
}
Thread.Sleep(1000 / 7);
}
catch
{
errortimes++;
}
}
camera.Close();
camera.Dispose();
}
void CameraGrabOne(string filename)
{
try
{
LogUtil.info(Name + "库位文件名:" + filename);
Bitmap bmp = camera.GetImage(DeviceName);
if (bmp != null)
{
if (File.Exists(filename))
File.Delete(filename);
bmp.Save(filename, ImageFormat.Jpeg);
bmp.Dispose();
}
}
catch (Exception e)
{
LogUtil.error(Name + e.ToString());
}
}
string GetFixtureStateFilename(InOutStoreParam inOutParam,StoreMoveType storeMoveType, FixtureState fixtureState)
{
string dir = $"\\image\\Fixture\\{storeMoveType}\\{inOutParam.PositionNum}\\";
Directory.CreateDirectory(dir);
string filename = $"{inOutParam.WareNumber}@@{fixtureState}.jpg";
foreach (var x in Path.GetInvalidFileNameChars())
{
filename = filename.Replace(x.ToString(), "");
}
return dir + filename;
}
enum FixtureState
{
In,
Up,
Down,
Out
}
}
}
......@@ -506,6 +506,8 @@ namespace OnlineStore.DeviceLibrary
#endregion
#region 自动上下料上料功能
AUTO_I02_MoveToDown,
AUTO_I02_MoveReUp,
/// <summary>
/// 开始自动上料
/// </summary>
......
......@@ -9,7 +9,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>OnlineStore.LoadCSVLibrary</RootNamespace>
<AssemblyName>LoadCSVLibrary</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
</PropertyGroup>
......@@ -33,9 +33,9 @@
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="log4net, Version=1.2.15.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
<Reference Include="log4net, Version=2.0.8.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\dll\log4net.dll</HintPath>
<HintPath>..\..\..\增广夹爪\Rmaxis\bin\Debug\log4net.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!