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 BOMReleaseService
{
private BOMReleaseDal dal = new BOMReleaseDal(RemotingProxyProvider._remotingProxy);
///
/// 根据分页条件获取分页菜单数据
///
///
///
///
///
///
public Hashtable getBOMReleaseListByPage(String part_no, string AENNR , Pager pager, String direction, String sort)
{
Hashtable result = new Hashtable();
String strWhere = " 1=1 ";
string partWhere = "";
if (!string.IsNullOrEmpty(part_no) && !part_no.Equals("可选:请输入暂时不BOM生效的零件号,用’,‘分隔。"))
{
string _temp = "";
string[] arr = part_no.Trim().Split(',');
foreach (string i in arr)
{
_temp += "'" + i + "',";
}
_temp = _temp.Substring(0, _temp.Length - 1);
partWhere += " AND MATNR not in (" + _temp + ")";
}
if (string.IsNullOrEmpty(AENNR))
{
AENNR = "";
}
strWhere += " AND AENNR = '" + AENNR + "' " + partWhere;
strWhere += "AND SID = ( SELECT MAX(SID) FROM DBO.SAP_BOM WHERE AENNR = '" + AENNR + "' " + partWhere + ")";
String orderBy = "";
if (sort != null && !"".Equals(sort.Trim()))
{
orderBy += sort + " " + direction;
}
else
{
orderBy += " MATNR " + direction;
}
result = dal.getListByPage(pager.pageSize, pager.pageNo, strWhere, orderBy);
return result;
}
///
/// 查询BOM版本
///
///
public ArrayList getVersion()
{
DataTable dt = dal.getVersion();
return DataTypeConvert.NewObject.DataTableToArrayList(dt);
}
///
/// 查询当前版本中的所有零件
///
/// 零件
/// 版本
///
public DataTable getAllPart(string where, string AENNR)
{
return dal.getAllPart(where, AENNR);
}
///
/// 按照总成零件号和BOM版本同步 SAP BOM 数据
///
/// 总成零件号
/// BOM版本
/// 是否同步成功
public bool SyncSAPBOMByPartNo(string partNo, string AENNR)
{
return dal.SyncSAPBOMByPartNo(partNo, AENNR);
}
}
}