コード例 #1
0
ファイル: Disposal.cs プロジェクト: CASMPostol/SmartFactory
 internal void ClearThroughCustom(Entities entities, ClearenceProcedure procedure, int sadConsignmentNumber, Action <Disposal> reCalculate)
 {
     CustomsStatus    = Linq.CustomsStatus.Started;
     CustomsProcedure = Entities.ToString(procedure);
     SadConsignmentNo = SADConsignment.DocumentNumber(entities, sadConsignmentNumber);
     reCalculate(this);
 }
コード例 #2
0
        /// <summary>
        /// Get requested customs procedure code
        /// </summary>
        /// <param name="value">The value.</param>
        /// <returns>
        /// Requested procedure code <see cref="CustomsProcedureCodes" /> - first two chars of the box 37
        /// </returns>
        private static CustomsProcedureCodes RequestedProcedure(this ClearenceProcedure value)
        {
            CustomsProcedureCodes _ret = default(CustomsProcedureCodes);

            switch (value)
            {
            case ClearenceProcedure._3151:
            case ClearenceProcedure._3171:
                _ret = CustomsProcedureCodes.NoProcedure;
                break;

            case ClearenceProcedure._4051:
            case ClearenceProcedure._4071:
                _ret = CustomsProcedureCodes.FreeCirculation;
                break;

            case ClearenceProcedure._5100:
            case ClearenceProcedure._5171:
                _ret = CustomsProcedureCodes.InwardProcessing;
                break;

            case ClearenceProcedure._7100:
            case ClearenceProcedure._7171:
                _ret = CustomsProcedureCodes.CustomsWarehousingProcedure;
                break;
            }
            return(_ret);
        }
コード例 #3
0
ファイル: Clearence.cs プロジェクト: CASMPostol/SmartFactory
        /// <summary>
        /// Creates the clearance.
        /// </summary>
        /// <param name="entities">The entities.</param>
        /// <param name="procedure">The procedure.</param>
        /// <param name="procedureCode">The procedure code.</param>
        /// <returns></returns>
        public static Clearence CreataClearence(Entities entities, string procedure, ClearenceProcedure procedureCode, NamedTraceLogger.TraceAction traceEvent)
        {
            Clearence _newClearence = CreateClearance(procedure, procedureCode);

            entities.Clearence.InsertOnSubmit(_newClearence);
            _newClearence.UpdateTitle(entities, traceEvent);
            entities.SubmitChanges();
            _newClearence.UpdateTitle(entities, traceEvent);
            return(_newClearence);
        }
コード例 #4
0
        /// <summary>
        /// Creates the clearance.
        /// </summary>
        /// <param name="entities">The entities.</param>
        /// <param name="procedure">The procedure.</param>
        /// <param name="procedureCode">The procedure code.</param>
        /// <param name="good">The good.</param>
        /// <returns></returns>
        public static Clearence CreataClearance(Entities entities, string procedure, ClearenceProcedure procedureCode, SADGood good)
        {
            Clearence _newClearance = CreateClearance(procedure, procedureCode);

            _newClearance.Clearence2SadGoodID = good;
            _newClearance.DocumentNo          = good.SADDocumentIndex.DocumentNumber;
            _newClearance.ReferenceNumber     = good.SADDocumentIndex.ReferenceNumber;
            _newClearance.UpdateTitle(entities);
            entities.Clearence.InsertOnSubmit(_newClearance);
            entities.SubmitChanges();
            _newClearance.UpdateTitle(entities);
            return(_newClearance);
        }
コード例 #5
0
        /// <summary>
        /// Starts the clearance and creates an object of <see cref="Clearence" />.
        /// </summary>
        /// <param name="entities">The entities.</param>
        /// <param name="procedure">The customs procedure.</param>
        /// <param name="procedureCode">The procedure code.</param>
        /// <param name="trace">The trace action.</param>
        /// <returns>Return new <see cref="Clearence"/> entity.</returns>
        public static Clearence CreateClearance(Entities entities, string procedure, ClearenceProcedure procedureCode, NamedTraceLogger.TraceAction trace)
        {
            trace("Entering Clearence.CreateClearance", 98, TraceSeverity.Verbose);
            Clearence _newClearance = CreateClearance(procedure, procedureCode);

            entities.Clearence.InsertOnSubmit(_newClearance);
            _newClearance.UpdateTitle(entities);
            trace("Clearence.CreateClearance at SubmitChanges", 103, TraceSeverity.Verbose);
            entities.SubmitChanges();
            _newClearance.UpdateTitle(entities);
            trace("Finished Clearence.CreateClearance", 106, TraceSeverity.Verbose);
            return(_newClearance);
        }
