Commit cbf0aa24 LN

历史记录查询修改

1 个父辈 9475593b
5S1 2 3
6C1D1 2 5
6D551 2 7
7H5S1 2 3
...@@ -31,8 +31,9 @@ namespace OnlineStore.AutoCountClient ...@@ -31,8 +31,9 @@ namespace OnlineStore.AutoCountClient
} }
else else
{ {
DateTime time1 = DateTime.Now.AddDays(-4); DateTime time1 = DateTime.Now.AddHours(-6);
dtpStartTime.Value = new DateTime(time1.Year, time1.Month, time1.Day, 0, 0, 0); //dtpStartTime.Value = new DateTime(time1.Year, time1.Month, time1.Day, 0, 0, 0);
dtpStartTime.Value = time1;
DateTime time = DateTime.Now.AddDays(-1); DateTime time = DateTime.Now.AddDays(-1);
dtpEndTime.Value = new DateTime(time.Year, time.Month, time.Day, 23, 59, 59); dtpEndTime.Value = new DateTime(time.Year, time.Month, time.Day, 23, 59, 59);
dtpEndTime.Value = DateTime.Now; dtpEndTime.Value = DateTime.Now;
...@@ -66,10 +67,16 @@ namespace OnlineStore.AutoCountClient ...@@ -66,10 +67,16 @@ namespace OnlineStore.AutoCountClient
PreStartTime = startTime; PreStartTime = startTime;
PreEndTime = endTime; PreEndTime = endTime;
string code = txtCode.Text.Trim(); string code = txtCode.Text.Trim();
try
{
lastList = new List<XRayHistory>(); lastList = new List<XRayHistory>();
string[][] array = null; string[][] array = null;
bool result = RobotManager.robot.sQLite.Select(code, startTime.ToString(), endTime.ToString(), out array); string str = "yyyy-MM-dd HH:mm:ss";
LogUtil.error("查数据【" + code + "】【" + startTime.ToString() + "】【" + endTime.ToString() + "】结果:" + result + "," + RobotManager.robot.sQLite.ErrInfo); string startStr = startTime.ToString(str);
string endStr = endTime.ToString(str);
bool result = RobotManager.robot.sQLite.Select(code, startStr,endStr, out array);
LogUtil.error("查数据【" + code + "】【" + startStr + "】【" + endStr + "】结果:" + result + "," + RobotManager.robot.sQLite.ErrInfo);
if (array != null && array.Length > 0) if (array != null && array.Length > 0)
{ {
LogUtil.info("共查询到【" + array.Length + "】行数据"); LogUtil.info("共查询到【" + array.Length + "】行数据");
...@@ -81,27 +88,27 @@ namespace OnlineStore.AutoCountClient ...@@ -81,27 +88,27 @@ namespace OnlineStore.AutoCountClient
DataGridViewRow view = new DataGridViewRow(); DataGridViewRow view = new DataGridViewRow();
view.CreateCells(dataGridView1); view.CreateCells(dataGridView1);
view.Cells[0].Value = index; view.Cells[0].Value = index;
if (a.Length >= 6)
lastList.Add(new XRayHistory(index, a[0], a[1], a[2], a[3], a[4]));
for (int i = 1; i < a.Length; i++)
{ {
view.Cells[i].Value = a[i]; XRayHistory his = new XRayHistory(index, a[0], a[1], a[2], a[3], a[4], a[5]);
lastList.Add(his);
view.Cells[Column_Code.Index] .Value= his.Code;
view.Cells[Column_Count.Index].Value = his.Count;
view.Cells[Column_Data.Index].Value = his.DataStr;
view.Cells[Column_Height.Index].Value = his.Height;
view.Cells[Column_Width.Index].Value = his.Width;
view.Cells[Column_ImageName.Index].Value = his.FileName;
} }
//view.Cells[0].Value = point.pointNum.ToString();
//view.Cells[1].Value = point.PartNum.ToString();
//view.Cells[2].Value = point.pointName;
//view.Cells[3].Value = point.PositionX.ToString();
//view.Cells[4].Value = point.PositionY.ToString();
//view.Cells[5].Value = point.NodePositionX.ToString();
//view.Cells[6].Value = point.NodePositionY.ToString();
//view.Cells[7].Value = point.PositionNum.ToString();
//view.Cells[8].Value = point.NeedSoldering;
//view.Cells[9].Value = point.WeldTemp;
dataGridView1.Rows.Add(view); dataGridView1.Rows.Add(view);
index++; index++;
} }
} }
}catch(Exception ex)
{
LogUtil.error("查询数据出错:" + ex.ToString());
}
} }
private void btnBack_Click(object sender, EventArgs e) private void btnBack_Click(object sender, EventArgs e)
{ {
...@@ -129,7 +136,7 @@ namespace OnlineStore.AutoCountClient ...@@ -129,7 +136,7 @@ namespace OnlineStore.AutoCountClient
} }
List<string> list = new List<string>(); List<string> list = new List<string>();
list.Add("编号,条码,高度,宽度,数量,图片文件名"); list.Add("编号,条码,高度,宽度,数量,图片文件名,时间");
foreach(XRayHistory obj in lastList) foreach(XRayHistory obj in lastList)
{ {
list.Add(obj.ToCSVStr()); list.Add(obj.ToCSVStr());
...@@ -150,13 +157,14 @@ namespace OnlineStore.AutoCountClient ...@@ -150,13 +157,14 @@ namespace OnlineStore.AutoCountClient
public class XRayHistory public class XRayHistory
{ {
public XRayHistory(int num,string code, string h, string w, string c, string fname) public XRayHistory(int num,string code, string h, string w, string c, string fname,string dataStr)
{ {
this.Code = code; this.Code = code;
this.Height = h; this.Height = h;
this.Width = w; this.Width = w;
this.Count = c; this.Count = c;
this.FileName = fname; this.FileName = fname;
this.DataStr = dataStr;
} }
public int Num = 0; public int Num = 0;
...@@ -169,10 +177,11 @@ namespace OnlineStore.AutoCountClient ...@@ -169,10 +177,11 @@ namespace OnlineStore.AutoCountClient
public string Count = ""; public string Count = "";
public string FileName = ""; public string FileName = "";
public string DataStr = "";
public string ToCSVStr() public string ToCSVStr()
{ {
return Num+","+ Code + "," + Height + "," + Width + "," + Count + "," + FileName + ","; return Num+","+ Code + "," + Height + "," + Width + "," + Count + "," + FileName + ","+DataStr;
} }
} }
} }
...@@ -123,33 +123,18 @@ ...@@ -123,33 +123,18 @@
<metadata name="Column_Code.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <metadata name="Column_Code.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value> <value>True</value>
</metadata> </metadata>
<metadata name="Column_Width.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <metadata name="Column_Data.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Column_Height.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value> <value>True</value>
</metadata> </metadata>
<metadata name="Column_Count.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <metadata name="Column_Count.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value> <value>True</value>
</metadata> </metadata>
<metadata name="Column_ImageName.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Column_Num.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Column_Code.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Column_Width.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <metadata name="Column_Width.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value> <value>True</value>
</metadata> </metadata>
<metadata name="Column_Height.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <metadata name="Column_Height.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value> <value>True</value>
</metadata> </metadata>
<metadata name="Column_Count.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Column_ImageName.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <metadata name="Column_ImageName.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value> <value>True</value>
</metadata> </metadata>
......
...@@ -424,15 +424,22 @@ namespace OnlineStore.AutoCountClient ...@@ -424,15 +424,22 @@ namespace OnlineStore.AutoCountClient
btnWorkTest.Enabled = false; btnWorkTest.Enabled = false;
try try
{ {
string filePath = txtImage.Text.Trim();
if (!File.Exists(filePath))
{
MessageBox.Show("请先选择正确的图片");
return;
}
txtResult.Text = "点料中..."; txtResult.Text = "点料中...";
int th = (int)numTh.Value; int th = (int)numTh.Value;
int wsize = (int)numWSize.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); int n = equipBean.carerayImage.GetLocalCount(filePath, th, wsize, out outCount, out Asa.API.EyemImage tpDstImg);
txtResult.Text = outCount.ToString(); txtResult.Text = outCount.ToString();
LogUtil.info(equipBean.Name + "用户点击 点料测试 结果[" + n + "]:" + outCount); LogUtil.info(equipBean.Name + "用户点击 点料测试【" + filePath + "】【" + th + "】【" + wsize + "】 结果[" + n + "]:" + outCount);
} }
catch (Exception ex) catch (Exception ex)
{ {
...@@ -450,6 +457,21 @@ namespace OnlineStore.AutoCountClient ...@@ -450,6 +457,21 @@ namespace OnlineStore.AutoCountClient
MessageBox.Show("保存阈值[" + th + "]成功!"); MessageBox.Show("保存阈值[" + th + "]成功!");
LogUtil.info("用户点击:保存阈值[" + th + "]成功!"); LogUtil.info("用户点击:保存阈值[" + th + "]成功!");
} }
private void btnSelImage_Click(object sender, EventArgs e)
{
System.Windows.Forms.OpenFileDialog openDialog = new System.Windows.Forms.OpenFileDialog();
openDialog.Title = "请选择要点料的图片";
openDialog.Filter = "(*.png)|*.png";
openDialog.DefaultExt = "png";
openDialog.InitialDirectory = Application.StartupPath + @"\XRAY\tif";
System.Windows.Forms.DialogResult result = openDialog.ShowDialog();
if (result == System.Windows.Forms.DialogResult.Cancel)
{
return;
}
txtImage.Text = openDialog.FileName;
}
} }
} }
......
...@@ -120,6 +120,9 @@ ...@@ -120,6 +120,9 @@
<metadata name="timer1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <metadata name="timer1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 11</value> <value>17, 11</value>
</metadata> </metadata>
<metadata name="fileSystemWatcher1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>107, 11</value>
</metadata>
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>25</value> <value>25</value>
</metadata> </metadata>
......
类型,阈值,面积 类型,阈值,窗口大小
6J.42001.181,45,16 6D5S1,2,3
TY.7H230.00M,45, 6C1D1,2,5
6H.12160.0RH,45,11 6D551,2,7
8C.R2003.H81,45,35 7H5S1,2,3
8C.2R006.A8H,45,
8C.1R004.D8H,45,
...@@ -39,7 +39,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -39,7 +39,7 @@ namespace OnlineStore.DeviceLibrary
// private string path2_png = Application.StartupPath + @"\XRAY\png"; // private string path2_png = Application.StartupPath + @"\XRAY\png";
private string path2_out = Application.StartupPath + @"\XRAY\out\"; private string path2_out = Application.StartupPath + @"\XRAY\out\";
private string path3_area = Application.StartupPath + @"\XRAY\area.txt"; private string path3_area = Application.StartupPath + @"\XRAY\area.txt";
private string configPath = Application.StartupPath + ConfigAppSettings.GetValue(Setting_Init.CounParamConfig);
private Dictionary<string, CountParam> countParamMap = new Dictionary<string, CountParam>(); private Dictionary<string, CountParam> countParamMap = new Dictionary<string, CountParam>();
public X_RAY_Equip(string cid, XRay_Config config) public X_RAY_Equip(string cid, XRay_Config config)
...@@ -103,40 +103,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -103,40 +103,7 @@ namespace OnlineStore.DeviceLibrary
{ {
System.IO.Directory.CreateDirectory(path2_out); System.IO.Directory.CreateDirectory(path2_out);
} }
countParamMap = new Dictionary<string, CountParam>(); LoadParamMap();
if (File.Exists(configPath))
{
try
{
string[] lines = File.ReadAllLines(configPath);
int index = -1;
foreach (string line in lines)
{
index++;
if (index.Equals(0))
{
continue;
}
CountParam param = CountParam.NewParam(line);
if (param != null)
{
if (!countParamMap.ContainsKey(param.PN))
{
countParamMap.Add(param.PN, param);
}
}
}
}
catch (Exception ex)
{
LogUtil.error("解析点料配置文件【" + configPath + "】出错:" + ex.ToString());
}
LogUtil.info("加载点料参数共【"+countParamMap.Count+"】条有效数据" + configPath);
}
else
{
LogUtil.error("未找到点料参数文件:" + configPath);
}
} }
catch (Exception ex) catch (Exception ex)
{ {
...@@ -397,6 +364,46 @@ namespace OnlineStore.DeviceLibrary ...@@ -397,6 +364,46 @@ namespace OnlineStore.DeviceLibrary
return msg; return msg;
} }
private void LoadParamMap()
{
countParamMap = new Dictionary<string, CountParam>();
string configPath = Application.StartupPath + ConfigAppSettings.GetValue(Setting_Init.CounParamConfig);
if (File.Exists(configPath))
{
try
{
string[] lines = File.ReadAllLines(configPath);
int index = -1;
foreach (string line in lines)
{
index++;
if (index.Equals(0))
{
continue;
}
CountParam param = CountParam.NewParam(line);
if (param != null)
{
if (!countParamMap.ContainsKey(param.PN))
{
countParamMap.Add(param.PN, param);
}
}
}
}
catch (Exception ex)
{
LogUtil.error("解析点料配置文件【" + configPath + "】出错:" + ex.ToString());
}
LogUtil.info("加载点料参数共【" + countParamMap.Count + "】条有效数据" + configPath);
}
else
{
LogUtil.error("未找到点料参数文件:" + configPath);
}
}
} }
public class CountParam public class CountParam
...@@ -407,8 +414,15 @@ namespace OnlineStore.DeviceLibrary ...@@ -407,8 +414,15 @@ namespace OnlineStore.DeviceLibrary
this.Threshold = th; this.Threshold = th;
this.AreaValue = area; this.AreaValue = area;
} }
public CountParam(string pn, int th, int size)
{
this.PN = pn;
this.Threshold = th;
this.WindowSize = size;
}
public string PN = ""; public string PN = "";
public int Threshold = 0; public int Threshold = 0;
public int WindowSize = 0;
public string AreaValue = ""; public string AreaValue = "";
internal static CountParam NewParam(string line) internal static CountParam NewParam(string line)
...@@ -420,9 +434,9 @@ namespace OnlineStore.DeviceLibrary ...@@ -420,9 +434,9 @@ namespace OnlineStore.DeviceLibrary
{ {
string pn = array[0].Trim(); string pn = array[0].Trim();
int th = Convert.ToInt32(array[1].Trim()); int th = Convert.ToInt32(array[1].Trim());
string a = array[2].Trim(); int size = Convert.ToInt32(array[2].Trim());
return new CountParam(pn, th, a); return new CountParam(pn, th, size);
} }
} }
catch (Exception ex) catch (Exception ex)
...@@ -431,6 +445,8 @@ namespace OnlineStore.DeviceLibrary ...@@ -431,6 +445,8 @@ namespace OnlineStore.DeviceLibrary
return null; return null;
} }
} }
} }
...@@ -326,7 +326,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -326,7 +326,7 @@ namespace OnlineStore.DeviceLibrary
private string lastFileName = ""; private string lastFileName = "";
private int lastTh = 0; private int lastTh = 0;
private int lastWSize = 0;
private void XW15_GetResult() private void XW15_GetResult()
{ {
if (IOValue(IO_Type.X_Lock_On).Equals(IO_VALUE.LOW)) if (IOValue(IO_Type.X_Lock_On).Equals(IO_VALUE.LOW))
...@@ -346,8 +346,9 @@ namespace OnlineStore.DeviceLibrary ...@@ -346,8 +346,9 @@ namespace OnlineStore.DeviceLibrary
//WorkLog("点料:获取点料结果[" + lastTh + "]=【" + count + "】,result=" + result + ",保存并上传结果"); //WorkLog("点料:获取点料结果[" + lastTh + "]=【" + count + "】,result=" + result + ",保存并上传结果");
WorkLog("点料:开始调用 countImage.GetCount "); WorkLog("点料:开始调用 countImage.GetCount ");
int n = carerayImage.GetCount(2, 3, out count, out Asa.API.EyemImage tpDstImg); string fileP = path1_tif + @"\" + lastFileName;
WorkLog("点料:获取点料结果 【" + count + "】,n =" + n + ",保存并上传结果"); int n = carerayImage.GetLocalCount(fileP, lastTh, lastWSize, out count, out Asa.API.EyemImage tpDstImg);
WorkLog("点料:获取点料结果 【" + count + "】【"+lastTh+"】【"+lastWSize+"】,n =" + n + ",保存并上传结果");
if (Work_ReelInfo.WareCount <= 0) if (Work_ReelInfo.WareCount <= 0)
{ {
...@@ -475,20 +476,28 @@ namespace OnlineStore.DeviceLibrary ...@@ -475,20 +476,28 @@ namespace OnlineStore.DeviceLibrary
private void UpdateArea(string codeStr) private void UpdateArea(string codeStr)
{ {
lastTh = ThresholdValue; lastTh = ThresholdValue;
lastWSize = 3;
string[] codeArray = codeStr.Split(';'); string[] codeArray = codeStr.Split(';');
string fileValue = ""; string fileValue = "";
string area = ""; string area = "";
if (codeArray.Length.Equals(2)) if (codeArray.Length.Equals(2))
{ {
string pn = codeArray[0]; string pn = codeArray[0];
string type = pn.Substring(0, 2) + pn.Substring(pn.Length - 3, 3);
if (countParamMap.ContainsKey(pn)) if (countParamMap.ContainsKey(pn))
{ {
area = countParamMap[pn].AreaValue; area = countParamMap[pn].AreaValue;
fileValue = lastFileName + " " + area; fileValue = lastFileName + " " + area;
lastTh = countParamMap[pn].Threshold; lastTh = countParamMap[pn].Threshold;
}else if (countParamMap.ContainsKey(type))
{
lastTh = countParamMap[type].Threshold;
lastWSize = countParamMap[type].WindowSize;
} }
} }
LogUtil.info("【" + codeStr + "】使用参数【" + lastTh + "】【" + area + "】,文件名【" + lastFileName + "】内容【" + fileValue + "】"); LogUtil.info("【" + codeStr + "】使用参数【" + lastTh + "】【" + lastWSize + "】 ");
//LogUtil.info("【" + codeStr + "】使用参数【" + lastTh + "】【" + area + "】,文件名【" + lastFileName + "】内容【" + fileValue + "】");
File.WriteAllText(path3_area, fileValue); File.WriteAllText(path3_area, fileValue);
} }
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!