Conversie van de TransSmart solution van BizTalk 2013 naar 2016.
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

TM.Shared.OrderStatus_to_TM.TransSmart.Status.btm.cs 7.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. namespace TM.TransSmart.Transforms {
  2. [Microsoft.XLANGs.BaseTypes.SchemaReference(@"TM.Shared.Schemas_v19A.OrderStatus", typeof(global::TM.Shared.Schemas_v19A.OrderStatus))]
  3. [Microsoft.XLANGs.BaseTypes.SchemaReference(@"TM.TransSmart.Schemas.nShift+root", typeof(global::TM.TransSmart.Schemas.nShift.root))]
  4. public sealed class TM_Shared_OrderStatus_to_TM_TransSmart_Status : 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/v19A""
  12. xmlns:ns0=""http://TM.nShift.messages""
  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. <xsl:variable name=""connectionString"" select=""SSO:GetValue('TM.TransSmart', 'ESBLookupConnectionString')""/>
  17. <xsl:variable name =""sender"">
  18. <xsl:choose>
  19. <xsl:when test=""/s0:StatusReport/Sender='KLGEUEERSE01'"">KLE</xsl:when>
  20. <xsl:when test=""/s0:StatusReport/Sender='KLGEUVENLO01'"">KLG</xsl:when>
  21. <xsl:otherwise>KLG</xsl:otherwise>
  22. </xsl:choose>
  23. </xsl:variable>
  24. <!-- end region -->
  25. <!-- region templates -->
  26. <xsl:template match=""/"">
  27. <xsl:apply-templates select=""/s0:StatusReport"" />
  28. </xsl:template>
  29. <xsl:template match=""/s0:StatusReport"">
  30. <xsl:variable name=""currentDateTime"" select=""DateTime:GetCurrentDateTime()"" />
  31. <xsl:variable name=""currentDate"" select=""DateTime:GetCurrentDate()"" />
  32. <ns0:root>
  33. <ns0:status>
  34. <xsl:attribute name=""carrier"">
  35. <xsl:value-of select=""$sender"" />
  36. </xsl:attribute>
  37. <xsl:for-each select=""Status"">
  38. <ns0:shipment>
  39. <ns0:lineNo>
  40. <xsl:number/>
  41. </ns0:lineNo>
  42. <ns0:statusTimeStamp>
  43. <xsl:value-of select=""DateTime:FormatDateTime(/s0:StatusReport/TimeStamp, 'yyyy-MM-ddTHH:mm:ss', 'yyyyMMddHHmmss', 'statusTimeStamp')""/>
  44. </ns0:statusTimeStamp>
  45. <ns0:reference>
  46. <xsl:value-of select=""ShipmentReference""/>
  47. </ns0:reference>
  48. <xsl:if test=""StatusCode='DELIVERED'"">
  49. <ns0:deliveryDate>
  50. <xsl:value-of select=""DateTime:FormatDateTime(StatusTimeStamp, 'yyyy-MM-ddTHH:mm:ss', 'yyyyMMdd', 'statusTimeStamp')""/>
  51. </ns0:deliveryDate>
  52. <ns0:deliveryTime>
  53. <xsl:value-of select=""DateTime:FormatDateTime(StatusTimeStamp, 'yyyy-MM-ddTHH:mm:ss', 'HHmmss', 'statusTimeStamp')""/>
  54. </ns0:deliveryTime>
  55. </xsl:if>
  56. <ns0:shipmentStatus>
  57. <xsl:choose>
  58. <xsl:when test=""StatusCode='DELIVERED'"">
  59. <xsl:text>DONE</xsl:text>
  60. </xsl:when>
  61. <xsl:when test=""StatusCode='DELIVERY' and ReasonCode='TRANSIT'"">
  62. <xsl:text>TRNS</xsl:text>
  63. </xsl:when>
  64. <xsl:otherwise>TRNS</xsl:otherwise>
  65. </xsl:choose>
  66. </ns0:shipmentStatus>
  67. <ns0:carrierStatusCode>
  68. <xsl:value-of select=""StatusCode""/>
  69. <xsl:text> </xsl:text>
  70. <xsl:value-of select=""ReasonCode""/>
  71. </ns0:carrierStatusCode>
  72. </ns0:shipment>
  73. </xsl:for-each>
  74. </ns0:status>
  75. </ns0:root>
  76. </xsl:template>
  77. <!-- end region -->
  78. <xsl:variable name=""dbClose"" select=""ScriptNS0:DBLookupShutdown()""/>
  79. </xsl:stylesheet>";
  80. private const int _useXSLTransform = 0;
  81. private const string _strArgList = @"<ExtensionObjects>
  82. <ExtensionObject Namespace=""http://schemas.microsoft.com/BizTalk/2003/ScriptNS0""
  83. AssemblyName=""Microsoft.BizTalk.BaseFunctoids, Version=3.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35""
  84. ClassName=""Microsoft.BizTalk.BaseFunctoids.FunctoidScripts"" />
  85. <ExtensionObject Namespace=""http://schemas.microsoft.com/BizTalk/2003/ScriptNS1""
  86. AssemblyName=""Microsoft.BizTalk.CrossReferencing, Version=3.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35""
  87. ClassName=""Microsoft.BizTalk.CrossReferencing.CrossReferencing"" />
  88. <ExtensionObject Namespace=""TM.Shared.Components.DateTime""
  89. AssemblyName=""TM.Shared.Components, Version=1.0.7.0, Culture=neutral, PublicKeyToken=9cbf569b151cb1d4""
  90. ClassName=""TM.Shared.Components.DateTimeFunctions"" />
  91. <ExtensionObject Namespace=""TM.Shared.Components.KeyList""
  92. AssemblyName=""TM.Shared.Components, Version=1.0.7.0, Culture=neutral, PublicKeyToken=9cbf569b151cb1d4""
  93. ClassName=""TM.Shared.Components.KeyListFunctions"" />
  94. <ExtensionObject Namespace=""TM.Shared.Components.SSO""
  95. AssemblyName=""TM.Shared.Components, Version=1.0.7.0, Culture=neutral, PublicKeyToken=9cbf569b151cb1d4""
  96. ClassName=""TM.Shared.Components.SSOFunctions"" />
  97. <ExtensionObject Namespace=""TM.Shared.Components.String""
  98. AssemblyName=""TM.Shared.Components, Version=1.0.7.0, Culture=neutral, PublicKeyToken=9cbf569b151cb1d4""
  99. ClassName=""TM.Shared.Components.StringFunctions"" />
  100. <ExtensionObject Namespace=""TM.TransSmart.Components""
  101. AssemblyName=""TM.TransSmart.Components, Version=1.0.1.0, Culture=neutral, PublicKeyToken=089e5464cda5fc95""
  102. ClassName=""TM.TransSmart.Components.Helper"" />
  103. </ExtensionObjects>";
  104. private const string _strSrcSchemasList0 = @"TM.Shared.Schemas_v19A.OrderStatus";
  105. private const global::TM.Shared.Schemas_v19A.OrderStatus _srcSchemaTypeReference0 = null;
  106. private const string _strTrgSchemasList0 = @"TM.TransSmart.Schemas.nShift+root";
  107. private const global::TM.TransSmart.Schemas.nShift.root _trgSchemaTypeReference0 = null;
  108. public override string XmlContent {
  109. get {
  110. return _strMap;
  111. }
  112. }
  113. public override int UseXSLTransform {
  114. get {
  115. return _useXSLTransform;
  116. }
  117. }
  118. public override string XsltArgumentListContent {
  119. get {
  120. return _strArgList;
  121. }
  122. }
  123. public override string[] SourceSchemas {
  124. get {
  125. string[] _SrcSchemas = new string [1];
  126. _SrcSchemas[0] = @"TM.Shared.Schemas_v19A.OrderStatus";
  127. return _SrcSchemas;
  128. }
  129. }
  130. public override string[] TargetSchemas {
  131. get {
  132. string[] _TrgSchemas = new string [1];
  133. _TrgSchemas[0] = @"TM.TransSmart.Schemas.nShift+root";
  134. return _TrgSchemas;
  135. }
  136. }
  137. }
  138. }