Conversie van de TransSmart solution van BizTalk 2013 naar 2016.
Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.

793 wiersze
34KB

  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:msxsl="urn:schemas-microsoft-com:xslt"
  5. xmlns:DateTime="TM.Shared.Components.DateTime"
  6. xmlns:SSO="TM.Shared.Components.SSO"
  7. xmlns:String="TM.Shared.Components.String"
  8. xmlns:Helper="TM.TransSmart.Components"
  9. xmlns:s0="http://TM.TransSmart.Shipment"
  10. xmlns:ns0="http://TM.KLG.com/KLG/Order/v19A"
  11. exclude-result-prefixes="s0 ns0 ScriptNS0 ScriptNS1 msxsl DateTime SSO String Helper">
  12. <xsl:output omit-xml-declaration="yes" method="xml" version="1.0" indent="yes" />
  13. <!-- region global variable initialization -->
  14. <xsl:variable name="connectionString" select="SSO:GetValue('TM.TransSmart', 'ESBLookupConnectionString')"/>
  15. <xsl:variable name="receiver" select="ScriptNS0:DBValueExtract(ScriptNS0:DBLookup(0 , /s0:carrierBooking/s0:shipments[1]/s0:shipmentInfo[1]/s0:carrier , $connectionString , 'TM_TransSmart_Receiver' , 'TransSmart_carrier') , 'KLG_receiver')"/>
  16. <xsl:variable name="sender">
  17. <xsl:choose>
  18. <xsl:when test="$receiver='KLGEUEERSE01'">
  19. <xsl:choose>
  20. <xsl:when test="normalize-space(ScriptNS0:DBValueExtract(ScriptNS0:DBLookup(0 , concat(/s0:carrierBooking/s0:shipments[1]/s0:shipmentInfo[1]/s0:customerId, /s0:carrierBooking/s0:shipments[1]/s0:shipmentInfo[1]/s0:costcenter) , $connectionString , 'TM_TransSmart_CompanyCode' , 'TransSmart_customerId+TransSmart_costcentre') , 'KLGEUEERSE01')) != ''">
  21. <xsl:value-of select="ScriptNS0:DBValueExtract(ScriptNS0:DBLookup(0 , concat(/s0:carrierBooking/s0:shipments[1]/s0:shipmentInfo[1]/s0:customerId, /s0:carrierBooking/s0:shipments[1]/s0:shipmentInfo[1]/s0:costcenter) , $connectionString , 'TM_TransSmart_CompanyCode' , 'TransSmart_customerId+TransSmart_costcentre') , 'KLGEUEERSE01')"/>
  22. </xsl:when>
  23. <xsl:otherwise>
  24. <xsl:value-of select="ScriptNS0:DBValueExtract(ScriptNS0:DBLookup(0 , /s0:carrierBooking/s0:shipments[1]/s0:shipmentInfo[1]/s0:customerId , $connectionString , 'TM_TransSmart_CompanyCode' , 'TransSmart_customerId') , 'KLGEUEERSE01')"/>
  25. </xsl:otherwise>
  26. </xsl:choose>
  27. </xsl:when>
  28. <xsl:when test="$receiver='KLGEUVENLO01'">
  29. <xsl:choose>
  30. <xsl:when test="normalize-space(ScriptNS0:DBValueExtract(ScriptNS0:DBLookup(0 , concat(/s0:carrierBooking/s0:shipments[1]/s0:shipmentInfo[1]/s0:customerId, /s0:carrierBooking/s0:shipments[1]/s0:shipmentInfo[1]/s0:costcenter) , $connectionString , 'TM_TransSmart_CompanyCode' , 'TransSmart_customerId+TransSmart_costcentre') , 'KLGEUVENLO01')) != ''">
  31. <xsl:value-of select="ScriptNS0:DBValueExtract(ScriptNS0:DBLookup(0 , concat(/s0:carrierBooking/s0:shipments[1]/s0:shipmentInfo[1]/s0:customerId, /s0:carrierBooking/s0:shipments[1]/s0:shipmentInfo[1]/s0:costcenter) , $connectionString , 'TM_TransSmart_CompanyCode' , 'TransSmart_customerId+TransSmart_costcentre') , 'KLGEUVENLO01')"/>
  32. </xsl:when>
  33. <xsl:otherwise>
  34. <xsl:value-of select="ScriptNS0:DBValueExtract(ScriptNS0:DBLookup(0 , /s0:carrierBooking/s0:shipments[1]/s0:shipmentInfo[1]/s0:customerId , $connectionString , 'TM_TransSmart_CompanyCode' , 'TransSmart_customerId') , 'KLGEUVENLO01')"/>
  35. </xsl:otherwise>
  36. </xsl:choose>
  37. </xsl:when>
  38. <xsl:otherwise>
  39. <xsl:text></xsl:text>
  40. </xsl:otherwise>
  41. </xsl:choose>
  42. </xsl:variable>
  43. <xsl:variable name="leadtimeSetup" select="ScriptNS0:DBLookup(0 , concat($sender, $receiver), $connectionString , 'TM_TransSmart_Leadtimes' , 'Sender + Receiver')"/>
  44. <xsl:variable name="LeadtimeCalculation" select="ScriptNS0:DBValueExtract($leadtimeSetup, 'Active')" />
  45. <xsl:variable name="CorrectionDays" select="number(ScriptNS0:DBValueExtract($leadtimeSetup, 'CorrectionDays'))" />
  46. <xsl:variable name="DefaultLeadtimeDays" select="ScriptNS0:DBValueExtract($leadtimeSetup, 'DefaultDays')" />
  47. <xsl:variable name="DefaultDeliveryCountry" select="ScriptNS0:DBValueExtract($leadtimeSetup, 'DefaultDeliveryCountry')" />
  48. <xsl:variable name="DefaultDeliveryTimeFrom" select="ScriptNS0:DBValueExtract($leadtimeSetup, 'DefaultDeliveryTimeFrom')" />
  49. <xsl:variable name="DefaultDeliveryTimeTo" select="ScriptNS0:DBValueExtract($leadtimeSetup, 'DefaultDeliveryTimeTo')" />
  50. <xsl:variable name="currentDate" select="DateTime:GetCurrentDate()" />
  51. <xsl:variable name="currentDateTime" select="DateTime:GetCurrentDateTime()" />
  52. <!-- end region -->
  53. <!-- region templates -->
  54. <xsl:template match="/">
  55. <xsl:apply-templates select="/s0:carrierBooking" />
  56. </xsl:template>
  57. <xsl:template match="/s0:carrierBooking">
  58. <ns0:Order>
  59. <Sender>
  60. <xsl:value-of select="$sender"/>
  61. </Sender>
  62. <Receiver>
  63. <xsl:value-of select="$receiver"/>
  64. </Receiver>
  65. <GroupName>N/A</GroupName>
  66. <Consolidation>N/A</Consolidation>
  67. <ReceiverVersion>N/A</ReceiverVersion>
  68. <OrchestrationResult>N/A</OrchestrationResult>
  69. <Reference>
  70. <xsl:value-of select="s0:shipments[1]/s0:shipmentInfo[1]/s0:reference"/>
  71. </Reference>
  72. <TimeStamp>
  73. <xsl:value-of select="$currentDateTime" />
  74. </TimeStamp>
  75. <Status>NEW</Status>
  76. <Date>
  77. <xsl:value-of select="$currentDate" />
  78. </Date>
  79. <FullTruckLoad>false</FullTruckLoad>
  80. <xsl:for-each select="s0:shipments/s0:shipmentInfo">
  81. <Shipment>
  82. <xsl:call-template name="Shipment"/>
  83. </Shipment>
  84. </xsl:for-each>
  85. </ns0:Order>
  86. </xsl:template>
  87. <xsl:template name="Shipment">
  88. <Consignor>
  89. <xsl:value-of select="$sender"/>
  90. </Consignor>
  91. <ConsignorReference>
  92. <xsl:value-of select="s0:reference"/>
  93. </ConsignorReference>
  94. <Debtor>
  95. <xsl:value-of select="$sender"/>
  96. </Debtor>
  97. <DebtorReference>
  98. <xsl:choose>
  99. <xsl:when test="normalize-space(s0:additionalReferences/s0:additionalReference[s0:type='ORDER']/s0:value) != ''">
  100. <xsl:value-of select="s0:additionalReferences/s0:additionalReference[s0:type='ORDER']/s0:value"/>
  101. </xsl:when>
  102. <xsl:otherwise>
  103. <xsl:value-of select="s0:reference"/>
  104. </xsl:otherwise>
  105. </xsl:choose>
  106. </DebtorReference>
  107. <Incoterm>
  108. <xsl:choose>
  109. <xsl:when test="s0:incoterms = 'DDU'">DAP</xsl:when>
  110. <xsl:otherwise>
  111. <xsl:value-of select="s0:incoterms"/>
  112. </xsl:otherwise>
  113. </xsl:choose>
  114. </Incoterm>
  115. <IncotermCity/>
  116. <IncotermCountryCode/>
  117. <xsl:variable name="deliveryFeatures">
  118. <xsl:if test="s0:serviceLevelOther!=''">
  119. <!-- Transsmart heeft een probleem met underscores in het serviceLevel element -->
  120. <!-- Daarom gebruiken zij ~ en moet KLG deze vervangen door _ -->
  121. <!-- Meerdere services worden gescheiden door een + teken -->
  122. <xsl:call-template name="features">
  123. <xsl:with-param name="splitString" select="translate(s0:serviceLevelOther,'~','_')"/>
  124. <xsl:with-param name="delimiter" select="'+'"/>
  125. </xsl:call-template>
  126. </xsl:if>
  127. </xsl:variable>
  128. <xsl:call-template name="Address_SF" />
  129. <xsl:call-template name="Address_ST">
  130. <xsl:with-param name="deliveryFeatures" select="$deliveryFeatures"/>
  131. </xsl:call-template>
  132. <xsl:call-template name="Good">
  133. <xsl:with-param name="deliveryFeatures" select="$deliveryFeatures"/>
  134. </xsl:call-template>
  135. </xsl:template>
  136. <xsl:template name="Address_SF">
  137. <xsl:variable name="collectionDate" select="concat(substring(s0:pickupDate, 1, 4), '-', substring(s0:pickupDate, 5, 2), '-', substring(s0:pickupDate, 7, 2))"/>
  138. <xsl:variable name="collectionTimeFrom" select="concat(substring(s0:pickupTime, 1, 2), ':', substring(s0:pickupTime, 3, 2), ':00')"/>
  139. <xsl:variable name="collectionTimeUntill" select="concat(substring(s0:pickupTimeTo, 1, 2), ':', substring(s0:pickupTimeTo, 3, 2), ':00')"/>
  140. <xsl:variable name="loadingDateTimeFrom">
  141. <xsl:choose>
  142. <xsl:when test="not($collectionDate = '00000000') and not(normalize-space($collectionDate)='') and string-length($collectionDate) = 10">
  143. <xsl:choose>
  144. <xsl:when test="not(normalize-space($collectionTimeFrom)='') and string-length($collectionTimeFrom) = 8">
  145. <xsl:value-of select="concat($collectionDate, 'T', $collectionTimeFrom)" />
  146. </xsl:when>
  147. <xsl:otherwise>
  148. <xsl:value-of select="concat($collectionDate, 'T07:00:00')" />
  149. </xsl:otherwise>
  150. </xsl:choose>
  151. </xsl:when>
  152. <xsl:otherwise>
  153. <xsl:value-of select="concat($currentDate, 'T07:00:00')"/>
  154. </xsl:otherwise>
  155. </xsl:choose>
  156. </xsl:variable>
  157. <xsl:variable name="loadingDateTimeTo">
  158. <xsl:choose>
  159. <xsl:when test="not($collectionDate = '00000000') and not(normalize-space($collectionDate)='') and string-length($collectionDate) = 10">
  160. <xsl:choose>
  161. <xsl:when test="not(normalize-space($collectionTimeUntill)='') and string-length($collectionTimeUntill) = 8">
  162. <xsl:value-of select="concat($collectionDate, 'T', $collectionTimeUntill)" />
  163. </xsl:when>
  164. <xsl:otherwise>
  165. <xsl:value-of select="concat($collectionDate, 'T16:00:00')" />
  166. </xsl:otherwise>
  167. </xsl:choose>
  168. </xsl:when>
  169. <xsl:otherwise>
  170. <xsl:value-of select="concat($currentDate, 'T16:00:00')"/>
  171. </xsl:otherwise>
  172. </xsl:choose>
  173. </xsl:variable>
  174. <xsl:variable name="loadingReference">
  175. <xsl:choose>
  176. <xsl:when test="$sender = 'JOBESHEERE01' and substring(s0:instruction,1,3) = 'RDV'">
  177. <xsl:value-of select="s0:instruction"/>
  178. </xsl:when>
  179. <xsl:when test="normalize-space(s0:additionalReferences/s0:additionalReference[s0:type='ROUTE_ID']/s0:value) != ''">
  180. <xsl:value-of select="s0:additionalReferences/s0:additionalReference[s0:type='ROUTE_ID']/s0:value"/>
  181. </xsl:when>
  182. <xsl:otherwise>
  183. <xsl:value-of select="s0:reference"/>
  184. </xsl:otherwise>
  185. </xsl:choose>
  186. </xsl:variable>
  187. <Address>
  188. <AddressType>SF</AddressType>
  189. <xsl:call-template name="Address">
  190. <xsl:with-param name="addressCode" select="''" />
  191. <xsl:with-param name="name1" select = "s0:addresses/s0:address[s0:type = 'SEND']/s0:name" />
  192. <xsl:with-param name="name2" select = "''" />
  193. <xsl:with-param name="address1" select = "s0:addresses/s0:address[s0:type = 'SEND']/s0:street1" />
  194. <xsl:with-param name="address2" select = "s0:addresses/s0:address[s0:type = 'SEND']/s0:street2" />
  195. <xsl:with-param name="postalCode" select = "s0:addresses/s0:address[s0:type = 'SEND']/s0:zipCode" />
  196. <xsl:with-param name="city" select = "s0:addresses/s0:address[s0:type = 'SEND']/s0:city" />
  197. <xsl:with-param name="region" select = "s0:addresses/s0:address[s0:type = 'SEND' and s0:countryCode = 'IE']/s0:state" />
  198. <xsl:with-param name="countryCode" select = "s0:addresses/s0:address[s0:type = 'SEND']/s0:countryCode" />
  199. <xsl:with-param name="start" select = "$loadingDateTimeFrom" />
  200. <xsl:with-param name="end" select = "$loadingDateTimeTo" />
  201. <xsl:with-param name="reference" select = "$loadingReference" />
  202. <xsl:with-param name="externalRemark1" select = "''" />
  203. <xsl:with-param name="externalRemark2" select = "''" />
  204. <xsl:with-param name="internalRemark1" select = "''" />
  205. <xsl:with-param name="internalRemark2" select = "''" />
  206. </xsl:call-template>
  207. <xsl:call-template name="ContactPerson">
  208. <xsl:with-param name="name" select = "s0:addresses/s0:address[s0:type = 'SEND']/s0:contact" />
  209. <xsl:with-param name="phone" select = "s0:addresses/s0:address[s0:type = 'SEND']/s0:telNo" />
  210. <xsl:with-param name="fax" select = "''" />
  211. <xsl:with-param name="email" select = "s0:addresses/s0:address[s0:type = 'SEND']/s0:email" />
  212. </xsl:call-template>
  213. </Address>
  214. </xsl:template>
  215. <xsl:template name="Address_ST">
  216. <xsl:param name="reference" />
  217. <xsl:param name="deliveryFeatures" />
  218. <xsl:variable name="collectionDate" select="concat(substring(s0:pickupDate/text(), 1, 4), '-', substring(s0:pickupDate/text(), 5, 2), '-', substring(s0:pickupDate/text(), 7, 2))"/>
  219. <xsl:variable name ="adjustedDeliveryDateTimeFrom">
  220. <xsl:choose>
  221. <xsl:when test="number(DateTime:CompareDateTime($currentDate, $collectionDate)) &lt;= 0">
  222. <xsl:value-of select="concat(DateTime:GetWorkday($collectionDate, '2', 'NL'),'T07:00:00')"/>
  223. </xsl:when>
  224. <xsl:otherwise>
  225. <xsl:value-of select="concat($currentDate, 'T07:00:00')"/>
  226. </xsl:otherwise>
  227. </xsl:choose>
  228. </xsl:variable>
  229. <xsl:variable name ="adjustedDeliveryDateTimeTo">
  230. <xsl:choose>
  231. <xsl:when test="number(DateTime:CompareDateTime($currentDate, $collectionDate)) &lt;= 0">
  232. <xsl:value-of select="concat(DateTime:GetWorkday($collectionDate, '2', 'NL'),'T16:00:00')"/>
  233. </xsl:when>
  234. <xsl:otherwise>
  235. <xsl:value-of select="concat($currentDate, 'T16:00:00')"/>
  236. </xsl:otherwise>
  237. </xsl:choose>
  238. </xsl:variable>
  239. <xsl:variable name="deliveryDate" select="concat(substring(s0:requestedDeliveryDate/text(), 1, 4), '-', substring(s0:requestedDeliveryDate/text(), 5, 2), '-', substring(s0:requestedDeliveryDate/text(), 7, 2))"/>
  240. <xsl:variable name="deliveryTimeFrom" select="concat(substring(s0:requestedDeliveryTime/text(), 1, 2), ':', substring(s0:requestedDeliveryTime/text(), 3, 2), ':00')"/>
  241. <xsl:variable name="deliveryTimeUntill" select="concat(substring(s0:requestedDeliveryTimeTo/text(), 1, 2), ':', substring(s0:requestedDeliveryTimeTo/text(), 3, 2), ':00')"/>
  242. <xsl:variable name="deliveryDateTimeFrom">
  243. <xsl:choose>
  244. <xsl:when test="not($deliveryDate = '00000000') and not(normalize-space($deliveryDate)='') and string-length($deliveryDate) = 10">
  245. <xsl:choose>
  246. <xsl:when test="not($deliveryTimeFrom = '00:00:00') and not(normalize-space($deliveryTimeFrom)='') and string-length($deliveryTimeFrom) = 8">
  247. <xsl:value-of select="concat($deliveryDate, 'T', $deliveryTimeFrom)" />
  248. </xsl:when>
  249. <xsl:otherwise>
  250. <xsl:value-of select="concat($deliveryDate, 'T07:00:00')" />
  251. </xsl:otherwise>
  252. </xsl:choose>
  253. </xsl:when>
  254. <xsl:otherwise>
  255. <xsl:value-of select="$adjustedDeliveryDateTimeFrom"/>
  256. </xsl:otherwise>
  257. </xsl:choose>
  258. </xsl:variable>
  259. <xsl:variable name="deliveryDateTimeTo">
  260. <xsl:choose>
  261. <xsl:when test="not($deliveryDate = '00000000') and not(normalize-space($deliveryDate)='') and string-length($deliveryDate) = 10">
  262. <xsl:choose>
  263. <xsl:when test="not($deliveryTimeUntill = '00:00:00') and not(normalize-space($deliveryTimeUntill)='') and string-length($deliveryTimeUntill) = 8">
  264. <xsl:value-of select="concat($deliveryDate, 'T', $deliveryTimeUntill)" />
  265. </xsl:when>
  266. <xsl:otherwise>
  267. <xsl:value-of select="concat($deliveryDate, 'T16:00:00')" />
  268. </xsl:otherwise>
  269. </xsl:choose>
  270. </xsl:when>
  271. <xsl:otherwise>
  272. <xsl:value-of select="$adjustedDeliveryDateTimeTo"/>
  273. </xsl:otherwise>
  274. </xsl:choose>
  275. </xsl:variable>
  276. <Address>
  277. <AddressType>ST</AddressType>
  278. <xsl:variable name="deliveryReference">
  279. <xsl:choose>
  280. <xsl:when test="s0:additionalReferences/s0:additionalReference[s0:type='YOUR_REFERENCE'] and normalize-space(s0:additionalReferences/s0:additionalReference[s0:type='YOUR_REFERENCE']/s0:value)!=''">
  281. <xsl:value-of select="s0:additionalReferences/s0:additionalReference[s0:type='YOUR_REFERENCE']/s0:value"/>
  282. </xsl:when>
  283. <xsl:otherwise>
  284. <xsl:value-of select="s0:reference"/>
  285. </xsl:otherwise>
  286. </xsl:choose>
  287. </xsl:variable>
  288. <xsl:call-template name="Address">
  289. <xsl:with-param name="addressCode" select="''" />
  290. <xsl:with-param name="name1" select = "s0:addresses/s0:address[s0:type = 'RECV']/s0:name" />
  291. <xsl:with-param name="name2" select = "''" />
  292. <xsl:with-param name="address1" select = "s0:addresses/s0:address[s0:type = 'RECV']/s0:street1" />
  293. <xsl:with-param name="address2" select = "s0:addresses/s0:address[s0:type = 'RECV']/s0:street2" />
  294. <xsl:with-param name="postalCode" select = "s0:addresses/s0:address[s0:type = 'RECV']/s0:zipCode" />
  295. <xsl:with-param name="city" select = "s0:addresses/s0:address[s0:type = 'RECV']/s0:city" />
  296. <xsl:with-param name="region" select = "s0:addresses/s0:address[s0:type = 'RECV' and s0:countryCode = 'IE']/s0:state" />
  297. <xsl:with-param name="countryCode" select = "s0:addresses/s0:address[s0:type = 'RECV']/s0:countryCode" />
  298. <xsl:with-param name="start" select = "$deliveryDateTimeFrom" />
  299. <xsl:with-param name="end" select = "$deliveryDateTimeTo" />
  300. <xsl:with-param name="reference" select = "$deliveryReference" />
  301. <xsl:with-param name="externalRemark1" select = "''" />
  302. <xsl:with-param name="externalRemark2" select = "s0:instruction" />
  303. <xsl:with-param name="internalRemark1" select = "''" />
  304. <xsl:with-param name="internalRemark2" select = "''" />
  305. </xsl:call-template>
  306. <!--<xsl:if test="s0:serviceLevelTime!=''">
  307. <xsl:call-template name="features">
  308. <xsl:with-param name="splitString" select="translate(s0:serviceLevelTime,'~','_')"/>
  309. <xsl:with-param name="delimiter" select="'+'"/>
  310. </xsl:call-template>
  311. </xsl:if>-->
  312. <xsl:copy-of select="$deliveryFeatures"/>
  313. <xsl:if test="$LeadtimeCalculation = 'True'">
  314. <Parametergroup>
  315. <Groupname>
  316. <xsl:text>LeadtimeData</xsl:text>
  317. </Groupname>
  318. <Parameter>
  319. <Qualifier>
  320. <xsl:text>ReceiverPostalcode</xsl:text>
  321. </Qualifier>
  322. <Value>
  323. <xsl:value-of select="translate(s0:addresses/s0:address[s0:type = 'RECV']/s0:zipCode, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ ', '')"/>
  324. </Value>
  325. </Parameter>
  326. <Parameter>
  327. <Qualifier>
  328. <xsl:text>SenderPostalcode</xsl:text>
  329. </Qualifier>
  330. <Value>
  331. <xsl:value-of select="translate(s0:addresses/s0:address[s0:type = 'SEND']/s0:zipCode, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ ', '')"/>
  332. </Value>
  333. </Parameter>
  334. <Parameter>
  335. <Qualifier>
  336. <xsl:text>ReceiverCountry</xsl:text>
  337. </Qualifier>
  338. <Value>
  339. <xsl:value-of select="s0:addresses/s0:address[s0:type = 'RECV']/s0:countryCode"/>
  340. </Value>
  341. </Parameter>
  342. <Parameter>
  343. <Qualifier>
  344. <xsl:text>SenderCountry</xsl:text>
  345. </Qualifier>
  346. <Value>
  347. <xsl:value-of select="s0:addresses/s0:address[s0:type = 'SEND']/s0:countryCode"/>
  348. </Value>
  349. </Parameter>
  350. <Parameter>
  351. <Qualifier>
  352. <xsl:text>PackageQuantity</xsl:text>
  353. </Qualifier>
  354. <Value>
  355. <xsl:value-of select="sum(s0:shipmentLines/s0:shipmentLine/s0:quantity)"/>
  356. </Value>
  357. </Parameter>
  358. <Parameter>
  359. <Qualifier>
  360. <xsl:text>PackageKilogram</xsl:text>
  361. </Qualifier>
  362. <Value>
  363. <xsl:value-of select="sum(s0:shipmentLines/s0:shipmentLine/s0:measurements/s0:weight)"/>
  364. </Value>
  365. </Parameter>
  366. <Parameter>
  367. <Qualifier>
  368. <xsl:text>ADR</xsl:text>
  369. </Qualifier>
  370. <Value>
  371. <xsl:text>false</xsl:text>
  372. </Value>
  373. </Parameter>
  374. <Parameter>
  375. <Qualifier>
  376. <xsl:text>defaultLeadDate</xsl:text>
  377. </Qualifier>
  378. <Value>
  379. <xsl:value-of select="DateTime:GetWorkday(concat(substring(s0:pickupDate/text(), 1, 4), '-', substring(s0:pickupDate/text(), 5, 2), '-', substring(s0:pickupDate/text(), 7, 2)), $DefaultLeadtimeDays, $DefaultDeliveryCountry)"/>
  380. </Value>
  381. </Parameter>
  382. <Parameter>
  383. <Qualifier>
  384. <xsl:text>StartingDate</xsl:text>
  385. </Qualifier>
  386. <Value>
  387. <!--<xsl:value-of select="concat(substring(s0:pickupDate/text(), 1, 4), '-', substring(s0:pickupDate/text(), 5, 2), '-', substring(s0:pickupDate/text(), 7, 2))"/>
  388. <xsl:text> Correction </xsl:text>
  389. <xsl:value-of select="$CorrectionDays"/>
  390. <xsl:text> Result </xsl:text>-->
  391. <xsl:value-of select="DateTime:GetWorkday(concat(substring(s0:pickupDate/text(), 1, 4), '-', substring(s0:pickupDate/text(), 5, 2), '-', substring(s0:pickupDate/text(), 7, 2)), $CorrectionDays, s0:addresses/s0:address[s0:type = 'SEND']/s0:countryCode)"/>
  392. <!--<xsl:text> Loading </xsl:text>
  393. <xsl:value-of select="s0:addresses/s0:address[s0:type = 'SEND']/s0:countryCode"/>-->
  394. </Value>
  395. </Parameter>
  396. <Parameter>
  397. <Qualifier>
  398. <xsl:text>timeFrom</xsl:text>
  399. </Qualifier>
  400. <Value>
  401. <xsl:choose>
  402. <xsl:when test="not($deliveryTimeFrom = '00:00:00') and not(normalize-space($deliveryTimeFrom)='') and string-length($deliveryTimeFrom) = 8">
  403. <xsl:value-of select="$deliveryTimeFrom"/>
  404. </xsl:when>
  405. <xsl:otherwise>
  406. <xsl:value-of select="$DefaultDeliveryTimeFrom"/>
  407. </xsl:otherwise>
  408. </xsl:choose>
  409. </Value>
  410. </Parameter>
  411. <Parameter>
  412. <Qualifier>
  413. <xsl:text>timeTo</xsl:text>
  414. </Qualifier>
  415. <Value>
  416. <xsl:choose>
  417. <xsl:when test="not($deliveryTimeUntill = '00:00:00') and not(normalize-space($deliveryTimeUntill)='') and string-length($deliveryTimeUntill) = 8">
  418. <xsl:value-of select="$deliveryTimeUntill"/>
  419. </xsl:when>
  420. <xsl:otherwise>
  421. <xsl:value-of select="$DefaultDeliveryTimeTo"/>
  422. </xsl:otherwise>
  423. </xsl:choose>
  424. </Value>
  425. </Parameter>
  426. <Parameter>
  427. <Qualifier>
  428. <xsl:text>CompanyCode</xsl:text>
  429. </Qualifier>
  430. <Value>
  431. <xsl:value-of select="$sender"/>
  432. </Value>
  433. </Parameter>
  434. </Parametergroup>
  435. </xsl:if>
  436. <xsl:call-template name="ContactPerson">
  437. <xsl:with-param name="name" select = "s0:addresses/s0:address[s0:type = 'RECV']/s0:contact" />
  438. <xsl:with-param name="phone" select = "s0:addresses/s0:address[s0:type = 'RECV']/s0:telNo" />
  439. <xsl:with-param name="fax" select = "s0:addresses/s0:address[s0:type = 'RECV']/s0:faxNo" />
  440. <xsl:with-param name="email" select = "s0:addresses/s0:address[s0:type = 'RECV']/s0:email" />
  441. </xsl:call-template>
  442. </Address>
  443. </xsl:template>
  444. <xsl:template name="Address">
  445. <xsl:param name="addressCode" />
  446. <xsl:param name="name1" />
  447. <xsl:param name="name2" />
  448. <xsl:param name="address1" />
  449. <xsl:param name="address2" />
  450. <xsl:param name="postalCode" />
  451. <xsl:param name="city" />
  452. <xsl:param name="region" />
  453. <xsl:param name="countryCode" />
  454. <xsl:param name="start" />
  455. <xsl:param name="end" />
  456. <xsl:param name="reference" />
  457. <xsl:param name="externalRemark1" />
  458. <xsl:param name="externalRemark2" />
  459. <xsl:param name="internalRemark1" />
  460. <xsl:param name="internalRemark2" />
  461. <AddressCode>
  462. <xsl:value-of select="$addressCode" />
  463. </AddressCode>
  464. <Name1>
  465. <xsl:value-of select="$name1" />
  466. </Name1>
  467. <Name2>
  468. <xsl:value-of select="$name2" />
  469. </Name2>
  470. <Address1>
  471. <xsl:value-of select="$address1" />
  472. </Address1>
  473. <Address2>
  474. <xsl:value-of select="$address2" />
  475. </Address2>
  476. <PostalCode>
  477. <xsl:value-of select="$postalCode" />
  478. </PostalCode>
  479. <City>
  480. <xsl:value-of select="$city" />
  481. </City>
  482. <Region>
  483. <xsl:value-of select="$region" />
  484. </Region>
  485. <CountryCode>
  486. <xsl:value-of select="$countryCode" />
  487. </CountryCode>
  488. <Start>
  489. <xsl:value-of select="$start" />
  490. </Start>
  491. <End>
  492. <xsl:value-of select="$end" />
  493. </End>
  494. <Reference>
  495. <xsl:value-of select="$reference" />
  496. </Reference>
  497. <ExternalRemark1>
  498. <xsl:value-of select="$externalRemark1" />
  499. </ExternalRemark1>
  500. <ExternalRemark2>
  501. <xsl:value-of select="$externalRemark2" />
  502. </ExternalRemark2>
  503. <InternalRemark1>
  504. <xsl:value-of select="$internalRemark1" />
  505. </InternalRemark1>
  506. <InternalRemark2>
  507. <xsl:value-of select="$internalRemark2" />
  508. </InternalRemark2>
  509. </xsl:template>
  510. <xsl:template name="features">
  511. <xsl:param name="splitString" select="."/>
  512. <xsl:param name="delimiter" select="'+'"/>
  513. <xsl:choose>
  514. <xsl:when test="contains($splitString,$delimiter)">
  515. <xsl:call-template name="feature">
  516. <xsl:with-param name="service" select="substring-before($splitString,$delimiter)"/>
  517. </xsl:call-template>
  518. <xsl:call-template name="features">
  519. <xsl:with-param name="splitString" select="substring-after($splitString,$delimiter)"/>
  520. <xsl:with-param name="delimiter" select="$delimiter"/>
  521. </xsl:call-template>
  522. </xsl:when>
  523. <xsl:otherwise>
  524. <xsl:call-template name="feature">
  525. <xsl:with-param name="service" select="$splitString"/>
  526. </xsl:call-template>
  527. </xsl:otherwise>
  528. </xsl:choose>
  529. </xsl:template>
  530. <xsl:template name="feature">
  531. <xsl:param name="service"/>
  532. <!--Het Transsmart service level STANDARD wordt door KLG genegeerd
  533. c.q. niet als feature opgenomen
  534. <xsl:if test="$service!='STANDARD'">-->
  535. <Feature>
  536. <FeatureCode>
  537. <xsl:value-of select="$service"/>
  538. </FeatureCode>
  539. <xsl:if test="$service='APP_REQ_EMAIL' or $service='APP_REQ_FAX' or $service='APP_REQ_INTERNET' or $service='APP_REQ_PHONE'">
  540. <AdditionalValue>
  541. <xsl:if test="$service='APP_REQ_EMAIL'">
  542. <xsl:value-of select="s0:addresses/s0:address[s0:type = 'RECV']/s0:email"/>
  543. </xsl:if>
  544. <xsl:if test="$service='APP_REQ_FAX'">
  545. <xsl:value-of select="s0:addresses/s0:address[s0:type = 'RECV']/s0:faxNo"/>
  546. </xsl:if>
  547. <xsl:if test="$service='APP_REQ_INTERNET'">
  548. </xsl:if>
  549. <xsl:if test=" $service='APP_REQ_PHONE'">
  550. <xsl:value-of select="s0:addresses/s0:address[s0:type = 'RECV']/s0:telNo"/>
  551. </xsl:if>
  552. </AdditionalValue>
  553. </xsl:if>
  554. </Feature>
  555. <!--</xsl:if>-->
  556. </xsl:template>
  557. <xsl:template name="ContactPerson">
  558. <xsl:param name="name" />
  559. <xsl:param name="phone" />
  560. <xsl:param name="fax" />
  561. <xsl:param name="email" />
  562. <ContactPerson>
  563. <Name>
  564. <xsl:value-of select="$name" />
  565. </Name>
  566. <Phone>
  567. <xsl:value-of select="$phone" />
  568. </Phone>
  569. <Fax>
  570. <xsl:value-of select="$fax" />
  571. </Fax>
  572. <Email>
  573. <xsl:value-of select="$email" />
  574. </Email>
  575. </ContactPerson>
  576. </xsl:template>
  577. <xsl:template name="Good">
  578. <xsl:param name="deliveryFeatures" />
  579. <xsl:for-each select="s0:shipmentLines/s0:shipmentLine">
  580. <!--Current Line values ...-->
  581. <xsl:variable name="cType" select="s0:packageType" />
  582. <xsl:variable name="cDesc" select="s0:description" />
  583. <xsl:variable name="cLeng" select="s0:measurements/s0:length" />
  584. <xsl:variable name="cWidt" select="s0:measurements/s0:width" />
  585. <xsl:variable name="cHeig" select="s0:measurements/s0:height" />
  586. <xsl:if test="generate-id() = generate-id(../s0:shipmentLine[s0:packageType=$cType][s0:description=$cDesc][s0:measurements/s0:length=$cLeng][s0:measurements/s0:width=$cWidt][s0:measurements/s0:height=$cHeig][1])">
  587. <xsl:variable name="tQuantity" select="sum(../s0:shipmentLine[s0:packageType=$cType][s0:description=$cDesc][s0:measurements/s0:length=$cLeng][s0:measurements/s0:width=$cWidt][s0:measurements/s0:height=$cHeig]/s0:quantity)" />
  588. <xsl:variable name="tWeight" select="round(sum(../s0:shipmentLine[s0:packageType=$cType][s0:description=$cDesc][s0:measurements/s0:length=$cLeng][s0:measurements/s0:width=$cWidt][s0:measurements/s0:height=$cHeig]/s0:measurements/s0:weight))"/>
  589. <Good>
  590. <xsl:variable name="packageType" select="Helper:GetDelimitedValueByIndex(s0:packageType, '|', 0)"/>
  591. <xsl:variable name="packageExchange" select="Helper:GetDelimitedValueByIndex(s0:packageType, '|', 1)"/>
  592. <xsl:variable name="Stackable" select="Helper:GetDelimitedValueByIndex(s0:packageType, '|', 2)"/>
  593. <!--<DEBUG>
  594. <TYPE>
  595. <xsl:value-of select="$packageType"/>
  596. </TYPE>
  597. <EXCHANGE>
  598. <xsl:value-of select="$packageExchange"/>
  599. </EXCHANGE>
  600. <STACKABLE>
  601. <xsl:value-of select="$Stackable"/>
  602. </STACKABLE>
  603. </DEBUG>-->
  604. <PackingQty>
  605. <xsl:value-of select="$tQuantity"/>
  606. </PackingQty>
  607. <PackingType>
  608. <!--<xsl:choose>
  609. <xsl:when test="contains(s0:packageType, '|')">
  610. <xsl:value-of select="substring-before(s0:packageType, '|')"/>
  611. </xsl:when>
  612. <xsl:otherwise>
  613. <xsl:value-of select="s0:packageType"/>
  614. </xsl:otherwise>
  615. </xsl:choose>-->
  616. <xsl:value-of select="$packageType"/>
  617. </PackingType>
  618. <!-- igv Feature NR exchange negeren -->
  619. <!--<xsl:if test="contains(s0:packageType, '|') and not(msxsl:node-set($deliveryFeatures)/Feature/FeatureCode = 'NR')">-->
  620. <xsl:if test="$packageExchange!='' and not(msxsl:node-set($deliveryFeatures)/Feature/FeatureCode = 'NR')">
  621. <PackingExchange>
  622. <!--<xsl:value-of select="substring-after(s0:packageType, '|')"/>-->
  623. <xsl:value-of select="$packageExchange"/>
  624. </PackingExchange>
  625. </xsl:if>
  626. <ProductDescription>
  627. <xsl:value-of select="s0:description"/>
  628. </ProductDescription>
  629. <BrutoWeight>
  630. <xsl:value-of select="$tWeight"/>
  631. </BrutoWeight>
  632. <NettoWeight>
  633. <xsl:value-of select="$tWeight"/>
  634. </NettoWeight>
  635. <LoadingMeter>
  636. <xsl:value-of select="format-number(((((round($cLeng) * round($cWidt)) div 24000) * $tQuantity) * 100) div 100,'##0.00' )"/>
  637. </LoadingMeter>
  638. <Volume>
  639. <xsl:value-of select="((round($cLeng) * round($cWidt) * round($cHeig)) * $tQuantity) div 1000000"/>
  640. </Volume>
  641. <xsl:if test="String:IsNumeric($Stackable)">
  642. <StackingLayers>
  643. <xsl:value-of select="$Stackable"/>
  644. </StackingLayers>
  645. </xsl:if>
  646. <PackingLength>
  647. <xsl:value-of select="$cLeng"/>
  648. </PackingLength>
  649. <PackingWidth>
  650. <xsl:value-of select="$cWidt"/>
  651. </PackingWidth>
  652. <PackingHeight>
  653. <xsl:value-of select="$cHeig"/>
  654. </PackingHeight>
  655. <xsl:for-each select="../s0:shipmentLine[s0:packageType=$cType][s0:description=$cDesc][s0:measurements/s0:length=$cLeng][s0:measurements/s0:width=$cWidt][s0:measurements/s0:height=$cHeig]/s0:dangerousGoods/s0:dangerousGoodsInfo">
  656. <DangerousGood>
  657. <DGSADRCode/>
  658. <UNNumber>
  659. <xsl:value-of select="s0:unCode/text()"/>
  660. </UNNumber>
  661. <Class/>
  662. <SubClass1>
  663. <xsl:value-of select="s0:hazardClassPrimary/text()"/>
  664. </SubClass1>
  665. <SubClass2>
  666. <xsl:value-of select="s0:hazardClassSecondary/text()"/>
  667. </SubClass2>
  668. <SubClass3/>
  669. <Classification>
  670. <xsl:value-of select="s0:classificationCode/text()"/>
  671. </Classification>
  672. <Labels/>
  673. <Qty>
  674. <xsl:value-of select="s0:quantity/text()"/>
  675. </Qty>
  676. <Weight>
  677. <xsl:value-of select="s0:measurements[s0:weightUom='KG']/s0:weight/text()"/>
  678. </Weight>
  679. <Volume/>
  680. <ProductDescription>
  681. <xsl:value-of select="s0:description/text()"/>
  682. </ProductDescription>
  683. <PackageType>
  684. <xsl:value-of select="s0:packingType/text()"/>
  685. </PackageType>
  686. <PackingGroup>
  687. <xsl:choose>
  688. <xsl:when test="s0:packingGroup/text() = '0'">
  689. <xsl:text>0</xsl:text>
  690. </xsl:when>
  691. <xsl:when test="s0:packingGroup/text() = '1'">
  692. <xsl:text>I</xsl:text>
  693. </xsl:when>
  694. <xsl:when test="s0:packingGroup/text() = '2'">
  695. <xsl:text>II</xsl:text>
  696. </xsl:when>
  697. <xsl:when test="s0:packingGroup/text() = '3'">
  698. <xsl:text>III</xsl:text>
  699. </xsl:when>
  700. <xsl:otherwise>
  701. <xsl:value-of select="s0:packingGroup/text()"/>
  702. </xsl:otherwise>
  703. </xsl:choose>
  704. </PackingGroup>
  705. <TransportCategory/>
  706. <NOSText/>
  707. <TunnelRestrictionCode>
  708. <xsl:value-of select="s0:tunnelCode/text()"/>
  709. </TunnelRestrictionCode>
  710. <EnvironmentallyHazardous/>
  711. <MarinePollutant/>
  712. <xsl:choose>
  713. <xsl:when test="s0:limitedQuantity > '0' and s0:limitedQuantity != 'N'">
  714. <LimitedQuantity><xsl:text>Y</xsl:text></LimitedQuantity>
  715. </xsl:when>
  716. <xsl:otherwise>
  717. <LimitedQuantity/>
  718. </xsl:otherwise>
  719. </xsl:choose>
  720. <LocalizedDescription/>
  721. </DangerousGood>
  722. </xsl:for-each>
  723. </Good>
  724. </xsl:if>
  725. </xsl:for-each>
  726. </xsl:template>
  727. <!-- end region -->
  728. <xsl:variable name="dbClose" select="ScriptNS0:DBLookupShutdown()"/>
  729. </xsl:stylesheet>