天津投入产出系统后端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

268 lines
6.8 KiB

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using QMAPP.BLL;
using QMAPP.FJC.Entity.Basic;
using QMAPP.FJC.DAL.Basic;
using QMAPP.FJC.BLL.Dict;
using QMFrameWork.Data;
using QMAPP.FJC.Entity;
using QMAPP.Entity;
namespace QMAPP.FJC.BLL.Basic
{
/// <summary>
/// 模块编号:M13-1
/// 作 用:先决条件校验规则
/// 作 者:王庆男
/// 编写日期:2015年06月09日
///</summary>
public class ProcessRuleBLL : BaseBLL
{
#region 获取信息
/// <summary>
/// 获取信息
/// </summary>
/// <param name="">条件</param>
/// <returns>信息</returns>
public ProcessRule Get(ProcessRule model)
{
try
{
return new ProcessRuleDAL().Get(model);
}
catch (Exception ex)
{
throw ex;
}
}
#endregion
#region 获取列表
/// <summary>
/// 获取列表
/// </summary>
/// <param name="condition">条件</param>
/// <param name="page">数据页</param>
/// <returns>数据页</returns>
public DataPage GetList(ProcessRule condition, DataPage page)
{
try
{
DictManageBLL processTypedict = new DictManageBLL(DictKind.PROCESSTYPE);
page = new ProcessRuleDAL().GetList(condition, page);
return page;
}
catch (Exception ex)
{
throw ex;
}
}
/// <summary>
/// 冷却工序
/// </summary>
/// <param name="condition"></param>
/// <param name="page"></param>
/// <returns></returns>
public DataPage GetListForSet(ProcessRule condition, DataPage page)
{
try
{
DictManageBLL processTypedict = new DictManageBLL(DictKind.PROCESSTYPE);
DictManageBLL ruleTypedict = new DictManageBLL(DictKind.RULETYPE);
page = new ProcessRuleDAL().GetListForSet(condition, page);
List<ProcessRule> list = page.Result as List<ProcessRule>;
foreach (var p in list)
{
p.RULECONTENT = processTypedict.GetDictValue(p.RULECONTENT);
p.RULETYPE = ruleTypedict.GetDictValue(p.RULETYPE);
}
page.Result = list;
return page;
}
catch (Exception ex)
{
throw ex;
}
}
/// <summary>
/// 获取列表
/// </summary>
/// <param name="condition">条件</param>
/// <returns>数据</returns>
public List<ProcessRule> GetAllList(ProcessRule condition)
{
try
{
#region 转换设备状态、接收控制指令、工序类别显示类型
List<ProcessRule> list = new ProcessRuleDAL().GetList(condition);
DictManageBLL dictRuleType = new DictManageBLL(DictKind.RULETYPE);
foreach (ProcessRule m in list)
{
//设备状态
m.RULETYPETEXT = dictRuleType.GetDictValue(m.RULETYPE);
}
#endregion
return list;
}
catch (Exception ex)
{
throw ex;
}
}
#endregion
#region 信息是否重复
/// <summary>
/// 判断名称是否存在
/// </summary>
/// <param name="info"></param>
/// <returns>true:已存在;fasel:不存在。</returns>
public bool ExistsProcessRule(ProcessRule model)
{
try
{
return new ProcessRuleDAL().ExistsRule(model);
}
catch (Exception ex)
{
throw ex;
}
}
#endregion
#region 插入信息
/// <summary>
/// 插入信息(单表)
/// </summary>
/// <param name="">信息</param>
/// <returns>插入行数</returns>
public int Insert(ProcessRule model)
{
try
{
//基本信息
model.PID = Guid.NewGuid().ToString();
model.CREATEUSER = this.LoginUser.UserID;
model.CREATEDATE = DateTime.Now;
model.UPDATEUSER = model.CREATEUSER;
model.UPDATEDATE = model.CREATEDATE;
ProcessRuleDAL cmdDAL = new ProcessRuleDAL();
if (ExistsProcessRule(model) == true)
return -1;
return new ProcessRuleDAL().Insert(model);
}
catch (Exception ex)
{
throw ex;
}
}
#endregion
#region 更新信息
/// <summary>
/// 更新信息
/// </summary>
/// <param name=""></param>
/// <returns>更新行数</returns>
public DataResult<int> Update(ProcessRule model)
{
try
{
DataResult<int> result = new DataResult<int>();
result.IsSuccess = true;
model.UPDATEUSER = this.LoginUser.UserID;
int i = new ProcessRuleDAL().Update(model);
if (i == 0)
{
result.IsSuccess = false;
}
result.Result = i;
return result;
}
catch (Exception ex)
{
throw ex;
}
}
#endregion
#region 删除
/// <summary>
/// 删除信息
/// </summary>
/// <param name=""></param>
/// <returns>删除个数</returns>
public int Delete(string strs)
{
int count = 0;
string[] list = strs.Split(":".ToCharArray());
try
{
foreach (string str in list)
{
count += this.DeleteProcessRule(new ProcessRule { PID = str });
}
return count;
}
catch (Exception ex)
{
throw ex;
}
}
/// <summary>
/// 删除信息
/// </summary>
/// <param name="">信息</param>
/// <returns>删除个数</returns>
public int DeleteProcessRule(ProcessRule model)
{
int count = 0;
try
{
count = new ProcessRuleDAL().Delete(model);
return count;
}
catch (Exception ex)
{
throw ex;
}
}
#endregion
}
}