Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

TM.Bosman.IFCSUM_to_TM.Shared.Order.btm.cs 46KB

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