/// <summary> /// 获取全部箱子 /// </summary> /// <returns></returns> public List <Box> GetBoxs() { DataTable table = null; LoggingData data = new LoggingData(ip, username, password, database); table = data.GetBoxs(); if (table == null) { CLog4net.LogError("柜子表初始化错误"); return(null); } List <Box> boxes = new List <Box>(); foreach (System.Data.DataRow d in table.Rows) { Box cb = new Box(); cb.Id = Convert.ToInt32(d[TbBox.id]); cb.Code = Convert.ToInt32(d[TbBox.code]); Box.Coordinate location = new Box.Coordinate(); location.X = Convert.ToInt32(d[TbBox.locationX]); location.Y = Convert.ToInt32(d[TbBox.locationY]); cb.CoordinateInfo = location; cb.CurrentState = (Box.State)Convert.ToByte(d[TbBox.state]); cb.IsIdle = Convert.ToBoolean(d[TbBox.idle]); cb.ThisSize = (Box.Size)Convert.ToByte(d[TbBox.size]); cb.RemarkInfo = Convert.ToString(d[TbBox.remark]); boxes.Add(cb); } return(boxes); }