知行之桥EDI系统Shopify端口的使用

服务器

  Shopify 是一站式SaaS模式的电商服务平台,为电商卖家提供搭建网店的技术和模版,管理全渠道的营销、售卖、支付、物流等服务。目前已有超过一百万家企业使用Shopify平台创建了在线店铺。 对于企业而言,企业愿意将Shopify和自己的业务系统集成起来,这样就可以从ERP系统中进行库存控制和订单业务。虽然Shopify提供了API接口能够让企业进行调用,但API调用意味着企业需要投入更多的开发、人力、和时间。 知行之桥EDI提供了Shopify端口,只需要通过页面的简单配置,即可成功的连接到Shopify店铺,对Shopify店铺进行操作控制,从而集成ERP系统。Shopify 端口允许通过Shopify 的 API 推送或拉取数据来将 Shopify 集成到企业的数据工作流中。 Shopify连接配置 1.登录知行之桥EDI后,在工作流页面,其他(Other)分类中,找到Shopify端口,并将其拖入空白区域,点击创建端口即可创建成功。 2.点击创建的端口,进入设置页面,点击此处的创建,创建Shopify连接 3.自定义连接名称,Auth Schema选择basic类型,填写商店URL、应用ID以及密码,点击创建连接。 4.连接创建完成后,回到Shopify端口的设置页面,点击测试连接,显示测试连接成功,此时即成功连接到了Shopify端口。 Shopify端口功能 与 Shopify 建立连接后,知行之桥 Shopify 端口以下几种操作: 1.Upsert:可以插入或更新 Shopify 相关数据。 默认情况下,如果 Shopify 中已存在该行记录,则会对 Shopify 中的现有数据执行更新操作。 2.Lookup:可以从 Shopify 检索一个数据并将该值插入到知行之桥现有的工作流中。 Lookup Query 可以指定端口将从 Shopify 检索哪个值,是针对 Shopify 表的 SQL 查询。 3.Select:从 Shopify 检索数据,并将其以XML的形式带入知行之桥的工作流中。 可以使用过滤器面板添加过滤条件。 这些过滤器的功能类似于 SQL 中的 WHERE 子句。 4.执行存储过程:将进入端口的数据视为存储过程的输入,然后将结果向下传递。 可以单击显示示例数据按钮为选定的存储过程提供示例输入并预览结果。 Shopify端口实战 假设现在企业A要将Shopify与自己ERP系统集成,评估后认为数据库中间表的方案符合企业预期,我们以以下比较常见的场景为例,为大家展示实际集成的工作流和代码实现。 将Shopify订单导入ERP系统 1.搭建工作流 首先,我们需要在知行之桥中先搭建出处理文件的工作流,工作流示例如下: 工作流由一个Shopify端口、一个XMLMap端口以及一个Mysql端口组成,各端口功能如下: Shopify端口:连接Shopify并从Shopify中定时获取订单数据 XMLMap端口:将Shopify获取到的订单XML文件转换为符合数据库表结构的XML文件 Mysql端口:处理XML Map得到的数据库结构XML文件,将文件数据插入到数据库中间表中 通过以上工作流,能够自动化的实现这一步骤: 获取Shopify 订单 -> 将订单插入数据库中间表 -> ERP处理中间表将订单数据收录入ERP系统中 -> 业务人员在ERP中看到订单。 2.Shopify 端口配置 点击Shopify端口进行配置,以获取订单数据。 选择Select操作,并在检索配置中点击添加: 在弹出的Shopify数据表中,选择Orders,点击添加: 此时可以在页面中看到Orders中的所有列,在下方过滤规则中可设置订单筛选条件,我们此处以“获取2022年5月31日后有过更新的订单”为条件作为示例,因为SQL是日期格式的比较,所以需要编写自定义SQL语句,在此处勾选编写自定义查询: 输入SQL语句:SELECT * FROM Orders WHERE UpdatedAt >= 2022-05-31 点击右上角保存变更。 此时Shopify端口即配置完成。 3.配置数据库端口 在和ERP开发事先沟通好中间表表结构和字段,此处以Orders和OrderItems两张表为例,Orders表示订单主表,包含订单、订单日期等信息,OrderItems表示订单从表,包含物料等信息。 在数据库创建好对应表之后,点击MySQL端口进行配置。 首先,创建数据库连接, 点击创建,输入数据库相关配置,并点击测试连接以确认配置正确,测试连接成功后点击创建连接以建立连接。 在“操作”中选择Upsert,并点击添加以添加表结构: 选中Orders表,点击添加 此时页面会列出Orders表中所包含的所有列名,在左侧选中orders,再次点击添加 选中OrderItems,再次点击添加 此时页面即可看到Orders和OrderItems表以树形结构嵌套在一起,从结构上能看出orderItems是Orders的子表。 接下来,需要创建主表和子表的关联关系,点击右上角代码,以代码的格式显示页面: 子表中,orderId作为外键,和主表关联 所以需要在orderId中添加ref=@id,以标明主从表的关联关系; 此外,由于主从表主键都是自增ID,需要在主键中添加”ref=”@@ LAST_INSERT_ID””: 配置完成后点击保存。 此时,数据库端口也配置完成。 4.XML Map端口配置 点击XML Map端口,进入XML Map端口设置,此时页面会自动载入源文件和目标文件,源文件是Shopify端口中输出的XML文件, 目标文件是数据库端口要输入的XML文件,我们在此处进行拖拽,实现源文件和目标文件的映射关系: 配置完所有的映射关系后,点击右上角保存变更。 5.执行工作流 到此步骤,所有知行之桥的配置就都完成了,我们在Shopify端口的输出页面,点击接收即可手动接收符合过滤条件的所有订单数据 我们下载一条订单文件,显示内容及格式 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 <?xml version="1.0" encoding="UTF-8"?> <Items xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:json="http://www.arcesb.com/ns/jsonconnector"> <Orders> <Id>4332630638615</Id> <AppliedDiscountAmount xsi:nil="true"/> <AppliedDiscountDescription xsi:nil="true"/> <AppliedDiscountTitle xsi:nil="true"/> <AppliedDiscountValue xsi:nil="true"/> <AppliedDiscountValueType xsi:nil="true"/> <BillingAddressAddress1 xsi:nil="true"/> <BillingAddressAddress2 xsi:nil="true"/> <BillingAddressCity xsi:nil="true"/> <BillingAddressCompany xsi:nil="true"/> <BillingAddressCountry xsi:nil="true"/> <BillingAddressCountryCode xsi:nil="true"/> <BillingAddressDefault xsi:nil="true"/> <BillingAddressFirstName xsi:nil="true"/> <BillingAddressLastName xsi:nil="true"/> <BillingAddressLatitude xsi:nil="true"/> <BillingAddressLongitude xsi:nil="true"/> <BillingAddressName xsi:nil="true"/> <BillingAddressPhone xsi:nil="true"/> <BillingAddressProvince xsi:nil="true"/> <BillingAddressProvinceCode xsi:nil="true"/> <BillingAddressZip xsi:nil="true"/> <BrowserIp xsi:nil="true"/> <BuyerAcceptsMarketing>False</BuyerAcceptsMarketing> <CancelledAt xsi:nil="true"/> <CancelReason xsi:nil="true"/> <CartToken xsi:nil="true"/> <ClosedAt xsi:nil="true"/> <CreatedAt>2022-05-30T00:58:33.0000+08:00</CreatedAt> <Currency>USD</Currency> <CustomerFirstName xsi:nil="true"/> <CustomerId xsi:nil="true"/> <CustomerLastName xsi:nil="true"/> <CustomerLocale xsi:nil="true"/> <DiscountApplicationsAggregate></DiscountApplicationsAggregate> <DiscountCodes></DiscountCodes> <Email></Email> <FinancialStatus>paid</FinancialStatus> <FulfillmentStatus xsi:nil="true"/> <InventoryBehaviour xsi:nil="true"/> <InvoiceSentAt xsi:nil="true"/> <InvoiceUrl xsi:nil="true"/> <LandingSite xsi:nil="true"/> <OrderItems json:array="true"> <Id json:name="id" json:type="NUMBER">11033980436503</Id> <Duties json:name="duties" json:array="empty"/> <FulfillableQuantity json:name="fulfillable_quantity" json:type="NUMBER">2</FulfillableQuantity> <VariantInventoryManagement json:name="variant_inventory_management">shopify</VariantInventoryManagement> <Name json:name="name">Fully-configurable Refined Rubber Fish - ellow</Name> <DiscountAllocations json:name="discount_allocations" json:array="empty"/> <TotalDiscount json:name="total_discount">0.00</TotalDiscount> <Price json:name="price">1360.00</Price> <TaxLines json:name="tax_lines" json:array="empty"/> <Taxable json:name="taxable" json:type="BOOLEAN">true</Taxable> <VariantTitle json:name="variant_title">ellow</VariantTitle> <Quantity json:name="quantity" json:type="NUMBER">2</Quantity> <Grams json:name="grams" json:type="NUMBER">46</Grams> <PriceSet json:name="price_set"> <ShopMoney json:name="shop_money"> <CurrencyCode json:name="currency_code">USD</CurrencyCode> <Amount json:name="amount">1360.00</Amount> </ShopMoney> <PresentmentMoney json:name="presentment_money"> <CurrencyCode json:name="currency_code">USD</CurrencyCode> <Amount json:name="amount">1360.00</Amount> </PresentmentMoney> </PriceSet> <GiftCard json:name="gift_card" json:type="BOOLEAN">false</GiftCard> <Sku json:name="sku"></Sku> <FulfillmentService json:name="fulfillment_service">manual</FulfillmentService> <Vor json:name="vor">Bernhard - Franecki</Vor> <ProductId json:name="product_id" json:type="NUMBER">64146735127</ProductId> <Title json:name="title">Fully-configurable Refined Rubber Fish</Title> <TotalDiscountSet json:name="total_discount_set"> <ShopMoney json:name="shop_money"> <CurrencyCode json:name="currency_code">USD</CurrencyCode> <Amount json:name="amount">0.00</Amount> </ShopMoney> <PresentmentMoney json:name="presentment_money"> <CurrencyCode json:name="currency_code">USD</CurrencyCode> <Amount json:name="amount">0.00</Amount> </PresentmentMoney> </TotalDiscountSet> <RequiresShipping json:name="requires_shipping" json:type="BOOLEAN">true</RequiresShipping> <Properties json:name="properties" json:array="empty"/> <FulfillmentStatus json:name="fulfillment_status" xsi:nil="true"/> <AdminGraphqlApiId json:name="admin_graphql_api_id">gid://shopify/LineItem/11033980436503</AdminGraphqlApiId> <ProductExists json:name="product_exists" json:type="BOOLEAN">true</ProductExists> <VariantId json:name="variant_id" json:type="NUMBER">548270538775</VariantId> </OrderItems> <LocationId xsi:nil="true"/> <Name>#2405</Name> <Note xsi:nil="true"/> <NoteAttributesAggregate></NoteAttributesAggregate> <Number>2405</Number> <Operation xsi:nil="true"/> <OrderStatusUrl>https://simpledevstore.myshopify.com/23750175/orders/b27379d5063f1530f23d67affef6c556/authenticate?key=f1ef074e457403b178fea3bd60d06f61</OrderStatusUrl> <PaymentTermsAmount xsi:nil="true"/> <PaymentTermsCurrency xsi:nil="true"/> <PaymentTermsDueInDays xsi:nil="true"/> <PaymentTermsPaymentSchedules xsi:nil="true"/> <PaymentTermsPaymentTermsName xsi:nil="true"/> <PaymentTermsPaymentTermsType xsi:nil="true"/> <Phone xsi:nil="true"/> <ProcessedAt>2022-05-30T00:58:33.0000+08:00</ProcessedAt> <ProcessingMethod></ProcessingMethod> <ReferringSite xsi:nil="true"/> <SFulfillmentReceipt xsi:nil="true"/> <SReceipt xsi:nil="true"/> <ShippingAddressAddress1 xsi:nil="true"/> <ShippingAddressAddress2 xsi:nil="true"/> <ShippingAddressCity xsi:nil="true"/> <ShippingAddressCompany xsi:nil="true"/> <ShippingAddressCountry xsi:nil="true"/> <ShippingAddressCountryCode xsi:nil="true"/> <ShippingAddressDefault xsi:nil="true"/> <ShippingAddressFirstName xsi:nil="true"/> <ShippingAddressLastName xsi:nil="true"/> <ShippingAddressLatitude xsi:nil="true"/> <ShippingAddressLongitude xsi:nil="true"/> <ShippingAddressName xsi:nil="true"/> <ShippingAddressPhone xsi:nil="true"/> <ShippingAddressProvince xsi:nil="true"/> <ShippingAddressProvinceCode xsi:nil="true"/> <ShippingAddressZip xsi:nil="true"/> <ShippingAggregate></ShippingAggregate> <SourceName>6489121</SourceName> <SubtotalPrice>2720.000000</SubtotalPrice> <Tags></Tags> <TaxAggregate></TaxAggregate> <TaxesIncluded>False</TaxesIncluded> <TaxExempt xsi:nil="true"/> <Token>b27379d5063f1530f23d67affef6c556</Token> <TotalDiscounts>0.000000</TotalDiscounts> <TotalOrderItemsPrice>2720.000000</TotalOrderItemsPrice> <TotalPrice>2720.000000</TotalPrice> <TotalShippingPriceSetShopMoneyAmount>0</TotalShippingPriceSetShopMoneyAmount> <TotalShippingPriceSetShopMoneyCurrencyCode>USD</TotalShippingPriceSetShopMoneyCurrencyCode> <TotalTax>0.000000</TotalTax> <TotalWeight>0</TotalWeight> <UpdatedAt>2022-05-30T00:58:33.0000+08:00</UpdatedAt> </Orders> </Items> 这些订单数据会经由XML Map端口和MySQL端口,流入数据库中。 点击MySQL端口,在输入中,看到文件状态位Success,则表示插入数据库成功: 进入数据库中间表即可看到插入的相关数据。 更多EDI信息,请参阅: EDI是什么? EDI通信专家 阅读原文:知行之桥EDI系统Shopify端口的使用 EDI通信专家

标签: 服务器