Пример #1
0
 public ActionResult Audit(string StorageNum, string IsForbid)
 {
     StorageProvider provider = new StorageProvider();
     StorageEntity entity = new StorageEntity();
     entity.IncludeIsForbid(true);
     entity.IsForbid = ConvertHelper.ToType<int>(IsForbid);
     entity.Where(a => a.StorageNum == StorageNum);
     int line = provider.Update(entity);
     if (line > 0)
     {
         this.ReturnJson.AddProperty("d", "success");
     }
     else
     {
         this.ReturnJson.AddProperty("d", "");
     }
     return Content(this.ReturnJson.ToString());
 }
Пример #2
0
 public static Storage_CE ToCE(StorageEntity item)
 {
     Storage_CE target = new Storage_CE();
     target.ID=item.ID;
     target.StorageNum=item.StorageNum;
     target.StorageName=item.StorageName;
     target.StorageType=item.StorageType;
     target.Length=item.Length;
     target.Width=item.Width;
     target.Height=item.Height;
     target.Action=item.Action;
     target.IsDelete=item.IsDelete;
     target.Status=item.Status;
     target.IsForbid=item.IsForbid;
     target.IsDefault=item.IsDefault;
     target.CreateTime=item.CreateTime;
     target.Remark=item.Remark;
     return target;
 }
Пример #3
0
 /// <summary>
 /// 注册仓库
 /// </summary>
 /// <param name="entity"></param>
 /// <returns></returns>
 public int Add(StorageEntity entity)
 {
     //如果是默认仓库
     if (entity.IsDefault == (int)EBool.Yes)
     {
         StorageEntity temp = new StorageEntity();
         temp.Where(a => a.IsDefault == (int)EBool.Yes);
         if (this.Storage.GetCount(temp) > 0)
         {
             temp = new StorageEntity();
             temp.IsDefault = (int)EBool.No;
             temp.IncludeIsDefault(true);
             temp.Where(a => a.IsDefault == (int)EBool.Yes);
             this.Storage.Update(temp);
         }
     }
     entity.IncludeAll();
     int line = this.Storage.Add(entity);
     if (line > 0)
     {
         Clear();
     }
     return line;
 }
Пример #4
0
        public ActionResult ToExcel()
        {
            PageInfo pageInfo = new Git.Framework.DataTypes.PageInfo() { PageIndex = 1, PageSize = Int32.MaxValue };
            string StorageNum = WebUtil.GetFormValue<string>("StorageName", string.Empty);
            string LocalName = WebUtil.GetFormValue<string>("LocalName", string.Empty);
            string LocalType = WebUtil.GetFormValue<string>("LocalType", string.Empty);
            LocationProvider provider = new LocationProvider();
            LocationEntity entity = new LocationEntity();

            StorageEntity SEntity = new StorageEntity();
            SEntity.Include(a => new { StorageName = a.StorageName });
            entity.Left<StorageEntity>(SEntity, new Params<string, string>() { Item1 = "StorageNum", Item2 = "StorageNum" });
            if (!StorageNum.IsEmpty())
            {
                entity.Where<LocationEntity>("StorageNum", ECondition.Like, "%" + StorageNum + "%");
            }
            if (!LocalName.IsEmpty())
            {
                entity.Begin<LocationEntity>()
                    .Where<LocationEntity>("LocalName", ECondition.Like, "%" + LocalName + "%")
                    .Or<LocationEntity>("LocalNum", ECondition.Like, "%" + LocalName + "%")
                    .Or<LocationEntity>("LocalBarCode", ECondition.Like, "%" + LocalName + "%")
                    .End<LocationEntity>()
                    ;
            }
            if (!LocalType.IsEmpty())
            {
                entity.Where<LocationEntity>("LocalType", ECondition.Like, "%" + LocalType + "%");
            }
            List<LocationEntity> listResult = provider.GetList(entity, ref pageInfo);
            listResult = listResult.IsNull() ? new List<LocationEntity>() : listResult;
            if (listResult.IsNotNull())
            {
                DataTable dt = new DataTable();
                dt.Columns.Add(new DataColumn("序号 "));
                dt.Columns.Add(new DataColumn("库位编号 "));
                dt.Columns.Add(new DataColumn("库位名 "));
                dt.Columns.Add(new DataColumn("所在仓库 "));
                dt.Columns.Add(new DataColumn("库位类型"));
                dt.Columns.Add(new DataColumn("是否禁用"));
                dt.Columns.Add(new DataColumn("是否默认"));
                dt.Columns.Add(new DataColumn("创建时间"));
                int count = 1;
                foreach (LocationEntity t in listResult)
                {
                    DataRow row = dt.NewRow();
                    row[0] = count;
                    row[1] = t.LocalNum;
                    row[2] = t.LocalName;
                    row[3] = t.StorageName;
                    row[4] = EnumHelper.GetEnumDesc<ELocalType>(t.LocalType);
                    row[5] = EnumHelper.GetEnumDesc<EBool>(t.IsForbid);
                    row[6] = EnumHelper.GetEnumDesc<EBool>(t.IsDefault);
                    row[7] = t.CreateTime.ToString("yyyy-MM-dd");
                    dt.Rows.Add(row);
                    count++;
                }
                string filePath = Server.MapPath("~/UploadFiles/");
                if (!System.IO.Directory.Exists(filePath))
                {
                    System.IO.Directory.CreateDirectory(filePath);
                }
                string filename = string.Format("库位管理{0}.xls", DateTime.Now.ToString("yyyyMMddHHmmss"));
                NPOIExcel excel = new NPOIExcel("库位管理", "库位", System.IO.Path.Combine(filePath, filename));
                excel.ToExcel(dt);
                this.ReturnJson.AddProperty("Path", ("/UploadFiles/" + filename).Escape());
            }
            else
            {
                this.ReturnJson.AddProperty("d", "无数据导出!");
            }
            return Content(this.ReturnJson.ToString());
        }
