예제 #1
0
        private void addBoxRow()
        {
            var wareRow = resultTable.Rows[0];

            var nomenclatureId = Convert.ToInt64(wareRow["Nomenclature"]);
            var nomenclature = new Nomenclature() { ReadingId = nomenclatureId };
            if (!nomenclature.BoxType.Empty)
                {
                var planUnitsQuantity = Convert.ToInt32(wareRow["PlanValue"]);
                var factUnitsQuantity = Convert.ToInt32(wareRow["FactValue"]);

                var boxesPlan = (planUnitsQuantity / nomenclature.UnitsQuantityPerPack) + ((planUnitsQuantity % nomenclature.UnitsQuantityPerPack) > 0 ? 1 : 0);
                var boxesFact = (factUnitsQuantity / nomenclature.UnitsQuantityPerPack) + ((factUnitsQuantity % nomenclature.UnitsQuantityPerPack) > 0 ? 1 : 0);

                var boxesRow = resultTable.NewRow();
                boxesRow["Nomenclature"] = nomenclature.BoxType.Id;
                boxesRow["PlanValue"] = boxesPlan;
                boxesRow["FactValue"] = boxesFact;

                boxesRow["StartCodeOfPreviousPallet"] = 0;
                boxesRow["FinalCodeOfPreviousPallet"] = 0;

                boxesRow["PalletCode"] = palletCode;
                boxesRow["StartCell"] = wareRow["StartCell"];
                boxesRow["FinalCell"] = wareRow["FinalCell"];

                resultTable.Rows.Add(boxesRow);

                BoxesRow = boxesRow;
                }
        }
예제 #2
0
파일: Measures.cs 프로젝트: AramisIT/FMCG
 public static long GetBoxForNomenclature(Nomenclature nomenclature)
 {
     return GetBoxForNomenclature(nomenclature.Id);
 }
예제 #3
0
        public bool CreateNewSticker(long wareId, DateTime expirationDate, int unitsQuantity, int boxesCount, long linerId, int linersCount, out long newStickerId)
        {
            var party = Parties.FindByExpirationDate(wareId, expirationDate);

            if (party.IsNull() || party.Empty)
                {
                newStickerId = 0;
                return false;
                }

            var nomenclature = new Nomenclature() { ReadingId = wareId };
            var sticker = new Stickers()
                {
                    Nomenclature = nomenclature,
                    Party = party,
                    UnitsQuantity = unitsQuantity,
                    Quantity = boxesCount,
                    ReleaseDate = party.DateOfManufacture,
                    ExpiryDate = party.TheDeadlineSuitability,
                    AcceptionDate = DateTime.Now,
                    Liner = new Nomenclature() { ReadingId = linerId },
                    LinersQuantity = linersCount
                };

            // ���������������, ��� ������� �������
            sticker.StartUnitsQuantity = nomenclature.UnitsQuantityPerPallet > unitsQuantity
                ? nomenclature.UnitsQuantityPerPallet
                : unitsQuantity;

            sticker.Write();
            newStickerId = sticker.Id;

            var stickerExists = newStickerId > 0;

            if (stickerExists)
                {
                printStickers(new List<Stickers>() { sticker });
                }

            return stickerExists;
        }
예제 #4
0
파일: Shipment.cs 프로젝트: AramisIT/FMCG
        private void fillTareInRow(DataRow row)
        {
            long nomenclatureId = (long)row[Nomenclature];

            if (tareDic.ContainsKey(nomenclatureId))
                {
                row[IsTare] = tareDic[nomenclatureId];
                }
            else
                {
                Nomenclature nomenclature = new Nomenclature() { ReadingId = nomenclatureId };
                tareDic.Add(nomenclatureId, nomenclature.IsTare);
                row[IsTare] = nomenclature.IsTare;
                }
        }
예제 #5
0
 public static bool IsKeg(this Nomenclature nomenclature)
 {
     return(nomenclature.UnitsQuantityPerPack <= 1);
 }
예제 #6
0
        private void SelectNomenclatureValue(KeyValuePair<long, string> value)
        {
            NomenclatureData currentRow = selectedRow;

            if (currentRow.Description != null && currentRow.Description.Id == value.Key)
                {
                editControlsArea.Controls.Clear();
                }
            else
                {
                //foreach (NomenclatureData data in list)
                //    {
                //    if (data.Description != null &&
                //        data.Description.Id == value.Key &&
                //        data.LineNumber != currentRow.LineNumber)
                //        {
                //        string message = string.Format(
                //            "\r\nВ таблиці вже існує рядок №{0} з такою номенлатурою..", data.LineNumber);
                //        showMessage("Повторення номенклатури!", message);
                //        return;
                //        }
                //    }

                selectedRow.Description = new ObjectValue(value);

                var nomenclature = new Nomenclature() { ReadingId = value.Key };
                selectedRow.UnitsAmountInOneStandartPallet = nomenclature.UnitsQuantityPerPallet;
                selectedRow.WithoutTray = nomenclature.WithoutTray;
                selectedRow.UnitsAmountInOneNonStandartPallet = 0;
                selectedRow.UpdatePalletQuantity();

                grid.RefreshDataSource();
                showMessage("Обрано нову номенклатуру!", value.Value);
                }

            updateSelectedRowInfo();
        }
