コード例 #1
0
        public static List <EplPartProperties> Search(string partNumber)
        {
            try
            {
                if (mDPartsManagement == null)
                {
                    mDPartsManagement = new MDPartsManagement();
                }

                if (mDPartsDatabase == null || !mDPartsDatabase.IsOpen)
                {
                    mDPartsDatabase = mDPartsManagement.OpenDatabase();
                }

                var parts = mDPartsDatabase.Parts.Where(i => i.PartNr.Contains(partNumber) || partNumber.Contains(i.PartNr)).ToList();

                if (parts == null)
                {
                    return(null);
                }

                var result = parts.Select(s => new EplPartProperties
                {
                    PartNumber     = s.PartNr,
                    Supplier       = s.Properties.ARTICLE_SUPPLIER,
                    Description    = s.Properties.ARTICLE_NOTE,
                    Manufacturer   = s.Properties.ARTICLE_MANUFACTURER,
                    OrderNumber    = s.Properties.ARTICLE_ORDERNR,
                    Unit           = s.Properties.ARTICLE_QUANTITYUNIT,
                    Quantity       = s.Properties.ARTICLE_PACKAGINGQUANTITY,
                    Macro          = s.Properties.ARTICLE_MACRO,
                    Characteristic = s.Properties.ARTICLE_CHARACTERISTICS,
                    Price          = s.Properties.ARTICLE_PACKAGINGPRICE_1,
                    PartGroup      = s.Properties.ARTICLE_GROUPNUMBER,
                    Symbol         = (s.Properties.ARTICLE_REPORT_SYMBOL[1].IsEmpty ? "" : s.Properties.ARTICLE_REPORT_SYMBOL[1].ToString()),
                    //ProductGroup = s.ProductGroup,
                    //ProductSubGroup = s.ProductSubGroup,
                    //ProductTopGroup = s.GenericProductGroup,
                    Voltage                     = s.Properties.ARTICLE_VOLTAGE,
                    VoltageType                 = s.Properties.ARTICLE_VOLTAGETYPE,
                    Current                     = s.Properties.ARTICLE_ELECTRICALCURRENT,
                    TrippingCurrent             = s.Properties.ARTICLE_TRIGGERCURRENT,
                    ConnectionPointCrossSection = s.Properties.ARTICLE_CONNECTIONCROSSSECTION,
                    SwitchingCapacity           = s.Properties.ARTICLE_ELECTRICALPOWER,
                    MaxPowerDissipation         = s.Properties.ARTICLE_POWERDISSIPATION,
                }).ToList();

                return(result);
            }
            catch (Exception ex)
            {
                Logger.WriteLine("Search error.", ex);
                return(null);
            }
        }
コード例 #2
0
 public void Open(string filePath, Project project)
 {
     PartsManagerment = new MDPartsManagement();
     PartsDataBase    = PartsManagerment.OpenDatabase();
     FilePath         = filePath;
     CurrentProject   = project;
     ExcelExtension   = new ExcelExtension(FilePath, true);
     PartSheets       = ExcelExtension.ExcelPackage.Workbook.Worksheets;
 }
コード例 #3
0
        public static MDPart SelectPartWithGui()
        {
            EplApplication    eplanApplication = new EplApplication();
            MDPartsManagement partsManagement  = new MDPartsManagement();
            string            partnNumber      = string.Empty;
            string            partVariant      = string.Empty;

            eplanApplication.ShowPartSelectionDialog(ref partnNumber, ref partVariant);
            MDPartsDatabase partsDatabase = partsManagement.OpenDatabase();
            MDPart          part          = partsDatabase.GetPart(partnNumber, partVariant);

            return(part);
        }
コード例 #4
0
ファイル: MdPart.cs プロジェクト: hanks5178/mv_design
        private void button1_Click(object sender, EventArgs e)
        {
            if (!this.IsValidPartNr())
            {
                MessageBox.Show("부품 종류와 부품 번호를 입력해야 합니다.");
                return;
            }

            string partNr           = comboBox4.Text;
            string category         = comboBox1.Text;
            string subCategory      = comboBox2.Text;
            string maker            = comboBox3.Text;
            string description1     = comboBox5.Text;
            string note             = textBox1.Text;
            string groupSymbolMacro = textBox2.Text;

            MDPartsManagement pm       = new MDPartsManagement();
            MDPartsDatabase   database = pm.OpenDatabase();
            MDPart            mdPart   = database.GetPart(partNr);

            if (mdPart != null)
            {
                MessageBox.Show(partNr + " 부품이 있습니다.");
                return;
            }

            DialogResult dr = MessageBox.Show(partNr + " 부품을 생성합니다.", "부품 생성 확인", MessageBoxButtons.OKCancel);

            if (DialogResult.OK != dr)
            {
                return;
            }


            Data.Mdb mdb        = Data.MdbFactory.GetUniqueInstance;
            string[] attributes = mdb.GetAttribute(comboBox1.Text, comboBox2.Text);


            mdPart = database.AddPart(partNr);
            if (mdPart == null)
            {
                MessageBox.Show(mdPart.PartNr + " 부품이 생성이 실패했습니다.");
                return;
            }

            mdPart.Variant = "0";
            mdPart.Properties.ARTICLE_PRODUCTGROUP     = attributes[0];
            mdPart.Properties.ARTICLE_PRODUCTSUBGROUP  = attributes[1];
            mdPart.Properties.ARTICLE_PRODUCTTOPGROUP  = attributes[2];
            mdPart.Properties.ARTICLE_MANUFACTURER     = maker.Trim().Length == 0 ? " " : maker;
            mdPart.Properties.ARTICLE_TYPENR           = partNr;
            mdPart.Properties.ARTICLE_NOTE             = note;
            mdPart.Properties.ARTICLE_GROUPSYMBOLMACRO = groupSymbolMacro;

            MultiLangString mls = new MultiLangString();

            mls.AddString(ISOCode.Language.L___, description1);
            mdPart.Properties.ARTICLE_DESCR1 = mls;

            mdb.AddAttribite(mdPart, category, subCategory);

            MessageBox.Show(mdPart.PartNr + " 부품이 생성되었습니다.");
        }