和川对SAP客户信息接口完成

master
ddlucky 2 years ago
parent beb34db0a4
commit b8f13a9303

2
.gitignore vendored

@ -240,3 +240,5 @@ ModelManifest.xml
# FAKE - F# Make
.fake/
/.vs.rar
/DSWeb/Properties/PublishProfiles/配置文件1.pubxml

@ -25,6 +25,7 @@ namespace DSWeb.Common.DB
{
[Key]
public string { get; set; }
public string 2 { get; set; }
public string { get; set; }
public string { get; set; }
public string { get; set; }
@ -121,7 +122,9 @@ namespace DSWeb.Common.DB
public string { get; set; }
public string { get; set; }
public string VGM { get; set; }
public string { get; set; }
//和川的客户信息库无此字段
//public string 放单状态 { get; set; }
public string { get; set; }
public string { get; set; }
public string { get; set; }
@ -130,7 +133,10 @@ namespace DSWeb.Common.DB
}
public class csCust
public class csCustHead {
public List<csCustInfo> csCust { get; set; }
}
public class csCustInfo
{
/// <summary>
/// 来源业务系统ID
@ -364,18 +370,19 @@ namespace DSWeb.Common.DB
/// </summary>
public string custOfficeCode { get; set; }
public csCustOfficeInfo CustOfficeInfo { get; set; }
public csCustInvoice CustInvoice { get; set; }
public List<csCustType> CustType { get; set; }
public List<csCustOfficeInfo> csCustOfficeInfo { get; set; }
public List<csCustInvoice> csCustInvoices { get; set; }
public List<csCustType> csCustTypes { get; set; }
public List<csCustContact> CustContact { get; set; }
public List<csCustSales> CustSales { get; set; }
public List<csCustAccount> CustAccount { get; set; }
public List<csCustSales> csCustSaless { get; set; }
public List<csCustAccount> csCustAccounts { get; set; }
public t_crm_client_md GetCrmClient() {
var result = new t_crm_client_md();
result.bizCsCustId = bizCsCustId;
result. = custCode;
result. = custAlias;
result. = custAlias == null?"": custAlias.Length>10? custAlias.Substring(0,10): custAlias;
result.2 = custAlias;
result. = custNameEn;
result. = custNameCn;
result. = countryCode;
@ -399,9 +406,9 @@ namespace DSWeb.Common.DB
result. = createTime == null ? DateTime.Now : Convert.ToDateTime(createTime);
result. = remark;
result.= CustOfficeInfo.memoryCode==null?"": (CustOfficeInfo.memoryCode.Length>10
?CustOfficeInfo.memoryCode.Substring(0,10)
:CustOfficeInfo.memoryCode);
result.= csCustOfficeInfo==null?"": (csCustOfficeInfo[0].memoryCode.Length>10
? csCustOfficeInfo[0].memoryCode.Substring(0,10)
: csCustOfficeInfo[0].memoryCode);
return result;
}

@ -21,8 +21,8 @@ namespace DSWeb.Common.DB
}
public DbSet<t_PublicInterface_Log_md> t_PublicInterface_Log { get; set; }
public DbSet<t_crm_client_md> t_crm_client { get; set; }
}

