MES对接
This commit is contained in:
@@ -47,7 +47,7 @@ namespace JinYuan.ControlCenters
|
|||||||
Directory.CreateDirectory(filePath);
|
Directory.CreateDirectory(filePath);
|
||||||
}
|
}
|
||||||
string logMessage = $"{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss:fff")}: {Message}";//打印出现的时间
|
string logMessage = $"{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss:fff")}: {Message}";//打印出现的时间
|
||||||
// 将消息写入日志文件
|
// 将消息写入日志文件
|
||||||
using (StreamWriter writer = new StreamWriter(filePath2, true))
|
using (StreamWriter writer = new StreamWriter(filePath2, true))
|
||||||
{
|
{
|
||||||
writer.WriteLine(logMessage);
|
writer.WriteLine(logMessage);
|
||||||
@@ -138,9 +138,9 @@ namespace JinYuan.ControlCenters
|
|||||||
{
|
{
|
||||||
DicStationFunction = new Dictionary<string, dgStationFunction>();
|
DicStationFunction = new Dictionary<string, dgStationFunction>();
|
||||||
|
|
||||||
DicStationFunction.Add("外观检测进站", FeedingStation);
|
DicStationFunction.Add("电芯进站", FeedingStation);
|
||||||
DicStationFunction.Add("NG出站", NGStation);
|
//DicStationFunction.Add("NG出站", NGStation);
|
||||||
DicStationFunction.Add("外观检测出站", BlankingStation);
|
//DicStationFunction.Add("外观检测出站", BlankingStation);
|
||||||
|
|
||||||
for (int i = 0; i < CommonMethods.ChatLineCount; i++)
|
for (int i = 0; i < CommonMethods.ChatLineCount; i++)
|
||||||
{
|
{
|
||||||
@@ -245,7 +245,7 @@ namespace JinYuan.ControlCenters
|
|||||||
//as 类型转换
|
//as 类型转换
|
||||||
Group pf = plcModel as Group;
|
Group pf = plcModel as Group;
|
||||||
bool sta = CommonMethods.IsExit;
|
bool sta = CommonMethods.IsExit;
|
||||||
while (!CommonMethods.IsExit)
|
while (!CommonMethods.IsExit)
|
||||||
{
|
{
|
||||||
CommonMethods.ResetEventRecv.WaitOne();
|
CommonMethods.ResetEventRecv.WaitOne();
|
||||||
if (CommonMethods.IsRun)
|
if (CommonMethods.IsRun)
|
||||||
@@ -273,8 +273,21 @@ namespace JinYuan.ControlCenters
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
DicStationFunction[pf.GroupName].BeginInvoke(resByte, pf, null, null);//信息解析
|
//if (DicStationFunction.TryGetValue(pf.GroupName, out var func))
|
||||||
}
|
//{
|
||||||
|
// func.BeginInvoke(resByte, pf, ar =>
|
||||||
|
// {
|
||||||
|
// try { func.EndInvoke(ar); }
|
||||||
|
// catch (Exception ex)
|
||||||
|
// {
|
||||||
|
// CommonMethods.AddLog(true, ex.Message);
|
||||||
|
// LogHelper.Instance.WriteEX(ex);
|
||||||
|
// }
|
||||||
|
// }, null);
|
||||||
|
//}
|
||||||
|
//// private Dictionary<string, dgStationFunction> DicStationFunction;
|
||||||
|
DicStationFunction[pf.GroupName].BeginInvoke(resByte, pf, null, null);//信息解析
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
@@ -317,7 +330,7 @@ namespace JinYuan.ControlCenters
|
|||||||
}
|
}
|
||||||
//LogErrorMessage("Write done");
|
//LogErrorMessage("Write done");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -1000,10 +1013,10 @@ namespace JinYuan.ControlCenters
|
|||||||
|
|
||||||
CommonMethods.TotalQty = CommonMethods.PlcLink.ReadInt32("D15");//生产总数
|
CommonMethods.TotalQty = CommonMethods.PlcLink.ReadInt32("D15");//生产总数
|
||||||
CommonMethods.ProOKQty = CommonMethods.PlcLink.ReadInt32("D17");//良品总数
|
CommonMethods.ProOKQty = CommonMethods.PlcLink.ReadInt32("D17");//良品总数
|
||||||
|
|
||||||
CommonMethods.Ppm = CommonMethods.PlcLink.ReadInt32("D13");
|
CommonMethods.Ppm = CommonMethods.PlcLink.ReadInt32("D13");
|
||||||
//CommonMethods.JiaDL = Convert.ToDouble(CommonMethods.PlcLink.ReadFloat("D11").ToString("F2"))/100;
|
//CommonMethods.JiaDL = Convert.ToDouble(CommonMethods.PlcLink.ReadFloat("D11").ToString("F2"))/100;
|
||||||
CommonMethods.JiaDL = Convert.ToDouble(CommonMethods.PlcLink.ReadInt32("D11").ToString("F2"))/100;
|
CommonMethods.JiaDL = Convert.ToDouble(CommonMethods.PlcLink.ReadInt32("D11").ToString("F2")) / 100;
|
||||||
|
|
||||||
#region 开机时间/运行时间
|
#region 开机时间/运行时间
|
||||||
CommonMethods.PlcOpenAndRunTime = GetList<int>(6, 0);
|
CommonMethods.PlcOpenAndRunTime = GetList<int>(6, 0);
|
||||||
@@ -1137,7 +1150,7 @@ namespace JinYuan.ControlCenters
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
string strAddr = "";
|
string strAddr = "";
|
||||||
|
|
||||||
if (flag)//产出
|
if (flag)//产出
|
||||||
{
|
{
|
||||||
//strAddr = "D" + (1032 + hour);
|
//strAddr = "D" + (1032 + hour);
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ namespace JinYuan.MES
|
|||||||
StringContent stringContent = new StringContent(strJosnData, Encoding.UTF8, "application/json");
|
StringContent stringContent = new StringContent(strJosnData, Encoding.UTF8, "application/json");
|
||||||
string ResponseMessage= new HttpClient()
|
string ResponseMessage= new HttpClient()
|
||||||
{
|
{
|
||||||
Timeout = TimeSpan.FromSeconds(6.0)
|
Timeout = TimeSpan.FromSeconds(3.0)
|
||||||
}.PostAsync(url, (HttpContent)stringContent).Result.Content.ReadAsStringAsync().Result;
|
}.PostAsync(url, (HttpContent)stringContent).Result.Content.ReadAsStringAsync().Result;
|
||||||
return ResponseMessage;
|
return ResponseMessage;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -117,7 +117,7 @@ namespace LargeSquareOne
|
|||||||
using (new TimerReset(m_RefreshTimer, 2000))
|
using (new TimerReset(m_RefreshTimer, 2000))
|
||||||
{
|
{
|
||||||
Refish12ProdQty();
|
Refish12ProdQty();
|
||||||
RefreshXiaoLvData();
|
RefreshXiaoLvData();//设备综合效率
|
||||||
RefreshChatTop10AlarmData();
|
RefreshChatTop10AlarmData();
|
||||||
RefreshChatNGData();
|
RefreshChatNGData();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user