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.

175 lines
5.8 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.ExcelModel;
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;
using System.Data;
using System.Text;
/***************************************************************************************************
*
* 更新人sitong.dong
* 描述:安灯信息查询
* 修改时间2022.06.22
* 修改日志:系统迭代升级
*
**************************************************************************************************/
namespace Estsh.Core.Services
{
public class AndonInfoQueryService : BaseService<SysPartSnRule>, IAndonInfoQueryService
{
private readonly IAndonInfoQueryRepository repository;
public AndonInfoQueryService(IAndonInfoQueryRepository _repository) : base(_repository)
{
repository = _repository;
}
/// <summary>
/// 根据分页条件获取分页菜单数据
/// </summary>
/// <param name="partNo"></param>
/// <param name="pager"></param>
/// <param name="direction"></param>
/// <param name="sort"></param>
/// <returns></returns>
public Hashtable getListByPage(String txtStartTime, String txtEndTime, string type, Pager pager, String direction, String sort,String enabled)
{
Hashtable result = new Hashtable();
String strWhere = "";
if (!String.IsNullOrEmpty(txtStartTime) && !String.IsNullOrEmpty(txtEndTime))
{
strWhere += " AND ( g.start_time > '" + txtStartTime + "' AND g.end_time < '" + txtEndTime + "') ";
}
else { return null; }
if (!String.IsNullOrEmpty(type))
{
strWhere += " AND g.andon_type = '" + type.Trim() + "'";
}
if (!String.IsNullOrEmpty(enabled))
{
strWhere += " AND g.enabled = '" + enabled + "'";
}
Hashtable dt = repository.getListByPage(pager.pageSize, pager.pageNo, strWhere, sort + " ");
return dt;
}
/// <summary>
/// 查看菜单详情
/// </summary>
/// <param name="ruid"></param>
/// <returns></returns>
public Hashtable getPartSNRuleDetail(String ruid)
{
ruid = " ruid = " + ruid;
List<SysPartSnRule> dt = repository.getList(ruid, "");
Hashtable result = new Hashtable();
result.Add("ruid", dt[0].Ruid);
result.Add("type", dt[0].Type);
result.Add("lenght", dt[0].Lenght);
result.Add("from1", dt[0].From1);
result.Add("part_no", dt[0].PartNo);
result.Add("to1", dt[0].To1);
result.Add("fix1", dt[0].Fix1);
result.Add("from2", dt[0].From2);
result.Add("to2", dt[0].To2);
result.Add("fix2", dt[0].Fix2);
result.Add("part_id", dt[0].PartId);
//result.Add("ext_rule", dt[0]["ext_rule"]);
result.Add("enabled", dt[0].Enabled);
return result;
}
/// <summary>
/// 删除菜单
/// </summary>
/// <param name="ids"></param>
/// <returns></returns>
public int deletePartSNRule(String ids)
{
String[] idArray = ids.Split(',');
int count = 0;
foreach (String id in idArray)
{
if (!"".Equals(id))
{
count += this.repository.deletePartSNRule(id);
}
}
return count;
}
/// <summary>
/// 获取 类型 信息
/// BY NOAH
/// </summary>
/// <returns></returns>
public List<KeyValueResult> getTypeData()
{
return repository.getTypeData();
}
/// <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 txtStartTime, String txtEndTime, string type, Pager pager, String direction, String sort, Boolean isPage)
{
int rowCount = 0;
String strWhere = " AND 1=1 ";
if (!String.IsNullOrEmpty(txtStartTime) && !String.IsNullOrEmpty(txtEndTime))
{
strWhere += " AND ( g.start_time > '" + txtStartTime + "' AND g.end_time < '" + txtEndTime + "') ";
}
if (!String.IsNullOrEmpty(type))
{
strWhere += " AND g.andon_type = '" + type.Trim() + "'";
}
if (isPage)
{
rowCount = pager.pageSize;
}
else
{
rowCount = pager.pageSize;
}
return repository.getTableListByPage(rowCount, pager.pageNo, strWhere, sort + " ");
}
public List<GAndonLog> getAndonCount(string condition)
{
return repository.getAndonCount(condition);
}
public List<GAndonLog> getAndonTime(string condition)
{
return repository.getAndonTime(condition);
}
}
}