예제 #1
0
        private void btnSendQC_Click(object sender, EventArgs e)
        {
            if (DataValidation.IsNumericNumber(txtSampleQty.Text))
            {
                try
                {
                    objBatch.BatchStatus = Batch.Status.QC;

                    QCReport objQCReport = new QCReport();

                    objQCReport.PackingBatchID  = objBatch.BatchID;
                    objQCReport.SampleSize      = cmbSample.Text;
                    objQCReport.SendBy          = CurrentUser.EmployeeID;
                    objQCReport.Status          = Convert.ToInt32(QCReport.ReportStatus.Initial);
                    objQCReport.SpecificGravity = 1;
                    objQCReport.Remarks         = "No";
                    objQCReport.SpecificGravity = Convert.ToInt32(txtSampleQty.Text);

                    objQCReport_DL.Add_Packing_Secondary(objQCReport);


                    Load_ReportList();
                }
                catch (Exception)
                {
                    MessageBox.Show(this, "Error occured while Saving Report Details", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
            else
            {
                MessageBox.Show(this, "please enter valid sample quantity", "MRP System", MessageBoxButtons.OK);
            }
        }
예제 #2
0
        public long Add(QCReport obj)
        {
            try
            {
                SqlParameter[] paramList = new SqlParameter[] {
                    new SqlParameter("@QCReportID", obj.QCReportID),
                    new SqlParameter("@ReportType", obj.ReportType),
                    new SqlParameter("@RPDBatchID", obj.RPDBatchID),
                    new SqlParameter("@PRPDBatchID", obj.PRPDBatchID),
                    new SqlParameter("@ProductionBatchID", obj.ProductionBatchID),
                    new SqlParameter("@PackingBatchID", obj.PackingBatchID),
                    new SqlParameter("@AnalyzedBy", obj.AnalyzedBy),
                    new SqlParameter("@RDQAOfficer", obj.RDQAOfficer),
                    new SqlParameter("@TestBy", obj.TestBy),
                    new SqlParameter("@SendBy", obj.SendBy),
                    new SqlParameter("@SendDate", obj.SendDate),
                    new SqlParameter("@SampleSize", obj.SampleSize),
                    new SqlParameter("@Remarks", obj.Remarks),
                    new SqlParameter("@SpecificGravity", obj.SpecificGravity),
                    new SqlParameter("@Status", obj.Status),
                    new SqlParameter("@outParam", SqlDbType.Int)
                    {
                        Direction = ParameterDirection.Output
                    }
                };

                return(Execute.RunSP_RowsEffected(Connection, "SPADD_QCReport_Update", paramList));
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message, ex);
            }
        }
예제 #3
0
        private void btnSendReport_Click(object sender, EventArgs e)
        {
            try
            {
                QCReport obj = new QCReport();
                obj.SendBy      = CurrentUser.UserEmp.EmployeeID;
                obj.PRPDBatchID = objPRPDBatch.PRPDBatchID;
                obj.ReportType  = "PRPD";
                obj.SampleSize  = txtReportSampleSize.Text;
                obj.Status      = Convert.ToInt32(QCReport.ReportStatus.Initial);
                obj.Remarks     = "N/A";

                if ((objPRPDBatchActivity_DL.ActivityCount(objPRPDBatch.PRPDBatchID, PRPDBatchActivity.ActStatus.Initial) > 0) || (objPRPDBatchActivity_DL.ActivityCount(objPRPDBatch.PRPDBatchID, PRPDBatchActivity.ActStatus.Started)) > 0)
                {
                    MessageBox.Show(this, "You should finish all activities before send to the Test", "Information", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
                else
                {
                    long ID = objQCReport_DL.Add_PRPD(obj);
                    if (ID > 0)
                    {
                        Load_Reports();

                        txtReportSampleSize.Text = "0.00";
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message.ToString());
            }
        }
예제 #4
0
        private void frmPRPDQCReport_Load(object sender, EventArgs e)
        {
            try
            {
                txtPRPDBatchID.Text     = objPRPDBatch.PRPDBatchID;
                txtMaterial.Text        = objPRPDBatch.PRPDBatchMaterial.MaterialNameCode;
                txtQuantity.Text        = objPRPDBatch.PRPDBatchFinalQty.ToString();
                txtInstructedBy.Text    = objPRPDBatch.PRPDBatchInstructedBy.EmployeeNameID;
                txtHandOverBy.Text      = objPRPDBatch.PRPDBatchHandOverBy.EmployeeNameID;
                txtApprovedBy.Text      = objPRPDBatch.PRPDBatchApprovedBy.EmployeeNameID;
                txtInspectedBy.Text     = objPRPDBatch.PRPDBatchInspectedBy.EmployeeNameID;
                txtComment.Text         = objPRPDBatch.PRPDBatchComments;
                txtTotalImpurities.Text = objPRPDBatch.PRPDBatchTotalImpurities.ToString();
                txtSupervisedBy.Text    = objPRPDBatch.PRPDBatchSuperviser.EmployeeNameID;

                QCReport objQCReport = objQCReportDL.Get_PRPD_Quality_Passed(objPRPDBatch.PRPDBatchID);
                if (objQCReport != null)
                {
                    txtReportID.Text   = objQCReport.QCReportID.ToString();
                    txtAnalyzedBy.Text = objQCReport.AnalyzedBy;
                    txtRDQAOffice.Text = objQCReport.RDQAOfficer;
                    txtSendBy.Text     = objQCReport.SendBy;
                    txtTestBy.Text     = objQCReport.TestBy;
                    txtSampleSize.Text = objQCReport.SampleSize;
                    txtRemarks.Text    = objQCReport.Remarks;

                    gvTestParameters.DataSource = objQCReportDetailsDL.GetView(objQCReport.QCReportID);
                }
            }
            catch (Exception)
            {
                MessageBox.Show(this, "Error occured while loading", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
        public ActionResult _QCReportListForTeam(int teamId, DateTime date)
        {
            var sessionQCReports = new List <SessionQCReportView>();
            var qcReports        = db.QCReports.Where(qcr => qcr.TeamId == teamId && qcr.Date == date).ToList();
            var qcTeams          = db.QCTeams.Where(qct => qct.TeamId == teamId && qct.From <= date && (qct.To == null || qct.To.Value >= date)).ToList();

            var goal         = db.Goals.FirstOrDefault(g => g.TeamId == teamId && g.GoalDate == date);
            var sessionHours = db.GoalDetails.Where(gd => gd.GoalId == goal.Id).GroupBy(gd => gd.SessionOrder);

            //kiem tra, them qc chua dc tao
            foreach (var sessionHour in sessionHours)
            {
                var sessionOrder    = sessionHour.Key;
                var sessionQCReport = new SessionQCReportView()
                {
                    SessionOrder     = sessionOrder,
                    ProductQCReports = new List <ProductQCReportView>()
                };
                var products = sessionHour.SelectMany(h => h.ProductDetails).Select(p => p.ProductId).Distinct();
                foreach (var productId in products)
                {
                    var productQCReport = new ProductQCReportView
                    {
                        ProductId = productId,
                        QCReports = new List <QCReport>()
                    };
                    foreach (var qcTeam in qcTeams)
                    {
                        var qcReport = qcReports.FirstOrDefault(qcr => qcr.SessionOrder == sessionOrder && qcr.ProductId == productId && qcr.QCId == qcTeam.QCId);
                        if (qcReport == null)
                        {
                            qcReport = new QCReport
                            {
                                QCId         = qcTeam.QCId,
                                QC           = qcTeam.QC,
                                TeamId       = qcTeam.TeamId,
                                Date         = date,
                                SessionOrder = sessionOrder,
                                ProductId    = productId,
                                IsEmpty      = true
                            };
                        }
                        productQCReport.QCReports.Add(qcReport);
                    }
                    sessionQCReport.ProductQCReports.Add(productQCReport);
                }

                sessionQCReports.Add(sessionQCReport);
            }

            //ViewBag.teamId = teamId;
            var model = new TeamQCReportView
            {
                TeamId           = teamId,
                TeamName         = db.Teams.Find(teamId).Name,
                SessionQCReports = sessionQCReports
            };

            return(PartialView(model));
        }
예제 #6
0
 private void FromQCReport(QCReport report)
 {
     Type               = report.GetType().Name.SplitByCapitals();
     Created            = report.Created;
     RegistrationNumber = report.VehicleRegistrationNumber;
     TechnicianName     = report.TechnicianName;
 }
예제 #7
0
 public static void Upload(QCReport report, bool isUpdating = false)
 {
     CallAsync(() =>
     {
         _connectClient.Service.UploadQCReport(CheckReportSerializedData(report));
         SaveReportUpload(report);
     });
 }
예제 #8
0
        public QCReport Get_ReworkQCReport(String BatchID, int Status)
        {
            SqlParameter[] paramList = new SqlParameter[] {
                new SqlParameter("@BatchID", BatchID),
                new SqlParameter("@Status", Status)
            };

            try
            {
                DataTable dt = Execute.RunSP_DataTable(Connection, "SPGET_QCReport_By_PackingID_Status", paramList);

                QCReport obj = new QCReport();

                if (dt.Rows.Count > 0)
                {
                    if (dt.Rows[0]["AnalyzedBy"] != null)
                    {
                        obj.AnalyzedBy = Convert.ToString(dt.Rows[0]["AnalyzedBy"]);
                    }

                    if (dt.Rows[0]["FinishDate"] != DBNull.Value)
                    {
                        obj.FinishDate = Convert.ToDateTime(dt.Rows[0]["FinishDate"]);
                    }

                    if (dt.Rows[0]["RDQAOfficer"] != null)
                    {
                        obj.RDQAOfficer = Convert.ToString(dt.Rows[0]["RDQAOfficer"]);
                    }

                    obj.PackingBatchID = Convert.ToString(dt.Rows[0]["PackingBatchID"]);

                    obj.QCReportID = Convert.ToInt64(dt.Rows[0]["QCReportID"]);
                    if (dt.Rows[0]["Remarks"] != null)
                    {
                        obj.Remarks = Convert.ToString(dt.Rows[0]["Remarks"]);
                    }
                    obj.ReportType      = Convert.ToString(dt.Rows[0]["ReportType"]);
                    obj.SampleSize      = "0";
                    obj.SendBy          = Convert.ToString(dt.Rows[0]["SendBy"]);
                    obj.SendDate        = Convert.ToDateTime(dt.Rows[0]["SendDate"]);
                    obj.SpecificGravity = Convert.ToDecimal(dt.Rows[0]["SpecificGravity"]);
                    obj.Status          = Convert.ToInt32(dt.Rows[0]["Status"]);

                    if (dt.Rows[0]["Remarks"] != null)
                    {
                        obj.TestBy = Convert.ToString(dt.Rows[0]["TestBy"]);
                    }
                }

                return(obj);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message, ex);
            }
        }
예제 #9
0
        private void gvReports_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex >= 0)
            {
                try
                {
                    objQCReport = objQCReport_DL.Get(Convert.ToInt64(gvReports.Rows[e.RowIndex].Cells["colID"].Value));
                    if (objQCReport != null)
                    {
                        Clear();
                        if (objQCReport.ReportType.Equals("RPD"))
                        {
                            txtBatch.Text = objQCReport.RPDBatchID;
                        }
                        else if (objQCReport.ReportType.Equals("PRPD"))
                        {
                            txtBatch.Text = objQCReport.RPDBatchID;
                        }
                        txtReportID.Text   = objQCReport.QCReportID.ToString();
                        txtReportType.Text = objQCReport.ReportType;
                        txtSampleSize.Text = objQCReport.SampleSize;
                        txtSendBy.Text     = objEmployee_DL.Get(objQCReport.SendBy).EmployeeNameID;
                        txtSendDate.Text   = objQCReport.SendDate.Value.ToShortDateString();
                        if (objQCReport.RDQAOfficer != null)
                        {
                            txtRDQAOfficer.Text = objEmployee_DL.Get(objQCReport.RDQAOfficer).EmployeeNameID;
                        }

                        if (objQCReport.AnalyzedBy != null)
                        {
                            txtAnalizedBy.Text = objEmployee_DL.Get(objQCReport.AnalyzedBy).EmployeeNameID;
                        }

                        if (objQCReport.TestBy != null)
                        {
                            txtTestBy.Text = objEmployee_DL.Get(objQCReport.TestBy).EmployeeNameID;
                        }
                        txtRemarks.Text = objQCReport.Remarks;

                        if (rbInitial.Checked == true)
                        {
                            btnMore.Enabled = true;
                        }
                        else
                        {
                            btnMore.Enabled = false;
                        }
                    }
                }
                catch (Exception)
                {
                    MessageBox.Show(this, "Error occured while loading", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
        }
예제 #10
0
        private void dgvBatchList_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                if (dgvBatchList.Rows.Count > 0)
                {
                    objBatch      = objBatch_DL.Get(dgvBatchList.CurrentRow.Cells["BatchID"].Value.ToString());
                    txtBatch.Text = objBatch.BatchID;

                    objQCReport = objQCReport_DL.Get_ProductionQCReport(objBatch.BatchID, Convert.ToInt32(QCReport.ReportStatus.Initial));



                    txtReportID.Text = objQCReport.QCReportID.ToString();
                    txtSendBy.Text   = objEmployee_DL.Get(objQCReport.SendBy).EmployeeName;
                    txtSendDate.Text = objQCReport.SendDate.Value.ToShortDateString();
                    txtRemarks.Text  = objQCReport.Remarks;

                    if (objQCReport.RDQAOfficer != null)
                    {
                        cmbRDQAOfficer.SelectedValue = objQCReport.RDQAOfficer;
                    }

                    if (objQCReport.AnalyzedBy != null)
                    {
                        cmbAnalizedBy.SelectedValue = objQCReport.AnalyzedBy;
                    }

                    if (objQCReport.TestBy != null)
                    {
                        cmbTestBy.SelectedValue = objQCReport.TestBy;
                    }

                    Load_ParameterDetails();
                }
                else
                {
                    DataTable dt = null;

                    gvTest.AutoGenerateColumns = false;
                    bindDetails.DataSource     = dt;
                    gvTest.DataSource          = bindDetails;
                    bindDetails.ResetBindings(true);
                }
            }
            catch (Exception)
            {
                MessageBox.Show(this, "Erro occured while selecting Test Details", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
예제 #11
0
        private void btnQCMore_Click(object sender, EventArgs e)
        {
            try
            {
                QCReport objQCReport = new QCReport();
                objQCReport = objQCReport_DL.Get(Convert.ToInt32(dgvReports.CurrentRow.Cells["QCReportID"].Value));

                frmQCDetailView objForm = new frmQCDetailView(CurrentUser, objQCReport);
                objForm.ShowDialog(this);
            }
            catch (Exception)
            {
                MessageBox.Show(this, "Error occured while loading report", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
예제 #12
0
        public QCCheckViewModel(QCReport qcReport)
        {
            if (qcReport == null)
            {
                return;
            }

            CentreName           = qcReport.TachoCentreName;
            Date                 = qcReport.DateOfAudit.Date;
            ThreeChecksCompleted = qcReport.ThreeBasicChecksCompleted;
            ManagerName          = qcReport.QCManagerName;
            Technician           = qcReport.TechnicianName;
            DocumentId           = qcReport.Id;
            DocumentTypeEnum     = DocumentType.QCReport;
        }
        public ActionResult _Edit(int teamId, DateTime date, int order, string productId, int qcId)
        {
            var qcReport = db.QCReports.Find(teamId, date, order, productId, qcId);

            if (qcReport == null)
            {
                qcReport = new QCReport
                {
                    QCId   = qcId,
                    QC     = db.QCs.Find(qcId),
                    Date   = date,
                    TeamId = teamId,
                    Team   = db.Teams.Find(teamId)
                };
            }
            return(PartialView(qcReport));
        }
예제 #14
0
        public QCReportViewModel(QCReport report) : this()
        {
            if (report == null)
            {
                return;
            }

            TachoCentreLine1            = report.TachoCentreLine1;
            TachoCentreLine2            = report.TachoCentreLine2;
            TachoCentreLine3            = report.TachoCentreLine3;
            TachoCentreCity             = report.TachoCentreCity;
            TachoCentrePostCode         = report.TachoCentrePostCode;
            TachoManagerName            = report.TachoManagerName;
            QCManagerName               = report.QCManagerName;
            TechnicianName              = report.TechnicianName;
            DateOfAudit                 = report.DateOfAudit;
            TypeOfTachographCheck       = report.TypeOfTachographCheck;
            TachographMake              = report.TachographMake;
            TachographModel             = report.TachographModel;
            TachographSerialNumber      = report.TachographSerialNumber;
            VehicleMake                 = report.VehicleMake;
            VehicleType                 = report.VehicleType;
            VehicleRegistrationNumber   = report.VehicleRegistrationNumber;
            VehicleIdentificationNumber = report.VehicleIdentificationNumber;
            ThreeBasicChecksCompleted   = report.ThreeBasicChecksCompleted;
            WFactor                         = report.WFactor;
            LFactor                         = report.LFactor;
            KFactor                         = report.KFactor;
            FortyKmTest                     = report.FortyKmTest;
            SixtyKmTest                     = report.SixtyKmTest;
            ClockTestCompleted              = report.ClockTestCompleted;
            BenchTestCarriedOutAnalogue     = report.BenchTestCarriedOutAnalogue;
            FunctionalBenchTestDigital      = report.FunctionalBenchTestDigital;
            DistanceCheckCarriedOut         = report.DistanceCheckCarriedOut;
            TestChartsCompleted             = report.TestChartsCompleted;
            SpeedForSpeedCheckCompleted     = report.SpeedForSpeedCheckCompleted;
            SystemSealedInAccordance        = report.SystemSealedInAccordance;
            CalibrationCertificateCompleted = report.CalibrationCertificateCompleted;
            ReferenceCableCheckCompleted    = report.ReferenceCableCheckCompleted;
            TechnicalDataPrintoutsCreated   = report.TechnicalDataPrintoutsCreated;
            EventsFaultsReadCleared         = report.EventsFaultsReadCleared;
            Comments                        = report.Comments;
            Passed = report.Passed;
        }
예제 #15
0
        private void dgvReports_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex >= 0)
            {
                try
                {
                    objQCReport = objQCReport_DL.Get(Convert.ToInt64(dgvReports.Rows[e.RowIndex].Cells["colQCReportID"].Value));
                    if (objQCReport != null)
                    {
                        txtReportID.Text   = objQCReport.QCReportID.ToString();
                        txtReportType.Text = objQCReport.ReportType;
                        txtSampleSize.Text = objQCReport.SampleSize;
                        txtSendBy.Text     = objEmployee_DL.Get(objQCReport.SendBy).EmployeeNameID;
                        txtSendDate.Text   = objQCReport.SendDate.Value.ToShortDateString();
                        if (objQCReport.RDQAOfficer != null)
                        {
                            txtRDQAOfficer.Text = objEmployee_DL.Get(objQCReport.RDQAOfficer).EmployeeNameID;
                        }

                        if (objQCReport.AnalyzedBy != null)
                        {
                            txtAnalizedBy.Text = objEmployee_DL.Get(objQCReport.AnalyzedBy).EmployeeNameID;
                        }

                        if (objQCReport.TestBy != null)
                        {
                            txtTestBy.Text = objEmployee_DL.Get(objQCReport.TestBy).EmployeeNameID;
                        }

                        lblStatus.Text = ((QCReport.ReportStatus)objQCReport.Status).ToString();
                        if (objQCReport != null)
                        {
                            //QC.frmQCDetailView objFrm = new MRP_GUI.QC.frmQCDetailView(CurrentUser, objQCReport);
                            //objFrm.ShowDialog(this);
                        }
                    }
                }
                catch (Exception)
                {
                    MessageBox.Show(this, "Error occured while loading report", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
        }
예제 #16
0
        public long Update_PRPD(QCReport obj, string PRPDBatchID, int PRPDBatchStatus)
        {
            try
            {
                SqlParameter[] paramList = new SqlParameter[] {
                    new SqlParameter("@PRPDBatchID", PRPDBatchID),
                    new SqlParameter("@PRPDBatchStatus", PRPDBatchStatus),
                    new SqlParameter("@AnalyzedBy", obj.AnalyzedBy),
                    new SqlParameter("@RDQAOfficer", obj.RDQAOfficer),
                    new SqlParameter("@TestBy", obj.TestBy),
                    new SqlParameter("@Remarks", obj.Remarks),
                    new SqlParameter("@Status", obj.Status),
                    new SqlParameter("@Original_QCReportID", obj.QCReportID)
                };

                return(Execute.RunSP_RowsEffected(Connection, "SPUPDATE_QCReport_PRPD", paramList));
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message, ex);
            }
        }
예제 #17
0
        private void dgvBatchList_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                objBatch      = objBatch_DL.Get(dgvBatchList.CurrentRow.Cells["BatchID"].Value.ToString());
                txtBatch.Text = objBatch.BatchID;

                objQCReport = objQCReport_DL.Get_PckingQCReport(objBatch.BatchID, Convert.ToInt32(QCReport.ReportStatus.Initial));

                if (objQCReport.QCReportID != 0)
                {
                    txtReportID.Text = objQCReport.QCReportID.ToString();
                    txtSendBy.Text   = objEmployee_DL.Get(objQCReport.SendBy).EmployeeName;
                    txtSendDate.Text = objQCReport.SendDate.Value.ToShortDateString();
                    txtRemarks.Text  = objQCReport.Remarks;

                    if (objQCReport.RDQAOfficer != null)
                    {
                        cmbRDQAOfficer.SelectedValue = objQCReport.RDQAOfficer;
                    }

                    if (objQCReport.AnalyzedBy != null)
                    {
                        cmbAnalizedBy.SelectedValue = objQCReport.AnalyzedBy;
                    }

                    if (objQCReport.TestBy != null)
                    {
                        cmbTestBy.SelectedValue = objQCReport.TestBy;
                    }

                    Load_ParameterDetails();
                }
            }
            catch (Exception)
            {
                MessageBox.Show(this, "Erro occured while selecting Test Details", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
예제 #18
0
        private void dgvReports_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            if (dgvReports.CurrentRow != null)
            {
                try
                {
                    objQCReport = objQCReport_DL.Get(Convert.ToInt64(dgvReports.CurrentRow.Cells["QCReportID"].Value));
                    if (objQCReport != null)
                    {
                        txtReportID.Text   = objQCReport.QCReportID.ToString();
                        txtReportType.Text = objQCReport.ReportType;
                        //txtSampleSize.Text = objQCReport.SampleSize;
                        txtSendBy.Text   = objEmployee_DL.Get(objQCReport.SendBy).EmployeeNameID;
                        txtSendDate.Text = objQCReport.SendDate.Value.ToShortDateString();
                        if (objQCReport.RDQAOfficer != null)
                        {
                            txtRDQAOfficer.Text = objEmployee_DL.Get(objQCReport.RDQAOfficer).EmployeeNameID;
                        }

                        if (objQCReport.AnalyzedBy != null)
                        {
                            txtAnalizedBy.Text = objEmployee_DL.Get(objQCReport.AnalyzedBy).EmployeeNameID;
                        }

                        if (objQCReport.TestBy != null)
                        {
                            txtTestBy.Text = objEmployee_DL.Get(objQCReport.TestBy).EmployeeNameID;
                        }

                        lblStatus.Text = ((QCReport.ReportStatus)objQCReport.Status).ToString();
                    }
                }
                catch (Exception)
                {
                    MessageBox.Show(this, "Error occured while loading report", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
        }
예제 #19
0
        private void btnSendQC_Click(object sender, EventArgs e)
        {
            if (DataValidation.IsNumericNumber(txtSampleQty.Text))
            {
                try
                {
                    QCReport objQCReport = new QCReport();

                    objQCReport.PackingBatchID  = objBatch.BatchID;
                    objQCReport.SampleSize      = cmbSample.Text;
                    objQCReport.SendBy          = CurrentUser.EmployeeID;
                    objQCReport.Status          = Convert.ToInt32(QCReport.ReportStatus.Initial);
                    objQCReport.SpecificGravity = 1;
                    objQCReport.Remarks         = "No";
                    objQCReport.SpecificGravity = Convert.ToInt32(txtSampleQty.Text);

                    long x = objQCReport_DL.Add_Packing_Rework(objQCReport);

                    if (x > 0)
                    {
                        MessageBox.Show(this, "Successfully Send QC", "Successful", MessageBoxButtons.OK);

                        objBatch_DL.Update_QCStatus_ForReworkBatches(dgvBatcList.CurrentRow.Cells["BatchNo"].Value.ToString(), CurrentUser.EmployeeID, Batch.Status.QC);
                    }


                    Load_ReportList();
                }
                catch (Exception)
                {
                    MessageBox.Show(this, "Error occured while Saving Report Details", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
            else
            {
                MessageBox.Show(this, "please enter valid sample quantity", "MRP System", MessageBoxButtons.OK);
            }
        }
예제 #20
0
        private void gvReports_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                if (e.RowIndex >= 0)
                {
                    objQCReport = objQCReport_DL.Get(Convert.ToInt64(gvReports.Rows[e.RowIndex].Cells["colQCReportID"].Value));
                    if (objQCReport != null)
                    {
                        txtReportID.Text   = objQCReport.QCReportID.ToString();
                        txtReportType.Text = objQCReport.ReportType;
                        txtSampleSize.Text = objQCReport.SampleSize;
                        txtSendBy.Text     = objEmployeeDL.Get(objQCReport.SendBy).EmployeeNameID;
                        txtSendDate.Text   = objQCReport.SendDate.Value.ToShortDateString();
                        txtQcStatus.Text   = Enum.Parse(typeof(QCReport.ReportStatus), objQCReport.Status.ToString()).ToString();
                        if (objQCReport.RDQAOfficer != null)
                        {
                            txtRDQAOfficer.Text = objEmployeeDL.Get(objQCReport.RDQAOfficer).EmployeeNameID;
                        }

                        if (objQCReport.AnalyzedBy != null)
                        {
                            txtAnalizedBy.Text = objEmployeeDL.Get(objQCReport.AnalyzedBy).EmployeeNameID;
                        }

                        if (objQCReport.TestBy != null)
                        {
                            txtTestBy.Text = objEmployeeDL.Get(objQCReport.TestBy).EmployeeNameID;
                        }
                    }
                }
            }
            catch (Exception)
            {
                MessageBox.Show(this, "Error occured while loading report", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
예제 #21
0
        public long Add_Packing(QCReport obj)
        {
            try
            {
                SqlParameter[] paramList = new SqlParameter[] {
                    new SqlParameter("@PackingBatchID", obj.PackingBatchID),
                    new SqlParameter("@SendBy", obj.SendBy),
                    new SqlParameter("@SampleSize", obj.SampleSize),
                    new SqlParameter("@Remarks", obj.Remarks),
                    new SqlParameter("@SpecificGravity", obj.SpecificGravity),
                    new SqlParameter("@Status", obj.Status),
                    new SqlParameter("@outParam", SqlDbType.Int)
                    {
                        Direction = ParameterDirection.Output
                    }
                };

                return(Execute.RunSP_RowsEffected(Connection, "SPADD_QCReport_Packing", paramList));
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message, ex);
            }
        }
예제 #22
0
        private void dgvPRPDbatchByState_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                if (e.RowIndex >= 0)
                {
                    objSourceInstructions.DataSource = null;
                    txtPRPDBatch.Text = dgvPRPDbatchByState.CurrentRow.Cells["PRPDBatchID"].Value.ToString();
                    objPRPDBatch      = objPRPDBatch_DL.Get(txtPRPDBatch.Text);

                    dtPRPDBatchInstructions = objPRPDBatchActivityInstructions_DL.GetDataByBatchID(txtPRPDBatch.Text);

                    dgvActivityInstructions.AutoGenerateColumns = false;
                    dgvActivityInstructions.DataSource          = objSourceInstructions;
                    objSourceInstructions.DataSource            = dtPRPDBatchInstructions;
                    objSourceInstructions.ResetBindings(true);

                    MR_DL objMRDL = new MR_DL(ConnectionStringClass.GetConnection());

                    if (objPRPDBatch.Status == PRPDBatch.PRPDBatchStatus.Approved)
                    {
                        if (objMRDL.Get(objPRPDBatch.MRIN).MRStatus == MR.Status.Reject)
                        {
                            btnSendMR.Enabled      = true;
                            btnSendMR.Visible      = true;
                            btnBatchDelete.Enabled = true;
                            btnApprove.Enabled     = false;
                        }
                        else
                        {
                            btnSendMR.Enabled      = false;
                            btnBatchDelete.Enabled = false;
                            btnApprove.Enabled     = false;
                        }
                    }
                    else if (objPRPDBatch.Status == PRPDBatch.PRPDBatchStatus.Created)
                    {
                        btnSendMR.Enabled      = false;
                        btnSendMR.Visible      = false;
                        btnBatchDelete.Enabled = true;
                        btnApprove.Enabled     = true;
                    }
                    else
                    {
                        btnSendMR.Enabled      = false;
                        btnSendMR.Visible      = false;
                        btnBatchDelete.Enabled = false;
                        btnApprove.Enabled     = false;
                    }

                    if (objPRPDBatch.Status == PRPDBatch.PRPDBatchStatus.Started)
                    {
                        if (dgvPRPDbatchByState.CurrentRow.Cells["PRPDBatchID"].Value != null)
                        {
                            objQCReport = objQCReport_DL.Get_PRPD_Quality_Passed(dgvPRPDbatchByState.CurrentRow.Cells["PRPDBatchID"].Value.ToString());
                            if (objQCReport == null)
                            {
                                btnEditMode.Enabled = true;
                            }
                            else
                            {
                                btnEditMode.Enabled = false;
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message.ToString());
            }
        }
 public void UploadQCReport(QCReport report)
 {
     UploadReport(report);
 }
 public void AutoUploadQCReport(QCReport report)
 {
     AutoUploadReport(report);
 }
        public ActionResult _Edit(QCReport qcReport)
        {
            if (qcReport.Errors != null)
            {
                foreach (var error in qcReport.Errors.ToList())
                {
                    if (!Utilities.IsNullOrDefault(error) && !error.IsDeleted)
                    {
                        db.Entry(error).State = error.Id == 0 ? EntityState.Added : EntityState.Modified;
                    }
                    else
                    {
                        qcReport.Errors.Remove(error);
                        if (error.Id != 0)
                        {
                            db.Entry(error).State = EntityState.Deleted;
                        }
                    }
                }
            }

            if (qcReport.Specifications != null)
            {
                foreach (var spec in qcReport.Specifications.ToList())
                {
                    //Xử lý SpecDetails
                    if (spec.QCSpecDetails != null)
                    {
                        foreach (var specDetail in spec.QCSpecDetails.ToList())
                        {
                            specDetail.QCSpecificationId = spec.Id;
                            if (!Utilities.IsNullOrDefault(specDetail) && !specDetail.IsDeleted)
                            {
                                db.Entry(specDetail).State = specDetail.Id == 0 ? EntityState.Added : EntityState.Modified;
                            }
                            else
                            {
                                spec.QCSpecDetails.Remove(specDetail);
                                if (specDetail.Id != 0)
                                {
                                    db.Entry(specDetail).State = EntityState.Deleted;
                                }
                            }
                        }
                    }

                    if (!spec.IsDeleted)
                    {
                        db.Entry(spec).State = spec.Id == 0 ? EntityState.Added : EntityState.Modified;
                    }
                    else
                    {
                        qcReport.Specifications.Remove(spec);
                        if (spec.Id != 0)
                        {
                            db.Entry(spec).State = EntityState.Deleted;
                        }
                    }
                }
            }

            if (db.QCReports.Any(qcr => qcr.TeamId == qcReport.TeamId && qcr.Date == qcReport.Date && qcr.QCId == qcReport.QCId))
            {
                db.Entry(qcReport).State = EntityState.Modified;
            }
            else
            {
                db.Entry(qcReport).State = EntityState.Added;
            }

            db.SaveChanges();
            return(Json(new { success = true, teamId = qcReport.TeamId, date = qcReport.Date.ToString("dd/MM/yyyy") }));
        }
예제 #26
0
 public frmQCDetailView(User objUser, QCReport QCReport)
 {
     CurrentUser = objUser;
     objQCReport = QCReport;
     InitializeComponent();
 }
예제 #27
0
        //public DataTable GetView(String PRPD)
        //{
        //    try
        //    {
        //        return da.GetDataByPRPDBatchID(PRPD);
        //    }
        //    catch (SqlException sqlex)
        //    {
        //        throw sqlex;
        //    }
        //    catch (Exception ex)
        //    {

        //        throw ex;
        //    }
        //}

        //public DataTable GetView(String PRPD,bool Status)
        //{
        //    try
        //    {
        //        return da.GetDataByPRPDBatchStatus(PRPD,Status);
        //    }
        //    catch (SqlException sqlex)
        //    {
        //        throw sqlex;
        //    }
        //    catch (Exception ex)
        //    {

        //        throw ex;
        //    }
        //}


        public QCReport Get_PRPD_Quality_Passed(String PRPDBatchID)
        {
            SqlParameter[] paramList = new SqlParameter[] {
                new SqlParameter("@PRPDBatchID", PRPDBatchID),
                new SqlParameter("@Status", true)
            };

            QCReport obj = new QCReport();

            try
            {
                DataTable dt = Execute.RunSP_DataTable(Connection, "SPGET_QCReport_PRPDBatch_Status", paramList);

                if (dt.Rows.Count > 0)
                {
                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        if (dt.Rows[0]["AnalyzedBy"] != null)
                        {
                            obj.AnalyzedBy = Convert.ToString(dt.Rows[0]["AnalyzedBy"]);
                        }

                        if (dt.Rows[0]["FinishDate"] != DBNull.Value)
                        {
                            obj.FinishDate = Convert.ToDateTime(dt.Rows[0]["FinishDate"]);
                        }

                        if (dt.Rows[0]["RDQAOfficer"] != null)
                        {
                            obj.RDQAOfficer = Convert.ToString(dt.Rows[0]["RDQAOfficer"]);
                        }

                        obj.PackingBatchID = Convert.ToString(dt.Rows[0]["PackingBatchID"]);

                        obj.QCReportID = Convert.ToInt64(dt.Rows[0]["QCReportID"]);
                        if (dt.Rows[0]["Remarks"] != null)
                        {
                            obj.Remarks = Convert.ToString(dt.Rows[0]["Remarks"]);
                        }
                        obj.ReportType      = Convert.ToString(dt.Rows[0]["ReportType"]);
                        obj.SampleSize      = "0";
                        obj.SendBy          = Convert.ToString(dt.Rows[0]["SendBy"]);
                        obj.SendDate        = Convert.ToDateTime(dt.Rows[0]["SendDate"]);
                        obj.SpecificGravity = Convert.ToDecimal(dt.Rows[0]["SpecificGravity"]);
                        obj.Status          = Convert.ToInt32(dt.Rows[0]["Status"]);

                        if (dt.Rows[0]["Remarks"] != null)
                        {
                            obj.TestBy = Convert.ToString(dt.Rows[0]["TestBy"]);
                        }
                    }
                    return(obj);
                }
                return(null);
            }
            catch (SqlException sqlex)
            {
                throw sqlex;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
예제 #28
0
 public frmQC(User objuser, QCReport QCReport)
 {
     objQCReport = QCReport;
     CurrentUser = objuser;
     InitializeComponent();
 }