Merge branch 'dep_yangw' of http://175.27.215.92:3000/yangw/ProductionSystem into dep_yangw

dep_yangw
frankiecao 11 months ago
commit 533b959680

@ -0,0 +1,7 @@
{
// 使 IntelliSense
//
// 访: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": []
}

@ -42,6 +42,7 @@ namespace ProductionSystem.Forms
private static string iniFilePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "SystemConfig.ini");
private bool topIsCanRound = true;//展示PLC采集数据时是否可以进入下一次循环
private bool middleIsCanRound = true;//展示PLC采集数据时是否可以进入下一次循环
private bool middleIsCanRound2 = true;//展示PLC采集数据时是否可以进入下一次循环
private static List<string> _curveKes = new List<string>();//曲线名称
CancellationToken cureCancellationToken;
@ -65,27 +66,33 @@ namespace ProductionSystem.Forms
cmbProductType.SelectedItem = new ListItem { Value = Program.ProductType, Text = Program.ProductType };
//var temp = _paraConfigService.GetParaTargetVal(ModeTypeEnum.BZ1_DB);
//string str1 = temp.PZF1.TargetVal;
//string str2 = temp.PZF1.Lin;
//string str3 = temp.PZF1.Com;
}
private void HomeForm_Load(object sender, EventArgs e)
{
#region 各工序的采集点位
Program.BZ1 = Program.MiddlePointKeyValues.Where(m => m.ParaCategory == "BZ1").ToList();
private void Init()
{
Program.BZ1 = Program.MiddlePointKeyValues.Where(m => m.ParaCategory == "BZ1").ToList();
Program.BZ2 = Program.MiddlePointKeyValues.Where(m => m.ParaCategory == "BZ2").ToList();
Program.BZ3 = Program.MiddlePointKeyValues.Where(m => m.ParaCategory == "BZ3").ToList();
Program.BZ4 = Program.MiddlePointKeyValues.Where(m => m.ParaCategory == "BZ4").ToList();
Program.BZ5 = Program.MiddlePointKeyValues.Where(m => m.ParaCategory == "BZ5").ToList();
Program.BZ6 = Program.MiddlePointKeyValues.Where(m => m.ParaCategory == "BZ6").ToList();
Program.BZ7 = Program.MiddlePointKeyValues.Where(m => m.ParaCategory == "BZ7").ToList();
Program.BZ8 = Program.MiddlePointKeyValues.Where(m => m.ParaCategory == "BZ8").ToList();
}
private void HomeForm_Load(object sender, EventArgs e)
{
#region 各工序的采集点位
Init();
@ -164,16 +171,25 @@ namespace ProductionSystem.Forms
Task.Run(() =>
{
ShowMiddleData();
}, cancellationTokenSource.Token);
Task.Run(() =>
{
ShowMiddleData2();
}, cancellationTokenSource.Token);
hslCurveHistory.RemoveAllCurve();
ShowMiddleData2();
ShowMiddleData2();
ShowMiddleData2();
ShowMiddleData2();
}
@ -576,16 +592,27 @@ namespace ProductionSystem.Forms
testValPoint.Val = val;
this.Invoke(new Action(() =>
{
var LblItemText = topMyResultControls[i].LblItemText;
topMyResultControls[i].SetForeColor(Color.Black);
topMyResultControls[i].TestValText = testValPoint.Val;
if (testValPoint.Val == "0.000")
{
topMyResultControls[i].TestValText = "停止";
}
else
if (testValPoint.Val == "1.000")
if (LblItemText.Contains("模式") || LblItemText.Contains("状态"))
{
topMyResultControls[i].TestValText = "启动";
if (testValPoint.Val == "0.000")
{
topMyResultControls[i].TestValText = "关闭";
topMyResultControls[i].SetForeColor(Color.Red);
}
else
if (testValPoint.Val == "1.000")
{
topMyResultControls[i].TestValText = "启动";
topMyResultControls[i].SetForeColor(Color.Green);
}
}
}));
//if (M249.Val != "0.000" && M249.Val != "10.000")
//{
@ -806,15 +833,19 @@ namespace ProductionSystem.Forms
private void ShowMiddleData2()
{
Thread.Sleep(Program.ReadPlcRate);
while (!cancellationTokenSource.IsCancellationRequested)
{
GetPlc(Program.BZ1, "BZ1");
GetPlc(Program.BZ2, "BZ2");
GetPlc(Program.BZ3, "BZ3");
GetPlc(Program.BZ4, "BZ4");
GetPlc(Program.BZ5, "BZ5");
GetPlc(Program.BZ6, "BZ6");
GetPlc(Program.BZ1, "BZ1");
GetPlc(Program.BZ2, "BZ2");
GetPlc(Program.BZ3, "BZ3");
GetPlc(Program.BZ4, "BZ4");
GetPlc(Program.BZ5, "BZ5");
GetPlc(Program.BZ6, "BZ6");
Thread.Sleep(Program.ReadPlcRate);
}
}
@ -1226,6 +1257,11 @@ namespace ProductionSystem.Forms
/// <summary>
/// 显示Db块的数据
/// </summary>
/// <param name="paraCategory"></param>
private void SetMiddleData(string paraCategory)
{
try

@ -420,12 +420,14 @@ namespace ProductionSystem.Forms.SystemSetting
if (textEditControl != null)
{
var protocolConfigCode = textEditControl.TargetText.Trim();
T_ParaConfig t_ParaConfig = new T_ParaConfig
{
ProductType = productType,
ParaCategory = paraCategory,
ParaCode = textEditControl.LblItemCode,
Remark = protocolConfigCode,
TargetVal = protocolConfigCode.ToDecimal(),
Remark= protocolConfigCode,
CreatedTime = DateTime.Now,
CreatedBy = CurrentUser.Id
};

@ -0,0 +1,28 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ProductionSystem_Model.Enum
{
/// <summary>
/// 模式枚举
/// </summary>
public enum ModeTypeEnum
{
[Description("步骤(模式)1")]
BZ1_DB = 1,
[Description("步骤(模式)2")]
BZ2_DB = 2,
[Description("步骤(模式)3")]
BZ3_DB = 3,
[Description("步骤(模式)4")]
BZ4_DB = 4,
[Description("步骤(模式)5")]
BZ5_DB = 5,
[Description("步骤(模式)6")]
BZ6_DB = 6,
}
}

@ -117,6 +117,7 @@
<Compile Include="DbModel\Ux.cs" />
<Compile Include="Enum\ColorEnum.cs" />
<Compile Include="Enum\FrameTypeEnum.cs" />
<Compile Include="Enum\ModeTypeEnum.cs" />
<Compile Include="Enum\MsgFormatEnum.cs" />
<Compile Include="Enum\MsgTypeEnum.cs" />
<Compile Include="Enum\ProtocolTypeEnum.cs" />
@ -137,7 +138,7 @@
<Compile Include="ViewModel\Request\Test\TestStepVM.cs" />
<Compile Include="ViewModel\Response\Para\ParaColVM.cs" />
<Compile Include="ViewModel\Response\Para\ParaConfigVM.cs" />
<Compile Include="ViewModel\Response\Para\ParaTargetValVM.cs" />
<Compile Include="ViewModel\Response\Para\EditionType.cs" />
<Compile Include="ViewModel\Response\Para\PointKeyValue.cs" />
<Compile Include="ViewModel\Response\Protocol\ProtocolDetailInfo.cs" />
<Compile Include="ViewModel\Response\Protocol\ProtocolDetailParaVM.cs" />

@ -0,0 +1,43 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ProductionSystem_Model.ViewModel.Response.Para
{
public class EditionPara
{
//目标值
public string TargetVal { get; set; }
//通讯方式
public string Lin { get; set; }
//端口号
public string Com { get; set; }
//错误信息
public string Err { get; set; }
}
public class EditonType
{
public EditonType()
{
STF1 = new EditionPara();
STF2 = new EditionPara();
PZF1 = new EditionPara();
PZF2 = new EditionPara();
SB1 = new EditionPara();
SB2 = new EditionPara();
SB3 = new EditionPara();
}
public EditionPara STF1 { get; set; }
public EditionPara STF2 { get; set; }
public EditionPara PZF1 { get; set; }
public EditionPara PZF2 { get; set; }
public EditionPara SB1 { get; set; }
public EditionPara SB2 { get; set; }
public EditionPara SB3{ get; set; }
}
}

@ -1,19 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ProductionSystem_Model.ViewModel.Response.Para
{
public class ParaTargetValVM
{
public string STF1TargetVal { get; set; }
public string STF2TargetVal { get; set; }
public string PZF1TargetVal { get; set; }
public string PZF2TargetVal { get; set; }
public string SB1TargetVal { get; set; }
public string SB2TargetVal { get; set; }
public string SB3TargetVal { get; set; }
}
}

@ -0,0 +1,49 @@
using ProductionSystem_Log;
using ProductionSystem_Model;
using ProductionSystem_Model.DbModel;
using ProductionSystem_Model.DbModel.Para;
using ProductionSystem_Model.ViewModel.Response.Para;
using SqlSugar;
using System;
using System.Collections.Generic;
namespace ProductionSystem_Service
{
public class ExvService : DbContext
{
public void Add(Exv ex)
{
db.Insertable(ex).ExecuteCommand();
}
}
public class UxService : DbContext
{
public void Add(Ux entity)
{
db.Insertable(entity).ExecuteCommand();
}
}
public class UYService : DbContext
{
public void Add(Uy entity)
{
db.Insertable(entity).ExecuteCommand();
}
}
public class StoneService : DbContext
{
public void Add(Stone entity)
{
db.Insertable(entity).ExecuteCommand();
}
}
}

@ -1,9 +1,12 @@
using ProductionSystem_Log;
using ProductionSystem_Model.DbModel.Para;
using ProductionSystem_Model.DbModel.Protocol;
using ProductionSystem_Model.Enum;
using ProductionSystem_Model.ViewModel.Response.Para;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
namespace ProductionSystem_Service
{
@ -95,63 +98,121 @@ namespace ProductionSystem_Service
{
try
{
var temp = db.Queryable<T_ParaConfig>().Where(m => m.ParaCategory == paraCategory && m.IsActive);
return temp;
var temp1 = db.Queryable<T_ParaConfig>().Where(m => m.ParaCategory == paraCategory && m.IsActive);
return temp1;
}catch (Exception ex)
{
LogHelper.Error(ex, "执行ParaConfigService下QueryTargetValWithParaCodeByParaCategery时异常");
return null;
}
}
private T_ParaColumnConfig QueryLinByParaCategeryAndParaCode(string paraCategory,string paraCode)
{
T_ParaColumnConfig temp1 = db.Queryable<T_ParaColumnConfig>().
Where(m => m.ParaCategory == paraCategory && m.ParaCode == paraCode && m.IsActive).
First();
if (temp1 == null)
{
throw new Exception("未维护数据!请先维护!");
}
else
{
var temp2 = db.Queryable<T_ParaColumnConfig>().
Where(m => m.ParaCategory == paraCategory && m.ParaCode == paraCode && m.IsActive).
First().ProtocolType;
if (temp2 == null)
{
temp2 = "未配置通讯方式";
}
return db.Queryable<T_ParaColumnConfig>().Where(m => m.ParaCategory == paraCategory && m.ParaCode == paraCode && m.IsActive).First();
}
}
private T_Protocol_Config QueryComByLin(string lin)
{
T_Protocol_Config temp1 = db.Queryable<T_Protocol_Config>().Where(m => m.ProtocolCode == lin && m.IsActive).First();
if (temp1 == null)
{
throw new Exception("未维护数据!请先维护!");
}
string temp3 = db.Queryable<T_Protocol_Config>().Where(m => m.ProtocolCode == lin && m.IsActive).First().ProtocolType;
if (temp3 == null)
{
temp3 = "未配置串口";
}
return db.Queryable<T_Protocol_Config>().Where(m => m.ProtocolCode == lin && m.IsActive).First();
}
/// <summary>
/// 根据参数种类查询有效参数配置项,例如传“BZ1”、“BZ2”
/// 根据参数种类查询有效参数配置项,例如传“BZ1_DB”、“BZ2_DB
/// </summary>
/// <param name="paraCategory"></param>
/// <returns></returns>
public ParaTargetValVM GetParaTargetVal(string paraCategory)
public EditonType GetParaTargetVal(ModeTypeEnum modeTypeEnum)
{
ParaTargetValVM paraTargetVal = new ParaTargetValVM();
var paraConfig = QueryTargetValWithParaCodeByParaCategery(paraCategory).ToList();
EditonType editonType = new EditonType();
var paraConfig = QueryTargetValWithParaCodeByParaCategery(modeTypeEnum.ToString()).ToList();
for (int i = 0; i < paraConfig.Count; i++)
{
if(paraConfig[i].ParaCode == "STF1MS")
if(paraConfig[i].ParaCode == modeTypeEnum.ToString())
{
paraTargetVal.STF1TargetVal = paraConfig[i].TargetVal.ToString();
if (paraConfig[i].TargetVal != null) { editonType.STF1.TargetVal = paraConfig[i].TargetVal.ToString(); }
else { editonType.STF1.TargetVal = "空值"; }
editonType.STF1.Lin = QueryLinByParaCategeryAndParaCode(modeTypeEnum.ToString(), paraConfig[i].ParaCode).ProtocolType;
editonType.STF1.Com = QueryComByLin(editonType.STF1.Lin).Port;
continue;
}
else if (paraConfig[i].ParaCode == "STF2MS")
else if (paraConfig[i].ParaCode == "FKSTF2ZT_DB")
{
paraTargetVal.STF2TargetVal = paraConfig[i].TargetVal.ToString();
if (paraConfig[i].TargetVal != null) { editonType.STF2.TargetVal = paraConfig[i].TargetVal.ToString(); }
else { editonType.STF2.TargetVal = "空值"; }
editonType.STF2.Lin = QueryLinByParaCategeryAndParaCode(modeTypeEnum.ToString(), paraConfig[i].ParaCode).ProtocolType;
editonType.STF2.Com = QueryComByLin(editonType.STF2.Lin).Port;
continue;
}
else if (paraConfig[i].ParaCode == "DZPZF1")
else if (paraConfig[i].ParaCode == "DZPZF1_DB")
{
paraTargetVal.PZF1TargetVal = paraConfig[i].TargetVal.ToString();
if (paraConfig[i].TargetVal != null) { editonType.PZF1.TargetVal = paraConfig[i].TargetVal.ToString(); }
else { editonType.PZF1.TargetVal = "空值"; }
editonType.PZF1.Lin = QueryLinByParaCategeryAndParaCode(modeTypeEnum.ToString(), paraConfig[i].ParaCode).ProtocolType;
editonType.PZF1.Com = QueryComByLin(editonType.PZF1.Lin).Port;
continue;
}
else if (paraConfig[i].ParaCode == "DZPZF2")
else if (paraConfig[i].ParaCode == "DZPZF2_DB")
{
paraTargetVal.PZF2TargetVal = paraConfig[i].TargetVal.ToString();
if (paraConfig[i].TargetVal != null) { editonType.PZF2.TargetVal = paraConfig[i].TargetVal.ToString(); }
else { editonType.PZF2.TargetVal = "空值"; }
editonType.PZF2.Lin = QueryLinByParaCategeryAndParaCode(modeTypeEnum.ToString(), paraConfig[i].ParaCode).ProtocolType;
editonType.PZF2.Com = QueryComByLin(editonType.PZF2.Lin).Port;
continue;
}
else if (paraConfig[i].ParaCode == "SB1ZS")
else if (paraConfig[i].ParaCode == "SB1ZS_DB")
{
paraTargetVal.SB1TargetVal = paraConfig[i].TargetVal.ToString();
if (paraConfig[i].TargetVal != null) { editonType.SB1.TargetVal = paraConfig[i].TargetVal.ToString(); }
else { editonType.SB1.TargetVal = "空值"; }
editonType.SB1.Lin = QueryLinByParaCategeryAndParaCode(modeTypeEnum.ToString(), paraConfig[i].ParaCode).ProtocolType;
editonType.SB1.Com = QueryComByLin(editonType.SB1.Lin).Port;
continue;
}
else if (paraConfig[i].ParaCode == "SB2ZS")
else if (paraConfig[i].ParaCode == "SB2ZS_DB")
{
paraTargetVal.SB2TargetVal = paraConfig[i].TargetVal.ToString();
if (paraConfig[i].TargetVal != null) { editonType.SB2.TargetVal = paraConfig[i].TargetVal.ToString(); }
else { editonType.SB2.TargetVal = "空值"; }
editonType.SB2.Lin = QueryLinByParaCategeryAndParaCode(modeTypeEnum.ToString(), paraConfig[i].ParaCode).ProtocolType;
editonType.SB2.Com = QueryComByLin(editonType.SB2.Lin).Port;
continue;
}
else if (paraConfig[i].ParaCode == "SB3ZS")
else if (paraConfig[i].ParaCode == "SB3ZS_DB")
{
paraTargetVal.SB3TargetVal = paraConfig[i].TargetVal.ToString();
if (paraConfig[i].TargetVal != null) { editonType.SB3.TargetVal = paraConfig[i].TargetVal.ToString(); }
else { editonType.SB3.TargetVal = "空值"; }
editonType.SB3.Lin = QueryLinByParaCategeryAndParaCode(modeTypeEnum.ToString(), paraConfig[i].ParaCode).ProtocolType;
editonType.SB3.Com = QueryComByLin(editonType.SB3.Lin).Port;
continue;
}
}
return paraTargetVal;
return editonType;
}
/// <summary>

@ -105,6 +105,7 @@
<Compile Include="DataProductService.cs" />
<Compile Include="DbContext.cs" />
<Compile Include="DicService.cs" />
<Compile Include="ExvService.cs" />
<Compile Include="MenuRoleService.cs" />
<Compile Include="MenuService.cs" />
<Compile Include="ParaColumnConfigService.cs" />

@ -33,23 +33,29 @@ namespace ProductionSystem_UserControl.ExtendedControls
get { return txtTestVal.Text; }
set
{
if (txtTestVal.Text == "停止")
{
txtTestVal.ForeColor = Color.Red;
}
else if(txtTestVal.Text == "启动")
{
txtTestVal.ForeColor = Color.Green;
}
else
{
txtTestVal.ForeColor = Color.Black;
}
//if (txtTestVal.Text == "停止")
//{
// txtTestVal.ForeColor = Color.Red;
//}
//else if(txtTestVal.Text == "启动")
//{
// txtTestVal.ForeColor = Color.Green;
//}
//else
//{
// txtTestVal.ForeColor = Color.Black;
//}
_testValText = value;
txtTestVal.Text = _testValText;
}
}
public void SetForeColor(Color color)
{
this.txtTestVal.ForeColor = color;
}
//添加背景颜色
/// <summary>

Loading…
Cancel
Save