# 企业中台 **Repository Path**: kephi/enterprise_MidPlat ## Basic Information - **Project Name**: 企业中台 - **Description**: No description available - **Primary Language**: C# - **License**: AFL-3.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 6 - **Forks**: 6 - **Created**: 2019-08-09 - **Last Updated**: 2024-10-17 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README ## 简介 ## 端口占用说明 TODO:现在很乱,后续尽量按照说明分配端口 - 中台端口从 5001 开始累积增加,中台RPC端口从 801开始累积增加 - 前台端口从 6001 开始累积增加 - 前端(Angular)端口从 8001 开始累积增加,MES 比较特殊,比如 51 车间,则是 8051,这样方便车间人员记忆 ### 中台 | 名称 | 端口 | RPC端口 | | :-------------- | :--- | :------ | | ZTWorkflow | 5081 | 813 | | ZTFlow | 5302 | 814 | | ZTPipeline | 5301 | 810 | | ZTProduceTask | 6201 | 806 | | ZTStore | 6871 | 811 | | ZTFixedAsset | 6202 | 812 | | ZTDevice | 5083 | | | ZTFinance | 5085 | | | ZTHumanResource | 5087 | 805 | | ZTProtection | 6003 | | ### 前台 | 名称 | 端口 | | :------------- | :--- | | AppMes51 | 5021 | | AppMes58 | 5031 | | AppProduceTask | 5011 | | AppFixedAsset | 5012 | ### 前端(Angular) | 名称 | 端口 | 发布端口 | | :---------- | :--- | -------- | | Mes51 | 4200 | 8051 | | Mes58 | 4200 | 8058 | | OutSourcing | 4200 | 8061 | | FixedAsset | 4200 | 8062 | ## 注意事项(非常重要) ### 关于 Common 项目的使用,如果有添加请在这里列举出来,避免重复并且方便别人使用! - 车间 位置:Camc.CommonPlat.Core.Shared/Departments 文件: - Department.cs 为 枚举类型 - DepartmentExtebsion.cs 为部门扩展类,目前提供3个方法: - `static ICollection GetDepartments();` 提供返回**部门** NameValue 列表; - `static ICollection GetWorkshops();` 提供返回**车间** NameValue 列表; - `static string ToChinese(this string department);`数字转中文,eg:"51"=>"五十一车间"; - `static string ToNumber(this string department);`中文转数字,eg:"五十一车间"=>"51"; 扩展:只需要在枚举中添加 对应的 Key/Value 用法: ```c# var department = "51"; department.ToChinese(); // 输出:五十一车间 department = "五十一车间"; department.ToNumber(); // 输出:51 ``` - 时间 位置:Camc.CommonPlat.Core.Shared/CamcDateTimes 文件: - CamcDayConfig.cs 为截至日配置 - CamcDateIdentifier.cs 为时间标识 ```c# [Range(1700, 9999)] public int Year { get; private set; } [Range(1, 12)] public int Month { get; private set; } ``` - CamcMonthlyRangeDates.cs 为日期返回值,属性为 DateTime StartDate 和 DateTime EndDate - CamcDateTimeExtension.cs 为日期扩展分类,目前提供 4 个方法: - `static CamcMonthlyRangeDates GetMonthlyRangeDates(this CamcDayConfig dayConfig, int year, int month)`该方法为获取指定年月日期范围; - `static CamcMonthlyRangeDates GetCurrentMonthlyRangeDates(this CamcDayConfig dayConfig)`该方法为获取当前月份日期范围; - `static CamcDateIdentifier GetCamcDateIdentifier(this CamcDayConfig dayConfig, DateTime date)`该方法返回 date 应该所属的 年份和月份 - `static CamcDateIdentifier GetCurrentCamcDateIdentifier(this CamcDayConfig dayConfig)`该方法返回 当前时间 应该所属的 年份和月份 用法: ```c# var camcDayConfig = new CamcDayConfig(); // 参数可选,没有 = new CamcDayConfig(17) var currentMonthlyRangeDates = camcDayConfig.GetCurrentMonthlyRangeDates(); ``` ### 关于公用数据库! - 实体:暂时不支持修改 - seed: - 增加数据时 **唯一标识** 尽量加上 该App 的属性,eg:Mes51 增加班组时, code 为 51_01; ```c# new OrganizationUnit(null, "生产一组",null){Code = "51_01"}, new OrganizationUnit(null, "生产二组",null){Code = "51_02"}, new OrganizationUnit(null, "生产三组",null){Code = "51_03"}, new OrganizationUnit(null, "生产四组",null){Code = "51_04"}, new OrganizationUnit(null, "生产五组",null){Code = "51_05"} ``` - 在不同的 App 上数据相同时,eg:角色, 一个班组角色,在所有车间都有,所以 创建 seed时,需要**先检查数据库中是否存在**(注意:**这个是需要每个App写自己的**,不是公用的,只需检查一下即可); ```c# var teamGroupLeaderRoleForHost = _context.Roles.IgnoreQueryFilters() .FirstOrDefault(r => r.TenantId == null && r.Name == StaticRoleNames.Host.TeamGroupLeader); if (teamGroupLeaderRoleForHost == null) { teamGroupLeaderRoleForHost = _context.Roles .Add(new Role(null, StaticRoleNames.Host.TeamGroupLeader, "班组长") {IsStatic = true}).Entity; _context.SaveChanges(); } ``` ## 文档 - [环境搭建](https://gitee.com/kephi/enterprise_MidPlat/blob/master/src/docs/环境搭建) - 后端 - [VS](https://gitee.com/kephi/enterprise_MidPlat/blob/master/docs/环境搭建/后端VS.md) - [Rider](https://gitee.com/kephi/enterprise_MidPlat/blob/master/docs/%E7%8E%AF%E5%A2%83%E6%90%AD%E5%BB%BA/%E5%90%8E%E7%AB%AFRider.md) (个人推荐使用这个,优点是:自带Resharper功能,占用内存小,可以灵活开启多项目调试或者运行,缺点是:如果以前没用过JetBrains公司的软件,可能不适应) - 前端