修改读码器
This commit is contained in:
parent
15df28b3b4
commit
19da00146e
@ -73,6 +73,8 @@ namespace HisenceYoloDetection
|
|||||||
|
|
||||||
bool PLC548 = false;
|
bool PLC548 = false;
|
||||||
string m_sKEYENCEBar;
|
string m_sKEYENCEBar;
|
||||||
|
string Oldm_sKEYENCEBar;
|
||||||
|
string OcrBar = "";//洗衣机编号
|
||||||
string IfChangeLanguage = "";//是否换洗衣机的型号
|
string IfChangeLanguage = "";//是否换洗衣机的型号
|
||||||
bool bTriger = true;//是否可以触发检测
|
bool bTriger = true;//是否可以触发检测
|
||||||
bool bBarTriger = false;//第一个地址完成后才能触发第二个位置
|
bool bBarTriger = false;//第一个地址完成后才能触发第二个位置
|
||||||
@ -85,6 +87,7 @@ namespace HisenceYoloDetection
|
|||||||
Mat Cam2ImgShowBar = new Mat();//实时相机2的照片 用来识别条码
|
Mat Cam2ImgShowBar = new Mat();//实时相机2的照片 用来识别条码
|
||||||
|
|
||||||
XKHisence xKNow;//数据库中的洗衣机数据
|
XKHisence xKNow;//数据库中的洗衣机数据
|
||||||
|
XKHisence Old_xKNow;//数据库中的洗衣机数据
|
||||||
XK_HisenceWord xK_HisenceSQLWord = new XK_HisenceWord();
|
XK_HisenceWord xK_HisenceSQLWord = new XK_HisenceWord();
|
||||||
bool bOn = false;
|
bool bOn = false;
|
||||||
////////////////////////////
|
////////////////////////////
|
||||||
@ -347,7 +350,7 @@ namespace HisenceYoloDetection
|
|||||||
|
|
||||||
string startTime = starttime;
|
string startTime = starttime;
|
||||||
string EndTime = starttime;
|
string EndTime = starttime;
|
||||||
string lineBody = "ZZ-P5";
|
string lineBody = "ZZ-P";
|
||||||
string MaterialDescripts = "制冷器";
|
string MaterialDescripts = "制冷器";
|
||||||
string MaterialDescripts2 = "工艺管";
|
string MaterialDescripts2 = "工艺管";
|
||||||
JObject patientinfo = new JObject();
|
JObject patientinfo = new JObject();
|
||||||
@ -766,15 +769,15 @@ namespace HisenceYoloDetection
|
|||||||
{
|
{
|
||||||
myLog("Cam1相机启动", DateTime.Now);
|
myLog("Cam1相机启动", DateTime.Now);
|
||||||
}
|
}
|
||||||
Cam2.Start("Cam2");
|
//Cam2.Start("Cam2");
|
||||||
if (Cam2.IfSuccess)
|
//if (Cam2.IfSuccess)
|
||||||
{
|
//{
|
||||||
myLog("Cam2相机启动", DateTime.Now);
|
// myLog("Cam2相机启动", DateTime.Now);
|
||||||
}
|
//}
|
||||||
Cam1.OnHImageOutput -= OnCameraMatOutPut;
|
Cam1.OnHImageOutput -= OnCameraMatOutPut;
|
||||||
Cam1.OnHImageOutput += OnCameraMatOutPut;
|
Cam1.OnHImageOutput += OnCameraMatOutPut;
|
||||||
Cam2.OnHImageOutput -= OnCameraMatOutPut2;
|
//Cam2.OnHImageOutput -= OnCameraMatOutPut2;
|
||||||
Cam2.OnHImageOutput += OnCameraMatOutPut2;
|
// Cam2.OnHImageOutput += OnCameraMatOutPut2;
|
||||||
|
|
||||||
OKOrNGShow.Image = OKbitmap;
|
OKOrNGShow.Image = OKbitmap;
|
||||||
//初始化扫码枪
|
//初始化扫码枪
|
||||||
@ -1179,16 +1182,62 @@ namespace HisenceYoloDetection
|
|||||||
{
|
{
|
||||||
_runHandleBefore.WaitOne();
|
_runHandleBefore.WaitOne();
|
||||||
//这里改成和海信的对接需求
|
//这里改成和海信的对接需求
|
||||||
|
|
||||||
|
// if(Oldm_sKEYENCEBar!= m_sKEYENCEBar)
|
||||||
|
{
|
||||||
|
// Oldm_sKEYENCEBar= m_sKEYENCEBar;
|
||||||
|
//获取请求
|
||||||
|
//报警地址
|
||||||
|
string url = "https://inner-apisix.hisense.com/mes-plus/api/Fcc/GetWorkOrderBOMlnfo?user_key=k7gzo1fsfcami7n5hmpxtybyluf9xeue";
|
||||||
|
// string url = "https://echo.hoppscotch.io";
|
||||||
|
string PostUrl = url;
|
||||||
|
DateTime dt = DateTime.Now;
|
||||||
|
|
||||||
|
string starttime = string.Format("{0:yyyy_mm_dd}", dt); //17 17 2017 2017
|
||||||
|
|
||||||
|
string startTime = starttime;
|
||||||
|
string EndTime = starttime;
|
||||||
|
string lineBody = "ZZ-P";//线体
|
||||||
|
string MaterialDescripts = "制冷器";
|
||||||
|
string MaterialDescripts2 = "工艺管";
|
||||||
|
JObject patientinfo = new JObject();
|
||||||
|
JArray ids = new JArray();
|
||||||
|
ids.Add(MaterialDescripts);
|
||||||
|
ids.Add(MaterialDescripts2);
|
||||||
|
patientinfo["startTime"] = startTime;
|
||||||
|
patientinfo["EndTime"] = EndTime;
|
||||||
|
patientinfo["lineBody"] = lineBody;
|
||||||
|
patientinfo["MaterialDescripts"] = ids;
|
||||||
|
string sendData = JsonConvert.SerializeObject(patientinfo);
|
||||||
|
//eg: 发送Url需要的格式:sendData={"ids":[123],"Name":小黑}
|
||||||
|
string resultData = Post(sendData, PostUrl);
|
||||||
|
resultData = "{\r\n\t\"Result\": [],\r\n\t\"success\": false,\r\n\t\"ReturnMsg\": \"参数-starttime 不正确!\"\r\n}";
|
||||||
|
JObject jo = (JObject)JsonConvert.DeserializeObject(resultData);
|
||||||
|
string sucessIf = jo["success"].ToString();
|
||||||
|
if (sucessIf.ToLower() == "true")
|
||||||
|
{
|
||||||
|
string ProductType = jo["ProductType"].ToString();
|
||||||
|
string FinalDefIo = jo["FinalDefIo"].ToString();
|
||||||
|
//WEBAPI得到条码
|
||||||
|
xKNow = GetModeFromBar(ProductType);//从数据库中查询到这个条码的四轴的值
|
||||||
|
//解析字段
|
||||||
|
}
|
||||||
|
}
|
||||||
//xKNow = GetModeFromBar("VWJ070633V0WW80F0120356");//从数据库中查询到这个条码的四轴的值
|
//xKNow = GetModeFromBar("VWJ070633V0WW80F0120356");//从数据库中查询到这个条码的四轴的值
|
||||||
xKNow = GetModeFromBar(m_sKEYENCEBar);//从数据库中查询到这个条码的四轴的值
|
|
||||||
|
|
||||||
if(xKNow==null)
|
if(xKNow==null)
|
||||||
{
|
{
|
||||||
myLog("数据库没有条码匹配" + m_sKEYENCEBar, DateTime.Now);
|
myLog("数据库没有条码匹配" + m_sKEYENCEBar, DateTime.Now);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
//if(xKNow.OcrBar!= Old_xKNow.OcrBar)
|
||||||
|
//{
|
||||||
|
|
||||||
|
//}
|
||||||
if (Regex.IsMatch(xKNow.MoveX.ToString(), @"^[0-9]+$") && Regex.IsMatch(xKNow.MoveY.ToString(), @"^[0-9]+$") && Regex.IsMatch(xKNow.MoveZ.ToString(), @"^[0-9]+$"))
|
if (Regex.IsMatch(xKNow.MoveX.ToString(), @"^[0-9]+$") && Regex.IsMatch(xKNow.MoveY.ToString(), @"^[0-9]+$") && Regex.IsMatch(xKNow.MoveZ.ToString(), @"^[0-9]+$"))
|
||||||
{
|
{
|
||||||
|
// Old_xKNow = xKNow;
|
||||||
myLog("型号匹配成功" + xKNow.OcrBar, DateTime.Now);
|
myLog("型号匹配成功" + xKNow.OcrBar, DateTime.Now);
|
||||||
bBarTriger = true;
|
bBarTriger = true;
|
||||||
//MoveToP(xKNow.MoveX, xKNow.MoveY, xKNow.MoveZ);// PLC控制电机移动四轴
|
//MoveToP(xKNow.MoveX, xKNow.MoveY, xKNow.MoveZ);// PLC控制电机移动四轴
|
||||||
@ -1288,7 +1337,7 @@ namespace HisenceYoloDetection
|
|||||||
}
|
}
|
||||||
if (iNum1 >= 2)
|
if (iNum1 >= 2)
|
||||||
{
|
{
|
||||||
#if false
|
#if true
|
||||||
|
|
||||||
if (bBarTriger)//证明读码器读到东西
|
if (bBarTriger)//证明读码器读到东西
|
||||||
{
|
{
|
||||||
@ -1330,8 +1379,8 @@ namespace HisenceYoloDetection
|
|||||||
Cam1.SnapshotCount = 0;
|
Cam1.SnapshotCount = 0;
|
||||||
Cam1.Snapshot();
|
Cam1.Snapshot();
|
||||||
|
|
||||||
Cam2.SnapshotCount = 0;
|
//Cam2.SnapshotCount = 0;
|
||||||
Cam2.Snapshot();
|
//Cam2.Snapshot();
|
||||||
myLog("第二次采集图像", DateTime.Now);
|
myLog("第二次采集图像", DateTime.Now);
|
||||||
|
|
||||||
//if (xKNow != null)
|
//if (xKNow != null)
|
||||||
|
Loading…
Reference in New Issue
Block a user