| | |
| | | using Ao.Lang; |
| | | using AutoMapper.Internal.Mappers; |
| | | using CMS.Extensions.Abp.AspNetCore.Mvc.Filters; |
| | | using CMS.Framework.AspNetCore.Users; |
| | | using CMS.Plugin.PipeLineLems.Application.Contracts.Dtos.WorkPlan; |
| | | using CMS.Plugin.PipeLineLems.Application.Contracts.Services; |
| | | using CMS.Plugin.PipeLineLems.Application.Implements; |
| | | using CMS.Plugin.PipeLineLems.Domain.WorkPlan; |
| | | using CmsQueryExtensions.Entitys; |
| | | using Microsoft.AspNetCore.Authorization; |
| | | using Microsoft.AspNetCore.Http; |
| | | using Microsoft.AspNetCore.Mvc; |
| | |
| | | public class WorkPlanController : ControllerBase |
| | | { |
| | | private readonly IWorkPlanAppService _workPlanAppService; |
| | | |
| | | |
| | | /// <summary> |
| | | /// 获取生产计划. |
| | | /// </summary> |
| | | /// <param name="input">标识符.</param> |
| | | /// <returns></returns> |
| | | [HttpPost] |
| | | [Route("GetWorkPlanByAps")] |
| | | public virtual async Task<MesOrderResponse> CreateWorkPlanByApsAsync([FromBody] List<WorkPlanInput> input) |
| | | { |
| | | return await _workPlanAppService.CreatebyApsAsync(input); |
| | | } |
| | | private readonly ICurrentUser _currentUser; |
| | | |
| | | /// <summary> |
| | | /// Initializes a new instance of the <see cref="WorkPlanController"/> class. |
| | | /// </summary> |
| | | /// <param name="workPlanAppService">The workPlan application service.</param> |
| | | public WorkPlanController(IWorkPlanAppService workPlanAppService) |
| | | public WorkPlanController(IWorkPlanAppService workPlanAppService, ICurrentUser currentUser) |
| | | { |
| | | _workPlanAppService = workPlanAppService; |
| | | _currentUser = currentUser; |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | await file.CopyToAsync(stream); |
| | | stream.Seek(0L, SeekOrigin.Begin); |
| | | |
| | | var userAccount = _currentUser.UserAccount; |
| | | var userId = _currentUser.UserId; |
| | | MyCurrentUser myCurrentUser = new MyCurrentUser() |
| | | { |
| | | UserAccount = _currentUser.UserAccount, |
| | | UserId = _currentUser.UserId |
| | | }; |
| | | |
| | | var sheetNames = stream.GetSheetNames(); |
| | | var workPlanRows = sheetNames.Contains("配置") ? MiniExcel.Query<WorkPlansImportModel.WorkPlanImportModel>(stream, sheetName: "配置").ToList() : new(); |
| | | |
| | |
| | | throw new UserFriendlyException("请检查导入的表格"); |
| | | } |
| | | |
| | | |
| | | await _workPlanAppService.ImportAsync(new WorkPlansImportModel |
| | | { |
| | | WorkPlans = workPlanRows, |
| | | }); |
| | | }, userId, userAccount); |
| | | |
| | | return Ok(); |
| | | } |