示例#1
0
        public JobOrderDetail GetJobOrderDetail(int JobOrderLineId)
        {
            var temp = (from L in _unitOfWork.Repository <ViewJobOrderBalance>().Instance
                        join Dl in _unitOfWork.Repository <JobOrderLine>().Instance on L.JobOrderLineId equals Dl.JobOrderLineId into JobOrderLineTable
                        from JobOrderLineTab in JobOrderLineTable.DefaultIfEmpty()
                        join Dh in _unitOfWork.Repository <JobOrderHeader>().Instance on L.JobOrderHeaderId equals Dh.JobOrderHeaderId into JobOrderHeaderTable
                        from JobOrderHeaderTab in JobOrderHeaderTable.DefaultIfEmpty()
                        where L.JobOrderLineId == JobOrderLineId
                        select new JobOrderDetail
            {
                JobOrderHeaderDocNo = L.JobOrderNo,
                ProductId = L.ProductId,
                ProductName = L.Product.ProductName,
                Dimension1Id = L.Dimension1Id,
                Dimension1Name = L.Dimension1.Dimension1Name,
                Dimension2Id = L.Dimension2Id,
                Dimension2Name = L.Dimension2.Dimension2Name,
                MachineId = JobOrderHeaderTab.MachineId,
                MachineName = JobOrderHeaderTab.Machine.ProductName,
                Qty = L.BalanceQty,
                BalanceQty = L.BalanceQty,
                LotNo = JobOrderLineTab.LotNo,
                UnitId = JobOrderLineTab.UnitId
            }).FirstOrDefault();

            return(temp);
        }
        public object GetProductUidDetail(string ProductUidName, int filter)
        {
            var Header = new JobInvoiceReturnHeaderService(db).Find(filter);

            var temp = (from i in db.JobInvoiceLine
                        join L in db.JobReceiveLine on i.JobReceiveLineId equals L.JobReceiveLineId
                        join H in db.JobReceiveHeader on L.JobReceiveHeaderId equals H.JobReceiveHeaderId into JobReceiveHeaderTable
                        from JobReceiveHeaderTab in JobReceiveHeaderTable.DefaultIfEmpty()
                        join Jol in db.JobOrderLine on L.JobOrderLineId equals Jol.JobOrderLineId into JobOrderLineTable
                        from JobOrderLineTab in JobOrderLineTable.DefaultIfEmpty()
                        join Pu in db.ProductUid on(JobOrderLineTab.ProductUidHeaderId == null ? JobOrderLineTab.ProductUidId : L.ProductUidId) equals Pu.ProductUIDId into ProductUidTable
                        from ProductUidTab in ProductUidTable.DefaultIfEmpty()
                        where ProductUidTab.ProductUidName == ProductUidName && JobReceiveHeaderTab.ProcessId == Header.ProcessId && JobReceiveHeaderTab.SiteId == Header.SiteId &&
                        JobReceiveHeaderTab.DivisionId == Header.DivisionId && JobReceiveHeaderTab.JobWorkerId == Header.JobWorkerId
                        orderby JobReceiveHeaderTab.DocDate
                        select new
            {
                ProductUidId = ProductUidTab.ProductUIDId,
                JobInvoiceLineId = i.JobInvoiceLineId,
                JobInvoiceDocNo = i.JobInvoiceHeader.DocNo,
                Success = (i.JobInvoiceHeader.JobWorkerId == Header.JobWorkerId ? true : false),
                ProdUidHeaderId = JobOrderLineTab.ProductUidHeaderId,
            }).ToList().Last();

            return(temp);
        }
        public IEnumerable <JobOrderHeaderListViewModel> GetPendingJobOrdersWithPatternMatch(int JobWorkerId, string term, int Limiter)//Product Id
        {
            var DivisionId = (int)System.Web.HttpContext.Current.Session["DivisionId"];
            var SiteId     = (int)System.Web.HttpContext.Current.Session["SiteId"];


            var tem = (from p in db.ViewJobOrderBalance
                       join D1 in db.Dimension1 on p.Dimension1Id equals D1.Dimension1Id into Dimension1Table
                       from Dimension1Tab in Dimension1Table.DefaultIfEmpty()
                       join D2 in db.Dimension2 on p.Dimension2Id equals D2.Dimension2Id into Dimension2Table
                       from Dimension2Tab in Dimension2Table.DefaultIfEmpty()
                       join D3 in db.Dimension3 on p.Dimension3Id equals D3.Dimension3Id into Dimension3Table
                       from Dimension3Tab in Dimension3Table.DefaultIfEmpty()
                       join D4 in db.Dimension4 on p.Dimension4Id equals D4.Dimension4Id into Dimension4Table
                       from Dimension4Tab in Dimension4Table.DefaultIfEmpty()
                       join t3 in db.Product on p.ProductId equals t3.ProductId
                       join Jol in db.JobOrderLine on p.JobOrderLineId equals Jol.JobOrderLineId into JobOrderLineTable from JobOrderLineTab in JobOrderLineTable.DefaultIfEmpty()
                       where p.BalanceQty > 0 && p.JobWorkerId == JobWorkerId &&
                       p.DivisionId == DivisionId && p.SiteId == SiteId &&
                       ((string.IsNullOrEmpty(term) ? 1 == 1 : p.JobOrderNo.ToLower().Contains(term.ToLower())) ||
                        (string.IsNullOrEmpty(term) ? 1 == 1 : Dimension1Tab.Dimension1Name.ToLower().Contains(term.ToLower())) ||
                        (string.IsNullOrEmpty(term) ? 1 == 1 : Dimension2Tab.Dimension2Name.ToLower().Contains(term.ToLower())) ||
                        (string.IsNullOrEmpty(term) ? 1 == 1 : Dimension3Tab.Dimension3Name.ToLower().Contains(term.ToLower())) ||
                        (string.IsNullOrEmpty(term) ? 1 == 1 : Dimension4Tab.Dimension4Name.ToLower().Contains(term.ToLower())) ||
                        (string.IsNullOrEmpty(term) ? 1 == 1 : t3.ProductName.ToLower().Contains(term.ToLower())))
                       orderby p.JobOrderNo
                       select new JobOrderHeaderListViewModel
            {
                DocNo = p.JobOrderNo,
                JobOrderLineId = p.JobOrderLineId,
                Dimension1Name = Dimension1Tab.Dimension1Name,
                Dimension2Name = Dimension2Tab.Dimension2Name,
                Dimension3Name = Dimension3Tab.Dimension3Name,
                Dimension4Name = Dimension4Tab.Dimension4Name,
                ProductName = t3.ProductName,
                ProductUidId = JobOrderLineTab.ProductUidId,
                ProductUidName = JobOrderLineTab.ProductUid.ProductUidName,
                LotNo = JobOrderLineTab.LotNo,
                BalanceQty = p.BalanceQty,
            }).Take(Limiter);

            return(tem);
        }
