From 30334be4b684d639231e7cd721ca99f3fdb0f5ed Mon Sep 17 00:00:00 2001 From: zs <zhousong@weben-smart.com> Date: 周一, 12 5月 2025 17:10:46 +0800 Subject: [PATCH] Merge branch 'master' of http://222.71.245.114:9086/r/HIA24016N_PipeLineDemo --- PipeLineLems/server/src/CMS.Plugin.PipeLineLems.Application.Contracts/Services/IWorkPlanAppService.cs | 3 PipeLineLems/server/src/CMS.Plugin.PipeLineLems.Application/Implements/MesAppService.cs | 7 PipeLineLems/server/src/CMS.Plugin.PipeLineLems.Application/Implements/SharedService.cs | 44 +++ PipeLineLems/pipelinelems_web/src/widgets/WorkPlan/Views/Pages/WorkPlan/WorkPlan.tsx | 4 PipeLineLems/server/src/CMS.Plugin.PipeLineLems.Application.Contracts/Dtos/WorkPlan/PickInput.cs | 23 + PipeLineLems/server/src/CMS.Plugin.PipeLineLems/Controller/WorkPlanController.cs | 266 ++++++++++--------- PipeLineLems/pipelinelems_web/src/widgets/WorkPlan/Views/Pages/WorkPlan/Config.ts | 32 +- PipeLineLems/server/src/CMS.Plugin.PipeLineLems.Application.Contracts/Dtos/WorkPlan/WorkPlanCreateOrUpdateDtoBase.cs | 13 PipeLineLems/server/src/CMS.Plugin.PipeLineLems/CMS.Plugin.PipeLineLems.csproj | 6 PipeLineLems/server/src/CMS.Plugin.PipeLineLems.Application.Contracts/Services/IMesAppService.cs | 3 PipeLineLems/server/src/CMS.Plugin.PipeLineLems.Application/Implements/WorkPlanAppService.cs | 5 PipeLineLems/server/src/CMS.Plugin.PipeLineLems/Controller/WorkPlanPublicController.cs | 31 ++ Weben_CMS专用代码生成器/queryExtensions/CmsQueryExtensions/Entitys/MyCurrentUser.cs | 25 + CommonDLL/CmsQueryExtensions.dll | 0 PipeLineLems/server/src/CMS.Plugin.PipeLineLems.Application.Contracts/Dtos/CallMaterialOrder/CallMaterialOrderCreateOrUpdateDtoBase.cs | 13 PipeLineLems/server/src/CMS.Plugin.PipeLineLems/CMSPluginEntry.cs | 2 PipeLineLems/pipelinelems_web/src/widgets/CallMaterialOrderRecord/Views/Pages/CallMaterialOrderRecord/CallMaterialOrderRecord.tsx | 8 PipeLineLems/pipelinelems_web/src/widgets/CallMaterialOrder/Views/Pages/CallMaterialOrder/CallMaterialOrder.tsx | 4 PipeLineLems/server/src/CMS.Plugin.PipeLineLems/ProjectService/PipeLineLemsProjectService.cs | 277 +++++++++++++++++++-- 19 files changed, 565 insertions(+), 201 deletions(-) diff --git a/CommonDLL/CmsQueryExtensions.dll b/CommonDLL/CmsQueryExtensions.dll index 813fc1b..f4b2558 100644 --- a/CommonDLL/CmsQueryExtensions.dll +++ b/CommonDLL/CmsQueryExtensions.dll Binary files differ diff --git a/PipeLineLems/pipelinelems_web/src/widgets/CallMaterialOrder/Views/Pages/CallMaterialOrder/CallMaterialOrder.tsx b/PipeLineLems/pipelinelems_web/src/widgets/CallMaterialOrder/Views/Pages/CallMaterialOrder/CallMaterialOrder.tsx index 4ee6337..acc6a18 100644 --- a/PipeLineLems/pipelinelems_web/src/widgets/CallMaterialOrder/Views/Pages/CallMaterialOrder/CallMaterialOrder.tsx +++ b/PipeLineLems/pipelinelems_web/src/widgets/CallMaterialOrder/Views/Pages/CallMaterialOrder/CallMaterialOrder.tsx @@ -297,7 +297,7 @@ 鍙枡 </IconButton> <el-divider direction="vertical" /> - <el-upload + {/* <el-upload v-permission="callMaterialOrder-import" name="file" accept=".xlsx,.xls,.csv" @@ -309,7 +309,7 @@ action="/api/v1/PipeLineLems/callMaterialOrder/import" > <IconButton icon="in">瀵煎叆</IconButton> - </el-upload> + </el-upload> */} <IconButton v-permission="callMaterialOrder-output" diff --git a/PipeLineLems/pipelinelems_web/src/widgets/CallMaterialOrderRecord/Views/Pages/CallMaterialOrderRecord/CallMaterialOrderRecord.tsx b/PipeLineLems/pipelinelems_web/src/widgets/CallMaterialOrderRecord/Views/Pages/CallMaterialOrderRecord/CallMaterialOrderRecord.tsx index 540bcd8..ed77a29 100644 --- a/PipeLineLems/pipelinelems_web/src/widgets/CallMaterialOrderRecord/Views/Pages/CallMaterialOrderRecord/CallMaterialOrderRecord.tsx +++ b/PipeLineLems/pipelinelems_web/src/widgets/CallMaterialOrderRecord/Views/Pages/CallMaterialOrderRecord/CallMaterialOrderRecord.tsx @@ -271,7 +271,7 @@ <div class={styles.headerContent}> <div class={styles.header}> - <IconButton + {/* <IconButton v-permission="callMaterialOrderRecord-add" icon="add-p" onClick={onAddCallMaterialOrderRecord} @@ -281,8 +281,8 @@ </IconButton> <el-divider direction="vertical" /> - <el-divider direction="vertical" /> - <el-upload + <el-divider direction="vertical" /> */} + {/* <el-upload v-permission="callMaterialOrderRecord-import" name="file" accept=".xlsx,.xls,.csv" @@ -294,7 +294,7 @@ action="/api/v1/PipeLineLems/callMaterialOrderRecord/import" > <IconButton icon="in">瀵煎叆</IconButton> - </el-upload> + </el-upload> */} <IconButton v-permission="callMaterialOrderRecord-output" diff --git a/PipeLineLems/pipelinelems_web/src/widgets/WorkPlan/Views/Pages/WorkPlan/Config.ts b/PipeLineLems/pipelinelems_web/src/widgets/WorkPlan/Views/Pages/WorkPlan/Config.ts index e26a8f8..bb7c427 100644 --- a/PipeLineLems/pipelinelems_web/src/widgets/WorkPlan/Views/Pages/WorkPlan/Config.ts +++ b/PipeLineLems/pipelinelems_web/src/widgets/WorkPlan/Views/Pages/WorkPlan/Config.ts @@ -10,6 +10,21 @@ width:160, }, { + field: 'processName', + title: '宸ュ簭鍚嶇О', + width:160, +}, +{ + field: 'pipeSpecCode', + title: '绠℃缂栫爜', + width:160, +}, +{ + field: 'pipeSectionName', + title: '绠℃鍚嶇О', + width:160, +}, +{ field: 'workPlanStatusDesc', title: '璁″垝鐘舵��', width:160, @@ -109,11 +124,7 @@ title: '宸ヤ欢鍚嶇О', width:160, }, -{ - field: 'processName', - title: '宸ュ簭鍚嶇О', - width:160, -}, + { field: 'pipeFittingCode', title: '绠′欢缂栫爜', @@ -124,16 +135,7 @@ title: '椤哄簭鍙�', width:160, }, -{ - field: 'pipeSpecCode', - title: '绠℃缂栫爜', - width:160, -}, -{ - field: 'pipeSectionName', - title: '绠℃鍚嶇О', - width:160, -}, + { field: 'outerDiameter', title: '澶栧緞(mm)', diff --git a/PipeLineLems/pipelinelems_web/src/widgets/WorkPlan/Views/Pages/WorkPlan/WorkPlan.tsx b/PipeLineLems/pipelinelems_web/src/widgets/WorkPlan/Views/Pages/WorkPlan/WorkPlan.tsx index 6f745cc..e9598e6 100644 --- a/PipeLineLems/pipelinelems_web/src/widgets/WorkPlan/Views/Pages/WorkPlan/WorkPlan.tsx +++ b/PipeLineLems/pipelinelems_web/src/widgets/WorkPlan/Views/Pages/WorkPlan/WorkPlan.tsx @@ -304,7 +304,7 @@ <div class={styles.headerContent}> <div class={styles.header}> - <IconButton + {/* <IconButton v-permission="workPlan-add" icon="add-p" onClick={onAddWorkPlan} @@ -313,7 +313,7 @@ 娣诲姞 </IconButton> - <el-divider direction="vertical" /> + <el-divider direction="vertical" /> */} <el-upload v-permission="workPlan-import" name="file" diff --git a/PipeLineLems/server/src/CMS.Plugin.PipeLineLems.Application.Contracts/Dtos/CallMaterialOrder/CallMaterialOrderCreateOrUpdateDtoBase.cs b/PipeLineLems/server/src/CMS.Plugin.PipeLineLems.Application.Contracts/Dtos/CallMaterialOrder/CallMaterialOrderCreateOrUpdateDtoBase.cs index 9eb5224..50e4529 100644 --- a/PipeLineLems/server/src/CMS.Plugin.PipeLineLems.Application.Contracts/Dtos/CallMaterialOrder/CallMaterialOrderCreateOrUpdateDtoBase.cs +++ b/PipeLineLems/server/src/CMS.Plugin.PipeLineLems.Application.Contracts/Dtos/CallMaterialOrder/CallMaterialOrderCreateOrUpdateDtoBase.cs @@ -29,10 +29,15 @@ /// </summary> public int Quantity { get; set; } - /// <summary> - /// WMS杩斿洖缁撴灉 - /// </summary> - public string? WmsRetResult { get; set; } + /// <summary> + /// 鍒涘缓浜� + /// </summary> + public string CreatorName { get; set; } + + /// <summary> + /// WMS杩斿洖缁撴灉 + /// </summary> + public string? WmsRetResult { get; set; } /// <summary> /// WMS浠诲姟鍙� diff --git a/PipeLineLems/server/src/CMS.Plugin.PipeLineLems.Application.Contracts/Dtos/WorkPlan/PickInput.cs b/PipeLineLems/server/src/CMS.Plugin.PipeLineLems.Application.Contracts/Dtos/WorkPlan/PickInput.cs new file mode 100644 index 0000000..49f8699 --- /dev/null +++ b/PipeLineLems/server/src/CMS.Plugin.PipeLineLems.Application.Contracts/Dtos/WorkPlan/PickInput.cs @@ -0,0 +1,23 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace CMS.Plugin.PipeLineLems.Application.Contracts.Dtos.WorkPlan +{ + /// <summary> + /// 鍒嗘嫞杈撳叆鍙傛暟妯″瀷 + /// </summary> + [Serializable] + public class PickInput + { + + /// <summary> + /// 绠℃缂栫爜 + /// </summary> + public string PipeSpecCode { get; set; } + + + } +} \ No newline at end of file diff --git a/PipeLineLems/server/src/CMS.Plugin.PipeLineLems.Application.Contracts/Dtos/WorkPlan/WorkPlanCreateOrUpdateDtoBase.cs b/PipeLineLems/server/src/CMS.Plugin.PipeLineLems.Application.Contracts/Dtos/WorkPlan/WorkPlanCreateOrUpdateDtoBase.cs index c2c1949..1d6ca30 100644 --- a/PipeLineLems/server/src/CMS.Plugin.PipeLineLems.Application.Contracts/Dtos/WorkPlan/WorkPlanCreateOrUpdateDtoBase.cs +++ b/PipeLineLems/server/src/CMS.Plugin.PipeLineLems.Application.Contracts/Dtos/WorkPlan/WorkPlanCreateOrUpdateDtoBase.cs @@ -183,11 +183,16 @@ /// 鍒涘缓浜篒D /// </summary> public string? CreatorId { get; set; } + /// <summary> + /// 鍒涘缓浜� + /// </summary> + public string CreatorName { get; set; } - /// <summary> - /// 淇敼浜篒D - /// </summary> - public string? LastModifierId { get; set; } + + /// <summary> + /// 淇敼浜篒D + /// </summary> + public string? LastModifierId { get; set; } /// <summary> /// 鍒犻櫎鏃堕棿 diff --git a/PipeLineLems/server/src/CMS.Plugin.PipeLineLems.Application.Contracts/Services/IMesAppService.cs b/PipeLineLems/server/src/CMS.Plugin.PipeLineLems.Application.Contracts/Services/IMesAppService.cs index 08230b4..4c042d5 100644 --- a/PipeLineLems/server/src/CMS.Plugin.PipeLineLems.Application.Contracts/Services/IMesAppService.cs +++ b/PipeLineLems/server/src/CMS.Plugin.PipeLineLems.Application.Contracts/Services/IMesAppService.cs @@ -9,5 +9,6 @@ /// </summary> public interface IMesAppService { - Task<MesOrderResponse> CreateAsync(List<WorkPlanInput> input); + + Task<MesOrderResponse> CreateAsync(List<WorkPlanInput> input, string userId, string userAccount); } diff --git a/PipeLineLems/server/src/CMS.Plugin.PipeLineLems.Application.Contracts/Services/IWorkPlanAppService.cs b/PipeLineLems/server/src/CMS.Plugin.PipeLineLems.Application.Contracts/Services/IWorkPlanAppService.cs index c836361..513b7bd 100644 --- a/PipeLineLems/server/src/CMS.Plugin.PipeLineLems.Application.Contracts/Services/IWorkPlanAppService.cs +++ b/PipeLineLems/server/src/CMS.Plugin.PipeLineLems.Application.Contracts/Services/IWorkPlanAppService.cs @@ -1,6 +1,7 @@ using CMS.Plugin.PipeLineLems.Application.Contracts.Dtos.WorkPlan; using CMS.Plugin.PipeLineLems.Domain.WorkPlan; using Volo.Abp.Application.Services; +using Volo.Abp.Users; namespace CMS.Plugin.PipeLineLems.Application.Contracts.Services; @@ -45,7 +46,7 @@ /// </summary> /// <param name="input"></param> /// <returns></returns> - Task ImportAsync(WorkPlansImportModel input); + Task ImportAsync(WorkPlansImportModel input, string userId,string userAccount); /// <summary> /// 瀵煎嚭浣滀笟璁″垝琛� diff --git a/PipeLineLems/server/src/CMS.Plugin.PipeLineLems.Application/Implements/MesAppService.cs b/PipeLineLems/server/src/CMS.Plugin.PipeLineLems.Application/Implements/MesAppService.cs index eb3c6a9..c2beaf6 100644 --- a/PipeLineLems/server/src/CMS.Plugin.PipeLineLems.Application/Implements/MesAppService.cs +++ b/PipeLineLems/server/src/CMS.Plugin.PipeLineLems.Application/Implements/MesAppService.cs @@ -8,10 +8,11 @@ using CMS.Plugin.ProductManagement.Abstractions; using Microsoft.Extensions.DependencyInjection; using Volo.Abp; +using Volo.Abp.Users; namespace CMS.Plugin.PipeLineLems.Application.Implements; -public class MesAppService : CMSPluginAppService +public class MesAppService : CMSPluginAppService,IMesAppService { private readonly IServiceProvider _serviceProvider; private readonly WorkPlanAppService _workPlanAppService; @@ -30,9 +31,9 @@ _sharedService = sharedService; } - public async Task<MesOrderResponse> CreateAsync(List<WorkPlanInput> input) + public async Task<MesOrderResponse> CreateAsync(List<WorkPlanInput> input, string userId, string userAccount) { - var response = await _sharedService.CommonCreatebyApsAsync(input, _serviceProvider, _workPlanAppService); + var response = await _sharedService.CommonCreatebyApsAsync(input, _serviceProvider, _workPlanAppService, userId, userAccount); return response; } diff --git a/PipeLineLems/server/src/CMS.Plugin.PipeLineLems.Application/Implements/SharedService.cs b/PipeLineLems/server/src/CMS.Plugin.PipeLineLems.Application/Implements/SharedService.cs index 96e46e2..7211e3f 100644 --- a/PipeLineLems/server/src/CMS.Plugin.PipeLineLems.Application/Implements/SharedService.cs +++ b/PipeLineLems/server/src/CMS.Plugin.PipeLineLems.Application/Implements/SharedService.cs @@ -15,6 +15,10 @@ using System.Text; using CMS.Plugin.PipeLineLems.Domain.WorkPlan; using CMS.Plugin.PipeLineLems.Domain.CallMaterialOrderRecord; +using Volo.Abp.Users; +using CmsQueryExtensions.Entitys; +using CMS.Unit.RuntimeValue.Abstractions; +using CMS.Extensions.Variable; namespace CMS.Plugin.PipeLineLems.Application.Implements; @@ -23,6 +27,34 @@ /// </summary> public class SharedService : CMSPluginAppService { + + + public async Task<MesOrderResponse> CommonPick(IServiceProvider _serviceProvider, PickInput input, MyCurrentUser myCurrentUser) + { + //1銆佽褰曞垎鎷h褰曡〃 + //2銆佹洿鏂颁綔涓氳鍒掕〃鐨勭姸鎬� =宸插垎鎷� + //3銆佸啓鍏� 鍒嗘嫞鍙橀噺 + + VariableService _variableService = _serviceProvider.GetRequiredService<VariableService>(); + + Dictionary<string, object?> keyValuePairs = new Dictionary<string, object?> + { + { "鍒嗘嫞鎵樼洏鍙�","鎵樼洏1"}, + { "鍒嗘嫞鏂瑰悜", "鐭瑁呴厤"}, + { "鍒嗘嫞浜�", myCurrentUser.UserAccount } + }; + _variableService.WriteValueAsync(keyValuePairs); + var response = new MesOrderResponse + { + Code = "000000", + Data = "", + Fail = false, + Mesg = "澶勭悊鎴愬姛", + Success = true, + Time = DateTime.UtcNow + }; + return response; + } /// <summary> /// 鍒涘缓浣滀笟璁″垝 /// </summary> @@ -33,9 +65,11 @@ /// <exception cref="UserFriendlyException"></exception> public async Task<MesOrderResponse> CommonCreatebyApsAsync(List<WorkPlanInput> input, IServiceProvider _serviceProvider, - WorkPlanAppService workPlanAppService - ) + WorkPlanAppService workPlanAppService, + string userId, string userAccount + ) { + if (input == null) { throw new UserFriendlyException("杈撳叆鍙傛暟涓嶈兘涓虹┖"); @@ -62,6 +96,7 @@ var orderManager = _serviceProvider.GetRequiredService<IOrderManager>(); var productProvider = _serviceProvider.GetRequiredService<IProductProvider>(); var formulaProvider = _serviceProvider.GetRequiredService<IFormulaProvider>(); + List<OrderModel> orderModels = new List<OrderModel>(); #region 浜嬪姟 @@ -177,6 +212,7 @@ CallMaterialStatus = Domain.Shared.Enums.CallMaterialStatusEnum.鏈墽琛�, DataIdentifier = gTask.Key, MaterialMode = gTask.ToList().First().MaterialMode, + CreatorName = userAccount, Quantity = 1 }; @@ -185,7 +221,7 @@ - + //throw new UserFriendlyException($"涓诲姩瑙﹀彂澶辫触"); //淇濆瓨鍒� scms_workplans 琛ㄤ腑 foreach (var item in input) { @@ -194,6 +230,8 @@ insertObj.CallMaterialStatus = Domain.Shared.Enums.CallMaterialStatusEnum.鏈墽琛�; insertObj.WorkPlanStatus = Domain.Shared.Enums.WorkPlanStatusEnum.鏈敓浜�; insertObj.Sort = 1; + insertObj.CreatorName = userAccount; + insertObj.Remark = "绯荤粺瀵煎叆"; await workPlanAppService.CreateAsync(insertObj); } diff --git a/PipeLineLems/server/src/CMS.Plugin.PipeLineLems.Application/Implements/WorkPlanAppService.cs b/PipeLineLems/server/src/CMS.Plugin.PipeLineLems.Application/Implements/WorkPlanAppService.cs index 285fecf..b85d09c 100644 --- a/PipeLineLems/server/src/CMS.Plugin.PipeLineLems.Application/Implements/WorkPlanAppService.cs +++ b/PipeLineLems/server/src/CMS.Plugin.PipeLineLems.Application/Implements/WorkPlanAppService.cs @@ -10,6 +10,7 @@ using Volo.Abp.Data; using Volo.Abp.ObjectExtending; using Volo.Abp.ObjectMapping; +using Volo.Abp.Users; namespace CMS.Plugin.PipeLineLems.Application.Implements; @@ -307,13 +308,13 @@ /// <param name="input"></param> /// <returns></returns> /// <exception cref="UserFriendlyException"></exception> - public async Task ImportAsync(WorkPlansImportModel input) + public async Task ImportAsync(WorkPlansImportModel input, string userId,string userAccount) { //杞崲鏁版嵁 var result = ObjectMapper.Map<List<WorkPlansImportModel.WorkPlanImportModel>, List<WorkPlanInput>>(input.WorkPlans); //await CreatebyApsAsync(result); - await _sharedService.CommonCreatebyApsAsync(result, _serviceProvider, this); + await _sharedService.CommonCreatebyApsAsync(result, _serviceProvider, this, userId, userAccount); // Check.NotNull(input, nameof(input)); // var workPlanCreateDtos = new List<(int RowIndex, WorkPlanCreateDto Item)>(); diff --git a/PipeLineLems/server/src/CMS.Plugin.PipeLineLems/CMS.Plugin.PipeLineLems.csproj b/PipeLineLems/server/src/CMS.Plugin.PipeLineLems/CMS.Plugin.PipeLineLems.csproj index 88da0f4..099e1a1 100644 --- a/PipeLineLems/server/src/CMS.Plugin.PipeLineLems/CMS.Plugin.PipeLineLems.csproj +++ b/PipeLineLems/server/src/CMS.Plugin.PipeLineLems/CMS.Plugin.PipeLineLems.csproj @@ -56,6 +56,12 @@ </ItemGroup> <ItemGroup> + <Reference Include="CmsQueryExtensions"> + <HintPath>..\..\..\..\CommonDLL\CmsQueryExtensions.dll</HintPath> + </Reference> + </ItemGroup> + + <ItemGroup> <Resource Include="Flows\50001_1.pfd"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> </Resource> diff --git a/PipeLineLems/server/src/CMS.Plugin.PipeLineLems/CMSPluginEntry.cs b/PipeLineLems/server/src/CMS.Plugin.PipeLineLems/CMSPluginEntry.cs index e3530a5..87ffc61 100644 --- a/PipeLineLems/server/src/CMS.Plugin.PipeLineLems/CMSPluginEntry.cs +++ b/PipeLineLems/server/src/CMS.Plugin.PipeLineLems/CMSPluginEntry.cs @@ -49,7 +49,7 @@ context.Services.AddScoped<IProjectRuntimeMigrator, CMSPluginRuntimeMigrator>(); context.Services.AddSingleton<IProjectService, PipeLineLemsProjectService>(); - + context.Services.AddScoped<IMesAppService, MesAppService>(); context.Services.AddScoped<IWorkPlanAppService, WorkPlanAppService>(); context.Services.AddScoped<IEFDataProvider>(p => diff --git a/PipeLineLems/server/src/CMS.Plugin.PipeLineLems/Controller/WorkPlanController.cs b/PipeLineLems/server/src/CMS.Plugin.PipeLineLems/Controller/WorkPlanController.cs index e792517..bc77738 100644 --- a/PipeLineLems/server/src/CMS.Plugin.PipeLineLems/Controller/WorkPlanController.cs +++ b/PipeLineLems/server/src/CMS.Plugin.PipeLineLems/Controller/WorkPlanController.cs @@ -1,75 +1,79 @@ -using Ao.Lang; -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.Authorization; -using Microsoft.AspNetCore.Http; -using Microsoft.AspNetCore.Mvc; -using MiniExcelLibs; -using System.Reflection; -using Volo.Abp; -using Volo.Abp.Application.Dtos; - -namespace CMS.Plugin.PipeLineLems.Controller -{ +using Ao.Lang; +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 CmsQueryExtensions.Entitys; +using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Mvc; +using MiniExcelLibs; +using System.Reflection; +using Volo.Abp; +using Volo.Abp.Application.Dtos; + +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 WorkPlanController : ControllerBase - { - private readonly IWorkPlanAppService _workPlanAppService; - + [ApiController] + [TypeFilter(typeof(CMSLanguageFilter))] + [TypeFilter(typeof(CMSUowActionFilter))] + [TypeFilter(typeof(CMSAuditActionFilter))] + [TypeFilter(typeof(CMSExceptionFilter))] + [Route("api/v{version:apiVersion}/PipeLineLems/[controller]")] + public class WorkPlanController : ControllerBase + { + private readonly IWorkPlanAppService _workPlanAppService; + 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) - { - _workPlanAppService = workPlanAppService; - } - + public WorkPlanController(IWorkPlanAppService workPlanAppService, ICurrentUser currentUser) + { + _workPlanAppService = workPlanAppService; + _currentUser = currentUser; + } + /// <summary> /// 鑾峰彇浣滀笟璁″垝琛� /// </summary> /// <param name="id">鏍囪瘑绗�.</param> /// <returns></returns> - [HttpGet] - [Route("{id}")] - public virtual Task<WorkPlanDto> GetAsync(Guid id) - { - return _workPlanAppService.GetAsync(id); - } - + [HttpGet] + [Route("{id}")] + public virtual Task<WorkPlanDto> GetAsync(Guid id) + { + return _workPlanAppService.GetAsync(id); + } + /// <summary> /// 鍒嗛〉鑾峰彇浣滀笟璁″垝琛ㄧ殑鍒楄〃. /// </summary> /// <param name="input">杈撳叆.</param> /// <returns></returns> - [HttpGet] - [Route("Page")] - public virtual Task<PagedResultDto<WorkPlanDto>> GetListAsync([FromQuery] GetWorkPlanInput input) - { - return _workPlanAppService.GetListAsync(input); - } - + [HttpGet] + [Route("Page")] + public virtual Task<PagedResultDto<WorkPlanDto>> GetListAsync([FromQuery] GetWorkPlanInput input) + { + return _workPlanAppService.GetListAsync(input); + } + /// <summary> /// 鍒涘缓浣滀笟璁″垝琛� /// </summary> /// <param name="input">杈撳叆.</param> /// <returns></returns> //[Authorize] - [HttpPost] - public virtual Task<WorkPlanDto> CreateAsync(WorkPlanCreateDto input) - { - return _workPlanAppService.CreateAsync(input); - } - + [HttpPost] + public virtual Task<WorkPlanDto> CreateAsync(WorkPlanCreateDto input) + { + return _workPlanAppService.CreateAsync(input); + } + /// <summary> /// 鏇存柊浣滀笟璁″垝琛� /// </summary> @@ -77,112 +81,120 @@ /// <param name="input">杈撳叆.</param> /// <returns></returns> //[Authorize] - [HttpPut] - [Route("{id}")] - public virtual Task<WorkPlanDto> UpdateAsync(Guid id, WorkPlanUpdateDto input) - { - return _workPlanAppService.UpdateAsync(id, input); - } - + [HttpPut] + [Route("{id}")] + public virtual Task<WorkPlanDto> UpdateAsync(Guid id, WorkPlanUpdateDto input) + { + return _workPlanAppService.UpdateAsync(id, input); + } + /// <summary> /// 鍏嬮殕浣滀笟璁″垝琛� /// </summary> /// <param name="ids">Id闆嗗悎.</param> /// <returns></returns> //[Authorize] - [HttpPost] - [Route("Clone")] - public virtual Task<List<WorkPlanDto>> CloneAsync([FromBody] IEnumerable<Guid> ids) - { - return _workPlanAppService.CloneAsync(ids); - } - + [HttpPost] + [Route("Clone")] + public virtual Task<List<WorkPlanDto>> CloneAsync([FromBody] IEnumerable<Guid> ids) + { + return _workPlanAppService.CloneAsync(ids); + } + /// <summary> /// 鍒犻櫎浣滀笟璁″垝琛� /// </summary> /// <param name="id">鏍囪瘑绗�.</param> /// <returns></returns> //[Authorize] - [HttpDelete] - [Route("{id}")] - public virtual Task DeleteAsync(Guid id) - { - return _workPlanAppService.DeleteAsync(id); - } - + [HttpDelete] + [Route("{id}")] + public virtual Task DeleteAsync(Guid id) + { + return _workPlanAppService.DeleteAsync(id); + } + /// <summary> /// 鎵归噺鍒犻櫎浣滀笟璁″垝琛� /// </summary> /// <param name="ids">The ids.</param> /// <returns></returns> //[Authorize] - [HttpDelete] - public virtual Task DeleteAsync([FromBody] IEnumerable<Guid> ids) - { - return _workPlanAppService.DeleteManyAsync(ids); - } - + [HttpDelete] + public virtual Task DeleteAsync([FromBody] IEnumerable<Guid> ids) + { + return _workPlanAppService.DeleteManyAsync(ids); + } + /// <summary> /// 璋冩暣鎺掑簭浣滀笟璁″垝琛� /// </summary> /// <param name="id">鏍囪瘑绗�.</param> /// <returns></returns> - [HttpPut] - [Route("{id}/AdjustSort/{sort}")] - public virtual Task AdjustSortAsync(Guid id, int sort) - { - return _workPlanAppService.AdjustSortAsync(id, sort); - } - + [HttpPut] + [Route("{id}/AdjustSort/{sort}")] + public virtual Task AdjustSortAsync(Guid id, int sort) + { + return _workPlanAppService.AdjustSortAsync(id, sort); + } + /// <summary> /// 瀵煎叆浣滀笟璁″垝琛� /// </summary> /// <returns></returns> - [Authorize] - [HttpPost] - [Route("Import")] - public virtual async Task<IActionResult> ImportAsync(IFormFile file) - { - using var stream = new MemoryStream(); - await file.CopyToAsync(stream); - stream.Seek(0L, SeekOrigin.Begin); - - var sheetNames = stream.GetSheetNames(); - var workPlanRows = sheetNames.Contains("閰嶇疆") ? MiniExcel.Query<WorkPlansImportModel.WorkPlanImportModel>(stream, sheetName: "閰嶇疆").ToList() : new(); - - if (!workPlanRows.Any()) - { - throw new UserFriendlyException("璇锋鏌ュ鍏ョ殑琛ㄦ牸"); - } - - await _workPlanAppService.ImportAsync(new WorkPlansImportModel - { - WorkPlans = workPlanRows, - }); - - return Ok(); - } - + [Authorize] + [HttpPost] + [Route("Import")] + public virtual async Task<IActionResult> ImportAsync(IFormFile file) + { + using var stream = new MemoryStream(); + 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(); + + if (!workPlanRows.Any()) + { + throw new UserFriendlyException("璇锋鏌ュ鍏ョ殑琛ㄦ牸"); + } + + await _workPlanAppService.ImportAsync(new WorkPlansImportModel + { + WorkPlans = workPlanRows, + }, userId, userAccount); + + return Ok(); + } + /// <summary> /// 瀵煎嚭浣滀笟璁″垝琛� /// </summary> /// <returns></returns> - [HttpGet] - [Route("Export")] - public virtual async Task<IActionResult> ExportAsync([FromQuery] GetWorkPlanInput input) - { - input.MaxResultCount = int.MaxValue; - var exportData = await _workPlanAppService.ExportAsync(input); - var templatePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, $"Resources/Templates/WorkPlan瀵煎嚭妯℃澘.xlsx"); - if (!System.IO.File.Exists(templatePath)) - { - templatePath = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) ?? string.Empty, $"Resources/Templates/WorkPlan瀵煎嚭妯℃澘.xlsx"); - } - - var memoryStream = new MemoryStream(); - await memoryStream.SaveAsByTemplateAsync(templatePath, exportData.Sheets); - memoryStream.Seek(0L, SeekOrigin.Begin); - return new FileStreamResult(memoryStream, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet") { FileDownloadName = $"{exportData.FileName}_{DateTime.Now:yyyyMMddhhmmss}.xlsx" }; - } - } -} + [HttpGet] + [Route("Export")] + public virtual async Task<IActionResult> ExportAsync([FromQuery] GetWorkPlanInput input) + { + input.MaxResultCount = int.MaxValue; + var exportData = await _workPlanAppService.ExportAsync(input); + var templatePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, $"Resources/Templates/WorkPlan瀵煎嚭妯℃澘.xlsx"); + if (!System.IO.File.Exists(templatePath)) + { + templatePath = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) ?? string.Empty, $"Resources/Templates/WorkPlan瀵煎嚭妯℃澘.xlsx"); + } + + var memoryStream = new MemoryStream(); + await memoryStream.SaveAsByTemplateAsync(templatePath, exportData.Sheets); + memoryStream.Seek(0L, SeekOrigin.Begin); + return new FileStreamResult(memoryStream, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet") { FileDownloadName = $"{exportData.FileName}_{DateTime.Now:yyyyMMddhhmmss}.xlsx" }; + } + } +} diff --git a/PipeLineLems/server/src/CMS.Plugin.PipeLineLems/Controller/WorkPlanPublicController.cs b/PipeLineLems/server/src/CMS.Plugin.PipeLineLems/Controller/WorkPlanPublicController.cs index 354df06..e8c4fd2 100644 --- a/PipeLineLems/server/src/CMS.Plugin.PipeLineLems/Controller/WorkPlanPublicController.cs +++ b/PipeLineLems/server/src/CMS.Plugin.PipeLineLems/Controller/WorkPlanPublicController.cs @@ -1,6 +1,8 @@ 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 CmsQueryExtensions.Entitys; using Microsoft.AspNetCore.Mvc; using System.Reflection; @@ -19,13 +21,21 @@ { private readonly IMesAppService _mesAppService; + private readonly ICurrentUser _currentUser; + private readonly Application.Implements.SharedService sharedService; + private IServiceProvider _serviceProvider; + /// <summary> /// Initializes a new instance of the <see cref="TestEntityNameController"/> class. /// </summary> /// <param name="testentitynameAppService">The testentityname application service.</param> - public WorkPlanPublicController(IMesAppService mesAppService) + public WorkPlanPublicController(IMesAppService mesAppService, ICurrentUser currentUser, Application.Implements.SharedService _sharedService, + IServiceProvider serviceProvider) { _mesAppService = mesAppService; + _currentUser = currentUser; + sharedService = _sharedService; + _serviceProvider = serviceProvider; } /// <summary> @@ -36,9 +46,24 @@ [HttpPost] public virtual async Task<MesOrderResponse> GetWorkPlanAsync([FromBody] List<WorkPlanInput> input) { - return await _mesAppService.CreateAsync(input); + return await _mesAppService.CreateAsync(input,"",""); } - + /// <summary> + /// 鍒嗘嫞 + /// </summary> + /// <param name="input">鏍囪瘑绗�.</param> + /// <returns></returns> + [HttpPost] + [Route("Pick")] + public virtual async Task<MesOrderResponse> Pick([FromBody] PickInput input) + { + MyCurrentUser myCurrentUser = new MyCurrentUser() + { + UserAccount = _currentUser.UserAccount, + UserId = _currentUser.UserId + }; + return await sharedService.CommonPick(_serviceProvider, input, myCurrentUser); + } } } diff --git a/PipeLineLems/server/src/CMS.Plugin.PipeLineLems/ProjectService/PipeLineLemsProjectService.cs b/PipeLineLems/server/src/CMS.Plugin.PipeLineLems/ProjectService/PipeLineLemsProjectService.cs index df8778c..ed7599c 100644 --- a/PipeLineLems/server/src/CMS.Plugin.PipeLineLems/ProjectService/PipeLineLemsProjectService.cs +++ b/PipeLineLems/server/src/CMS.Plugin.PipeLineLems/ProjectService/PipeLineLemsProjectService.cs @@ -20,6 +20,7 @@ using CMS.Plugin.PipeLineLems.Domain.WorkPlan; using CMS.Plugin.PipeLineLems.Domain.CallMaterialOrder; using System.Collections.Generic; +using CMS.Framework.AspNetCore.Users; namespace CMS.Plugin.PipeLineLems.ProjectService { @@ -31,6 +32,7 @@ private IServiceProvider _serviceProvider; private readonly ILogger<PipeLineLemsProjectService> _logger; private readonly IVariableDataCache _variableDataCache; + /// <summary> /// 鍙橀噺鏈嶅姟 @@ -84,6 +86,8 @@ _monitorVariableNames = new Dictionary<string, string> { { "鎵撶爜杩涚珯淇″彿", "鎵撶爜杩涚珯淇″彿(鎻忚堪)" }, + { "璇锋眰鐢熸垚鎵撶爜浜у搧鐮佷俊鍙�", "璇锋眰鐢熸垚鎵撶爜浜у搧鐮佷俊鍙�(鎻忚堪)" }, + { "璇锋眰鐢熸垚鍒囧壊浜у搧鐮佷俊鍙�", "璇锋眰鐢熸垚鍒囧壊浜у搧鐮佷俊鍙�(鎻忚堪)" }, { "鍒囧壊杩涚珯淇″彿", "鍒囧壊杩涚珯淇″彿(鎻忚堪)" }, }; @@ -142,6 +146,30 @@ _logger.LogInformation($"{changed.Name} 鍙橀噺鍊煎彂鐢熷彉鍖栵紝鏃у�納oldValue}=鏂板�納newValue}锛孴raceId={traceId}"); + if (changed.Name == "璇锋眰鐢熸垚鎵撶爜浜у搧鐮佷俊鍙�" && changed.New?.Value.SafeString().ToBool() == true) + { + + // TODO: 澶勭悊鍙橀噺鍊煎彉鍖� + // Tips锛歨ttps://cms-docs.shengyc.com/cms/api/%E5%90%8E%E7%AB%AF#3-%E5%8F%98%E9%87%8F%E6%A8%A1%E5%9D%97 + /* 璇存槑锛氶�氳繃璁㈤槄 IVariableDataCache.TagChanged 浜嬩欢锛屾偍鍙互瀹炴椂鐩戞帶鍙橀噺鐨勫彉鍖栥�傛浜嬩欢浼氫紶閫掓墍鏈夊彉閲忚嚦浜嬩欢澶勭悊鍑芥暟锛屽洜姝わ紝涓氬姟灞傞渶鍦ㄥ嚱鏁颁腑绛涢�夊叧娉ㄧ殑鍙橀噺銆� + 娉ㄦ剰浜嬮」锛� + 锛�1锛夋�ц兘褰卞搷锛� 鍙戝竷浜嬩欢鏃讹紝浜嬩欢鐨勫彂閫佽�呭皢闃诲娴佺▼銆傚洜姝わ紝寮虹儓寤鸿閬垮厤鍦ㄤ簨浠跺鐞嗗嚱鏁颁腑鎵ц I/ O 鎿嶄綔銆丠TTP 鎺ュ彛璁块棶鎴栧叾浠栬�楁椂鎿嶄綔锛屼互闃叉瀵圭郴缁熸�ц兘浜х敓涓ラ噸褰卞搷锛屽鑷存暣涓郴缁熷搷搴斿欢杩熴�� + 锛�2锛夐珮棰戠巼瑙﹀彂锛� 鐢变簬浜嬩欢璁㈤槄浜嗗叏閲忓彉閲忥紝瑙﹀彂棰戠巼鍙兘闈炲父楂樸�� + 锛�3锛夊紓姝ュ鐞嗭細 閴翠簬浜嬩欢瑙﹀彂棰戠巼寰堥珮锛屽缓璁笟鍔″眰鍦ㄧ瓫閫夊叧娉ㄥ彉閲忓悗锛屼娇鐢� Task 鍚姩鏂扮嚎绋嬪鐞嗕笟鍔¢�昏緫锛屼互閬垮厤闃诲鏍稿績鐨勫彉閲忕洃鍚姛鑳斤紝瀹炵幇涓氬姟灞備笌骞冲彴鍩哄骇鐨勮В鑰︺�� + 锛�4锛夊苟鍙戠鐞嗭細 濡傛灉涓氬姟灞傚苟鍙戦噺澶э紝蹇呴』浼樺寲浠g爜璁捐鍜屽疄鏂斤紝浠ュ噺灏戝湪楂樺苟鍙戞儏鍐典笅鐨勭郴缁熻祫婧愭秷鑰楋紝闃叉绯荤粺鎬ц兘闂銆� + 锛�5锛変唬鐮佸畨鍏細 瀹夎骞朵娇鐢� CMS.CodeAnalysis 鍒嗘瀽鍣ㄦ潵鍒嗘瀽 IVariableDataCache.TagChanged 鐨勪娇鐢ㄦ儏鍐点�傝宸ュ叿鑳藉湪浣跨敤涓嶅綋鏃舵彁渚涚紪璇戦敊璇紝甯姪鎮ㄦ彁楂樹唬鐮佽川閲忋��*/ + + _ = Task.Run(async () => + { + await HanlderForPringBarCodeByCreateProductAsync(); + // 渚�1锛氬悓姝ュ鐞� + //await ProcessAsync(); + + // 渚�2锛氳皟鐢ㄥ閮ˋPI + //await ExecuteExternalApiAsync(); + }); + } + if (changed.Name == "鎵撶爜杩涚珯淇″彿" && changed.New?.Value.SafeString().ToBool() == true) { @@ -166,6 +194,8 @@ }); } + + if (changed.Name == "鍒囧壊杩涚珯淇″彿" && changed.New?.Value.SafeString().ToBool() == true) { @@ -182,6 +212,31 @@ _ = Task.Run(async () => { await HanlderForCutAsync(); + // 渚�1锛氬悓姝ュ鐞� + //await ProcessAsync(); + + // 渚�2锛氳皟鐢ㄥ閮ˋPI + //await ExecuteExternalApiAsync(); + }); + } + + + if (changed.Name == "璇锋眰鐢熸垚鍒囧壊浜у搧鐮佷俊鍙�" && changed.New?.Value.SafeString().ToBool() == true) + { + + // TODO: 澶勭悊鍙橀噺鍊煎彉鍖� + // Tips锛歨ttps://cms-docs.shengyc.com/cms/api/%E5%90%8E%E7%AB%AF#3-%E5%8F%98%E9%87%8F%E6%A8%A1%E5%9D%97 + /* 璇存槑锛氶�氳繃璁㈤槄 IVariableDataCache.TagChanged 浜嬩欢锛屾偍鍙互瀹炴椂鐩戞帶鍙橀噺鐨勫彉鍖栥�傛浜嬩欢浼氫紶閫掓墍鏈夊彉閲忚嚦浜嬩欢澶勭悊鍑芥暟锛屽洜姝わ紝涓氬姟灞傞渶鍦ㄥ嚱鏁颁腑绛涢�夊叧娉ㄧ殑鍙橀噺銆� + 娉ㄦ剰浜嬮」锛� + 锛�1锛夋�ц兘褰卞搷锛� 鍙戝竷浜嬩欢鏃讹紝浜嬩欢鐨勫彂閫佽�呭皢闃诲娴佺▼銆傚洜姝わ紝寮虹儓寤鸿閬垮厤鍦ㄤ簨浠跺鐞嗗嚱鏁颁腑鎵ц I/ O 鎿嶄綔銆丠TTP 鎺ュ彛璁块棶鎴栧叾浠栬�楁椂鎿嶄綔锛屼互闃叉瀵圭郴缁熸�ц兘浜х敓涓ラ噸褰卞搷锛屽鑷存暣涓郴缁熷搷搴斿欢杩熴�� + 锛�2锛夐珮棰戠巼瑙﹀彂锛� 鐢变簬浜嬩欢璁㈤槄浜嗗叏閲忓彉閲忥紝瑙﹀彂棰戠巼鍙兘闈炲父楂樸�� + 锛�3锛夊紓姝ュ鐞嗭細 閴翠簬浜嬩欢瑙﹀彂棰戠巼寰堥珮锛屽缓璁笟鍔″眰鍦ㄧ瓫閫夊叧娉ㄥ彉閲忓悗锛屼娇鐢� Task 鍚姩鏂扮嚎绋嬪鐞嗕笟鍔¢�昏緫锛屼互閬垮厤闃诲鏍稿績鐨勫彉閲忕洃鍚姛鑳斤紝瀹炵幇涓氬姟灞備笌骞冲彴鍩哄骇鐨勮В鑰︺�� + 锛�4锛夊苟鍙戠鐞嗭細 濡傛灉涓氬姟灞傚苟鍙戦噺澶э紝蹇呴』浼樺寲浠g爜璁捐鍜屽疄鏂斤紝浠ュ噺灏戝湪楂樺苟鍙戞儏鍐典笅鐨勭郴缁熻祫婧愭秷鑰楋紝闃叉绯荤粺鎬ц兘闂銆� + 锛�5锛変唬鐮佸畨鍏細 瀹夎骞朵娇鐢� CMS.CodeAnalysis 鍒嗘瀽鍣ㄦ潵鍒嗘瀽 IVariableDataCache.TagChanged 鐨勪娇鐢ㄦ儏鍐点�傝宸ュ叿鑳藉湪浣跨敤涓嶅綋鏃舵彁渚涚紪璇戦敊璇紝甯姪鎮ㄦ彁楂樹唬鐮佽川閲忋��*/ + + _ = Task.Run(async () => + { + await HanlderForCutByCreateProductAsync(); // 渚�1锛氬悓姝ュ鐞� //await ProcessAsync(); @@ -229,7 +284,7 @@ } /// <summary> - /// 鎵撶爜 + /// 鎵撶爜杩涚珯淇″彿 /// </summary> /// <returns></returns> private async Task HanlderForPringBarCodeAsync() @@ -268,40 +323,46 @@ var workPlanList = await workPlanAppService.FindByDataIdentifierAsync(callMaterialOrder.DataIdentifier); if (workPlanList?.Count == 0) return;//缁撴潫 - //TODO:鏆傛椂鐢熸垚浜у搧ID - //var productID = DateTime.Now.ToString("yyyyMMddHHmmssfff"); - var productID = workPlanList.First().PipeSpecCode; - Dictionary<string, object?> keyValuePairs_productID = new Dictionary<string, object?> - { - { "鎵撶爜_ProductID", productID}, - }; - var ret = _variableService.WriteValueAsync(keyValuePairs_productID); + ////TODO:鏆傛椂鐢熸垚浜у搧ID + ////var productID = DateTime.Now.ToString("yyyyMMddHHmmssfff"); + //var productID = workPlanList.First().PipeSpecCode; + //Dictionary<string, object?> keyValuePairs_productID = new Dictionary<string, object?> + //{ + // { "鎵撶爜_ProductID", productID}, + //}; + //var ret = _variableService.WriteValueAsync(keyValuePairs_productID); - //鏇存柊涓虹敓浜т腑 - foreach (var item in workPlanList) - { - item.WorkPlanStatus = Domain.Shared.Enums.WorkPlanStatusEnum.鐢熶骇涓�; - } - await workPlanRepository.UpdateManyAsync(workPlanList); + ////鏇存柊涓虹敓浜т腑 + //foreach (var item in workPlanList) + //{ + // item.WorkPlanStatus = Domain.Shared.Enums.WorkPlanStatusEnum.鐢熶骇涓�; + //} + //await workPlanRepository.UpdateManyAsync(workPlanList); //寰楀埌鐮佸�� var code1 = ""; var code2 = ""; var code3 = ""; + var pipeSpecCode1 = ""; + var pipeSpecCode2 = ""; + var pipeSpecCode3 = ""; var new_workPlanList = workPlanList.Where(x => x.ProcessRouteNumber == "鍒囧壊").ToList(); for (int i = 0; i < new_workPlanList.Count; i++) { if (i == 0) { code1 = new_workPlanList[i].MarkingContent; + pipeSpecCode1 = new_workPlanList[i].PipeSpecCode; } if (i == 1) { code2 = new_workPlanList[i].MarkingContent; + pipeSpecCode2 = new_workPlanList[i].PipeSpecCode; } if (i == 2) { code3 = new_workPlanList[i].MarkingContent; + pipeSpecCode3 = new_workPlanList[i].PipeSpecCode; } } Dictionary<string, object?> keyValuePairs = new Dictionary<string, object?> @@ -309,6 +370,9 @@ { "鎵撶爜宸ヤ欢1",code1}, { "鎵撶爜宸ヤ欢2", code2}, { "鎵撶爜宸ヤ欢3", code3 }, + { "鎵撶爜绠℃缂栫爜1",pipeSpecCode1}, + { "鎵撶爜绠℃缂栫爜2", pipeSpecCode2}, + { "鎵撶爜绠℃缂栫爜3", pipeSpecCode3 }, { "鎵撶爜绠℃缂栫爜", new_workPlanList.First().PipeSpecCode }, { "鎵撶爜绠℃鍚嶇О", new_workPlanList.First().PipeSectionName }, { "鎵撶爜鍘熸枡绠″瀷鍙�", new_workPlanList.First().MaterialMode }, @@ -325,6 +389,75 @@ var ret2 = _variableService.WriteValueAsync(keyValuePairs); + + + uow.CompleteAsync(); + } + catch (Exception) + { + uow.RollbackAsync(); + throw; + } + } + } + + /// <summary> + /// 璇锋眰鐢熸垚鎵撶爜浜у搧鐮佷俊鍙� + /// </summary> + /// <returns></returns> + private async Task HanlderForPringBarCodeByCreateProductAsync() + { + + var workPlanAppService = _serviceProvider.GetRequiredService<IWorkPlanAppService>(); + var workPlanRepository = _serviceProvider.GetRequiredService<IWorkPlanRepository>(); + var callMaterialOrderAppService = _serviceProvider.GetRequiredService<ICallMaterialOrderAppService>(); + + using var scope = _serviceProvider.CreateScope(); + var unitOfWorkManager = scope.ServiceProvider.GetRequiredService<IUnitOfWorkManager>(); + using var uow = unitOfWorkManager.Begin(requiresNew: true); + + var plcTaskNo = await _variableService.ReadValueAsync("鎵撶爜杩涚珯PLC浠诲姟鍙�"); + + if (string.IsNullOrEmpty(plcTaskNo?.Content?.Value.SafeString().ToString())) + { + + } + else + { + + + + var myTaskNo = plcTaskNo.Content.Value.SafeString().ToString(); + CallMaterialOrder callMaterialOrder = null; + try + { + //鏍规嵁wms浠诲姟鍙峰鎵� 鍙枡宸ュ崟 + callMaterialOrder = await callMaterialOrderAppService.FindByWmsTaskNoAsync(myTaskNo); + if (callMaterialOrder == null) return;//缁撴潫 + + + + //鏍规嵁鍘熸枡鏍囪瘑瀵绘壘 浣滀笟璁″垝 + var workPlanList = await workPlanAppService.FindByDataIdentifierAsync(callMaterialOrder.DataIdentifier); + if (workPlanList?.Count == 0) return;//缁撴潫 + + //TODO:鏆傛椂鐢熸垚浜у搧ID + //var productID = DateTime.Now.ToString("yyyyMMddHHmmssfff"); + var productID = callMaterialOrder.DataIdentifier; + Dictionary<string, object?> keyValuePairs_productID = new Dictionary<string, object?> + { + { "鎵撶爜_ProductID", productID}, + }; + var ret = _variableService.WriteValueAsync(keyValuePairs_productID); + + + //鏇存柊涓虹敓浜т腑 + var new_workPlanList = workPlanList.Where(x => x.ProcessRouteNumber == "鍒囧壊").ToList(); + foreach (var item in new_workPlanList) + { + item.WorkPlanStatus = Domain.Shared.Enums.WorkPlanStatusEnum.鐢熶骇涓�; + } + await workPlanRepository.UpdateManyAsync(new_workPlanList); uow.CompleteAsync(); @@ -447,40 +580,46 @@ var workPlanList = await workPlanAppService.FindByDataIdentifierAsync(callMaterialOrder.DataIdentifier); if (workPlanList?.Count == 0) return;//缁撴潫 - //TODO:鏆傛椂鐢熸垚浜у搧ID - //var productID = DateTime.Now.ToString("yyyyMMddHHmmssfff"); - var productID = workPlanList.First().PipeSpecCode; - Dictionary<string, object?> keyValuePairs_productID = new Dictionary<string, object?> - { - { "鍒囧壊_ProductID", productID}, - }; - var ret = _variableService.WriteValueAsync(keyValuePairs_productID); + ////TODO:鏆傛椂鐢熸垚浜у搧ID + ////var productID = DateTime.Now.ToString("yyyyMMddHHmmssfff"); + //var productID = workPlanList.First().PipeSpecCode; + //Dictionary<string, object?> keyValuePairs_productID = new Dictionary<string, object?> + //{ + // { "鍒囧壊_ProductID", productID}, + //}; + //var ret = _variableService.WriteValueAsync(keyValuePairs_productID); - //鏇存柊涓虹敓浜т腑 - foreach (var item in workPlanList) - { - item.WorkPlanStatus = Domain.Shared.Enums.WorkPlanStatusEnum.鐢熶骇涓�; - } - await workPlanRepository.UpdateManyAsync(workPlanList); + ////鏇存柊涓虹敓浜т腑 + //foreach (var item in workPlanList) + //{ + // item.WorkPlanStatus = Domain.Shared.Enums.WorkPlanStatusEnum.鐢熶骇涓�; + //} + //await workPlanRepository.UpdateManyAsync(workPlanList); //寰楀埌鐮佸�� decimal code1 = 0; decimal code2 = 0; decimal code3 = 0; + var pipeSpecCode1 = ""; + var pipeSpecCode2 = ""; + var pipeSpecCode3 = ""; var new_workPlanList = workPlanList.Where(x => x.ProcessRouteNumber == "瑁呴厤").ToList(); for (int i = 0; i < new_workPlanList.Count; i++) { if (i == 0) { code1 = new_workPlanList[i].CuttingPosition; + pipeSpecCode1 = new_workPlanList[i].PipeSpecCode; } if (i == 1) { code2 = new_workPlanList[i].CuttingPosition; + pipeSpecCode2 = new_workPlanList[i].PipeSpecCode; } if (i == 2) { code3 = new_workPlanList[i].CuttingPosition; + pipeSpecCode3 = new_workPlanList[i].PipeSpecCode; } } Dictionary<string, object?> keyValuePairs = new Dictionary<string, object?> @@ -488,6 +627,9 @@ { "鍒囧壊浣嶇疆1",code1}, { "鍒囧壊浣嶇疆2", code2}, { "鍒囧壊浣嶇疆3", code3 }, + { "鍒囧壊绠℃缂栫爜1",pipeSpecCode1}, + { "鍒囧壊绠℃缂栫爜2", pipeSpecCode2}, + { "鍒囧壊绠℃缂栫爜3", pipeSpecCode3 }, { "鍒囧壊绠℃缂栫爜", new_workPlanList.First().PipeSpecCode }, { "鍒囧壊绠℃鍚嶇О", new_workPlanList.First().PipeSectionName }, { "鍒囧壊鍘熸枡绠″瀷鍙�", new_workPlanList.First().MaterialMode }, @@ -515,5 +657,82 @@ } } } + + /// <summary> + /// 璇锋眰鐢熸垚鍒囧壊浜у搧鐮佷俊鍙� + /// </summary> + /// <returns></returns> + private async Task HanlderForCutByCreateProductAsync() + { + + var workPlanAppService = _serviceProvider.GetRequiredService<IWorkPlanAppService>(); + var workPlanRepository = _serviceProvider.GetRequiredService<IWorkPlanRepository>(); + var callMaterialOrderAppService = _serviceProvider.GetRequiredService<ICallMaterialOrderAppService>(); + + using var scope = _serviceProvider.CreateScope(); + var unitOfWorkManager = scope.ServiceProvider.GetRequiredService<IUnitOfWorkManager>(); + using var uow = unitOfWorkManager.Begin(requiresNew: true); + + var plcTaskNo = await _variableService.ReadValueAsync("鍒囧壊杩涚珯PLC浠诲姟鍙�"); + + if (string.IsNullOrEmpty(plcTaskNo?.Content?.Value.SafeString().ToString())) + { + + } + else + { + + + + var myTaskNo = plcTaskNo.Content.Value.SafeString().ToString(); + CallMaterialOrder callMaterialOrder = null; + try + { + //鏍规嵁wms浠诲姟鍙峰鎵� 鍙枡宸ュ崟 + callMaterialOrder = await callMaterialOrderAppService.FindByWmsTaskNoAsync(myTaskNo); + if (callMaterialOrder == null) return;//缁撴潫 + + + + //鏍规嵁鍘熸枡鏍囪瘑瀵绘壘 浣滀笟璁″垝 + var workPlanList = await workPlanAppService.FindByDataIdentifierAsync(callMaterialOrder.DataIdentifier); + if (workPlanList?.Count == 0) return;//缁撴潫 + + //TODO:鏆傛椂鐢熸垚浜у搧ID + //var productID = DateTime.Now.ToString("yyyyMMddHHmmssfff"); + var productID = callMaterialOrder.DataIdentifier; + Dictionary<string, object?> keyValuePairs_productID = new Dictionary<string, object?> + { + { "鍒囧壊_ProductID", productID}, + }; + var ret = _variableService.WriteValueAsync(keyValuePairs_productID); + + var new_workPlanList = workPlanList.Where(x => x.ProcessRouteNumber == "瑁呴厤").ToList(); + //鏇存柊涓虹敓浜т腑 + foreach (var item in new_workPlanList) + { + item.WorkPlanStatus = Domain.Shared.Enums.WorkPlanStatusEnum.鐢熶骇涓�; + item.Remark = "鏇存柊鐢熶骇涓�"; + } + await workPlanRepository.UpdateManyAsync(new_workPlanList); + + var new_workPlanList_printCode = workPlanList.Where(x => x.ProcessRouteNumber == "鍒囧壊").ToList(); + foreach (var item in new_workPlanList_printCode) + { + item.WorkPlanStatus = Domain.Shared.Enums.WorkPlanStatusEnum.宸插畬鎴�; + item.Remark = "鏇存柊宸插畬鎴�"; + } + await workPlanRepository.UpdateManyAsync(new_workPlanList_printCode); + + + uow.CompleteAsync(); + } + catch (Exception) + { + uow.RollbackAsync(); + throw; + } + } + } } } diff --git "a/Weben_CMS\344\270\223\347\224\250\344\273\243\347\240\201\347\224\237\346\210\220\345\231\250/queryExtensions/CmsQueryExtensions/Entitys/MyCurrentUser.cs" "b/Weben_CMS\344\270\223\347\224\250\344\273\243\347\240\201\347\224\237\346\210\220\345\231\250/queryExtensions/CmsQueryExtensions/Entitys/MyCurrentUser.cs" new file mode 100644 index 0000000..2b6a81b --- /dev/null +++ "b/Weben_CMS\344\270\223\347\224\250\344\273\243\347\240\201\347\224\237\346\210\220\345\231\250/queryExtensions/CmsQueryExtensions/Entitys/MyCurrentUser.cs" @@ -0,0 +1,25 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace CmsQueryExtensions.Entitys +{ + /// <summary> + /// 褰撳墠鐧诲綍鐢ㄦ埛瀵硅薄 + /// </summary> + [Serializable] + public class MyCurrentUser + { + /// <summary> + /// 鐢ㄦ埛ID + /// </summary> + public string? UserId { get; set; } + + /// <summary> + /// 鐢ㄦ埛鍚� + /// </summary> + public string? UserAccount { get; set; } + } +} -- Gitblit v1.9.3