예제 #7
0
        private bool getBoxes(long nomenclatureId, int units, out NomenclatureData tare)
        {
            var nomenclature = new Nomenclature() { ReadingId = nomenclatureId };

            if (nomenclature.IsKeg() || nomenclature.BoxType.Empty)
                {
                tare = null;
                return false;
                }

            tare = new NomenclatureData();
            tare.Description = new ObjectValue(nomenclature.BoxType.Description, nomenclature.BoxType.Id);
            tare.Quantity = units / nomenclature.UnitsQuantityPerPack;

            return true;
        }
예제 #8
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();
                }
        }
예제 #9
0
        /// <summary>Конвертація списку елементів в таблицю</summary>
        private void convertListsToTables()
        {
            Dictionary<Product, Parties> partyDic = getPartyForTable();
            Document.NomenclatureInfo.Rows.Clear();
            foreach (NomenclatureData data in waresList)
                {
                if (data.Description != null && data.Description.Id != 0)
                    {
                    DataRow newRow = Document.NomenclatureInfo.GetNewRow(Document);
                    newRow.SetRefValueToRowCell(Document, Document.Nomenclature, data.Description.Id, typeof(Nomenclature));
                    newRow[Document.NomenclatureCount] = data.Quantity;
                    newRow.SetRefValueToRowCell(Document, Document.NomenclatureParty, partyDic[new Product(data.Description.Id, data.Date.Date)]);
                    newRow.AddRowToTable(Document);

                    var nomenclature = new Nomenclature() { ReadingId = data.Description.Id };
                    if (nomenclature.ShelfLife != data.ShelfLifeDays)
                        {
                        nomenclature.ShelfLife = data.ShelfLifeDays;
                        nomenclature.Write();
                        }
                    }
                }
            Document.SetSubtableModified(Document.NomenclatureInfo.TableName);

            Document.TareInfo.Rows.Clear();
            tareList = tareList ?? new List<NomenclatureData>();
            foreach (NomenclatureData data in tareList)
                {
                if (data.Description != null && data.Description.Id != 0)
                    {
                    DataRow newRow = Document.TareInfo.GetNewRow(Document);
                    newRow.SetRefValueToRowCell(Document, Document.Tare, data.Description.Id, typeof(Nomenclature));
                    newRow[Document.TareCount] = data.Quantity;
                    newRow.AddRowToTable(Document);
                    }
                }
            Document.SetSubtableModified(Document.TareInfo.TableName);
        }
예제 #10
0
 private void addTrays(Dictionary<long, NomenclatureData> tareDictionary, int standartTrays, Nomenclature nomenclatureTray)
 {
     if (standartTrays < 1) return;
     NomenclatureData tare;
     if (tareDictionary.TryGetValue(nomenclatureTray.Id, out tare))
         {
         tare.Quantity += standartTrays;
         }
     else
         {
         tare = new NomenclatureData
             {
                 Description = new ObjectValue(nomenclatureTray.Description, nomenclatureTray.Id),
                 Quantity = standartTrays
             };
         tareDictionary.Add(nomenclatureTray.Id, tare);
         }
 }
예제 #11
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;
        }
예제 #12
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;
 }
예제 #13
0
        private GoodsRows findStickerRows(long stickerId)
        {
            var result = new GoodsRows();

            foreach (DataRow row in NomenclatureInfo.Rows)
                {
                if (row[this.NomenclatureCode].Equals(stickerId))
                    {
                    var nomenclatureId = (long)row[Nomenclature];

                    if (isTray(nomenclatureId))
                        {
                        result.TrayRow = row;
                        }
                    else if (isLiner(nomenclatureId))
                        {
                        result.LinerRow = row;
                        }
                    else
                        {
                        var nomenclature = new Nomenclature() { ReadingId = nomenclatureId };

                        if (nomenclature.IsTare)
                            {
                            result.BoxRow = row;
                            }
                        else
                            {
                            result.WareRow = row;
                            }
                        }
                    }
                }

            return result;
        }
예제 #14
0
        private void addWareRow(Stickers sticker, Cells cell, Nomenclature nomenclature, int quantity, long partyId)
        {
            if (quantity > 0 && !nomenclature.Empty)
                {
                var row = NomenclatureInfo.GetNewRow(this);

                row[Nomenclature] = nomenclature.Id;
                row[NomenclaturePlan] = quantity;
                row[NomenclatureParty] = partyId;
                row[NomenclatureCode] = sticker.Id;
                row[NomenclatureCell] = cell.Id;

                row.AddRowToTable(this);
                }
        }
예제 #15
0
 public static long GetBoxForNomenclature(Nomenclature nomenclature)
 {
     return(GetBoxForNomenclature(nomenclature.Id));
 }