87 lines
2.6 KiB
C#
87 lines
2.6 KiB
C#
|
|
using Models.Models;
|
|||
|
|
using SamplePre.DAL;
|
|||
|
|
using SamplePre.DAL.DBContext;
|
|||
|
|
using SamplePre.Models.Ext;
|
|||
|
|
using System;
|
|||
|
|
using System.Collections.Generic;
|
|||
|
|
using System.Linq;
|
|||
|
|
using System.Text;
|
|||
|
|
using System.Threading.Tasks;
|
|||
|
|
|
|||
|
|
namespace SamplePre.ProcessBll.BLL
|
|||
|
|
{
|
|||
|
|
public class SysParamBll
|
|||
|
|
{
|
|||
|
|
public int DelSysParm(string id)
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
int val = DBFactory.Instance.Deleteable<sys_parm>().Where(p => p.id == id).ExecuteCommand();
|
|||
|
|
|
|||
|
|
return val;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 判断该参数是否被使用,已使用不能删除
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="parmId"></param>
|
|||
|
|
/// <returns></returns>
|
|||
|
|
/// <exception cref="NotImplementedException"></exception>
|
|||
|
|
public bool IsExtisActionParam(string parmId)
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
//动作参数
|
|||
|
|
List<sys_action_parm_map> data = DBFactory.Instance.Queryable<sys_action_parm_map>()
|
|||
|
|
.Where(p=>p.parm_id == parmId).ToList();
|
|||
|
|
if(data.Count > 0) return true;
|
|||
|
|
|
|||
|
|
//标准动作参数配置表
|
|||
|
|
List<sys_standard_action_parm> data2 = DBFactory.Instance.Queryable<sys_standard_action_parm>()
|
|||
|
|
.Where(p => p.parm_id == parmId).ToList();
|
|||
|
|
if (data2.Count > 0) return true;
|
|||
|
|
|
|||
|
|
|
|||
|
|
return false;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 判断plc编码是否存在
|
|||
|
|
/// </summary>
|
|||
|
|
/// <returns></returns>
|
|||
|
|
/// <exception cref="NotImplementedException"></exception>
|
|||
|
|
public bool IsExtisPlCcode(string plcCode)
|
|||
|
|
{
|
|||
|
|
List<sys_parm> data2 = DBFactory.Instance.Queryable<sys_parm>()
|
|||
|
|
.Where(p => p.plc_type == plcCode).ToList();
|
|||
|
|
if (data2.Count > 0) return true;
|
|||
|
|
|
|||
|
|
return false;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public List<sys_parm> QuerySysParm()
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
List<sys_parm> data = DBFactory.Instance.Queryable<sys_parm>().ToList();
|
|||
|
|
|
|||
|
|
return data;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public int SaveSysParm(sys_parm parm)
|
|||
|
|
{
|
|||
|
|
int val = DBFactory.Instance.Insertable<sys_parm>(parm).ExecuteCommand();
|
|||
|
|
return val;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 更新参数数据
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="parm"></param>
|
|||
|
|
/// <exception cref="NotImplementedException"></exception>
|
|||
|
|
public int UpdateSysParm(sys_parm parm)
|
|||
|
|
{
|
|||
|
|
int val = DBFactory.Instance.Updateable<sys_parm>(parm).ExecuteCommand();
|
|||
|
|
|
|||
|
|
return val;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|