schangxiang@126.com
2025-05-07 c2fa981fb19aa0fee113dd684f5f14956d58bd93
优化
已添加2个文件
已修改3个文件
245 ■■■■■ 文件已修改
Weben_CMS专用代码生成器/Code/File/GenerateCodeConfigParamFiles/物料信息表配置文本.txt 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Weben_CMS专用代码生成器/Code/GenerateCode_WeiBen_CMS.csproj 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Weben_CMS专用代码生成器/Code/MainForm.Designer.cs 80 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Weben_CMS专用代码生成器/Code/MainForm.cs 124 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Weben_CMS专用代码生成器/Code/Model/GenerateCodeConfigParam.cs 25 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Weben_CMSרÓôúÂëÉú³ÉÆ÷/Code/File/GenerateCodeConfigParamFiles/ÎïÁÏÐÅÏ¢±íÅäÖÃÎı¾.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
Weben_CMSרÓôúÂëÉú³ÉÆ÷/Code/GenerateCode_WeiBen_CMS.csproj
@@ -249,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" />
@@ -475,6 +476,9 @@
    <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 />
Weben_CMSרÓôúÂëÉú³ÉÆ÷/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;
    }
}
Weben_CMSרÓôúÂëÉú³ÉÆ÷/Code/MainForm.cs
@@ -9,6 +9,7 @@
using GenerateCode_WeiBen_WMS.Const;
using GenerateCode_WeiBen_WMS.Model;
using GenerateCode_WeiBen_WMS.Utility;
using System.Xml;
namespace GenerateCode_GEBrilliantFactory
{
@@ -685,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();
                // è§£æžæ¯ä¸€è¡Œå†…容并赋值给实体类属性
                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 = "";
        }
    }
}
Weben_CMSרÓôúÂëÉú³ÉÆ÷/Code/Model/GenerateCodeConfigParam.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,25 @@
using 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; }
    }
}