|  |  | 
 |  |  | using System; | 
 |  |  | using Newtonsoft.Json; | 
 |  |  | using Newtonsoft.Json.Serialization; | 
 |  |  | using System; | 
 |  |  | using System.Collections.Generic; | 
 |  |  | using System.Linq; | 
 |  |  | using System.Text; | 
 |  |  | using System.Threading.Tasks; | 
 |  |  | using WIDESEA_Common.APIEnum; | 
 |  |  | using WIDESEA_Core.Helper; | 
 |  |  | using WIDESEA_External.Model; | 
 |  |  | using WIDESEA_IBasicRepository; | 
 |  |  | using WIDESEA_Model.Models; | 
 |  |  |  | 
 |  |  | namespace WIDESEA_External.ERPService | 
 |  |  | { | 
 |  |  | 
 |  |  |     /// </summary> | 
 |  |  |     public class InvokeERPService : IInvokeERPService | 
 |  |  |     { | 
 |  |  |         string serviceIp = ""; | 
 |  |  |  | 
 |  |  |         private readonly IApiInfoRepository _apiInfoRepository; | 
 |  |  |         public InvokeERPService(IApiInfoRepository apiInfoRepository) | 
 |  |  |         { | 
 |  |  |             _apiInfoRepository = apiInfoRepository; | 
 |  |  |         } | 
 |  |  |         // å建ä¸ä¸ªä½¿ç¨å°é©¼å³°å½åæ³çåºåå设置 | 
 |  |  |         JsonSerializerSettings settings = new JsonSerializerSettings | 
 |  |  |         { | 
 |  |  |             ContractResolver = new CamelCasePropertyNamesContractResolver() | 
 |  |  |         }; | 
 |  |  |         /// <summary> | 
 |  |  |         /// ERPæ¶è´§åæ¥å£è°ç¨ | 
 |  |  |         /// </summary> | 
 |  |  | 
 |  |  |         /// <returns></returns> | 
 |  |  |         public string InvokeMatReceiveApi(ERPReceiveModel receiveModel) | 
 |  |  |         { | 
 |  |  |             string serviceAddress = ""; | 
 |  |  |  | 
 |  |  |             Dt_ApiInfo apiInfo = _apiInfoRepository.QueryFirst(x => x.ApiCode == APIEnum.InvokeErpApi.ToString()); | 
 |  |  |             ERPBaseModel<ERPReceiveModel> model = new ERPBaseModel<ERPReceiveModel>() | 
 |  |  |             { | 
 |  |  |                 Data = receiveModel, | 
 |  |  |                 Desc = "æ¶è´§å", | 
 |  |  |                 Type = "toTCWMSReceive", | 
 |  |  |                 SecurityCode = "" | 
 |  |  |                 SecurityCode = "TeChuang" | 
 |  |  |             }; | 
 |  |  |  | 
 |  |  |             string response = HttpHelper.Post(serviceIp + serviceAddress, model.Serialize()); | 
 |  |  |              | 
 |  |  |             string request = JsonConvert.SerializeObject(model, settings); | 
 |  |  |              | 
 |  |  |             string response = HttpHelper.Post(apiInfo.ApiAddress, request); | 
 |  |  |             return response; | 
 |  |  |         } | 
 |  |  |  | 
 |  |  | 
 |  |  |         /// <returns></returns> | 
 |  |  |         public string InvokeCheckOrderApi(ERPCheckModel checkModel) | 
 |  |  |         { | 
 |  |  |             string serviceAddress = ""; | 
 |  |  |             Dt_ApiInfo apiInfo = _apiInfoRepository.QueryFirst(x => x.ApiCode == APIEnum.InvokeErpApi.ToString()); | 
 |  |  |             ERPBaseModel<ERPCheckModel> model = new ERPBaseModel<ERPCheckModel>() | 
 |  |  |             { | 
 |  |  |                 Data = checkModel, | 
 |  |  |                 Desc = "æ¶è´§å", | 
 |  |  |                 Desc = "ç©æIQCæ£éªå", | 
 |  |  |                 Type = "toTCWMSIQCTest", | 
 |  |  |                 SecurityCode = "" | 
 |  |  |                 SecurityCode = "TeChuang" | 
 |  |  |             }; | 
 |  |  |             string request = JsonConvert.SerializeObject(model, settings); | 
 |  |  |  | 
 |  |  |             string response = HttpHelper.Post(serviceIp + serviceAddress, model.Serialize()); | 
 |  |  |             string response = HttpHelper.Post(apiInfo.ApiAddress, request); | 
 |  |  |             return response; | 
 |  |  |         } | 
 |  |  |  | 
 |  |  | 
 |  |  |         /// <returns></returns> | 
 |  |  |         public string InvokeInboundOrderApi(ERPInboundModel inboundModel) | 
 |  |  |         { | 
 |  |  |             string serviceAddress = ""; | 
 |  |  |             Dt_ApiInfo apiInfo = _apiInfoRepository.QueryFirst(x => x.ApiCode == APIEnum.InvokeErpApi.ToString()); | 
 |  |  |             ERPBaseModel<ERPInboundModel> model = new ERPBaseModel<ERPInboundModel>() | 
 |  |  |             { | 
 |  |  |                 Data = inboundModel, | 
 |  |  |                 Desc = "æ¶è´§å", | 
 |  |  |                 Desc = "ç©æå
¥åºå", | 
 |  |  |                 Type = "toTCWMSMaterialWarehousing", | 
 |  |  |                 SecurityCode = "" | 
 |  |  |                 SecurityCode = "TeChuang" | 
 |  |  |             }; | 
 |  |  |  | 
 |  |  |             string response = HttpHelper.Post(serviceIp + serviceAddress, model.Serialize()); | 
 |  |  |             string request = JsonConvert.SerializeObject(model, settings); | 
 |  |  |             string response = HttpHelper.Post(apiInfo.ApiAddress, request); | 
 |  |  |             return response; | 
 |  |  |         } | 
 |  |  |         /// <summary> | 
 |  |  |         /// ERP颿éç¥ååºåº | 
 |  |  |         /// </summary> | 
 |  |  |         public string InvokeOutStandardsApi(ERPIssueModel issueModel) | 
 |  |  |         { | 
 |  |  |             Dt_ApiInfo apiInfo = _apiInfoRepository.QueryFirst(x => x.ApiCode == APIEnum.InvokeErpApi.ToString()); | 
 |  |  |             ERPBaseModel<ERPIssueModel> model = new ERPBaseModel<ERPIssueModel>() | 
 |  |  |             { | 
 |  |  |                 Data = issueModel, | 
 |  |  |                 Desc = "颿åºåºéç¥å", | 
 |  |  |                 Type = "toStandardPickList", | 
 |  |  |                 SecurityCode = "TeChuang" | 
 |  |  |             }; | 
 |  |  |             string request = JsonConvert.SerializeObject(model, settings).Replace("issitem", "Issitem"); | 
 |  |  |             string response = HttpHelper.Post(apiInfo.ApiAddress, request); | 
 |  |  |             return response; | 
 |  |  |         } | 
 |  |  |         /// <summary> | 
 |  |  |         /// ERPç©æåºåºæ¥å£è°ç¨ | 
 |  |  |         /// </summary> | 
 |  |  |         /// <param name="outboundModel"></param> | 
 |  |  |         /// <returns></returns> | 
 |  |  |         public string InvokeOutboundOrderApi(ERPOutboundModel outboundModel) | 
 |  |  |         { | 
 |  |  |             Dt_ApiInfo apiInfo = _apiInfoRepository.QueryFirst(x => x.ApiCode == APIEnum.InvokeErpApi.ToString()); | 
 |  |  |             ERPBaseModel<ERPOutboundModel> model = new ERPBaseModel<ERPOutboundModel>() | 
 |  |  |             { | 
 |  |  |                 Data = outboundModel, | 
 |  |  |                 Desc = "ææåºåº", | 
 |  |  |                 Type = "toBomMaterialOutTC", | 
 |  |  |                 SecurityCode = "TeChuang" | 
 |  |  |             }; | 
 |  |  |             string request = JsonConvert.SerializeObject(model, settings); | 
 |  |  |             string response = HttpHelper.Post(apiInfo.ApiAddress, request); | 
 |  |  |             return response; | 
 |  |  |         } | 
 |  |  |     } |