dep
我叫锄头 11 months ago
parent b1c553ddd7
commit c4b9956e26

@ -65,7 +65,10 @@ namespace ProductionSystem.Forms
{ {
#region 各工序的采集点位 #region 各工序的采集点位
Program.electricTestPoints = Program.MiddlePointKeyValues.Where(m => m.ParaCategory == "ElectricTest").ToList(); Program.electricTestPoints = Program.MiddlePointKeyValues.Where(m => m.ParaCategory == "BZ1").ToList();
Program.idlingPoints = Program.MiddlePointKeyValues.Where(m => m.ParaCategory == "Idling").ToList(); Program.idlingPoints = Program.MiddlePointKeyValues.Where(m => m.ParaCategory == "Idling").ToList();
Program.speedUp1Points = Program.MiddlePointKeyValues.Where(m => m.ParaCategory == "SpeedUp1").ToList(); Program.speedUp1Points = Program.MiddlePointKeyValues.Where(m => m.ParaCategory == "SpeedUp1").ToList();
Program.speedUp2Points = Program.MiddlePointKeyValues.Where(m => m.ParaCategory == "SpeedUp2").ToList(); Program.speedUp2Points = Program.MiddlePointKeyValues.Where(m => m.ParaCategory == "SpeedUp2").ToList();
@ -101,22 +104,22 @@ namespace ProductionSystem.Forms
#endregion #endregion
#region 页面第一次加载的时候读取一遍PLC数据 #region 页面第一次加载的时候读取一遍PLC数据
//空载 ////空载
GetIdlingPointsVal(); //GetIdlingPointsVal();
//一段速 ////一段速
GetSpeedUp1PointsVal(); //GetSpeedUp1PointsVal();
//二段升速 ////二段升速
GetSpeedUp2Points(); //GetSpeedUp2Points();
//二段速稳定 ////二段速稳定
GetSteady2Points(); //GetSteady2Points();
//三段升速 ////三段升速
GetSpeedUp3Points(); //GetSpeedUp3Points();
//三段速稳定 ////三段速稳定
GetSteady3Points(); //GetSteady3Points();
//内漏 ////内漏
GetEndoleadPoints(); //GetEndoleadPoints();
//单驱 ////单驱
GetSingleModelPoints(); //GetSingleModelPoints();
#endregion #endregion
//PLC心跳监测 //PLC心跳监测
@ -492,8 +495,8 @@ namespace ProductionSystem.Forms
continue; continue;
} }
//条码值 //条码值
var readM248 = OmronHelper.GetPlcVal(M248.DataType, M248.Address); //var readM248 = OmronHelper.GetPlcVal(M248.DataType, M248.Address);
UpdateControlContent(txtProductCode, readM248.val); //UpdateControlContent(txtProductCode, readM248.val);
#region 顶部采集项目赋值 #region 顶部采集项目赋值
if (Program.TopPointKeyValues.Count > 0) if (Program.TopPointKeyValues.Count > 0)
@ -642,20 +645,23 @@ namespace ProductionSystem.Forms
var M249 = Program.CommandPointKeyValues.FirstOrDefault(m => m.Key == "M249"); var M249 = Program.CommandPointKeyValues.FirstOrDefault(m => m.Key == "M249");
M249.Val = OmronHelper.GetPlcVal(M249.DataType, M249.Address).val; M249.Val = OmronHelper.GetPlcVal(M249.DataType, M249.Address).val;
#region 电检一直采集 #region 模拟一个值
for (int i = 0; i < Program.electricTestPoints.Count; i++) for (int i = 0; i < Program.electricTestPoints.Count; i++)
{ {
var electricReadResult = OmronHelper.GetPlcVal(Program.electricTestPoints[i].DataType, Program.electricTestPoints[i].Address); var electricReadResult = OmronHelper.GetPlcVal(Program.electricTestPoints[i].DataType, Program.electricTestPoints[i].Address);
Program.electricTestPoints[i].Val = electricReadResult.val; Program.electricTestPoints[i].Val = electricReadResult.val;
} }
var electricPoint = Program.electricTestPoints.FirstOrDefault(m => m.Key == "M44");
var electricStatus = OmronHelper.GetPlcVal(electricPoint.DataType, electricPoint.Address).val; SetMiddleData(Program.electricTestPoints, "BZ1");
if (electricStatus == "1.000" || electricStatus == "2.000") //var electricPoint = Program.electricTestPoints.FirstOrDefault(m => m.Key == "M44");
{ //var electricStatus = OmronHelper.GetPlcVal(electricPoint.DataType, electricPoint.Address).val;
SetMiddleData(Program.electricTestPoints, "ElectricTest"); //if (electricStatus == "1.000" || electricStatus == "2.000")
} //{
// SetMiddleData(Program.electricTestPoints, "ElectricTest");
//}
#endregion #endregion
M249.Val = "23234234234234";
switch (M249.Val) switch (M249.Val)
{ {
//空载 //空载
@ -924,6 +930,9 @@ namespace ProductionSystem.Forms
//} //}
} }
/// <summary> /// <summary>
/// 一段速 /// 一段速
/// </summary> /// </summary>

@ -37,7 +37,7 @@ namespace ProductionSystem.Untils
while (true) while (true)
{ {
Thread.Sleep(Program.ReadPlcRate); Thread.Sleep(Program.ReadPlcRate);
DataChange(); // DataChange();
} }
}); });
} }

@ -5,6 +5,8 @@ using DevExpress.XtraEditors.Repository;
using ProductionSystem_Model.Enum; using ProductionSystem_Model.Enum;
using ProductionSystem_Service; using ProductionSystem_Service;
using SqlSugar; using SqlSugar;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO.Ports; using System.IO.Ports;
using System.Linq; using System.Linq;
@ -362,7 +364,26 @@ namespace ProductionSystem.Untils.System
var defaultSelected = list.FirstOrDefault(m => m.IsUsed); var defaultSelected = list.FirstOrDefault(m => m.IsUsed);
if (defaultSelected != null) if (defaultSelected != null)
{ {
cmbEdit.SelectedItem = new ListItem { Value = defaultSelected.ProductTypeCode, Text = defaultSelected.ProductTypeName }; try
{
// cmbEdit.SelectedIndex = 0;
//cmbEdit.Invoke((MethodInvoker)delegate {
// cmbEdit.SelectedItem = new ListItem { Value = defaultSelected.ProductTypeCode, Text = defaultSelected.ProductTypeName };
// // 进行操作
//});
//
}
catch (Exception ex)
{
}
} }
else else
{ {

@ -40,10 +40,10 @@ namespace ProductionSystem_Service
{ {
//(A)全局生效配置点 //(A)全局生效配置点
//调试SQL事件可以删掉 //调试SQL事件可以删掉
//db.Aop.OnLogExecuting = (sql, pars) => db.Aop.OnLogExecuting = (sql, pars) =>
//{ {
// Console.WriteLine(sql);//输出sql,查看执行sql Console.WriteLine(sql);//输出sql,查看执行sql
//}; };
db.Aop.OnError = (exp) => db.Aop.OnError = (exp) =>
{ {
LogHelper.Error(exp, exp.Sql); LogHelper.Error(exp, exp.Sql);

Loading…
Cancel
Save