private void SetupPage()
 {
     pnlReceiptEdit.Visible = true;
     tbReceiptDate.Text     = WebSiteCommon.FormatDateString(WebSiteCommon.LocalTime(DateTime.UtcNow, SessionManager.UserContext.TimeZoneID), false);
 }
Example #2
0
        public PROB_DEFINE UpdateProblemDefinition(PROB_DEFINE prDefine)
        {
            foreach (INCIDENT incident in this.IncidentList)
            {
                if (this.ProbCase.PROBCASE_TYPE == "QI")
                {
                    QualityIssue qualityIssue = new QualityIssue().Load(incident.INCIDENT_ID);
                    string       str          = "";

                    // who reported the problem
                    str = incident.CREATE_BY;
                    if (incident.CREATE_PERSON != null && incident.CREATE_PERSON > 0)
                    {
                        PERSON  person  = SQMModelMgr.LookupPerson((decimal)incident.CREATE_PERSON, "");
                        COMPANY company = SQMModelMgr.LookupCompany(person.COMPANY_ID);
                        str += " (" + company.COMPANY_NAME + ")";
                    }
                    if (string.IsNullOrEmpty(prDefine.WHO_IS) || !prDefine.WHO_IS.Contains(str))
                    {
                        if (!string.IsNullOrEmpty(prDefine.WHO_IS))
                        {
                            prDefine.WHO_IS += ", ";
                        }
                        prDefine.WHO_IS += str;
                    }

                    // where did the problem occur
                    str = qualityIssue.DetectedLocation.Company.COMPANY_NAME;
                    if (incident.DETECT_BUS_ORG_ID != null && incident.DETECT_BUS_ORG_ID > 0)
                    {
                        str += (" /  " + qualityIssue.DetectedLocation.BusinessOrg.ORG_NAME);
                    }
                    if (incident.DETECT_PLANT_ID != null && incident.DETECT_PLANT_ID > 0)
                    {
                        str += (" / " + qualityIssue.DetectedLocation.Plant.PLANT_NAME);
                    }
                    if (string.IsNullOrEmpty(prDefine.WHERE_IS) || !prDefine.WHERE_IS.Contains(str))
                    {
                        if (!string.IsNullOrEmpty(prDefine.WHERE_IS))
                        {
                            prDefine.WHERE_IS += ", ";
                        }
                        prDefine.WHERE_IS += str;
                    }


                    // where detected
                    str = WebSiteCommon.GetXlatValueLong("issueResponsible", qualityIssue.IssueOccur.SOURCE);
                    if (string.IsNullOrEmpty(prDefine.DETECTED_IS) || !prDefine.DETECTED_IS.Contains(str))
                    {
                        if (!string.IsNullOrEmpty(prDefine.DETECTED_IS))
                        {
                            prDefine.DETECTED_IS += ", ";
                        }
                        prDefine.DETECTED_IS += str;
                    }

                    // who or where is impacted
                    if (!string.IsNullOrEmpty(prDefine.IMPACT_IS))
                    {
                        prDefine.IMPACT_IS += ", ";
                    }

                    prDefine.IMPACT_IS += WebSiteCommon.GetXlatValueLong("issueResponsible", qualityIssue.IssueOccur.SOURCE);

                    // when did the problem occur
                    str = WebSiteCommon.FormatDateString(WebSiteCommon.LocalTime(incident.INCIDENT_DT, SessionManager.UserContext.TimeZoneID), false);
                    if (string.IsNullOrEmpty(prDefine.WHEN_IS) || !prDefine.WHEN_IS.Contains(str))
                    {
                        if (!string.IsNullOrEmpty(prDefine.WHEN_IS))
                        {
                            prDefine.WHEN_IS += ", ";
                        }
                        prDefine.WHEN_IS += str;
                    }

                    // what is the problem
                    if (!string.IsNullOrEmpty(prDefine.WHAT_IS))
                    {
                        prDefine.WHAT_IS += ", ";
                    }
                    prDefine.WHAT_IS += (" " + qualityIssue.Partdata.Part.PART_NUM + "(" + qualityIssue.Partdata.Part.PART_NAME + ")");

                    // how many how often detected
                    double qty = 0;
                    if (!string.IsNullOrEmpty(prDefine.HOW_MANY))
                    {
                        qty = double.Parse(prDefine.HOW_MANY);
                    }
                    foreach (QI_OCCUR_ITEM item in qualityIssue.IssueOccur.QI_OCCUR_ITEM)
                    {
                        qty += Convert.ToDouble(item.INSPECT_NC_QTY);
                        foreach (QI_OCCUR_NC sample in item.QI_OCCUR_NC)
                        {
                            if (!string.IsNullOrEmpty(prDefine.NC_IS))
                            {
                                prDefine.NC_IS += ", ";
                            }
                            NONCONFORMANCE nc = SQMResourcesMgr.LookupNonconf(this.Entities, (decimal)sample.NONCONF_ID, "");
                            if (nc != null)
                            {
                                prDefine.NC_IS += (qualityIssue.IssueOccur.OCCUR_DESC + ": " + nc.NONCONF_DESC);
                            }
                        }
                    }
                    prDefine.HOW_MANY = qty.ToString();

                    str = qualityIssue.IssueOccur.OCCUR_DESC;
                    if (string.IsNullOrEmpty(prDefine.WHY_IS) || !prDefine.WHY_IS.Contains(str))
                    {
                        if (!string.IsNullOrEmpty(prDefine.WHY_IS))
                        {
                            prDefine.WHY_IS += ", ";
                        }
                        prDefine.WHY_IS += str;
                    }

                    prDefine.URGENT_IS = prDefine.MEASURE_IS = prDefine.OFTEN_IS = "TBD";
                }
            }

            return(prDefine);
        }
