Beispiel #1
0
        private BusinessPartnerResponse CreateSetSupplierResponse(SupplierBundleMaintainConfirmationMessage_sync_V1 sapResponse)
        {
            BusinessPartnerResponse response = new BusinessPartnerResponse();
            BaseResponse            tempRes  = SapLogParser.ParseSapResponseLog(sapResponse.Log);

            response.Errors   = tempRes.Errors;
            response.Warnings = tempRes.Warnings;

            if (sapResponse.Supplier != null)
            {
                var getAllDetails = CreateSupplierQuery(sapResponse.Supplier[0].InternalID);

                if (getAllDetails.Supplier != null)
                {
                    response.BpExternalId = getAllDetails.Supplier[0].InternalID;

                    if (getAllDetails.Supplier[0].PurchasingData != null)
                    {
                        response.SupplierDetails               = new AccountTypeDetails();
                        response.SupplierDetails.CurrencyID    = getAllDetails.Supplier[0].PurchasingData.PurchaseOrderCurrencyCode;
                        response.SupplierDetails.PaymentTermID = getAllDetails.Supplier[0].PurchasingData.CashDiscountTermsCode != null ?
                                                                 getAllDetails.Supplier[0].PurchasingData.CashDiscountTermsCode.Value : null;
                    }
                }
            }

            return(response);
        }
Beispiel #2
0
        public BusinessPartnerResponse SetSupplierFromBusinessPartner(string externalId, string billingCountry)
        {
            var query = new SupplierBundleMaintainRequestMessage_sync_V1();
            SupplierMaintainRequestBundleSupplier_V1 supplier = new SupplierMaintainRequestBundleSupplier_V1();

            supplier.InternalID = externalId;
            supplier.CreateFromBusinessPartnerIndicator          = true;
            supplier.CreateFromBusinessPartnerIndicatorSpecified = true;
            supplier.actionCode          = ActionCode.Item02;
            supplier.actionCodeSpecified = true;

            _sapOrgs = _sapService.SetOrgsFromDb();
            //supplier.paymentDataListCompleteTransmissionIndicator = true;
            //supplier.paymentDataListCompleteTransmissionIndicatorSpecified = true;
            //supplier.PaymentData = new SupplierMaintainRequestBundlePaymentData[_sapOrgs.Sales.Count];

            foreach (var company in _sapOrgs.Companies)
            {
                //int index = _sapOrgs.Companies.IndexOf(company);
                //var paymentData = new SupplierMaintainRequestBundlePaymentData();
                //paymentData.CompanyID = company.Company;

                //paymentData.AccountDeterminationCreditorGroupCode = new SupplierManageService.AccountDeterminationCreditorGroupCode();
                // paymentData.AccountDeterminationCreditorGroupCode.Value = company.CountryCode == billingCountry ? "4010" : "4020"; ;

                //paymentData.PaymentForm = new SupplierMaintainRequestBundlePaymentForm[1];
                //paymentData.PaymentForm[0] = new SupplierMaintainRequestBundlePaymentForm();
                //paymentData.PaymentForm[0].PaymentFormCode = "06";

                //supplier.PaymentData[index] = paymentData;
            }

            supplier.generalProductTaxExemptionListCompleteTransmissionIndicator          = true;
            supplier.generalProductTaxExemptionListCompleteTransmissionIndicatorSpecified = true;
            supplier.GeneralProductTaxExemption                = new SupplierMaintainRequestBundleGeneralProductTaxExemption[1];
            supplier.GeneralProductTaxExemption[0]             = new SupplierMaintainRequestBundleGeneralProductTaxExemption();
            supplier.GeneralProductTaxExemption[0].CountryCode = "US";
            supplier.GeneralProductTaxExemption[0].TaxTypeCode = new SupplierManageService.TaxTypeCode {
                listID = "US", Value = "1"
            };
            supplier.GeneralProductTaxExemption[0].ReasonCode = new SupplierManageService.TaxExemptionReasonCode {
                listID = "US", Value = "O"
            };

            supplier.communicationArrangementListCompleteTransmissionIndicator          = true;
            supplier.communicationArrangementListCompleteTransmissionIndicatorSpecified = true;
            supplier.CommunicationArrangement    = new SupplierMaintainRequestBundleCommunicationArrangement[1];
            supplier.CommunicationArrangement[0] = new SupplierMaintainRequestBundleCommunicationArrangement();
            supplier.CommunicationArrangement[0].CommunicationMediumTypeCode       = new SupplierManageService.CommunicationMediumTypeCode();
            supplier.CommunicationArrangement[0].CommunicationMediumTypeCode.Value = "PRT";
            supplier.CommunicationArrangement[0].OutputCopyNumberValueSpecified    = true;
            supplier.CommunicationArrangement[0].OutputCopyNumberValue             = 1;

            SupplierMaintainRequestBundleSupplier_V1[] supplierArray = new SupplierMaintainRequestBundleSupplier_V1[1];
            supplierArray[0] = supplier;
            query.Supplier   = supplierArray;

            SupplierBundleMaintainConfirmationMessage_sync_V1 sapResponse = _manageClient.MaintainBundle_V1(query);

            return(CreateSetSupplierResponse(sapResponse));
        }