纽威
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

112 lines
4.2 KiB

using NFine.Data.Extensions;
using NFine.Domain._03_Entity.SRM;
using NFine.Repository;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace NFine.Application.SRM
{
public class TakeEffApp : RepositoryFactory<ICSVendor>
{
/// <summary>
/// 获取采购组织
/// </summary>
/// <returns></returns>
public DataTable GetWorkPint()
{
string WorkPoint = NFine.Code.OperatorProvider.Provider.GetCurrent().Location;
string sql = @"
select '' as PURCHUGCODE,'' as PURCHUGNAME
union all
SELECT DISTINCT PURCHUGCODE,PURCHUGNAME FROM ICSPURCHUG WHERE PURCHUGCODE<>'' ";
string role = NFine.Code.OperatorProvider.Provider.GetCurrent().RoleEnCode;
//if (role != "admin")
//{
// sql += " and b.WorkPoint='" + WorkPoint + "'";
//}
DataTable dt = SqlHelper.GetDataTableBySql(sql);
return dt;
}
/// <summary>
/// 获取采购组织
/// </summary>
/// <returns></returns>
public DataTable GetMaterials()
{
string WorkPoint = NFine.Code.OperatorProvider.Provider.GetCurrent().Location;
string sql = @"select '' as Invtype
union all
SELECT DISTINCT Invtype FROM [ICSINVENTORY] WHERE Invtype<>''";
string role = NFine.Code.OperatorProvider.Provider.GetCurrent().RoleEnCode;
//if (role != "admin")
//{
// sql += " and b.WorkPoint='" + WorkPoint + "'";
//}
DataTable dt = SqlHelper.GetDataTableBySql(sql);
return dt;
}
/// <summary>
/// 获取物料
/// </summary>
/// <returns></returns>
public DataTable GetInvCode()
{
string WorkPoint = NFine.Code.OperatorProvider.Provider.GetCurrent().Location;
string sql = @"
select '' as INVCODE,'' as INVName
union all
SELECT DISTINCT INVCODE,INVName FROM ICSINVENTORY WHERE INVCODE<>'' ";
string role = NFine.Code.OperatorProvider.Provider.GetCurrent().RoleEnCode;
//if (role != "admin")
//{
// sql += " and b.WorkPoint='" + WorkPoint + "'";
//}
DataTable dt = SqlHelper.GetDataTableBySql(sql);
return dt;
}
/// <summary>
/// 获取供应商列表
/// </summary>
/// <returns></returns>
public DataTable GetVendor()
{
string WorkPoint = NFine.Code.OperatorProvider.Provider.GetCurrent().Location;
string sql = @"
select '' as F_VenCode,'' as cVenName
union all
SELECT DISTINCT a.F_VenCode,isnull(b.cVenName,'') as cVenName FROM dbo.Sys_SRM_User a
LEFT JOIN dbo.ICSVendor b ON a.F_VenCode=b.cVenCode and a.F_Location=b.WorkPoint
WHERE a.F_VenCode IS NOT NULL AND a.F_VenCode <>''";
string role = NFine.Code.OperatorProvider.Provider.GetCurrent().RoleEnCode;
if (role != "admin")
{
sql += " and b.WorkPoint=" + WorkPoint.TrimEnd(',') + "";
}
DataTable dt = SqlHelper.GetDataTableBySql(sql);
return dt;
}
public DataTable GetInvNameType(string InvCode)
{
string configSql = @"SELECT DISTINCT INVTYpe,INVName,INVUom FROM ICSINVENTORY WHERE INVCODE='"+InvCode+"'";
DataTable dt = SqlHelper.GetDataTableBySql(configSql);
return dt;
}
public string GetVenName(string VenCode)
{
string sql = @" SELECT DISTINCT a.F_VenCode,isnull(b.cVenName,'') as cVenName FROM dbo.Sys_SRM_User a
LEFT JOIN dbo.ICSVendor b ON a.F_VenCode=b.cVenCode and a.F_Location=b.WorkPoint
WHERE a.F_VenCode IS NOT NULL AND a.F_VenCode <>'' and F_VenCode='" + VenCode + "'";
DataTable dt = SqlHelper.GetDataTableBySql(sql);
string VenCodeName = string.Empty;
foreach (DataRow dr in dt.Rows)
{
VenCodeName += dr["cVenName"].ToString() + ",";
}
return VenCodeName;
}
}
}