Example #3
0
        protected void DisplayIssue()
        {
            tbPartNumber.Text = qualityIssue.Part.PART_NUM;
            tbSupplier.Text   = qualityIssue.Supplier.COMPANY_NAME;

            gvQISamples.DataSource = qualityIssue.IssueOccur.QI_OCCUR_ITEM.First().QI_OCCUR_SAMPLE;
            gvQISamples.DataBind();

            if (!qualityIssue.IsNew)
            {
                // PROB_DEFINE probDefine = new PROB_DEFINE();
                // probDefine = qualityIssue.UpdateProblemDefinition(probDefine);

                lblIssueDate_out.Text          = WebSiteCommon.LocalTime((DateTime)qualityIssue.Incident.CREATE_DT, SessionManager.UserContext.TimeZoneID).ToString();
                uclSearchBar.TitleItem.Text    = qualityIssue.IssueID;
                uclSearchBar.TitleItem.Visible = lblIssueDate_out.Visible = true;

                tbDateDetected.Text = WebSiteCommon.FormatDateString(WebSiteCommon.LocalTime(qualityIssue.Incident.INCIDENT_DT, SessionManager.UserContext.TimeZoneID), false);
                tbIssueDesc.Text    = qualityIssue.Incident.DESCRIPTION;

                SetListSelectedTextValue(ddlQualityIssueType, qualityIssue.IssueOccur.PROBLEM_TYPE);
                if (!string.IsNullOrEmpty(qualityIssue.IssueOccur.SOURCE))
                {
                    rblSource.SelectedValue = qualityIssue.IssueOccur.SOURCE;
                }

                BUSINESS_ORG orginBusOrg = SQMModelMgr.LookupBusOrg((decimal)qualityIssue.Incident.BUS_ORG_ID);
                if (orginBusOrg == null)
                {
                    lblOriginator_out.Text = qualityIssue.Incident.CREATE_BY;
                }
                else
                {
                    lblOriginator_out.Text = qualityIssue.Incident.CREATE_BY + "  (" + orginBusOrg.ORG_NAME + ")";
                }

                ddlPlant.SelectedValue     = qualityIssue.Incident.PLANT_ID.ToString();
                ddlPlantLine.SelectedValue = qualityIssue.Incident.PLANT_ID.ToString();
                if (qualityIssue.Incident.PLANT_LINE_ID > -1)
                {
                    ddlPlantLine.SelectedValue = qualityIssue.Incident.PLANT_LINE_ID.ToString();
                }

                if (qualityIssue.IssueOccur.CUSTOMER_ID > 0)
                {
                    ddlCustomer.SelectedValue = qualityIssue.IssueOccur.CUSTOMER_ID.ToString();
                }
                if (qualityIssue.IssueOccur.CUSTOMER_PLANT_ID > 0)
                {
                    ddlCustomerPlant.SelectedValue = qualityIssue.IssueOccur.CUSTOMER_PLANT_ID.ToString();
                }

                tbNCLotNum.Text        = qualityIssue.IssueOccur.QI_OCCUR_ITEM.First().LOT_NUM;
                tbNCContainer.Text     = qualityIssue.IssueOccur.QI_OCCUR_ITEM.First().CONTAINER_NUM;
                tbNCTotalQty.Text      = qualityIssue.IssueOccur.QI_OCCUR_ITEM.First().TOTAL_QTY.ToString();
                tbNCSampleQty.Text     = qualityIssue.IssueOccur.QI_OCCUR_ITEM.First().INSPECT_QTY.ToString();
                tbNCNonConformQty.Text = qualityIssue.IssueOccur.QI_OCCUR_ITEM.First().INSPECT_NC_QTY.ToString();
                tbTotalEstNCQty.Text   = qualityIssue.IssueOccur.QI_OCCUR_ITEM.First().TOTAL_NC_QTY.ToString();

                int nRow = -1;
                foreach (QI_OCCUR_SAMPLE sample in qualityIssue.IssueOccur.QI_OCCUR_ITEM.First().QI_OCCUR_SAMPLE)
                {
                    GridViewRow  row = gvQISamples.Rows[++nRow];
                    DropDownList ddl = (DropDownList)row.FindControl("ddlPrimaryNC");
                    SetListSelectedTextValue(ddl, qualityIssue.IssueOccur.QI_OCCUR_ITEM.First().QI_OCCUR_SAMPLE.First().PROBLEM_PRIMARY);
                    ddl = (DropDownList)row.FindControl("ddlSecondaryNC");
                    SetListSelectedTextValue(ddl, qualityIssue.IssueOccur.QI_OCCUR_ITEM.First().QI_OCCUR_SAMPLE.First().PROBLEM_SECONDARY);
                    TextBox tb = (TextBox)row.FindControl("tbNCCount");
                    tb.Text = Math.Max(1, Convert.ToDecimal(qualityIssue.IssueOccur.QI_OCCUR_ITEM.First().QI_OCCUR_SAMPLE.First().PROBLEM_COUNT)).ToString();
                }

                tbObservations.Text          = qualityIssue.IssueOccur.QI_OCCUR_ITEM.First().QI_OCCUR_SAMPLE.First().SAMPLE_COMMENTS;
                ddlDisposition.SelectedValue = qualityIssue.IssueOccur.DISPOSITION;
                if (!string.IsNullOrEmpty(qualityIssue.IssueOccur.RESPONSIBLE))
                {
                    rblResponsible.SelectedValue = qualityIssue.IssueOccur.RESPONSIBLE;
                }
                cbActionRequired.Checked = (bool)qualityIssue.IssueOccur.ACTION_REQD;
                tbComments.Text          = qualityIssue.IssueOccur.QI_OCCUR_ITEM.First().ITEM_COMMENTS;

                btnPrintLabel.OnClientClick = "Popup('../Problem/QualityIssue_Label.aspx?issue=" + qualityIssue.IssueOccur.QIO_ID.ToString() + "', 'newPage', 600, 450); return false;";
            }
        }