示例#1
0
        public void Process()
        {
            PcPriceChange priceChange = _context.PriceChange;
            var           line        = _context.Line;

            // TODO : implement if needed
        }
示例#2
0
        public void Process()
        {
            PcPriceChange priceChange = null;
            var           line        = _context.Line;

            if (line.StartsWith(PcConstants.PriceChange))
            {
                priceChange          = new PcPriceChange();
                _context.PriceChange = priceChange;
                _context.Next();
            }
            else
            {
                _context.PriceChange = null;
                return;
            }

            while (line != null && !line.StartsWith(PcConstants.TimestampCet))
            {
                _context.Next();
                line = _context.Line;
            }

            _context.Next();
            var currency = _context.Line;

            _context.Next();
            var effectiveDate = _context.Line;

            priceChange.EconomicalInfo = new PcEconomicalInfo
            {
                Currency      = currency,
                EffectiveDate = effectiveDate
            };

            line = _context.Line;
            while (line != null && !line.StartsWith(PcConstants.PartNumber))
            {
                _context.Next();
                line = _context.Line;
            }

            if (line != null && line.StartsWith(PcConstants.PartNumber))
            {
                _context.State = new PcStateMaterial(_context);
                _context.Process();
            }
            else
            {
                throw new Exception($"[PcStateTop] Unknown format: {line}");
            }
        }
示例#3
0
        private void AddPcContent(string documentName, int pageNumber, PcPriceChange priceChange)
        {
            var curency       = priceChange.EconomicalInfo.Currency;
            var effectiveDate = priceChange.EconomicalInfo.EffectiveDate;
            var materials     = priceChange.Materials;

            if (materials != null)
            {
                foreach (var material in materials)
                {
                    AddContent(_worksheetPc, 'A', _indexPc, material.PartNumber);
                    AddContent(_worksheetPc, 'B', _indexPc, curency);
                    AddContent(_worksheetPc, 'C', _indexPc, material.InvoicePrice);
                    AddContent(_worksheetPc, 'D', _indexPc, material.PreviousInvoicePrice);
                    AddContent(_worksheetPc, 'E', _indexPc, effectiveDate);
                    AddContent(_worksheetPc, 'F', _indexPc, documentName, true);
                    AddContent(_worksheetPc, 'G', _indexPc, pageNumber, true);

                    _indexPc++;
                }
            }
        }
示例#4
0
        public void Process()
        {
            var           table       = new Table();
            PcPriceChange priceChange = _context.PriceChange;
            var           line        = _context.Line;

            if (line.StartsWith(PcConstants.PartNumber))
            {
                while (line != null && line != PcConstants.MaterialWeight)
                {
                    // TODO : review for the moment we consider that 'FINIS Code' will not have any values on it so we skip it
                    //if (line != PcConstants.FinisCode)
                    //{
                    //    table.Add(new Column { Header = line });
                    //}
                    table.Add(new Column {
                        Header = line
                    });

                    _context.Next();
                    line = _context.Line;
                }
                table.Add(new Column {
                    Header = line
                });                                      // add also the last column MaterialWeight

                _context.Next();
                line = _context.Line;

                var index       = 0;
                var columnCount = table.ColumnCount;

                // TODO: see problem with FINIS Code (present / not present)
                bool justAddedPartNumber = false;

                while (line != null && line != PoConstants.Remarks)
                {
                    if (justAddedPartNumber)
                    {
                        if (!IsFinisCode(line)) // TODO: see problem with FINIS Code (present / not present)
                        {
                            var finisCodeColumn = table[index];
                            finisCodeColumn.Values.Add("");

                            index++;
                            index = index % columnCount;
                        }
                    }
                    justAddedPartNumber = IsPartNumber(line);

                    var column = table[index];
                    column.Values.Add(line);

                    index++;
                    index = index % columnCount;

                    _context.Next();
                    line = _context.Line;
                }

                priceChange.Materials.AddRange(table.GetMaterials());

                if (line == PoConstants.Remarks)
                {
                    _context.State = new PcStateBottom(_context);
                    _context.Process();
                }
                else
                {
                    throw new Exception($"[PcStateMaterial] Unkonwon format {line}");
                }
            }
        }