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.
109 lines
4.6 KiB
109 lines
4.6 KiB
using System;
|
|
using System.Collections.Generic;
|
|
using System.Data;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using ICS.WCF.Base;
|
|
using ICSSoft.Entity;
|
|
|
|
namespace ICS.Supplier
|
|
{
|
|
public class GetSupplier
|
|
{
|
|
public FormICSCreatedArrivalNoticeModel FindByApproveDate(ISupplier d)
|
|
{
|
|
StringBuilder strHead = new StringBuilder();
|
|
strHead.AppendLine("***************接口传入参数记录****************:");
|
|
strHead.AppendLine("开始时间:" + d.StartTime);
|
|
strHead.AppendLine("结束时间:" + d.EndTime);
|
|
strHead.AppendLine("***************接口传入参数记录****************:");
|
|
Appconfig.WriteLogFile(strHead.ToString(), "U9料品信息接口日志");
|
|
StringBuilder resultlog = new StringBuilder();
|
|
|
|
FormICSCreatedArrivalNoticeModel result = new FormICSCreatedArrivalNoticeModel();
|
|
List<KPRApprovedEntity> returnValue = new List<KPRApprovedEntity>();
|
|
try
|
|
{
|
|
DateTime time1 = Appconfig.TimestampToDateTime(d.StartTime);
|
|
DateTime time2 = Appconfig.TimestampToDateTime(d.EndTime);
|
|
string sql = @"select DISTINCT A.[Code] as 供应商编码, A1.[Name] as 供应商名称,A1.ID as 供应商id,A2.Code as 组织代码
|
|
from CBO_Supplier as A
|
|
left join [CBO_Supplier_Trl] as A1 on (A1.SysMlFlag = 'zh-CN') and (A.[ID] = A1.[ID])
|
|
LEFT JOIN Base_Organization as A2 on A.Org=A2.ID
|
|
where 1=1 and A.[Effective_IsEffective]=1 AND A2.Code='02' ";
|
|
|
|
if (!string.IsNullOrEmpty(d.StartTime.ToString()) && d.StartTime != 0)
|
|
{
|
|
sql += " and A.ModifiedOn >= '" + time1 + "'";
|
|
}
|
|
if (!string.IsNullOrEmpty(d.EndTime.ToString()) && d.EndTime != 0)
|
|
{
|
|
sql += " and A.ModifiedOn <= '" + time2 + "'";
|
|
}
|
|
|
|
DataTable dt = DBhlper.Query(sql, Appconfig.GetU9ConnStr());
|
|
if (dt == null)
|
|
{
|
|
result.Code = -1;
|
|
result.ResMsg = "获取U9供应商信息失败";
|
|
result.ResData = null;
|
|
result.IsCompress = false;
|
|
result.IsSuccess = false;
|
|
resultlog.AppendLine("获取U9供应商信息失败");
|
|
resultlog.AppendLine("查询sql:" + sql);
|
|
Appconfig.WriteLogFile(resultlog.ToString(), "U9供应商信息接口日志");
|
|
return result;
|
|
}
|
|
|
|
int count = dt.Rows.Count; ;
|
|
foreach (DataRow dr in dt.Rows)
|
|
{
|
|
KPRApprovedEntity PRLine = new KPRApprovedEntity();
|
|
PRLine.OrgID = dr["组织代码"].ToString();
|
|
PRLine.ERPID = dr["供应商id"].ToString();
|
|
PRLine.bstSupNo = dr["供应商编码"].ToString();
|
|
PRLine.bstName = dr["供应商名称"].ToString();
|
|
returnValue.Add(PRLine);
|
|
}
|
|
|
|
|
|
result.Code = 0;
|
|
result.ResMsg = "获取U9供应商信息成功";
|
|
result.ResData = returnValue;
|
|
result.IsCompress = false;
|
|
result.IsSuccess = true;
|
|
return result;
|
|
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
result.Code = -1;
|
|
result.ResMsg = "U9供应商信息获取失败,请查看日志";
|
|
result.ResData = null;
|
|
result.IsCompress = false;
|
|
result.IsSuccess = false;
|
|
StringBuilder str = new StringBuilder();
|
|
str.AppendLine("U9供应商信息获取失败");
|
|
str.AppendLine("开始时间:" + d.StartTime);
|
|
str.AppendLine("结束时间:" + d.EndTime);
|
|
str.AppendLine("失败原因:" + ex.Message);
|
|
Appconfig.WriteLogFile(str.ToString(), "U9供应商信息接口日志");
|
|
}
|
|
return result;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 返回值
|
|
/// </summary>
|
|
public class FormICSCreatedArrivalNoticeModel
|
|
{
|
|
//0 :正常数据,-1:失败。
|
|
public int Code { get; set; }
|
|
public string ResMsg { get; set; }
|
|
public List<KPRApprovedEntity> ResData { get; set; }
|
|
public bool IsCompress { get; set; }
|
|
public bool IsSuccess { get; set; }
|
|
}
|
|
}
|
|
}
|