Commit fa81c6e7 刘韬

出料防撞检测,平板出错检测

1 个父辈 dbedd0e8
...@@ -14,13 +14,13 @@ ...@@ -14,13 +14,13 @@
<add key="ConfigPath_XRay" value="\RobotConfig\Config_XRay.csv" /> <add key="ConfigPath_XRay" value="\RobotConfig\Config_XRay.csv" />
<add key="ConfigPath_InputEquip" value="\RobotConfig\Config_InputEquip.csv" /> <add key="ConfigPath_InputEquip" value="\RobotConfig\Config_InputEquip.csv" />
<add key="ConfigPath_OutputEquip" value="\RobotConfig\Config_OutputEquip.csv" /> <add key="ConfigPath_OutputEquip" value="\RobotConfig\Config_OutputEquip.csv" />
<add key="CounParamConfig" value="\XRAY\countParam.csv" />
<!--二维码类型列表配置,用#分割,一维码=Barcode 二维码: QR Code#Data Matrix ECC 200#Micro QR Code--> <!--二维码类型列表配置,用#分割,一维码=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="CodeType" value="Data Matrix ECC 200"/>-->
<add key="ACBaudRate" value="115200" /> <add key="ACBaudRate" value="115200" />
<!--二维码参数文件所在路径,文件名与二维码类型名一样--> <!--二维码参数文件所在路径,文件名与二维码类型名一样-->
<add key="CodeParamPath" value="\CodeParam\" /> <add key="CodeParamPath" value="\CodeParam\\XRAY\countParam.csv" />
<add key="Config_Pwd" value="123456" /> <add key="Config_Pwd" value="123456" />
<add key="UseAIOBOX" value="1" /> <add key="UseAIOBOX" value="1" />
......
...@@ -61,10 +61,6 @@ ...@@ -61,10 +61,6 @@
<Reference Include="AccImageBox"> <Reference Include="AccImageBox">
<HintPath>..\..\dll\AccImageBox.dll</HintPath> <HintPath>..\..\dll\AccImageBox.dll</HintPath>
</Reference> </Reference>
<Reference Include="Asa.CarerayImage, Version=1.1.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\dll\X-Ray\Asa.CarerayImage.dll</HintPath>
</Reference>
<Reference Include="Asa.PrintLabel"> <Reference Include="Asa.PrintLabel">
<HintPath>..\..\dll\label\Asa.PrintLabel.dll</HintPath> <HintPath>..\..\dll\label\Asa.PrintLabel.dll</HintPath>
</Reference> </Reference>
......
...@@ -12,6 +12,7 @@ using System.IO; ...@@ -12,6 +12,7 @@ using System.IO;
using OnlineStore.LoadCSVLibrary; using OnlineStore.LoadCSVLibrary;
using OnlineStore.Common; using OnlineStore.Common;
using OnlineStore.DeviceLibrary; using OnlineStore.DeviceLibrary;
using static OnlineStore.DeviceLibrary.CountParam;
namespace OnlineStore.AutoCountClient namespace OnlineStore.AutoCountClient
{ {
...@@ -96,7 +97,9 @@ namespace OnlineStore.AutoCountClient ...@@ -96,7 +97,9 @@ namespace OnlineStore.AutoCountClient
if (obj.Sufan >= 0) if (obj.Sufan >= 0)
{ {
ParamManager.UpdateParam(new CountParam(obj.PartNum, RobotManager.robot.XrayBean.ThresholdValue, 3, obj.Sufan)); var suanfa = SignType.AUTO;
Enum.TryParse<SignType>(obj.Sufan.ToString(), out suanfa);
ParamManager.UpdateParam(new CountParam(obj.PartNum, RobotManager.robot.XrayBean.ThresholdValue, 3, suanfa));
ParamManager.SaveMapToFile(); ParamManager.SaveMapToFile();
} }
} }
...@@ -134,7 +137,9 @@ namespace OnlineStore.AutoCountClient ...@@ -134,7 +137,9 @@ namespace OnlineStore.AutoCountClient
groupInfo.Text = "元器件【" + obj.PartNum + "】的基本信息"; groupInfo.Text = "元器件【" + obj.PartNum + "】的基本信息";
if (obj.Sufan >= 0) if (obj.Sufan >= 0)
{ {
ParamManager.UpdateParam(new CountParam(obj.PartNum, RobotManager.robot.XrayBean.ThresholdValue, 3, obj.Sufan)); var suanfa = SignType.AUTO;
Enum.TryParse<SignType>(obj.Sufan.ToString(), out suanfa);
ParamManager.UpdateParam(new CountParam(obj.PartNum, RobotManager.robot.XrayBean.ThresholdValue, 3, suanfa));
ParamManager.SaveMapToFile(); ParamManager.SaveMapToFile();
} }
} }
...@@ -387,7 +392,7 @@ namespace OnlineStore.AutoCountClient ...@@ -387,7 +392,7 @@ namespace OnlineStore.AutoCountClient
CountParam param = ParamManager.GetParamByPN(com.PartNum); CountParam param = ParamManager.GetParamByPN(com.PartNum);
if (param != null) if (param != null)
{ {
com.Sufan = param.Sign; com.Sufan = (int)param.Sign;
} }
else else
{ {
......
...@@ -58,6 +58,8 @@ ...@@ -58,6 +58,8 @@
this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator(); this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator();
this.设置TToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.设置TToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.元器件学习ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.元器件学习ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.批量ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.单盘ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator17 = new System.Windows.Forms.ToolStripSeparator(); this.toolStripSeparator17 = new System.Windows.Forms.ToolStripSeparator();
this.二维码学习ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.二维码学习ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator7 = new System.Windows.Forms.ToolStripSeparator(); this.toolStripSeparator7 = new System.Windows.Forms.ToolStripSeparator();
...@@ -361,11 +363,28 @@ ...@@ -361,11 +363,28 @@
// //
// 元器件学习ToolStripMenuItem // 元器件学习ToolStripMenuItem
// //
this.元器件学习ToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.批量ToolStripMenuItem,
this.单盘ToolStripMenuItem});
this.元器件学习ToolStripMenuItem.Name = "元器件学习ToolStripMenuItem"; this.元器件学习ToolStripMenuItem.Name = "元器件学习ToolStripMenuItem";
this.元器件学习ToolStripMenuItem.Size = new System.Drawing.Size(180, 26); this.元器件学习ToolStripMenuItem.Size = new System.Drawing.Size(180, 26);
this.元器件学习ToolStripMenuItem.Text = "元器件学习"; this.元器件学习ToolStripMenuItem.Text = "元器件学习";
this.元器件学习ToolStripMenuItem.Click += new System.EventHandler(this.元器件学习ToolStripMenuItem_Click); this.元器件学习ToolStripMenuItem.Click += new System.EventHandler(this.元器件学习ToolStripMenuItem_Click);
// //
// 批量ToolStripMenuItem
//
this.批量ToolStripMenuItem.Name = "批量ToolStripMenuItem";
this.批量ToolStripMenuItem.Size = new System.Drawing.Size(112, 26);
this.批量ToolStripMenuItem.Text = "批量";
this.批量ToolStripMenuItem.Click += new System.EventHandler(this.批量ToolStripMenuItem_Click);
//
// 单盘ToolStripMenuItem
//
this.单盘ToolStripMenuItem.Name = "单盘ToolStripMenuItem";
this.单盘ToolStripMenuItem.Size = new System.Drawing.Size(112, 26);
this.单盘ToolStripMenuItem.Text = "单盘";
this.单盘ToolStripMenuItem.Click += new System.EventHandler(this.单盘ToolStripMenuItem_Click);
//
// toolStripSeparator17 // toolStripSeparator17
// //
this.toolStripSeparator17.Name = "toolStripSeparator17"; this.toolStripSeparator17.Name = "toolStripSeparator17";
...@@ -388,12 +407,14 @@ ...@@ -388,12 +407,14 @@
this.toolStripMenuItem2.Name = "toolStripMenuItem2"; this.toolStripMenuItem2.Name = "toolStripMenuItem2";
this.toolStripMenuItem2.Size = new System.Drawing.Size(180, 26); this.toolStripMenuItem2.Size = new System.Drawing.Size(180, 26);
this.toolStripMenuItem2.Text = "AGV调试"; this.toolStripMenuItem2.Text = "AGV调试";
this.toolStripMenuItem2.Visible = false;
this.toolStripMenuItem2.Click += new System.EventHandler(this.toolStripMenuItem2_Click); this.toolStripMenuItem2.Click += new System.EventHandler(this.toolStripMenuItem2_Click);
// //
// toolStripSeparator6 // toolStripSeparator6
// //
this.toolStripSeparator6.Name = "toolStripSeparator6"; this.toolStripSeparator6.Name = "toolStripSeparator6";
this.toolStripSeparator6.Size = new System.Drawing.Size(177, 6); this.toolStripSeparator6.Size = new System.Drawing.Size(177, 6);
this.toolStripSeparator6.Visible = false;
// //
// 标签编辑ToolStripMenuItem // 标签编辑ToolStripMenuItem
// //
...@@ -421,55 +442,57 @@ ...@@ -421,55 +442,57 @@
// toolStripMenuItem3 // toolStripMenuItem3
// //
this.toolStripMenuItem3.Name = "toolStripMenuItem3"; this.toolStripMenuItem3.Name = "toolStripMenuItem3";
this.toolStripMenuItem3.Size = new System.Drawing.Size(144, 26); this.toolStripMenuItem3.Size = new System.Drawing.Size(180, 26);
this.toolStripMenuItem3.Text = "历史记录"; this.toolStripMenuItem3.Text = "历史记录";
this.toolStripMenuItem3.Click += new System.EventHandler(this.toolStripMenuItem3_Click); this.toolStripMenuItem3.Click += new System.EventHandler(this.toolStripMenuItem3_Click);
// //
// toolStripSeparator5 // toolStripSeparator5
// //
this.toolStripSeparator5.Name = "toolStripSeparator5"; this.toolStripSeparator5.Name = "toolStripSeparator5";
this.toolStripSeparator5.Size = new System.Drawing.Size(141, 6); this.toolStripSeparator5.Size = new System.Drawing.Size(177, 6);
// //
// 元器件库ToolStripMenuItem // 元器件库ToolStripMenuItem
// //
this.元器件库ToolStripMenuItem.Name = "元器件库ToolStripMenuItem"; this.元器件库ToolStripMenuItem.Name = "元器件库ToolStripMenuItem";
this.元器件库ToolStripMenuItem.Size = new System.Drawing.Size(144, 26); this.元器件库ToolStripMenuItem.Size = new System.Drawing.Size(180, 26);
this.元器件库ToolStripMenuItem.Text = "元器件库"; this.元器件库ToolStripMenuItem.Text = "元器件库";
this.元器件库ToolStripMenuItem.Visible = false;
this.元器件库ToolStripMenuItem.Click += new System.EventHandler(this.元器件库ToolStripMenuItem_Click); this.元器件库ToolStripMenuItem.Click += new System.EventHandler(this.元器件库ToolStripMenuItem_Click);
// //
// toolStripSeparator16 // toolStripSeparator16
// //
this.toolStripSeparator16.Name = "toolStripSeparator16"; this.toolStripSeparator16.Name = "toolStripSeparator16";
this.toolStripSeparator16.Size = new System.Drawing.Size(141, 6); this.toolStripSeparator16.Size = new System.Drawing.Size(177, 6);
this.toolStripSeparator16.Visible = false;
// //
// 清空日志ToolStripMenuItem // 清空日志ToolStripMenuItem
// //
this.清空日志ToolStripMenuItem.Name = "清空日志ToolStripMenuItem"; this.清空日志ToolStripMenuItem.Name = "清空日志ToolStripMenuItem";
this.清空日志ToolStripMenuItem.Size = new System.Drawing.Size(144, 26); this.清空日志ToolStripMenuItem.Size = new System.Drawing.Size(180, 26);
this.清空日志ToolStripMenuItem.Text = "清空日志"; this.清空日志ToolStripMenuItem.Text = "清空日志";
this.清空日志ToolStripMenuItem.Click += new System.EventHandler(this.清空日志ToolStripMenuItem_Click); this.清空日志ToolStripMenuItem.Click += new System.EventHandler(this.清空日志ToolStripMenuItem_Click);
// //
// toolStripSeparator10 // toolStripSeparator10
// //
this.toolStripSeparator10.Name = "toolStripSeparator10"; this.toolStripSeparator10.Name = "toolStripSeparator10";
this.toolStripSeparator10.Size = new System.Drawing.Size(141, 6); this.toolStripSeparator10.Size = new System.Drawing.Size(177, 6);
// //
// 复制日志ToolStripMenuItem // 复制日志ToolStripMenuItem
// //
this.复制日志ToolStripMenuItem.Name = "复制日志ToolStripMenuItem"; this.复制日志ToolStripMenuItem.Name = "复制日志ToolStripMenuItem";
this.复制日志ToolStripMenuItem.Size = new System.Drawing.Size(144, 26); this.复制日志ToolStripMenuItem.Size = new System.Drawing.Size(180, 26);
this.复制日志ToolStripMenuItem.Text = "复制日志"; this.复制日志ToolStripMenuItem.Text = "复制日志";
this.复制日志ToolStripMenuItem.Click += new System.EventHandler(this.复制日志ToolStripMenuItem_Click); this.复制日志ToolStripMenuItem.Click += new System.EventHandler(this.复制日志ToolStripMenuItem_Click);
// //
// toolStripSeparator11 // toolStripSeparator11
// //
this.toolStripSeparator11.Name = "toolStripSeparator11"; this.toolStripSeparator11.Name = "toolStripSeparator11";
this.toolStripSeparator11.Size = new System.Drawing.Size(141, 6); this.toolStripSeparator11.Size = new System.Drawing.Size(177, 6);
// //
// 版本号ToolStripMenuItem // 版本号ToolStripMenuItem
// //
this.版本号ToolStripMenuItem.Name = "版本号ToolStripMenuItem"; this.版本号ToolStripMenuItem.Name = "版本号ToolStripMenuItem";
this.版本号ToolStripMenuItem.Size = new System.Drawing.Size(144, 26); this.版本号ToolStripMenuItem.Size = new System.Drawing.Size(180, 26);
this.版本号ToolStripMenuItem.Text = "关于软件"; this.版本号ToolStripMenuItem.Text = "关于软件";
this.版本号ToolStripMenuItem.Click += new System.EventHandler(this.版本号ToolStripMenuItem_Click); this.版本号ToolStripMenuItem.Click += new System.EventHandler(this.版本号ToolStripMenuItem_Click);
// //
...@@ -535,7 +558,7 @@ ...@@ -535,7 +558,7 @@
// //
this.aGVCancelStateToolStripMenuItem.Name = "aGVCancelStateToolStripMenuItem"; this.aGVCancelStateToolStripMenuItem.Name = "aGVCancelStateToolStripMenuItem";
this.aGVCancelStateToolStripMenuItem.Size = new System.Drawing.Size(213, 26); this.aGVCancelStateToolStripMenuItem.Size = new System.Drawing.Size(213, 26);
this.aGVCancelStateToolStripMenuItem.Text = "AGV cancelState"; this.aGVCancelStateToolStripMenuItem.Text = "禁用AGV";
this.aGVCancelStateToolStripMenuItem.Click += new System.EventHandler(this.aGVCancelStateToolStripMenuItem_Click); this.aGVCancelStateToolStripMenuItem.Click += new System.EventHandler(this.aGVCancelStateToolStripMenuItem_Click);
// //
// toolStripSeparator13 // toolStripSeparator13
...@@ -681,6 +704,8 @@ ...@@ -681,6 +704,8 @@
private System.Windows.Forms.ToolStripSeparator toolStripSeparator12; private System.Windows.Forms.ToolStripSeparator toolStripSeparator12;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator14; private System.Windows.Forms.ToolStripSeparator toolStripSeparator14;
private System.Windows.Forms.ToolStripMenuItem 启用贴标功能ToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem 启用贴标功能ToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem 批量ToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem 单盘ToolStripMenuItem;
} }
} }
...@@ -257,6 +257,7 @@ namespace OnlineStore.AutoCountClient ...@@ -257,6 +257,7 @@ namespace OnlineStore.AutoCountClient
{ {
Camera._cam.CloseAll(); Camera._cam.CloseAll();
} }
if (robot.sQLite!=null)
robot.sQLite.Close(); robot.sQLite.Close();
} }
catch (Exception ex) catch (Exception ex)
...@@ -486,7 +487,17 @@ namespace OnlineStore.AutoCountClient ...@@ -486,7 +487,17 @@ namespace OnlineStore.AutoCountClient
{ {
return; return;
} }
lblXrayWork.Visible = robot.XrayBean.InXWork; lblXrayWork.Visible = robot.XrayBean.InXWork;
if (robot.XrayBean.carerayImageError)
{
robot.XrayBean.MoveStop = true;
lblXrayWork.Text = "图像平板失效,请及时处理。";
lblXrayWork.Visible = true;
}
string canScanCode = ""; string canScanCode = "";
lblStatus.Text = robot.GetRunStr() + canScanCode; lblStatus.Text = robot.GetRunStr() + canScanCode;
string warnMsg = robot.WarnMsg; string warnMsg = robot.WarnMsg;
...@@ -535,11 +546,11 @@ namespace OnlineStore.AutoCountClient ...@@ -535,11 +546,11 @@ namespace OnlineStore.AutoCountClient
//} //}
if (AgvClient.CurrCancelState) if (AgvClient.CurrCancelState)
{ {
aGVCancelStateToolStripMenuItem.Text = gouStr + " AGV cancelState"; aGVCancelStateToolStripMenuItem.Text = gouStr + "禁用 AGV";
} }
else else
{ {
aGVCancelStateToolStripMenuItem.Text = "AGV cancelState"; aGVCancelStateToolStripMenuItem.Text = "禁用 AGV";
} }
UpdateListBox(); UpdateListBox();
} }
...@@ -707,7 +718,6 @@ namespace OnlineStore.AutoCountClient ...@@ -707,7 +718,6 @@ namespace OnlineStore.AutoCountClient
ExitApp(); ExitApp();
} }
private void logBox_VisibleChanged(object sender, EventArgs e) private void logBox_VisibleChanged(object sender, EventArgs e)
{ {
if (!LoadOk) if (!LoadOk)
...@@ -941,7 +951,32 @@ namespace OnlineStore.AutoCountClient ...@@ -941,7 +951,32 @@ namespace OnlineStore.AutoCountClient
private void 元器件学习ToolStripMenuItem_Click(object sender, EventArgs e) private void 元器件学习ToolStripMenuItem_Click(object sender, EventArgs e)
{ {
}
private void 单盘ToolStripMenuItem_Click(object sender, EventArgs e)
{
string backPath = ParamManager.NoConfigPath; string backPath = ParamManager.NoConfigPath;
OpenFileDialog ofd = new OpenFileDialog();
ofd.InitialDirectory = ParamManager.NoConfigPath;
ofd.Multiselect = true;
ofd.Filter = "PNG|*.png";
if (DialogResult.OK == ofd.ShowDialog(this)) {
FrmLearning frm = new FrmLearning();
frm.ImageFiles = ofd.FileNames;
frm.ImagePath = ParamManager.NoConfigPath;
frm.Show();
//Task.Run(() => { frm.ShowDialog(); });
}
}
private void 批量ToolStripMenuItem_Click(object sender, EventArgs e)
{
string backPath = ParamManager.NoConfigPath;
FrmLearning frm = new FrmLearning();
frm.ImagePath = backPath;
frm.Show();
/*
folderBrowserDialog1.Description = "请选择需要学习的图片文件夹"; folderBrowserDialog1.Description = "请选择需要学习的图片文件夹";
if (!Directory.Exists(backPath)) if (!Directory.Exists(backPath))
{ {
...@@ -954,8 +989,9 @@ namespace OnlineStore.AutoCountClient ...@@ -954,8 +989,9 @@ namespace OnlineStore.AutoCountClient
string folder = folderBrowserDialog1.SelectedPath; string folder = folderBrowserDialog1.SelectedPath;
FrmLearning frm = new FrmLearning(); FrmLearning frm = new FrmLearning();
frm.ImagePath = folder; frm.ImagePath = folder;
frm.ShowDialog(); frm.Show();
} //Task.Run(() => { frm.ShowDialog(); });
}*/
} }
private void 元器件库ToolStripMenuItem_Click(object sender, EventArgs e) private void 元器件库ToolStripMenuItem_Click(object sender, EventArgs e)
{ {
...@@ -1012,5 +1048,7 @@ namespace OnlineStore.AutoCountClient ...@@ -1012,5 +1048,7 @@ namespace OnlineStore.AutoCountClient
} }
LogUtil.info(Name + " 点击:" + 启用贴标功能ToolStripMenuItem.Text); LogUtil.info(Name + " 点击:" + 启用贴标功能ToolStripMenuItem.Text);
} }
} }
} }
...@@ -16,13 +16,13 @@ using System.Reflection; ...@@ -16,13 +16,13 @@ using System.Reflection;
using UserFromControl; using UserFromControl;
using OnlineStore.LoadCSVLibrary; using OnlineStore.LoadCSVLibrary;
using OnlineStore.Common; using OnlineStore.Common;
using static OnlineStore.DeviceLibrary.CountParam;
namespace OnlineStore.AutoCountClient namespace OnlineStore.AutoCountClient
{ {
internal partial class FrmXRay : FrmEquipBase internal partial class FrmXRay : FrmEquipBase
{ {
private int DeviceType = 0; private SignType DeviceType = SignType.AUTO;
private bool IsLoad = false; private bool IsLoad = false;
private X_RAY_Equip equipBean; private X_RAY_Equip equipBean;
...@@ -34,10 +34,15 @@ namespace OnlineStore.AutoCountClient ...@@ -34,10 +34,15 @@ namespace OnlineStore.AutoCountClient
InitializeComponent(); InitializeComponent();
LoadIOList(); LoadIOList();
} }
private void FrmXRay_Shown(object sender, EventArgs e)
{
}
private void FrmStoreIOStatus_Load(object sender, EventArgs e) private void FrmStoreIOStatus_Load(object sender, EventArgs e)
{ {
cmbType.Items.AddRange(new string[] { "小器件", "大器件", "异形三角器件", "异形三脚大器件", "异形长条形器件" }); cmbType.Items.AddRange(new string[] { "默认算法", "算法A", "算法B", "算法C", "算法D", "算法E" });
cmbType.SelectedIndex = DeviceType; cmbType.SelectedIndex = (DeviceType==SignType.AUTO?0: (int)DeviceType);
chbDebug.Checked = equipBean.IsDebug; chbDebug.Checked = equipBean.IsDebug;
lblCom.Text = "X射线端口号:" + equipBean.Config.XRay_Port; lblCom.Text = "X射线端口号:" + equipBean.Config.XRay_Port;
...@@ -105,6 +110,7 @@ namespace OnlineStore.AutoCountClient ...@@ -105,6 +110,7 @@ namespace OnlineStore.AutoCountClient
{ {
return; return;
} }
this.chbMoveStop.Checked = equipBean.MoveStop;
ReadIOList(); ReadIOList();
ReadBtnDO(); ReadBtnDO();
lblOpen.Visible =(! equipBean.OpenXLine); lblOpen.Visible =(! equipBean.OpenXLine);
...@@ -447,9 +453,8 @@ namespace OnlineStore.AutoCountClient ...@@ -447,9 +453,8 @@ namespace OnlineStore.AutoCountClient
txtResult.Text = "点料中..."; txtResult.Text = "点料中...";
int th = (int)numTh.Value; int th = (int)numTh.Value;
int wsize = (int)numWSize.Value; int wsize = (int)numWSize.Value;
Asa.API.EyemImage tpDstImg ;
CountParam param = new CountParam("", th, wsize, DeviceType); CountParam param = new CountParam("", th, wsize, DeviceType);
int outCount = equipBean.GetCountResult(filePath, param, out tpDstImg); int outCount = equipBean.GetCountResult(filePath, param, out _);
txtResult.Text = outCount.ToString(); txtResult.Text = outCount.ToString();
LogUtil.info(equipBean.Name + "用户点击 点料测试【" + filePath + "】【" + th + "】【" + wsize + "】 结果:" + outCount); LogUtil.info(equipBean.Name + "用户点击 点料测试【" + filePath + "】【" + th + "】【" + wsize + "】 结果:" + outCount);
} }
...@@ -494,7 +499,8 @@ namespace OnlineStore.AutoCountClient ...@@ -494,7 +499,8 @@ namespace OnlineStore.AutoCountClient
int index = cmbType.SelectedIndex; int index = cmbType.SelectedIndex;
if (index >= 0) if (index >= 0)
{ {
DeviceType = index; index--;
Enum.TryParse<SignType>(index.ToString(), out DeviceType);
LogUtil.info(Name + " " + equipBean.Name + " 更改 equipBean.DeviceType=" + index); LogUtil.info(Name + " " + equipBean.Name + " 更改 equipBean.DeviceType=" + index);
} }
} }
......
...@@ -48,6 +48,8 @@ namespace CodeLibrary ...@@ -48,6 +48,8 @@ namespace CodeLibrary
} }
public override void CloseAll() public override void CloseAll()
{ {
if (cameraCurr == null)
return;
for (int i = 0; i < cameraCurr.Length; i++) for (int i = 0; i < cameraCurr.Length; i++)
{ {
if (cameraCurr[i] != null) if (cameraCurr[i] != null)
......
...@@ -41,8 +41,9 @@ ...@@ -41,8 +41,9 @@
<AutoGenerateBindingRedirects>false</AutoGenerateBindingRedirects> <AutoGenerateBindingRedirects>false</AutoGenerateBindingRedirects>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="Asa.CarerayImage"> <Reference Include="Asa.CarerayImage, Version=1.1.2.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\dll\X-Ray\Asa.CarerayImage.dll</HintPath> <SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\CarerayImage\CarerayImage\bin\Debug\Asa.CarerayImage.dll</HintPath>
</Reference> </Reference>
<Reference Include="Asa.IOModule.AIOBOX"> <Reference Include="Asa.IOModule.AIOBOX">
<HintPath>..\..\dll\Asa.IOModule.AIOBOX.dll</HintPath> <HintPath>..\..\dll\Asa.IOModule.AIOBOX.dll</HintPath>
......
...@@ -81,6 +81,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -81,6 +81,7 @@ namespace OnlineStore.DeviceLibrary
{ {
if (Robot.AutoInput && Robot.IOValue(IO_LineIn_Check).Equals(IO_VALUE.HIGH)) if (Robot.AutoInput && Robot.IOValue(IO_LineIn_Check).Equals(IO_VALUE.HIGH))
{ {
//WorkLog("启动位置1");
StartWorking(new WorkParam()); StartWorking(new WorkParam());
} }
} }
...@@ -106,12 +107,12 @@ namespace OnlineStore.DeviceLibrary ...@@ -106,12 +107,12 @@ namespace OnlineStore.DeviceLibrary
WorkLog("无料串,:通知agv来送料串AgvName:" + AgvName + ",agvcallresult:" + agvcallresult.ToString()); WorkLog("无料串,:通知agv来送料串AgvName:" + AgvName + ",agvcallresult:" + agvcallresult.ToString());
} }
} }
else// if(AgvClient.GetAction(AgvName)!=Asa.ClientAction.NeedLeave && AgvClient.GetAction(AgvName)!=Asa.ClientAction.MayLeave) else if (Robot.IOValue(IO_LineIn_Check).Equals(IO_VALUE.HIGH) && Robot.IOValue(IO_LineEnd_Check).Equals(IO_VALUE.HIGH)
&& AgvClient.GetAction(AgvName)!=Asa.ClientAction.NeedLeave && AgvClient.GetAction(AgvName)!=Asa.ClientAction.MayLeave && AgvClient.GetAction(AgvName) != Asa.ClientAction.FinishLeave)
{ {
shelfWatch.Stop(); shelfWatch.Stop();
//AgvClient.SetToNone(AgvName); AgvClient.SetToNone(AgvName);
} }
} }
private Stopwatch shelfWatch = new Stopwatch(); private Stopwatch shelfWatch = new Stopwatch();
public bool Reset(bool needStop = false) public bool Reset(bool needStop = false)
......
...@@ -187,11 +187,45 @@ namespace OnlineStore.DeviceLibrary ...@@ -187,11 +187,45 @@ namespace OnlineStore.DeviceLibrary
else if (MoveInfo.IsStep(StepEnum.IB09_ScanCode)) else if (MoveInfo.IsStep(StepEnum.IB09_ScanCode))
{ {
MoveInfo.NextMoveStep(StepEnum.IB10_ScanOK); WorkLog("IB09_ScanCode");
MoveInfo.MoveParam = new WorkParam();
MoveInfo.MoveParam.WareCode = CodeManager.GetValidCode(LastCodeList); MoveInfo.MoveParam.WareCode = CodeManager.GetValidCode(LastCodeList);
if (String.IsNullOrEmpty(MoveInfo.MoveParam.WareCode))
{
MoveInfo.MoveParam.IsNgReel = true;
MoveInfo.MoveParam.NgMsg = "无有效条码";
MoveInfo.MoveParam.TargetPosType = 1;
WorkLog(" 无有效条码,从XRay放到NG箱:" + MoveInfo.MoveParam.ToStr());
string outF = "无有效条码NG.";
RobotManager.robot.sQLite.Insert(MoveInfo.MoveParam.WareCode, MoveInfo.MoveParam.PlateW, MoveInfo.MoveParam.PlateH, 0, outF);
}
else if (SServerManager.CanConnect())
{
int needPosition = 0;
string msg = SServerManager.Get_VMICheckRLC(Name, MoveInfo.MoveParam.WareCode, out needPosition);
if (needPosition >= 1 && needPosition <= 3)
{
MoveInfo.MoveParam.TargetPosType = needPosition;
WorkLog(" 【" + MoveInfo.MoveParam.WareCode + "】通过接口获取目标位置:" + needPosition);
}
else
{
WorkLog(" 【" + MoveInfo.MoveParam.WareCode + "】获取是否测值失败:" + msg);
MoveInfo.MoveParam.TargetPosType = 1;
MoveInfo.MoveParam.IsNgReel = true;
MoveInfo.MoveParam.NgMsg = msg;
RobotManager.robot.sQLite.Insert(MoveInfo.MoveParam.WareCode, MoveInfo.MoveParam.PlateW, MoveInfo.MoveParam.PlateH, 0, msg);
}
}
else {
MoveInfo.MoveParam.TargetPosType = 1;
}
MoveInfo.NextMoveStep(StepEnum.IB10_ScanOK);
var span = DateTime.Now - MoveInfo.LastSetpTime; var span = DateTime.Now - MoveInfo.LastSetpTime;
LogUtil.ticklog("", MoveInfo.MoveParam.WareCode, span.TotalSeconds, "拍照扫码结束"); //LogUtil.ticklog("", MoveInfo.MoveParam.WareCode, span.TotalSeconds, "拍照扫码结束");
WorkLog("料串入料 :扫码结束【" + MoveInfo.MoveParam.WareCode + "】,等待取料机构来取料,拍照识别耗时:" + span.TotalSeconds.ToString()); WorkLog("料串入料 :扫码结束【" + MoveInfo.MoveParam.WareCode + "】,等待取料机构来取料," + MoveInfo.MoveParam.ToStr());
} }
else if (MoveInfo.IsStep(StepEnum.IB11_TrayLeave)) else if (MoveInfo.IsStep(StepEnum.IB11_TrayLeave))
{ {
...@@ -546,6 +580,11 @@ namespace OnlineStore.DeviceLibrary ...@@ -546,6 +580,11 @@ namespace OnlineStore.DeviceLibrary
{ {
//入口有料串,暂不处理 //入口有料串,暂不处理
LogUtil.error(logName + ",入口已有料架,暂不处理"); LogUtil.error(logName + ",入口已有料架,暂不处理");
Task.Factory.StartNew(delegate
{
Thread.Sleep(3000);
AgvClient.SetStatus(AgvName, "", ClientAction.None, ClientLevel.High, true);
});
} }
} }
catch (TimeoutException te) catch (TimeoutException te)
...@@ -601,6 +640,11 @@ namespace OnlineStore.DeviceLibrary ...@@ -601,6 +640,11 @@ namespace OnlineStore.DeviceLibrary
else else
{ {
LogUtil.info(logName + " 未检测到料架,暂不处理"); LogUtil.info(logName + " 未检测到料架,暂不处理");
Task.Factory.StartNew(delegate
{
Thread.Sleep(3000);
AgvClient.SetStatus(AgvName, "", ClientAction.None, ClientLevel.High, true);
});
} }
} }
catch (TimeoutException te) catch (TimeoutException te)
......
...@@ -249,13 +249,23 @@ namespace OnlineStore.DeviceLibrary ...@@ -249,13 +249,23 @@ namespace OnlineStore.DeviceLibrary
if (LeftBatchMove.MoveInfo.MoveType.Equals(RobotMoveType.Working) && LeftBatchMove.MoveInfo.IsStep(StepEnum.IB10_ScanOK)) if (LeftBatchMove.MoveInfo.MoveType.Equals(RobotMoveType.Working) && LeftBatchMove.MoveInfo.IsStep(StepEnum.IB10_ScanOK))
{ {
WorkLog("左侧开始取料");
string code = LeftBatchMove.MoveInfo.MoveParam.WareCode; string code = LeftBatchMove.MoveInfo.MoveParam.WareCode;
StartWorking(new WorkParam(1, 0, code)); var p = new WorkParam(1, 0, code);
p.IsNgReel = LeftBatchMove.MoveInfo.MoveParam.IsNgReel;
p.TargetPosType = LeftBatchMove.MoveInfo.MoveParam.TargetPosType;
p.NgMsg = LeftBatchMove.MoveInfo.MoveParam.NgMsg;
StartWorking(p);
} }
else if (RightBatchMove.MoveInfo.MoveType.Equals(RobotMoveType.Working) && RightBatchMove.MoveInfo.IsStep(StepEnum.IB10_ScanOK)) else if (RightBatchMove.MoveInfo.MoveType.Equals(RobotMoveType.Working) && RightBatchMove.MoveInfo.IsStep(StepEnum.IB10_ScanOK))
{ {
WorkLog("右侧开始取料");
string code = RightBatchMove.MoveInfo.MoveParam.WareCode; string code = RightBatchMove.MoveInfo.MoveParam.WareCode;
StartWorking(new WorkParam(2, 0, code)); var p = new WorkParam(2, 0, code);
p.IsNgReel = RightBatchMove.MoveInfo.MoveParam.IsNgReel;
p.TargetPosType = RightBatchMove.MoveInfo.MoveParam.TargetPosType;
p.NgMsg = RightBatchMove.MoveInfo.MoveParam.NgMsg;
StartWorking(p);
} }
} }
if (SecMoveInfo.MoveType.Equals(RobotMoveType.None) && NoErrorAlarm()) if (SecMoveInfo.MoveType.Equals(RobotMoveType.None) && NoErrorAlarm())
......
...@@ -50,7 +50,6 @@ namespace OnlineStore.DeviceLibrary ...@@ -50,7 +50,6 @@ namespace OnlineStore.DeviceLibrary
} }
#region 取料 #region 取料
internal bool IsInGetWare() internal bool IsInGetWare()
{ {
if (MoveInfo.MoveStep >= StepEnum.OT06_MoveXToP2 && MoveInfo.MoveStep <= StepEnum.OT09_MoveZToP1) if (MoveInfo.MoveStep >= StepEnum.OT06_MoveXToP2 && MoveInfo.MoveStep <= StepEnum.OT09_MoveZToP1)
...@@ -110,7 +109,6 @@ namespace OnlineStore.DeviceLibrary ...@@ -110,7 +109,6 @@ namespace OnlineStore.DeviceLibrary
MoveInfo.MoveParam.IsNgReel = true; MoveInfo.MoveParam.IsNgReel = true;
} }
MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.Out_TrayCheck, IO_VALUE.HIGH)); MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.Out_TrayCheck, IO_VALUE.HIGH));
MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.X_OLine_Run, IO_VALUE.LOW)); MoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.X_OLine_Run, IO_VALUE.LOW));
} }
...@@ -175,7 +173,6 @@ namespace OnlineStore.DeviceLibrary ...@@ -175,7 +173,6 @@ namespace OnlineStore.DeviceLibrary
} }
private void OT03_MoveXToP2() private void OT03_MoveXToP2()
{ {
int position = Config.GetMoveXP2(MoveInfo.MoveParam.PlateW); int position = Config.GetMoveXP2(MoveInfo.MoveParam.PlateW);
if (MoveXAxis.IsInPosition(position)) if (MoveXAxis.IsInPosition(position))
{ {
...@@ -347,6 +344,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -347,6 +344,7 @@ namespace OnlineStore.DeviceLibrary
{ {
int trayHeight = MoveInfo.MoveParam.PlateH; int trayHeight = MoveInfo.MoveParam.PlateH;
ShelfMoveInfo.NextMoveStep(StepEnum.OS_21_BatchDownH); ShelfMoveInfo.NextMoveStep(StepEnum.OS_21_BatchDownH);
int currP = BatchAxis.GetAclPosition(); int currP = BatchAxis.GetAclPosition();
int targetP = currP - (trayHeight + 20) * Config.Height_ChangeValue; int targetP = currP - (trayHeight + 20) * Config.Height_ChangeValue;
if (targetP < Config.BatchAxisP2) if (targetP < Config.BatchAxisP2)
...@@ -354,6 +352,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -354,6 +352,7 @@ namespace OnlineStore.DeviceLibrary
targetP = Config.BatchAxisP2; targetP = Config.BatchAxisP2;
} }
ShelfWorkLog("放料: 提升轴下降指定高度 : 盘高【" + trayHeight + "】实时位置【" + currP + "】目标位置【" + targetP + "】"); ShelfWorkLog("放料: 提升轴下降指定高度 : 盘高【" + trayHeight + "】实时位置【" + currP + "】目标位置【" + targetP + "】");
ShelfMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000));
BatchAxis.AbsMove(ShelfMoveInfo, targetP, Config.BatchAxis_P2Speed); BatchAxis.AbsMove(ShelfMoveInfo, targetP, Config.BatchAxis_P2Speed);
} }
} }
...@@ -367,13 +366,21 @@ namespace OnlineStore.DeviceLibrary ...@@ -367,13 +366,21 @@ namespace OnlineStore.DeviceLibrary
} }
else if (MoveInfo.IsStep(StepEnum.OT12_MoveXToP3)) else if (MoveInfo.IsStep(StepEnum.OT12_MoveXToP3))
{ {
if (IOValue(IO_Type.O_WLine_TrayCheck).Equals(IO_VALUE.HIGH)) {
ShelfMoveInfo.NextMoveStep(StepEnum.OS_20_ShelfReady);
MoveInfo.NextMoveStep(StepEnum.OT11_WaitShelfOk);
WorkLog("放料:料串下降不到位,重新下降 ", 1);
}
else
{
MoveInfo.NextMoveStep(StepEnum.OT13_MoveZToP3); MoveInfo.NextMoveStep(StepEnum.OT13_MoveZToP3);
int p = Config.GetMoveZP3(MoveInfo.MoveParam.PlateH); int p = Config.GetMoveZP3(MoveInfo.MoveParam.PlateH);
WorkLog("放料:取料Z轴下降到P3 ["+p+"] ",1); WorkLog("放料:取料Z轴下降到P3 [" + p + "] ", 1);
MoveZAxis.AbsMove(MoveInfo, p, Config.MoveZ_P3Speed); MoveZAxis.AbsMove(MoveInfo, p, Config.MoveZ_P3Speed);
CheckStartLabel(); CheckStartLabel();
} }
}
else if (MoveInfo.IsStep(StepEnum.OT13_MoveZToP3)) else if (MoveInfo.IsStep(StepEnum.OT13_MoveZToP3))
{ {
bool shelfOk = ShelfMoveInfo.MoveType.Equals(RobotMoveType.ShelfPro) && ShelfMoveInfo.IsStep(StepEnum.OS_22_WaitTray); bool shelfOk = ShelfMoveInfo.MoveType.Equals(RobotMoveType.ShelfPro) && ShelfMoveInfo.IsStep(StepEnum.OS_22_WaitTray);
...@@ -424,7 +431,6 @@ namespace OnlineStore.DeviceLibrary ...@@ -424,7 +431,6 @@ namespace OnlineStore.DeviceLibrary
WorkLog("放料完成,耗时(" + FormUtil.GetSpanStr(span) + ")"); WorkLog("放料完成,耗时(" + FormUtil.GetSpanStr(span) + ")");
TickLog("出口料串,放料完成"); TickLog("出口料串,放料完成");
MoveInfo.EndMove(); MoveInfo.EndMove();
} }
else else
{ {
...@@ -438,10 +444,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -438,10 +444,7 @@ namespace OnlineStore.DeviceLibrary
} }
} }
} }
#region NG #region NG
else if (MoveInfo.IsStep(StepEnum.OT21_NG_MoveXToP1)) else if (MoveInfo.IsStep(StepEnum.OT21_NG_MoveXToP1))
{ {
int busyStatus = ACServerManager.GetBusyStatus(MoveZAxis.Config.DeviceName, MoveZAxis.Config.GetAxisValue()); int busyStatus = ACServerManager.GetBusyStatus(MoveZAxis.Config.DeviceName, MoveZAxis.Config.GetAxisValue());
...@@ -478,16 +481,12 @@ namespace OnlineStore.DeviceLibrary ...@@ -478,16 +481,12 @@ namespace OnlineStore.DeviceLibrary
TickLog("出口NG,放料完成"); TickLog("出口NG,放料完成");
WorkLog("放料完成,耗时(" + FormUtil.GetSpanStr(span) + ")"); WorkLog("放料完成,耗时(" + FormUtil.GetSpanStr(span) + ")");
MoveInfo.EndMove(); MoveInfo.EndMove();
} }
#endregion #endregion
} }
#endregion #endregion
#region 贴标 #region 贴标
public override bool StartLabelling(WorkParam param) public override bool StartLabelling(WorkParam param)
{ {
if (!SecMoveInfo.MoveType.Equals(RobotMoveType.None)) if (!SecMoveInfo.MoveType.Equals(RobotMoveType.None))
...@@ -508,7 +507,6 @@ namespace OnlineStore.DeviceLibrary ...@@ -508,7 +507,6 @@ namespace OnlineStore.DeviceLibrary
{ {
LabelZAxis.AbsMove(SecMoveInfo, Config.LabelZ_P1, Config.LabelZ_P1Speed); LabelZAxis.AbsMove(SecMoveInfo, Config.LabelZ_P1, Config.LabelZ_P1Speed);
} }
return true; return true;
} }
...@@ -529,8 +527,12 @@ namespace OnlineStore.DeviceLibrary ...@@ -529,8 +527,12 @@ namespace OnlineStore.DeviceLibrary
{ {
SecMoveInfo.NextMoveStep(StepEnum.OL03_PrintLabel); SecMoveInfo.NextMoveStep(StepEnum.OL03_PrintLabel);
RobotManager.LastPrintStatus = Asa.PrintLabel.PrinterStatus.Unknown; RobotManager.LastPrintStatus = Asa.PrintLabel.PrinterStatus.Unknown;
try
{
NeedPrint = ConfigAppSettings.GetIntValue(Setting_Init.NeedPrintLabel).Equals(1); NeedPrint = ConfigAppSettings.GetIntValue(Setting_Init.NeedPrintLabel).Equals(1);
StickingPosJudgment = ConfigAppSettings.GetIntValue(Setting_Init.StickingPosJudgment).Equals(1); StickingPosJudgment = ConfigAppSettings.GetIntValue(Setting_Init.StickingPosJudgment).Equals(1);
}
catch { }
SecWorkLog("贴标: 重置PrintLabel状态=Unknown,开始打印标签[" + NeedPrint + "] ,贴标XYR轴到取标签点P2, 等待1s"); SecWorkLog("贴标: 重置PrintLabel状态=Unknown,开始打印标签[" + NeedPrint + "] ,贴标XYR轴到取标签点P2, 等待1s");
SecMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000)); SecMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000));
if (NeedPrint) if (NeedPrint)
...@@ -548,7 +550,6 @@ namespace OnlineStore.DeviceLibrary ...@@ -548,7 +550,6 @@ namespace OnlineStore.DeviceLibrary
LabelXAxis.AbsMove(SecMoveInfo, Config.LabelX_P2, Config.LabelX_P2Speed); LabelXAxis.AbsMove(SecMoveInfo, Config.LabelX_P2, Config.LabelX_P2Speed);
LabelYAxis.AbsMove(SecMoveInfo, Config.LabelY_P2, Config.LabelY_P2Speed); LabelYAxis.AbsMove(SecMoveInfo, Config.LabelY_P2, Config.LabelY_P2Speed);
LabelRAxis.AbsMove(SecMoveInfo, Config.LabelR_P2, Config.LabelR_P2Speed); LabelRAxis.AbsMove(SecMoveInfo, Config.LabelR_P2, Config.LabelR_P2Speed);
} }
else if (SecMoveInfo.IsStep(StepEnum.OL03_PrintLabel)) else if (SecMoveInfo.IsStep(StepEnum.OL03_PrintLabel))
{ {
...@@ -576,7 +577,6 @@ namespace OnlineStore.DeviceLibrary ...@@ -576,7 +577,6 @@ namespace OnlineStore.DeviceLibrary
LogUtil.error(WarnMsg, SecMoveInfo.ErrorLogType, SecMoveInfo.logSeconds()); LogUtil.error(WarnMsg, SecMoveInfo.ErrorLogType, SecMoveInfo.logSeconds());
Alarm(AlarmType.IoSingleTimeOut); Alarm(AlarmType.IoSingleTimeOut);
} }
} }
else if (SecMoveInfo.IsStep(StepEnum.OL05_TakeBack)) else if (SecMoveInfo.IsStep(StepEnum.OL05_TakeBack))
{ {
......
...@@ -246,12 +246,12 @@ namespace OnlineStore.DeviceLibrary ...@@ -246,12 +246,12 @@ namespace OnlineStore.DeviceLibrary
else if (ShelfMoveInfo.IsStep(StepEnum.OS_21_BatchDownH)) else if (ShelfMoveInfo.IsStep(StepEnum.OS_21_BatchDownH))
{ {
ShelfMoveInfo.NextMoveStep(StepEnum.OS_22_WaitTray); ShelfMoveInfo.NextMoveStep(StepEnum.OS_22_WaitTray);
ShelfWorkLog("等待料盘放入料串"); ShelfWorkLog("等待料盘放入料串,O_WLine_TrayCheck=" + IOValue(IO_Type.O_WLine_TrayCheck).ToString());
} }
else if (ShelfMoveInfo.IsStep(StepEnum.OS_23_TrayOK)) else if (ShelfMoveInfo.IsStep(StepEnum.OS_23_TrayOK))
{ {
ShelfMoveInfo.NextMoveStep(StepEnum.OS_24_BatchToP3); ShelfMoveInfo.NextMoveStep(StepEnum.OS_24_BatchToP3);
ShelfWorkLog("批量轴匀速到P3或信号亮"); ShelfWorkLog("批量轴匀速到P3或信号亮,O_WLine_TrayCheck=" + IOValue(IO_Type.O_WLine_TrayCheck).ToString()); ;
BatchAxisToP3(ShelfMoveInfo); BatchAxisToP3(ShelfMoveInfo);
} }
else if (ShelfMoveInfo.IsStep(StepEnum.OS_24_BatchToP3)) else if (ShelfMoveInfo.IsStep(StepEnum.OS_24_BatchToP3))
......
using BLL; using Asa;
using BLL;
using log4net; using log4net;
using OnlineStore.Common; using OnlineStore.Common;
using OnlineStore.LoadCSVLibrary; using OnlineStore.LoadCSVLibrary;
...@@ -64,6 +65,17 @@ namespace OnlineStore.DeviceLibrary ...@@ -64,6 +65,17 @@ namespace OnlineStore.DeviceLibrary
AgvClient.NodeList.Add(outputEquip.Config.AgvOutName); AgvClient.NodeList.Add(outputEquip.Config.AgvOutName);
AgvClient.NodeList.Add(inputEquip.Config.RightAgvName); AgvClient.NodeList.Add(inputEquip.Config.RightAgvName);
AgvClient.NodeList.Add(inputEquip.Config.LeftAgvName); AgvClient.NodeList.Add(inputEquip.Config.LeftAgvName);
/*var carerayImage = new CarerayImage();
if (carerayImage.Open())
{
carerayImage.Close();
}
else {
LogUtil.info(Name + "图像平板打开失败! 系统不允许启动。");
return;
}
*/
Task.Factory.StartNew(delegate Task.Factory.StartNew(delegate
{ {
LogUtil.info(Name + "开始连接IO模块 "); LogUtil.info(Name + "开始连接IO模块 ");
......
...@@ -61,7 +61,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -61,7 +61,7 @@ namespace OnlineStore.DeviceLibrary
} }
public bool carerayImageError = false;
private void XRayLoad() private void XRayLoad()
{ {
try try
...@@ -69,7 +69,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -69,7 +69,7 @@ namespace OnlineStore.DeviceLibrary
carerayImage = new CarerayImage("XRay"); carerayImage = new CarerayImage("XRay");
bool cResult = carerayImage.Open(); bool cResult = carerayImage.Open();
LogUtil.info(Name + "carerayImage.Open()=" + cResult); LogUtil.info(Name + "carerayImage.Open()=" + cResult);
carerayImageError = !cResult;
xRay = new XRay("XRay"); xRay = new XRay("XRay");
xRay.WarmUp += XRay_WarmUp; xRay.WarmUp += XRay_WarmUp;
...@@ -346,10 +346,8 @@ namespace OnlineStore.DeviceLibrary ...@@ -346,10 +346,8 @@ namespace OnlineStore.DeviceLibrary
} }
return false; return false;
} }
#endregion #endregion
public override string GetMoveStr() public override string GetMoveStr()
{ {
string msg = ""; string msg = "";
......
...@@ -239,7 +239,9 @@ namespace OnlineStore.DeviceLibrary ...@@ -239,7 +239,9 @@ namespace OnlineStore.DeviceLibrary
//MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(8000)); //MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(8000));
WorkLog("点料:清理" + path1_tif + "内容,开始获取X射线图形 "); WorkLog("点料:清理" + path1_tif + "内容,开始获取X射线图形 ");
CapImage(); if (string.IsNullOrEmpty(CapImage())) {
//Alarm(AlarmType.IoSingleTimeOut);
}
MoveInfo.EndStepWait(); MoveInfo.EndStepWait();
} }
...@@ -398,13 +400,15 @@ namespace OnlineStore.DeviceLibrary ...@@ -398,13 +400,15 @@ namespace OnlineStore.DeviceLibrary
//MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(300000)); //MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(300000));
//MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(200)); //MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(200));
GetResultTask = Task.Factory.StartNew(delegate { GetResultTask = Task.Factory.StartNew(delegate
{
try try
{ {
if (xRay.IsRayOpen) if (xRay.IsRayOpen)
{ {
xRay.Stop(); xRay.Stop();
} }
InXWork = false; InXWork = false;
WorkLog("点料:停止X射线,设置 InXWork = false,开始获取点料结果"); WorkLog("点料:停止X射线,设置 InXWork = false,开始获取点料结果");
bool isNg = false; bool isNg = false;
...@@ -414,11 +418,12 @@ namespace OnlineStore.DeviceLibrary ...@@ -414,11 +418,12 @@ namespace OnlineStore.DeviceLibrary
if (lastParam == null) if (lastParam == null)
{ {
lastParam = new CountParam("", ThresholdValue, 3); lastParam = new CountParam("", ThresholdValue, 3);
WorkLog("点料:" + "NG:未找到元器件类型,PN[" + ParamManager.GetCodeStrPN(Work_ReelInfo.WareCode) + "]");
BackNoConfigImg(ParamManager.GetCodeStrPN(Work_ReelInfo.WareCode));
} }
if (lastParam != null)
{
string fileP = path1_tif + @"\" + lastFileName; string fileP = path1_tif + @"\" + lastFileName;
count = GetCountResult(fileP, lastParam, out Asa.API.EyemImage tpDstImg); count = GetCountResult(fileP, lastParam,out _);
if (count < ResultMinCount) if (count < ResultMinCount)
{ {
isNg = true; isNg = true;
...@@ -441,14 +446,8 @@ namespace OnlineStore.DeviceLibrary ...@@ -441,14 +446,8 @@ namespace OnlineStore.DeviceLibrary
NgMsg = msg; NgMsg = msg;
} }
} }
}
else
{
isNg = true;
NgMsg = "NG:未找到元器件类型,PN[" +ParamManager. GetCodeStrPN(Work_ReelInfo.WareCode) + "]";
WorkLog("点料:" + NgMsg);
BackNoConfigImg();
}
string outF = path2_out + lastFileName; string outF = path2_out + lastFileName;
if (!isNg) if (!isNg)
...@@ -521,7 +520,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -521,7 +520,7 @@ namespace OnlineStore.DeviceLibrary
LogUtil.error(Name + "carerayImage.GetImage 获取图片失败 = " + imgResult + ", carerayImage.Close 失败"); LogUtil.error(Name + "carerayImage.GetImage 获取图片失败 = " + imgResult + ", carerayImage.Close 失败");
} }
} }
carerayImageError = !imgResult;
carerayImage.WindowWidth = Config.WindowWidth; carerayImage.WindowWidth = Config.WindowWidth;
carerayImage.WindowLevel = Config.WindowLevel; carerayImage.WindowLevel = Config.WindowLevel;
if (imgResult) if (imgResult)
...@@ -552,12 +551,15 @@ namespace OnlineStore.DeviceLibrary ...@@ -552,12 +551,15 @@ namespace OnlineStore.DeviceLibrary
{ {
WorkLog("点料:获取X射线图形,获取图片失败,carerayImage.Get48bImage()=null"); WorkLog("点料:获取X射线图形,获取图片失败,carerayImage.Get48bImage()=null");
LogUtil.error(Name + " 获取图片失败,carerayImage.Get48bImage()=null"); LogUtil.error(Name + " 获取图片失败,carerayImage.Get48bImage()=null");
lastFileName = "";
} }
} }
else else
{ {
WorkLog("点料:获取X射线图形,获取图片失败,carerayImage.GetImage()=" + imgResult); WorkLog("点料:获取X射线图形,获取图片失败,carerayImage.GetImage()=" + imgResult);
LogUtil.error(Name + " 获取图片失败,carerayImage.GetImage()=" + imgResult); LogUtil.error(Name + " 获取图片失败,carerayImage.GetImage()=" + imgResult);
lastFileName = "";
} }
bool result = xRay.Stop(); bool result = xRay.Stop();
if (!result) if (!result)
...@@ -603,22 +605,25 @@ namespace OnlineStore.DeviceLibrary ...@@ -603,22 +605,25 @@ namespace OnlineStore.DeviceLibrary
} }
private void BackNoConfigImg() private void BackNoConfigImg(string pn)
{ {
//将未找到料号配置的图片保存到新的文件夹 //将未找到料号配置的图片保存到新的文件夹
string fileP = path1_tif + @"\" + lastFileName; string fileP = path1_tif + @"\" + lastFileName;
string backPath = ParamManager.NoConfigPath ; string backPath = ParamManager.NoConfigPath ;
string backFile = backPath + lastFileName; string backFile = Path.Combine(backPath, pn + ".png");
try try
{ {
if (!Directory.Exists(backPath)) if (!Directory.Exists(backPath))
{ {
Directory.CreateDirectory(backPath); Directory.CreateDirectory(backPath);
} }
if (!File.Exists(backFile))
{
System.IO.File.Copy(fileP, backFile); System.IO.File.Copy(fileP, backFile);
LogUtil.info("BackNoConfigImg 【" + fileP + "】 -> 【" + backFile + "】"); LogUtil.info("BackNoConfigImg 【" + fileP + "】 -> 【" + backFile + "】");
} }
}
catch (Exception ex) catch (Exception ex)
{ {
LogUtil.error("X图片备份到【" + backFile + "】错误:" + ex.ToString()); LogUtil.error("X图片备份到【" + backFile + "】错误:" + ex.ToString());
...@@ -626,52 +631,46 @@ namespace OnlineStore.DeviceLibrary ...@@ -626,52 +631,46 @@ namespace OnlineStore.DeviceLibrary
} }
public int GetCountResult(string fileP, CountParam param, out Asa.API.EyemImage tpDstImg) public int GetCountResult(string fileP, CountParam param, out string resfile)
{ {
// 器件类型
//"小器件" GetLocalCount
//"粘连不严重" GetLocalCountIrregular type = 0
//"大器件" GetLocalCountIrregular type = 1
//"长条型器件" GetLocalCountIrregular type = 2
//"E形状" GetLocalCountIrregular type = 3
//返回的数量是string类型,count = "4000,3000,3500,2000" //返回的数量是string类型,count = "4000,3000,3500,2000"
int count = 0; int count = 0;
tpDstImg = new API.EyemImage(); resfile = "";
//tpDstImg = new API.EyemImage();
try try
{ {
string countStr = ""; string countStr = "";
int result = 0; int result = 0;
int type = param.Sign; CountParam.SignType type = param.Sign;
int threshold = param.Threshold; int threshold = param.Threshold;
int windowsize = param.WindowSize; int windowsize = param.WindowSize; ;
/* if (param.Sign == CountParam.SignType.AUTO)
if (param.Sign.Equals(0))
{ {
result = carerayImage.GetLocalCount(fileP, threshold, windowsize, out countStr, out tpDstImg); result = carerayImage.GetLocalCount(fileP, threshold, windowsize, out countStr, out _);
LogUtil.info("GetCountResult " + type + " 调用 GetLocalCount 【" + fileP + "】【" + threshold + "】【" + windowsize + "】,返回【" + result + "】,结果【" + countStr + "】"); LogUtil.info("GetCountResult " + type + " 调用 GetLocalCount 【" + fileP + "】【" + threshold + "】【" + windowsize + "】,返回【" + result + "】,结果【" + countStr + "】");
} }
else else {
{ result = carerayImage.GetLocalCountIrregular(fileP, threshold, type.ToString(), windowsize, out countStr, out _);
int t = param.Sign ; LogUtil.info("GetCountResult " + type + " 调用 GetLocalCountIrregular 【" + fileP + "】【" + threshold + "】【" + windowsize + "】,返回【" + result + "】,结果【" + countStr + "】");
result = carerayImage.GetLocalCountIrregular(fileP, threshold, t, windowsize, out countStr, out tpDstImg);
LogUtil.info("GetCountResult " + type + " 调用 GetLocalCountIrregular 【" + fileP + "】【" + threshold + "】[" + t + "]【" + windowsize + "】,返回【" + result + "】,结果【" + countStr + "】");
} }
string[] array = countStr.Split(','); if (countStr != null)
if (array.Length > 0)
{ {
count= Convert.ToInt32(array[0]);
}*/
result = carerayImage.GetLocalCount(fileP, threshold, windowsize, out countStr, out tpDstImg);
LogUtil.info("GetCountResult " + type + " 调用 GetLocalCount 【" + fileP + "】【" + threshold + "】【" + windowsize + "】,返回【" + result + "】,结果【" + countStr + "】");
string[] array = countStr.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); string[] array = countStr.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
count = (from a in array where int.TryParse(a, out _) && int.Parse(a) > 0 select int.Parse(a)).FirstOrDefault(); count = (from a in array where int.TryParse(a, out _) && int.Parse(a) > 0 select int.Parse(a)).FirstOrDefault();
}
else {
count = 0;
}
string resfilename = Path.GetFileNameWithoutExtension(fileP)+ "-Mark.png"; string resfilename = Path.GetFileNameWithoutExtension(fileP)+ "-Mark.png";
string root = Path.Combine(Application.StartupPath, "ResOut"); string root = Path.Combine(Application.StartupPath, "ResOut");
var n = DateTime.Now; var n = DateTime.Now;
string destdir = Path.Combine(root, n.Year.ToString() + "-" + n.Month.ToString(), n.Day.ToString(), n.Hour.ToString()); string destdir = Path.Combine(root, n.Year.ToString() + "-" + n.Month.ToString(), n.Day.ToString(), n.Hour.ToString());
Directory.CreateDirectory(destdir); Directory.CreateDirectory(destdir);
Directory.Move(Path.Combine(root, resfilename), Path.Combine(destdir, resfilename)); resfile = Path.Combine(destdir, resfilename);
if (File.Exists(resfile))
File.Delete(resfile);
Directory.Move(Path.Combine(root, resfilename), resfile);
} }
catch (Exception ex) catch (Exception ex)
{ {
...@@ -686,7 +685,6 @@ namespace OnlineStore.DeviceLibrary ...@@ -686,7 +685,6 @@ namespace OnlineStore.DeviceLibrary
Bitmap bit = null; Bitmap bit = null;
return bit; return bit;
} }
#endregion #endregion
} }
} }
\ No newline at end of file \ No newline at end of file
...@@ -8,6 +8,7 @@ using System.Linq; ...@@ -8,6 +8,7 @@ using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
using static OnlineStore.DeviceLibrary.CountParam;
namespace OnlineStore.DeviceLibrary namespace OnlineStore.DeviceLibrary
{ {
...@@ -16,14 +17,19 @@ namespace OnlineStore.DeviceLibrary ...@@ -16,14 +17,19 @@ namespace OnlineStore.DeviceLibrary
public static string NoConfigPath = @"D:\NoConfigImg\"; public static string NoConfigPath = @"D:\NoConfigImg\";
private static Dictionary<string, CountParam> countParamMap = new Dictionary<string, CountParam>(); private static Dictionary<string, CountParam> countParamMap = new Dictionary<string, CountParam>();
private static string ConfigFilePath = ""; private static string ConfigFilePath = "";
internal static void Init() public static void Init()
{ {
ConfigFilePath = Application.StartupPath + ConfigAppSettings.GetValue(Setting_Init.CounParamConfig); ConfigFilePath = Application.StartupPath + ConfigAppSettings.GetValue(Setting_Init.CounParamConfig);
countParamMap = LoadParamMap( ); countParamMap = LoadParamMap();
} }
public static string GetSufanStr(int type) public static string GetSufanStr(int type)
{ {
SignType sign=SignType.AUTO;
Enum.TryParse<SignType>(type.ToString(), out sign);
return GetSufanStr(sign);
}
public static string GetSufanStr(SignType type)
{
if (type.Equals(0)) if (type.Equals(0))
{ {
return "算法A"; return "算法A";
...@@ -44,7 +50,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -44,7 +50,7 @@ namespace OnlineStore.DeviceLibrary
{ {
return "算法E"; return "算法E";
} }
return ""; return "默认算法";
} }
public static CountParam GetParamByPN(string pn) public static CountParam GetParamByPN(string pn)
{ {
...@@ -190,7 +196,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -190,7 +196,7 @@ namespace OnlineStore.DeviceLibrary
List<ComponetInfo> FZList = new List<ComponetInfo>(); List<ComponetInfo> FZList = new List<ComponetInfo>();
Dictionary<int, int> sufaCount = new Dictionary<int, int>(); Dictionary<int, int> sufaCount = new Dictionary<int, int>();
int maxSufa = -1; SignType maxSufa = SignType.AUTO;
int maxCount = 0; int maxCount = 0;
foreach (ComponetInfo obj in CSVBomManager.allComMap.Values) foreach (ComponetInfo obj in CSVBomManager.allComMap.Values)
{ {
...@@ -199,7 +205,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -199,7 +205,7 @@ namespace OnlineStore.DeviceLibrary
CountParam p = GetParamByPN(obj.PartNum); CountParam p = GetParamByPN(obj.PartNum);
if (p != null) if (p != null)
{ {
obj.Sufan = p.Sign; obj.Sufan = (int)p.Sign;
if (sufaCount.ContainsKey(obj.Sufan)) if (sufaCount.ContainsKey(obj.Sufan))
{ {
...@@ -213,7 +219,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -213,7 +219,7 @@ namespace OnlineStore.DeviceLibrary
if (sufaCount[obj.Sufan] > maxCount) if (sufaCount[obj.Sufan] > maxCount)
{ {
maxCount = sufaCount[obj.Sufan]; maxCount = sufaCount[obj.Sufan];
maxSufa = obj.Sufan; Enum.TryParse<SignType>(obj.Sufan.ToString(),out maxSufa);
} }
} }
FZList.Add(obj); FZList.Add(obj);
...@@ -244,7 +250,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -244,7 +250,7 @@ namespace OnlineStore.DeviceLibrary
} }
public class CountParam public class CountParam
{ {
public CountParam(string pn, int th = 0, int size = 0, int sign = 0, int value = 0) public CountParam(string pn, int th = 0, int size = 0, SignType sign=SignType.AUTO, int value = 0)
{ {
this.PN = pn; this.PN = pn;
this.Threshold = th; this.Threshold = th;
...@@ -256,12 +262,12 @@ namespace OnlineStore.DeviceLibrary ...@@ -256,12 +262,12 @@ namespace OnlineStore.DeviceLibrary
public int Threshold = 0; public int Threshold = 0;
public int WindowSize = 0; public int WindowSize = 0;
public string AreaValue = ""; public string AreaValue = "";
public int Sign = 0; public SignType Sign = 0;
public int Value = 0; public int Value = 0;
public string ToStr() public string ToStr()
{ {
return "【PN=" + PN + ",sign=" + Sign + ",value=" + Value + ",th=" + Threshold + ",wsize=" + WindowSize + "】"; return "【PN=" + PN + ",sign=" + Sign.ToString()+ ",value=" + Value + ",th=" + Threshold + ",wsize=" + WindowSize + "】";
} }
public string ToCSVStr() public string ToCSVStr()
{ {
...@@ -277,7 +283,9 @@ namespace OnlineStore.DeviceLibrary ...@@ -277,7 +283,9 @@ namespace OnlineStore.DeviceLibrary
if (array.Length >= 5) if (array.Length >= 5)
{ {
string pn = array[0].Trim(); string pn = array[0].Trim();
int sign = Convert.ToInt32(array[1].Trim()); SignType sign = SignType.AUTO;
Enum.TryParse<SignType>(array[1].Trim(), out sign);
int value = Convert.ToInt32(array[2].Trim()); int value = Convert.ToInt32(array[2].Trim());
int th = Convert.ToInt32(array[3].Trim()); int th = Convert.ToInt32(array[3].Trim());
int size = Convert.ToInt32(array[4].Trim()); int size = Convert.ToInt32(array[4].Trim());
...@@ -290,7 +298,15 @@ namespace OnlineStore.DeviceLibrary ...@@ -290,7 +298,15 @@ namespace OnlineStore.DeviceLibrary
return null; return null;
} }
public enum SignType
{
IP_SMALL_PARTS=0,
IP_LARGE_PARTS = 1,
IP_LONG_PARTS = 2,
IP_SQUARE_PARTS = 3,
IP_GEN_PARTS = 4,
AUTO = 99,
}
internal static string GetCSVTitle() internal static string GetCSVTitle()
{ {
return "type,sign,value,threshold,windowSize"; return "type,sign,value,threshold,windowSize";
......
...@@ -275,7 +275,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -275,7 +275,7 @@ namespace OnlineStore.DeviceLibrary
if (IOManager.IOValue(TargetIoType, 0).Equals(TargetIoValue)) if (IOManager.IOValue(TargetIoType, 0).Equals(TargetIoValue))
{ {
AxisStopCheckMove(); AxisStopCheckMove();
LogUtil.info(AxisName + "上料轴,检测到 " + TargetIoType + "=" + TargetIoValue + ",停止运动"); LogUtil.info(AxisName + "上料轴,检测到 " + TargetIoType + "=" + TargetIoValue + ",停止运动,AclPosition=" + GetAclPosition().ToString());
SuddenStop(); SuddenStop();
} }
} }
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!