Пример #5
0
        public ActionResult GetList()
        {
            int pageIndex = WebUtil.GetFormValue<int>("pageIndex", 1);
            int pageSize = WebUtil.GetFormValue<int>("pageSize", 15);
            string LocalName = WebUtil.GetFormValue<string>("LocalName", string.Empty);
            string LocalType = WebUtil.GetFormValue<string>("LocalType", string.Empty);
            PageInfo pageInfo = new PageInfo() { PageIndex = pageIndex, PageSize = pageSize };
            LocationProvider provider = new LocationProvider();
            LocationEntity entity = new LocationEntity();
            StorageEntity SEntity = new StorageEntity();
            SEntity.Include(a => new { StorageName = a.StorageName });
            entity.Left<StorageEntity>(SEntity, new Params<string, string>() { Item1 = "StorageNum", Item2 = "StorageNum" });
            string StorageNum = this.DefaultStore;
            entity.Where<LocationEntity>("StorageNum", ECondition.Eth, StorageNum);
            if (!LocalName.IsEmpty())
            {
                entity.Begin<LocationEntity>()
                    .Where<LocationEntity>("LocalName", ECondition.Like, "%" + LocalName + "%")
                    .Or<LocationEntity>("LocalNum", ECondition.Like, "%" + LocalName + "%")
                    .Or<LocationEntity>("LocalBarCode", ECondition.Like, "%" + LocalName + "%")
                    .End<LocationEntity>()
                    ;
            }
            if (!LocalType.IsEmpty())
            {
                entity.Where<LocationEntity>("LocalType", ECondition.Eth, LocalType);
            }

            List<LocationEntity> listResult = provider.GetList(entity, ref pageInfo);
            string json = ConvertJson.ListToJson<LocationEntity>(listResult, "List");
            this.ReturnJson.AddProperty("Data", new JsonObject(json));
            this.ReturnJson.AddProperty("RowCount", pageInfo.RowCount);
            return Content(this.ReturnJson.ToString());
        }