@ -1,5 +1,7 @@
using Aspose.Words.Saving;
using DSWeb.Areas.CommMng.DAL;
using DSWeb.Areas.CommMng.PublicInterfaceDAL;
using DSWeb.Areas.MvcShipping.Models.Message.VGM;
using DSWeb.Common.DB;
using DSWeb.MvcShipping.Helper;
using HcUtility.Comm;
@ -8,28 +10,37 @@ using System.Collections.Generic;
using System.Data.Entity.Core.Metadata.Edm;
using System.Data.Entity.Migrations;
using System.Diagnostics.Contracts;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Web;
using System.Web.Mvc;
namespace DSWeb.Areas.CommMng.Controllers
{
public class PublicInterfaceController
[JsonRequestBehavior]
public class PublicInterfaceController : Controller
{
[HttpPost]
public InterfaceResult PostInterface(InterfaceParam param) {
try {
//[HttpPost]
public InterfaceResult PostInterface() {
var sr = new StreamReader(Request.InputStream, Encoding.UTF8);
var strJson = sr.ReadToEnd();
var param = JsonConvert.Deserialize<InterfaceParam>(strJson);
try
{
param.Save();
Assembly assembly = Assembly.Load("DSWeb.Areas.CommMng.Controllers");
var type = assembly.GetType("DSWeb.Areas.CommMng.Controllers.InterfaceBase." + param.PORTNAME);
Assembly assembly = Assembly.Load("DSWeb");
var classname = "DSWeb.Areas.CommMng.PublicInterfaceDAL." + param.header.serviceCode;
var type = assembly.GetType(classname);
Object obj = type.Assembly.CreateInstance(type.ToString());
var doset = type.GetMethod("DoSet");
var _param = new object[]{ param};
var _param = new object[]{ param.body };
InterfaceResult result = (InterfaceResult)doset.Invoke(obj,BindingFlags.Instance|BindingFlags.NonPublic,null, _param, null);
return result;
} catch (Exception e) {
@ -40,7 +51,7 @@ namespace DSWeb.Areas.CommMng.Controllers
if (e.InnerException != null && e.InnerException.Message != null) {
msg += "//InnerException.Message:" + e.InnerException.Message;
}
var _rs= BasicDataRefDAL.SaveLog(msg, "", param.PORTNAME, "公开接口");
var _rs= BasicDataRefDAL.SaveLog(msg, "", param.header.serviceCode, "公开接口");
var _rr = JsonConvert.Deserialize<DBResult>(_rs.Content);
_r.errMsg = "未知错误,请联系相关人员,错误日志号【" + _rr.Data.ToString() + "】";
return _r;
@ -48,78 +59,4 @@ namespace DSWeb.Areas.CommMng.Controllers
}
}
public class InterfaceResult {
public string errCode { get; set; }
public string errMsg { get; set; }
public InterfaceResult() { }
public InterfaceResult(DBResult dbresult) {
if (dbresult.Success)
{
errCode = "0";
}
else
{
errCode = "1";
}
errMsg = dbresult.Message + ";Data:" + JsonConvert.Serialize(dbresult.Data);
}
}
public class InterfaceParam {
public string PORTNAME { get; set; }
public string GID { get; set; }
public string Param { get; set; }
public t_PublicInterface_Log_md getsaverec() {
var result = new t_PublicInterface_Log_md();
result.GID= GID;
result.Param= Param;
result.PORTNAME = PORTNAME;
return result;
}
public void Save() {
var saverec = getsaverec();
if (string.IsNullOrWhiteSpace( saverec.Param) && string.IsNullOrWhiteSpace(saverec.PORTNAME))
{
var cdc = new CommonDataContext();
cdc.t_PublicInterface_Log.Add(saverec);
}
}
}
public class InterfaceBase
{
public InterfaceBase() { }
public InterfaceResult DoSet(InterfaceParam param) {
return new InterfaceResult();
}
//public static void SaveParam(InterfaceParam param) {
// param.Save();
//}
public class csCustInfo: InterfaceBase
{
public InterfaceResult DoSet(InterfaceParam param)
{
var result = new DBResult();
//解析param.Param
var _str = param.Param;
//向数据库保存
return new InterfaceResult(result);
}
}
}
}

@ -2,16 +2,20 @@
using System.Collections.Generic;
using System.Data;
using System.Data.Common;
using System.Data.Entity.Migrations;
using System.Diagnostics;
using System.Linq;
using System.ServiceModel.Configuration;
using System.Text;
using System.Web;
using DSWeb.Areas.CommMng.Models;
using DSWeb.Common.DB;
using DSWeb.EntityDA;
using DSWeb.MvcShipping.Comm.Cookie;
using DSWeb.MvcShipping.Helper;
using HcUtility.Comm;
using Microsoft.Practices.EnterpriseLibrary.Data;
using Newtonsoft.Json.Linq;
namespace DSWeb.Areas.CommMng.DAL
{
@ -222,5 +226,4 @@ namespace DSWeb.Areas.CommMng.DAL
#endregion
}
}

@ -0,0 +1,145 @@
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.Common;
using System.Data.Entity.Migrations;
using System.Diagnostics;
using System.Linq;
using System.ServiceModel.Configuration;
using System.Text;
using System.Web;
using DSWeb.Areas.CommMng.Models;
using DSWeb.Common.DB;
using DSWeb.EntityDA;
using DSWeb.MvcShipping.Comm.Cookie;
using DSWeb.MvcShipping.Helper;
using HcUtility.Comm;
using Microsoft.Practices.EnterpriseLibrary.Data;
using Newtonsoft.Json.Linq;
namespace DSWeb.Areas.CommMng.PublicInterfaceDAL
{
public class InterfaceResult
{
public string errCode { get; set; }
public string errMsg { get; set; }
public InterfaceResult() { }
public InterfaceResult(DBResult dbresult)
{
if (dbresult.Success)
{
errCode = "0";
}
else
{
errCode = "1";
}
errMsg = dbresult.Message + ";Data:" + JsonConvert.Serialize(dbresult.Data);
}
}
public class InterfaceParam
{
public Interface_Header header { get; set; }
public object body { get; set; }
public t_PublicInterface_Log_md getsaverec()
{
var result = new t_PublicInterface_Log_md();
result.GID = Guid.NewGuid().ToString();
result.Param = body.ToString();
result.PORTNAME = header.serviceCode;
return result;
}
public void Save()
{
var saverec = getsaverec();
if (string.IsNullOrWhiteSpace(saverec.Param) && string.IsNullOrWhiteSpace(saverec.PORTNAME))
{
var cdc = new DS6DataContext();
cdc.t_PublicInterface_Log.Add(saverec);
}
}
}
public class Interface_Header
{
public string serviceCode { get; set; }
}
public class InterfaceBase
{
public InterfaceBase() { }
public virtual InterfaceResult DoSet(JObject paramObject)
{
return new InterfaceResult();
}
//public static void SaveParam(InterfaceParam param) {
// param.Save();
//}
}
public class KF_CUST_UPDATE : InterfaceBase
{
public override InterfaceResult DoSet(JObject paramObject)
{
var result = new DBResult();
try {
var jsonstr= paramObject.ToString();
csCustHead custhead = JsonConvert.Deserialize<csCustHead>(jsonstr);
var custlist = custhead.csCust;
var ds6 = new DS6DataContext();
//解析param.Param
foreach (var cust in custlist)
{
var ds6cust = cust.GetCrmClient();
var currInfoclient = ds6.t_crm_client.Where(x => x. == cust.custCode).ToList();
if (currInfoclient == null || currInfoclient.Count == 0)
ds6.t_crm_client.Where(x => x. == cust.custNameCn).ToList();
if (currInfoclient == null || currInfoclient.Count == 0)
{
ds6.t_crm_client.Add(ds6cust);
}
else
{
var oldclient = currInfoclient[0];
//部分字段不更新
ds6cust. = oldclient.;
ds6.t_crm_client.AddOrUpdate(ds6cust);
}
}
if (custlist.Count > 0)
{
ds6.SaveChanges();
}
}catch(Exception ex)
{
result.Success= false;
result.Message=ex.Message;
}
//向数据库保存
result.Success = true;
result.Message = "保存成功";
return new InterfaceResult(result);
}
}
}

@ -291,6 +291,7 @@
<Compile Include="Areas\CommMng\Controllers\PublicInterfaceController.cs" />
<Compile Include="Areas\CommMng\DAL\PageHelperEIP.cs" />
<Compile Include="Areas\CommMng\DAL\PagerHelper.cs" />
<Compile Include="Areas\CommMng\DAL\PublicInterfaceDAL.cs" />
<Compile Include="Areas\CommMng\Models\BasicDataModel.cs" />
<Compile Include="Areas\CommMng\Models\CwAccitemsGlModel.cs" />
<Compile Include="Areas\CommMng\Models\CwItemModel.cs" />

@ -1,17 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
您 Web 项目的发布/打包进程将使用此文件。您可以通过编辑此 MSBuild 文件
来自定义该进程的行为。若要了解与此相关的详细信息,请访问 http://go.microsoft.com/fwlink/?LinkID=208121。
-->
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<WebPublishMethod>FileSystem</WebPublishMethod>
<LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
<LastUsedPlatform>Any CPU</LastUsedPlatform>
<SiteUrlToLaunchAfterPublish />
<LaunchSiteAfterPublish>True</LaunchSiteAfterPublish>
<ExcludeApp_Data>False</ExcludeApp_Data>
<publishUrl>D:\DS7JIEKOU</publishUrl>
<DeleteExistingFiles>True</DeleteExistingFiles>
</PropertyGroup>
</Project>

@ -67,11 +67,11 @@
<!--
<add name="DongShengDB" connectionString="Server=ds-hxt;Database=dongshengdata_jf;User ID=sa;Password=ds20040201;Connect Timeout=18000;" providerName="System.Data.SqlClient" />
-->
<add name="sydevzsh" connectionString="Server=ds-hxt;Database=dongshengdata_jf;User ID=sa;Password=ds20040201;Connect Timeout=18000;" providerName="System.Data.SqlClient" />
<add name="sydevzsh" connectionString="Server=ds-hxt;Database=dongshengdata_jf;User ID=sa;Password=ds20040201;Connect Timeout=18000;" providerName="System.Data.SqlClient" />
<add name="DongShengDB" connectionString="Server=60.209.125.238,52314;Database=shippingwebTEST;User ID=sa;Password=Ds20040201;Connect Timeout=18000;" providerName="System.Data.SqlClient" />
<add name="DS6DB" connectionString="Server=60.209.125.238,52314;Database=HECHUAN;User ID=sa;Password=Ds20040201;Connect Timeout=18000;" providerName="System.Data.SqlClient" />
<add name="DS6DB" connectionString="Server=60.209.125.238,52314;Database=HECHUAN;User ID=sa;Password=Ds20040201;Connect Timeout=18000;" providerName="System.Data.SqlClient" />
</connectionStrings>
<!--

Loading…
Cancel
Save