Пример #1
0
 public frmCPGViewModel(UserInformation userInfo, string partNo, decimal routeNo, decimal seqNo, PCCSModel dtPccsLocal)
 {
     this.selectChangeGrdCommandFeatureDetails        = new DelegateCommand <DataRowView>(this.SelectDataRowFeatureDetails);
     this.mouseDoubleClickGrdMeasuringDetails         = new DelegateCommand <DataRowView>(this.SelectDataRowMouseDoubleClickMeasuringDetails);
     this.mouseDoubleClickGrdSelectedMeasuringDetails = new DelegateCommand <DataRowView>(this.SelectDataRowMouseDoubleClickSelectedMeasuringDetails);
     this._onAvailPreviousCommand  = new DelegateCommand(this.AvailPreviousCommand);
     this._onAvailNextCommand      = new DelegateCommand <DataGrid>(this.AvailNextCommand);
     this._onAvailChkCommand       = new DelegateCommand <DataGrid>(this.AvailChkCommand);
     this._onSplPreviousCommand    = new DelegateCommand <DataGrid>(this.SplPreviousCommand);
     this._onSplNextCommand        = new DelegateCommand <DataGrid>(this.SplNextCommand);
     this._onGrd3PreviousCommand   = new DelegateCommand <DataGrid>(this.Grd3PreviousCommand);
     this._onGrd3NextCommand       = new DelegateCommand <DataGrid>(this.Grd3NextCommand);
     this._onGrd4PreviousCommand   = new DelegateCommand <DataGrid>(this.Grd4PreviousCommand);
     this._onGrd4NextCommand       = new DelegateCommand(this.Grd4NextCommand);
     this._onGrd4FinishCommand     = new DelegateCommand(this.Grd4FinishCommand);
     this._rowEditEndingSplCommand = new DelegateCommand <Object>(this.RowEditEndingSpl);
     this._closeCommand            = new DelegateCommand(this.Close);
     _cpgbll            = new CPGBll(userInfo);
     _cpgModel          = new CPGModel();
     VisibilityPage1    = Visibility.Visible;
     VisibilityPage2    = Visibility.Collapsed;
     VisibilityPage3    = Visibility.Collapsed;
     VisibilityPage4    = Visibility.Collapsed;
     VisibilityPageBtn1 = Visibility.Visible;
     VisibilityPageBtn2 = Visibility.Collapsed;
     VisibilityPageBtn3 = Visibility.Collapsed;
     VisibilityPageBtn4 = Visibility.Collapsed;
     CPGModel.PartNo    = partNo;
     CPGModel.RouteNo   = routeNo;
     CPGModel.SeqNo     = seqNo;
     dtpccsForm         = dtPccsLocal.PCCSDetails;
     pccsMast           = dtPccsLocal;
     _cpgbll.GetCPGAvailable(CPGModel);
 }
Пример #2
0
        //original
        //public bool GetLogDetails(LogModel lm, PCCSModel pm)
        //{
        //    try
        //    {
        //        DataTable dt = new DataTable();
        //        dt = ToDataTable((from n in DB.LOGS
        //                          where n.PART_NO == pm.PartNo
        //                         // orderby (n.ACC_DATE.ToDateTimeValue()) descending //new
        //                          select new { n.PART_NO, ACC_DATE = String.Format("{0:d/M/yyyy HH:mm:ss tt}", n.ACC_DATE), n.IPADDRESS, n.SHEET_ACCESSED, n.UNAME }).ToList());

        //        ////new
        //        //dt = ToDataTable((from n in DB.LOGS
        //        //                  where n.PART_NO == pm.PartNo

        //        //                  select new { n.PART_NO, ACC_DATE = String.Format("{0:d/M/yyyy HH:mm:ss tt}", n.ACC_DATE), n.IPADDRESS, n.SHEET_ACCESSED, n.UNAME }).ToList());


        //        ////end new
        //        if (dt != null && dt.Rows.Count > 0)
        //        {
        //            lm.LogDetails = dt.DefaultView;
        //        }
        //        else
        //        {
        //            lm.LogDetails = null;
        //        }
        //        return true;
        //    }
        //    catch (Exception ex)
        //    {
        //        throw ex.LogException();
        //    }

        //}
        //original


        //new
        public bool GetLogDetails(LogModel lm, PCCSModel pm)
        {
            try
            {
                DataTable     dt    = new DataTable();
                StringBuilder sbsql = new StringBuilder();
                //original
                sbsql.Append("select n.PART_NO as PART_NO, n.ACC_DATE as ACC_DATE, n.IPADDRESS as IPADDRESS, n.SHEET_ACCESSED as SHEET_ACCESSED, n.UNAME as UNAME from LOGS n where n.PART_NO ='" + pm.PartNo + "'order by convert(varchar,n.ACC_DATE,101) desc ");
                //new
                //sbsql.Append("select n.PART_NO as PART_NO,ACC_DATE = String.Format({0:d/M/yyyy HH:mm:ss tt}, n.ACC_DATE) as ACC_DATE, n.IPADDRESS as IPADDRESS, n.SHEET_ACCESSED as SHEET_ACCESSED, n.UNAME as UNAME from LOGS n where n.PART_NO ='" + pm.PartNo + "'order by convert(Datetime,n.ACC_DATE,104) desc ");
                dt = ToDataTable(DB.ExecuteQuery <LogNewModel>(sbsql.ToString()).ToList());
                if (dt != null && dt.Rows.Count > 0)
                {
                    lm.LogDetails = dt.DefaultView;
                }
                else
                {
                    lm.LogDetails = null;
                }
                return(true);
            }
            catch (Exception ex)
            {
                throw ex.LogException();
            }
        }
