using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Estsh.Web.Util;
using System.Data;
using Estsh.Web.Dal;
using System.Collections;
using Estsh.Web.Models;
/***************************************************************************************************
*
* 作者:王勇
*
* *************************************************************************************************/
namespace Estsh.Core.Services
{
///
/// 菜单业务处理类
///
public class KittingHistoryService
{
private KittingHistoryDal dal = new KittingHistoryDal(RemotingProxyProvider._remotingProxy);
///
/// 根据分页条件获取分页菜单数据
///
///
///
///
///
///
public Hashtable getKittingHistoryListByPage(String type_name, String StartCarNo, String view_board_name, Pager pager, String direction, String sort)
{
Hashtable result = new Hashtable();
String strWhere = " 1=1 ";
if (!string.IsNullOrEmpty(type_name) && !string.IsNullOrEmpty(StartCarNo))
{
strWhere += " and a.type_name = '" + type_name + "' and a.car_no='" + StartCarNo + "' ";
}
String orderBy = "";
if (sort != null && !"".Equals(sort.Trim()))
{
orderBy += sort + " " + direction;
}
else
{
orderBy += " a.pdline_name,b.update_ymd ,b.update_hms ,a.car_no " + direction;
}
result = dal.getListByPage(view_board_name, pager.pageSize, pager.pageNo, strWhere, orderBy);
return result;
}
///
/// 查询2
///
///
///
///
///
///
public Hashtable getKittingHistoryListByPage_2(String pdline_name, String view_board_name, String Date, String Date2, Pager pager, String direction, String sort)
{
Hashtable result = new Hashtable();
String strWhere = " 1=1 ";
if (!string.IsNullOrEmpty(pdline_name))
{
strWhere += " and a.pdline_name='" + pdline_name + "' ";
}
if (!string.IsNullOrEmpty(Date) && !string.IsNullOrEmpty(Date2))
{
strWhere += "AND a.update_ymd between '" + Date + "' and '" + Date2 + "' ";
}
String orderBy = "";
if (sort != null && !"".Equals(sort.Trim()))
{
orderBy += sort + " " + direction;
}
else
{
orderBy += " a.pdline_name,b.update_ymd ,b.update_hms ,a.car_no " + direction;
}
result = dal.getListByPage(view_board_name, pager.pageSize, pager.pageNo, strWhere, orderBy);
return result;
}
///
/// 保存菜单数据
///
///
///
public int saveKittingHistory(Hashtable htParams)
{
return dal.saveKittingHistory(htParams);
}
///
/// 更新菜单数据
///
///
///
public int updateKittingHistory(Hashtable htParams)
{
return dal.updateKittingHistory(htParams);
}
///
/// 查看详情
///
///
///
public ArrayList getKittingHistory(String part_id)
{
part_id = "part_id = " + part_id;
DataTable dt = dal.getList(part_id, "");
ArrayList result = DataTypeConvert.NewObject.DataTableToArrayList(dt);
return result;
}
///
/// 删除菜单
///
///
///
public int deleteKittingHistory(String ids)
{
String[] idArray = ids.Split(',');
int count = 0;
foreach (String id in idArray)
{
if (!"".Equals(id))
{
count += this.dal.deleteKittingHistory(id);
}
}
return count;
}
///
/// 获取下拉框中的菜单数据
///
///
public ArrayList getSelectKittingHistory()
{
Hashtable result = new Hashtable();
DataTable dt = dal.getSelectKittingHistory();
return DataTypeConvert.NewObject.DataTableToArrayList(dt);
}
///
/// 获取下拉框中的菜单数据
///
///
public ArrayList getSelectKittingHistory_view_board_name()
{
Hashtable result = new Hashtable();
DataTable dt = dal.getSelectKittingHistory_view_board_name();
return DataTypeConvert.NewObject.DataTableToArrayList(dt);
}
///
/// 获取下拉框中的菜单数据
///
///
public ArrayList getSelectKittingHistory_pdline_name()
{
Hashtable result = new Hashtable();
DataTable dt = dal.getSelectKittingHistory_pdline_name();
return DataTypeConvert.NewObject.DataTableToArrayList(dt);
}
///
/// 根据分页条件获取分页客户订单数据
///
/// 查询条件
///
/// 排序方式
/// 排序字段
///
public DataTable getTableListByPage(String part_no, String cust_order, Pager pager, String direction, String sort, Boolean isPage)
{
DataTable result = null;
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 += sort + " " + direction;
}
else
{
orderBy += " a.part_id " + direction;
}
if (isPage)
{
rowCount = pager.pageSize;
}
else
{
rowCount = pager.pageSize;
}
result = dal.getTableListByPage(rowCount, pager.pageNo, strWhere, sort + " " + direction);
return result;
}
}
}