コード例 #1
0
ファイル: RFIDService.cs プロジェクト: gyygyy32/Redsun
        public ModuleInfo getModuleInfo(object[] parms)
        {
            string serial    = (string)parms[0];
            string uniqueTid = (string)parms[1];

            //check if this tag has writen data before by unique tid
            bool b_writenDataBefore = false;

            //Dictionary<string, object> dic = new Dictionary<string, object>();

            //string sp_parm_serial_no = "strModuleID";

            string     conn = "";
            ModuleInfo mi   = null;
            string     sql  = "";

#if SQLSERVER_ShiLangDe
            //dic.Add(sp_parm_serial_no, serial);
            //SUBSTRING(CONVERT(varchar(100), TestTime, 20),1,7) testtime 直接取值
            conn = connect_string;
            sql  = @"
SELECT 
'' ProductType,
'' ELGrade,
'' status,
testtime, 
PM,
Voc,
Isc,
VPM,
IPM,
FF,
'' Pivf,
LotNumber,
'' PalletNO,
'' CellDate,
'' Cellsource,
'' EqpID,
'' IVFilePath,
'' cell_supplier_country,
'' iec_date,
'' iec_verfy,
'' iso,
'' mfg_name,
'' customer
  FROM [JCMMES].[dbo].[VIEW_GETMODULE_DATA]
  where LotNumber = '{0}'
";
            sql  = string.Format(sql, serial);//[mes_level2_iface].[dbo].[test_rfid]

            IEnumerable <ModuleInfo> miList = DBOperation.GetMsSqlRows <ModuleInfo>(conn, sql, r =>
            {
                ModuleInfo obj = new ModuleInfo();
                try
                {
                    obj.ProductType           = r.IsDBNull(0) ? "" : r[0].ToString();
                    obj.ELGrade               = r.IsDBNull(1) ? "" : r[1].ToString();
                    obj.Status                = r.IsDBNull(2) ? "" : r[2].ToString();
                    obj.PackedDate            = r.IsDBNull(3) ? "" : r[3].ToString();
                    obj.Pmax                  = r.IsDBNull(4) ? "" : r[4].ToString();
                    obj.Voc                   = r.IsDBNull(5) ? "" : r[5].ToString();
                    obj.Isc                   = r.IsDBNull(6) ? "" : r[6].ToString();
                    obj.Vpm                   = r.IsDBNull(7) ? "" : r[7].ToString();
                    obj.Ipm                   = r.IsDBNull(8) ? "" : r[8].ToString();
                    obj.FF                    = r.IsDBNull(9) ? "" : r[9].ToString();
                    obj.Pivf                  = r.IsDBNull(10) ? "" : r[10].ToString();
                    obj.Module_ID             = r.IsDBNull(11) ? "" : r[11].ToString();
                    obj.PalletNO              = r.IsDBNull(12) ? "" : r[12].ToString();
                    obj.CellDate              = r.IsDBNull(13) ? "" : r[13].ToString();
                    obj.Cellsource            = r.IsDBNull(14) ? "" : r[14].ToString();
                    obj.EqpID                 = r.IsDBNull(15) ? "" : r[15].ToString();
                    obj.IVFilePath            = r.IsDBNull(16) ? "" : r[16].ToString();
                    obj.cell_supplier_country = r.IsDBNull(17) ? "" : r[17].ToString();
                    obj.iec_date              = r.IsDBNull(18) ? "" : r[18].ToString();
                    obj.iec_verfy             = r.IsDBNull(19) ? "" : r[19].ToString();
                    obj.iso                   = r.IsDBNull(20) ? "" : r[20].ToString();
                    obj.mfg_name              = r.IsDBNull(21) ? "" : r[21].ToString();
                    obj.customer              = r.IsDBNull(22) ? "" : r[22].ToString();
                }
                catch (Exception ex)
                {
                    LogHelper.writeErrorLog(m_errLogFileName, ex);
                }
                return(obj);
            });

            /*
             * IEnumerable<ModuleInfo> miList = DBOperation.GetMSRowsBySP<ModuleInfo>(conn, "Get_RFID_BasicInfo_V2", dic, r =>
             * {
             *  ModuleInfo obj = new ModuleInfo();
             *  try
             *  {
             *      obj.ProductType = r.IsDBNull(0) ? "" : r[0].ToString();
             *      obj.ELGrade = r.IsDBNull(1) ? "" : r[1].ToString();
             *      obj.Status = r.IsDBNull(2) ? "" : r[2].ToString();
             *      obj.PackedDate = r.IsDBNull(3) ? "" : r[3].ToString();
             *      obj.Pmax = r.IsDBNull(4) ? "" : r[4].ToString();
             *      obj.Voc = r.IsDBNull(5) ? "" : r[5].ToString();
             *      obj.Isc = r.IsDBNull(6) ? "" : r[6].ToString();
             *      obj.Vpm = r.IsDBNull(7) ? "" : r[7].ToString();
             *      obj.Ipm = r.IsDBNull(8) ? "" : r[8].ToString();
             *      obj.FF = r.IsDBNull(9) ? "" : r[9].ToString();
             *      obj.Pivf = r.IsDBNull(10) ? "" : r[10].ToString();
             *      obj.Module_ID = r.IsDBNull(11) ? "" : r[11].ToString();
             *      obj.PalletNO = r.IsDBNull(12) ? "" : r[12].ToString();
             *      obj.CellDate = r.IsDBNull(13) ? "" : r[13].ToString();
             *      obj.Cellsource = r.IsDBNull(14) ? "" : r[14].ToString();
             *      obj.EqpID = r.IsDBNull(15) ? "" : r[15].ToString();
             *      obj.IVFilePath = r.IsDBNull(16) ? "" : r[16].ToString();
             *      obj.cell_supplier_country = r.IsDBNull(17) ? "" : r[17].ToString();
             *      obj.iec_date = r.IsDBNull(18) ? "" : r[18].ToString();
             *      obj.iec_verfy = r.IsDBNull(19) ? "" : r[19].ToString();
             *      obj.iso = r.IsDBNull(20) ? "" : r[20].ToString();
             *      obj.mfg_name = r.IsDBNull(21) ? "" : r[21].ToString();
             *      obj.customer = r.IsDBNull(22) ? "" : r[22].ToString();
             *  }
             *  catch (Exception ex)
             *  {
             *      LogHelper.writeErrorLog(m_errLogFileName, ex);
             *  }
             *  return obj;
             * });
             */

            mi = miList == null ? null : miList.FirstOrDefault();

            if (mi != null)
            {
                mi.b_writenDataBefore = b_writenDataBefore;
            }
#endif

#if SQLSERVER_LOCALHOST
            //dic.Add(sp_parm_serial_no, serial);
            //SUBSTRING(CONVERT(varchar(100), TestTime, 20),1,7) testtime 直接取值
            conn = connect_string;
            sql  = @"
SELECT 
'' ProductType,
'' ELGrade,
'' status,
SUBSTRING(CONVERT(varchar(100), TestTime, 20),1,7), 
PM,
Voc,
Isc,
VPM,
IPM,
FF,
'' Pivf,
LotNumber,
'' PalletNO,
'' CellDate,
'' Cellsource,
'' EqpID,
'' IVFilePath,
'' cell_supplier_country,
'' iec_date,
'' iec_verfy,
'' iso,
'' mfg_name,
'' customer
  FROM [mes_level2_iface].[dbo].[test_rfid]
  where LotNumber = '{0}'
";
            sql  = string.Format(sql, serial);//[mes_level2_iface].[dbo].[test_rfid]

            IEnumerable <ModuleInfo> miList = DBOperation.GetMsSqlRows <ModuleInfo>(conn, sql, r =>
            {
                ModuleInfo obj = new ModuleInfo();
                try
                {
                    obj.ProductType           = r.IsDBNull(0) ? "" : r[0].ToString();
                    obj.ELGrade               = r.IsDBNull(1) ? "" : r[1].ToString();
                    obj.Status                = r.IsDBNull(2) ? "" : r[2].ToString();
                    obj.PackedDate            = r.IsDBNull(3) ? "" : r[3].ToString();
                    obj.Pmax                  = r.IsDBNull(4) ? "" : r[4].ToString();
                    obj.Voc                   = r.IsDBNull(5) ? "" : r[5].ToString();
                    obj.Isc                   = r.IsDBNull(6) ? "" : r[6].ToString();
                    obj.Vpm                   = r.IsDBNull(7) ? "" : r[7].ToString();
                    obj.Ipm                   = r.IsDBNull(8) ? "" : r[8].ToString();
                    obj.FF                    = r.IsDBNull(9) ? "" : r[9].ToString();
                    obj.Pivf                  = r.IsDBNull(10) ? "" : r[10].ToString();
                    obj.Module_ID             = r.IsDBNull(11) ? "" : r[11].ToString();
                    obj.PalletNO              = r.IsDBNull(12) ? "" : r[12].ToString();
                    obj.CellDate              = r.IsDBNull(13) ? "" : r[13].ToString();
                    obj.Cellsource            = r.IsDBNull(14) ? "" : r[14].ToString();
                    obj.EqpID                 = r.IsDBNull(15) ? "" : r[15].ToString();
                    obj.IVFilePath            = r.IsDBNull(16) ? "" : r[16].ToString();
                    obj.cell_supplier_country = r.IsDBNull(17) ? "" : r[17].ToString();
                    obj.iec_date              = r.IsDBNull(18) ? "" : r[18].ToString();
                    obj.iec_verfy             = r.IsDBNull(19) ? "" : r[19].ToString();
                    obj.iso                   = r.IsDBNull(20) ? "" : r[20].ToString();
                    obj.mfg_name              = r.IsDBNull(21) ? "" : r[21].ToString();
                    obj.customer              = r.IsDBNull(22) ? "" : r[22].ToString();
                }
                catch (Exception ex)
                {
                    LogHelper.writeErrorLog(m_errLogFileName, ex);
                }
                return(obj);
            });

            /*
             * IEnumerable<ModuleInfo> miList = DBOperation.GetMSRowsBySP<ModuleInfo>(conn, "Get_RFID_BasicInfo_V2", dic, r =>
             * {
             *  ModuleInfo obj = new ModuleInfo();
             *  try
             *  {
             *      obj.ProductType = r.IsDBNull(0) ? "" : r[0].ToString();
             *      obj.ELGrade = r.IsDBNull(1) ? "" : r[1].ToString();
             *      obj.Status = r.IsDBNull(2) ? "" : r[2].ToString();
             *      obj.PackedDate = r.IsDBNull(3) ? "" : r[3].ToString();
             *      obj.Pmax = r.IsDBNull(4) ? "" : r[4].ToString();
             *      obj.Voc = r.IsDBNull(5) ? "" : r[5].ToString();
             *      obj.Isc = r.IsDBNull(6) ? "" : r[6].ToString();
             *      obj.Vpm = r.IsDBNull(7) ? "" : r[7].ToString();
             *      obj.Ipm = r.IsDBNull(8) ? "" : r[8].ToString();
             *      obj.FF = r.IsDBNull(9) ? "" : r[9].ToString();
             *      obj.Pivf = r.IsDBNull(10) ? "" : r[10].ToString();
             *      obj.Module_ID = r.IsDBNull(11) ? "" : r[11].ToString();
             *      obj.PalletNO = r.IsDBNull(12) ? "" : r[12].ToString();
             *      obj.CellDate = r.IsDBNull(13) ? "" : r[13].ToString();
             *      obj.Cellsource = r.IsDBNull(14) ? "" : r[14].ToString();
             *      obj.EqpID = r.IsDBNull(15) ? "" : r[15].ToString();
             *      obj.IVFilePath = r.IsDBNull(16) ? "" : r[16].ToString();
             *      obj.cell_supplier_country = r.IsDBNull(17) ? "" : r[17].ToString();
             *      obj.iec_date = r.IsDBNull(18) ? "" : r[18].ToString();
             *      obj.iec_verfy = r.IsDBNull(19) ? "" : r[19].ToString();
             *      obj.iso = r.IsDBNull(20) ? "" : r[20].ToString();
             *      obj.mfg_name = r.IsDBNull(21) ? "" : r[21].ToString();
             *      obj.customer = r.IsDBNull(22) ? "" : r[22].ToString();
             *  }
             *  catch (Exception ex)
             *  {
             *      LogHelper.writeErrorLog(m_errLogFileName, ex);
             *  }
             *  return obj;
             * });
             */

            mi = miList == null? null: miList.FirstOrDefault();

            if (mi != null)
            {
                mi.b_writenDataBefore = b_writenDataBefore;
            }
#endif

#if SQLSERVER_TengHui
            dic.Add(sp_parm_serial_no, serial);

            conn = connect_string;

            IEnumerable <ModuleInfo> miList = DBOperation.GetMSRowsBySP <ModuleInfo>(conn, "Get_RFID_BasicInfo_V2", dic, r =>
            {
                ModuleInfo obj = new ModuleInfo();
                try
                {
                    obj.ProductType           = r.IsDBNull(0) ? "" : r[0].ToString();
                    obj.ELGrade               = r.IsDBNull(1) ? "" : r[1].ToString();
                    obj.Status                = r.IsDBNull(2) ? "" : r[2].ToString();
                    obj.PackedDate            = r.IsDBNull(3) ? "" : r[3].ToString();
                    obj.Pmax                  = r.IsDBNull(4) ? "" : r[4].ToString();
                    obj.Voc                   = r.IsDBNull(5) ? "" : r[5].ToString();
                    obj.Isc                   = r.IsDBNull(6) ? "" : r[6].ToString();
                    obj.Vpm                   = r.IsDBNull(7) ? "" : r[7].ToString();
                    obj.Ipm                   = r.IsDBNull(8) ? "" : r[8].ToString();
                    obj.FF                    = r.IsDBNull(9) ? "" : r[9].ToString();
                    obj.Pivf                  = r.IsDBNull(10) ? "" : r[10].ToString();
                    obj.Module_ID             = r.IsDBNull(11) ? "" : r[11].ToString();
                    obj.PalletNO              = r.IsDBNull(12) ? "" : r[12].ToString();
                    obj.CellDate              = r.IsDBNull(13) ? "" : r[13].ToString();
                    obj.Cellsource            = r.IsDBNull(14) ? "" : r[14].ToString();
                    obj.EqpID                 = r.IsDBNull(15) ? "" : r[15].ToString();
                    obj.IVFilePath            = r.IsDBNull(16) ? "" : r[16].ToString();
                    obj.cell_supplier_country = r.IsDBNull(17) ? "" : r[17].ToString();
                    obj.iec_date              = r.IsDBNull(18) ? "" : r[18].ToString();
                    obj.iec_verfy             = r.IsDBNull(19) ? "" : r[19].ToString();
                    obj.iso                   = r.IsDBNull(20) ? "" : r[20].ToString();
                    obj.mfg_name              = r.IsDBNull(21) ? "" : r[21].ToString();
                    //obj.customer = r.IsDBNull(22) ? "" : r[22].ToString();
                }
                catch (Exception ex)
                {
                    LogHelper.writeErrorLog(m_errLogFileName, ex);
                }
                return(obj);
            });


            mi = miList == null? null: miList.FirstOrDefault();

            if (mi != null)
            {
                mi.b_writenDataBefore = b_writenDataBefore;
            }
#endif

#if MYSQL_LOCALHOST
            dic.Add(sp_parm_serial_no, serial);

            conn = connect_string;

            IEnumerable <ModuleInfo> miList = DBOperation.GetMySqlRowsBySP <ModuleInfo>(conn, "Get_RFID_BasicInfo_V2", dic, r =>
            {
                ModuleInfo obj = new ModuleInfo();
                try
                {
                    obj.ProductType           = r.IsDBNull(0) ? "" : r[0].ToString();
                    obj.ELGrade               = r.IsDBNull(1) ? "" : r[1].ToString();
                    obj.Status                = r.IsDBNull(2) ? "" : r[2].ToString();
                    obj.PackedDate            = r.IsDBNull(3) ? "" : r[3].ToString();
                    obj.Pmax                  = r.IsDBNull(4) ? "" : r[4].ToString();
                    obj.Voc                   = r.IsDBNull(5) ? "" : r[5].ToString();
                    obj.Isc                   = r.IsDBNull(6) ? "" : r[6].ToString();
                    obj.Vpm                   = r.IsDBNull(7) ? "" : r[7].ToString();
                    obj.Ipm                   = r.IsDBNull(8) ? "" : r[8].ToString();
                    obj.FF                    = r.IsDBNull(9) ? "" : r[9].ToString();
                    obj.Pivf                  = r.IsDBNull(10) ? "" : r[10].ToString();
                    obj.Module_ID             = r.IsDBNull(11) ? "" : r[11].ToString();
                    obj.PalletNO              = r.IsDBNull(12) ? "" : r[12].ToString();
                    obj.CellDate              = r.IsDBNull(13) ? "" : r[13].ToString();
                    obj.Cellsource            = r.IsDBNull(14) ? "" : r[14].ToString();
                    obj.EqpID                 = r.IsDBNull(15) ? "" : r[15].ToString();
                    obj.IVFilePath            = r.IsDBNull(16) ? "" : r[16].ToString();
                    obj.cell_supplier_country = r.IsDBNull(17) ? "" : r[17].ToString();
                    obj.iec_date              = r.IsDBNull(18) ? "" : r[18].ToString();
                    obj.iec_verfy             = r.IsDBNull(19) ? "" : r[19].ToString();
                    obj.iso                   = r.IsDBNull(20) ? "" : r[20].ToString();
                    obj.mfg_name              = r.IsDBNull(21) ? "" : r[21].ToString();
                }
                catch (Exception ex)
                {
                    LogHelper.writeErrorLog(m_errLogFileName, ex);
                }
                return(obj);
            });


            mi = miList == null? null: miList.FirstOrDefault();

            if (mi != null)
            {
                mi.b_writenDataBefore = b_writenDataBefore;
            }
#endif

#if MYSQL_CLOUD
            dic.Add(sp_parm_serial_no, serial);

            conn = connect_string;

            IEnumerable <ModuleInfo> miList = DBOperation.GetMySqlRowsBySP <ModuleInfo>(conn, "Get_RFID_BasicInfo_V2", dic, r =>
            {
                ModuleInfo obj = new ModuleInfo();
                try
                {
                    obj.ProductType           = r.IsDBNull(0) ? "" : r[0].ToString();
                    obj.ELGrade               = r.IsDBNull(1) ? "" : r[1].ToString();
                    obj.Status                = r.IsDBNull(2) ? "" : r[2].ToString();
                    obj.PackedDate            = r.IsDBNull(3) ? "" : r[3].ToString();
                    obj.Pmax                  = r.IsDBNull(4) ? "" : r[4].ToString();
                    obj.Voc                   = r.IsDBNull(5) ? "" : r[5].ToString();
                    obj.Isc                   = r.IsDBNull(6) ? "" : r[6].ToString();
                    obj.Vpm                   = r.IsDBNull(7) ? "" : r[7].ToString();
                    obj.Ipm                   = r.IsDBNull(8) ? "" : r[8].ToString();
                    obj.FF                    = r.IsDBNull(9) ? "" : r[9].ToString();
                    obj.Pivf                  = r.IsDBNull(10) ? "" : r[10].ToString();
                    obj.Module_ID             = r.IsDBNull(11) ? "" : r[11].ToString();
                    obj.PalletNO              = r.IsDBNull(12) ? "" : r[12].ToString();
                    obj.CellDate              = r.IsDBNull(13) ? "" : r[13].ToString();
                    obj.Cellsource            = r.IsDBNull(14) ? "" : r[14].ToString();
                    obj.EqpID                 = r.IsDBNull(15) ? "" : r[15].ToString();
                    obj.IVFilePath            = r.IsDBNull(16) ? "" : r[16].ToString();
                    obj.cell_supplier_country = r.IsDBNull(17) ? "" : r[17].ToString();
                    obj.iec_date              = r.IsDBNull(18) ? "" : r[18].ToString();
                    obj.iec_verfy             = r.IsDBNull(19) ? "" : r[19].ToString();
                    obj.iso                   = r.IsDBNull(20) ? "" : r[20].ToString();
                    obj.mfg_name              = r.IsDBNull(21) ? "" : r[21].ToString();
                    obj.customer              = r.IsDBNull(22) ? "" : r[22].ToString();
                }
                catch (Exception ex)
                {
                    LogHelper.writeErrorLog(m_errLogFileName, ex);
                }
                return(obj);
            });


            mi = miList == null? null: miList.FirstOrDefault();

            if (mi != null)
            {
                mi.b_writenDataBefore = b_writenDataBefore;
            }
#endif

            return(mi);
        }
