using System.Collections;
using Estsh.Core.Models;
using Estsh.Core.Repository.IRepositories;
using Estsh.Core.Util;
using Estsh.Core.Services.IServices;
using Estsh.Core.Model.Result;
using Estsh.Core.Dapper;
using Estsh.Core.Model.ExcelModel;
/***************************************************************************************************
*
* 更新人:sitong.dong
* 描述:回冲日志查询
* 修改时间:2022.06.22
* 修改日志:系统迭代升级
*
**************************************************************************************************/
namespace Estsh.Core.Services
{
///
/// 回冲日志查询
///
public class ProductDeductLogQueryService : BaseService, IProductDeductLogQueryService
{
private readonly IProductDeductLogQueryRepository repository;
public ProductDeductLogQueryService(IProductDeductLogQueryRepository _repository) : base(_repository)
{
repository = _repository;
}
#region 收货查询补打
///
/// 根据分页条件获取列表
///
///
///
///
///
///
public Hashtable getProductListByPage(string serialNumber, string partNo, string partSpec, string itemPartNo, string itemPartSpec, string startTime, string endTime, string enabled, Pager pager, String direction, String sort)
{
Hashtable result = new Hashtable();
String strWhere = " 1=1 ";
if (serialNumber != null && !serialNumber.Trim().Equals(""))
{
strWhere += "and a.serial_number like '%" + serialNumber.Trim() + "%' ";
}
if (partNo != null && !partNo.Trim().Equals(""))
{
strWhere += "and a.part_no like '%" + partNo.Trim() + "%' ";
}
if (partSpec != null && !partSpec.Trim().Equals(""))
{
strWhere += "and pt.part_spec like '%" + partSpec.Trim() + "%' ";
}
if (itemPartNo != null && !itemPartNo.Trim().Equals(""))
{
strWhere += "and a.item_part_no like '%" + itemPartNo.Trim() + "%' ";
}
if (itemPartSpec != null && !itemPartSpec.Trim().Equals(""))
{
strWhere += "and zpt.part_Spec like '%" + itemPartSpec.Trim() + "%' ";
}
if (!String.IsNullOrEmpty(startTime) && !String.IsNullOrEmpty(endTime))
{
strWhere += " and a.create_time BETWEEN '" + startTime.Trim() + "' AND '" + endTime.Trim() + "'";
}
else if (String.IsNullOrEmpty(startTime) && !String.IsNullOrEmpty(endTime))
{
strWhere += " and a.create_time < '" + endTime.Trim() + "'";
}
else if (!String.IsNullOrEmpty(startTime) && String.IsNullOrEmpty(endTime))
{
strWhere += " and a.create_time >'" + startTime.Trim() + "'";
}
else
{
strWhere += " and a.create_time BETWEEN '" + DateTime.Now.AddDays(-7).ToString("yyyy-MM-dd HH:mm:ss") + "' AND '" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "'";
}
//strWhere += " and is_not_find=1 ";
String orderBy = " a.serial_number ";
result = repository.getProductListByPage(pager.pageSize, pager.pageNo, strWhere, orderBy);
return result;
}
public List getExportList(string serialNumber, string partNo, string partSpec, string itemPartNo, string itemPartSpec, string startTime, string endTime, string enabled)
{
String strWhere = " 1=1 ";
if (serialNumber != null && !serialNumber.Trim().Equals(""))
{
strWhere += "and a.serial_number like '%" + serialNumber.Trim() + "%' ";
}
if (partNo != null && !partNo.Trim().Equals(""))
{
strWhere += "and a.part_no like '%" + partNo.Trim() + "%' ";
}
if (partSpec != null && !partSpec.Trim().Equals(""))
{
strWhere += "and pt.part_spec like '%" + partSpec.Trim() + "%' ";
}
if (itemPartNo != null && !itemPartNo.Trim().Equals(""))
{
strWhere += "and a.item_part_no like '%" + itemPartNo.Trim() + "%' ";
}
if (itemPartSpec != null && !itemPartSpec.Trim().Equals(""))
{
strWhere += "and zpt.part_Spec like '%" + itemPartSpec.Trim() + "%' ";
}
if (!String.IsNullOrEmpty(startTime) && !String.IsNullOrEmpty(endTime))
{
strWhere += " and a.create_time BETWEEN '" + startTime.Trim() + "' AND '" + endTime.Trim() + "'";
}
else if (String.IsNullOrEmpty(startTime) && !String.IsNullOrEmpty(endTime))
{
strWhere += " and a.create_time < '" + endTime.Trim() + "'";
}
else if (!String.IsNullOrEmpty(startTime) && String.IsNullOrEmpty(endTime))
{
strWhere += " and a.create_time >'" + startTime.Trim() + "'";
}
else
{
strWhere += " and a.create_time BETWEEN '" + DateTime.Now.AddDays(-7).ToString("yyyy-MM-dd HH:mm:ss") + "' AND '" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "'";
}
strWhere += " and is_not_find=1 ";
String orderBy = " a.serial_number ";
return repository.getExportList(strWhere, orderBy);
}
public Hashtable getProductLogListByPage(string serialNumber, string partNo, string partSpec, string itemPartNo, string itemPartSpec, string startTime, string endTime, string enabled, Pager pager, String direction, String sort)
{
Hashtable result = new Hashtable();
String strWhere = " 1=1 ";
if (serialNumber != null && !serialNumber.Trim().Equals(""))
{
strWhere += "and a.serial_number like '%" + serialNumber.Trim() + "%' ";
}
if (partNo != null && !partNo.Trim().Equals(""))
{
strWhere += "and a.part_no like '%" + partNo.Trim() + "%' ";
}
if (partSpec != null && !partSpec.Trim().Equals(""))
{
strWhere += "and pt.part_spec like '%" + partSpec.Trim() + "%' ";
}
if (itemPartNo != null && !itemPartNo.Trim().Equals(""))
{
strWhere += "and a.item_part_no like '%" + itemPartNo.Trim() + "%' ";
}
if (itemPartSpec != null && !itemPartSpec.Trim().Equals(""))
{
strWhere += "and zpt.part_Spec like '%" + itemPartSpec.Trim() + "%' ";
}
if (!String.IsNullOrEmpty(startTime) && !String.IsNullOrEmpty(endTime))
{
strWhere += " and a.create_time BETWEEN '" + startTime.Trim() + "' AND '" + endTime.Trim() + "'";
}
else if (String.IsNullOrEmpty(startTime) && !String.IsNullOrEmpty(endTime))
{
strWhere += " and a.create_time < '" + endTime.Trim() + "'";
}
else if (!String.IsNullOrEmpty(startTime) && String.IsNullOrEmpty(endTime))
{
strWhere += " and a.create_time >'" + startTime.Trim() + "'";
}
else
{
strWhere += " and a.create_time BETWEEN '" + DateTime.Now.AddDays(-7).ToString("yyyy-MM-dd HH:mm:ss") + "' AND '" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "'";
}
String orderBy = " a.serial_number ";
result = repository.getProductLogListByPage(pager.pageSize, pager.pageNo, strWhere, orderBy);
return result;
}
#endregion
}
}