Пример #3
0
        // Need to Implement in Grid
        public bool GetPccsComboValues(PCCSModel pccsModel)
        {
            try
            {
                DataTable dt = new DataTable();
                dt = ToDataTable((from o in DB.PCCS_FEATURES
                                  select new { o.FEATURE }).ToList());
                pccsModel.FeatureCmb = (dt != null) ? dt.DefaultView : null;

                dt = ToDataTable((from o in DB.PCCS_PROCESS
                                  select new { PROCESS_FEATURE = o.PCCS_PROCESS1 }).ToList());
                pccsModel.Process = (dt != null) ? dt.DefaultView : null;

                dt = ToDataTable((from o in DB.SPECIAL_CHARACTER
                                  select new { o.SPEC_CHAR }).ToList());
                pccsModel.SplChar = (dt != null) ? dt.DefaultView : null;

                dt = ToDataTable((from o in DB.PCCS_CONTROL_METHOD
                                  select new { o.CONTROL_METHOD }).ToList());
                pccsModel.Control = (dt != null) ? dt.DefaultView : null;

                return(true);
            }
            catch (Exception ex)
            {
                ex.LogException();
                return(false);
            }
        }
Пример #4
0
        public bool GetRouteNoDetailsByPartNo(PCCSModel pccsModel, string partNo)
        {
            try
            {
                DataTable dt = new DataTable();
                if (partNo.IsNotNullOrEmpty())
                {
                    pccsModel.RouteNo        = 0;
                    pccsModel.RouteNoDetails = null;

                    dt = ToDataTable((from o in DB.PROCESS_MAIN
                                      where o.PART_NO == partNo && ((Convert.ToBoolean(Convert.ToInt16(o.DELETE_FLAG)) == false) || (o.DELETE_FLAG == null))
                                      select new { o.ROUTE_NO }).ToList());
                }
                if (dt != null)
                {
                    //if (dt.Rows.Count > 0) pccsModel.RouteNo = Convert.ToDecimal(dt.Rows[0]["ROUTE_NO"].ToString());
                    pccsModel.RouteNoDetails = dt.DefaultView;

                    // pccsModel.RouteNoDetails.AddNew();
                }
                else
                {
                    pccsModel.RouteNoDetails = null;
                }


                return(true);
            }
            catch (Exception ex)
            {
                ex.LogException();
                return(false);
            }
        }
Пример #5
0
        public bool GetPartNoDetails(PCCSModel pccsModel)
        {
            try
            {
                DataTable dt = new DataTable();
                // DB.PRD_MAST.Context.Refresh(System.Data.Linq.RefreshMode.OverwriteCurrentValues, DB.PRD_MAST);
                dt = ToDataTable((from o in DB.PRD_MAST
                                  where ((Convert.ToBoolean(Convert.ToInt16(o.DELETE_FLAG)) == false) || (o.DELETE_FLAG == null))
                                  select new { o.PART_NO, o.PART_DESC }).ToList());
                if (dt != null)
                {
                    pccsModel.PartNoDetails = dt.DefaultView;
                    //  pccsModel.PartNoDetails.AddNew();
                }
                else
                {
                    pccsModel.PartNoDetails = null;
                }

                return(true);
            }
            catch (Exception ex)
            {
                ex.LogException();
                return(false);
            }
        }
