예제 #1
0
        public static StorageDoc GetStorageDetail(string docid, string clientid)
        {
            DataSet    ds    = StockDAL.GetStorageDetail(docid, clientid);
            StorageDoc model = new StorageDoc();

            if (ds.Tables.Contains("Doc") && ds.Tables["Doc"].Rows.Count > 0)
            {
                model.FillData(ds.Tables["Doc"].Rows[0]);
                model.CreateUser = OrganizationBusiness.GetUserByUserID(model.CreateUserID, clientid);
                model.StatusStr  = GetDocStatusStr(model.DocType, model.Status);

                model.DocTypeStr = CommonBusiness.GetEnumDesc <EnumDocType>((EnumDocType)model.DocType);

                model.WareHouse = SystemBusiness.BaseBusiness.GetWareByID(model.WareID, model.ClientID);
                model.Details   = new List <StorageDetail>();
                foreach (DataRow item in ds.Tables["Details"].Rows)
                {
                    StorageDetail details = new StorageDetail();
                    details.FillData(item);
                    model.Details.Add(details);
                }
            }

            return(model);
        }
예제 #2
0
        public static List <StorageDoc> GetStorageDocDetails(string docid, string clientid)
        {
            DataSet ds = StockDAL.BaseProvider.GetStorageDocDetails(docid);

            List <StorageDoc> list = new List <StorageDoc>();

            foreach (DataRow dr in ds.Tables["Doc"].Rows)
            {
                StorageDoc model = new StorageDoc();
                model.FillData(dr);

                List <StorageDetail> details = new List <StorageDetail>();
                foreach (DataRow detailDR in ds.Tables["Details"].Select("DocID = '" + model.DocID + "'"))
                {
                    StorageDetail detail = new StorageDetail();
                    detail.FillData(detailDR);
                    details.Add(detail);
                }
                model.Details = details;
                var user = OrganizationBusiness.GetUserByUserID(model.CreateUserID, clientid);
                model.UserName = user != null ? user.Name : "";

                list.Add(model);
            }
            return(list);
        }
예제 #3
0
        public static List <StorageDoc> GetStorageDocList(string userid, EnumDocType type, EnumDocStatus status, string keywords, string begintime, string endtime, string wareid, string providerid, int pageSize, int pageIndex, ref int totalCount, ref int pageCount, string clientID)
        {
            DataSet ds = StockDAL.GetStorageDocList(userid, (int)type, (int)status, keywords, begintime, endtime, wareid, providerid, pageSize, pageIndex, ref totalCount, ref pageCount, clientID);

            List <StorageDoc> list = new List <StorageDoc>();

            foreach (DataRow dr in ds.Tables[0].Rows)
            {
                StorageDoc model = new StorageDoc();
                model.FillData(dr);
                model.UserName  = OrganizationBusiness.GetUserByUserID(model.CreateUserID, clientID).Name;
                model.StatusStr = GetDocStatusStr(model.DocType, model.Status);

                model.Details = new List <StorageDetail>();
                if (ds.Tables.Contains("Details"))
                {
                    foreach (DataRow detail in ds.Tables["Details"].Select("DocID='" + model.DocID + "'"))
                    {
                        StorageDetail dModel = new StorageDetail();
                        dModel.FillData(detail);
                        if ((int)type == 3 || (int)type == 4)
                        {
                            if (!string.IsNullOrEmpty(dModel.DepotID) && !string.IsNullOrEmpty(dModel.WareID))
                            {
                                dModel.DepotCode = SystemBusiness.BaseBusiness.GetDepotByID(dModel.DepotID, dModel.WareID, clientID).DepotCode;
                            }
                        }
                        model.Details.Add(dModel);
                    }
                }

                list.Add(model);
            }
            return(list);
        }
예제 #4
0
        /// <summary>
        /// 获取单据列表
        /// </summary>
        /// <param name="userid">创建人(拥有者)</param>
        /// <param name="type">类型</param>
        /// <param name="status">状态</param>
        /// <param name="keywords">关键词</param>
        /// <param name="pageSize">页Size</param>
        /// <param name="pageIndex">页码</param>
        /// <param name="totalCount">总数</param>
        /// <param name="pageCount"><总页/param>
        /// <param name="clientID">客户端ID</param>
        /// <returns></returns>
        public static List <StorageDoc> GetStorageDocList(string userid, EnumDocType type, EnumDocStatus status, string keywords, int pageSize, int pageIndex, ref int totalCount, ref int pageCount, string clientID)
        {
            DataSet ds = OrdersDAL.GetStorageDocList(userid, (int)type, (int)status, keywords, pageSize, pageIndex, ref totalCount, ref pageCount, clientID);

            List <StorageDoc> list = new List <StorageDoc>();

            foreach (DataRow dr in ds.Tables[0].Rows)
            {
                StorageDoc model = new StorageDoc();
                model.FillData(dr);
                model.CreateUser = OrganizationBusiness.GetUserByUserID(model.CreateUserID, clientID);
                model.StatusStr  = GetDocStatusStr(model.DocType, model.Status);

                list.Add(model);
            }
            return(list);
        }
