示例#1
0
        /// <summary>
        /// Builds freight invoice.
        /// Original from https://ps.extra.chrysler.com/sites/itb-ebus/Documents/210FreightPaymentInvoice.pdf
        /// </summary>
        static TS210 BuildFreightInvoice(string controlNumber)
        {
            var result = new TS210();

            //  Transaction Set Identifier Code = “210”
            //  (Motor Carrier Freight Details and Invoice)
            //  Transaction Set Control Number = 00000001
            result.ST = new ST();
            result.ST.TransactionSetIdentifierCode_01 = "210";
            result.ST.TransactionSetControlNumber_02  = controlNumber.PadLeft(9, '0');

            //  Invoice Number = 3410889
            //  Shipment Identification Number = 545930791T
            //  Shipment Method of Payment
            //  = “TP” (Third Party)
            //  Weight Unit Code = “L” (Pounds)
            //  Date = 10 / 31 / 2007
            //  Net Amount Due = 51.65
            //  Delivery Date = 10 / 29 / 2007
            //  Date / Time Qualifier = “035” (Delivered)
            //  Standard Carrier Alpha Code = NLMI
            result.B3 = new B3();
            result.B3.InvoiceNumber_02 = "3410889";
            result.B3.ShipmentIdentificationNumber_03 = "545930791T";
            result.B3.ShipmentMethodofPayment_04      = "TP";
            result.B3.WeightUnitCode_05           = "L";
            result.B3.Date_06                     = "20071031";
            result.B3.NetAmountDue_07             = "5165";
            result.B3.DeliveryDate_09             = "20071029";
            result.B3.DateTimeQualifier_10        = "035";
            result.B3.StandardCarrierAlphaCode_11 = "NLMI";

            //  Currency Code = USD (U.S.)
            result.C3 = new C3();
            result.C3.CurrencyCode_01 = "USD";

            //  Repeating N9
            result.N9 = new List <N9>();

            //  Reference Identification Qualifier = “AE”
            //  (Authorization for Expense<AFE> Number)
            //  Reference Identification = 260451
            var n91 = new N9();

            n91.ReferenceIdentificationQualifier_01 = "AE";
            n91.ReferenceIdentification_02          = "260451";
            result.N9.Add(n91);

            //  Reference Identification Qualifier
            //  = “OP” (Original Purchase Order)
            //  Reference Identification = 3410889
            var n92 = new N9();

            n92.ReferenceIdentificationQualifier_01 = "OP";
            n92.ReferenceIdentification_02          = "3410889";
            result.N9.Add(n92);

            //  Repeating G62
            result.G62 = new List <G62>();

            //  Date Qualifier = “86” (Actual Pickup Date)
            //  Date = 10 / 31 / 2007
            var g62 = new G62();

            g62.DateQualifier_01 = "86";
            g62.Date_02          = "20071031";
            result.G62.Add(g62);

            //  Repeating R3
            result.R3 = new List <R3>();

            //  Standard Carrier Alpha Code = EXEM
            //  Routing Sequence Code
            //  = “B” (Origin / Delivery Carrier < Any Mode >)
            //  Transportation Method/ Type Code
            //  = “AE” (Air Express)
            //  Date = 10 / 31 / 2007
            //  Amount = 379.05
            var r3 = new R3();

            r3.StandardCarrierAlphaCode_01     = "EXEM";
            r3.RoutingSequenceCode_02          = "B";
            r3.TransportationMethodTypeCode_04 = "AE";
            r3.Date_07   = "20071031";
            r3.Amount_08 = "37905";
            result.R3.Add(r3);

            //  Repeating N1 Loops
            result.N1Loop = new List <Loop_N1_210>();

            //  Begin N1 Loop 1
            var n1Loop1 = new Loop_N1_210();

            //  Entity Identifier Code = “SH” (Shipper)
            //  Name = SIEMENS VDO S A DE C V –
            //  SIEMENS AUTOMOTIVE
            //  Identification Code Qualifier
            //  = “94” (Code assigned by the organization that is
            //  the ultimate destination of the transaction set)
            //  Identification Code = 99999
            n1Loop1.N1 = new N1();
            n1Loop1.N1.EntityIdentifierCode_01 = "SH";
            n1Loop1.N1.Name_02 = "SIEMENS VDO S A DE C V - SIEMENS AUTOMOTIVE";
            n1Loop1.N1.IdentificationCodeQualifier_03 = "94";
            n1Loop1.N1.IdentificationCode_04          = "99999";

            //  Repeating N3
            n1Loop1.N3 = new List <N3>();

            //  Address Information
            //  = PERIFERICO SUR 7999D COMPLEJO IND
            var n31 = new N3();

            n31.AddressInformation_01 = "PERIFERICO SUR 7999D COMPLEJO IND";
            n1Loop1.N3.Add(n31);

            //  City Name = TLAQUEPAQUE
            //  State or Province Code = MX
            //  Postal Code = 99999
            //  Country Code = MX
            n1Loop1.N4                        = new N4();
            n1Loop1.N4.CityName_01            = "TLAQUEPAQUE";
            n1Loop1.N4.StateorProvinceCode_02 = "MX";
            n1Loop1.N4.PostalCode_03          = "99999";
            n1Loop1.N4.CountryCode_04         = "MX";

            //  End N1 Loop 1
            result.N1Loop.Add(n1Loop1);

            //  Begin N1 Loop 2
            var n1Loop2 = new Loop_N1_210();

            //  Entity Identifier Code = “CN” (Consignee)
            //  Name = BRAMPTON ASSEMBLY – COLLINS
            //  AND AIKMAN
            //  Identification Code Qualifier
            //  = “94” (Code assigned by the organization that is
            //  the ultimate destination of the transaction set)
            //  Identification Code = 09126B
            n1Loop2.N1 = new N1();
            n1Loop2.N1.EntityIdentifierCode_01 = "CN";
            n1Loop2.N1.Name_02 = "BRAMPTON ASSEMBLY - COLLINS AND AIKMAN";
            n1Loop2.N1.IdentificationCodeQualifier_03 = "94";
            n1Loop2.N1.IdentificationCode_04          = "09126B";

            //  Repeating N3
            n1Loop2.N3 = new List <N3>();

            //  Address Information
            // = 500 LAIRD ROAD~GUELPH PRODUCTS
            var n32 = new N3();

            n32.AddressInformation_01 = "500 LAIRD ROAD";
            n32.AddressInformation_02 = "GUELPH PRODUCTS";
            n1Loop2.N3.Add(n32);

            //  City Name = GUELPH
            //  State or Province Code = ON
            //  Postal Code = 99999
            //  Country Code = CA
            n1Loop2.N4                        = new N4();
            n1Loop2.N4.CityName_01            = "GUELPH";
            n1Loop2.N4.StateorProvinceCode_02 = "ON";
            n1Loop2.N4.PostalCode_03          = "99999";
            n1Loop2.N4.CountryCode_04         = "CA";

            //  End N1 Loop 2
            result.N1Loop.Add(n1Loop2);

            //  Begin N1 Loop 3
            var n1Loop3 = new Loop_N1_210();

            //  Entity Identifier Code = “BT” (Bill-to-Party)
            //  Name = BRAMPTON ASSEMBLY - MAIN
            //  Identification Code Qualifier
            //  = “94” (Code assigned by the organization that is
            //  the ultimate destination of the transaction set)
            //  Identification Code = 09126
            n1Loop3.N1 = new N1();
            n1Loop3.N1.EntityIdentifierCode_01 = "BT";
            n1Loop3.N1.Name_02 = "BRAMPTON ASSEMBLY - MAIN";
            n1Loop3.N1.IdentificationCodeQualifier_03 = "94";
            n1Loop3.N1.IdentificationCode_04          = "09126";

            //  Repeating N3
            n1Loop3.N3 = new List <N3>();

            //  Address Information
            //  = 2000 WILLIAMS PARKWAY EAST
            var n33 = new N3();

            n33.AddressInformation_01 = "2000 WILLIAMS PARKWAY EAST";
            n1Loop3.N3.Add(n33);

            //  City Name = BRAMPTON
            //  State or Province Code = ON
            //  Postal Code = 99999
            //  Country Code = CA
            n1Loop3.N4                        = new N4();
            n1Loop3.N4.CityName_01            = "BRAMPTON";
            n1Loop3.N4.StateorProvinceCode_02 = "ON";
            n1Loop3.N4.PostalCode_03          = "99999";
            n1Loop3.N4.CountryCode_04         = "CA";

            //  End N1 Loop 3
            result.N1Loop.Add(n1Loop3);

            //  Begin N1 Loop 4
            var n1Loop4 = new Loop_N1_210();

            //  Entity Identifier Code = “CA” (Carrier)
            //  Name
            //  = NATIONAL LOGISTICS MANAGEMENT
            //  Identification Code Qualifier
            //  = “94” (Code assigned by the organization that is
            //  the ultimate destination of the transaction set)
            //  Identification Code = 45795
            n1Loop4.N1 = new N1();
            n1Loop4.N1.EntityIdentifierCode_01 = "CA";
            n1Loop4.N1.Name_02 = "NATIONAL LOGISTICS MANAGEMENT";
            n1Loop4.N1.IdentificationCodeQualifier_03 = "94";
            n1Loop4.N1.IdentificationCode_04          = "45795";

            //  Repeating N3
            n1Loop4.N3 = new List <N3>();

            //  Address Information = 14320 JOY RD.
            var n34 = new N3();

            n34.AddressInformation_01 = "14320 JOY RD.";
            n1Loop4.N3.Add(n34);

            //  City Name = DETROIT
            //  State or Province Code = MI
            //  Postal Code = 48228
            //  Country Code = US
            n1Loop4.N4                        = new N4();
            n1Loop4.N4.CityName_01            = "DETROIT";
            n1Loop4.N4.StateorProvinceCode_02 = "MI";
            n1Loop4.N4.PostalCode_03          = "48228";
            n1Loop4.N4.CountryCode_04         = "US";

            //  End N1 Loop 4
            result.N1Loop.Add(n1Loop4);

            //  Begin N1 Loop 5
            var n1Loop5 = new Loop_N1_210();

            //  Entity Identifier Code = “ZZ” (Mutually Defined)
            //  Name = EXPEDITORS / EMERY WORLDWIDE
            //  Identification Code Qualifier
            //  = “94” (Code assigned by the organization that is
            //  the ultimate destination of the transaction set)
            //  Identification Code = 37905
            n1Loop5.N1 = new N1();
            n1Loop5.N1.EntityIdentifierCode_01 = "ZZ";
            n1Loop5.N1.Name_02 = "EXPEDITORS/EMERY WORLDWIDE";
            n1Loop5.N1.IdentificationCodeQualifier_03 = "94";
            n1Loop5.N1.IdentificationCode_04          = "37905";

            //  Repeating N3
            n1Loop5.N3 = new List <N3>();

            //  Address Information = 10881 LOWELL AVENUE
            var n35 = new N3();

            n35.AddressInformation_01 = "10881 LOWELL AVENUE";
            n1Loop5.N3.Add(n35);

            //  City Name = OVERLANDPARK
            //  State or Province Code = KS
            //  Postal Code = 66201
            //  Country Code = US
            n1Loop5.N4                        = new N4();
            n1Loop5.N4.CityName_01            = "OVERLANDPARK";
            n1Loop5.N4.StateorProvinceCode_02 = "KS";
            n1Loop5.N4.PostalCode_03          = "66201";
            n1Loop5.N4.CountryCode_04         = "US";

            //  Repeating N9
            n1Loop5.N9 = new List <N9>();

            //  Reference Identification Qualifier
            //  = “IK” (Invoice Number)
            //  Reference Identification = 545930791T
            var n9 = new N9();

            n9.ReferenceIdentificationQualifier_01 = "IK";
            n9.ReferenceIdentification_02          = "545930791T";
            n1Loop5.N9.Add(n9);

            //  End N1 Loop 5
            result.N1Loop.Add(n1Loop5);

            //  Repeating N7 Loops
            result.N7Loop = new List <Loop_N7_210>();

            //  Begin N7 Loop
            var n7Loop1 = new Loop_N7_210();

            //  Equipment Number = 53456
            //  Equipment Description Code
            //  = “TL” (Trailer < not otherwise specified>)
            //  Equipment Length = 53 Feet
            //  Equipment Type
            //  = “53ST” (53 Foot Standard Trailer)
            n7Loop1.N7 = new N7();
            n7Loop1.N7.EquipmentNumber_02          = "53456";
            n7Loop1.N7.EquipmentDescriptionCode_11 = "TL";
            n7Loop1.N7.EquipmentLength_15          = "5300";
            n7Loop1.N7.EquipmentType_22            = "53ST";

            //  End N7 Loop
            result.N7Loop.Add(n7Loop1);

            //  Repeating LX Loops
            result.LXLoop = new List <Loop_LX_210>();

            //  Begin LX Loop
            var lxLoop1 = new Loop_LX_210();

            //  Assigned Number = 1
            lxLoop1.LX = new LX();
            lxLoop1.LX.AssignedNumber_01 = "1";

            //  Repeating L5
            lxLoop1.L5 = new List <L5>();

            //  Lading Line Item Number= 1
            //  Commodity Code = “2” (Auto Parts)
            //  Commodity Code Qualifier
            //  = “Z” (Mutually defined)
            var l5 = new L5();

            l5.LadingLineItemNumber_01   = "1";
            l5.CommodityCode_03          = "2";
            l5.CommodityCodeQualifier_04 = "Z";
            lxLoop1.L5.Add(l5);

            //  Repeating L0
            lxLoop1.L0 = new List <L0>();

            //  Lading Line Item Number = 1
            //  Billed / Rated -as Quantity = 1499
            //  Billed / Rated -as Qualifier = “FR” (Flat Rate)
            //  Weight = 1499
            //  Weight Qualifier = “G” (Gross)
            //  Weight Unit Code = “L” (Pounds)
            var l0 = new L0();

            l0.LadingLineItemNumber_01   = "1";
            l0.BilledRatedasQuantity_02  = "1499";
            l0.BilledRatedasQualifier_03 = "FR";
            l0.Weight_04          = "1499";
            l0.WeightQualifier_05 = "G";
            l0.WeightUnitCode_11  = "L";
            lxLoop1.L0.Add(l0);

            //  Repeating L0
            lxLoop1.L1 = new List <L1>();

            //  Lading Line Item Number = 1
            //  Freight Rate = 51.65
            //  Rate / Value Qualifier = “FR” (Flat Rate)
            //  Charge = 51.65
            //  Special Charge or Allowance Code
            //  = “400” (Freight)
            var l1 = new L1();

            l1.LadingLineItemNumber_01 = "1";
            l1.FreightRate_02          = "51.65";
            l1.RateValueQualifier_03   = "FR";
            l1.Charge_04 = "5165";
            l1.SpecialChargeorAllowanceCode_08 = "400";
            lxLoop1.L1.Add(l1);

            //  End LX Loop
            result.LXLoop.Add(lxLoop1);

            //  Weight = 2619
            //  Weight Qualifier = “G” (Gross Weight)
            //  Charge = 51.65
            result.L3                    = new L3();
            result.L3.Weight_01          = "2619";
            result.L3.WeightQualifier_02 = "G";
            result.L3.Charge_05          = "5165";

            return(result);
        }
        /// <summary>
        /// Builds Rail Carrier Shipment.
        /// Original from https://ps.nafta.extra.fcagroup.com/sites/itb-ebus/shared%20Documents/404RailCarrierShipmentInformation.pdf
        /// </summary>
        static TS404 BuildRailCarrierShipment(string controlNumber)
        {
            var result = new TS404();

            //  Transaction Set Identifier Code
            //  = “404” (Rail Carrier Shipment Information)
            //  Transaction Set Control Number = 0001
            result.ST = new ST();
            result.ST.TransactionSetIdentifierCode_01 = "404";
            result.ST.TransactionSetControlNumber_02  = controlNumber.PadLeft(9, '0');

            //  Transaction Set Purpose Code = “00” (Original)
            //  Transportation Method/ Type Code = “R” (Rail)
            //  Shipment Method of Payment
            //  = “11” (Rule 11 Shipment)
            //  Standard Carrier Alpha Code = NS
            //  Weight Unit Code = ”L” (Pounds)
            //  Shipment Qualifier
            //  = “B” (Bill of Lading for Individual Shipment)
            //  Section Seven Code = “N” (Not in Effect)
            result.BX = new BX();
            result.BX.TransactionSetPurposeCode_01    = "00";
            result.BX.TransportationMethodTypeCode_02 = "R";
            result.BX.ShipmentMethodofPayment_03      = "11";
            result.BX.StandardCarrierAlphaCode_05     = "NS";
            result.BX.WeightUnitCode_06    = "L";
            result.BX.ShipmentQualifier_07 = "B";
            result.BX.SectionSevenCode_08  = "N";

            //  Shipment Weight Code
            //  = “A” (Shipper's Weight Agreement)
            //  Billing Code = “S” (Single Shipment Billing)
            result.BNX = new BNX();
            result.BNX.ShipmentWeightCode_01 = "A";
            result.BNX.BillingCode_03        = "S";

            //  Release Code = “R” (Released with Billing Data)
            //  Date = 03 / 01 / 2000
            //  Time = 11:16
            //  Time Code = “LT” (Local Time)
            result.M3 = new M3();
            result.M3.ReleaseCode_01 = "R";
            result.M3.Date_02        = "20000301";
            result.M3.Time_03        = "1116";
            result.M3.TimeCode_04    = "LT";

            //  Repeating N9
            result.N9 = new List <N9>();

            //  Reference Identification Qualifier
            //  = “BM” (Bill of Lading Number)
            //  Reference Identification = 2041247
            //  Date = 03 / 01 / 2000
            //  Time = 11:16
            //  Time Code = “LT” (Local Time)
            var n9 = new N9();

            n9.ReferenceIdentificationQualifier_01 = "BM";
            n9.ReferenceIdentification_02          = "2041247";
            n9.Date_04     = "20000301";
            n9.Time_05     = "1116";
            n9.TimeCode_06 = "LT";
            result.N9.Add(n9);

            //  Repeating N7 Loops
            result.N7Loop = new List <Loop_N7_404>();

            //  Begin N7 Loop
            var n7Loop1 = new Loop_N7_404();

            //  Equipment Initial = CR
            //  Equipment Number = 237522
            //  Weight = 80,503
            //  Weight Qualifier = “N” (Actual Net Weight)
            //  Equipment Description Code = “RR” (Rail Car)
            n7Loop1.N7 = new N7();
            n7Loop1.N7.EquipmentInitial_01         = "CR";
            n7Loop1.N7.EquipmentNumber_02          = "237522";
            n7Loop1.N7.Weight_03                   = "80503";
            n7Loop1.N7.WeightQualifier_04          = "N";
            n7Loop1.N7.EquipmentDescriptionCode_11 = "RR";

            //  Repeating M7
            n7Loop1.M7 = new List <M7>();

            //  Seal Number = 582127
            //  Seal Number = 582128
            var m7 = new M7();

            m7.SealNumber_01 = "582127";
            m7.SealNumber_02 = "582128";
            n7Loop1.M7.Add(m7);

            //  End N7 Loop
            result.N7Loop.Add(n7Loop1);

            //  City Name = WARREN
            //  State or Province Code = MI
            result.F9                        = new F9();
            result.F9.CityName_02            = "WARREN";
            result.F9.StateorProvinceCode_03 = "MI";

            //  City Name = VALLEY PARK
            //  State or Province Code = MO
            result.D9                        = new D9();
            result.D9.CityName_02            = "VALLEY PARK";
            result.D9.StateorProvinceCode_03 = "MO";

            //  Repeating N1 Loops
            result.N1Loop = new List <Loop_N1_404_3>();

            //  Begin N1 Loop 1
            var n1Loop1 = new Loop_N1_404_3();

            //  Entity Identifier Code = “11”
            //  (Party to be billed < AAR Accounting Rule 11 >)
            //  Name = CORPAY SOLUTIONS
            n1Loop1.N1 = new N1();
            n1Loop1.N1.EntityIdentifierCode_01 = "11";
            n1Loop1.N1.Name_02 = "CORPAY SOLUTIONS";

            //  Repeating N3
            n1Loop1.N3 = new List <N3>();

            //  Address Information
            //  = PO BOX 195199 / 2065 S CENTER RD
            var n31 = new N3();

            n31.AddressInformation_01 = "PO BOX 195199/2065 S CENTER RD";
            n1Loop1.N3.Add(n31);

            //  City Name = BURTON
            //  State or Province Code = MI
            //  Postal Code = 48519
            n1Loop1.N4                        = new N4();
            n1Loop1.N4.CityName_01            = "BURTON";
            n1Loop1.N4.StateorProvinceCode_02 = "MI";
            n1Loop1.N4.PostalCode_03          = "48519";

            //  End N1 Loop 1
            result.N1Loop.Add(n1Loop1);

            //  Begin N1 Loop 2
            var n1Loop2 = new Loop_N1_404_3();

            //  Entity Identifier Code = “CN” (Consignee)
            //  Name = ST LOUIS ASSEMBLY I
            //  Identification Code Qualifier
            //  = “93” (Code assigned by the organization
            //  originating the transaction set)
            //  Identification Code = 04087
            n1Loop2.N1 = new N1();
            n1Loop2.N1.EntityIdentifierCode_01 = "CN";
            n1Loop2.N1.Name_02 = "ST LOUIS ASSEMBLY I";
            n1Loop2.N1.IdentificationCodeQualifier_03 = "93";
            n1Loop2.N1.IdentificationCode_04          = "04087";

            //  Repeating N3
            n1Loop2.N3 = new List <N3>();

            //  Address Information
            //  = 1001 N HIGHWAY DRIVE
            var n32 = new N3();

            n32.AddressInformation_01 = "1001 N HIGHWAY DRIVE";
            n1Loop2.N3.Add(n32);

            //  City Name = FENTON
            //  State or Province Code = MO
            //  Postal Code = 63026
            n1Loop2.N4                        = new N4();
            n1Loop2.N4.CityName_01            = "FENTON";
            n1Loop2.N4.StateorProvinceCode_02 = "MO";
            n1Loop2.N4.PostalCode_03          = "63026";

            //  End N1 Loop 2
            result.N1Loop.Add(n1Loop2);

            //  Begin N1 Loop 3
            var n1Loop3 = new Loop_N1_404_3();

            //  Entity Identifier Code
            //  = “UC” (Ultimate Consignee)
            //  Name = ST LOUIS ASSEMBLY I
            //  Identification Code Qualifier
            //  = “93” (Code assigned by the organization
            //  originating the transaction set)
            //  Identification Code = 04087
            n1Loop3.N1 = new N1();
            n1Loop3.N1.EntityIdentifierCode_01 = "UC";
            n1Loop3.N1.Name_02 = "ST LOUIS ASSEMBLY I";
            n1Loop3.N1.IdentificationCodeQualifier_03 = "93";
            n1Loop3.N1.IdentificationCode_04          = "04087";

            //  Repeating N3
            n1Loop3.N3 = new List <N3>();

            //  Address Information
            //  = 1001 N HIGHWAY DRIVE
            var n33 = new N3();

            n33.AddressInformation_01 = "1001 N HIGHWAY DRIVE";
            n1Loop3.N3.Add(n33);

            //  City Name = FENTON
            //  State or Province Code = MO
            //  Postal Code = 63026
            n1Loop3.N4                        = new N4();
            n1Loop3.N4.CityName_01            = "FENTON";
            n1Loop3.N4.StateorProvinceCode_02 = "MO";
            n1Loop3.N4.PostalCode_03          = "63026";

            //  End N1 Loop 3
            result.N1Loop.Add(n1Loop3);

            //  Begin N1 Loop 4
            var n1Loop4 = new Loop_N1_404_3();

            //  Entity Identifier Code = “SH” (Shipper)
            //  Name = STERLING STAMPING
            //  Identification Code Qualifier
            //  = “93” (Code assigned by the organization
            //  originating the transaction set)
            //  Identification Code = 06215
            n1Loop4.N1 = new N1();
            n1Loop4.N1.EntityIdentifierCode_01 = "SH";
            n1Loop4.N1.Name_02 = "STERLING STAMPING";
            n1Loop4.N1.IdentificationCodeQualifier_03 = "93";
            n1Loop4.N1.IdentificationCode_04          = "06215";

            //  Repeating N3
            n1Loop4.N3 = new List <N3>();

            //  Address = 35777 VAN DYKE RD
            var n34 = new N3();

            n34.AddressInformation_01 = "35777 VAN DYKE RD";
            n1Loop4.N3.Add(n34);

            //  City Name = STERLING HEIGHTS
            //  State or Province Code = MI
            //  Postal Code = 48312
            n1Loop4.N4                        = new N4();
            n1Loop4.N4.CityName_01            = "STERLING HEIGHTS";
            n1Loop4.N4.StateorProvinceCode_02 = "MI";
            n1Loop4.N4.PostalCode_03          = "48312";

            //  End N1 Loop 4
            result.N1Loop.Add(n1Loop4);

            //  Repeating R2
            result.R2 = new List <R2>();

            //  Standard Carrier Alpha Code = NS
            //  Routing Sequence Code
            //  = “R” (Origin Carrier, Rule 11 Shipment)
            //  City Name = ESTL
            var r21 = new R2();

            r21.StandardCarrierAlphaCode_01 = "NS";
            r21.RoutingSequenceCode_02      = "R";
            r21.CityName_03 = "ESTL";
            result.R2.Add(r21);

            //  Standard Carrier Alpha Code = BNSF
            //  Routing Sequence Code
            //  = “1” (1st Carrier after Origin Carrier)
            var r22 = new R2();

            r22.StandardCarrierAlphaCode_01 = "BNSF";
            r22.RoutingSequenceCode_02      = "1";
            result.R2.Add(r22);

            //  Repeating LX Loops
            result.LXLoop = new List <Loop_LX_404>();

            //  Begin LX Loop
            var lxLoop1 = new Loop_LX_404();

            //  Assigned Number = 1
            lxLoop1.LX = new LX();
            lxLoop1.LX.AssignedNumber_01 = "1";

            //  Repeating L5
            lxLoop1.L5 = new List <L5>();

            //  Lading Line Item Number = 1
            //  Lading Description = AUTO PARTS
            //  Commodity Code = 3714993
            //  Commodity Code Qualifier
            //  = “T” (Standard Transportation Commodity
            //  Code<STCC>)
            var l5 = new L5();

            l5.LadingLineItemNumber_01   = "1";
            l5.LadingDescription_02      = "AUTO PARTS";
            l5.CommodityCode_03          = "3714993";
            l5.CommodityCodeQualifier_04 = "T";
            lxLoop1.L5.Add(l5);

            //  Repeating L0 Loops
            lxLoop1.L0Loop = new List <Loop_L0_404>();

            //  Begin L0 Loop
            var l0Loop1 = new Loop_L0_404();

            //  Lading Line Item Number = 1
            //  Weight = 80,503
            //  Weight Qualifier = “N” (Actual Net Weight)
            //  Lading Quantity = 42
            //  Packaging Form Code = “RCK” (Rack)
            l0Loop1.L0 = new L0();
            l0Loop1.L0.LadingLineItemNumber_01 = "1";
            l0Loop1.L0.Weight_04            = "80503";
            l0Loop1.L0.WeightQualifier_05   = "N";
            l0Loop1.L0.LadingQuantity_08    = "42";
            l0Loop1.L0.PackagingFormCode_09 = "RCK";

            //  End L0 Loop
            lxLoop1.L0Loop.Add(l0Loop1);

            //  End LX Loop
            result.LXLoop.Add(lxLoop1);

            return(result);
        }
