75 lines
2.2 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using System;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using WaterCloud.Code;
using WaterCloud.Domain.MaterialManage;
using WaterCloud.Service;
using WaterCloud.Service.MaterialManage;
namespace WaterCloud.Web.Areas.EquipmentManage.Controllers
{
/// <summary>
/// 创 建:超级管理员
/// 日 期2020-12-01 12:23
/// 描 述:模具物料绑定控制器类
/// </summary>
[Area("MaterialManage")]
public class MaterialEqpController : BaseController
{
public MaterialEqpService _service {get;set;}
#region
[HttpGet]
[HandlerAjaxOnly]
public async Task<ActionResult> GetGridJson(string itemId, string keyword)
{
var data = await _service.GetLookList(itemId, keyword);
return Success(data.Count, data);
}
[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(MaterialEqpBandingEntity 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
{
//todo 加删除限制
await _service.DeleteForm(keyValue);
return await Success("操作成功。", "", keyValue, DbLogType.Delete);
}
catch (Exception ex)
{
return await Error(ex.Message, "", keyValue, DbLogType.Delete);
}
}
#endregion
}
}