Пример #6
0
        public bool GetCurrentProcessByPartNo(PCCSModel pccsModel)
        {
            try
            {
                if (pccsModel.PartNo.IsNotNullOrEmpty())
                {
                    PROCESS_MAIN processMain = (from c in DB.PROCESS_MAIN
                                                where c.PART_NO == pccsModel.PartNo && c.CURRENT_PROC == 1
                                                select c).FirstOrDefault <PROCESS_MAIN>();

                    if (processMain != null)
                    {
                        pccsModel.RouteNo = processMain.ROUTE_NO;
                    }
                    else if (processMain == null)
                    {
                        return(false);
                    }
                }
                return(true);
            }
            catch (System.Data.Linq.ChangeConflictException)
            {
                DB.ChangeConflicts.ResolveAll(System.Data.Linq.RefreshMode.KeepChanges);
            }
            catch (Exception ex)
            {
                ex.LogException();
                return(false);
            }
            return(true);
        }
Пример #7
0
        public SapViewModel(UserInformation userInfo, string strType)
        {
            _userInformation = new UserInformation();
            _userInformation = userInfo;
            SapModel         = new SapModel();
            _pccsModel       = new PCCSModel();
            _sapBll          = new SapBll(_userInformation);
            this.selectChangeComboCommandPartNo = new DelegateCommand(this.SelectDataRowPart);
            this.selectChangeComboCommandRoh    = new DelegateCommand(this.SelectDataRowRoh);

            _bomEditCommand       = new DelegateCommand <DataRowView>(this.BomEdit);
            this._enterPartNumber = new DelegateCommand <string>(this.EnterPartNumber);
            _onRefreshCommand     = new DelegateCommand(this.Refresh);
            _onExportCommand      = new DelegateCommand(this.Export);
            _onCloseCommand       = new DelegateCommand(this.Close);
            _onSaveCommand        = new DelegateCommand(this.Save);
            _sapBll.GetPartNoDetails(SapModel);
            _sapBll.GetRohNoDetails(SapModel);
            SetdropDownItems();
            sapType = strType.ToUpper();
            switch (sapType)
            {
            case "FERT":
            {
                GrpMFertVisibility = Visibility.Visible;
                GrpKFertVisibility = Visibility.Collapsed;
                GrpYFertVisibility = Visibility.Collapsed;
            }
            break;
            }
        }
Пример #8
0
 public LogViewModel(UserInformation userInformation)
 {
     _pccsBll  = new PCCSBll(userInformation);
     _logBll   = new LogViewBll(userInformation);
     PccsModel = new PCCSModel();
     logmodel  = new LogModel();
     this.selectChangeComboCommandPartNo = new DelegateCommand(this.SelectDataRowPart);
     LoadCmbDatas();
     SetdropDownItems();
 }
Пример #9
0
 public QcpViewModel(UserInformation userInformation)
 {
     QCPMODEL  = new QcpModel();
     _pccsBll  = new PCCSBll(userInformation);
     qcpBll    = new QcpBll(userInformation);
     PccsModel = new PCCSModel();
     this.selectChangeComboCommandPartNo = new DelegateCommand(this.SelectDataRowPart);
     this.qcpReportClickCommand          = new DelegateCommand(this.qcpReport);
     LoadCmbDatas();
     SetdropDownItems();
     //QCPMODEL.PartNo = qcpBll.GetPartNo(QCPMODEL).ToString();
 }