コード例 #6
0
ファイル: Clearence.cs プロジェクト: CASMPostol/SmartFactory
        private static Clearence CreateClearance(string code, ClearenceProcedure procedure)
        {
            Clearence _newClearence = new Clearence()
            {
                Archival           = false,
                DocumentNo         = String.Empty.NotAvailable(),
                ProcedureCode      = code,
                ReferenceNumber    = String.Empty.NotAvailable(),
                SPStatus           = false,
                ClearenceProcedure = procedure
            };

            return(_newClearence);
        }
コード例 #7
0
        /// <summary>
        /// Returns a <see cref="System.String" /> that represents this instance.
        /// </summary>
        /// <param name="procedureCode">The procedure code.</param>
        /// <returns>
        /// A <see cref="System.String" /> that represents procedure code.
        /// </returns>
        public static string ToString(ClearenceProcedure procedureCode)
        {
            string _value = String.Empty.NotAvailable();

            switch (procedureCode)
            {
            case ClearenceProcedure._3151:
                _value = "3151";
                break;

            case ClearenceProcedure._3171:
                _value = "3171";
                break;

            case ClearenceProcedure._4051:
                _value = "4051";
                break;

            case ClearenceProcedure._4071:
                _value = "4071";
                break;

            case ClearenceProcedure._5100:
                _value = "5100";
                break;

            case ClearenceProcedure._5171:
                _value = "5171";
                break;

            case ClearenceProcedure._7100:
                _value = "7100";
                break;

            case ClearenceProcedure._7171:
                _value = "7171";
                break;

            default:
                break;
            }
            return(_value);
        }
コード例 #8
0
ファイル: Clearence.cs プロジェクト: CASMPostol/SmartFactory
        /// <summary>
        /// Updates the title.
        /// </summary>
        /// <param name="entities">The auto-generated <see cref="Microsoft.SharePoint.Linq.DataContext"/> object.</param>
        public void UpdateTitle(Entities entities, NamedTraceLogger.TraceAction traceEvent)
        {
            string _quantity = String.Empty;

            //IQueryable<CustomsWarehouseDisposal> _Dspsls = from _Dspx in entities.CustomsWarehouseDisposal where _Dspx == this.Id select {ssss = _d.s }
            //if ( this.Disposal.Any() )
            //  _quantity = this.Disposal.Sum<Disposal>( x => x.SettledQuantity.Value ).ToString( "F2" );
            //else
            //  _quantity = " --- ";
            traceEvent("Starting Clearence.UpdateTitle", 57, TraceSeverity.Verbose);
            string _ClearanceTitleFormat = Settings.GetParameter(entities, SettingsEntry.ClearanceTitleFormatCW);

            Title = String.Format(_ClearanceTitleFormat,
                                  this.ProcedureCode,                                                                     //0
                                  ClearenceProcedure.GetValueOrDefault(Linq.ClearenceProcedure.Invalid).Convert2String(), //1
                                  ReferenceNumber.NotAvailable(),                                                         //2
                                  Id.GetValueOrDefault(-999));                                                            //3
            traceEvent("Finished Clearence.UpdateTitle; new Title: " + Title, 66, TraceSeverity.Verbose);
        }
コード例 #9
0
        private ClearenceProcedure Covert2ClearenceProcedure(Interoperability.ERP.ClearenceProcedure clearanceProcedure)
        {
            ClearenceProcedure _ret = default(ClearenceProcedure);

            switch (clearanceProcedure)
            {
            case Interoperability.ERP.ClearenceProcedure.Item4071:
                _ret = ClearenceProcedure._4071;
                break;

            case Interoperability.ERP.ClearenceProcedure.Item5171:
                _ret = ClearenceProcedure._5171;
                break;

            case Interoperability.ERP.ClearenceProcedure.Item3171:
                _ret = ClearenceProcedure._3171;
                break;

            case Interoperability.ERP.ClearenceProcedure.Item7171:
                _ret = ClearenceProcedure._7171;
                break;
            }
            return(_ret);
        }