示例#3
0
        private void frm_PSC_CG_Load(object sender, EventArgs e)
        {
            dgv.Rows.Clear();

            dgv.Rows.Add("Distance (m)",
                         L1.ToString("f3"),
                         L2.ToString("f3"),
                         L3.ToString("f3"),
                         L4.ToString("f3"),
                         L5.ToString("f3"),
                         L6.ToString("f3"),
                         L7.ToString("f3"),
                         L8.ToString("f3"),
                         L9.ToString("f3"));

            dgv.Rows.Add("Cable 'e' (mm)",
                         Cable_E.F1.ToString("f3"),
                         Cable_E.F2.ToString("f3"),
                         Cable_E.F3.ToString("f3"),
                         Cable_E.F4.ToString("f3"),
                         Cable_E.F5.ToString("f3"),
                         Cable_E.F6.ToString("f3"),
                         Cable_E.F7.ToString("f3"),
                         Cable_E.F8.ToString("f3"),
                         Cable_E.F9.ToString("f3"));
            dgv.Rows.Add("Cable 'd' (mm)",
                         Cable_D.F1.ToString("f3"),
                         Cable_D.F2.ToString("f3"),
                         Cable_D.F3.ToString("f3"),
                         Cable_D.F4.ToString("f3"),
                         Cable_D.F5.ToString("f3"),
                         Cable_D.F6.ToString("f3"),
                         Cable_D.F7.ToString("f3"),
                         Cable_D.F8.ToString("f3"),
                         Cable_D.F9.ToString("f3"));
            dgv.Rows.Add("Cable 'c' (mm)",
                         Cable_C.F1.ToString("f3"),
                         Cable_C.F2.ToString("f3"),
                         Cable_C.F3.ToString("f3"),
                         Cable_C.F4.ToString("f3"),
                         Cable_C.F5.ToString("f3"),
                         Cable_C.F6.ToString("f3"),
                         Cable_C.F7.ToString("f3"),
                         Cable_C.F8.ToString("f3"),
                         Cable_C.F9.ToString("f3"));


            dgv.Rows.Add("Cable 'b' (mm)",
                         Cable_B.F1.ToString("f3"),
                         Cable_B.F2.ToString("f3"),
                         Cable_B.F3.ToString("f3"),
                         Cable_B.F4.ToString("f3"),
                         Cable_B.F5.ToString("f3"),
                         Cable_B.F6.ToString("f3"),
                         Cable_B.F7.ToString("f3"),
                         Cable_B.F8.ToString("f3"),
                         Cable_B.F9.ToString("f3"));
            dgv.Rows.Add("Cable 'a' (mm)",
                         Cable_A.F1.ToString("f3"),
                         Cable_A.F2.ToString("f3"),
                         Cable_A.F3.ToString("f3"),
                         Cable_A.F4.ToString("f3"),
                         Cable_A.F5.ToString("f3"),
                         Cable_A.F6.ToString("f3"),
                         Cable_A.F7.ToString("f3"),
                         Cable_A.F8.ToString("f3"),
                         Cable_A.F9.ToString("f3"));

            //Average
            Cable_CG = ((Cable_A + Cable_B + Cable_C + Cable_D + Cable_E) / 5.0);


            dgv.Rows.Add("CG",
                         Cable_CG.F1.ToString("f3"),
                         Cable_CG.F2.ToString("f3"),
                         Cable_CG.F3.ToString("f3"),
                         Cable_CG.F4.ToString("f3"),
                         Cable_CG.F5.ToString("f3"),
                         Cable_CG.F6.ToString("f3"),
                         Cable_CG.F7.ToString("f3"),
                         Cable_CG.F8.ToString("f3"),
                         Cable_CG.F9.ToString("f3"));


            dgv.Rows[0].ReadOnly = true;
            dgv.Rows[0].Frozen   = true;
            dgv.Rows[0].DefaultCellStyle.ForeColor = Color.Blue;

            dgv.Rows[6].ReadOnly = true;
            dgv.Rows[6].Frozen   = true;
            dgv.Rows[6].DefaultCellStyle.ForeColor = Color.Blue;
        }
