Commit 1b7dcae2 张东亮

使用相机对屏蔽托盘进行二次判断并纠正信息

1 个父辈 7bbe83b1
正在显示 31 个修改的文件 包含 604 行增加141 行删除
<?xml version="1.0"?>
<configuration>
<configSections>
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net" />
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net"/>
</configSections>
<appSettings>
<!--是否开机自动启动料仓-->
<add key="App_AutoRun" value="1" />
<add key="App_Title" value="流水线客户端" />
<add key="App_AutoRun" value="1"/>
<add key="App_Title" value="流水线客户端"/>
<!--Server address-->
<!--<add key="http.server" value="http://localhost/myproject/service/store/emptyPosForPutin"/>-->
<add key="http.server" value="http://10.85.199.25/myproject/" />
<add key="http.server" value="http://10.85.199.25/myproject/"/>
<!--storeType-->
<add key="Line_moveEquip_count" value="20" />
<add key="Line_feedingEquip_count" value="4" />
<add key="Line_providingEquip_count" value="4" />
<add key="Line_dischargeLine_count" value="2" />
<add key="Line_moveEquip_count" value="20"/>
<add key="Line_feedingEquip_count" value="4"/>
<add key="Line_providingEquip_count" value="4"/>
<add key="Line_dischargeLine_count" value="2"/>
<!--start one store config-->
<add key="ConfigPath_Line" value="\LineConfig\Config_Line.csv" />
<add key="ConfigPath_MoveEquip" value="\LineConfig\MoveEquip\Config_MoveEquip.csv" />
<add key="ConfigPath_FeedingEquip" value="\LineConfig\Config_FeedingEquip.csv" />
<add key="ConfigPath_ProvidingEquip" value="\LineConfig\Config_ProvidingEquip.csv" />
<add key="ConfigPath_DischargeLine" value="\LineConfig\Config_DischargeLine.csv" />
<add key="Line_Type" value="Line" />
<add key="Line_CID" value="rc1250" />
<add key="ConfigPath_Line" value="\LineConfig\Config_Line.csv"/>
<add key="ConfigPath_MoveEquip" value="\LineConfig\MoveEquip\Config_MoveEquip.csv"/>
<add key="ConfigPath_FeedingEquip" value="\LineConfig\Config_FeedingEquip.csv"/>
<add key="ConfigPath_ProvidingEquip" value="\LineConfig\Config_ProvidingEquip.csv"/>
<add key="ConfigPath_DischargeLine" value="\LineConfig\Config_DischargeLine.csv"/>
<add key="Line_Type" value="Line"/>
<add key="Line_CID" value="rc1250"/>
<!--end one store config-->
<!--摄像机名称列表配置,用#分割-->
<add key="CameraName" value="GigE:MV-CE100-30GC (00C69898519)#GigE:MV-CE100-30GC (00C95305929)" />
<add key="CameraName" value="GigE:MV-CE100-30GC (00C69898519)#GigE:MV-CE100-30GC (00C95305929)"/>
<!--二维码类型列表配置,用#分割,一维码=Barcode 二维码: QR Code#Data Matrix ECC 200#Micro QR Code-->
<add key="CodeType" value="Data Matrix ECC 200#QR Code" />
<add key="CodeType" value="Data Matrix ECC 200#QR Code"/>
<!--<add key="CodeType" value="Data Matrix ECC 200"/>-->
<add key="ACBaudRate" value="115200" />
<add key="ACBaudRate" value="115200"/>
<!--二维码参数文件所在路径,文件名与二维码类型名一样-->
<add key="CodeParamPath" value="\CodeParam\" />
<add key="Config_Pwd" value="123456" />
<add key="CodeParamPath" value="\CodeParam\"/>
<add key="Config_Pwd" value="123456"/>
<!--出库等待料盘拿走的时间,秒-->
<add key="OutStoreWaitSeconds" value="10" />
<add key="UseAIOBOX" value="1" />
<add key="OutStoreWaitSeconds" value="10"/>
<add key="UseAIOBOX" value="1"/>
<!--流水线监听端口-->
<add key="TCPServerPort" value="5246" />
<add key="TCPServerPort" value="5246"/>
<!--AGV调度服务器地址-->
<add key="AgvServerIp" value="10.85.199.20" />
<add key="AgvServerIp" value="10.85.199.20"/>
<!--IO配置-->
<add key="DIMS" value="60" />
<add key="DOMS" value="300" />
<add key="LineRunTest" value="1" />
<add key="DIMS" value="60"/>
<add key="DOMS" value="300"/>
<add key="LineRunTest" value="1"/>
<!--ABB机器人服务器-->
<add key="ABBServerPort" value="21" />
<add key="ABBServerPort" value="21"/>
<!--是否打开托盘编码界面-->
<add key="OpenRFIDWrite" value="1" />
<add key="DefaultPWD" value="123456" />
<add key="OpenRFIDWrite" value="1"/>
<add key="DefaultPWD" value="123456"/>
<!--当前调试的设备ID,分号分割-->
<add key="DebugDeviceId" value="0" />
<add key="Server_Log_Open" value="0" />
<add key="CodeCount" value="4" />
<add key="DefaultTrayNum" value="0" />
<add key="NeedScanCode" value="1" />
<add key="Agv_Log_Open" value="0" />
<add key="NeedCheckTray" value="0" />
<add key="Feed_LastShelfID_101" value="B19" />
<add key="Feed_LastShelfID_102" value="B23" />
<add key="Feed_LastShelfID_103" value="B25" />
<add key="Feed_LastShelfID_104" value="B7" />
<add key="Brush_Delay_Seconds" value="5" />
<add key ="SaveErrorImageToFile" value ="1"/>
<add key ="UseTrayCheck" value ="8,"/>
<add key ="ConfigPath_TrayList" value ="\LineConfig\TrayList.data"/>
<add key="DebugDeviceId" value="0"/>
<add key="Server_Log_Open" value="0"/>
<add key="CodeCount" value="4"/>
<add key="DefaultTrayNum" value="0"/>
<add key="NeedScanCode" value="1"/>
<add key="Agv_Log_Open" value="0"/>
<add key="NeedCheckTray" value="0"/>
<add key="Feed_LastShelfID_101" value="B19"/>
<add key="Feed_LastShelfID_102" value="B23"/>
<add key="Feed_LastShelfID_103" value="B25"/>
<add key="Feed_LastShelfID_104" value="B7"/>
<add key="Brush_Delay_Seconds" value="5"/>
<add key="SaveErrorImageToFile" value="1"/>
<add key="UseTrayCheck" value="4,5,6,9,12,13,14,15,20,18,8,16,17,1,2,11,7,3,10,19,101,102,103,"/>
<add key="ConfigPath_TrayList" value="\LineConfig\TrayList.data"/>
<add key="TESTFILE" value="D:\皮带线料盘识别\test.bmp"/>
</appSettings>
<!-- <log4net> -->
......@@ -85,60 +85,60 @@
<!-- </log4net> -->
<log4net>
<appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender">
<file value="logs/Line-RC1250.log" />
<param name="Encoding" value="UTF-8" />
<appendToFile value="true" />
<rollingStyle value="Date" />
<datePattern value="yyyy-MM-dd" />
<file value="logs/Line-RC1250.log"/>
<param name="Encoding" value="UTF-8"/>
<appendToFile value="true"/>
<rollingStyle value="Date"/>
<datePattern value="yyyy-MM-dd"/>
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="[%date][%t]%-5p %m%n" />
<conversionPattern value="[%date][%t]%-5p %m%n"/>
</layout>
</appender>
<appender name="TheRFID" type="log4net.Appender.RollingFileAppender">
<file value="logs/rfid/TheRFID-line.log" />
<param name="Encoding" value="UTF-8" />
<appendToFile value="true" />
<rollingStyle value="Date" />
<datePattern value="yyyy-MM-dd" />
<file value="logs/rfid/TheRFID-line.log"/>
<param name="Encoding" value="UTF-8"/>
<appendToFile value="true"/>
<rollingStyle value="Date"/>
<datePattern value="yyyy-MM-dd"/>
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="[%date][%t]%-5p %m%n" />
<conversionPattern value="[%date][%t]%-5p %m%n"/>
</layout>
</appender>
<appender name="AIOBOX" type="log4net.Appender.RollingFileAppender">
<file value="logs/aio/AIOBOX-line.log" />
<param name="Encoding" value="UTF-8" />
<appendToFile value="true" />
<rollingStyle value="Date" />
<datePattern value="yyyy-MM-dd" />
<file value="logs/aio/AIOBOX-line.log"/>
<param name="Encoding" value="UTF-8"/>
<appendToFile value="true"/>
<rollingStyle value="Date"/>
<datePattern value="yyyy-MM-dd"/>
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="[%date][%t]%-5p %m%n" />
<conversionPattern value="[%date][%t]%-5p %m%n"/>
</layout>
</appender>
<appender name="RunLog" type="log4net.Appender.RollingFileAppender">
<file value="logs/log/RunLog-line.log" />
<param name="Encoding" value="UTF-8" />
<appendToFile value="true" />
<rollingStyle value="Date" />
<datePattern value="yyyy-MM-dd" />
<file value="logs/log/RunLog-line.log"/>
<param name="Encoding" value="UTF-8"/>
<appendToFile value="true"/>
<rollingStyle value="Date"/>
<datePattern value="yyyy-MM-dd"/>
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value=" %m%n" />
<conversionPattern value=" %m%n"/>
</layout>
</appender>
<logger name="RollingLogFileAppender">
<level value="Info" />
<appender-ref ref="RollingLogFileAppender" />
<level value="Info"/>
<appender-ref ref="RollingLogFileAppender"/>
</logger>
<logger name="TheRFID">
<level value="Info" />
<appender-ref ref="TheRFID" />
<level value="Info"/>
<appender-ref ref="TheRFID"/>
</logger>
<logger name="AIOBOX">
<level value="Info" />
<appender-ref ref="AIOBOX" />
<level value="Info"/>
<appender-ref ref="AIOBOX"/>
</logger>
<logger name="RunLog">
<level value="Info" />
<appender-ref ref="RunLog" />
<level value="Info"/>
<appender-ref ref="RunLog"/>
</logger>
<!--<root>
<level value="Info" />
......@@ -146,13 +146,13 @@
</root>-->
</log4net>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/>
</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" />
<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>
......
......@@ -9,7 +9,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>OnlineStore.AssemblyLine</RootNamespace>
<AssemblyName>AssemblyLine</AssemblyName>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
<PublishUrl>publish\</PublishUrl>
......
......@@ -292,6 +292,8 @@ namespace OnlineStore.AssemblyLine
chbBoxSendShelf.Visible = equipBean.Config.IsCanOut.Equals(1);
chbUseTrayCheck.Visible = equipBean.Config.IsCanOut.Equals(0);
chbBoxSendShelf.Checked = equipBean.OutEndSendShelfOut;
//chbUseTrayCheck.Visible = equipBean.Config.DIList.ContainsKey(IO_Type.TrayCheck);
chbUseTrayCheck.Checked = LineManager.useTrayCheck.Contains(equipBean.DeviceID);
IsLoad = true;
}
......@@ -776,6 +778,7 @@ namespace OnlineStore.AssemblyLine
}
}
}
}
}
......
......@@ -12,6 +12,7 @@ using System.Drawing;
using System.Linq;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Runtime.Remoting.Metadata.W3cXsd2001;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
......@@ -362,9 +363,11 @@ namespace OnlineStore.AssemblyLine
{
if (lineBean.runStatus != LineRunStatus.Wait)
{
MessageBox.Show(lineBean.Name + "当前状态:" + lineBean.runStatus + ",不能启动!");
//MessageBox.Show(lineBean.Name + "当前状态:" + lineBean.runStatus + ",不能启动!");
return;
}
stopRequest = false;
stopRun = false;
LogUtil.info("点击 开始启动");
startTimer.Interval = 300;
startTimer.Elapsed += timer_Elapsed;
......@@ -427,7 +430,7 @@ namespace OnlineStore.AssemblyLine
{
if (lineBean.runStatus.Equals(LineRunStatus.Wait))
{
MessageBox.Show(lineBean.Name + "流水线未启动,不需要停止");
// MessageBox.Show(lineBean.Name + "流水线未启动,不需要停止");
return;
}
LogUtil.info(lineBean.Name + "点击:停止");
......@@ -541,11 +544,47 @@ namespace OnlineStore.AssemblyLine
LogUtil.error("LogM Error: ", ex);
}
}
bool stopRun = false;
bool stopRequest = false;
DateTime stopTime = new DateTime();
private void timer1_Tick(object sender, EventArgs e)
{
try
{
LogM();
try
{
if (SServerManager.stopRun(Name))
{
if (!stopRequest)
{
stopTime = DateTime.Now;
stopRequest = true;
//lineBean.WriteDrivetMotorRun(IO_VALUE.LOW);
}
if (!stopRun && stopRequest && (DateTime.Now - stopTime).TotalSeconds > 40)
{
stopRun = true;
//停止所有料仓TToolStripMenuItem_Click(null, null);
lineBean.WriteDrivetMotorRun(IO_VALUE.LOW);
lineBean.LineStopRun = true;
LogUtil.info("收到服务端停机要求,停止环形线");
}
}
else
{
if (stopRun)
{
lineBean.LineStopRun = false;
lineBean.WriteDrivetMotorRun(IO_VALUE.HIGH);
//启动所有料仓AToolStripMenuItem_Click(null, null);
stopRun = false;
LogUtil.info("收到服务端开机要求,启动环形线");
}
stopRequest = false;
}
}
catch { lineBean.WriteDrivetMotorRun(IO_VALUE.HIGH); }
if (!this.Visible)
{
return;
......@@ -942,7 +981,7 @@ namespace OnlineStore.AssemblyLine
private void btnTrayInfo_Click(object sender, EventArgs e)
{
string msg ="";
string msg = "";
List<TrayInfo> tray = TrayManager.getTrayList();
LogUtil.info("-------------------开始打印托盘信息:");
......@@ -954,7 +993,7 @@ namespace OnlineStore.AssemblyLine
{
disstr = "✘";
}
LogUtil.info(disstr+ t.ToStr());
LogUtil.info(disstr + t.ToStr());
msg += disstr + t.ToStr() + "\r\n";
}
LogUtil.info("-------------------结束打印托盘信息");
......@@ -1255,7 +1294,8 @@ namespace OnlineStore.AssemblyLine
TrayInfo tray = TrayManager.GetTrayInfo(trayNum);
lblSelTrayNum.Text = tray.ToStr();
}
}catch(Exception ex)
}
catch (Exception ex)
{
}
......@@ -1274,7 +1314,7 @@ namespace OnlineStore.AssemblyLine
DialogResult resut = MessageBox.Show("确定手动清空托盘【" + num + "】的信息?\r\n " + oldStr + "", "提示", MessageBoxButtons.YesNo);
if (resut.Equals(DialogResult.Yes))
{
TrayManager.ClearInstore(tray,"手动清空托盘");
TrayManager.ClearInstore(tray, "手动清空托盘");
TrayManager.UpdateTrayInfo(num);
TrayInfo info = TrayManager.GetTrayInfo(num);
MessageBox.Show("更新成功:\r" + info.ToStr());
......@@ -1297,7 +1337,7 @@ namespace OnlineStore.AssemblyLine
else
{
启用分流横移1ToolStripMenuItem.Text = gouStr + "启用分流横移1";
lineBean.DisableShunt = false ;
lineBean.DisableShunt = false;
}
LogUtil.info(Name + " 点击:" + 启用分流横移1ToolStripMenuItem.Text + ",lineBean.DisableShunt=" + lineBean.DisableShunt);
}
......@@ -1318,7 +1358,7 @@ namespace OnlineStore.AssemblyLine
启用分流横移2ToolStripMenuItem.Text = gouStr + "启用分流横移2";
lineBean.DisableShunt2 = false;
}
LogUtil.info(Name + " 点击:" + 启用分流横移2ToolStripMenuItem.Text+ ",lineBean.DisableShunt2="+ lineBean.DisableShunt2);
LogUtil.info(Name + " 点击:" + 启用分流横移2ToolStripMenuItem.Text + ",lineBean.DisableShunt2=" + lineBean.DisableShunt2);
}
private void 自动保存托盘信息ToolStripMenuItem_Click(object sender, EventArgs e)
......@@ -1373,11 +1413,41 @@ namespace OnlineStore.AssemblyLine
{
RFIDManager.Open();
}
catch(Exception ex)
catch (Exception ex)
{
LogUtil.error("btnOpenRfid_Click",ex);
LogUtil.error("btnOpenRfid_Click", ex);
}
}
//private void 启用服务器停止ToolStripMenuItem_Click(object sender, EventArgs e)
//{
// if (SServerManager.IgnoreServerStop)
// {
// 启用服务器停止ToolStripMenuItem.Text = gouStr + " 启用服务器停止功能";
// SServerManager.IgnoreServerStop = false;
// }
// else
// {
// 启用服务器停止ToolStripMenuItem.Text = "启用服务器停止功能";
// SServerManager.IgnoreServerStop = true;
// }
// LogUtil.info(Name + " 点击:" + 启用服务器停止ToolStripMenuItem.Text);
//}
private void 新托盘检测逻辑ToolStripMenuItem_Click(object sender, EventArgs e)
{
if (TrayDisableManager.UseNewLogic)
{
新托盘检测逻辑ToolStripMenuItem.Text = "新托盘检测逻辑";
TrayDisableManager.UseNewLogic = false;
}
else
{
新托盘检测逻辑ToolStripMenuItem.Text = gouStr + " 新托盘检测逻辑";
TrayDisableManager.UseNewLogic = true;
}
LogUtil.info(Name + " 点击:" + 新托盘检测逻辑ToolStripMenuItem.Text);
}
}
}
......@@ -16,7 +16,7 @@ using System.Reflection;
using UserFromControl;
using OnlineStore.LoadCSVLibrary;
using OnlineStore.Common;
using System.Threading.Tasks;
namespace OnlineStore.AssemblyLine
{
......@@ -62,6 +62,7 @@ namespace OnlineStore.AssemblyLine
lblThisSta.Text = equipBean.WarnMsg;
lblName.Text = equipBean.Name;
txtP1.Text = equipBean.Config.UpDownAxisP1.ToString();
btnReelCheck.Visible = equipBean.Config.CameraName_1 != "";
IsLoad = true;
}
......@@ -540,6 +541,32 @@ namespace OnlineStore.AssemblyLine
}
}
private void btnReelCheck_Click(object sender, EventArgs e)
{
ReelCheck(btnReelCheck.Text, equipBean.Config.CameraName_1);
}
private void ReelCheck(string text, string cameraName)
{
if (String.IsNullOrEmpty(cameraName))
{
return;
}
Task.Factory.StartNew(delegate {
int rfid = equipBean.ReadReelCheckId();
string reelInfo = equipBean.GetCurReelInfo(cameraName);
if (!string.IsNullOrEmpty(reelInfo))
{
MessageBox.Show("相机[" + cameraName + "]检测料盘结果:[" + rfid + "][" + reelInfo + "]", text + "结果", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
else
{
MessageBox.Show("相机[" + cameraName + "]检测料盘失败:[" + rfid + "]", text + "结果", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
});
}
}
}
......
......@@ -19,7 +19,7 @@ namespace OnlineStore.AssemblyLine.Properties {
// 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
// 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen
// (以 /str 作为命令选项),或重新生成 VS 项目。
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
......@@ -47,8 +47,8 @@ namespace OnlineStore.AssemblyLine.Properties {
}
/// <summary>
/// 重写当前线程的 CurrentUICulture 属性
/// 重写当前线程的 CurrentUICulture 属性
/// 重写当前线程的 CurrentUICulture 属性,对
/// 使用此强类型资源类的所有资源查找执行重写
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
......
......@@ -12,7 +12,7 @@ namespace OnlineStore.AssemblyLine.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.9.0.0")]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.3.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
......
......@@ -9,7 +9,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>OnlineStore.Common</RootNamespace>
<AssemblyName>Common</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
</PropertyGroup>
......
......@@ -9,7 +9,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>OnlineStore.DeviceLibrary</RootNamespace>
<AssemblyName>DeviceLibrary</AssemblyName>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
</PropertyGroup>
......
......@@ -3,6 +3,8 @@ PRO,0,设备是否处于调试状态(1=调试,0=正常),IsDebug,0,,,,,
PRO,0,对应的横移模块,SidesWayNum,4,,,,,
PRO,0,设备对应的出料流水线的编号,DLineEquipNum,2,,,,,
PRO,0,设备对应的出料流水线的第几条流水线,DLineLineNum,2,,,,,
PRO,0,出料口前阻挡监控相机,CameraName_1,r_camera_1,,,,,
PRO,0,出料口前阻挡RFID,CameraName_1_RFID,192.168.210.133,,,,,
,,,,,
PRO,0,移栽上下运动是否使用伺服,UpDownUseAxis,1,,,,,
AXIS,0,移栽上下轴,UpDown_Axis,10,COM3,0,,,
......
......@@ -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,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);
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,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);
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))
......@@ -434,7 +434,7 @@ namespace OnlineStore.DeviceLibrary
//判断皮带三还有料盘,需要转动一个工位
UpdateLastP();
LogUtil.debug(hengyiName + "空闲,且流水线还有料盘,转动一个工位");
Line3Turn.StartLineRun( Line3EndProcess);
Line3Turn.StartLineRun(Line3EndProcess);
}
}
private void UpdateLastP()
......@@ -495,7 +495,7 @@ namespace OnlineStore.DeviceLibrary
}
else
{
LogUtil.error (Name + "Line3EndProcess result=" + result + "");
LogUtil.error(Name + "Line3EndProcess result=" + result + "");
}
}
private bool ScanIsEnd()
......@@ -520,7 +520,7 @@ namespace OnlineStore.DeviceLibrary
}
IsInScanCode = true;
LastScanTime=DateTime.Now;
LastScanTime = DateTime.Now;
string LastCode = "";
//Task.Factory.StartNew(delegate
//{
......@@ -535,12 +535,24 @@ namespace OnlineStore.DeviceLibrary
Thread.Sleep(300);
if (IOValue(IO_Type.ExitTray_Check3).Equals(IO_VALUE.LOW))
{
UpdateScanInfo(IO_VALUE.LOW,"");
UpdateScanInfo(IO_VALUE.LOW, "");
IsInScanCode = false;
}
else
{
string resStr = "";
bool hasR=false;
bool hasReel=false;
if(IOValue(IO_Type.ExitTray_Check3).Equals(IO_VALUE.HIGH))
{
hasReel = true;
resStr += "信号检测到有料盘,";
}
else
{
resStr += "信号未检测到料盘,";
}
try
{
LastCode = "";
......@@ -560,11 +572,31 @@ namespace OnlineStore.DeviceLibrary
}
LogUtil.info(hengyiName + "扫码工位:开始扫码,IsInScanCode=" + IsInScanCode);
List<string> LastCodeList = CodeManager.CameraScan(Config.GetCameraList(), hengyiName, true);
bool hasR = CodeManager.HasRightCode(LastCodeList.ToArray());
hasR = CodeManager.HasRightCode(LastCodeList.ToArray());
if(LastCodeList.Count>0)
{
hasReel = true;
resStr += "第一次扫到条码,";
}
else
{
resStr += "第一次未扫到条码,";
}
if (!hasR)
{
LastCodeList = CodeManager.CameraScan(Config.GetCameraList(), hengyiName, true, 3000);
hasR = CodeManager.HasRightCode(LastCodeList.ToArray());
if (LastCodeList.Count > 0)
{
hasReel = true;
resStr += "第二次扫到条码";
}
else
{
resStr += "第二次未扫到条码";
}
}
LastCode = SServerManager.ProcessCodeList(LastCodeList);
}
catch (Exception ex)
......@@ -573,18 +605,26 @@ namespace OnlineStore.DeviceLibrary
}
finally
{
if(hasReel)
{
UpdateScanInfo(IO_VALUE.HIGH, LastCode);
}
else
{
UpdateScanInfo(IO_VALUE.LOW, LastCode);
}
IsInScanCode = false;
LogUtil.info(hengyiName + " 扫码工位 : 扫码结束 ," + StationInfo_Scan.ToStr + " IsInScanCode = " + IsInScanCode);
LogUtil.info(hengyiName + $" 扫码工位 [{resStr}]: 扫码结束 ," + StationInfo_Scan.ToStr + " IsInScanCode = " + IsInScanCode);
}
}
//}, TaskCreationOptions.LongRunning);
}
private void UpdateScanInfo(IO_VALUE value,string code)
private void UpdateScanInfo(IO_VALUE value, string code)
{
StationInfo_Scan = new StationTrayInfo(value,code);
StationInfo_Scan = new StationTrayInfo(value, code);
if (DeviceID.Equals(301))
{
StationInfo_NG = new StationTrayInfo(StationInfo_Scan.TrayValue, StationInfo_Scan.CodeStr);
......
......@@ -256,8 +256,34 @@ namespace OnlineStore.DeviceLibrary
// }
//}
UpdateTrayNum();
TrayInfo trayInfo = TrayManager.GetTrayInfo(currTrayNum);
if (trayInfo.InoutPar?.ManualJudgeNG ?? false)
{
if (Config.SidesWayNum <= 0)
{
SecondMoveInfo.NextMoveStep(LineMoveStep.MO_15_WaitCanGo);
TrayInfo tray = TrayManager.GetTrayInfo(currTrayNum);
CheckLog(SecondMoveInfo.MoveNum + "***************上个托盘号【" + preTrayNum + "】,当前 【" + tray.ToStr() + "】被标记为判定NG,放盘通过~");
//CheckLog("托盘放行 " + SecondMoveInfo.SLog + " ,移栽2,需要判断是否可以放盘通过,最多等待10000)");
CheckLog("托盘放行 " + SecondMoveInfo.SLog + " ,等待 NextStopCheck=0");
// SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.NextStopCheck, IO_VALUE.LOW));
}
else
{
CheckLog("托盘检测:此托盘被标记为判定NG,写一下顶升上升,结束处理");
if (Config.SidesWayNum.Equals(2))
{
CylinderMove(null, IO_Type.SW_TopCylinder_Down, IO_Type.SW_TopCylinder_Up);
if (LineManager.Line.SwCanUpMove(3))
{
LineManager.Line.CylinderMove(null, IO_Type.SW3_TopCylinder_Down, IO_Type.SW3_TopCylinder_Up);
}
}
SMoveEnd();
}
}
//出料中,需要拦盘
if (CurrTrayIsNeed(currTrayNum, true))
else if (CurrTrayIsNeed(currTrayNum, true))
{
SecondMoveInfo.MoveParam = CheckParam;
SecondMoveInfo.NextMoveStep(LineMoveStep.MIO_06_TopUp);
......@@ -332,7 +358,7 @@ namespace OnlineStore.DeviceLibrary
LogInfo("当前托盘上的料盘检测信号[" + io.ConfigStr + "]的值:" + IOValue(IO_Type.ReelCheck));
}
LogInfo(SecondMoveInfo.MoveNum + SecondMoveInfo.SLog + " 入库中,需拦截空托盘【 " + currTrayNum + "】,空托盘料盘检测信号亮,禁用托盘,暂时放托盘离开");
TrayDisableManager.AddDisable(currTrayNum, Name, "空托盘料盘检测信号亮");
TrayDisableManager.AddDisable(currTrayNum, Name, "空托盘料盘检测信号亮",2);
TrayMoveOk();
return;
}
......@@ -343,7 +369,7 @@ namespace OnlineStore.DeviceLibrary
if ((!isfull) && IOValue(IO_Type.ReelCheck).Equals(IO_VALUE.HIGH))
{
LogInfo(SecondMoveInfo.MoveNum + SecondMoveInfo.SLog + " 入库中,需拦截空托盘【 " + currTrayNum + "】,空托盘料盘检测信号亮,禁用托盘,暂时放托盘离开");
TrayDisableManager.AddDisable(currTrayNum, Name, "空托盘料盘检测信号亮");
TrayDisableManager.AddDisable(currTrayNum, Name, "空托盘料盘检测信号亮",2);
TrayMoveOk();
return;
}
......@@ -355,7 +381,7 @@ namespace OnlineStore.DeviceLibrary
LogInfo("当前托盘上的料盘检测信号[" + io.ConfigStr + "]的值:" + IOValue(IO_Type.ReelCheck));
}
LogInfo(SecondMoveInfo.MoveNum + SecondMoveInfo.SLog + " 需拦截有料托盘【 " + currTrayNum + "】,有料托盘料盘检测信号不亮,禁用托盘,暂时放托盘离开");
TrayDisableManager.AddDisable(currTrayNum, Name, "有料托盘料盘检测信号不亮");
TrayDisableManager.AddDisable(currTrayNum, Name, "有料托盘料盘检测信号不亮",1);
TrayMoveOk();
return;
}
......@@ -835,6 +861,7 @@ namespace OnlineStore.DeviceLibrary
InLog("料盘移栽" + MoveInfo.SLog + ":上料横移取料端");
CylinderMove(MoveInfo, IO_Type.SL_MoveCylinder_Give, IO_Type.SL_MoveCylinder_Take);
ClearTimeoutAlarm("扫码执行结束超时");
ClearTimeoutAlarm("即将关机,暂停抓取料盘");
}
else if (MoveInfo.IsTimeOut(60))
{
......@@ -1440,6 +1467,8 @@ namespace OnlineStore.DeviceLibrary
private Task ScanCodeTask = null;
private void FI_13_ScanCode()
{
if (SServerManager.putInEnable(Name))
{
if (CylinderIsOk(IO_Type.SL_MoveCylinder_Take, IO_Type.SL_MoveCylinder_Give))
{
if (YuScanTask == null || YuScanTask.IsCompleted)
......@@ -1507,6 +1536,11 @@ namespace OnlineStore.DeviceLibrary
FI_12_MoveCylinder_Give();
}
}
else //if (MoveInfo.IsTimeOut(10))
{
MoveTimeoutAlarm(MoveInfo, "即将关机,暂停抓取料盘");
}
}
private int LoopCount = 0;
private void CheckHasTray()
{
......
......@@ -552,6 +552,7 @@ namespace OnlineStore.DeviceLibrary
IOMove(IO_Type.Alarm_HddLed, IO_VALUE.HIGH);
}
public bool LineStopRun = false;
public void WriteDrivetMotorRun(IO_VALUE value)
{
......@@ -561,13 +562,12 @@ namespace OnlineStore.DeviceLibrary
IOMove(IO_Type.DriveMotor_Run4, value);
}
#region 灯光处理
private void CloseLed()
public void CloseLed()
{
CheckAndMove(IO_Type.AutoRun_HddLed, IO_VALUE.LOW);
CheckAndMove(IO_Type.AutoRun_HddLed, IO_VALUE.HIGH);
CheckAndMove(IO_Type.Alarm_HddLed, IO_VALUE.LOW);
CheckAndMove(IO_Type.RunSign_HddLed, IO_VALUE.LOW);
CheckAndMove(IO_Type.Alarm_Buzzer, IO_VALUE.LOW);
......@@ -577,7 +577,7 @@ namespace OnlineStore.DeviceLibrary
try
{
DateTime time = DateTime.Now;
if (runStatus <= LineRunStatus.Wait)
if (runStatus <= LineRunStatus.Wait || LineStopRun)
{
CloseLed();
return;
......
......@@ -351,7 +351,7 @@ namespace OnlineStore.DeviceLibrary
{
LogUtil.error(Name + "入库 [" + posId + "],升降气缸下降到托盘[" + currTrayNum + "]取料失败,升降轴上升,禁用托盘,同时放行托盘");
LogInfo("入库 [" + posId + "]" + MoveInfo.SLog + ": 升降轴上升,禁用托盘,同时放行托盘,顶升气缸1下降");
TrayDisableManager.AddDisable(currTrayNum, Name, "入库取料失败");
TrayDisableManager.AddDisable(currTrayNum, Name, "入库取料失败",0);
MI_18_UpdownUp();
}
}
......@@ -390,7 +390,7 @@ namespace OnlineStore.DeviceLibrary
}
LogUtil.error(Name + "入库 [" + posId + "],托盘【 " + currTrayNum + "】,有料托盘料盘检测信号不亮,升降轴上升,禁用托盘,同时放行托盘");
LogInfo("入库 [" + posId + "]" + MoveInfo.SLog + ": 升降轴上升,禁用托盘,同时放行托盘,顶升气缸1下降");
TrayDisableManager.AddDisable(currTrayNum, Name, "有料托盘料盘检测信号不亮");
TrayDisableManager.AddDisable(currTrayNum, Name, "有料托盘料盘检测信号不亮",1);
MI_18_UpdownUp();
}
else
......@@ -651,7 +651,7 @@ namespace OnlineStore.DeviceLibrary
LogInfo("当前托盘上的料盘检测信号[" + io.ConfigStr + "]的值:" + IOValue(IO_Type.TrayCheck));
}
LogInfo(" 出库中,需拦截空托盘【 " + currTrayNum + "】,空托盘料盘检测信号亮,禁用托盘");
TrayDisableManager.AddDisable(currTrayNum, Name, "空托盘料盘检测信号亮");
TrayDisableManager.AddDisable(currTrayNum, Name, "空托盘料盘检测信号亮", 2);
}
else
{
......@@ -734,7 +734,7 @@ namespace OnlineStore.DeviceLibrary
LogInfo("当前托盘上的料盘检测信号[" + io.ConfigStr + "]的值:" + IOValue(IO_Type.TrayCheck));
}
LogInfo(" 入库需拦截有料托盘【 " + currTrayNum + "】,有料托盘料盘检测信号不亮,禁用托盘");
TrayDisableManager.AddDisable(currTrayNum, Name, "有料托盘料盘检测信号不亮");
TrayDisableManager.AddDisable(currTrayNum, Name, "有料托盘料盘检测信号不亮", 1);
return false;
}
else if (!LineServer.BoxCanInStore(StoreID))
......@@ -958,7 +958,7 @@ namespace OnlineStore.DeviceLibrary
try
{
StopReadRfid();
LogUtil.info($"【{Name}】停止记录rfid缓存");
LogUtil.debug($"【{Name}】停止记录rfid缓存");
}
catch (Exception ex1)
{
......@@ -970,8 +970,13 @@ namespace OnlineStore.DeviceLibrary
bool isFull = TrayManager.TrayIsFull(currTrayNum);
if (TrayManager.RightTrayCode(currTrayNum, preTrayNum, false))
{
TrayInfo tray = TrayManager.GetTrayInfo(currTrayNum);
if (tray.InoutPar?.ManualJudgeNG ?? false)
{
LogInfo(SecondMoveInfo.MoveNum + "*************** 托盘【" + currTrayNum + "】被为标记判定NG,放盘通过");
}
//出库中,需要拦盘
if (CheckIsNeedOutStore())
else if (CheckIsNeedOutStore())
{
isNeed = true;
}
......@@ -1056,8 +1061,13 @@ namespace OnlineStore.DeviceLibrary
//托盘号正确
//preTrayNum = num;
bool isNeedMove = false;
TrayInfo tray = TrayManager.GetTrayInfo(currTrayNum);
if(tray.InoutPar?.ManualJudgeNG??false)
{
LogInfo(SecondMoveInfo.MoveNum + "*************** 托盘【" + currTrayNum + "】被为标记判定NG,放盘通过");
}
//判断盘是空盘,空盘并且编号正确才需要放料盘过去
if (CheckIsNeedOutStore())
else if (CheckIsNeedOutStore())
{
SecondMoveInfo.MoveParam = new InOutParam(currTrayNum);
isNeedMove = true;
......
......@@ -278,7 +278,7 @@ namespace OnlineStore.DeviceLibrary
try
{
int id = Convert.ToInt32(st.Trim());
if (id > 0 && id <= 20)
//if (id > 0 && id <= 20)
{
useTrayCheck.Add(id);
}
......
......@@ -35,10 +35,83 @@ namespace OnlineStore.DeviceLibrary
List<TrayDisableInfo> dislist = new List<TrayDisableInfo>(TrayDisableMap.Values);
return dislist;
}
public static void AddDisable(int trayNum, string deviceName, string describle)
public static bool UseNewLogic = true;
/// <summary>
/// 添加屏蔽库位
/// </summary>
/// <param name="trayNum"></param>
/// <param name="deviceName"></param>
/// <param name="describle"></param>
/// <param name="type">0,无;1:硬件未检测到;2:硬件检测到</param>
public static void AddDisable(int trayNum, string deviceName, string describle,int type)
{
TrayDisableInfo t = new TrayDisableInfo(trayNum, deviceName, describle);
if(UseNewLogic)
{
TrayInfo tray = TrayManager.GetTrayInfo(trayNum);
if(tray.InoutPar.Corrected)
{
LogUtil.info($"{deviceName} 托盘新判断逻辑,料盘已纠正,无需处理:【{tray.ToStr()}】【{describle}】");
return;
}
if (tray.IsFull && type.Equals(1))//有料,但传感器未检测到
{
LogUtil.info($"{deviceName} 托盘新判断逻辑:【{tray.ToStr()}】【{describle}】。需要二次判断");
tray.InoutPar.ManualJudgeNG = true;
TrayManager.UpdateTrayInfo(trayNum,tray.IsFull,tray.InOrOutStore,tray.InoutPar);
}
else if (!tray.IsFull && type.Equals(2) && !tray.InoutPar.InStoreNg)//无料,但传感器感应到
{
tray.InoutPar.ManualJudgeNG = true;
LogUtil.info($"{deviceName} 托盘新判断逻辑:【{tray.ToStr()}】【{describle}】。认为NG");
TrayManager.UpdateTrayInfo(trayNum, tray.IsFull, tray.InOrOutStore, tray.InoutPar);
}
else
{
tray.InoutPar.ManualJudgeNG = true;
TrayManager.UpdateTrayInfo(trayNum, tray.IsFull, tray.InOrOutStore, tray.InoutPar);
LogUtil.info($"{deviceName} 托盘新判断逻辑:【{tray.ToStr()}】【{describle}】。其他处理,需要二次判断");
}
//if (tray.InOrOutStore.Equals(1))//入库料
//{
// if (tray.IsFull && type.Equals(1))//认为无料
// {
// TrayManager.UpdateTrayInfo(trayNum) ;
// LogUtil.info($"{deviceName} 托盘新判断逻辑:【{tray.ToStr()}】【{describle}】。认为无料");
// }
// else if(!tray.IsFull && type.Equals(2) && !tray.InoutPar.InStoreNg)
// {
// tray.InoutPar.InStoreNg = true;
// TrayManager.UpdateTrayInfo(trayNum,true,tray.InOrOutStore,tray.InoutPar);
// LogUtil.info($"{deviceName} 托盘新判断逻辑:【{tray.ToStr()}】【{describle}】。认为NG");
// }
//}
//else if(tray.InOrOutStore.Equals(2))
//{
// if (tray.IsFull && type.Equals(1))//认为无料
// {
// TrayManager.UpdateTrayInfo(trayNum);
// LogUtil.info($"{deviceName} 托盘新判断逻辑:【{tray.ToStr()}】【{describle}】。认为无料");
// }
// else if (!tray.IsFull && type.Equals(2) && !tray.InoutPar.InStoreNg)
// {
// tray.InoutPar.InStoreNg = true;
// TrayManager.UpdateTrayInfo(trayNum, true, tray.InOrOutStore, tray.InoutPar);
// LogUtil.info($"{deviceName} 托盘新判断逻辑:【{tray.ToStr()}】【{describle}】。认为NG");
// }
//}
}
else
{
AddDisableTray(t);
}
}
public static void AddDisableTray(int trayNum)
{
TrayDisableInfo t = new TrayDisableInfo();
t.TrayCode = trayNum;
if (TrayDisableMap.ContainsKey(trayNum))
{
TrayDisableMap[trayNum] = t;
......@@ -56,7 +129,25 @@ namespace OnlineStore.DeviceLibrary
}
LogUtil.info("增加托盘禁用:" + t.ToStr() + "");
}
public static void AddDisableTray(TrayDisableInfo t)
{
if (TrayDisableMap.ContainsKey(t.TrayCode))
{
TrayDisableMap[t.TrayCode] = t;
}
else
{
TrayDisableMap.TryAdd(t.TrayCode, t);
}
//如果托盘上物料是入库的,直接清理入库 任务
TrayInfo tray = TrayManager.GetTrayInfo(t.TrayCode);
if (tray.IsFull && tray.InOrOutStore.Equals(1))
{
TrayManager.ClearInstore(tray, "禁用托盘[" + t.TrayCode + "]");
}
LogUtil.info("增加托盘禁用:" + t.ToStr() + "");
}
public static void RemoveDisable(int trayNum)
{
TrayManager.UpdateTrayInfo(trayNum);
......
......@@ -105,14 +105,18 @@ namespace OnlineStore.DeviceLibrary
{
param = new InOutParam();
}
param.Corrected = false;
TrayInfoMap[trayNum].InoutPar = param;
TrayInfoMap[trayNum].ShowMsg = ngMsg;
}
else
{
TrayInfo fixture = new TrayInfo(trayNum, isFull, inOrOut, param,ngMsg);
fixture.InoutPar.Corrected = false;
TrayInfoMap.TryAdd(trayNum, fixture);
// TrayInfoMap.TryAdd(trayNum, fixture);
}
SaveMapToFile();
}
......
......@@ -258,6 +258,169 @@ namespace OnlineStore.DeviceLibrary
return codeList;
}
[HandleProcessCorruptedStateExceptions]
public static (bool,string) ReelCheckCameraScan(List<string> cameraList, string deviceName)
{
bool isPreScan = deviceName.EndsWith("预扫码");
List<string> codeList = new List<string>();
bool findCode = true;
if (cameraList == null || cameraList.Count <= 0)
{
return (findCode, ProcessCode(codeList));
}
try
{
foreach (string cameraName in cameraList)
{
if (cameraName.Trim().Equals(""))
{
continue;
}
ScanCount++;
DateTime startTime = DateTime.Now;
if (deviceName != "")
{
LogUtil.info(deviceName + " 【" + cameraName + "】开始取图片");
}
Bitmap bmp = null;
HalconDotNet.HObject ho_Image = null;
try
{
ho_Image = Camera._cam.CaptureOnImage(cameraName, out bmp);
if (ho_Image == null)
{
LogUtil.error(deviceName + " 【" + cameraName + "】取图片失败[" + Camera._cam.ErrInfo + "],关闭相机");
CloseCamera(cameraName);
continue;
}
LogUtil.debug(deviceName + " 【" + cameraName + "】取图片完成,开始扫码");
string r = "";
// bool eyemNoCode = false;
Task eyemtask = Task.Factory.StartNew(delegate {
List<CodeInfo> tlci = EyemDecode.ModelDecoder(ref bmp);
foreach (CodeInfo co in tlci)
{
LogUtil.info(deviceName + " 【" + cameraName + "】[eyemDecode]" + co.CodeType + "(X: " + co.X + ",Y: " + co.Y + ") " + co.CodeStr);
string str = CodeManager.ReplaceCode(co.CodeStr);
if (!codeList.Contains(str))
{
codeList.Add(str);
r = r + "##eyem|" + co.CodeType + "|" + str;
//if (!findCode)
//{
// findCode = HasRightCode(str);
//}
}
}
});
//最多等待60秒
bool taskResult = eyemtask.Wait(60000);
if (!taskResult)
{
LogUtil.error(deviceName + " 【" + cameraName + "】eyem扫码超时");
//eyemNoCode = true;
}
//if (!isPreScan)
//{
// if (!findCode)
// {
// try
// {
// List<CodeInfo> cc = new List<CodeInfo>();
// eyemNoCode = true;
// RemoteDecodeHelper.RemoteDecodeParam remoteDecodeParam = new RemoteDecodeHelper.RemoteDecodeParam
// {
// codeTypeList = allCodeTypeList.ToArray(),
// codeCount = 3,
// timeout = 3000
// };
// cc = RemoteDecodeHelper.DecodeRequest(ho_Image, remoteDecodeParam);
// if (cc != null && cc.Count > 0) findCode = true;
// //if (cc != null)
// //{
// // foreach (CodeInfo c in cc)
// // {
// // string str = CodeManager.ReplaceCode(c.CodeStr);
// // if (!codeList.Contains(str))
// // {
// // codeList.Add(str);
// // r = r + "##halcon|" + c.CodeType + "|" + str;
// // if (!findCode)
// // {
// // findCode = HasRightCode(str);
// // }
// // }
// // }
// //}
// }
// catch (Exception ex)
// {
// LogUtil.error(deviceName + " RemoteDecodeHelper扫码出错:" + ex.ToString());
// }
// }
// //if (!findRightCode && SaveErrorImageToFile.Equals(1))
// if (SaveImage || (((!findCode) || eyemNoCode) && (!isPreScan)))
// {
// //如果halcon没扫出的,
// string nameStr = "";
// if (findCode && eyemNoCode)
// {
// nameStr = "eyem";
// }
// SaveImageToFile(deviceName, cameraName + nameStr, bmp);
// }
//}
if (deviceName != "" || r != "")
{
LogUtil.info(deviceName + " 【" + cameraName + "】扫码完成【" + FormUtil.GetSpanStr(DateTime.Now - startTime) + "】[" + findCode + "]" + ScanCount + " :" + r);
}
}
catch (AccessViolationException e)
{
LogUtil.error(deviceName + " 扫码出现AccessViolationException异常,关闭相机【" + cameraName + "】:" + e.ToString());
Camera._cam.Close(cameraName);
// GC.Collect();
}
catch (Exception ex)
{
LogUtil.error(deviceName + " 扫码出错:" + ex.ToString());
}
finally
{
if (ho_Image != null)
{
ho_Image.Dispose();
ho_Image = null;
}
// GC.Collect();
Task.Delay(10);
}
}
}
catch (AccessViolationException e)
{
LogUtil.error(deviceName + " 扫码出现AccessViolationException异常,关闭所有相机:" + e.ToString());
Camera._cam.CloseAll();
//GC.Collect();
}
catch (Exception ex)
{
LogUtil.error(deviceName + " 扫码出错:" + ex.ToString());
}
string code = ProcessCode(codeList);
findCode = string.IsNullOrEmpty(code) ? false : true;
return (findCode,code);
}
private static int SaveErrorImageToFile = ConfigAppSettings.GetIntValue(Setting_Init.SaveErrorImageToFile);
private static void SaveImageToFile(string deviceName, string cameraName, HalconDotNet.HObject bitmap)
......@@ -282,6 +445,7 @@ namespace OnlineStore.DeviceLibrary
}
private static void SaveImageToFile(string deviceName, string cameraName, Bitmap bitmap)
{
if (!SaveImage) return;
string date = deviceName.Trim().Replace('_', '-') +"-"+ DateTime.Now.ToString("yyyyMMdd-HHmmss") + DateTime.Now.Millisecond;
string dire = @"D:\image\" + deviceName.Trim().Replace('_', '-') + @"\" + cameraName.Trim().Replace('_', '-').Replace(':', '-') + @"\";
string iamgeName = date + ".bmp";
......@@ -309,7 +473,7 @@ namespace OnlineStore.DeviceLibrary
foreach (string code in codes)
{
string[] strarray = code.Split(';');
if (strarray.Length == 4)
if (strarray.Length >= 4)
{
if (
//strarray[0].StartsWith("L") &&
......
......@@ -60,6 +60,15 @@ namespace OnlineStore.DeviceLibrary
/// 是否是入库NG的料盘
/// </summary>
public bool InStoreNg = false;
/// <summary>
/// 手动判断NG
/// </summary>
public bool ManualJudgeNG = false;
/// <summary>
/// 相机已纠正
/// </summary>
public bool Corrected = false;
public string NgMsg = "";
public string ToStr()
{
......
......@@ -593,22 +593,22 @@ namespace OnlineStore.DeviceLibrary
{
if (msg.StartsWith(Name))
{
LogUtil.error(msg, logtype, logseconds);
//LogUtil.error(msg, logtype, logseconds);
}
else
{
LogUtil.error(Name + msg, logtype, logseconds);
//LogUtil.error(Name + msg, logtype, logseconds);
}
}
else
{
if (msg.StartsWith(Name))
{
LogUtil.error(msg);
//LogUtil.error(msg);
}
else
{
LogUtil.error(Name + msg);
// LogUtil.error(Name + msg);
}
}
......
......@@ -257,6 +257,7 @@ namespace OnlineStore.DeviceLibrary
MI_18_UpdownUp,
#endregion
#region 移栽装置出入库共同模块 1180-1100
/// <summary>
///移载(流水线)装置出入库处理,阻挡气缸1-1下降
......
......@@ -48,7 +48,7 @@ namespace OnlineStore.DeviceLibrary
//return "托盘 [" + TrayCode + "] [" + (IsFull ? "有料" : "空") +"] ["+ type +
// "]二维码[" + WareCode + "]库位号[" + PosId + "] [" + PlateW + "X" + PlateH+ "] " + err + " "+ jinji + "" ;
return "托盘 [" + TrayCode + "] [" + LastUpdateTime.ToLongTimeString() + "] [" + (IsFull ? "有料" : "空") + "] [" + type + "]";
return "托盘 [" + TrayCode + "] [" + LastUpdateTime.ToLongTimeString() + "] [" + (IsFull ? "有料" : "空") + "] [" + type + "]"+"["+ ((inoutPar?.ManualJudgeNG ?? false) ? "判定NG" : "判定OK") + "]["+((inoutPar?.Corrected??false)?"纠正OK":"未纠正")+"]";
}
/// <summary>
/// 夹具编码值(1-32?)
......
......@@ -9,7 +9,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>OnlineStore.LoadCSVLibrary</RootNamespace>
<AssemblyName>LoadCSVLibrary</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
</PropertyGroup>
......
......@@ -119,8 +119,16 @@ namespace OnlineStore.LoadCSVLibrary
/// </summary>
[ConfigProAttribute("UpdownAxis_P3Speed", false)]
public int UpdownAxis_P3Speed { get; set; }
/// <summary>
/// PRO 0 出料口监控相机 CameraName_1
/// </summary>
[ConfigProAttribute("CameraName_1", false)]
public string CameraName_1 { get; set; }
/// <summary>
/// PRO,0,出料口前阻挡RFID,CameraName_1_RFID,192.168.103.21,,,,,
/// </summary>
[ConfigProAttribute("CameraName_1_RFID", false)]
public string CameraName_1_RFID { get; set; }
/// <summary>
/// PRO,0,移栽上下轴流水线取放料详细位置P2,UpDownP2DetialList,7*16=80000;,,,,,
......
......@@ -19,7 +19,7 @@ namespace UserFromControl.Properties {
// 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
// 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen
// (以 /str 作为命令选项),或重新生成 VS 项目。
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
......@@ -47,8 +47,8 @@ namespace UserFromControl.Properties {
}
/// <summary>
/// 重写当前线程的 CurrentUICulture 属性
/// 重写当前线程的 CurrentUICulture 属性
/// 重写当前线程的 CurrentUICulture 属性,对
/// 使用此强类型资源类的所有资源查找执行重写
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
......
......@@ -9,7 +9,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>UserFromControl</RootNamespace>
<AssemblyName>UserFromControl</AssemblyName>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
</PropertyGroup>
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!