using WMS.Core;
using WMS.Util;
using System.Data;
using Microsoft.AspNetCore.Mvc;using WMS.BZWeb;
using WMS.Info;
namespace WMS.BZWeb
{
///
/// 描 述:库区管理
///
[Area("BaseManager")]
public class BaseDataController : MvcControllerBase
{
private BaseData bll = new BaseData();
///
/// 主页面
///
///
[HttpGet]
public ActionResult Index()
{
return View();
}
///
/// 表单页
///
///
[HttpGet]
public ActionResult Form()
{
return View();
}
///
/// 获取列表数据
///
///
[HttpGet]
////[AjaxOnly]
public ActionResult QueryList(string keyword)
{
var data = bll.QueryList(keyword);
return Success("", data);
}
///
/// 获取列表数据
///
///
[HttpGet]
////[AjaxOnly]
public ActionResult GetList(string keyword)
{
var data = bll.GetList(keyword);
return Success("", data);
}
///
/// 获取功能列表的树形数据(只有展开项)
///
///
[HttpGet]
////[AjaxOnly]
public ActionResult GetExpendModuleTree()
{
var data = bll.GetExpendTree();
return this.Success("", data);
}
///
/// 获取分页数据
///
/// 分页参数
/// 查询关键字
///
[HttpGet]
////[AjaxOnly]
public ActionResult GetPageList(string pagination, string keyword,string unitGrpId)
{
Pagination paginationobj = InitPagination(pagination);
return ToPageDataResult(paginationobj, bll.GetPageList(keyword, unitGrpId, paginationobj));
}
///
/// 获取表单数据
/// 主键
///
///
[HttpGet]
////[AjaxOnly]
public ActionResult GetFormData(string keyValue)
{
var data = bll.GetEntity(keyValue);
return Success("", data);
}
///
/// 删除实体数据
/// 主键
///
///
[HttpPost]
////[AjaxOnly]
public ActionResult DeleteForm(string keyValue)
{
bll.DeleteEntity(keyValue);
return Success("删除成功。");
}
///
/// 保存实体数据(新增、修改)
/// 主键
///
///
[HttpPost]
[ValidateAntiForgeryToken]
////[AjaxOnly]
public ActionResult SaveForm(string keyValue, BASE_DATA entity)
{
LoginUserInfo LoginUser = LoginBLLCore.GetLoginUser();
bll.SaveEntity(LoginUser, keyValue, entity);
return Success("保存成功!");
}
///
/// 获取映射数据
///
///
[HttpGet]
////[AjaxOnly]
public ActionResult GetMap(string ver)
{
var data = bll.GetMap();
string md5 = SecurityUtil.MD5(data.ToJson(), 32);
if (md5 == ver)
{
return Success("no update");
}
else
{
var jsondata = new
{
data = data,
ver = md5
};
return Success("", jsondata);
}
}
///
/// 获取映射数据
///
///
[HttpGet]
////[AjaxOnly]
public ActionResult GetMapByWhere(string ver, string KeyW, string KeyV)
{
var data = bll.GetMap(KeyW, KeyV);
string md5 = SecurityUtil.MD5(data.ToJson(), 32);
if (md5 == ver)
{
return Success("no update");
}
else
{
var jsondata = new
{
data = data,
ver = md5
};
return Success("", jsondata);
}
}
///
/// 获取树形数据
///
/// 父级id
///
[HttpGet]
////[AjaxOnly]
public ActionResult GetTree(string parentId)
{
var data = bll.GetTree(parentId);
return Success("",data);
}
}
}