Example #1
0
        private GoodsRows getPalletBalance(long palletId)
        {
            const string sql = @"
            with tareTypes as (
            select top 2 cast(Value as bigint) [Id], 2 wareType
            from [SystemConsts] where [description] = 'StandartTray' or [description] = 'NonStandartTray'

            union all

            select top 2 cast(Value as bigint) [Id], 3 wareType
            from [SystemConsts] where [description] = 'StandartLiner' or [description] = 'NonStandartLiner'
            )

            select Stock.Nomenclature, Stock.Cell NomenclatureCell, Stock.Party,
            par.DateOfManufacture [ProductionDate], Stock.Quantity NomenclatureFact,
            isnull(RTRIM(c.[Description]),'') [CellDescription],
            ISNULL(tareTypes.wareType, case when Stock.Party = 0 then 1 else 0 end) NomenclatureType

             FROM dbo.GetStockBalance (
              '0001-01-01',
              0,
              0,
              @ComplateType,
              0,
              @PalletId) Stock

            left join tareTypes on tareTypes.Id = Stock.Nomenclature and Stock.Party = 0
            left join Cells c on c.Id = Stock.Cell
            left join Parties par on par.Id = Stock.Party

            ";
            var q = DB.NewQuery(sql);
            q.AddInputParameter("ComplateType", (int)RowsStates.Completed);
            q.AddInputParameter("PalletId", palletId);
            var table = q.SelectToTable();

            var result = new GoodsRows();
            foreach (DataRow row in table.Rows)
                {
                var tareType = (GoodsRows.NomenclatureTypes)row["NomenclatureType"];
                result.SetRow(row, tareType);
                }

            return result;
        }
Example #2
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;
        }