Пример #10
0
        public DataTable GetQCP(PCCSModel pccs, QcpModel qcp)
        {
            try
            {
                DataTable dt = new DataTable();
                dt = ToDataTable((from r in DB.PRD_CIREF
                                  join p in DB.PRD_MAST on r.PART_NO equals p.PART_NO
                                  into a from b in a.DefaultIfEmpty()
                                  join i in DB.DDCI_INFO on r.CI_REF equals i.CI_REFERENCE
                                  join c in DB.DDCUST_MAST on i.CUST_CODE equals c.CUST_CODE
                                  join e in DB.PROCESS_MAIN on r.PART_NO equals e.PART_NO
                                  join d in DB.CONTROL_PLAN on e.ROUTE_NO equals d.ROUTE_NO
                                  into y from z in y.DefaultIfEmpty()
                                  where z.PART_NO == e.PART_NO && e.CURRENT_PROC == 1 && r.PART_NO == qcp.PartNo.ToUpper() && r.CURRENT_CIREF == true
                                  select new
                {
                    c.CUST_NAME,
                    i.ENQU_RECD_ON,
                    b.PART_DESC,
                    b.BIF_PROJ,
                    r.PART_NO,
                    e.ROUTE_NO,
                    z.CORE_TEAM_MEMBER1,
                    z.CORE_TEAM_MEMBER2,
                    z.CORE_TEAM_MEMBER3,
                    z.CORE_TEAM_MEMBER4,
                    z.CORE_TEAM_MEMBER5,
                    z.CORE_TEAM_MEMBER6,
                    EX_NO = "",
                    REVISION_NO = ""
                }).ToList());

                if (dt != null && dt.Rows.Count > 0)
                {
                    EXHIBIT_DOC exhibit = (from o in DB.EXHIBIT_DOC
                                           where o.DOC_NAME == "PQPSO"
                                           select o).FirstOrDefault <EXHIBIT_DOC>();
                    if (exhibit != null)
                    {
                        dt.Rows[0]["EX_NO"]       = exhibit.EX_NO;
                        dt.Rows[0]["REVISION_NO"] = exhibit.REVISION_NO;
                    }
                }
                return(dt);
            }
            catch (Exception ex)
            {
                throw ex.LogException();
            }
        }
