Beispiel #1
0
        public List <SysChemicalItem> GetAvailableChemicalInStock(byte _RequisitionAt)
        {
            var FinalStock = DalChemicalStock.ItemWiseStockInSpecificChemicalStore(_RequisitionAt);

            var data = (from s in FinalStock
                        where s.ClosingQty > 0
                        join c in _context.Sys_ChemicalItem on s.ItemID equals c.ItemID into Chemicals
                        from c in Chemicals.DefaultIfEmpty()

                        join i in _context.Sys_ItemType on(c.ItemTypeID == null? null: c.ItemTypeID) equals i.ItemTypeID into ItemTypes
                        from i in ItemTypes.DefaultIfEmpty()


                        select new SysChemicalItem
            {
                ItemID = Convert.ToInt32(s.ItemID),
                ItemName = c == null ? null : c.ItemName,
                //ItemCategory = DalCommon.ReturnChemicalItemCategory(c.ItemCategory),
                //ItemTypeName = DalCommon.GetItemTypeName(Convert.ToByte(c.ItemTypeID)),
                ItemCategory = c.ItemCategory,
                ItemTypeName = (i == null? null: i.ItemTypeName),
                StockQty = s.ClosingQty
            }).ToList();

            foreach (var item in data)
            {
                item.ItemCategory = DalCommon.ReturnChemicalItemCategory(item.ItemCategory);
            }

            return(data);
        }
        public List <PrdYearMonthCrustScheduleItem> GetRequisitionItemList(string _RequistionDateID)
        {
            using (var context = new BLC_DEVEntities())
            {
                var ScheduleItem = (from i in context.PRD_YearMonthFinishReqItem.AsEnumerable()
                                    where i.RequisitionDateID.ToString() == _RequistionDateID
                                    //join d in YearMonthScheduleDate on i.ScheduleDateID equals d.ScheduleDateID into Items
                                    //from d in Items.DefaultIfEmpty()

                                    join b in context.Sys_Buyer on i.BuyerID equals b.BuyerID into Buyers
                                    from b in Buyers.DefaultIfEmpty()

                                    join o in context.SLS_BuyerOrder on i.BuyerOrderID equals o.BuyerOrderID into Orders
                                    from o in Orders.DefaultIfEmpty()

                                    join u in context.Sys_Unit on i.AvgSizeUnit equals u.UnitID into AVGUnits
                                    from u in AVGUnits.DefaultIfEmpty()

                                    join tu in context.Sys_Unit on i.ThicknessUnit equals tu.UnitID into ThickUnits
                                    from tu in ThickUnits.DefaultIfEmpty()

                                    join a in context.Sys_Article on i.ArticleID equals a.ArticleID into Articles
                                    from a in Articles.DefaultIfEmpty()

                                    join it in context.Sys_ItemType on i.ItemTypeID equals it.ItemTypeID into ItemTypes
                                    from it in ItemTypes.DefaultIfEmpty()

                                    join ls in context.Sys_LeatherStatus on i.LeatherStatusID equals ls.LeatherStatusID into LeatherStatus
                                    from ls in LeatherStatus.DefaultIfEmpty()

                                    select new PrdYearMonthCrustScheduleItem
                {
                    //ScheduleItemID = i.ScheduleItemID,
                    RequisitionItemID = i.RequisitionItemID,
                    ScheduleProductionNo = i.ScheduleProductionNo == "Press F9" ? null : i.ScheduleProductionNo,
                    BuyerID = i.BuyerID,
                    BuyerName = (b == null ? null : b.BuyerName),
                    BuyerOrderID = i.BuyerOrderID,
                    BuyerOrderNo = (o == null ? null : o.BuyerOrderNo),

                    ItemTypeID = i.ItemTypeID,
                    ItemTypeName = (it == null ? "" : it.ItemTypeName),

                    LeatherStatusID = i.LeatherStatusID,
                    LeatherStatusName = (ls == null ? "" : ls.LeatherStatusName),
                    ArticleID = i.ArticleID,
                    ArticleNo = i.ArticleNo,
                    ArticleName = (a == null ? null : a.ArticleName),

                    ArticleChallanID = i.ArticleChallanID,
                    ArticleChallanNo = i.ArticleChallanNo,

                    AvgSize = i.AvgSize,
                    AvgSizeUnit = i.AvgSizeUnit,
                    AvgSizeUnitName = (u == null ? "" : u.UnitName),
                    SideDescription = i.SideDescription,
                    SelectionRange = i.SelectionRange,
                    Thickness = i.Thickness,
                    ThicknessUnit = i.ThicknessUnit,
                    ThicknessUnitName = (tu == null ? "" : tu.UnitName),
                    ThicknessAt = i.ThicknessAt == "AFSV" ? "After Shaving" : "After Finishing",
                    Remarks = i.Remark
                }).ToList();

                return(ScheduleItem);
            }
        }
        public List <PrdYearMonthCrustScheduleItem> GetScheduleList(string _ScheduleYear, string _ScheduleMonth, string _ProductionFloor)
        {
            using (_context)
            {
                var YearMonthID = (from y in _context.PRD_YearMonth.AsEnumerable()
                                   where y.ScheduleYear == _ScheduleYear & y.ScheduleMonth == _ScheduleMonth & (y.ProductionFloor).ToString() == _ProductionFloor &
                                   y.ScheduleFor == "CRP"
                                   select y.YearMonID).FirstOrDefault();

                var YearMonthSchedule = (from s in _context.PRD_YearMonthSchedule.AsEnumerable()
                                         where s.YearMonID == YearMonthID
                                         select new
                {
                    ScheduleID = s.ScheduleID
                }).ToList();

                var YearMonthScheduleDate = (from s in YearMonthSchedule.AsEnumerable()
                                             join d in _context.PRD_YearMonthScheduleDate on s.ScheduleID equals d.ScheduleID into ScheduleDates
                                             from d in ScheduleDates.DefaultIfEmpty()
                                             select new
                {
                    ScheduleDateID = (d == null ? 0 : d.ScheduleDateID)
                }).ToList();

                var ScheduleItem = (from i in _context.PRD_YearMonthFinishScheduleItem.AsEnumerable()
                                    join d in YearMonthScheduleDate on i.ScheduleDateID equals d.ScheduleDateID into Items
                                    from d in Items.DefaultIfEmpty()

                                    join b in _context.Sys_Buyer on i.BuyerID equals b.BuyerID into Buyers
                                    from b in Buyers.DefaultIfEmpty()

                                    join o in _context.SLS_BuyerOrder on i.BuyerOrderID equals o.BuyerOrderID into Orders
                                    from o in Orders.DefaultIfEmpty()

                                    join u in _context.Sys_Unit on i.AvgSizeUnit equals u.UnitID into AVGUnits
                                    from u in AVGUnits.DefaultIfEmpty()

                                    join tu in _context.Sys_Unit on i.ThicknessUnit equals tu.UnitID into ThickUnits
                                    from tu in ThickUnits.DefaultIfEmpty()

                                    join a in _context.Sys_Article on i.ArticleID equals a.ArticleID into Articles
                                    from a in Articles.DefaultIfEmpty()

                                    join it in _context.Sys_ItemType on i.ItemTypeID equals it.ItemTypeID into ItemTypes
                                    from it in ItemTypes.DefaultIfEmpty()

                                    join ls in _context.Sys_LeatherStatus on i.LeatherStatusID equals ls.LeatherStatusID into LeatherStatus
                                    from ls in LeatherStatus.DefaultIfEmpty()

                                    select new PrdYearMonthCrustScheduleItem
                {
                    ScheduleItemID = i.ScheduleItemID,
                    ScheduleProductionNo = i.ScheduleProductionNo,
                    BuyerID = i.BuyerID,
                    BuyerName = (b == null ? null : b.BuyerName),
                    BuyerOrderID = i.BuyerOrderID,
                    BuyerOrderNo = (o == null ? null : o.BuyerOrderNo),

                    ItemTypeID = i.ItemTypeID,
                    ItemTypeName = (it == null ? null : it.ItemTypeName),

                    LeatherStatusID = i.LeatherStatusID,
                    LeatherStatusName = (ls == null ? null : ls.LeatherStatusName),
                    ArticleID = i.ArticleID,
                    ArticleNo = i.ArticleNo,
                    ArticleName = (a == null ? null : a.ArticleName),
                    ArticleChallanID = i.ArticleChallanID,
                    ArticleChallanNo = i.ArticleChallanNo,
                    AvgSize = i.AvgSize,
                    AvgSizeUnit = i.AvgSizeUnit,
                    AvgSizeUnitName = (u == null ? null : u.UnitName),
                    SideDescription = i.SideDescription,
                    SelectionRange = i.SelectionRange,
                    Thickness = i.Thickness,
                    ThicknessUnit = i.ThicknessUnit,
                    ThicknessUnitName = (tu == null ? null : tu.UnitName),
                    ThicknessAt = i.ThicknessAt == "AFSV" ? "After Shaving" : "After Finishing",
                    Remarks = i.Remarks
                }).ToList();

                return(ScheduleItem);
            }
        }