示例#1
0
        public bool GetWares(string barcode, SelectionFilters selectionFilter, out DataTable wares)
        {
            var q = DB.NewQuery(@"select n.Id, rtrim(n.Description) [Description]
            from Barcodes b
            join Nomenclature n on n.Id = b.Nomenclature
            where b.Description = @barcode");
            q.AddInputParameter("barcode", barcode);

            var result = q.SelectToTable();

            switch (selectionFilter)
                {
                case SelectionFilters.All:
                    wares = result;
                    return q.ThrowedException == null;

                case SelectionFilters.RecentlyShipped:
                    wares = filterRecentlyShippedWares(result);
                    break;

                default:
                    wares = null;
                    break;
                }

            return wares != null;
        }
示例#2
0
        public bool GetWaresInKegs(SelectionFilters selectionFilter, out DataTable waresInKegs)
        {
            var q = DB.NewQuery(@"
            select n.Id, rtrim(n.Description) [Description]
            from Nomenclature n
            where BoxType > 0
            and UnitsQuantityPerPallet > 0
            and UnitsQuantityPerPack = 1
            and IsTare = 0
            and ShelfLife > 0
            and MarkForDeleting = 0
            ");

            var result = q.SelectToTable();

            switch (selectionFilter)
                {
                case SelectionFilters.All:
                    waresInKegs = result;
                    break;

                case SelectionFilters.RecentlyShipped:
                    waresInKegs = filterRecentlyShippedWares(result);
                    break;

                default:
                    waresInKegs = null;
                    break;
                }

            return waresInKegs != null;
        }
示例#3
0
        public bool GetParties(long wareId, SelectionFilters selectionFilter, out DataTable parties)
        {
            switch (selectionFilter)
                {
                case SelectionFilters.RecentlyShipped:
                    var q = DB.NewQuery(string.Format(@"
            declare @boundDate date = DATEADD (day , -{0}, cast(GETDATE() as date));

            select distinct p.Id, p.TheDeadlineSuitability ExpirationDate from Moving

            join dbo.SubMovingNomenclatureInfo n on n.IdDoc = Moving.Id
            join Parties p on p.Id = n.Party

            where Moving.PickingPlan > 0 and Moving.Date >= @boundDate
            and n.Nomenclature = @Nomenclature and Moving.MarkForDeleting = 0

            order by p.TheDeadlineSuitability", RECENTLY_SHIPPED_DAYS_AMOUNT));
                    q.AddInputParameter("Nomenclature", wareId);

                    var result = q.SelectToTable();
                    var expirationColumn = new DataColumn("Expiration", typeof(string));
                    result.Columns.Add(expirationColumn);

                    var dataTimeColumn = result.Columns["ExpirationDate"];
                    foreach (DataRow row in result.Rows)
                        {
                        var expirationDate = (DateTime)row[dataTimeColumn];
                        row[expirationColumn] = expirationDate.ConvertToStringDateOnly();
                        }
                    result.Columns.Remove(dataTimeColumn);

                    parties = result;
                    break;

                default:
                    parties = null;
                    break;
                }

            return parties != null;
        }