Commit 9475593b LN

修改点料方式

1 个父辈 b19dbc38
...@@ -58,6 +58,10 @@ ...@@ -58,6 +58,10 @@
<AutoGenerateBindingRedirects>false</AutoGenerateBindingRedirects> <AutoGenerateBindingRedirects>false</AutoGenerateBindingRedirects>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<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>
......
...@@ -38,7 +38,7 @@ namespace OnlineStore.AutoCountClient ...@@ -38,7 +38,7 @@ namespace OnlineStore.AutoCountClient
chbDebug.Checked = equipBean.IsDebug; chbDebug.Checked = equipBean.IsDebug;
lblCom.Text = "X射线端口号:" + equipBean.Config.XRay_Port; lblCom.Text = "X射线端口号:" + equipBean.Config.XRay_Port;
lblDianl.Text = "电流:" + equipBean.Config.XRay_Electricity ; lblDianl.Text = "电流:" + equipBean.Config.XRay_Electricity;
lblDiany.Text = "电压:" + equipBean.Config.XRay_Voltage; lblDiany.Text = "电压:" + equipBean.Config.XRay_Voltage;
//lblDiany.Text = "窗宽:" + equipBean.Config.WindowWidth + ",窗位:" + equipBean.Config.WindowLevel; //lblDiany.Text = "窗宽:" + equipBean.Config.WindowWidth + ",窗位:" + equipBean.Config.WindowLevel;
lblData.Text = "最后使用时间:" + ConfigAppSettings.GetValue(Setting_Init.XRay_Data); lblData.Text = "最后使用时间:" + ConfigAppSettings.GetValue(Setting_Init.XRay_Data);
...@@ -425,14 +425,18 @@ namespace OnlineStore.AutoCountClient ...@@ -425,14 +425,18 @@ namespace OnlineStore.AutoCountClient
try try
{ {
txtResult.Text = "点料中..."; txtResult.Text = "点料中...";
int th =(int) numTh.Value; int th = (int)numTh.Value;
int outCount = 0; int outCount = 0;
equipBean.countImage.GetCount(th, out outCount); // equipBean.countImage.GetCount(th, out outCount);
int n = equipBean.carerayImage.GetCount(2, 3, out outCount, out Asa.API.EyemImage tpDstImg);
txtResult.Text = outCount.ToString(); txtResult.Text = outCount.ToString();
LogUtil.info(equipBean.Name + "用户点击 点料测试["+ th + "] 结果:"+outCount); LogUtil.info(equipBean.Name + "用户点击 点料测试 结果[" + n + "]:" + outCount);
} }
catch (Exception ex) catch (Exception ex)
{ {
MessageBox.Show(ex.ToString());
LogUtil.error("点料测试出错:" + ex.ToString()); LogUtil.error("点料测试出错:" + ex.ToString());
} }
btnWorkTest.Enabled = true; btnWorkTest.Enabled = true;
...@@ -443,8 +447,8 @@ namespace OnlineStore.AutoCountClient ...@@ -443,8 +447,8 @@ namespace OnlineStore.AutoCountClient
int th = (int)numTh.Value; int th = (int)numTh.Value;
ConfigAppSettings.SaveValue(Setting_Init.ThresholdValue, th); ConfigAppSettings.SaveValue(Setting_Init.ThresholdValue, th);
equipBean.ThresholdValue = th; equipBean.ThresholdValue = th;
MessageBox.Show("保存阈值["+th+"]成功!"); MessageBox.Show("保存阈值[" + th + "]成功!");
LogUtil.info( "用户点击:保存阈值[" + th + "]成功!"); LogUtil.info("用户点击:保存阈值[" + th + "]成功!");
} }
} }
......
...@@ -25,7 +25,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -25,7 +25,7 @@ namespace OnlineStore.DeviceLibrary
public XRay xRay = null; public XRay xRay = null;
public CountImage countImage = null; // public CountImage countImage = null;
public CarerayImage carerayImage = null; public CarerayImage carerayImage = null;
public bool xRayCanStart = false; public bool xRayCanStart = false;
...@@ -66,15 +66,15 @@ namespace OnlineStore.DeviceLibrary ...@@ -66,15 +66,15 @@ namespace OnlineStore.DeviceLibrary
{ {
try try
{ {
countImage = new CountImage("Count"); //countImage = new CountImage("Count");
countImage.SetDirectory(path1_tif, path2_out, path3_area); //countImage.SetDirectory(path1_tif, path2_out, path3_area);
LogUtil.info(Name + "CountImage path1【" + path1_tif + "】"); //LogUtil.info(Name + "CountImage path1【" + path1_tif + "】");
LogUtil.info(Name + "CountImage path2【" + path2_out + "】"); //LogUtil.info(Name + "CountImage path2【" + path2_out + "】");
LogUtil.info(Name + "CountImage path3【" + path3_area + "】"); //LogUtil.info(Name + "CountImage path3【" + path3_area + "】");
LogUtil.info(Name + "CountImage SetDirectory: 完成"); //LogUtil.info(Name + "CountImage SetDirectory: 完成");
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);
xRay = new XRay("XRay"); xRay = new XRay("XRay");
...@@ -174,6 +174,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -174,6 +174,7 @@ namespace OnlineStore.DeviceLibrary
} }
} }
#region 启动,复位,停止
public override bool StartRun() public override bool StartRun()
{ {
if (CanStartRun().Equals(false)) if (CanStartRun().Equals(false))
...@@ -308,8 +309,9 @@ namespace OnlineStore.DeviceLibrary ...@@ -308,8 +309,9 @@ namespace OnlineStore.DeviceLibrary
StopMove(); StopMove();
runStatus = RobotRunStatus.Wait; runStatus = RobotRunStatus.Wait;
} }
#endregion
#region 定时器
protected override void BaseTimerProcess() protected override void BaseTimerProcess()
{ {
if (isInSuddenDown || isNoAirCheck) if (isInSuddenDown || isNoAirCheck)
...@@ -326,10 +328,12 @@ namespace OnlineStore.DeviceLibrary ...@@ -326,10 +328,12 @@ namespace OnlineStore.DeviceLibrary
StartWorking(new WorkParam()); StartWorking(new WorkParam());
} }
} }
LockOnProcess();
}
#endregion
LockOnProcess(); #region 互锁信号处理
}
private void LockOnProcess() private void LockOnProcess()
{ {
...@@ -374,6 +378,9 @@ namespace OnlineStore.DeviceLibrary ...@@ -374,6 +378,9 @@ namespace OnlineStore.DeviceLibrary
return false; return false;
} }
#endregion
public override string GetMoveStr() public override string GetMoveStr()
{ {
string msg = ""; string msg = "";
......
...@@ -80,6 +80,8 @@ namespace OnlineStore.DeviceLibrary ...@@ -80,6 +80,8 @@ namespace OnlineStore.DeviceLibrary
return false; return false;
} }
protected override void WorkingProcess() protected override void WorkingProcess()
{ {
if (MoveInfo.IsInWait) if (MoveInfo.IsInWait)
...@@ -303,11 +305,8 @@ namespace OnlineStore.DeviceLibrary ...@@ -303,11 +305,8 @@ namespace OnlineStore.DeviceLibrary
InXWork = true; InXWork = true;
bool result = xRay.Start(); bool result = xRay.Start();
WorkLog("料盘处理:启动X射线[" + result + "],等待1秒"); WorkLog("料盘处理:启动X射线[" + result + "],等待1秒");
} }
private string lastFileName = "";
private int lastTh = 0;
private void XW13_GetXRayImage() private void XW13_GetXRayImage()
{ {
if (IOValue(IO_Type.X_Lock_On).Equals(IO_VALUE.LOW)) if (IOValue(IO_Type.X_Lock_On).Equals(IO_VALUE.LOW))
...@@ -318,10 +317,15 @@ namespace OnlineStore.DeviceLibrary ...@@ -318,10 +317,15 @@ namespace OnlineStore.DeviceLibrary
MoveInfo.NextMoveStep(StepEnum.XW13_GetXRayImage); MoveInfo.NextMoveStep(StepEnum.XW13_GetXRayImage);
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(8000)); MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(8000));
WorkLog("点料:清理" + path1_tif + "内容,开始获取X射线图形 "); WorkLog("点料:清理" + path1_tif + "内容,开始获取X射线图形 ");
CapImage(); CapImage();
MoveInfo.EndStepWait(); MoveInfo.EndStepWait();
} }
#endregion
#region 点料处理
private string lastFileName = "";
private int lastTh = 0;
private void XW15_GetResult() private void XW15_GetResult()
{ {
...@@ -337,9 +341,13 @@ namespace OnlineStore.DeviceLibrary ...@@ -337,9 +341,13 @@ namespace OnlineStore.DeviceLibrary
xRay.Stop(); xRay.Stop();
} }
int count = 99999; int count = 99999;
//WorkLog("点料:开始调用 countImage.GetCount ");
//bool result = countImage.GetCount(lastTh, out count);
//WorkLog("点料:获取点料结果[" + lastTh + "]=【" + count + "】,result=" + result + ",保存并上传结果");
WorkLog("点料:开始调用 countImage.GetCount "); WorkLog("点料:开始调用 countImage.GetCount ");
bool result = countImage.GetCount(lastTh, out count); int n = carerayImage.GetCount(2, 3, out count, out Asa.API.EyemImage tpDstImg);
WorkLog("点料:获取点料结果[" + lastTh + "]=【" + count + "】,result=" + result + ",保存并上传结果"); WorkLog("点料:获取点料结果 【" + count + "】,n =" + n + ",保存并上传结果");
if (Work_ReelInfo.WareCount <= 0) if (Work_ReelInfo.WareCount <= 0)
{ {
...@@ -347,6 +355,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -347,6 +355,7 @@ namespace OnlineStore.DeviceLibrary
Work_ReelInfo.WareCount = count; Work_ReelInfo.WareCount = count;
} }
string outF = path2_out + lastFileName; string outF = path2_out + lastFileName;
try try
{ {
...@@ -388,7 +397,25 @@ namespace OnlineStore.DeviceLibrary ...@@ -388,7 +397,25 @@ namespace OnlineStore.DeviceLibrary
ConfigAppSettings.SaveValue(Setting_Init.XRay_Data, lastData); ConfigAppSettings.SaveValue(Setting_Init.XRay_Data, lastData);
ClearFilePath(); ClearFilePath();
//取图失败关掉重开。
bool imgResult = carerayImage.GetImage(); bool imgResult = carerayImage.GetImage();
if (!imgResult)
{
bool closeR = carerayImage.Close();
if (closeR)
{
bool openR = carerayImage.Open();
LogUtil.error(Name + "carerayImage.GetImage 获取图片失败 = " + imgResult + ", carerayImage.Close 成功 ,重新打开并获取图片");
imgResult = carerayImage.GetImage();
}
else
{
LogUtil.error(Name + "carerayImage.GetImage 获取图片失败 = " + imgResult + ", carerayImage.Close 失败");
}
}
carerayImage.WindowWidth = Config.WindowWidth; carerayImage.WindowWidth = Config.WindowWidth;
carerayImage.WindowLevel = Config.WindowLevel; carerayImage.WindowLevel = Config.WindowLevel;
if (imgResult) if (imgResult)
...@@ -443,6 +470,8 @@ namespace OnlineStore.DeviceLibrary ...@@ -443,6 +470,8 @@ namespace OnlineStore.DeviceLibrary
} }
return lastFileName; return lastFileName;
} }
private void UpdateArea(string codeStr) private void UpdateArea(string codeStr)
{ {
lastTh = ThresholdValue; lastTh = ThresholdValue;
...@@ -456,12 +485,13 @@ namespace OnlineStore.DeviceLibrary ...@@ -456,12 +485,13 @@ namespace OnlineStore.DeviceLibrary
{ {
area = countParamMap[pn].AreaValue; area = countParamMap[pn].AreaValue;
fileValue = lastFileName + " " + area; fileValue = lastFileName + " " + area;
lastTh = countParamMap[pn].Threshold; lastTh = countParamMap[pn].Threshold;
} }
} }
LogUtil.info("【" + codeStr + "】使用参数【" + lastTh + "】【" + area + "】,文件名【" + lastFileName + "】内容【"+fileValue+"】"); LogUtil.info("【" + codeStr + "】使用参数【" + lastTh + "】【" + area + "】,文件名【" + lastFileName + "】内容【" + fileValue + "】");
File.WriteAllText(path3_area, fileValue); File.WriteAllText(path3_area, fileValue);
} }
private void ClearFilePath() private void ClearFilePath()
{ {
try try
...@@ -477,7 +507,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -477,7 +507,7 @@ namespace OnlineStore.DeviceLibrary
} }
try try
{ {
System.IO.Directory.CreateDirectory(path1_tif+@"\"); System.IO.Directory.CreateDirectory(path1_tif + @"\");
} }
catch (Exception ex) catch (Exception ex)
{ {
...@@ -486,10 +516,6 @@ namespace OnlineStore.DeviceLibrary ...@@ -486,10 +516,6 @@ namespace OnlineStore.DeviceLibrary
} }
private bool IsInStoreNeed()
{
return false;
}
#endregion #endregion
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!