예제 #1
0
        private void ConfOutputbutton_Click(object sender, RoutedEventArgs e)
        {
            string sFileStyle  = "Excel(.xml) | *.xml";
            string UIKey       = "ConfOutPutFilePathteBox";
            string UIKey1      = "OutPutDatasteBox";
            string UIKey2      = "OPCInforaButton";
            string UIKey3      = "AlarmListradioButton";
            string sFilePath   = UIdictionary[UIKey].MyString;
            bool   bOpenEnable = Outputfile(ref sFilePath, sFileStyle);

            UIdictionary[UIKey1].MyString = "";
            try
            {
                if (bOpenEnable)
                {
                    BaseFactory factory = new BaseFactory();
                    factory.BaseParameter = CreateConvertParameter();
                    factory.bOPCIfo       = (bool)UIdictionary[UIKey2].Mybool;
                    factory.bConvAlarm    = (bool)UIdictionary[UIKey3].Mybool;
                    CreateDataMath <List <string>, ConveyorRow> createMath;
                    ConfigData            dConfigData;
                    List <List <string> > lls = new List <List <string> >();
                    //ConfigData dConfigData = (ConfigData)factory.CreatDataClass("ConfigData");
                    if (UIdictionary[UIKey2].Mybool == true)
                    {
                        string[] sListColName = { "Tag Name", "Type", "Channel", "Device", "DataType" };
                        factory.sListColName = sListColName.ToList();
                        dConfigData          = (ConfigData)factory.CreatDataClass("ConfigData");
                        createMath           = dConfigData.CreateOPCInfoRows;
                        lls = dConfigData.CreateList(createMath);
                    }
                    if (UIdictionary[UIKey3].Mybool == true)
                    {
                        string[] sListColName = { "SignalName",        "AckType",       "AlarmTag",     "PartName",
                                                  "Alarm Description", "AlarmGroup",    "AlarmType",    "AlarmCategory",
                                                  "Delayed",           "ConditionName", "Priority",     "GeneralComment","Level1View",
                                                  "Level2View",        "Resetable",     "ResetBit",     "ALNumber",      "CCTVRecording",
                                                  "ElementID",         "ResetSignal",   "ExtraTagList", "CISData",       "Technical" };
                        factory.sListColName = sListColName.ToList();
                        dConfigData          = (ConfigData)factory.CreatDataClass("ConfigData");
                        createMath           = dConfigData.CreateAlarmListRows;
                        lls = dConfigData.CreateList(createMath);
                    }
                    UIdictionary[UIKey].MyString = sFilePath;
                    //ExcelFunction.ExcelWrite(sFilePath, dt);
                    //XmlFuction xmlFuction = new XmlFuction();
                    //xmlFuction.XmlWrite(sFilePath, dt);
                    XmlSerialiaztion.XmlSerial(sFilePath, new Workbook(lls));
                    UIdictionary[UIKey1].MyString = "Build Datas Successful";
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Build OPC Data Error: " + ex.Message);
            }
            GC.Collect();
        }
예제 #2
0
        private void ElementSearchOutputFilePathbutton_Click(object sender, RoutedEventArgs e)
        {
            string sFileStyle   = "XML | *.xml";
            string UIKey        = "ElementSearchOutputFilePathBox";
            string UIKey1       = "OutPutDatasteBox";
            string sOutFilePath = UIdictionary[UIKey].MyString;
            bool   bOpenEnable  = Outputfile(ref sOutFilePath, sFileStyle);

            UIdictionary[UIKey1].MyString = "";
            try
            {
                if (bOpenEnable)
                {
                    BaseFactory       factory          = new BaseFactory(CreateConvertParameter());
                    ElementSearchData elmentSearchData = (ElementSearchData)factory.CreatDataClass("ElementSearchData");
                    CreateDataMath <ElementSeacrhStruct, ConveyorRow> elmentSearchMath = elmentSearchData.CreateElements;
                    List <ElementSeacrhStruct> lelmentSearchData = elmentSearchData.CreateList(elmentSearchMath);
                    ElementSearchXml           elementSearchXml  = new ElementSearchXml();
                    elementSearchXml.Elements     = lelmentSearchData;
                    UIdictionary[UIKey1].MyString = DataConvert.ToString(lelmentSearchData);
                    UIdictionary[UIKey].MyString  = sOutFilePath;
                    XmlSerialiaztion.XmlSerial(sOutFilePath, elementSearchXml);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Build Element Search Data Error: " + ex.Message);
            }
            GC.Collect();
        }
예제 #3
0
        private void Level1DataOutputbutton_Click(object sender, RoutedEventArgs e)
        {
            string sFileStyle = "Text documents (.vsignal)|*.vsignal";
            string UIKey      = "Level1DataOutPutFilePathteBox";
            string UIKey1     = "OutPutDatasteBox";
            string sFilePath  = UIdictionary[UIKey].MyString;

            UIdictionary[UIKey1].MyString = "";
            try
            {
                bool bOpenEnable = Outputfile(ref sFilePath, sFileStyle);
                if (bOpenEnable == true)
                {
                    BaseFactory factory = new BaseFactory();
                    factory.BaseParameter = CreateConvertParameter();
                    factory.TempTable     = Level1DataExcelData;
                    Level1Data level1Data = (Level1Data)factory.CreatDataClass("Level1Data");
                    CreateDataMath <string, List <ConveyorRow> > dataMath = level1Data.CreateLineSignal;
                    var level1DataList = level1Data.CreateList(dataMath);
                    UIdictionary[UIKey].MyString  = sFilePath;
                    UIdictionary[UIKey1].MyString = DataConvert.ToString1(level1DataList);
                    System.IO.File.WriteAllText(@sFilePath, UIdictionary[UIKey1].MyString, Encoding.UTF8);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Build Level1 Data Error: " + ex.Message);
            }
            GC.Collect();
        }
예제 #4
0
        /// <summary>
        /// WPF XAML数据输出
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void XMLOutputbutton_Click(object sender, RoutedEventArgs e)
        {
            string sFileStyle = "WPF (.Xaml)|*.Xaml";
            string UIKey      = "XMLOutPutFilePathteBox";
            string UIKey1     = "OutPutDatasteBox";
            string UIKey2     = "L1raButton";
            string UIKey3     = "L2raButton";
            string UIKey4     = "TeBlackraButton";
            string UIKey5     = "ElementradioButton";
            string UIKey6     = "ViewNameteBox";
            string sFilePath  = UIdictionary[UIKey].MyString;

            UIdictionary[UIKey1].MyString = "";
            try
            {
                bool bOpenEnable = Outputfile(ref sFilePath, sFileStyle);
                if (bOpenEnable == true)
                {
                    BaseFactory factory = new BaseFactory();
                    factory.BaseParameter = CreateConvertParameter();
                    XamlData Data = (XamlData)factory.CreatDataClass("XamlData");
                    CreateDataMath <BgElementCommonXaml, ConveyorRow> bgXmalMath;
                    CreateDataMath <BgTextBlock, ConveyorRow>         blockTextMath;

                    List <BgElementCommonXaml> bgXamlGroup    = new List <BgElementCommonXaml>();
                    List <BgTextBlock>         textBlockGroup = new List <BgTextBlock>();

                    if (UIdictionary[UIKey2].Mybool == true)
                    {
                        bgXmalMath  = Data.CreatL1CommonXaml12307;
                        bgXamlGroup = Data.CreateList(bgXmalMath);
                    }
                    else if (UIdictionary[UIKey3].Mybool == true)
                    {
                        if (UIdictionary[UIKey5].Mybool == true)
                        {
                            bgXmalMath  = Data.CreatL2CommonXaml;
                            bgXamlGroup = Data.CreateList(bgXmalMath);
                        }
                        else if (UIdictionary[UIKey4].Mybool == true)
                        {
                            blockTextMath  = Data.CreatTextBlock;
                            textBlockGroup = Data.CreateList(blockTextMath);
                        }
                    }
                    ElementXaml elementXaml = new ElementXaml(bgXamlGroup, textBlockGroup, UIdictionary[UIKey6].MyString);
                    XmlSerialiaztion.XmlSerial(@sFilePath, elementXaml);
                    UIdictionary[UIKey].MyString  = sFilePath;
                    UIdictionary[UIKey1].MyString = "Build Xaml Successful!";
                    //System.IO.File.WriteAllText(@sFilePath, UIdictionary[UIKey1].MyString, Encoding.UTF8);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Build XML Data Error: " + ex.Message);
            }
            GC.Collect();
        }
예제 #5
0
        /// <summary>
        /// 测试记录表格输出
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void TestListOutputbutton_Click(object sender, RoutedEventArgs e)
        {
            string sFileStyle = "Excel(.xlsx) | *.xlsx|Excel(.xls) | *.xls";
            string UIKey      = "TestListOutPutFilePathteBox";
            string UIKey1     = "OutPutDatasteBox";
            string UIKey2     = "TestListTemplateteBox";
            string sFilePath  = UIdictionary[UIKey].MyString;

            UIdictionary[UIKey1].MyString = "";
            //try
            //{

            bool bOpenEnable = Outputfile(ref sFilePath, sFileStyle);

            if (bOpenEnable == true)
            {
                BaseFactory factory = new BaseFactory();
                factory.BaseParameter = CreateConvertParameter();


                TestList listData = (TestList)factory.CreatDataClass("TestList");
                CreateDataMath <List <TestSheetRow>, ConveyorRow> testdataMath = listData.CreateTestRows;
                CreateDataMath <List <string>, ConveyorRow>       cmcdataMath  = listData.CreateCMCRows;
                List <List <TestSheetRow> > testDataRows = listData.CreateList(testdataMath);
                List <List <string> >       cmcDataRows  = listData.CreateList(cmcdataMath);
                NpoiExcelFunction.ExcelWrite(sFilePath, "CMC", cmcDataRows);
                NpoiExcelFunction.ExcelWrite(sFilePath, "Test", testDataRows);
                UIdictionary[UIKey].MyString = sFilePath;

                //NpoiExcelFunction.ExcelWrite(sFilePath, (ListData as TestList).ListData);
                UIdictionary[UIKey1].MyString = "Output Test List successful!";
            }
            //}
            //catch (Exception ex)
            //{
            //    MessageBox.Show("Build Test List Error: " + ex.Message);
            //}
            GC.Collect();
        }
예제 #6
0
        /// <summary>
        /// 测试数据输出
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void TestDataOutputbutton_Click(object sender, RoutedEventArgs e)
        {
            string sFileStyle = "SIG File(.signaltester) | *.signaltester";
            string UIKey      = "TestdataOutPutFilePathteBox";
            string UIKey1     = "OutPutDatasteBox";
            string UIKey3     = "L1raButton";
            string UIKey4     = "L2raButton";
            string sFilePath  = UIdictionary[UIKey].MyString;

            try
            {
                bool bOpenEnable = Outputfile(ref sFilePath, sFileStyle);
                if (bOpenEnable == true)
                {
                    BaseFactory factory = new BaseFactory();
                    factory.BaseParameter = CreateConvertParameter();
                    TestData TestData = (TestData)factory.CreatDataClass("TestData");
                    List <List <string> > TestDataList = new List <List <string> >();
                    if (UIdictionary[UIKey3].Mybool == true)
                    {
                        CreateDataMath <string, List <ConveyorRow> > dataMath = TestData.CreateL1Signal;
                        TestDataList = TestData.CreateList(dataMath);
                    }
                    if (UIdictionary[UIKey4].Mybool == true)
                    {
                        CreateDataMath <string, List <ConveyorRow> > dataMath = TestData.CreateL2Signal;
                        TestDataList = TestData.CreateList(dataMath);
                    }
                    UIdictionary[UIKey].MyString  = sFilePath;
                    UIdictionary[UIKey1].MyString = DataConvert.ToString(TestDataList);
                    System.IO.File.WriteAllText(@sFilePath, UIdictionary[UIKey1].MyString, Encoding.UTF8);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Build Test data Error: " + ex.Message);
            }
            GC.Collect();
        }
예제 #7
0
        private void OPCDataOutputbutton_Click(object sender, RoutedEventArgs e)
        {
            //string sFileStyle = "Excel(.xlsx) | *.xlsx|Excel(.xls) | *.xls";
            string sFileStyle  = "Excel(.csv) | *.csv";
            string UIKey       = "OPCDataOutPutFilePathteBox";
            string UIKey1      = "OutPutDatasteBox";
            string UIKey2      = "SinglecheckBox";
            string UIKey3      = "CommandcheckBox";
            string UIKey4      = "HourcheckBox";
            string sFilePath   = UIdictionary[UIKey].MyString;
            bool   bOpenEnable = Outputfile(ref sFilePath, sFileStyle);

            UIdictionary[UIKey1].MyString = "";
            try
            {
                if (bOpenEnable)
                {
                    BaseFactory factory = new BaseFactory();
                    factory.BaseParameter = CreateConvertParameter();
                    factory.bSingle       = (bool)UIdictionary[UIKey2].Mybool;
                    factory.bCommand      = (bool)UIdictionary[UIKey3].Mybool;
                    factory.bHours        = (bool)UIdictionary[UIKey4].Mybool;
                    OPCData opcData = (OPCData)factory.CreatDataClass("OPCData");
                    CreateDataMath <List <string>, ConveyorRow> createOPCMath = opcData.CreateOPCRows;
                    var opcdataList = opcData.CreateList(createOPCMath);
                    UIdictionary[UIKey].MyString = sFilePath;
                    //ExcelFunction.ExcelWrite(sFilePath, dt);
                    CsvFunction.CsvWirte(sFilePath, opcdataList);
                    UIdictionary[UIKey1].MyString = DataConvert.ToString(opcdataList);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Build OPC Data Error: " + ex.Message);
            }
            GC.Collect();
        }