コード例 #2
0
        public ModuleInfo getModuleInfo(object[] parms)
        {
            string serial    = (string)parms[0];
            string uniqueTid = (string)parms[1];

            //check if this tag has writen data before by unique tid
            bool b_writenDataBefore = false;

            Dictionary <string, object> dic = new Dictionary <string, object>();

            string sp_parm_serial_no = "strModuleID";

            string     conn = "";
            ModuleInfo mi   = null;


#if SQLSERVER_LOCALHOST
            dic.Add(sp_parm_serial_no, serial);

            conn = connect_string;

            IEnumerable <ModuleInfo> miList = DBOperation.GetMSRowsBySP <ModuleInfo>(conn, "Get_RFID_BasicInfo_V2", dic, r =>
            {
                ModuleInfo obj = new ModuleInfo();
                try
                {
                    obj.ProductType           = r.IsDBNull(0) ? "" : r[0].ToString();
                    obj.ELGrade               = r.IsDBNull(1) ? "" : r[1].ToString();
                    obj.Status                = r.IsDBNull(2) ? "" : r[2].ToString();
                    obj.PackedDate            = r.IsDBNull(3) ? "" : r[3].ToString();
                    obj.Pmax                  = r.IsDBNull(4) ? "" : r[4].ToString();
                    obj.Voc                   = r.IsDBNull(5) ? "" : r[5].ToString();
                    obj.Isc                   = r.IsDBNull(6) ? "" : r[6].ToString();
                    obj.Vpm                   = r.IsDBNull(7) ? "" : r[7].ToString();
                    obj.Ipm                   = r.IsDBNull(8) ? "" : r[8].ToString();
                    obj.FF                    = r.IsDBNull(9) ? "" : r[9].ToString();
                    obj.Pivf                  = r.IsDBNull(10) ? "" : r[10].ToString();
                    obj.Module_ID             = r.IsDBNull(11) ? "" : r[11].ToString();
                    obj.PalletNO              = r.IsDBNull(12) ? "" : r[12].ToString();
                    obj.CellDate              = r.IsDBNull(13) ? "" : r[13].ToString();
                    obj.Cellsource            = r.IsDBNull(14) ? "" : r[14].ToString();
                    obj.EqpID                 = r.IsDBNull(15) ? "" : r[15].ToString();
                    obj.IVFilePath            = r.IsDBNull(16) ? "" : r[16].ToString();
                    obj.cell_supplier_country = r.IsDBNull(17) ? "" : r[17].ToString();
                    obj.iec_date              = r.IsDBNull(18) ? "" : r[18].ToString();
                    obj.iec_verfy             = r.IsDBNull(19) ? "" : r[19].ToString();
                    obj.iso                   = r.IsDBNull(20) ? "" : r[20].ToString();
                    obj.mfg_name              = r.IsDBNull(21) ? "" : r[21].ToString();
                    obj.customer              = r.IsDBNull(22) ? "" : r[22].ToString();
                }
                catch (Exception ex)
                {
                    LogHelper.writeErrorLog(m_errLogFileName, ex);
                }
                return(obj);
            });


            mi = miList == null? null: miList.FirstOrDefault();

            if (mi != null)
            {
                mi.b_writenDataBefore = b_writenDataBefore;
            }
#endif

#if SQLSERVER_TengHui
            dic.Add(sp_parm_serial_no, serial);

            conn = connect_string;

            IEnumerable <ModuleInfo> miList = DBOperation.GetMSRowsBySP <ModuleInfo>(conn, "Get_RFID_BasicInfo_V2", dic, r =>
            {
                ModuleInfo obj = new ModuleInfo();
                try
                {
                    obj.ProductType           = r.IsDBNull(0) ? "" : r[0].ToString();
                    obj.ELGrade               = r.IsDBNull(1) ? "" : r[1].ToString();
                    obj.Status                = r.IsDBNull(2) ? "" : r[2].ToString();
                    obj.PackedDate            = r.IsDBNull(3) ? "" : r[3].ToString();
                    obj.Pmax                  = r.IsDBNull(4) ? "" : r[4].ToString();
                    obj.Voc                   = r.IsDBNull(5) ? "" : r[5].ToString();
                    obj.Isc                   = r.IsDBNull(6) ? "" : r[6].ToString();
                    obj.Vpm                   = r.IsDBNull(7) ? "" : r[7].ToString();
                    obj.Ipm                   = r.IsDBNull(8) ? "" : r[8].ToString();
                    obj.FF                    = r.IsDBNull(9) ? "" : r[9].ToString();
                    obj.Pivf                  = r.IsDBNull(10) ? "" : r[10].ToString();
                    obj.Module_ID             = r.IsDBNull(11) ? "" : r[11].ToString();
                    obj.PalletNO              = r.IsDBNull(12) ? "" : r[12].ToString();
                    obj.CellDate              = r.IsDBNull(13) ? "" : r[13].ToString();
                    obj.Cellsource            = r.IsDBNull(14) ? "" : r[14].ToString();
                    obj.EqpID                 = r.IsDBNull(15) ? "" : r[15].ToString();
                    obj.IVFilePath            = r.IsDBNull(16) ? "" : r[16].ToString();
                    obj.cell_supplier_country = r.IsDBNull(17) ? "" : r[17].ToString();
                    obj.iec_date              = r.IsDBNull(18) ? "" : r[18].ToString();
                    obj.iec_verfy             = r.IsDBNull(19) ? "" : r[19].ToString();
                    obj.iso                   = r.IsDBNull(20) ? "" : r[20].ToString();
                    obj.mfg_name              = r.IsDBNull(21) ? "" : r[21].ToString();
                    //obj.customer = r.IsDBNull(22) ? "" : r[22].ToString();
                }
                catch (Exception ex)
                {
                    LogHelper.writeErrorLog(m_errLogFileName, ex);
                }
                return(obj);
            });


            mi = miList == null? null: miList.FirstOrDefault();

            if (mi != null)
            {
                mi.b_writenDataBefore = b_writenDataBefore;
            }
#endif

#if MYSQL_LOCALHOST
            dic.Add(sp_parm_serial_no, serial);

            conn = connect_string;

            IEnumerable <ModuleInfo> miList = DBOperation.GetMySqlRowsBySP <ModuleInfo>(conn, "Get_RFID_BasicInfo_V2", dic, r =>
            {
                ModuleInfo obj = new ModuleInfo();
                try
                {
                    obj.ProductType           = r.IsDBNull(0) ? "" : r[0].ToString();
                    obj.ELGrade               = r.IsDBNull(1) ? "" : r[1].ToString();
                    obj.Status                = r.IsDBNull(2) ? "" : r[2].ToString();
                    obj.PackedDate            = r.IsDBNull(3) ? "" : r[3].ToString();
                    obj.Pmax                  = r.IsDBNull(4) ? "" : r[4].ToString();
                    obj.Voc                   = r.IsDBNull(5) ? "" : r[5].ToString();
                    obj.Isc                   = r.IsDBNull(6) ? "" : r[6].ToString();
                    obj.Vpm                   = r.IsDBNull(7) ? "" : r[7].ToString();
                    obj.Ipm                   = r.IsDBNull(8) ? "" : r[8].ToString();
                    obj.FF                    = r.IsDBNull(9) ? "" : r[9].ToString();
                    obj.Pivf                  = r.IsDBNull(10) ? "" : r[10].ToString();
                    obj.Module_ID             = r.IsDBNull(11) ? "" : r[11].ToString();
                    obj.PalletNO              = r.IsDBNull(12) ? "" : r[12].ToString();
                    obj.CellDate              = r.IsDBNull(13) ? "" : r[13].ToString();
                    obj.Cellsource            = r.IsDBNull(14) ? "" : r[14].ToString();
                    obj.EqpID                 = r.IsDBNull(15) ? "" : r[15].ToString();
                    obj.IVFilePath            = r.IsDBNull(16) ? "" : r[16].ToString();
                    obj.cell_supplier_country = r.IsDBNull(17) ? "" : r[17].ToString();
                    obj.iec_date              = r.IsDBNull(18) ? "" : r[18].ToString();
                    obj.iec_verfy             = r.IsDBNull(19) ? "" : r[19].ToString();
                    obj.iso                   = r.IsDBNull(20) ? "" : r[20].ToString();
                    obj.mfg_name              = r.IsDBNull(21) ? "" : r[21].ToString();
                }
                catch (Exception ex)
                {
                    LogHelper.writeErrorLog(m_errLogFileName, ex);
                }
                return(obj);
            });


            mi = miList == null? null: miList.FirstOrDefault();

            if (mi != null)
            {
                mi.b_writenDataBefore = b_writenDataBefore;
            }
#endif

#if MYSQL_CLOUD
            dic.Add(sp_parm_serial_no, serial);

            conn = connect_string;

            IEnumerable <ModuleInfo> miList = DBOperation.GetMySqlRowsBySP <ModuleInfo>(conn, "Get_RFID_BasicInfo_V3", dic, r =>
            {
                ModuleInfo obj = new ModuleInfo();
                try
                {
                    obj.ProductType           = r.IsDBNull(0) ? "" : r[0].ToString();
                    obj.ELGrade               = r.IsDBNull(1) ? "" : r[1].ToString();
                    obj.Status                = r.IsDBNull(2) ? "" : r[2].ToString();
                    obj.PackedDate            = r.IsDBNull(3) ? "" : r[3].ToString();
                    obj.Pmax                  = r.IsDBNull(4) ? "" : r[4].ToString();
                    obj.Voc                   = r.IsDBNull(5) ? "" : r[5].ToString();
                    obj.Isc                   = r.IsDBNull(6) ? "" : r[6].ToString();
                    obj.Vpm                   = r.IsDBNull(7) ? "" : r[7].ToString();
                    obj.Ipm                   = r.IsDBNull(8) ? "" : r[8].ToString();
                    obj.FF                    = r.IsDBNull(9) ? "" : r[9].ToString();
                    obj.Pivf                  = r.IsDBNull(10) ? "" : r[10].ToString();
                    obj.Module_ID             = r.IsDBNull(11) ? "" : r[11].ToString();
                    obj.PalletNO              = r.IsDBNull(12) ? "" : r[12].ToString();
                    obj.CellDate              = r.IsDBNull(13) ? "" : r[13].ToString();
                    obj.Cellsource            = r.IsDBNull(14) ? "" : r[14].ToString();
                    obj.EqpID                 = r.IsDBNull(15) ? "" : r[15].ToString();
                    obj.IVFilePath            = r.IsDBNull(16) ? "" : r[16].ToString();
                    obj.cell_supplier_country = r.IsDBNull(17) ? "" : r[17].ToString();
                    obj.iec_date              = r.IsDBNull(18) ? "" : r[18].ToString();
                    obj.iec_verfy             = r.IsDBNull(19) ? "" : r[19].ToString();
                    obj.iso                   = r.IsDBNull(20) ? "" : r[20].ToString();
                    obj.mfg_name              = r.IsDBNull(21) ? "" : r[21].ToString();
                    obj.customer              = r.IsDBNull(22) ? "" : r[22].ToString();
                }
                catch (Exception ex)
                {
                    LogHelper.writeErrorLog(m_errLogFileName, ex);
                }
                return(obj);
            });


            mi = miList == null? null: miList.FirstOrDefault();

            if (mi != null)
            {
                mi.b_writenDataBefore = b_writenDataBefore;
            }
#endif

            return(mi);
        }
