Exemplo n.º 1
0
        private void fillEditableTable(WaresTypes waresTypes)
        {
            var isTare = waresTypes == WaresTypes.Tare;
            var table = isTare ? Document.TareInfo : Document.NomenclatureInfo;

            list = new List<NomenclatureData>();

            if (table.Rows.Count > 0)
                {
                foreach (DataRow row in table.Rows)
                    {
                    long nomemclatureId = (long)row[isTare ? Document.Tare : Document.Nomenclature];

                    string nomenclatureDescription = null;
                    bool withoutTray = false;
                    var shelfLifeDays = 0;
                    var unitsQuantityPerPallet = 0;

                    if (isTare)
                        {
                        nomenclatureDescription =
                            FastInputDataCache.GetCashedData(typeof(Nomenclature).Name).GetDescription(nomemclatureId);
                        }
                    else
                        {
                        var nomenclature = new Nomenclature() { ReadingId = nomemclatureId };
                        nomenclatureDescription = nomenclature.Description;
                        shelfLifeDays = nomenclature.ShelfLife;
                        unitsQuantityPerPallet = nomenclature.UnitsQuantityPerPallet;
                        withoutTray = nomenclature.WithoutTray;
                        }

                    NomenclatureData element = new NomenclatureData
                        {
                            LineNumber = Convert.ToInt64(row["LineNumber"]),
                            Description = new ObjectValue(nomenclatureDescription, nomemclatureId),
                            ShelfLifeDays = shelfLifeDays,
                            UnitsAmountInOneStandartPallet = unitsQuantityPerPallet,
                            WithoutTray = withoutTray
                        };

                    element.Quantity = Convert.ToInt32(row[isTare ? Document.TareCount : Document.NomenclatureCount]);

                    if (!isTare)
                        {
                        Parties party = new Parties() { ReadingId = row[Document.NomenclatureParty] };
                        element.Date = party.DateOfManufacture;
                        element.UpdatePalletQuantity();
                        }

                    list.Add(element);
                    }
                }
            else if (isTare)
                {
                computeTare();
                }
        }
Exemplo n.º 2
0
 private Stickers createSticker(Nomenclature nomenclature, Parties party, int packsQuantity, int unitsQuantity, long trayId, int startUnitsQuantity)
 {
     var sticker = new Stickers();
     sticker.Nomenclature = nomenclature;
     sticker.Quantity = packsQuantity;
     sticker.UnitsQuantity = unitsQuantity;
     sticker.Driver = Driver;
     if (trayId > 0)
         {
         sticker.SetRef("Tray", trayId);
         }
     sticker.AcceptionDate = Date;
     sticker.StartUnitsQuantity = startUnitsQuantity;
     sticker.ReleaseDate = party.DateOfManufacture;
     sticker.ExpiryDate = party.TheDeadlineSuitability;
     sticker.Party = party;
     if (sticker.Write() != WritingResult.Success)
         {
         return null;
         }
     return sticker;
 }
Exemplo n.º 3
0
        private List<Stickers> createStickers(List<NomenclatureData> wareList)
        {
            var result = new List<Stickers>();

            for (int rowIndex = 0; rowIndex < NomenclatureInfo.Rows.Count; rowIndex++)
                {
                DataRow row = NomenclatureInfo.Rows[rowIndex];

                var nomenclatureCount = Convert.ToInt32(row[NomenclatureCount]);
                var nomenclature = new Nomenclature() { ReadingId = row[Nomenclature] };
                var countInOnePalet = nomenclature.UnitsQuantityPerPallet;
                var countInOnePack = nomenclature.UnitsQuantityPerPack;
                if (countInOnePack == 0)
                    {
                    countInOnePack = 1;// to avoid division by zero
                    }

                var party = new Parties() { ReadingId = row[NomenclatureParty] };

                var nomenclatureData = wareList[rowIndex];
                var createSpecificStikers = nomenclatureData.StandartPalletsCount > 0 ||
                                            nomenclatureData.NonStandartPalletsCount > 0;

                var trayId = nomenclatureData.WithoutTray ? 0 : Consts.StandartTray.Id;

                // список кортежей: первый элемент - кол-во упаковок, второй - количество штук, третий - Id поддона
                var pallets = createSpecificStikers ? buildNonStandartQuantitiesList(nomenclatureData, countInOnePack, trayId) : buildStandartQuantitiesList(nomenclatureCount, countInOnePalet, countInOnePack, trayId);

                foreach (var unitsQuantity in pallets)
                    {
                    var newSticker = createSticker(nomenclature, party, unitsQuantity.Item1, unitsQuantity.Item2, unitsQuantity.Item3, unitsQuantity.Item4);
                    if (newSticker == null)
                        {
                        return new List<Stickers>();
                        }
                    result.Add(newSticker);
                    }
                }

            return result;
        }
Exemplo n.º 4
0
        private void fillDateInRow(DataRow row)
        {
            long partyId = (long)row[NomenclatureParty];

            if (partyDic.ContainsKey(partyId))
                {
                row[NomenclatureDate] = partyDic[partyId];
                }
            else
                {
                Parties party = new Parties() { ReadingId = partyId };
                partyDic.Add(partyId, party.DateOfManufacture);
                row[NomenclatureDate] = party.DateOfManufacture;
                }
        }