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.

148 lines
5.6 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 CartonTrackService : BaseService<SysHtStock>, ICartonTrackService
{
private readonly ICartonTrackRepository repository;
public CartonTrackService(ICartonTrackRepository _repository) : base(_repository)
{
repository = _repository;
}
/// <summary>
/// 根据分页条件获取分页菜单数据
/// </summary>
/// <param name="CartonTrackName"></param>
/// <param name="pager"></param>
/// <param name="direction"></param>
/// <param name="sort"></param>
/// <returns></returns>
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<CartonTrack> 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<CartonTrack> result = repository.getExportList( strWhere, orderBy);
return result;
}
public List<KeyValueResult> GetLocateType()
{
return repository.GetLocateType();
}
/// <summary>
/// 获取下拉框中的菜单数据
/// </summary>
/// <returns></returns>
public List<KeyValueResult> getSelectCartonTrack()
{
return repository.getSelectCartonTrack();
}
}
}