Пример #11
0
        public bool SavePccs(PCCSModel pccsModel, ref string typ)
        {
            try
            {
                DataTable dtPccsDetails        = new DataTable();
                DataTable dtPccsRevisonDetails = new DataTable();
                bool      _status = false;

                if (pccsModel.PartNo.IsNotNullOrEmpty() && pccsModel.SeqNo.IsNotNullOrEmpty() && pccsModel.RouteNo.IsNotNullOrEmpty())
                {
                    if (pccsModel.PCCSDetails.IsNotNullOrEmpty() && pccsModel.PCCSDetails.Count > 0)
                    {
                        //Save PCCS Details
                        DataTable   dt = new DataTable();
                        List <PCCS> lstexistingDatas = new List <PCCS>();
                        dtPccsDetails    = pccsModel.PCCSDetails.Table;
                        lstexistingDatas = ((from c in DB.PCCS
                                             where c.PART_NO == pccsModel.PartNo && c.ROUTE_NO == pccsModel.RouteNo && c.SEQ_NO == Convert.ToDecimal(pccsModel.SeqNo)
                                             select c).ToList());
                        if (lstexistingDatas.Count > 0)
                        {
                            DB.PCCS.DeleteAllOnSubmit(lstexistingDatas);
                            DB.SubmitChanges();
                        }

                        for (int i = 0; i < dtPccsDetails.Rows.Count; i++)
                        {
                            PCCS pccs = null;
                            try
                            {
                                if (dtPccsDetails.Rows[i]["REACTION_PLAN"].ToString() != "" || dtPccsDetails.Rows[i]["CONTROL_METHOD"].ToString() != "" || dtPccsDetails.Rows[i]["FREQ_OF_INSP"].ToString() != "" || dtPccsDetails.Rows[i]["GAUGES_USED"].ToString() != "" || dtPccsDetails.Rows[i]["DEPT_RESP"].ToString() != "" || dtPccsDetails.Rows[i]["SPEC_CHAR"].ToString() != "" || dtPccsDetails.Rows[i]["CTRL_SPEC_MAX"].ToString() != "" || dtPccsDetails.Rows[i]["CTRL_SPEC_MIN"].ToString() != "" || dtPccsDetails.Rows[i]["SPEC_MAX"].ToString() != "" || dtPccsDetails.Rows[i]["SPEC_MIN"].ToString() != "" || dtPccsDetails.Rows[i]["PROCESS_FEATURE"].ToString() != "" || dtPccsDetails.Rows[i]["ISR_NO"].ToValueAsString().ToDecimalValue() != 0 || dtPccsDetails.Rows[i]["FEATURE"].ToString() != "")
                                {
                                    pccs          = new PCCS();
                                    pccs.PART_NO  = pccsModel.PartNo.ToString();
                                    pccs.ROUTE_NO = pccsModel.RouteNo.ToValueAsString().ToDecimalValue();
                                    pccs.SEQ_NO   = pccsModel.SeqNo.IsNumeric() ? Convert.ToDecimal(pccsModel.SeqNo) : 0;
                                    //pccs.SNO = dtPccsDetails.Rows[i]["SNO"].ToString().IsNumeric() ? Convert.ToDouble(dtPccsDetails.Rows[i]["SNO"].ToString()) : 0;
                                    pccs.SNO             = dtPccsDetails.Rows[i]["SNO"].ToValueAsString().ToDoubleValue();
                                    pccs.ISR_NO          = dtPccsDetails.Rows[i]["ISR_NO"].ToValueAsString().ToDecimalValue();
                                    pccs.FEATURE         = dtPccsDetails.Rows[i]["FEATURE"].ToString();
                                    pccs.PROCESS_FEATURE = dtPccsDetails.Rows[i]["PROCESS_FEATURE"].ToString();
                                    pccs.SPEC_MIN        = dtPccsDetails.Rows[i]["SPEC_MIN"].ToString();
                                    pccs.SPEC_MAX        = dtPccsDetails.Rows[i]["SPEC_MAX"].ToString();
                                    pccs.CTRL_SPEC_MIN   = dtPccsDetails.Rows[i]["CTRL_SPEC_MIN"].ToString();
                                    pccs.CTRL_SPEC_MAX   = dtPccsDetails.Rows[i]["CTRL_SPEC_MAX"].ToString();
                                    pccs.SPEC_CHAR       = dtPccsDetails.Rows[i]["SPEC_CHAR"].ToString();
                                    pccs.DEPT_RESP       = dtPccsDetails.Rows[i]["DEPT_RESP"].ToString();
                                    pccs.GAUGES_USED     = dtPccsDetails.Rows[i]["GAUGES_USED"].ToString();
                                    //pccs.SAMPLE_SIZE = dtPccsDetails.Rows[i]["SAMPLE_SIZE"].ToString().IsNumeric() ? Convert.ToDecimal(dtPccsDetails.Rows[i]["SAMPLE_SIZE"].ToString()) : 0;
                                    pccs.SAMPLE_SIZE    = dtPccsDetails.Rows[i]["SAMPLE_SIZE"].ToValueAsString();
                                    pccs.FREQ_OF_INSP   = dtPccsDetails.Rows[i]["FREQ_OF_INSP"].ToString();
                                    pccs.CONTROL_METHOD = dtPccsDetails.Rows[i]["CONTROL_METHOD"].ToString();
                                    pccs.REACTION_PLAN  = dtPccsDetails.Rows[i]["REACTION_PLAN"].ToString();
                                    pccs.DELETE_FLAG    = false;
                                    pccs.ENTERED_DATE   = DateTime.Now;
                                    pccs.ENTERED_BY     = userInformation.UserName;
                                    pccs.ROWID          = Guid.NewGuid();
                                    DB.PCCS.InsertOnSubmit(pccs);
                                    DB.SubmitChanges();
                                    typ = "INS";
                                }
                            }
                            catch (Exception ex)
                            {
                                ex.LogException();
                                DB.PCCS.DeleteOnSubmit(pccs);
                            }
                        }
                        _status = true;

                        //Save PCCS Revison Details
                        // GetPccsRevisonDetails(pccsModel, pccsModel.PartNo, pccsModel.RouteNo);
                        dtPccsRevisonDetails = pccsModel.PccsRevisionDetails.Table;
                        //PART_NO,ROUTE_NO,ISSUE_NO,ISSUE_DATE,ISSUE_ALTER,COMPILED_BY
                        decimal routeNo = pccsModel.RouteNo.ToValueAsString().ToDecimalValue();

                        List <PCCS_ISSUE> lstexistingDatasPccsIssue = new List <PCCS_ISSUE>();
                        dtPccsDetails             = pccsModel.PCCSDetails.Table;
                        lstexistingDatasPccsIssue = ((from c in DB.PCCS_ISSUE
                                                      where c.PART_NO == pccsModel.PartNo &&
                                                      c.ROUTE_NO == pccsModel.RouteNo
                                                      select c).ToList());
                        if (lstexistingDatasPccsIssue.Count > 0)
                        {
                            DB.PCCS_ISSUE.DeleteAllOnSubmit(lstexistingDatasPccsIssue);
                            DB.SubmitChanges();
                        }

                        for (int i = 0; i < dtPccsRevisonDetails.Rows.Count; i++)
                        {
                            if (dtPccsRevisonDetails.Rows[i]["ROUTE_NO"].IsNotNullOrEmpty())
                            {
                                routeNo = dtPccsRevisonDetails.Rows[i]["ROUTE_NO"].ToString().ToDecimalValue();
                            }
                            else
                            {
                                routeNo = pccsModel.RouteNo.ToValueAsString().ToDecimalValue();
                            }

                            //PCCS_ISSUE pccsRevison = (from c in DB.PCCS_ISSUE
                            //                          where c.PART_NO == pccsModel.PartNo && c.ROUTE_NO == routeNo && c.ISSUE_NO == (i + 1).ToString()
                            //                          select c).FirstOrDefault<PCCS_ISSUE>();
                            //if (!pccsRevison.IsNotNullOrEmpty())
                            //{
                            PCCS_ISSUE pccsRevison = null;
                            if (routeNo == pccsModel.RouteNo)
                            {
                                try
                                {
                                    if (dtPccsRevisonDetails.Rows[i]["ISSUE_DATE"].ToString().IsNotNullOrEmpty() || dtPccsRevisonDetails.Rows[i]["ISSUE_ALTER"].ToString().IsNotNullOrEmpty() || dtPccsRevisonDetails.Rows[i]["COMPILED_BY"].ToString().IsNotNullOrEmpty())
                                    {
                                        pccsRevison = new PCCS_ISSUE()
                                        {
                                            PART_NO  = pccsModel.PartNo.ToString(),
                                            ROUTE_NO = pccsModel.RouteNo.ToValueAsString().ToDecimalValue(),
                                            ISSUE_NO = dtPccsRevisonDetails.Rows[i]["ISSUE_NO"].ToString(),
                                            // ISSUE_DATE = dtPccsRevisonDetails.Rows[i]["ISSUE_DATE"].ToString().ToDateTimeValue(),
                                            ISSUE_ALTER  = dtPccsRevisonDetails.Rows[i]["ISSUE_ALTER"].ToString(),
                                            COMPILED_BY  = dtPccsRevisonDetails.Rows[i]["COMPILED_BY"].ToString(),
                                            DELETE_FLAG  = false,
                                            ENTERED_DATE = DateTime.Now,
                                            ENTERED_BY   = userInformation.UserName,
                                            ROWID        = Guid.NewGuid()
                                        };
                                        if (dtPccsRevisonDetails.Rows[i]["ISSUE_DATE"].ToString() != "")
                                        {
                                            pccsRevison.ISSUE_DATE = Convert.ToDateTime(dtPccsRevisonDetails.Rows[i]["ISSUE_DATE"]);
                                        }
                                        else
                                        {
                                            pccsRevison.ISSUE_DATE = null;
                                        }

                                        DB.PCCS_ISSUE.InsertOnSubmit(pccsRevison);
                                        DB.SubmitChanges();
                                        typ = "INS";
                                    }
                                }
                                catch (Exception ex)
                                {
                                    ex.LogException();
                                    DB.PCCS_ISSUE.DeleteOnSubmit(pccsRevison);
                                }
                            }
                        }
                        _status = true;
                    }
                }

                return(_status);
            }
            catch (Exception ex)
            {
                ex.LogException();
                return(false);
            }
        }
