新框架PC后端代码(祈禧6月初版本)
lg
2025-11-20 b98df034707a61fd2857dbccd5a232605076ca59
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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
using Gs.Toolbox;
using Gs.Toolbox.ApiCore.Abstract.Mvc;
using Gs.Toolbox.ApiCore.Common.Mvc;
using Gs.Toolbox.ApiCore.Group;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using System.Data;
using System.Data.SqlClient;
using System.Drawing;
using System.Drawing.Imaging;
using System.Dynamic;
using static Gs.Toolbox.UtilityHelper;
 
namespace Gs.Wom.WorkService
{
    [ApiGroup(ApiGroupNames.WOM)]
    public class KanBanController : IRomteService
    {
        private readonly IHttpContextAccessor _http;
 
        private readonly string _userCode, _userGuid, _orgFids;
 
        public KanBanController(IHttpContextAccessor httpContextAccessor)
        {
            _http = httpContextAccessor;
            (_userCode, _userGuid, _orgFids) =
                GetUserGuidAndOrgGuid(_http);
        }
 
        /// <summary>
        ///     读取列表,支持分页
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        [RequestMethod(RequestMethods.POST)]
        public ReturnDto<PageList<dynamic>> GetLaTouListPage([FromBody] dynamic model)
        {
            int currentPage = model.currentPage;
            int everyPageSize = model.everyPageSize;
            string sortName = model.sortName;
            string keyWhere = model.keyWhere;
            SqlParameter[] parameters =
            {
            new("@inCurrentPage", currentPage),
            new("@inEveryPageSize", everyPageSize),
            new("@inSortName", sortName),
            new("@inSortOrder", ""),
            new("@inQueryWhere", keyWhere),
            new("@inFid", ""),
            new("@inP1", ""),
            new("@inP2", ""),
            new("@inP3", ""),
            new("@inP4", "")
        };
            var dset = new DataSet();
            var _pglist = new PageList<dynamic>
            {
                total = 0,
                everyPageSize = 0,
                pages = 0,
                list = new List<dynamic>()
            };
            try
            {
                dset = DbHelperSQL.RunProcedure("kanban_latou_lst", parameters, "0");
                if (dset != null && dset.Tables.Count > 0 &&
                    dset.Tables[0].Rows.Count > 0) //有数据
                {
                    var intTotal =
                        int.Parse(dset.Tables[1].Rows[0]["intTotal"].ToString());
                    var pages = intTotal % everyPageSize != 0
                        ? intTotal / everyPageSize + 1
                        : intTotal / everyPageSize;
                    _pglist.total = intTotal;
                    _pglist.everyPageSize = everyPageSize;
                    _pglist.pages = pages;
                    var _dy = dset.Tables[0].TableToDynamicList();
                    _pglist.list = _dy;
                }
            }
            catch (Exception ex)
            {
                LogHelper.Debug(ToString(), ex.Message);
                return ReturnDto<PageList<dynamic>>.QuickReturn(_pglist,
              ReturnCode.Exception, ex.Message);
            }
 
            return ReturnDto<PageList<dynamic>>.QuickReturn(_pglist,
                ReturnCode.Success, "读取成功");
        }
 
        /// <summary>
        ///     读取
        /// </summary>
        /// <param name="guid"></param>
        /// <returns></returns>
        [RequestMethod(RequestMethods.POST)]
        public ReturnDto<ExpandoObject> GetLaTouModel([FromBody] dynamic model)
        {
            string guid = model.guid.ToString();
            dynamic m = new ExpandoObject();
            m.tb0 = new ExpandoObject();
            m.tb1 = new List<dynamic>();
            m.tb2 = new List<dynamic>();
            m.tb3 = new List<dynamic>();
            m.tb4 = new List<dynamic>();
            m.tb5 = new List<dynamic>();
            m.tb6 = new List<dynamic>();
            m.tb7 = new ExpandoObject();
            m.tb8 = new ExpandoObject();
            m.tb9 = new ExpandoObject();
            m.tb10 = new List<dynamic>();
            m.tb11 = new List<dynamic>();
            m.tb12 = new List<dynamic>();
            m.tb13 = new List<string>();//产能图时间段
            m.tb14 = new ExpandoObject();//下一指令
            SqlParameter[] parameters =
            {
            new("@inMainGuid", guid),
            new("@inLineId", ""),
        };
            var dset = new DataSet();
            try
            {
                dset = DbHelperSQL.RunProcedure("[kanban_latou]", parameters,
                    "0");
                if (dset != null && dset.Tables.Count > 0 &&
                    dset.Tables[0].Rows.Count > 0)
                {
                    //--@0主表信息
                    var _tb0 = dset.Tables[0].Rows[0];
                    m.tb0 = _tb0.RowToDynamic();
                    //  --@1在制品明细
                    var _tb1 = dset.Tables[1].TableToDynamicList();
                    m.tb1 = _tb1;
                    // --@2产能图柱
                    var _tb2 = dset.Tables[2].TableToDynamicList();
                    m.tb2 = _tb2;
                    //  --@3标准产能
                    var _tb3 = dset.Tables[3].TableToDynamicList();
                    m.tb3 = _tb3;
                    //   --@4标准下线
                    var _tb4 = dset.Tables[4].TableToDynamicList();
                    m.tb4 = _tb4;
                    //    --@5标准上线
                    var _tb5 = dset.Tables[5].TableToDynamicList();
                    m.tb5 = _tb5;
                    //--@6产能表
                    var _tb6 = dset.Tables[6].TableToDynamicList();
                    m.tb6 = _tb6;
                    //--@7不良项目图
                    var _tb7 = dset.Tables[7].Rows[0].RowToDynamic();
                    m.tb7 = _tb7;
                    // --@8良品目图
                    var _tb8 = dset.Tables[8].Rows[0].RowToDynamic();
                    m.tb8 = _tb8;
                    // --@9异常报警
                    var _tb9 = dset.Tables[9].Rows[0].RowToDynamic();
                    m.tb9 = _tb9;
                    // --@10计件
                    var _tb10 = dset.Tables[10].TableToDynamicList();
                    m.tb10 = _tb10;
                    // --@11计时
                    var _tb11 = dset.Tables[11].TableToDynamicList();
                    m.tb11 = _tb11;
                    // --@12不良项目表
                    var _tb12 = dset.Tables[12].TableToDynamicList();
                    m.tb12 = _tb12;
                    //产能图时间点
                    foreach (DataRow row in dset.Tables[2].Rows)
                    {
                        m.tb13.Add(row["t"].ToString());
                    }
                    var _tb14 = dset.Tables[13].Rows[0];
                    m.tb14 = _tb14.RowToDynamic();
                }
            }
            catch (Exception ex)
            {
                LogHelper.Debug(ToString(), ex.Message);
            }
 
            if (m != null)
                return ReturnDto<dynamic>.QuickReturn(m, ReturnCode.Success,
                    "读取成功!");
            return ReturnDto<dynamic>.QuickReturn(m, ReturnCode.Default, "读取失败!");
        }
    }
}