示例#4
0
    // Update is called once per frame
    void Update()
    {
        NowCursorState = tmpCursor.GetComponent <AnimatedCursor>().tmpCursorState;

        PlaceBtnState  = PlaceButton.GetComponent <ButtonInteraction>().NowButtonState;
        DeleteBtnState = DeleteButton.GetComponent <ButtonInteraction>().NowButtonState;
        CancelBtnState = CancelButton.GetComponent <ButtonInteraction>().NowButtonState;


        lineRenderer = GetComponent <LineRenderer>();

        //Debug.Log("Cursor Position: " + tmpCursor.transform.position);

        //Vector3 CursorPosition = tmpCursor.GetComponent<Transform>().position;

        if ((ButtonInteraction.PosState == PosButtonType.PLACE) && (NowCursorState == CursorStateEnum.Release) &&
            (PlaceBtnState != ButtonStateEnum.Targeted) && (PlaceBtnState != ButtonStateEnum.Pressed) &&
            (DeleteBtnState != ButtonStateEnum.Observation) && (CancelBtnState != ButtonStateEnum.Observation))
        {
            if (SizeButtonCollection.SizeButtonState == SizeButtonType.MEDIUM)
            {
                offset = 6.0f;
            }
            else if (SizeButtonCollection.SizeButtonState == SizeButtonType.LARGE)
            {
                offset = 8.0f;
            }
            else if (SizeButtonCollection.SizeButtonState == SizeButtonType.SMALL)
            {
                offset = 5.0f;
            }

            Vector3 FinalPos = tmpCursor.transform.position - new Vector3(0f, 0f, 0.1f) * offset;
            Instantiate(PlaneObject, FinalPos, transform.rotation, this.transform);   //Genarate the drone

            ChildCount = this.transform.childCount;

            /*Use to process the three Red Light*/

            if (ChildCount > 1)
            {
                Vector3 pos1, pos2;                                                                          //the position of two way point(drone)
                Vector3 p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15, p16, p17, p18; //Red light initial position
                pos1 = this.gameObject.transform.GetChild(ChildCount - 2).transform.position;
                pos2 = this.gameObject.transform.GetChild(ChildCount - 1).transform.position;

                p0  = (pos1 * 1 + pos2 * 19) / 20;
                p1  = (pos1 * 2 + pos2 * 18) / 20;
                p2  = (pos1 * 3 + pos2 * 17) / 20;
                p3  = (pos1 * 4 + pos2 * 16) / 20;
                p4  = (pos1 * 5 + pos2 * 15) / 20;
                p5  = (pos1 * 6 + pos2 * 14) / 20;
                p6  = (pos1 * 7 + pos2 * 13) / 20;
                p7  = (pos1 * 8 + pos2 * 12) / 20;
                p8  = (pos1 * 9 + pos2 * 11) / 20;
                p9  = (pos1 * 10 + pos2 * 10) / 20;
                p10 = (pos1 * 11 + pos2 * 9) / 20;
                p11 = (pos1 * 12 + pos2 * 8) / 20;
                p12 = (pos1 * 13 + pos2 * 7) / 20;
                p13 = (pos1 * 14 + pos2 * 6) / 20;
                p14 = (pos1 * 15 + pos2 * 5) / 20;

                p15 = (pos1 * 16 + pos2 * 4) / 20;
                p16 = (pos1 * 17 + pos2 * 3) / 20;
                p17 = (pos1 * 18 + pos2 * 2) / 20;
                p18 = (pos1 * 19 + pos2 * 1) / 20;


                L0 = Instantiate(CloneRedLight_0, p0, this.gameObject.transform.GetChild(ChildCount - 2).transform.rotation, LightManager.transform);
                L0.GetComponent <RedLightPos>().Obj1        = this.gameObject.transform.GetChild(ChildCount - 2).gameObject;
                L0.GetComponent <RedLightPos>().Obj2        = this.gameObject.transform.GetChild(ChildCount - 1).gameObject;
                L0.GetComponent <RedLightPos>().Current_Num = ChildCount - 2;

                L1 = Instantiate(CloneRedLight_1, p1, this.gameObject.transform.GetChild(ChildCount - 2).transform.rotation, LightManager.transform);
                L1.GetComponent <RedLightPos>().Obj1        = this.gameObject.transform.GetChild(ChildCount - 2).gameObject;
                L1.GetComponent <RedLightPos>().Obj2        = this.gameObject.transform.GetChild(ChildCount - 1).gameObject;
                L1.GetComponent <RedLightPos>().Current_Num = ChildCount - 2;

                L2 = Instantiate(CloneRedLight_2, p2, this.gameObject.transform.GetChild(ChildCount - 2).transform.rotation, LightManager.transform);
                L2.GetComponent <RedLightPos>().Obj1        = this.gameObject.transform.GetChild(ChildCount - 2).gameObject;
                L2.GetComponent <RedLightPos>().Obj2        = this.gameObject.transform.GetChild(ChildCount - 1).gameObject;
                L2.GetComponent <RedLightPos>().Current_Num = ChildCount - 2;

                L3 = Instantiate(CloneRedLight_3, p3, this.gameObject.transform.GetChild(ChildCount - 2).transform.rotation, LightManager.transform);
                L3.GetComponent <RedLightPos>().Obj1        = this.gameObject.transform.GetChild(ChildCount - 2).gameObject;
                L3.GetComponent <RedLightPos>().Obj2        = this.gameObject.transform.GetChild(ChildCount - 1).gameObject;
                L3.GetComponent <RedLightPos>().Current_Num = ChildCount - 2;

                L4 = Instantiate(CloneRedLight_4, p4, this.gameObject.transform.GetChild(ChildCount - 2).transform.rotation, LightManager.transform);
                L4.GetComponent <RedLightPos>().Obj1        = this.gameObject.transform.GetChild(ChildCount - 2).gameObject;
                L4.GetComponent <RedLightPos>().Obj2        = this.gameObject.transform.GetChild(ChildCount - 1).gameObject;
                L4.GetComponent <RedLightPos>().Current_Num = ChildCount - 2;

                L5 = Instantiate(CloneRedLight_5, p5, this.gameObject.transform.GetChild(ChildCount - 2).transform.rotation, LightManager.transform);
                L5.GetComponent <RedLightPos>().Obj1        = this.gameObject.transform.GetChild(ChildCount - 2).gameObject;
                L5.GetComponent <RedLightPos>().Obj2        = this.gameObject.transform.GetChild(ChildCount - 1).gameObject;
                L5.GetComponent <RedLightPos>().Current_Num = ChildCount - 2;

                L6 = Instantiate(CloneRedLight_6, p6, this.gameObject.transform.GetChild(ChildCount - 2).transform.rotation, LightManager.transform);
                L6.GetComponent <RedLightPos>().Obj1        = this.gameObject.transform.GetChild(ChildCount - 2).gameObject;
                L6.GetComponent <RedLightPos>().Obj2        = this.gameObject.transform.GetChild(ChildCount - 1).gameObject;
                L6.GetComponent <RedLightPos>().Current_Num = ChildCount - 2;

                L7 = Instantiate(CloneRedLight_7, p7, this.gameObject.transform.GetChild(ChildCount - 2).transform.rotation, LightManager.transform);
                L7.GetComponent <RedLightPos>().Obj1        = this.gameObject.transform.GetChild(ChildCount - 2).gameObject;
                L7.GetComponent <RedLightPos>().Obj2        = this.gameObject.transform.GetChild(ChildCount - 1).gameObject;
                L7.GetComponent <RedLightPos>().Current_Num = ChildCount - 2;

                L8 = Instantiate(CloneRedLight_8, p8, this.gameObject.transform.GetChild(ChildCount - 2).transform.rotation, LightManager.transform);
                L8.GetComponent <RedLightPos>().Obj1        = this.gameObject.transform.GetChild(ChildCount - 2).gameObject;
                L8.GetComponent <RedLightPos>().Obj2        = this.gameObject.transform.GetChild(ChildCount - 1).gameObject;
                L8.GetComponent <RedLightPos>().Current_Num = ChildCount - 2;

                L9 = Instantiate(CloneRedLight_9, p9, this.gameObject.transform.GetChild(ChildCount - 2).transform.rotation, LightManager.transform);
                L9.GetComponent <RedLightPos>().Obj1        = this.gameObject.transform.GetChild(ChildCount - 2).gameObject;
                L9.GetComponent <RedLightPos>().Obj2        = this.gameObject.transform.GetChild(ChildCount - 1).gameObject;
                L9.GetComponent <RedLightPos>().Current_Num = ChildCount - 2;

                L10 = Instantiate(CloneRedLight_10, p10, this.gameObject.transform.GetChild(ChildCount - 2).transform.rotation, LightManager.transform);
                L10.GetComponent <RedLightPos>().Obj1        = this.gameObject.transform.GetChild(ChildCount - 2).gameObject;
                L10.GetComponent <RedLightPos>().Obj2        = this.gameObject.transform.GetChild(ChildCount - 1).gameObject;
                L10.GetComponent <RedLightPos>().Current_Num = ChildCount - 2;

                L11 = Instantiate(CloneRedLight_11, p11, this.gameObject.transform.GetChild(ChildCount - 2).transform.rotation, LightManager.transform);
                L11.GetComponent <RedLightPos>().Obj1        = this.gameObject.transform.GetChild(ChildCount - 2).gameObject;
                L11.GetComponent <RedLightPos>().Obj2        = this.gameObject.transform.GetChild(ChildCount - 1).gameObject;
                L11.GetComponent <RedLightPos>().Current_Num = ChildCount - 2;

                L12 = Instantiate(CloneRedLight_12, p12, this.gameObject.transform.GetChild(ChildCount - 2).transform.rotation, LightManager.transform);
                L12.GetComponent <RedLightPos>().Obj1        = this.gameObject.transform.GetChild(ChildCount - 2).gameObject;
                L12.GetComponent <RedLightPos>().Obj2        = this.gameObject.transform.GetChild(ChildCount - 1).gameObject;
                L12.GetComponent <RedLightPos>().Current_Num = ChildCount - 2;

                L13 = Instantiate(CloneRedLight_13, p13, this.gameObject.transform.GetChild(ChildCount - 2).transform.rotation, LightManager.transform);
                L13.GetComponent <RedLightPos>().Obj1        = this.gameObject.transform.GetChild(ChildCount - 2).gameObject;
                L13.GetComponent <RedLightPos>().Obj2        = this.gameObject.transform.GetChild(ChildCount - 1).gameObject;
                L13.GetComponent <RedLightPos>().Current_Num = ChildCount - 2;

                L14 = Instantiate(CloneRedLight_14, p14, this.gameObject.transform.GetChild(ChildCount - 2).transform.rotation, LightManager.transform);
                L14.GetComponent <RedLightPos>().Obj1        = this.gameObject.transform.GetChild(ChildCount - 2).gameObject;
                L14.GetComponent <RedLightPos>().Obj2        = this.gameObject.transform.GetChild(ChildCount - 1).gameObject;
                L14.GetComponent <RedLightPos>().Current_Num = ChildCount - 2;


                /////////////////////////////////////////
                L15 = Instantiate(CloneRedLight_15, p15, this.gameObject.transform.GetChild(ChildCount - 2).transform.rotation, LightManager.transform);
                L15.GetComponent <RedLightPos>().Obj1        = this.gameObject.transform.GetChild(ChildCount - 2).gameObject;
                L15.GetComponent <RedLightPos>().Obj2        = this.gameObject.transform.GetChild(ChildCount - 1).gameObject;
                L15.GetComponent <RedLightPos>().Current_Num = ChildCount - 2;

                L16 = Instantiate(CloneRedLight_16, p16, this.gameObject.transform.GetChild(ChildCount - 2).transform.rotation, LightManager.transform);
                L16.GetComponent <RedLightPos>().Obj1        = this.gameObject.transform.GetChild(ChildCount - 2).gameObject;
                L16.GetComponent <RedLightPos>().Obj2        = this.gameObject.transform.GetChild(ChildCount - 1).gameObject;
                L16.GetComponent <RedLightPos>().Current_Num = ChildCount - 2;

                L17 = Instantiate(CloneRedLight_17, p17, this.gameObject.transform.GetChild(ChildCount - 2).transform.rotation, LightManager.transform);
                L17.GetComponent <RedLightPos>().Obj1        = this.gameObject.transform.GetChild(ChildCount - 2).gameObject;
                L17.GetComponent <RedLightPos>().Obj2        = this.gameObject.transform.GetChild(ChildCount - 1).gameObject;
                L17.GetComponent <RedLightPos>().Current_Num = ChildCount - 2;

                L18 = Instantiate(CloneRedLight_18, p18, this.gameObject.transform.GetChild(ChildCount - 2).transform.rotation, LightManager.transform);
                L18.GetComponent <RedLightPos>().Obj1        = this.gameObject.transform.GetChild(ChildCount - 2).gameObject;
                L18.GetComponent <RedLightPos>().Obj2        = this.gameObject.transform.GetChild(ChildCount - 1).gameObject;
                L18.GetComponent <RedLightPos>().Current_Num = ChildCount - 2;
            }

            //WayPoint.Add(tmp);
            //Debug.Log("InstantiateInstantiateInstantiateInstantiateInstantiateInstantiate");
        }


        /* Line Process*/
        ChildCount = this.transform.childCount;
        lineRenderer.SetVertexCount(ChildCount);


        if (ChildCount > 1)
        {
            for (int i = 0; i < ChildCount; i++)
            {
                tmp = this.gameObject.transform.GetChild(i).gameObject;
                lineRenderer.SetPosition(i, tmp.transform.position);
            }


            /*Obstacle Detect*/
            for (int i = 0; i < ChildCount - 1; i++)
            {
                Obj1 = this.gameObject.transform.GetChild(i).gameObject;
                Obj2 = this.gameObject.transform.GetChild(i + 1).gameObject;
                Ray        ray = new Ray(Obj1.transform.position, Obj2.transform.position - Obj1.transform.position);
                RaycastHit hit;

                //Debug.Log( i + " -> " + (i+1) + " distance : " + Vector3.Distance(Obj1.transform.position, Obj2.transform.position));
                float distance = Vector3.Distance(Obj1.transform.position, Obj2.transform.position) - 0.1f;

                Physics.Raycast(ray, out hit, distance, mask);

                //When collision is NOT NULL, there is obstacles
                if (hit.transform != null)
                {
                    lineRenderer.material = LineMat2; // if collision the line become red
                    //Debug.Log("BBBBBBBBB");

                    //LineCollision = false;   // Let Other Script Know Collision State
                    //LineCollisionNum = i + 1;

                    Debug.Log("Blocked by : " + hit.transform.name);
                }
                //If is NULL -> No Obstacles
                else if (hit.transform == null)
                {
                    lineRenderer.material = LineMat1;
                    //LineCollision = true;
                    //LineCollisionNum = -1;
                    //Debug.Log("NNNNNNNNN");
                }

                //Debug.Log("Line color : " + lineRenderer.material);
            }
        }

        //if(ChildCount == 2) lineRenderer.SetPosition(2, new Vector3(0,0,1));
    }