|
|
@ -1,9 +1,12 @@
|
|
|
|
using ProductionSystem_Log;
|
|
|
|
using ProductionSystem_Log;
|
|
|
|
using ProductionSystem_Model.DbModel.Para;
|
|
|
|
using ProductionSystem_Model.DbModel.Para;
|
|
|
|
|
|
|
|
using ProductionSystem_Model.DbModel.Protocol;
|
|
|
|
|
|
|
|
using ProductionSystem_Model.Enum;
|
|
|
|
using ProductionSystem_Model.ViewModel.Response.Para;
|
|
|
|
using ProductionSystem_Model.ViewModel.Response.Para;
|
|
|
|
using SqlSugar;
|
|
|
|
using SqlSugar;
|
|
|
|
using System;
|
|
|
|
using System;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
|
|
using System.Linq;
|
|
|
|
|
|
|
|
|
|
|
|
namespace ProductionSystem_Service
|
|
|
|
namespace ProductionSystem_Service
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -95,63 +98,121 @@ namespace ProductionSystem_Service
|
|
|
|
{
|
|
|
|
{
|
|
|
|
try
|
|
|
|
try
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var temp = db.Queryable<T_ParaConfig>().Where(m => m.ParaCategory == paraCategory && m.IsActive);
|
|
|
|
var temp1 = db.Queryable<T_ParaConfig>().Where(m => m.ParaCategory == paraCategory && m.IsActive);
|
|
|
|
return temp;
|
|
|
|
return temp1;
|
|
|
|
}catch (Exception ex)
|
|
|
|
}catch (Exception ex)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
LogHelper.Error(ex, "执行ParaConfigService下QueryTargetValWithParaCodeByParaCategery时异常");
|
|
|
|
LogHelper.Error(ex, "执行ParaConfigService下QueryTargetValWithParaCodeByParaCategery时异常");
|
|
|
|
return null;
|
|
|
|
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>
|
|
|
|
/// <summary>
|
|
|
|
/// 根据参数种类查询有效参数配置项,例如传“BZ1”、“BZ2”
|
|
|
|
/// 根据参数种类查询有效参数配置项,例如传“BZ1_DB”、“BZ2_DB”
|
|
|
|
/// </summary>
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="paraCategory"></param>
|
|
|
|
/// <param name="paraCategory"></param>
|
|
|
|
/// <returns></returns>
|
|
|
|
/// <returns></returns>
|
|
|
|
public ParaTargetValVM GetParaTargetVal(string paraCategory)
|
|
|
|
public EditonType GetParaTargetVal(ModeTypeEnum modeTypeEnum)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
ParaTargetValVM paraTargetVal = new ParaTargetValVM();
|
|
|
|
EditonType editonType = new EditonType();
|
|
|
|
var paraConfig = QueryTargetValWithParaCodeByParaCategery(paraCategory).ToList();
|
|
|
|
var paraConfig = QueryTargetValWithParaCodeByParaCategery(modeTypeEnum.ToString()).ToList();
|
|
|
|
for (int i = 0; i < paraConfig.Count; i++)
|
|
|
|
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;
|
|
|
|
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;
|
|
|
|
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;
|
|
|
|
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;
|
|
|
|
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;
|
|
|
|
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;
|
|
|
|
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;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return paraTargetVal;
|
|
|
|
return editonType;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
|