Пример #6
0
        public ActionResult ToExcel()
        {
            string StorageName = WebUtil.GetFormValue<string>("StorageName", string.Empty);
            int StorageType = WebUtil.GetFormValue<int>("StorageType", -1);
            int IsForbid = WebUtil.GetFormValue<int>("IsForbid", -1);
            PageInfo pageInfo = new Git.Framework.DataTypes.PageInfo() { PageIndex = 1, PageSize = Int32.MaxValue };
            StorageProvider provider = new StorageProvider();
            StorageEntity entity = new StorageEntity();
            if (IsForbid > -1)
            {
                entity.Where<StorageEntity>("IsForbid", ECondition.Eth, IsForbid);
            }
            if (StorageType > -1)
            {
                entity.Where<StorageEntity>("StorageType", ECondition.Eth, StorageType);
            }
            if (!StorageName.IsEmpty())
            {
                entity.Begin<StorageEntity>()
                    .Where<StorageEntity>("StorageName", ECondition.Like, "%" + StorageName + "%")
                    .Or<StorageEntity>("StorageNum", ECondition.Like, "%" + StorageName + "%")
                    .End<StorageEntity>()
                    ;
            }
            List<StorageEntity> listResult = provider.GetList(entity, ref pageInfo);
            listResult = listResult.IsNull() ? new List<StorageEntity>() : listResult;
            if (listResult.IsNotNull())
            {
                DataTable dt = new DataTable();
                dt.Columns.Add(new DataColumn("序号 "));
                dt.Columns.Add(new DataColumn("仓库编号 "));
                dt.Columns.Add(new DataColumn("仓库名 "));
                dt.Columns.Add(new DataColumn("仓库类型 "));
                dt.Columns.Add(new DataColumn("是否禁用"));
                dt.Columns.Add(new DataColumn("是否默认"));
                dt.Columns.Add(new DataColumn("备注"));
                dt.Columns.Add(new DataColumn("创建时间"));
                int count = 1;
                foreach (StorageEntity t in listResult)
                {
                    DataRow row = dt.NewRow();
                    row[0] = count;
                    row[1] = t.StorageNum;
                    row[2] = t.StorageName;
                    row[3] = EnumHelper.GetEnumDesc<EStorageType>(t.StorageType);
                    row[4] = EnumHelper.GetEnumDesc<EBool>(t.IsForbid);
                    row[5] = EnumHelper.GetEnumDesc<EBool>(t.IsDefault);
                    row[6] = t.Remark;
                    row[7] = t.CreateTime.ToString("yyyy-MM-dd");
                    dt.Rows.Add(row);
                    count++;
                }
                string filePath = Server.MapPath("~/UploadFiles/");
                if (!System.IO.Directory.Exists(filePath))
                {
                    System.IO.Directory.CreateDirectory(filePath);
                }
                string filename = string.Format("仓库管理{0}.xls", DateTime.Now.ToString("yyyyMMddHHmmss"));
                NPOIExcel excel = new NPOIExcel("仓库管理", "仓库", System.IO.Path.Combine(filePath, filename));
                excel.ToExcel(dt);
                this.ReturnJson.AddProperty("Path", ("/UploadFiles/" + filename).Escape());

            }
            else
            {
                this.ReturnJson.AddProperty("d", "无数据导出!");
            }
            return Content(this.ReturnJson.ToString());
        }
Пример #7
0
 public ActionResult GetList()
 {
     int pageIndex = WebUtil.GetFormValue<int>("pageIndex", 1);
     int pageSize = WebUtil.GetFormValue<int>("pageSize", 10);
     string StorageName = WebUtil.GetFormValue<string>("StorageName", string.Empty);
     int StorageType = WebUtil.GetFormValue<int>("StorageType", -1);
     int IsForbid = WebUtil.GetFormValue<int>("IsForbid", -1);
     PageInfo pageInfo = new PageInfo() { PageIndex = pageIndex, PageSize = pageSize };
     StorageProvider provider = new StorageProvider();
     StorageEntity entity = new StorageEntity();
     if (IsForbid > -1)
     {
         entity.Where<StorageEntity>("IsForbid", ECondition.Eth, IsForbid);
     }
     if (StorageType > -1)
     {
         entity.Where<StorageEntity>("StorageType", ECondition.Eth, StorageType);
     }
     if (!StorageName.IsEmpty())
     {
         entity.Begin<StorageEntity>()
             .Where<StorageEntity>("StorageName", ECondition.Like, "%" + StorageName + "%")
             .Or<StorageEntity>("StorageNum", ECondition.Like, "%" + StorageName + "%")
             .End<StorageEntity>()
             ;
     }
     List<StorageEntity> listResult = provider.GetList(entity, ref pageInfo);
     string json = ConvertJson.ListToJson<StorageEntity>(listResult, "List");
     this.ReturnJson.AddProperty("Data", new JsonObject(json));
     this.ReturnJson.AddProperty("RowCount", pageInfo.RowCount);
     return Content(this.ReturnJson.ToString());
 }