示例#4
0
        public JobReceiveQAAttributeViewModel GetJobReceiveQAAttributeDetailForEdit(int JobReceiveQALineid)
        {
            JobReceiveQAAttributeViewModel JobReceiveQALineDetail = (from L in db.JobReceiveQALine
                                                                     join H in db.JobReceiveQAHeader on L.JobReceiveQAHeaderId equals H.JobReceiveQAHeaderId into JobReceiveQAHeaderTable
                                                                     from JobReceiveQAHeaderTab in JobReceiveQAHeaderTable.DefaultIfEmpty()
                                                                     join Jrl in db.JobReceiveLine on L.JobReceiveLineId equals Jrl.JobReceiveLineId into JobReceiveLineTable
                                                                     from JobReceiveLineTab in JobReceiveLineTable.DefaultIfEmpty()
                                                                     join Jol in db.JobOrderLine on JobReceiveLineTab.JobOrderLineId equals Jol.JobOrderLineId into JobOrderLineTable
                                                                     from JobOrderLineTab in JobOrderLineTable.DefaultIfEmpty()
                                                                     join Ld in db.JobReceiveQALineExtended on L.JobReceiveQALineId equals Ld.JobReceiveQALineId into JobReceiveQALineDetailTable
                                                                     from JobReceiveQALineDetailTab in JobReceiveQALineDetailTable.DefaultIfEmpty()
                                                                     where L.JobReceiveQALineId == JobReceiveQALineid
                                                                     select new JobReceiveQAAttributeViewModel
            {
                JobReceiveQALineId = L.JobReceiveQALineId,
                JobReceiveQAHeaderId = L.JobReceiveQAHeaderId,
                JobReceiveLineId = L.JobReceiveLineId,
                JobWorkerId = JobReceiveQAHeaderTab.JobWorkerId,
                ProductUidId = L.ProductUidId,
                ProductUidName = L.ProductUid.ProductUidName,
                ProductId = JobOrderLineTab.ProductId,
                ProductName = JobOrderLineTab.Product.ProductName,
                QAQty = L.Qty,
                InspectedQty = L.Qty,
                Qty = L.Qty,
                UnitId = JobOrderLineTab.Product.UnitId,
                DealUnitId = JobReceiveLineTab.DealUnitId,
                UnitConversionMultiplier = L.UnitConversionMultiplier,
                DealQty = L.DealQty,
                Weight = L.Weight,
                UnitDecimalPlaces = JobOrderLineTab.Product.Unit.DecimalPlaces,
                DealUnitDecimalPlaces = JobOrderLineTab.DealUnit.DecimalPlaces,
                PenaltyRate = L.PenaltyRate,
                PenaltyAmt = L.PenaltyAmt,
                DivisionId = JobReceiveQAHeaderTab.DivisionId,
                SiteId = JobReceiveQAHeaderTab.SiteId,
                ProcessId = JobReceiveQAHeaderTab.ProcessId,
                DocDate = JobReceiveQAHeaderTab.DocDate,
                DocTypeId = JobReceiveQAHeaderTab.DocTypeId,
                DocNo = JobReceiveQAHeaderTab.DocNo,
                QAById = JobReceiveQAHeaderTab.QAById,
                Remark = JobReceiveQAHeaderTab.Remark,
                Length = JobReceiveQALineDetailTab.Length,
                Width = JobReceiveQALineDetailTab.Width,
                Height = JobReceiveQALineDetailTab.Height
            }).FirstOrDefault();

            if (JobReceiveQALineDetail != null)
            {
                ProductDimensions ProductDimensions = new ProductService(_unitOfWork).GetProductDimensions(JobReceiveQALineDetail.ProductId, JobReceiveQALineDetail.DealUnitId, JobReceiveQALineDetail.DocTypeId);
                if (ProductDimensions != null)
                {
                    JobReceiveQALineDetail.DimensionUnitDecimalPlaces = ProductDimensions.DimensionUnitDecimalPlaces;
                }
            }

            return(JobReceiveQALineDetail);
        }
