Exemplo n.º 1
0
 /// <summary>
 /// Closes the specified web.
 /// </summary>
 /// <param name="Web">The SharePoint site on which the workflow instance is located.</param>
 /// <param name="WebUrl">The URL of the SharePoint site on which the workflow instance is located.</param>
 /// <param name="ItemId">The ID of the list item on which the workflow instance is running.</param>
 /// <exception cref="CAS.SharePoint.ApplicationError">The account has been already closed.</exception>
 internal static void Close(SPWeb Web, string WebUrl, int ItemId)
 {
     using (Entities _entities = new Entities(WebUrl))
     {
         CustomsWarehouse _cw = Element.GetAtIndex <CustomsWarehouse>(_entities.CustomsWarehouse, ItemId);
         RequestContent   _newRequestContent = CreateContent(_entities, _cw);
         if (_cw.AccountClosed.GetValueOrDefault(false))
         {
             throw new CAS.SharePoint.ApplicationError("CloseAccount", "AccountClosed", "The account has been already closed.", null);
         }
         if (_cw.AccountBalance.GetValueOrDefault(-1) == 0)
         {
             //TODO check packages and value on last disposal.
             _cw.AccountClosed = true;
             _cw.ClosingDate   = DateTime.Today;
             _entities.SubmitChanges();
         }
         int?_requestId = _cw.CWL_CW2CWLibraryID.GetTargetId <CustomsWarehouseLib>();
         if (_requestId.HasValue)
         {
             File.WriteXmlFile <RequestContent>(Web, _requestId.Value, Entities.CustomsWarehouseLibName, _newRequestContent, RequestContent.StylesheetName);
         }
         else
         {
             string _documentName = Settings.ClearanceRequestFileName(_entities, ItemId);
             SPFile _newFile      = File.CreateXmlFile <RequestContent>(Web, _newRequestContent, _documentName, Entities.CustomsWarehouseLibName, RequestContent.StylesheetName);
             CustomsWarehouseLib _CustomsWarehouseLibEntry = Element.GetAtIndex <CustomsWarehouseLib>(_entities.CustomsWarehouseLibrary, _newFile.Item.ID);
             _CustomsWarehouseLibEntry.Archival = false;
             _cw.CWL_CW2CWLibraryID             = _CustomsWarehouseLibEntry;
             _entities.SubmitChanges();
         }
     }
 }
        internal static CheckListWebPartDataContract GetCheckListWebPartDataContract(WebsiteModel.Linq.Entities entities, WebsiteModel.Linq.DisposalRequestLib disposalRequestLib)
        {
            List <DisposalDescription> _dda = new List <DisposalDescription>();

            foreach (CustomsWarehouseDisposal _cwdx in disposalRequestLib.CustomsWarehouseDisposal(entities, false))
            {
                CustomsWarehouse _cw = _cwdx.CWL_CWDisposal2CustomsWarehouseID;
                if (_cw == null)
                {
                    throw new ArgumentNullException("CWL_CWDisposal2CustomsWarehouseID", "CustomsWarehouseDisposal is not connected to CustomsWarehouse");
                }
                DisposalDescription _new = new DisposalDescription
                {
                    OGLDate        = _cw.CustomsDebtDate.GetValueOrDefault(),
                    OGLNumber      = _cw.DocumentNo,
                    PackageToClear = Convert.ToInt32(_cw.AccountBalance.Value / _cw.CW_MassPerPackage.Value)
                };
                _dda.Add(_new);
            }
            CheckListWebPartDataContract _ret = new CheckListWebPartDataContract
            {
                Today         = DateTime.Today,
                DisposalsList = _dda.ToArray()
            };

            return(_ret);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Creates the Customs Warehousing account.
        /// </summary>
        /// <param name="accountData">The account data.</param>
        /// <param name="warnings">The warnings collection.</param>
        /// <param name="requestedUrl">The The URL of a Windows SharePoint Services "14" Web site.</param>
        /// <exception cref="System.NotImplementedException"></exception>
        void ICWAccountFactory.CreateCWAccount(CommonAccountData accountData, List <Customs.Warnning> warnings, string requestedUrl)
        {
            string _at = "Beginning";

            try
            {
                using (Entities _edc = new Entities(requestedUrl))
                {
                    if (Linq.CustomsWarehouse.RecordExist(_edc, accountData.DocumentNo))
                    {
                        string _msg = "CW record with the same SAD document number: {0} exist";
                        throw new CreateCWAccountException(String.Format(_msg, accountData.DocumentNo));
                    }
                    _at = "CommonAccountData";
                    this.CommonAccountData = accountData;
                    _at = "ClearanceLookup";
                    this.ClearenceLookup = Element.GetAtIndex <Clearence>(_edc.Clearence, accountData.ClearenceLookup);
                    _at = "ConsentLookup";
                    this.ConsentLookup = Element.GetAtIndex <Consent>(_edc.Consent, CommonAccountData.ConsentLookup);
                    _at                 = "VendorLookup";
                    VendorLookup        = Vendor.FirstOrDefault(_edc);
                    _at                 = "PCNTariffCodeLookup";
                    PCNTariffCodeLookup = Element.GetAtIndex <PCNCode>(_edc.PCNCode, accountData.PCNTariffCodeLookup);
                    _at                 = "AnalyzeGoodsDescription";
                    AnalizeGoodsDescription(_edc, ClearenceLookup.Clearence2SadGoodID.GoodsDescription, warnings);
                    _at = "AnalyzeGoodsDescription";
                    AnalyzeCertificates(_edc, ClearenceLookup.Clearence2SadGoodID.SADRequiredDocuments(_edc, false), warnings);
                    this.EntryDate = DateTime.Today;
                    bool _fatal = (from _wx in warnings where _wx.Fatal select _wx).Any <Warnning>();
                    if (_fatal)
                    {
                        throw new CreateCWAccountException("There are fatal errors in the message - CW account is not created.");
                    }
                    CustomsWarehouse _cw = new CustomsWarehouse(_edc, this);
                    _at = "InsertOnSubmit";
                    _edc.CustomsWarehouse.InsertOnSubmit(_cw);
                    _at = "SubmitChanges #1";
                    _edc.SubmitChanges();
                    _at = "UpdateTitle";
                    _cw.UpdateTitle();
                    _at = "SubmitChanges #2";
                    _edc.SubmitChanges();
                }
            }
            catch (CreateCWAccountException _ccwe)
            {
                Warnning _wrn = new Warnning(_ccwe.Message, true);
                warnings.Add(_wrn);
            }
            catch (Exception ex)
            {
                string   _msg = string.Format(Properties.Resources.UnexpectedExceptionMessage, "ICWAccountFactory.CreateCWAccount", _at, ex.Message);
                Warnning _wrn = new Warnning(_msg, true);
                warnings.Add(_wrn);
            }
        }
Exemplo n.º 4
0
 private void onWhileLogToHistory(object sender, EventArgs e)
 {
     TraceEvent("Entering CloseManyAccounts.onWhileLogToHistory", 74, TraceSeverity.Verbose);
     WhileLogToHistory_HistoryOutcome = "Closing account";
     using (Entities _entities = new Entities(workflowProperties.WebUrl))
     {
         CustomsWarehouse _cw = Element.GetAtIndex <CustomsWarehouse>(_entities.CustomsWarehouse, m_InitializationData.AccountsArray[m_LoopCounter]);
         WhileLogToHistory_HistoryDescription = String.Format("Closing account: {0} - Item: {1}/{2}", _cw.Title, m_LoopCounter + 1, m_InitializationData.AccountsArray.Length);
         TraceEvent("CloseManyAccounts.onWhileLogToHistory: " + WhileLogToHistory_HistoryDescription, 79, TraceSeverity.Verbose);
     }
 }
Exemplo n.º 5
0
 /// <summary>
 /// Gets the content of the XML.
 /// </summary>
 /// <param name="xml">The document.</param>
 /// <param name="edc">The edc.</param>
 /// <param name="parent">The entry.</param>
 /// <param name="progressChanged">The progress changed.</param>
 private static void GetXmlContent(Entities entities, DisposalRequestXml xml, DisposalRequestLib parent, ProgressChangedEventHandler progressChanged)
 {
     progressChanged(null, new ProgressChangedEventArgs(1, "GetXmlContent: starting"));
     foreach (var _xmli in xml.DisposalRequestContent)
     {
         CustomsWarehouseDisposal.XmlData _xmlData = new CustomsWarehouseDisposal.XmlData()
         {
             AdditionalQuantity = _xmli.AddedKg,
             DeclaredQuantity   = _xmli.QtyToClear,
             SKUDescription     = _xmli.Description
         };
         CustomsWarehouse.Dispose(entities, _xmli.BatchNo.Trim(), parent, _xmlData);
     }
     progressChanged(null, new ProgressChangedEventArgs(1, "GetXmlContent: finished"));
 }
Exemplo n.º 6
0
        internal static BinCardContentType CreateContent(CustomsWarehouse item)
        {
            string             _at  = "BinCardContentType";
            BinCardContentType _ret = new BinCardContentType()
            {
                Batch                    = item.Batch,
                NetWeight                = item.CW_Quantity.ValueOrException <double>(m_Source, _at, "NetWeight"),
                NetWeightSpecified       = true,
                PackageQuantity          = item.CW_PackageUnits.ValueOrException <double>(m_Source, _at, "PackageQuantity"),
                PackageQuantitySpecified = true,
                PzNo        = item.CW_PzNo,
                SAD         = item.DocumentNo,
                SADDate     = item.CustomsDebtDate.ValueOrException <DateTime>(m_Source, _at, "SADDate"),
                SKU         = item.SKU,
                TobaccoName = item.TobaccoName,
                TobaccoType = item.Grade
            };

            return(_ret);
        }
Exemplo n.º 7
0
 private void m_DataContext_GetListCompleted(object siurce, GetListAsyncCompletedEventArgs e)
 {
     try
     {
         m_DataContext.GetListCompleted -= m_DataContext_GetListCompleted;
         if (e.Error != null)
         {
             x_TextBoxSelectedBatch.Text = "Not found";
             x_TextBoxTotalStock.Text    = e.Error.Message;
         }
         if (e.Cancelled)
         {
             x_TextBoxSelectedBatch.Text = "Not found";
             x_TextBoxTotalStock.Text    = "Cancelled";
         }
         Accounts = e.Result <CustomsWarehouse>();
         if (Accounts.Count == 0)
         {
             x_TextBoxSelectedBatch.Text = "Not found";
             x_TextBoxTotalStock.Text    = "N/A";
             return;
         }
         CustomsWarehouse _noValue = Accounts.FirstOrDefault <CustomsWarehouse>(x => !x.Value.HasValue);
         if (_noValue != null)
         {
             x_TextBoxSelectedBatch.Text = "No Value";
             x_TextBoxTotalStock.Text    = "N/A";
             return;
         }
         Accounts.Sort(new Comparison <CustomsWarehouse>(CustomsWarehouse.CompareCustomsWarehouse));
         x_TextBoxSelectedBatch.Text = String.Format("{0}/{1} accounts", Accounts.First <CustomsWarehouse>().Batch, Accounts.Count);
         m_Available = Accounts.Sum(x => x.TobaccoNotAllocated.Value);
         x_TextBoxTotalStock.Text = m_Available.ToString(c_DoubleFormat);
         x_TextBoxQtyToClear.Text = 0.0.ToString(c_DoubleFormat);
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Serach exception", MessageBoxButton.OK);
     }
 }
Exemplo n.º 8
0
 private void CreateBinCard(object sender, EventArgs e)
 {
     try
     {
         using (Entities _entities = new Entities(workflowProperties.WebUrl))
         {
             CustomsWarehouse   _cw         = Element.GetAtIndex <CustomsWarehouse>(_entities.CustomsWarehouse, workflowProperties.ItemId);
             BinCardContentType _newBinCard = Factory.CreateContent(_cw);
             if (_cw.CWL_CW2BinCardTitle == null)
             {
                 string     _documentName    = Settings.BinCardDocumentName(_entities, workflowProperties.ItemId);
                 SPFile     _newFile         = File.CreateXmlFile <BinCardContentType>(workflowProperties.Web, _newBinCard, _documentName, BinCardLib.LibraryName, BinCardContentType.StylesheetNmane);
                 BinCardLib _BinCardLibRntry = Element.GetAtIndex <BinCardLib>(_entities.BinCardLibrary, _newFile.Item.ID);
                 _BinCardLibRntry.Archival = false;
                 _cw.CWL_CW2BinCardTitle   = _BinCardLibRntry;
                 _entities.SubmitChanges();
             }
             else
             {
                 int _binCardId          = _cw.CWL_CW2BinCardTitle.Id.Value;
                 SPDocumentLibrary _lib  = (SPDocumentLibrary)workflowProperties.Web.Lists[BinCardLib.LibraryName];
                 SPFile            _file = _lib.GetItemByIdSelectedFields(_binCardId).File;
                 File.WriteXmlFile <BinCardContentType>(_file, _newBinCard, BinCardContentType.StylesheetNmane);
             }
         }
         logToHistoryListActivity_HistoryOutcome     = "Success";
         logToHistoryListActivity_HistoryDescription = "Document created successfully";
     }
     catch (CAS.SharePoint.ApplicationError _ap)
     {
         logToHistoryListActivity_HistoryOutcome     = "ApplicationError";
         logToHistoryListActivity_HistoryDescription = _ap.Message;
     }
     catch (Exception _ex)
     {
         logToHistoryListActivity_HistoryOutcome     = "Exeption";
         logToHistoryListActivity_HistoryDescription = _ex.Message;
     }
 }
Exemplo n.º 9
0
        internal static ExitSheeDataContract GetExitSheeDataContract(Entities edc, WebsiteModel.Linq.CustomsWarehouseDisposal cwd)
        {
            Warehouse        _wrh           = (from _wrhx in edc.Warehouse where _wrhx.SPProcedure == cwd.CustomsProcedure select _wrhx).FirstOrDefault();
            string           _warehouseName = _wrh == null ? "N/A" : _wrh.WarehouseName;
            CustomsWarehouse _cw            = cwd.CWL_CWDisposal2CustomsWarehouseID;

            if (_cw == null)
            {
                throw new ArgumentNullException("CWL_CWDisposal2CustomsWarehouseID", "CustomsWarehouseDisposal is not connected to CustomsWarehouse");
            }
            ExitSheeDataContract _esdc = new ExitSheeDataContract
            {
                Grade             = cwd.CWL_CWDisposal2CustomsWarehouseID.Grade,
                OGLNumber         = _cw.DocumentNo,
                PackageToClear    = Convert.ToInt32(cwd.CW_PackageToClear.GetValueOrDefault()),
                RemainingPackage  = Convert.ToInt32(cwd.CW_RemainingPackage.GetValueOrDefault()),
                RemainingQuantity = cwd.RemainingQuantity.GetValueOrDefault(),
                SAD            = cwd.SADDocumentNo,
                SettledNetMass = cwd.CW_SettledNetMass.GetValueOrDefault(),
                WarehouseName  = _warehouseName
            };

            return(_esdc);
        }
Exemplo n.º 10
0
        /// <summary>
        /// Gets the sample data.
        /// </summary>
        /// <param name="listOfAccounts">The list of accounts.</param>
        /// <param name="groupOfDisposals">The group of disposals.</param>
        public static void GetData(List <CustomsWarehouse> listOfAccounts, out IGrouping <string, CustomsWarehouseDisposal> groupOfDisposals)
        {
            List <CustomsWarehouseDisposal> listOfDisposals = new List <CustomsWarehouseDisposal>();

            groupOfDisposals = null;
            CustomsWarehouse _newCW = new CustomsWarehouse()
            {
                DocumentNo          = "OGL/362010/00/003231/2014",
                CustomsDebtDate     = new DateTime(2014, 02, 14),
                Grade               = "XIDSME",
                SKU                 = "12607453",
                Batch               = "0003808069",
                AccountBalance      = 9000,
                TobaccoNotAllocated = 0,
                NetMass             = 9000,
                GrossMass           = 9750,
                CW_PackageUnits     = 50,
                CW_MassPerPackage   = 180,
                Value               = 76401,
                InvoiceNo           = "82203825",
                AccountClosed       = false,
                Units               = "kg",
            };

            listOfAccounts.Add(_newCW);
            CustomsWarehouseDisposal _newCWD = new CustomsWarehouseDisposal()
            {
                CWL_CWDisposal2CustomsWarehouseID = _newCW,
                CW_AddedKg          = 0,
                CW_DeclaredNetMass  = 9000,
                CW_SettledGrossMass = 9750,
                CW_PackageToClear   = 50,
                TobaccoValue        = 76401,
                CustomsProcedure    = "4071",
                CustomsStatus       = CustomsStatus.NotStarted
            };

            listOfDisposals.Add(_newCWD);
            _newCW = new CustomsWarehouse()
            {
                DocumentNo          = "OGL/362010/00/013937/2014",
                CustomsDebtDate     = new DateTime(2014, 06, 23),
                Grade               = "XIDSME",
                SKU                 = "12607453",
                Batch               = "0003808069",
                AccountBalance      = 7020,
                TobaccoNotAllocated = 0,
                NetMass             = 7020,
                GrossMass           = 7605,
                CW_PackageUnits     = 39,
                CW_MassPerPackage   = 180,
                Value               = 59592.78,
                InvoiceNo           = "82219877",
                AccountClosed       = false,
                Units               = "kg",
            };
            listOfAccounts.Add(_newCW);
            _newCWD = new CustomsWarehouseDisposal()
            {
                CWL_CWDisposal2CustomsWarehouseID = _newCW,
                CW_AddedKg          = 6020,
                CW_DeclaredNetMass  = 1000,
                CW_SettledGrossMass = 7605,
                CW_PackageToClear   = 39,
                TobaccoValue        = 59592.78,
                CustomsProcedure    = "4071",
            };
            listOfDisposals.Add(_newCWD);
            _newCW = new CustomsWarehouse()
            {
                DocumentNo          = "OGL/362010/00/015363/2014",
                CustomsDebtDate     = new DateTime(2014, 07, 14),
                Grade               = "XIDSME",
                SKU                 = "12607453",
                Batch               = "0003808069",
                AccountBalance      = 4140,
                TobaccoNotAllocated = 4140,
                NetMass             = 4140,
                GrossMass           = 4485,
                CW_PackageUnits     = 23,
                CW_MassPerPackage   = 180,
                Value               = 35144.46,
                InvoiceNo           = "82222800",
                AccountClosed       = false,
                Units               = "m3",
            };
            listOfAccounts.Add(_newCW);
            _newCWD = new CustomsWarehouseDisposal()
            {
                CWL_CWDisposal2CustomsWarehouseID = _newCW,
                CW_AddedKg          = 0,
                CW_DeclaredNetMass  = 0,
                CW_SettledGrossMass = 0,
                CW_PackageToClear   = 0,
                TobaccoValue        = 15280.2,
                CustomsProcedure    = "4071",
            };
            listOfDisposals.Add(_newCWD);
            _newCW = new CustomsWarehouse()
            {
                DocumentNo          = "OGL/362010/00/016193/2014",
                CustomsDebtDate     = new DateTime(2014, 07, 15),
                Grade               = "XIDSME",
                SKU                 = "12607453",
                Batch               = "0003808069",
                AccountBalance      = 6120,
                TobaccoNotAllocated = 4320,
                NetMass             = 6120,
                GrossMass           = 6630,
                CW_PackageUnits     = 34,
                CW_MassPerPackage   = 180,
                Value               = 51952.68,
                InvoiceNo           = "82223962",
                AccountClosed       = false,
                Units               = "m4",
            };
            listOfAccounts.Add(_newCW);
            _newCWD = new CustomsWarehouseDisposal()
            {
                CWL_CWDisposal2CustomsWarehouseID = _newCW,
                CW_AddedKg          = 1800,
                CW_DeclaredNetMass  = 0,
                CW_SettledGrossMass = 1950,
                CW_PackageToClear   = 10,
                TobaccoValue        = 15280.2,
                CustomsProcedure    = "4071",
            };
            listOfDisposals.Add(_newCWD);
            _newCW = new CustomsWarehouse()
            {
                DocumentNo          = "OGL/362010/00/017253/2014",
                CustomsDebtDate     = new DateTime(2014, 07, 16),
                Grade               = "XIDSME",
                SKU                 = "12607453",
                Batch               = "0003808069",
                AccountBalance      = 8820,
                TobaccoNotAllocated = 8820,
                NetMass             = 8820,
                GrossMass           = 9555,
                CW_PackageUnits     = 49,
                CW_MassPerPackage   = 180,
                Value               = 74872.98,
                InvoiceNo           = "82225744",
                AccountClosed       = false,
                Units               = "m5",
            };
            listOfAccounts.Add(_newCW);
            groupOfDisposals = listOfDisposals.GroupBy <CustomsWarehouseDisposal, string>(x => x.CWL_CWDisposal2CustomsWarehouseID.Batch).First <IGrouping <string, CustomsWarehouseDisposal> >();
        }
Exemplo n.º 11
0
        private static RequestContent CreateContent(Entities edc, CustomsWarehouse customsWarehouse)
        {
            string   _withdrawalSADDocumentNo   = String.Empty;
            DateTime _withdrawalSADDocumentDate = default(DateTime);
            List <ArrayOfDisposalDisposalsArray> _listOfDisposals = new List <ArrayOfDisposalDisposalsArray>();

            foreach (CustomsWarehouseDisposal _document in customsWarehouse.CustomsWarehouseDisposal(edc, false))
            {
                List <string> _wz = new List <string>();
                if (!_document.CW_Wz1.IsNullOrEmpty())
                {
                    _wz.Add(_document.CW_Wz1);
                }
                if (!_document.CW_Wz2.IsNullOrEmpty())
                {
                    _wz.Add(_document.CW_Wz2);
                }
                if (!_document.CW_Wz3.IsNullOrEmpty())
                {
                    _wz.Add(_document.CW_Wz3);
                }
                ArrayOfDisposalDisposalsArray _newItem = new ArrayOfDisposalDisposalsArray()
                {
                    CNTarrifCode      = _document.CWL_CWDisposal2PCNTID.ProductCodeNumber,
                    Currency          = _document.CWL_CWDisposal2CustomsWarehouseID.Currency,
                    No                = _document.SPNo.GetValueOrDefault().Convert2Int(),
                    PackageToClear    = _document.CW_PackageToClear.GetValueOrDefault().Convert2Int(),
                    RemainingPackage  = _document.CW_RemainingPackage.GetValueOrDefault(-1).Convert2Int(),
                    RemainingQuantity = _document.RemainingQuantity.GetValueOrDefault(-1).Convert2Int(),
                    SADDate           = _document.SADDate.GetValueOrNull(),
                    SADDocumentNo     = _document.SADDocumentNo,
                    SettledGrossMass  = _document.CW_SettledGrossMass.GetValueOrDefault(),
                    SettledNetMass    = _document.CW_SettledNetMass.GetValueOrDefault(),
                    TobaccoValue      = _document.TobaccoValue.GetValueOrDefault(),
                    WZ                = String.Join(",", _wz.ToArray())
                };
                _listOfDisposals.Add(_newItem);
                if (_document.ClearingType.Value == ClearingType.TotalWindingUp)
                {
                    _withdrawalSADDocumentNo   = _document.SADDocumentNo;
                    _withdrawalSADDocumentDate = _document.SADDate.GetValueOrDefault(Extensions.SPMinimum);
                }
            }
            if (customsWarehouse.AccountBalance.Value > 0)
            {
                _withdrawalSADDocumentNo   = String.Empty.NotAvailable();
                _withdrawalSADDocumentDate = Extensions.SPMinimum;
            }
            _listOfDisposals.Sort((x, y) => {
                int _yNo = y.No == 0 ? 9999 : y.No;
                return(x.No.CompareTo(_yNo));
            });
            RequestContent _new = new RequestContent()
            {
                Batch                                                                       = customsWarehouse.Batch,
                CNTarrifCode                                                                = customsWarehouse.CWL_CW2PCNID.ProductCodeNumber,
                ConsentDate                                                                 = customsWarehouse.CWL_CW2ConsentTitle == null ? Extensions.SPMinimum : customsWarehouse.CWL_CW2ConsentTitle.ConsentDate.GetValueOrNull(),
                ConsentNo                                                                   = customsWarehouse.CWL_CW2ConsentTitle == null?String.Empty.NotAvailable() : customsWarehouse.CWL_CW2ConsentTitle.Title,
                                                                 Currency                   = customsWarehouse.Currency,
                                                                 DisposalsColection         = _listOfDisposals.ToArray(),
                                                                 DocumentDate               = DateTime.Today,
                                                                 DocumentName               = customsWarehouse.Title,
                                                                 DocumentNo                 = customsWarehouse.Id.Value,
                                                                 Grade                      = customsWarehouse.Grade,
                                                                 GrossMass                  = customsWarehouse.GrossMass.GetValueOrDefault(-1),
                                                                 IntroducingSADDocumentDate = customsWarehouse.CustomsDebtDate.GetValueOrNull(),
                                                                 IntroducingSADDocumentNo   = customsWarehouse.DocumentNo,
                                                                 InvoiceNo                  = customsWarehouse.InvoiceNo,
                                                                 NetMass                    = customsWarehouse.NetMass.GetValueOrDefault(-1),
                                                                 PackageUnits               = customsWarehouse.CW_PackageUnits.GetValueOrDefault(-1),
                                                                 PzNo                       = customsWarehouse.CW_PzNo,
                                                                 Quantity                   = customsWarehouse.CW_Quantity.GetValueOrDefault(-1),
                                                                 SKU                        = customsWarehouse.SKU,
                                                                 TobaccoName                = customsWarehouse.TobaccoName,
                                                                 UnitPrice                  = customsWarehouse.CW_UnitPrice.GetValueOrDefault(-1),
                                                                 Value                      = customsWarehouse.Value.GetValueOrDefault(-1),
                                                                 WithdrawalSADDcoumentNo    = _withdrawalSADDocumentNo,
                                                                 WithdrawalSADDocumentDate  = _withdrawalSADDocumentDate
            };

            return(_new);
        }