|
|
using System.Collections;
|
|
|
using Estsh.Core.Util;
|
|
|
using Estsh.Core.Repository.IRepositories;
|
|
|
using Estsh.Core.Services.IServices;
|
|
|
using Estsh.Core.Models;
|
|
|
using Estsh.Core.Model.Result;
|
|
|
|
|
|
/***************************************************************************************************
|
|
|
*
|
|
|
* 更新人:sitong.dong
|
|
|
* 描述:不良原因
|
|
|
* 修改时间:2022.06.22
|
|
|
* 修改日志:系统迭代升级
|
|
|
*
|
|
|
**************************************************************************************************/
|
|
|
namespace Estsh.Core.Services
|
|
|
{
|
|
|
public class DefectReasonService : BaseService<SysReason>, IDefectReasonService
|
|
|
{
|
|
|
private readonly IDefectReasonRepository repository;
|
|
|
public DefectReasonService(IDefectReasonRepository _repository) : base(_repository)
|
|
|
{
|
|
|
repository = _repository;
|
|
|
}
|
|
|
public List<Models.SysWebGridColumn> GetGridItems()
|
|
|
{
|
|
|
List<Models.SysWebGridColumn> gridItems = new List<Models.SysWebGridColumn>();
|
|
|
Models.SysWebGridColumn item = new Models.SysWebGridColumn();
|
|
|
item.Display = "id";
|
|
|
item.Name = "reason_id";
|
|
|
item.Hide = true;
|
|
|
gridItems.Add(item);
|
|
|
|
|
|
item = new Models.SysWebGridColumn();
|
|
|
item.Display = "不良原因代码";
|
|
|
item.Name = "reason_code";
|
|
|
item.Width = "20%";
|
|
|
gridItems.Add(item);
|
|
|
|
|
|
item = new Models.SysWebGridColumn();
|
|
|
item.Display = "不良级别";
|
|
|
item.Name = "reason_level";
|
|
|
item.Width = "20%";
|
|
|
gridItems.Add(item);
|
|
|
|
|
|
item = new Models.SysWebGridColumn();
|
|
|
item.Display = "不良类型";
|
|
|
item.Name = "reason_type";
|
|
|
item.Width = "20%";
|
|
|
gridItems.Add(item);
|
|
|
|
|
|
item = new Models.SysWebGridColumn();
|
|
|
item.Display = "不良描述";
|
|
|
item.Name = "reason_desc";
|
|
|
item.Width = "20%";
|
|
|
gridItems.Add(item);
|
|
|
|
|
|
return gridItems;
|
|
|
}
|
|
|
|
|
|
public Hashtable GetDefectReasonWhere(Pager pager)
|
|
|
{
|
|
|
Hashtable result = new Hashtable();
|
|
|
string whereStr = "enabled = 'Y'";
|
|
|
return repository.GetDefectReasonWhere(whereStr, pager);
|
|
|
|
|
|
}
|
|
|
|
|
|
public bool UpdateById(SysReason param)
|
|
|
{
|
|
|
return repository.UpdateReason(param);
|
|
|
}
|
|
|
|
|
|
public bool AddDefect(SysReason htParams)
|
|
|
{
|
|
|
return repository.AddDefectReason(htParams);
|
|
|
}
|
|
|
|
|
|
public Hashtable GetReasonById(int reason_id)
|
|
|
{
|
|
|
Hashtable result = new Hashtable();
|
|
|
string whereStr = string.Format("reason_id = {0}", reason_id);
|
|
|
Pager pager = new Pager();
|
|
|
pager.pageNo = 1;
|
|
|
pager.pageSize = 10;
|
|
|
//string whereStr = string.Format( "[enabled] = '{0}'");
|
|
|
return repository.GetDefectReasonWhere(whereStr, pager);
|
|
|
}
|
|
|
|
|
|
public bool DeleteReasonById(int reason_id)
|
|
|
{
|
|
|
return repository.DeleteReasonById(reason_id);
|
|
|
}
|
|
|
|
|
|
/// <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);
|
|
|
}
|
|
|
}
|
|
|
}
|