Commit d26cf840 LN

皮带线增加监控相机,识别皮带线工位是否有料

1 个父辈 5400e627
正在显示 81 个修改的文件 包含 405 行增加14 行删除
此文件类型无法预览
此文件类型无法预览
<?xml version="1.0"?>
<doc>
<assembly>
<name>Asa.CameraFactory</name>
</assembly>
<members>
</members>
</doc>
此文件类型无法预览
此文件类型无法预览
此文件类型无法预览
此文件类型无法预览
此文件类型无法预览
此文件类型无法预览
此文件类型无法预览
此文件类型无法预览
此文件类型无法预览
此文件类型无法预览
此文件类型无法预览
此文件类型无法预览
此文件类型无法预览
此文件类型无法预览
此文件类型无法预览
此文件类型无法预览
此文件类型无法预览
此文件类型无法预览
此文件类型无法预览
此文件类型无法预览
此文件类型无法预览
此文件类型无法预览
此文件类型无法预览
此文件类型无法预览
......@@ -147,4 +147,12 @@
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
</startup>
<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.8.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
\ No newline at end of file
......@@ -37,6 +37,8 @@
this.cmbLineType = new System.Windows.Forms.ComboBox();
this.btnLine1Test = new System.Windows.Forms.Button();
this.groupBox6 = new System.Windows.Forms.GroupBox();
this.btnLine2Check = new System.Windows.Forms.Button();
this.btnLine1Check = new System.Windows.Forms.Button();
this.lblThisSta = new System.Windows.Forms.Label();
this.lblTrayNum = new System.Windows.Forms.Label();
this.lblInstoreList = new System.Windows.Forms.Label();
......@@ -321,6 +323,8 @@
this.groupBox6.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.groupBox6.Controls.Add(this.btnLine2Check);
this.groupBox6.Controls.Add(this.btnLine1Check);
this.groupBox6.Controls.Add(this.lblThisSta);
this.groupBox6.Controls.Add(this.lblTrayNum);
this.groupBox6.Controls.Add(this.lblInstoreList);
......@@ -332,6 +336,32 @@
this.groupBox6.TabStop = false;
this.groupBox6.Text = "消息";
//
// btnLine2Check
//
this.btnLine2Check.BackColor = System.Drawing.Color.White;
this.btnLine2Check.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnLine2Check.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnLine2Check.Location = new System.Drawing.Point(662, 22);
this.btnLine2Check.Name = "btnLine2Check";
this.btnLine2Check.Size = new System.Drawing.Size(110, 40);
this.btnLine2Check.TabIndex = 281;
this.btnLine2Check.Text = "皮带线2料盘识别";
this.btnLine2Check.UseVisualStyleBackColor = false;
this.btnLine2Check.Click += new System.EventHandler(this.btnLine2Check_Click);
//
// btnLine1Check
//
this.btnLine1Check.BackColor = System.Drawing.Color.White;
this.btnLine1Check.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnLine1Check.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnLine1Check.Location = new System.Drawing.Point(543, 22);
this.btnLine1Check.Name = "btnLine1Check";
this.btnLine1Check.Size = new System.Drawing.Size(110, 40);
this.btnLine1Check.TabIndex = 280;
this.btnLine1Check.Text = "皮带线1料盘识别";
this.btnLine1Check.UseVisualStyleBackColor = false;
this.btnLine1Check.Click += new System.EventHandler(this.btnLine1Check_Click);
//
// lblThisSta
//
this.lblThisSta.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
......@@ -340,7 +370,7 @@
this.lblThisSta.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.lblThisSta.ForeColor = System.Drawing.Color.Red;
this.lblThisSta.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
this.lblThisSta.Location = new System.Drawing.Point(271, 14);
this.lblThisSta.Location = new System.Drawing.Point(274, 66);
this.lblThisSta.Name = "lblThisSta";
this.lblThisSta.Size = new System.Drawing.Size(531, 143);
this.lblThisSta.TabIndex = 246;
......@@ -797,6 +827,8 @@
private System.Windows.Forms.Button btnScanCylinder;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Button button2;
private System.Windows.Forms.Button btnLine2Check;
private System.Windows.Forms.Button btnLine1Check;
}
}
......@@ -225,6 +225,11 @@ namespace OnlineStore.AssemblyLine
btnRun3.Text = line3Name + "运转";
btnLine1Test.Text = line1Name + "出库测试";
btnLine2Test.Text = line2Name + "出库测试";
btnLine1Check.Text = line1Name + "料盘识别";
btnLine2Check.Text = line2Name + "料盘识别";
btnLine1Check.Visible = equipBean.Config.CameraName_1 != "";
btnLine2Check.Visible = equipBean.Config.CameraName_2 != "";
this.cmbLineType.Items.AddRange(new object[] {
//line1Name+"运转-入口定位",
//line2Name+"运转-入口定位",
......@@ -473,6 +478,33 @@ namespace OnlineStore.AssemblyLine
LogUtil.info(equipBase.Name + "点击【" + button2.Text + "】 ");
equipBean.SeparateStopRun();
}
private void btnLine1Check_Click(object sender, EventArgs e)
{
ReelCheck(btnLine1Check.Text, equipBean.Config.CameraName_1);
}
private void btnLine2Check_Click(object sender, EventArgs e)
{
ReelCheck(btnLine2Check.Text, equipBean.Config.CameraName_2);
}
private void ReelCheck(string text, string cameraName)
{
if (String.IsNullOrEmpty(cameraName))
{
return;
}
int[] result = ReelCheckUtil.ReelCheck(cameraName);
if (result != null && result.Length == 2)
{
MessageBox.Show("相机[" + cameraName + "]检测料盘结果:[" + result[0] + "][" + result[1] + "]",text+"结果",MessageBoxButtons.OK,MessageBoxIcon.Information);
}
else
{
MessageBox.Show("相机[" + cameraName + "]检测料盘失败",text+ "结果", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
}
}
......
......@@ -32,6 +32,7 @@
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FrmLineStore));
this.tabControl1 = new System.Windows.Forms.TabControl();
this.tabPage1 = new System.Windows.Forms.TabPage();
this.chbSaveImg = new System.Windows.Forms.CheckBox();
this.chbSaveImage = new System.Windows.Forms.CheckBox();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.numTrayNum = new System.Windows.Forms.NumericUpDown();
......@@ -148,6 +149,7 @@
//
// tabPage1
//
this.tabPage1.Controls.Add(this.chbSaveImg);
this.tabPage1.Controls.Add(this.chbSaveImage);
this.tabPage1.Controls.Add(this.groupBox1);
this.tabPage1.Controls.Add(this.panel1);
......@@ -164,11 +166,23 @@
this.tabPage1.Text = "状态信息";
this.tabPage1.UseVisualStyleBackColor = true;
//
// chbSaveImg
//
this.chbSaveImg.AutoSize = true;
this.chbSaveImg.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.chbSaveImg.Location = new System.Drawing.Point(1187, 145);
this.chbSaveImg.Name = "chbSaveImg";
this.chbSaveImg.Size = new System.Drawing.Size(112, 24);
this.chbSaveImg.TabIndex = 285;
this.chbSaveImg.Text = "保存视觉图片";
this.chbSaveImg.UseVisualStyleBackColor = true;
this.chbSaveImg.CheckedChanged += new System.EventHandler(this.chbSaveImg_CheckedChanged);
//
// chbSaveImage
//
this.chbSaveImage.AutoSize = true;
this.chbSaveImage.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.chbSaveImage.Location = new System.Drawing.Point(1201, 150);
this.chbSaveImage.Location = new System.Drawing.Point(1059, 145);
this.chbSaveImage.Name = "chbSaveImage";
this.chbSaveImage.Size = new System.Drawing.Size(112, 24);
this.chbSaveImage.TabIndex = 203;
......@@ -1070,6 +1084,7 @@
private System.Windows.Forms.ToolStripSeparator toolStripSeparator19;
private System.Windows.Forms.ToolStripMenuItem 自动保存托盘信息ToolStripMenuItem;
private System.Windows.Forms.Button btnIOAutoCon;
private System.Windows.Forms.CheckBox chbSaveImg;
}
}
......@@ -320,7 +320,8 @@ namespace OnlineStore.AssemblyLine
if (Camera._cam != null)
{
Camera._cam.CloseAll();
}
}
MyCamera.DisposeCamera();
// CodeManager.CloseAllCamera();
// RFIDManager.Close();
//System.Environment.Exit(System.Environment.ExitCode);
......@@ -1350,5 +1351,19 @@ namespace OnlineStore.AssemblyLine
LogUtil.info("用户点击了:" + btnIOAutoCon.Text);
AIOAutoConSetting.SetAutoConnect(true, 3);
}
private void chbSaveImg_CheckedChanged(object sender, EventArgs e)
{
if (!LoadOk)
{
return;
}
if (ReelCheckUtil.SaveImage.Equals(chbSaveImg.Checked))
{
return;
}
ReelCheckUtil.SaveImage = (chbSaveImg.Checked);
LogUtil.info("勾选 保存视觉图片:ReelCheckUtil.SaveImage =" + ReelCheckUtil.SaveImage);
}
}
}
......@@ -568,4 +568,30 @@ PRO,0,是否存放的大料盘,IsBigTray,1,,,,,
如果当前是优先皮带线,且空闲中,拦截托盘
如果当前不是优先皮带线,但是优先皮带线全部不可用(未启动,急停,无气压信号)中,拦截托盘
如果当前不是优先皮带线,但是料盘出库超时,拦截托盘
如果此出库信息无优先线,且当前空闲中,拦截托盘
\ No newline at end of file
如果此出库信息无优先线,且当前空闲中,拦截托盘
20220124
修改内容:
皮带线增加监控相机,识别皮带线工位是否有料。
1. 配置文件: Config_DischargeLine_2.csv 增加一行配置:
PRO,0,短皮带线1监控相机,CameraName_1,r_camera_1,,,,,
2. 配置文件:AssemblyLine.exe.config 增加配置:
<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.8.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
3. 修改相机配置:\Config\Camera.json文件:修改相机IP,用户名,密码
\ No newline at end of file
{
"HIKIPCamera": [
{
"Name": "r_camera_1",
"IP": "192.168.207.11",
"User": "admin",
"Password": "acc123456",
"Port": 8000
}
]
}
\ No newline at end of file
......@@ -36,6 +36,9 @@
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="Asa.Camera.VisionLib">
<HintPath>..\..\dll\Asa.Camera.VisionLib.dll</HintPath>
</Reference>
<Reference Include="Asa.RFID">
<HintPath>..\..\dll\RFID\Asa.RFID.dll</HintPath>
</Reference>
......@@ -86,6 +89,8 @@
<Compile Include="assemblymanager\TrayManager.cs" />
<Compile Include="baan\AxisBean.cs" />
<Compile Include="baan\WaitUtil.cs" />
<Compile Include="deviceLibrary\reelCheck\MyCamera.cs" />
<Compile Include="deviceLibrary\reelCheck\ReelCheckUtil.cs" />
<Compile Include="deviceLibrary\halcon\CodeManager.cs" />
<Compile Include="deviceLibrary\halcon\RemoteDecodeHelper.cs" />
<Compile Include="deviceLibrary\IO\AIOBOX\AIOAutoConSetting.cs" />
......@@ -121,6 +126,15 @@
<Compile Include="assemblymanager\TrayDisableManager.cs" />
</ItemGroup>
<ItemGroup>
<Content Include="Asa.Camera.VisionLib.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Asa.Camera.VisionLib.pdb">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Asa.Camera.VisionLib.xml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="eyemLib.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
......@@ -133,6 +147,87 @@
<Content Include="libdmtx.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="mask.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="MvCameraControl.Net.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="MvCameraControl.Net.xml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="NetSDK\AudioRender.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="NetSDK\HCCore.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="NetSDK\HCNetSDK.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="NetSDK\HCNetSDKCom\AnalyzeData.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="NetSDK\HCNetSDKCom\AudioIntercom.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="NetSDK\HCNetSDKCom\HCAlarm.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="NetSDK\HCNetSDKCom\HCCoreDevCfg.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="NetSDK\HCNetSDKCom\HCDisplay.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="NetSDK\HCNetSDKCom\HCGeneralCfgMgr.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="NetSDK\HCNetSDKCom\HCIndustry.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="NetSDK\HCNetSDKCom\HCPlayBack.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="NetSDK\HCNetSDKCom\HCPreview.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="NetSDK\HCNetSDKCom\HCVoiceTalk.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="NetSDK\HCNetSDKCom\libiconv2.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="NetSDK\HCNetSDKCom\OpenAL32.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="NetSDK\HCNetSDKCom\StreamTransClient.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="NetSDK\HCNetSDKCom\SystemTransform.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="NetSDK\hlog.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="NetSDK\hpr.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="NetSDK\libeay32.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="NetSDK\PlayCtrl.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="NetSDK\ssleay32.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="NetSDK\SuperRender.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="NetSDK\zlib1.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="opencv_world420.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
......@@ -154,6 +249,9 @@
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Content Include="Config\Camera.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<None Include="LineConfig\Config_FeedingEquip_1.csv">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
......@@ -247,6 +345,15 @@
<None Include="LineConfig\MoveEquip\Config_MoveEquip_20.csv">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<Content Include="NetSDK\HCNetSDKCom\HCAlarm.lib">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="NetSDK\HCNetSDKCom\HCGeneralCfgMgr.lib">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="NetSDK\HCNetSDKCom\HCPreview.lib">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
......
类型,分类编号,说明,名称,属性值,设备名称,默认值,描述,电器定义,代码定义
PRO,0,设备是否处于调试状态(1=调试,0=正常),IsDebug,0,,,,,
PRO,0,扫码的相机名称(多个用#分隔),CameraNameList,GigE:MV-CE200-10GC (00D76546876),,,,,
PRO,0,短皮带线1监控相机,CameraName_1,r_camera_1,,,,,
,,,,,,,,,
DI,0,出料皮带线体2急停,DLine_SuddenStop,0,PRO_AOI_IP_3,0,出料皮带线体2急停,X041,X041
DI,0,出料皮带线体2复位,DLine_Reset,1,PRO_AOI_IP_3,0,出料皮带线体2复位,X042,X042
......
此文件类型无法预览
此文件类型无法预览
此文件类型无法预览
此文件类型无法预览
此文件类型无法预览
此文件类型无法预览
此文件类型无法预览
此文件类型无法预览
......@@ -47,14 +47,14 @@ namespace OnlineStore.DeviceLibrary
if (id.Equals(1))
{
IsNewType = true;
TrayLine1 = new OutTrayLineBean(330 + ((id - 1) * 3 + 1) , "皮带线" + "_" + ((id - 1) * 3 + 1) + " ", IO_Type.ExitLocation_Check1, IO_Type.ExitTray_Check1, IO_Type.DLine_Run1, IO_Type.EntryTray_Check3, this.DeviceID,IO_Type.DLine_Brush1);
TrayLine2 = new OutTrayLineBean(330 + ((id - 1) * 3 + 2),"皮带线" + "_" + ((id - 1) * 3 + 2) + " ", IO_Type.ExitLocation_Check2, IO_Type.ExitTray_Check2, IO_Type.DLine_Run2, IO_Type.MiddleTray_Check3, this.DeviceID,IO_Type.DLine_Brush2);
TrayLine1 = new OutTrayLineBean(330 + ((id - 1) * 3 + 1) , "皮带线" + "_" + ((id - 1) * 3 + 1) + " ", IO_Type.ExitLocation_Check1, IO_Type.ExitTray_Check1, IO_Type.DLine_Run1, IO_Type.EntryTray_Check3, this.DeviceID,IO_Type.DLine_Brush1,Config.CameraName_1);
TrayLine2 = new OutTrayLineBean(330 + ((id - 1) * 3 + 2),"皮带线" + "_" + ((id - 1) * 3 + 2) + " ", IO_Type.ExitLocation_Check2, IO_Type.ExitTray_Check2, IO_Type.DLine_Run2, IO_Type.MiddleTray_Check3, this.DeviceID,IO_Type.DLine_Brush2,Config.CameraName_2);
}
else
{
IsNewType = true;
TrayLine1 = new OutTrayLineBean(330+ ((id - 1) * 3 + 1),"皮带线" + "_" + ((id - 1) * 3 + 1) + " ", IO_Type.ExitLocation_Check1, IO_Type.ExitTray_Check1, IO_Type.DLine_Run1, IO_Type.MiddleTray_Check3, this.DeviceID,IO_Type.DLine_Brush1);
TrayLine2 = new OutTrayLineBean(330+((id - 1) * 3 + 2),"皮带线" + "_" + ((id - 1) * 3 + 2) + " ", IO_Type.ExitLocation_Check2, IO_Type.ExitTray_Check2, IO_Type.DLine_Run2, IO_Type.EntryTray_Check3, this.DeviceID,IO_Type.DLine_Brush2);
TrayLine1 = new OutTrayLineBean(330+ ((id - 1) * 3 + 1),"皮带线" + "_" + ((id - 1) * 3 + 1) + " ", IO_Type.ExitLocation_Check1, IO_Type.ExitTray_Check1, IO_Type.DLine_Run1, IO_Type.MiddleTray_Check3, this.DeviceID,IO_Type.DLine_Brush1,Config.CameraName_1);
TrayLine2 = new OutTrayLineBean(330+((id - 1) * 3 + 2),"皮带线" + "_" + ((id - 1) * 3 + 2) + " ", IO_Type.ExitLocation_Check2, IO_Type.ExitTray_Check2, IO_Type.DLine_Run2, IO_Type.EntryTray_Check3, this.DeviceID,IO_Type.DLine_Brush2,Config.CameraName_2);
}
Line3Turn = new LineTurnBean(DeviceID, IO_Type.DLine_Run3, IO_Type.Location_Check3);
if ((DeviceID % 100).Equals(1))
......
......@@ -125,7 +125,7 @@ namespace OnlineStore.DeviceLibrary
}
IOManager.Init();
//先初始化设备
MyCamera.LoadCameraConfig();
//初始化摄像机配置
CodeManager.LoadConfig();
......
......@@ -31,6 +31,7 @@ namespace OnlineStore.DeviceLibrary
private DateTime BrushStopTime = DateTime.Now;
private string Name = "";
private LineTurnBean lineRun = null;
private string cameraName = "";
internal LineMoveInfo MoveInfo = null;
public DischargeLine equipBean
{
......@@ -38,7 +39,7 @@ namespace OnlineStore.DeviceLibrary
}
internal bool Line3CanRun = true;
private int Id = 0;
public OutTrayLineBean(int id, string name, string exitLocationS, string exittrayS, string lineRundo, string line3checkDi, int dId, string brushDo)
public OutTrayLineBean(int id, string name, string exitLocationS, string exittrayS, string lineRundo, string line3checkDi, int dId, string brushDo,string cName)
{
this.Id = id;
this.equipBeanId = dId;
......@@ -50,6 +51,7 @@ namespace OnlineStore.DeviceLibrary
this.Line3_TrayCheck = line3checkDi;
this.DLine_Brush_Do = brushDo;
lineRun = new LineTurnBean(dId, LineRun_Do, ExitLocation_Check);
this.cameraName = cName;
}
public void StopRun()
......@@ -328,22 +330,43 @@ namespace OnlineStore.DeviceLibrary
//皮带线1出口无料
if (IsInTurn().Equals(false) && HasTray() && lineRun.CanStart())
{
bool exitHasTray = false;
bool line3HasTray = false;
//如果有监控相机
if (!cameraName.Equals(""))
{
int[] results = ReelCheckUtil.ReelCheck(cameraName);
if (results != null && results.Length == 2)
{
exitHasTray = (results[0] == 1);
line3HasTray = (results[1] == 1);
if (exitHasTray && equipBean.IOValue(ExitTray_Check).Equals(IO_VALUE.LOW))
{
LogUtil.error(Name + "出口信号检测无料,视觉检测有料,认为出口有料");
}
if (line3HasTray && equipBean.IOValue(Line3_TrayCheck).Equals(IO_VALUE.LOW))
{
LogUtil.error(Name + ",长皮带线" + Line3_TrayCheck + "=LOW,视觉检测有料,认为长皮带线有料");
}
}
}
if (MoveInfo.MoveType.Equals(LineMoveType.None) &&
equipBean.IOValue(ExitTray_Check).Equals(IO_VALUE.LOW))
equipBean.IOValue(ExitTray_Check).Equals(IO_VALUE.LOW) && (!exitHasTray))
{
//皮带线1出口无料
//StartBrush();
lineRun.StartLineRun(LineEndProcess);
}
else if (MoveInfo.MoveStep <= LineMoveStep.DLO_02_WaitEnteryNoTray && MoveInfo.IsInWait.Equals(false) &&
equipBean.IOValue(ExitTray_Check).Equals(IO_VALUE.HIGH))
(equipBean.IOValue(ExitTray_Check).Equals(IO_VALUE.HIGH) || exitHasTray))
{
//皮带线1出口有料,皮带3入库无料,且在停止状态
if (equipBean.Line3TurnIsStop() && equipBean.IOValue(Line3_TrayCheck).Equals(IO_VALUE.LOW))
if (equipBean.Line3TurnIsStop() && equipBean.IOValue(Line3_TrayCheck).Equals(IO_VALUE.LOW) && (!line3HasTray))
{
Line3CanRun = false;
LogUtil.debug(Name + "出口有料,且" + Line3_TrayCheck + "=LOW,转动一个工位,[" + LineRun_Do + "] [" + ExitLocation_Check + "]");
StartBrush();
lineRun.StartLineRun(LineEndProcess);
}
......
using OnlineStore.Common;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace OnlineStore.DeviceLibrary
{
public class MyCamera
{
static Asa.Camera.VisionLib camera;
static bool loadCameraState = false;
static List<string> cameraList = new List<string>();
public static void LoadCameraConfig()
{
if (loadCameraState)
return;
string path = @".\Config\Camera.json";
if (!File.Exists(path))
{
LogUtil.error("找不到监控相机配置文件" + path);
}
camera = new Asa.Camera.VisionLib(path);
loadCameraState = true;
}
public static void StartCamera(string cameraName)
{
if (cameraList.Contains(cameraName))
{
CloseCamera(cameraName);
}
camera.Open(cameraName);
cameraList.Add(cameraName);
}
// void startMonitor(object obj)
//{
// if (!loadCameraState)
// {
// LogUtil.error(cameraName + "监控相机初始化失败,无法开启");
// return;
// }
// string name = (string)obj;
// while (IsOpen)
// {
// Bitmap bmp = AcqImage(name);
// if (bmp != null)
// {
// camera_event?.Invoke(new CameraArgs(name, bmp));
// }
// Thread.Sleep(300);
// }
//}
public static void CloseCamera(string cameraName)
{
camera.Close(cameraName);
cameraList.Remove(cameraName);
}
public static Bitmap AcqImage(string camName)
{
if (!cameraList.Contains(camName))
{
StartCamera(camName);
}
Bitmap bitmap = camera.GetImage(camName);
return bitmap;
}
public static void DisposeCamera()
{
camera.Close();
camera.Dispose();
}
}
public class CameraArgs : EventArgs
{
/// <summary>
/// 相机名
/// </summary>
public string CamName { get; set; }
/// <summary>
/// 相机采集的图片
/// </summary>
public Bitmap Image { get; set; }
public CameraArgs(string name, Bitmap img)
{
CamName = name;
Image = img;
}
}
}
......@@ -32,6 +32,20 @@ namespace OnlineStore.LoadCSVLibrary
[ConfigProAttribute("CameraNameList")]
public string CameraNameList { get; set; }
/// <summary>
/// PRO 0 短皮带线1监控相机 CameraName_1
/// </summary>
[ConfigProAttribute("CameraName_1",false)]
public string CameraName_1 { get; set; }
/// <summary>
/// PRO 0 短皮带线2监控相机 CameraName_2
/// </summary>
[ConfigProAttribute("CameraName_2",false)]
public string CameraName_2 { get; set; }
private List<string> CameraList = null;
public List<string> GetCameraList()
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!