| | |
| | | using Microsoft.AspNetCore.Mvc; |
| | | using Microsoft.Extensions.Logging; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Security.Claims; |
| | | using System.Threading.Tasks; |
| | | using Microsoft.AspNetCore.Authorization; |
| | | using Model.ModelVm; |
| | | using Newtonsoft.Json; |
| | | using Utility.Tools; |
| | | using WMS.Entity.Context; |
| | | using WMS.IBLL.ISysServer; |
| | | using Wms.Tools; |
| | | using Utility; |
| | | |
| | | |
| | | namespace Wms.Controllers |
| | | { |
| | | [Route("api/[controller]/[action]")] |
| | | [ApiController] |
| | | [ServiceFilter(typeof(ApiResponseActionFilter))] |
| | | public class WeatherForecastController : ControllerBase |
| | | { |
| | | private static readonly string[] Summaries = new[] |
| | |
| | | _userMan = userMan; |
| | | } |
| | | |
| | | [HttpGet] |
| | | public IEnumerable<WeatherForecast> Get() |
| | | { |
| | | var rng = new Random(); |
| | | var data = Enumerable.Range(1, 5).Select(index => new WeatherForecast |
| | | { |
| | | Date = DateTime.Now.AddDays(index), |
| | | TemperatureC = rng.Next(-20, 55), |
| | | Summary = Summaries[rng.Next(Summaries.Length)] |
| | | }) |
| | | .ToArray(); |
| | | var list = JsonConvert.SerializeObject(data); |
| | | _logger.LogWarning("接收物料转移任务:(" + list + "),"); |
| | | return data; |
| | | } |
| | | //[HttpGet] |
| | | //public IEnumerable<WeatherForecast> Get() |
| | | //{ |
| | | // var rng = new Random(); |
| | | // var data = Enumerable.Range(1, 5).Select(index => new WeatherForecast |
| | | // { |
| | | // Date = DateTime.Now.AddDays(index), |
| | | // TemperatureC = rng.Next(-20, 55), |
| | | // Summary = Summaries[rng.Next(Summaries.Length)] |
| | | // }) |
| | | // .ToArray(); |
| | | // var list = JsonConvert.SerializeObject(data); |
| | | // _logger.LogWarning("接收物料转移任务:(" + list + "),"); |
| | | // return data; |
| | | //} |
| | | |
| | | /// <summary> |
| | | /// 登录 |
| | |
| | | /// <param name="model">登录名</param> |
| | | /// <returns></returns> |
| | | [HttpPost] |
| | | [ServiceFilter(typeof(ApiResponseActionFilter))] |
| | | public async Task<string> Login(LoginVm model) |
| | | { |
| | | if (ModelState.IsValid) |
| | |
| | | /// 登录 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | [HttpPost] |
| | | public IActionResult ceshi() |
| | | { |
| | | //if (ModelState.IsValid) |
| | | //{ |
| | | try |
| | | { |
| | | //获取当前登录的用户ID |
| | | var claimsIdentity = this.User.Identity as ClaimsIdentity; |
| | | var userId = claimsIdentity.FindFirst(ClaimTypes.Name)?.Value; |
| | | var bolls = _userMan.CeShi(); |
| | | //[HttpPost] |
| | | //public IActionResult ceshi() |
| | | //{ |
| | | // //if (ModelState.IsValid) |
| | | // //{ |
| | | // try |
| | | // { |
| | | // //获取当前登录的用户ID |
| | | // var claimsIdentity = this.User.Identity as ClaimsIdentity; |
| | | // var userId = claimsIdentity.FindFirst(ClaimTypes.Name)?.Value; |
| | | // var bolls = _userMan.CeShi(); |
| | | |
| | | return Ok(new { code = 200, data = bolls }); |
| | | // return Ok(new { code = 200, data = bolls }); |
| | | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | return Ok(new { code = 400, ErrorMsg = "请联系管理员/" + e.Message }); |
| | | } |
| | | //} |
| | | //else //数据格式错误 |
| | | //{ |
| | | // return Ok(new { code = 400, ErrorMsg = "数据格式错误" }); |
| | | //} |
| | | } |
| | | // } |
| | | // catch (Exception e) |
| | | // { |
| | | // return Ok(new { code = 400, ErrorMsg = "请联系管理员/" + e.Message }); |
| | | // } |
| | | // //} |
| | | // //else //数据格式错误 |
| | | // //{ |
| | | // // return Ok(new { code = 400, ErrorMsg = "数据格式错误" }); |
| | | // //} |
| | | //} |
| | | } |
| | | } |