|
|
|
@ -42,7 +42,14 @@ namespace MaterialTraceability.Business
|
|
|
|
|
private IBaseServices<ProEquip> equipServices = new BaseServices<ProEquip>();
|
|
|
|
|
private IBaseServices<ProReadRecord> readServices = new BaseServices<ProReadRecord>();
|
|
|
|
|
|
|
|
|
|
public List<TagInfo> gettaglist(string equipid, out ProEquip eq)
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 获取标签信息
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="equipid">设备编号</param>
|
|
|
|
|
/// <param name="isFilter">是否开启过滤</param>
|
|
|
|
|
/// <param name="eq"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public List<TagInfo> gettaglist(string equipid,bool isFilter, out ProEquip eq)
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
@ -60,12 +67,19 @@ namespace MaterialTraceability.Business
|
|
|
|
|
}
|
|
|
|
|
eq = equip;
|
|
|
|
|
LogHelper.RfidLog("gettaglist函数结果:" + JsonChange.ModeToJson(taglist));
|
|
|
|
|
if (isFilter)
|
|
|
|
|
{
|
|
|
|
|
#region 读取结果过滤,返回读取次数大于两次的数据 Add By WenJY 2023-05-11
|
|
|
|
|
result = taglist.Where(x => x.Count > 2).ToList();
|
|
|
|
|
LogHelper.Info($"gettaglist函数结果过滤,返回读取次数大于2的数据{JsonChange.ModeToJson(result)}");
|
|
|
|
|
#endregion
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
return taglist;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
eq = null;
|
|
|
|
|
LogHelper.Info($"gettaglist函数结果:{JsonChange.ModeToJson(taglist)},设备编号{equipid};未匹配到设备信息;");
|
|
|
|
@ -79,6 +93,8 @@ namespace MaterialTraceability.Business
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 涂布、模切、冷压上料读取
|
|
|
|
|
/// </summary>
|
|
|
|
@ -89,8 +105,9 @@ namespace MaterialTraceability.Business
|
|
|
|
|
{
|
|
|
|
|
LogHelper.Info("进入ReadEPCByAntana函数");
|
|
|
|
|
ProEquip proEquip = _equipList.Where(x => x.equipId == equipId).FirstOrDefault();
|
|
|
|
|
List<TagInfo> info2 = this.gettaglist(proEquip.equipId.ToString(), out proEquip);
|
|
|
|
|
List<TagInfo> info2 = this.gettaglist(proEquip.equipId.ToString(),false, out proEquip);
|
|
|
|
|
|
|
|
|
|
#region 2023/2/6关闭
|
|
|
|
|
// ----------------------------------------------------------------------2023/2/6关闭
|
|
|
|
|
// info2遍历信号强度、读取次数,上传至服务器数据库读取记录表ReadRecord,
|
|
|
|
|
// 过滤前的数据is_success字段统一设置成999,便于数据库查找观察
|
|
|
|
@ -121,7 +138,7 @@ namespace MaterialTraceability.Business
|
|
|
|
|
//}
|
|
|
|
|
//LogHelper.Info("标签强度上传失败");
|
|
|
|
|
// -------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
if (info2.Count == 0)
|
|
|
|
|
{
|
|
|
|
@ -152,6 +169,47 @@ namespace MaterialTraceability.Business
|
|
|
|
|
return info;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 读取EPC并过滤读取次数
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="equipId"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public string ReadEPCAndFliterCount(int equipId)
|
|
|
|
|
{
|
|
|
|
|
LogHelper.Info("进入ReadEPCByAntana函数");
|
|
|
|
|
ProEquip proEquip = _equipList.Where(x => x.equipId == equipId).FirstOrDefault();
|
|
|
|
|
List<TagInfo> info2 = this.gettaglist(proEquip.equipId.ToString(), true, out proEquip);
|
|
|
|
|
|
|
|
|
|
if (info2.Count == 0)
|
|
|
|
|
{
|
|
|
|
|
return "";
|
|
|
|
|
}
|
|
|
|
|
CFliterRFID cFliterRFID = new CFliterRFID();
|
|
|
|
|
var result = cFliterRFID.filterByTagCount(info2);
|
|
|
|
|
|
|
|
|
|
if (result == "") return "";
|
|
|
|
|
if (StringExtension.IsBlank(result))
|
|
|
|
|
{
|
|
|
|
|
return "";
|
|
|
|
|
}
|
|
|
|
|
string info = result;
|
|
|
|
|
LogHelper.Info("ReadEpcByAntana函数读取结果:" + result);
|
|
|
|
|
ProReadRecord readRecord = new ProReadRecord()
|
|
|
|
|
{
|
|
|
|
|
MachineID = proEquip.machineId,
|
|
|
|
|
EquipID = proEquip.equipId,
|
|
|
|
|
PositionID = proEquip.positionId,
|
|
|
|
|
Ant = StringChange.ParseToInt(proEquip.equipAnt),
|
|
|
|
|
ReadEPC = result,
|
|
|
|
|
Result = StringExtension.IsBlank(result) ? "0" : "1",
|
|
|
|
|
ReadTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")
|
|
|
|
|
};
|
|
|
|
|
readServices.Add(readRecord);
|
|
|
|
|
return info;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 生产过程中读取RFID信息
|
|
|
|
|
/// </summary>
|
|
|
|
@ -161,7 +219,7 @@ namespace MaterialTraceability.Business
|
|
|
|
|
{
|
|
|
|
|
LogHelper.Info("ReadEpcByProduction函数");
|
|
|
|
|
ProEquip proEquip = _equipList.Where(x => x.equipId == equipId).FirstOrDefault();
|
|
|
|
|
List<TagInfo> tagInfos = this.gettaglist(proEquip.equipId.ToString(), out proEquip);
|
|
|
|
|
List<TagInfo> tagInfos = this.gettaglist(proEquip.equipId.ToString(),true, out proEquip);
|
|
|
|
|
|
|
|
|
|
if (tagInfos.Count == 0)
|
|
|
|
|
{
|
|
|
|
@ -203,7 +261,7 @@ namespace MaterialTraceability.Business
|
|
|
|
|
int position = positionGroup.FirstOrDefault();
|
|
|
|
|
ProEquip proEquip = _equipList.Where(x => x.positionId == position).FirstOrDefault();
|
|
|
|
|
//ProEquip proEquip = _equipList.Where(x => x.equipId == equipId).FirstOrDefault();//这里只获取了第一个,设备
|
|
|
|
|
var info2 = this.gettaglist(proEquip.equipId.ToString(), out proEquip);
|
|
|
|
|
var info2 = this.gettaglist(proEquip.equipId.ToString(),false, out proEquip);
|
|
|
|
|
/////做日志用,后期可以不用了
|
|
|
|
|
//foreach (var a in info2)
|
|
|
|
|
//{
|
|
|
|
|