You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

171 lines
5.5 KiB
C#

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

using Estsh.Core.Dapper;
using Estsh.Core.IRepositories;
using Estsh.Core.Model.Result;
using Estsh.Core.Models;
using Estsh.Core.Repository.IRepositories;
using Estsh.Core.Services.IServices;
using Estsh.Core.Util;
using System.Collections;
/***************************************************************************************************
*
* 更新人sitong.dong
* 描述:制程定义
* 修改时间2022.06.22
* 修改日志:系统迭代升级
*
**************************************************************************************************/
namespace Estsh.Core.Services
{
public class ProcessDefineService : BaseService<SysProcess>, IProcessDefineService
{
private readonly IProcessDefineRepository repository;
public ProcessDefineService(IProcessDefineRepository _repository) : base(_repository)
{
repository = _repository;
}
/// <summary>
/// 根据分页条件获取分页菜单数据
/// </summary>
/// <param name="menuName"></param>
/// <param name="pager"></param>
/// <param name="direction"></param>
/// <param name="sort"></param>
/// <returns></returns>
public Hashtable getProcessListByPage(String process_name, Pager pager, String direction, String sort, String factoryId, String enabled)
{
String strWhere = " 1=1 ";
if (process_name != null && !process_name.Trim().Equals(""))
{
strWhere += " and a.process_name like '%" + process_name.Trim() + "%'";
}
if (enabled != null && !enabled.Trim().Equals(""))
{
strWhere += " and a.enabled = '" + enabled + "'";
}
if (factoryId != null && !factoryId.Trim().Equals(""))
{
strWhere += " and a.factory_id = '" + factoryId + "'";
}
String orderBy = "";
if (sort != null && !"".Equals(sort.Trim()))
{
orderBy += typeof(SysProcess).GetEntityColumnName(sort.Trim()) + " " + direction;
}
else
{
orderBy += typeof(SysProcess).GetEntityColumnName("ProcessId") + " " + direction;
}
return repository.getListByPage(pager.pageSize, pager.pageNo, strWhere, orderBy);
}
/// <summary>
/// 获取下拉框中的区段数据
/// </summary>
/// <returns></returns>
public List<KeyValueResult> getStageInfo()
{
return repository.getStageInfo();
}
/// <summary>
/// 获取作业类型数据
/// </summary>
/// <returns></returns>
public List<KeyValueResult> getOperateType()
{
return repository.getOperateType();
}
/// <summary>
/// 保存菜单数据
/// </summary>
/// <param name="htParams"></param>
/// <returns></returns>
public int savePdline(SysProcess htParams)
{
return repository.savePdline(htParams);
}
/// <summary>
/// 更新菜单数据
/// </summary>
/// <param name="htParams"></param>
/// <returns></returns>
public int updatePdline(SysProcess htParams)
{
return repository.updatePdline(htParams);
}
/// <summary>
/// 查看菜单详情
/// </summary>
/// <param name="ruid"></param>
/// <returns></returns>
public Hashtable getProcessDetail(String process_id)
{
process_id = " process_id = " + process_id;
List<SysProcess> dt = repository.getList(process_id, "");
Hashtable result = new Hashtable();
result.Add("factoryId", dt[0].FactoryId);
result.Add("factoryName", dt[0].FactoryName);
result.Add("factoryCode", dt[0].FactoryCode);
result.Add("processName", dt[0].ProcessName);
result.Add("processId", dt[0].ProcessId);
result.Add("processDesc", dt[0].ProcessDesc);
result.Add("processCode", dt[0].ProcessCode);
result.Add("stageName", dt[0].StageName);
result.Add("stageId", dt[0].StageId);
result.Add("typeName", dt[0].TypeName);
result.Add("typeId", dt[0].TypeId);
result.Add("enabled", dt[0].Enabled);
return result;
}
/// <summary>
/// 删除菜单
/// </summary>
/// <param name="ids"></param>
/// <returns></returns>
public int deleteProcess(String ids)
{
String[] idArray = ids.Split(',');
int count = 0;
foreach (String id in idArray)
{
if (!"".Equals(id))
{
count += this.repository.deleteProcess(id);
}
}
return count;
}
/// <summary>
/// 启用
/// </summary>
/// <param name="ids"></param>
/// <returns></returns>
public int EnableData(String ids)
{
ids = ids.Substring(0, ids.Length - 1);
return this.repository.EnableData(ids);
}
/// <summary>
/// 禁用
/// </summary>
/// <param name="ids"></param>
/// <returns></returns>
public int DisableData(String ids)
{
ids = ids.Substring(0, ids.Length - 1);
return this.repository.DisableData(ids);
}
}
}