Example #1
0
        public QualityAssurance_InputMasterDTO QueryDataFromPP(CheckPointInputConditionModel searchModel)
        {
            QualityAssurance_InputMasterDTO result = new QualityAssurance_InputMasterDTO();

            try
            {
                var query = from QAinterface in DataContext.PPForQAInterface
                            join flowchartdetail in DataContext.FlowChart_Detail on QAinterface.FlowChart_Detail_UID equals
                            flowchartdetail.FlowChart_Detail_UID
                            where flowchartdetail.FlowChart_Master_UID == searchModel.Flowchart_Master_UID &&
                            QAinterface.Color == searchModel.Color &&
                            QAinterface.Product_Date == searchModel.ProductDate &&
                            QAinterface.Time_Interval == searchModel.Time_interval && QAinterface.MaterielType == searchModel.MaterialType &&
                            QAinterface.QAUsedFlag == false && QAinterface.FlowChart_Detail_UID == searchModel.Flowchart_Detail_UID
                            select new
                {
                    QAinterface.NG_Qty,
                    QAinterface.Input_Qty
                };
                if (query.Count() > 0)
                {
                    result.NG_Qty        = query.ToArray()[0].NG_Qty;
                    result.Input         = query.ToArray()[0].Input_Qty;
                    result.Product_Date  = searchModel.ProductDate;
                    result.Time_Interval = searchModel.Time_interval;
                }
            }
            catch (Exception ex)
            {
                log.Error(ex);
            }
            return(result);
        }
Example #2
0
        public QualityAssurance_InputMasterDTO GetInputMasterByID(int uid)
        {
            QualityAssurance_InputMasterDTO result = new QualityAssurance_InputMasterDTO();

            try
            {
                var query = from qAMaster in DataContext.QualityAssurance_InputMaster
                            where qAMaster.QualityAssurance_InputMaster_UID == uid
                            select new QualityAssurance_InputMasterDTO
                {
                    NG_Qty                           = qAMaster.NG_Qty,
                    Input                            = qAMaster.Input,
                    Color                            = qAMaster.Color,
                    FirstCheck_Qty                   = qAMaster.FirstCheck_Qty,
                    FirstOK_Qty                      = qAMaster.FirstOK_Qty,
                    FirstRejectionRate               = qAMaster.FirstRejectionRate,
                    FlowChart_Detail_UID             = qAMaster.FlowChart_Detail_UID,
                    MaterielType                     = qAMaster.MaterielType,
                    Process                          = qAMaster.Process,
                    Product_Date                     = qAMaster.Product_Date,
                    Shipment_Qty                     = qAMaster.Shipment_Qty,
                    SurfaceSA_Qty                    = qAMaster.SurfaceSA_Qty,
                    SizeSA_Qty                       = qAMaster.SizeSA_Qty,
                    RepairCheck_Qty                  = qAMaster.RepairCheck_Qty,
                    RepairOK_Qty                     = qAMaster.RepairOK_Qty,
                    WIPForCheck_Qty                  = qAMaster.WIPForCheck_Qty,
                    Time_Interval                    = qAMaster.Time_Interval,
                    QualityAssurance_InputMaster_UID = qAMaster.QualityAssurance_InputMaster_UID,
                    NGFlag                           = qAMaster.NGFlag,
                    FirstCheckFlag                   = qAMaster.FirstCheckFlag,
                    Displace_Qty                     = qAMaster.Displace_Qty,
                    DisplaceFlag                     = qAMaster.DisplaceFlag
                };
                if (query.Count() != 0)
                {
                    result = query.ToList()[0];
                }
                return(result);
            }
            catch (Exception ex)
            {
                log.Error(ex);
            }

            return(result);
        }
