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, IProcessDefineService { private readonly IProcessDefineRepository repository; public ProcessDefineService(IProcessDefineRepository _repository) : base(_repository) { repository = _repository; } /// /// 根据分页条件获取分页菜单数据 /// /// /// /// /// /// 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); } /// /// 获取下拉框中的区段数据 /// /// public List getStageInfo() { return repository.getStageInfo(); } /// /// 获取作业类型数据 /// /// public List getOperateType() { return repository.getOperateType(); } /// /// 保存菜单数据 /// /// /// public int savePdline(SysProcess htParams) { return repository.savePdline(htParams); } /// /// 更新菜单数据 /// /// /// public int updatePdline(SysProcess htParams) { return repository.updatePdline(htParams); } /// /// 查看菜单详情 /// /// /// public Hashtable getProcessDetail(String process_id) { process_id = " process_id = " + process_id; List 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; } /// /// 删除菜单 /// /// /// 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; } /// /// 启用 /// /// /// public int EnableData(String ids) { ids = ids.Substring(0, ids.Length - 1); return this.repository.EnableData(ids); } /// /// 禁用 /// /// /// public int DisableData(String ids) { ids = ids.Substring(0, ids.Length - 1); return this.repository.DisableData(ids); } } }