コード例 #10
0
        private static DocumentContent CreateDocumentContent(IEnumerable <Disposal> disposals, ClearenceProcedure customProcedureCode, string documentNo, DateTime endDate, DateTime startDate)
        {
            IEnumerable <IGrouping <string, Disposal> > _groups = from _disx in disposals
                                                                  let _ogl = _disx.Disposal2IPRIndex == null ? String.Empty : _disx.Disposal2IPRIndex.DocumentNo
                                                                             orderby _ogl ascending
                                                                             group _disx by _ogl;
            List <MaterialsOnOneAccount> _group = new List <MaterialsOnOneAccount>();
            double _totalQuantity = 0;
            double _totalValue    = 0;

            foreach (IGrouping <string, Disposal> _gx in _groups)
            {
                IEnumerable <Disposal> _dspslsInGroup = from _dspslx in _gx select _dspslx;
                MaterialsOnOneAccount  _mona          = CreateMaterialRecords(_dspslsInGroup);
                _group.Add(_mona);
                _totalValue    += _mona.TotalValue;
                _totalQuantity += _mona.TotalQuantity;
            }
            return(new DocumentContent()
            {
                AccountDescription = _group.ToArray(),
                CustomProcedureCode = Entities.ToString(customProcedureCode),
                DocumentDate = DateTime.Today.Date,
                DocumentNo = documentNo,
                EndDate = endDate.Date,
                StartDate = startDate.Date,
                TotalQuantity = _totalQuantity,
                TotalValue = _totalValue
            });
        }
コード例 #11
0
        internal static DocumentContent GetDustWasteFormContent(IEnumerable <Disposal> disposals, ClearenceProcedure customProcedureCode, string documentNo)
        {
            DateTime endDate   = disposals.Max(x => x.Created.Value);
            DateTime startDate = disposals.Min(x => x.Created.Value);

            return(CreateDocumentContent(disposals, customProcedureCode, documentNo, endDate, startDate));
        }
コード例 #12
0
        internal static DocumentContent GetTobaccoFreeCirculationFormContent(IEnumerable <Disposal> disposals, ClearenceProcedure customProcedureCode, string documentNo)
        {
            DateTime endDate   = disposals.Max(x => x.Disposal2IPRIndex.CustomsDebtDate.Value);
            DateTime startDate = disposals.Min(x => x.Disposal2IPRIndex.CustomsDebtDate.Value);

            return(CreateDocumentContent(disposals, customProcedureCode, documentNo, endDate, startDate));
        }
コード例 #13
0
        internal static DocumentContent GetBoxFormContent(IEnumerable <Disposal> disposals, ClearenceProcedure customProcedureCode, string documentNo)
        {
            DateTime endDate   = disposals.Max(x => x.Disposal2IPRIndex.CustomsDebtDate.Value);
            DateTime startDate = disposals.Min(x => x.Disposal2IPRIndex.CustomsDebtDate.Value);
            MaterialsOnOneAccount _materials = CreateMaterialRecords(disposals);

            return(new DocumentContent()
            {
                AccountDescription = new MaterialsOnOneAccount[] { _materials },
                CustomProcedureCode = Entities.ToString(customProcedureCode),
                DocumentDate = DateTime.Today.Date,
                DocumentNo = documentNo,
                EndDate = endDate.Date,
                StartDate = startDate.Date,
                TotalQuantity = _materials.TotalQuantity,
                TotalValue = _materials.TotalValue
            });
        }