示例#5
0
        public JobReceiveQAAttributeViewModel GetJobReceiveLineDetail(int JobReceiveLineid)
        {
            JobReceiveQAAttributeViewModel JobReceiveLineDetail = (from L in db.JobReceiveLine
                                                                   join H in db.JobReceiveHeader on L.JobReceiveHeaderId equals H.JobReceiveHeaderId into JobReceiveHeaderTable
                                                                   from JobReceiveHeaderTab in JobReceiveHeaderTable.DefaultIfEmpty()
                                                                   join Jol in db.JobOrderLine on L.JobOrderLineId equals Jol.JobOrderLineId into JobOrderLineTable
                                                                   from JobOrderLineTab in JobOrderLineTable.DefaultIfEmpty()
                                                                   where L.JobReceiveLineId == JobReceiveLineid
                                                                   select new JobReceiveQAAttributeViewModel
            {
                JobReceiveLineId = L.JobReceiveLineId,
                JobWorkerId = JobReceiveHeaderTab.JobWorkerId,
                ProductUidId = L.ProductUidId,
                ProductUidName = L.ProductUid.ProductUidName,
                ProductId = JobOrderLineTab.ProductId,
                ProductName = JobOrderLineTab.Product.ProductName,
                QAQty = L.Qty,
                InspectedQty = L.Qty,
                Qty = L.Qty,
                UnitId = JobOrderLineTab.Product.UnitId,
                DealUnitId = L.DealUnitId,
                UnitConversionMultiplier = L.UnitConversionMultiplier,
                DealQty = L.DealQty,
                Weight = L.Weight,
                UnitDecimalPlaces = JobOrderLineTab.Product.Unit.DecimalPlaces,
                DealUnitDecimalPlaces = JobOrderLineTab.DealUnit.DecimalPlaces,
                DocTypeId = JobReceiveHeaderTab.DocTypeId
            }).FirstOrDefault();


            if (JobReceiveLineDetail != null)
            {
                ProductDimensions ProductDimensions = new ProductService(_unitOfWork).GetProductDimensions(JobReceiveLineDetail.ProductId, JobReceiveLineDetail.DealUnitId, JobReceiveLineDetail.DocTypeId);
                if (ProductDimensions != null)
                {
                    JobReceiveLineDetail.Length = ProductDimensions.Length;
                    JobReceiveLineDetail.Width  = ProductDimensions.Width;
                    JobReceiveLineDetail.Height = ProductDimensions.Height;
                    JobReceiveLineDetail.DimensionUnitDecimalPlaces = ProductDimensions.DimensionUnitDecimalPlaces;
                }
            }

            return(JobReceiveLineDetail);
        }
