25'ten fazla konu seçemezsiniz Konular bir harf veya rakamla başlamalı, kısa çizgiler ('-') içerebilir ve en fazla 35 karakter uzunluğunda olabilir.

TM.Bosman.IFCSUM_to_TM.Shared.Order.xsl 41KB

1 hafta önce
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005
  1. <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
  2. xmlns:ScriptNS0="http://schemas.microsoft.com/BizTalk/2003/ScriptNS0"
  3. xmlns:ScriptNS1="http://schemas.microsoft.com/BizTalk/2003/ScriptNS1"
  4. xmlns:Biztalk="TM.Shared.Components.Biztalk"
  5. xmlns:DateTime="TM.Shared.Components.DateTime"
  6. xmlns:KeyList="TM.Shared.Components.KeyList"
  7. xmlns:SSO="TM.Shared.Components.SSO"
  8. xmlns:String="TM.Shared.Components.String"
  9. xmlns:Bosman="TM.Bosman.Components.MSsql"
  10. xmlns:Log="TM.Bosman.Components.Logging"
  11. xmlns:s0="http://schemas.microsoft.com/BizTalk/EDI/EDIFACT/2006"
  12. xmlns:ns0="http://TM.KLG.com/KLG/Order"
  13. exclude-result-prefixes="s0 ns0 ScriptNS0 ScriptNS1 DateTime KeyList SSO String Bosman Log">
  14. <xsl:output omit-xml-declaration="yes" method="xml" version="1.0" indent="yes" />
  15. <!-- Region global variable initialization -->
  16. <xsl:variable name="guid1">
  17. <xsl:value-of select="KeyList:NewGuid()"/>
  18. </xsl:variable>
  19. <xsl:variable name="guid2">
  20. <xsl:value-of select="KeyList:NewGuid()"/>
  21. </xsl:variable>
  22. <xsl:variable name="BosmanReference" select="/s0:EFACT_D96A_IFCSUM_BOSMAN/s0:BGM/BGM02" />
  23. <xsl:variable name="sender">BOSMASHEER01</xsl:variable>
  24. <!-- region receiver -->
  25. <xsl:variable name="receiver">
  26. <xsl:choose>
  27. <xsl:when test="count(//s0:CNILoop1/s0:NADLoop2[s0:NAD_3/NAD01 = 'DP']) &gt; 0">
  28. <xsl:choose>
  29. <xsl:when test="//s0:CNILoop1/s0:NADLoop2[s0:NAD_3/NAD01 = 'DP']/s0:NAD_3//NAD09 = 'FR'">KLGEUEERSE01</xsl:when>
  30. <xsl:otherwise>KLGEUVENLO01</xsl:otherwise>
  31. </xsl:choose>
  32. </xsl:when>
  33. <xsl:otherwise>
  34. <xsl:choose>
  35. <xsl:when test="//s0:CNILoop1/s0:NADLoop2[s0:NAD_3/NAD01 = 'CN']/s0:NAD_3//NAD09 = 'FR'">KLGEUEERSE01</xsl:when>
  36. <xsl:otherwise>KLGEUVENLO01</xsl:otherwise>
  37. </xsl:choose>
  38. </xsl:otherwise>
  39. </xsl:choose>
  40. </xsl:variable>
  41. <!-- end region -->
  42. <!-- region connectionString -->
  43. <xsl:variable name="connectionString" select="SSO:GetValue('TM.Bosman', 'ESBLookupConnectionString2016')"/>
  44. <!-- end region -->
  45. <!-- region consolidationReference -->
  46. <xsl:variable name="consolidationReference" select="/s0:EFACT_D96A_IFCSUM_BOSMAN/s0:RFFLoop1[s0:RFF/s0:C506/C50601 = 'PG']/s0:RFF/s0:C506/C50602" />
  47. <!-- end region -->
  48. <!-- region constants -->
  49. <xsl:variable name="lowerCase" select="'abcdefghijklmnopqrstuvwxyz'" />
  50. <xsl:variable name="upperCase" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ'" />
  51. <!-- end region -->
  52. <!-- region kGoods -->
  53. <!-- Voor Venlo moeten goederenregels gesplitst worden op de combinatie van packing en Deliveryreference Voor Eersel alleen op packing -->
  54. <xsl:key name="kGoodsVenlo" match="s0:GIDLoop1" use="concat(generate-id(..), '|', s0:GID/s0:C213/C21302, '|', s0:PCILoop1/s0:PCI/s0:C210/C21001)" />
  55. <xsl:key name="kGoodsEersel" match="s0:GIDLoop1" use="concat(generate-id(..), '|', s0:GID/s0:C213/C21302, '|')" />
  56. <!-- end region -->
  57. <xsl:key name="kLabel" match="s0:GIDLoop1/s0:PCILoop1/s0:PCI/s0:C210/C21001/text()" use="." />
  58. <!-- region orderDate -->
  59. <xsl:variable name="orderDate" select="DateTime:FormatDateTime(/s0:EFACT_D96A_IFCSUM_BOSMAN/s0:RFFLoop1/s0:DTM_2/s0:C507_2[C50701 = '171']/C50702, 'yyyyMMdd', 'yyyy-MM-dd', 'TM.BOSMAN.IFCSUM_to_TM.Shared.Order: orderDate')"/>
  60. <!-- end region -->
  61. <!-- region loadingDate loadingDateTimeFrom loadingDateTimeTo -->
  62. <xsl:variable name="loadingDate189">
  63. <xsl:choose>
  64. <xsl:when test="/s0:EFACT_D96A_IFCSUM_BOSMAN/s0:TDTLoop1/s0:DTM_5/s0:C507_5[C50701 = '189']/C50702 and '0001-01-01' != DateTime:FormatDateTime(/s0:EFACT_D96A_IFCSUM_BOSMAN/s0:TDTLoop1/s0:DTM_5/s0:C507_5[C50701 = '189']/C50702, 'yyyyMMdd', 'yyyy-MM-dd', 'TM.BOSMAN.IFCSUM_to_TM.Shared.Order: loadingDate189 TEST')">
  65. <xsl:value-of select="DateTime:FormatDateTime(/s0:EFACT_D96A_IFCSUM_BOSMAN/s0:TDTLoop1/s0:DTM_5/s0:C507_5[C50701 = '189']/C50702, 'yyyyMMdd', 'yyyy-MM-dd', 'TM.BOSMAN.IFCSUM_to_TM.Shared.Order: loadingDate189')" />
  66. </xsl:when>
  67. <xsl:otherwise>
  68. <xsl:value-of select="DateTime:GetWorkday($orderDate, 0, 'NL')"/>
  69. </xsl:otherwise>
  70. </xsl:choose>
  71. </xsl:variable>
  72. <xsl:variable name="loadingDate189TimeFrom">
  73. <xsl:choose>
  74. <xsl:when test="$receiver = 'KLGEUEERSE01'">
  75. <xsl:value-of select="$loadingDate189" />
  76. </xsl:when>
  77. <xsl:when test="$receiver = 'KLGEUVENLO01'">
  78. <xsl:value-of select="concat($loadingDate189, 'T08:00:00')" />
  79. </xsl:when>
  80. </xsl:choose>
  81. </xsl:variable>
  82. <xsl:variable name="loadingDate189TimeTo">
  83. <xsl:choose>
  84. <xsl:when test="$receiver = 'KLGEUEERSE01'">
  85. <xsl:value-of select="$loadingDate189" />
  86. </xsl:when>
  87. <xsl:when test="$receiver = 'KLGEUVENLO01'">
  88. <xsl:value-of select="concat($loadingDate189, 'T16:00:00')" />
  89. </xsl:when>
  90. </xsl:choose>
  91. </xsl:variable>
  92. <!-- end region -->
  93. <!-- end region -->
  94. <!-- region templates -->
  95. <xsl:template match="/">
  96. <xsl:apply-templates select="/s0:EFACT_D96A_IFCSUM_BOSMAN" />
  97. </xsl:template>
  98. <xsl:template match="/s0:EFACT_D96A_IFCSUM_BOSMAN">
  99. <ns0:Order>
  100. <xsl:variable name="bosmanRoutine">
  101. <xsl:for-each select="s0:CNILoop1">
  102. <!-- Count Shipments: Collection to Delivery country -->
  103. <xsl:variable name="from" select="s0:NADLoop2[s0:NAD_3/NAD01 = 'CZ']/s0:NAD_3/NAD09"/>
  104. <xsl:variable name="to">
  105. <xsl:choose>
  106. <xsl:when test="count(s0:NADLoop2[s0:NAD_3/NAD01 = 'DP']) &gt; 0">
  107. <xsl:value-of select="s0:NADLoop2[s0:NAD_3/NAD01 = 'DP']/s0:NAD_3//NAD09"/>
  108. </xsl:when>
  109. <xsl:otherwise>
  110. <xsl:value-of select="s0:NADLoop2[s0:NAD_3/NAD01 = 'CN']/s0:NAD_3//NAD09"/>
  111. </xsl:otherwise>
  112. </xsl:choose>
  113. </xsl:variable>
  114. <xsl:variable name="counter1" select="concat($from, ' to ', $to)"/>
  115. <xsl:value-of select="KeyList:AddToCounter($guid1, $counter1)"/>
  116. <xsl:variable name="referenceCheck">
  117. <xsl:for-each select="s0:NADLoop2/s0:NAD_3[NAD01='CZ']">
  118. <xsl:if test="not(normalize-space(../s0:RFFLoop4/s0:RFF_5/s0:C506_5[C50601='CU']/C50602)='')">
  119. <xsl:value-of select="../s0:RFFLoop4/s0:RFF_5/s0:C506_5[C50601='CU']/C50602"/>
  120. <xsl:text> / </xsl:text>
  121. </xsl:if>
  122. </xsl:for-each>
  123. <xsl:value-of select="s0:CNI/s0:C503_3/C50301"/>
  124. </xsl:variable>
  125. <xsl:variable name="checkResult">
  126. <xsl:value-of select="Bosman:CheckReference($referenceCheck)"/>
  127. </xsl:variable>
  128. <xsl:value-of select="KeyList:AddToCounter($guid2, $checkResult)"/>
  129. </xsl:for-each>
  130. </xsl:variable>
  131. <xsl:variable name="orderReference" select="concat('Bosman shipment(s): ', KeyList:ListCountersAsString($guid1), '(', KeyList:ListCountersAsString($guid2), ')')"/>
  132. <Sender>
  133. <xsl:value-of select="$sender" />
  134. </Sender>
  135. <Receiver>
  136. <xsl:value-of select="$receiver" />
  137. </Receiver>
  138. <GroupName>ORCHESTRATION</GroupName>
  139. <Consolidation>
  140. <xsl:choose>
  141. <xsl:when test="$receiver = 'KLGEUEERSE01'">YES</xsl:when>
  142. <xsl:otherwise>NO</xsl:otherwise>
  143. </xsl:choose>
  144. </Consolidation>
  145. <Reference>
  146. <xsl:value-of select="$orderReference"/>
  147. </Reference>
  148. <TimeStamp>
  149. <xsl:value-of select="DateTime:GetCurrentDateTime()" />
  150. </TimeStamp>
  151. <Status>NEW</Status>
  152. <Date>
  153. <xsl:value-of select="$orderDate" />
  154. </Date>
  155. <xsl:apply-templates select="./s0:CNILoop1" />
  156. </ns0:Order>
  157. </xsl:template>
  158. <xsl:template match="s0:CNILoop1">
  159. <Shipment>
  160. <!-- region loadingDate loadingDateTimeFrom loadingDateTimeTo -->
  161. <xsl:variable name="loadingDate200">
  162. <xsl:choose>
  163. <xsl:when test="s0:DTM_7/s0:C507_7[C50701 = '200']/C50702 and '0001-01-01' != DateTime:FormatDateTime(substring(s0:DTM_7/s0:C507_7[C50701 = '200']/C50702, 1, 8), 'yyyyMMdd', 'yyyy-MM-dd', 'TM.BOSMAN.IFCSUM_to_TM.Shared.Order: loadingDate200 TEST')">
  164. <xsl:value-of select="DateTime:FormatDateTime(substring(s0:DTM_7/s0:C507_7[C50701 = '200']/C50702, 1, 8), 'yyyyMMdd', 'yyyy-MM-dd', 'TM.BOSMAN.IFCSUM_to_TM.Shared.Order: loadingDate200')" />
  165. </xsl:when>
  166. <xsl:otherwise>
  167. <xsl:value-of select="DateTime:GetWorkday($orderDate, 0, 'NL')"/>
  168. </xsl:otherwise>
  169. </xsl:choose>
  170. </xsl:variable>
  171. <xsl:variable name="loadingDate200TimeFrom">
  172. <xsl:choose>
  173. <xsl:when test="$receiver = 'KLGEUEERSE01'">
  174. <xsl:value-of select="$loadingDate200" />
  175. </xsl:when>
  176. <xsl:when test="$receiver = 'KLGEUVENLO01'">
  177. <xsl:value-of select="concat($loadingDate200, 'T08:00:00')" />
  178. </xsl:when>
  179. </xsl:choose>
  180. </xsl:variable>
  181. <xsl:variable name="loadingDate200TimeTo">
  182. <xsl:choose>
  183. <xsl:when test="$receiver = 'KLGEUEERSE01'">
  184. <xsl:value-of select="$loadingDate200" />
  185. </xsl:when>
  186. <xsl:when test="$receiver = 'KLGEUVENLO01'">
  187. <xsl:value-of select="concat($loadingDate200, 'T16:00:00')" />
  188. </xsl:when>
  189. </xsl:choose>
  190. </xsl:variable>
  191. <!-- end region -->
  192. <!--<debug>
  193. <xpath>
  194. <xsl:value-of select="substring(s0:DTM_7/s0:C507_7[C50701 = '200']/C50702, 1, 8)"/>
  195. </xpath>
  196. <loadingDate200>
  197. <xsl:value-of select="$loadingDate200"/>
  198. </loadingDate200>
  199. </debug>-->
  200. <xsl:variable name="ftl">
  201. <xsl:choose>
  202. <xsl:when test="number(./s0:CNT_2/s0:C270_2[C27001 = '34']/C27002) = 13.6">true</xsl:when>
  203. <xsl:otherwise>false</xsl:otherwise>
  204. </xsl:choose>
  205. </xsl:variable>
  206. <!-- region collectionReference -->
  207. <xsl:variable name="collectionReference">
  208. <xsl:for-each select="s0:NADLoop2/s0:NAD_3[NAD01 = 'PW']">
  209. <xsl:if test="not (normalize-space(../s0:RFFLoop4/s0:RFF_5/s0:C506_5[C50601 = 'AAK']/C50602) = '')">
  210. <xsl:value-of select="../s0:RFFLoop4/s0:RFF_5/s0:C506_5[C50601 = 'AAK']/C50602"/>
  211. </xsl:if>
  212. </xsl:for-each>
  213. <xsl:text>|</xsl:text>
  214. <xsl:for-each select="s0:NADLoop2/s0:NAD_3[NAD01 = 'CZ']">
  215. <xsl:if test="not (normalize-space(../s0:RFFLoop4/s0:RFF_5/s0:C506_5[C50601 = 'CU']/C50602) = '')">
  216. <xsl:value-of select="../s0:RFFLoop4/s0:RFF_5/s0:C506_5[C50601 = 'CU']/C50602"/>
  217. </xsl:if>
  218. </xsl:for-each>
  219. </xsl:variable>
  220. <!-- end region -->
  221. <xsl:variable name="poReferences">
  222. <xsl:for-each select="s0:FTX_5[FTX01 = 'DEL']/s0:C108_5">
  223. <xsl:if test="starts-with(C10801, 'PO:')">
  224. <xsl:if test="position() > 1">
  225. <xsl:text> | </xsl:text> <!-- Add a separator for multiple values -->
  226. </xsl:if>
  227. <xsl:value-of select="substring-after(C10801, 'PO: ')"/>
  228. </xsl:if>
  229. </xsl:for-each>
  230. </xsl:variable>
  231. <!-- region deliveryReference-->
  232. <xsl:variable name="deliveryReference">
  233. <xsl:choose>
  234. <xsl:when test="not (normalize-space(s0:NADLoop2[s0:NAD_3/NAD01 = 'DP']/s0:RFFLoop4/s0:RFF_5/s0:C506_5[C50601 = 'AAJ']/C50602) = '')">
  235. <xsl:for-each select="s0:NADLoop2/s0:NAD_3[NAD01 = 'DP']">
  236. <xsl:if test="not (normalize-space(../s0:RFFLoop4/s0:RFF_5/s0:C506_5[C50601 = 'AAJ']/C50602) = '')">
  237. <xsl:value-of select="concat(../s0:RFFLoop4/s0:RFF_5/s0:C506_5[C50601 = 'AAJ']/C50602, $poReferences)"/>
  238. </xsl:if>
  239. </xsl:for-each>
  240. </xsl:when>
  241. <xsl:otherwise>
  242. <xsl:for-each select="s0:NADLoop2/s0:NAD_3[NAD01 = 'CN']">
  243. <xsl:if test="not (normalize-space(../s0:RFFLoop4/s0:RFF_5/s0:C506_5[C50601 = 'AAO']/C50602) = '')">
  244. <!--<xsl:value-of select="../s0:RFFLoop4/s0:RFF_5/s0:C506_5[C50601 = 'AAO']/C50602"/>-->
  245. <xsl:value-of select="concat(../s0:RFFLoop4/s0:RFF_5/s0:C506_5[C50601 = 'AAO']/C50602, $poReferences)"/>
  246. </xsl:if>
  247. </xsl:for-each>
  248. </xsl:otherwise>
  249. </xsl:choose>
  250. </xsl:variable>
  251. <!-- end region -->
  252. <!-- region deliveryDate deliveryDateTimeFrom deliveryDateTimeTo AND Check CNILoop for existence of a usable DTM_7 segment -->
  253. <xsl:variable name="deliveryDate">
  254. <xsl:choose>
  255. <xsl:when test="./s0:DTM_7/s0:C507_7[C50701='2']">
  256. <xsl:choose>
  257. <xsl:when test="./s0:DTM_7/s0:C507_7[C50701='2']/C50703='102'">
  258. <xsl:value-of select="DateTime:FormatDateTime(./s0:DTM_7/s0:C507_7[C50701='2']/C50702, 'yyyyMMdd', 'yyyy-MM-dd', 'TM.BOSMAN.IFCSUM_to_TM.Shared.Order: deliveryDate::2:102')"/>
  259. </xsl:when>
  260. <xsl:when test="./s0:DTM_7/s0:C507_7[C50701='2']/C50703='203'">
  261. <xsl:value-of select="DateTime:FormatDateTime(./s0:DTM_7/s0:C507_7[C50701='2']/C50702, 'yyyyMMddHHmm', 'yyyy-MM-dd', 'TM.BOSMAN.IFCSUM_to_TM.Shared.Order: deliveryDate::2:203')"/>
  262. </xsl:when>
  263. <xsl:otherwise>
  264. <xsl:value-of select="DateTime:FormatDateTime(./s0:DTM_7/s0:C507_7[C50701='2']/C50702, 'yyyyMMdd', 'yyyy-MM-dd', 'TM.BOSMAN.IFCSUM_to_TM.Shared.Order: deliveryDate::2')"/>
  265. </xsl:otherwise>
  266. </xsl:choose>
  267. </xsl:when>
  268. <xsl:when test="./s0:DTM_7/s0:C507_7[C50701='64']">
  269. <xsl:choose>
  270. <xsl:when test="./s0:DTM_7/s0:C507_7[C50701='64']/C50703='102'">
  271. <xsl:value-of select="DateTime:FormatDateTime(./s0:DTM_7/s0:C507_7[C50701='64']/C50702, 'yyyyMMdd', 'yyyy-MM-dd', 'TM.BOSMAN.IFCSUM_to_TM.Shared.Order: deliveryDate::64:102')"/>
  272. </xsl:when>
  273. <xsl:when test="./s0:DTM_7/s0:C507_7[C50701='64']/C50703='203'">
  274. <xsl:value-of select="DateTime:FormatDateTime(./s0:DTM_7/s0:C507_7[C50701='64']/C50702, 'yyyyMMddHHmm', 'yyyy-MM-dd', 'TM.BOSMAN.IFCSUM_to_TM.Shared.Order: deliveryDate::64:203')"/>
  275. </xsl:when>
  276. <xsl:otherwise>
  277. <xsl:value-of select="DateTime:FormatDateTime(./s0:DTM_7/s0:C507_7[C50701='64']/C50702, 'yyyyMMdd', 'yyyy-MM-dd', 'TM.BOSMAN.IFCSUM_to_TM.Shared.Order: deliveryDate::64')"/>
  278. </xsl:otherwise>
  279. </xsl:choose>
  280. </xsl:when>
  281. <xsl:otherwise>
  282. <xsl:value-of select="Biztalk:SendErrorMessage('TM.Bosman.IFCSUM_to_TM.Shared.Order', concat('CNILoop ', ./s0:CNI/CNI01, ' is missing either a DTM_7 segment completely OR a DTM_7 segment with either a C50701=2 or C50701=64'), 'the DTM_7 segment needs to be present and needs to contain either a C50701=2 or C50701=64 segment', concat('Retrieve the original Bosman message with reference: ', $BosmanReference, ' and e-mail it to Bosman with explanation to update the message and resend it'))"/>
  283. </xsl:otherwise>
  284. </xsl:choose>
  285. </xsl:variable>
  286. <xsl:variable name="deliveryDateTimeFrom">
  287. <xsl:choose>
  288. <xsl:when test="$receiver = 'KLGEUEERSE01'">
  289. <xsl:value-of select="concat($deliveryDate, 'T00:00:00')" />
  290. </xsl:when>
  291. <xsl:when test="$receiver = 'KLGEUVENLO01'">
  292. <xsl:value-of select="concat($deliveryDate, 'T08:00:00')" />
  293. </xsl:when>
  294. </xsl:choose>
  295. </xsl:variable>
  296. <xsl:variable name="deliveryDateTimeTo">
  297. <xsl:choose>
  298. <xsl:when test="$receiver = 'KLGEUEERSE01'">
  299. <xsl:value-of select="concat($deliveryDate, 'T00:00:00')" />
  300. <!--<xsl:value-of select="concat($deliveryDate, 'T23:59:59')" />-->
  301. </xsl:when>
  302. <xsl:when test="$receiver = 'KLGEUVENLO01'">
  303. <xsl:value-of select="concat($deliveryDate, 'T16:00:00')" />
  304. </xsl:when>
  305. </xsl:choose>
  306. </xsl:variable>
  307. <!-- end region-->
  308. <Consignor>
  309. <xsl:value-of select="$sender" />
  310. </Consignor>
  311. <ConsignorReference>
  312. <xsl:if test="$receiver = 'KLGEUVENLO01'">
  313. <xsl:for-each select="s0:NADLoop2/s0:NAD_3[NAD01='CZ']">
  314. <xsl:if test="not(normalize-space(../s0:RFFLoop4/s0:RFF_5/s0:C506_5[C50601='CU']/C50602)='')">
  315. <xsl:value-of select="../s0:RFFLoop4/s0:RFF_5/s0:C506_5[C50601='CU']/C50602"/>
  316. <xsl:text> / </xsl:text>
  317. </xsl:if>
  318. </xsl:for-each>
  319. </xsl:if>
  320. <xsl:value-of select="s0:CNI/s0:C503_3/C50301"/>
  321. </ConsignorReference>
  322. <Debtor>
  323. <xsl:value-of select="$sender" />
  324. </Debtor>
  325. <DebtorReference>
  326. <xsl:if test="$receiver = 'KLGEUVENLO01'">
  327. <xsl:for-each select="s0:NADLoop2/s0:NAD_3[NAD01='CZ']">
  328. <xsl:if test="not(normalize-space(../s0:RFFLoop4/s0:RFF_5/s0:C506_5[C50601='CU']/C50602)='')">
  329. <xsl:value-of select="../s0:RFFLoop4/s0:RFF_5/s0:C506_5[C50601='CU']/C50602"/>
  330. <xsl:text> / </xsl:text>
  331. </xsl:if>
  332. </xsl:for-each>
  333. </xsl:if>
  334. <xsl:value-of select="s0:CNI/s0:C503_3/C50301"/>
  335. </DebtorReference>
  336. <Incoterm>
  337. <xsl:value-of select="s0:TODLoop1/s0:TOD[TOD01 = '6']/s0:C100/C10001"/>
  338. </Incoterm>
  339. <IncotermCity>
  340. <!-- Zonder bij behorende landcode geeft city in Ixolution een probleem -->
  341. <!--<xsl:value-of select="s0:TODLoop1/s0:LOC_7[LOC01 = '1']/s0:C517_7/C51704/text()"/>-->
  342. </IncotermCity>
  343. <IncotermCountryCode />
  344. <Parametergroup>
  345. <Groupname/>
  346. <Parameter>
  347. <!-- TIJDELIJKE OPLOSSING! Uiteindelijk moeten IxSuite business rules de juiste waarde bepalen! -->
  348. <!-- NB In de mapping naar StandardBusinessDocumen wordt scenario alleen voor Venlo ingevuld. -->
  349. <Qualifier>Scenario</Qualifier>
  350. <Value>21</Value>
  351. </Parameter>
  352. </Parametergroup>
  353. <!-- region SF Address & ContactPerson -->
  354. <Address>
  355. <xsl:variable name="PCI_identification">
  356. <xsl:choose>
  357. <xsl:when test="$receiver = 'KLGEUVENLO01'">
  358. <!--unieke labels per shipment">-->
  359. <xsl:for-each select="s0:GIDLoop1/s0:PCILoop1/s0:PCI/s0:C210/C21001/text()[generate-id()
  360. = generate-id(key('kLabel',.)[1])]">
  361. <xsl:sort select ="." data-type="text"/>
  362. <xsl:choose>
  363. <xsl:when test="position() = last()">
  364. <xsl:value-of select ="."></xsl:value-of>
  365. </xsl:when>
  366. <xsl:otherwise>
  367. <xsl:value-of select ="concat(., ', ')"></xsl:value-of>
  368. </xsl:otherwise>
  369. </xsl:choose>
  370. </xsl:for-each>
  371. </xsl:when>
  372. <xsl:otherwise>
  373. <xsl:text></xsl:text>
  374. </xsl:otherwise>
  375. </xsl:choose>
  376. </xsl:variable>
  377. <xsl:choose>
  378. <xsl:when test="count(s0:NADLoop2[s0:NAD_3/NAD01 = 'PW']) &gt; 0">
  379. <xsl:for-each select="s0:NADLoop2[s0:NAD_3/NAD01 = 'PW']">
  380. <xsl:call-template name="NADtoSF">
  381. <xsl:with-param name="loadingDate200TimeFrom" select="$loadingDate200TimeFrom" />
  382. <xsl:with-param name="loadingDate200TimeTo" select="$loadingDate200TimeTo"/>
  383. <xsl:with-param name="collectionReference" select="$collectionReference"/>
  384. <xsl:with-param name="internalRemark1" select="$PCI_identification"/>
  385. </xsl:call-template>
  386. </xsl:for-each>
  387. </xsl:when>
  388. <xsl:otherwise>
  389. <xsl:for-each select="s0:NADLoop2[s0:NAD_3/NAD01 = 'CZ']">
  390. <xsl:call-template name="NADtoSF">
  391. <xsl:with-param name="loadingDate200TimeFrom" select="$loadingDate200TimeFrom" />
  392. <xsl:with-param name="loadingDate200TimeTo" select="$loadingDate200TimeTo"/>
  393. <xsl:with-param name="collectionReference" select="$collectionReference"/>
  394. <xsl:with-param name="internalRemark1" select="$PCI_identification"/>
  395. </xsl:call-template>
  396. </xsl:for-each>
  397. </xsl:otherwise>
  398. </xsl:choose>
  399. </Address>
  400. <!-- end region-->
  401. <!-- region ST Address & ContactPerson -->
  402. <Address>
  403. <xsl:choose>
  404. <xsl:when test="count(s0:NADLoop2[s0:NAD_3/NAD01 = 'DP']) &gt; 0">
  405. <xsl:for-each select="s0:NADLoop2[s0:NAD_3/NAD01 = 'DP']">
  406. <xsl:call-template name="NADtoST">
  407. <xsl:with-param name="deliveryDateTimeFrom" select="$deliveryDateTimeFrom" />
  408. <xsl:with-param name="deliveryDateTimeTo" select="$deliveryDateTimeTo"/>
  409. <xsl:with-param name="deliveryReference" select="$deliveryReference"/>
  410. <xsl:with-param name="NAD01" select="'DP'"/>
  411. </xsl:call-template>
  412. </xsl:for-each>
  413. </xsl:when>
  414. <xsl:otherwise>
  415. <xsl:for-each select="s0:NADLoop2[s0:NAD_3/NAD01 = 'CN']">
  416. <xsl:call-template name="NADtoST">
  417. <xsl:with-param name="deliveryDateTimeFrom" select="$deliveryDateTimeFrom" />
  418. <xsl:with-param name="deliveryDateTimeTo" select="$deliveryDateTimeTo"/>
  419. <xsl:with-param name="deliveryReference" select="$deliveryReference"/>
  420. <xsl:with-param name="NAD01" select="'CN'"/>
  421. </xsl:call-template>
  422. </xsl:for-each>
  423. </xsl:otherwise>
  424. </xsl:choose>
  425. <xsl:value-of select="../s0:GIDLoop1[1]/s0:PCILoop1/s0:PCI/s0:C210/C21001"/>
  426. <xsl:if test="$receiver = 'KLGEUVENLO01'">
  427. <xsl:call-template name="Feature">
  428. <xsl:with-param name="featureCode" select = "'DATE_FIXED'" />
  429. <xsl:with-param name="additionalValue" select = "''" />
  430. <!-- $deliveryDate -->
  431. </xsl:call-template>
  432. </xsl:if>
  433. </Address>
  434. <!-- end region-->
  435. <!-- region Good and DengerousGood -->
  436. <!-- Voor Venlo moeten goederenregels gesplitst worden op de combinatie van packing en Deliveryreference Voor Eersel alleen op packing -->
  437. <xsl:choose>
  438. <xsl:when test="$receiver = 'KLGEUEERSE01'">
  439. <xsl:for-each select="s0:GIDLoop1[generate-id() = generate-id(key('kGoodsEersel', concat(generate-id(..), '|', s0:GID/s0:C213/C21302, '|'))[1])]">
  440. <!-- de EERSTE GIDLoop1 met PackingType als key -->
  441. <xsl:call-template name="Good">
  442. <xsl:with-param name="ftl" select="$ftl"/>
  443. <xsl:with-param name="key" select="'kGoodsEersel'"/>
  444. <xsl:with-param name="keyDeliveryRef" select="''"/>
  445. </xsl:call-template>
  446. </xsl:for-each>
  447. </xsl:when>
  448. <xsl:when test="$receiver = 'KLGEUVENLO01'">
  449. <xsl:for-each select="s0:GIDLoop1[generate-id() = generate-id(key('kGoodsVenlo', concat(generate-id(..), '|', s0:GID/s0:C213/C21302, '|', s0:PCILoop1/s0:PCI/s0:C210/C21001 ))[1])]">
  450. <!-- de EERSTE GIDLoop1 met PackingType en Deliveryreference als key -->
  451. <xsl:call-template name="Good">
  452. <xsl:with-param name="ftl" select="$ftl"/>
  453. <xsl:with-param name="key" select="'kGoodsVenlo'"/>
  454. <xsl:with-param name="keyDeliveryRef" select="s0:PCILoop1/s0:PCI/s0:C210/C21001"/>
  455. </xsl:call-template>
  456. </xsl:for-each>
  457. </xsl:when>
  458. </xsl:choose>
  459. <!-- end region -->
  460. </Shipment>
  461. </xsl:template>
  462. <xsl:template name="NADtoSF">
  463. <xsl:param name="loadingDate200TimeFrom"/>
  464. <xsl:param name="loadingDate200TimeTo"/>
  465. <xsl:param name="collectionReference"/>
  466. <xsl:param name="internalRemark1"/>
  467. <xsl:for-each select="s0:NAD_3">
  468. <xsl:variable name="Remarks">
  469. <xsl:for-each select="../../s0:FTX_5[FTX01 = 'AAI']/s0:C108_5">
  470. <xsl:if test="not(contains(C10801, 'AFLEVERDATUM'))">
  471. <xsl:if test="not(contains(C10801, 'GE-UPDATED'))">
  472. <xsl:value-of select="C10801"/>
  473. <xsl:text>, </xsl:text>
  474. </xsl:if>
  475. </xsl:if>
  476. </xsl:for-each>
  477. </xsl:variable>
  478. <xsl:call-template name="Address">
  479. <xsl:with-param name="addressType" select = "'SF'" />
  480. <xsl:with-param name="name1" select = "s0:C080_3[1]/C08001" />
  481. <xsl:with-param name="name2" select = "s0:C080_3[2]/C08001" />
  482. <xsl:with-param name="address1" select = "s0:C059_3[1]/C05901" />
  483. <xsl:with-param name="address2" select = "s0:C059_3[2]/C05901" />
  484. <xsl:with-param name="postalCode" select = "NAD08" />
  485. <xsl:with-param name="city" select = "NAD06" />
  486. <xsl:with-param name="region" select = "NAD07" />
  487. <xsl:with-param name="countryCode" select = "NAD09" />
  488. <xsl:with-param name="start" select = "$loadingDate200TimeFrom" />
  489. <xsl:with-param name="end" select = "$loadingDate200TimeTo" />
  490. <xsl:with-param name="reference" select = "$collectionReference" />
  491. <xsl:with-param name="externalRemark1" select = "$Remarks" />
  492. <xsl:with-param name="externalRemark2" select = "''" />
  493. <xsl:with-param name="internalRemark1" select = "$internalRemark1" />
  494. <xsl:with-param name="internalRemark2" select = "$Remarks" />
  495. </xsl:call-template>
  496. <xsl:for-each select="../s0:CTALoop3[s0:CTA_4/CTA01 = 'IC']">
  497. <xsl:call-template name="ContactPerson">
  498. <xsl:with-param name="name" select = "s0:CTA_4/s0:C056_4/C05602" />
  499. <xsl:with-param name="phone" select = "s0:COM_4/s0:C076_4[C07602 = 'TE']/C07601" />
  500. <xsl:with-param name="fax" select = "s0:COM_4/s0:C076_4[C07602 = 'FA']/C07601" />
  501. <xsl:with-param name="email" select = "s0:COM_4/s0:C076_4[C07602 = 'EM']/C07601" />
  502. </xsl:call-template>
  503. </xsl:for-each>
  504. </xsl:for-each>
  505. </xsl:template>
  506. <xsl:template name="NAD_ST_CN">
  507. <xsl:for-each select="../../s0:NADLoop2[s0:NAD_3/NAD01 = 'CN']/s0:NAD_3">
  508. <xsl:text>CONSIGNEE: </xsl:text>
  509. <xsl:value-of select="s0:C080_3[1]/C08001"/>
  510. <xsl:text> - </xsl:text>
  511. <xsl:value-of select="NAD06"/>
  512. <xsl:text>, </xsl:text>
  513. </xsl:for-each>
  514. </xsl:template>
  515. <xsl:template name="NADtoST">
  516. <xsl:param name="deliveryDateTimeFrom" />
  517. <xsl:param name="deliveryDateTimeTo" />
  518. <xsl:param name="deliveryReference" />
  519. <xsl:param name="NAD01" />
  520. <xsl:for-each select="s0:NAD_3">
  521. <xsl:variable name="Remarks">
  522. <xsl:if test="$NAD01 = 'DP'">
  523. <xsl:call-template name="NAD_ST_CN"/>
  524. </xsl:if>
  525. <xsl:for-each select="../../s0:FTX_5[FTX01 = 'DEL']/s0:C108_5">
  526. <xsl:value-of select="C10801"/>
  527. <xsl:text>, </xsl:text>
  528. </xsl:for-each>
  529. </xsl:variable>
  530. <xsl:variable name="countryCode">
  531. <xsl:choose>
  532. <xsl:when test="translate(substring(NAD08, 1, 2), $lowerCase, $upperCase) = 'BT'">IE</xsl:when>
  533. <xsl:otherwise>
  534. <xsl:value-of select="NAD09"/>
  535. </xsl:otherwise>
  536. </xsl:choose>
  537. </xsl:variable>
  538. <xsl:call-template name="Address">
  539. <xsl:with-param name="addressType" select = "'ST'" />
  540. <xsl:with-param name="name1" select = "s0:C080_3[1]/C08001" />
  541. <xsl:with-param name="name2" select = "s0:C080_3[2]/C08001" />
  542. <xsl:with-param name="address1" select = "s0:C059_3[1]/C05901" />
  543. <xsl:with-param name="address2" select = "s0:C059_3[2]/C05901" />
  544. <xsl:with-param name="postalCode" select = "NAD08" />
  545. <xsl:with-param name="city" select = "NAD06" />
  546. <xsl:with-param name="region" select = "NAD07" />
  547. <xsl:with-param name="countryCode" select = "$countryCode" />
  548. <xsl:with-param name="start" select = "$deliveryDateTimeFrom" />
  549. <xsl:with-param name="end" select = "$deliveryDateTimeTo" />
  550. <xsl:with-param name="reference" select = "$deliveryReference" />
  551. <xsl:with-param name="externalRemark1" select = "$Remarks" />
  552. <xsl:with-param name="externalRemark2" select = "''" />
  553. <xsl:with-param name="internalRemark1" select = "''" />
  554. <xsl:with-param name="internalRemark2" select = "''" />
  555. </xsl:call-template>
  556. <xsl:for-each select="../s0:CTALoop3[s0:CTA_4/CTA01 = 'IC']">
  557. <xsl:call-template name="ContactPerson">
  558. <xsl:with-param name="name" select = "s0:CTA_4/s0:C056_4/C05602" />
  559. <xsl:with-param name="phone" select = "s0:COM_4/s0:C076_4[C07602 = 'TE']/C07601" />
  560. <xsl:with-param name="fax" select = "s0:COM_4/s0:C076_4[C07602 = 'FA']/C07601" />
  561. <xsl:with-param name="email" select = "s0:COM_4/s0:C076_4[C07602 = 'EM']/C07601" />
  562. </xsl:call-template>
  563. </xsl:for-each>
  564. </xsl:for-each>
  565. </xsl:template>
  566. <xsl:template name="Address">
  567. <xsl:param name="addressType" />
  568. <xsl:param name="name1" />
  569. <xsl:param name="name2" />
  570. <xsl:param name="address1" />
  571. <xsl:param name="address2" />
  572. <xsl:param name="postalCode" />
  573. <xsl:param name="city" />
  574. <xsl:param name="region" />
  575. <xsl:param name="countryCode" />
  576. <xsl:param name="start" />
  577. <xsl:param name="end" />
  578. <xsl:param name="reference" />
  579. <xsl:param name="externalRemark1" />
  580. <xsl:param name="externalRemark2" />
  581. <xsl:param name="internalRemark1" />
  582. <xsl:param name="internalRemark2" />
  583. <AddressType>
  584. <xsl:value-of select="$addressType" />
  585. </AddressType>
  586. <Name1>
  587. <xsl:value-of select="$name1" />
  588. </Name1>
  589. <Name2>
  590. <xsl:value-of select="$name2" />
  591. </Name2>
  592. <Address1>
  593. <xsl:value-of select="$address1" />
  594. </Address1>
  595. <Address2>
  596. <xsl:value-of select="$address2" />
  597. </Address2>
  598. <PostalCode>
  599. <xsl:value-of select="$postalCode" />
  600. </PostalCode>
  601. <City>
  602. <xsl:value-of select="$city" />
  603. </City>
  604. <Region>
  605. <xsl:value-of select="$region" />
  606. </Region>
  607. <CountryCode>
  608. <xsl:value-of select="$countryCode" />
  609. </CountryCode>
  610. <Start>
  611. <xsl:value-of select="$start" />
  612. </Start>
  613. <End>
  614. <xsl:value-of select="$end" />
  615. </End>
  616. <Reference>
  617. <xsl:value-of select="$reference" />
  618. </Reference>
  619. <ExternalRemark1>
  620. <xsl:value-of select="$externalRemark1" />
  621. </ExternalRemark1>
  622. <ExternalRemark2>
  623. <xsl:value-of select="$externalRemark2" />
  624. </ExternalRemark2>
  625. <InternalRemark1>
  626. <xsl:value-of select="$internalRemark1" />
  627. </InternalRemark1>
  628. <InternalRemark2>
  629. <xsl:value-of select="$internalRemark2" />
  630. </InternalRemark2>
  631. </xsl:template>
  632. <xsl:template name="ContactPerson">
  633. <xsl:param name="name" />
  634. <xsl:param name="phone" />
  635. <xsl:param name="fax" />
  636. <xsl:param name="email" />
  637. <ContactPerson>
  638. <Name>
  639. <xsl:value-of select="$name" />
  640. </Name>
  641. <Phone>
  642. <xsl:value-of select="$phone" />
  643. </Phone>
  644. <Fax>
  645. <xsl:value-of select="$fax" />
  646. </Fax>
  647. <Email>
  648. <xsl:value-of select="$email" />
  649. </Email>
  650. </ContactPerson>
  651. </xsl:template>
  652. <xsl:template name="Parameter">
  653. <xsl:param name="qualifier" />
  654. <xsl:param name="value" />
  655. <xsl:param name="additionalValue" />
  656. <Parameter>
  657. <Qualifier>
  658. <xsl:value-of select="$qualifier" />
  659. </Qualifier>
  660. <Value>
  661. <xsl:value-of select="$value" />
  662. </Value>
  663. <AdditionalValue>
  664. <xsl:value-of select="$additionalValue" />
  665. </AdditionalValue>
  666. </Parameter>
  667. </xsl:template>
  668. <xsl:template name="Feature">
  669. <xsl:param name="featureCode" />
  670. <xsl:param name="additionalValue" />
  671. <Feature>
  672. <FeatureCode>
  673. <xsl:value-of select="$featureCode" />
  674. </FeatureCode>
  675. <AdditionalValue>
  676. <xsl:value-of select="$additionalValue" />
  677. </AdditionalValue>
  678. </Feature>
  679. </xsl:template>
  680. <xsl:template name="Good">
  681. <xsl:param name="ftl"/>
  682. <xsl:param name="key"/>
  683. <xsl:param name="keyDeliveryRef"/>
  684. <Good>
  685. <!--<DEBUG>
  686. <ftl>
  687. <xsl:value-of select="$ftl"/>
  688. </ftl>
  689. <key>
  690. <xsl:value-of select="$key"/>
  691. </key>
  692. <keyDelRef>
  693. <xsl:value-of select="$keyDeliveryRef"/>
  694. </keyDelRef>
  695. </DEBUG>-->
  696. <xsl:variable name="packingQty">
  697. <xsl:value-of select="sum(key($key, concat(generate-id(..), '|', s0:GID/s0:C213/C21302, '|', $keyDeliveryRef))/s0:GID/s0:C213/C21301)"/>
  698. </xsl:variable>
  699. <xsl:variable name="C21302">
  700. <xsl:value-of select="s0:GID/s0:C213/C21302" />
  701. </xsl:variable>
  702. <xsl:variable name="packingType">
  703. <xsl:value-of select="ScriptNS0:DBValueExtract(string(ScriptNS0:DBLookup(0, $C21302, $connectionString, 'TM_Bosman_Package', 'Bosman')), 'KLG')" />
  704. </xsl:variable>
  705. <xsl:call-template name="GoodsDetail">
  706. <xsl:with-param name="ftl" select="$ftl"/>
  707. <xsl:with-param name="packingQty" select="$packingQty"/>
  708. <xsl:with-param name="packingType" select="$packingType"/>
  709. <xsl:with-param name="key" select="$key"/>
  710. <xsl:with-param name="keyDeliveryRef" select="$keyDeliveryRef"/>
  711. </xsl:call-template>
  712. <!--<DEBUG>
  713. <xsl:variable name="cni" select="'1012022000334589'"/>
  714. <receiver>
  715. <xsl:value-of select="$receiver"/>
  716. </receiver>
  717. <xpath>
  718. <xsl:choose>
  719. <xsl:when test="$receiver = 'KLGEUEERSE01'">
  720. <xsl:text>/ns0:EFACT_D96A_IFCSUM_BOSMAN/ns0:CNILoop1[ns0:CNI/ns0:C503_3/C50301='</xsl:text>
  721. <xsl:value-of select="$cni"/>
  722. <xsl:text>']/ns0:GIDLoop1[ns0:GID/ns0:C213/C21302='</xsl:text>
  723. <xsl:value-of select="$C21302"/>
  724. <xsl:text>']/ns0:DGSLoop1</xsl:text>
  725. </xsl:when>
  726. <xsl:when test="$receiver = 'KLGEUVENLO01'">
  727. <xsl:text>/ns0:EFACT_D96A_IFCSUM_BOSMAN/ns0:CNILoop1[ns0:CNI/ns0:C503_3/C50301='</xsl:text>
  728. <xsl:value-of select="$cni"/>
  729. <xsl:text>']/ns0:GIDLoop1[ns0:GID/ns0:C213/C21302='</xsl:text>
  730. <xsl:value-of select="$C21302"/>
  731. <xsl:text>'][ns0:PCILoop1/ns0:PCI/ns0:C210/C21001='</xsl:text>
  732. <xsl:value-of select="$keyDeliveryRef"/>
  733. <xsl:text>']/ns0:DGSLoop1</xsl:text>
  734. </xsl:when>
  735. </xsl:choose>
  736. </xpath>
  737. </DEBUG>-->
  738. <xsl:choose>
  739. <xsl:when test="$receiver = 'KLGEUEERSE01'">
  740. <xsl:for-each select="../s0:GIDLoop1[s0:GID/s0:C213/C21302/text()=$C21302]/s0:DGSLoop1">
  741. <DangerousGood>
  742. <xsl:call-template name="DangerousGood">
  743. <xsl:with-param name="packingQty" select="$packingQty"/>
  744. <xsl:with-param name="packingType" select="$packingType"/>
  745. </xsl:call-template>
  746. <xsl:for-each select="s0:FTX_11[FTX01 = 'AAD']">
  747. <xsl:call-template name="LocalizedDescription"/>
  748. </xsl:for-each>
  749. </DangerousGood>
  750. </xsl:for-each>
  751. </xsl:when>
  752. <xsl:when test="$receiver = 'KLGEUVENLO01'">
  753. <xsl:for-each select="../s0:GIDLoop1[s0:GID/s0:C213/C21302=$C21302][s0:PCILoop1/s0:PCI/s0:C210/C21001=$keyDeliveryRef]/s0:DGSLoop1">
  754. <DangerousGood>
  755. <xsl:call-template name="DangerousGood">
  756. <xsl:with-param name="packingQty" select="$packingQty"/>
  757. <xsl:with-param name="packingType" select="$packingType"/>
  758. </xsl:call-template>
  759. <xsl:for-each select="s0:FTX_11[FTX01 = 'AAD']">
  760. <xsl:call-template name="LocalizedDescription"/>
  761. </xsl:for-each>
  762. </DangerousGood>
  763. </xsl:for-each>
  764. </xsl:when>
  765. </xsl:choose>
  766. <xsl:variable name="C21001">
  767. <xsl:value-of select="s0:PCILoop1/s0:PCI/s0:C210/C21001"/>
  768. </xsl:variable>
  769. <!--Barcodes overnemen (SD-7882) NOG ALTIJD NIET LIVE / TERUGGEDRAAID-->
  770. <!--<xsl:for-each select="//s0:PCILoop1[s0:PCI/s0:C210/C21001/text()=$C21001]/s0:GIN/*/C20801">
  771. <Barcode>
  772. <Barcode>
  773. <xsl:value-of select="text()"/>
  774. </Barcode>
  775. </Barcode>
  776. </xsl:for-each>-->
  777. </Good>
  778. </xsl:template>
  779. <xsl:template name="GoodsDetail">
  780. <xsl:param name="ftl"/>
  781. <xsl:param name="packingQty"/>
  782. <xsl:param name="packingType"/>
  783. <xsl:param name="key"/>
  784. <xsl:param name="keyDeliveryRef"/>
  785. <PackingQty>
  786. <xsl:value-of select="$packingQty"/>
  787. </PackingQty>
  788. <PackingType>
  789. <xsl:value-of select="$packingType"/>
  790. </PackingType>
  791. <PackageQty>
  792. <xsl:value-of select="sum(key($key, concat(generate-id(..), '|', s0:GID/s0:C213/C21302, '|', $keyDeliveryRef))/s0:GID/s0:C213_2/C21301)" />
  793. </PackageQty>
  794. <PackageType>
  795. <xsl:value-of select="ScriptNS0:DBValueExtract(string(ScriptNS0:DBLookup(0, s0:GID/s0:C213_2/C21302, $connectionString, 'TM_Bosman_Package', 'Bosman')), 'KLG')" />
  796. </PackageType>
  797. <ProductDescription>
  798. <xsl:choose>
  799. <xsl:when test="$receiver = 'KLGEUEERSE01'">
  800. <xsl:value-of select="s0:FTX_9[FTX01 = 'AAA']/s0:C108_9/C10801"/>
  801. </xsl:when>
  802. <xsl:when test="$receiver = 'KLGEUVENLO01'">
  803. <xsl:value-of select="concat(s0:FTX_9[FTX01 = 'AAA']/s0:C108_9/C10801, ' | ', s0:PCILoop1/s0:PCI/s0:C210/C21001)"/>
  804. </xsl:when>
  805. </xsl:choose>
  806. </ProductDescription>
  807. <BrutoWeight>
  808. <xsl:value-of select="format-number(sum(key($key, concat(generate-id(..), '|', s0:GID/s0:C213/C21302, '|', $keyDeliveryRef))/s0:MEALoop4/s0:MEA_5[MEA01 = 'WT']/s0:C174_5/C17402), '0.00')" />
  809. </BrutoWeight>
  810. <LoadingMeter>
  811. <xsl:variable name="loadingMeters" select="format-number(sum(key($key, concat(generate-id(..), '|', s0:GID/s0:C213/C21302, '|', $keyDeliveryRef))/s0:MEALoop4/s0:MEA_5[MEA01 = 'LMT']/s0:C174_5/C17402), '0.00')" />
  812. <xsl:choose>
  813. <xsl:when test="$ftl = 'true' and position() = 1">13.6</xsl:when>
  814. <xsl:when test="$ftl = 'true' and position() > 1">0</xsl:when>
  815. <xsl:when test="$loadingMeters > 13.6">13.6</xsl:when>
  816. <xsl:otherwise>
  817. <xsl:value-of select="$loadingMeters" />
  818. </xsl:otherwise>
  819. </xsl:choose>
  820. </LoadingMeter>
  821. <Volume>
  822. <xsl:value-of select="format-number(sum(key($key, concat(generate-id(..), '|', s0:GID/s0:C213/C21302, '|', $keyDeliveryRef ))/s0:MEALoop4/s0:MEA_5[MEA01 = 'VOL']/s0:C174_5/C17402), '0.00')" />
  823. </Volume>
  824. <ContainerNumber>
  825. <xsl:value-of select="./s0:CNT_2[/s0:C270_2/C27001 = '34']/s0:C270_2/C27002"></xsl:value-of>
  826. </ContainerNumber>
  827. </xsl:template>
  828. <xsl:template name="DangerousGood">
  829. <xsl:param name="packingQty"/>
  830. <xsl:param name="packingType"/>
  831. <xsl:variable name="DGSpackingQty">
  832. <xsl:value-of select="s0:MEALoop7/s0:EQN_16/s0:C523_16/C52301"/>
  833. </xsl:variable>
  834. <xsl:variable name="DGSpackingType">
  835. <xsl:value-of select="ScriptNS0:DBValueExtract(string(ScriptNS0:DBLookup(0, s0:FTX_11/s0:C108_11/C10801, $connectionString, 'TM_Bosman_Package', 'Bosman')), 'KLG')" />
  836. </xsl:variable>
  837. <xsl:variable name="nosTextGB">
  838. <xsl:for-each select="s0:FTX_11[FTX01 = 'NOS']">
  839. <xsl:if test="FTX05 = 'GB'">
  840. <xsl:value-of select="s0:C108_11/C10801" />
  841. </xsl:if>
  842. </xsl:for-each>
  843. </xsl:variable>
  844. <UNNumber>
  845. <xsl:value-of select="s0:DGS/s0:C234/C23401" />
  846. </UNNumber>
  847. <Class>
  848. <xsl:value-of select="s0:DGS/s0:C236/C23601" />
  849. </Class>
  850. <SubClass1 />
  851. <SubClass2 />
  852. <SubClass3 />
  853. <Labels />
  854. <Qty>
  855. <!--<xsl:value-of select="$packingQty"/>-->
  856. <xsl:value-of select="$DGSpackingQty"/>
  857. </Qty>
  858. <Weight>
  859. <xsl:value-of select="s0:MEALoop7/s0:MEA_8/s0:C174_8/C17402" />
  860. </Weight>
  861. <PackageType>
  862. <!--<xsl:value-of select="$packingType"/>-->
  863. <xsl:value-of select="$DGSpackingType"/>
  864. </PackageType>
  865. <PackingGroup>
  866. <xsl:choose>
  867. <xsl:when test="s0:DGS/DGS05 = ''">0</xsl:when>
  868. <xsl:when test="s0:DGS/DGS05 = '0'">0</xsl:when>
  869. <xsl:when test="s0:DGS/DGS05 = '1'">I</xsl:when>
  870. <xsl:when test="s0:DGS/DGS05 = '2'">II</xsl:when>
  871. <xsl:when test="s0:DGS/DGS05 = '3'">III</xsl:when>
  872. </xsl:choose>
  873. </PackingGroup>
  874. <TransportCategory>
  875. <!--<xsl:value-of select="name()" />-->
  876. <xsl:value-of select="s0:DGS/DGS12" />
  877. </TransportCategory>
  878. <NOSText>
  879. <xsl:value-of select="$nosTextGB"/>
  880. </NOSText>
  881. <TunnelRestrictionCode>
  882. <xsl:value-of select="s0:FTX_11[FTX01 = 'AAC']/s0:C108_11/C10801" />
  883. </TunnelRestrictionCode>
  884. </xsl:template>
  885. <xsl:template name="LocalizedDescription">
  886. <LocalizedDescription>
  887. <LanguageCode>
  888. <xsl:value-of select="FTX05" />
  889. </LanguageCode>
  890. <Description>
  891. <xsl:value-of select="s0:C108_11/C10801" />
  892. </Description>
  893. </LocalizedDescription>
  894. </xsl:template>
  895. <!-- end region -->
  896. <xsl:variable name="removeDate1" select="KeyList:RemoveData($guid1)"/>
  897. <xsl:variable name="removeDate2" select="KeyList:RemoveData($guid2)"/>
  898. <xsl:variable name="dbClose" select="ScriptNS0:DBLookupShutdown()"/>
  899. </xsl:stylesheet>