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 TruckOrderPrintService : BaseService, ITruckOrderPrintService
{
private readonly ITruckOrderPrintRepository repository;
public TruckOrderPrintService(ITruckOrderPrintRepository _repository) : base(_repository)
{
repository = _repository;
}
///
/// 根据分页条件获取分页菜单数据
///
///
///
///
///
///
public Hashtable getTruckOrderPrintListByPage(String cust_pdline_name, String comtype_name, String StartCar_no, String EndCar_no, String date, String date2, Pager pager, String direction, String sort)
{
Hashtable result = new Hashtable();
String strWhere = " 1=1 ";
//if (part_no != null && !part_no.Trim().Equals(""))
//{
// strWhere = " b.part_no like '%" + part_no.Trim() + "%' ";
//}
//if (cust_order != null && !cust_order.Trim().Equals(""))
//{
// strWhere += " AND a.cust_order like '%" + cust_order.Trim() + "%'";
//}
String orderBy = "";
if (sort != null && !"".Equals(sort.Trim()))
{
orderBy += typeof(SysWebMenu).GetEntityColumnName(sort.Trim()) + " " + direction;
}
else
{
orderBy += " a.part_id " + direction;
}
result = repository.getListByPage(cust_pdline_name, comtype_name, StartCar_no, EndCar_no, date, date2, pager.pageSize, pager.pageNo, strWhere, orderBy);
return result;
}
///
/// 保存菜单数据
///
///
///
public int saveTruckOrderPrint(SysPartCustOrder htParams)
{
return repository.saveTruckOrderPrint(htParams);
}
///
/// 更新菜单数据
///
///
///
public int updateTruckOrderPrint(SysPartCustOrder htParams)
{
return repository.updateTruckOrderPrint(htParams);
}
///
/// 查看详情
///
///
///
public List getTruckOrderPrint(String part_id)
{
part_id = "part_id = " + part_id;
return repository.getList(part_id, "");
}
///
/// 删除菜单
///
///
///
public int deleteTruckOrderPrint(String ids)
{
String[] idArray = ids.Split(',');
int count = 0;
foreach (String id in idArray)
{
if (!"".Equals(id))
{
count += this.repository.deleteTruckOrderPrint(id);
}
}
return count;
}
///
/// 获取下拉框中的菜单数据
///
///
public List getCust_pdline_nameListData()
{
return repository.getCust_pdline_nameListData();
}
///
/// 获取下拉框中的菜单数据
///
///
public List getType_nameListData(String cust_pdline_id)
{
return repository.getType_nameListData(cust_pdline_id);
}
///
/// 获取下拉框中的菜单数据
///
///
public List getSelectTruckOrderPrint()
{
return repository.getSelectTruckOrderPrint();
}
///
/// 根据分页条件获取分页客户订单数据
///
/// 查询条件
///
/// 排序方式
/// 排序字段
///
public List getTableListByPage(String part_no, String cust_order, Pager pager, String direction, String sort, Boolean isPage)
{
String strWhere = " 1=1 ";
int rowCount = 0;
if (part_no != null && !part_no.Trim().Equals(""))
{
strWhere = " b.part_no like '%" + part_no.Trim() + "%' ";
}
if (cust_order != null && !cust_order.Trim().Equals(""))
{
strWhere += " AND a.cust_order like '%" + cust_order.Trim() + "%'";
}
String orderBy = "";
if (sort != null && !"".Equals(sort.Trim()))
{
orderBy += typeof(SysWebMenu).GetEntityColumnName(sort.Trim()) + " " + direction;
}
else
{
orderBy += " a.part_id " + direction;
}
if (isPage)
{
rowCount = pager.pageSize;
}
else
{
rowCount = pager.pageSize;
}
List result = repository.getTableListByPage(rowCount, pager.pageNo, strWhere, orderBy);
return result;
}
}
}