コード例 #3
0
        public ModuleInfo getModuleInfo(object[] parms)
        {
            string serial    = (string)parms[0];
            string uniqueTid = (string)parms[1];

            #region check if this tag has writen data before by unique tid
            bool b_writenDataBefore = false;

            //if (true)
            //{

            //}

            #endregion

            #region get module information
            Dictionary <string, object> dic = new Dictionary <string, object>();

            string dfRS          = "SolarNo";
            string commonVarname = "strModuleID";


            string     conn = "";
            ModuleInfo mi   = null;
            if (m_dbType == DB_Type.MySql)
            {
                dic.Add(commonVarname, serial);

                #region mysql db
                conn = m_mysql_conn;

                IEnumerable <ModuleInfo> miList = DBOperation.GetMySqlRowsBySP <ModuleInfo>(conn, "Get_RFID_BasicInfo", dic, r =>
                {
                    //int i = 0;
                    ModuleInfo obj = new ModuleInfo();
                    try
                    {
                        obj.ProductType = r.IsDBNull(0) ? "" : r.GetString(0);
                        obj.ELGrade     = r.IsDBNull(1) ? "" : r.GetString(1);
                        obj.Status      = r.IsDBNull(2) ? "" : r.GetString(2);
                        obj.PackedDate  = r.IsDBNull(3) ? "0" : r.GetString(3);
                        obj.Pmax        = r.IsDBNull(4) ? "" : r.GetString(4);
                        obj.Voc         = r.IsDBNull(5) ? "" : r.GetString(5);
                        obj.Isc         = r.IsDBNull(6) ? "" : r.GetString(6);
                        obj.Vpm         = r.IsDBNull(7) ? "" : r.GetString(7);
                        obj.Ipm         = r.IsDBNull(8) ? "" : r.GetString(8);
                        obj.Pivf        = r.IsDBNull(9) ? "" : r.GetString(9);
                        obj.Module_ID   = r.IsDBNull(10) ? "" : r.GetString(10);
                        obj.PalletNO    = r.IsDBNull(11) ? "" : r.GetString(11);
                        obj.CellDate    = r.IsDBNull(12) ? "" : r.GetString(12);
                        obj.Cellsource  = r.IsDBNull(13) ? "" : r.GetString(13);
                        obj.EqpID       = r.IsDBNull(14) ? "" : r.GetString(14);
                        obj.IVFilePath  = r.IsDBNull(15) ? "" : r.GetString(15);
                    }
                    catch (Exception ex)
                    {
                        LogHelper.writeErrorLog(m_errLogFileName, ex);
                    }
                    return(obj);
                });
                #endregion

                mi = miList.FirstOrDefault();

                if (mi != null)
                {
                    mi.b_writenDataBefore = b_writenDataBefore;
                }

                return(mi);
            }
            else if (m_dbType == DB_Type.SqlServer)
            {
                dic.Add(dfRS, serial);

                #region sqlserver db
                conn = m_ms_conn1;
                //"Get_RFID_BasicInfo"
                IEnumerable <ModuleInfo> miList = DBOperation.GetMSRowsBySP <ModuleInfo>(conn, "get_rfid_basicInfo_v2", dic, r =>
                {
                    //int i = 0;
                    ModuleInfo obj = new ModuleInfo();
                    try
                    {
                        obj.ProductType = r.IsDBNull(0) ? "" : r.GetString(0);
                        obj.PackedDate  = r.IsDBNull(3) ? "" : r.GetString(3);             //1
                        obj.ELGrade     = r.IsDBNull(1) ? "" : r.GetString(1);             //2
                        obj.Status      = "";
                        obj.Pmax        = r.IsDBNull(4) ? "" : r.GetDecimal(4).ToString(); //3
                        obj.Voc         = r.IsDBNull(5) ? "" : r.GetDecimal(5).ToString(); //4
                        obj.Isc         = r.IsDBNull(6) ? "" : r.GetDecimal(6).ToString(); //5
                        obj.Vpm         = r.IsDBNull(7) ? "" : r.GetDecimal(7).ToString(); //6
                        obj.Ipm         = r.IsDBNull(8) ? "" : r.GetDecimal(8).ToString(); //7
                        obj.Pivf        = r.IsDBNull(8) ? "" : r.GetString(8);
                        obj.Module_ID   = r.IsDBNull(11) ? "" : r.GetString(11);           //9
                        obj.CellDate    = r.IsDBNull(13) ? "" : r.GetString(13);           //10
                        obj.PalletNO    = "";
                        obj.Cellsource  = "";
                        obj.EqpID       = "";
                        obj.IVFilePath  = "";

                        //return obj;
                    }
                    catch (Exception ex)
                    {
                        LogHelper.writeErrorLog(m_errLogFileName, ex);
                    }
                    return(obj);
                });
                #endregion

                mi = miList.FirstOrDefault();
            }
            #endregion

            if (mi != null)
            {
                mi.b_writenDataBefore = b_writenDataBefore;
            }

            return(mi);
        }