Esempio n. 1
0
        private void ReadOtp_SaveFile(Excel.Worksheet xlsSheet)
        {
            this.uDSConfigOtp = new Infragistics.Win.UltraWinDataSource.UltraDataSource();

            Infragistics.Win.UltraWinDataSource.UltraDataColumn ultraDataColumn1 = new Infragistics.Win.UltraWinDataSource.UltraDataColumn("No1");
            Infragistics.Win.UltraWinDataSource.UltraDataColumn ultraDataColumn2 = new Infragistics.Win.UltraWinDataSource.UltraDataColumn("Name1");
            Infragistics.Win.UltraWinDataSource.UltraDataColumn ultraDataColumn3 = new Infragistics.Win.UltraWinDataSource.UltraDataColumn("Status1");
            Infragistics.Win.UltraWinDataSource.UltraDataColumn ultraDataColumn4 = new Infragistics.Win.UltraWinDataSource.UltraDataColumn("No2");
            Infragistics.Win.UltraWinDataSource.UltraDataColumn ultraDataColumn5 = new Infragistics.Win.UltraWinDataSource.UltraDataColumn("Name2");
            Infragistics.Win.UltraWinDataSource.UltraDataColumn ultraDataColumn6 = new Infragistics.Win.UltraWinDataSource.UltraDataColumn("Status2");
            Infragistics.Win.UltraWinDataSource.UltraDataColumn ultraDataColumn7 = new Infragistics.Win.UltraWinDataSource.UltraDataColumn("No3");
            Infragistics.Win.UltraWinDataSource.UltraDataColumn ultraDataColumn8 = new Infragistics.Win.UltraWinDataSource.UltraDataColumn("Name3");
            Infragistics.Win.UltraWinDataSource.UltraDataColumn ultraDataColumn9 = new Infragistics.Win.UltraWinDataSource.UltraDataColumn("Status3");
            ultraDataColumn1.DataType = typeof(uint);
            this.uDSConfigOtp.Band.Columns.AddRange(new object[] {
                ultraDataColumn1, ultraDataColumn2, ultraDataColumn3,
                ultraDataColumn4, ultraDataColumn5, ultraDataColumn6,
                ultraDataColumn7, ultraDataColumn8, ultraDataColumn9,
            });

            int boolArrayQuentity = this.m_Otp_Module_Quentity * 32;

            this.m_abReadedOtpMapUse = new bool[boolArrayQuentity];

            try
            {
                this.uDSConfigOtp.Rows.Clear();
                string       rowReadData;
                string       rowStatusDAta;
                UltraDataRow rowItem           = null;
                int          IONameReadCount   = 1;
                int          ColumnCount       = 1;
                int          IOMapAddressCount = 0;
                for (int row = 100; row < 200; row++) //
                {
                    Debug.Write("Row " + row.ToString() + " 입니다." + System.Environment.NewLine);
                    if (((Excel.Range)xlsSheet.Cells[row, 5]).Value2 == null) // null 이면 종료
                    {
                        break;
                    }

                    if (((Excel.Range)xlsSheet.Cells[row, 6]).Value2 == null)
                    {
                        m_abReadedOtpMapUse[IOMapAddressCount] = false;
                        IOMapAddressCount++;
                        continue;
                    }
                    else
                    {
                        m_abReadedOtpMapUse[IOMapAddressCount] = true;
                        IOMapAddressCount++;
                    }


                    if (ColumnCount == 1)
                    {
                        this.uDSConfigOtp.Rows.Add();
                        rowItem = this.uDSConfigOtp.Rows[this.uDSConfigOtp.Rows.Count - 1];
                    }


                    rowReadData   = ((Excel.Range)xlsSheet.Cells[row, 6]).Value2.ToString().Trim();
                    rowStatusDAta = ((Excel.Range)xlsSheet.Cells[row, 7]).Value2.ToString().Trim();

                    switch (ColumnCount)
                    {
                    case 1:
                        rowItem["NO1"]     = IONameReadCount.ToString("00");
                        rowItem["Name1"]   = rowReadData;
                        rowItem["Status1"] = (IOMapAddressCount - 1).ToString("00");
                        break;

                    case 2:
                        rowItem["NO2"]     = IONameReadCount.ToString("00");
                        rowItem["Name2"]   = rowReadData;
                        rowItem["Status2"] = (IOMapAddressCount - 1).ToString("00");
                        break;

                    case 3:
                        rowItem["NO3"]     = IONameReadCount.ToString("00");
                        rowItem["Name3"]   = rowReadData;
                        rowItem["Status3"] = (IOMapAddressCount - 1).ToString("00");
                        break;
                    }

                    if (ColumnCount == 3)
                    {
                        ColumnCount = 1;
                    }
                    else
                    {
                        ColumnCount++;
                    }

                    IONameReadCount++;
                }
                int orc = uDSConfigOtp.Rows.Count;
                for (int i = 0; i < (12 - orc); i++)
                {
                    this.uDSConfigOtp.Rows.Add();
                }
                //this.uDSConfigOtp.Rows.Add();
            }
            catch
            {
                //MessageBox.Show("ERROR !! READ TO EXCEL FILE !!");
            }
            finally
            {
            }
        }
