Ejemplo n.º 1
0
        /// <summary>
        /// 获取未生成交接单的箱主信息和明细信息
        /// </summary>
        /// <returns></returns>
        public static List <PBBoxInfo> GetUnGenerateBoxListWithDetail()
        {
            List <PBBoxInfo> result = null;
            string           sql    = @"SELECT * FROM dbo.PBBox WHERE IsGenerate=0

                            SELECT * FROM dbo.PBBoxDetail WHERE HU IN(SELECT HU FROM dbo.PBBox WHERE IsGenerate = 0)";
            DataSet          ds     = DBHelper.GetDataSet(sql, false);

            if (ds != null && ds.Tables.Count == 2)
            {
                DataTable dtBox       = ds.Tables[0];
                DataTable dtBoxDetail = ds.Tables[1];
                if (dtBox.Rows.Count > 0)
                {
                    result = new List <PBBoxInfo>();
                    foreach (DataRow row in dtBox.Rows)
                    {
                        PBBoxInfo item = PBBoxInfo.BuildPBBoxInfo(row);
                        if (dtBoxDetail != null && dtBoxDetail.Rows.Count > 0)
                        {
                            DataRow[] detailRows = dtBoxDetail.Select(string.Format("HU='{0}'", item.HU));
                            if (detailRows != null && detailRows.Length > 0)
                            {
                                foreach (DataRow detailRow in detailRows)
                                {
                                    item.Details.Add(PBBoxDetailInfo.BuildPBBoxDetailInfo(detailRow));
                                }
                            }
                        }
                        result.Add(item);
                    }
                }
            }
            return(result);
        }
Ejemplo n.º 2
0
        public static PBBoxInfo GetBoxByHu(string hu)
        {
            PBBoxInfo result = new PBBoxInfo();
            string    sql    = string.Format(@"select * from PBBox WHERE HU='{0}'
SELECT * FROM PBBoxDetail WHERE HU = '{0}'", hu);

            DataSet ds = DBHelper.GetDataSet(sql, false);

            if (ds != null && ds.Tables.Count == 2)
            {
                DataTable boxTable = ds.Tables[0];
                if (boxTable != null && boxTable.Rows.Count > 0)
                {
                    result = PBBoxInfo.BuildPBBoxInfo(boxTable.Rows[0]);
                }
                else
                {
                    return(null);
                }
                DataTable detailTable = ds.Tables[1];
                if (detailTable != null && detailTable.Rows.Count > 0)
                {
                    foreach (DataRow row in detailTable.Rows)
                    {
                        result.Details.Add(PBBoxDetailInfo.BuildPBBoxDetailInfo(row));
                    }
                }
            }

            return(result);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 获取需要生成交接单的所有箱主信息
        /// </summary>
        /// <returns></returns>
        public static List <PBBoxInfo> GetNeedGenerateBoxListWithoutDetail()
        {
            List <PBBoxInfo> result = null;
            string           sql    = @"SELECT * FROM dbo.PBBox WHERE IsGenerate=0";
            DataTable        dt     = DBHelper.GetTable(sql, false);

            if (dt != null && dt.Rows.Count > 0)
            {
                result = new List <PBBoxInfo>();
                foreach (DataRow row in dt.Rows)
                {
                    PBBoxInfo item = PBBoxInfo.BuildPBBoxInfo(row);
                    result.Add(item);
                }
            }

            return(result);
        }