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.

190 lines
8.0 KiB
C#

2 years ago
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
{
/// <summary>
/// 回冲日志查询
/// </summary>
public class ProductDeductLogQueryService : BaseService<WmsProductDeduct>, IProductDeductLogQueryService
{
private readonly IProductDeductLogQueryRepository repository;
public ProductDeductLogQueryService(IProductDeductLogQueryRepository _repository) : base(_repository)
{
repository = _repository;
}
#region 收货查询补打
/// <summary>
/// 根据分页条件获取列表
/// </summary>
/// <param name="account"></param>
/// <param name="pager"></param>
/// <param name="direction"></param>
/// <param name="sort"></param>
/// <returns></returns>
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<ProductDeductLog> 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
}
}