Пример #12
0
        public bool GetPccsRevisonDetails(PCCSModel pccsModel, string partNo, decimal?routeNo)
        {
            try
            {
                DataTable dt = new DataTable();
                if (partNo.IsNotNullOrEmpty())
                {
                    dt = ToDataTableWithType((from o in DB.PCCS_ISSUE
                                              where o.PART_NO == partNo && ((Convert.ToBoolean(Convert.ToInt16(o.DELETE_FLAG)) == false) || (o.DELETE_FLAG == null)) &&
                                              o.ROUTE_NO == routeNo
                                              orderby o.ISSUE_NO
                                              select new { o.PART_NO, o.ROUTE_NO, ISSUE_NO = o.ISSUE_NO, o.ISSUE_DATE, o.ISSUE_ALTER, o.COMPILED_BY }).ToList());
                }

                //pccsModel.PccsRevisionDetails = new DataView();
                dt.Columns.Add("ISSUE_NONUMERIC", typeof(System.Int32));
                foreach (DataRow dr in dt.Rows)
                {
                    int output;
                    if (int.TryParse(dr["ISSUE_NO"].ToValueAsString(), out output) == true)
                    {
                        dr["ISSUE_NONUMERIC"] = dr["ISSUE_NO"];
                    }
                    else
                    {
                        dr["ISSUE_NONUMERIC"] = 0;
                    }
                }

                dt.DefaultView.Sort = "ISSUE_NONUMERIC";
                DataTable dtFinal = dt.DefaultView.ToTable();
                pccsModel.PccsRevisionDetails      = (dtFinal != null) ? dtFinal.DefaultView : null;
                pccsModel.PccsRevisionDetails.Sort = "";

                //pccsModel.PccsRevisionDetails = dt.DefaultView;
                DataRowView drv = pccsModel.PccsRevisionDetails.AddNew();
                if (dt != null && partNo != "")
                {
                    if (pccsModel.PccsRevisionDetails.Count > 0)
                    {
                        drv.BeginEdit();
                        // drv["ISSUE_NO"] = pccsModel.PccsRevisionDetails.Count;
                        drv["ISSUE_NONUMERIC"] = pccsModel.PccsRevisionDetails.Count;
                        drv.EndEdit();
                        pccsModel.PccsRevisionDetails.EndInit();
                    }
                }
                else
                {
                    pccsModel.PccsRevisionDetails = null;
                }


                return(true);
            }
            catch (Exception ex)
            {
                ex.LogException();
                return(false);
            }
        }
