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.

104 lines
3.4 KiB
C#

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

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
{
/// <summary>
/// 菜单业务处理类
/// </summary>
public class BOMReleaseService
{
private BOMReleaseDal dal = new BOMReleaseDal(RemotingProxyProvider._remotingProxy);
/// <summary>
/// 根据分页条件获取分页菜单数据
/// </summary>
/// <param name="BOMReleaseName"></param>
/// <param name="pager"></param>
/// <param name="direction"></param>
/// <param name="sort"></param>
/// <returns></returns>
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;
}
/// <summary>
/// 查询BOM版本
/// </summary>
/// <returns></returns>
public ArrayList getVersion()
{
DataTable dt = dal.getVersion();
return DataTypeConvert.NewObject.DataTableToArrayList(dt);
}
/// <summary>
/// 查询当前版本中的所有零件
/// </summary>
/// <param name="_where">零件</param>
/// <param name="version">版本</param>
/// <returns></returns>
public DataTable getAllPart(string where, string AENNR)
{
return dal.getAllPart(where, AENNR);
}
/// <summary>
/// 按照总成零件号和BOM版本同步 SAP BOM 数据
/// </summary>
/// <param name="partNo">总成零件号</param>
/// <param name="version">BOM版本</param>
/// <returns>是否同步成功</returns>
public bool SyncSAPBOMByPartNo(string partNo, string AENNR)
{
return dal.SyncSAPBOMByPartNo(partNo, AENNR);
}
}
}