|
|
using Dapper;
|
|
|
using Estsh.Core.Base;
|
|
|
using Estsh.Core.Dapper;
|
|
|
using Estsh.Core.Model.ExcelModel;
|
|
|
using Estsh.Core.Model.Result;
|
|
|
using Estsh.Core.Models;
|
|
|
using Estsh.Core.Repository.IRepositories;
|
|
|
using System.Collections;
|
|
|
using System.Data;
|
|
|
using System.Text;
|
|
|
|
|
|
/***************************************************************************************************
|
|
|
*
|
|
|
* 更新人:sitong.dong
|
|
|
* 描述:质检结果接口返回查询
|
|
|
* 修改时间:2022.06.22
|
|
|
* 修改日志:系统迭代升级
|
|
|
*
|
|
|
**************************************************************************************************/
|
|
|
namespace Estsh.Core.Repositories
|
|
|
{
|
|
|
/// <summary>
|
|
|
/// 数据访问类
|
|
|
/// </summary>
|
|
|
public class QualityResultRepository : BaseRepository<BaseEntity>, IQualityResultRepository
|
|
|
{
|
|
|
public QualityResultRepository(DapperDbContext _dapperDbContext) : base(_dapperDbContext)
|
|
|
{
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 获取分页数据列表
|
|
|
/// </summary>
|
|
|
public Hashtable getListByPage(int PageSize, int PageIndex, string strWhere, string OrderBy)
|
|
|
{
|
|
|
using (IDbConnection dbConn = dapperDbContext.GetDbConnection())
|
|
|
{
|
|
|
dbConn.Open();
|
|
|
OrderBy = "evrtn,convert(int,etenr)";
|
|
|
Hashtable result = new Hashtable();
|
|
|
if (PageSize == 0)
|
|
|
return result;
|
|
|
DynamicParameters Params = new DynamicParameters();
|
|
|
Params.Add("@TotalCount", 0, DbType.Int32, ParameterDirection.Output);
|
|
|
Params.Add("@TotalPage", 0, DbType.Int32, ParameterDirection.Output);
|
|
|
Params.Add("@GroupColumn", "");
|
|
|
Params.Add("@Table", "wms_inqc a (nolock) left join sys_part b (nolock) on a.matnr=b.part_no ");
|
|
|
Params.Add("@Column", "a.*,b.part_spec,b.part_spec2");
|
|
|
Params.Add("@PageSize", PageSize);
|
|
|
Params.Add("@CurrentPage", PageIndex);
|
|
|
Params.Add("@Condition", strWhere);
|
|
|
Params.Add("@OrderColumn", OrderBy);
|
|
|
Params.Add("@Group", 0);
|
|
|
|
|
|
List<WmsInqc> dataList = dbConn.Query<WmsInqc>("Com_Pagination", Params, commandType: CommandType.StoredProcedure).ToList();
|
|
|
result.Add("dataList", dataList);
|
|
|
result.Add("totalCount", Params.Get<int>("@TotalCount"));
|
|
|
return result;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
public List<QualityResult> getSearchDataList(string strWhere, string orderBy)
|
|
|
{
|
|
|
using (IDbConnection dbConn = dapperDbContext.GetDbConnection())
|
|
|
{
|
|
|
dbConn.Open();
|
|
|
StringBuilder SqlStringBuilder = new StringBuilder(1024);
|
|
|
SqlStringBuilder.Append(" SELECT BSTYP,EVRTN,PROVE,ETENR,WERKS,MATNR,b.part_spec,b.part_spec2,LIFNR,convert(int,ZDEV) ZDEV,LGORT,a.UNIT,ZPOST,ZTIME, ");
|
|
|
SqlStringBuilder.Append(" RECTIM,case WHEN SYNFLG='N' THEN '未同步' WHEN SYNFLG='Y' THEN '已同步' ELSE '同步错误' end SYNFLG ");
|
|
|
SqlStringBuilder.Append(" ,ERRMSG,SYNTIM FROM dbo.WMS_INQC a (nolock) left join sys_part b (nolock) on a.matnr=b.part_no ");
|
|
|
SqlStringBuilder.Append(" where "+ strWhere +" "+ orderBy);
|
|
|
List<QualityResult> dataList = dbConn.Query<QualityResult>(SqlStringBuilder.ToString()).ToList();
|
|
|
return dataList;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|