Пример #13
0
        public bool GetPccsDetails(PCCSModel pccsModel, string partNo, decimal?routeNo = 1, string seqNo = "0")
        {
            try
            {
                DataTable dt = new DataTable();

                if (partNo.IsNotNullOrEmpty() && seqNo.IsNotNullOrEmpty() && seqNo != "0")
                {
                    dt = ToDataTable((from o in DB.PCCS
                                      where o.PART_NO == partNo && o.ROUTE_NO == routeNo && o.SEQ_NO == Convert.ToDecimal(seqNo) && ((Convert.ToBoolean(Convert.ToInt16(o.DELETE_FLAG)) == false) || (o.DELETE_FLAG == null))
                                      orderby o.ROUTE_NO, o.SEQ_NO, o.SNO
                                      select new { o.PART_NO, o.ROUTE_NO, o.SEQ_NO, o.SNO, o.ISR_NO, o.FEATURE, o.PROCESS_FEATURE, o.SPEC_MIN, o.SPEC_MAX, o.CTRL_SPEC_MIN, o.CTRL_SPEC_MAX, o.SPEC_CHAR, o.DEPT_RESP, o.GAUGES_USED, o.SAMPLE_SIZE, o.FREQ_OF_INSP, o.CONTROL_METHOD, o.REACTION_PLAN }).ToList());
                }
                else
                {
                    dt = ToDataTable((from o in DB.PCCS
                                      where o.PART_NO == partNo && o.ROUTE_NO == routeNo && ((Convert.ToBoolean(Convert.ToInt16(o.DELETE_FLAG)) == false) || (o.DELETE_FLAG == null))
                                      orderby o.ROUTE_NO, o.SEQ_NO, o.SNO
                                      select new { o.PART_NO, o.ROUTE_NO, o.SEQ_NO, o.SNO, o.ISR_NO, o.FEATURE, o.PROCESS_FEATURE, o.SPEC_MIN, o.SPEC_MAX, o.CTRL_SPEC_MIN, o.CTRL_SPEC_MAX, o.SPEC_CHAR, o.DEPT_RESP, o.GAUGES_USED, o.SAMPLE_SIZE, o.FREQ_OF_INSP, o.CONTROL_METHOD, o.REACTION_PLAN }).ToList());
                }
                if (dt != null && dt.Rows.Count == 0 && seqNo != "0")
                {
                    pccsModel.PCCSDetails = dt.DefaultView;
                    DataRowView drv = pccsModel.PCCSDetails.AddNew();
                    drv.BeginEdit();
                    drv["SNO"] = pccsModel.PCCSDetails.Count;
                    drv.EndEdit();
                    pccsModel.PCCSDetails.EndInit();
                    pccsModel.EditGenBtn = "Generate F5";
                }
                else if (dt.Rows.Count == 0 && seqNo == "0")
                {
                    pccsModel.PCCSDetails = dt.DefaultView;
                    DataRowView drv = pccsModel.PCCSDetails.AddNew();
                    drv.BeginEdit();
                    drv["SNO"] = 1;
                    drv.EndEdit();
                    pccsModel.PCCSDetails.EndInit();
                    pccsModel.EditGenBtn = "Generate F5";
                }
                else if (dt.Rows.Count != 0 && seqNo == "0")
                {
                    pccsModel.PCCSDetails = dt.DefaultView;
                    DataRowView drv = pccsModel.PCCSDetails.AddNew();
                    drv.BeginEdit();
                    drv["SNO"] = pccsModel.PCCSDetails.Count;
                    drv.EndEdit();
                    pccsModel.PCCSDetails.EndInit();
                    pccsModel.EditGenBtn = "Edit F5";
                }
                else if (dt.Rows.Count > 0 && seqNo != "0")
                {
                    pccsModel.PCCSDetails = dt.DefaultView;
                    DataRowView drv = pccsModel.PCCSDetails.AddNew();
                    drv.BeginEdit();
                    drv["SNO"] = pccsModel.PCCSDetails.Count;
                    drv.EndEdit();
                    pccsModel.PCCSDetails.EndInit();
                    pccsModel.EditGenBtn = "Edit F5";
                }
                else
                {
                    pccsModel.PCCSDetails = null;
                }

                return(true);
            }
            catch (Exception ex)
            {
                ex.LogException();
                return(false);
            }
        }
