You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

TM.Shared.OrderStatus_to_TM.Bosman.IFTSTA.btm.cs 9.1KB

преди 1 седмица
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218
  1. namespace TM.Bosman.Transforms {
  2. [Microsoft.XLANGs.BaseTypes.SchemaReference(@"TM.Shared.Schemas.OrderStatus", typeof(global::TM.Shared.Schemas.OrderStatus))]
  3. [Microsoft.XLANGs.BaseTypes.SchemaReference(@"TM.Bosman.Schemas.EFACT_D96A_IFTSTA_BOSMAN", typeof(global::TM.Bosman.Schemas.EFACT_D96A_IFTSTA_BOSMAN))]
  4. public sealed class TM_Shared_OrderStatus_to_TM_Bosman_IFTSTA : 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:DateTime=""TM.Shared.Components.DateTime""
  9. xmlns:SSO=""TM.Shared.Components.SSO""
  10. xmlns:String=""TM.Shared.Components.String""
  11. xmlns:s0=""http://TM.KLG.com/KLG/OrderStatus""
  12. xmlns:ns0=""http://schemas.microsoft.com/BizTalk/EDI/EDIFACT/2006""
  13. exclude-result-prefixes=""s0 ns0 ScriptNS0 ScriptNS1 DateTime SSO String"">
  14. <xsl:output omit-xml-declaration=""yes"" method=""xml"" version=""1.0"" indent=""yes"" />
  15. <!-- Region global variable initialization -->
  16. <!-- region connectionString -->
  17. <xsl:variable name=""connectionString"" select=""SSO:GetValue('TM.Bosman', 'ESBLookupConnectionString2016')""/>
  18. <!-- end region -->
  19. <!-- end region -->
  20. <!-- region templates -->
  21. <xsl:template match=""/"">
  22. <xsl:apply-templates select=""/s0:StatusReport"" />
  23. </xsl:template>
  24. <xsl:template match=""/s0:StatusReport"">
  25. <ns0:EFACT_D96A_IFTSTA_BOSMAN>
  26. <UNH>
  27. <UNH1>
  28. <xsl:value-of select=""DateTime:FormatDateTime(TimeStamp, 'yyyy-MM-ddTHH:mm:ss', 'yyyyMMddHHmmss')"" />
  29. </UNH1>
  30. <UNH2>
  31. <UNH2.1>IFTSTA</UNH2.1>
  32. <UNH2.2>D</UNH2.2>
  33. <UNH2.3>96A</UNH2.3>
  34. <UNH2.4>UN</UNH2.4>
  35. <UNH2.5>EAN002</UNH2.5>
  36. </UNH2>
  37. </UNH>
  38. <ns0:BGM>
  39. <!-- Max length of BGM02 is 35 -->
  40. <BGM02>
  41. <xsl:value-of select=""substring(/s0:StatusReport/Status/ShipmentReference,1,35)""/>
  42. </BGM02>
  43. </ns0:BGM>
  44. <ns0:DTM>
  45. <ns0:C507>
  46. <C50701>137</C50701>
  47. <C50702>
  48. <xsl:value-of select=""DateTime:FormatDateTime(TimeStamp, 'yyyy-MM-ddTHH:mm:ss', 'yyyyMMdd')"" />
  49. </C50702>
  50. <C50703>102</C50703>
  51. </ns0:C507>
  52. </ns0:DTM>
  53. <ns0:CNILoop1>
  54. <ns0:CNI>
  55. <!-- Momenteel bevat Shared.Status maximaal 1 bericht -->
  56. <CNI01>1</CNI01>
  57. <ns0:C503>
  58. <C50301>
  59. <xsl:choose>
  60. <xsl:when test=""contains(/s0:StatusReport/Status/ShipmentReference,'/')"">
  61. <xsl:value-of select=""normalize-space(substring-after(/s0:StatusReport/Status/ShipmentReference,'/'))""/>
  62. </xsl:when>
  63. <xsl:otherwise>
  64. <xsl:value-of select=""/s0:StatusReport/Status/ShipmentReference""/>
  65. </xsl:otherwise>
  66. </xsl:choose>
  67. </C50301>
  68. </ns0:C503>
  69. </ns0:CNI>
  70. <ns0:STSLoop1>
  71. <ns0:STS>
  72. <ns0:C601>
  73. <C60101>1</C60101>
  74. </ns0:C601>
  75. <ns0:C555>
  76. <C55501>
  77. <xsl:variable name=""status"">
  78. <xsl:choose>
  79. <xsl:when test=""ScriptNS0:DBValueExtract(string(ScriptNS0:DBLookup(0, /s0:StatusReport/Status/StatusCode, $connectionString, 'TM_Bosman_StatusCode', 'KLG')), 'Bosman') != ''"">
  80. <xsl:value-of select=""ScriptNS0:DBValueExtract(string(ScriptNS0:DBLookup(0, /s0:StatusReport/Status/StatusCode, $connectionString, 'TM_Bosman_StatusCode', 'KLG')), 'Bosman')"" />
  81. </xsl:when>
  82. <xsl:otherwise>
  83. <xsl:value-of select=""/s0:StatusReport/Status/StatusCode""/>
  84. </xsl:otherwise>
  85. </xsl:choose>
  86. </xsl:variable>
  87. <xsl:value-of select=""$status""/>
  88. </C55501>
  89. </ns0:C555>
  90. </ns0:STS>
  91. <ns0:DTM_3>
  92. <ns0:C507_3>
  93. <C50701>334</C50701>
  94. <xsl:choose>
  95. <xsl:when test=""String:Left(Status/StatusTimeStamp,1)>'0'"">
  96. <C50702>
  97. <xsl:value-of select=""DateTime:FormatDateTime(Status/StatusTimeStamp, 'yyyy-MM-ddTHH:mm:ss', 'yyyyMMddHHmm')"" />
  98. </C50702>
  99. <C50703>203</C50703>
  100. </xsl:when>
  101. <xsl:otherwise>
  102. <C50702>000101010000</C50702>
  103. <C50703>102</C50703>
  104. </xsl:otherwise>
  105. </xsl:choose>
  106. </ns0:C507_3>
  107. </ns0:DTM_3>
  108. </ns0:STSLoop1>
  109. </ns0:CNILoop1>
  110. <UNT>
  111. <UNT1>0</UNT1>
  112. <UNT2>
  113. <xsl:value-of select=""DateTime:FormatDateTime(TimeStamp, 'yyyy-MM-ddTHH:mm:ss', 'yyyyMMddHHmmss')"" />
  114. </UNT2>
  115. </UNT>
  116. </ns0:EFACT_D96A_IFTSTA_BOSMAN>
  117. </xsl:template>
  118. <!-- end region -->
  119. <xsl:variable name=""dbClose"" select=""ScriptNS0:DBLookupShutdown()""/>
  120. </xsl:stylesheet>";
  121. private const int _useXSLTransform = 0;
  122. private const string _strArgList = @"<ExtensionObjects>
  123. <ExtensionObject Namespace=""http://schemas.microsoft.com/BizTalk/2003/ScriptNS0""
  124. AssemblyName=""Microsoft.BizTalk.BaseFunctoids, Version=3.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35""
  125. ClassName=""Microsoft.BizTalk.BaseFunctoids.FunctoidScripts"" />
  126. <ExtensionObject Namespace=""http://schemas.microsoft.com/BizTalk/2003/ScriptNS1""
  127. AssemblyName=""Microsoft.BizTalk.CrossReferencing, Version=3.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35""
  128. ClassName=""Microsoft.BizTalk.CrossReferencing.CrossReferencing"" />
  129. <ExtensionObject Namespace=""TM.Shared.Components.Biztalk""
  130. AssemblyName=""TM.Shared.Components, Version=3.0.37.0, Culture=neutral, PublicKeyToken=9cbf569b151cb1d4""
  131. ClassName=""TM.Shared.Components.BiztalkFunctions"" />
  132. <ExtensionObject Namespace=""TM.Shared.Components.DateTime""
  133. AssemblyName=""TM.Shared.Components, Version=3.0.37.0, Culture=neutral, PublicKeyToken=9cbf569b151cb1d4""
  134. ClassName=""TM.Shared.Components.DateTimeFunctions"" />
  135. <ExtensionObject Namespace=""TM.Shared.Components.KeyList""
  136. AssemblyName=""TM.Shared.Components, Version=3.0.37.0, Culture=neutral, PublicKeyToken=9cbf569b151cb1d4""
  137. ClassName=""TM.Shared.Components.KeyListFunctions"" />
  138. <ExtensionObject Namespace=""TM.Shared.Components.SSO""
  139. AssemblyName=""TM.Shared.Components, Version=3.0.37.0, Culture=neutral, PublicKeyToken=9cbf569b151cb1d4""
  140. ClassName=""TM.Shared.Components.SSOFunctions"" />
  141. <ExtensionObject Namespace=""TM.Shared.Components.String""
  142. AssemblyName=""TM.Shared.Components, Version=3.0.37.0, Culture=neutral, PublicKeyToken=9cbf569b151cb1d4""
  143. ClassName=""TM.Shared.Components.StringFunctions"" />
  144. <ExtensionObject Namespace=""TM.Bosman.Components.MSsql""
  145. AssemblyName=""TM.Bosman.Components, Version=3.0.0.0, Culture=neutral, PublicKeyToken=ef8f53020aeb0dca""
  146. ClassName=""TM.Bosman.Components.MSsql"" />
  147. <ExtensionObject Namespace=""TM.Bosman.Components.Logging""
  148. AssemblyName=""TM.Bosman.Components, Version=3.0.0.0, Culture=neutral, PublicKeyToken=ef8f53020aeb0dca""
  149. ClassName=""TM.Bosman.Components.Logging"" />
  150. </ExtensionObjects>";
  151. private const string _strSrcSchemasList0 = @"TM.Shared.Schemas.OrderStatus";
  152. private const global::TM.Shared.Schemas.OrderStatus _srcSchemaTypeReference0 = null;
  153. private const string _strTrgSchemasList0 = @"TM.Bosman.Schemas.EFACT_D96A_IFTSTA_BOSMAN";
  154. private const global::TM.Bosman.Schemas.EFACT_D96A_IFTSTA_BOSMAN _trgSchemaTypeReference0 = null;
  155. public override string XmlContent {
  156. get {
  157. return _strMap;
  158. }
  159. }
  160. public override int UseXSLTransform {
  161. get {
  162. return _useXSLTransform;
  163. }
  164. }
  165. public override string XsltArgumentListContent {
  166. get {
  167. return _strArgList;
  168. }
  169. }
  170. public override string[] SourceSchemas {
  171. get {
  172. string[] _SrcSchemas = new string [1];
  173. _SrcSchemas[0] = @"TM.Shared.Schemas.OrderStatus";
  174. return _SrcSchemas;
  175. }
  176. }
  177. public override string[] TargetSchemas {
  178. get {
  179. string[] _TrgSchemas = new string [1];
  180. _TrgSchemas[0] = @"TM.Bosman.Schemas.EFACT_D96A_IFTSTA_BOSMAN";
  181. return _TrgSchemas;
  182. }
  183. }
  184. }
  185. }