From 26f79abb03e3ab39c77c023075d734705138e8c0 Mon Sep 17 00:00:00 2001
From: zhaoxinyu <89237069@qq.com>
Date: Mon, 26 Feb 2024 11:29:26 +0800
Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=99=A8=E5=85=B7=E5=8A=9F?=
=?UTF-8?q?=E8=83=BD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../Equipments/DTOs/EquipmentDTO.cs | 58 +++++
.../DTOs/EquipmentForDongyangExportDTO.cs | 53 ++++
.../Equipments/EquipmentPermissions.cs | 21 ++
.../Equipments/IEquipmentAppService.cs | 28 +++
.../Equipments/Inputs/EquipmentCheckInput.cs | 55 ++++
.../Equipments/Inputs/EquipmentEditInput.cs | 228 +++++++++++++++++
.../Equipments/Inputs/EquipmentImportInput.cs | 56 +++++
.../BasedataApplicationAutoMapperProfile.cs | 1 +
.../Equipments/EquipmentAppService.cs | 236 ++++++++++++++++++
.../Equipments/EquipmentAutoMapperProfile.cs | 33 +++
.../Win_in.Sfs.Basedata.Application.csproj | 2 +-
.../Equipments/Equipment.cs | 160 ++++++++++++
.../Equipments/EquipmentManager.cs | 29 +++
.../Equipments/EquipmentValidator.cs | 92 +++++++
.../Equipments/IEquipmentManager.cs | 8 +
.../Equipments/IEquipmentRepository.cs | 13 +
.../BasedataDbContext.cs | 4 +-
...asedataDbContextModelCreatingExtensions.cs | 1 +
.../BasedataEntityFrameworkCoreModule.cs | 1 +
...uipmentDbContextModelCreatingExtensions.cs | 41 +++
.../Equipments/EquipmentEfCoreRepository.cs | 70 ++++++
...in.Sfs.Basedata.EntityFrameworkCore.csproj | 4 +
22 files changed, 1190 insertions(+), 4 deletions(-)
create mode 100644 be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/Equipments/DTOs/EquipmentDTO.cs
create mode 100644 be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/Equipments/DTOs/EquipmentForDongyangExportDTO.cs
create mode 100644 be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/Equipments/EquipmentPermissions.cs
create mode 100644 be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/Equipments/IEquipmentAppService.cs
create mode 100644 be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/Equipments/Inputs/EquipmentCheckInput.cs
create mode 100644 be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/Equipments/Inputs/EquipmentEditInput.cs
create mode 100644 be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/Equipments/Inputs/EquipmentImportInput.cs
create mode 100644 be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/Equipments/EquipmentAppService.cs
create mode 100644 be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/Equipments/EquipmentAutoMapperProfile.cs
create mode 100644 be/Modules/BaseData/src/Win_in.Sfs.Basedata.Domain/Equipments/Equipment.cs
create mode 100644 be/Modules/BaseData/src/Win_in.Sfs.Basedata.Domain/Equipments/EquipmentManager.cs
create mode 100644 be/Modules/BaseData/src/Win_in.Sfs.Basedata.Domain/Equipments/EquipmentValidator.cs
create mode 100644 be/Modules/BaseData/src/Win_in.Sfs.Basedata.Domain/Equipments/IEquipmentManager.cs
create mode 100644 be/Modules/BaseData/src/Win_in.Sfs.Basedata.Domain/Equipments/IEquipmentRepository.cs
create mode 100644 be/Modules/BaseData/src/Win_in.Sfs.Basedata.EntityFrameworkCore/Equipments/EquipmentDbContextModelCreatingExtensions.cs
create mode 100644 be/Modules/BaseData/src/Win_in.Sfs.Basedata.EntityFrameworkCore/Equipments/EquipmentEfCoreRepository.cs
diff --git a/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/Equipments/DTOs/EquipmentDTO.cs b/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/Equipments/DTOs/EquipmentDTO.cs
new file mode 100644
index 000000000..b24b1e152
--- /dev/null
+++ b/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/Equipments/DTOs/EquipmentDTO.cs
@@ -0,0 +1,58 @@
+using System.ComponentModel.DataAnnotations;
+using Win_in.Sfs.Shared.Domain;
+using Win_in.Sfs.Shared.Domain.Shared;
+
+namespace Win_in.Sfs.Basedata.Application.Contracts;
+
+using System;
+using System.Collections.Generic;
+
+[Display(Name = "物品基本信息")]
+
+public class EquipmentDTO : SfsBaseDataDTOBase, IHasCode
+{
+ ///
+ /// 器具编号
+ ///
+ [Display(Name = "器具编号")]
+ public string Code { get; set; }
+ ///
+ /// 类型
+ ///
+ [Display(Name = "类型")]
+ public string Type { get; set; } = string.Empty;
+ ///
+ /// 型号
+ ///
+ [Display(Name = "型号")]
+ public string Model { get; set; } = string.Empty;
+ ///
+ /// 库位编号
+ ///
+ [Display(Name = "库位编号")]
+ public string LocCode { get; set; } = string.Empty;
+ ///
+ /// 状态
+ ///
+ [Display(Name = "状态")]
+ public int State { get; set; } = 0;
+ ///
+ /// 备注
+ ///
+ [Display(Name = "备注")]
+ public string Remark { get; set; } = string.Empty;
+
+
+ ///
+ /// 创建人
+ ///
+ [Display(Name = "创建人")]
+ public string Creator { get; set; }
+
+ ///
+ /// 创建时间
+ ///
+ [Display(Name = "创建时间")]
+ public DateTime CreatTime { get; set; } = DateTime.Now;
+
+}
diff --git a/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/Equipments/DTOs/EquipmentForDongyangExportDTO.cs b/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/Equipments/DTOs/EquipmentForDongyangExportDTO.cs
new file mode 100644
index 000000000..e8308d52b
--- /dev/null
+++ b/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/Equipments/DTOs/EquipmentForDongyangExportDTO.cs
@@ -0,0 +1,53 @@
+using System;
+using System.ComponentModel.DataAnnotations;
+using Win_in.Sfs.Shared.Domain.Shared;
+
+namespace Win_in.Sfs.Basedata.Application.Contracts;
+
+[Display(Name = "物料信息")]
+public class EquipmentForDongyangExportDTO
+{
+ ///
+ /// 器具编号
+ ///
+ [Display(Name = "器具编号")]
+ public string Code { get; set; }
+ ///
+ /// 类型
+ ///
+ [Display(Name = "类型")]
+ public string Type { get; set; } = string.Empty;
+ ///
+ /// 型号
+ ///
+ [Display(Name = "型号")]
+ public string Model { get; set; } = string.Empty;
+ ///
+ /// 库位编号
+ ///
+ [Display(Name = "库位编号")]
+ public string LocCode { get; set; } = string.Empty;
+ ///
+ /// 状态
+ ///
+ [Display(Name = "状态")]
+ public int State { get; set; } = 0;
+ ///
+ /// 备注
+ ///
+ [Display(Name = "备注")]
+ public string Remark { get; set; } = string.Empty;
+
+
+ ///
+ /// 创建人
+ ///
+ [Display(Name = "创建人")]
+ public string Creator { get; set; }
+
+ ///
+ /// 创建时间
+ ///
+ [Display(Name = "创建时间")]
+ public DateTime CreatTime { get; set; } = DateTime.Now;
+}
diff --git a/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/Equipments/EquipmentPermissions.cs b/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/Equipments/EquipmentPermissions.cs
new file mode 100644
index 000000000..48f3a686f
--- /dev/null
+++ b/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/Equipments/EquipmentPermissions.cs
@@ -0,0 +1,21 @@
+using Volo.Abp.Authorization.Permissions;
+using Win_in.Sfs.Basedata.Domain;
+
+namespace Win_in.Sfs.Basedata.Application.Contracts;
+
+public static class EquipmentPermissions
+{
+
+ public const string Default = BasedataPermissions.GroupName + "." + nameof(Equipment);
+ public const string Create = Default + "." + BasedataPermissions.CreateStr;
+ public const string Update = Default + "." + BasedataPermissions.UpdateStr;
+ public const string Delete = Default + "." + BasedataPermissions.DeleteStr;
+
+ public static void AddEquipmentPermission(this PermissionGroupDefinition permissionGroup)
+ {
+ var EquipmentPermission = permissionGroup.AddPermission(Default, BasedataPermissionDefinitionProvider.L(nameof(Equipment)));
+ EquipmentPermission.AddChild(Create, BasedataPermissionDefinitionProvider.L(BasedataPermissions.CreateStr));
+ EquipmentPermission.AddChild(Update, BasedataPermissionDefinitionProvider.L(BasedataPermissions.UpdateStr));
+ EquipmentPermission.AddChild(Delete, BasedataPermissionDefinitionProvider.L(BasedataPermissions.DeleteStr));
+ }
+}
diff --git a/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/Equipments/IEquipmentAppService.cs b/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/Equipments/IEquipmentAppService.cs
new file mode 100644
index 000000000..9b4d3f1ba
--- /dev/null
+++ b/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/Equipments/IEquipmentAppService.cs
@@ -0,0 +1,28 @@
+using System.Collections.Generic;
+using System.Threading.Tasks;
+using Microsoft.AspNetCore.Mvc;
+using Win_in.Sfs.Shared.Application.Contracts;
+using Win_in.Sfs.Shared.Domain.Shared;
+
+namespace Win_in.Sfs.Basedata.Application.Contracts;
+
+public interface IEquipmentAppService
+ : ISfsBaseDataAppServiceBase
+ , ISfsGetByCodeAppService
+ , ISfsCheckAppService
+ , ISfsUpsertAppService
+{
+ //Task CheckItemIsAvailable(string itemCode);
+ //[HttpGet("check-item-is-available-no-select-sql")]
+ //void CheckItemIsAvailable(EquipmentDTO EquipmentDTO);
+
+ //Task> GetListByNameAsync(string name);
+
+ //Task GetOrAddAsync(EquipmentEditInput input);
+
+ //Task GetManageTypeAsync(string itemCode);
+ //Task> GetManageTypesAsync(List itemCodes);
+
+ //Task UpsertAsyncByInterface(EquipmentEditInput input);
+ //Task UpsertStdPackQtyAsync(string itemCode, decimal stdpackqty);
+}
diff --git a/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/Equipments/Inputs/EquipmentCheckInput.cs b/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/Equipments/Inputs/EquipmentCheckInput.cs
new file mode 100644
index 000000000..33d5ffc19
--- /dev/null
+++ b/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/Equipments/Inputs/EquipmentCheckInput.cs
@@ -0,0 +1,55 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
+using Win_in.Sfs.Shared.Domain.Shared;
+
+namespace Win_in.Sfs.Basedata.Application.Contracts;
+
+public class EquipmentCheckInput
+{
+ ///
+ /// 器具编号
+ ///
+ [Display(Name = "器具编号")]
+ public string Code { get; set; }
+ ///
+ /// 类型
+ ///
+ [Display(Name = "类型")]
+ public string Type { get; set; } = string.Empty;
+ ///
+ /// 型号
+ ///
+ [Display(Name = "型号")]
+ public string Model { get; set; } = string.Empty;
+ ///
+ /// 库位编号
+ ///
+ [Display(Name = "库位编号")]
+ public string LocCode { get; set; } = string.Empty;
+ ///
+ /// 状态
+ ///
+ [Display(Name = "状态")]
+ public int State { get; set; } = 0;
+ ///
+ /// 备注
+ ///
+ [Display(Name = "备注")]
+ public string Remark { get; set; } = string.Empty;
+
+
+ ///
+ /// 创建人
+ ///
+ [Display(Name = "创建人")]
+ public string Creator { get; set; }
+
+ ///
+ /// 创建时间
+ ///
+ [Display(Name = "创建时间")]
+ public DateTime CreatTime { get; set; }=DateTime.Now;
+
+
+}
diff --git a/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/Equipments/Inputs/EquipmentEditInput.cs b/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/Equipments/Inputs/EquipmentEditInput.cs
new file mode 100644
index 000000000..4822c9a39
--- /dev/null
+++ b/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/Equipments/Inputs/EquipmentEditInput.cs
@@ -0,0 +1,228 @@
+using System;
+using System.ComponentModel.DataAnnotations;
+using Win_in.Sfs.Shared.Domain;
+using Win_in.Sfs.Shared.Domain.Shared;
+
+namespace Win_in.Sfs.Basedata.Application.Contracts;
+
+public class EquipmentEditInput : SfsBaseDataCreateOrUpdateInputBase
+{
+ ///
+ /// 器具编号
+ ///
+ [Display(Name = "器具编号")]
+ [Required(ErrorMessage = "{0}是必填项")]
+ public string Code { get; set; }
+ ///
+ /// 类型
+ ///
+ [Display(Name = "类型")]
+ public string Type { get; set; } = string.Empty;
+ ///
+ /// 型号
+ ///
+ [Display(Name = "型号")]
+ public string Model { get; set; } = string.Empty;
+ ///
+ /// 库位编号
+ ///
+ [Display(Name = "库位编号")]
+ public string LocCode { get; set; } = string.Empty;
+ ///
+ /// 状态
+ ///
+ [Display(Name = "状态")]
+ public int State { get; set; } = 0;
+ ///
+ /// 备注
+ ///
+ [Display(Name = "备注")]
+ public string Remark { get; set; } = string.Empty;
+ ///
+ /// 创建人
+ ///
+ [Display(Name = "创建人")]
+ public string Creator { get; set; }
+
+ ///
+ /// 创建时间
+ ///
+ [Display(Name = "创建时间")]
+ public DateTime CreatTime { get; set; }=DateTime.Now;
+
+
+
+ //#region Base
+ /////
+ ///// 名称
+ /////
+ //[Display(Name = "名称")]
+ //[Required(ErrorMessage = "{0}是必填项")]
+ //[StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")]
+ //public string Name { get; set; }
+
+ /////
+ ///// 描述1
+ /////
+ //[Display(Name = "描述1")]
+ //[StringLength(SfsEfCorePropertyConst.DescLength, ErrorMessage = "{0}最多输入{1}个字符")]
+ //public string Desc1 { get; set; }
+
+ /////
+ ///// 描述2
+ /////
+ //[Display(Name = "描述2")]
+ //[StringLength(SfsEfCorePropertyConst.DescLength, ErrorMessage = "{0}最多输入{1}个字符")]
+ //public string Desc2 { get; set; }
+
+ /////
+ ///// 状态
+ /////
+ //[Display(Name = "状态")]
+ //[Required(ErrorMessage = "{0}是必填项")]
+ //public EnumItemStatus Status { get; set; }
+
+ /////
+ ///// 制造件
+ /////
+ //[Display(Name = "制造件")]
+ //[Required(ErrorMessage = "{0}是必填项")]
+ //public bool CanMake { get; set; }
+
+ /////
+ ///// 采购件
+ /////
+ //[Display(Name = "采购件")]
+ //[Required(ErrorMessage = "{0}是必填项")]
+ //public bool CanBuy { get; set; }
+ /////
+ ///// 外包件
+ /////
+ //[Display(Name = "外包件")]
+ //public bool CanOutsourcing { get; set; }
+ /////
+ ///// 回收件
+ /////
+ //[Display(Name = "回收件")]
+ //public bool IsRecycled { get; set; }
+
+ /////
+ ///// 类型
+ /////
+ //[Display(Name = "类型")]
+ //[StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")]
+ //public string Type { get; set; }
+
+ /////
+ ///// 种类
+ /////
+ //[Display(Name = "种类")]
+ //[StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")]
+ //public string Category { get; set; }
+
+ /////
+ ///// 分组
+ /////
+ //[Display(Name = "分组")]
+ //[StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")]
+ //public string Group { get; set; }
+
+ /////
+ ///// 颜色
+ /////
+ //[Display(Name = "颜色")]
+ //[StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")]
+ //public string Color { get; set; }
+
+ /////
+ ///// 配置
+ /////
+ //[Display(Name = "配置")]
+ //[StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")]
+ //public string Configuration { get; set; }
+
+ /////
+ ///// 虚零件
+ /////
+ //[Display(Name = "虚零件(Is phantom)")]
+ //public virtual bool IsPhantom { get; set; }
+
+ /////
+ ///// 基本计量单位
+ /////
+ //[Display(Name = "基本计量单位")]
+ //[Required(ErrorMessage = "{0}是必填项")]
+ //[StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")]
+ //public string BasicUom { get; set; }
+
+ /////
+ ///// 标包数
+ /////
+ //[Display(Name = "标包数")]
+ //[Required(ErrorMessage = "{0}是必填项")]
+ //public decimal StdPackQty { get; set; }
+
+ /////
+ ///// ABC类
+ /////
+ //[Display(Name = "ABC类")]
+ //[Required(ErrorMessage = "{0}是必填项", AllowEmptyStrings = true)]
+ //[StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")]
+ //public string AbcClass { get; set; }
+
+ /////
+ ///// 项目
+ /////
+ //[Display(Name = "项目")]
+ //[StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")]
+ //public string Project { get; set; }
+
+ /////
+ ///// 版本
+ /////
+ //[Display(Name = "版本")]
+ //[StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")]
+ //public string Version { get; set; }
+
+ /////
+ ///// 工程变革
+ /////
+ //[Display(Name = "工程变革")]
+ //[StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")]
+ //public string Eco { get; set; }
+
+ /////
+ ///// 有效期
+ /////
+ //[Display(Name = "有效期")]
+ //public int Validity { get; set; }
+ /////
+ ///// 有效期单位
+ /////
+ //[Display(Name = "有效期单位")]
+ //public EnumValidityUnit ValidityUnit { get; set; }
+
+ /////
+ ///// 管理类型
+ /////
+ //[Display(Name = "管理类型")]
+ //public EnumItemManageType ManageType { get; set; }
+
+ /////
+ ///// 打印标签用的一个等级
+ /////
+ //[Display(Name = "Elevel")]
+ //[StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")]
+ //public string Elevel { get; set; }
+ //#endregion
+
+ //#region Create
+ /////
+ ///// 代码
+ /////
+ //[Display(Name = "代码")]
+ //[Required(ErrorMessage = "{0}是必填项")]
+ //[StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")]
+ //public string Code { get; set; }
+ //#endregion
+}
diff --git a/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/Equipments/Inputs/EquipmentImportInput.cs b/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/Equipments/Inputs/EquipmentImportInput.cs
new file mode 100644
index 000000000..03373df2f
--- /dev/null
+++ b/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/Equipments/Inputs/EquipmentImportInput.cs
@@ -0,0 +1,56 @@
+using System;
+using System.ComponentModel.DataAnnotations;
+using Win_in.Sfs.Shared.Application.Contracts;
+using Win_in.Sfs.Shared.Domain;
+using Win_in.Sfs.Shared.Domain.Shared;
+
+namespace Win_in.Sfs.Basedata.Application.Contracts;
+
+[Display(Name = "物品")]
+public class EquipmentImportInput : SfsBaseDataImportInputBase
+{
+ ///
+ /// 器具编号
+ ///
+ [Display(Name = "器具编号")]
+ [Required(ErrorMessage = "{0}是必填项")]
+ public string Code { get; set; }
+ ///
+ /// 类型
+ ///
+ [Display(Name = "类型")]
+ public string Type { get; set; } = string.Empty;
+ ///
+ /// 型号
+ ///
+ [Display(Name = "型号")]
+ public string Model { get; set; } = string.Empty;
+ ///
+ /// 库位编号
+ ///
+ [Display(Name = "库位编号")]
+ public string LocCode { get; set; } = string.Empty;
+ ///
+ /// 状态
+ ///
+ [Display(Name = "状态")]
+ public int State { get; set; } = 0;
+ ///
+ /// 备注
+ ///
+ [Display(Name = "备注")]
+ public string Remark { get; set; } = string.Empty;
+ ///
+ /// 创建人
+ ///
+ [Display(Name = "创建人")]
+ public string Creator { get; set; }
+
+ ///
+ /// 创建时间
+ ///
+ [Display(Name = "创建时间")]
+ public DateTime CreatTime { get; set; } = DateTime.Now;
+
+
+}
diff --git a/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/BasedataApplicationAutoMapperProfile.cs b/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/BasedataApplicationAutoMapperProfile.cs
index 6ed3caf50..66ac5ab13 100644
--- a/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/BasedataApplicationAutoMapperProfile.cs
+++ b/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/BasedataApplicationAutoMapperProfile.cs
@@ -48,5 +48,6 @@ public partial class BasedataApplicationAutoMapperProfile : Profile
WorkStationAutoMapperProfile();
WorkGroupAutoMapperProfile();
WorkShopAutoMapperProfile();
+ EquipmentAutoMapperProfile();
}
}
diff --git a/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/Equipments/EquipmentAppService.cs b/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/Equipments/EquipmentAppService.cs
new file mode 100644
index 000000000..6ee10fea0
--- /dev/null
+++ b/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/Equipments/EquipmentAppService.cs
@@ -0,0 +1,236 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
+using System.Linq;
+using System.Linq.Expressions;
+using System.Threading;
+using System.Threading.Tasks;
+using Microsoft.AspNetCore.Authorization;
+using Microsoft.AspNetCore.Mvc;
+using Volo.Abp;
+using Volo.Abp.Application.Dtos;
+using Volo.Abp.Caching;
+using Volo.Abp.Domain.Repositories;
+using Volo.Abp.Validation;
+using Win_in.Sfs.Basedata.Application.Contracts;
+using Win_in.Sfs.Basedata.Domain;
+using Win_in.Sfs.Basedata.Domain.Shared;
+using Win_in.Sfs.Shared.Domain;
+using Win_in.Sfs.Shared.Domain.Shared;
+
+namespace Win_in.Sfs.Basedata.Application;
+
+[Authorize]
+[Route($"{BasedataConsts.RootPath}Equipment")]
+public class EquipmentAppService
+ : SfsBaseDataWithCodeAppServiceBase
+ , IEquipmentAppService
+{
+ //private readonly ItemValidator _itemValidator;
+ private readonly IEquipmentManager _manager;
+ private new readonly IEquipmentRepository _repository;
+
+ public EquipmentAppService(
+ IEquipmentRepository repository,
+ IDistributedCache cache,
+ // ItemValidator itemValidator,
+ IEquipmentManager manager)
+ : base(repository, cache)
+ {
+ _repository = repository;
+ //_itemValidator = itemValidator;
+ _manager = manager;
+ base.CreatePolicyName = EquipmentPermissions.Create;
+ base.UpdatePolicyName = EquipmentPermissions.Update;
+ base.DeletePolicyName = EquipmentPermissions.Delete;
+ }
+
+ [HttpPost("check")]
+ //[Authorize(ErpLocationPermissions.Default)]
+
+ public virtual async Task CheckAsync(string code, EquipmentCheckInput input)
+ {
+ await Task.CompletedTask.ConfigureAwait(false);
+ }
+
+
+ //protected ICategoryAppService _categoryApp => LazyServiceProvider.LazyGetRequiredService();
+ //protected IItemCategoryAppService _itemCategoryApp => LazyServiceProvider.LazyGetRequiredService();
+
+ //[HttpPost("check")]
+ //public virtual async Task CheckAsync(string code, EquipmentCheckInput input)
+ //{
+ // var result = new AbpValidationResult();
+ // _itemValidator.CheckFormat(code);
+ // var dto = await GetByCodeAsync(code).ConfigureAwait(false);
+ // var entity = ObjectMapper.Map(dto);
+ // //_itemValidator.CheckCanBuy(entity, input.CanBuy, result);
+ // //_itemValidator.CheckCanMake(entity, input.CanMake, result);
+ // //_itemValidator.CheckStatus(entity, input.Statuses, result);
+ // //_itemValidator.CheckProject(entity, input.Projects, result);
+ // //await _itemValidator.CheckCategoryAsync(entity, input.Categories, result).ConfigureAwait(false);
+ // if (result.Errors.Count > 0)
+ // {
+ // throw new AbpValidationException(result.Errors);
+ // }
+ //}
+
+ /////
+ ///// 检物品状态 是否可用
+ /////
+ /////
+ /////
+ /////
+ //[HttpGet("check-item-is-available")]
+ //public virtual async Task CheckItemIsAvailable(string itemCode)
+ //{
+ // var entity = await _repository.FindAsync(c => c.Code == itemCode).ConfigureAwait(false);
+
+ // if (entity == null)
+ // {
+ // throw new UserFriendlyException($"未找到代码为 {itemCode} 的物品");
+ // }
+
+ // return entity.Status == EnumItemStatus.Active;
+ //}
+
+ ///
+ /// 检物品状态 是否可用(不查询数据库 直接根据对象判断)
+ ///
+ ///
+ ///
+ //[HttpGet("check-item-is-available-no-select-sql")]
+ //public void CheckItemIsAvailable(EquipmentDTO EquipmentDTO)
+ //{
+ // if (EquipmentDTO != null && EquipmentDTO.Status != EnumItemStatus.Active)
+ // {
+ // throw new UserFriendlyException($"物料 {EquipmentDTO.Code} 状态为 {EquipmentDTO.Status} ,不是可用状态");
+ // }
+ //}
+
+ //[HttpGet("{id}")]
+ //public override async Task GetAsync(Guid id)
+ //{
+ // var dto = await base.GetAsync(id).ConfigureAwait(false);
+
+ // dto.ItemCategoryDictionary = await GetItemCategory(dto.Code).ConfigureAwait(false);
+
+ // return dto;
+ //}
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ //[HttpGet("list-by-name")]
+ //public virtual async Task> GetListByNameAsync(string name)
+ //{
+ // var entities = await _repository.GetListAsync(c => c.Name == name).ConfigureAwait(false);
+ // var dtos = ObjectMapper.Map, List>(entities);
+ // return dtos;
+ //}
+
+ //[HttpGet("get-manage-type")]
+ //public virtual async Task GetManageTypeAsync(string itemCode)
+ //{
+ // var entity = await GetByCodeAsync(itemCode).ConfigureAwait(false);
+ // Check.NotNull(entity, "物品代码", $"物品 {itemCode} 不存在");
+ // return entity.ManageType;
+ //}
+
+ //[HttpGet("get-manage-types")]
+ //public virtual async Task> GetManageTypesAsync(List itemCodes)
+ //{
+ // var dtos = await GetByCodesAsync(itemCodes).ConfigureAwait(false);
+ // var itemManageTypes = dtos.ToDictionary(dto => dto.Code, dto => dto.ManageType);
+ // return itemManageTypes;
+ //}
+
+ //[HttpPost("get-or-add")]
+ //public virtual async Task GetOrAddAsync(EquipmentEditInput input)
+ //{
+ // var result = await _repository.FirstOrDefaultAsync(p => p.Code == input.Code).ConfigureAwait(false);
+ // if (result == null)
+ // {
+ // var entity = ObjectMapper.Map(input);
+ // result = await _repository.InsertAsync(entity, true).ConfigureAwait(false);
+ // }
+
+ // var dto = ObjectMapper.Map(result);
+ // return dto;
+ //}
+
+ //[HttpPost("list")]
+ //public override async Task> GetPagedListByFilterAsync(
+ // SfsBaseDataRequestInputBase sfsRequestInput,
+ // bool includeDetails = false,
+ // CancellationToken cancellationToken = default)
+ //{
+ // Expression> expression = sfsRequestInput.Condition.Filters?.Count > 0
+ // ? sfsRequestInput.Condition.Filters.ToLambda()
+ // : p => true;
+ // var pageResult = await GetPagedListAsync(
+ // expression,
+ // sfsRequestInput.SkipCount,
+ // sfsRequestInput.MaxResultCount,
+ // sfsRequestInput.Sorting,
+ // includeDetails,
+ // cancellationToken).ConfigureAwait(false);
+
+ // foreach (var item in pageResult.Items)
+ // {
+ // item.ItemCategoryDictionary = await GetItemCategory(item.Code).ConfigureAwait(false);
+ // }
+
+ // return pageResult;
+ //}
+
+ //[HttpPost("upsert")]
+ //public virtual async Task UpsertAsync(EquipmentEditInput input)
+ //{
+ // var entity = ObjectMapper.Map(input);
+ // await _repository.UpsertAsync(entity).ConfigureAwait(false);
+ //}
+ //[HttpPost("upsert-interface")]
+ //public virtual async Task UpsertAsyncByInterface(EquipmentEditInput input)
+ //{
+ // var entity = ObjectMapper.Map(input);
+ // await _repository.UpsertAsyncByInterface(entity).ConfigureAwait(false);
+ //}
+
+ //protected override Expression> BuildSearchExpression(string keyWord)
+ //{
+ // Expression> expression = p =>
+ // p.Code.Contains(keyWord)
+ // || p.Name.Contains(keyWord)
+ // || p.Desc1.Contains(keyWord)
+ // || p.Desc2.Contains(keyWord)
+ // || p.AbcClass.Contains(keyWord)
+ // || p.BasicUom.Contains(keyWord)
+ // || p.Elevel.Contains(keyWord)
+ // || p.Project.Contains(keyWord)
+ // || p.Version.Contains(keyWord);
+ // return expression;
+ //}
+
+ //private async Task> GetItemCategory(string itemCode)
+ //{
+ // // var itemCategorys = await this._itemCategoryApp.GetListByItemCode(itemCode).ConfigureAwait(false);
+
+ // // return itemCategorys.ToDictionary(x => x.CategoryCode, y => y.Value);
+ //}
+
+ [HttpPost("upsert")]
+
+ public virtual async Task UpsertAsync(EquipmentEditInput input)
+ {
+ var entity = ObjectMapper.Map(input);
+ await _repository.UpsertAsync(entity).ConfigureAwait(false);
+ }
+
+
+
+
+}
diff --git a/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/Equipments/EquipmentAutoMapperProfile.cs b/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/Equipments/EquipmentAutoMapperProfile.cs
new file mode 100644
index 000000000..fec39f919
--- /dev/null
+++ b/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/Equipments/EquipmentAutoMapperProfile.cs
@@ -0,0 +1,33 @@
+using AutoMapper;
+using Volo.Abp.AutoMapper;
+using Win_in.Sfs.Basedata.Application.Contracts;
+using Win_in.Sfs.Basedata.Domain;
+
+namespace Win_in.Sfs.Basedata.Application;
+
+public partial class BasedataApplicationAutoMapperProfile : Profile
+{
+ private void EquipmentAutoMapperProfile()
+ {
+ CreateMap()
+
+ .ReverseMap();
+
+ CreateMap()
+ .IgnoreAuditedObjectProperties()
+ .Ignore(x => x.TenantId)
+ .Ignore(x => x.Remark)
+ .Ignore(x => x.ExtraProperties)
+ .Ignore(x => x.ConcurrencyStamp)
+ ;
+
+ //CreateMap()
+
+ //CreateMap()
+ // .Ignore(x => x.ItemCategory)
+ // .Ignore(x => x.Color);
+ CreateMap()
+ .IgnoreAuditedObjectProperties()
+ .Ignore(x => x.ConcurrencyStamp).Ignore(x => x.Id);
+ }
+}
diff --git a/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/Win_in.Sfs.Basedata.Application.csproj b/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/Win_in.Sfs.Basedata.Application.csproj
index 6cb51991c..6f33022f8 100644
--- a/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/Win_in.Sfs.Basedata.Application.csproj
+++ b/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/Win_in.Sfs.Basedata.Application.csproj
@@ -1,4 +1,4 @@
-
+
diff --git a/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Domain/Equipments/Equipment.cs b/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Domain/Equipments/Equipment.cs
new file mode 100644
index 000000000..97fa77973
--- /dev/null
+++ b/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Domain/Equipments/Equipment.cs
@@ -0,0 +1,160 @@
+using System;
+using System.ComponentModel.DataAnnotations;
+using Win_in.Sfs.Shared.Domain;
+using Win_in.Sfs.Shared.Domain.Entities;
+using Win_in.Sfs.Shared.Domain.Shared;
+
+namespace Win_in.Sfs.Basedata.Domain;
+
+///
+/// 物品基本信息
+///
+public class Equipment : SfsBaseDataAggregateRootBase, IHasCode
+{
+
+ [IgnoreUpdate]
+ ///
+ /// 器具编号
+ ///
+ public string Code { get; set; }
+ ///
+ /// 类型
+ ///
+ public string Type { get; set; }
+ ///
+ /// 型号
+ ///
+ public string Model { get; set; }
+ ///
+ /// 库位编号
+ ///
+ public string LocCode { get; set; }
+ ///
+ /// 状态
+ ///
+ public int State { get; set; }
+ ///
+ /// 备注
+ ///
+
+ ///
+ /// 创建人
+ ///
+ public string Creator { get; set; }
+
+ ///
+ /// 创建时间
+ ///
+ public DateTime CreatTime { get; set; }
+
+
+
+
+
+
+
+
+ /////
+ ///// 代码
+ /////
+ //[IgnoreUpdate]
+ //public string Code { get; set; }
+ /////
+ ///// 名称
+ /////
+ //public string Name { get; set; }
+ /////
+ ///// 描述
+ /////
+ //public string Desc1 { get; set; }
+ /////
+ ///// 描述2
+ /////
+ //public string Desc2 { get; set; }
+ /////
+ ///// 状态
+ /////
+ //public EnumItemStatus Status { get; set; }
+ /////
+ ///// 制造件
+ /////
+ //public bool CanMake { get; set; }
+ /////
+ ///// 采购件
+ /////
+ //[IgnoreUpdate]
+ //public bool CanBuy { get; set; }
+ /////
+ ///// 外包件
+ /////
+ //public bool CanOutsourcing { get; set; }
+ /////
+ ///// 回收件
+ /////
+ //public bool IsRecycled { get; set; }
+
+ //[Display(Name = "类型")]
+ //public string Type { get; set; }
+
+ //[Display(Name = "种类")]
+ //public string Category { get; set; }
+
+ //[Display(Name = "分组")]
+ //public string Group { get; set; }
+
+ //[Display(Name = "颜色")]
+ //public string Color { get; set; }
+
+ //[Display(Name = "配置")]
+ //public string Configuration { get; set; }
+ /////
+ ///// 基本计量单位
+ /////
+ //public string BasicUom { get; set; }
+
+ /////
+ ///// 标包数
+ /////
+ //public decimal StdPackQty { get; set; }
+
+ /////
+ ///// ABC类,默认为C
+ /////
+ //public string AbcClass { get; set; }
+ /////
+ ///// 项目
+ /////
+ //public string Project { get; set; }
+ /////
+ ///// 版本
+ /////
+ //public string Version { get; set; }
+ /////
+ ///// 工程变革
+ /////
+ //public string Eco { get; set; }
+ /////
+ ///// 有效期
+ /////
+ //public int Validity { get; set; }
+ /////
+ ///// 有效期单位
+ /////
+ //public EnumValidityUnit ValidityUnit { get; set; }
+
+ /////
+ ///// 管理类型
+ /////
+ //public EnumItemManageType ManageType { get; set; }
+
+ /////
+ ///// 打印标签用的一个等级
+ /////
+ //public string Elevel { get; set; }
+
+ /////
+ ///// 虚零件
+ /////
+ //public virtual bool IsPhantom { get; set; }
+
+}
diff --git a/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Domain/Equipments/EquipmentManager.cs b/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Domain/Equipments/EquipmentManager.cs
new file mode 100644
index 000000000..bc69afb6a
--- /dev/null
+++ b/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Domain/Equipments/EquipmentManager.cs
@@ -0,0 +1,29 @@
+using System.Collections.Generic;
+using System.Threading.Tasks;
+using Volo.Abp.Domain.Services;
+
+namespace Win_in.Sfs.Basedata.Domain;
+
+public class EquipmentManager : DomainService, IEquipmentManager
+{
+ private readonly IEquipmentRepository _repository;
+
+ public EquipmentManager(IEquipmentRepository repository)
+ {
+ _repository = repository;
+ }
+
+ ///
+ /// 执行导入
+ ///
+ public virtual async Task ImportDataAsync(List mergeEntities, List deleteEntities = null)
+ {
+ if (deleteEntities != null && deleteEntities.Count > 0)
+ {
+ await _repository.BulkDeleteAsync(deleteEntities).ConfigureAwait(false);
+ }
+
+ await _repository.BulkMergeAsync(mergeEntities).ConfigureAwait(false);
+ }
+}
+
diff --git a/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Domain/Equipments/EquipmentValidator.cs b/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Domain/Equipments/EquipmentValidator.cs
new file mode 100644
index 000000000..6d94580b4
--- /dev/null
+++ b/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Domain/Equipments/EquipmentValidator.cs
@@ -0,0 +1,92 @@
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
+using System.Linq;
+using System.Threading.Tasks;
+using Volo.Abp.Domain.Services;
+using Volo.Abp.Validation;
+using Win_in.Sfs.Shared.Domain.Shared;
+
+namespace Win_in.Sfs.Basedata.Domain;
+
+//public class ItemValidator : DomainService
+//{
+// private readonly IItemCategoryRepository _itemCategoryRepository;
+
+// public ItemValidator(
+// IItemCategoryRepository itemCategoryRepository)
+// {
+// _itemCategoryRepository = itemCategoryRepository;
+// }
+// #region Check
+
+// public void CheckFormat(string code)
+// {
+// var wrongFormat = false;
+
+// //TODO 检查物品号的格式
+
+// if (wrongFormat)
+// {
+// var result = new AbpValidationResult();
+// result.Errors.Add(new ValidationResult($"{code} 格式错误"));
+// throw new AbpValidationException(result.Errors);
+// }
+// }
+
+// public void CheckCanMake(ItemBasic entity, bool? inputCanMake, AbpValidationResult result)
+// {
+// if (inputCanMake != null && inputCanMake.Value != entity.CanMake)
+// {
+// result.Errors.Add(new ValidationResult($"{entity.Code} {nameof(entity.CanMake)} 状态错误"));
+// }
+// }
+
+// public void CheckCanBuy(ItemBasic entity, bool? inputCanBuy, AbpValidationResult result)
+// {
+// if (inputCanBuy != null && inputCanBuy.Value != entity.CanBuy)
+// {
+// result.Errors.Add(new ValidationResult($"{entity.Code} {nameof(entity.CanBuy)} 状态错误"));
+// }
+// }
+
+// public void CheckStatus(ItemBasic entity, List validStatuses, AbpValidationResult result)
+// {
+// if (validStatuses.Any() && !validStatuses.Contains(entity.Status))
+// {
+// result.Errors.Add(new ValidationResult($"{entity.Code} 状态错误"));
+// }
+// }
+
+// public void CheckProject(ItemBasic entity, List validProjects, AbpValidationResult result)
+// {
+// if (validProjects.Any() && !validProjects.Contains(entity.Project))
+// {
+// result.Errors.Add(new ValidationResult($"{entity.Code} 项目错误"));
+// }
+// }
+
+// public virtual async Task CheckCategoryAsync(ItemBasic entity, Dictionary validCategories, AbpValidationResult result)
+// {
+// if (!validCategories.Any())
+// {
+// return;
+// }
+
+// var code = entity.Code;
+
+// var categories = await _itemCategoryRepository.GetListAsync(p => p.ItemCode == code).ConfigureAwait(false);
+
+// foreach (var category in validCategories)
+// {
+// var found = categories.Any(p => p.CategoryCode == category.Key
+// && p.Value == category.Value);
+// if (!found)
+// {
+// result.Errors.Add(new ValidationResult($"{code} 的 {category.Key}:{category.Value}错误"));
+// }
+// }
+
+// }
+
+// #endregion
+//}
diff --git a/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Domain/Equipments/IEquipmentManager.cs b/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Domain/Equipments/IEquipmentManager.cs
new file mode 100644
index 000000000..13161ca51
--- /dev/null
+++ b/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Domain/Equipments/IEquipmentManager.cs
@@ -0,0 +1,8 @@
+using Volo.Abp.Domain.Services;
+using Win_in.Sfs.Shared.Domain;
+
+namespace Win_in.Sfs.Basedata.Domain;
+
+public interface IEquipmentManager : IDomainService, IBulkImportService
+{
+}
diff --git a/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Domain/Equipments/IEquipmentRepository.cs b/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Domain/Equipments/IEquipmentRepository.cs
new file mode 100644
index 000000000..fa12d7b40
--- /dev/null
+++ b/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Domain/Equipments/IEquipmentRepository.cs
@@ -0,0 +1,13 @@
+using System.Threading.Tasks;
+using Win_in.Sfs.Shared.Domain;
+
+namespace Win_in.Sfs.Basedata.Domain;
+
+public interface IEquipmentRepository : ISfsBaseDataRepositoryBase, ISfsBulkRepositoryBase
+{
+ public Task UpsertAsync(Equipment entity);
+
+ public Task InsertAutoSaveAsync(Equipment entity);
+
+ public Task UpsertAsyncByInterface(Equipment entity);
+}
diff --git a/be/Modules/BaseData/src/Win_in.Sfs.Basedata.EntityFrameworkCore/BasedataDbContext.cs b/be/Modules/BaseData/src/Win_in.Sfs.Basedata.EntityFrameworkCore/BasedataDbContext.cs
index 1dbbf4cb5..2cf74d3c9 100644
--- a/be/Modules/BaseData/src/Win_in.Sfs.Basedata.EntityFrameworkCore/BasedataDbContext.cs
+++ b/be/Modules/BaseData/src/Win_in.Sfs.Basedata.EntityFrameworkCore/BasedataDbContext.cs
@@ -42,7 +42,6 @@ public class BasedataDbContext : AbpDbContext, IBasedataDbCon
public DbSet WorkShops { get; set; }
public DbSet Docks { get; set; }
public DbSet LocationGroups { get; set; }
-
public DbSet Locations { get; set; }
public DbSet ProductionLines { get; set; }
public DbSet WorkGroups { get; set; }
@@ -51,10 +50,9 @@ public class BasedataDbContext : AbpDbContext, IBasedataDbCon
public DbSet SupplierTimeWindows { get; set; }
public DbSet ErpLocation { get; set; }
public DbSet CustomerAddresses { get; set; }
-
public DbSet ItemGuideBooks { get; set; }
public DbSet Dicts { get; set; }
-
+ public DbSet Equipments { get; set; }
public BasedataDbContext(DbContextOptions options)
: base(options)
{
diff --git a/be/Modules/BaseData/src/Win_in.Sfs.Basedata.EntityFrameworkCore/BasedataDbContextModelCreatingExtensions.cs b/be/Modules/BaseData/src/Win_in.Sfs.Basedata.EntityFrameworkCore/BasedataDbContextModelCreatingExtensions.cs
index ad0cabba6..65bd5cca4 100644
--- a/be/Modules/BaseData/src/Win_in.Sfs.Basedata.EntityFrameworkCore/BasedataDbContextModelCreatingExtensions.cs
+++ b/be/Modules/BaseData/src/Win_in.Sfs.Basedata.EntityFrameworkCore/BasedataDbContextModelCreatingExtensions.cs
@@ -63,6 +63,7 @@ public static class BasedataDbContextModelCreatingExtensions
builder.ConfigureCustomerAddress(options);
builder.ConfigureItemGuideBook(options);
builder.ConfigureDocumentSetting(options);
+ builder.ConfigureEquipment(options);
//设置decimal的默认小数位数
builder.ConfigurePrecisionOfDecimal();
diff --git a/be/Modules/BaseData/src/Win_in.Sfs.Basedata.EntityFrameworkCore/BasedataEntityFrameworkCoreModule.cs b/be/Modules/BaseData/src/Win_in.Sfs.Basedata.EntityFrameworkCore/BasedataEntityFrameworkCoreModule.cs
index 3193de4a3..4715293e8 100644
--- a/be/Modules/BaseData/src/Win_in.Sfs.Basedata.EntityFrameworkCore/BasedataEntityFrameworkCoreModule.cs
+++ b/be/Modules/BaseData/src/Win_in.Sfs.Basedata.EntityFrameworkCore/BasedataEntityFrameworkCoreModule.cs
@@ -67,6 +67,7 @@ public class BasedataEntityFrameworkCoreModule : AbpModule
context.Services.AddTransient();
context.Services.AddTransient();
context.Services.AddTransient();
+ context.Services.AddTransient();
ConfigureEntity();
}
diff --git a/be/Modules/BaseData/src/Win_in.Sfs.Basedata.EntityFrameworkCore/Equipments/EquipmentDbContextModelCreatingExtensions.cs b/be/Modules/BaseData/src/Win_in.Sfs.Basedata.EntityFrameworkCore/Equipments/EquipmentDbContextModelCreatingExtensions.cs
new file mode 100644
index 000000000..7a78d99cf
--- /dev/null
+++ b/be/Modules/BaseData/src/Win_in.Sfs.Basedata.EntityFrameworkCore/Equipments/EquipmentDbContextModelCreatingExtensions.cs
@@ -0,0 +1,41 @@
+using Microsoft.EntityFrameworkCore;
+using Volo.Abp.EntityFrameworkCore.Modeling;
+using Win_in.Sfs.Basedata.Domain;
+using Win_in.Sfs.Shared.Domain.Shared;
+using Win_in.Sfs.Shared.EntityFrameworkCore;
+
+namespace Win_in.Sfs.Basedata.EntityFrameworkCore;
+
+public static class EquipmentDbContextModelCreatingExtensions
+{
+ public static void ConfigureEquipment(this ModelBuilder builder, BasedataModelBuilderConfigurationOptions options)
+ {
+ builder.Entity(b =>
+ {
+ //Configure table & schema name
+ b.ToTable(options.TablePrefix + nameof(Equipment), options.Schema);
+ //Configure ABP properties
+ b.ConfigureByConvention();
+ //Configure Sfs base properties
+ b.ConfigureSfsBase();
+
+ //Properties
+ b.Property(q => q.Code).IsRequired().HasMaxLength(SfsPropertyConst.CodeLength).IsRequired(true);
+ b.Property(q => q.Model).HasMaxLength(SfsPropertyConst.CodeLength);
+ b.Property(q => q.LocCode).HasMaxLength(SfsPropertyConst.CodeLength);
+ b.Property(q => q.Type).HasMaxLength(SfsPropertyConst.CodeLength);
+
+
+ //Relations
+ //None
+
+ //Indexes
+ b.HasIndex(q => new { q.Code }).IsUnique();
+ });
+ }
+}
+
+
+///
+/// 器具编号
+///
diff --git a/be/Modules/BaseData/src/Win_in.Sfs.Basedata.EntityFrameworkCore/Equipments/EquipmentEfCoreRepository.cs b/be/Modules/BaseData/src/Win_in.Sfs.Basedata.EntityFrameworkCore/Equipments/EquipmentEfCoreRepository.cs
new file mode 100644
index 000000000..5d0bab8cb
--- /dev/null
+++ b/be/Modules/BaseData/src/Win_in.Sfs.Basedata.EntityFrameworkCore/Equipments/EquipmentEfCoreRepository.cs
@@ -0,0 +1,70 @@
+using System;
+using System.Threading.Tasks;
+using Microsoft.EntityFrameworkCore;
+using Volo.Abp.EntityFrameworkCore;
+using Win_in.Sfs.Basedata.Domain;
+using Win_in.Sfs.Shared.Domain;
+
+namespace Win_in.Sfs.Basedata.EntityFrameworkCore;
+
+public class EquipmentEfCoreRepository : SfsBaseDataEfCoreRepositoryBase, IEquipmentRepository, ISfsBulkRepositoryBase
+{
+ public EquipmentEfCoreRepository(IDbContextProvider dbContextProvider) : base(dbContextProvider)
+ {
+ }
+ public virtual async Task UpsertAsyncByInterface(Equipment entity)
+ {
+ var dbSet = await GetDbSetAsync().ConfigureAwait(false);
+ var exist = await dbSet.FirstOrDefaultAsync(p => p.Code == entity.Code).ConfigureAwait(false);
+ if (exist == null)
+ {
+ var insRet = await InsertAsync(entity).ConfigureAwait(false);
+ }
+ else
+ {
+ exist.State = entity.State;
+ exist.Model = entity.Model;
+ exist.Type = entity.Type;
+ exist.LastModificationTime = DateTimeOffset.Now.DateTime;
+
+ }
+ }
+ public virtual async Task UpsertAsync(Equipment entity)
+ {
+ var dbSet = await GetDbSetAsync().ConfigureAwait(false);
+ var exist = await dbSet.FirstOrDefaultAsync(p => p.Code == entity.Code).ConfigureAwait(false);
+ if (exist == null)
+ {
+ var insRet = await InsertAsync(entity).ConfigureAwait(false);
+ }
+ else
+ {
+ exist.State = entity.State;
+ exist.Model = entity.Model;
+ exist.Type = entity.Type;
+ exist.LastModificationTime = DateTimeOffset.Now.DateTime;
+
+ }
+
+ // var context = await GetDbContextAsync();
+ // await context.SingleMergeAsync(entity, options =>
+ // {
+ // //业务主键,可以是联合主键
+ // options.ColumnPrimaryKeyExpression = c => new
+ // {
+ // c.Code
+ // };
+ // //需要在更新时忽略的属性
+ // options.IgnoreOnMergeUpdateExpression = c => new
+ // {
+ // c.Id,
+ // c.ManageType,
+ // };
+ // });
+ }
+
+ public virtual async Task InsertAutoSaveAsync(Equipment entity)
+ {
+ _ = await InsertAsync(entity, true, GetCancellationToken()).ConfigureAwait(false);
+ }
+}
diff --git a/be/Modules/BaseData/src/Win_in.Sfs.Basedata.EntityFrameworkCore/Win_in.Sfs.Basedata.EntityFrameworkCore.csproj b/be/Modules/BaseData/src/Win_in.Sfs.Basedata.EntityFrameworkCore/Win_in.Sfs.Basedata.EntityFrameworkCore.csproj
index 7fecf30fe..2ee6ae91f 100644
--- a/be/Modules/BaseData/src/Win_in.Sfs.Basedata.EntityFrameworkCore/Win_in.Sfs.Basedata.EntityFrameworkCore.csproj
+++ b/be/Modules/BaseData/src/Win_in.Sfs.Basedata.EntityFrameworkCore/Win_in.Sfs.Basedata.EntityFrameworkCore.csproj
@@ -30,4 +30,8 @@
+
+
+
+