Пример #14
0
        public bool GetSequenceNoDetailsByPartNoRouteNo(PCCSModel pccsModel, string partNo, decimal routeNo)
        {
            try
            {
                DataTable dt = new DataTable();
                if (partNo.IsNotNullOrEmpty())
                {
                    dt = ToDataTable((from o in DB.PROCESS_SHEET
                                      where o.PART_NO == partNo && o.ROUTE_NO == routeNo && ((Convert.ToBoolean(Convert.ToInt16(o.DELETE_FLAG)) == false) || (o.DELETE_FLAG == null))
                                      select new { o.SEQ_NO, o.OPN_DESC }).ToList());
                }
                if (dt != null)
                {
                    pccsModel.SeqNoDetails = dt.DefaultView;
                    try
                    {
                        if (pccsModel.SeqNoDetails.IsNotNullOrEmpty())
                        {
                            if (pccsModel.SeqNoDetails.Table.Columns.IndexOf("SnoSort") < 0)
                            {
                                pccsModel.SeqNoDetails.Table.Columns.Add("SnoSort", typeof(decimal));
                            }
                            for (int i = 0; i < pccsModel.SeqNoDetails.Count; i++)
                            {
                                pccsModel.SeqNoDetails[i]["SnoSort"] = pccsModel.SeqNoDetails[i]["SEQ_NO"];
                            }
                            pccsModel.SeqNoDetails.Sort = "SnoSort ASC";
                            foreach (DataRowView item in pccsModel.SeqNoDetails)
                            {
                                item["SnoSort"] = item["SEQ_NO"];
                            }
                            pccsModel.SeqNoDetails.Sort = "SnoSort ASC";
                        }
                    }
                    catch (Exception ex)
                    {
                        ex.LogException();
                    }
                    PROCESS_SHEET procesSheet = (from o in DB.PROCESS_SHEET
                                                 where o.PART_NO == partNo && o.ROUTE_NO == routeNo && ((Convert.ToBoolean(Convert.ToInt16(o.DELETE_FLAG)) == false) || (o.DELETE_FLAG == null))
                                                 //where o.PART_NO == partNo && o.ROUTE_NO == routeNo && o.SEQ_NO == 20 && ((Convert.ToBoolean(Convert.ToInt16(o.DELETE_FLAG)) == false) || (o.DELETE_FLAG == null))
                                                 select o).FirstOrDefault <PROCESS_SHEET>();
                    if (procesSheet.IsNotNullOrEmpty())
                    {
                        pccsModel.SeqNo    = procesSheet.SEQ_NO.ToValueAsString();
                        pccsModel.OperDesc = procesSheet.OPN_DESC.ToValueAsString();
                    }
                    else
                    {
                        if (pccsModel.SeqNoDetails.Count > 0)
                        {
                            pccsModel.SeqNo    = pccsModel.SeqNoDetails.Table.Rows[0]["SEQ_NO"].ToString();
                            pccsModel.OperDesc = pccsModel.SeqNoDetails.Table.Rows[0]["OPN_DESC"].ToString();
                        }
                    }
                    //  pccsModel.SeqNoDetails.AddNew();
                }
                else
                {
                    pccsModel.SeqNoDetails = null;
                }


                return(true);
            }
            catch (Exception ex)
            {
                ex.LogException();
                return(false);
            }
        }
        public frmControlPlanGeneration(UserInformation userInformation, string partNo, decimal routeNo, decimal seqNo, PCCSModel dtPccsLocal)
        {
            InitializeComponent();
            frmCPGViewModel fm = new frmCPGViewModel(userInformation, partNo, routeNo, seqNo, dtPccsLocal);

            this.DataContext = fm;
            if (fm.CloseAction == null)
            {
                fm.CloseAction = new Action(() => this.Close());
            }
        }