Esempio n. 2
0
        private void ReadMotionSet_SaveFile(Excel.Worksheet xlsSheet)
        {
            Infragistics.Win.UltraWinDataSource.UltraDataColumn ultraDataColumn1  = new Infragistics.Win.UltraWinDataSource.UltraDataColumn("No");
            Infragistics.Win.UltraWinDataSource.UltraDataColumn ultraDataColumn2  = new Infragistics.Win.UltraWinDataSource.UltraDataColumn("AxName");
            Infragistics.Win.UltraWinDataSource.UltraDataColumn ultraDataColumn3  = new Infragistics.Win.UltraWinDataSource.UltraDataColumn("LimitPos");
            Infragistics.Win.UltraWinDataSource.UltraDataColumn ultraDataColumn4  = new Infragistics.Win.UltraWinDataSource.UltraDataColumn("LimitNeg");
            Infragistics.Win.UltraWinDataSource.UltraDataColumn ultraDataColumn5  = new Infragistics.Win.UltraWinDataSource.UltraDataColumn("PosOrigin");
            Infragistics.Win.UltraWinDataSource.UltraDataColumn ultraDataColumn6  = new Infragistics.Win.UltraWinDataSource.UltraDataColumn("OnOff");
            Infragistics.Win.UltraWinDataSource.UltraDataColumn ultraDataColumn7  = new Infragistics.Win.UltraWinDataSource.UltraDataColumn("PosStart");
            Infragistics.Win.UltraWinDataSource.UltraDataColumn ultraDataColumn8  = new Infragistics.Win.UltraWinDataSource.UltraDataColumn("Error");
            Infragistics.Win.UltraWinDataSource.UltraDataColumn ultraDataColumn9  = new Infragistics.Win.UltraWinDataSource.UltraDataColumn("Position");
            Infragistics.Win.UltraWinDataSource.UltraDataColumn ultraDataColumn10 = new Infragistics.Win.UltraWinDataSource.UltraDataColumn("Speed");
            ultraDataColumn1.DataType = typeof(uint);
            this.uDSConfigMotion.Band.Columns.AddRange(new object[] {
                ultraDataColumn1, ultraDataColumn2, ultraDataColumn3,
                ultraDataColumn4, ultraDataColumn5, ultraDataColumn6,
                ultraDataColumn7, ultraDataColumn8, ultraDataColumn9, ultraDataColumn10
            });

            try
            {
                this.uDSConfigMotion.Rows.Clear();
                string[]     rowReadData     = new string[9];
                UltraDataRow rowItem         = null;
                int          IONameReadCount = 1;
                int          ColumnCount     = 1;
                for (int row = 2; row < 100; row++) //
                {
                    Debug.Write("Row " + row.ToString() + " 입니다." + System.Environment.NewLine);
                    if (((Excel.Range)xlsSheet.Cells[row, 1]).Value2 == null) // null 이면 종료
                    {
                        break;
                    }

                    this.uDSConfigMotion.Rows.Add();
                    rowItem = this.uDSConfigMotion.Rows[row - 2];

                    for (int col = 1; col < 10; col++)
                    {
                        rowReadData[col - 1] = ((Excel.Range)xlsSheet.Cells[row, col]).Value2.ToString();//.Trim();
                    }

                    rowItem["No"]        = this.uDSConfigMotion.Rows.Count;
                    rowItem["AxName"]    = rowReadData[0];
                    rowItem["LimitPos"]  = rowReadData[1];
                    rowItem["LimitNeg"]  = rowReadData[2];
                    rowItem["PosOrigin"] = rowReadData[3];
                    rowItem["OnOff"]     = rowReadData[4];
                    rowItem["PosStart"]  = rowReadData[5];
                    rowItem["Error"]     = rowReadData[6];
                    rowItem["Position"]  = rowReadData[7];
                    rowItem["Speed"]     = rowReadData[8];
                }
                this.uDSConfigMotion.Rows.Add();
                this.uDSConfigMotion.Rows.Add();
                this.uDSConfigMotion.Rows.Add();
                this.uDSConfigMotion.Rows.Add();
                this.uDSConfigMotion.Rows.Add();
                this.uDSConfigMotion.Rows.Add();
                this.uDSConfigMotion.Rows.Add();
                this.uDSConfigMotion.Rows.Add();
                this.uDSConfigMotion.Rows.Add();
            }
            catch
            {
                //MessageBox.Show("ERROR !! READ TO EXCEL FILE !!");
            }
            finally
            {
            }
        }