public static ShelfOnInfo GetShelfOnInfo()
 {
     try
     {
         myCon.Open();
         string          sql             = "SELECT sp.ProductName,GROUP_CONCAT(tid),COUNT(1) FROM StockProducts sp WHERE sp.ProductState='已入库' GROUP BY sp.ProductName ";
         MySqlCommand    mySqlCommand    = new MySqlCommand(sql, myCon);
         MySqlDataReader mySqlDataReader = mySqlCommand.ExecuteReader();
         ShelfOnInfo     shelfOnInfo     = new ShelfOnInfo();
         while (mySqlDataReader.Read())
         {
             if (mySqlDataReader.HasRows)
             {
                 Productinfo productinfo = new Productinfo
                 {
                     ProductName = mySqlDataReader[0].ToString(),
                     tids        = mySqlDataReader[1].ToString().Split(new char[1] {
                         ','
                     }).ToList(),
                     Count = mySqlDataReader[2].ToString()
                 };
                 shelfOnInfo.productinfos.Add(productinfo);
             }
         }
         mySqlDataReader.Close();
         string          sql2             = "SELECT shelfcode,shelflocation from ShelfCodePositionCorrespondence WHERE ShelfState='无货物'";
         MySqlCommand    mySqlCommand2    = new MySqlCommand(sql2, myCon);
         MySqlDataReader mySqlDataReader2 = mySqlCommand2.ExecuteReader();
         while (mySqlDataReader2.Read())
         {
             if (mySqlDataReader2.HasRows)
             {
                 ShelfCode shelfCode = new ShelfCode
                 {
                     shelfcode     = mySqlDataReader2[0].ToString(),
                     shelflocation = mySqlDataReader2[1].ToString(),
                 };
                 shelfOnInfo.ShelfCodes.Add(shelfCode);
             }
         }
         mySqlDataReader2.Close();
         return(shelfOnInfo);
     }
     catch (Exception ex)
     {
         LogHelper.WriteLog("查询失败", ex);
         return(null);
     }
     finally
     {
         myCon.Close();
     }
 }
 public static List <ShelfCode> GetShelfCodes(string productname)
 {
     try
     {
         myCon.Open();
         string           sql2             = string.Format("SELECT shelfcode,shelflocation,Tids from ShelfCodePositionCorrespondence WHERE ShelfState='已上架' and productname='{0}'", productname);
         MySqlCommand     mySqlCommand2    = new MySqlCommand(sql2, myCon);
         MySqlDataReader  mySqlDataReader2 = mySqlCommand2.ExecuteReader();
         List <ShelfCode> shelfCodes       = new List <ShelfCode>();
         while (mySqlDataReader2.Read())
         {
             if (mySqlDataReader2.HasRows)
             {
                 ShelfCode shelfCode = new ShelfCode
                 {
                     shelfcode     = mySqlDataReader2[0].ToString(),
                     shelflocation = mySqlDataReader2[1].ToString(),
                     tids          = mySqlDataReader2[2].ToString().Split(new char[1] {
                         ','
                     }).ToList()
                 };
                 shelfCodes.Add(shelfCode);
             }
         }
         mySqlDataReader2.Close();
         return(shelfCodes);
     }
     catch (Exception ex)
     {
         LogHelper.WriteLog("查询失败", ex);
         return(null);
     }
     finally
     {
         myCon.Close();
     }
 }