using System;
using Learun.Util;
using System.Data;
using Learun.Application.TwoDevelopment.AssetManagementSystem;
using System.Web.Mvc;
using System.Collections.Generic;
namespace Learun.Application.Web.Areas.AssetManagementSystem.Controllers
{
///
/// 版 本 Learun-ADMS-Ultimate V7.0.0 力软敏捷开发框架
/// Copyright (c) 2013-2018 上海力软信息技术有限公司
/// 创 建:超级管理员
/// 日 期:2019-09-10 16:19
/// 描 述:资产盘点
///
public class Ass_InventoryController : MvcControllerBase
{
private Ass_InventoryIBLL ass_InventoryIBLL = new Ass_InventoryBLL();
private Ass_InventoryItemApplyIBLL ass_InventoryItemApplyIBLL = new Ass_InventoryItemApplyBLL();
#region 视图功能
///
/// 主页面
///
///
[HttpGet]
public ActionResult Index()
{
return View();
}
///
/// 表单页
///
///
[HttpGet]
public ActionResult Form()
{
ViewBag.ITNo = "PD_" + CommonHelper.CreateNo();
return View();
}
///
/// 详情页
///
///
[HttpGet]
public ActionResult FormView()
{
return View();
}
#endregion
#region 获取数据
///
/// 获取页面显示列表数据
///
/// 查询参数
///
[HttpGet]
[AjaxOnly]
public ActionResult GetPageList(string pagination, string queryJson)
{
Pagination paginationobj = pagination.ToObject();
var data = ass_InventoryIBLL.GetPageList(paginationobj, queryJson);
var jsonData = new
{
rows = data,
total = paginationobj.total,
page = paginationobj.page,
records = paginationobj.records
};
return Success(jsonData);
}
///
/// 获取表单数据
///
///
[HttpGet]
[AjaxOnly]
public ActionResult GetFormData(string keyValue)
{
var Ass_InventoryData = ass_InventoryIBLL.GetAss_InventoryEntity(keyValue);
var Ass_InventoryItemData = ass_InventoryItemApplyIBLL.GetAss_InventoryItemList(Ass_InventoryData.ITID);
var jsonData = new
{
Ass_Inventory = Ass_InventoryData,
Ass_InventoryItem = Ass_InventoryItemData
};
return Success(jsonData);
}
///
/// 获取表单数据
///
///
[HttpGet]
[AjaxOnly]
public ActionResult GetFormDataByProcessId(string processId)
{
var Ass_InventoryData = ass_InventoryIBLL.GetEntityByProcessId(processId);
var Ass_InventoryItemData = ass_InventoryItemApplyIBLL.GetAss_InventoryItemList(Ass_InventoryData.ITID);
var jsonData = new
{
Ass_Inventory = Ass_InventoryData,
Ass_InventoryItem = Ass_InventoryItemData
};
return Success(jsonData);
}
#endregion
#region 提交数据
///
/// 删除实体数据
/// 主键
///
///
[HttpPost]
[AjaxOnly]
public ActionResult DeleteForm(string keyValue)
{
ass_InventoryIBLL.DeleteEntity(keyValue);
return Success("删除成功!");
}
///
/// 保存实体数据(新增、修改)
/// 主键
///
///
[HttpPost]
[ValidateAntiForgeryToken]
[AjaxOnly]
public ActionResult SaveForm(string keyValue, string strEntity, string strAss_InventoryItemList)
{
Ass_InventoryEntity entity = strEntity.ToObject();
entity.ITStatus = 0;
entity.ITDate = DateTime.Now;
List list = strAss_InventoryItemList.ToObject>();
ass_InventoryIBLL.SaveEntity(keyValue, entity, list);
return Success("保存成功!");
}
#endregion
#region 扩展数据
///
/// 提交盘点申请单
///
/// 盘点表主键
/// 审核状态
/// 流程Id
///
public ActionResult ModifyStatus(string keyValue, int pastatus, string processId)
{
ass_InventoryIBLL.ModifyStatus(keyValue, pastatus, processId);
return Success("提交成功!");
}
#endregion
}
}