wbc
2025-05-28 b9349673f1610970530db34ed8ed9b26e8e1e239
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
 
using System.Dynamic;
using System.Net;
using MES.Service.Dto.service;
using MES.Service.Modes;
using MES.Service.service;
using MES.Service.util;
using Microsoft.AspNetCore.Mvc;
using Newtonsoft.Json.Linq;
 
 
 
namespace MESApplication.Controllers.BasicData;
 
    
    [Route("api/[controller]")]
    [ApiController]
    public class ModulesController : ControllerBase
    {
        private readonly SysUserService _sysUserService = new SysUserService();
 
        /// <summary>
        /// 查询权限
        /// </summary>
        /// <param name="userno">用户Id</param>
        /// <returns>权限信息</returns>
        [HttpPost("queryPurview")]
        public ResponseResult QueryPurview([FromBody] JObject data)
        {
            var userno = data["userno"]?.ToString();
            try
            {
                List<UserPermission> userForBase = _sysUserService.QueryPurview(userno);
 
                if (userForBase.Count == 0)
                {
                    return new ResponseResult
                    {
                        status = 1,
                        message = "权限不存在!"
                    };
                }
                else
                {
                    dynamic resultInfos = new ExpandoObject();
                    resultInfos.tbBillList = userForBase;
 
                    return new ResponseResult
                    {
                        status = 0,
                        message = "查询权限成功!",
                        data = resultInfos
                    };
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
                return new ResponseResult
                {
                    status = 1,
                    message = "查询权限失败!"
                };
            }
        }
 
 
            /// <summary>
            /// 功能界面
            /// </summary>
            /// <param name="functionName">方法名称</param>
            /// <returns>功能界面信息</returns>
            [HttpPost("getRfSetup")]
            public ResponseResult GetRfSetup([FromBody] JObject data)
            {
 
              var functionName = data["functionName"]?.ToString();
            try
                {
                    Console.WriteLine(functionName);
                    string decodedFunctionName = WebUtility.UrlDecode(functionName);
                    return _sysUserService.GetRfSetup(functionName);
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.ToString());
                    return new ResponseResult
                    {
                        status = 1,
                        message = "查询功能界面失败!"
                    };
                }
            }
 
 
 
 
            /// <summary>
            /// 功能执行存储过程
            /// </summary>
            /// <param name="data">请求参数</param>
            /// <returns>API响应结果</returns>
            [HttpPost("getExcProc")]
            public ResponseResult GetExcProc([FromBody] JObject data)
            {
                var functionName = data["functionName"]?.ToString();
                var fileName = data["fileName"]?.ToString();
                var pmachtype = data["pmachtype"]?.ToString();
                var fileValue = data["fileValue"]?.ToString();
                var outFiles = data["outFiles"]?.ToString();
 
                try
                {
                    Console.WriteLine(functionName);
                    string decodedFunctionName = WebUtility.UrlDecode(functionName);
                    return _sysUserService.GetExcProc(decodedFunctionName, fileName, pmachtype, fileValue, outFiles);
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.ToString());
                    return new ResponseResult
                    {
                        status = 1,
                        message = "查询功能界面失败!"
                    };
                }
            }
 
}