106 lines
3.3 KiB
C#
106 lines
3.3 KiB
C#
using System;
|
||
using System.Linq;
|
||
using System.Threading.Tasks;
|
||
using System.Collections.Generic;
|
||
using Microsoft.AspNetCore.Mvc;
|
||
using WaterCloud.Code;
|
||
using WaterCloud.Domain.MaterialManage;
|
||
using WaterCloud.Service;
|
||
using Microsoft.AspNetCore.Authorization;
|
||
using WaterCloud.Service.MaterialManage;
|
||
|
||
namespace WaterCloud.Web.Areas.MaterialManage.Controllers
|
||
{
|
||
/// <summary>
|
||
/// 创 建:超级管理员
|
||
/// 日 期:2021-06-17 14:19
|
||
/// 描 述:流转箱打印控制器类
|
||
/// </summary>
|
||
[Area("MaterialManage")]
|
||
public class TransferBoxBatchController : BaseController
|
||
{
|
||
public TransferBoxBatchService _service {get;set;}
|
||
|
||
#region 获取数据
|
||
[HandlerAjaxOnly]
|
||
[IgnoreAntiforgeryToken]
|
||
public async Task<ActionResult> GetGridJson(SoulPage<TransferBoxBatchEntity> pagination, string keyword)
|
||
{
|
||
if (string.IsNullOrEmpty(pagination.field))
|
||
{
|
||
pagination.field = "F_Id";
|
||
pagination.order = "asc";
|
||
}
|
||
var data = await _service.GetLookList(pagination,keyword);
|
||
return Content(pagination.setData(data).ToJson());
|
||
}
|
||
|
||
[HttpGet]
|
||
[HandlerAjaxOnly]
|
||
public async Task<ActionResult> GetListJson(string keyword)
|
||
{
|
||
var data = await _service.GetList(keyword);
|
||
return Content(data.ToJson());
|
||
}
|
||
|
||
[HttpGet]
|
||
[HandlerAjaxOnly]
|
||
public async Task<ActionResult> GetFormJson(string keyValue)
|
||
{
|
||
var data = await _service.GetLookForm(keyValue);
|
||
return Content(data.ToJson());
|
||
}
|
||
#endregion
|
||
|
||
#region 提交数据
|
||
[HttpPost]
|
||
[HandlerAjaxOnly]
|
||
public async Task<ActionResult> SubmitForm(TransferBoxBatchEntity entity, string keyValue)
|
||
{
|
||
try
|
||
{
|
||
await _service.SubmitForm(entity, keyValue);
|
||
return await Success("操作成功。", "", keyValue);
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
return await Error(ex.Message, "", keyValue);
|
||
}
|
||
}
|
||
|
||
[HttpPost]
|
||
[HandlerAjaxOnly]
|
||
[ServiceFilter(typeof(HandlerAuthorizeAttribute))]
|
||
public async Task<ActionResult> DeleteForm(string keyValue)
|
||
{
|
||
try
|
||
{
|
||
await _service.DeleteForm(keyValue);
|
||
return await Success("操作成功。", "", keyValue, DbLogType.Delete);
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
return await Error(ex.Message, "", keyValue, DbLogType.Delete);
|
||
}
|
||
}
|
||
[HttpPost]
|
||
[HandlerAjaxOnly]
|
||
[ServiceFilter(typeof(HandlerAuthorizeAttribute))]
|
||
public async Task<ActionResult> PrinterForm(string keyValue,long num)
|
||
{
|
||
try
|
||
{
|
||
var data= await _service.PrinterForm(keyValue, num);
|
||
await Success("操作成功。", "", keyValue, DbLogType.Submit);
|
||
return Content(data.ToJson());
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
await Error(ex.Message, "", keyValue, DbLogType.Submit);
|
||
return Content(null);
|
||
}
|
||
}
|
||
#endregion
|
||
}
|
||
}
|