//----------------------------------------------------------------------------------------------------- public FileAnalysis Func_CWO_XUS_SHP_X12_310_GLO( string filename, string fileOut, string filePrs, string fileErr) { this.FileStatus = new FileAnalysis(); if (File.Exists(filename)) { var controlNum = this.Func_SQL_GetControlNumber(); var doc = new XmlDocument(); doc.Load(filename); XmlNode root = doc.DocumentElement; var nsmgr = new XmlNamespaceManager(doc.NameTable); nsmgr.AddNamespace("ns", "http://www.cargowise.com/Schemas/Universal/2011/11"); var myInterchange = new MyINT(controlNum, "12", "3023254180", "ZZ", "FMXJ310", true); var myGroup = myInterchange.CreateGroup(controlNum, "IO", "3023254180", "FMXJ310"); var myMessage = new X12_4010_310(controlNum); var statusCode = this.Func_XML_GetResultString(doc, nsmgr, @"//ns:ActionPurpose/ns:Code"); if (statusCode == "INV") { var invTerms = this.Func_XML_GetResultString( doc, nsmgr, @"//ns:ShipmentCollection/ns:Shipment/ns:PaymentMethod/ns:Code"); var invCode = new X12_ID_146(); invCode = invTerms == "PPD" ? X12_ID_146.PP : X12_ID_146.CC; var invAmnt = this.Func_XML_GetResultString(doc, nsmgr, @"//ns:LocalTotal"); invAmnt = invAmnt.Substring(0, invAmnt.Length - 2).Replace(".", string.Empty); myMessage.Add_B3( this.Func_XML_GetResultString(doc, nsmgr, @"//ns:Number"), this.Func_XML_GetResultString(doc, nsmgr, @"//ns:TransactionInfo/ns:Description"), invCode, this.Func_XML_GetResultDate(doc, nsmgr, @"//ns:TransactionDate"), invAmnt, "WINA", this.Func_XML_GetResultDate(doc, nsmgr, @"//ns:DueDate")); myMessage.Add_B2A(X12_ID_353.Item00, X12_ID_346.BN); var refList = doc.SelectNodes( @"//ns:SubShipmentCollection/ns:SubShipment/ns:AdditionalReferenceCollection/ns:AdditionalReference/ns:Type/ns:Code", nsmgr); if (refList != null && refList.Count > 0) { foreach (XmlNode refItem in refList) { switch (refItem.InnerText) { case "LID": { myMessage.Add_N9( EdiFabric.Definitions.X12_004010_310.X12_ID_128.OL, this.Func_XML_GetResultString( doc, nsmgr, @"//ns:SubShipmentCollection/ns:SubShipment/ns:AdditionalReferenceCollection/ns:AdditionalReference/ns:Type[ns:Code='LID']/parent::ns:AdditionalReference/ns:ReferenceNumber"), this.Func_XML_GetResultString( doc, nsmgr, @"//ns:SubShipmentCollection/ns:SubShipment/ns:AdditionalReferenceCollection/ns:AdditionalReference/ns:Type[ns:Code='LID']/parent::ns:AdditionalReference/ns:ContextInformation")); } break; case "BKG": { myMessage.Add_N9( EdiFabric.Definitions.X12_004010_310.X12_ID_128.MB, this.Func_XML_GetResultString( doc, nsmgr, @"//ns:SubShipmentCollection/ns:SubShipment/ns:AdditionalReferenceCollection/ns:AdditionalReference/ns:Type[ns:Code='BKG']/parent::ns:AdditionalReference/ns:ReferenceNumber"), this.Func_XML_GetResultString( doc, nsmgr, @"//ns:SubShipmentCollection/ns:SubShipment/ns:AdditionalReferenceCollection/ns:AdditionalReference/ns:Type[ns:Code='BKG']/parent::ns:AdditionalReference/ns:ContextInformation")); } break; case "UCR": { myMessage.Add_N9( EdiFabric.Definitions.X12_004010_310.X12_ID_128.SI, this.Func_XML_GetResultString( doc, nsmgr, @"//ns:SubShipmentCollection/ns:SubShipment/ns:AdditionalReferenceCollection/ns:AdditionalReference/ns:Type[ns:Code='UCR']/parent::ns:AdditionalReference/ns:ReferenceNumber"), this.Func_XML_GetResultString( doc, nsmgr, @"//ns:SubShipmentCollection/ns:SubShipment/ns:AdditionalReferenceCollection/ns:AdditionalReference/ns:Type[ns:Code='UCR']/parent::ns:AdditionalReference/ns:ContextInformation")); } break; case "CON": { myMessage.Add_N9( EdiFabric.Definitions.X12_004010_310.X12_ID_128.TS, this.Func_XML_GetResultString( doc, nsmgr, @"//ns:SubShipmentCollection/ns:SubShipment/ns:AdditionalReferenceCollection/ns:AdditionalReference/ns:Type[ns:Code='CON']/parent::ns:AdditionalReference/ns:ReferenceNumber"), this.Func_XML_GetResultString( doc, nsmgr, @"//ns:SubShipmentCollection/ns:SubShipment/ns:AdditionalReferenceCollection/ns:AdditionalReference/ns:Type[ns:Code='CON']/parent::ns:AdditionalReference/ns:ContextInformation")); } break; case "OAG": { myMessage.Add_N9( EdiFabric.Definitions.X12_004010_310.X12_ID_128.FN, this.Func_XML_GetResultString( doc, nsmgr, @"//ns:SubShipmentCollection/ns:SubShipment/ns:AdditionalReferenceCollection/ns:AdditionalReference/ns:Type[ns:Code='OAG']/parent::ns:AdditionalReference/ns:ReferenceNumber"), this.Func_XML_GetResultString( doc, nsmgr, @"//ns:SubShipmentCollection/ns:SubShipment/ns:AdditionalReferenceCollection/ns:AdditionalReference/ns:Type[ns:Code='OAG']/parent::ns:AdditionalReference/ns:ContextInformation")); } break; } } } myMessage.Add_N9( EdiFabric.Definitions.X12_004010_310.X12_ID_128.BN, this.Func_XML_GetResultString( doc, nsmgr, @"//ns:Shipment/ns:WayBillNumber"), ""); myMessage.Add_N9( EdiFabric.Definitions.X12_004010_310.X12_ID_128.FN, this.Func_XML_GetResultString( doc, nsmgr, @"//ns:Shipment/ns:DataContext/ns:DataSourceCollection/ns:DataSource[ns:Type='ForwardingShipment']/ns:Key"), ""); myMessage.Add_N9( EdiFabric.Definitions.X12_004010_310.X12_ID_128.X9, this.Func_XML_GetResultString( doc, nsmgr, @"//ns:SubShipmentCollection/ns:SubShipment/ns:WayBillNumber"), ""); myMessage.Add_N9( EdiFabric.Definitions.X12_004010_310.X12_ID_128.IV, this.Func_XML_GetResultString( doc, nsmgr, @"//ns:Number"), ""); myMessage.Add_N9( EdiFabric.Definitions.X12_004010_310.X12_ID_128.VR, this.Func_XML_GetResultString( doc, nsmgr, @"//ns:DataProvider"), ""); var ordList = doc.SelectNodes( @"//ns:SubShipmentCollection/ns:SubShipment/ns:LocalProcessing/ns:OrderNumberCollection/ns:OrderNumber", nsmgr); if (ordList != null && ordList.Count > 0) { int intCnt = 1; foreach (XmlNode ordItem in ordList) { myMessage.Add_N9( EdiFabric.Definitions.X12_004010_310.X12_ID_128.PO, this.Func_XML_GetResultString( doc, nsmgr, @"//ns:SubShipmentCollection/ns:SubShipment/ns:LocalProcessing/ns:OrderNumberCollection/ns:OrderNumber[" + intCnt.ToString() + "]/ns:OrderReference"), ""); intCnt += 1; } } var transLeg = this.Func_XML_GetResultCount( doc, nsmgr, @"//ns:SubShipment/ns:TransportLegCollection/ns:TransportLeg"); for (var i = 1; i <= transLeg; i++) { myMessage.Add_V1( this.Func_XML_GetResultString( doc, nsmgr, @"//ns:SubShipment/ns:TransportLegCollection/ns:TransportLeg[ns:LegOrder=" + i + "]/ns:VesselName"), this.Func_XML_GetResultString( doc, nsmgr, @"//ns:SubShipment/ns:TransportLegCollection/ns:TransportLeg[ns:LegOrder=" + i + "]/ns:VoyageFlightNo"), this.Func_XML_GetResultString( doc, nsmgr, @"//SubShipment/TransportLegCollection/TransportLeg[LegOrder=" + i + "]/Carrier/RegistrationNumberCollection/RegistrationNumber/Type[Code='CCC']/parent::RegistrationNumber/Value")); } var dtmR4R = new List<S_DTM>(); var estR = new S_DTM { D_374_1 = X12_ID_374.Item139, D_373_2 = this.Func_XML_GetResultDate( doc, nsmgr, @"//ns:SubShipment/ns:DateCollection/ns:Date[ns:Type='Departure']/ns:Value/parent::ns:Date[ns:IsEstimate='true']/ns:Value"), D_337_3 = this.Func_XML_GetResultTime( doc, nsmgr, @"//ns:SubShipment/ns:DateCollection/ns:Date[ns:Type='Departure']/ns:Value/parent::ns:Date[ns:IsEstimate='true']/ns:Value"), D_623_4 = EdiFabric.Definitions.X12_004010_310.X12_ID_623.LT, D_623_4Specified = true }; if (estR.D_373_2 != string.Empty && estR.D_337_3 != string.Empty) { dtmR4R.Add(estR); } var actR = new S_DTM { D_374_1 = X12_ID_374.Item140, D_373_2 = this.Func_XML_GetResultDate( doc, nsmgr, @"//ns:SubShipment/ns:TransportLegCollection/ns:TransportLeg[ns:LegOrder=1]/ns:ActualDeparture"), D_337_3 = this.Func_XML_GetResultTime( doc, nsmgr, @"//ns:SubShipment/ns:TransportLegCollection/ns:TransportLeg[ns:LegOrder=1]/ns:ActualDeparture"), D_623_4 = EdiFabric.Definitions.X12_004010_310.X12_ID_623.LT, D_623_4Specified = true }; if (actR.D_373_2 != string.Empty && actR.D_337_3 != string.Empty) { dtmR4R.Add(actR); } myMessage.Add_R4( EdiFabric.Definitions.X12_004010_310.X12_ID_115.R, EdiFabric.Definitions.X12_004010_310.X12_ID_309.UN, this.Func_XML_GetResultString(doc, nsmgr, @"//ns:SubShipment/ns:PortOfOrigin/ns:Code"), this.Func_XML_GetResultString(doc, nsmgr, @"//ns:SubShipment/ns:PortOfOrigin/ns:Name"), this.Func_XML_GetResultString(doc, nsmgr, @"//ns:SubShipment/ns:PortOfOrigin/ns:Code") .Substring(0, 2), dtmR4R); var dtmR4E = new List<S_DTM>(); var estE = new S_DTM { D_374_1 = X12_ID_374.Item139, D_373_2 = this.Func_XML_GetResultDate( doc, nsmgr, @"//ns:SubShipment/ns:DateCollection/ns:Date[ns:Type='Arrival']/ns:Value/parent::ns:Date[ns:IsEstimate='true']/ns:Value"), D_337_3 = this.Func_XML_GetResultTime( doc, nsmgr, @"//ns:SubShipment/ns:DateCollection/ns:Date[ns:Type='Arrival']/ns:Value/parent::ns:Date[ns:IsEstimate='true']/ns:Value"), D_623_4 = EdiFabric.Definitions.X12_004010_310.X12_ID_623.LT, D_623_4Specified = true }; if (estE.D_373_2 != string.Empty && estE.D_337_3 != string.Empty) { dtmR4E.Add(estE); } var actE = new S_DTM { D_374_1 = X12_ID_374.Item140, D_373_2 = this.Func_XML_GetResultDate( doc, nsmgr, @"//ns:SubShipment/ns:TransportLegCollection/ns:TransportLeg[ns:LegOrder=" + transLeg + "]/ns:ActualArrival"), D_337_3 = this.Func_XML_GetResultTime( doc, nsmgr, @"//ns:SubShipment/ns:TransportLegCollection/ns:TransportLeg[ns:LegOrder=" + transLeg + "]/ns:ActualArrival"), D_623_4 = EdiFabric.Definitions.X12_004010_310.X12_ID_623.LT, D_623_4Specified = true }; if (actE.D_373_2 != string.Empty && actE.D_337_3 != string.Empty) { dtmR4E.Add(actE); } myMessage.Add_R4( EdiFabric.Definitions.X12_004010_310.X12_ID_115.E, EdiFabric.Definitions.X12_004010_310.X12_ID_309.UN, this.Func_XML_GetResultString(doc, nsmgr, @"//ns:SubShipment/ns:PortOfDestination/ns:Code"), this.Func_XML_GetResultString(doc, nsmgr, @"//ns:SubShipment/ns:PortOfDestination/ns:Name"), this.Func_XML_GetResultString(doc, nsmgr, @"//ns:SubShipment/ns:PortOfDestination/ns:Code") .Substring(0, 2), dtmR4E); var dtmR4L = new List<S_DTM>(); var estL = new S_DTM { D_374_1 = X12_ID_374.Item139, D_373_2 = this.Func_XML_GetResultDate( doc, nsmgr, @"//ns:SubShipment/ns:TransportLegCollection/ns:TransportLeg[ns:LegOrder=1]/ns:EstimatedDeparture"), D_337_3 = this.Func_XML_GetResultTime( doc, nsmgr, @"//ns:SubShipment/ns:TransportLegCollection/ns:TransportLeg[ns:LegOrder=1]/ns:EstimatedDeparture"), D_623_4 = EdiFabric.Definitions.X12_004010_310.X12_ID_623.LT, D_623_4Specified = true }; if (estL.D_373_2 != string.Empty && estL.D_337_3 != string.Empty) { dtmR4L.Add(estL); } var actL = new S_DTM { D_374_1 = X12_ID_374.Item140, D_373_2 = this.Func_XML_GetResultDate( doc, nsmgr, @"//ns:SubShipment/ns:TransportLegCollection/ns:TransportLeg[ns:LegOrder=" + transLeg + "]/ns:ActualDeparture"), D_337_3 = this.Func_XML_GetResultTime( doc, nsmgr, @"//ns:SubShipment/ns:TransportLegCollection/ns:TransportLeg[ns:LegOrder=" + transLeg + "]/ns:ActualDeparture"), D_623_4 = EdiFabric.Definitions.X12_004010_310.X12_ID_623.LT, D_623_4Specified = true }; if (actL.D_373_2 != string.Empty && actL.D_337_3 != string.Empty) { dtmR4L.Add(actL); } myMessage.Add_R4( EdiFabric.Definitions.X12_004010_310.X12_ID_115.L, EdiFabric.Definitions.X12_004010_310.X12_ID_309.UN, this.Func_XML_GetResultString( doc, nsmgr, @"//ns:SubShipmentCollection/ns:SubShipment/ns:TransportLegCollection/ns:TransportLeg[ns:LegOrder=1]/ns:PortOfLoading/ns:Code"), this.Func_XML_GetResultString( doc, nsmgr, @"//ns:SubShipmentCollection/ns:SubShipment/ns:TransportLegCollection/ns:TransportLeg[ns:LegOrder=1]/ns:PortOfLoading/ns:Name"), this.Func_XML_GetResultString( doc, nsmgr, @"//ns:SubShipmentCollection/ns:SubShipment/ns:TransportLegCollection/ns:TransportLeg[ns:LegOrder=1]/ns:PortOfLoading/ns:Code") .Substring(0, 2), dtmR4L); var dtmR4D = new List<S_DTM>(); var estD = new S_DTM { D_374_1 = X12_ID_374.Item139, D_373_2 = this.Func_XML_GetResultDate( doc, nsmgr, @"//ns:SubShipment/ns:TransportLegCollection/ns:TransportLeg[ns:LegOrder=" + transLeg + "]/ns:EstimatedArrival"), D_337_3 = this.Func_XML_GetResultTime( doc, nsmgr, @"//ns:SubShipment/ns:TransportLegCollection/ns:TransportLeg[ns:LegOrder=" + transLeg + "]/ns:EstimatedArrival"), D_623_4 = EdiFabric.Definitions.X12_004010_310.X12_ID_623.LT, D_623_4Specified = true }; if (estD.D_373_2 != string.Empty && estD.D_337_3 != string.Empty) { dtmR4D.Add(estD); } var actD = new S_DTM { D_374_1 = X12_ID_374.Item140, D_337_3 = this.Func_XML_GetResultTime( doc, nsmgr, @"//ns:SubShipment/ns:TransportLegCollection/ns:TransportLeg[ns:LegOrder=" + transLeg + "]/ns:ActualArrival"), D_373_2 = this.Func_XML_GetResultDate( doc, nsmgr, @"//ns:SubShipment/ns:TransportLegCollection/ns:TransportLeg[ns:LegOrder=" + transLeg + "]/ns:ActualArrival"), D_623_4 = EdiFabric.Definitions.X12_004010_310.X12_ID_623.LT, D_623_4Specified = true }; if (actD.D_373_2 != string.Empty && actD.D_337_3 != string.Empty) { dtmR4D.Add(actD); } myMessage.Add_R4( EdiFabric.Definitions.X12_004010_310.X12_ID_115.D, EdiFabric.Definitions.X12_004010_310.X12_ID_309.UN, this.Func_XML_GetResultString( doc, nsmgr, @"//ns:SubShipmentCollection/ns:SubShipment/ns:TransportLegCollection/ns:TransportLeg[ns:LegOrder=" + transLeg + "]/ns:PortOfDischarge/ns:Code"), this.Func_XML_GetResultString( doc, nsmgr, @"//ns:SubShipmentCollection/ns:SubShipment/ns:TransportLegCollection/ns:TransportLeg[ns:LegOrder=" + transLeg + "]/ns:PortOfDischarge/ns:Name"), this.Func_XML_GetResultString( doc, nsmgr, @"//ns:SubShipmentCollection/ns:SubShipment/ns:TransportLegCollection/ns:TransportLeg[ns:LegOrder=" + transLeg + "]/ns:PortOfDischarge/ns:Code").Substring(0, 2), dtmR4D); myMessage.Add_LX(doc, nsmgr); myMessage.Add_L3( this.Func_XML_GetResultString( doc, nsmgr, @"//ns:ShipmentCollection/ns:Shipment/ns:DocumentedWeight"), invAmnt, this.Func_XML_GetResultString( doc, nsmgr, @"//ns:ShipmentCollection/ns:Shipment/ns:DocumentedVolume"), this.Func_XML_GetResultString( doc, nsmgr, @"//ns:ShipmentCollection/ns:Shipment/ns:DocumentedChargeable")); myGroup.AddMessage(myMessage.m310); myInterchange.SaveEdi( string.Concat(fileOut, "\\", Path.GetFileNameWithoutExtension(filename), ".edi")); //this.FileStatus.HasError = // Func_File_Validate( // string.Concat(fileOut, "\\", Path.GetFileNameWithoutExtension(filename), ".edi")); if (!this.FileStatus.HasError) { this.Func_SQL_SubmitControlNumber( controlNum, "310GLO", string.Concat(fileOut, "\\", Path.GetFileNameWithoutExtension(filename), ".edi")); Func_File_Move(filename, string.Concat(filePrs, "\\", Path.GetFileName(filename))); this.FileStatus.Created = true; this.FileStatus.Status = true; this.FileStatus.FileOutName = string.Concat( fileOut, "\\", Path.GetFileNameWithoutExtension(filename), ".edi"); } else { Func_File_Move( string.Concat(fileOut, "\\", Path.GetFileNameWithoutExtension(filename), ".edi"), string.Concat(fileErr, "\\", Path.GetFileNameWithoutExtension(filename), ".edi")); Func_File_Move(filename, string.Concat(fileErr, "\\", Path.GetFileName(filename))); this.FileStatus.Created = false; this.FileStatus.Status = false; this.FileStatus.FileErrName = string.Concat(fileOut, "\\", Path.GetFileName(filename)); } } } return this.FileStatus; }
//----------------------------------------------------------------------------------------------------- public FileAnalysis Func_CWO_XUS_SHP_X12_301_GLO( string filename, string fileOut, string filePrs, string fileErr, X12_ID_558 codeX12Id558) { this.FileStatus = new FileAnalysis(); if (File.Exists(filename)) { var controlNum = this.Func_SQL_GetControlNumber(); var doc = new XmlDocument(); doc.Load(filename); XmlNode root = doc.DocumentElement; var nsmgr = new XmlNamespaceManager(doc.NameTable); nsmgr.AddNamespace("ns", "http://www.cargowise.com/Schemas/Universal/2011/11"); var bookingConfirmed = DateTime.Parse( this.Func_XML_GetResultString( doc, nsmgr, @"//ns:EventType[ns:Code='ATC']/parent::ns:DataContext/ns:TriggerDate")); var myInterchange = new MyINT(controlNum, "12", "3023254180", "ZZ", "FMXJ301", true); var myGroup = myInterchange.CreateGroup(controlNum, "RO", "3023254180", "FMXJ301"); var myMessage = new X12_4010_301( controlNum, this.Func_XML_GetResultString(doc, nsmgr, @"//ns:SubShipment/ns:WayBillNumber"), bookingConfirmed); var svl = this.Func_SQL_TranslateCWOTariffServiceLevel( this.Func_XML_GetResultString(doc, nsmgr, @"//ns:ServiceLevel/ns:Code")).Trim(); var SvcLvl = X12_ID_375.Item1A; if (svl.Any()) { switch (svl) { case "DD": { SvcLvl = X12_ID_375.DD; } break; case "DP": { SvcLvl = X12_ID_375.DP; } break; case "PD": { SvcLvl = X12_ID_375.PD; } break; case "PP": { SvcLvl = X12_ID_375.PP; } break; } } myMessage.Add_Y3( this.Func_XML_GetResultString( doc, nsmgr, @"/ns:UniversalInterchange/ns:Body/ns:UniversalShipment/ns:Shipment/ns:BookingConfirmationReference"), this.Func_XML_GetResultDate( doc, nsmgr, @"//ns:SubShipmentCollection/ns:SubShipment/ns:DateCollection/ns:Date[ns:Type='Departure'][ns:IsEstimate='true']/ns:Value"), this.Func_XML_GetResultDate( doc, nsmgr, @"//ns:SubShipmentCollection/ns:SubShipment/ns:DateCollection/ns:Date[ns:Type='Arrival'][ns:IsEstimate='true']/ns:Value"), this.Func_XML_GetResultDate( doc, nsmgr, @"/ns:UniversalInterchange/ns:Body/ns:UniversalShipment/ns:Shipment/ns:TransportLegCollection/ns:TransportLeg[ns:LegOrder='1']/ns:FCLCutOff"), this.Func_XML_GetResultTime( doc, nsmgr, @"/ns:UniversalInterchange/ns:Body/ns:UniversalShipment/ns:Shipment/ns:ContainerCollection/ns:Container/ns:DepartureSlotDateTime"), SvcLvl, "WINA", string.Empty, string.Empty, X12_ID_91.O, X12_ID_623.LT); myMessage.Add_Y4( this.Func_XML_GetResultString( doc, nsmgr, @"/ns:UniversalInterchange/ns:Body/ns:UniversalShipment/ns:Shipment/ns:BookingConfirmationReference"), this.Func_XML_GetResultDate( doc, nsmgr, @"//ns:SubShipmentCollection/ns:SubShipment/ns:LocalProcessing/ns:EstimatedPickup"), this.Func_XML_GetResultString( doc, nsmgr, @"//ns:SubShipmentCollection/ns:SubShipment/ns:ContainerCollection/ns:Container/ns:ContainerType/ns:ISOCode"), int.Parse( this.Func_XML_GetResultString( doc, nsmgr, @"//ns:SubShipmentCollection/ns:SubShipment/ns:ContainerCount"))); var refList = doc.SelectNodes( @"//ns:SubShipmentCollection/ns:SubShipment/ns:AdditionalReferenceCollection/ns:AdditionalReference/ns:Type/ns:Code", nsmgr); if (refList != null && refList.Count > 0) { foreach (XmlNode refItem in refList) { switch (refItem.InnerText) { case "LID": { myMessage.Add_N9( X12_ID_128.OL, this.Func_XML_GetResultString( doc, nsmgr, @"//ns:SubShipmentCollection/ns:SubShipment/ns:AdditionalReferenceCollection/ns:AdditionalReference/ns:Type[ns:Code='LID']/parent::ns:AdditionalReference/ns:ReferenceNumber"), this.Func_XML_GetResultString( doc, nsmgr, @"//ns:SubShipmentCollection/ns:SubShipment/ns:AdditionalReferenceCollection/ns:AdditionalReference/ns:Type[ns:Code='LID']/parent::ns:AdditionalReference/ns:ContextInformation")); } break; case "BKG": { myMessage.Add_N9( X12_ID_128.MB, this.Func_XML_GetResultString( doc, nsmgr, @"//ns:SubShipmentCollection/ns:SubShipment/ns:AdditionalReferenceCollection/ns:AdditionalReference/ns:Type[ns:Code='BKG']/parent::ns:AdditionalReference/ns:ReferenceNumber"), this.Func_XML_GetResultString( doc, nsmgr, @"//ns:SubShipmentCollection/ns:SubShipment/ns:AdditionalReferenceCollection/ns:AdditionalReference/ns:Type[ns:Code='BKG']/parent::ns:AdditionalReference/ns:ContextInformation")); } break; case "UCR": { myMessage.Add_N9( X12_ID_128.SI, this.Func_XML_GetResultString( doc, nsmgr, @"//ns:SubShipmentCollection/ns:SubShipment/ns:AdditionalReferenceCollection/ns:AdditionalReference/ns:Type[ns:Code='UCR']/parent::ns:AdditionalReference/ns:ReferenceNumber"), this.Func_XML_GetResultString( doc, nsmgr, @"//ns:SubShipmentCollection/ns:SubShipment/ns:AdditionalReferenceCollection/ns:AdditionalReference/ns:Type[ns:Code='UCR']/parent::ns:AdditionalReference/ns:ContextInformation")); } break; case "CON": { myMessage.Add_N9( X12_ID_128.TS, this.Func_XML_GetResultString( doc, nsmgr, @"//ns:SubShipmentCollection/ns:SubShipment/ns:AdditionalReferenceCollection/ns:AdditionalReference/ns:Type[ns:Code='CON']/parent::ns:AdditionalReference/ns:ReferenceNumber"), this.Func_XML_GetResultString( doc, nsmgr, @"//ns:SubShipmentCollection/ns:SubShipment/ns:AdditionalReferenceCollection/ns:AdditionalReference/ns:Type[ns:Code='CON']/parent::ns:AdditionalReference/ns:ContextInformation")); } break; case "OAG": { myMessage.Add_N9( X12_ID_128.FN, this.Func_XML_GetResultString( doc, nsmgr, @"//ns:SubShipmentCollection/ns:SubShipment/ns:AdditionalReferenceCollection/ns:AdditionalReference/ns:Type[ns:Code='OAG']/parent::ns:AdditionalReference/ns:ReferenceNumber"), this.Func_XML_GetResultString( doc, nsmgr, @"//ns:SubShipmentCollection/ns:SubShipment/ns:AdditionalReferenceCollection/ns:AdditionalReference/ns:Type[ns:Code='OAG']/parent::ns:AdditionalReference/ns:ContextInformation")); } break; } } } myMessage.Add_R4( X12_ID_115.R, X12_ID_309.UN, this.Func_XML_GetResultString( doc, nsmgr, @"//ns:SubShipmentCollection/ns:SubShipment/ns:PortOfOrigin/ns:Code"), this.Func_XML_GetResultString( doc, nsmgr, @"//ns:SubShipmentCollection/ns:SubShipment/ns:PortOfOrigin/ns:Name"), string.Empty, string.Empty); myMessage.Add_R4( X12_ID_115.L, X12_ID_309.UN, this.Func_XML_GetResultString( doc, nsmgr, @"//ns:SubShipmentCollection/ns:SubShipment/ns:PortOfLoading/ns:Code"), this.Func_XML_GetResultString( doc, nsmgr, @"//ns:SubShipmentCollection/ns:SubShipment/ns:PortOfLoading/ns:Name"), string.Empty, string.Empty); myMessage.Add_R4( X12_ID_115.D, X12_ID_309.UN, this.Func_XML_GetResultString( doc, nsmgr, @"//ns:SubShipmentCollection/ns:SubShipment/ns:PortOfDischarge/ns:Code"), this.Func_XML_GetResultString( doc, nsmgr, @"//ns:SubShipmentCollection/ns:SubShipment/ns:PortOfDischarge/ns:Name"), string.Empty, string.Empty); myMessage.Add_R4( X12_ID_115.E, X12_ID_309.UN, this.Func_XML_GetResultString( doc, nsmgr, @"//ns:SubShipmentCollection/ns:SubShipment/ns:PortOfDestination/ns:Code"), this.Func_XML_GetResultString( doc, nsmgr, @"//ns:SubShipmentCollection/ns:SubShipment/ns:PortOfDestination/ns:Name"), string.Empty, string.Empty); myMessage.Add_LX("1"); myMessage.Add_V1( this.Func_XML_GetResultString( doc, nsmgr, @"/ns:UniversalInterchange/ns:Body/ns:UniversalShipment/ns:Shipment/ns:VesselName"), this.Func_XML_GetResultString( doc, nsmgr, @"/ns:UniversalInterchange/ns:Body/ns:UniversalShipment/ns:Shipment/ns:VoyageFlightNo"), this.Func_XML_GetResultString( doc, nsmgr, @"//ns:SubShipment/ns:TransportLegCollection/ns:TransportLeg/ns:Carrier/ns:RegistrationNumberCollection/ns:RegistrationNumber/ns:Type[ns:Code='CCC']/parent::ns:RegistrationNumber/ns:Value"), X12_ID_854.GC); myGroup.AddMessage(myMessage.m301); myInterchange.SaveEdi(string.Concat(fileOut, "\\", Path.GetFileNameWithoutExtension(filename), ".edi")); this.FileStatus.HasError = Func_File_Validate(string.Concat(fileOut, "\\", Path.GetFileNameWithoutExtension(filename), ".edi")); if (!this.FileStatus.HasError) { this.Func_SQL_SubmitControlNumber( controlNum, "301GLO", string.Concat(fileOut, "\\", Path.GetFileNameWithoutExtension(filename), ".edi")); Func_File_Move(filename, string.Concat(filePrs, "\\", Path.GetFileName(filename))); this.FileStatus.Created = true; this.FileStatus.Status = true; this.FileStatus.FileOutName = string.Concat( fileOut, "\\", Path.GetFileNameWithoutExtension(filename), ".edi"); } else { Func_File_Move( string.Concat(fileOut, "\\", Path.GetFileNameWithoutExtension(filename), ".edi"), string.Concat(fileErr, "\\", Path.GetFileNameWithoutExtension(filename), ".edi")); Func_File_Move(filename, string.Concat(fileErr, "\\", Path.GetFileName(filename))); this.FileStatus.Created = false; this.FileStatus.Status = false; this.FileStatus.FileErrName = string.Concat(fileOut, "\\", Path.GetFileName(filename)); } } return this.FileStatus; }
//----------------------------------------------------------------------------------------------------- public FileAnalysis Func_CWO_XUS_SHP_X12_990_GLO( string filename, string fileOut, string filePrs, string fileErr) { this.FileStatus = new FileAnalysis(); if (File.Exists(filename)) { var controlNum = this.Func_SQL_GetControlNumber(); var doc = new XmlDocument(); doc.Load(filename); XmlNode root = doc.DocumentElement; var nsmgr = new XmlNamespaceManager(doc.NameTable); nsmgr.AddNamespace("ns", "http://www.cargowise.com/Schemas/Universal/2011/11"); var myInterchange = new MyINT(controlNum, "12", "3023254180", "ZZ", "FMXJ990", true); var myGroup = myInterchange.CreateGroup(controlNum, "GF", "3023254180", "FMXJ990"); var myMessage = new X12_4010_990(controlNum); myMessage.Add_B1_A( "WINA", this.Func_XML_GetResultString( doc, nsmgr, @"//ns:SubShipmentCollection/ns:SubShipment/ns:WayBillNumber"), DateTime.Now); myMessage.Add_N9(this.Func_XML_GetResultString(doc, nsmgr, @"//ns:Shipment/ns:DataContext/ns:DataSourceCollection/ns:DataSource[ns:Type='ForwardingShipment']/ns:Key")); myGroup.AddMessage(myMessage.m990); myInterchange.SaveEdi(string.Concat(fileOut, "\\", Path.GetFileNameWithoutExtension(filename), ".edi")); this.FileStatus.HasError = Func_File_Validate(string.Concat(fileOut, "\\", Path.GetFileNameWithoutExtension(filename), ".edi")); if (!this.FileStatus.HasError) { this.Func_SQL_SubmitControlNumber( controlNum, "990GLO", string.Concat(fileOut, "\\", Path.GetFileNameWithoutExtension(filename), ".edi")); Func_File_Move(filename, string.Concat(filePrs, "\\", Path.GetFileName(filename))); this.FileStatus.Created = true; this.FileStatus.Status = true; this.FileStatus.FileOutName = string.Concat( fileOut, "\\", Path.GetFileNameWithoutExtension(filename), ".edi"); } else { Func_File_Move( string.Concat(fileOut, "\\", Path.GetFileNameWithoutExtension(filename), ".edi"), string.Concat(fileErr, "\\", Path.GetFileNameWithoutExtension(filename), ".edi")); Func_File_Move(filename, string.Concat(fileErr, "\\", Path.GetFileName(filename))); this.FileStatus.Created = false; this.FileStatus.Status = false; this.FileStatus.FileErrName = string.Concat(fileOut, "\\", Path.GetFileName(filename)); } } return this.FileStatus; }
public FileAnalysis Func_CWO_XUS_SHP_X12_214_GLO( string filename, string fileOut, string filePrs, string fileErr) { this.FileStatus = new FileAnalysis(); if (File.Exists(filename)) { var controlNum = this.Func_SQL_GetControlNumber(); var doc = new XmlDocument(); doc.Load(filename); XmlNode root = doc.DocumentElement; var nsmgr = new XmlNamespaceManager(doc.NameTable); nsmgr.AddNamespace("ns", "http://www.cargowise.com/Schemas/Universal/2011/11"); var myInterchange = new MyINT(controlNum, "12", "3023254180", "ZZ", "FMXJ214", true); var myGroup = myInterchange.CreateGroup(controlNum, "QM", "3023254180", "FMXJ214"); var myMessage = new X12_4010_214(controlNum); var statusCode = this.Func_XML_GetResultString(doc, nsmgr, @"//ns:ActionPurpose/ns:Code"); if (statusCode != string.Empty) { myMessage.Add_B10( this.Func_XML_GetResultString(doc, nsmgr, @"//ns:Shipment/ns:DataContext/ns:DataSourceCollection/ns:DataSource[ns:Type='ForwardingShipment']/ns:Key"), this.Func_XML_GetResultString(doc, nsmgr, @"//ns:SubShipmentCollection/ns:SubShipment/ns:WayBillNumber"), "WINA" ); switch (statusCode) { case "AAP": { } break; case "ABD": { } break; case "X3P": { myMessage.Add_LX("1", X12_ID_1650.X3, X12_ID_1651.NS, X12_ID_1652.AA, X12_ID_1651.NS, this.Func_XML_GetResultDate(doc, nsmgr, @"//ns:LocalProcessing/ns:PickupCartageCompleted"), this.Func_XML_GetResultTime(doc, nsmgr, @"//ns:LocalProcessing/ns:PickupCartageCompleted"), EdiFabric.Definitions.X12_004010_214.X12_ID_623.LT, this.Func_XML_GetResultString(doc, nsmgr, @"//ns:OrganizationAddressCollection/ns:OrganizationAddress[ns:AddressType='ConsignorPickupDeliveryAddress']/ns:City"), this.Func_XML_GetResultString(doc, nsmgr, @"//ns:OrganizationAddressCollection/ns:OrganizationAddress[ns:AddressType='ConsignorPickupDeliveryAddress']/ns:State"), this.Func_XML_GetResultString(doc, nsmgr, @"//ns:OrganizationAddressCollection/ns:OrganizationAddress[ns:AddressType='ConsignorPickupDeliveryAddress']/ns:Country/ns:Code") ); } break; case "AFP": { myMessage.Add_LX("1", X12_ID_1650.AF, X12_ID_1651.NS, X12_ID_1652.AA, X12_ID_1651.NS, this.Func_XML_GetResultDate(doc, nsmgr, @"//ns:LocalProcessing/ns:PickupCartageCompleted"), this.Func_XML_GetResultTime(doc, nsmgr, @"//ns:LocalProcessing/ns:PickupCartageCompleted"), EdiFabric.Definitions.X12_004010_214.X12_ID_623.LT, this.Func_XML_GetResultString(doc, nsmgr, @"//ns:OrganizationAddressCollection/ns:OrganizationAddress[ns:AddressType='ConsignorPickupDeliveryAddress']/ns:City"), this.Func_XML_GetResultString(doc, nsmgr, @"//ns:OrganizationAddressCollection/ns:OrganizationAddress[ns:AddressType='ConsignorPickupDeliveryAddress']/ns:State"), this.Func_XML_GetResultString(doc, nsmgr, @"//ns:OrganizationAddressCollection/ns:OrganizationAddress[ns:AddressType='ConsignorPickupDeliveryAddress']/ns:Country/ns:Code") ); } break; case "X1D": { } break; case "D1D": { } break; case "AGP": { } break; case "OOP": { myMessage.Add_LX("1", X12_ID_1650.OO, X12_ID_1651.NS, X12_ID_1652.AA, X12_ID_1651.NS, this.Func_XML_GetResultDate(doc, nsmgr, @"//ns:TriggerDate"), this.Func_XML_GetResultTime(doc, nsmgr, @"//ns:TriggerDate"), EdiFabric.Definitions.X12_004010_214.X12_ID_623.LT, Func_SQL_GetCityNameFromPortCode(this.Func_XML_GetResultString(doc, nsmgr, @"//ns:SubShipmentCollection/ns:SubShipment/ns:TransportLegCollection/ns:TransportLeg/ns:PortOfLoading/ns:Code")) .Substring(0, 29) .Trim(), Func_SQL_GetStateCodeFromPortCode(this.Func_XML_GetResultString(doc, nsmgr, @"//ns:SubShipmentCollection/ns:SubShipment/ns:TransportLegCollection/ns:TransportLeg/ns:PortOfLoading/ns:Code")), Func_SQL_GetCountryCodeFromPortCode(this.Func_XML_GetResultString(doc, nsmgr, @"//ns:SubShipmentCollection/ns:SubShipment/ns:TransportLegCollection/ns:TransportLeg/ns:PortOfLoading/ns:Code")) ); } break; case "P1P": { myMessage.Add_LX("1", X12_ID_1650.P1, X12_ID_1651.NS, X12_ID_1652.AA, X12_ID_1651.NS, this.Func_XML_GetResultDate(doc, nsmgr, @"//ns:SubShipmentCollection/ns:SubShipment/ns:TransportLegCollection/ns:TransportLeg/ns:ActualDeparture"), this.Func_XML_GetResultTime(doc, nsmgr, @"//ns:SubShipmentCollection/ns:SubShipment/ns:TransportLegCollection/ns:TransportLeg/ns:ActualDeparture"), EdiFabric.Definitions.X12_004010_214.X12_ID_623.LT, Func_SQL_GetCityNameFromPortCode(this.Func_XML_GetResultString(doc, nsmgr, @"//ns:SubShipmentCollection/ns:SubShipment/ns:TransportLegCollection/ns:TransportLeg/ns:PortOfLoading/ns:Code")) .Substring(0, 29) .Trim(), Func_SQL_GetStateCodeFromPortCode(this.Func_XML_GetResultString(doc, nsmgr, @"//ns:SubShipmentCollection/ns:SubShipment/ns:TransportLegCollection/ns:TransportLeg/ns:PortOfLoading/ns:Code")), Func_SQL_GetCountryCodeFromPortCode(this.Func_XML_GetResultString(doc, nsmgr, @"//ns:SubShipmentCollection/ns:SubShipment/ns:TransportLegCollection/ns:TransportLeg/ns:PortOfLoading/ns:Code")) ); } break; case "X4D": { myMessage.Add_LX("1", X12_ID_1650.X4, X12_ID_1651.NS, X12_ID_1652.AA, X12_ID_1651.NS, this.Func_XML_GetResultDate(doc, nsmgr, @"//ns:SubShipmentCollection/ns:SubShipment/ns:TransportLegCollection/ns:TransportLeg/ns:ActualArrival"), this.Func_XML_GetResultTime(doc, nsmgr, @"//ns:SubShipmentCollection/ns:SubShipment/ns:TransportLegCollection/ns:TransportLeg/ns:ActualArrival"), EdiFabric.Definitions.X12_004010_214.X12_ID_623.LT, Func_SQL_GetCityNameFromPortCode(this.Func_XML_GetResultString(doc, nsmgr, @"//ns:SubShipmentCollection/ns:SubShipment/ns:TransportLegCollection/ns:TransportLeg/ns:PortOfDischarge/ns:Code")) .Substring(0, 29) .Trim(), Func_SQL_GetStateCodeFromPortCode(this.Func_XML_GetResultString(doc, nsmgr, @"//ns:SubShipmentCollection/ns:SubShipment/ns:TransportLegCollection/ns:TransportLeg/ns:PortOfDischarge/ns:Code")), Func_SQL_GetCountryCodeFromPortCode(this.Func_XML_GetResultString(doc, nsmgr, @"//ns:SubShipmentCollection/ns:SubShipment/ns:TransportLegCollection/ns:TransportLeg/ns:PortOfDischarge/ns:Code")) ); } break; case "X9D": { } break; } myGroup.AddMessage(myMessage.m214); myInterchange.SaveEdi(@"D:\Temp\X12\214\GLO\Out\" + Path.GetFileNameWithoutExtension(filename) + ".edi"); } } return FileStatus; }
//----------------------------------------------------------------------------------------------------- public FileAnalysis Func_CWO_XUS_SHP_X12_315_GLO( string filename, string fileOut, string filePrs, string fileErr) { this.FileStatus = new FileAnalysis(); if (File.Exists(filename)) { var controlNum = this.Func_SQL_GetControlNumber(); var doc = new XmlDocument(); doc.Load(filename); XmlNode root = doc.DocumentElement; var nsmgr = new XmlNamespaceManager(doc.NameTable); nsmgr.AddNamespace("ns", "http://www.cargowise.com/Schemas/Universal/2011/11"); var myInterchange = new MyINT(controlNum, "12", "3023254180", "ZZ", "FMXJ315", true); var myGroup = myInterchange.CreateGroup(controlNum, "QO", "3023254180", "FMXJ315"); var myMessage = new X12_4010_315(controlNum); var statusCode = this.Func_XML_GetResultString(doc, nsmgr, @"//ns:ActionPurpose/ns:Code"); if (statusCode != string.Empty) { switch (statusCode) { case "LEO": { var b403 = this.Func_EDI_ConvertStatusCode( this.Func_SQL_GetStatusCode(statusCode, "315GLO", "B403")); var b409 = this.Func_EDI_ConvertContainerStatus( this.Func_SQL_GetStatusCode(statusCode, "315GLO", "B409")); var dateEvt = this.Func_XML_GetResultDate( doc, nsmgr, @"//ns:SubShipmentCollection/ns:SubShipment/ns:ContainerCollection/ns:Container/ns:ContainerParkEmptyPickupGateOut"); var timeEvt = this.Func_XML_GetResultTime( doc, nsmgr, @"//ns:SubShipmentCollection/ns:SubShipment/ns:ContainerCollection/ns:Container/ns:ContainerParkEmptyPickupGateOut"); var containerNum = this.Func_XML_GetResultString( doc, nsmgr, @"//ns:SubShipmentCollection/ns:SubShipment/ns:ContainerCollection/ns:Container/ns:ContainerNumber"); var contPre = containerNum.Substring(0, 4); var contSuf = containerNum.Substring(4, 7); var contChk = containerNum.Substring(10, 1); var contType = this.Func_XML_GetResultString( doc, nsmgr, @"//ns:SubShipmentCollection/ns:SubShipment/ns:ContainerCollection/ns:Container/ns:ContainerType/ns:ISOCode"); var portCode = this.Func_XML_GetResultString( doc, nsmgr, @"//ns:SubShipmentCollection/ns:SubShipment/ns:TransportLegCollection/ns:TransportLeg/ns:PortOfLoading/ns:Code"); myMessage.Add_B4( b403, dateEvt, timeEvt, contPre, contSuf, b409, contType, portCode, EdiFabric.Definitions.X12_004010_315.X12_ID_309.UN, contChk); } break; case "ILR": { var b403 = this.Func_EDI_ConvertStatusCode( this.Func_SQL_GetStatusCode(statusCode, "315GLO", "B403")); var b409 = this.Func_EDI_ConvertContainerStatus( this.Func_SQL_GetStatusCode(statusCode, "315GLO", "B409")); var cntCount = this.Func_XML_GetResultCount( doc, nsmgr, @"//ns:UniversalShipment/ns:Shipment/ns:ContainerCollection/ns:Container"); if (cntCount > 0) { var dateEvt = this.Func_XML_GetResultDate( doc, nsmgr, @"//ns:UniversalShipment/ns:Shipment/ns:ContainerCollection/ns:Container[ns:Link=1]/ns:FCLWharfGateIn"); var timeEvt = this.Func_XML_GetResultTime( doc, nsmgr, @"//ns:UniversalShipment/ns:Shipment/ns:ContainerCollection/ns:Container[ns:Link=1]/ns:FCLWharfGateIn"); var containerNum = this.Func_XML_GetResultString( doc, nsmgr, @"//ns:UniversalShipment/ns:Shipment/ns:ContainerCollection/ns:Container[ns:Link=1]/ns:ContainerNumber"); var contPre = containerNum.Substring(0, 4); var contSuf = containerNum.Substring(4, 7); var contChk = containerNum.Substring(10, 1); var contType = this.Func_XML_GetResultString( doc, nsmgr, @"//ns:UniversalShipment/ns:Shipment/ns:ContainerCollection/ns:Container[ns:Link=1]/ns:ContainerType/ns:ISOCode"); var portCode = this.Func_XML_GetResultString( doc, nsmgr, @"//ns:SubShipmentCollection/ns:SubShipment/ns:TransportLegCollection/ns:TransportLeg/ns:PortOfLoading/ns:Code"); myMessage.Add_B4( b403, dateEvt, timeEvt, contPre, contSuf, b409, contType, portCode, EdiFabric.Definitions.X12_004010_315.X12_ID_309.UN, contChk); } } break; case "AEL": { var b403 = this.Func_EDI_ConvertStatusCode( this.Func_SQL_GetStatusCode(statusCode, "315GLO", "B403")); var b409 = this.Func_EDI_ConvertContainerStatus( this.Func_SQL_GetStatusCode(statusCode, "315GLO", "B409")); var cntCount = this.Func_XML_GetResultCount( doc, nsmgr, @"//ns:UniversalShipment/ns:Shipment/ns:ContainerCollection/ns:Container"); if (cntCount > 0) { var dateEvt = this.Func_XML_GetResultDate( doc, nsmgr, @"//ns:UniversalShipment/ns:Shipment/ns:ContainerCollection/ns:Container[ns:Link=1]/ns:FCLOnBoardVessel"); var timeEvt = this.Func_XML_GetResultTime( doc, nsmgr, @"//ns:UniversalShipment/ns:Shipment/ns:ContainerCollection/ns:Container[ns:Link=1]/ns:FCLOnBoardVessel"); var containerNum = this.Func_XML_GetResultString( doc, nsmgr, @"//ns:UniversalShipment/ns:Shipment/ns:ContainerCollection/ns:Container[ns:Link=1]/ns:ContainerNumber"); var contPre = containerNum.Substring(0, 4); var contSuf = containerNum.Substring(4, 7); var contChk = containerNum.Substring(10, 1); var contType = this.Func_XML_GetResultString( doc, nsmgr, @"//ns:UniversalShipment/ns:Shipment/ns:ContainerCollection/ns:Container[ns:Link=1]/ns:ContainerType/ns:ISOCode"); var portCode = this.Func_XML_GetResultString( doc, nsmgr, @"//ns:SubShipmentCollection/ns:SubShipment/ns:TransportLegCollection/ns:TransportLeg/ns:PortOfLoading/ns:Code"); myMessage.Add_B4( b403, dateEvt, timeEvt, contPre, contSuf, b409, contType, portCode, EdiFabric.Definitions.X12_004010_315.X12_ID_309.UN, contChk); } } break; case "CLL": { var b403 = this.Func_EDI_ConvertStatusCode( this.Func_SQL_GetStatusCode(statusCode, "315GLO", "B403")); var b409 = this.Func_EDI_ConvertContainerStatus( this.Func_SQL_GetStatusCode(statusCode, "315GLO", "B409")); var cntCount = this.Func_XML_GetResultCount( doc, nsmgr, @"//ns:UniversalShipment/ns:Shipment/ns:ContainerCollection/ns:Container"); if (cntCount > 0) { var dateEvt = this.Func_XML_GetResultDate( doc, nsmgr, @"//ns:SubShipmentCollection/ns:SubShipment/ns:TransportLegCollection/ns:TransportLeg[ns:LegOrder=1][ns:TransportMode='Sea']/ns:EstimatedDeparture"); var timeEvt = this.Func_XML_GetResultTime( doc, nsmgr, @"//ns:SubShipmentCollection/ns:SubShipment/ns:TransportLegCollection/ns:TransportLeg[ns:LegOrder=1][ns:TransportMode='Sea']/ns:EstimatedDeparture"); var containerNum = this.Func_XML_GetResultString( doc, nsmgr, @"//ns:UniversalShipment/ns:Shipment/ns:ContainerCollection/ns:Container[ns:Link=1]/ns:ContainerNumber"); var contPre = containerNum.Substring(0, 4); var contSuf = containerNum.Substring(4, 7); var contChk = containerNum.Substring(10, 1); var contType = this.Func_XML_GetResultString( doc, nsmgr, @"//ns:UniversalShipment/ns:Shipment/ns:ContainerCollection/ns:Container[ns:Link=1]/ns:ContainerType/ns:ISOCode"); var portCode = this.Func_XML_GetResultString( doc, nsmgr, @"//ns:SubShipmentCollection/ns:SubShipment/ns:TransportLegCollection/ns:TransportLeg/ns:PortOfLoading/ns:Code"); myMessage.Add_B4( b403, dateEvt, timeEvt, contPre, contSuf, b409, contType, portCode, EdiFabric.Definitions.X12_004010_315.X12_ID_309.UN, contChk); } } break; case "VDL": { var b403 = this.Func_EDI_ConvertStatusCode( this.Func_SQL_GetStatusCode(statusCode, "315GLO", "B403")); var b409 = this.Func_EDI_ConvertContainerStatus( this.Func_SQL_GetStatusCode(statusCode, "315GLO", "B409")); var cntCount = this.Func_XML_GetResultCount( doc, nsmgr, @"//ns:UniversalShipment/ns:Shipment/ns:ContainerCollection/ns:Container"); if (cntCount > 0) { var dateEvt = this.Func_XML_GetResultDate( doc, nsmgr, @"//ns:SubShipmentCollection/ns:SubShipment/ns:TransportLegCollection/ns:TransportLeg[ns:LegOrder=1][ns:TransportMode='Sea']/ns:ActualDeparture"); var timeEvt = this.Func_XML_GetResultTime( doc, nsmgr, @"//ns:SubShipmentCollection/ns:SubShipment/ns:TransportLegCollection/ns:TransportLeg[ns:LegOrder=1][ns:TransportMode='Sea']/ns:ActualDeparture"); var containerNum = this.Func_XML_GetResultString( doc, nsmgr, @"//ns:UniversalShipment/ns:Shipment/ns:ContainerCollection/ns:Container[ns:Link=1]/ns:ContainerNumber"); var contPre = containerNum.Substring(0, 4); var contSuf = containerNum.Substring(4, 7); var contChk = containerNum.Substring(10, 1); var contType = this.Func_XML_GetResultString( doc, nsmgr, @"//ns:UniversalShipment/ns:Shipment/ns:ContainerCollection/ns:Container[ns:Link=1]/ns:ContainerType/ns:ISOCode"); var portCode = this.Func_XML_GetResultString( doc, nsmgr, @"//ns:SubShipmentCollection/ns:SubShipment/ns:TransportLegCollection/ns:TransportLeg/ns:PortOfLoading/ns:Code"); myMessage.Add_B4( b403, dateEvt, timeEvt, contPre, contSuf, b409, contType, portCode, EdiFabric.Definitions.X12_004010_315.X12_ID_309.UN, contChk); } } break; case "ELD": { var b403 = this.Func_EDI_ConvertStatusCode( this.Func_SQL_GetStatusCode(statusCode, "315GLO", "B403")); var b409 = this.Func_EDI_ConvertContainerStatus( this.Func_SQL_GetStatusCode(statusCode, "315GLO", "B409")); var cntCount = this.Func_XML_GetResultCount( doc, nsmgr, @"//ns:UniversalShipment/ns:Shipment/ns:ContainerCollection/ns:Container"); var legCount = this.Func_XML_GetResultCount( doc, nsmgr, @"//ns:SubShipmentCollection/ns:SubShipment/ns:TransportLegCollection/ns:TransportLeg[ns:TransportMode='Sea']"); if (cntCount > 0) { var dateEvt = this.Func_XML_GetResultDate( doc, nsmgr, @"//ns:SubShipmentCollection/ns:SubShipment/ns:TransportLegCollection/ns:TransportLeg[ns:LegOrder=" + legCount + "][ns:TransportMode='Sea']/ns:EstimatedArrival"); var timeEvt = this.Func_XML_GetResultTime( doc, nsmgr, @"//ns:SubShipmentCollection/ns:SubShipment/ns:TransportLegCollection/ns:TransportLeg[ns:LegOrder=" + legCount + "][ns:TransportMode='Sea']/ns:EstimatedArrival"); var containerNum = this.Func_XML_GetResultString( doc, nsmgr, @"//ns:UniversalShipment/ns:Shipment/ns:ContainerCollection/ns:Container[ns:Link=1]/ns:ContainerNumber"); var contPre = containerNum.Substring(0, 4); var contSuf = containerNum.Substring(4, 7); var contChk = containerNum.Substring(10, 1); var contType = this.Func_XML_GetResultString( doc, nsmgr, @"//ns:UniversalShipment/ns:Shipment/ns:ContainerCollection/ns:Container[ns:Link=1]/ns:ContainerType/ns:ISOCode"); var portCode = this.Func_XML_GetResultString( doc, nsmgr, @"//ns:SubShipment/ns:TransportLegCollection/ns:TransportLeg[ns:LegOrder=" + legCount + "]/ns:PortOfDischarge/ns:Code"); myMessage.Add_B4( b403, dateEvt, timeEvt, contPre, contSuf, b409, contType, portCode, EdiFabric.Definitions.X12_004010_315.X12_ID_309.UN, contChk); } } break; case "VAD": { var b403 = this.Func_EDI_ConvertStatusCode( this.Func_SQL_GetStatusCode(statusCode, "315GLO", "B403")); var b409 = this.Func_EDI_ConvertContainerStatus( this.Func_SQL_GetStatusCode(statusCode, "315GLO", "B409")); var cntCount = this.Func_XML_GetResultCount( doc, nsmgr, @"//ns:UniversalShipment/ns:Shipment/ns:ContainerCollection/ns:Container"); var legCount = this.Func_XML_GetResultCount( doc, nsmgr, @"//ns:SubShipmentCollection/ns:SubShipment/ns:TransportLegCollection/ns:TransportLeg[ns:TransportMode='Sea']"); if (cntCount > 0) { var dateEvt = this.Func_XML_GetResultDate( doc, nsmgr, @"//ns:SubShipmentCollection/ns:SubShipment/ns:TransportLegCollection/ns:TransportLeg[ns:LegOrder=" + legCount + "][ns:TransportMode='Sea']/ns:ActualArrival"); var timeEvt = this.Func_XML_GetResultTime( doc, nsmgr, @"//ns:SubShipmentCollection/ns:SubShipment/ns:TransportLegCollection/ns:TransportLeg[ns:LegOrder=" + legCount + "][ns:TransportMode='Sea']/ns:ActualArrival"); var containerNum = this.Func_XML_GetResultString( doc, nsmgr, @"//ns:UniversalShipment/ns:Shipment/ns:ContainerCollection/ns:Container[ns:Link=1]/ns:ContainerNumber"); var contPre = containerNum.Substring(0, 4); var contSuf = containerNum.Substring(4, 7); var contChk = containerNum.Substring(10, 1); var contType = this.Func_XML_GetResultString( doc, nsmgr, @"//ns:UniversalShipment/ns:Shipment/ns:ContainerCollection/ns:Container[ns:Link=1]/ns:ContainerType/ns:ISOCode"); var portCode = this.Func_XML_GetResultString( doc, nsmgr, @"//ns:SubShipment/ns:TransportLegCollection/ns:TransportLeg[ns:LegOrder=" + legCount + "]/ns:PortOfDischarge/ns:Code"); myMessage.Add_B4( b403, dateEvt, timeEvt, contPre, contSuf, b409, contType, portCode, EdiFabric.Definitions.X12_004010_315.X12_ID_309.UN, contChk); } } break; case "UVD": { var b403 = this.Func_EDI_ConvertStatusCode( this.Func_SQL_GetStatusCode(statusCode, "315GLO", "B403")); var b409 = this.Func_EDI_ConvertContainerStatus( this.Func_SQL_GetStatusCode(statusCode, "315GLO", "B409")); var cntCount = this.Func_XML_GetResultCount( doc, nsmgr, @"//ns:UniversalShipment/ns:Shipment/ns:ContainerCollection/ns:Container"); var legCount = this.Func_XML_GetResultCount( doc, nsmgr, @"//ns:SubShipmentCollection/ns:SubShipment/ns:TransportLegCollection/ns:TransportLeg[ns:TransportMode='Sea']"); if (cntCount > 0) { var dateEvt = this.Func_XML_GetResultDate( doc, nsmgr, @"//ns:SubShipment/ns:ContainerCollection/ns:Container[ns:Link=1]/ns:FCLUnloadFromVessel"); var timeEvt = this.Func_XML_GetResultTime( doc, nsmgr, @"//ns:SubShipment/ns:ContainerCollection/ns:Container[ns:Link=1]/ns:FCLUnloadFromVessel"); var containerNum = this.Func_XML_GetResultString( doc, nsmgr, @"//ns:UniversalShipment/ns:Shipment/ns:ContainerCollection/ns:Container[ns:Link=1]/ns:ContainerNumber"); var contPre = containerNum.Substring(0, 4); var contSuf = containerNum.Substring(4, 7); var contChk = containerNum.Substring(10, 1); var contType = this.Func_XML_GetResultString( doc, nsmgr, @"//ns:UniversalShipment/ns:Shipment/ns:ContainerCollection/ns:Container[ns:Link=1]/ns:ContainerType/ns:ISOCode"); var portCode = this.Func_XML_GetResultString( doc, nsmgr, @"//ns:SubShipment/ns:TransportLegCollection/ns:TransportLeg[ns:LegOrder=" + legCount + "]/ns:PortOfDischarge/ns:Code"); myMessage.Add_B4( b403, dateEvt, timeEvt, contPre, contSuf, b409, contType, portCode, EdiFabric.Definitions.X12_004010_315.X12_ID_309.UN, contChk); } } break; case "OLD": { var b403 = this.Func_EDI_ConvertStatusCode( this.Func_SQL_GetStatusCode(statusCode, "315GLO", "B403")); var b409 = this.Func_EDI_ConvertContainerStatus( this.Func_SQL_GetStatusCode(statusCode, "315GLO", "B409")); var cntCount = this.Func_XML_GetResultCount( doc, nsmgr, @"//ns:UniversalShipment/ns:Shipment/ns:ContainerCollection/ns:Container"); var legCount = this.Func_XML_GetResultCount( doc, nsmgr, @"//ns:SubShipmentCollection/ns:SubShipment/ns:TransportLegCollection/ns:TransportLeg[ns:TransportMode='Sea']"); if (cntCount > 0) { var dateEvt = this.Func_XML_GetResultDate( doc, nsmgr, @"//ns:SubShipment/ns:ContainerCollection/ns:Container[ns:Link=1]/ns:FCLWharfGateOut"); var timeEvt = this.Func_XML_GetResultTime( doc, nsmgr, @"//ns:SubShipment/ns:ContainerCollection/ns:Container[ns:Link=1]/ns:FCLWharfGateOut"); var containerNum = this.Func_XML_GetResultString( doc, nsmgr, @"//ns:UniversalShipment/ns:Shipment/ns:ContainerCollection/ns:Container[ns:Link=1]/ns:ContainerNumber"); var contPre = containerNum.Substring(0, 4); var contSuf = containerNum.Substring(4, 7); var contChk = containerNum.Substring(10, 1); var contType = this.Func_XML_GetResultString( doc, nsmgr, @"//ns:UniversalShipment/ns:Shipment/ns:ContainerCollection/ns:Container[ns:Link=1]/ns:ContainerType/ns:ISOCode"); var portCode = this.Func_XML_GetResultString( doc, nsmgr, @"//ns:SubShipment/ns:TransportLegCollection/ns:TransportLeg[ns:LegOrder=" + legCount + "]/ns:PortOfDischarge/ns:Code"); myMessage.Add_B4( b403, dateEvt, timeEvt, contPre, contSuf, b409, contType, portCode, EdiFabric.Definitions.X12_004010_315.X12_ID_309.UN, contChk); } } break; case "AGM": { var b403 = this.Func_EDI_ConvertStatusCode( this.Func_SQL_GetStatusCode(statusCode, "315GLO", "B403")); var b409 = this.Func_EDI_ConvertContainerStatus( this.Func_SQL_GetStatusCode(statusCode, "315GLO", "B409")); var cntCount = this.Func_XML_GetResultCount( doc, nsmgr, @"//ns:UniversalShipment/ns:Shipment/ns:ContainerCollection/ns:Container"); if (cntCount > 0) { var dateEvt = this.Func_XML_GetResultDate( doc, nsmgr, @"//ns:SubShipment/ns:LocalProcessing/ns:EstimatedDelivery"); var timeEvt = this.Func_XML_GetResultTime( doc, nsmgr, @"//ns:SubShipment/ns:LocalProcessing/ns:EstimatedDelivery"); var containerNum = this.Func_XML_GetResultString( doc, nsmgr, @"//ns:UniversalShipment/ns:Shipment/ns:ContainerCollection/ns:Container[ns:Link=1]/ns:ContainerNumber"); var contPre = containerNum.Substring(0, 4); var contSuf = containerNum.Substring(4, 7); var contChk = containerNum.Substring(10, 1); var contType = this.Func_XML_GetResultString( doc, nsmgr, @"//ns:UniversalShipment/ns:Shipment/ns:ContainerCollection/ns:Container[ns:Link=1]/ns:ContainerType/ns:ISOCode"); var portCode = this.Func_XML_GetResultString( doc, nsmgr, @"//ns:PortOfDestination/ns:Code"); myMessage.Add_B4( b403, dateEvt, timeEvt, contPre, contSuf, b409, contType, portCode, EdiFabric.Definitions.X12_004010_315.X12_ID_309.UN, contChk); } } break; case "DEM": { var b403 = this.Func_EDI_ConvertStatusCode( this.Func_SQL_GetStatusCode(statusCode, "315GLO", "B403")); var b409 = this.Func_EDI_ConvertContainerStatus( this.Func_SQL_GetStatusCode(statusCode, "315GLO", "B409")); var cntCount = this.Func_XML_GetResultCount( doc, nsmgr, @"//ns:UniversalShipment/ns:Shipment/ns:ContainerCollection/ns:Container"); if (cntCount > 0) { var dateEvt = this.Func_XML_GetResultDate( doc, nsmgr, @"//ns:SubShipment/ns:LocalProcessing/ns:DeliveryCartageCompleted"); var timeEvt = this.Func_XML_GetResultTime( doc, nsmgr, @"//ns:SubShipment/ns:LocalProcessing/ns:DeliveryCartageCompleted"); var containerNum = this.Func_XML_GetResultString( doc, nsmgr, @"//ns:UniversalShipment/ns:Shipment/ns:ContainerCollection/ns:Container[ns:Link=1]/ns:ContainerNumber"); var contPre = containerNum.Substring(0, 4); var contSuf = containerNum.Substring(4, 7); var contChk = containerNum.Substring(10, 1); var contType = this.Func_XML_GetResultString( doc, nsmgr, @"//ns:UniversalShipment/ns:Shipment/ns:ContainerCollection/ns:Container[ns:Link=1]/ns:ContainerType/ns:ISOCode"); var portCode = this.Func_XML_GetResultString( doc, nsmgr, @"//ns:PortOfDestination/ns:Code"); myMessage.Add_B4( b403, dateEvt, timeEvt, contPre, contSuf, b409, contType, portCode, EdiFabric.Definitions.X12_004010_315.X12_ID_309.UN, contChk); } } break; case "TOS": { var b403 = this.Func_EDI_ConvertStatusCode( this.Func_SQL_GetStatusCode(statusCode, "315GLO", "B403")); var b409 = this.Func_EDI_ConvertContainerStatus( this.Func_SQL_GetStatusCode(statusCode, "315GLO", "B409")); var cntCount = this.Func_XML_GetResultCount( doc, nsmgr, @"//ns:UniversalShipment/ns:Shipment/ns:ContainerCollection/ns:Container"); var legCount = this.Func_XML_GetResultCount( doc, nsmgr, @"//ns:SubShipmentCollection/ns:SubShipment/ns:TransportLegCollection/ns:TransportLeg[ns:TransportMode='Sea']"); if (cntCount > 0) { var dateEvt = this.Func_XML_GetResultDate( doc, nsmgr, @"//ns:SubShipment/ns:ContainerCollection/ns:Container[ns:Link=1]/ns:ContainerParkEmptyReturnGateIn"); var timeEvt = this.Func_XML_GetResultTime( doc, nsmgr, @"//ns:SubShipment/ns:ContainerCollection/ns:Container[ns:Link=1]/ns:ContainerParkEmptyReturnGateIn"); var containerNum = this.Func_XML_GetResultString( doc, nsmgr, @"//ns:UniversalShipment/ns:Shipment/ns:ContainerCollection/ns:Container[ns:Link=1]/ns:ContainerNumber"); var contPre = containerNum.Substring(0, 4); var contSuf = containerNum.Substring(4, 7); var contChk = containerNum.Substring(10, 1); var contType = this.Func_XML_GetResultString( doc, nsmgr, @"//ns:UniversalShipment/ns:Shipment/ns:ContainerCollection/ns:Container[ns:Link=1]/ns:ContainerType/ns:ISOCode"); var portCode = this.Func_XML_GetResultString( doc, nsmgr, @"//ns:SubShipmentCollection/ns:SubShipment/ns:TransportLegCollection/ns:TransportLeg[ns:LegOrder=" + legCount + "]/ns:PortOfDischarge/ns:Code"); myMessage.Add_B4( b403, dateEvt, timeEvt, contPre, contSuf, b409, contType, portCode, EdiFabric.Definitions.X12_004010_315.X12_ID_309.UN, contChk); } } break; default: { break; } } var refList = doc.SelectNodes( @"//ns:SubShipmentCollection/ns:SubShipment/ns:AdditionalReferenceCollection/ns:AdditionalReference/ns:Type/ns:Code", nsmgr); myMessage.Add_N9(EdiFabric.Definitions.X12_004010_315.X12_ID_128.ZZ, "WINA", ""); if (refList != null && refList.Count > 0) { foreach (XmlNode refItem in refList) { switch (refItem.InnerText) { case "LID": { myMessage.Add_N9( EdiFabric.Definitions.X12_004010_315.X12_ID_128.OL, this.Func_XML_GetResultString( doc, nsmgr, @"//ns:SubShipmentCollection/ns:SubShipment/ns:AdditionalReferenceCollection/ns:AdditionalReference/ns:Type[ns:Code='LID']/parent::ns:AdditionalReference/ns:ReferenceNumber"), this.Func_XML_GetResultString( doc, nsmgr, @"//ns:SubShipmentCollection/ns:SubShipment/ns:AdditionalReferenceCollection/ns:AdditionalReference/ns:Type[ns:Code='LID']/parent::ns:AdditionalReference/ns:ContextInformation")); } break; case "BKG": { myMessage.Add_N9( EdiFabric.Definitions.X12_004010_315.X12_ID_128.MB, this.Func_XML_GetResultString( doc, nsmgr, @"//ns:SubShipmentCollection/ns:SubShipment/ns:AdditionalReferenceCollection/ns:AdditionalReference/ns:Type[ns:Code='BKG']/parent::ns:AdditionalReference/ns:ReferenceNumber"), this.Func_XML_GetResultString( doc, nsmgr, @"//ns:SubShipmentCollection/ns:SubShipment/ns:AdditionalReferenceCollection/ns:AdditionalReference/ns:Type[ns:Code='BKG']/parent::ns:AdditionalReference/ns:ContextInformation")); } break; case "UCR": { myMessage.Add_N9( EdiFabric.Definitions.X12_004010_315.X12_ID_128.SI, this.Func_XML_GetResultString( doc, nsmgr, @"//ns:SubShipmentCollection/ns:SubShipment/ns:AdditionalReferenceCollection/ns:AdditionalReference/ns:Type[ns:Code='UCR']/parent::ns:AdditionalReference/ns:ReferenceNumber"), this.Func_XML_GetResultString( doc, nsmgr, @"//ns:SubShipmentCollection/ns:SubShipment/ns:AdditionalReferenceCollection/ns:AdditionalReference/ns:Type[ns:Code='UCR']/parent::ns:AdditionalReference/ns:ContextInformation")); } break; case "CON": { myMessage.Add_N9( EdiFabric.Definitions.X12_004010_315.X12_ID_128.TS, this.Func_XML_GetResultString( doc, nsmgr, @"//ns:SubShipmentCollection/ns:SubShipment/ns:AdditionalReferenceCollection/ns:AdditionalReference/ns:Type[ns:Code='CON']/parent::ns:AdditionalReference/ns:ReferenceNumber"), this.Func_XML_GetResultString( doc, nsmgr, @"//ns:SubShipmentCollection/ns:SubShipment/ns:AdditionalReferenceCollection/ns:AdditionalReference/ns:Type[ns:Code='CON']/parent::ns:AdditionalReference/ns:ContextInformation")); } break; case "OAG": { myMessage.Add_N9( EdiFabric.Definitions.X12_004010_315.X12_ID_128.FN, this.Func_XML_GetResultString( doc, nsmgr, @"//ns:SubShipmentCollection/ns:SubShipment/ns:AdditionalReferenceCollection/ns:AdditionalReference/ns:Type[ns:Code='OAG']/parent::ns:AdditionalReference/ns:ReferenceNumber"), this.Func_XML_GetResultString( doc, nsmgr, @"//ns:SubShipmentCollection/ns:SubShipment/ns:AdditionalReferenceCollection/ns:AdditionalReference/ns:Type[ns:Code='OAG']/parent::ns:AdditionalReference/ns:ContextInformation")); } break; } } } myMessage.Add_N9( EdiFabric.Definitions.X12_004010_315.X12_ID_128.BN, this.Func_XML_GetResultString( doc, nsmgr, @"//ns:Shipment/ns:WayBillNumber"), ""); myMessage.Add_N9( EdiFabric.Definitions.X12_004010_315.X12_ID_128.FN, this.Func_XML_GetResultString( doc, nsmgr, @"//ns:Shipment/ns:DataContext/ns:DataSourceCollection/ns:DataSource[ns:Type='ForwardingShipment']/ns:Key"), ""); myMessage.Add_N9( EdiFabric.Definitions.X12_004010_315.X12_ID_128.X9, this.Func_XML_GetResultString( doc, nsmgr, @"//ns:SubShipmentCollection/ns:SubShipment/ns:WayBillNumber"), ""); var ordList = doc.SelectNodes( @"//ns:SubShipmentCollection/ns:SubShipment/ns:LocalProcessing/ns:OrderNumberCollection/ns:OrderNumber", nsmgr); if (ordList != null && ordList.Count > 0) { int intCnt = 1; foreach (XmlNode ordItem in ordList) { myMessage.Add_N9( EdiFabric.Definitions.X12_004010_315.X12_ID_128.PO, this.Func_XML_GetResultString( doc, nsmgr, @"//ns:SubShipmentCollection/ns:SubShipment/ns:LocalProcessing/ns:OrderNumberCollection/ns:OrderNumber[" + intCnt.ToString() + "]/ns:OrderReference"), ""); intCnt += 1; } } myMessage.Add_Q2( this.Func_XML_GetResultString( doc, nsmgr, @"//ns:SubShipment/ns:TransportLegCollection/ns:TransportLeg[ns:LegType='Main']/ns:VoyageFlightNo"), this.Func_XML_GetResultString( doc, nsmgr, @"//ns:SubShipment/ns:TransportLegCollection/ns:TransportLeg[ns:LegType='Main']/ns:VesselName")); if (statusCode != string.Empty) { var tranCount = this.Func_XML_GetResultCount( doc, nsmgr, @"//ns:SubShipmentCollection/ns:SubShipment/ns:TransportLegCollection/ns:TransportLeg"); switch (statusCode) { case "LEO": { myMessage.Add_R4( EdiFabric.Definitions.X12_004010_315.X12_ID_115.L, EdiFabric.Definitions.X12_004010_315.X12_ID_309.UN, this.Func_XML_GetResultString( doc, nsmgr, @"//ns:SubShipmentCollection/ns:SubShipment/ns:TransportLegCollection/ns:TransportLeg[ns:LegOrder=1]/ns:PortOfLoading/ns:Code"), this.Func_XML_GetResultString( doc, nsmgr, @"//ns:SubShipmentCollection/ns:SubShipment/ns:TransportLegCollection/ns:TransportLeg[ns:LegOrder=1]/ns:PortOfLoading/ns:Name"), this.Func_XML_GetResultString( doc, nsmgr, @"//ns:SubShipmentCollection/ns:SubShipment/ns:TransportLegCollection/ns:TransportLeg[ns:LegOrder=1]/ns:PortOfLoading/ns:Code") .Substring(0, 2)); } break; case "VDL": { myMessage.Add_R4( EdiFabric.Definitions.X12_004010_315.X12_ID_115.L, EdiFabric.Definitions.X12_004010_315.X12_ID_309.UN, this.Func_XML_GetResultString( doc, nsmgr, @"//ns:SubShipmentCollection/ns:SubShipment/ns:TransportLegCollection/ns:TransportLeg[ns:LegOrder=1]/ns:PortOfLoading/ns:Code"), this.Func_XML_GetResultString( doc, nsmgr, @"//ns:SubShipmentCollection/ns:SubShipment/ns:TransportLegCollection/ns:TransportLeg[ns:LegOrder=1]/ns:PortOfLoading/ns:Name"), this.Func_XML_GetResultString( doc, nsmgr, @"//ns:SubShipmentCollection/ns:SubShipment/ns:TransportLegCollection/ns:TransportLeg[ns:LegOrder=1]/ns:PortOfLoading/ns:Code") .Substring(0, 2)); } break; case "OLD": { myMessage.Add_R4( EdiFabric.Definitions.X12_004010_315.X12_ID_115.D, EdiFabric.Definitions.X12_004010_315.X12_ID_309.UN, this.Func_XML_GetResultString( doc, nsmgr, @"//ns:SubShipmentCollection/ns:SubShipment/ns:TransportLegCollection/ns:TransportLeg[ns:LegOrder=" + tranCount + "]/ns:PortOfDischarge/ns:Code"), this.Func_XML_GetResultString( doc, nsmgr, @"//ns:SubShipmentCollection/ns:SubShipment/ns:TransportLegCollection/ns:TransportLeg[ns:LegOrder=" + tranCount + "]/ns:PortOfDischarge/ns:Name"), this.Func_XML_GetResultString( doc, nsmgr, @"//ns:SubShipmentCollection/ns:SubShipment/ns:TransportLegCollection/ns:TransportLeg[ns:LegOrder=" + tranCount + "]/ns:PortOfDischarge/ns:Code").Substring(0, 2)); } break; case "DEM": { myMessage.Add_R4( EdiFabric.Definitions.X12_004010_315.X12_ID_115.M, EdiFabric.Definitions.X12_004010_315.X12_ID_309.UN, this.Func_XML_GetResultString(doc, nsmgr, @"//ns:SubShipment/ns:PortOfDestination/ns:Code"), this.Func_XML_GetResultString(doc, nsmgr, @"//ns:SubShipment/ns:PortOfDestination/ns:Name"), this.Func_XML_GetResultString(doc, nsmgr, @"//ns:SubShipment/ns:PortOfDestination/ns:Code") .Substring(0, 2)); } break; default: { myMessage.Add_R4( EdiFabric.Definitions.X12_004010_315.X12_ID_115.R, EdiFabric.Definitions.X12_004010_315.X12_ID_309.UN, this.Func_XML_GetResultString(doc, nsmgr, @"//ns:SubShipment/ns:PortOfOrigin/ns:Code"), this.Func_XML_GetResultString(doc, nsmgr, @"//ns:SubShipment/ns:PortOfOrigin/ns:Name"), this.Func_XML_GetResultString(doc, nsmgr, @"//ns:SubShipment/ns:PortOfOrigin/ns:Code") .Substring(0, 2)); myMessage.Add_R4( EdiFabric.Definitions.X12_004010_315.X12_ID_115.M, EdiFabric.Definitions.X12_004010_315.X12_ID_309.UN, this.Func_XML_GetResultString(doc, nsmgr, @"//ns:SubShipment/ns:PortOfDestination/ns:Code"), this.Func_XML_GetResultString(doc, nsmgr, @"//ns:SubShipment/ns:PortOfDestination/ns:Name"), this.Func_XML_GetResultString(doc, nsmgr, @"//ns:SubShipment/ns:PortOfDestination/ns:Code") .Substring(0, 2)); //var tranCount = this.Func_XML_GetResultCount( // doc, // nsmgr, // @"//ns:SubShipmentCollection/ns:SubShipment/ns:TransportLegCollection/ns:TransportLeg"); myMessage.Add_R4( EdiFabric.Definitions.X12_004010_315.X12_ID_115.L, EdiFabric.Definitions.X12_004010_315.X12_ID_309.UN, this.Func_XML_GetResultString( doc, nsmgr, @"//ns:SubShipmentCollection/ns:SubShipment/ns:TransportLegCollection/ns:TransportLeg[ns:LegOrder=1]/ns:PortOfLoading/ns:Code"), this.Func_XML_GetResultString( doc, nsmgr, @"//ns:SubShipmentCollection/ns:SubShipment/ns:TransportLegCollection/ns:TransportLeg[ns:LegOrder=1]/ns:PortOfLoading/ns:Name"), this.Func_XML_GetResultString( doc, nsmgr, @"//ns:SubShipmentCollection/ns:SubShipment/ns:TransportLegCollection/ns:TransportLeg[ns:LegOrder=1]/ns:PortOfLoading/ns:Code") .Substring(0, 2)); myMessage.Add_R4( EdiFabric.Definitions.X12_004010_315.X12_ID_115.D, EdiFabric.Definitions.X12_004010_315.X12_ID_309.UN, this.Func_XML_GetResultString( doc, nsmgr, @"//ns:SubShipmentCollection/ns:SubShipment/ns:TransportLegCollection/ns:TransportLeg[ns:LegOrder=" + tranCount + "]/ns:PortOfDischarge/ns:Code"), this.Func_XML_GetResultString( doc, nsmgr, @"//ns:SubShipmentCollection/ns:SubShipment/ns:TransportLegCollection/ns:TransportLeg[ns:LegOrder=" + tranCount + "]/ns:PortOfDischarge/ns:Name"), this.Func_XML_GetResultString( doc, nsmgr, @"//ns:SubShipmentCollection/ns:SubShipment/ns:TransportLegCollection/ns:TransportLeg[ns:LegOrder=" + tranCount + "]/ns:PortOfDischarge/ns:Code").Substring(0, 2)); } break; } } myGroup.AddMessage(myMessage.m315); myInterchange.SaveEdi(string.Concat(fileOut, "\\", Path.GetFileNameWithoutExtension(filename), ".edi")); this.FileStatus.HasError = Func_File_Validate(string.Concat(fileOut, "\\", Path.GetFileNameWithoutExtension(filename), ".edi")); if (!this.FileStatus.HasError) { this.Func_SQL_SubmitControlNumber( controlNum, "315GLO", string.Concat(fileOut, "\\", Path.GetFileNameWithoutExtension(filename), ".edi")); Func_File_Move(filename, string.Concat(filePrs, "\\", Path.GetFileName(filename))); this.FileStatus.Created = true; this.FileStatus.Status = true; this.FileStatus.FileOutName = string.Concat( fileOut, "\\", Path.GetFileNameWithoutExtension(filename), ".edi"); } else { Func_File_Move( string.Concat(fileOut, "\\", Path.GetFileNameWithoutExtension(filename), ".edi"), string.Concat(fileErr, "\\", Path.GetFileNameWithoutExtension(filename), ".edi")); Func_File_Move(filename, string.Concat(fileErr, "\\", Path.GetFileName(filename))); this.FileStatus.Created = false; this.FileStatus.Status = false; this.FileStatus.FileErrName = string.Concat(fileOut, "\\", Path.GetFileName(filename)); } } } return this.FileStatus; }