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();
RedisHelper redis = new RedisHelper();
#region[App生产看板]
///
/// App生产看板
///
/// 时间
/// 缺陷统计类型
///
[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生产进度看板单据信息]
///
/// App生产进度看板单据信息
///
/// 单据类型(SO:销售订单、MO:生产订单、PO:生产工单)
/// 产品信息(可多个)
/// 单据日期范围
///
[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.eyJ1c2VyY29kZSI6Ijk5OCIsInVzZXJuYW1lIjoi5rWL6K-V6LSm5Y-3MSIsInN0b3JnX2NvZGUiOiJTQ0IwMV8xXzEiLCJzdG9yZ19uYW1lIjoi57K-5bel6L2m6Ze0IiwiaXNfc3lzdGVtX2FkbWluIjoiTiIsInJvbGVfY29kZSI6Ijk5OTkiLCJyb2xlX2RhdGFwZXJtaXNzaW9ucyI6IiIsInVzZXJ0eXBlIjoiQVBQIiwicmVkaXNrZXkiOiJOZXdNRVNMb2dpblVzZXJJREFQUDk5OCIsInRpbWVvdXQiOiIyMDIzLTEyLTA3VDE0OjU0OjAzLjU0NDMxMjMrMDg6MDAifQ._L0xdKgeD_dgnedzV8EEN6y2Xad0J7beswuIcNj4OKs";
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
}
}