89 lines
2.7 KiB
C#
89 lines
2.7 KiB
C#
using System;
|
|
using System.Data;
|
|
using System.Security.Cryptography;
|
|
using bizFacade;
|
|
//using SystemFramework;
|
|
using MesServerWork;
|
|
|
|
namespace MesServerFunctions
|
|
{
|
|
partial class Functions_BASE_24
|
|
{
|
|
/// <summary>
|
|
/// 上线扫码
|
|
/// </summary>
|
|
/// <param name="OpName"></param>
|
|
/// <param name="tagValue"></param>
|
|
public void PartScanOver(DoWhatPlc.CustomeEvetnArgs msgEvent)
|
|
{
|
|
try
|
|
{
|
|
//DoWhatPlc.CustomeEvetnArgs msgEvent = (DoWhatPlc.CustomeEvetnArgs)e;
|
|
string OpName = Convert.ToString(msgEvent.OpName);
|
|
int tagValue = Convert.ToInt32(msgEvent.TagValue);
|
|
|
|
int engineTypeID;
|
|
string engineID;
|
|
string orderForm;
|
|
string engineType="";
|
|
string scanPosition="1";
|
|
|
|
if (tagValue == 1)
|
|
{
|
|
//机器人扫描, 读取码值
|
|
MIS_BASE.Read_PartScanCode(40, OpName, out engineID);
|
|
//去除码值中的空格
|
|
engineID = engineID.Replace(" ", "");
|
|
//机器人扫描, 读取壳体在小车上的位置
|
|
MIS_BASE.Read_PartScanCode(37, OpName, out scanPosition);
|
|
|
|
//MIS_BASE.Read_EngineType(OpName, out engineType);
|
|
bool checkReult = false;
|
|
checkReult = CheckPartCode(engineID, scanPosition);
|
|
if (checkReult)
|
|
{
|
|
MIS_BASE.Write_TagTypeID(61, OpName, "1");//写入匹配结果 OK
|
|
}
|
|
else
|
|
{
|
|
MIS_BASE.Write_TagTypeID(62, OpName, "1");//写入匹配结果 NG
|
|
}
|
|
}
|
|
else
|
|
{
|
|
MIS_BASE.Write_TagTypeID(61, OpName, "0");
|
|
MIS_BASE.Write_TagTypeID(62, OpName, "0");
|
|
}
|
|
}
|
|
catch (Exception err)
|
|
{
|
|
////ApplicationLog.WriteLog(err, "Function03:PartLoad");
|
|
}
|
|
}
|
|
|
|
public bool CheckPartCode(string partCode, string scanPosition)
|
|
{
|
|
|
|
BaseDataSystemMES.CheckUpLoadPart(partCode, scanPosition, out DataTable dt);
|
|
if (dt.Rows.Count > 0)
|
|
{
|
|
if(dt.Rows[0]["result"].ToString() == "1")
|
|
{
|
|
return true;
|
|
}
|
|
else
|
|
{
|
|
return false;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
return false;
|
|
}
|
|
|
|
|
|
|
|
}
|
|
}
|
|
}
|