예제 #1
0
        public List <SysArticleChallan> GetSearchInformation()
        {
            using (_context)
            {
                var Data = (from c in _context.Sys_ArticleChallan.AsEnumerable()

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

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

                            orderby c.ArticleChallanID descending
                            select new SysArticleChallan
                {
                    ArticleChallanID = c.ArticleChallanID,
                    ArticleChallanNo = c.ArticleChallanNo,
                    BuyerID = c.BuyerID,
                    BuyerCode = (b == null?null:b.BuyerCode),
                    BuyerName = (b == null ? null : b.BuyerName),
                    ArticleID = c.ArticleID,
                    ArticleName = (a == null?null:a.ArticleName),
                    PreparationDate = Convert.ToDateTime(c.PreparationDate).ToString("dd'/'MM'/'yyyy"),
                    RecordStatus = DalCommon.ReturnRecordStatus(c.RecordStatus),
                    ChallanNote = c.ChallanNote,
                    ArticleNote = c.ArticleNote,
                    ArticleArea = c.ArticleArea
                }).ToList();

                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);
            }
        }