yl
2025-11-19 4718d79b98b135e9f07c0c201386a50f3c131171
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
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using VueWebCoreApi.DLL.BLL;
using VueWebCoreApi.Models;
using VueWebCoreApi.Tools;
 
namespace VueWebCoreApi.Controllers
{
    [ApiExplorerSettings(GroupName = "App智能分析")]
    [ApiController]
    [Route("api/[controller]")]
    public class AppAnalyticsController : Controller
    {
        //定义全局信息返回变量
        ToMessage mes = new ToMessage();
        RedisCommon redis = new RedisCommon();
 
        #region[App生产看板]
        /// <summary>
        /// App生产看板
        /// </summary>
        /// <param name="Ratetime">时间</param>
        /// <param name="defecttype">缺陷统计类型</param>
        /// <returns></returns>
        [Route(template: "ProductionKanban")]
        [HttpGet]
        public JsonResult ProductionKanban(string Ratetime, string defecttype)
        {
            var token = HttpContext.Request.Headers["Token"].ToString();
            User us = JwtTools.Denocode(token.ToString());
            string startopendate = "";  //开始时间
            string endclosedate = "";    //结束时间
            if (Ratetime != "" && Ratetime != null)
            {
                startopendate = Ratetime.Split('~')[0].ToString();
                endclosedate = Ratetime.Split('~')[1].ToString();
            }
            mes = AppAnalyticsBLL.ProductionKanban(us, startopendate, endclosedate, defecttype);
            return Json(mes);
        }
        #endregion
 
        #region[App生产进度看板单据信息]
        /// <summary>
        /// App生产进度看板单据信息
        /// </summary>
        /// <param name="ordertype">单据类型(SO:销售订单、MO:生产订单、PO:生产工单)</param>
        /// <param name="partcode">产品信息(可多个)</param>
        /// <param name="Ratetime">单据日期范围</param>
        /// <returns></returns>
        [Route(template: "ProductionScheduleKanban")]
        [HttpGet]
        public JsonResult ProductionScheduleKanban(string ordertype, string partcode = null, string Ratetime = null)
        {
            var token = HttpContext.Request.Headers["Token"].ToString();
            //var token = "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyY29kZSI6Ijk5OSIsInVzZXJuYW1lIjoiOTk5Iiwic3RvcmdfY29kZSI6IjEiLCJzdG9yZ19uYW1lIjoi5rWZ5rGf5LyY5q2l5L2T6IKy55So5ZOB6IKh5Lu95pyJ6ZmQ5YWs5Y-4IiwiaXNfc3lzdGVtX2FkbWluIjoiTiIsInJvbGVfY29kZSI6Ijg4ODgsOTk5OSIsInJvbGVfZGF0YXBlcm1pc3Npb25zIjoiIiwidXNlcnR5cGUiOiJBUFAiLCJyZWRpc2tleSI6Ik5ld1lCTUVTTG9naW5Vc2VySURBUFA5OTkiLCJtZXNTZXR0aW5nIjoie1wicm91dGVcIjp0cnVlLFwiaXNPcmRlclwiOnRydWUsXCJkZXZpY2VcIjp0cnVlLFwidGVjaFwiOnRydWUsXCJ3b3JrT3JkZXJcIjp0cnVlLFwiZXZlcnlcIjpmYWxzZSxcImxhc3RcIjpmYWxzZX0iLCJ0aW1lb3V0IjoiMjAyNS0xMS0xOVQxMToyMzo1OS42NzgzNDQ2KzA4OjAwIn0._W55Y9dnnuOnIY5DgWgY5ZI-Xqu90HWxCwdU6T1HxZU";
            User us = JwtTools.Denocode(token.ToString());
            string startopendate = "";  //开始时间
            string endclosedate = "";    //结束时间
            if (Ratetime != "" && Ratetime != null)
            {
                startopendate = Ratetime.Split('~')[0].ToString();
                endclosedate = Ratetime.Split('~')[1].ToString();
            }
            mes = AppAnalyticsBLL.ProductionScheduleKanban(us,ordertype, partcode, startopendate, endclosedate);
            return Json(mes);
        }
        #endregion
    }
}