commit 3eb9944300d3eb7c6b8f11fb9305629cf0e61dc5 Author: 747575620@qq.com <747575620@qq.com> Date: Tue Jul 11 11:47:47 2023 +0800 胖子天骄项目初始化 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..c29e8cf --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +.vs +obj +bin diff --git a/backend/BPA.MES.Base.Application/BPA.MES.Base.Application.csproj b/backend/BPA.MES.Base.Application/BPA.MES.Base.Application.csproj new file mode 100644 index 0000000..eb7c73f --- /dev/null +++ b/backend/BPA.MES.Base.Application/BPA.MES.Base.Application.csproj @@ -0,0 +1,36 @@ + + + + + net6.0 + 1701;1702;1591 + BPA.MES.Base.Application.xml + enable + + + + + + + + + + + PreserveNewest + + + + + + + + + + + + + + + + + diff --git a/backend/BPA.MES.Base.Application/BPA.MES.Base.Application.xml b/backend/BPA.MES.Base.Application/BPA.MES.Base.Application.xml new file mode 100644 index 0000000..d7773a6 --- /dev/null +++ b/backend/BPA.MES.Base.Application/BPA.MES.Base.Application.xml @@ -0,0 +1,2846 @@ + + + + BPA.MES.Base.Application + + + + + 名 称 : + 创 建 人 :yangxiao + 创建时间 : 2023/3/4 10:15:54 + 描 述 : + + + + + 用户Id + + + + + 账号 + + + + + 名称 + + + + + 头像 + + + + + 电话 + + + + + 性别 + + + + + 是否授权 + + + + + 微信session_key + + + + + 是否超级管理 + + + + + 租户Id + + + + + 用户组织机构Id + + + + + 用户组织机构名称 + + + + + 是否是管理员 + + + + + 名 称 :设备配方表 + 创 建 人 :yangxiao + 创建时间 :2023/3/2 13:57:00 + 描 述 : + + + + + 设备Id + + + + + 配方Id + + + + + 名 称 :设备 + 创 建 人 :yangxiao + 创建时间 :2023/3/2 13:51:45 + 描 述 : + + + + + 名称 + + + + + 编码 + + + + + 名 称 :分组信息 + 创 建 人 :yangxiao + 创建时间 : 2023/3/10 14:01:15 + 描 述 : + + + + + 名称 + + + + + 介绍 + + + + + 名 称 :物料 + 创 建 人 :yangxiao + 创建时间 :2023/3/2 13:52:00 + 描 述 : + + + + + 名称 + + + + + 编码 + + + + + 单位 + + + + + 每秒出水量(g) + + + + + 名 称 :配方物料信息 + 创 建 人 :yangxiao + 创建时间 : 2023/3/2 13:58:19 + 描 述 : + + + + + 物料Id + + + + + 配方Id + + + + + 通道 + + + + + 顺序 + + + + + 时间(s) + + + + + 名 称 :配方分组 + 创 建 人 :yangxiao + 创建时间 : 2023/3/10 14:56:03 + 描 述 : + + + + + 组Id + + + + + 产品Id + + + + + 名 称 :配方信息 + 创 建 人 :yangxiao + 创建时间 : 2023/3/2 13:57:15 + 描 述 : + + + + + 名称 + + + + + 自定义编码 + + + + + 图标 + + + + + 名 称 :店铺信息 + 创 建 人 :yangxiao + 创建时间 : 2023/3/2 13:52:13 + 描 述 : + + + + + 名称 + + + + + 地址 + + + + + 联系电话 + + + + + 负责人 + + + + + 名 称 :账户信息 + 创 建 人 :yangxiao + 创建时间 : 2023/1/3 10:18:43 + 描 述 : + + + + + 账号 + + + + + 密码 + + + + + 员工表Id + + + + + 名 称 授权模板表 + 创 建 人 :yangxiao + 创建时间 : 2023/1/4 17:31:11 + 描 述 : + + + + + 名称 + + + + + 描述 + + + + + 创建时间 + + + + + 是否删除 + + + + + 名 称 : 授权模板子项表 + 创 建 人 :yangxiao + 创建时间 : 2023/1/4 17:31:27 + 描 述 : + + + + + 模板编号 + + + + + 模块编号 + + + + + 是否删除 + + + + + 名 称 :授权对象表 + 创 建 人 :yangxiao + 创建时间 : 2023/1/4 17:31:39 + 描 述 : + + + + + 授权模板编号 + + + + + 授权对象编号(用户编号,角色编号) + + + + + 授权类型 1:用户,2:角色 + + + + + 是否删除 + + + + + 名 称 :员工信息 + 创 建 人 :yangxiao + 创建时间 : 2023/1/4 17:44:31 + 描 述 : + + + + + 员工姓名 + + + + + 1男2女 + + + + + 手机号 + + + + + 员工IC卡 + + + + + 头像 + + + + + 入职时间 + + + + + 身份证 + + + + + 1在职2出差3离职 + + + + + 超管 + + + + + 角色Id + + + + + 是否删除 + + + + + 名 称 :模块菜单表 + 创 建 人 :yangxiao + 创建时间 : 2023/1/4 17:32:15 + 描 述 : + + + + + 类别 1:菜单,2:视图,3:功能 + + + + + 菜单打开方式 0:框架内嵌,1:新开页面 + + + + + 父级编号 + + + + + 名称 + + + + + 图标 + + + + + 地址 + + + + + 状态 + + + + + 名 称 :角色信息 + 创 建 人 :yangxiao + 创建时间 : 2023/1/4 17:32:32 + 描 述 : + + + + + 角色名称 + + + + + 角色类型 1超级管理员,2其他 + + + + + 角色描述 + + + + + 是否删除 + + + + + 名 称 :设备Dto类 + 创 建 人 :yangxiao + 创建时间 : 2023/3/2 16:12:06 + 描 述 : + + + + + 增加 + + + + + 更新 + + + + + 删除 + + + + + 主键 + + + + + 不分页 + + + + + 设备Id + + + + + 分页 + + + + + 设备Id + + + + + 配方数组 + + + + + 输出 + + + + + 设备名称 + + + + + 配方名称 + + + + + 配方代码 + + + + + 分组Id + + + + + 分组名称 + + + + + 配方图片地址 + + + + + 名 称 :设备Dto类 + 创 建 人 :yangxiao + 创建时间 : 2023/3/2 16:12:06 + 描 述 : + + + + + 增加 + + + + + 更新 + + + + + 删除 + + + + + 主键 + + + + + 分页 + + + + + 输出 + + + + + 名 称 :设备服务 + 创 建 人 :yangxiao + 创建时间 :2023/3/2 16:11:04 + 描 述 :店铺数据维护 + + + + + 增加 + + + + + + + 批量下发配方 + + + + + + + + 删除 + + + + + + + + 详情 + + + + + + + + 列表 + + + + + + + 分页 + + + + + + + 更新 + + + + + + + + 名 称 :设备服务 + 创 建 人 :yangxiao + 创建时间 :2023/3/2 16:11:04 + 描 述 :店铺数据维护 + + + + + 增加 + + + + + + + 删除 + + + + + + + + 详情 + + + + + + + + 列表 + + + + + + + 分页 + + + + + + + 下拉 + + + + + + + 更新 + + + + + + + + 名 称 :设备配方服务 + 创 建 人 :yangxiao + 创建时间 :2023/3/2 18:30:58 + 描 述 : + + + + + 增加 + + + + + + 移除 + + + + + + 更新 + + + + + + 不分页列表 + + + + + + 分页列表 + + + + + + 查询单条 + + + + + + + 批量下发配方 + + + + + + + 名 称 :设备服务 + 创 建 人 :yangxiao + 创建时间 :2023/3/2 18:30:58 + 描 述 : + + + + + 增加 + + + + + + 移除 + + + + + + 更新 + + + + + + 不分页列表 + + + + + + 分页列表 + + + + + + 下拉列表 + + + + + + 查询单条 + + + + + + + 名 称 :设备Dto类 + 创 建 人 :yangxiao + 创建时间 : 2023/3/2 16:12:06 + 描 述 : + + + + + 增加 + + + + + 更新 + + + + + 删除 + + + + + 主键 + + + + + 分页 + + + + + 名称 + + + + + 编码 + + + + + 输出 + + + + + 名 称 :物料服务 + 创 建 人 :yangxiao + 创建时间 :2023/3/2 18:31:53 + 描 述 : + + + + + 增加 + + + + + + 移除 + + + + + + 更新 + + + + + + 不分页列表 + + + + + + 分页列表 + + + + + + 下拉列表 + + + + + + 查询单条 + + + + + + + 名 称 :物料服务 + 创 建 人 :yangxiao + 创建时间 :2023/3/2 16:11:04 + 描 述 :店铺数据维护 + + + + + 增加 + + + + + + + 删除 + + + + + + + + 详情 + + + + + + + + 列表 + + + + + + + 分页 + + + + + + + 下拉 + + + + + + + 更新 + + + + + + + + 名 称 :产品分组 + 创 建 人 :yangxiao + 创建时间 : 2023/3/10 13:59:43 + 描 述 : + + + + + 增加 + + + + + 更新 + + + + + 删除 + + + + + 主键 + + + + + 分页 + + + + + 名称 + + + + + 输出 + + + + + 名 称 :配方物料Dto类 + 创 建 人 :yangxiao + 创建时间 :2023/3/2 16:12:06 + 描 述 : + + + + + 增加 + + + + + 物料Id + + + + + 配方Id + + + + + 通道 + + + + + 顺序 + + + + + 时间(s) + + + + + 更新 + + + + + 删除 + + + + + 主键 + + + + + 不分页 + + + + + 配方Id + + + + + 分页 + + + + + 输出 + + + + + 配方名称 + + + + + 物料名称 + + + + + 物料编码 + + + + + 名 称 :配方Dto类 + 创 建 人 :yangxiao + 创建时间 :2023/3/2 16:12:06 + 描 述 : + + + + + 增加 + + + + + 更新 + + + + + 删除 + + + + + 主键 + + + + + 分页 + + + + + 名称 + + + + + 分组id + + + + + 输出 + + + + + 分组Id + + + + + 名 称 :分组信息 + 创 建 人 :yangxiao + 创建时间 : 2023/3/10 14:03:06 + 描 述 : + + + + + 增加 + + + + + + + 删除 + + + + + + + + 详情 + + + + + + + + 列表 + + + + + + + 分页 + + + + + + + 更新 + + + + + + + + 名 称 :分组信息 + 创 建 人 :yangxiao + 创建时间 :2023/3/10 14:03:21 + 描 述 : + + + + + 增加 + + + + + + 移除 + + + + + + 更新 + + + + + + 不分页列表 + + + + + + 分页列表 + + + + + + 查询单条 + + + + + + + 名 称 :配方物料服务 + 创 建 人 :yangxiao + 创建时间 :2023/3/2 18:33:18 + 描 述 : + + + + + 增加 + + + + + + 批量增加 + + + + + + + 移除 + + + + + + 更新 + + + + + + 不分页列表 + + + + + + 分页列表 + + + + + + 查询单条 + + + + + + + 名 称 :配方服务 + 创 建 人 :yangxiao + 创建时间 :2023/3/2 18:33:18 + 描 述 : + + + + + 增加 + + + + + + 移除 + + + + + + 更新 + + + + + + 不分页列表 + + + + + + 分页列表 + + + + + + 下拉列表 + + + + + + 查询单条 + + + + + + + 更改物料分组 + + + + + + + 名 称 :配方物料服务 + 创 建 人 :yangxiao + 创建时间 :2023/3/2 16:11:04 + 描 述 :配方物料数据维护 + + + + + 增加 + + + + + + + 批量增加 + + + + + + + + 删除 + + + + + + + + 详情 + + + + + + + + 列表 + + + + + + + 分页 + + + + + + + 更新 + + + + + + + + 名 称 :物料服务 + 创 建 人 :yangxiao + 创建时间 :2023/3/2 16:11:04 + 描 述 :店铺数据维护 + + + + + 增加 + + + + + + + 删除 + + + + + + + + 详情 + + + + + + + + 列表 + + + + + + + 分页 + + + + + + + 下拉 + + + + + + + 更新 + + + + + + + + [账号信息]入参基础 + + + + + 账号 + + admin + + + + 密码 + + e10adc3949ba59abbe56e057f20f883e + + + + [账号信息]添加入参 + + + + + 员工编号 + + + + + [账号信息]修改入参 + + + + + 主键 + + + + + 员工编号 + + + + + [账号信息]修改密码 + + + + + 新密码 + + + + + [账号信息]删除入参 + + + + + 主键 + + + + + [账号信息]普通查询入参 + + + + + 主键 + + + + + [账号信息]分页查询入参 + + + + + 主键 + + + + + 设备名称 + + + + + 名 称 :[账号信息]输出实体 + 创 建 人 :yangxiao + 创建时间 : 2023/1/3 10:22:37 + 描 述 : + + + + + 主键 + + + + + 账号 + + + + + 密码 + + + + + 员工id + + + + + [授权信息]入参基础 + + + + + 关键字 + + + + + 模板Id + + + + + 授权类型 1:用户,2:角色 + + + + + 授权对象 + + + + + [授权信息]添加入参 + + + + + [授权信息]角色授权入参 + + + + + 模板编号 + + + + + 授权类型 1用户 2角色 + + + + + 授权对象 + + + + + [授权信息]修改入参 + + + + + 主键 + + + + + [授权信息]删除入参 + + + + + 主键 + + + + + [授权信息]普通查询入参 + + + + + 主键 + + + + + [授权信息]分页查询入参 + + + + + 主键 + + + + + 名 称 :授权信息输出 + 创 建 人 :yangxiao + 创建时间 : 2023/1/4 17:24:21 + 描 述 : + + + + + 编号 + + + + + 名称 + + + + + 已授权 + + + + + [授权模块]入参基础 + + + + + 名称 + + + + + 描述 + + + + + [授权模块]添加入参 + + + + + [授权模块]修改入参 + + + + + 主键 + + + + + [授权模块]删除入参 + + + + + 主键 + + + + + [授权模块]普通查询入参 + + + + + 主键 + + + + + [授权模块]分页查询入参 + + + + + 主键 + + + + + 关键字 + + + + + 名 称 :授权模块输出 + 创 建 人 :yangxiao + 创建时间 : 2023/1/4 9:48:24 + 描 述 : + + + + + 主键 + + + + + 名称 + + + + + 描述 + + + + + [授权模块]入参基础 + + + + + 子级列表 + + + + + 拥有权限 + + + + + 模块编号 + + + + + 类别 1:菜单,2:视图,3:功能 + + + + + 菜单打开方式 0:框架内嵌,1:新开页面 + + + + + 父级编号 + + + + + 名称 + + + + + 图标 + + + + + 地址 + + + + + 排序码 + + + + + 启用禁用 + + + + + 子集 + + + + + [授权模块]添加入参 + + + + + [授权模块]批量授权信息 + + + + + 模板名称 + + + + + 授权模块 + + + + + [授权模块]修改入参 + + + + + 主键 + + + + + [授权模块]删除入参 + + + + + 主键 + + + + + [授权模块]普通查询入参 + + + + + 主键 + + + + + [授权模块]分页查询入参 + + + + + 主键 + + + + + [账号信息]入参基础 + + + + + 模板Id + + + + + 模块Id + + + + + [账号信息]添加入参 + + + + + [账号信息]修改入参 + + + + + 主键 + + + + + [账号信息]删除入参 + + + + + 主键 + + + + + [账号信息]普通查询入参 + + + + + 主键 + + + + + [账号信息]分页查询入参 + + + + + 主键 + + + + + 名 称 : + 创 建 人 :yangxiao + 创建时间 : 2023/1/4 17:20:51 + 描 述 : + + + + + 名 称 :授权模块输出 + 创 建 人 :yangxiao + 创建时间 : 2023/1/4 17:18:24 + 描 述 : + + + + + 子级列表 + + + + + 拥有权限 + + + + + 模块编号 + + + + + 类别 1:菜单,2:视图,3:功能 + + + + + 菜单打开方式 0:框架内嵌,1:新开页面 + + + + + 父级编号 + + + + + 名称 + + + + + 图标 + + + + + 地址 + + + + + 排序码 + + + + + 启用禁用 + + + + + 子集 + + + + + 名 称 : + 创 建 人 :yangxiao + 创建时间 : 2023/1/5 15:15:50 + 描 述 : + + + + + 主键 + + + + + 排序 + + + + + 员工姓名 + + + + + 1男2女 + + + + + 手机号 + + + + + 员工IC卡 + + + + + 头像 + + + + + 入职时间 + + + + + 离职时间 + + + + + 身份证 + + + + + 1在职2出差3离职 + + + + + 角色Id + + + + + 是否存在账号 + + + + + 账号 + + + + + [授权信息]添加入参 + + + + + [授权信息]修改入参 + + + + + 主键 + + + + + [授权信息]删除入参 + + + + + 主键 + + + + + [授权信息]普通查询入参 + + + + + 主键 + + + + + [授权信息]分页查询入参 + + + + + 主键 + + + + + 关键字 + + + + + 状态 + + + + + 性别 + + + + + 入职时间 + + + + + 名 称 :[员工信息] + 创 建 人 :yangxiao + 创建时间 : 2023/1/5 15:18:02 + 描 述 : + + + + + 主键 + + + + + 排序 + + + + + 员工姓名 + + + + + 1男2女 + + + + + 手机号 + + + + + 员工IC卡 + + + + + 头像 + + + + + 入职时间 + + + + + 离职时间 + + + + + 身份证 + + + + + 1在职2出差3离职 + + + + + 角色Id + + + + + 是否存在账号 + + + + + 账号 + + + + + [模块信息]入参基础 + + + + + 类别 1:菜单,2:视图,3:功能 + + + + + 菜单打开方式 0:框架内嵌,1:新开页面 + + + + + 父级编号 + + + + + 名称 + + + + + 图标 + + + + + 地址 + + + + + 排序码 + + + + + 启用禁用 + + + + + [模块信息]添加入参 + + + + + 主键 + + + + + [模块信息]修改入参 + + + + + 主键 + + + + + [模块信息]删除入参 + + + + + 主键 + + + + + [模块信息]普通查询入参 + + + + + 主键 + + + + + [模块信息]分页查询入参 + + + + + 主键 + + + + + 名 称 : + 创 建 人 :yangxiao + 创建时间 : 2023/1/4 9:48:24 + 描 述 : + + + + + 主键 + + + + + 类别 1:菜单,2:视图,3:功能 + + + + + 菜单打开方式 0:框架内嵌,1:新开页面 + + + + + 父级编号 + + + + + 名称 + + + + + 图标 + + + + + 地址 + + + + + 排序码 + + + + + 启用禁用 + + + + + [菜单模块树]入参基础 + + + + + 类别 1:菜单,2:视图,3:功能 + + + + + 菜单打开方式 0:框架内嵌,1:新开页面 + + + + + 父级编号 + + + + + 名称 + + + + + 图标 + + + + + 地址 + + + + + 排序码 + + + + + 启用禁用 + + + + + 子集 + + + + + [菜单模块树]添加入参 + + + + + [菜单模块树]修改入参 + + + + + 主键 + + + + + [菜单模块树]删除入参 + + + + + 主键 + + + + + [菜单模块树]普通查询入参 + + + + + 主键 + + + + + 名称 + + + + + [菜单模块树]分页查询入参 + + + + + 主键 + + + + + 名 称 :[菜单模块树]输出 + 创 建 人 :yangxiao + 创建时间 : 2023/1/4 16:14:43 + 描 述 : + + + + + 模块编号 + + + + + 类别 1:菜单,2:视图,3:功能 + + + + + 菜单打开方式 0:框架内嵌,1:新开页面 + + + + + 父级编号 + + + + + 名称 + + + + + 图标 + + + + + 地址 + + + + + 排序码 + + + + + 启用禁用 + + + + + 子集 + + + + + 名 称 :[角色信息] + 创 建 人 :yangxiao + 创建时间 : 2023/1/4 9:43:25 + 描 述 : + + + + + 角色名称 + + + + + 角色描述 + + + + + [角色信息]添加入参 + + + + + [角色信息]修改入参 + + + + + 主键 + + + + + [角色信息]删除入参 + + + + + 主键 + + + + + [角色信息]普通查询入参 + + + + + 主键 + + + + + [角色信息]分页查询入参 + + + + + 主键 + + + + + 关键字 + + + + + 名 称 :角色信息 + 创 建 人 :yangxiao + 创建时间 : 2023/1/4 9:43:42 + 描 述 : + + + + + 主键 + + + + + 角色名称 + + + + + 角色描述 + + + + + 名 称 :个人角色信息 + 创 建 人 :yangxiao + 创建时间 : 2023/1/4 17:46:47 + 描 述 : + + + + + 个人菜单信息 + + + + + 主键 + + + + + 菜单名称 + + + + + 菜单地址 + + + + + 菜单图标 + + + + + 菜单子项 + + + + + 父级Id + + + + + 分页信息 + + + + + 打开类型 + + + + + 类别 + + + + + 名 称 :授权服务 + 创 建 人 :yangxiao + 创建时间 :2023/3/2 16:11:04 + 描 述 :授权服务数据维护 + + + + + 登录 + + + + + + + 获取个人信息 + + + + + + 获取用户权限 + + + + + + 获取权限模块编号 + + + + + + + + 获取账户信息 + + + + + + + 添加账户 + + + + + + + 修改账户信息 + + + + + + + 删除账户 + + + + + + + 获取授权模块编号 + + + + + + diff --git a/backend/BPA.MES.Base.Application/Const/ClaimConst.cs b/backend/BPA.MES.Base.Application/Const/ClaimConst.cs new file mode 100644 index 0000000..705d722 --- /dev/null +++ b/backend/BPA.MES.Base.Application/Const/ClaimConst.cs @@ -0,0 +1,64 @@ +namespace BPA.MES.Base.Application +{ + /// + /// 名 称 : + /// 创 建 人 :yangxiao + /// 创建时间 : 2023/3/4 10:15:54 + /// 描 述 : + /// + public class ClaimConst + { + /// + /// 用户Id + /// + public const string CLAINM_USERID = "UserId"; + /// + /// 账号 + /// + public const string CLAINM_ACCOUNT = "Account"; + /// + /// 名称 + /// + public const string CLAINM_NAME = "Name"; + /// + /// 头像 + /// + public const string CLAINM_AVATARURL = "AvatarUrl"; + /// + /// 电话 + /// + public const string CLAINM_PHONE = "Phone"; + /// + /// 性别 + /// + public const string CLAINM_SEX = "0"; + /// + /// 是否授权 + /// + public const string CLAINM_ISAUTH = "0"; + /// + /// 微信session_key + /// + public const string SESSION_KEY = "session_key"; + /// + /// 是否超级管理 + /// + public const string CLAINM_SUPERADMIN = "SuperAdmin"; + /// + /// 租户Id + /// + public const string TENANT_ID = "TenantId"; + /// + /// 用户组织机构Id + /// + public const string CLAINM_ORGID = "OrgId"; + /// + /// 用户组织机构名称 + /// + public const string CLAINM_ORGNAME = "OrgName"; + /// + /// 是否是管理员 + /// + public const bool ISADMIN = false; + } +} diff --git a/backend/BPA.MES.Base.Application/Entitys/Base/DeviceRecipeEntity.cs b/backend/BPA.MES.Base.Application/Entitys/Base/DeviceRecipeEntity.cs new file mode 100644 index 0000000..a7d7750 --- /dev/null +++ b/backend/BPA.MES.Base.Application/Entitys/Base/DeviceRecipeEntity.cs @@ -0,0 +1,22 @@ +namespace BPA.MES.Base.Application.Entitys +{ + /// + /// 名 称 :设备配方表 + /// 创 建 人 :yangxiao + /// 创建时间 :2023/3/2 13:57:00 + /// 描 述 : + /// + [SugarTable("devices_recipes")] + public class DeviceRecipeEntity : DEntityBase + { + /// + /// 设备Id + /// + public string DeviceId { get; set; } + /// + /// 配方Id + /// + public string RecipesId { get; set; } + + } +} diff --git a/backend/BPA.MES.Base.Application/Entitys/Base/DevicesInfoEntity.cs b/backend/BPA.MES.Base.Application/Entitys/Base/DevicesInfoEntity.cs new file mode 100644 index 0000000..a233b87 --- /dev/null +++ b/backend/BPA.MES.Base.Application/Entitys/Base/DevicesInfoEntity.cs @@ -0,0 +1,23 @@ +namespace BPA.MES.Base.Application.Entitys +{ + /// + /// 名 称 :设备 + /// 创 建 人 :yangxiao + /// 创建时间 :2023/3/2 13:51:45 + /// 描 述 : + /// + [SugarTable("devices_info")] + public class DevicesInfoEntity: DEntityBase + { + /// + /// 名称 + /// + [Required(ErrorMessage = "名称不能为空")] + public string Name { get; set; } + /// + /// 编码 + /// + [Required(ErrorMessage = "编码不能为空")] + public string Code { get; set; } + } +} diff --git a/backend/BPA.MES.Base.Application/Entitys/Base/GroupInfoEntity.cs b/backend/BPA.MES.Base.Application/Entitys/Base/GroupInfoEntity.cs new file mode 100644 index 0000000..2bbf3b3 --- /dev/null +++ b/backend/BPA.MES.Base.Application/Entitys/Base/GroupInfoEntity.cs @@ -0,0 +1,21 @@ +namespace BPA.MES.Base.Application.Entitys +{ + /// + /// 名 称 :分组信息 + /// 创 建 人 :yangxiao + /// 创建时间 : 2023/3/10 14:01:15 + /// 描 述 : + /// + [SugarTable("group_info")] + public class GroupInfoEntity: DEntityBase + { + /// + /// 名称 + /// + public string Name { get; set; } + /// + /// 介绍 + /// + public string Des { get; set; } + } +} diff --git a/backend/BPA.MES.Base.Application/Entitys/Base/MaterialsInfoEntity.cs b/backend/BPA.MES.Base.Application/Entitys/Base/MaterialsInfoEntity.cs new file mode 100644 index 0000000..3f8ec05 --- /dev/null +++ b/backend/BPA.MES.Base.Application/Entitys/Base/MaterialsInfoEntity.cs @@ -0,0 +1,31 @@ +namespace BPA.MES.Base.Application.Entitys +{ + /// + /// 名 称 :物料 + /// 创 建 人 :yangxiao + /// 创建时间 :2023/3/2 13:52:00 + /// 描 述 : + /// + [SugarTable("materials_info")] + public class MaterialsInfoEntity: DEntityBase + { + /// + /// 名称 + /// + [Required(ErrorMessage = "名称不能为空")] + public string Name { get; set; } + /// + /// 编码 + /// + [Required(ErrorMessage = "编码不能为空")] + public string Code { get; set; } + /// + /// 单位 + /// + public string Unit { get; set; } + /// + /// 每秒出水量(g) + /// + public string Wos { get; set; } + } +} diff --git a/backend/BPA.MES.Base.Application/Entitys/Base/RecipeMaterialEntity.cs b/backend/BPA.MES.Base.Application/Entitys/Base/RecipeMaterialEntity.cs new file mode 100644 index 0000000..d757e03 --- /dev/null +++ b/backend/BPA.MES.Base.Application/Entitys/Base/RecipeMaterialEntity.cs @@ -0,0 +1,33 @@ +namespace BPA.MES.Base.Application.Entitys +{ + /// + /// 名 称 :配方物料信息 + /// 创 建 人 :yangxiao + /// 创建时间 : 2023/3/2 13:58:19 + /// 描 述 : + /// + [SugarTable("recipes_material")] + public class RecipeMaterialEntity : DEntityBase + { + /// + /// 物料Id + /// + public string MaterialId { get; set; } + /// + /// 配方Id + /// + public string RecipesId { get; set; } + /// + /// 通道 + /// + public string Outlet { get; set; } + /// + /// 顺序 + /// + public string Sort { get; set; } + /// + /// 时间(s) + /// + public string Time { get; set; } + } +} diff --git a/backend/BPA.MES.Base.Application/Entitys/Base/RecipesGroupEntity.cs b/backend/BPA.MES.Base.Application/Entitys/Base/RecipesGroupEntity.cs new file mode 100644 index 0000000..1518fdd --- /dev/null +++ b/backend/BPA.MES.Base.Application/Entitys/Base/RecipesGroupEntity.cs @@ -0,0 +1,21 @@ +namespace BPA.MES.Base.Application.Entitys +{ + /// + /// 名 称 :配方分组 + /// 创 建 人 :yangxiao + /// 创建时间 : 2023/3/10 14:56:03 + /// 描 述 : + /// + [SugarTable("recipes_group")] + public class RecipesGroupEntity + { + /// + /// 组Id + /// + public string GroupId { get; set; } + /// + /// 产品Id + /// + public string RecipesId { get; set; } + } +} diff --git a/backend/BPA.MES.Base.Application/Entitys/Base/RecipesInfoEntity.cs b/backend/BPA.MES.Base.Application/Entitys/Base/RecipesInfoEntity.cs new file mode 100644 index 0000000..5f6932c --- /dev/null +++ b/backend/BPA.MES.Base.Application/Entitys/Base/RecipesInfoEntity.cs @@ -0,0 +1,25 @@ +namespace BPA.MES.Base.Application.Entitys +{ + /// + /// 名 称 :配方信息 + /// 创 建 人 :yangxiao + /// 创建时间 : 2023/3/2 13:57:15 + /// 描 述 : + /// + [SugarTable("recipes_info")] + public class RecipesInfoEntity : DEntityBase + { + /// + /// 名称 + /// + public string Name { get; set; } + /// + /// 自定义编码 + /// + public string Code { get; set; } + /// + /// 图标 + /// + public string PicUrl { get; set; } + } +} diff --git a/backend/BPA.MES.Base.Application/Entitys/Base/StoreInfoEntity.cs b/backend/BPA.MES.Base.Application/Entitys/Base/StoreInfoEntity.cs new file mode 100644 index 0000000..6a5c6ef --- /dev/null +++ b/backend/BPA.MES.Base.Application/Entitys/Base/StoreInfoEntity.cs @@ -0,0 +1,30 @@ +namespace BPA.MES.Base.Application.Entitys +{ + /// + /// 名 称 :店铺信息 + /// 创 建 人 :yangxiao + /// 创建时间 : 2023/3/2 13:52:13 + /// 描 述 : + /// + [SugarTable("store_info")] + public class StoreInfoEntity : DEntityBase + { + /// + /// 名称 + /// + [Required(ErrorMessage = "名称不能为空")] + public string Name { get; set; } + /// + /// 地址 + /// + public string Address { get; set; } + /// + /// 联系电话 + /// + public string Phone { get; set; } + /// + /// 负责人 + /// + public string Directors { get; set; } + } +} diff --git a/backend/BPA.MES.Base.Application/Entitys/Sys/AccountEntity.cs b/backend/BPA.MES.Base.Application/Entitys/Sys/AccountEntity.cs new file mode 100644 index 0000000..8c0955b --- /dev/null +++ b/backend/BPA.MES.Base.Application/Entitys/Sys/AccountEntity.cs @@ -0,0 +1,29 @@ + +namespace BPA.MES.Base.Application.Entitys +{ + /// + /// 名 称 :账户信息 + /// 创 建 人 :yangxiao + /// 创建时间 : 2023/1/3 10:18:43 + /// 描 述 : + /// + [SugarTable("sys_account")] + public class AccountEntity : DEntityBase + { + /// + /// 账号 + /// + [SugarColumn(IsNullable = false)] + public string Account { get; set; } + /// + /// 密码 + /// + [SugarColumn(IsNullable = false)] + public string Pwd { get; set; } + /// + /// 员工表Id + /// + [SugarColumn(IsNullable = false)] + public string EmployeeId { get; set; } + } +} diff --git a/backend/BPA.MES.Base.Application/Entitys/Sys/AuthorizeTemplateEntity.cs b/backend/BPA.MES.Base.Application/Entitys/Sys/AuthorizeTemplateEntity.cs new file mode 100644 index 0000000..c95181f --- /dev/null +++ b/backend/BPA.MES.Base.Application/Entitys/Sys/AuthorizeTemplateEntity.cs @@ -0,0 +1,29 @@ +namespace BPA.MES.Base.Application.Entitys +{ + /// + /// 名 称 授权模板表 + /// 创 建 人 :yangxiao + /// 创建时间 : 2023/1/4 17:31:11 + /// 描 述 : + /// + [SugarTable("sys_authorizetemplate")] + public class AuthorizeTemplateEntity : DEntityBase + { + /// + /// 名称 + /// + public string Name { get; set; } + /// + /// 描述 + /// + public string Remark { get; set; } + /// + /// 创建时间 + /// + public DateTime? CreateAt { get; set; } + /// + /// 是否删除 + /// + public bool IsDeleted { get; set; } + } +} diff --git a/backend/BPA.MES.Base.Application/Entitys/Sys/AuthorizeTemplateItemEntity.cs b/backend/BPA.MES.Base.Application/Entitys/Sys/AuthorizeTemplateItemEntity.cs new file mode 100644 index 0000000..3a3489a --- /dev/null +++ b/backend/BPA.MES.Base.Application/Entitys/Sys/AuthorizeTemplateItemEntity.cs @@ -0,0 +1,27 @@ +namespace BPA.MES.Base.Application.Entitys +{ + /// + /// 名 称 : 授权模板子项表 + /// 创 建 人 :yangxiao + /// 创建时间 : 2023/1/4 17:31:27 + /// 描 述 : + /// + [SugarTable("sys_authorizetemplate_item")] + public class AuthorizeTemplateItemEntity : DEntityBase + { + /// + /// 模板编号 + /// + public string TB_TemplateId { get; set; } + + /// + /// 模块编号 + /// + public string TB_ModuleId { get; set; } + + /// + /// 是否删除 + /// + public bool IsDeleted { get; set; } + } +} diff --git a/backend/BPA.MES.Base.Application/Entitys/Sys/AuthorizeTemplateMapEntity.cs b/backend/BPA.MES.Base.Application/Entitys/Sys/AuthorizeTemplateMapEntity.cs new file mode 100644 index 0000000..90f33fa --- /dev/null +++ b/backend/BPA.MES.Base.Application/Entitys/Sys/AuthorizeTemplateMapEntity.cs @@ -0,0 +1,30 @@ +namespace BPA.MES.Base.Application.Entitys +{ + /// + /// 名 称 :授权对象表 + /// 创 建 人 :yangxiao + /// 创建时间 : 2023/1/4 17:31:39 + /// 描 述 : + /// + [SugarTable("sys_authorizetemplatemap")] + public class AuthorizeTemplateMapEntity : DEntityBase + { + /// + /// 授权模板编号 + /// + public string TemplateId { get; set; } + + /// + /// 授权对象编号(用户编号,角色编号) + /// + public string ObjectId { get; set; } + /// + /// 授权类型 1:用户,2:角色 + /// + public int AuthorizeType { get; set; } + /// + /// 是否删除 + /// + public bool IsDeleted { get; set; } + } +} diff --git a/backend/BPA.MES.Base.Application/Entitys/Sys/EmployeeEntity.cs b/backend/BPA.MES.Base.Application/Entitys/Sys/EmployeeEntity.cs new file mode 100644 index 0000000..0e3594c --- /dev/null +++ b/backend/BPA.MES.Base.Application/Entitys/Sys/EmployeeEntity.cs @@ -0,0 +1,69 @@ +namespace BPA.MES.Base.Application.Entitys +{ + /// + /// 名 称 :员工信息 + /// 创 建 人 :yangxiao + /// 创建时间 : 2023/1/4 17:44:31 + /// 描 述 : + /// + [SugarTable("sys_employee")] + public class EmployeeEntity : DEntityBase + { + /// + /// 员工姓名 + /// + [SugarColumn(IsNullable = false)] + public string Name { get; set; } + /// + /// 1男2女 + /// + [SugarColumn(IsNullable = true)] + public int Gender { get; set; } + /// + /// 手机号 + /// + [SugarColumn(IsNullable = false)] + public string Phone { get; set; } + /// + /// 员工IC卡 + /// + [SugarColumn(IsNullable = true)] + public string ICCard { get; set; } + /// + /// 头像 + /// + [SugarColumn(IsNullable = true)] + public string Header { get; set; } + + [SugarColumn(IsNullable = false)] + public DateTime JoinDate { get; set; } + /// + /// 入职时间 + /// + [SugarColumn(IsNullable = true)] + public DateTime? OutDate { get; set; } + /// + /// 身份证 + /// + [SugarColumn(IsNullable = true)] + public string IdCard { get; set; } + /// + /// 1在职2出差3离职 + /// + [SugarColumn(IsNullable = false)] + public int Stutas { get; set; } + /// + /// 超管 + /// + [SugarColumn(IsNullable = false)] + public bool IsAdmin { get; set; } + /// + /// 角色Id + /// + public string TB_RoleId { get; set; } + /// + /// 是否删除 + /// + public bool IsDeleted { get; set; } + } +} diff --git a/backend/BPA.MES.Base.Application/Entitys/Sys/ModuleEntity.cs b/backend/BPA.MES.Base.Application/Entitys/Sys/ModuleEntity.cs new file mode 100644 index 0000000..b9ef298 --- /dev/null +++ b/backend/BPA.MES.Base.Application/Entitys/Sys/ModuleEntity.cs @@ -0,0 +1,46 @@ +namespace BPA.MES.Base.Application.Entitys +{ + /// + /// 名 称 :模块菜单表 + /// 创 建 人 :yangxiao + /// 创建时间 : 2023/1/4 17:32:15 + /// 描 述 : + /// + [SugarTable("sys_module")] + public class ModuleEntity : DEntityBase + { + /// + /// 类别 1:菜单,2:视图,3:功能 + /// + public int Category { get; set; } + + /// + /// 菜单打开方式 0:框架内嵌,1:新开页面 + /// + public int OpenType { get; set; } + + /// + /// 父级编号 + /// + public string ParentId { get; set; } + + /// + /// 名称 + /// + public string Name { set; get; } + + /// + /// 图标 + /// + public string Icon { set; get; } + + /// + /// 地址 + /// + public string Url { set; get; } + /// + /// 状态 + /// + public bool IsDisabled { get; set; } + } +} diff --git a/backend/BPA.MES.Base.Application/Entitys/Sys/RoleEntity.cs b/backend/BPA.MES.Base.Application/Entitys/Sys/RoleEntity.cs new file mode 100644 index 0000000..43522ff --- /dev/null +++ b/backend/BPA.MES.Base.Application/Entitys/Sys/RoleEntity.cs @@ -0,0 +1,32 @@ +namespace BPA.MES.Base.Application.Entitys +{ + /// + /// 名 称 :角色信息 + /// 创 建 人 :yangxiao + /// 创建时间 : 2023/1/4 17:32:32 + /// 描 述 : + /// + [SugarTable("sys_role")] + public class RoleEntity : DEntityBase + { + /// + /// 角色名称 + /// + public string Name { get; set; } + + /// + /// 角色类型 1超级管理员,2其他 + /// + public int? RoleType { get; set; } + + /// + /// 角色描述 + /// + public string Description { get; set; } + + /// + /// 是否删除 + /// + public bool IsDeleted { get; set; } + } +} diff --git a/backend/BPA.MES.Base.Application/GlobalUsings.cs b/backend/BPA.MES.Base.Application/GlobalUsings.cs new file mode 100644 index 0000000..d3511cb --- /dev/null +++ b/backend/BPA.MES.Base.Application/GlobalUsings.cs @@ -0,0 +1,19 @@ +global using Furion; +global using Furion.DataEncryption; +global using Furion.DataValidation; +global using Furion.DependencyInjection; +global using Furion.DynamicApiController; +global using Furion.Extensions; +global using Furion.FriendlyException; +global using Furion.Logging; +global using Mapster; +global using Microsoft.AspNetCore.Authorization; +global using Microsoft.AspNetCore.Http; +global using Microsoft.AspNetCore.Mvc; +global using Microsoft.CodeAnalysis; +global using BPA.MES.Base.Core; +global using static BPA.MES.Base.Core.TreeExtensions; +global using System.ComponentModel.DataAnnotations; +global using BPA.MES.Base.Application.Entitys; +global using Furion.DataEncryption.Extensions; +global using SqlSugar; \ No newline at end of file diff --git a/backend/BPA.MES.Base.Application/Services/DeviceService/Dtos/DeviceRecipeDto.cs b/backend/BPA.MES.Base.Application/Services/DeviceService/Dtos/DeviceRecipeDto.cs new file mode 100644 index 0000000..2a370bc --- /dev/null +++ b/backend/BPA.MES.Base.Application/Services/DeviceService/Dtos/DeviceRecipeDto.cs @@ -0,0 +1,99 @@ +namespace BPA.MES.Base.Application.Entitys +{ + /// + /// 名 称 :设备Dto类 + /// 创 建 人 :yangxiao + /// 创建时间 : 2023/3/2 16:12:06 + /// 描 述 : + /// + public class DeviceRecipeDto : DeviceRecipeEntity + { + + } + /// + /// 增加 + /// + public class DeviceRecipeAddInput : DeviceRecipeDto + { + + } + /// + /// 更新 + /// + public class DeviceRecipeUpdateInput : DeviceRecipeDto + { + + } + /// + /// 删除 + /// + public class DeviceRecipeDelInput + { + /// + /// 主键 + /// + public string Id { get; set; } + } + /// + /// 不分页 + /// + public class DeviceRecipeQueryInput + { + /// + /// 设备Id + /// + public string DeviceId { get; set; } + + } + /// + /// 分页 + /// + public class DeviceRecipeQueryPageInput : RequestPage + { + + } + + public class DeviceRecipeBatchAddInput + { + /// + /// 设备Id + /// + public string DeviceId { get; set; } + /// + /// 配方数组 + /// + public List RecipesIds { get; set; } = new(); + } + + + /// + /// 输出 + /// + public class DeviceRecipeOutput : DeviceRecipeDto + { + /// + /// 设备名称 + /// + public string DeviceName { get; set; } + /// + /// 配方名称 + /// + public string RecipeName { get; set; } + /// + /// 配方代码 + /// + public string RecipeCode { get; set; } + /// + /// 分组Id + /// + public string GroupId { get; set; } + /// + /// 分组名称 + /// + public string GroupName { get; set; } + /// + /// 配方图片地址 + /// + public string RecipesPic { get; set; } + } +} diff --git a/backend/BPA.MES.Base.Application/Services/DeviceService/Dtos/DevicesInfoDto.cs b/backend/BPA.MES.Base.Application/Services/DeviceService/Dtos/DevicesInfoDto.cs new file mode 100644 index 0000000..124537e --- /dev/null +++ b/backend/BPA.MES.Base.Application/Services/DeviceService/Dtos/DevicesInfoDto.cs @@ -0,0 +1,51 @@ +namespace BPA.MES.Base.Application.Entitys +{ + /// + /// 名 称 :设备Dto类 + /// 创 建 人 :yangxiao + /// 创建时间 : 2023/3/2 16:12:06 + /// 描 述 : + /// + public class DevicesInfoDto : DevicesInfoEntity + { + + } + /// + /// 增加 + /// + public class DevicesInfoAddInput : DevicesInfoDto + { + + } + /// + /// 更新 + /// + public class DevicesInfoUpdateInput : DevicesInfoDto + { + + } + /// + /// 删除 + /// + public class DevicesInfoDelInput + { + /// + /// 主键 + /// + public string Id { get; set; } + } + /// + /// 分页 + /// + public class DevicesInfoQueryPageInput : RequestPage + { + + } + /// + /// 输出 + /// + public class DevicesInfoOutput : DevicesInfoDto + { + + } +} diff --git a/backend/BPA.MES.Base.Application/Services/DeviceService/Services/DeviceRecipeService.cs b/backend/BPA.MES.Base.Application/Services/DeviceService/Services/DeviceRecipeService.cs new file mode 100644 index 0000000..c52a918 --- /dev/null +++ b/backend/BPA.MES.Base.Application/Services/DeviceService/Services/DeviceRecipeService.cs @@ -0,0 +1,145 @@ +namespace BPA.MES.Base.Application.Entitys +{ + /// + /// 名 称 :设备服务 + /// 创 建 人 :yangxiao + /// 创建时间 :2023/3/2 16:11:04 + /// 描 述 :店铺数据维护 + /// + [ApiDescriptionSettings(Name = "DeviceRecipe", KeepName = true, SplitCamelCase = true, KeepVerb = true)] + public class DeviceRecipeService : IDeviceRecipeService, ITransient, IDynamicApiController + { + private readonly ISqlSugarClient _dbContext; + public DeviceRecipeService(ISqlSugarClient db) + { + _dbContext = db; + } + /// + /// 增加 + /// + /// + /// + [HttpPost] + public async Task Add(DeviceRecipeAddInput input) + { + var r_entity = await _dbContext.Queryable().FirstAsync(x => x.DeviceId == input.DeviceId && x.RecipesId==input.RecipesId); + if (r_entity != null) + { + throw Oops.Bah("名称已存在!"); + } + DeviceRecipeEntity entity = input.Adapt(); + return await _dbContext.Insertable(entity).IgnoreColumns(ignoreNullColumn: true).ExecuteCommandIdentityIntoEntityAsync(); + } + /// + /// 批量下发配方 + /// + /// + /// + /// + + public async Task BatchUpdate(DeviceRecipeBatchAddInput input) + { + bool result = false; + List dr_entitys = new(); + foreach (var item in input.RecipesIds) + { + DeviceRecipeEntity entity = new(); + entity.RecipesId = item; + entity.DeviceId = input.DeviceId; + dr_entitys.Add(entity); + } + try + { + _dbContext.Ado.BeginTran(); + await _dbContext.Deleteable().Where(x => x.DeviceId == input.DeviceId).ExecuteCommandAsync(); + if (input.RecipesIds.Any()) + { + await _dbContext.Insertable(dr_entitys).ExecuteCommandAsync(); + } + _dbContext.Ado.CommitTran(); + result = true; + } + catch (Exception ex) + { + throw Oops.Bah("更新失败!"); + } + return result; + } + /// + /// 删除 + /// + /// + /// + /// + [HttpPost] + public async Task Del(DeviceRecipeDelInput input) + { + var res = await _dbContext.Deleteable().Where(x => x.Id == input.Id).ExecuteCommandHasChangeAsync(); + return res; + } + /// + /// 详情 + /// + /// + /// + /// + [HttpGet] + public async Task Detail(string Id) + { + var entity = await _dbContext.Queryable().FirstAsync(x => x.Id == Id); + DeviceRecipeOutput output = entity.Adapt(); + return output; + } + /// + /// 列表 + /// + /// + /// + [HttpPost,AllowAnonymous] + public async Task> List(DeviceRecipeQueryInput input) + { + var output = await _dbContext.Queryable() + .LeftJoin((a,b)=>a.RecipesId==b.Id) + .LeftJoin((a,b,c)=>a.RecipesId==c.RecipesId) + .LeftJoin((a, b, c,d)=>c.GroupId==d.Id) + .WhereIF(!string.IsNullOrEmpty(input.DeviceId),a=>a.DeviceId==input.DeviceId) + .Select((a, b, c,d) => new DeviceRecipeOutput + { + DeviceId = a.DeviceId, + RecipeName = b.Name, + RecipeCode = b.Code, + RecipesId = a.RecipesId, + RecipesPic =b.PicUrl, + GroupId = c.GroupId, + GroupName = d.Name + }) + .ToListAsync(); + return output; + } + /// + /// 分页 + /// + /// + /// + [HttpPost] + public async Task> PagedList(DeviceRecipeQueryPageInput input) + { + var entity = await _dbContext.Queryable() + .ToPagedListAsync(input.PageIndex, input.PageSize); + SqlSugarPagedList output = entity.Adapt>(); + return output; + } + /// + /// 更新 + /// + /// + /// + /// + [HttpPost] + public async Task Update(DeviceRecipeUpdateInput input) + { + var res = await _dbContext.Updateable().ExecuteCommandHasChangeAsync(); + return res; + } + } +} diff --git a/backend/BPA.MES.Base.Application/Services/DeviceService/Services/DevicesInfoService.cs b/backend/BPA.MES.Base.Application/Services/DeviceService/Services/DevicesInfoService.cs new file mode 100644 index 0000000..44131ee --- /dev/null +++ b/backend/BPA.MES.Base.Application/Services/DeviceService/Services/DevicesInfoService.cs @@ -0,0 +1,111 @@ +namespace BPA.MES.Base.Application.Entitys +{ + /// + /// 名 称 :设备服务 + /// 创 建 人 :yangxiao + /// 创建时间 :2023/3/2 16:11:04 + /// 描 述 :店铺数据维护 + /// + [ApiDescriptionSettings(Name = "DevicesInfo", KeepName = true, SplitCamelCase = true, KeepVerb = true)] + public class DevicesInfoService : IDevicesInfoService, ITransient, IDynamicApiController + { + private readonly ISqlSugarClient _dbContext; + public DevicesInfoService(ISqlSugarClient db) + { + _dbContext = db; + } + /// + /// 增加 + /// + /// + /// + [HttpPost] + public async Task Add(DevicesInfoAddInput input) + { + var r_entity = await _dbContext.Queryable().FirstAsync(x => x.Name == input.Name); + if (r_entity != null) + { + throw Oops.Bah("名称已存在!"); + } + DevicesInfoEntity entity = input.Adapt(); + return await _dbContext.Insertable(entity).IgnoreColumns(ignoreNullColumn: true).ExecuteCommandIdentityIntoEntityAsync(); + } + /// + /// 删除 + /// + /// + /// + /// + [HttpPost] + public async Task Del(DevicesInfoDelInput input) + { + var res = await _dbContext.Deleteable().Where(x => x.Id == input.Id).ExecuteCommandHasChangeAsync(); + return res; + } + /// + /// 详情 + /// + /// + /// + /// + [HttpGet] + public async Task Detail(string Id) + { + var entity = await _dbContext.Queryable().FirstAsync(x => x.Id == Id); + DevicesInfoOutput output = entity.Adapt(); + return output; + } + /// + /// 列表 + /// + /// + /// + [HttpGet] + public async Task> List() + { + var entity = await _dbContext.Queryable().ToListAsync(); + List output = entity.Adapt>(); + return output; + } + /// + /// 分页 + /// + /// + /// + [HttpPost] + public async Task> PagedList(DevicesInfoQueryPageInput input) + { + var entity = await _dbContext.Queryable() + .ToPagedListAsync(input.PageIndex, input.PageSize); + SqlSugarPagedList output = entity.Adapt>(); + return output; + } + /// + /// 下拉 + /// + /// + /// + [HttpGet] + public async Task SelectList() + { + var entity = await _dbContext.Queryable().Select(x => new + { + key = x.Id, + value = x.Name + }).ToListAsync(); + return entity; + } + /// + /// 更新 + /// + /// + /// + /// + [HttpPost] + public async Task Update(DevicesInfoUpdateInput input) + { + var res = await _dbContext.Updateable().ExecuteCommandHasChangeAsync(); + return res; + } + } +} diff --git a/backend/BPA.MES.Base.Application/Services/DeviceService/Services/IDeviceRecipeService.cs b/backend/BPA.MES.Base.Application/Services/DeviceService/Services/IDeviceRecipeService.cs new file mode 100644 index 0000000..7965b6e --- /dev/null +++ b/backend/BPA.MES.Base.Application/Services/DeviceService/Services/IDeviceRecipeService.cs @@ -0,0 +1,49 @@ +namespace BPA.MES.Base.Application.Entitys +{ + /// + /// 名 称 :设备配方服务 + /// 创 建 人 :yangxiao + /// 创建时间 :2023/3/2 18:30:58 + /// 描 述 : + /// + public interface IDeviceRecipeService + { + /// + /// 增加 + /// + /// + Task Add(DeviceRecipeAddInput input); + /// + /// 移除 + /// + /// + Task Del(DeviceRecipeDelInput input); + /// + /// 更新 + /// + /// + Task Update(DeviceRecipeUpdateInput input); + /// + /// 不分页列表 + /// + /// + Task> List(DeviceRecipeQueryInput input); + /// + /// 分页列表 + /// + /// + Task> PagedList(DeviceRecipeQueryPageInput input); + /// + /// 查询单条 + /// + /// + /// + Task Detail(string Id); + /// + /// 批量下发配方 + /// + /// + /// + Task BatchUpdate(DeviceRecipeBatchAddInput input); + } +} diff --git a/backend/BPA.MES.Base.Application/Services/DeviceService/Services/IDevicesInfoService.cs b/backend/BPA.MES.Base.Application/Services/DeviceService/Services/IDevicesInfoService.cs new file mode 100644 index 0000000..289acce --- /dev/null +++ b/backend/BPA.MES.Base.Application/Services/DeviceService/Services/IDevicesInfoService.cs @@ -0,0 +1,49 @@ +namespace BPA.MES.Base.Application.Entitys +{ + /// + /// 名 称 :设备服务 + /// 创 建 人 :yangxiao + /// 创建时间 :2023/3/2 18:30:58 + /// 描 述 : + /// + public interface IDevicesInfoService + { + /// + /// 增加 + /// + /// + Task Add(DevicesInfoAddInput input); + /// + /// 移除 + /// + /// + Task Del(DevicesInfoDelInput input); + /// + /// 更新 + /// + /// + Task Update(DevicesInfoUpdateInput input); + /// + /// 不分页列表 + /// + /// + Task> List(); + /// + /// 分页列表 + /// + /// + Task> PagedList(DevicesInfoQueryPageInput input); + /// + /// 下拉列表 + /// + /// + Task SelectList(); + /// + /// 查询单条 + /// + /// + /// + Task Detail(string Id); + + } +} diff --git a/backend/BPA.MES.Base.Application/Services/MaterialService/Dtos/MaterialsInfoDto.cs b/backend/BPA.MES.Base.Application/Services/MaterialService/Dtos/MaterialsInfoDto.cs new file mode 100644 index 0000000..c511140 --- /dev/null +++ b/backend/BPA.MES.Base.Application/Services/MaterialService/Dtos/MaterialsInfoDto.cs @@ -0,0 +1,58 @@ +namespace BPA.MES.Base.Application.Entitys +{ + /// + /// 名 称 :设备Dto类 + /// 创 建 人 :yangxiao + /// 创建时间 : 2023/3/2 16:12:06 + /// 描 述 : + /// + public class MaterialsInfoDto : MaterialsInfoEntity + { + + } + /// + /// 增加 + /// + public class MaterialsInfoAddInput : MaterialsInfoDto + { + + } + /// + /// 更新 + /// + public class MaterialsInfoUpdateInput : MaterialsInfoDto + { + + } + /// + /// 删除 + /// + public class MaterialsInfoDelInput + { + /// + /// 主键 + /// + public string Id { get; set; } + } + /// + /// 分页 + /// + public class MaterialsInfoQueryPageInput : RequestPage + { + /// + /// 名称 + /// + public string Name { get; set; } + /// + /// 编码 + /// + public string Code { get; set; } + } + /// + /// 输出 + /// + public class MaterialsInfoOutput : MaterialsInfoDto + { + + } +} diff --git a/backend/BPA.MES.Base.Application/Services/MaterialService/Services/IMaterialsInfoService.cs b/backend/BPA.MES.Base.Application/Services/MaterialService/Services/IMaterialsInfoService.cs new file mode 100644 index 0000000..d9dbd7e --- /dev/null +++ b/backend/BPA.MES.Base.Application/Services/MaterialService/Services/IMaterialsInfoService.cs @@ -0,0 +1,48 @@ +namespace BPA.MES.Base.Application.Entitys +{ + /// + /// 名 称 :物料服务 + /// 创 建 人 :yangxiao + /// 创建时间 :2023/3/2 18:31:53 + /// 描 述 : + /// + public interface IMaterialsInfoService + { + /// + /// 增加 + /// + /// + Task Add(MaterialsInfoAddInput input); + /// + /// 移除 + /// + /// + Task Del(MaterialsInfoDelInput input); + /// + /// 更新 + /// + /// + Task Update(MaterialsInfoUpdateInput input); + /// + /// 不分页列表 + /// + /// + Task> List(); + /// + /// 分页列表 + /// + /// + Task> PagedList(MaterialsInfoQueryPageInput input); + /// + /// 下拉列表 + /// + /// + Task SelectList(); + /// + /// 查询单条 + /// + /// + /// + Task Detail(string Id); + } +} diff --git a/backend/BPA.MES.Base.Application/Services/MaterialService/Services/MaterialsInfoService.cs b/backend/BPA.MES.Base.Application/Services/MaterialService/Services/MaterialsInfoService.cs new file mode 100644 index 0000000..11b37ff --- /dev/null +++ b/backend/BPA.MES.Base.Application/Services/MaterialService/Services/MaterialsInfoService.cs @@ -0,0 +1,115 @@ +namespace BPA.MES.Base.Application.Entitys +{ + /// + /// 名 称 :物料服务 + /// 创 建 人 :yangxiao + /// 创建时间 :2023/3/2 16:11:04 + /// 描 述 :店铺数据维护 + /// + [ApiDescriptionSettings(Name = "MaterialsInfo", KeepName = true, SplitCamelCase = true, KeepVerb = true)] + public class MaterialsInfoService : IMaterialsInfoService, ITransient, IDynamicApiController + { + private readonly ISqlSugarClient _dbContext; + public MaterialsInfoService(ISqlSugarClient db) + { + _dbContext = db; + } + /// + /// 增加 + /// + /// + /// + [HttpPost] + public async Task Add(MaterialsInfoAddInput input) + { + var r_entity = await _dbContext.Queryable().FirstAsync(x => x.Name == input.Name); + if (r_entity != null) + { + throw Oops.Bah("名称已存在!"); + } + MaterialsInfoEntity entity = input.Adapt(); + return await _dbContext.Insertable(entity).IgnoreColumns(ignoreNullColumn: true).ExecuteCommandIdentityIntoEntityAsync(); + } + /// + /// 删除 + /// + /// + /// + /// + [HttpPost] + public async Task Del(MaterialsInfoDelInput input) + { + var res = await _dbContext.Deleteable().Where(x => x.Id == input.Id).ExecuteCommandHasChangeAsync(); + return res; + } + /// + /// 详情 + /// + /// + /// + /// + [HttpGet] + public async Task Detail(string Id) + { + var entity = await _dbContext.Queryable().FirstAsync(x => x.Id == Id); + MaterialsInfoOutput output = entity.Adapt(); + return output; + } + /// + /// 列表 + /// + /// + /// + [HttpGet] + public async Task> List() + { + var entity = await _dbContext.Queryable().ToListAsync(); + List output = entity.Adapt>(); + return output; + } + /// + /// 分页 + /// + /// + /// + [HttpPost] + public async Task> PagedList(MaterialsInfoQueryPageInput input) + { + var entity = await _dbContext.Queryable() + .WhereIF(!string.IsNullOrEmpty(input.Name),x=>x.Name.Contains(input.Name)) + .WhereIF(!string.IsNullOrEmpty(input.Code), x => x.Code.Contains(input.Code)) + .ToPagedListAsync(input.PageIndex, input.PageSize); + SqlSugarPagedList output = entity.Adapt>(); + return output; + } + /// + /// 下拉 + /// + /// + /// + [HttpGet] + public async Task SelectList() + { + var entity = await _dbContext.Queryable().Select(x => new + { + key = x.Id, + value = x.Name + }).ToListAsync(); + return entity; + } + /// + /// 更新 + /// + /// + /// + /// + [HttpPost] + public async Task Update(MaterialsInfoUpdateInput input) + { + var entity = await _dbContext.Queryable().Where(x => x.Id == input.Id).FirstAsync(); + entity = input.Adapt(); + var res = await _dbContext.Updateable(entity).ExecuteCommandHasChangeAsync(); + return res; + } + } +} diff --git a/backend/BPA.MES.Base.Application/Services/RecipesService/Dtos/GroupInfoDto.cs b/backend/BPA.MES.Base.Application/Services/RecipesService/Dtos/GroupInfoDto.cs new file mode 100644 index 0000000..0c0d230 --- /dev/null +++ b/backend/BPA.MES.Base.Application/Services/RecipesService/Dtos/GroupInfoDto.cs @@ -0,0 +1,54 @@ +namespace BPA.MES.Base.Application.Entitys +{ + /// + /// 名 称 :产品分组 + /// 创 建 人 :yangxiao + /// 创建时间 : 2023/3/10 13:59:43 + /// 描 述 : + /// + public class GroupInfoDto : GroupInfoEntity + { + + } + /// + /// 增加 + /// + public class GroupInfoAddInput : GroupInfoDto + { + + } + /// + /// 更新 + /// + public class GroupInfoUpdateInput : GroupInfoDto + { + + } + /// + /// 删除 + /// + public class GroupInfoDelInput + { + /// + /// 主键 + /// + public string Id { get; set; } + } + /// + /// 分页 + /// + public class GroupInfoQueryPageInput : RequestPage + { + /// + /// 名称 + /// + public string Name { get; set; } + } + /// + /// 输出 + /// + public class GroupInfoOutput : GroupInfoDto + { + + } +} diff --git a/backend/BPA.MES.Base.Application/Services/RecipesService/Dtos/RecipeMaterialDto.cs b/backend/BPA.MES.Base.Application/Services/RecipesService/Dtos/RecipeMaterialDto.cs new file mode 100644 index 0000000..78d2c65 --- /dev/null +++ b/backend/BPA.MES.Base.Application/Services/RecipesService/Dtos/RecipeMaterialDto.cs @@ -0,0 +1,91 @@ +namespace BPA.MES.Base.Application.Entitys +{ + /// + /// 名 称 :配方物料Dto类 + /// 创 建 人 :yangxiao + /// 创建时间 :2023/3/2 16:12:06 + /// 描 述 : + /// + public class RecipeMaterialDto : RecipeMaterialEntity + { + + } + /// + /// 增加 + /// + public class RecipeMaterialAddInput + { + /// + /// 物料Id + /// + public string MaterialId { get; set; } + /// + /// 配方Id + /// + public string RecipesId { get; set; } + /// + /// 通道 + /// + public string Outlet { get; set; } + /// + /// 顺序 + /// + public string Sort { get; set; } + /// + /// 时间(s) + /// + public string Time { get; set; } + } + /// + /// 更新 + /// + public class RecipeMaterialUpdateInput : RecipeMaterialDto + { + + } + /// + /// 删除 + /// + public class RecipeMaterialDelInput + { + /// + /// 主键 + /// + public string Id { get; set; } + } + /// + /// 不分页 + /// + public class RecipeMaterialQueryInput + { + /// + /// 配方Id + /// + public string RecipesId { get; set; } + } + /// + /// 分页 + /// + public class RecipeMaterialQueryPageInput : RequestPage + { + + } + /// + /// 输出 + /// + public class RecipeMaterialOutput : RecipeMaterialDto + { + /// + /// 配方名称 + /// + public string RecipesName { get; set; } + /// + /// 物料名称 + /// + public string MaterialName { get; set; } + /// + /// 物料编码 + /// + public string MaterialCode { get; set; } + } +} diff --git a/backend/BPA.MES.Base.Application/Services/RecipesService/Dtos/RecipesInfoDto.cs b/backend/BPA.MES.Base.Application/Services/RecipesService/Dtos/RecipesInfoDto.cs new file mode 100644 index 0000000..f952324 --- /dev/null +++ b/backend/BPA.MES.Base.Application/Services/RecipesService/Dtos/RecipesInfoDto.cs @@ -0,0 +1,66 @@ +namespace BPA.MES.Base.Application.Entitys +{ + /// + /// 名 称 :配方Dto类 + /// 创 建 人 :yangxiao + /// 创建时间 :2023/3/2 16:12:06 + /// 描 述 : + /// + public class RecipesInfoDto : RecipesInfoEntity + { + + } + /// + /// 增加 + /// + public class RecipesInfoAddInput : RecipesInfoDto + { + + } + /// + /// 更新 + /// + public class RecipesInfoUpdateInput : RecipesInfoDto + { + + } + /// + /// 删除 + /// + public class RecipesInfoDelInput + { + /// + /// 主键 + /// + public string Id { get; set; } + } + /// + /// 分页 + /// + public class RecipesInfoQueryPageInput : RequestPage + { + /// + /// 名称 + /// + public string Name { get; set; } + /// + /// 分组id + /// + public string GroupId { get; set; } + } + /// + /// 输出 + /// + public class RecipesInfoOutput : RecipesInfoDto + { + /// + /// 分组Id + /// + public string GroupId { get; set; } + } + + public class RecipesGroupInput : RecipesGroupEntity + { + + } +} diff --git a/backend/BPA.MES.Base.Application/Services/RecipesService/Services/GroupInfoService.cs b/backend/BPA.MES.Base.Application/Services/RecipesService/Services/GroupInfoService.cs new file mode 100644 index 0000000..c7b1a8a --- /dev/null +++ b/backend/BPA.MES.Base.Application/Services/RecipesService/Services/GroupInfoService.cs @@ -0,0 +1,97 @@ +namespace BPA.MES.Base.Application.Entitys +{ + /// + /// 名 称 :分组信息 + /// 创 建 人 :yangxiao + /// 创建时间 : 2023/3/10 14:03:06 + /// 描 述 : + /// + [ApiDescriptionSettings(Name = "GroupInfo", KeepName = true, SplitCamelCase = true, KeepVerb = true)] + public class GroupInfoService : IGroupInfoService, ITransient, IDynamicApiController + { + private readonly ISqlSugarClient _dbContext; + public GroupInfoService(ISqlSugarClient db) + { + _dbContext = db; + } + /// + /// 增加 + /// + /// + /// + [HttpPost] + public async Task Add(GroupInfoAddInput input) + { + GroupInfoEntity entity = input.Adapt(); + return await _dbContext.Insertable(entity).IgnoreColumns(ignoreNullColumn: true).ExecuteCommandIdentityIntoEntityAsync(); + } + /// + /// 删除 + /// + /// + /// + /// + [HttpPost] + public async Task Del(GroupInfoDelInput input) + { + var res = await _dbContext.Deleteable().Where(x=>x.Id==input.Id).ExecuteCommandHasChangeAsync(); + return res; + } + /// + /// 详情 + /// + /// + /// + /// + [HttpGet] + public async Task Detail(string Id) + { + var entity = await _dbContext.Queryable().FirstAsync(); + GroupInfoOutput output = entity.Adapt(); + return output; + } + /// + /// 列表 + /// + /// + /// + [HttpPost, AllowAnonymous] + public async Task> List() + { + var entity = await _dbContext.Queryable().ToListAsync(); + List output = entity.Adapt>(); + return output; + } + /// + /// 分页 + /// + /// + /// + [HttpPost] + public async Task> PagedList(GroupInfoQueryPageInput input) + { + var entity = await _dbContext.Queryable() + .ToPagedListAsync(input.PageIndex, input.PageSize); + SqlSugarPagedList output = entity.Adapt>(); + return output; + } + /// + /// 更新 + /// + /// + /// + /// + [HttpPost] + public async Task Update(GroupInfoUpdateInput input) + { + var entity = await _dbContext.Queryable().FirstAsync(x=>x.Id==input.Id); + if (entity == null) + { + throw Oops.Bah("数据不存在!"); + } + entity = input.Adapt(); + var res = await _dbContext.Updateable(entity).ExecuteCommandHasChangeAsync(); + return res; + } + } +} diff --git a/backend/BPA.MES.Base.Application/Services/RecipesService/Services/IGroupInfoService.cs b/backend/BPA.MES.Base.Application/Services/RecipesService/Services/IGroupInfoService.cs new file mode 100644 index 0000000..4db6760 --- /dev/null +++ b/backend/BPA.MES.Base.Application/Services/RecipesService/Services/IGroupInfoService.cs @@ -0,0 +1,43 @@ +namespace BPA.MES.Base.Application.Entitys +{ + /// + /// 名 称 :分组信息 + /// 创 建 人 :yangxiao + /// 创建时间 :2023/3/10 14:03:21 + /// 描 述 : + /// + public interface IGroupInfoService + { + /// + /// 增加 + /// + /// + Task Add(GroupInfoAddInput input); + /// + /// 移除 + /// + /// + Task Del(GroupInfoDelInput input); + /// + /// 更新 + /// + /// + Task Update(GroupInfoUpdateInput input); + /// + /// 不分页列表 + /// + /// + Task> List(); + /// + /// 分页列表 + /// + /// + Task> PagedList(GroupInfoQueryPageInput input); + /// + /// 查询单条 + /// + /// + /// + Task Detail(string Id); + } +} diff --git a/backend/BPA.MES.Base.Application/Services/RecipesService/Services/IRecipeMaterialService.cs b/backend/BPA.MES.Base.Application/Services/RecipesService/Services/IRecipeMaterialService.cs new file mode 100644 index 0000000..b5f6c3d --- /dev/null +++ b/backend/BPA.MES.Base.Application/Services/RecipesService/Services/IRecipeMaterialService.cs @@ -0,0 +1,49 @@ +namespace BPA.MES.Base.Application.Entitys +{ + /// + /// 名 称 :配方物料服务 + /// 创 建 人 :yangxiao + /// 创建时间 :2023/3/2 18:33:18 + /// 描 述 : + /// + public interface IRecipeMaterialService + { + /// + /// 增加 + /// + /// + Task Add(RecipeMaterialAddInput input); + /// + /// 批量增加 + /// + /// + /// + Task BatchAdd(List inputs); + /// + /// 移除 + /// + /// + Task Del(RecipeMaterialDelInput input); + /// + /// 更新 + /// + /// + Task Update(RecipeMaterialUpdateInput input); + /// + /// 不分页列表 + /// + /// + Task> List(RecipeMaterialQueryInput input); + /// + /// 分页列表 + /// + /// + Task> PagedList(RecipeMaterialQueryPageInput input); + /// + /// 查询单条 + /// + /// + /// + Task Detail(string Id); + } +} diff --git a/backend/BPA.MES.Base.Application/Services/RecipesService/Services/IRecipesInfoService.cs b/backend/BPA.MES.Base.Application/Services/RecipesService/Services/IRecipesInfoService.cs new file mode 100644 index 0000000..bb6bf5c --- /dev/null +++ b/backend/BPA.MES.Base.Application/Services/RecipesService/Services/IRecipesInfoService.cs @@ -0,0 +1,54 @@ +namespace BPA.MES.Base.Application.Entitys +{ + /// + /// 名 称 :配方服务 + /// 创 建 人 :yangxiao + /// 创建时间 :2023/3/2 18:33:18 + /// 描 述 : + /// + public interface IRecipesInfoService + { + /// + /// 增加 + /// + /// + Task Add(RecipesInfoAddInput input); + /// + /// 移除 + /// + /// + Task Del(RecipesInfoDelInput input); + /// + /// 更新 + /// + /// + Task Update(RecipesInfoUpdateInput input); + /// + /// 不分页列表 + /// + /// + Task> List(); + /// + /// 分页列表 + /// + /// + Task> PagedList(RecipesInfoQueryPageInput input); + /// + /// 下拉列表 + /// + /// + Task SelectList(); + /// + /// 查询单条 + /// + /// + /// + Task Detail(string Id); + /// + /// 更改物料分组 + /// + /// + /// + Task ChangeGroup(RecipesGroupInput input); + } +} diff --git a/backend/BPA.MES.Base.Application/Services/RecipesService/Services/RecipeMaterialService.cs b/backend/BPA.MES.Base.Application/Services/RecipesService/Services/RecipeMaterialService.cs new file mode 100644 index 0000000..58e69be --- /dev/null +++ b/backend/BPA.MES.Base.Application/Services/RecipesService/Services/RecipeMaterialService.cs @@ -0,0 +1,131 @@ +namespace BPA.MES.Base.Application.Entitys +{ + /// + /// 名 称 :配方物料服务 + /// 创 建 人 :yangxiao + /// 创建时间 :2023/3/2 16:11:04 + /// 描 述 :配方物料数据维护 + /// + [ApiDescriptionSettings(Name = "RecipeMaterial", KeepName = true, SplitCamelCase = true, KeepVerb = true)] + public class RecipeMaterialService : IRecipeMaterialService, ITransient, IDynamicApiController + { + private readonly ISqlSugarClient _dbContext; + public RecipeMaterialService(ISqlSugarClient db) + { + _dbContext = db; + } + /// + /// 增加 + /// + /// + /// + [HttpPost] + public async Task Add(RecipeMaterialAddInput input) + { + RecipeMaterialEntity entity = input.Adapt(); + return await _dbContext.Insertable(entity).IgnoreColumns(ignoreNullColumn: true).ExecuteCommandIdentityIntoEntityAsync(); + } + /// + /// 批量增加 + /// + /// + /// + /// + public async Task BatchAdd(List inputs) + { + bool result = false; + List entitys = inputs.Adapt>(); + try + { + _dbContext.Ado.BeginTran(); + await _dbContext.Deleteable().Where(x => x.RecipesId == inputs[0].RecipesId).ExecuteCommandAsync(); + await _dbContext.Insertable(entitys).ExecuteCommandAsync(); + _dbContext.Ado.CommitTran(); + result = true; + } + catch (Exception ex) + { + _dbContext.Ado.RollbackTran(); + throw Oops.Bah("保存失败!"); + } + return result; + } + + /// + /// 删除 + /// + /// + /// + /// + [HttpPost] + public async Task Del(RecipeMaterialDelInput input) + { + var res = await _dbContext.Deleteable().Where(x => x.Id == input.Id).ExecuteCommandHasChangeAsync(); + return res; + } + /// + /// 详情 + /// + /// + /// + /// + [HttpGet] + public async Task Detail(string Id) + { + var entity = await _dbContext.Queryable().FirstAsync(x => x.Id == Id); + RecipeMaterialOutput output = entity.Adapt(); + return output; + } + /// + /// 列表 + /// + /// + /// + [HttpPost,AllowAnonymous] + public async Task> List(RecipeMaterialQueryInput input) + { + var output = await _dbContext.Queryable() + .LeftJoin((a,b)=>a.RecipesId==b.Id) + .LeftJoin((a,b,c)=>a.MaterialId==c.Id) + .WhereIF(!string.IsNullOrEmpty(input.RecipesId),(a,b,c)=>a.RecipesId==input.RecipesId) + .Select((a,b,c)=>new RecipeMaterialOutput + { + MaterialName = c.Name, + MaterialCode = c.Code, + MaterialId = c.Id, + RecipesId = a.RecipesId, + RecipesName = b.Name, + Sort = a.Sort, + Time = a.Time, + Outlet = a.Outlet + }) + .ToListAsync(); + return output; + } + /// + /// 分页 + /// + /// + /// + [HttpPost] + public async Task> PagedList(RecipeMaterialQueryPageInput input) + { + var entity = await _dbContext.Queryable() + .ToPagedListAsync(input.PageIndex, input.PageSize); + SqlSugarPagedList output = entity.Adapt>(); + return output; + } + /// + /// 更新 + /// + /// + /// + /// + [HttpPost] + public async Task Update(RecipeMaterialUpdateInput input) + { + var res = await _dbContext.Updateable().ExecuteCommandHasChangeAsync(); + return res; + } + } +} diff --git a/backend/BPA.MES.Base.Application/Services/RecipesService/Services/RecipesInfoService.cs b/backend/BPA.MES.Base.Application/Services/RecipesService/Services/RecipesInfoService.cs new file mode 100644 index 0000000..5cae33a --- /dev/null +++ b/backend/BPA.MES.Base.Application/Services/RecipesService/Services/RecipesInfoService.cs @@ -0,0 +1,132 @@ +namespace BPA.MES.Base.Application.Entitys +{ + /// + /// 名 称 :物料服务 + /// 创 建 人 :yangxiao + /// 创建时间 :2023/3/2 16:11:04 + /// 描 述 :店铺数据维护 + /// + [ApiDescriptionSettings(Name = "RecipesInfo", KeepName = true, SplitCamelCase = true, KeepVerb = true)] + public class RecipesInfoService : IRecipesInfoService, ITransient, IDynamicApiController + { + private readonly ISqlSugarClient _dbContext; + public RecipesInfoService(ISqlSugarClient db) + { + _dbContext = db; + } + /// + /// 增加 + /// + /// + /// + [HttpPost] + public async Task Add(RecipesInfoAddInput input) + { + var r_entity = await _dbContext.Queryable().FirstAsync(x => x.Name == input.Name); + if (r_entity != null) + { + throw Oops.Bah("名称已存在!"); + } + RecipesInfoEntity entity = input.Adapt(); + return await _dbContext.Insertable(entity).IgnoreColumns(ignoreNullColumn: true).ExecuteCommandIdentityIntoEntityAsync(); + } + /// + /// 删除 + /// + /// + /// + /// + [HttpPost] + public async Task Del(RecipesInfoDelInput input) + { + var res = await _dbContext.Deleteable().Where(x => x.Id == input.Id).ExecuteCommandHasChangeAsync(); + return res; + } + /// + /// 详情 + /// + /// + /// + /// + [HttpGet] + public async Task Detail(string Id) + { + var entity = await _dbContext.Queryable().FirstAsync(x => x.Id == Id); + RecipesInfoOutput output = entity.Adapt(); + return output; + } + /// + /// 列表 + /// + /// + /// + [HttpGet] + public async Task> List() + { + var entity = await _dbContext.Queryable().ToListAsync(); + List output = entity.Adapt>(); + return output; + } + /// + /// 分页 + /// + /// + /// + [HttpPost] + public async Task> PagedList(RecipesInfoQueryPageInput input) + { + var entity = await _dbContext.Queryable() + .LeftJoin((a,b)=>a.Id==b.RecipesId) + .WhereIF(!string.IsNullOrEmpty(input.Name), (a, b) => a.Name.Contains(input.Name)) + .WhereIF(!string.IsNullOrEmpty(input.GroupId), (a, b) => b.GroupId==input.GroupId) + .Select() + .ToPagedListAsync(input.PageIndex, input.PageSize); + SqlSugarPagedList output = entity.Adapt>(); + return output; + } + /// + /// 下拉 + /// + /// + /// + [HttpGet] + public async Task SelectList() + { + var entity = await _dbContext.Queryable().Select(x => new + { + key = x.Id, + value = x.Name + }).ToListAsync(); + return entity; + } + /// + /// 更新 + /// + /// + /// + /// + [HttpPost] + public async Task Update(RecipesInfoUpdateInput input) + { + var entity = await _dbContext.Queryable().Where(x => x.Id == input.Id).FirstAsync(); + entity = input.Adapt(); + var res = await _dbContext.Updateable(entity).ExecuteCommandHasChangeAsync(); + return res; + } + [HttpPost] + public async Task ChangeGroup(RecipesGroupInput input) + { + var isExit = await _dbContext.Queryable().FirstAsync(x=>x.RecipesId==input.RecipesId); + var entity = input.Adapt(); + if (isExit==null) + { + return await _dbContext.Insertable(entity).ExecuteCommandIdentityIntoEntityAsync(); + } + else + { + return await _dbContext.Updateable(entity).Where(x => x.RecipesId == input.RecipesId).ExecuteCommandHasChangeAsync(); + } + + } + } +} diff --git a/backend/BPA.MES.Base.Application/Services/SystemService/Dtos/AccountInput.cs b/backend/BPA.MES.Base.Application/Services/SystemService/Dtos/AccountInput.cs new file mode 100644 index 0000000..60aebc1 --- /dev/null +++ b/backend/BPA.MES.Base.Application/Services/SystemService/Dtos/AccountInput.cs @@ -0,0 +1,94 @@ +/// +/// 名 称 :[账号信息]实体基础 +/// 创 建 人 :yangxiao +/// 创建时间 : 2023/1/3 10:21:42 +/// 描 述 : +/// +namespace BPA.MES.Base.Application +{ + /// + /// [账号信息]入参基础 + /// + public class AccountInput + { + /// + /// 账号 + /// + /// admin + public string Account { get; set; } + /// + /// 密码 + /// + /// e10adc3949ba59abbe56e057f20f883e + public string Pwd { get; set; } + + } + /// + /// [账号信息]添加入参 + /// + public class AccountAddInput : AccountInput + { + /// + /// 员工编号 + /// + public string TB_Employee_Id { get; set; } + } + /// + /// [账号信息]修改入参 + /// + public class AccountUpdateInput : AccountInput + { + /// + /// 主键 + /// + public string? Id { get; set; } + /// + /// 员工编号 + /// + public string TB_Employee_Id { get; set; } + } + /// + /// [账号信息]修改密码 + /// + public class AccountUpdatePwdInput: AccountInput + { + /// + /// 新密码 + /// + public string NewPwd { get; set; } + } + /// + /// [账号信息]删除入参 + /// + public class AccountDelInput + { + /// + /// 主键 + /// + public string? Id { get; set; } + } + /// + /// [账号信息]普通查询入参 + /// + public class AccountQueryInput + { + /// + /// 主键 + /// + public string? Id { get; set; } + } + /// + /// [账号信息]分页查询入参 + /// + public class AccountQueryPageInput : RequestPage + { + /// + /// 主键 + /// + public string? Id { get; set; } + /// + /// 设备名称 + /// + public string Name { get; set; } + } +} diff --git a/backend/BPA.MES.Base.Application/Services/SystemService/Dtos/AccountOutput.cs b/backend/BPA.MES.Base.Application/Services/SystemService/Dtos/AccountOutput.cs new file mode 100644 index 0000000..ea06298 --- /dev/null +++ b/backend/BPA.MES.Base.Application/Services/SystemService/Dtos/AccountOutput.cs @@ -0,0 +1,29 @@ +namespace BPA.MES.Base.Application +{ + /// + /// 名 称 :[账号信息]输出实体 + /// 创 建 人 :yangxiao + /// 创建时间 : 2023/1/3 10:22:37 + /// 描 述 : + /// + public class AccountOutput + { + /// + /// 主键 + /// + public string Id { get;set; } + /// + /// 账号 + /// + public string Account { get; set; } + /// + /// 密码 + /// + public string Pwd { get; set; } + /// + /// 员工id + /// + public string TB_Employee_Id { get; set; } + + } +} diff --git a/backend/BPA.MES.Base.Application/Services/SystemService/Dtos/AuthorModuleInput.cs b/backend/BPA.MES.Base.Application/Services/SystemService/Dtos/AuthorModuleInput.cs new file mode 100644 index 0000000..2584501 --- /dev/null +++ b/backend/BPA.MES.Base.Application/Services/SystemService/Dtos/AuthorModuleInput.cs @@ -0,0 +1,134 @@ +/// +/// 名 称 :[授权模块]实体基础 +/// 创 建 人 :yangxiao +/// 创建时间 : 2023/1/3 10:21:42 +/// 描 述 +/// +namespace BPA.MES.Base.Application +{ + /// + /// [授权模块]入参基础 + /// + public class AuthorModuleInput + { + /// + /// 子级列表 + /// + public List? Childrens { get; set; } + /// + /// 拥有权限 + /// + public bool HasPermission { get; set; } + /// + /// 模块编号 + /// + public string Id { get; set; } + + /// + /// 类别 1:菜单,2:视图,3:功能 + /// + public int Category { get; set; } + + /// + /// 菜单打开方式 0:框架内嵌,1:新开页面 + /// + public int OpenType { get; set; } + + /// + /// 父级编号 + /// + public string ParentId { get; set; } + + /// + /// 名称 + /// + public string Name { set; get; } + + /// + /// 图标 + /// + public string Icon { set; get; } + + /// + /// 地址 + /// + public string Url { set; get; } + /// + /// 排序码 + /// + public int Sort { set; get; } + /// + /// 启用禁用 + /// + public bool IsDisabled { get; set; } + + /// + /// 子集 + /// + public List? Children { get; set; } + } + /// + /// [授权模块]添加入参 + /// + public class AuthorModuleAddInput : AuthorModuleInput + { + + } + + /// + /// [授权模块]批量授权信息 + /// + public class AuthorModulesAddInput + { + /// + /// 模板名称 + /// + public string TemplateName { set; get; } + + /// + /// 授权模块 + /// + public List ModuleIds { get; set; } + } + + /// + /// [授权模块]修改入参 + /// + public class AuthorModuleUpdateInput : AuthorModuleInput + { + /// + /// 主键 + /// + public string? Id { get; set; } + } + /// + /// [授权模块]删除入参 + /// + public class AuthorModuleDelInput + { + /// + /// 主键 + /// + public string? Id { get; set; } + } + /// + /// [授权模块]普通查询入参 + /// + public class AuthorModuleQueryInput + { + /// + /// 主键 + /// + public string? Id { get; set; } + } + /// + /// [授权模块]分页查询入参 + /// + public class AuthorModuleQueryPageInput : RequestPage + { + /// + /// 主键 + /// + public string? Id { get; set; } + } +} \ No newline at end of file diff --git a/backend/BPA.MES.Base.Application/Services/SystemService/Dtos/AuthorModuleItemInput.cs b/backend/BPA.MES.Base.Application/Services/SystemService/Dtos/AuthorModuleItemInput.cs new file mode 100644 index 0000000..0efce1f --- /dev/null +++ b/backend/BPA.MES.Base.Application/Services/SystemService/Dtos/AuthorModuleItemInput.cs @@ -0,0 +1,70 @@ +/// +/// 名 称 :[账号信息]实体基础 +/// 创 建 人 :yangxiao +/// 创建时间 : 2023/1/3 10:21:42 +/// 描 述 +/// +namespace BPA.MES.Base.Application +{ + /// + /// [账号信息]入参基础 + /// + public class AuthorModuleItemInput + { + /// + /// 模板Id + /// + public string TB_TemplateId { get; set; } + /// + /// 模块Id + /// + public List TB_ModuleIds { get; set; } + } + /// + /// [账号信息]添加入参 + /// + public class AuthorModuleItemAddInput : AuthorModuleItemInput + { + + } + /// + /// [账号信息]修改入参 + /// + public class AuthorModuleItemUpdateInput : AuthorModuleItemInput + { + /// + /// 主键 + /// + public string? Id { get; set; } + } + /// + /// [账号信息]删除入参 + /// + public class AuthorModuleItemDelInput + { + /// + /// 主键 + /// + public string? Id { get; set; } + } + /// + /// [账号信息]普通查询入参 + /// + public class AuthorModuleItemQueryInput + { + /// + /// 主键 + /// + public string? Id { get; set; } + } + /// + /// [账号信息]分页查询入参 + /// + public class AuthorModuleItemQueryPageInput : RequestPage + { + /// + /// 主键 + /// + public string? Id { get; set; } + } +} \ No newline at end of file diff --git a/backend/BPA.MES.Base.Application/Services/SystemService/Dtos/AuthorModuleItemOutput.cs b/backend/BPA.MES.Base.Application/Services/SystemService/Dtos/AuthorModuleItemOutput.cs new file mode 100644 index 0000000..8334c97 --- /dev/null +++ b/backend/BPA.MES.Base.Application/Services/SystemService/Dtos/AuthorModuleItemOutput.cs @@ -0,0 +1,12 @@ +namespace BPA.MES.Base.Application +{ + /// + /// 名 称 : + /// 创 建 人 :yangxiao + /// 创建时间 : 2023/1/4 17:20:51 + /// 描 述 : + /// + public class AuthorModuleItemOutput + { + } +} diff --git a/backend/BPA.MES.Base.Application/Services/SystemService/Dtos/AuthorModuleOutput.cs b/backend/BPA.MES.Base.Application/Services/SystemService/Dtos/AuthorModuleOutput.cs new file mode 100644 index 0000000..2836c5e --- /dev/null +++ b/backend/BPA.MES.Base.Application/Services/SystemService/Dtos/AuthorModuleOutput.cs @@ -0,0 +1,68 @@ +namespace BPA.MES.Base.Application +{ + /// + /// 名 称 :授权模块输出 + /// 创 建 人 :yangxiao + /// 创建时间 : 2023/1/4 17:18:24 + /// 描 述 : + /// + public class AuthorModuleOutput + { + /// + /// 子级列表 + /// + public List? Childrens { get; set; } + /// + /// 拥有权限 + /// + public bool HasPermission { get; set; } + /// + /// 模块编号 + /// + public string Id { get; set; } + + /// + /// 类别 1:菜单,2:视图,3:功能 + /// + public int Category { get; set; } + + /// + /// 菜单打开方式 0:框架内嵌,1:新开页面 + /// + public int OpenType { get; set; } + + /// + /// 父级编号 + /// + public string ParentId { get; set; } + + /// + /// 名称 + /// + public string Name { set; get; } + + /// + /// 图标 + /// + public string Icon { set; get; } + + /// + /// 地址 + /// + public string Url { set; get; } + /// + /// 排序码 + /// + public int Sort { set; get; } + /// + /// 启用禁用 + /// + public bool IsDisabled { get; set; } + + /// + /// 子集 + /// + public List? Children { get; set; } + } + +} diff --git a/backend/BPA.MES.Base.Application/Services/SystemService/Dtos/AuthorizeInput.cs b/backend/BPA.MES.Base.Application/Services/SystemService/Dtos/AuthorizeInput.cs new file mode 100644 index 0000000..4562531 --- /dev/null +++ b/backend/BPA.MES.Base.Application/Services/SystemService/Dtos/AuthorizeInput.cs @@ -0,0 +1,97 @@ +/// +/// 名 称 :[授权信息]实体基础 +/// 创 建 人 :yangxiao +/// 创建时间 : 2023/1/3 10:21:42 +/// 描 述 +/// +namespace BPA.MES.Base.Application +{ + /// + /// [授权信息]入参基础 + /// + public class AuthorizeInput + { + /// + /// 关键字 + /// + public string Keyword { get; set; } + /// + /// 模板Id + /// + public string TemplateId { get; set; } + /// + /// 授权类型 1:用户,2:角色 + /// + public int Type { get; set; } + /// + /// 授权对象 + /// + public List? ObjectIds { get; set; } + } + /// + /// [授权信息]添加入参 + /// + public class AuthorizeAddInput : AuthorizeInput + { + + } + /// + /// [授权信息]角色授权入参 + /// + public class AuthorMapAddInput + { + /// + /// 模板编号 + /// + public List TemplateIds { get; set; } + /// + /// 授权类型 1用户 2角色 + /// + + public int AuthorizeType { get; set; } + /// + /// 授权对象 + /// + public string ObjectId { get; set; } + } + /// + /// [授权信息]修改入参 + /// + public class AuthorizeUpdateInput : AuthorizeInput + { + /// + /// 主键 + /// + public string? Id { get; set; } + } + /// + /// [授权信息]删除入参 + /// + public class AuthorizeDelInput + { + /// + /// 主键 + /// + public string? Id { get; set; } + } + /// + /// [授权信息]普通查询入参 + /// + public class AuthorizeQueryInput + { + /// + /// 主键 + /// + public string? Id { get; set; } + } + /// + /// [授权信息]分页查询入参 + /// + public class AuthorizeQueryPageInput : RequestPage + { + /// + /// 主键 + /// + public string? Id { get; set; } + } +} \ No newline at end of file diff --git a/backend/BPA.MES.Base.Application/Services/SystemService/Dtos/AuthorizeOutput.cs b/backend/BPA.MES.Base.Application/Services/SystemService/Dtos/AuthorizeOutput.cs new file mode 100644 index 0000000..7ef3dc9 --- /dev/null +++ b/backend/BPA.MES.Base.Application/Services/SystemService/Dtos/AuthorizeOutput.cs @@ -0,0 +1,27 @@ +namespace BPA.MES.Base.Application +{ + /// + /// 名 称 :授权信息输出 + /// 创 建 人 :yangxiao + /// 创建时间 : 2023/1/4 17:24:21 + /// 描 述 : + /// + public class AuthorizeOutput + { + /// + /// 编号 + /// + public string Id { get; set; } + + /// + /// 名称 + /// + public string Name { get; set; } + + /// + /// 已授权 + /// + public bool IsAuthorized { get; set; } + } + +} diff --git a/backend/BPA.MES.Base.Application/Services/SystemService/Dtos/AuthorizeTemplateInput.cs b/backend/BPA.MES.Base.Application/Services/SystemService/Dtos/AuthorizeTemplateInput.cs new file mode 100644 index 0000000..8f6111d --- /dev/null +++ b/backend/BPA.MES.Base.Application/Services/SystemService/Dtos/AuthorizeTemplateInput.cs @@ -0,0 +1,74 @@ +/// +/// 名 称 :[授权模块]实体基础 +/// 创 建 人 :yangxiao +/// 创建时间 : 2023/1/3 10:21:42 +/// 描 述 +/// +namespace BPA.MES.Base.Application +{ + /// + /// [授权模块]入参基础 + /// + public class AuthorizeTemplateInput + { + /// + /// 名称 + /// + public string Name { get; set; } + /// + /// 描述 + /// + public string Remark { get; set; } + } + /// + /// [授权模块]添加入参 + /// + public class AuthorizeTemplateAddInput : AuthorizeTemplateInput + { + + } + /// + /// [授权模块]修改入参 + /// + public class AuthorizeTemplateUpdateInput : AuthorizeTemplateInput + { + /// + /// 主键 + /// + public string? Id { get; set; } + } + /// + /// [授权模块]删除入参 + /// + public class AuthorizeTemplateDelInput + { + /// + /// 主键 + /// + public string? Id { get; set; } + } + /// + /// [授权模块]普通查询入参 + /// + public class AuthorizeTemplateQueryInput + { + /// + /// 主键 + /// + public string? Id { get; set; } + } + /// + /// [授权模块]分页查询入参 + /// + public class AuthorizeTemplateQueryPageInput : RequestPage + { + /// + /// 主键 + /// + public string? Id { get; set; } + /// + /// 关键字 + /// + public string Keyword { get; set; } + } +} \ No newline at end of file diff --git a/backend/BPA.MES.Base.Application/Services/SystemService/Dtos/AuthorizeTemplateOutput.cs b/backend/BPA.MES.Base.Application/Services/SystemService/Dtos/AuthorizeTemplateOutput.cs new file mode 100644 index 0000000..17e228d --- /dev/null +++ b/backend/BPA.MES.Base.Application/Services/SystemService/Dtos/AuthorizeTemplateOutput.cs @@ -0,0 +1,24 @@ +namespace BPA.MES.Base.Application +{ + /// + /// Ȩģ + /// yangxiao + /// ʱ 2023/1/4 9:48:24 + /// + /// + public class AuthorizeTemplateOutput + { + /// + /// + /// + public string Id { get; set; } + /// + /// + /// + public string Name { get; set; } + /// + /// + /// + public string Remark { get; set; } + } +} diff --git a/backend/BPA.MES.Base.Application/Services/SystemService/Dtos/EmployeeInput.cs b/backend/BPA.MES.Base.Application/Services/SystemService/Dtos/EmployeeInput.cs new file mode 100644 index 0000000..c665bbc --- /dev/null +++ b/backend/BPA.MES.Base.Application/Services/SystemService/Dtos/EmployeeInput.cs @@ -0,0 +1,141 @@ +namespace BPA.MES.Base.Application +{ + /// + /// 名 称 : + /// 创 建 人 :yangxiao + /// 创建时间 : 2023/1/5 15:15:50 + /// 描 述 : + /// + public class EmployeeInput + { + /// + /// 主键 + /// + public string Id { get; set; } + /// + /// 排序 + /// + public int Sort { get; set; } + /// + /// 员工姓名 + /// + + public string Name { get; set; } + /// + /// 1男2女 + /// + + public int Gender { get; set; } + /// + /// 手机号 + /// + + public string Phone { get; set; } + /// + /// 员工IC卡 + /// + + public string ICCard { get; set; } + /// + /// 头像 + /// + + public string Header { get; set; } + /// + /// 入职时间 + /// + + public DateTime JoinDate { get; set; } + + /// + /// 离职时间 + /// + public DateTime? OutDate { get; set; } + /// + /// 身份证 + /// + + public string IdCard { get; set; } + /// + /// 1在职2出差3离职 + /// + + public int Stutas { get; set; } + /// + /// 角色Id + /// + public string TB_RoleId { get; set; } + /// + /// 是否存在账号 + /// + public bool IsAccount { get; set; } + /// + /// 账号 + /// + public string Account { get; set; } + } + + /// + /// [授权信息]添加入参 + /// + public class EmployeeAddInput : EmployeeInput + { + + } + /// + /// [授权信息]修改入参 + /// + public class EmployeeUpdateInput : EmployeeInput + { + /// + /// 主键 + /// + public string? Id { get; set; } + } + /// + /// [授权信息]删除入参 + /// + public class EmployeeDelInput + { + /// + /// 主键 + /// + public string? Id { get; set; } + } + /// + /// [授权信息]普通查询入参 + /// + public class EmployeeQueryInput + { + /// + /// 主键 + /// + public string? Id { get; set; } + } + /// + /// [授权信息]分页查询入参 + /// + public class EmployeeQueryPageInput : RequestPage + { + /// + /// 主键 + /// + public string? Id { get; set; } + /// + /// 关键字 + /// + public string Keyword { get; set; } + /// + /// 状态 + /// + public int Status { get; set; } + /// + /// 性别 + /// + public int Gender { get; set; } + /// + /// 入职时间 + /// + public DateTime? JoinDate { get; set; } + } +} diff --git a/backend/BPA.MES.Base.Application/Services/SystemService/Dtos/EmployeeOutput.cs b/backend/BPA.MES.Base.Application/Services/SystemService/Dtos/EmployeeOutput.cs new file mode 100644 index 0000000..be0e839 --- /dev/null +++ b/backend/BPA.MES.Base.Application/Services/SystemService/Dtos/EmployeeOutput.cs @@ -0,0 +1,69 @@ +namespace BPA.MES.Base.Application +{ + /// + /// 名 称 :[员工信息] + /// 创 建 人 :yangxiao + /// 创建时间 : 2023/1/5 15:18:02 + /// 描 述 : + /// + public class EmployeeOutput + { + /// + /// 主键 + /// + public string Id { get; set; } + /// + /// 排序 + /// + public int Sort { get; set; } + /// + /// 员工姓名 + /// + public string Name { get; set; } + /// + /// 1男2女 + /// + + public int Gender { get; set; } + /// + /// 手机号 + /// + public string Phone { get; set; } + /// + /// 员工IC卡 + /// + public string ICCard { get; set; } + /// + /// 头像 + /// + public string Header { get; set; } + /// + /// 入职时间 + /// + public DateTime JoinDate { get; set; } + /// + /// 离职时间 + /// + public DateTime? OutDate { get; set; } + /// + /// 身份证 + /// + public string IdCard { get; set; } + /// + /// 1在职2出差3离职 + /// + public int Stutas { get; set; } + /// + /// 角色Id + /// + public string TB_RoleId { get; set; } + /// + /// 是否存在账号 + /// + public bool IsAccount { get; set; } + /// + /// 账号 + /// + public string Account { get; set; } + } +} diff --git a/backend/BPA.MES.Base.Application/Services/SystemService/Dtos/Mapper.cs b/backend/BPA.MES.Base.Application/Services/SystemService/Dtos/Mapper.cs new file mode 100644 index 0000000..8487bf4 --- /dev/null +++ b/backend/BPA.MES.Base.Application/Services/SystemService/Dtos/Mapper.cs @@ -0,0 +1,8 @@ +namespace BPA.MES.Base.Application; + +public class Mapper : IRegister +{ + public void Register(TypeAdapterConfig config) + { + } +} diff --git a/backend/BPA.MES.Base.Application/Services/SystemService/Dtos/ModuleInput.cs b/backend/BPA.MES.Base.Application/Services/SystemService/Dtos/ModuleInput.cs new file mode 100644 index 0000000..cad95fe --- /dev/null +++ b/backend/BPA.MES.Base.Application/Services/SystemService/Dtos/ModuleInput.cs @@ -0,0 +1,97 @@ +/// +/// 名 称 :[模块信息]实体基础 +/// 创 建 人 :yangxiao +/// 创建时间 : 2023/1/3 10:21:42 +/// 描 述 +/// +namespace BPA.MES.Base.Application +{ + /// + /// [模块信息]入参基础 + /// + public class ModuleInput + { + /// + /// 类别 1:菜单,2:视图,3:功能 + /// + public int Category { get; set; } + /// + /// 菜单打开方式 0:框架内嵌,1:新开页面 + /// + public int OpenType { get; set; } + /// + /// 父级编号 + /// + public string ParentId { get; set; } + /// + /// 名称 + /// + public string Name { set; get; } + /// + /// 图标 + /// + public string Icon { set; get; } + /// + /// 地址 + /// + public string Url { set; get; } + /// + /// 排序码 + /// + public int Sort { set; get; } + /// + /// 启用禁用 + /// + public bool IsDisabled { get; set; } + } + /// + /// [模块信息]添加入参 + /// + public class ModuleAddInput : ModuleInput + { + /// + /// 主键 + /// + public string Id { get; set; } + } + /// + /// [模块信息]修改入参 + /// + public class ModuleUpdateInput : ModuleInput + { + /// + /// 主键 + /// + public string? Id { get; set; } + } + /// + /// [模块信息]删除入参 + /// + public class ModuleDelInput + { + /// + /// 主键 + /// + public string? Id { get; set; } + } + /// + /// [模块信息]普通查询入参 + /// + public class ModuleQueryInput + { + /// + /// 主键 + /// + public string? Id { get; set; } + } + /// + /// [模块信息]分页查询入参 + /// + public class ModuleQueryPageInput : RequestPage + { + /// + /// 主键 + /// + public string? Id { get; set; } + } +} \ No newline at end of file diff --git a/backend/BPA.MES.Base.Application/Services/SystemService/Dtos/ModuleOutput.cs b/backend/BPA.MES.Base.Application/Services/SystemService/Dtos/ModuleOutput.cs new file mode 100644 index 0000000..ae5b46b --- /dev/null +++ b/backend/BPA.MES.Base.Application/Services/SystemService/Dtos/ModuleOutput.cs @@ -0,0 +1,48 @@ +namespace BPA.MES.Base.Application +{ + /// + /// 名 称 : + /// 创 建 人 :yangxiao + /// 创建时间 : 2023/1/4 9:48:24 + /// 描 述 : + /// + public class ModuleOutput + { + /// + /// 主键 + /// + public string Id { get; set; } + /// + /// 类别 1:菜单,2:视图,3:功能 + /// + public int Category { get; set; } + /// + /// 菜单打开方式 0:框架内嵌,1:新开页面 + /// + public int OpenType { get; set; } + /// + /// 父级编号 + /// + public string ParentId { get; set; } + /// + /// 名称 + /// + public string Name { set; get; } + /// + /// 图标 + /// + public string Icon { set; get; } + /// + /// 地址 + /// + public string Url { set; get; } + /// + /// 排序码 + /// + public int Sort { set; get; } + /// + /// 启用禁用 + /// + public bool IsDisabled { get; set; } + } +} diff --git a/backend/BPA.MES.Base.Application/Services/SystemService/Dtos/ModuleTreeInput.cs b/backend/BPA.MES.Base.Application/Services/SystemService/Dtos/ModuleTreeInput.cs new file mode 100644 index 0000000..9113544 --- /dev/null +++ b/backend/BPA.MES.Base.Application/Services/SystemService/Dtos/ModuleTreeInput.cs @@ -0,0 +1,108 @@ +/// +/// 名 称 :[菜单模块树]实体基础 +/// 创 建 人 :yangxiao +/// 创建时间 : 2023/1/3 10:21:42 +/// 描 述 +/// +namespace BPA.MES.Base.Application +{ + /// + /// [菜单模块树]入参基础 + /// + public class ModuleTreeInput + { + /// + /// 类别 1:菜单,2:视图,3:功能 + /// + public int Category { get; set; } + + /// + /// 菜单打开方式 0:框架内嵌,1:新开页面 + /// + public int OpenType { get; set; } + + /// + /// 父级编号 + /// + public string ParentId { get; set; } + + /// + /// 名称 + /// + public string Name { set; get; } + + /// + /// 图标 + /// + public string Icon { set; get; } + + /// + /// 地址 + /// + public string Url { set; get; } + /// + /// 排序码 + /// + public int Sort { set; get; } + /// + /// 启用禁用 + /// + public bool IsDisabled { get; set; } + + /// + /// 子集 + /// + public List Children { get; set; } + } + /// + /// [菜单模块树]添加入参 + /// + public class ModuleTreeAddInput : ModuleTreeInput + { + + } + /// + /// [菜单模块树]修改入参 + /// + public class ModuleTreeUpdateInput : ModuleTreeInput + { + /// + /// 主键 + /// + public string? Id { get; set; } + } + /// + /// [菜单模块树]删除入参 + /// + public class ModuleTreeDelInput + { + /// + /// 主键 + /// + public string? Id { get; set; } + } + /// + /// [菜单模块树]普通查询入参 + /// + public class ModuleTreeQueryInput + { + /// + /// 主键 + /// + public string? Id { get; set; } + /// + /// 名称 + /// + public string Name { get; set; } + } + /// + /// [菜单模块树]分页查询入参 + /// + public class ModuleTreeQueryPageInput : RequestPage + { + /// + /// 主键 + /// + public string? Id { get; set; } + } +} \ No newline at end of file diff --git a/backend/BPA.MES.Base.Application/Services/SystemService/Dtos/ModuleTreeOutput.cs b/backend/BPA.MES.Base.Application/Services/SystemService/Dtos/ModuleTreeOutput.cs new file mode 100644 index 0000000..a8771bd --- /dev/null +++ b/backend/BPA.MES.Base.Application/Services/SystemService/Dtos/ModuleTreeOutput.cs @@ -0,0 +1,59 @@ +namespace BPA.MES.Base.Application +{ + /// + /// 名 称 :[菜单模块树]输出 + /// 创 建 人 :yangxiao + /// 创建时间 : 2023/1/4 16:14:43 + /// 描 述 : + /// + public class ModuleTreeOutput + { + /// + /// 模块编号 + /// + public string Id { get; set; } + + /// + /// 类别 1:菜单,2:视图,3:功能 + /// + public int Category { get; set; } + + /// + /// 菜单打开方式 0:框架内嵌,1:新开页面 + /// + public int OpenType { get; set; } + + /// + /// 父级编号 + /// + public string ParentId { get; set; } + + /// + /// 名称 + /// + public string Name { set; get; } + + /// + /// 图标 + /// + public string Icon { set; get; } + + /// + /// 地址 + /// + public string Url { set; get; } + /// + /// 排序码 + /// + public int Sort { set; get; } + /// + /// 启用禁用 + /// + public bool IsDisabled { get; set; } + + /// + /// 子集 + /// + public List Children { get; set; } + } +} diff --git a/backend/BPA.MES.Base.Application/Services/SystemService/Dtos/RoleInput.cs b/backend/BPA.MES.Base.Application/Services/SystemService/Dtos/RoleInput.cs new file mode 100644 index 0000000..69e5a12 --- /dev/null +++ b/backend/BPA.MES.Base.Application/Services/SystemService/Dtos/RoleInput.cs @@ -0,0 +1,71 @@ +namespace BPA.MES.Base.Application +{ + /// + /// 名 称 :[角色信息] + /// 创 建 人 :yangxiao + /// 创建时间 : 2023/1/4 9:43:25 + /// 描 述 : + /// + public class RoleInput + { + /// + /// 角色名称 + /// + public string Name { get; set; } + /// + /// 角色描述 + /// + public string Description { get; set; } + } + /// + /// [角色信息]添加入参 + /// + public class RoleAddInput : RoleInput + { + + } + /// + /// [角色信息]修改入参 + /// + public class RoleUpdateInput : RoleInput + { + /// + /// 主键 + /// + public string? Id { get; set; } + } + /// + /// [角色信息]删除入参 + /// + public class RoleDelInput + { + /// + /// 主键 + /// + public string? Id { get; set; } + } + /// + /// [角色信息]普通查询入参 + /// + public class RoleQueryInput + { + /// + /// 主键 + /// + public string? Id { get; set; } + } + /// + /// [角色信息]分页查询入参 + /// + public class RoleQueryPageInput : RequestPage + { + /// + /// 主键 + /// + public string? Id { get; set; } + /// + /// 关键字 + /// + public string Keyword { get; set; } + } +} diff --git a/backend/BPA.MES.Base.Application/Services/SystemService/Dtos/RoleOutput.cs b/backend/BPA.MES.Base.Application/Services/SystemService/Dtos/RoleOutput.cs new file mode 100644 index 0000000..423080d --- /dev/null +++ b/backend/BPA.MES.Base.Application/Services/SystemService/Dtos/RoleOutput.cs @@ -0,0 +1,24 @@ +namespace BPA.MES.Base.Application +{ + /// + /// 名 称 :角色信息 + /// 创 建 人 :yangxiao + /// 创建时间 : 2023/1/4 9:43:42 + /// 描 述 : + /// + public class RoleOutput + { + /// + /// 主键 + /// + public string Id { get; set; } + /// + /// 角色名称 + /// + public string Name { get; set; } + /// + /// 角色描述 + /// + public string Description { get; set; } + } +} diff --git a/backend/BPA.MES.Base.Application/Services/SystemService/Dtos/UserRoleCacheDto.cs b/backend/BPA.MES.Base.Application/Services/SystemService/Dtos/UserRoleCacheDto.cs new file mode 100644 index 0000000..112a260 --- /dev/null +++ b/backend/BPA.MES.Base.Application/Services/SystemService/Dtos/UserRoleCacheDto.cs @@ -0,0 +1,62 @@ + + + + + +namespace BPA.MES.Base.Application +{ + /// + /// 名 称 :个人角色信息 + /// 创 建 人 :yangxiao + /// 创建时间 : 2023/1/4 17:46:47 + /// 描 述 : + /// + public class UserRoleCacheDto + { + public List AuthorizationCodes { get; set; } + public List Menus { get; set; } + } + +/// +/// 个人菜单信息 +/// +public class UserMenu : ITree + { + /// + /// 主键 + /// + public string Id { get; set; } + /// + /// 菜单名称 + /// + public string Name { get; set; } + /// + /// 菜单地址 + /// + public string Url { get; set; } + /// + /// 菜单图标 + /// + public string Icon { get; set; } + /// + /// 菜单子项 + /// + public List Children { get; set; } + /// + /// 父级Id + /// + public string ParentId { get; set; } + /// + /// 分页信息 + /// + public string Sort { get; set; } + /// + /// 打开类型 + /// + public int OpenType { get; set; } + /// + /// 类别 + /// + public int Category { get; set; } + } +} diff --git a/backend/BPA.MES.Base.Application/Services/SystemService/Services/AuthorizeService.cs b/backend/BPA.MES.Base.Application/Services/SystemService/Services/AuthorizeService.cs new file mode 100644 index 0000000..db1f84c --- /dev/null +++ b/backend/BPA.MES.Base.Application/Services/SystemService/Services/AuthorizeService.cs @@ -0,0 +1,645 @@ +namespace BPA.MES.Base.Application +{ + /// + /// 名 称 :授权服务 + /// 创 建 人 :yangxiao + /// 创建时间 :2023/3/2 16:11:04 + /// 描 述 :授权服务数据维护 + /// + [ApiDescriptionSettings(Name = "Authorize", KeepName = true, SplitCamelCase = true, KeepVerb = true)] + public class AuthorizeService : IAuthorizeService, ITransient, IDynamicApiController + { + private readonly IHttpContextAccessor _httpContextAccessor; + private readonly ISqlSugarClient db; + private readonly ISqlSugarClient _dbContext; + public AuthorizeService(ISqlSugarClient db, IHttpContextAccessor httpContextAccessor) + { + this.db = db; + _dbContext = db; + _httpContextAccessor = httpContextAccessor; + } + #region 当前用户 + /// + /// 登录 + /// + /// + /// + + [AllowAnonymous] + public async Task Login(AccountInput input) + { + var Info = await db.Queryable().FirstAsync(t => t.Account == input.Account && t.Pwd == input.Pwd); + if (Info == null) + throw Oops.Bah("请输入正确的账号和密码"); + var User = await db.Queryable().FirstAsync(t => t.Id == Info.EmployeeId); + if (User == null) + { + throw Oops.Bah("账号没有权限"); + } + //return ResolveService().CreateAccessToken(new UserIdentity + //{ + // Id = User.Id, + // UserName = User.Name, + // IsAdmin = User.IsAdmin, + //}); + + // 生成Token令牌 + //var accessToken = await _jwtBearerManager.CreateTokenAdmin(user); + var accessToken = JWTEncryption.Encrypt(new Dictionary + { + {ClaimConst.CLAINM_USERID, User.Id}, + {ClaimConst.CLAINM_NAME,User.Name}, + {ClaimConst.CLAINM_ISAUTH,User.IsAdmin}, + },20); + // 设置Swagger自动登录 + _httpContextAccessor.HttpContext.SigninToSwagger(accessToken); + // 生成刷新Token令牌 + var refreshToken = + JWTEncryption.GenerateRefreshToken(accessToken, 25); + + _httpContextAccessor.HttpContext.Response.Headers["access-token"] = accessToken; + // 设置刷新Token令牌 + _httpContextAccessor.HttpContext.Response.Headers["x-access-token"] = refreshToken; + return true; + } + /// + /// 获取个人信息 + /// + /// + public async Task GetUserInfo() + { + string userId = App.User?.FindFirst(ClaimConst.CLAINM_USERID)?.Value; + var user = await db.Queryable().LeftJoin((t, x) => t.TB_RoleId == x.Id) + .Where((t, x) => t.Id == userId).Select((t, x) => new + { + RoleName = x.Name, + RoleType = x.RoleType, + Id = t.Id, + UserName = t.Name + }).FirstAsync(); + + + var menus = (await GetJurisdictionItemsAsync())?.Menus; + return new + { + Menus = menus, + UserInfo = new + { + UserId = user?.Id, + user?.RoleName, + user?.UserName + } + }; + } + [HttpGet] + public async Task> MultipleModuleAuthorityAsync() + { + return (await GetJurisdictionItemsAsync())?.AuthorizationCodes; + } + /// + /// 获取用户权限 + /// + /// + [HttpGet] + async Task GetJurisdictionItemsAsync() + { + + string userId = App.User?.FindFirst(ClaimConst.CLAINM_USERID)?.Value; + var result = new UserRoleCacheDto(); + + result.AuthorizationCodes = (await GetAuthorityModuleIdsAsync(userId)) ?? new List(); + + if (result.AuthorizationCodes.HasVal()) + { + var temp = await db.Queryable().Where(t => t.Category == 1 || t.Category == 2 || t.Category == 3) + .Where(t => result.AuthorizationCodes.Contains(t.Id) && !t.IsDisabled).OrderBy(t => t.ParentId) + .ToListAsync(); + + result.Menus = temp.Adapt>().BuildTree(); + } + + result.Menus = result.Menus ?? new List(); + + return result; + } + /// + /// 获取权限模块编号 + /// + /// + /// + /// + [HttpGet] + async Task> GetAuthorityModuleIdsAsync(string userId) + { + List moduleIds = null; + + var user = await db.Queryable().Where(m => m.Id == userId).FirstAsync(); + + if (user == null) + { + return moduleIds; + } + + //超管用户 + if (user.IsAdmin) + { + moduleIds = await db.Queryable() + .OrderBy(m => m.ParentId).OrderBy(m => m.Name) + .ToListAsync(m => m.Id); + } + else + { + moduleIds = await GetAuthorityModuleIdsAsync((category) => + { + if (category == 1) + { + return user.Id; + } + if (category == 2) + { + return user.TB_RoleId; + } + else + { + throw new NotImplementedException("无效授权类别"); + } + }); + } + + return moduleIds; + } + /// + /// 获取账户信息 + /// + /// + /// + [HttpPost] + public async Task> AccountPageList(AccountQueryPageInput input) + { + var entity = await _dbContext.Queryable() + .ToPagedListAsync(input.PageIndex,input.PageSize); + SqlSugarPagedList output = entity.Adapt>(); + return output; + } + + /// + /// 添加账户 + /// + /// + /// + public async Task AddAccount(AccountAddInput input) + { + var entity = input.Adapt(); + return await _dbContext.Insertable(entity).ExecuteCommandIdentityIntoEntityAsync(); + } + /// + /// 修改账户信息 + /// + /// + /// + public async Task UpdateAccount(AccountUpdateInput input) { + var entity = input.Adapt(); + return await _dbContext.Updateable(entity).ExecuteCommandHasChangeAsync(); + } + /// + /// 删除账户 + /// + /// + /// + public async Task DelAccount(AccountDelInput input) { + var entity = input.Adapt(); + return await _dbContext.Deleteable(entity).Where(x=>x.Id==input.Id).ExecuteCommandHasChangeAsync(); + } + /// + /// 获取授权模块编号 + /// + /// + /// + [HttpGet] + async Task> GetAuthorityModuleIdsAsync(Func getObjectId) + { + for (int index = 1; index <= 2; index++) + { + var objectId = getObjectId(index); + var templateIds = await db.Queryable().LeftJoin((t, x) => t.TemplateId == x.Id) + .Where((t, x) => t.AuthorizeType == index && t.ObjectId == objectId).ToListAsync(t => t.TemplateId); + + if (!templateIds.HasVal() || templateIds.Count == 0) + { + continue; + } + return await db.Queryable().LeftJoin((t, x) => t.TB_ModuleId == x.Id) + .Where((t, x) => templateIds.Contains(t.TB_TemplateId)) + .GroupBy((t, x) => t.TB_ModuleId).ToListAsync(t => t.TB_ModuleId); + } + return null; + } + #endregion + + + #region 角色 + [HttpPost] + public async Task AddRole(RoleAddInput input) + { + var check = await db.Queryable().FirstAsync(t => t.Name == input.Name); + if (check != null) throw Oops.Bah ("角色名称不能重复"); + var model = input.Adapt(); + model.RoleType = 2; + return await db.Insertable(model).ExecuteCommandAsync() > 0; + } + [HttpPost] + public async Task EditRole(RoleUpdateInput input) + { + if (!await db.Queryable().Where(it => it.Id == input.Id).AnyAsync()) + throw Oops.Bah("角色不存在或已被删除"); + if (await _dbContext.Queryable().Where(it => it.Id != input.Id && it.Name == input.Name).AnyAsync()) + throw Oops.Bah("角色名称已经存在"); + return await _dbContext.Updateable(input).Where(a => a.Id == input.Id).ExecuteCommandHasChangeAsync(); + } + [HttpGet] + public async Task RemoveRole(string input) + { + return await db.Updateable().Where(t => t.Id == input).ExecuteCommandHasChangeAsync(); + } + [HttpGet] + public async Task GetRole(string input) + { + var entity = await db.Queryable().FirstAsync(t => t.Id == input); + return entity.Adapt(); + } + [HttpGet] + public async Task> GetRoleList() + { + var entity = await db.Queryable().Where(t => t.RoleType != 1).ToListAsync(); + return entity.Adapt>(); + } + [HttpPost] + public async Task> QueryRole(RoleQueryPageInput input) + { + var eneity = await db.Queryable() + .WhereIF(!string.IsNullOrEmpty(input.Keyword), t => t.Name.Contains(input.Keyword)) + .Select() + .ToPagedListAsync(input.PageIndex, input.PageSize); + return eneity; + } + #endregion + + #region 模块 + [HttpPost] + public async Task AddModule(ModuleAddInput input) + { + input.ParentId = input.ParentId ?? string.Empty; + input.Id = null; + return (await db.Insertable(input.Adapt()).ExecuteCommandAsync()) > 0; + } + [HttpPost] + + public async Task EditModule(ModuleUpdateInput input) + { + if (!await db.Queryable().Where(it => it.Id == input.Id ).AnyAsync()) + { + throw Oops.Bah("模块不存在或已被删除"); + } + input.ParentId = input.ParentId ?? string.Empty; + return await db.Updateable(input).Where(a => a.Id == input.Id).ExecuteCommandHasChangeAsync(); + } + [HttpGet] + + public async Task RemoveModule(string input) + { + var list = await db.Queryable().Where(it => it.ParentId == input).ToListAsync(); + if (list.HasVal()) + { + foreach (var item in list) + { + await RemoveModule(item.Id); + } + } + await _dbContext.Updateable().Where(it => it.Id == input).ExecuteCommandAsync(); + } + [HttpPost] + public async Task> GetTreeGrid(ModuleTreeQueryInput input) + { + var list = new List(); + + var datas = await db.Queryable() + .WhereIF(!string.IsNullOrEmpty(input.Name), t => t.Name.Contains(input.Name)) + .OrderBy(it => it.ParentId) + .OrderBy(it => it.Name) + .ToListAsync(); + + var modules = datas.Adapt>(); + + if (modules.HasVal()) + { + foreach (var item in modules.Where(it => it.Category == 1)) + { + item.Children = modules.Where(it => it.ParentId == item.Id && it.Category == 2).OrderBy(it => it.Sort).ToList(); + foreach (var view in item.Children) + { + view.Children = modules.Where(it => it.ParentId == view.Id && it.Category == 3).OrderBy(it => it.Sort).ToList(); + } + + list.Add(item); + } + } + return list; + } + #endregion + + #region 授权模板 + [HttpPost] + public async Task AddAuthorTemp(AuthorizeTemplateAddInput input) + { + if (await db.Queryable().Where(it => it.Name == input.Name && it.IsDeleted == false).AnyAsync()) + throw Oops.Bah("模板名称已经存在"); + var data = await db.Insertable(input.Adapt()).ExecuteCommandAsync(); + return data > 0; + } + [HttpPost] + public async Task EditAuthorTemp(AuthorizeTemplateUpdateInput input) + { + if (!await db.Queryable().Where(it => it.Id == input.Id && it.IsDeleted == false).AnyAsync()) + throw Oops.Bah("模板不存在或已被删除"); + if (await db.Queryable().Where(it => it.Id != input.Id && it.Name == input.Name && it.IsDeleted == false).AnyAsync()) + throw Oops.Bah("模板名称已经存在"); + return await db.Updateable(input).Where(a => a.Id == input.Id).ExecuteCommandHasChangeAsync(); + } + [HttpGet] + public async Task RemoveAuthorTemp(string input) + { + var f1 = await db.Updateable().SetColumns(t => t.IsDeleted == true).Where(t => t.Id == input).ExecuteCommandHasChangeAsync(); + var f2 = await db.Updateable().SetColumns(T => T.IsDeleted == true).Where(t => t.TB_TemplateId == input).ExecuteCommandHasChangeAsync(); + return f1 && f2; + } + [HttpPost] + public async Task> QueryAuthorTemp(AuthorizeTemplateQueryPageInput input) + { + RefAsync Total = 0; + var data = await db.Queryable().Where(t => !t.IsDeleted) + .WhereIF(!string.IsNullOrEmpty(input.Keyword), t => t.Name.Contains(input.Keyword)) + .OrderByDescending(t => t.CreateAt) + .Select() + .ToPagedListAsync(input.PageIndex, input.PageSize); + return data; + } + public async Task GetAuthorTemp(string input) + { + var data = await db.Queryable().Where(it => it.Id == input && it.IsDeleted == false).FirstAsync(); + return data.Adapt(); + } + #endregion + + #region 授权模板详情 + [HttpGet] + public async Task> GetModuleByTemplateId(string input) + { + List result = new List(); + var modules = await db.Queryable().ToListAsync(); + var roots = modules.Adapt>(); + db.ThenMapper(roots, item => + { + item.HasPermission = db.Queryable().Where(m => m.TB_TemplateId == input && m.TB_ModuleId == item.Id).Any(); + }); + if (roots.HasVal()) + { + foreach (var item in roots.Where(it => it.Category == 1)) + { + item.Childrens = roots.Where(it => it.ParentId == item.Id && it.Category == 2).OrderBy(it => it.Name).ToList(); + + foreach (var view in item.Childrens) + { + view.Childrens = roots.Where(it => it.ParentId == view.Id && it.Category == 3).OrderBy(it => it.Name).ToList(); + } + + result.Add(item); + } + } + return result; + } + [HttpPost] + public async Task EditTemplateItem(AuthorModuleItemUpdateInput input) + { + var temp = await db.Queryable().FirstAsync(t => t.Id == input.TB_TemplateId && t.IsDeleted == false); + await db.Updateable().SetColumns(T => T.IsDeleted == true) + .Where(t => t.TB_TemplateId == input.TB_TemplateId).ExecuteCommandHasChangeAsync(); + + var entity = input.TB_ModuleIds.Distinct().ToList().ConvertAll(t => new AuthorizeTemplateItemEntity + { + TB_ModuleId = t, + TB_TemplateId = input.TB_TemplateId + }); + var res = await db.Insertable(entity).ExecuteCommandAsync(); + return res > 0; + } + [HttpPost] + public async Task> GetAuthorizeObjects(AuthorizeInput input) + { + List result; + if (input.Type == 2) + { + var temp = await db.Queryable() + .Where(t => t.RoleType != 1) + .Where(t => t.IsDeleted == false) + .WhereIF(!string.IsNullOrWhiteSpace(input.Keyword), t => t.Name.Contains(input.Keyword)) + .OrderBy(t => t.RoleType) + .OrderBy(t => t.Name) + .ToListAsync(); + + result = temp.Adapt>(); + db.ThenMapper(result, item => + { + item.IsAuthorized = db.Queryable() + .Where(m => m.TemplateId == input.TemplateId && m.AuthorizeType == input.Type && m.ObjectId == item.Id).Any(); + }); + } + else + { + var temp = await db.Queryable() + .Where(t => t.IsAdmin == false) + .Where(t => t.IsDeleted == false) + .WhereIF(!string.IsNullOrWhiteSpace(input.Keyword), t => t.Name.Contains(input.Keyword)) + .OrderBy(t => t.Name) + .ToListAsync(); + result = temp.Adapt>(); + db.ThenMapper(result, item => + { + item.IsAuthorized = db.Queryable().Where(t => t.IsDeleted == false) + .Where(m => m.TemplateId == input.TemplateId && m.AuthorizeType == input.Type && m.ObjectId == item.Id).Any(); + }); + } + if (result.HasVal()) + { + result = result.OrderByDescending(m => m.IsAuthorized).ThenBy(m => m.Name).ToList(); + } + return result; + } + [HttpPost] + public async Task RemoveAuthorize(AuthorizeInput input) + { + var objectIds = input.ObjectIds.Distinct().ToArray(); + return await db.Updateable().SetColumns(t => t.IsDeleted == true) + .Where(it => it.TemplateId == input.TemplateId && it.AuthorizeType == input.Type && objectIds.Contains(it.ObjectId)) + .ExecuteCommandHasChangeAsync(); + } + [HttpPost] + public async Task AddAuthorize(AuthorMapAddInput input) + { + foreach (var item in input.TemplateIds.Distinct()) + { + if (!await _dbContext.Queryable().AnyAsync(m => m.TemplateId == item && m.AuthorizeType == input.AuthorizeType && m.IsDeleted == false && m.ObjectId == input.ObjectId)) + { + await _dbContext.Insertable(new AuthorizeTemplateMapEntity() + { + TemplateId = item, + ObjectId = input.ObjectId, + AuthorizeType = input.AuthorizeType + }).ExecuteCommandAsync(); + } + } + } + [HttpPost] + public async Task SaveAuthorize(AuthorModulesAddInput input) + { + if (await db.Queryable().Where(it => it.Name == input.TemplateName && it.IsDeleted == false).AnyAsync()) + { + throw Oops.Bah("模板名称已经存在"); + } + AuthorizeTemplateEntity Model = new AuthorizeTemplateEntity(); + Model.Name = input.TemplateName; + List templateItems = input.ModuleIds.ConvertAll(m => new AuthorizeTemplateItemEntity + { + TB_TemplateId = Model.Id, + TB_ModuleId = m + }); + try + { + db.Ado.BeginTran(); + var f1 = (await db.Insertable(Model).ExecuteCommandAsync()) > 0; + var f2 = (await _dbContext.Insertable(templateItems).ExecuteCommandAsync()) > 0; + db.Ado.CommitTran(); + return f1 && f2; + } + catch (Exception) + { + db.Ado.RollbackTran(); + return false; + } + } + [HttpGet] + public async Task RestoreAccountByUser(string input) + { + var Demo = "123456".ToMD5Encrypt(); + return await db.Updateable().SetColumns(t => t.Pwd == Demo) + .Where(t => t.EmployeeId == input).ExecuteCommandHasChangeAsync(); + } + [HttpPost] + public async Task AddAccountByUser(AccountAddInput input) + { + var temp = await db.Queryable().FirstAsync(t => t.EmployeeId == input.TB_Employee_Id); + if (temp != null) + { + //throw new BusinessException("该员工已绑定账户,请勿重复绑定"); + temp.Account = input.Account; + return await db.Updateable(temp).ExecuteCommandAsync() > 0; + } + else + { + var model = input.Adapt(); + //默认123456 + model.Pwd = "123456".ToMD5Encrypt(); + return await db.Insertable(model).ExecuteCommandAsync() > 0; + } + } + [HttpPost] + public async Task EditAccountPwd(AccountUpdatePwdInput input) + { + var model = db.Queryable().First(t => t.Account == input.Account && t.Pwd == input.Pwd); + if (model == null) throw Oops.Bah("原密码不正确"); + model.Pwd = input.NewPwd; + return await db.Updateable(model).ExecuteCommandAsync() > 0; + } + [HttpGet] + public async Task GetAccountByUser(string input) + { + var data = await db.Queryable().FirstAsync(t => t.EmployeeId == input); + return data.Adapt(); + } + + [HttpPost] + public async Task AddEmployee(EmployeeAddInput input) + { + var model = input.Adapt(); + model.IsAdmin = false; + var temp = await db.Queryable().FirstAsync(t => t.Name.Equals(input.Name) && t.Phone.Equals(input.Phone) && t.IsDeleted == false); + if (temp != null) throw Oops.Bah("该员工已经存在"); + return await db.Insertable(model).ExecuteCommandAsync() > 0; + } + [HttpPost] + public async Task EditEmployee(EmployeeUpdateInput input) + { + var temp = await db.Queryable().FirstAsync(t => t.Id == input.Id); + temp.Header = input.Header; + temp.IdCard = input.IdCard; + temp.Gender = input.Gender; + temp.JoinDate = input.JoinDate; + temp.OutDate = input.OutDate; + temp.Name = input.Name; + temp.Phone = input.Phone; + temp.Stutas = input.Stutas; + return await db.Updateable(temp).ExecuteCommandHasChangeAsync(); + } + [HttpPost] + public async Task> QueryEmployee(EmployeeQueryPageInput input) + { + + var entity = await db.Queryable() + + .WhereIF(!string.IsNullOrEmpty(input.Keyword), t => t.Name.Contains(input.Keyword) || t.Phone.Contains(input.Keyword)) + .WhereIF(input.Status > 0, t => t.Stutas == input.Status).WhereIF(input.Gender > 0, t => t.Gender == input.Gender) + .WhereIF(input.JoinDate.HasValue, t => t.JoinDate <= input.JoinDate.Value) + .Where(t => t.IsAdmin == false) + .Where(t => t.IsDeleted == false) + .Select(t => new EmployeeOutput() + { + Id = t.Id.SelectAll(), + IsAccount = SqlFunc.Subqueryable().Where(s => s.EmployeeId == t.Id).Any(), + Account = SqlFunc.Subqueryable().Where(s => s.EmployeeId == t.Id).Select(s => s.Account) + }) + .ToPagedListAsync(input.PageIndex, input.PageSize); + return entity; + } + [HttpGet] + public async Task RemoveEmployee([FromQuery] string employeeId) + { + bool result = false; + var entity =await db.Queryable().FirstAsync(x=>x.EmployeeId== employeeId); + + try + { + db.Ado.BeginTran(); + await db.Deleteable().Where(t => t.Id == employeeId).ExecuteCommandAsync(); + if (entity!=null) + { + entity.EmployeeId = string.Empty; + await db.Updateable(entity).ExecuteCommandAsync(); + } + db.Ado.CommitTran(); + result = true; + } + catch (Exception ex) + { + db.Ado.RollbackTran(); + throw Oops.Bah("删除失败!"); + } + return result; + } + [HttpGet] + public async Task> EmployeeList() + { + var data = await db.Queryable().Where(t => t.IsAdmin == false).ToListAsync(); + return data.Adapt>(); + } + #endregion + } +} diff --git a/backend/BPA.MES.Base.Application/Services/SystemService/Services/IAuthorizeService.cs b/backend/BPA.MES.Base.Application/Services/SystemService/Services/IAuthorizeService.cs new file mode 100644 index 0000000..e8c073e --- /dev/null +++ b/backend/BPA.MES.Base.Application/Services/SystemService/Services/IAuthorizeService.cs @@ -0,0 +1,63 @@ +namespace BPA.MES.Base.Application; + +public interface IAuthorizeService +{ + + #region 账户 + Task RestoreAccountByUser(string input); + Task AddAccountByUser(AccountAddInput input); + Task EditAccountPwd(AccountUpdatePwdInput input); + Task GetAccountByUser(string input); + Task> AccountPageList(AccountQueryPageInput input); + Task AddAccount(AccountAddInput input); + Task UpdateAccount(AccountUpdateInput input); + Task DelAccount(AccountDelInput input); + Task Login(AccountInput input); + + #endregion + + #region 员工 + Task AddEmployee(EmployeeAddInput input); + Task EditEmployee(EmployeeUpdateInput input); + Task> QueryEmployee(EmployeeQueryPageInput input); + Task RemoveEmployee(string input); + Task> EmployeeList(); + #endregion + + + Task GetUserInfo(); + Task> MultipleModuleAuthorityAsync(); + + #region 角色 + Task AddRole(RoleAddInput input); + Task EditRole(RoleUpdateInput input); + Task RemoveRole(string input); + Task GetRole(string input); + Task> GetRoleList(); + Task> QueryRole(RoleQueryPageInput input); + #endregion + + #region 模块 + Task AddModule(ModuleAddInput input); + Task EditModule(ModuleUpdateInput input); + Task RemoveModule(string input); + Task> GetTreeGrid(ModuleTreeQueryInput input); + #endregion + + #region 授权模板 + Task AddAuthorTemp(AuthorizeTemplateAddInput input); + Task EditAuthorTemp(AuthorizeTemplateUpdateInput input); + Task RemoveAuthorTemp(string input); + Task> QueryAuthorTemp(AuthorizeTemplateQueryPageInput input); + Task GetAuthorTemp(string input); + #endregion + + #region 授权模板详情 + Task> GetModuleByTemplateId(string input); + Task EditTemplateItem(AuthorModuleItemUpdateInput input); + Task> GetAuthorizeObjects(AuthorizeInput input); + Task RemoveAuthorize(AuthorizeInput input); + Task SaveAuthorize(AuthorModulesAddInput input); + Task AddAuthorize(AuthorMapAddInput input); + #endregion +} diff --git a/backend/BPA.MES.Base.Application/applicationsettings.json b/backend/BPA.MES.Base.Application/applicationsettings.json new file mode 100644 index 0000000..56080bc --- /dev/null +++ b/backend/BPA.MES.Base.Application/applicationsettings.json @@ -0,0 +1,12 @@ +{ + "SpecificationDocumentSettings": { + "DocumentTitle": "MES数据接口" + }, + "CorsAccessorSettings": { + "WithExposedHeaders": [ + "access-token", + "x-access-token", + "environment" + ] + } +} \ No newline at end of file diff --git a/backend/BPA.MES.Base.Core/BPA.MES.Base.Core.csproj b/backend/BPA.MES.Base.Core/BPA.MES.Base.Core.csproj new file mode 100644 index 0000000..58e025d --- /dev/null +++ b/backend/BPA.MES.Base.Core/BPA.MES.Base.Core.csproj @@ -0,0 +1,23 @@ + + + + + net6.0 + 1701;1702;1591 + BPA.MES.Base.Core.xml + + + + + + + + + + + + + + + + diff --git a/backend/BPA.MES.Base.Core/BPA.MES.Base.Core.xml b/backend/BPA.MES.Base.Core/BPA.MES.Base.Core.xml new file mode 100644 index 0000000..28e839d --- /dev/null +++ b/backend/BPA.MES.Base.Core/BPA.MES.Base.Core.xml @@ -0,0 +1,131 @@ + + + + BPA.MES.Base.Core + + + + + 名 称 :主键 + 创 建 人 :yangxiao + 创建时间 :2023/3/2 13:59:33 + 描 述 : + + + + + 主键 + + + + + 名 称 : + 创 建 人 :yangxiao + 创建时间 : 2023/3/4 9:51:33 + 描 述 : + + + + + 名 称 :分页基础类 + 创 建 人 :yangxiao + 创建时间 : 2023/3/2 16:15:41 + 描 述 : + + + + + 页码 + + 1 + + + + 页大小 + + 10 + + + + 名 称 :分页泛型集合 + 创 建 人 :yangxiao + 创建时间 : 2023/3/2 16:21:27 + 描 述 : + + + + + 页码 + + + + + 页容量 + + + + + 总条数 + + + + + 总页数 + + + + + 当前页集合 + + + + + 是否有上一页 + + + + + 是否有下一页 + + + + + 分页拓展类 + + + + + 分页拓展 + + + + + + + + + 分页拓展 + + + + + + + + + 名 称 :数据库启动类 + 创 建 人 :yangxiao + 创建时间 : 2023/3/23 14:09:30 + 描 述 : + + + + + 名 称 : + 创 建 人 :yangxiao + 创建时间 : 2023/3/4 9:50:52 + 描 述 : + + + + diff --git a/backend/BPA.MES.Base.Core/DEntityBase.cs b/backend/BPA.MES.Base.Core/DEntityBase.cs new file mode 100644 index 0000000..39a7fb6 --- /dev/null +++ b/backend/BPA.MES.Base.Core/DEntityBase.cs @@ -0,0 +1,27 @@ +using SqlSugar; +using System.ComponentModel; +using Yitter.IdGenerator; + +namespace BPA.MES.Base.Core +{ + /// + /// 名 称 :主键 + /// 创 建 人 :yangxiao + /// 创建时间 :2023/3/2 13:59:33 + /// 描 述 : + /// + public class DEntityBase + { + /// + /// 主键 + /// + [Description("主键")] + [SugarColumn(IsPrimaryKey = true)] + public string Id { get; set; } + public DEntityBase() + { + var b = YitIdHelper.NextId(); + Id = b.ToString(); + } + } +} diff --git a/backend/BPA.MES.Base.Core/EmptyExtensions.cs b/backend/BPA.MES.Base.Core/EmptyExtensions.cs new file mode 100644 index 0000000..fe0750a --- /dev/null +++ b/backend/BPA.MES.Base.Core/EmptyExtensions.cs @@ -0,0 +1,21 @@ +namespace BPA.MES.Base.Core +{ + /// + /// 名 称 : + /// 创 建 人 :yangxiao + /// 创建时间 : 2023/3/4 9:51:33 + /// 描 述 : + /// + public static class EmptyExtensions + { + public static bool HasVal(this T obj) + { + if (obj != null) + { + return !obj.Equals(default(T)); + } + + return false; + } + } +} diff --git a/backend/BPA.MES.Base.Core/RequestPage.cs b/backend/BPA.MES.Base.Core/RequestPage.cs new file mode 100644 index 0000000..15ea1e6 --- /dev/null +++ b/backend/BPA.MES.Base.Core/RequestPage.cs @@ -0,0 +1,22 @@ +namespace BPA.MES.Base.Core +{ + /// + /// 名 称 :分页基础类 + /// 创 建 人 :yangxiao + /// 创建时间 : 2023/3/2 16:15:41 + /// 描 述 : + /// + public class RequestPage + { + /// + /// 页码 + /// + /// 1 + public int PageIndex { get; set; } + /// + /// 页大小 + /// + /// 10 + public int PageSize { get; set; } + } +} diff --git a/backend/BPA.MES.Base.Core/SqlSugarPagedList.cs b/backend/BPA.MES.Base.Core/SqlSugarPagedList.cs new file mode 100644 index 0000000..2f67754 --- /dev/null +++ b/backend/BPA.MES.Base.Core/SqlSugarPagedList.cs @@ -0,0 +1,109 @@ +using SqlSugar; +using System; +using System.Collections.Generic; +using System.Threading.Tasks; + +namespace BPA.MES.Base.Core +{ + /// + /// 名 称 :分页泛型集合 + /// 创 建 人 :yangxiao + /// 创建时间 : 2023/3/2 16:21:27 + /// 描 述 : + /// + public class SqlSugarPagedList + where TEntity : new() + { + /// + /// 页码 + /// + public int Page { get; set; } + + /// + /// 页容量 + /// + public int PageSize { get; set; } + + /// + /// 总条数 + /// + public int Total { get; set; } + + /// + /// 总页数 + /// + public int TotalPages { get; set; } + + /// + /// 当前页集合 + /// + public IEnumerable Items { get; set; } + + /// + /// 是否有上一页 + /// + public bool HasPrevPage { get; set; } + + /// + /// 是否有下一页 + /// + public bool HasNextPage { get; set; } + } + + /// + /// 分页拓展类 + /// + public static class SqlSugarPagedExtensions + { + /// + /// 分页拓展 + /// + /// + /// + /// + /// + public static SqlSugarPagedList ToPagedList(this ISugarQueryable entity, int pageIndex, int pageSize) + where TEntity : new() + { + var total = 0; + var items = entity.ToPageList(pageIndex, pageSize, ref total); + var totalPages = (int)Math.Ceiling(total / (double)pageSize); + return new SqlSugarPagedList + { + Page = pageIndex, + PageSize = pageSize, + Items = items, + Total = total, + TotalPages = totalPages, + HasNextPage = pageIndex < totalPages, + HasPrevPage = pageIndex - 1 > 0 + }; + } + + /// + /// 分页拓展 + /// + /// + /// + /// + /// + public static async Task> ToPagedListAsync(this ISugarQueryable entity, int pageIndex, int pageSize) + where TEntity : new() + { + RefAsync total = 0; + var items = await entity.ToPageListAsync(pageIndex, pageSize, total); + var totalPages = (int)Math.Ceiling(total / (double)pageSize); + return new SqlSugarPagedList + { + Page = pageIndex, + PageSize = pageSize, + Items = items, + Total = total, + TotalPages = totalPages, + HasNextPage = pageIndex < totalPages, + HasPrevPage = pageIndex - 1 > 0 + }; + } + + } +} \ No newline at end of file diff --git a/backend/BPA.MES.Base.Core/SqlsugarSetup.cs b/backend/BPA.MES.Base.Core/SqlsugarSetup.cs new file mode 100644 index 0000000..87f5014 --- /dev/null +++ b/backend/BPA.MES.Base.Core/SqlsugarSetup.cs @@ -0,0 +1,41 @@ +using Furion; +using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.DependencyInjection; +using SqlSugar; +using System; +using System.Collections.Generic; + +namespace BPA.MES.Base.Core +{ + /// + /// 名 称 :数据库启动类 + /// 创 建 人 :yangxiao + /// 创建时间 : 2023/3/23 14:09:30 + /// 描 述 : + /// + public static class SqlsugarSetup + { + public static void AddSqlsugarSetup(this IServiceCollection services, IConfiguration configuration, string dbName = "ConnectionString") + { + //如果多个数数据库传 List + var dbs = App.GetConfig>("ConnectionConfigs")[0]; + var configConnection = new ConnectionConfig() + { + DbType = dbs.DbType, + ConnectionString = dbs.ConnectionString, + IsAutoCloseConnection = dbs.IsAutoCloseConnection, + }; + SqlSugarScope sqlSugar = new SqlSugarScope(configConnection, + db => + { + //单例参数配置,所有上下文生效 + db.Aop.OnLogExecuting = (sql, pars) => + { + Console.WriteLine(sql);//输出sql + }; + }); + + services.AddSingleton(sqlSugar);//这边是SqlSugarScope用AddSingleton + } + } +} diff --git a/backend/BPA.MES.Base.Core/TreeExtensions.cs b/backend/BPA.MES.Base.Core/TreeExtensions.cs new file mode 100644 index 0000000..1659049 --- /dev/null +++ b/backend/BPA.MES.Base.Core/TreeExtensions.cs @@ -0,0 +1,65 @@ +using System; +using System.Collections.Generic; +using System.Linq; + +namespace BPA.MES.Base.Core +{ + /// + /// 名 称 : + /// 创 建 人 :yangxiao + /// 创建时间 : 2023/3/4 9:50:52 + /// 描 述 : + /// + public static class TreeExtensions + { + public static List BuildTree(this List list, string rootId = "") where T : class, ITree + { + string rootId2 = rootId; + List list2 = list; + List resul = null; + if (list2.HasVal()) + { + List list3 = list2.Where((T e) => e.ParentId == rootId2).ToList(); + if (list3.HasVal()) + { + resul = new List(); + list3.ForEach(delegate (T it) + { + it.Children = list2.BuildTree(it.Id); + resul.Add(it); + }); + } + } + + return resul; + } + public interface ITree where T : class + { + string Id { get; set; } + + string ParentId { get; set; } + + List Children { get; set; } + } + public static List DeleteTreeNodes(this List list, Func condition) where T : class, ITree + { + if (list.HasVal()) + { + for (int i = 0; i < list.Count; i++) + { + T val = list[i]; + if (condition(val)) + { + list.Remove(val); + } + else if (val.Children.HasVal()) + { + val.Children.DeleteTreeNodes(condition); + } + } + } + + return list; + } + } +} diff --git a/backend/BPA.MES.Base.Web.Core/BPA.MES.Base.Web.Core.csproj b/backend/BPA.MES.Base.Web.Core/BPA.MES.Base.Web.Core.csproj new file mode 100644 index 0000000..56a5220 --- /dev/null +++ b/backend/BPA.MES.Base.Web.Core/BPA.MES.Base.Web.Core.csproj @@ -0,0 +1,19 @@ + + + + + net6.0 + 1701;1702;1591 + BPA.MES.Base.Web.Core.xml + + + + + + + + + + + + diff --git a/backend/BPA.MES.Base.Web.Core/BPA.MES.Base.Web.Core.xml b/backend/BPA.MES.Base.Web.Core/BPA.MES.Base.Web.Core.xml new file mode 100644 index 0000000..af94544 --- /dev/null +++ b/backend/BPA.MES.Base.Web.Core/BPA.MES.Base.Web.Core.xml @@ -0,0 +1,8 @@ + + + + BPA.MES.Base.Web.Core + + + + diff --git a/backend/BPA.MES.Base.Web.Core/Handlers/JwtHandler.cs b/backend/BPA.MES.Base.Web.Core/Handlers/JwtHandler.cs new file mode 100644 index 0000000..f413b49 --- /dev/null +++ b/backend/BPA.MES.Base.Web.Core/Handlers/JwtHandler.cs @@ -0,0 +1,16 @@ +using Furion.Authorization; +using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Http; +using System.Threading.Tasks; + +namespace BPA.MES.Base.Web.Core; + +public class JwtHandler : AppAuthorizeHandler +{ + public override Task PipelineAsync(AuthorizationHandlerContext context, DefaultHttpContext httpContext) + { + // 这里写您的授权判断逻辑,授权通过返回 true,否则返回 false + + return Task.FromResult(true); + } +} diff --git a/backend/BPA.MES.Base.Web.Core/Startup.cs b/backend/BPA.MES.Base.Web.Core/Startup.cs new file mode 100644 index 0000000..725e5bc --- /dev/null +++ b/backend/BPA.MES.Base.Web.Core/Startup.cs @@ -0,0 +1,52 @@ +using BPA.MES.Base.Core; +using Furion; +using Microsoft.AspNetCore.Builder; +using Microsoft.AspNetCore.Hosting; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Hosting; +using Yitter.IdGenerator; + +namespace BPA.MES.Base.Web.Core; + +public class Startup : AppStartup +{ + public void ConfigureServices(IServiceCollection services) + { + services.AddConsoleFormatter(); + services.AddJwt(); + + services.AddCorsAccessor(); + services.AddSqlsugarSetup(App.Configuration); + // 配置雪花Id算法机器码 + YitIdHelper.SetIdGenerator(new IdGeneratorOptions + { + WorkerId = 5 + }); + services.AddControllers() + .AddInjectWithUnifyResult(); + } + + public void Configure(IApplicationBuilder app, IWebHostEnvironment env) + { + if (env.IsDevelopment()) + { + app.UseDeveloperExceptionPage(); + } + + app.UseHttpsRedirection(); + + app.UseRouting(); + + app.UseCorsAccessor(); + + app.UseAuthentication(); + app.UseAuthorization(); + + app.UseInject(string.Empty); + + app.UseEndpoints(endpoints => + { + endpoints.MapControllers(); + }); + } +} diff --git a/backend/BPA.MES.Base.Web.Entry/BPA.MES.Base.Web.Entry.csproj b/backend/BPA.MES.Base.Web.Entry/BPA.MES.Base.Web.Entry.csproj new file mode 100644 index 0000000..b6729c3 --- /dev/null +++ b/backend/BPA.MES.Base.Web.Entry/BPA.MES.Base.Web.Entry.csproj @@ -0,0 +1,21 @@ + + + + + net6.0 + enable + en-US + true + + + + + + + + + + + + + diff --git a/backend/BPA.MES.Base.Web.Entry/BPA.MES.Base.Web.Entry.csproj.user b/backend/BPA.MES.Base.Web.Entry/BPA.MES.Base.Web.Entry.csproj.user new file mode 100644 index 0000000..4ba691b --- /dev/null +++ b/backend/BPA.MES.Base.Web.Entry/BPA.MES.Base.Web.Entry.csproj.user @@ -0,0 +1,9 @@ + + + + ProjectDebugger + + + BPA.MES.Base.Web.Entry + + \ No newline at end of file diff --git a/backend/BPA.MES.Base.Web.Entry/Program.cs b/backend/BPA.MES.Base.Web.Entry/Program.cs new file mode 100644 index 0000000..65ae485 --- /dev/null +++ b/backend/BPA.MES.Base.Web.Entry/Program.cs @@ -0,0 +1 @@ +Serve.Run(RunOptions.Default.WithArgs(args)); diff --git a/backend/BPA.MES.Base.Web.Entry/Properties/launchSettings.json b/backend/BPA.MES.Base.Web.Entry/Properties/launchSettings.json new file mode 100644 index 0000000..44bd64b --- /dev/null +++ b/backend/BPA.MES.Base.Web.Entry/Properties/launchSettings.json @@ -0,0 +1,31 @@ +{ + "$schema": "http://json.schemastore.org/launchsettings.json", + "iisSettings": { + "windowsAuthentication": false, + "anonymousAuthentication": true, + "iisExpress": { + "applicationUrl": "http://localhost:53785", + "sslPort": 44342 + } + }, + "profiles": { + "IIS Express": { + "commandName": "IISExpress", + "launchBrowser": true, + "launchUrl": "", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "BPA.MES.Base.Web.Entry": { + "commandName": "Project", + "dotnetRunMessages": true, + "launchBrowser": true, + "launchUrl": "", + "applicationUrl": "https://localhost:5001;http://localhost:5000", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + } + } +} \ No newline at end of file diff --git a/backend/BPA.MES.Base.Web.Entry/SingleFilePublish.cs b/backend/BPA.MES.Base.Web.Entry/SingleFilePublish.cs new file mode 100644 index 0000000..8f9d8ec --- /dev/null +++ b/backend/BPA.MES.Base.Web.Entry/SingleFilePublish.cs @@ -0,0 +1,22 @@ +using Furion; +using System.Reflection; + +namespace BPA.MES.Base.Web.Entry; + +public class SingleFilePublish : ISingleFilePublish +{ + public Assembly[] IncludeAssemblies() + { + return Array.Empty(); + } + + public string[] IncludeAssemblyNames() + { + return new[] + { + "BPA.MES.Base.Application", + "BPA.MES.Base.Core", + "BPA.MES.Base.Web.Core" + }; + } +} \ No newline at end of file diff --git a/backend/BPA.MES.Base.Web.Entry/appsettings.Development.json b/backend/BPA.MES.Base.Web.Entry/appsettings.Development.json new file mode 100644 index 0000000..5f187ae --- /dev/null +++ b/backend/BPA.MES.Base.Web.Entry/appsettings.Development.json @@ -0,0 +1,10 @@ +{ + "$schema": "https://gitee.com/dotnetchina/Furion/raw/v4/schemas/v4/furion-schema.json", + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning", + "Microsoft.EntityFrameworkCore": "Information" + } + } +} \ No newline at end of file diff --git a/backend/BPA.MES.Base.Web.Entry/appsettings.json b/backend/BPA.MES.Base.Web.Entry/appsettings.json new file mode 100644 index 0000000..5133041 --- /dev/null +++ b/backend/BPA.MES.Base.Web.Entry/appsettings.json @@ -0,0 +1,18 @@ +{ + "$schema": "https://gitee.com/dotnetchina/Furion/raw/v4/schemas/v4/furion-schema.json", + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning", + "Microsoft.EntityFrameworkCore": "Information" + } + }, + "AllowedHosts": "*", + "ConnectionConfigs": [ + { + "ConnectionString": "server=10.2.1.254;Port=3306;Database=bpa_mes_base;Uid=root;Pwd=BapAdmin123456.;", + "DbType": "MySql", + "IsAutoCloseConnection": true + } + ] +} \ No newline at end of file diff --git a/backend/BPA.MES.Base.sln b/backend/BPA.MES.Base.sln new file mode 100644 index 0000000..4571ecc --- /dev/null +++ b/backend/BPA.MES.Base.sln @@ -0,0 +1,43 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.3.32519.111 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPA.MES.Base.Application", "BPA.MES.Base.Application\BPA.MES.Base.Application.csproj", "{AB699EE9-43A8-46F2-A855-04A26DE63372}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPA.MES.Base.Web.Core", "BPA.MES.Base.Web.Core\BPA.MES.Base.Web.Core.csproj", "{9D14BB78-DA2A-4040-B9DB-5A515B599181}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPA.MES.Base.Core", "BPA.MES.Base.Core\BPA.MES.Base.Core.csproj", "{4FB30091-15C7-4FD9-AB7D-266814F360F5}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPA.MES.Base.Web.Entry", "BPA.MES.Base.Web.Entry\BPA.MES.Base.Web.Entry.csproj", "{C8D99F52-EDC7-411F-8300-6DB14BF59E8C}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {AB699EE9-43A8-46F2-A855-04A26DE63372}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {AB699EE9-43A8-46F2-A855-04A26DE63372}.Debug|Any CPU.Build.0 = Debug|Any CPU + {AB699EE9-43A8-46F2-A855-04A26DE63372}.Release|Any CPU.ActiveCfg = Release|Any CPU + {AB699EE9-43A8-46F2-A855-04A26DE63372}.Release|Any CPU.Build.0 = Release|Any CPU + {9D14BB78-DA2A-4040-B9DB-5A515B599181}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {9D14BB78-DA2A-4040-B9DB-5A515B599181}.Debug|Any CPU.Build.0 = Debug|Any CPU + {9D14BB78-DA2A-4040-B9DB-5A515B599181}.Release|Any CPU.ActiveCfg = Release|Any CPU + {9D14BB78-DA2A-4040-B9DB-5A515B599181}.Release|Any CPU.Build.0 = Release|Any CPU + {4FB30091-15C7-4FD9-AB7D-266814F360F5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {4FB30091-15C7-4FD9-AB7D-266814F360F5}.Debug|Any CPU.Build.0 = Debug|Any CPU + {4FB30091-15C7-4FD9-AB7D-266814F360F5}.Release|Any CPU.ActiveCfg = Release|Any CPU + {4FB30091-15C7-4FD9-AB7D-266814F360F5}.Release|Any CPU.Build.0 = Release|Any CPU + {C8D99F52-EDC7-411F-8300-6DB14BF59E8C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {C8D99F52-EDC7-411F-8300-6DB14BF59E8C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C8D99F52-EDC7-411F-8300-6DB14BF59E8C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {C8D99F52-EDC7-411F-8300-6DB14BF59E8C}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {B2073C2C-0FD3-452B-8047-8134D68E12CE} + EndGlobalSection +EndGlobal diff --git a/frontend/.editorconfig b/frontend/.editorconfig new file mode 100644 index 0000000..7e3649a --- /dev/null +++ b/frontend/.editorconfig @@ -0,0 +1,16 @@ +# http://editorconfig.org +root = true + +[*] +indent_style = space +indent_size = 2 +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true + +[*.md] +trim_trailing_whitespace = false + +[Makefile] +indent_style = tab diff --git a/frontend/.eslintignore b/frontend/.eslintignore new file mode 100644 index 0000000..8336e93 --- /dev/null +++ b/frontend/.eslintignore @@ -0,0 +1,8 @@ +/lambda/ +/scripts +/config +.history +public +dist +.umi +mock \ No newline at end of file diff --git a/frontend/.eslintrc.js b/frontend/.eslintrc.js new file mode 100644 index 0000000..3ac39ef --- /dev/null +++ b/frontend/.eslintrc.js @@ -0,0 +1,7 @@ +module.exports = { + extends: [require.resolve('@umijs/lint/dist/config/eslint')], + globals: { + page: true, + REACT_APP_ENV: true, + }, +}; diff --git a/frontend/.gitignore b/frontend/.gitignore new file mode 100644 index 0000000..0fb3670 --- /dev/null +++ b/frontend/.gitignore @@ -0,0 +1,41 @@ +# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. + +# dependencies +**/node_modules +# roadhog-api-doc ignore +/src/utils/request-temp.js +_roadhog-api-doc + +# production +/dist + +# misc +.DS_Store +npm-debug.log* +yarn-error.log + +/coverage +.idea +yarn.lock +package-lock.json +*bak +.vscode + + +# visual studio code +.history +*.log +functions/* +.temp/** + +# umi +.umi +.umi-production +.umi-test + +# screenshot +screenshot +.firebase +.eslintcache + +build diff --git a/frontend/.prettierignore b/frontend/.prettierignore new file mode 100644 index 0000000..7999ccd --- /dev/null +++ b/frontend/.prettierignore @@ -0,0 +1,22 @@ +**/*.svg +.umi +.umi-production +/dist +.dockerignore +.DS_Store +.eslintignore +*.png +*.toml +docker +.editorconfig +Dockerfile* +.gitignore +.prettierignore +LICENSE +.eslintcache +*.lock +yarn-error.log +.history +CNAME +/build +/public diff --git a/frontend/.prettierrc.js b/frontend/.prettierrc.js new file mode 100644 index 0000000..3447a1a --- /dev/null +++ b/frontend/.prettierrc.js @@ -0,0 +1,21 @@ +module.exports = { + singleQuote: true, + trailingComma: 'all', + printWidth: 100, + proseWrap: 'never', + endOfLine: 'lf', + overrides: [ + { + files: '.prettierrc', + options: { + parser: 'json', + }, + }, + { + files: 'document.ejs', + options: { + parser: 'html', + }, + }, + ], +}; diff --git a/frontend/README.md b/frontend/README.md new file mode 100644 index 0000000..4c89a72 --- /dev/null +++ b/frontend/README.md @@ -0,0 +1,57 @@ +# Ant Design Pro + +This project is initialized with [Ant Design Pro](https://pro.ant.design). Follow is the quick guide for how to use. + +## Environment Prepare + +Install `node_modules`: + +```bash +npm install +``` + +or + +```bash +yarn +``` + +## Provided Scripts + +Ant Design Pro provides some useful script to help you quick start and build with web project, code style check and test. + +Scripts provided in `package.json`. It's safe to modify or add additional script: + +### Start project + +```bash +npm start +``` + +### Build project + +```bash +npm run build +``` + +### Check code style + +```bash +npm run lint +``` + +You can also use script to auto fix some lint error: + +```bash +npm run lint:fix +``` + +### Test code + +```bash +npm test +``` + +## More + +You can view full document on our [official website](https://pro.ant.design). And welcome any feedback in our [github](https://github.com/ant-design/ant-design-pro). diff --git a/frontend/config/config.ts b/frontend/config/config.ts new file mode 100644 index 0000000..3a27d43 --- /dev/null +++ b/frontend/config/config.ts @@ -0,0 +1,126 @@ +// https://umijs.org/config/ +import { defineConfig } from '@umijs/max'; +import { join } from 'path'; +import defaultSettings from './defaultSettings'; +import proxy from './proxy'; +import routes from './routes'; + +const { REACT_APP_ENV = 'dev' } = process.env; + +export default defineConfig({ + /** + * @name 开启 hash 模式 + * @description 让 build 之后的产物包含 hash 后缀。通常用于增量发布和避免浏览器加载缓存。 + * @doc https://umijs.org/docs/api/config#hash + */ + history:{type:'hash'}, + hash: true, + + /** + * @name 兼容性设置 + * @description 设置 ie11 不一定完美兼容,需要检查自己使用的所有依赖 + * @doc https://umijs.org/docs/api/config#targets + */ + // targets: { + // ie: 11, + // }, + /** + * @name 路由的配置,不在路由中引入的文件不会编译 + * @description 只支持 path,component,routes,redirect,wrappers,title 的配置 + * @doc https://umijs.org/docs/guides/routes + */ + // umi routes: https://umijs.org/docs/routing + routes, + /** + * @name 主题的配置 + * @description 虽然叫主题,但是其实只是 less 的变量设置 + * @doc antd的主题设置 https://ant.design/docs/react/customize-theme-cn + * @doc umi 的theme 配置 https://umijs.org/docs/api/config#theme + */ + theme: { + // 如果不想要 configProvide 动态设置主题需要把这个设置为 default + // 只有设置为 variable, 才能使用 configProvide 动态设置主色调 + 'root-entry-name': 'variable', + }, + /** + * @name moment 的国际化配置 + * @description 如果对国际化没有要求,打开之后能减少js的包大小 + * @doc https://umijs.org/docs/api/config#ignoremomentlocale + */ + ignoreMomentLocale: false, + /** + * @name 代理配置 + * @description 可以让你的本地服务器代理到你的服务器上,这样你就可以访问服务器的数据了 + * @see 要注意以下 代理只能在本地开发时使用,build 之后就无法使用了。 + * @doc 代理介绍 https://umijs.org/docs/guides/proxy + * @doc 代理配置 https://umijs.org/docs/api/config#proxy + */ + proxy: proxy[REACT_APP_ENV as keyof typeof proxy], + /** + * @name 快速热更新配置 + * @description 一个不错的热更新组件,更新时可以保留 state + */ + fastRefresh: true, + //============== 以下都是max的插件配置 =============== + /** + * @name 数据流插件 + * @@doc https://umijs.org/docs/max/data-flow + */ + model: {}, + /** + * 一个全局的初始数据流,可以用它在插件之间共享数据 + * @description 可以用来存放一些全局的数据,比如用户信息,或者一些全局的状态,全局初始状态在整个 Umi 项目的最开始创建。 + * @doc https://umijs.org/docs/max/data-flow#%E5%85%A8%E5%B1%80%E5%88%9D%E5%A7%8B%E7%8A%B6%E6%80%81 + */ + initialState: {}, + /** + * @name layout 插件 + * @doc https://umijs.org/docs/max/layout-menu + */ + layout: { + locale: false, + ...defaultSettings, + }, + /** + * @name 国际化插件 + * @doc https://umijs.org/docs/max/i18n + */ + locale: { + + }, + /** + * @name antd 插件 + * @description 内置了 babel import 插件 + * @doc https://umijs.org/docs/max/antd#antd + */ + antd: {}, + /** + * @name moment2dayjs 插件 + * @description 将项目中的 moment 替换为 dayjs + * @doc https://umijs.org/docs/max/moment2dayjs + */ + moment2dayjs: { + preset: 'antd', + plugins: ['duration'], + }, + /** + * @name 网络请求配置 + * @description 它基于 axios 和 ahooks 的 useRequest 提供了一套统一的网络请求和错误处理方案。 + * @doc https://umijs.org/docs/max/request + */ + request: {}, + /** + * @name 权限插件 + * @description 基于 initialState 的权限插件,必须先打开 initialState + * @doc https://umijs.org/docs/max/access + */ + access: {}, + //================ pro 插件配置 ================= + presets: ['umi-presets-pro'], + keepalive: [/./], + tabsLayout: {}, + mfsu: { + strategy: 'normal', + }, + requestRecord: {}, +}); diff --git a/frontend/config/defaultSettings.ts b/frontend/config/defaultSettings.ts new file mode 100644 index 0000000..cef2514 --- /dev/null +++ b/frontend/config/defaultSettings.ts @@ -0,0 +1,28 @@ +import { Settings as LayoutSettings } from '@ant-design/pro-components'; + +/** + * @name + */ +const Settings: LayoutSettings & { + pwa?: boolean; + logo?: string; + title?:any +} = { + navTheme: 'light', + colorPrimary: '#13C2C2', + layout: 'mix', + contentWidth: 'Fluid', + fixedHeader: false, + fixSiderbar: true, + colorWeak: false, + title: "五芳斋中控管理系统", + menu: { + locale: false, // 禁用多语言功能 + }, + pwa: false, + splitMenus:false, + logo: './logo.png', + iconfontUrl: '', +}; + +export default Settings; diff --git a/frontend/config/proxy.ts b/frontend/config/proxy.ts new file mode 100644 index 0000000..e9b5b41 --- /dev/null +++ b/frontend/config/proxy.ts @@ -0,0 +1,16 @@ +/** + * @name 代理的配置 + * @see 在生产环境 代理是无法生效的,所以这里没有生产环境的配置 + * @doc https://umijs.org/docs/guides/proxy + */ +export default { + dev: { + '/api/': { + target: 'http://localhost:5000', + pathRewrite: { + '/api': '/api' + }, + changeOrigin: true, + } + } +}; diff --git a/frontend/config/routes.ts b/frontend/config/routes.ts new file mode 100644 index 0000000..abe0a2a --- /dev/null +++ b/frontend/config/routes.ts @@ -0,0 +1,20 @@ +export default [ + { path: '/user', layout: false, routes: [{ path: '/user/login', component: './user/login' }] }, + { path: '/', icon: 'SmileOutlined', component: './welcome',name:'欢迎页' }, + { path:'/logs',icon: 'SettingOutlined',name:'日志管理', + routes: [{ path: '/logs/log',name:'日志管理', component: './logs/index' }] + }, + { + icon: 'SettingOutlined', + path: '/system', + name:'系统管理', + routes: [ + { path: '/system/account',name:'账号管理', component: './system/account' }, + { path: '/system/user',name:'人员管理', component: './system/user' }, + { path: '/system/role',name:'角色管理', component: './system/role' }, + { path: '/system/module',name:'模块管理', component: './system/module' }, + { path: '/system/authTemplate',name:'权限管理', component: './system/authTemplate' }, + ], + }, + { path: '*', layout: false, component: './404' }, +]; diff --git a/frontend/jest.config.ts b/frontend/jest.config.ts new file mode 100644 index 0000000..1de2a1a --- /dev/null +++ b/frontend/jest.config.ts @@ -0,0 +1,23 @@ +import { configUmiAlias, createConfig } from '@umijs/max/test'; + +export default async () => { + const config = await configUmiAlias({ + ...createConfig({ + target: 'browser', + }), + }); + + console.log(); + return { + ...config, + testEnvironmentOptions: { + ...(config?.testEnvironmentOptions || {}), + url: 'http://localhost:8000', + }, + setupFiles: [...(config.setupFiles || []), './tests/setupTests.jsx'], + globals: { + ...config.globals, + localStorage: null, + }, + }; +}; diff --git a/frontend/jsconfig.json b/frontend/jsconfig.json new file mode 100644 index 0000000..197bee5 --- /dev/null +++ b/frontend/jsconfig.json @@ -0,0 +1,11 @@ +{ + "compilerOptions": { + "jsx": "react-jsx", + "emitDecoratorMetadata": true, + "experimentalDecorators": true, + "baseUrl": ".", + "paths": { + "@/*": ["./src/*"] + } + } +} diff --git a/frontend/package.json b/frontend/package.json new file mode 100644 index 0000000..e57cd81 --- /dev/null +++ b/frontend/package.json @@ -0,0 +1,103 @@ +{ + "name": "ant-design-pro", + "version": "6.0.0", + "license": "ISC", + "private": true, + "description": "An out-of-box UI solution for enterprise applications", + "scripts": { + "analyze": "cross-env ANALYZE=1 max build", + "build": "max build", + "deploy": "npm run build && npm run gh-pages", + "dev": "npm run start:dev", + "gh-pages": "gh-pages -d dist", + "i18n-remove": "pro i18n-remove --write", + "postinstall": "max setup", + "jest": "jest", + "lint": "npm run lint:js && npm run lint:prettier && npm run tsc", + "lint-staged": "lint-staged", + "lint-staged:js": "eslint --ext .js,.jsx,.ts,.tsx ", + "lint:fix": "eslint --fix --cache --ext .js,.jsx,.ts,.tsx --format=pretty ./src ", + "lint:js": "eslint --cache --ext .js,.jsx,.ts,.tsx --format=pretty ./src", + "lint:prettier": "prettier -c --write \"**/**.{js,jsx,tsx,ts,less,md,json}\" --end-of-line auto", + "openapi": "max openapi", + "prepare": "cd ../.. && husky install frontend/.husky", + "prettier": "prettier -c --write \"**/**.{js,jsx,tsx,ts,less,md,json}\"", + "preview": "npm run build && max preview --port 8000", + "record": "cross-env NODE_ENV=development REACT_APP_ENV=test max record --scene=login", + "serve": "umi-serve", + "start:mock": "cross-env UMI_ENV=dev max dev", + "start": "cross-env UMI_ENV=dev max dev", + "start:dev": "cross-env REACT_APP_ENV=dev MOCK=none UMI_ENV=dev max dev", + "start:no-mock": "cross-env MOCK=none UMI_ENV=dev max dev", + "start:pre": "cross-env REACT_APP_ENV=pre UMI_ENV=dev max dev", + "start:test": "cross-env REACT_APP_ENV=test MOCK=none UMI_ENV=dev max dev", + "test": "jest", + "test:coverage": "npm run jest -- --coverage", + "test:update": "npm run jest -- -u", + "tsc": "tsc --noEmit" + }, + "lint-staged": { + "**/*.{js,jsx,ts,tsx}": "npm run lint-staged:js", + "**/*.{js,jsx,tsx,ts,less,md,json}": [ + "prettier --write" + ] + }, + "browserslist": [ + "> 1%", + "last 2 versions", + "not ie <= 10" + ], + "dependencies": { + "@ant-design/icons": "^4.8.0", + "@ant-design/pro-components": "^2.3.44", + "@ant-design/pro-layout": "^7.8.3", + "@ant-design/use-emotion-css": "1.0.4", + "@umijs/route-utils": "^2.2.2", + "antd": "^5.2.3", + "classnames": "^2.3.2", + "eslint-config-prettier": "^8.6.0", + "eslint-plugin-unicorn": "^46.0.0", + "js-md5": "^0.7.3", + "lodash": "^4.17.21", + "moment": "^2.29.4", + "omit.js": "^2.0.2", + "rc-menu": "^9.8.1", + "rc-util": "^5.25.2", + "react": "^18.2.0", + "react-dev-inspector": "^1.8.3", + "react-dom": "^18.2.0", + "react-helmet-async": "^1.3.0" + }, + "devDependencies": { + "@ant-design/pro-cli": "^2.1.5", + "@testing-library/react": "^13.4.0", + "@types/classnames": "^2.3.1", + "@types/express": "^4.17.14", + "@types/history": "^4.7.11", + "@types/jest": "^29.2.4", + "@types/js-md5": "^0.7.0", + "@types/lodash": "^4.14.191", + "@types/react": "^17.0.52", + "@types/react-dom": "^17.0.18", + "@types/react-helmet": "^6.1.6", + "@umijs/lint": "^4.0.35", + "@umijs/max": "^4.0.55", + "cross-env": "^7.0.3", + "eslint": "^8.29.0", + "express": "^4.18.2", + "gh-pages": "^3.2.3", + "husky": "^7.0.4", + "jest": "^29.3.1", + "jest-environment-jsdom": "^29.3.1", + "lint-staged": "^10.5.4", + "mockjs": "^1.1.0", + "prettier": "^2.8.1", + "swagger-ui-dist": "^4.15.5", + "ts-node": "^10.9.1", + "typescript": "^4.9.4", + "umi-presets-pro": "^2.0.0" + }, + "engines": { + "node": ">=12.0.0" + } +} diff --git a/frontend/playwright.config.ts b/frontend/playwright.config.ts new file mode 100644 index 0000000..ec1b31d --- /dev/null +++ b/frontend/playwright.config.ts @@ -0,0 +1,22 @@ +// playwright.config.ts +import type { PlaywrightTestConfig } from '@playwright/test'; +import { devices } from '@playwright/test'; + +const config: PlaywrightTestConfig = { + forbidOnly: !!process.env.CI, + retries: process.env.CI ? 2 : 0, + use: { + trace: 'on-first-retry', + }, + projects: [ + { + name: 'chromium', + use: { ...devices['Desktop Chrome'] }, + }, + { + name: 'firefox', + use: { ...devices['Desktop Firefox'] }, + }, + ], +}; +export default config; diff --git a/frontend/public/03.gif b/frontend/public/03.gif new file mode 100644 index 0000000..a8ff828 Binary files /dev/null and b/frontend/public/03.gif differ diff --git a/frontend/public/CNAME b/frontend/public/CNAME new file mode 100644 index 0000000..30c2d4d --- /dev/null +++ b/frontend/public/CNAME @@ -0,0 +1 @@ +preview.pro.ant.design \ No newline at end of file diff --git a/frontend/public/favicon.ico b/frontend/public/favicon.ico new file mode 100644 index 0000000..e2e9325 Binary files /dev/null and b/frontend/public/favicon.ico differ diff --git a/frontend/public/icons/icon-128x128.png b/frontend/public/icons/icon-128x128.png new file mode 100644 index 0000000..48d0e23 Binary files /dev/null and b/frontend/public/icons/icon-128x128.png differ diff --git a/frontend/public/icons/icon-192x192.png b/frontend/public/icons/icon-192x192.png new file mode 100644 index 0000000..938e9b5 Binary files /dev/null and b/frontend/public/icons/icon-192x192.png differ diff --git a/frontend/public/icons/icon-512x512.png b/frontend/public/icons/icon-512x512.png new file mode 100644 index 0000000..21fc108 Binary files /dev/null and b/frontend/public/icons/icon-512x512.png differ diff --git a/frontend/public/logo.png b/frontend/public/logo.png new file mode 100644 index 0000000..00bb72d Binary files /dev/null and b/frontend/public/logo.png differ diff --git a/frontend/public/logo.svg b/frontend/public/logo.svg new file mode 100644 index 0000000..239bf69 --- /dev/null +++ b/frontend/public/logo.svg @@ -0,0 +1 @@ +Group 28 Copy 5Created with Sketch. \ No newline at end of file diff --git a/frontend/public/nc.png b/frontend/public/nc.png new file mode 100644 index 0000000..2dcd410 Binary files /dev/null and b/frontend/public/nc.png differ diff --git a/frontend/public/pro_icon.svg b/frontend/public/pro_icon.svg new file mode 100644 index 0000000..e075b78 --- /dev/null +++ b/frontend/public/pro_icon.svg @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/frontend/src/api/AuthTemplate.ts b/frontend/src/api/AuthTemplate.ts new file mode 100644 index 0000000..31fe56d --- /dev/null +++ b/frontend/src/api/AuthTemplate.ts @@ -0,0 +1,119 @@ +import { request } from '@umijs/max'; + +/** + * 授权模板 + */ +export default { + /** + * 创建授权模板 + * @param params + * @returns + */ + SaveCreateAuthTemp(params: AuthTemplateTypes.AuthTemplateType) { + return request('/api/authorize/AddAuthorTemp', { + method: 'POST', + data: { + ...params + } + }); + }, + + /** + * 删除授权模板 + * @param params + * @returns + */ + DeleteAuthTemp(id: string) { + return request(`/api/authorize/RemoveAuthorTemp?input=${id}`, { + method: 'GET' + }); + }, + + /** + * 修改授权模板 + * @param params + * @returns + */ + SaveModifyAuthTemp(params: AuthTemplateTypes.AuthTemplateType) { + return request('/api/authorize/EditAuthorTemp', { + method: 'POST', + data: { + ...params + } + }); + }, + + /** + * 授权模板分页查询 + * @param params + * @returns + */ + GetPagedListAuthTemp(params: AuthTemplateTypes.PageParams) { + return request('/api/authorize/QueryAuthorTemp', { + method: 'POST', + data: { + ...params + } + }); + }, + + /** + * 模板 授权模块 + */ + SaveUpdateItems(params: AuthTemplateTypes.TempAuthModule) { + return request('/api/authorize/EditTemplateItem', { + method: 'POST', + data: { + ...params + } + }); + }, + + /** + * 根据模板ID 查询已授权用户|角色 + * @param params + * @returns + */ + GetauthorizeObjects(params: AuthTemplateTypes.AuthObjectParams) { + return request('/api/authorize/GetauthorizeObjects', { + method: 'POST', + data: { + ...params + } + }); + }, + + /** + * 添加授权 + */ + Addauthorize(params: AuthTemplateTypes.AddAuthParams) { + return request('/api/authorize/Addauthorize', { + method: 'POST', + data: { + ...params + } + }); + }, + + /** + * 移除授权 + */ + Removeauthorize(params: AuthTemplateTypes.RemoveAuthParams) { + return request('/api/authorize/Removeauthorize', { + method: 'POST', + data: { + ...params + } + }); + }, + + /** + * 获取授权模板列表 + * @param templateId + */ + GetModules(templateId: string) { + return request(`/api/authorize/GetModuleByTemplateId?input=${templateId}`, { + method: 'GET' + }); + } +} \ No newline at end of file diff --git a/frontend/src/api/DeviceInfo.ts b/frontend/src/api/DeviceInfo.ts new file mode 100644 index 0000000..784f38f --- /dev/null +++ b/frontend/src/api/DeviceInfo.ts @@ -0,0 +1,112 @@ +import { request } from '@umijs/max'; + + +export default { + /** + * 新增 + * @param parms + * @returns + */ + Add(parms: DeviceTypes.Info) { + return request('/api/devicesinfo/add', { + method: 'POST', + data: { + ...parms, + }, + }); + }, + /** + * 删除 + * @param parms + * @returns + */ + Del(parms: DeviceTypes.Info) { + return request(`/api/devicesinfo/del`, { + method: 'POST', + data: { + ...parms, + }, + }); + }, + /** + * 修改 + * @param parms + * @returns + */ + Update(parms: DeviceTypes.Info) { + return request('/api/devicesinfo/update', { + method: 'POST', + data: { + ...parms, + }, + }); + }, + /** + * 详情 + * @param parms + * @returns + */ + Detail(id: string) { + return request(`/api/devicesinfo/detail?id=${id}`, { + method: 'GET' + }); + }, + /** + * 获取列表 + * @param parms + * @returns + */ + List() { + return request('/api/devicesinfo/list', { + method: 'POST' + }); + }, + /** + * 未绑定的设备列表 + * @param parms + * @returns + */ + UnBindList() { + return request('/api/devicesinfo/UnBindList', { + method: 'GET' + }); + + }, + /** + * 分页查询 + * @param parms + * @returns + */ + PagedList(parms: DeviceTypes.Info) { + return request('/api/devicesinfo/pagedlist', { + method: 'POST', + data: { + ...parms, + }, + }); + }, + /** + * 批量更新 + * @param parms + * @returns + */ + BatchUpdate(parms: DeviceTypes.BatchAdd) { + return request('/api/devicerecipe/batchupdate', { + method: 'POST', + data: parms + }); + }, + /** + * 根据设备Id查询配方信息 + * @param parms + * @returns + */ + RecipeList(id: string){ + return request(' api/devicerecipe/list', { + method: 'POST', + data: { + deviceId: id + } + }); + } +} \ No newline at end of file diff --git a/frontend/src/api/Material.ts b/frontend/src/api/Material.ts new file mode 100644 index 0000000..6f0df94 --- /dev/null +++ b/frontend/src/api/Material.ts @@ -0,0 +1,334 @@ +import { request } from '@umijs/max'; + +export default { + /** + * 物料列表 + * @param params + * @returns + */ + MaterialList(params: MaterialTypes.MaterialPageListParams) { + return request('/erp/material/Material/GetMaterialPage', { + method: 'POST', + data: { + ...params + } + }); + }, + + /** + * 根据Id获取物料信息 + * @param id + */ + GetMaterialById(id: string) { + return request(`/erp/material/Material/GetMaterialById?id=${id}`, { + method: 'GET' + }); + }, + + /** + * 新增物料 + * @param params + * @returns + */ + AddMaterial(params: MaterialTypes.MaterialItemEA) { + return request('/erp/material/Material/AddMaterial', { + method: 'POST', + data: { + ...params + } + }); + }, + + /** + * 修改物料 + * @param params + * @returns + */ + UpdateMaterial(params: MaterialTypes.MaterialItemEA) { + return request('/erp/material/Material/UpdateMaterial', { + method: 'POST', + data: { + ...params + } + }); + }, + + /** + * 修改物料价格 + * @param params + * @returns + */ + UpdateMateriaPrice(params: MaterialTypes.MaterialPriceParams) { + return request('/erp/material/Material/UpdateMateriaPrice', { + method: 'POST', + data: { + ...params + } + }); + }, + + + /** + * 扩展属性分页列表 + * @param params + * @returns + */ + GetExtendAttributePage(params: MaterialTypes.ExtendAttributePageParams) { + return request('/erp/material/ExtendAttribute/GetExtendAttributePage', { + method: 'POST', + data: { + ...params + } + }); + }, + + /** + * 添加扩展属性 + * @param params + * @returns + */ + AddExtendAttribute(params: MaterialTypes.ExtendAttributeItem) { + return request('/erp/material/ExtendAttribute/AddExtendAttribute', { + method: 'POST', + data: { + ...params + } + }); + }, + + /** + * 修改扩展属性 + * @param params + */ + UpdateExtendAttribute(params: MaterialTypes.ExtendAttributeItem) { + return request('/erp/material/ExtendAttribute/UpdateExtendAttribute', { + method: 'POST', + data: { + ...params + } + }); + }, + + /** + * 根据获取扩展属性id获取扩展属性 + * @param id + * @returns + */ + GetExtendAttributeById(id: string) { + return request(`/erp/material/ExtendAttribute/GetExtendAttributeById?id=${id}`, { + method: 'GET' + }); + }, + + /** + * 根据物料ID查询物料扩展属性列表 + * @param materialId + * @returns + */ + GetMaterialExtendAttributeById(materialId: string) { + return request(`/erp/material/MaterialExtend/GetMaterialExtendAttributeById?input=${materialId}`, { + method: 'GET' + }); + }, + + /** + * 新增物料的扩展属性信息 + * @param params + * @returns + */ + AddMaterialExtendAttribute(params: MaterialTypes.MaterialExtendAttributeItem) { + return request('/erp/material/MaterialExtend/AddMaterialExtendAttribute', { + method: 'POST', + data: { + ...params + } + }); + }, + + /** + * 编辑物料的扩展属性信息 + * @param params + */ + UpdateMaterialExtendAttribute(params: MaterialTypes.MaterialExtendAttributeItem) { + return request('/erp/material/MaterialExtend/UpdateMaterialExtendAttribute', { + method: 'POST', + data: { + ...params + } + }); + }, + + /** + * 获取物料类型分页列表 + * @param params + */ + GetMaterialTypePage(params: MaterialTypes.MaterialTypeParams) { + return request('/erp/material/MaterialType/GetMaterialTypePage', { + method: 'POST', + data: { + ...params + } + }); + }, + + /** + * 新增物料类型 + * @param params + * @returns + */ + AddMaterialType(params: MaterialTypes.MaterialType) { + return request('/erp/material/MaterialType/AddMaterialType', { + method: 'POST', + data: { + ...params + } + }); + }, + + /** + * 更新物料类型 + * @param params + * @returns + */ + UpdateMaterialType(params: MaterialTypes.MaterialType) { + return request('/erp/material/MaterialType/UpdateMaterialType', { + method: 'POST', + data: { + ...params + } + }); + }, + + /** + * 根据物料类型Id获取物料的拓展信息 + * @param id + */ + GetMaterialTypeExtendAttributeById(id: string) { + return request(`/erp/material/MaterialType/GetMaterialTypeExtendAttributeById?Id=${id}`, { + method: 'GET' + }); + }, + + /** + * 新增物料类型的拓展信息 + * @param params + * @returns + */ + AddMaterialTypeExtendAttribute(params: MaterialTypes.MaterialTypeExtend) { + return request('/erp/material/MaterialTypeExtend/AddMaterialTypeExtendAttribute', { + method: 'POST', + data: { + ...params + } + }); + }, + + /** + * 更新物料类型扩展信息 + * @param params + * @returns + */ + UpdateMaterialTypeExtendAttribute(params: MaterialTypes.MaterialTypeExtend) { + return request('/erp/material/MaterialTypeExtend/UpdateMaterialTypeExtendAttribute', { + method: 'POST', + data: { + ...params + } + }); + }, + + /** + * 根据物料Id查询物料的修改记录 + * @param params + * @returns + */ + MeterialModifyPage(params: MaterialTypes.MaterialModifyPageParams) { + return request(`/erp/material/MeterialModify/MeterialModifyPage`, { + method: 'POST', + data: { + ...params + } + }); + }, + + /** + * 新增物料修改记录 + * @param params + * @returns + */ + AddMeterialModify(params: MaterialTypes.MaterialModify) { + return request('/erp/material/MeterialModify/AddMeterialModify', { + method: 'POST', + data: { + ...params + } + }); + }, + + /** + * 根据物料Id获取物料单位的换算列表 + * @param id + * @returns + */ + GetUnitTransformationsById(id: string) { + return request(`/erp/material/UnitTransformation/GetUnitTransformationsById?Id=${id}`, { + method: 'GET' + }); + }, + + /** + * 添加物料换算 + * @param params + * @returns + */ + AddUnitTransformation(params: MaterialTypes.MaterialUnitTransform) { + return request('/erp/material/UnitTransformation/AddUnitTransformation', { + method: 'POST', + data: { + ...params + } + }); + }, + + /** + * 编辑物料换算 + * @param params + * @returns + */ + UpdateUnitTransformation(params: MaterialTypes.MaterialUnitTransform) { + return request('/erp/material/UnitTransformation/UpdateUnitTransformation', { + method: 'POST', + data: { + ...params + } + }); + }, + + + /** + * 导出物料模板 + * @param materialTypeId + * @returns + */ + MaterialTemplateExport(materialTypeId: string) { + return request(`/erp/material/Material/MaterialTemplateExport?materialTypeId=${materialTypeId}`, { + method: 'GET', + responseType: 'blob' + }); + }, + + /** + * 导出物料数据 + * @param params + * @returns + */ + MaterialDataExport(params: MaterialTypes.ExportMaterialParams) { + return request('/erp/material/Material/MaterialDataExport', { + method: 'POST', + responseType: 'blob', + data: { + ...params + } + }); + } +} \ No newline at end of file diff --git a/frontend/src/api/ModuleAPI.ts b/frontend/src/api/ModuleAPI.ts new file mode 100644 index 0000000..bf6cf08 --- /dev/null +++ b/frontend/src/api/ModuleAPI.ts @@ -0,0 +1,45 @@ +import { request } from '@umijs/max'; + +/** + * 模块相关接口 + */ +export default { + + //创建模块 + SaveCreateModule(params: ModuleTypes.ModuleType) { + return request('/api/authorize/addmodule', { + method: 'POST', + data: { + ...params + } + }); + }, + + //获取模块视图 + GetTreeGridModule(params: ModuleTypes.ModuleType) { + return request(`/api/authorize/gettreegrid`, { + method: 'POST', + data:{ + ...params + } + }); + }, + + //修改模块 + SaveModifyModule(params: ModuleTypes.ModuleType) { + return request('/api/authorize/editmodule', { + method: 'POST', + data: { + ...params + } + }); + }, + + //删除模块 + DeleteModule(id: string) { + return request(`/api/authorize/removemodule?input=${id}`, { + method: 'GET' + }); + }, + +} \ No newline at end of file diff --git a/frontend/src/api/Role.ts b/frontend/src/api/Role.ts new file mode 100644 index 0000000..dfe03fe --- /dev/null +++ b/frontend/src/api/Role.ts @@ -0,0 +1,52 @@ +import { request } from '@umijs/max'; + +export default { + //创建角色 + CreateRole(parms: RolelTypes.RoleType) { + return request('/api/authorize/AddRole', { + method: 'POST', + data: { + ...parms, + }, + }); + }, + + //删除角色 + DeleteRole(id: string) { + return request(`/api/authorize/RemoveRole?input=${id}`, { + method: 'GET' + }); + }, + + //修改角色 + ModifyRole(parms: RolelTypes.RoleType) { + return request('/api/authorize/EditRole', { + method: 'POST', + data: { + ...parms, + }, + }); + }, + + + //获取角色列表 + GetRoleList() { + return request('/api/authorize/GetRoleList', { + method: 'GET', + }); + }, + + /** + * 角色分页查询 + * @param parms + * @returns + */ + GetRolePagedList(parms: RolelTypes.RolePageParams) { + return request('/api/authorize/QueryRole', { + method: 'POST', + data: { + ...parms, + }, + }); + } +} \ No newline at end of file diff --git a/frontend/src/api/User.ts b/frontend/src/api/User.ts new file mode 100644 index 0000000..4e9f7cd --- /dev/null +++ b/frontend/src/api/User.ts @@ -0,0 +1,110 @@ +import { request } from '@umijs/max'; + +export default { + //登录 + Login(parms: UserTypes.LoginParams) { + return request('/api/authorize/login', { + method: 'POST', + data: { + ...parms + } + }); + }, + + //新增人员 + CreateUser(params: UserTypes.PersonnelType) { + return request('/api/authorize/addemployee', { + method: 'POST', + data: { + ...params, + }, + }); + }, + + //修改人员信息 + ModifyUser(params: UserTypes.PersonnelType) { + return request('/api/authorize/editemployee', { + method: 'POST', + data: { + ...params, + }, + }); + }, + + + //根据用户ID查询用户信息 + GetUserById(id: string) { + return request(`/api/base/user/getuserbyid?id=${id}`, { + method: 'GET', + }); + }, + + //人员分页查询 + GetUserPagedList(params: UserTypes.UserPageParams) { + return request('/api/authorize/queryemployee', { + method: 'POST', + data: { + ...params, + }, + }); + }, + + /** + * 获取用户已授权菜单 + */ + GetUserAuthInfo() { + return request('/api/base/authorize/getuserinfo', { + method: 'POST', + }); + }, + + GetUserInfo() { + return request('/api/authorize/getuserinfo', { + method: 'GET', + }); + }, + /** + * 删除用户 + * @param params + */ + RemoveUser(employeeId:string){ + return request(`/api/authorize/removeemployee?employeeId=${employeeId}`, { + method: 'GET' + }); + }, + /** + * 绑定账户 + * @param params + */ + BindAccount(params: Account.TBAccountDTO) { + return request('/api/authorize/addaccountbyuser', { + method: 'POST', + data: { + ...params, + }, + }); + }, + /** + * 重置账户 + * @param params + * @returns + */ + RestoreAccount(params: string) { + return request(`/api/authorize/restoreaccountbyuser?input=${params}`, { + method: 'GET', + }); + }, + /** + * 编辑密码 + * @param params + * @returns + */ + EditPwd(params: Account.TBAccountPwdDTO) { + return request(`/api/authorize/editaccountpwd`, { + method: 'POST', + data: { + ...params, + }, + }); + } +} \ No newline at end of file diff --git a/frontend/src/api/accountService.ts b/frontend/src/api/accountService.ts new file mode 100644 index 0000000..0263d02 --- /dev/null +++ b/frontend/src/api/accountService.ts @@ -0,0 +1,52 @@ +import { request } from '@umijs/max'; + + +export default { + //创建 + Add(parms: Account.TBAccountDTO) { + return request('/api/authorize/add', { + method: 'POST', + data: { + ...parms, + }, + }); + }, + //删除 + Del(parms: Account.TBAccountDTO) { + return request(`/api/authorize/del`, { + method: 'POST', + data: { + ...parms, + }, + }); + }, + //修改 + Update(parms: Account.TBAccountDTO) { + return request('/api/authorize/update', { + method: 'POST', + data: { + ...parms, + }, + }); + }, + //列表 + List() { + return request('/api/authorize/list', { + method: 'POST', + }); + }, + /** + * 分页查询 + * @param parms + * @returns + */ + PagedList(parms: Account.TBAccountDTO) { + return request('/api/authorize/accountpagelist', { + method: 'POST', + data: { + ...parms, + }, + }); + } +} + diff --git a/frontend/src/api/groupService.ts b/frontend/src/api/groupService.ts new file mode 100644 index 0000000..4d35ded --- /dev/null +++ b/frontend/src/api/groupService.ts @@ -0,0 +1,52 @@ +import { request } from '@umijs/max'; + + +export default { + //创建 + Add(parms: GroupInfoTypes.Info) { + return request('/api/groupinfo/add', { + method: 'POST', + data: { + ...parms, + }, + }); + }, + //删除 + Del(parms: GroupInfoTypes.Info) { + return request(`/api/groupinfo/del`, { + method: 'POST', + data: { + ...parms, + }, + }); + }, + //修改 + Update(parms: GroupInfoTypes.Info) { + return request('/api/groupinfo/update', { + method: 'POST', + data: { + ...parms, + }, + }); + }, + //列表 + List() { + return request('/api/groupinfo/list', { + method: 'POST', + }); + }, + /** + * 分页查询 + * @param parms + * @returns + */ + PagedList(parms: GroupInfoTypes.Page) { + return request('/api/groupinfo/pagedlist', { + method: 'POST', + data: { + ...parms, + }, + }); + } +} + diff --git a/frontend/src/api/materialService.ts b/frontend/src/api/materialService.ts new file mode 100644 index 0000000..c89a6dd --- /dev/null +++ b/frontend/src/api/materialService.ts @@ -0,0 +1,59 @@ + + +import { request } from '@umijs/max'; + + +export default { + //创建 + Add(parms: MaterialsTypes.MaterialsInfo) { + return request('/api/materialsinfo/add', { + method: 'POST', + data: { + ...parms, + }, + }); + }, + + //删除 + Del(parms: MaterialsTypes.MaterialsInfo) { + return request(`/api/materialsinfo/del`, { + method: 'POST', + data: { + ...parms, + }, + }); + }, + + //修改 + Update(parms: MaterialsTypes.MaterialsInfo) { + return request('/api/materialsinfo/update', { + method: 'POST', + data: { + ...parms, + }, + }); + }, + + + //获取列表 + List() { + return request('/api/materialsinfo/list', { + method: 'GET', + }); + }, + + /** + * 分页查询 + * @param parms + * @returns + */ + PagedList(parms: MaterialsTypes.MaterialsPage) { + return request('/api/materialsinfo/pagedlist', { + method: 'POST', + data: { + ...parms, + }, + }); + } +} + diff --git a/frontend/src/api/recipeService.ts b/frontend/src/api/recipeService.ts new file mode 100644 index 0000000..9619b80 --- /dev/null +++ b/frontend/src/api/recipeService.ts @@ -0,0 +1,83 @@ +import { request } from '@umijs/max'; + + +export default { + //创建 + Add(parms: RecipeTypes.Info) { + return request('/api/recipesinfo/add', { + method: 'POST', + data: { + ...parms, + }, + }); + }, + //删除 + Del(parms: RecipeTypes.Info) { + return request(`/api/recipesinfo/del`, { + method: 'POST', + data: { + ...parms, + }, + }); + }, + + //修改角色 + Update(parms: RecipeTypes.Info) { + return request('/api/recipesinfo/update', { + method: 'POST', + data: { + ...parms, + }, + }); + }, + + + //获取角色列表 + List() { + return request('/api/recipesinfo/list', { + method: 'GET', + }); + }, + + /** + * 角色分页查询 + * @param parms + * @returns + */ + PagedList(parms: RecipeTypes.Page) { + return request('/api/recipesinfo/pagedlist', { + method: 'POST', + data: { + ...parms, + }, + }); + }, + /** + * 获取配方物料列表 + * @param parms + * @returns + */ + MaterialList(parms:RecipeMaterialTypes.Info ){ + return request('/api/recipematerial/list', { + method: 'POST', + data: { + ...parms, + }, + }); + }, + //批量创建物料信息 + BatchAdd(parms: RecipeMaterialTypes.Info[]){ + return request('/api/recipematerial/batchadd', { + method: 'POST', + data: parms + }); + }, + //更改分组 + ChangeGroup(parms: RecipeTypes.RecipesGroupInput){ + return request('/api/recipesinfo/changegroup', { + method: 'POST', + data: parms + }); + } +} + diff --git a/frontend/src/api/storeService.ts b/frontend/src/api/storeService.ts new file mode 100644 index 0000000..f3d1d1a --- /dev/null +++ b/frontend/src/api/storeService.ts @@ -0,0 +1,59 @@ + + +import { request } from '@umijs/max'; + + +export default { + //创建 + Add(parms: StoreTypes.StoreInfo) { + return request('/api/storeinfo/add', { + method: 'POST', + data: { + ...parms, + }, + }); + }, + + //删除 + Del(parms: StoreTypes.StoreInfo) { + return request(`/api/storeinfo/del`, { + method: 'POST', + data: { + ...parms, + }, + }); + }, + + //修改角色 + Update(parms: StoreTypes.StoreInfo) { + return request('/api/storeinfo/update', { + method: 'POST', + data: { + ...parms, + }, + }); + }, + + + //获取角色列表 + List() { + return request('/api/storeinfo/list', { + method: 'GET', + }); + }, + + /** + * 角色分页查询 + * @param parms + * @returns + */ + PagedList(parms: StoreTypes.StoreInfo) { + return request('/api/storeinfo/pagedlist', { + method: 'POST', + data: { + ...parms, + }, + }); + } +} + diff --git a/frontend/src/app.tsx b/frontend/src/app.tsx new file mode 100644 index 0000000..5c156a9 --- /dev/null +++ b/frontend/src/app.tsx @@ -0,0 +1,141 @@ +import Footer from '@/components/Footer'; +import type { MenuDataItem, Settings as LayoutSettings } from '@ant-design/pro-components'; +import type { RunTimeLayoutConfig } from '@umijs/max'; +import defaultSettings from '../config/defaultSettings'; +import { errorConfig } from './requestErrorConfig'; +import HeaderRight from './components/HeaderRight'; +import { history } from '@umijs/max'; +import UserAPI from '@/api/User'; +import React from 'react'; +import * as Icon from '@ant-design/icons'; +const isDev = process.env.NODE_ENV === 'development'; + +const loopMenuItem = (menus: MenuDataItem[]): MenuDataItem[] => { + return menus?.map(({ icon, routes, ...item }) => ({ + ...item, + icon: icon && React.createElement(Icon[icon as string]), + routes: routes && loopMenuItem(routes), + })); +}; + +const formartRoutes = (menuTree: any[]) => { + menuTree.forEach((item) => { + item.path = item.url; + if (item.children && item.children.length > 0 && item.category < 2) { + formartRoutes(item.children); + } else { + delete item.children; + } + }); + return menuTree; +}; + +/** + * @see https://umijs.org/zh-CN/plugins/plugin-initial-state + * */ +export async function getInitialState(): Promise<{ + settings?: Partial; + fetchUserInfo: () => any; + menuData: any[]; + currentUser: any; +}> { + const fetchUserInfo = async () => { + const response:MyResponse.Content = await UserAPI.GetUserInfo(); + if (response.statusCode===200) { + console.log('response',response); + + return response.data; + } + return null; + }; + const response = await fetchUserInfo(); + if (response) { + localStorage.setItem('USER_INFO', JSON.stringify(response.userInfo)); + localStorage.setItem('USER_MENU', JSON.stringify(response.menus)); + return { + menuData: formartRoutes(response.menus), + currentUser: response.userInfo, + fetchUserInfo, + settings: defaultSettings, + }; + } + return { + menuData: [], + currentUser: null, + fetchUserInfo, + settings: defaultSettings, + }; +} +// ProLayout 支持的api https://procomponents.ant.design/components/layout +export const layout: RunTimeLayoutConfig = ({ initialState }) => { + const config: any = { + rightContentRender: () => , + waterMarkProps: { + content: '黑菠萝科技研发部', + }, + token: { + colorBgAppListIconHover: 'rgba(0,0,0,0.06)', + colorTextAppListIconHover: 'rgba(255,255,255,0.95)', + colorTextAppListIcon: 'rgba(255,255,255,0.85)', + sider: { + colorBgCollapsedButton: '#13C2C2', + colorTextCollapsedButtonHover: 'rgba(0,0,0,0.65)', + colorTextCollapsedButton: 'rgba(0,0,0,0.45)', + colorMenuBackground: '#000', + colorBgMenuItemCollapsedHover: 'rgba(0,0,0,0.06)', + colorBgMenuItemCollapsedSelected: '#13C2C2', + colorMenuItemDivider: 'rgba(255,255,255,0.15)', + colorBgMenuItemHover: '#F5222D', + colorBgMenuItemSelected: '#13C2C2', + colorTextMenuSelected: '#fff', + colorTextMenuItemHover: 'rgba(255,255,255,0.75)', + colorTextMenu: 'rgba(255,255,255,0.75)', + colorTextMenuSecondary: 'rgba(255,255,255,0.65)', + colorTextMenuTitle: 'rgba(255,255,255,0.95)', + colorTextMenuActive: 'rgba(255,255,255,0.95)', + colorTextSubMenuSelected: '#fff', + }, + header: { + colorBgHeader: '#000000', + colorMenuBackground: '#fff', + colorHeaderTitle: '#13C2C2', + }, + }, + footerRender: () =>