/// <summary> 配件销售开单 /// </summary> /// <param name="updateTime">最后更新时间</param> /// <returns>返回同步配件信息条数,如为-1,同步失败</returns> public static bool UpLoadPartSale(string jsonStr) { //如果没有接入码或者sap代码,则不调用接口 if (string.IsNullOrEmpty(GlobalStaticObj_YT.ClientID) || string.IsNullOrEmpty(GlobalStaticObj_YT.SAPCode)) { return true; } Utility.Log.Log.writeLineToLog("【配件销售开单】" + jsonStr, "接口"); #region 测试数据 //partsale pSale = new partsale(); //pSale.amount = "120"; //pSale.cust_name = "add"; //pSale.cust_phone = "123123"; //pSale.license_plate = "豫G99300"; //pSale.remark = "dfgdfsdf"; //pSale.sale_date = "2014-10-10 14:46:44"; //pSale.turner = "14H197P-0013"; //SUPartSale.partDetail[] pArry = new SUPartSale.partDetail[1]; //SUPartSale.partDetail p0 = new SUPartSale.partDetail(); //p0.amount = "12"; //p0.business_count = "1"; //p0.business_price = "12"; //p0.car_parts_code = "2100-00233"; //p0.parts_remark = "asdfasdf"; //p0.remark = "asdfasf"; //p0.wh_code = "CK00000202"; //pArry[0] = p0; //pSale.partDetails = pArry; #endregion ServicePointManager.ServerCertificateValidationCallback = WebServUtil.ValidateServerCertificate; SUPartSale.clientInfo clientInfo = new SUPartSale.clientInfo(); clientInfo.clientID = GlobalStaticObj_YT.ClientID; clientInfo.serviceID = "partSaleSU"; SUPartSale.partSale pSale = Newtonsoft.Json.JsonConvert.DeserializeObject<SUPartSale.partSale>(jsonStr); SUPartSale.partSaleSUService serv = new SUPartSale.partSaleSUService(); string stationCode = Secret.Encrypt3DES_UTF8(GlobalStaticObj_YT.SAPCode, GlobalStaticObj_YT.KeySecurity_YT); string dateStr = Secret.Encrypt3DES_UTF8(GlobalStaticObj_Server.Instance.CurrentDateTime.ToString("yyyy-MM-dd HH:mm:ss"), GlobalStaticObj_YT.KeySecurity_YT); string requestType = Secret.Encrypt3DES_UTF8("CREATE", GlobalStaticObj_YT.KeySecurity_YT); clientInfo = WebServUtil.EncModel<SUPartSale.clientInfo>(clientInfo); //先取出配件实体集合加密 SUPartSale.partDetail[] partDetails = WebServUtil.EncList<SUPartSale.partDetail>(pSale.partDetails); pSale = WebServUtil.EncModel<SUPartSale.partSale>(pSale);//加密销售单实体 pSale.partDetails = partDetails;//将加密后的配件实体集合赋值给加密后的销售单实体 SUPartSale.Result result = serv.partSaleSU(stationCode, dateStr, requestType, pSale, clientInfo); string state = Secret.Decrypt3DES_UTF8(result.state, GlobalStaticObj_YT.KeySecurity_YT); if (state == "F") { string errMsg = Secret.Decrypt3DES_UTF8(result.errorMsg, GlobalStaticObj_YT.KeySecurity_YT); //Utility.Log.Log.writeLineToLog("【配件销售开单】" + errMsg, "接口"); GlobalStaticObj_Server.YTInterfaceLogService.WriteLog("配件销售开单", errMsg); return false; } return true; }
/// <summary> 配件销售开单 /// </summary> /// <param name="updateTime">最后更新时间</param> /// <returns>返回同步配件信息条数,如为-1,同步失败</returns> public static bool UpLoadPartSales() { ServicePointManager.ServerCertificateValidationCallback = ValidateServerCertificate; SUPartSale.clientInfo clientInfo = new SUPartSale.clientInfo(); clientInfo.clientID = GlobalStaticObj_Servier.Instance.ClientID; clientInfo.serviceID = "partSaleSU"; SUPartSale.partSale pSale = new SUPartSale.partSale(); pSale.amount = "120"; pSale.cust_name = "add"; pSale.cust_phone = "123123"; pSale.license_plate = "豫G99300"; pSale.remark = "dfgdfsdf"; pSale.sale_date = "2014-10-10 14:46:44"; pSale.turner = "14H197P-0013"; SUPartSale.partDetail[] pArry = new SUPartSale.partDetail[1]; SUPartSale.partDetail p0 = new SUPartSale.partDetail(); p0.amount="12"; p0.business_count = "1"; p0.business_price = "12"; p0.car_parts_code = "2100-00233"; p0.parts_remark = "asdfasdf"; p0.remark = "asdfasf"; p0.wh_code = "CK00000202"; pArry[0] = p0; pSale.partDetails = pArry; SUPartSale.partSaleSUService serv = new SUPartSale.partSaleSUService(); int time= serv.Timeout; SUPartSale.Result result = serv.partSaleSU(GlobalStaticObj_Servier.Instance.ClientID, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), "CREATE", pSale, clientInfo); if (result.state == "S") { return true; } return false; }