Example #3
0
        public QualityAssurance_InputMasterDTO QueryAssuranceInputMaster(CheckPointInputConditionModel searchModel)
        {
            QualityAssurance_InputMasterDTO result = new QualityAssurance_InputMasterDTO();

            try
            {
                bool     searchHistory = false;
                TimeSpan tSpan         = DateTime.Now.Date - searchModel.ProductDate;
                if (tSpan.Days >= 7)
                {
                    searchHistory = true;
                }

                if (!searchHistory)
                {
                    var query = from qAMaster in DataContext.QualityAssurance_InputMaster
                                join flowChartDetail in DataContext.FlowChart_Detail on qAMaster.FlowChart_Detail_UID equals
                                flowChartDetail.FlowChart_Detail_UID
                                where
                                qAMaster.FlowChart_Detail_UID == searchModel.Flowchart_Detail_UID && qAMaster.Product_Date == searchModel.ProductDate &&
                                qAMaster.MaterielType == searchModel.MaterialType &&
                                qAMaster.Time_Interval == searchModel.Time_interval && qAMaster.Color == searchModel.Color
                                select new QualityAssurance_InputMasterDTO
                    {
                        NG_Qty                           = qAMaster.NG_Qty,
                        Input                            = qAMaster.Input,
                        Color                            = qAMaster.Color,
                        FirstCheck_Qty                   = qAMaster.FirstCheck_Qty,
                        FirstOK_Qty                      = qAMaster.FirstOK_Qty,
                        FirstRejectionRate               = qAMaster.FirstRejectionRate,
                        FlowChart_Detail_UID             = qAMaster.FlowChart_Detail_UID,
                        MaterielType                     = qAMaster.MaterielType,
                        Process                          = qAMaster.Process,
                        Product_Date                     = qAMaster.Product_Date,
                        Shipment_Qty                     = qAMaster.Shipment_Qty,
                        SurfaceSA_Qty                    = qAMaster.SurfaceSA_Qty,
                        SizeSA_Qty                       = qAMaster.SizeSA_Qty,
                        RepairCheck_Qty                  = qAMaster.RepairCheck_Qty,
                        RepairOK_Qty                     = qAMaster.RepairOK_Qty,
                        WIPForCheck_Qty                  = qAMaster.WIPForCheck_Qty,
                        Time_Interval                    = qAMaster.Time_Interval,
                        QualityAssurance_InputMaster_UID = qAMaster.QualityAssurance_InputMaster_UID,
                        NGFlag                           = qAMaster.NGFlag,
                        FirstCheckFlag                   = qAMaster.FirstCheckFlag,
                        Displace_Qty                     = qAMaster.Displace_Qty,
                        DisplaceFlag                     = qAMaster.DisplaceFlag
                    };

                    if (query.Count() != 0)
                    {
                        result = query.ToList()[0];
                    }
                }
                else
                {
                    var query = from qAMaster in DataContext.QualityAssurance_InputMaster_History
                                join flowChartDetail in DataContext.FlowChart_Detail on qAMaster.FlowChart_Detail_UID equals
                                flowChartDetail.FlowChart_Detail_UID
                                where
                                qAMaster.FlowChart_Detail_UID == searchModel.Flowchart_Detail_UID && qAMaster.Product_Date == searchModel.ProductDate &&
                                qAMaster.MaterielType == searchModel.MaterialType && qAMaster.Time_Interval == searchModel.Time_interval && qAMaster.Color == searchModel.Color
                                select new QualityAssurance_InputMasterDTO
                    {
                        NG_Qty                           = qAMaster.NG_Qty,
                        Input                            = qAMaster.Input,
                        Color                            = qAMaster.Color,
                        FirstCheck_Qty                   = qAMaster.FirstCheck_Qty,
                        FirstOK_Qty                      = qAMaster.FirstOK_Qty,
                        FirstRejectionRate               = qAMaster.FirstRejectionRate,
                        FlowChart_Detail_UID             = qAMaster.FlowChart_Detail_UID,
                        MaterielType                     = qAMaster.MaterielType,
                        Process                          = qAMaster.Process,
                        Product_Date                     = qAMaster.Product_Date,
                        Shipment_Qty                     = qAMaster.Shipment_Qty,
                        SurfaceSA_Qty                    = qAMaster.SurfaceSA_Qty,
                        SizeSA_Qty                       = qAMaster.SizeSA_Qty,
                        RepairCheck_Qty                  = qAMaster.RepairCheck_Qty,
                        RepairOK_Qty                     = qAMaster.RepairOK_Qty,
                        WIPForCheck_Qty                  = qAMaster.WIPForCheck_Qty,
                        Time_Interval                    = qAMaster.Time_Interval,
                        QualityAssurance_InputMaster_UID = qAMaster.QualityAssurance_InputMaster_UID,
                        NGFlag                           = qAMaster.NGFlag,
                        FirstCheckFlag                   = qAMaster.FirstCheckFlag,
                        Displace_Qty                     = qAMaster.Displace_Qty,
                        DisplaceFlag                     = qAMaster.DisplaceFlag
                    };

                    if (query.Count() != 0)
                    {
                        result = query.ToList()[0];
                    }
                }
            }
            catch (Exception ex)
            {
                log.Error(ex);
            }
            return(result);
        }