Пример #8
0
 /// <summary>
 /// 删除仓库信息
 /// </summary>
 /// <param name="storageNum"></param>
 /// <returns></returns>
 public int Delete(string storageNum)
 {
     StorageEntity entity = new StorageEntity();
     entity.IsDelete = (int)EIsDelete.Deleted;
     entity.IncludeIsDelete(true);
     entity.Where(a => a.StorageNum == storageNum);
     int line = this.Storage.Update(entity);
     if (line > 0)
     {
         Clear();
     }
     return line;
 }
Пример #9
0
 /// <summary>
 /// 设置仓库的禁用和启用状态
 /// </summary>
 /// <param name="storageNum"></param>
 /// <param name="isForbid"></param>
 /// <returns></returns>
 public int SetForbid(string storageNum, EBool isForbid)
 {
     StorageEntity entity = new StorageEntity();
     entity.IsDefault = (int)isForbid;
     entity.IncludeIsDefault(true);
     entity.Where(a => a.StorageNum == storageNum);
     int line = this.Storage.Update(entity);
     return line;
 }
Пример #10
0
        /// <summary>
        /// 设置某个仓库为默认仓库值
        /// </summary>
        /// <param name="sotrageNum"></param>
        /// <returns></returns>
        public int SetDefault(string sotrageNum)
        {
            StorageEntity entity = new StorageEntity();
            entity.IsDefault = (int)EBool.No;
            entity.IncludeIsDefault(true);
            int line = this.Storage.Update(entity);

            entity = new StorageEntity();
            entity.IsDefault = (int)EBool.Yes;
            entity.IncludeIsDefault(true);
            entity.Where(a => a.StorageNum == sotrageNum);
            line += this.Storage.Update(entity);

            if (line > 0)
            {
                Clear();
            }
            return line;
        }
Пример #11
0
 /// <summary>
 /// 根据仓库编码查询仓库信息
 /// </summary>
 /// <param name="storageNum"></param>
 /// <returns></returns>
 public StorageEntity GetSingleByNum(string storageNum)
 {
     StorageEntity entity = new StorageEntity();
     entity.IncludeAll();
     entity.Where(a => a.StorageNum == storageNum);
     entity = this.Storage.GetSingle(entity);
     return entity;
 }
Пример #12
0
 /// <summary>
 /// 查询分页
 /// </summary>
 /// <param name="pageInfo"></param>
 /// <returns></returns>
 public List<StorageEntity> GetList(StorageEntity entity, ref PageInfo pageInfo)
 {
     try
     {
         entity.IncludeAll();
         entity.Where(a => a.IsDelete == (int)EIsDelete.NotDelete);
         entity.OrderBy(a => a.ID, EOrderBy.DESC);
         int rowCount = 0;
         List<StorageEntity> listResult = this.Storage.GetList(entity, pageInfo.PageSize, pageInfo.PageIndex, out rowCount);
         pageInfo.RowCount = rowCount;
         return listResult;
     }
     catch
     {
         return null;
     }
 }
Пример #13
0
 /// <summary>
 /// 查询所有的仓库数据信息
 /// </summary>
 /// <returns></returns>
 public List<StorageEntity> GetList()
 {
     StorageEntity entity = new StorageEntity();
     entity.IncludeAll();
     entity.Where(a => a.IsDelete == (int)EIsDelete.NotDelete);
     List<StorageEntity> listResult = this.Storage.GetList();
     return listResult;
 }