change -修改曲线显示逻辑

dep_yangw
frankiecao 11 months ago
commit 6d099aeb39

@ -1567,8 +1567,11 @@ namespace ProductionSystem.Forms
while (!cancellationTokenSource.IsCancellationRequested)
{
var readM248 = OmronHelper.GetPlcVal(M248.DataType, M248.Address);
string plcTiaoMa=readM248.val.ToString().Replace("\r", "").Replace("\n", "");
string tiaoma = txtProductCode.Text.Replace("\r", "").Replace("\n", "");
if (tiaoma.Contains("暂无条码") || tiaoma == "" || tiaoma.Contains("暂"))
//彻底解决页面闪烁的问题
if (string.IsNullOrEmpty(plcTiaoMa) || tiaoma.Contains("暂无条码") || tiaoma == "" || tiaoma.Contains("暂"))
{
for (int i = 1; i < 9; i++)
{
@ -2454,38 +2457,38 @@ namespace ProductionSystem.Forms
if (Program.timerEnable)
{
Program.cureManualReset.WaitOne();
//模拟数据
for (int i = 0; i < Program.Times.Length; i++)
if (GetPlcValue("D670") != "")
{
//Program.OutPressData[i] = Convert.ToSingle(random.NextDouble() * 60 + 200);
//Program.InPressData[i] = Convert.ToSingle(random.NextDouble() * 60 + 400);
//Program.GastankPressData[i] = Convert.ToSingle(random.NextDouble() * 60 + 600);
//Program.XVibrateData[i] = Convert.ToSingle(random.NextDouble() * 60 + 800);
//Program.YVibrateData[i] = Convert.ToSingle(random.NextDouble() * 60 + 1000);
if (GetPlcValue("D670") != "")
//模拟数据
for (int i = 0; i < Program.Times.Length; i++)
{
//Program.OutPressData[i] = Convert.ToSingle(random.NextDouble() * 60 + 200);
//Program.InPressData[i] = Convert.ToSingle(random.NextDouble() * 60 + 400);
//Program.GastankPressData[i] = Convert.ToSingle(random.NextDouble() * 60 + 600);
//Program.XVibrateData[i] = Convert.ToSingle(random.NextDouble() * 60 + 800);
//Program.YVibrateData[i] = Convert.ToSingle(random.NextDouble() * 60 + 1000);
var product = result2Service.QueryLatestStep(Program.ProductType, txtProductCode.Text);
var electricity = product.Electricity;
Program.CurrentData[i] = float.Parse(electricity);
Program.Times[i] = DateTime.Now.AddSeconds(i - 1000);
}
}
//if (Program.VoltageData.Length > 0)
//{
// hslCurveHistory.SetLeftCurve("电压", Program.VoltageData, Color.DarkOliveGreen, CurveStyle.Curve, "{0:F2} V");
//}
if (Program.CurrentData.Length > 0)
{
hslCurveHistory.SetLeftCurve("电流", Program.CurrentData, Color.Yellow, CurveStyle.Curve, "{0:F2} A");
}
if (Program.Times.Length > 0)
{
hslCurveHistory.SetDateTimes(Program.Times);
}
hslCurveHistory.ScrollToRight();
// 将曲线显示出来
hslCurveHistory.RenderCurveUI();
}
//if (Program.VoltageData.Length > 0)
//{
// hslCurveHistory.SetLeftCurve("电压", Program.VoltageData, Color.DarkOliveGreen, CurveStyle.Curve, "{0:F2} V");
//}
if (Program.CurrentData.Length > 0)
{
hslCurveHistory.SetLeftCurve("电流", Program.CurrentData, Color.Yellow, CurveStyle.Curve, "{0:F2} A");
}
if (Program.Times.Length > 0)
{
hslCurveHistory.SetDateTimes(Program.Times);
}
hslCurveHistory.ScrollToRight();
// 将曲线显示出来
hslCurveHistory.RenderCurveUI();
}
}
}
}

Loading…
Cancel
Save