using Newtonsoft.Json; using System; using System.Collections.Generic; using System.Linq; using System.Web; using Microsoft.AspNetCore.Mvc;using WMS.BZWeb; using WMS.Core; using WMS.Core.ServiceCore; using WMS.Info; namespace WMS.BZWeb { [Area("WCSManager")] public class WcsDeviceInfoController : MvcControllerBase { WcsDeviceInfoService bll = new WcsDeviceInfoService(); WcsDeviceprotocolService deviceprotocolService = new WcsDeviceprotocolService(); #region 视图功能 // GET: WCSManager/WcsDeviceInfo public ActionResult Index() { return View(); } /// /// 表单页 /// /// [HttpGet] public ActionResult Form() { return View(); } public ActionResult GenerateDeviceForm() { return View(); } #endregion /// /// /// /// [HttpGet] ////[AjaxOnly] public ActionResult GetSelectDeviceNameList() { return Success(bll.GetSelectDeviceNameList()); } #region 获取数据 /// /// 获取页面显示列表数据 /// /// 分页参数 /// 查询参数 /// [HttpGet] ////[AjaxOnly] public ActionResult GetPageList(string pagination, string queryJson) { Pagination paginationobj = InitPagination(pagination); var data = bll.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 wcsDeviceEntity = bll.GetEntity(keyValue); //var WCS_DEVICEPROTOCOLData = wcsdeviceinfoIBLL.GetWCS_DEVICEPROTOCOLList(WCS_DEVICEData.CODE); var list= deviceprotocolService.GetEntityByDevicecode(keyValue); var jsonData = new { WCS_DEVICE = wcsDeviceEntity, WCS_DEVICEPROTOCOL = list //WCS_DEVICEPROTOCOL = WCS_DEVICEPROTOCOLData, }; return Success(jsonData); } #endregion #region 提交数据 /// /// 删除实体数据 /// /// 主键 /// [HttpPost] ////[AjaxOnly] public ActionResult DeleteForm(string keyValue) { bll.DeleteEntity(keyValue); return Success("删除成功!"); } /// /// 保存实体数据(新增、修改) /// /// 主键 /// 实体 /// [HttpPost] [ValidateAntiForgeryToken] ////[AjaxOnly] public ActionResult SaveForm(string keyValue, WcsDeviceEntity strEntity, List strwCS_DEVICEPROTOCOLList) { LoginUserInfo LoginUser = LoginBLLCore.GetLoginUser(); bll.SaveEntity(LoginUser, keyValue, strEntity, strwCS_DEVICEPROTOCOLList); //bll.SaveEntity(LoginUser, keyValue, entity); return Success("保存成功!"); } [HttpPost] [ValidateAntiForgeryToken] ////[AjaxOnly] public ActionResult SaveGenerateDevice(GenerateDevice entity) { LoginUserInfo LoginUser = LoginBLLCore.GetLoginUser(); bll.SaveGenerateDevice(LoginUser, entity); //bll.SaveEntity(LoginUser, keyValue, entity); return Success("保存成功!"); } #endregion } }