|
|
using Estsh.Core.Dapper;
|
|
|
using Estsh.Core.IRepositories;
|
|
|
using Estsh.Core.Model.ExcelModel;
|
|
|
using Estsh.Core.Models;
|
|
|
using Estsh.Core.Repository.IRepositories;
|
|
|
using Estsh.Core.Services.IServices;
|
|
|
using Estsh.Core.Util;
|
|
|
using System.Collections;
|
|
|
|
|
|
|
|
|
/***************************************************************************************************
|
|
|
*
|
|
|
* 更新人:sitong.dong
|
|
|
* 描述:DPS管理
|
|
|
* 修改时间:2022.06.22
|
|
|
* 修改日志:系统迭代升级
|
|
|
*
|
|
|
**************************************************************************************************/
|
|
|
namespace Estsh.Core.Services
|
|
|
{
|
|
|
public class DPSDefineService : BaseService<GDps>, IDPSDefineService
|
|
|
{
|
|
|
private readonly IDPSDefineRepository repository;
|
|
|
|
|
|
public DPSDefineService(IDPSDefineRepository _repository) : base(_repository)
|
|
|
{
|
|
|
repository = _repository;
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 根据分页条件获取分页菜单数据
|
|
|
/// </summary>
|
|
|
/// <param name="partNo_search"></param>
|
|
|
/// <param name="pager"></param>
|
|
|
/// <param name="direction"></param>
|
|
|
/// <param name="sort"></param>
|
|
|
/// <returns></returns>
|
|
|
public Hashtable getDPSListByPage(String partNo_search, String mt_area_search, String control_id_search, String addr_search,
|
|
|
String mt_group_search, String enabled_search, Pager pager, String direction, String sort)
|
|
|
{
|
|
|
Hashtable result = new Hashtable();
|
|
|
|
|
|
String strWhere = " 1=1 ";
|
|
|
if (!String.IsNullOrEmpty(partNo_search))
|
|
|
{
|
|
|
strWhere += " and a.part_no = '" + partNo_search.Trim() + "'";
|
|
|
}
|
|
|
if (!String.IsNullOrEmpty(mt_area_search))
|
|
|
{
|
|
|
strWhere += " and a.mt_area like '%" + mt_area_search.Trim() + "%'";
|
|
|
}
|
|
|
//因为select下拉框取view_board_id得到的是view_board_name,select的名字叫view_board_id
|
|
|
if (!String.IsNullOrEmpty(control_id_search))
|
|
|
{
|
|
|
strWhere += " and a.control_id = '" + control_id_search.Trim() + "'";
|
|
|
}
|
|
|
|
|
|
if (!String.IsNullOrEmpty(addr_search))
|
|
|
{
|
|
|
strWhere += " and a.addr_id = '" + addr_search.Trim() + "'";
|
|
|
}
|
|
|
if (!String.IsNullOrEmpty(mt_group_search))
|
|
|
{
|
|
|
strWhere += " and a.mt_group = '" + mt_group_search.Trim() + "'";
|
|
|
}
|
|
|
if (!String.IsNullOrEmpty(enabled_search))
|
|
|
{
|
|
|
strWhere += " and a.enabled = '" + enabled_search.Trim() + "'";
|
|
|
}
|
|
|
|
|
|
String orderBy = "";
|
|
|
if (sort != null && !"".Equals(sort.Trim()))
|
|
|
{
|
|
|
orderBy += typeof(GDps).GetEntityColumnName(sort.Trim()) + " " + direction;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
orderBy += typeof(GDps).GetEntityColumnName("ruid") + " " + direction;
|
|
|
}
|
|
|
|
|
|
return repository.getListByPage(pager.pageSize, pager.pageNo, strWhere, orderBy);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 保存菜单数据
|
|
|
/// </summary>
|
|
|
/// <param name="htParams"></param>
|
|
|
/// <returns></returns>
|
|
|
public int saveDPS(GDps htParams)
|
|
|
{
|
|
|
return repository.saveDPS(htParams);
|
|
|
}
|
|
|
/// <summary>
|
|
|
/// 更新菜单数据
|
|
|
/// </summary>
|
|
|
/// <param name="htParams"></param>
|
|
|
/// <returns></returns>
|
|
|
public int updateDPS(GDps htParams)
|
|
|
{
|
|
|
return repository.updateDPS(htParams);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 查看菜单详情
|
|
|
/// </summary>
|
|
|
/// <param name="ruid"></param>
|
|
|
/// <returns></returns>
|
|
|
public Hashtable getDPSDetail(String ruid)
|
|
|
{
|
|
|
ruid = " a.ruid = " + ruid;
|
|
|
List<GDps> dt = repository.getList(ruid, "");
|
|
|
Hashtable result = new Hashtable();
|
|
|
result.Add("ruid", dt[0].Ruid);
|
|
|
result.Add("mtArea", dt[0].MtArea);
|
|
|
result.Add("mtGroup", dt[0].mtGroup);
|
|
|
//result.Add("view_board_name", dt.Rows[0]["view_board_name"]);
|
|
|
result.Add("viewBoardId", dt[0].ViewBoardId);
|
|
|
result.Add("addrId", dt[0].AddrId);
|
|
|
result.Add("sysPartNo", dt[0].sysPartNo);
|
|
|
result.Add("partName", dt[0].PartName);
|
|
|
result.Add("partSpec", dt[0].partSpec);
|
|
|
result.Add("isFinish", dt[0].IsFinish);
|
|
|
result.Add("controlId", dt[0].ControlId);
|
|
|
result.Add("enabled", dt[0].Enabled);
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 删除菜单
|
|
|
/// </summary>
|
|
|
/// <param name="ids"></param>
|
|
|
/// <returns></returns>
|
|
|
public int deleteDPS(String ids)
|
|
|
{
|
|
|
String[] idArray = ids.Split(',');
|
|
|
int count = 0;
|
|
|
foreach (String id in idArray)
|
|
|
{
|
|
|
if (!"".Equals(id))
|
|
|
{
|
|
|
count += this.repository.deleteDPS(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);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 获取 类型 信息
|
|
|
/// BY NOAH
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
//public ArrayList getBoardName()
|
|
|
//{
|
|
|
// Hashtable result = new Hashtable();
|
|
|
|
|
|
// DataTable dt = repository.getBoardName();
|
|
|
|
|
|
// return DataTypeConvert.NewObject.DataTableToArrayList(dt);
|
|
|
//}
|
|
|
/// <summary>
|
|
|
/// 判断是否存在 用户输入的零件号
|
|
|
/// BY NOAH
|
|
|
/// </summary>
|
|
|
/// <param name="part_no"></param>
|
|
|
/// <returns></returns>
|
|
|
public String isExsitPart_no(String part_no)
|
|
|
{
|
|
|
return this.repository.isExsitPart_no(part_no);
|
|
|
}
|
|
|
/// <summary>
|
|
|
/// 根据分页条件获取分页菜单数据
|
|
|
/// </summary>
|
|
|
/// <param name="menuName">查询条件</param>
|
|
|
/// <param name="pager"></param>
|
|
|
/// <param name="direction">排序方式</param>
|
|
|
/// <param name="sort">排序字段</param>
|
|
|
/// <returns></returns>
|
|
|
public Hashtable getTableListByPage(String partNo_search, String mt_area_search, String control_id_search, String addr_search,
|
|
|
String mt_group_search, String enabled_search, Pager pager, String direction, String sort, Boolean isPage)
|
|
|
{
|
|
|
int rowCount = 0;
|
|
|
String strWhere = " 1=1 ";
|
|
|
if (!String.IsNullOrEmpty(partNo_search.Trim()))
|
|
|
{
|
|
|
strWhere += " and a.part_no = '" + partNo_search.Trim() + "'";
|
|
|
}
|
|
|
if (!String.IsNullOrEmpty(mt_area_search.Trim()))
|
|
|
{
|
|
|
strWhere += " and a.mt_area like '%" + mt_area_search.Trim() + "%'";
|
|
|
}
|
|
|
//因为select下拉框取view_board_id得到的是view_board_name,select的名字叫view_board_id
|
|
|
if (!String.IsNullOrEmpty(control_id_search))
|
|
|
{
|
|
|
strWhere += " and a.control_id = '" + control_id_search.Trim() + "'";
|
|
|
}
|
|
|
|
|
|
if (!String.IsNullOrEmpty(addr_search))
|
|
|
{
|
|
|
strWhere += " and a.addr_id = '" + addr_search.Trim() + "'";
|
|
|
}
|
|
|
if (!String.IsNullOrEmpty(mt_group_search))
|
|
|
{
|
|
|
strWhere += " and a.mt_group = '" + mt_group_search.Trim() + "'";
|
|
|
}
|
|
|
if (!String.IsNullOrEmpty(enabled_search.Trim()))
|
|
|
{
|
|
|
strWhere += " and a.enabled = '" + enabled_search.Trim() + "'";
|
|
|
}
|
|
|
|
|
|
String orderBy = "";
|
|
|
if (sort != null && !"".Equals(sort.Trim()))
|
|
|
{
|
|
|
orderBy += typeof(GDps).GetEntityColumnName(sort.Trim()) + " " + direction;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
orderBy += typeof(GDps).GetEntityColumnName("ruid") + " " + direction;
|
|
|
}
|
|
|
|
|
|
//页数
|
|
|
if (isPage)
|
|
|
{
|
|
|
rowCount = pager.pageSize;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
rowCount = pager.pageSize;
|
|
|
}
|
|
|
return repository.getTableListByPage(rowCount, pager.pageNo, strWhere, orderBy);
|
|
|
}
|
|
|
}
|
|
|
} |