コード例 #14
0
        internal static CigaretteExportForm GetCigaretteExportForm(Batch batch, InvoiceContent invoice, List <Ingredient> ingredients, string documentName, ref int subdocumentNo, ClearenceProcedure procedure)
        {
            double _portion          = invoice.Quantity.Value / batch.FGQuantity.Value;
            CigaretteExportForm _ret = new CigaretteExportForm();

            if (batch == null)
            {
                throw new ArgumentNullException("Batch cannot be null");
            }
            if (batch.SKUIndex == null)
            {
                throw new ArgumentNullException("SKU in batch cannot be null");
            }
            if (invoice == null)
            {
                throw new ArgumentNullException("Invoice cannot be null");
            }
            _ret.DocumentNo = String.Format(GlobalDefinitions.CigaretteExportFormNamePatern, documentName, subdocumentNo++);
            _ret.DustKg     = (batch.Dust.GetValueOrDefault(-1) * _portion).RountMass();
            CountExportFormTotals(ingredients, _ret);
            _ret.Portion           = _portion;
            _ret.CustomsProcedure  = Entities.ToString(procedure);
            _ret.FinishedGoodBatch = batch.Batch0;
            //TODO Must be calculated depending on commodity or unit.
            _ret.FinishedGoodQantity        = invoice.Quantity.GetValueOrDefault(0);
            _ret.FinishedGoodUnit           = invoice.Units.GetLocalizedString();
            _ret.FinishedGoodSKU            = batch.SKUIndex.SKU;
            _ret.FinishedGoodSKUDescription = batch.SKUIndex.Title();
            _ret.MaterialTotal                 = (batch.Tobacco.GetValueOrDefault(-1) * _portion).RountMass();
            _ret.ProductFormat                 = batch.SKUIndex.FormatIndex.Title();
            _ret.CTFUsageMin                   = batch.CFTProductivityRateMin.GetValueOrDefault(-1) * 100;
            _ret.CTFUsageMax                   = batch.CFTProductivityRateMax.GetValueOrDefault(-1) * 100;
            _ret.CTFUsagePerUnitMin            = batch.CFTProductivityRateMin.GetValueOrDefault(-1);
            _ret.CTFUsagePerUnitMax            = batch.CFTProductivityRateMax.GetValueOrDefault(-1);
            _ret.CTFUsagePer1MFinishedGoodsMin = batch.CTFUsageMin.GetValueOrDefault(-1);
            _ret.CTFUsagePer1MFinishedGoodsMax = batch.CTFUsageMax.GetValueOrDefault(-1);
            _ret.WasteCoefficient              = batch.BatchWasteCooeficiency.GetValueOrDefault(-1) + batch.BatchDustCooeficiency.GetValueOrDefault(-1);
            switch (batch.ProductType.Value)
            {
            case CAS.SmartFactory.IPR.WebsiteModel.Linq.ProductType.Cutfiller:
                _ret.Product = xml.DocumentsFactory.CigaretteExportForm.ProductType.Cutfiller;
                break;

            case CAS.SmartFactory.IPR.WebsiteModel.Linq.ProductType.Cigarette:
                SKUCigarette _skuCigarette = batch.SKUIndex as SKUCigarette;
                _ret.BrandDescription  = _skuCigarette.Brand;
                _ret.FamilyDescription = _skuCigarette.Family;
                _ret.Product           = xml.DocumentsFactory.CigaretteExportForm.ProductType.Cigarette;
                break;

            default:
                throw new ApplicationError("InvoiceLib.CigaretteExportForm", "Product", "Wrong ProductType", null);
            }
            _ret.SHMentholKg = (batch.SHMenthol.GetValueOrDefault(-1) * _portion).RountMass();
            _ret.WasteKg     = (batch.Waste.GetValueOrDefault(-1) * _portion).RountMass();
            _ret.IPRRestMaterialQantityTotal = _ret.DustKg + _ret.SHMentholKg + _ret.WasteKg;
            _ret.TobaccoTotal = (_ret.IPTMaterialQuantityTotal + _ret.RegularMaterialQuantityTotal + _ret.IPRRestMaterialQantityTotal).RountMass();
            return(_ret);
        }
コード例 #15
0
        /// <summary>
        /// Updates the title.
        /// </summary>
        /// <param name="entities">The auto-generated <see cref="Microsoft.SharePoint.Linq.DataContext"/> object.</param>
        public void UpdateTitle(Entities entities)
        {
            string _quantity = String.Empty;
            IEnumerable <Disposal> _dspsls = this.Disposal(entities);

            if (_dspsls != null && _dspsls.Count() > 0)
            {
                _quantity = _dspsls.Sum <Disposal>(x => x.SettledQuantity.Value).ToString("F2");
            }
            else
            {
                _quantity = " --- ";
            }
            string _ClearanceTitleFormat = Settings.GetParameter(entities, SettingsEntry.ClearanceTitleFormat);

            Title = String.Format(_ClearanceTitleFormat, this.ProcedureCode, Entities.ToString(ClearenceProcedure.GetValueOrDefault(Linq.ClearenceProcedure.Invalid)),
                                  ReferenceNumber.NotAvailable(), _quantity, Id.GetValueOrDefault(-999));
        }
コード例 #16
0
 /// <summary>
 /// Updates the clearance.
 /// </summary>
 /// <param name="entities">The entities.</param>
 /// <param name="procedureDescription">The procedure description.</param>
 /// <param name="clearanceProcedure">The clearance procedure.</param>
 public void UpdateClerance(Entities entities, string procedureDescription, ClearenceProcedure clearanceProcedure)
 {
     ProcedureCode      = procedureDescription;
     ClearenceProcedure = clearanceProcedure;
     UpdateTitle(entities);
 }