示例#6
0
        public List <QAGroupLineLineViewModel> GetJobReceiveQAAttribute(int JobReceiveLineid)
        {
            List <QAGroupLineLineViewModel> JobReceiveQAAttribute = (from L in db.JobReceiveLine
                                                                     join H in db.JobReceiveHeader on L.JobReceiveHeaderId equals H.JobReceiveHeaderId into JobReceiveHeaderTable
                                                                     from JobReceiveHeaderTab in JobReceiveHeaderTable.DefaultIfEmpty()
                                                                     join Jol in db.JobOrderLine on L.JobOrderLineId equals Jol.JobOrderLineId into JobOrderLineTable
                                                                     from JobOrderLineTab in JobOrderLineTable.DefaultIfEmpty()
                                                                     join Pp in db.ProductProcess on new { X1 = JobOrderLineTab.ProductId, X2 = JobReceiveHeaderTab.ProcessId } equals new { X1 = Pp.ProductId, X2 = (Pp.ProcessId ?? 0) } into ProductProcessTable
                                                                     from ProductProcessTab in ProductProcessTable.DefaultIfEmpty()
                                                                     join QAGl in db.QAGroupLine on ProductProcessTab.QAGroupId equals QAGl.QAGroupId into QAGroupLineTable
                                                                     from QAGroupLineTab in QAGroupLineTable.DefaultIfEmpty()
                                                                     where L.JobReceiveLineId == JobReceiveLineid && ((int?)QAGroupLineTab.QAGroupLineId ?? 0) != 0
                                                                     select new QAGroupLineLineViewModel
            {
                QAGroupLineId = QAGroupLineTab.QAGroupLineId,
                DefaultValue = QAGroupLineTab.DefaultValue,
                Value = QAGroupLineTab.DefaultValue,
                Name = QAGroupLineTab.Name,
                DataType = QAGroupLineTab.DataType,
                ListItem = QAGroupLineTab.ListItem
            }).ToList();


            return(JobReceiveQAAttribute);
        }