|
- using Nancy;
- using Learun.Util;
- using System.Collections.Generic;
- using Learun.Application.TwoDevelopment.EducationalAdministration;
- using Learun.Application.TwoDevelopment.LogisticsManagement;
- using System;
- using Learun.Application.WorkFlow;
-
- namespace Learun.Application.WebApi
- {
- /// <summary>
- /// 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园
- /// Copyright (c) 2013-2018 北京泉江科技有限公司
- /// 创 建:超级管理员
- /// 日 期:2020-06-03 14:29
- /// 描 述:系部数据
- /// </summary>
- public class PurchaseWorkApi : BaseApi
- {
- private Purchase_WorkIBLL purchaseworkIBLL = new Purchase_WorkBLL();
- private NWFProcessIBLL nWFProcessIBLL = new NWFProcessBLL();
-
- /// <summary>
- /// 注册接口
- /// <summary>
- public PurchaseWorkApi()
- : base("/learun/adms/purchasework")
- {
- Get["/pagelist"] = GetPageList;
- Get["/form"] = GetForm;
- Get["/formdetail"] = GetFormDetails;
- Post["/delete"] = DeleteForm;
- Post["/save"] = SaveForm;
- Post["/submit"] = Submit;
- Get["/shList"] = GetshList;
- }
- #region 获取数据
-
- /// <summary>
- /// 获取页面显示列表分页数据
- /// <summary>
- /// <param name="_"></param>
- /// <returns></returns>
- public Response GetPageList(dynamic _)
- {
- ReqPageParam parameter = this.GetReqData<ReqPageParam>();
- var data = purchaseworkIBLL.GetPageList(parameter.pagination, parameter.queryJson);
- var jsonData = new
- {
- rows = data,
- total = parameter.pagination.total,
- page = parameter.pagination.page,
- records = parameter.pagination.records
- };
- return Success(jsonData);
- }
- /// <summary>
- /// 获取表单数据
- /// <summary>
- /// <param name="_"></param>
- /// <returns></returns>
- public Response GetForm(dynamic _)
- {
- string keyValue = this.GetReqData();
- var Purchase_WorkData = purchaseworkIBLL.GetPurchase_WorkEntity(keyValue);
- var Purchase_Work_DetailsData = purchaseworkIBLL.GetPurchase_Work_DetailsList(Purchase_WorkData.Id);
- var jsonData = new
- {
- Purchase_Work = Purchase_WorkData,
- Purchase_Work_Details = Purchase_Work_DetailsData,
- };
- return Success(jsonData);
- }
- /// <summary>
- /// 获取表单数据
- /// <summary>
- /// <param name="_"></param>
- /// <returns></returns>
- public Response GetFormDetails(dynamic _)
- {
- string keyValue = this.GetReqData();
-
- var Purchase_Work_DetailsData = purchaseworkIBLL.GetPurchase_Work_DetailsList(keyValue);
-
- return Success(Purchase_Work_DetailsData);
- }
-
- /// <summary>
- /// 获取页面显示列表数据
- /// <summary>
- /// <param name="_"></param>
- /// <returns></returns>
- public Response GetshList(dynamic _)
- {
- Purchase_WorkEntity parameter = this.GetReqData<Purchase_WorkEntity>();
- var Purchase_WorkData = purchaseworkIBLL.GetEntityByProcessId(parameter.ProcessId);
- var Purchase_Work_DetailsData = purchaseworkIBLL.GetPurchase_Work_DetailsList(Purchase_WorkData.Id);
- var jsonData = new
- {
- Purchase_Work = Purchase_WorkData,
- Purchase_Work_Details = Purchase_Work_DetailsData,
- };
- return Success(jsonData);
- }
- #endregion
-
- #region 提交数据
-
- /// <summary>
- /// 删除实体数据
- /// <param name="_"></param>
- /// <summary>
- /// <returns></returns>
- public Response DeleteForm(dynamic _)
- {
- string keyValue = this.GetReqData();
- purchaseworkIBLL.DeleteEntity(keyValue);
- return Success("删除成功!");
- }
- /// <summary>
- /// 保存实体数据(新增、修改)
- /// <param name="_"></param>
- /// <summary>
- /// <returns></returns>
- public Response SaveForm(dynamic _)
- {
- ReqFormEntity parameter = this.GetReqData<ReqFormEntity>();
- Purchase_WorkEntity entity = parameter.strEntity.ToObject<Purchase_WorkEntity>();
- List<Purchase_Work_DetailsEntity> detailList = parameter.DetailList.ToObject<List<Purchase_Work_DetailsEntity>>();
- //var code = entity.EnCode;
-
- string id=purchaseworkIBLL.SaveEntity(parameter.keyValue, entity, detailList);
- var json = new
- {
- Id = id
- };
- return Success(json);
- }
- /// <summary>
- /// 提交
- /// <param name="_"></param>
- /// <summary>
- /// <returns></returns>
- public Response Submit(dynamic _)
- {
- Purchase_WorkEntity parameter = this.GetReqData<Purchase_WorkEntity>();
- //string keyValue = this.GetReqData();
- //var processId = Guid.NewGuid().ToString();
- purchaseworkIBLL.ModifyStatus(parameter.Id, 1, parameter.ProcessId);
- //UserInfo userInfo = LoginUserInfo.Get();
- //nWFProcessIBLL.CreateFlow("2-1", processId, "", 1, "", userInfo);
- return Success("提交成功!");
- }
- #endregion
-
- #region 私有类
-
- /// <summary>
- /// 表单实体类
- /// <summary>
- private class ReqFormEntity
- {
- public string keyValue { get; set; }
- public string strEntity { get; set; }
- public string DetailList { get; set; }
- }
- #endregion
- }
- }
|