From c611663e387949c48c37587a0a291f2ed1eb92a6 Mon Sep 17 00:00:00 2001
From: schangxiang@126.com <schangxiang@126.com>
Date: 周二, 23 4月 2024 15:51:17 +0800
Subject: [PATCH] 修复 打印模板 处理枚举类型的问题

---
 iWare_RawMaterialWarehouse_Wms/Admin.NET.Application/Service/System/CodeGen/CodeGenService.cs |   48 ++++++++++++++++++++++--------------------------
 1 files changed, 22 insertions(+), 26 deletions(-)

diff --git a/iWare_RawMaterialWarehouse_Wms/Admin.NET.Application/Service/System/CodeGen/CodeGenService.cs b/iWare_RawMaterialWarehouse_Wms/Admin.NET.Application/Service/System/CodeGen/CodeGenService.cs
index f1aa40d..9760a98 100644
--- a/iWare_RawMaterialWarehouse_Wms/Admin.NET.Application/Service/System/CodeGen/CodeGenService.cs
+++ b/iWare_RawMaterialWarehouse_Wms/Admin.NET.Application/Service/System/CodeGen/CodeGenService.cs
@@ -16,23 +16,11 @@
 using Microsoft.EntityFrameworkCore.Infrastructure;
 using Microsoft.EntityFrameworkCore.Metadata;
 using Newtonsoft.Json;
-using OfficeOpenXml.Drawing;
 using OfficeOpenXml;
-using System;
+using StackExchange.Profiling.Internal;
+using System.Reflection;
 using System.Text;
 using System.Web;
-using OfficeOpenXml.FormulaParsing.Excel.Functions.Math;
-using OfficeOpenXml.Style;
-using System.Net.WebSockets;
-using OfficeOpenXml.FormulaParsing.Excel.Functions.RefAndLookup;
-using Microsoft.EntityFrameworkCore.Metadata.Internal;
-using System.Reflection;
-using NetTopologySuite.Noding;
-using System.Xml.Linq;
-using static Npgsql.Replication.PgOutput.Messages.RelationMessage;
-using StackExchange.Profiling.Internal;
-using System.Collections.Generic;
-using System.Data.SqlTypes;
 
 namespace Admin.NET.Application.CodeGen
 {
@@ -47,7 +35,7 @@
         private readonly IRepository<SysLowCode> _sysLowCodeRep; // 浠g爜鐢熸垚鍣ㄤ粨鍌�
         private readonly ICodeGenConfigService _codeGenConfigService;
         private readonly IViewEngine _viewEngine;
-        private readonly ISysExcelTemplateService _sysExcelTemplateService;
+        private readonly ISysEnumDataService _sysEnumDataService;
         private readonly IRepository<SysMenu> _sysMenuRep; // 鑿滃崟琛ㄤ粨鍌�
 
         /// <summary>
@@ -58,19 +46,20 @@
         /// <param name="codeGenConfigService"></param>
         /// <param name="viewEngine"></param>
         /// <param name="sysMenuRep"></param>
+        /// <param name="sysEnumDataService"></param>
         public CodeGenerateService(IRepository<SysCodeGen> sysCodeGenRep,
                               IRepository<SysLowCode> sysLowCodeRep,
                               ICodeGenConfigService codeGenConfigService,
                               IViewEngine viewEngine,
                               IRepository<SysMenu> sysMenuRep,
-            ISysExcelTemplateService sysExcelTemplateService)
+            ISysEnumDataService sysEnumDataService)
         {
             _sysCodeGenRep = sysCodeGenRep;
             _sysLowCodeRep = sysLowCodeRep;
             _codeGenConfigService = codeGenConfigService;
             _viewEngine = viewEngine;
             _sysMenuRep = sysMenuRep;
-            _sysExcelTemplateService = sysExcelTemplateService;
+            _sysEnumDataService = sysEnumDataService;
         }
 
         /// <summary>
@@ -1041,6 +1030,7 @@
 
                     //鑾峰彇瑕佸鐞嗙殑浠g爜鐢熸垚閰嶇疆鐨勬槸澧炴敼鐨勬ā鐗堝瓧娈�
                     var showCodeGenConfigs = tableFieldList.Where(w => w.WhetherAddUpdate.Equals("Y")).ToList();
+                    showCodeGenConfigs = showCodeGenConfigs.Where(x => x.ColumnKey.ToLower() == "false").ToList();
                     int _mergeCellsCount = showCodeGenConfigs.Count();//鍚堝苟鍒楋紙妯$増璧嬪�肩殑鏍囬鍒楁暟锛�
                                                                       //鑾峰彇蹇呭~瀛楁
 
@@ -1102,26 +1092,26 @@
             StringBuilder _remarkContentBuilder = new StringBuilder();
             _remarkContentBuilder.AppendLine("");
             _remarkContentBuilder.AppendLine("1.鏀寔Excel2007鍙婁互涓婄増鏈枃浠躲��");
-            _remarkContentBuilder.AppendLine("2.瀵煎叆鏂板鏁版嵁鏃朵笉鑳借秴杩�5000琛屻��");
-            _remarkContentBuilder.AppendLine("3.瀵煎叆鏇存柊鏁版嵁鏃朵笉鑳借秴杩�2000琛屻��");
+            _remarkContentBuilder.AppendLine("2.瀵煎叆鏁版嵁鏃朵笉鑳借秴杩�5000琛屻��");
             _remarkContentBuilder.AppendLine("");
             _remarkContentBuilder.AppendLine("");
 
             Dictionary<string, string> typeNameDict = new()
             {
-                { "string", "鏂囨湰銆�"},
-                { "int", "鏁板瓧銆�"},
-                { "long", "鏁板瓧銆�"},
-                { "decimal", "灏忔暟銆�"},
-                { "bool", "甯冨皵銆傜ず渚嬶細鏄�佸惁銆�"},
+                { "string", "杈撳叆鏂囨湰銆�"},
+                { "int", "杈撳叆鏁板瓧銆�"},
+                { "long", "杈撳叆鏁板瓧銆�"},
+                { "decimal", "杈撳叆灏忔暟銆�"},
+                { "bool", "鏄�,鍚︺��"},
 
             };
             Dictionary<string, string> effectTypeDict = new()
             {
-                { "datepicker", "鏃ユ湡銆� 绀轰緥: 2023/3/1"},
-                { "datetimepicker", "鏃ユ湡鏃堕棿銆傜ず渚�: 2023/3/1 12:00:00"},
+                { "datepicker", "鏃ユ湡銆� 绀轰緥: 2023/3/1銆�"},
+                { "datetimepicker", "鏃ユ湡鏃堕棿銆傜ず渚�: 2023/3/1 12:00:00銆�"},
 
             };
+
             requiredTableFieldList.ForEach(x =>
             {
                 string text = "";
@@ -1134,6 +1124,12 @@
                 {
                     text += typeNameDict[x.DtoNetType];
                 }
+                else if (x.EffectType == "select")
+                {
+                    var queryValue = x.DtoNetType.Split('.').Last();
+                    var enumStr = _sysEnumDataService.GetEnumDataListStr(new EnumDataInput() { EnumName = queryValue });
+                    text += enumStr + "銆�";
+                }
                 else
                 {
                     text += ("娉ㄦ剰锛氱被鍨嬫湭鑳借瘑鍒嚭鏉ワ紝闇�瑕佽嚜宸辩淮鎶わ紒锛侊紒銆�");

--
Gitblit v1.9.3