/// <summary>
        ///  İrsaliye Yanıtı'nın(Receipt Advice) UBL' ini oluşturma
        /// </summary>
        /// <returns>İrsaliye Yanıtı UBL'i</returns>
        public ReceiptAdviceType CreateReceiptAdvice(string vknTckn, DateTime tarih, string UUID)
        {
            //İrsaliye Yanıtı kalem sayısını random olarak üretme
            Random rnd        = new Random();
            int    lineNumber = rnd.Next(1, 10);

            ReceiptAdviceType irsaliyeYaniti = SetReceiptHeader(lineNumber, tarih);

            irsaliyeYaniti.OrderReference              = SetOrderReference();
            irsaliyeYaniti.DespatchDocumentReference   = SetDocumentReference(UUID);
            irsaliyeYaniti.AdditionalDocumentReference = SetAdditionalDocumentReference();
            irsaliyeYaniti.Signature = SetSignature();
            switch (vknTckn.Length)
            {
            case 10:
                irsaliyeYaniti.DeliveryCustomerParty = SetCustomerParty(vknTckn, "VKN");
                irsaliyeYaniti.DespatchSupplierParty = SetSupplierParty(vknTckn, "VKN");
                break;

            case 11:
                irsaliyeYaniti.DeliveryCustomerParty = SetCustomerParty(vknTckn, "TCKN");
                irsaliyeYaniti.DespatchSupplierParty = SetSupplierParty(vknTckn, "TCKN");
                break;
            }

            irsaliyeYaniti.Shipment    = SetShipment(lineNumber);
            irsaliyeYaniti.ReceiptLine = SetReceiptLine(lineNumber);

            return(irsaliyeYaniti);
        }
示例#2
0
        public void ReadReceiptAdvice()
        {
            string            filename = "UBL-ReceiptAdvice-2.0-Example.xml";
            ReceiptAdviceType doc      = UblDoc <ReceiptAdviceType> .Create(filename);

            Assert.AreEqual("Heremouthshire", (string)doc.DespatchSupplierParty.Party.PostalAddress.CountrySubentity);
            bool areEqual = UblXmlComparer.IsCopyEqual <ReceiptAdviceType>(filename, doc);

            Assert.IsTrue(areEqual, "Written UBL doc differs from original");
        }
        /// <summary>
        /// İrsaliye Yanıtı (Receipt Advice) UBL'inin header alanlarını oluşturma
        /// </summary>
        /// <returns>UBL'in Header Alanı</returns>
        private ReceiptAdviceType SetReceiptHeader(int lineNumber, DateTime tarih1)
        {
            XmlDocument doc = new XmlDocument();

            doc.LoadXml("<xml />");

            var irsaliyeYaniti = new ReceiptAdviceType
            {
                UBLExtensions = new[]   //UBL Dijital İmza Düğümü
                {
                    new UBLExtensionType
                    {
                        ExtensionContent = doc.DocumentElement
                    }
                },
                UBLVersionID = new UBLVersionIDType {
                    Value = "2.1"
                },                                                      //uluslararası fatura standardı 2.1
                CustomizationID = new CustomizationIDType {
                    Value = "TR1.2.1"
                },                                                                // GİB UBLTR olarak isimlendirdiği Türkiye'ye özgü 1.2.1 eİrsaliye formatını kullanıyor.
                ProfileID = new ProfileIDType {
                    Value = "TEMELIRSALIYE"
                },                                                          //Kullanılan Senaryo
                ID = new IDType {
                    Value = "GIB2018000000001"
                },                                               // İrsaliye Yanıtına Ait Numara
                CopyIndicator = new CopyIndicatorType {
                    Value = false
                },                                                        //İrsaliye Yanıtının Asıl veya Suret Bilgisi
                UUID = new UUIDType {
                    Value = Guid.NewGuid().ToString()
                },                                                          //İrsaliye Yanıtının Evrensel Tekliğini Sağlayan Numara
                IssueDate = new IssueDateType {
                    Value = tarih1
                },                                                 //İrsaliye Yanıtının Düzenleme Tarihi
                IssueTime = new IssueTimeType {
                    Value = default(DateTime).AddHours(11).AddMinutes(20)
                },                                                                                        //İrsaliye Yanıtının Düzenleme Zamanı
                ReceiptAdviceTypeCode = new ReceiptAdviceTypeCodeType {
                    Value = "SEVK"
                },            //İrsaliye Yanıtı Tipi Kodu
                Note = new[]  //İrsaliye Yanıtı İle İlgili Genel Açıklamalar
                {
                    new NoteType {
                        Value = "Ürünler geç teslim edildi.."
                    },
                },
                LineCountNumeric = new LineCountNumericType {
                    Value = lineNumber
                },                                                                   //İrsaliye Yanıtı Kalem Sayısı
            };

            return(irsaliyeYaniti);
        }
