From 727ed59c834554dfea2afc77a883f1545c9165a5 Mon Sep 17 00:00:00 2001
From: schangxiang@126.com <schangxiang@126.com>
Date: 周一, 12 5月 2025 14:56:10 +0800
Subject: [PATCH] 222

---
 PipeLineLems/server/src/CMS.Plugin.PipeLineLems.Application/Implements/MesAppService.cs          |    2 
 PipeLineLems/server/src/CMS.Plugin.PipeLineLems.Application/Implements/SharedService.cs          |   40 +++++++++++++++++--
 PipeLineLems/server/src/CMS.Plugin.PipeLineLems.Application.Contracts/Dtos/WorkPlan/PickInput.cs |   23 +++++++++++
 PipeLineLems/server/src/CMS.Plugin.PipeLineLems/Controller/WorkPlanController.cs                 |    6 +++
 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/Controller/WorkPlanPublicController.cs           |   31 ++++++++++++++-
 PipeLineLems/server/src/CMS.Plugin.PipeLineLems/CMSPluginEntry.cs                                |    2 
 PipeLineLems/server/src/CMS.Plugin.PipeLineLems/ProjectService/PipeLineLemsProjectService.cs     |    4 +-
 9 files changed, 104 insertions(+), 13 deletions(-)

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/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/Implements/MesAppService.cs b/PipeLineLems/server/src/CMS.Plugin.PipeLineLems.Application/Implements/MesAppService.cs
index 4a053d1..c2beaf6 100644
--- a/PipeLineLems/server/src/CMS.Plugin.PipeLineLems.Application/Implements/MesAppService.cs
+++ b/PipeLineLems/server/src/CMS.Plugin.PipeLineLems.Application/Implements/MesAppService.cs
@@ -12,7 +12,7 @@
 
 namespace CMS.Plugin.PipeLineLems.Application.Implements;
 
-public class MesAppService : CMSPluginAppService
+public class MesAppService : CMSPluginAppService,IMesAppService
 {
     private readonly IServiceProvider _serviceProvider;
     private readonly WorkPlanAppService _workPlanAppService;
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 b56150f..5a25ab4 100644
--- a/PipeLineLems/server/src/CMS.Plugin.PipeLineLems.Application/Implements/SharedService.cs
+++ b/PipeLineLems/server/src/CMS.Plugin.PipeLineLems.Application/Implements/SharedService.cs
@@ -16,6 +16,9 @@
 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;
 
@@ -24,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>
@@ -34,11 +65,11 @@
     /// <exception cref="UserFriendlyException"></exception>
 
     public async Task<MesOrderResponse> CommonCreatebyApsAsync(List<WorkPlanInput> input, IServiceProvider _serviceProvider,
-        WorkPlanAppService workPlanAppService,
-        string userId, string userAccount
-        )
+    WorkPlanAppService workPlanAppService,
+    string userId, string userAccount
+    )
     {
-      
+
         if (input == null)
         {
             throw new UserFriendlyException("杈撳叆鍙傛暟涓嶈兘涓虹┖");
@@ -198,7 +229,6 @@
                 insertObj.CallMaterialStatus = Domain.Shared.Enums.CallMaterialStatusEnum.鏈墽琛�;
                 insertObj.WorkPlanStatus = Domain.Shared.Enums.WorkPlanStatusEnum.鏈敓浜�;
                 insertObj.Sort = 1;
-                insertObj.CreatorId = userId;
                 insertObj.CreatorName = userAccount;
                 await workPlanAppService.CreateAsync(insertObj);
             }
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 22406bb..bc77738 100644
--- a/PipeLineLems/server/src/CMS.Plugin.PipeLineLems/Controller/WorkPlanController.cs
+++ b/PipeLineLems/server/src/CMS.Plugin.PipeLineLems/Controller/WorkPlanController.cs
@@ -3,6 +3,7 @@
 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;
@@ -152,6 +153,11 @@
 
             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();
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 1e3200e..b9c5024 100644
--- a/PipeLineLems/server/src/CMS.Plugin.PipeLineLems/ProjectService/PipeLineLemsProjectService.cs
+++ b/PipeLineLems/server/src/CMS.Plugin.PipeLineLems/ProjectService/PipeLineLemsProjectService.cs
@@ -443,7 +443,7 @@
 
                     //TODO:鏆傛椂鐢熸垚浜у搧ID
                     //var productID = DateTime.Now.ToString("yyyyMMddHHmmssfff");
-                    var productID = workPlanList.First().PipeSpecCode;
+                    var productID = callMaterialOrder.DataIdentifier;
                     Dictionary<string, object?> keyValuePairs_productID = new Dictionary<string, object?>
                     {
                         { "鎵撶爜_ProductID", productID},
@@ -698,7 +698,7 @@
 
                     //TODO:鏆傛椂鐢熸垚浜у搧ID
                     //var productID = DateTime.Now.ToString("yyyyMMddHHmmssfff");
-                    var productID = workPlanList.First().PipeSpecCode;
+                    var productID = callMaterialOrder.DataIdentifier;
                     Dictionary<string, object?> keyValuePairs_productID = new Dictionary<string, object?>
                     {
                         { "鍒囧壊_ProductID", productID},

--
Gitblit v1.9.3