Commit 9475593b LN

修改点料方式

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