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.

159 lines
5.3 KiB
C#

2 years ago
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.IRepositories;
using Estsh.Core.Dapper;
using Estsh.Core.Base;
/***************************************************************************************************
*
* sitong.dong
*
* 2022.06.22
*
*
**************************************************************************************************/
namespace Estsh.Core.Services
{
public class SingleWarePrintDefineService : BaseService<BaseEntity>, ISingleWarePrintDefineService
{
private readonly ISingleWarePrintDefineRepository repository;
public SingleWarePrintDefineService(ISingleWarePrintDefineRepository _repository) : base(_repository)
{
repository = _repository;
}
/// <summary>
/// 根据分页条件获取分页菜单数据
/// </summary>
/// <param name="partNo_search"></param>
/// <param name="pager"></param>
/// <param name="direction"></param>
/// <param name="sort"></param>
/// <returns></returns>
public List<SapMisco> getDPSListByPage(String where, String partNo_search, String option3, String locate_name,
String enabled_search, Pager pager, String direction, String sort)
{
String strWhere = " 1=1 " + where;
if (!String.IsNullOrEmpty(partNo_search))
{
strWhere += " AND p.part_no = '" + partNo_search.Trim() + "'";
}
if (!String.IsNullOrEmpty(option3))
{
strWhere += " AND p.option3 =" + option3.Trim() + "";
}
//因为select下拉框取view_board_id得到的是view_board_nameselect的名字叫view_board_id
if (!String.IsNullOrEmpty(locate_name))
{
strWhere += " AND l.locate_name= '" + locate_name.Trim() + "'";
}
if (!String.IsNullOrEmpty(enabled_search))
{
strWhere += " AND s.enabled= '" + enabled_search.Trim() + "'";
}
String orderBy = "";
if (sort != null && !"".Equals(sort.Trim()))
{
orderBy += typeof(SapMisco).GetEntityColumnName(sort.Trim()) + " " + direction;
}
else
{
orderBy += typeof(SapMisco).GetEntityColumnName("Zinstno") + " " + direction;
}
List<SapMisco> dt = repository.GetOrderDetail(pager.pageSize, pager.pageNo, strWhere, orderBy);
return dt;
}
/// <summary>
/// 获取分页总数量
/// </summary>
/// <param name="partNo_search"></param>
/// <returns></returns>
public int getMenuCount(String where, String partNo_search, String option3, String locate_name,
String enabled_search, Pager pager, String direction, String sort)
{
String strWhere = " ";
if (!String.IsNullOrEmpty(partNo_search))
{
strWhere += " AND p.part_no = '" + partNo_search.Trim() + "'";
}
if (!String.IsNullOrEmpty(option3))
{
strWhere += " AND p.option3 =" + option3.Trim() + "";
}
//因为select下拉框取view_board_id得到的是view_board_nameselect的名字叫view_board_id
if (!String.IsNullOrEmpty(locate_name))
{
strWhere += " AND l.locate_name= '" + locate_name.Trim() + "'";
}
if (!String.IsNullOrEmpty(enabled_search))
{
strWhere += " AND s.enabled= '" + enabled_search.Trim() + "'";
}
return repository.GetOrderCount(strWhere);
}
/// <summary>
/// 获取库位名称
/// </summary>
/// <returns></returns>
public List<KeyValueResult> GetTaskList()
{
return repository.GetTaskList();
}
public List<SapMisco> GetOrderDetail(String order_no, Pager pager, String direction, String sort)
{
String strWhere = " 1=1 ";
if (!String.IsNullOrEmpty(order_no))
{
strWhere += " AND a.ZINSTNO = '" + order_no.Trim() + "'";
}
else
{
strWhere += " AND a.ZINSTNO = '1' ";
}
String orderBy = "";
if (sort != null && !"".Equals(sort.Trim()))
{
orderBy += typeof(SapMisco).GetEntityColumnName(sort.Trim()) + " " + direction;
}
else
{
orderBy += typeof(SapMisco).GetEntityColumnName("Zinstno") + " " + direction;
}
List<SapMisco> dt = repository.GetOrderDetail(pager.pageSize, pager.pageNo, strWhere, orderBy);
return dt;
}
public int GetOrderCount(String order_no)
{
String strWhere = " ";
if (!String.IsNullOrEmpty(order_no))
{
strWhere = order_no.Trim();
}
else
{
strWhere = "1";
}
return repository.GetOrderCount(strWhere);
}
}
}