예제 #5
0
        /// <summary>
        /// 创建单据
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public static string CreateStorageDoc(StorageDoc model, string userid, string operateip, string clientid)
        {
            string        docid = Guid.NewGuid().ToString();
            SqlConnection conn  = new SqlConnection(OrdersDAL.ConnectionString);

            conn.Open();
            SqlTransaction tran = conn.BeginTransaction();

            try
            {
                bool bl = OrdersDAL.AddStorageDoc(docid, model.DocType, model.TotalMoney, model.CityCode, model.Address, model.Remark, userid, operateip, clientid, tran);
                if (bl)
                {
                    //单据明细
                    foreach (var detail in model.Details)
                    {
                        if (!OrdersDAL.AddStorageDocDetail(docid, detail.AutoID, detail.ProductDetailID, detail.Quantity, detail.Price, detail.TotalMoney, detail.BatchCode, clientid, tran))
                        {
                            tran.Rollback();
                            conn.Dispose();
                            return("");
                        }
                    }
                    tran.Commit();
                    conn.Dispose();
                    return(docid);
                }
                else
                {
                    tran.Rollback();
                    conn.Dispose();
                    return("");
                }
            }
            catch (Exception ex)
            {
                tran.Rollback();
                conn.Dispose();
                return("");
            }
        }
예제 #6
0
        public static List <StorageDoc> GetStorageDocList(string userid, EnumDocType type, EnumDocStatus status, string keywords, string begintime, string endtime, string wareid, string providerid, int pageSize, int pageIndex, ref int totalCount, ref int pageCount, string clientID)
        {
            DataSet ds = StockDAL.GetStorageDocList(userid, (int)type, (int)status, keywords, begintime, endtime, wareid, providerid, pageSize, pageIndex, ref totalCount, ref pageCount, clientID);

            List <StorageDoc> list = new List <StorageDoc>();

            foreach (DataRow dr in ds.Tables[0].Rows)
            {
                StorageDoc model = new StorageDoc();
                model.FillData(dr);
                model.CreateUser = OrganizationBusiness.GetUserByUserID(model.CreateUserID, clientID);
                model.StatusStr  = GetDocStatusStr(model.DocType, model.Status);
                model.WareHouse  = SystemBusiness.BaseBusiness.GetWareByID(model.WareID, model.ClientID);
                if (!string.IsNullOrEmpty(model.ProviderID))
                {
                    model.ProviderName = BaseBusiness.GetProviderByID(model.ProviderID).Name;
                }

                list.Add(model);
            }
            return(list);
        }
예제 #7
0
        /// <summary>
        /// 获取单据详情
        /// </summary>
        /// <param name="docid">单据ID</param>
        /// <param name="clientid">客户端ID</param>
        /// <returns></returns>
        public static StorageDoc GetStorageDetail(string docid, string clientid)
        {
            DataSet    ds    = OrdersDAL.GetStorageDetail(docid, clientid);
            StorageDoc model = new StorageDoc();

            if (ds.Tables.Contains("Doc") && ds.Tables["Doc"].Rows.Count > 0)
            {
                model.FillData(ds.Tables["Doc"].Rows[0]);
                model.CreateUser = OrganizationBusiness.GetUserByUserID(model.CreateUserID, clientid);
                model.StatusStr  = GetDocStatusStr(model.DocType, model.Status);

                model.Details = new List <StorageDetail>();
                foreach (DataRow item in ds.Tables["Details"].Rows)
                {
                    StorageDetail details = new StorageDetail();
                    details.FillData(item);
                    model.Details.Add(details);
                }
            }

            return(model);
        }
예제 #8
0
        public static StorageDoc GetStorageDetail(string docid, string clientid)
        {
            DataSet    ds    = StockDAL.GetStorageDetail(docid, clientid);
            StorageDoc model = new StorageDoc();

            if (ds.Tables.Contains("Doc") && ds.Tables["Doc"].Rows.Count > 0)
            {
                model.FillData(ds.Tables["Doc"].Rows[0]);
                model.CreateUser = OrganizationBusiness.GetUserByUserID(model.CreateUserID, clientid);
                model.StatusStr  = GetDocStatusStr(model.DocType, model.Status);

                model.DocTypeStr = CommonBusiness.GetEnumDesc <EnumDocType>((EnumDocType)model.DocType);

                if (!string.IsNullOrEmpty(model.ExpressID))
                {
                    model.Express = ExpressCompanyBusiness.GetExpressCompanyDetail(model.ExpressID);
                }

                model.WareHouse = SystemBusiness.BaseBusiness.GetWareByID(model.WareID, model.ClientID);
                model.Details   = new List <StorageDetail>();
                foreach (DataRow item in ds.Tables["Details"].Rows)
                {
                    StorageDetail details = new StorageDetail();
                    details.FillData(item);
                    if (!string.IsNullOrEmpty(details.UnitID))
                    {
                        details.UnitName = new ProductsBusiness().GetUnitByID(details.UnitID).UnitName;
                    }
                    if (!string.IsNullOrEmpty(details.ProviderID))
                    {
                        details.Providers = new ProvidersBusiness().GetProviderByID(details.ProviderID);
                    }
                    model.Details.Add(details);
                }
            }

            return(model);
        }