コード例 #1
0
ファイル: PartBOM.cs プロジェクト: cliamc/CheckROHS
        private void SortMtls()
        {
            EpicorVPartSearch evps  = new EpicorVPartSearch();
            EpicorPartRev     eprev = new EpicorPartRev();

            foreach (string anitem in partBom)
            {
                if (anitem[0] == '%')
                {
                    continue;
                }

                bool rohsTag;
                bool subTag = evps.CheckSubRohs(anitem, out rohsTag);
                if (!subTag)
                {
                    MfgDataSubPart mdsp = new MfgDataSubPart();
                    subTag = mdsp.CheckPartExist(anitem);
                }

                if (subTag)
                {
                    string partNum = anitem;;
                    string pRev    = "";
                    // find the version first
                    if (anitem.IndexOf("=") == -1)
                    {
                        pRev = eprev.GetRevision(anitem);
                    }
                    else
                    {
                        string pn = "";
                        DBHelper.Util.ExtractPartInfo(anitem, ref pn, ref pRev);
                    }

                    PartBOM pb = new PartBOM(partNum, pRev);
                    if (!pb.GetBomRohsFlag())
                    {
                        this.bomRohs = false;
                    }
                    subs.Add(pb);
                }
                else
                {
                    MtlRohs mr = new MtlRohs();
                    mr.PartNum = anitem;
                    if (rohsTag)
                    {
                        mr.Rohs = true;
                    }
                    else
                    {
                        mr.Rohs      = false;
                        this.bomRohs = false;
                    }
                    endMtls.Add(mr);
                }
            } // foreach
        }     // SortMtls()
コード例 #2
0
ファイル: CheckROHS.cs プロジェクト: cliamc/CheckROHS
        private void DisplayBOMtree(PartBOM pb, TreeNode parentNode = null)
        {
            TreeNode treeNodeRt = new TreeNode(pb.PartNum);

            //
            if (pb.bomRohs)
            {
                treeNodeRt.ImageIndex         = 0;
                treeNodeRt.SelectedImageIndex = 0;
            }
            else
            {
                treeNodeRt.ImageIndex         = 1;
                treeNodeRt.SelectedImageIndex = 1;
            }

            if (parentNode == null)
            {
                treeView1.Nodes.Add(treeNodeRt);
            }
            else
            {
                treeView1.SelectedNode = parentNode;
                treeView1.SelectedNode.Nodes.Add(treeNodeRt);
            }

            treeView1.SelectedNode = treeNodeRt;
            foreach (MtlRohs anItem in pb.endMtls)
            {
                TreeNode treeNode = new TreeNode(anItem.PartNum);
                if (anItem.Rohs)
                {
                    treeNode.ImageIndex         = 0;
                    treeNode.SelectedImageIndex = 0;
                }
                else
                {
                    treeNode.ImageIndex         = 1;
                    treeNode.SelectedImageIndex = 1;
                }
                treeView1.SelectedNode.Nodes.Add(treeNode);
            }

            // Display List<PartBOM> subs recursively
            foreach (PartBOM aBom in pb.subs)
            {
                DisplayBOMtree(aBom, treeNodeRt);
            }
        }
コード例 #3
0
ファイル: CheckROHS.cs プロジェクト: cliamc/CheckROHS
        //private void partText_KeyUp(object sender, KeyEventArgs e)
        //{
        //    if ((e.KeyCode == Keys.Enter) || (e.KeyCode == Keys.Tab))
        //    {
        //        chkBtn.Enabled = true;
        //        chkBtn.Select();
        //        resetBtn.Enabled = true;
        //        jobText.Enabled = false;
        //        partText.Enabled = false;
        //        verUD.Enabled = false;
        //    }
        //}

        private void chkBtn_Click(object sender, EventArgs e)
        {
            try
            {
                // Process input
                bool       goodToGo = false;
                MfgDataJob checkJob = new MfgDataJob();

                if (jobText.Text.Length == 5)
                {
                    DataTable dt = checkJob.SelectTbl(jobText.Text.ToString());

                    if (dt.Rows.Count != 0)
                    {
                        DataRow dr = dt.Rows[0];
                        partText.Text = dr["PartNumber"].ToString();
                        //verUD.Value = Convert.ToDecimal(dr["PartVersion"].ToString());
                        verText.Text = dr["PartVersion"].ToString();
                        goodToGo     = true;
                    }
                    else
                    {
                        MessageBox.Show("Cannot find the job " + jobText.Text + " in SQL Job table");
                    }
                }
                //else if (partText.Text.Length > 0)
                //{
                //    string tmp = checkJob.GetJobWithPart(partText.Text, verUD.Value.ToString());

                //    if (!string.IsNullOrEmpty(tmp))
                //    {
                //        jobText.Text = tmp;
                //        goodToGo = true;
                //    }
                //    else
                //    {
                //        MessageBox.Show("Cannot find the job with the Part Number and the Version provided in SQL Job table");
                //    }
                //}

                if (goodToGo)
                {
                    // application logic start here

                    ///PartBOM pb = new PartBOM(partText.Text, verUD.Value.ToString());
                    PartBOM pb       = new PartBOM(partText.Text, verText.Text.ToString());
                    bool    rohsYorn = pb.GetBomRohsFlag();

                    // Save the checking result to Job table
                    checkJob.UpdateROHS(jobText.Text, rohsYorn);

                    string msg = string.Format("This job BOM is ROHS complied - {0}", rohsYorn.ToString());
                    toolStripStatusLabel1.Text = msg;
                    //MessageBox.Show(msg);

                    DisplayBOMtree(pb, null);
                }

                chkBtn.Enabled = false;
            }
            catch (Exception ee)
            {
                string tmp = DBHelper.Util.RemoveSingleQuote(ee.ToString());
                //MfgDataTraceRecord.LogRecord(tmp);
                MessageBox.Show(ee.ToString());
            }
        }