示例#4
0
        public static ReceiptAdviceType Create()
        {
            var doc = new ReceiptAdviceType
            {
                UBLVersionID    = "2.0",
                CustomizationID = "urn:oasis:names:specification:ubl:xpath:ReceiptAdvice-2.0:sbs-1.0-draft",
                ProfileID       = "bpid:urn:oasis:names:draft:bpss:ubl-2-sbs-receipt-advice-notification-draft",
                ID            = "658398",
                CopyIndicator = false,
                UUID          = "89F82FA6-5331-491D-83BC-7B6CA7FD047C",
                IssueDate     = "2005-06-21",
                Note          = new TextType[]
                {
                    new TextType
                    {
                        Value = "sample"
                    }
                },
                OrderReference = new OrderReferenceType[]
                {
                    new OrderReferenceType
                    {
                        ID           = "AEG012345",
                        SalesOrderID = "CON0095678",
                        UUID         = "6E09886B-DC6E-439F-82D1-7CCAC7F4E3B1",
                        IssueDate    = "2005-06-20"
                    }
                },
                DespatchDocumentReference = new DocumentReferenceType[]
                {
                    new DocumentReferenceType
                    {
                        ID        = "565899",
                        UUID      = "88C7280E-8F10-419F-9949-8EFFFA2842B8",
                        IssueDate = "2005-06-20"
                    }
                },
                DeliveryCustomerParty = new CustomerPartyType
                {
                    CustomerAssignedAccountID = "XFB01",
                    SupplierAssignedAccountID = "GT00978567",
                    Party = new PartyType
                    {
                        PartyName = new PartyNameType[]
                        {
                            new PartyNameType
                            {
                                Name = "IYT Corporation"
                            }
                        },
                        PostalAddress = new AddressType
                        {
                            StreetName       = "Avon Way",
                            BuildingName     = "Thereabouts",
                            BuildingNumber   = "56A",
                            CityName         = "Bridgtow",
                            PostalZone       = "ZZ99 1ZZ",
                            CountrySubentity = "Avon",
                            AddressLine      = new AddressLineType[]
                            {
                                new AddressLineType
                                {
                                    Line = "3rd Floor, Room 5"
                                }
                            },
                            Country = new CountryType
                            {
                                IdentificationCode = "GB"
                            }
                        },
                        PartyTaxScheme = new PartyTaxSchemeType[]
                        {
                            new PartyTaxSchemeType
                            {
                                RegistrationName = "Bridgtow District Council",
                                CompanyID        = "12356478",
                                ExemptionReason  = new TextType[]
                                {
                                    new TextType
                                    {
                                        Value = "Local Authority"
                                    }
                                },
                                TaxScheme = new TaxSchemeType
                                {
                                    ID          = "UK VAT",
                                    TaxTypeCode = "VAT"
                                }
                            }
                        },
                        Contact = new ContactType
                        {
                            Name           = "Mr Fred Churchill",
                            Telephone      = "0127 2653214",
                            Telefax        = "0127 2653215",
                            ElectronicMail = "*****@*****.**"
                        }
                    }
                },
                DespatchSupplierParty = new SupplierPartyType
                {
                    CustomerAssignedAccountID = "CO001",
                    Party = new PartyType
                    {
                        PartyName = new PartyNameType[]
                        {
                            new PartyNameType
                            {
                                Name = "Consortial"
                            }
                        },
                        PostalAddress = new AddressType
                        {
                            StreetName       = "Busy Street",
                            BuildingName     = "Thereabouts",
                            BuildingNumber   = "56A",
                            CityName         = "Farthing",
                            PostalZone       = "AA99 1BB",
                            CountrySubentity = "Heremouthshire",
                            AddressLine      = new AddressLineType[]
                            {
                                new AddressLineType
                                {
                                    Line = "The Roundabout"
                                }
                            },
                            Country = new CountryType
                            {
                                IdentificationCode = "GB"
                            }
                        },
                        PartyTaxScheme = new PartyTaxSchemeType[]
                        {
                            new PartyTaxSchemeType
                            {
                                RegistrationName = "Farthing Purchasing Consortium",
                                CompanyID        = "175 269 2355",
                                ExemptionReason  = new TextType[]
                                {
                                    new TextType
                                    {
                                        Value = "N/A"
                                    }
                                },
                                TaxScheme = new TaxSchemeType
                                {
                                    ID          = "VAT",
                                    TaxTypeCode = "VAT"
                                }
                            }
                        },
                        Contact = new ContactType
                        {
                            Name           = "Mrs Bouquet",
                            Telephone      = "0158 1233714",
                            Telefax        = "0158 1233856",
                            ElectronicMail = "*****@*****.**"
                        }
                    }
                },
                Shipment = new ShipmentType
                {
                    ID          = "1",
                    Consignment = new ConsignmentType[]
                    {
                        new ConsignmentType
                        {
                            ID = "1"
                        }
                    },
                    Delivery = new DeliveryType
                    {
                        ID       = "1",
                        Quantity = new QuantityType
                        {
                            unitCode = "KGM",
                            Value    = 90M
                        },
                        ActualDeliveryDate      = "2005-06-20",
                        ActualDeliveryTime      = "11:30:00.0Z",
                        RequestedDeliveryPeriod = new PeriodType
                        {
                            StartDate = "2005-06-20",
                            StartTime = "10:30:47.0Z",
                            EndDate   = "2005-06-21",
                            EndTime   = "10:30:47.0Z"
                        }
                    }
                },
                ReceiptLine = new ReceiptLineType[]
                {
                    new ReceiptLineType
                    {
                        ID   = "1",
                        Note = new TextType[]
                        {
                            new TextType
                            {
                                Value = "SAMPLE"
                            }
                        },
                        ReceivedQuantity = new QuantityType
                        {
                            unitCode = "KGM",
                            Value    = 90M
                        },
                        ShortQuantity = new QuantityType
                        {
                            unitCode = "KGM",
                            Value    = 10M
                        },
                        Item = new ItemType[]
                        {
                            new ItemType
                            {
                                Description = new TextType[]
                                {
                                    new TextType
                                    {
                                        Value = "Acme beeswax"
                                    }
                                },
                                Name = "beeswax",
                                BuyersItemIdentification = new ItemIdentificationType
                                {
                                    ID = "6578489"
                                },
                                SellersItemIdentification = new ItemIdentificationType
                                {
                                    ID = "17589683"
                                },
                                ItemInstance = new ItemInstanceType[]
                                {
                                    new ItemInstanceType
                                    {
                                        LotIdentification = new LotIdentificationType
                                        {
                                            LotNumberID = "546378239",
                                            ExpiryDate  = "2010-01-01"
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            };

            doc.Xmlns = new System.Xml.Serialization.XmlSerializerNamespaces(new[]
            {
                new XmlQualifiedName("cac", "urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2"),
                new XmlQualifiedName("cbc", "urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2"),
            });
            return(doc);
        }