From 0eeea319afd6c7ccb76e09fd2fb4fbf226c820a3 Mon Sep 17 00:00:00 2001
From: zs <zhousong@weben-smart.com>
Date: 周四, 08 5月 2025 08:52:24 +0800
Subject: [PATCH] Merge branch 'master' of http://222.71.245.114:9086/r/HIA24016N_PipeLineDemo
---
Weben_CMS专用代码生成器/Code/Const/TemplateConst.cs | 13 +
Weben_CMS专用代码生成器/Code/MainForm.cs | 130 +++++++++++
Weben_CMS专用代码生成器/Code/File/ExcelTemplateFile/CommonTemplate.xlsx | 0
Weben_CMS专用代码生成器/Code/Utility/ImportTemplteHelper.cs | 204 ++++++++++++++++++
Weben_CMS专用代码生成器/Code/File/GenerateCodeConfigParamFiles/物料信息表配置文本.txt | 12 +
Weben_CMS专用代码生成器/Code/Model/GenerateCodeConfigParam.cs | 25 ++
Weben_CMS专用代码生成器/Code/MainForm.Designer.cs | 80 +++++-
Weben_CMS专用代码生成器/Code/packages.config | 28 ++
Weben_CMS专用代码生成器/Code/App.config | 24 ++
Weben_CMS专用代码生成器/Code/GenerateCode_WeiBen_CMS.csproj | 114 ++++++++++
10 files changed, 608 insertions(+), 22 deletions(-)
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/Code/App.config" "b/Weben_CMS\344\270\223\347\224\250\344\273\243\347\240\201\347\224\237\346\210\220\345\231\250/Code/App.config"
index 25af00c..3654ec7 100644
--- "a/Weben_CMS\344\270\223\347\224\250\344\273\243\347\240\201\347\224\237\346\210\220\345\231\250/Code/App.config"
+++ "b/Weben_CMS\344\270\223\347\224\250\344\273\243\347\240\201\347\224\237\346\210\220\345\231\250/Code/App.config"
@@ -22,6 +22,30 @@
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
</dependentAssembly>
+ <dependentAssembly>
+ <assemblyIdentity name="System.Memory" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
+ <bindingRedirect oldVersion="0.0.0.0-4.0.1.2" newVersion="4.0.1.2" />
+ </dependentAssembly>
+ <dependentAssembly>
+ <assemblyIdentity name="System.ValueTuple" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
+ <bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" />
+ </dependentAssembly>
+ <dependentAssembly>
+ <assemblyIdentity name="System.Threading.Tasks.Extensions" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
+ <bindingRedirect oldVersion="0.0.0.0-4.2.0.1" newVersion="4.2.0.1" />
+ </dependentAssembly>
+ <dependentAssembly>
+ <assemblyIdentity name="Microsoft.Bcl.AsyncInterfaces" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
+ <bindingRedirect oldVersion="0.0.0.0-8.0.0.0" newVersion="8.0.0.0" />
+ </dependentAssembly>
+ <dependentAssembly>
+ <assemblyIdentity name="System.Buffers" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
+ <bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" />
+ </dependentAssembly>
+ <dependentAssembly>
+ <assemblyIdentity name="System.Security.Cryptography.Pkcs" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
+ <bindingRedirect oldVersion="0.0.0.0-4.1.1.0" newVersion="4.1.1.0" />
+ </dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
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/Code/Const/TemplateConst.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/Code/Const/TemplateConst.cs"
new file mode 100644
index 0000000..d7f103a
--- /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/Code/Const/TemplateConst.cs"
@@ -0,0 +1,13 @@
+锘縰sing System;
+
+namespace GenerateCode_WeiBen_WMS.Const
+{
+ public class TemplateConst
+ {
+ /// <summary>
+ /// 鐢熸垚瀵煎叆妯℃澘鐨凟xcel鏂囦欢璺緞(鍏叡)
+ /// </summary>
+ public static string EXCEL_TEMPLATEFILE_瀵煎叆妯$増璺緞 = AppDomain.CurrentDomain.BaseDirectory + @"\File\ExcelTemplateFile";
+ public static string EXCEL_TEMPLATEFILE_瀵煎叆妯$増鍚嶇О鍚庣紑 = "瀵煎嚭妯℃澘";
+ }
+}
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/Code/File/ExcelTemplateFile/CommonTemplate.xlsx" "b/Weben_CMS\344\270\223\347\224\250\344\273\243\347\240\201\347\224\237\346\210\220\345\231\250/Code/File/ExcelTemplateFile/CommonTemplate.xlsx"
new file mode 100644
index 0000000..b814a7d
--- /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/Code/File/ExcelTemplateFile/CommonTemplate.xlsx"
Binary files differ
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/Code/File/GenerateCodeConfigParamFiles/\347\211\251\346\226\231\344\277\241\346\201\257\350\241\250\351\205\215\347\275\256\346\226\207\346\234\254.txt" "b/Weben_CMS\344\270\223\347\224\250\344\273\243\347\240\201\347\224\237\346\210\220\345\231\250/Code/File/GenerateCodeConfigParamFiles/\347\211\251\346\226\231\344\277\241\346\201\257\350\241\250\351\205\215\347\275\256\346\226\207\346\234\254.txt"
new file mode 100644
index 0000000..329cf9e
--- /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/Code/File/GenerateCodeConfigParamFiles/\347\211\251\346\226\231\344\277\241\346\201\257\350\241\250\351\205\215\347\275\256\346\226\207\346\234\254.txt"
@@ -0,0 +1,12 @@
+锘縖琛ㄥ悕]:scms_wmsmaterials
+[瀹炰綋绫诲悕]:WmsMaterial
+[瀹炰綋绫诲璞″悕]:wmsMaterial
+[椤甸潰鑿滃崟鍚峕:鐗╂枡淇℃伅
+[椤甸潰鑿滃崟瀵硅薄缂╁啓]:wmsMaterial
+[琛ㄧ殑涓枃娉ㄨВ]:鐗╂枡鍩虹淇℃伅琛�
+[閲嶅鎬ф牎楠屽瓧娈礭:MaterialCode
+[鍒犻櫎鎻愮ず瀛楁]:MaterialCode
+[妯$硦鏌ヨ瀛楁]:'MaterialCode', 'MaterialName', 'Remark'
+[妯$硦鏌ヨ瀛楁鍚峕:璇疯緭鍏ョ墿鏂欑紪鐮�/鐗╂枡鍚嶇О/澶囨敞
+[椤圭洰鍛藉悕绌洪棿]:HIAWms
+[鏋氫妇绫诲瀷瀛楁闆嗗悎]:PurchaseType|PurchaseTypeEnum|PurchaseTypeDesc,MaterialType|MaterialTypeEnum|MaterialTypeDesc,IsMainBranch|YesNoEnum|IsMainBranchDesc
\ No newline at end of file
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/Code/GenerateCode_WeiBen_CMS.csproj" "b/Weben_CMS\344\270\223\347\224\250\344\273\243\347\240\201\347\224\237\346\210\220\345\231\250/Code/GenerateCode_WeiBen_CMS.csproj"
index 5447997..0c9b4e0 100644
--- "a/Weben_CMS\344\270\223\347\224\250\344\273\243\347\240\201\347\224\237\346\210\220\345\231\250/Code/GenerateCode_WeiBen_CMS.csproj"
+++ "b/Weben_CMS\344\270\223\347\224\250\344\273\243\347\240\201\347\224\237\346\210\220\345\231\250/Code/GenerateCode_WeiBen_CMS.csproj"
@@ -28,6 +28,8 @@
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
<TargetFrameworkProfile />
+ <NuGetPackageImportStamp>
+ </NuGetPackageImportStamp>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<PlatformTarget>x86</PlatformTarget>
@@ -54,14 +56,47 @@
<ApplicationIcon>Robot.ico</ApplicationIcon>
</PropertyGroup>
<ItemGroup>
+ <Reference Include="EPPlus.Interfaces, Version=8.0.0.0, Culture=neutral, PublicKeyToken=a694d7f3b0907a61, processorArchitecture=MSIL">
+ <HintPath>packages\EPPlus.Interfaces.8.0.0\lib\net462\EPPlus.Interfaces.dll</HintPath>
+ </Reference>
+ <Reference Include="Magicodes.IE.EPPlus, Version=2.7.5.2, Culture=neutral, processorArchitecture=MSIL">
+ <HintPath>packages\Magicodes.IE.EPPlus.2.7.5.2\lib\netstandard2.0\Magicodes.IE.EPPlus.dll</HintPath>
+ </Reference>
<Reference Include="Microsoft.Bcl.AsyncInterfaces, Version=8.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>packages\Microsoft.Bcl.AsyncInterfaces.8.0.0\lib\net462\Microsoft.Bcl.AsyncInterfaces.dll</HintPath>
+ </Reference>
+ <Reference Include="Microsoft.Extensions.Configuration, Version=3.1.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
+ <HintPath>packages\Microsoft.Extensions.Configuration.3.1.0\lib\netstandard2.0\Microsoft.Extensions.Configuration.dll</HintPath>
+ </Reference>
+ <Reference Include="Microsoft.Extensions.Configuration.Abstractions, Version=3.1.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
+ <HintPath>packages\Microsoft.Extensions.Configuration.Abstractions.3.1.0\lib\netstandard2.0\Microsoft.Extensions.Configuration.Abstractions.dll</HintPath>
+ </Reference>
+ <Reference Include="Microsoft.Extensions.Configuration.FileExtensions, Version=3.1.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
+ <HintPath>packages\Microsoft.Extensions.Configuration.FileExtensions.3.1.0\lib\netstandard2.0\Microsoft.Extensions.Configuration.FileExtensions.dll</HintPath>
+ </Reference>
+ <Reference Include="Microsoft.Extensions.Configuration.Json, Version=3.1.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
+ <HintPath>packages\Microsoft.Extensions.Configuration.Json.3.1.0\lib\netstandard2.0\Microsoft.Extensions.Configuration.Json.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Extensions.DependencyInjection.Abstractions, Version=8.0.0.2, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>packages\Microsoft.Extensions.DependencyInjection.Abstractions.8.0.2\lib\net462\Microsoft.Extensions.DependencyInjection.Abstractions.dll</HintPath>
</Reference>
+ <Reference Include="Microsoft.Extensions.FileProviders.Abstractions, Version=3.1.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
+ <HintPath>packages\Microsoft.Extensions.FileProviders.Abstractions.3.1.0\lib\netstandard2.0\Microsoft.Extensions.FileProviders.Abstractions.dll</HintPath>
+ </Reference>
+ <Reference Include="Microsoft.Extensions.FileProviders.Physical, Version=3.1.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
+ <HintPath>packages\Microsoft.Extensions.FileProviders.Physical.3.1.0\lib\netstandard2.0\Microsoft.Extensions.FileProviders.Physical.dll</HintPath>
+ </Reference>
+ <Reference Include="Microsoft.Extensions.FileSystemGlobbing, Version=3.1.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
+ <HintPath>packages\Microsoft.Extensions.FileSystemGlobbing.3.1.0\lib\netstandard2.0\Microsoft.Extensions.FileSystemGlobbing.dll</HintPath>
+ </Reference>
<Reference Include="Microsoft.Extensions.Logging.Abstractions, Version=8.0.0.2, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>packages\Microsoft.Extensions.Logging.Abstractions.8.0.2\lib\net462\Microsoft.Extensions.Logging.Abstractions.dll</HintPath>
+ </Reference>
+ <Reference Include="Microsoft.Extensions.Primitives, Version=3.1.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
+ <HintPath>packages\Microsoft.Extensions.Primitives.3.1.0\lib\netstandard2.0\Microsoft.Extensions.Primitives.dll</HintPath>
+ </Reference>
+ <Reference Include="Microsoft.IO.RecyclableMemoryStream, Version=3.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
+ <HintPath>packages\Microsoft.IO.RecyclableMemoryStream.3.0.1\lib\netstandard2.0\Microsoft.IO.RecyclableMemoryStream.dll</HintPath>
</Reference>
<Reference Include="MySqlConnector, Version=2.0.0.0, Culture=neutral, PublicKeyToken=d33d3e53aa5f8c92, processorArchitecture=MSIL">
<HintPath>packages\MySqlConnector.2.4.0\lib\net48\MySqlConnector.dll</HintPath>
@@ -69,14 +104,31 @@
<Reference Include="Newtonsoft.Json, Version=11.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>packages\Newtonsoft.Json.11.0.2\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
+ <Reference Include="PresentationCore" />
+ <Reference Include="SixLabors.ImageSharp, Version=1.0.0.0, Culture=neutral, PublicKeyToken=d998eea7b14cab13, processorArchitecture=MSIL">
+ <HintPath>packages\SixLabors.ImageSharp.1.0.4\lib\net472\SixLabors.ImageSharp.dll</HintPath>
+ </Reference>
+ <Reference Include="SkiaSharp, Version=2.88.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756, processorArchitecture=MSIL">
+ <HintPath>packages\SkiaSharp.2.88.6\lib\net462\SkiaSharp.dll</HintPath>
+ </Reference>
<Reference Include="System" />
<Reference Include="System.Buffers, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>packages\System.Buffers.4.5.1\lib\net461\System.Buffers.dll</HintPath>
</Reference>
+ <Reference Include="System.ComponentModel.Annotations, Version=4.2.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
+ <HintPath>packages\System.ComponentModel.Annotations.5.0.0\lib\net461\System.ComponentModel.Annotations.dll</HintPath>
+ </Reference>
+ <Reference Include="System.ComponentModel.Composition" />
+ <Reference Include="System.ComponentModel.DataAnnotations" />
<Reference Include="System.configuration" />
<Reference Include="System.Core" />
<Reference Include="System.Diagnostics.DiagnosticSource, Version=8.0.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>packages\System.Diagnostics.DiagnosticSource.8.0.1\lib\net462\System.Diagnostics.DiagnosticSource.dll</HintPath>
+ </Reference>
+ <Reference Include="System.IO, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
+ <HintPath>packages\System.IO.4.3.0\lib\net462\System.IO.dll</HintPath>
+ <Private>True</Private>
+ <Private>True</Private>
</Reference>
<Reference Include="System.Memory, Version=4.0.1.2, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>packages\System.Memory.4.5.5\lib\net461\System.Memory.dll</HintPath>
@@ -85,13 +137,57 @@
<Reference Include="System.Numerics.Vectors, Version=4.1.4.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll</HintPath>
</Reference>
+ <Reference Include="System.Runtime, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
+ <HintPath>packages\System.Runtime.4.3.0\lib\net462\System.Runtime.dll</HintPath>
+ <Private>True</Private>
+ <Private>True</Private>
+ </Reference>
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>packages\System.Runtime.CompilerServices.Unsafe.6.0.0\lib\net461\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
+ </Reference>
+ <Reference Include="System.Security" />
+ <Reference Include="System.Security.Cryptography.Algorithms, Version=4.2.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
+ <HintPath>packages\System.Security.Cryptography.Algorithms.4.3.0\lib\net463\System.Security.Cryptography.Algorithms.dll</HintPath>
+ <Private>True</Private>
+ <Private>True</Private>
+ </Reference>
+ <Reference Include="System.Security.Cryptography.Encoding, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
+ <HintPath>packages\System.Security.Cryptography.Encoding.4.3.0\lib\net46\System.Security.Cryptography.Encoding.dll</HintPath>
+ <Private>True</Private>
+ <Private>True</Private>
+ </Reference>
+ <Reference Include="System.Security.Cryptography.Pkcs, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
+ <HintPath>packages\System.Security.Cryptography.Pkcs.4.7.0\lib\net461\System.Security.Cryptography.Pkcs.dll</HintPath>
+ </Reference>
+ <Reference Include="System.Security.Cryptography.Primitives, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
+ <HintPath>packages\System.Security.Cryptography.Primitives.4.3.0\lib\net46\System.Security.Cryptography.Primitives.dll</HintPath>
+ <Private>True</Private>
+ <Private>True</Private>
+ </Reference>
+ <Reference Include="System.Security.Cryptography.X509Certificates, Version=4.1.1.2, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
+ <HintPath>packages\System.Security.Cryptography.X509Certificates.4.3.2\lib\net461\System.Security.Cryptography.X509Certificates.dll</HintPath>
+ <Private>True</Private>
+ <Private>True</Private>
+ </Reference>
+ <Reference Include="System.Security.Cryptography.Xml, Version=8.0.0.2, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
+ <HintPath>packages\System.Security.Cryptography.Xml.8.0.2\lib\net462\System.Security.Cryptography.Xml.dll</HintPath>
+ </Reference>
+ <Reference Include="System.Text.Encoding.CodePages, Version=4.1.3.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
+ <HintPath>packages\System.Text.Encoding.CodePages.4.7.0\lib\net461\System.Text.Encoding.CodePages.dll</HintPath>
+ </Reference>
+ <Reference Include="System.Text.Encodings.Web, Version=4.0.5.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
+ <HintPath>packages\System.Text.Encodings.Web.4.7.0\lib\netstandard2.0\System.Text.Encodings.Web.dll</HintPath>
+ </Reference>
+ <Reference Include="System.Text.Json, Version=4.0.1.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
+ <HintPath>packages\System.Text.Json.4.7.0\lib\net461\System.Text.Json.dll</HintPath>
</Reference>
<Reference Include="System.Threading.Tasks.Extensions, Version=4.2.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>packages\System.Threading.Tasks.Extensions.4.5.4\lib\net461\System.Threading.Tasks.Extensions.dll</HintPath>
</Reference>
<Reference Include="System.Transactions" />
+ <Reference Include="System.ValueTuple, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
+ <HintPath>packages\System.ValueTuple.4.5.0\lib\net47\System.ValueTuple.dll</HintPath>
+ </Reference>
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Data" />
@@ -102,6 +198,7 @@
</ItemGroup>
<ItemGroup>
<Compile Include="Const\SystemConst.cs" />
+ <Compile Include="Const\TemplateConst.cs" />
<Compile Include="DataBaseFactory\DataBaseServiceHandle.cs" />
<Compile Include="DataBaseFactory\DataBaseServiceFactory.cs" />
<Compile Include="DataBaseFactory\Default\SqlServerDataBaseServiceHandle.cs" />
@@ -152,6 +249,7 @@
<Compile Include="Generate\Web\Views\Pages\EntityNameClass\EntityNameClass_Config_Generate.cs" />
<Compile Include="Generate\Web\Views\Pages\EntityNameClass\EntityNameClass_Generate.cs" />
<Compile Include="Generate\Web\Views\Pages\EntityNameClass\EntityNameClass_module_Generate.cs" />
+ <Compile Include="Model\GenerateCodeConfigParam.cs" />
<Compile Include="Model\GenerateCodeParam.cs" />
<Compile Include="Model\Enum\DataBaseEnum.cs" />
<Compile Include="Model\Enum\DataTypeEnum.cs" />
@@ -163,6 +261,7 @@
<Compile Include="Generate\Model_Generate.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
+ <Compile Include="Utility\ImportTemplteHelper.cs" />
<Compile Include="Utility\ListHelper.cs" />
<Compile Include="Utility\MySqlHelper.cs" />
<Compile Include="Utility\SQLHelper.cs" />
@@ -188,6 +287,9 @@
<DependentUpon>MainForm.cs</DependentUpon>
</EmbeddedResource>
<None Include="App.config" />
+ <None Include="File\ExcelTemplateFile\CommonTemplate.xlsx">
+ <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+ </None>
<None Include="packages.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
@@ -374,10 +476,22 @@
<Content Include="Templete\Web\Views\Pages\EntityNameClass\EntityNameClass妯℃澘.txt">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
+ <Content Include="File\GenerateCodeConfigParamFiles\鐗╂枡淇℃伅琛ㄩ厤缃枃鏈�.txt">
+ <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+ </Content>
<Content Include="甯哥敤.txt" />
</ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+ <Import Project="packages\SkiaSharp.NativeAssets.macOS.2.88.6\build\net462\SkiaSharp.NativeAssets.macOS.targets" Condition="Exists('packages\SkiaSharp.NativeAssets.macOS.2.88.6\build\net462\SkiaSharp.NativeAssets.macOS.targets')" />
+ <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
+ <PropertyGroup>
+ <ErrorText>杩欏彴璁$畻鏈轰笂缂哄皯姝ら」鐩紩鐢ㄧ殑 NuGet 绋嬪簭鍖呫�備娇鐢ㄢ�淣uGet 绋嬪簭鍖呰繕鍘熲�濆彲涓嬭浇杩欎簺绋嬪簭鍖呫�傛湁鍏虫洿澶氫俊鎭紝璇峰弬瑙� http://go.microsoft.com/fwlink/?LinkID=322105銆傜己灏戠殑鏂囦欢鏄� {0}銆�</ErrorText>
+ </PropertyGroup>
+ <Error Condition="!Exists('packages\SkiaSharp.NativeAssets.macOS.2.88.6\build\net462\SkiaSharp.NativeAssets.macOS.targets')" Text="$([System.String]::Format('$(ErrorText)', 'packages\SkiaSharp.NativeAssets.macOS.2.88.6\build\net462\SkiaSharp.NativeAssets.macOS.targets'))" />
+ <Error Condition="!Exists('packages\SkiaSharp.NativeAssets.Win32.2.88.6\build\net462\SkiaSharp.NativeAssets.Win32.targets')" Text="$([System.String]::Format('$(ErrorText)', 'packages\SkiaSharp.NativeAssets.Win32.2.88.6\build\net462\SkiaSharp.NativeAssets.Win32.targets'))" />
+ </Target>
+ <Import Project="packages\SkiaSharp.NativeAssets.Win32.2.88.6\build\net462\SkiaSharp.NativeAssets.Win32.targets" Condition="Exists('packages\SkiaSharp.NativeAssets.Win32.2.88.6\build\net462\SkiaSharp.NativeAssets.Win32.targets')" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
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/Code/MainForm.Designer.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/Code/MainForm.Designer.cs"
index 7337df2..94dc57c 100644
--- "a/Weben_CMS\344\270\223\347\224\250\344\273\243\347\240\201\347\224\237\346\210\220\345\231\250/Code/MainForm.Designer.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/Code/MainForm.Designer.cs"
@@ -64,6 +64,8 @@
this.lbl_DataSource = new System.Windows.Forms.Label();
this.cmb_DataSource = new System.Windows.Forms.ComboBox();
this.groupBox2 = new System.Windows.Forms.GroupBox();
+ this.tb_DeleteAlertAttr = new System.Windows.Forms.TextBox();
+ this.label25 = new System.Windows.Forms.Label();
this.tb_ValidateRepeatName = new System.Windows.Forms.TextBox();
this.label24 = new System.Windows.Forms.Label();
this.tb_LikeQueryAttrsName = new System.Windows.Forms.TextBox();
@@ -87,8 +89,9 @@
this.label12 = new System.Windows.Forms.Label();
this.tb_templeteFileDownName = new System.Windows.Forms.TextBox();
this.label14 = new System.Windows.Forms.Label();
- this.label25 = new System.Windows.Forms.Label();
- this.tb_DeleteAlertAttr = new System.Windows.Forms.TextBox();
+ this.tb_FilePath = new System.Windows.Forms.TextBox();
+ this.btn_SelectFile = new System.Windows.Forms.Button();
+ this.button1 = new System.Windows.Forms.Button();
this.groupBox1.SuspendLayout();
this.groupBox2.SuspendLayout();
this.groupBox3.SuspendLayout();
@@ -96,7 +99,7 @@
//
// btnPath
//
- this.btnPath.Location = new System.Drawing.Point(425, 570);
+ this.btnPath.Location = new System.Drawing.Point(453, 723);
this.btnPath.Name = "btnPath";
this.btnPath.Size = new System.Drawing.Size(97, 23);
this.btnPath.TabIndex = 1;
@@ -115,7 +118,7 @@
//
// tbPath
//
- this.tbPath.Location = new System.Drawing.Point(106, 566);
+ this.tbPath.Location = new System.Drawing.Point(134, 719);
this.tbPath.Name = "tbPath";
this.tbPath.ReadOnly = true;
this.tbPath.Size = new System.Drawing.Size(253, 21);
@@ -123,7 +126,7 @@
//
// btnExit
//
- this.btnExit.Location = new System.Drawing.Point(649, 600);
+ this.btnExit.Location = new System.Drawing.Point(677, 753);
this.btnExit.Name = "btnExit";
this.btnExit.Size = new System.Drawing.Size(171, 67);
this.btnExit.TabIndex = 8;
@@ -133,7 +136,7 @@
//
// btn_CreateFile
//
- this.btn_CreateFile.Location = new System.Drawing.Point(106, 600);
+ this.btn_CreateFile.Location = new System.Drawing.Point(134, 753);
this.btn_CreateFile.Name = "btn_CreateFile";
this.btn_CreateFile.Size = new System.Drawing.Size(157, 67);
this.btn_CreateFile.TabIndex = 14;
@@ -324,7 +327,7 @@
//
// btn_InsertSql
//
- this.btn_InsertSql.Location = new System.Drawing.Point(385, 600);
+ this.btn_InsertSql.Location = new System.Drawing.Point(413, 753);
this.btn_InsertSql.Name = "btn_InsertSql";
this.btn_InsertSql.Size = new System.Drawing.Size(157, 67);
this.btn_InsertSql.TabIndex = 42;
@@ -454,6 +457,22 @@
this.groupBox2.TabStop = false;
this.groupBox2.Text = "鑷畾涔夐厤缃�";
//
+ // tb_DeleteAlertAttr
+ //
+ this.tb_DeleteAlertAttr.Location = new System.Drawing.Point(552, 246);
+ this.tb_DeleteAlertAttr.Name = "tb_DeleteAlertAttr";
+ this.tb_DeleteAlertAttr.Size = new System.Drawing.Size(145, 21);
+ this.tb_DeleteAlertAttr.TabIndex = 65;
+ //
+ // label25
+ //
+ this.label25.AutoSize = true;
+ this.label25.Location = new System.Drawing.Point(452, 255);
+ this.label25.Name = "label25";
+ this.label25.Size = new System.Drawing.Size(83, 12);
+ this.label25.TabIndex = 64;
+ this.label25.Text = "鍒犻櫎鎻愮ず瀛楁:";
+ //
// tb_ValidateRepeatName
//
this.tb_ValidateRepeatName.Location = new System.Drawing.Point(402, 108);
@@ -555,7 +574,7 @@
//
// tb_EnumList
//
- this.tb_EnumList.Location = new System.Drawing.Point(418, 361);
+ this.tb_EnumList.Location = new System.Drawing.Point(431, 361);
this.tb_EnumList.Multiline = true;
this.tb_EnumList.Name = "tb_EnumList";
this.tb_EnumList.Size = new System.Drawing.Size(369, 104);
@@ -654,27 +673,43 @@
this.label14.TabIndex = 47;
this.label14.Text = "鏂囦欢涓嬭浇鍚嶅瓧:";
//
- // label25
+ // tb_FilePath
//
- this.label25.AutoSize = true;
- this.label25.Location = new System.Drawing.Point(452, 255);
- this.label25.Name = "label25";
- this.label25.Size = new System.Drawing.Size(83, 12);
- this.label25.TabIndex = 64;
- this.label25.Text = "鍒犻櫎鎻愮ず瀛楁:";
+ this.tb_FilePath.Enabled = false;
+ this.tb_FilePath.Location = new System.Drawing.Point(51, 579);
+ this.tb_FilePath.Name = "tb_FilePath";
+ this.tb_FilePath.Size = new System.Drawing.Size(568, 21);
+ this.tb_FilePath.TabIndex = 47;
+ this.tb_FilePath.TextChanged += new System.EventHandler(this.tb_FilePath_TextChanged);
//
- // tb_DeleteAlertAttr
+ // btn_SelectFile
//
- this.tb_DeleteAlertAttr.Location = new System.Drawing.Point(552, 246);
- this.tb_DeleteAlertAttr.Name = "tb_DeleteAlertAttr";
- this.tb_DeleteAlertAttr.Size = new System.Drawing.Size(145, 21);
- this.tb_DeleteAlertAttr.TabIndex = 65;
+ this.btn_SelectFile.Location = new System.Drawing.Point(632, 571);
+ this.btn_SelectFile.Name = "btn_SelectFile";
+ this.btn_SelectFile.Size = new System.Drawing.Size(252, 34);
+ this.btn_SelectFile.TabIndex = 48;
+ this.btn_SelectFile.Text = "璇峰湪姝ゅ鍏ョ敓鎴愪唬鐮侀渶瑕佺殑閰嶇疆鏂囨湰锛侊紒";
+ this.btn_SelectFile.UseVisualStyleBackColor = true;
+ this.btn_SelectFile.Click += new System.EventHandler(this.btn_SelectFile_Click);
+ //
+ // button1
+ //
+ this.button1.Location = new System.Drawing.Point(890, 571);
+ this.button1.Name = "button1";
+ this.button1.Size = new System.Drawing.Size(108, 34);
+ this.button1.TabIndex = 49;
+ this.button1.Text = "娓呯┖瀵煎叆璺緞锛侊紒";
+ this.button1.UseVisualStyleBackColor = true;
+ this.button1.Click += new System.EventHandler(this.button1_Click_1);
//
// MainForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.ClientSize = new System.Drawing.Size(1250, 672);
+ this.ClientSize = new System.Drawing.Size(1250, 831);
+ this.Controls.Add(this.button1);
+ this.Controls.Add(this.btn_SelectFile);
+ this.Controls.Add(this.tb_FilePath);
this.Controls.Add(this.groupBox2);
this.Controls.Add(this.groupBox1);
this.Controls.Add(this.btn_InsertSql);
@@ -760,6 +795,9 @@
private System.Windows.Forms.Label label24;
private System.Windows.Forms.TextBox tb_DeleteAlertAttr;
private System.Windows.Forms.Label label25;
+ private System.Windows.Forms.TextBox tb_FilePath;
+ private System.Windows.Forms.Button btn_SelectFile;
+ private System.Windows.Forms.Button button1;
}
}
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/Code/MainForm.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/Code/MainForm.cs"
index e0fe64c..8f187c0 100644
--- "a/Weben_CMS\344\270\223\347\224\250\344\273\243\347\240\201\347\224\237\346\210\220\345\231\250/Code/MainForm.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/Code/MainForm.cs"
@@ -8,6 +8,8 @@
using GenerateCode_WeiBen_WMS.DataBaseFactory;
using GenerateCode_WeiBen_WMS.Const;
using GenerateCode_WeiBen_WMS.Model;
+using GenerateCode_WeiBen_WMS.Utility;
+using System.Xml;
namespace GenerateCode_GEBrilliantFactory
{
@@ -270,7 +272,7 @@
//鐢熸垚Model
//CreateModelFile(columnList, tableName, filePrefixName, wcf_NameSpacePath, createPerson, chinaComment, entityName, modulelogo);
//CreateModelParamFile(columnList, tableName, filePrefixName, wcf_NameSpacePath, createPerson, chinaComment, entityName, modulelogo);
- genCodeRootPath = tbPath.Text + @"\" + tb_WCF_NameSpacePath.Text.Trim();
+ genCodeRootPath = tbPath.Text + @"\" + tb_WCF_NameSpacePath.Text.Trim();
var webFolerPath = (tb_WCF_NameSpacePath.Text.Trim() + "_Web").ToLower();
#region 瀹炰綋绫�
var entityFilePath = genCodeRootPath + @"\server\src\CMS.Plugin." + tb_WCF_NameSpacePath.Text.Trim() + @".Application.Contracts\Dtos\" + tb_EntityName.Text.Trim();
@@ -461,6 +463,9 @@
str_generate = AutoMapperProfile_Generate.CreateText(param);
tf = TextHelper.Export2File_V2(autoMapFilePath, param.EntityName + $"AutoMapperProfile.cs", tableName, str_generate, FileType.InputModel, filePrefixName, entityName, modulelogo);
+ //37銆佺敓鎴� 瀵煎嚭妯℃澘Excel鏂囦欢
+ List<ColumnModel> newColumnNameList = ListHelper.RemoveForPageTableListQueryAttributes(param.ColumnNameList);
+ ImportTemplteHelper.CreateImportTemplte(param, newColumnNameList, genCodeRootPath);
////鐢熸垚 OutputModel 鏂囦欢
@@ -681,5 +686,128 @@
dataBaseEnum = (DataBaseEnum)Enum.Parse(typeof(DataBaseEnum), name);
}
+
+ private void btn_SelectFile_Click(object sender, EventArgs e)
+ {
+ OpenFileDialog fileDialog = new OpenFileDialog();
+ fileDialog.Multiselect = true;
+ fileDialog.Title = "璇烽�夋嫨鏂囦欢";
+ fileDialog.Filter = "鎵�鏈夋枃浠�(*txt*)|*.txt*"; //璁剧疆瑕侀�夋嫨鐨勬枃浠剁殑绫诲瀷
+ if (fileDialog.ShowDialog() == DialogResult.OK)
+ {
+ string file = fileDialog.FileName;//杩斿洖鏂囦欢鐨勫畬鏁磋矾寰�
+ this.tb_FilePath.Text = file;
+ }
+ }
+
+ private void tb_FilePath_TextChanged(object sender, EventArgs e)
+ {
+ try
+ {
+ string filePath = this.tb_FilePath.Text;
+
+ string[] lines = File.ReadAllLines(filePath);
+
+ // 鍒涘缓瀹炰綋绫诲璞�
+ GenerateCodeConfigParam entity = new GenerateCodeConfigParam();
+
+ // 瑙f瀽姣忎竴琛屽唴瀹瑰苟璧嬪�肩粰瀹炰綋绫诲睘鎬�
+ foreach (string line in lines)
+ {
+ if (line.Contains(":"))
+ {
+ string[] parts = line.Split(':');
+ string propertyName = parts[0].Trim('[', ']');
+ string propertyValue = parts[1].Trim();
+
+ // 鏍规嵁灞炴�у悕璧嬪��
+ switch (propertyName)
+ {
+ case "琛ㄥ悕":
+ entity.琛ㄥ悕 = propertyValue;
+ break;
+ case "瀹炰綋绫诲悕":
+ entity.瀹炰綋绫诲悕 = propertyValue;
+ break;
+ case "瀹炰綋绫诲璞″悕":
+ entity.瀹炰綋绫诲璞″悕 = propertyValue;
+ break;
+ case "椤甸潰鑿滃崟鍚�":
+ entity.椤甸潰鑿滃崟鍚� = propertyValue;
+ break;
+ case "椤甸潰鑿滃崟瀵硅薄缂╁啓":
+ entity.椤甸潰鑿滃崟瀵硅薄缂╁啓 = propertyValue;
+ break;
+ case "琛ㄧ殑涓枃娉ㄨВ":
+ entity.琛ㄧ殑涓枃娉ㄨВ = propertyValue;
+ break;
+ case "閲嶅鎬ф牎楠屽瓧娈�":
+ entity.閲嶅鎬ф牎楠屽瓧娈� = propertyValue;
+ break;
+ case "鍒犻櫎鎻愮ず瀛楁":
+ entity.鍒犻櫎鎻愮ず瀛楁 = propertyValue;
+ break;
+ case "妯$硦鏌ヨ瀛楁":
+ entity.妯$硦鏌ヨ瀛楁 = propertyValue;
+ break;
+ case "妯$硦鏌ヨ瀛楁鍚�":
+ entity.妯$硦鏌ヨ瀛楁鍚� = propertyValue;
+ break;
+ case "椤圭洰鍛藉悕绌洪棿":
+ entity.椤圭洰鍛藉悕绌洪棿 = propertyValue;
+ break;
+ case "鏋氫妇绫诲瀷瀛楁闆嗗悎":
+ entity.鏋氫妇绫诲瀷瀛楁闆嗗悎 = propertyValue;
+ break;
+ }
+ }
+ }
+
+ //缁欑晫闈㈣祴鍊�
+ this.tb_TableName.Text = "";//琛ㄥ悕
+ this.tb_WCF_NameSpacePath.Text = "";//琛ㄥ悕
+ this.tb_ChinaComment.Text = "";//琛ㄥ悕
+ this.tb_MenuName.Text = "";//琛ㄥ悕
+ this.tb_PageMenuInstanceName.Text = "";//琛ㄥ悕
+ this.tb_EntityName.Text = "";//琛ㄥ悕
+
+ this.tb_LikeQueryAttrs.Text = "";//琛ㄥ悕
+ this.tb_LikeQueryAttrsName.Text = "";//琛ㄥ悕
+
+ this.tb_EntityProName.Text = "";//琛ㄥ悕
+ this.tb_EnumList.Text = "";//琛ㄥ悕
+ this.tb_ValidateRepeatName.Text = "";//琛ㄥ悕
+ this.tb_DeleteAlertAttr.Text = "";//琛ㄥ悕
+
+ this.tb_TableName.Text = entity.琛ㄥ悕;//琛ㄥ悕
+ this.tb_WCF_NameSpacePath.Text = entity.椤圭洰鍛藉悕绌洪棿;//WCF椤圭洰鍛藉悕绌洪棿
+ this.tb_ChinaComment.Text = entity.琛ㄧ殑涓枃娉ㄨВ;//涓枃娉ㄩ噴
+ this.tb_MenuName.Text = entity.椤甸潰鑿滃崟鍚�;
+ this.tb_PageMenuInstanceName.Text = entity.椤甸潰鑿滃崟瀵硅薄缂╁啓;
+ this.tb_EntityName.Text = entity.瀹炰綋绫诲悕;//瀹炰綋绫诲悕
+
+ this.tb_LikeQueryAttrs.Text = entity.妯$硦鏌ヨ瀛楁;
+ this.tb_LikeQueryAttrsName.Text = entity.妯$硦鏌ヨ瀛楁鍚�;
+
+ this.tb_EntityProName.Text = entity.瀹炰綋绫诲璞″悕;//瀹炰綋绫诲璞″悕
+ this.tb_EnumList.Text = entity.鏋氫妇绫诲瀷瀛楁闆嗗悎;
+ this.tb_ValidateRepeatName.Text = entity.閲嶅鎬ф牎楠屽瓧娈�;
+ this.tb_DeleteAlertAttr.Text = entity.鍒犻櫎鎻愮ず瀛楁;
+
+ }
+ catch (FileNotFoundException)
+ {
+ Console.WriteLine("閿欒: 鏂囦欢鏈壘鍒�!");
+ }
+ catch (Exception ex)
+ {
+ Console.WriteLine($"閿欒: 鍙戠敓浜嗕竴涓湭鐭ラ敊璇�: {ex.Message}");
+ }
+ }
+
+ private void button1_Click_1(object sender, EventArgs e)
+ {
+ this.tb_FilePath.Text = "";
+ }
}
}
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/Code/Model/GenerateCodeConfigParam.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/Code/Model/GenerateCodeConfigParam.cs"
new file mode 100644
index 0000000..572a0b7
--- /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/Code/Model/GenerateCodeConfigParam.cs"
@@ -0,0 +1,25 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace GenerateCode_WeiBen_WMS.Model
+{
+ internal class GenerateCodeConfigParam
+ {
+ public string 琛ㄥ悕 { get; set; }
+ public string 瀹炰綋绫诲悕 { get; set; }
+ public string 瀹炰綋绫诲璞″悕 { get; set; }
+ public string 椤甸潰鑿滃崟鍚� { get; set; }
+ public string 椤甸潰鑿滃崟瀵硅薄缂╁啓 { get; set; }
+ public string 琛ㄧ殑涓枃娉ㄨВ { get; set; }
+ public string 閲嶅鎬ф牎楠屽瓧娈� { get; set; }
+ public string 鍒犻櫎鎻愮ず瀛楁 { get; set; }
+ public string 妯$硦鏌ヨ瀛楁 { get; set; }
+ public string 妯$硦鏌ヨ瀛楁鍚� { get; set; }
+ public string 椤圭洰鍛藉悕绌洪棿 { get; set; }
+
+ public string 鏋氫妇绫诲瀷瀛楁闆嗗悎 { get; set; }
+ }
+}
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/Code/Utility/ImportTemplteHelper.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/Code/Utility/ImportTemplteHelper.cs"
new file mode 100644
index 0000000..e44afdf
--- /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/Code/Utility/ImportTemplteHelper.cs"
@@ -0,0 +1,204 @@
+锘縰sing GenerateCode_GEBrilliantFactory;
+using GenerateCode_WeiBen_WMS.Const;
+using GenerateCode_WeiBen_WMS.Model;
+using OfficeOpenXml;
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace GenerateCode_WeiBen_WMS.Utility
+{
+
+ public class ImportTemplteHelper
+ {
+
+ /// <summary>
+ /// 鏍规嵁琛ㄥ悕鍒涘缓瀵煎叆妯$増
+ /// </summary>
+ /// <param name="input"></param>
+ public static void CreateImportTemplte(GenerateCodeParam input, List<ColumnModel> tableFieldList, string genCodeRootPath)
+ {
+ string errMsg = string.Empty;
+ //涓氬姟鍚�
+ string _busName = input.EntityName;
+ var copayPath = TemplateConst.EXCEL_TEMPLATEFILE_瀵煎叆妯$増璺緞 + "\\CommonTemplate.xlsx";
+
+ var fileFolderPath = genCodeRootPath + "\\server\\src\\CMS.Plugin." + input.NameSpacePath + "\\Resources\\Templates";
+ if (!Directory.Exists(fileFolderPath))
+ {
+ Directory.CreateDirectory(fileFolderPath);
+ }
+ string newPath = fileFolderPath + $"\\{_busName}{TemplateConst.EXCEL_TEMPLATEFILE_瀵煎叆妯$増鍚嶇О鍚庣紑}.xlsx";
+
+ CreatExcel(tableFieldList, copayPath, newPath);
+ }
+
+ /// <summary>
+ /// 鏍规嵁瀹炰綋绫诲悕 鐢熸垚瀵煎叆excel妯$増
+ /// </summary>
+ /// <param name="tableFieldList">浠g爜鐢熸垚閫夋嫨閰嶇疆琛ㄧ殑瀛楁</param>
+ /// <param name="copayPath"></param>
+ /// <param name="newPath"></param>
+ private static void CreatExcel(List<ColumnModel> tableFieldList, string copayPath, string newPath)
+ {
+ string errMsg = string.Empty;
+ try
+ {
+ #region 楠岃瘉鍘熷瀵煎叆妯℃澘鏂囦欢鏄惁瀛樺湪
+ if (!File.Exists(copayPath))
+ {
+ errMsg = $"鐢ㄦ潵澶嶅埗鐢熸垚妯$増鐨凟XCEL鏂囦欢涓嶅瓨鍦�";
+ throw new Exception($"鐢熸垚瀵煎叆妯$増鏂囦欢寮傚父锛歿errMsg}");
+ }
+ #endregion
+
+ //鑾峰彇妯℃澘鏂囦欢
+ FileInfo copyFile = new FileInfo(copayPath);
+
+ // 妫�鏌ユ柊鐢熸垚鐨勫鍏ユā鐗堟枃浠舵槸鍚﹀瓨鍦紝瀛樺湪灏卞垹闄わ紝浠ラ伩鍏嶅彲鑳界殑寮傚父銆�
+ if (File.Exists(newPath))
+ {
+ File.Delete(newPath); // 鍒犻櫎鏂囦欢
+ }
+ //澶嶅埗鍘熷瀵煎叆妯$増锛屽垱寤烘柊鐨勫鍏ユā鐗堟枃浠�
+ copyFile.CopyTo(newPath, true);
+ FileInfo existingFile = new FileInfo(newPath);
+ using (ExcelPackage package = new ExcelPackage(existingFile))
+ {
+ //鑾峰彇妯℃澘鍐呭
+ ExcelWorksheet worksheet = package.Workbook.Worksheets[0];//鑾峰彇绗竴涓獁orksheet
+ //琛屽拰鍒楅兘鏄粠1寮�濮嬶紝鑰屼笉鏄粠0寮�濮嬶紒锛侊紒
+ int _remarkRowIndex = 1;//worksheet 琛岀储寮曪紙璇存槑锛� 娉ㄦ剰锛氶粯璁ゆ槸绗竴琛屾槸瀵煎叆妯$増鐨勮鏄�
+ int _mergeRowCount = _remarkRowIndex;//鍚堝苟琛� 锛堝繀濉瓧娈垫暟閲忥級 榛樿鏄涓�琛屽悎骞�
+ int _titleRowIndex = 1;//worksheet 琛岀储寮曪紙鏍囬锛夋敞鎰忥細榛樿鏄涓�琛屾槸瀵煎叆妯$増鐨勬爣棰�
+ int _cellIndex = 1;//worksheet 鍒楃储寮� 娉ㄦ剰锛氶粯璁ゆ槸绗竴鍒楀紑濮嬭缃鍏ユā鐗堢殑鏍囬
+
+ //妯$増绗竴鍒椾綔涓烘ā鐗堜娇鐢紝鎵�鏈夋柊澧炵殑鍒楁牱寮忔姤閿欎竴鑷�
+ var templateCell = worksheet.Cells[_titleRowIndex, _cellIndex];
+
+ string _remark = string.Empty; //绗竴琛屾坊鍔犺鏄庯紝娉ㄦ剰鎹㈣銆�
+
+ //鑾峰彇瑕佸鐞嗙殑浠g爜鐢熸垚閰嶇疆鐨勬槸澧炴敼鐨勬ā鐗堝瓧娈�
+ var showCodeGenConfigs = tableFieldList.Where(w => 1 == 1).ToList();
+ showCodeGenConfigs = showCodeGenConfigs.Where(x => 1 == 1).ToList();
+
+ /*
+ int _mergeCellsCount = showCodeGenConfigs.Count();//鍚堝苟鍒楋紙妯$増璧嬪�肩殑鏍囬鍒楁暟锛�
+ //鑾峰彇蹇呭~瀛楁
+
+ //鍒涘缓妯$増璇存槑
+ StringBuilder _remarkContentBuilder = GetParseTemplateHint(showCodeGenConfigs);
+ string _remarkContent = _remarkContentBuilder.ToString();
+
+ #region 鍚堝苟鍗曞厓鏍�
+ //鍚堝苟鍗曞厓鏍硷紝鍚堝苟琛屽拰鍒椼�傞粯璁ゆ槸鍚堝苟绗竴琛岀殑鎵�鏈夋爣棰樺垪
+ var cellRange = worksheet.Cells[1, 1, _mergeRowCount, _mergeCellsCount];
+
+ cellRange.Value = _remarkContent;//鍚堝苟鍗曞厓鏍煎悗鐨勫唴瀹硅祴鍊�
+ var mergeCell = cellRange.Merge = true;//鍚堝苟
+ int rowHeight = GetRowHeightBasedOnContent(showCodeGenConfigs.Count()); // 鏍规嵁鍐呭璁$畻琛岄珮锛堣繖閲岄渶瑕佷綘鑷繁瀹炵幇閫昏緫锛�
+ worksheet.Row(_remarkRowIndex).Height = rowHeight; // 璁剧疆琛岄珮锛屾敞鎰廍PPlus鐨勫崟浣嶄笉鍚岋紝闇�瑕佽浆鎹�
+
+ #endregion
+ //*/
+
+ //寰幆鍒涘缓妯$増鏍囬鍒�
+ foreach (var item in showCodeGenConfigs)
+ {
+ var currentCell = worksheet.Cells[_titleRowIndex, _cellIndex];
+ //缁欐柊妯$増鍒楁爣棰樿祴鍊�
+ currentCell.Value = item.Description;
+ //澶嶅埗鎷疯礉鐨別xcel妯$増鍒楋紝缁欐柊妯$増鍒楁牱寮忚祴鍊�
+ currentCell.StyleID = templateCell.StyleID;
+ // worksheet.Column(_cellIndex).AutoFit();//瀹藉害鑷�傚簲
+
+ //缁欑浜岃璧嬪��
+ var currentCell2 = worksheet.Cells[2, _cellIndex];
+ //缁欐柊妯$増鍒楁爣棰樿祴鍊�
+ currentCell2.Value = "{{閰嶇疆." + item.ColumnName + "}}";
+ //澶嶅埗鎷疯礉鐨別xcel妯$増鍒楋紝缁欐柊妯$増鍒楁牱寮忚祴鍊�
+ currentCell2.StyleID = templateCell.StyleID;
+ // worksheet.Column(_cellIndex).AutoFit();//瀹藉害鑷�傚簲
+
+ _cellIndex++;
+ }
+
+
+ package.Save();//淇濆瓨
+ }
+ }
+ catch (Exception ex)
+ {
+ throw new Exception($"鐢熸垚瀵煎叆妯$増鏂囦欢寮傚父锛岃鏌ョ湅绯荤粺鏃ュ織:" + ex.Message);
+ }
+ finally { }
+ }
+
+ // 杩欓噷鏄竴涓亣璁剧殑鏂规硶锛岀敤浜庢牴鎹崟鍏冩牸鍐呭璁$畻琛岄珮銆備綘闇�瑕佹牴鎹疄闄呮儏鍐垫潵瀹炵幇杩欎釜閫昏緫銆�
+ private static int GetRowHeightBasedOnContent(int lineCount)
+ {
+ // 杩欓噷鍙槸涓�涓ず渚嬮�昏緫锛屼綘鍙兘闇�瑕佹洿澶嶆潅鐨勭畻娉曟潵鍐冲畾鍚堥�傜殑琛岄珮銆�
+
+ return (lineCount + 3) * 20; //
+ }
+
+ private static StringBuilder GetParseTemplateHint(List<ColumnModel> requiredTableFieldList)
+ {
+ StringBuilder _remarkContentBuilder = new StringBuilder();
+ _remarkContentBuilder.AppendLine("");
+ _remarkContentBuilder.AppendLine("1.鏀寔Excel2007鍙婁互涓婄増鏈枃浠躲��");
+ _remarkContentBuilder.AppendLine("2.瀵煎叆鏁版嵁鏃朵笉鑳借秴杩�5000琛屻��");
+ _remarkContentBuilder.AppendLine("");
+ _remarkContentBuilder.AppendLine("");
+
+ Dictionary<string, string> typeNameDict = new Dictionary<string, string>()
+ {
+ { "string", "杈撳叆鏂囨湰銆�"},
+ { "int", "杈撳叆鏁板瓧銆�"},
+ { "long", "杈撳叆鏁板瓧銆�"},
+ { "decimal", "杈撳叆灏忔暟銆�"},
+ { "bool", "鏄�,鍚︺��"},
+
+ };
+ Dictionary<string, string> effectTypeDict = new Dictionary<string, string>()
+ {
+ { "datepicker", "鏃ユ湡銆� 绀轰緥: 2023/3/1銆�"},
+ { "datetimepicker", "鏃ユ湡鏃堕棿銆傜ず渚�: 2023/3/1 12:00:00銆�"},
+
+ };
+
+ requiredTableFieldList.ForEach(x =>
+ {
+ string text = "";
+ text += x.Description + "(" + (x.IsNullable ? "蹇呭~" : "闈炲繀濉�") + "): ";
+ var _dataType = x.DataType.Replace("?", "").ToLower();
+ //if (effectTypeDict.ContainsKey(x.EffectType.ToLower()))
+ //{
+ // text += effectTypeDict[x.EffectType.ToLower()];
+ //}
+ //else if (x.EffectType.ToLower() == "enumselector")
+ //{//娉ㄦ剰锛氳繖涓垽鏂鏀惧湪鍒ゆ柇_dataType鍓嶉潰锛屼富瑕佹槸鑰冭檻鏋氫妇鍜宨nt绫诲瀷鐨勬贩娣�
+ // var queryValue = x.NetType.Split('.').Last();
+ // var enumStr = _sysEnumService.GetEnumDataListStr(new EnumDataInput() { EnumName = queryValue });
+ // text += enumStr + "銆�";
+ //}
+ if (typeNameDict.ContainsKey(_dataType))
+ {
+ text += typeNameDict[_dataType];
+ }
+ else
+ {
+ text += ("娉ㄦ剰锛氱被鍨嬫湭鑳借瘑鍒嚭鏉ワ紝闇�瑕佽嚜宸辩淮鎶わ紒锛侊紒銆�");
+ }
+ _remarkContentBuilder.AppendLine(text);
+ });
+
+ return _remarkContentBuilder;
+
+ }
+
+ }
+}
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/Code/packages.config" "b/Weben_CMS\344\270\223\347\224\250\344\273\243\347\240\201\347\224\237\346\210\220\345\231\250/Code/packages.config"
index d58da6f..2f980aa 100644
--- "a/Weben_CMS\344\270\223\347\224\250\344\273\243\347\240\201\347\224\237\346\210\220\345\231\250/Code/packages.config"
+++ "b/Weben_CMS\344\270\223\347\224\250\344\273\243\347\240\201\347\224\237\346\210\220\345\231\250/Code/packages.config"
@@ -1,14 +1,42 @@
锘�<?xml version="1.0" encoding="utf-8"?>
<packages>
+ <package id="EPPlus.Interfaces" version="8.0.0" targetFramework="net48" />
+ <package id="Magicodes.IE.EPPlus" version="2.7.5.2" targetFramework="net48" />
<package id="Microsoft.Bcl.AsyncInterfaces" version="8.0.0" targetFramework="net48" />
+ <package id="Microsoft.Extensions.Configuration" version="3.1.0" targetFramework="net48" />
+ <package id="Microsoft.Extensions.Configuration.Abstractions" version="3.1.0" targetFramework="net48" />
+ <package id="Microsoft.Extensions.Configuration.FileExtensions" version="3.1.0" targetFramework="net48" />
+ <package id="Microsoft.Extensions.Configuration.Json" version="3.1.0" targetFramework="net48" />
<package id="Microsoft.Extensions.DependencyInjection.Abstractions" version="8.0.2" targetFramework="net48" />
+ <package id="Microsoft.Extensions.FileProviders.Abstractions" version="3.1.0" targetFramework="net48" />
+ <package id="Microsoft.Extensions.FileProviders.Physical" version="3.1.0" targetFramework="net48" />
+ <package id="Microsoft.Extensions.FileSystemGlobbing" version="3.1.0" targetFramework="net48" />
<package id="Microsoft.Extensions.Logging.Abstractions" version="8.0.2" targetFramework="net48" />
+ <package id="Microsoft.Extensions.Primitives" version="3.1.0" targetFramework="net48" />
+ <package id="Microsoft.IO.RecyclableMemoryStream" version="3.0.1" targetFramework="net48" />
<package id="MySqlConnector" version="2.4.0" targetFramework="net48" />
<package id="Newtonsoft.Json" version="11.0.2" targetFramework="net451" />
+ <package id="SixLabors.ImageSharp" version="1.0.4" targetFramework="net48" />
+ <package id="SkiaSharp" version="2.88.6" targetFramework="net48" />
+ <package id="SkiaSharp.NativeAssets.macOS" version="2.88.6" targetFramework="net48" />
+ <package id="SkiaSharp.NativeAssets.Win32" version="2.88.6" targetFramework="net48" />
<package id="System.Buffers" version="4.5.1" targetFramework="net48" />
+ <package id="System.ComponentModel.Annotations" version="5.0.0" targetFramework="net48" />
<package id="System.Diagnostics.DiagnosticSource" version="8.0.1" targetFramework="net48" />
+ <package id="System.IO" version="4.3.0" targetFramework="net48" />
<package id="System.Memory" version="4.5.5" targetFramework="net48" />
<package id="System.Numerics.Vectors" version="4.5.0" targetFramework="net48" />
+ <package id="System.Runtime" version="4.3.0" targetFramework="net48" />
<package id="System.Runtime.CompilerServices.Unsafe" version="6.0.0" targetFramework="net48" />
+ <package id="System.Security.Cryptography.Algorithms" version="4.3.0" targetFramework="net48" />
+ <package id="System.Security.Cryptography.Encoding" version="4.3.0" targetFramework="net48" />
+ <package id="System.Security.Cryptography.Pkcs" version="4.7.0" targetFramework="net48" />
+ <package id="System.Security.Cryptography.Primitives" version="4.3.0" targetFramework="net48" />
+ <package id="System.Security.Cryptography.X509Certificates" version="4.3.2" targetFramework="net48" />
+ <package id="System.Security.Cryptography.Xml" version="8.0.2" targetFramework="net48" />
+ <package id="System.Text.Encoding.CodePages" version="4.7.0" targetFramework="net48" />
+ <package id="System.Text.Encodings.Web" version="4.7.0" targetFramework="net48" />
+ <package id="System.Text.Json" version="4.7.0" targetFramework="net48" />
<package id="System.Threading.Tasks.Extensions" version="4.5.4" targetFramework="net48" />
+ <package id="System.ValueTuple" version="4.5.0" targetFramework="net48" />
</packages>
\ No newline at end of file
--
Gitblit v1.9.3