简体   繁体   English

使用Azure集成工具解决XSLT中的特定EDI 856 HL级别时遇到问题

[英]I have a problem with addressing a specific EDI 856 HL level in XSLT with Azure integration tools

I have an inbound 856 that looks like the following when decoded: 解码后,我有一个入站856,看起来像下面的样子:

<X12_00401_856>
    <ST>
        <ST01>856</ST01>
        <ST02>0339</ST02>
    </ST>
    <BSN>
        <BSN01>00</BSN01>
        <BSN02>N975092</BSN02>
        <BSN03>20180911</BSN03>
        <BSN04>125200</BSN04>
    </BSN>
    <DTM>
        <DTM01>011</DTM01>
        <DTM02>20180911</DTM02>
    </DTM>
    <HLLoop1>
        <HL>
            <HL01>1</HL01>
            <HL03>S</HL03>
            <HL04>1</HL04>
        </HL>
        <N1Loop1>
            <N1>
                <N101>ST</N101>
                <N103>1</N103>
                <N104>123456789</N104>
            </N1>
        </N1Loop1>
    </HLLoop1>
    <HLLoop1>
        <HL>
            <HL01>2</HL01>
            <HL02>1</HL02>
            <HL03>O</HL03>
            <HL04>1</HL04>
        </HL>
        <LIN>
            <LIN02>VO</LIN02>
            <LIN03>123456</LIN03>
        </LIN>
    </HLLoop1>
    <HLLoop1>
        <HL>
            <HL01>3</HL01>
            <HL02>2</HL02>
            <HL03>I</HL03>
            <HL04>0</HL04>
        </HL>
        <LIN>
            <LIN02>HN</LIN02>
            <LIN03>NH1802</LIN03>
        </LIN>
    </HLLoop1>
    <HLLoop1>
        <HL>
            <HL01>4</HL01>
            <HL02>1</HL02>
            <HL03>O</HL03>
            <HL04>1</HL04>
        </HL>
        <LIN>
            <LIN02>VO</LIN02>
            <LIN03>654321</LIN03>
        </LIN>
    </HLLoop1>
    <HLLoop1>
        <HL>
            <HL01>5</HL01>
            <HL02>4</HL02>
            <HL03>I</HL03>
            <HL04>0</HL04>
        </HL>
        <LIN>
            <LIN02>HN</LIN02>
            <LIN03>NH1803</LIN03>
        </LIN>
    </HLLoop1>
    <HLLoop1>
        <HL>
            <HL01>6</HL01>
            <HL02>4</HL02>
            <HL03>I</HL03>
            <HL04>0</HL04>
        </HL>
        <LIN>
            <LIN02>HN</LIN02>
            <LIN03>NH1803</LIN03>
        </LIN>
    </HLLoop1>
    <CTT>
        <CTT01>3</CTT01>
    </CTT>
    <SE>
        <SE01>71</SE01>
        <SE02>0339</SE02>
    </SE>
</X12_00401_856>

Here is a screenshot of my map: 这是我的地图的屏幕截图:

在此处输入图片说明

The first script is C#: 第一个脚本是C#:

public int hlIndex = 0;

public int returnHLOIndex(int hl01, string hl03)
        {
            if(hl03 == "O")
            {
                hlIndex = hl01;
            }
            return hlIndex;
        }

Here is the XSLT in the second script: 这是第二个脚本中的XSLT:

<xsl:template name="X12_00401_856_To_ASN">

    <xsl:variable name="BOL" select="//BSN/BSN02"/>
    <xsl:variable name="accountNumber"><xsl:value-of select="//HLLoop1[HL/HL03='S']/N1Loop1/N1[N101='ST']/N104"/></xsl:variable>

    <xsl:variable name="NetWeight" select="//TD1/TD107"/>

    <xsl:element name="EDIFile_Staging_ASNHeader">
        <xsl:element name="AccountNumber"><xsl:value-of select="$accountNumber"/></xsl:element>
        <!--        -->
        <xsl:for-each select="//HLLoop1[HL/HL03='I']">

            <xsl:variable name="hloIndex"><xsl:value-of select="userCSharp:returnHLOIndex"/></xsl:variable>
            <xsl:variable name="orderNumber"><xsl:value-of select="//HLLoop1[$hloIndex]/LIN/LIN03"/></xsl:variable>

            <xsl:element name="EDIFile_Staging_ASNLines">
                <xsl:element name="lineNumber"><xsl:value-of select="position()"/></xsl:element>
                <xsl:element name="AdvanceShipmentNoteDocuNum"><xsl:value-of select="$BOL"/></xsl:element>
                <xsl:element name="AccountNumber"><xsl:value-of select="$accountNumber"/></xsl:element>
                <xsl:element name="ASNNumber"><xsl:value-of select="$BOL"/></xsl:element>
                <xsl:element name="OrderNumber"><xsl:value-of select="$orderNumber"/></xsl:element>

            </xsl:element>
        </xsl:for-each>
    </xsl:element>
</xsl:template>

The output generates one detail loop for each item level in the 856. But I need to carry the value of the LIN03 from the parent Order level. 输出为856中的每个项目级别生成一个明细循环。但是我需要携带父订单级别的LIN03的值。 This version only seems to grab the first occurrence of the LIN03 at the order level. 这个版本似乎只在订单级别上抢占了LIN03的第一次出现。 How can I correctly address those order level values? 我如何正确处理那些订单级别的值?

I read one of the comments and he is right, you should add parameters. 我读了其中的评论之一,他是对的,您应该添加参数。

 <xsl:variable name="hloIndex"> <xsl:value-of select="userCSharp:returnHLOIndex(string((HL/HL01/text()), string(HL/HL03/text()))"/> </xsl:variable> 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 我对 Azure Function Bundle 绑定有疑问 - I have a problem with Azure Function Bundle Bindings 我可以使用Azure命令行工具流式传输特定的Azure网站自定义日志文件吗? - Can I stream specific Azure website custom log files with the Azure command line tools? 在Azure Logic App中创建EDI批处理 - Create EDI Batch in Azure Logic App 必须如何存储 Azure BlobStorage 连接数据才能支持所有可用的寻址模式? - How does Azure BlobStorage connection data have to be stored to support all available addressing modes? Azure BizTalk Services EDI Bridge的架构错误 - Schema error with Azure BizTalk Services EDI Bridge SAP 与 Azure 逻辑应用程序集成 - 缓存/元数据问题? - SAP integration with Azure Logic Apps - Cache / Metadata problem? 订阅级别嵌套部署的 Azure ARM 模板资源 ID 问题 - Azure ARM template resourceId problem with nested deployments on subscription level Azure 集成帐户(地图 - XSLT)- 使用逻辑应用程序将 2 个不同的 XML 合并到单个 xml - Azure integration account (Maps - XSLT) - Merge 2 different XMLs into single xml with Logic Apps 无法将特定的自定义域添加到Azure网站(我正在其他人工作) - Unable to add specific custom domain to Azure Website (I have others working) Azure:我可以使用源代码管理集成吗? - Azure: Will I be able to use source control integration?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM