From 0e42f871905f207658d822fcbe29aeb57b2156af Mon Sep 17 00:00:00 2001 From: schangxiang@126.com <schangxiang@126.com> Date: 周三, 21 5月 2025 16:18:01 +0800 Subject: [PATCH] 修复查询bug --- PipeLineLems/server/src/CMS.Plugin.PipeLineLems/Controller/WorkPlanPublicController.cs | 304 ++++++++++++++++++++++++++++++++++++++++++++------ 1 files changed, 265 insertions(+), 39 deletions(-) diff --git a/PipeLineLems/server/src/CMS.Plugin.PipeLineLems/Controller/WorkPlanPublicController.cs b/PipeLineLems/server/src/CMS.Plugin.PipeLineLems/Controller/WorkPlanPublicController.cs index 49f808e..33a15cf 100644 --- a/PipeLineLems/server/src/CMS.Plugin.PipeLineLems/Controller/WorkPlanPublicController.cs +++ b/PipeLineLems/server/src/CMS.Plugin.PipeLineLems/Controller/WorkPlanPublicController.cs @@ -1,44 +1,270 @@ -//using CMS.Extensions.Abp.AspNetCore.Mvc.Filters; -//using CMS.Plugin.PipeLineLems.Application.Contracts.Dtos.WorkPlan; -//using CMS.Plugin.PipeLineLems.Application.Contracts.Services; -//using Microsoft.AspNetCore.Mvc; -//using System.Reflection; +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 CmsQueryExtensions; +using CmsQueryExtensions.Entitys; +using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Mvc; +using System.Reflection; -//namespace CMS.Plugin.PipeLineLems.Controller -//{ -// /// <summary> -// /// 浣滀笟璁″垝鏈嶅姟 -// /// </summary> -// [ApiController] -// [TypeFilter(typeof(CMSLanguageFilter))] -// [TypeFilter(typeof(CMSUowActionFilter))] -// [TypeFilter(typeof(CMSAuditActionFilter))] -// [TypeFilter(typeof(CMSExceptionFilter))] -// [Route("api/v{version:apiVersion}/PipeLineLems/[controller]")] -// public class WorkPlanPublicController : ControllerBase -// { +namespace CMS.Plugin.PipeLineLems.Controller +{ + /// <summary> + /// 浣滀笟璁″垝鏈嶅姟 + /// </summary> + [ApiController] + [TypeFilter(typeof(CMSLanguageFilter))] + [TypeFilter(typeof(CMSUowActionFilter))] + [TypeFilter(typeof(CMSAuditActionFilter))] + [TypeFilter(typeof(CMSExceptionFilter))] + [Route("api/v{version:apiVersion}/PipeLineLems/[controller]")] + public class WorkPlanPublicController : ControllerBase + { + private readonly IWorkPlanAppService _workPlanAppService; + private readonly IMesAppService _mesAppService; + private readonly ICurrentUser _currentUser; + private readonly Application.Implements.SharedService sharedService; + private IServiceProvider _serviceProvider; -// private readonly IMesAppService _mesAppService; -// /// <summary> -// /// Initializes a new instance of the <see cref="TestEntityNameController"/> class. -// /// </summary> -// /// <param name="testentitynameAppService">The testentityname application service.</param> -// public WorkPlanPublicController(IMesAppService mesAppService) -// { -// _mesAppService = mesAppService; -// } + /// <summary> + /// Initializes a new instance of the <see cref="TestEntityNameController"/> class. + /// </summary> + /// <param name="testentitynameAppService">The testentityname application service.</param> + public WorkPlanPublicController(IMesAppService mesAppService, ICurrentUser currentUser, Application.Implements.SharedService _sharedService, + IServiceProvider serviceProvider, IWorkPlanAppService workPlanAppService) + { + _mesAppService = mesAppService; + _currentUser = currentUser; + sharedService = _sharedService; + _serviceProvider = serviceProvider; + _workPlanAppService = workPlanAppService; + } -// /// <summary> -// /// 鑾峰彇鐢熶骇璁″垝. -// /// </summary> -// /// <param name="input">鏍囪瘑绗�.</param> -// /// <returns></returns> -// [HttpPost] -// public virtual async Task<MesOrderResponse> GetWorkPlanAsync([FromBody] List<WorkPlanInput> input) -// { -// return await _mesAppService.CreateAsync(input); -// } + /// <summary> + /// 鑾峰彇鐢熶骇璁″垝. + /// </summary> + /// <param name="input">鏍囪瘑绗�.</param> + /// <returns></returns> + [HttpPost] + public virtual async Task<MesOrderResponse> GetWorkPlanAsync([FromBody] List<WorkPlanInput> input) + { + return await _mesAppService.CreateAsync(input, "", ""); + } + + /// <summary> + /// 鍒嗘嫞 + /// </summary> + /// <param name="input">鏍囪瘑绗�.</param> + /// <returns></returns> + [Authorize] + [HttpPost] + [Route("Pick")] + public virtual async Task<MesOrderResponse> Pick([FromBody] PickInput input) + { + try + { + MyCurrentUser myCurrentUser = new MyCurrentUser() + { + UserAccount = _currentUser.UserAccount, + UserId = _currentUser.UserId + }; + return await sharedService.CommonPick(_serviceProvider, input, myCurrentUser); + } + catch (Exception ex) + { + return new MesOrderResponse() + { + Code = "400", + Message = ex.Message + }; + } + } -// } -//} + /// <summary> + /// 鍙枡 + /// </summary> + /// <param name="input">鏍囪瘑绗�.</param> + /// <returns></returns> + [Authorize] + [HttpPost] + [Route("CallMaterial")] + public virtual async Task<MesOrderResponse> CallMaterial([FromBody] CallMaterialByDataIdentifierInput input) + { + try + { + MyCurrentUser myCurrentUser = new MyCurrentUser() + { + UserAccount = _currentUser.UserAccount, + UserId = _currentUser.UserId + }; + return await sharedService.CallMaterial(input, _serviceProvider, myCurrentUser); + } + catch (Exception ex) + { + return new MesOrderResponse() + { + Code = "400", + Message = ex.Message + }; + } + } + + /// <summary> + /// 涓嬪彂娉曞叞鍐茬爜 + /// </summary> + /// <param name="input">鏍囪瘑绗�.</param> + /// <returns></returns> + [Authorize] + [HttpPost] + [Route("SendFlangeCode")] + public virtual async Task<MesOrderResponse> SendFlangeCode([FromBody] SendFlangeCodeInput input) + { + try + { + MyCurrentUser myCurrentUser = new MyCurrentUser() + { + UserAccount = _currentUser.UserAccount, + UserId = _currentUser.UserId + }; + return await sharedService.SendFlangeCode_StartProduction(input, _serviceProvider, myCurrentUser); + } + catch (Exception ex) + { + return new MesOrderResponse() + { + Code = "400", + Message = ex.Message + }; + } + } + + /// <summary> + /// 娉曞叞鍐茬爜瀹屽伐 + /// </summary> + /// <param name="input"></param> + /// <returns></returns> + [Authorize] + [HttpPost] + [Route("SendFlangeCode_FinishProduction")] + public virtual async Task<MesOrderResponse> SendFlangeCode_FinishProduction([FromBody] CompleteAssemblyProcessInput input) + { + try + { + MyCurrentUser myCurrentUser = new MyCurrentUser() + { + UserAccount = _currentUser.UserAccount, + UserId = _currentUser.UserId + }; + return await sharedService.SendFlangeCode_CompleteAssemblyProcess(_serviceProvider, input, myCurrentUser); + } + catch (Exception ex) + { + return new MesOrderResponse() + { + Code = "400", + Message = ex.Message + }; + } + } + + /// <summary> + /// 寮�宸� + /// </summary> + /// <param name="input"></param> + /// <returns></returns> + [Authorize] + [HttpPost] + [Route("StartProduction")] + public virtual async Task<MesOrderResponse> StartProduction([FromBody] StartProductionInput input) + { + try + { + MyCurrentUser myCurrentUser = new MyCurrentUser() + { + UserAccount = _currentUser.UserAccount, + UserId = _currentUser.UserId + }; + return await sharedService.StartProduction(input, _serviceProvider, myCurrentUser); + } + catch (Exception ex) + { + return new MesOrderResponse() + { + Code = "400", + Message = ex.Message + }; + } + } + + /// <summary> + /// 瀹屽伐 + /// </summary> + /// <param name="input"></param> + /// <returns></returns> + [Authorize] + [HttpPost] + [Route("FinishProduction")] + public virtual async Task<MesOrderResponse> FinishProduction([FromBody] CompleteAssemblyProcessInput input) + { + try + { + MyCurrentUser myCurrentUser = new MyCurrentUser() + { + UserAccount = _currentUser.UserAccount, + UserId = _currentUser.UserId + }; + return await sharedService.CompleteAssemblyProcess(_serviceProvider, input, myCurrentUser); + } + catch (Exception ex) + { + return new MesOrderResponse() + { + Code = "400", + Message = ex.Message + }; + } + } + + + /// <summary> + /// 鍒嗘嫞鏃惰幏鍙栫敓浜ц鍒掑拰鍒嗛厤鍖哄煙 + /// </summary> + /// <param name="input"></param> + /// <returns></returns> + [HttpPost] + [Route("GetPickRet")] + public virtual async Task<CmsApiResponse<PickOutput>> GetPickRetAsync([FromBody] GetWorkPlanInput input) + { + + //WorkPlanDto workPlanDto = await _workPlanAppService.FindSingleByFilterAsync(input); + ////杩欓噷瑕佽幏鍙杦ms鐨勫簱瀛橈紝鏉ュ垎鏋� 瑕佹斁鍒板摢涓墭鐩橀噷 + //return new PickOutput() + //{ + // WorkPlan = workPlanDto, + // PlaceNo = "", + // ContinerNo = "" + //}; + try + { + MyCurrentUser myCurrentUser = new MyCurrentUser() + { + UserAccount = _currentUser.UserAccount, + UserId = _currentUser.UserId + }; + return await sharedService.GetPickRetAsync(input, _serviceProvider, myCurrentUser); + } + catch (Exception ex) + { + return new CmsApiResponse<PickOutput>() + { + Code = 400, + Message = ex.Message + }; + } + + } + } +} -- Gitblit v1.9.3