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.

132 lines
5.2 KiB
C#

2 years ago
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;
using Estsh.Core.IRepositories;
using Estsh.Core.Dapper;
using Estsh.Core.Model.ExcelModel;
using Estsh.Core.Base;
/***************************************************************************************************
*
* sitong.dong
*
* 2022.06.22
*
*
**************************************************************************************************/
namespace Estsh.Core.Services
{
public class QualityResultService : BaseService<BaseEntity>, IQualityResultService
{
private readonly IQualityResultRepository repository;
public QualityResultService(IQualityResultRepository _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 getInQCListByPage(string prove, string evrtn, string matnr, string partSpec, string beginSynTim, string endSynTim, string synflg, Pager pager, String direction, String sort)
{
Hashtable result = new Hashtable();
String strWhere = " 1=1 ";
if (prove != null && !prove.Trim().Equals(""))
{
strWhere += "and prove like '" + prove.Trim() + "' ";
}
if (evrtn != null && !evrtn.Trim().Equals(""))
{
strWhere += "and evrtn like '%" + evrtn.Trim() + "%' ";
}
if (matnr != null && !matnr.Trim().Equals(""))
{
strWhere += "and matnr like '%" + matnr.Trim() + "%' ";
}
if (partSpec != null && !partSpec.Trim().Equals(""))
{
strWhere += "and part_spec like '%" + partSpec.Trim() + "%' ";
}
if (synflg != null && !synflg.Trim().Equals(""))
{
strWhere += "and synflg = '" + synflg.Trim() + "' ";
}
if (!String.IsNullOrEmpty(beginSynTim) && !String.IsNullOrEmpty(endSynTim))
{
strWhere += " and RECTIM BETWEEN '" + beginSynTim.Trim() + "' AND '" + endSynTim.Trim() + "' ";
}
if (String.IsNullOrEmpty(beginSynTim) && !String.IsNullOrEmpty(endSynTim))
{
strWhere += " and RECTIM <'" + endSynTim.Trim() + "' ";
}
if (!String.IsNullOrEmpty(beginSynTim) && String.IsNullOrEmpty(endSynTim))
{
strWhere += " and RECTIM > '" + beginSynTim.Trim() + "' ";
}
String orderBy = "";
if (sort != null && !"".Equals(sort.Trim()))
{
orderBy += typeof(WmsInqc).GetEntityColumnName(sort.Trim()) + " " + direction;
}
else
{
orderBy += typeof(WmsInqc).GetEntityColumnName("evrtn") + " " + direction;
}
result = repository.getListByPage(pager.pageSize, pager.pageNo, strWhere, orderBy);
return result;
}
public List<QualityResult> getSearchDataList(string prove, string evrtn, string matnr, string partSpec, string beginSynTim, string endSynTim, string synflg)
{
Hashtable result = new Hashtable();
String strWhere = " 1=1 ";
if (prove != null && !prove.Trim().Equals(""))
{
strWhere += "and prove like '%" + prove.Trim() + "%' ";
}
if (evrtn != null && !evrtn.Trim().Equals(""))
{
strWhere += "and evrtn like '%" + evrtn.Trim() + "%' ";
}
if (matnr != null && !matnr.Trim().Equals(""))
{
strWhere += "and matnr like '%" + matnr.Trim() + "%' ";
}
if (partSpec != null && !partSpec.Trim().Equals(""))
{
strWhere += "and part_spec like '%" + partSpec.Trim() + "%' ";
}
if (synflg != null && !synflg.Trim().Equals(""))
{
strWhere += "and synflg = '" + synflg.Trim() + "' ";
}
if (!String.IsNullOrEmpty(beginSynTim) && !String.IsNullOrEmpty(endSynTim))
{
strWhere += " and RECTIM BETWEEN '" + beginSynTim.Trim() + "' AND '" + endSynTim.Trim() + "' ";
}
if (String.IsNullOrEmpty(beginSynTim) && !String.IsNullOrEmpty(endSynTim))
{
strWhere += " and RECTIM <'" + endSynTim.Trim() + "' ";
}
if (!String.IsNullOrEmpty(beginSynTim) && String.IsNullOrEmpty(endSynTim))
{
strWhere += " and RECTIM > '" + beginSynTim.Trim() + "' ";
}
string orderBy = " order by evrtn,convert(int,etenr) ";
return repository.getSearchDataList(strWhere, orderBy);
}
}
}