Conversie van de TransSmart solution van BizTalk 2013 naar 2016.
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

871 linhas
39KB

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