知行之桥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连接

edi

3.自定义连接名称,Auth Schema选择basic类型,填写商店URL、应用ID以及密码,点击创建连接。

edi

4.连接创建完成后,回到Shopify端口的设置页面,点击测试连接,显示测试连接成功,此时即成功连接到了Shopify端口。

edi

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.搭建工作流

首先,我们需要在知行之桥中先搭建出处理文件的工作流,工作流示例如下:

edi

工作流由一个Shopify端口、一个XMLMap端口以及一个Mysql端口组成,各端口功能如下:

Shopify端口:连接Shopify并从Shopify中定时获取订单数据
XMLMap端口:将Shopify获取到的订单XML文件转换为符合数据库表结构的XML文件
Mysql端口:处理XML Map得到的数据库结构XML文件,将文件数据插入到数据库中间表中

通过以上工作流,能够自动化的实现这一步骤: 获取Shopify 订单 -> 将订单插入数据库中间表 -> ERP处理中间表将订单数据收录入ERP系统中 -> 业务人员在ERP中看到订单。

2.Shopify 端口配置

点击Shopify端口进行配置,以获取订单数据。

选择Select操作,并在检索配置中点击添加:

edi

在弹出的Shopify数据表中,选择Orders,点击添加:

edi

此时可以在页面中看到Orders中的所有列,在下方过滤规则中可设置订单筛选条件,我们此处以“获取2022年5月31日后有过更新的订单”为条件作为示例,因为SQL是日期格式的比较,所以需要编写自定义SQL语句,在此处勾选编写自定义查询:

edi

输入SQL语句:SELECT * FROM Orders WHERE UpdatedAt >= 2022-05-31

点击右上角保存变更。

此时Shopify端口即配置完成。

3.配置数据库端口

在和ERP开发事先沟通好中间表表结构和字段,此处以Orders和OrderItems两张表为例,Orders表示订单主表,包含订单、订单日期等信息,OrderItems表示订单从表,包含物料等信息。

在数据库创建好对应表之后,点击MySQL端口进行配置。

edi

首先,创建数据库连接, 点击创建,输入数据库相关配置,并点击测试连接以确认配置正确,测试连接成功后点击创建连接以建立连接。

edi

在“操作”中选择Upsert,并点击添加以添加表结构:

edi

选中Orders表,点击添加

edi

此时页面会列出Orders表中所包含的所有列名,在左侧选中orders,再次点击添加

edi

选中OrderItems,再次点击添加

edi

此时页面即可看到Orders和OrderItems表以树形结构嵌套在一起,从结构上能看出orderItems是Orders的子表。

edi

接下来,需要创建主表和子表的关联关系,点击右上角代码,以代码的格式显示页面:

edi

子表中,orderId作为外键,和主表关联

edi

所以需要在orderId中添加ref=@id,以标明主从表的关联关系;

此外,由于主从表主键都是自增ID,需要在主键中添加”ref=”@@ LAST_INSERT_ID””:

edi

配置完成后点击保存。

此时,数据库端口也配置完成。

4.XML Map端口配置

点击XML Map端口,进入XML Map端口设置,此时页面会自动载入源文件和目标文件,源文件是Shopify端口中输出的XML文件, 目标文件是数据库端口要输入的XML文件,我们在此处进行拖拽,实现源文件和目标文件的映射关系:

edi

配置完所有的映射关系后,点击右上角保存变更。

5.执行工作流

到此步骤,所有知行之桥的配置就都完成了,我们在Shopify端口的输出页面,点击接收即可手动接收符合过滤条件的所有订单数据

edi

我们下载一条订单文件,显示内容及格式:

<?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>
            <Vendor json:name="vendor">Bernhard - Franecki</Vendor>
            <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"/>
        <SendFulfillmentReceipt xsi:nil="true"/>
        <SendReceipt 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是什么?
阅读原文

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

知行EDI

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值