|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157 |
- 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 PurchaseWorkApplyApi : BaseApi
- {
- private Purchase_Work_ApplyIBLL PurchaseWorkIBLL = new Purchase_Work_ApplyBLL();
- private NWFProcessIBLL nWFProcessIBLL = new NWFProcessBLL();
-
- /// <summary>
- /// 注册接口
- /// <summary>
- public PurchaseWorkApplyApi()
- : base("/learun/adms/PurchaseWorkapply")
- {
- Get["/pagelist"] = GetPageList;
- Get["/form"] = GetForm;
- 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_Work_ApplyEntity(keyValue);
- var Purchase_Work_DetailsData = PurchaseWorkIBLL.GetPurchase_Work_ApplydetailsList(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 GetshList(dynamic _)
- {
- Purchase_Work_ApplyEntity parameter = this.GetReqData<Purchase_Work_ApplyEntity>();
- var Purchase_WorkData = PurchaseWorkIBLL.GetEntityByProcessId(parameter.ProcessId);
- var Purchase_Work_DetailsData = PurchaseWorkIBLL.GetPurchase_Work_ApplydetailsList(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 _)
- {
- //Purchase_WorkEntity entity = strEntity.ToObject<Purchase_WorkEntity>();
- //List<Purchase_Work_DetailsEntity> Purchase_Work_DetailsList = strPurchase_Work_DetailsList.ToObject<List<Purchase_Work_DetailsEntity>>();
- //Purchase_WorkIBLL.SaveEntity(keyValue, entity, Purchase_Work_DetailsList);
- ReqFormEntity parameter = this.GetReqData<ReqFormEntity>();
- Purchase_Work_ApplyEntity entity = parameter.strEntity.ToObject<Purchase_Work_ApplyEntity>();
- List<Purchase_Work_ApplydetailsEntity> detailList = parameter.DetailList.ToObject<List<Purchase_Work_ApplydetailsEntity>>();
- //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_Work_ApplyEntity parameter = this.GetReqData<Purchase_Work_ApplyEntity>();
- //string keyValue = this.GetReqData();
- //var processId = Guid.NewGuid().ToString();
- PurchaseWorkIBLL.ModifyStatus(parameter.Id, 1, parameter.ProcessId);
- //UserInfo userInfo = LoginUserInfo.Get();
- //nWFProcessIBLL.CreateFlow("1-7", 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
- }
- }
|