public void TestSaveBusData_GetSupplier() { AliSupplierHandle supplier = new AliSupplierHandle(); string data = "{\"AppKey\":\"334362\",\"AppSecret\":\"w5v9Xu2sK2y5\",\"TokenKey\":\"aa3cbd3b-de0c-4779-8596-6724864d7a13\",\"MemberId\":\"b2b-2248624086\"}"; supplier.analyseBussdata("GetSupplier", data); string ret = ""; FileInfo f = new FileInfo(@"E:\1688云端\json3.json"); using (FileStream fs = f.OpenRead()) { int n; using (MemoryStream ms = new MemoryStream()) { byte[] cach = new byte[255]; while ((n = fs.Read(cach, 0, cach.Length)) > 0) { ms.Write(cach, 0, n); } ret = System.Text.Encoding.Default.GetString(ms.ToArray()); ms.Close(); } fs.Close(); } AliDataAccess ada = new AliDataAccess(); ada.SaveBusData(supplier, ret); }
public void TestSaveBusData_GetOpBulkSettlement() { AliOpBulkSettlementHandle rcv = new AliOpBulkSettlementHandle(); string data = "{\"AppKey\":\"334362\",\"AppSecret\":\"w5v9Xu2sK2y5\",\"TokenKey\":\"aa3cbd3b-de0c-4779-8596-6724864d7a13\",\"RcvId\":\"199012010\"}"; rcv.analyseBussdata("GetOpBulkSettlement", data); string ret = ""; FileInfo f = new FileInfo(@"E:\1688云端\json2.json"); using (FileStream fs = f.OpenRead()) { int n; using (MemoryStream ms = new MemoryStream()) { byte[] cach = new byte[255]; while ((n = fs.Read(cach, 0, cach.Length)) > 0) { ms.Write(cach, 0, n); } ret = System.Text.Encoding.Default.GetString(ms.ToArray()); ms.Close(); } fs.Close(); } AliDataAccess ada = new AliDataAccess(); ada.SaveBusData(rcv, ret); }
public void TestSaveBusData_GetQuotationListByBuyOfferId() { AliQuotationHandle quote = new AliQuotationHandle(); string data = "{\"AppKey\":\"334362\",\"AppSecret\":\"w5v9Xu2sK2y5\",\"TokenKey\":\"aa3cbd3b-de0c-4779-8596-6724864d7a13\",\"OfferId\":\"297650670727\"}"; quote.analyseBussdata("GetQuotationListByBuyOfferId", data); string ret = "{\"quotationList\":[{\"expireDate\":\"20190531235959000+0800\",\"buyOfferId\":297650670727,\"attachments\":[],\"supplierMemberId\":\"b2b-2248624086\",\"contactInfo\":{\"contact\":\"李工\",\"mobile\":\"18305811673\"},\"invoiceType\":\"common\",\"freight\":0,\"totalPrice\":5000,\"supplyNoteItems\":[{\"subject\":\"苹果\",\"amount\":10,\"unit\":\"台\",\"price\":100,\"prItemId\":\"10087\",\"id\":1495899150729,\"productCode\":\"006001\",\"taxRate\":\"3\",\"itemCount\":10.0,\"brandName\":\"\",\"modelNumber\":\"\"},{\"subject\":\"菠萝蜜\",\"amount\":20,\"unit\":\"台\",\"price\":200,\"prItemId\":\"10088\",\"id\":1495899160727,\"productCode\":\"006002\",\"taxRate\":\"3\",\"itemCount\":20.0,\"brandName\":\"\",\"modelNumber\":\"\"}],\"payRequirementInfo\":{\"type\":\"payperiod\"},\"gmtCreate\":\"20190330135621000+0800\",\"prId\":\"xj82\",\"id\":1165882280727,\"status\":\"sent\"}]}"; AliDataAccess ada = new AliDataAccess(); ada.SaveBusData(quote, ret); }
public void TestSaveBusData_PostBuyoffer() { AliBuyofferHandle buyoffer = new AliBuyofferHandle(); string data = "{\"AppKey\":\"334362\",\"AppSecret\":\"w5v9Xu2sK2y5\",\"TokenKey\":\"0a54c693-6ca2-4765-abdf-c52b768dafbe\",\"subject\":\"test地址4\",\"phone\":\"13978766543\",\"contact\":\"联系人\",\"description\":\"描述1\",\"gmtQuotationExpire\":\"2018-12-12 12:12:12\",\"subBizType\":\"singlepurchase\",\"processTemplateCode\":\"assureTradeBusinessBuy\",\"transToolType\":\"3\",\"invoiceRequirement\":\"vat\",\"visibleAfterEndQuote\":\"false\",\"sourceMethodType\":\"open\",\"ngid\":\"\",\"receiveStreetAddress\":\"古林镇\",\"includeTax\":\"true\",\"quoteHasPostFee\":\"false\",\"allowPartOffer\":\"false\",\"certificateIds\":[\"542\",\"1\",\"2\",\"3\",\"400\",\"548\",\"549\"],\"otherCertificateNames\":[\"合格证\",\"检测报告\"],items:[{\"prItemId\":\"1001\",\"productCode\":\"a001\",\"purchaseAmount\":100,\"subject\":\"资源名称\",\"desc\":\"资源描述\",\"unit\":\"千克\",\"brandName\":\"品牌\",\"modelNumber\":\"型号1\"}]}"; buyoffer.analyseBussdata("PostBuyoffer", data); string ret = "{\"id\":297650670727}";//buyoffer.doPost(); AliDataAccess ada = new AliDataAccess(); ada.SaveBusData(buyoffer, ret); }
public void TestSaveBusData_GetBuyoffer() { AliBuyofferHandle buyoffer = new AliBuyofferHandle(); string data = "{\"AppKey\":\"334362\",\"AppSecret\":\"w5v9Xu2sK2y5\",\"TokenKey\":\"aa3cbd3b-de0c-4779-8596-6724864d7a13\",\"offerid\":\"297650670727\"}"; buyoffer.analyseBussdata("GetBuyoffer", data); string ret = "{\"buyOffer\":{\"processTemplateCode\":\"accountPeriod\",\"attachments\":[],\"contactInfo\":{\"phone\":\"18305811642\",\"contact\":\"小张\"},\"allowPartQuote\":false,\"gmtQuotationExpire\":\"20190331015209000+0800\",\"prId\":\"xj82\",\"isVisibleAfterEndQuote\":false,\"title\":\"330ht(20190330-0001-XJCG)\",\"gmtCreate\":\"20190330135359000+0800\",\"quoteHasPostFee\":true,\"purchaseNoteId\":297650670727,\"includeTax\":true,\"sourceMethodType\":\"selectedmysupplier\",\"subBizType\":\"singlepurchase\",\"onlineShoppingAttachList\":[],\"transToolType\":\"3\",\"openToPortal\":false,\"purchaseNoteItems\":[{\"attachments\":[],\"purchaseCount\":10,\"subject\":\"苹果\",\"purchaseId\":297650670727,\"purchaseNoteItemId\":1132333900728,\"prItemId\":\"10087\",\"brandName\":\"\",\"purchaseAmount\":10,\"productFeature\":\"\",\"purchaseItemSign\":{\"sign\":0,\"addedIntoProductedDeport\":false},\"unit\":\"台\",\"productCode\":\"006001\",\"lineNum\":\"1\",\"modelNumber\":\"\",\"category\":{\"topCategoryId\":130822002,\"topCategoryName\":\"餐饮生鲜\",\"secondCategoryName\":\"水果\",\"thirdCategoryName\":\"苹果\",\"leafCategoryId\":1036642,\"secondCategoryId\":10037,\"categorylist\":[130822002,10037,1036642],\"thirdCategoryId\":1036642,\"leafCategoryName\":\"苹果\"},\"categoryId\":1036642},{\"attachments\":[],\"purchaseCount\":20,\"subject\":\"菠萝\",\"purchaseId\":297650670727,\"purchaseNoteItemId\":1132333910727,\"prItemId\":\"10088\",\"brandName\":\"\",\"purchaseAmount\":50,\"productFeature\":\"\",\"purchaseItemSign\":{\"sign\":0,\"addedIntoProductedDeport\":false},\"unit\":\"台\",\"productCode\":\"006002\",\"lineNum\":\"2\",\"modelNumber\":\"\",\"category\":{\"topCategoryId\":130822002,\"topCategoryName\":\"餐饮生鲜\",\"secondCategoryName\":\"水果\",\"thirdCategoryName\":\"菠萝/凤梨\",\"leafCategoryId\":125062004,\"secondCategoryId\":10037,\"categorylist\":[130822002,10037,125062004],\"thirdCategoryId\":125062004,\"leafCategoryName\":\"菠萝/凤梨\"},\"categoryId\":125062004}],\"invoiceType\":\"vat\",\"subUserId\":2200593250128,\"status\":\"sent\"}}"; AliDataAccess ada = new AliDataAccess(); ada.SaveBusData(buyoffer, ret); }
public object DoBusinessWork(string useServer, object busData, CloudBaseData cloudData) { object result = null; AliPubHandle handle = null; switch (useServer) { case "GetSubAccountBindingList": //取1688账号与i6p账号绑定清单 case "BindSubAccount": //绑定或解绑i6p账号 case "GetMemberIdsByLoginIds": //通过列表loginIds查询对应的memberId,批量最大数不要超过110个 case "GetLoginIdsByMemberIds": //通过列表memberId查询对应的loginIds,批量最大数不要超过110个 case "CreateSubAccount": handle = new AliAccountHandle(); break; case "GetSupplier": //取1688供应商信息 case "UpdateSupplierCode": //更新供应商外部编码,用于将i8系统的编码同步到1688 case "ImportSuppliers": //批量导入1688供应商 添加后供应商需完成账号注册并与公司名绑定才能与买家进行线上采购合作 handle = new AliSupplierHandle(); break; case "PostBuyoffer": //发布询价单 case "CloseBuyOffer": //关闭询价单 case "GetBuyoffer": //取1688询价单信息 handle = new AliBuyofferHandle(); break; case "GetQuotationListByBuyOfferId": //根据询价id获取询价单的报价信息 handle = new AliQuotationHandle(); break; case "GetOrder": //根据订单id获取订单的信息 case "GetOrder2": case "QueryOrderDetail": //查询采购订单详情 case "CreateOrder": //创建询价流程采购单(交易) 需要报价单主键 case "CreateOrderPayment": //根据订单创建付款单 case "CreateProcurementOrder": //创建履约订单 case "ApproveOrder": //采购订单审批 case "CancelOrder": //取消订单 case "CreateOrderBySourceId": //根据来源单据创建订单 handle = new AliOrderHandle(); break; case "ReceiveOrder": //确认订单生成收货单 case "GetOpBulkSettlement": //获取收货单信息 case "ReceiveGoods": //履约采购订单创建收货单 case "QueryReceiveGoods": ///查询履约采购的收货单 handle = new AliOpBulkSettlementHandle(); break; case "CreateBulkSettlementImpl": //根据收货单子单id创建结算单 case "CreateSettlementNote": //履约采购的结算 case "QuerySettlementNote": //履约采购查询结算单 case "CreatePayNote": //履约采购通过结算创建付款单 handle = new AliBulkSettlementImplHandle(); break; case "AddCategory": //创建1688资源分类 case "ModifyCategory": //修改1688资源分类 case "DelCategory": //删除1688资源分类 case "GetCategoryById": //通过1688主键查找单个资源分类 case "QueryAllCategory": //查询所有1688资源分类 handle = new AliCategoryHandle(); break; case "AddProduct": //创建1688物料 case "DelProduct": //根据id删除1688物料 case "ModifyProduct": //修改1688物料 case "QueryProduct": //分页查询1688物料 case "QueryProductById": //根据1688主键查找物料 case "QueryProductByCodeList": //精确查询产品列表 handle = new AliProductHandle(); break; case "TestCouldService": return(string.Format("云服务通畅;AppKey:{0},Book:{1},IP:{2},Loginer:{3},Rule:{4},TimeStamp:{5}", cloudData.AppKey, cloudData.Book, cloudData.IP, cloudData.Loginer, cloudData.Rule, cloudData.TimeStamp)); default: throw new Exception(string.Format("'{0}' is invalid", useServer)); } string data = busData.ToString(); AliDataLog adl = new AliDataLog(); AliDataAccess ada = new AliDataAccess(); try { handle.analyseBussdata(useServer, data); result = handle.doPost(); adl.LogForAliApi(handle, result.ToString(), true); ada.SaveBusData(handle, result.ToString()); } catch (Exception e) { adl.LogForAliApi(handle, "", false, e); throw e; } return(result); }