Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/376.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 在groovy中根据一定的规则计算数量_Java_Groovy_Sap Cloud Platform - Fatal编程技术网

Java 在groovy中根据一定的规则计算数量

Java 在groovy中根据一定的规则计算数量,java,groovy,sap-cloud-platform,Java,Groovy,Sap Cloud Platform,我需要根据以下某些规则计算数量:- 如果(70,71)中的“/List/Data/file/List3/Disc/Account/AccountId/Id” 选择“/List/Data/file/List3/LineId/HeadId”的第一个匹配项,将其除以 “/List/Data/file/List3/Disc/Account/AccountId/Id”和(70,71) 输入XML:- <?xml version="1.0" encoding="UTF-8

我需要根据以下某些规则计算数量:-

如果(70,71)中的“/List/Data/file/List3/Disc/Account/AccountId/Id”

选择“/List/Data/file/List3/LineId/HeadId”的第一个匹配项,将其除以 “/List/Data/file/List3/Disc/Account/AccountId/Id”和(70,71)

输入XML:-

<?xml version="1.0" encoding="UTF-8"?>
<List xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <Area>
        <Sender>
            <LogicalId>TRYUJ</LogicalId>
            <ComponentId>094560.4566.2110352</ComponentId>
            <Confirmation>0</Confirmation>
        </Sender>
        <CreationDateTime>2021-05-20T23:22:24Z</CreationDateTime>
        <ReferenceId>
            <Id>5334456</Id>
        </ReferenceId>
    </Area>
    <Data>
      <File>
        <List1 rscount="345678"/>
        <List2>
            <DispatchHead>
                <DispatchId>
                    <Id>2000220772</Id>
                </DispatchId>
                <ShipFrom>Z4</ShipFrom>
                <ShipTo>0</ShipTo>
                <DivisionGroup>ND1</DivisionGroup>
                <TransportArea>
                    <TransportId>
                        <Id>2000220772</Id>
                    </TransportId>
                </TransportArea>
            </DispatchHead>
        </List2>
        <List3>
                <PartId>
                    <Id>32145</Id>
                    <Revision/>
                    <Division>PD1</Division>
                </PartId>
                <DeliveredQuantity>122.00</DeliveredQuantity>
                <AdvicedQuantity>146.00</AdvicedQuantity>
                <LineId>
                    <HeadId>200</HeadId>
                    <Division>PD1</Division>
                    <Id>0001</Id>
                </LineId>
                <Disc>
                    <Account>
                        <AccountId>
                            <Id>70</Id>
                        </AccountId>
                        <AccountZone>99</AccountZone>
                    </Account>
                    <Quantity>24.00</Quantity>
                    <Note>DERFGHYTJ</Note>
                </Disc>
        </List3>
        <List3>
                <PartId>
                    <Id>32145</Id>
                    <Revision/>
                    <Division>PD1</Division>
                </PartId>
                <DeliveredQuantity>122.00</DeliveredQuantity>
                <AdvicedQuantity>146.00</AdvicedQuantity>
                <LineId>
                    <HeadId>200</HeadId>
                    <Division>PD1</Division>
                    <Id>0001</Id>
                </LineId>
                <Disc>
                    <Account>
                        <AccountId>
                            <Id>73</Id>
                        </AccountId>
                        <AccountZone>99</AccountZone>
                    </Account>
                    <Quantity>24.00</Quantity>
                    <Note>DERFGHYTJ</Note>
                </Disc>
        </List3>
        <List3>
                <PartId>
                    <Id>3245</Id>
                    <Revision/>
                    <Division>PD1</Division>
                </PartId>
                <DeliveredQuantity>241.00</DeliveredQuantity>
                <AdvicedQuantity>250.00</AdvicedQuantity>
                <LineId>
                    <HeadId>600</HeadId>
                    <Division>PD1</Division>
                    <Id>0002</Id>
                </LineId>
                <Disc>
                    <Account>
                        <AccountId>
                            <Id>71</Id>
                        </AccountId>
                        <AccountZone>99</AccountZone>
                    </Account>
                    <Quantity>9.00</Quantity>
                </Disc>
        </List3>
      </Dispatch>
    </Data>
</List> 

特鲁伊
094560.4566.2110352
0
2021-05-20T23:22:24Z
5334456
2000220772
Z4
0
ND1
2000220772
32145
PD1
122
146
200
PD1
0001
70
99
24
德夫格希特
32145
PD1
122
146
200
PD1
0001
73
99
24
德夫格希特
3245
PD1
241
250
600
PD1
0002
71
99
9
我需要使用这个数量来填充目标xml中的元素。
我该怎么做,有什么建议吗?

请添加您尝试过的代码以及失败的原因(例如错误、堆栈跟踪、日志等),以便我们改进。