using MesWork;
using Newtonsoft.Json;
using OpcBasic;
using System;
using System.Collections.Concurrent;
namespace DC_A95
{
public class PLC_R
{
///
///
///
/// 工位号
/// 上线缸体码
/// 托盘号
///
public static bool Read_LineSet(string opCode, out string partCode, out int palletNo)
{
partCode = MesWorkForm.ReadPLC(120, opCode).ToString();
palletNo = Convert.ToInt32(MesWorkForm.ReadPLC(80, opCode));
return true;
}
public static string GetString_CleanGarbled(string inputStr)
{
return inputStr.Replace("\0", "").Replace("\n", "").Replace("\r", "").Replace(" ", "");
}
public static ConcurrentDictionary ReadPLC_OpName(string opName)
{
if (MesWorkForm.IsDemoMesServer == 1)
{
return JsonConvert.DeserializeObject<
ConcurrentDictionary
>(JsonConvert.SerializeObject(
PlcLinkForm.ReadPLC_GroupData(opName)
));
}
else
{
try
{
PlcLinkForm.GetDbAndMaxLengthByOpName(opName, out string tagStartAdr, out ushort tagAdrListMaxLength);
return JsonConvert.DeserializeObject<
ConcurrentDictionary
>(JsonConvert.SerializeObject(PlcLinkForm.ReadQualityDataList(
opName
, tagStartAdr
, tagAdrListMaxLength
)
));
}
catch (Exception err)
{
return null;
}
}
}
}
}