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 CartonTrackService : BaseService, ICartonTrackService
{
private readonly ICartonTrackRepository repository;
public CartonTrackService(ICartonTrackRepository _repository) : base(_repository)
{
repository = _repository;
}
///
/// 根据分页条件获取分页菜单数据
///
///
///
///
///
///
public Hashtable getCartonTrackListByPage( String carton_no, String partNo, String partSpec, String locateType, String startTime, String endTime, Pager pager, String direction, String sort, String enabled)
{
Hashtable result = new Hashtable();
String strWhere = " 1=1 ";
if (carton_no != null && !carton_no.Trim().Equals(""))
{
strWhere += " and a.carton_no like '%" + carton_no.Trim() + "%' ";
}
if (partNo != null && !partNo.Trim().Equals(""))
{
strWhere += " and c.part_no like '%" + partNo.Trim() + "%'";
}
if (partSpec != null && !partSpec.Trim().Equals(""))
{
strWhere += " and c.part_spec like '%" + partSpec.Trim() + "%'";
}
if (locateType != null && !locateType.Trim().Equals(""))
{
strWhere += " and d.locate_type like '%" + locateType.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() + "'";
}
if (enabled != null && !enabled.Trim().Equals(""))
{
strWhere += " and a.enabled='" + enabled+ "'";
}
String orderBy = "";
if (sort != null && !"".Equals(sort.Trim()))
{
orderBy += typeof(SysStock).GetEntityColumnName(sort.Trim()) + " " + direction;
}
else
{
orderBy += " a.carton_no " + direction;
}
result = repository.getListByPage(pager.pageSize, pager.pageNo, strWhere, orderBy);
return result;
}
public List getExportList(String carton_no, String partNo, String partSpec, String locateType, String startTime, String endTime, String enabled)
{
String strWhere = " 1=1 ";
if (carton_no != null && !carton_no.Trim().Equals(""))
{
strWhere += " and a.carton_no like '%" + carton_no.Trim() + "%' ";
}
if (partNo != null && !partNo.Trim().Equals(""))
{
strWhere += " and c.part_no like '%" + partNo.Trim() + "%'";
}
if (partSpec != null && !partSpec.Trim().Equals(""))
{
strWhere += " and c.part_spec like '%" + partSpec.Trim() + "%'";
}
if (locateType != null && !locateType.Trim().Equals(""))
{
strWhere += " and d.locate_type like '%" + locateType.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() + "'";
}
if (enabled != null && !enabled.Trim().Equals(""))
{
strWhere += " and a.enabled='" + enabled + "'";
}
string orderBy = " order by a.create_time desc ";
List result = repository.getExportList( strWhere, orderBy);
return result;
}
public List GetLocateType()
{
return repository.GetLocateType();
}
///
/// 获取下拉框中的菜单数据
///
///
public List getSelectCartonTrack()
{
return repository.getSelectCartonTrack();
}
}
}