using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Estsh.Web.Dal;
using Estsh.Web.Util;
using System.Collections;
using System.Data;
namespace Estsh.Core.Services
{
public class CartonDetailQueryService
{
CartonDetailQueryDal dal = new CartonDetailQueryDal(RemotingProxyProvider._remotingProxy);
public ArrayList GetVendor()
{
DataTable dt = dal.GetVendor();
return DataTypeConvert.NewObject.DataTableToArrayList(dt);
}
public ArrayList GetPart()
{
DataTable dt = dal.GetPart();
return DataTypeConvert.NewObject.DataTableToArrayList(dt);
}
public ArrayList GetModelType()
{
DataTable dt = dal.GetModelType();
return DataTypeConvert.NewObject.DataTableToArrayList(dt);
}
public ArrayList GetStatus()
{
DataTable dt = dal.GetStatus();
return DataTypeConvert.NewObject.DataTableToArrayList(dt);
}
public ArrayList GetEnabled()
{
DataTable dt = dal.GetEnabled();
return DataTypeConvert.NewObject.DataTableToArrayList(dt);
}
public ArrayList GetLocate()
{
DataTable dt = dal.GetLocate();
return DataTypeConvert.NewObject.DataTableToArrayList(dt);
}
///
/// 获取菜单列表
///
///
///
///
public List getMenuList(string sqlWhere, string orderBy, String rootPath)
{
DataTable ds = dal.getList(sqlWhere, orderBy);
List treeNodes = new List();
for (int i = 0; i < ds.Rows.Count; i++)
{
TreeNode node = new TreeNode();
node.id = ds.Rows[i]["RUID"].ToString();
node.icon = ds.Rows[i]["MenuPicLink"].ToString();
node.name = ds.Rows[i]["MenuName"].ToString();
if (ds.Rows[i]["ParentMenuID"] == null || "0".Equals(ds.Rows[i]["ParentMenuID"].ToString().Trim()))
{
node.parentId = "0";
node.iconSkin = "diy01";
}
else
{
node.parentId = ds.Rows[i]["ParentMenuID"].ToString();
node.url = rootPath + ds.Rows[i]["MenuLink"].ToString();
node.target = "frmright";
}
treeNodes.Add(node);
}
return treeNodes;
}
///
/// 根据分页条件获取分页菜单数据
///
///
///
///
///
///
public ArrayList getDPSListByPage(String cartonNO, String picknoTxt, String buy_no, String partNo_search,
String locate_name, String option3, String cmbVendor, String cmbCartonStatus, String cmbEnabled,
String date, String txtEndPrintTime, String updateDate,
Pager pager, String direction, String sort)
{
String strWhere = " where 1=1 ";
if (!string.IsNullOrEmpty(cartonNO))
{
strWhere += " AND s.carton_no = '" + cartonNO.Trim() + "' ";
}
if (!string.IsNullOrEmpty(cmbVendor))
{
strWhere += " AND v.vendor_name = '" + cmbVendor.Trim() + "' ";
}
if (!string.IsNullOrEmpty(partNo_search))
{
strWhere += " AND p.part_no = '" + partNo_search.Trim() + "' ";
}
if (!string.IsNullOrEmpty(option3))
{
strWhere += " AND p.option3 = '" + option3.Trim() + "' ";
}
if (!string.IsNullOrEmpty(cmbCartonStatus))
{
strWhere += " AND s.enabled = '" + cmbCartonStatus.Trim() + "' ";
}
if (!string.IsNullOrEmpty(locate_name))
{
strWhere += " AND l.locate_id = '" + locate_name.Trim() + "' ";
}
if (!string.IsNullOrEmpty(buy_no))
{
strWhere += " AND s.buy_no like '%" + buy_no.Trim() + "%' ";
}
if (!string.IsNullOrEmpty(picknoTxt))
{
strWhere += " AND s.pick_no like '%" + picknoTxt.Trim() + "%' ";
}
if (!string.IsNullOrEmpty(cmbEnabled))
{
strWhere += "and 1=1 AND s.status = '" + cmbEnabled.Trim() + "' ";
}
DataTable dt = dal.getListByPage(pager.pageSize, pager.pageNo, strWhere, sort + " " + direction);
return DataTypeConvert.NewObject.DataTableToArrayList(dt);
}
///
/// 获取分页总数量
///
///
///
public int getMenuCount(String cartonNO, String picknoTxt, String buy_no, String partNo_search,
String locate_name, String option3, String cmbVendor, String cmbCartonStatus, String cmbEnabled,
String date, String txtEndPrintTime, String updateDate,
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_name,select的名字叫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 strWhere = " ";
if (!string.IsNullOrEmpty(cartonNO))
{
strWhere += " AND s.carton_no = '" + cartonNO.Trim() + "' ";
}
if (!string.IsNullOrEmpty(cmbVendor))
{
strWhere += " AND v.vendor_name = '" + cmbVendor.Trim() + "' ";
}
if (!string.IsNullOrEmpty(partNo_search))
{
strWhere += " AND p.part_no = '" + partNo_search.Trim() + "' ";
}
if (!string.IsNullOrEmpty(option3))
{
strWhere += " AND p.option3 = '" + option3.Trim() + "' ";
}
if (!string.IsNullOrEmpty(cmbCartonStatus))
{
strWhere += " AND s.enabled = '" + cmbCartonStatus.Trim() + "' ";
}
if (!string.IsNullOrEmpty(locate_name))
{
strWhere += " AND l.locate_name = '" + locate_name.Trim() + "' ";
}
if (!string.IsNullOrEmpty(buy_no))
{
strWhere += " AND s.buy_no like '%" + buy_no.Trim() + "%' ";
}
if (!string.IsNullOrEmpty(picknoTxt))
{
strWhere += " AND s.pick_no like '%" + picknoTxt.Trim() + "%' ";
}
if (!string.IsNullOrEmpty(cmbEnabled))
{
strWhere += "and 1=1 AND s.status = '" + cmbEnabled.Trim() + "' ";
}
return dal.getCountWhere(strWhere);
}
public string GetServer()
{
return dal.GetServer();
}
}
}