From c6c79da5c743fd1e493a12ce7c20f007837cfdf8 Mon Sep 17 00:00:00 2001
From: zhaoxinyu <89237069@qq.com>
Date: Mon, 1 Apr 2024 16:59:07 +0800
Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E5=99=A8=E5=85=B7?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../PublishProfiles/FolderProfile1.pubxml | 17 +++
.../PublishProfiles/FolderProfile1.pubxml | 17 +++
.../Equipments/DTOs/EquipmentDTO.cs | 16 +--
.../Equipments/Inputs/EquipmentEditInput.cs | 16 +--
.../Equipments/Inputs/EquipmentImportInput.cs | 20 +--
.../Equipments/EquipmentAutoMapperProfile.cs | 4 +-
.../Equipments/Equipment.cs | 9 +-
.../Notes/MesNotes/DTOs/MesNoteDTO.cs | 26 ++++
.../Notes/MesNotes/DTOs/MesNoteDetailDTO.cs | 13 ++
.../Notes/MesNotes/IMesNoteAppService.cs | 17 +++
.../MesNotes/Inputs/MesNoteDetailInput.cs | 13 ++
.../Notes/MesNotes/Inputs/MesNoteEditInput.cs | 41 ++++++
.../MesNotes/Inputs/MesNoteImportInput.cs | 20 +++
.../Notes/MesNotes/MesNotePermissions.cs | 30 ++++
.../StorePermissionDefinitionProvider.cs | 2 +
.../Notes/MesNotes/MesNoteAppService.cs | 134 ++++++++++++++++++
.../MesNotes/MesNoteAutoMapperProfile.cs | 38 +++++
.../Notes/MesNotes/IMesNoteManager.cs | 5 +
.../Notes/MesNotes/IMesNoteRepository.cs | 6 +
.../Notes/MesNotes/MesNote.cs | 34 +++++
.../Notes/MesNotes/MesNoteDetail.cs | 13 ++
.../Notes/MesNotes/MesNoteManager.cs | 14 ++
...MesNoteDbContextModelCreatingExtensions.cs | 65 +++++++++
.../Notes/MesNotes/MesNoteEfCoreRepository.cs | 11 ++
24 files changed, 550 insertions(+), 31 deletions(-)
create mode 100644 be/Hosts/Wms.Host/Win_in.Sfs.Wms.Store.HttpApi.Host/Properties/PublishProfiles/FolderProfile1.pubxml
create mode 100644 be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Properties/PublishProfiles/FolderProfile1.pubxml
create mode 100644 be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/MesNotes/DTOs/MesNoteDTO.cs
create mode 100644 be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/MesNotes/DTOs/MesNoteDetailDTO.cs
create mode 100644 be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/MesNotes/IMesNoteAppService.cs
create mode 100644 be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/MesNotes/Inputs/MesNoteDetailInput.cs
create mode 100644 be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/MesNotes/Inputs/MesNoteEditInput.cs
create mode 100644 be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/MesNotes/Inputs/MesNoteImportInput.cs
create mode 100644 be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/MesNotes/MesNotePermissions.cs
create mode 100644 be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/MesNotes/MesNoteAppService.cs
create mode 100644 be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/MesNotes/MesNoteAutoMapperProfile.cs
create mode 100644 be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/MesNotes/IMesNoteManager.cs
create mode 100644 be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/MesNotes/IMesNoteRepository.cs
create mode 100644 be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/MesNotes/MesNote.cs
create mode 100644 be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/MesNotes/MesNoteDetail.cs
create mode 100644 be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/MesNotes/MesNoteManager.cs
create mode 100644 be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Notes/MesNotes/MesNoteDbContextModelCreatingExtensions.cs
create mode 100644 be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Notes/MesNotes/MesNoteEfCoreRepository.cs
diff --git a/be/Hosts/Wms.Host/Win_in.Sfs.Wms.Store.HttpApi.Host/Properties/PublishProfiles/FolderProfile1.pubxml b/be/Hosts/Wms.Host/Win_in.Sfs.Wms.Store.HttpApi.Host/Properties/PublishProfiles/FolderProfile1.pubxml
new file mode 100644
index 000000000..36847ea03
--- /dev/null
+++ b/be/Hosts/Wms.Host/Win_in.Sfs.Wms.Store.HttpApi.Host/Properties/PublishProfiles/FolderProfile1.pubxml
@@ -0,0 +1,17 @@
+
+
+
+
+ false
+ false
+ true
+ Release
+ Any CPU
+ FileSystem
+ bin\Release\net6.0\publish\
+ FileSystem
+ <_TargetId>Folder
+
+
\ No newline at end of file
diff --git a/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Properties/PublishProfiles/FolderProfile1.pubxml b/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Properties/PublishProfiles/FolderProfile1.pubxml
new file mode 100644
index 000000000..36847ea03
--- /dev/null
+++ b/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Properties/PublishProfiles/FolderProfile1.pubxml
@@ -0,0 +1,17 @@
+
+
+
+
+ false
+ false
+ true
+ Release
+ Any CPU
+ FileSystem
+ bin\Release\net6.0\publish\
+ FileSystem
+ <_TargetId>Folder
+
+
\ No newline at end of file
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
index c61f712b2..33fdd9dc1 100644
--- 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
@@ -16,7 +16,7 @@ public class EquipmentDTO : SfsBaseDataDTOBase, IHasCode
/// 类型
///
[Display(Name = "类型")]
- public EnumEquipmentType Type { get; set; }
+ public EnumContainerType Type { get; set; }
///
/// 器具编号
///
@@ -25,18 +25,18 @@ public class EquipmentDTO : SfsBaseDataDTOBase, IHasCode
public string Code { get; set; }
- ///
- /// 标包数量
- ///
- [Display(Name = "标包数")]
- [Required(ErrorMessage = "{0}是必填项")]
- public decimal StdQty { get; set; }
+ /////
+ ///// 标包数量
+ /////
+ //[Display(Name = "标包数")]
+ //[Required(ErrorMessage = "{0}是必填项")]
+ //public decimal StdQty { get; set; }
///
/// 型号
///
[Display(Name = "型号")]
- public EnumEquipmentModel Model { get; set; }
+ public string Model { get; set; }
///
/// 库位编号
///
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
index e5fe9a2e5..25ab571b3 100644
--- 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
@@ -12,7 +12,7 @@ public class EquipmentEditInput : SfsBaseDataCreateOrUpdateInputBase
/// 类型
///
[Display(Name = "类型")]
- public EnumEquipmentType Type { get; set; }
+ public EnumContainerType Type { get; set; }
///
/// 器具编号
///
@@ -21,18 +21,18 @@ public class EquipmentEditInput : SfsBaseDataCreateOrUpdateInputBase
public string Code { get; set; }
- ///
- /// 标包数量
- ///
- [Display(Name = "标包数")]
- [Required(ErrorMessage = "{0}是必填项")]
- public decimal StdQty { get; set; }
+ /////
+ ///// 标包数量
+ /////
+ //[Display(Name = "标包数")]
+ //[Required(ErrorMessage = "{0}是必填项")]
+ //public decimal StdQty { get; set; }
///
/// 型号
///
[Display(Name = "型号")]
- public EnumEquipmentModel Model { get; set; }
+ public string Model { get; set; }
///
/// 库位编号
///
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
index 2894c5c1b..975c20ec2 100644
--- 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
@@ -1,18 +1,18 @@
using System;
using System.ComponentModel.DataAnnotations;
-
+using Win_in.Sfs.Shared.Domain.Shared;
using Win_in.Sfs.Shared.Domain.Shared.Enums.Basedata;
namespace Win_in.Sfs.Basedata.Application.Contracts;
-[Display(Name = "物品")]
+[Display(Name = "器具")]
public class EquipmentImportInput : SfsBaseDataImportInputBase
{
///
/// 类型
///
[Display(Name = "类型")]
- public Win_in.Sfs.Shared.Domain.Shared.Enums.Basedata.EnumEquipmentType Type { get; set; }
+ public EnumContainerType Type { get; set; }
///
/// 器具编号
///
@@ -21,18 +21,18 @@ public class EquipmentImportInput : SfsBaseDataImportInputBase
public string Code { get; set; }
- ///
- /// 标包数量
- ///
- [Display(Name = "标包数")]
- [Required(ErrorMessage = "{0}是必填项")]
- public decimal StdQty { get; set; }
+ /////
+ ///// 标包数量
+ /////
+ //[Display(Name = "标包数")]
+ //[Required(ErrorMessage = "{0}是必填项")]
+ //public decimal StdQty { get; set; }
///
/// 型号
///
[Display(Name = "型号")]
- public EnumEquipmentModel Model { get; set; }
+ public string Model { get; set; }
///
/// 库位编号
///
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
index a21be096e..8dafeec7e 100644
--- 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
@@ -10,11 +10,12 @@ public partial class BasedataApplicationAutoMapperProfile : Profile
private void EquipmentAutoMapperProfile()
{
CreateMap()
-
+
.ReverseMap();
CreateMap()
.IgnoreAuditedObjectProperties()
+ .Ignore(x => x.StdQty)
.Ignore(x => x.TenantId)
.Ignore(x => x.Remark)
.Ignore(x => x.ExtraProperties)
@@ -28,6 +29,7 @@ public partial class BasedataApplicationAutoMapperProfile : Profile
// .Ignore(x => x.Color);
CreateMap()
.IgnoreAuditedObjectProperties()
+ .Ignore(x => x.StdQty)
.Ignore(x => x.ConcurrencyStamp).Ignore(x => x.Id);
}
}
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
index fbd852777..154422405 100644
--- 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
@@ -1,5 +1,6 @@
using System;
using System.ComponentModel.DataAnnotations;
+using Microsoft.Extensions.Hosting;
using Win_in.Sfs.Shared.Domain;
using Win_in.Sfs.Shared.Domain.Entities;
using Win_in.Sfs.Shared.Domain.Shared;
@@ -19,13 +20,13 @@ public class Equipment : SfsBaseDataAggregateRootBase, IHasCode
///
public string Code { get; set; }
///
- /// 类型
+ /// 器具类型
///
- public EnumEquipmentType Type { get; set; }
+ public EnumContainerType Type { get; set; }
///
- /// 型号
+ /// 器具规格
///
- public EnumEquipmentModel Model { get; set; }
+ public string Model { get; set; }
///
/// 库位编号
///
diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/MesNotes/DTOs/MesNoteDTO.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/MesNotes/DTOs/MesNoteDTO.cs
new file mode 100644
index 000000000..06a7a4a5e
--- /dev/null
+++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/MesNotes/DTOs/MesNoteDTO.cs
@@ -0,0 +1,26 @@
+using System.ComponentModel.DataAnnotations;
+
+namespace Win_in.Sfs.Wms.Store.Application.Contracts;
+
+public class MesNoteDTO : SfsStoreDTOBase, IHasNumber
+{
+
+ ///
+ /// 任务ID
+ ///
+ [Display(Name = "任务ID")]
+ public string JobNumber { get; set; }
+
+ ///
+ /// 报废类型
+ ///
+ [Display(Name = "报废类型")]
+ public string Type { get; set; }
+
+ ///
+ /// 报废请求单号
+ ///
+ [Display(Name = "报废请求单号")]
+ public string ScrapRequestNumber { get; set; }
+
+}
diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/MesNotes/DTOs/MesNoteDetailDTO.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/MesNotes/DTOs/MesNoteDetailDTO.cs
new file mode 100644
index 000000000..d4896072d
--- /dev/null
+++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/MesNotes/DTOs/MesNoteDetailDTO.cs
@@ -0,0 +1,13 @@
+using System.ComponentModel.DataAnnotations;
+
+namespace Win_in.Sfs.Wms.Store.Application.Contracts;
+
+public class MesNoteDetailDTO : SfsStoreDetailWithFromToDTOBase
+{
+ ///
+ /// 原因代码
+ ///
+ [Display(Name = "原因代码")]
+ public string ReasonCode { get; set; }
+
+}
diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/MesNotes/IMesNoteAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/MesNotes/IMesNoteAppService.cs
new file mode 100644
index 000000000..13695d854
--- /dev/null
+++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/MesNotes/IMesNoteAppService.cs
@@ -0,0 +1,17 @@
+using System.Threading.Tasks;
+using Volo.Abp.Application.Dtos;
+
+namespace Win_in.Sfs.Wms.Store.Application.Contracts;
+
+using System.Threading;
+
+public interface IMesNoteAppService : ISfsStoreMasterReadOnlyAppServiceBase
+{
+ Task CreateAsync(MesNoteEditInput input);
+
+ Task> GetListByTypeAsync(
+ SfsStoreRequestInputBase requestInput,
+ string type,
+ bool includeDetails = false,
+ CancellationToken cancellationToken = default);
+}
diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/MesNotes/Inputs/MesNoteDetailInput.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/MesNotes/Inputs/MesNoteDetailInput.cs
new file mode 100644
index 000000000..ed70e44ba
--- /dev/null
+++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/MesNotes/Inputs/MesNoteDetailInput.cs
@@ -0,0 +1,13 @@
+using System.ComponentModel.DataAnnotations;
+
+namespace Win_in.Sfs.Wms.Store.Application.Contracts;
+
+public class MesNoteDetailInput : SfsStoreDetailWithFromToInputBase
+{
+ ///
+ /// 原因代码
+ ///
+ [Display(Name = "原因代码")]
+ public string ReasonCode { get; set; }
+
+}
diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/MesNotes/Inputs/MesNoteEditInput.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/MesNotes/Inputs/MesNoteEditInput.cs
new file mode 100644
index 000000000..8f36d14c6
--- /dev/null
+++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/MesNotes/Inputs/MesNoteEditInput.cs
@@ -0,0 +1,41 @@
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
+using Win_in.Sfs.Shared.Domain;
+
+namespace Win_in.Sfs.Wms.Store.Application.Contracts;
+
+public class MesNoteEditInput : SfsStoreCreateOrUpdateInputBase
+{
+ #region Create
+ ///
+ /// 任务ID
+ ///
+ [Display(Name = "任务ID")]
+ public string JobNumber { get; set; }
+
+ ///
+ /// 报废记录号
+ ///
+ [Display(Name = "报废记录号")]
+ [StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")]
+ public string Number { get; set; }
+
+ ///
+ /// 报废请求单号
+ ///
+ [Display(Name = "报废请求单号")]
+ public string ScrapRequestNumber { get; set; }
+
+ ///
+ /// 报废类型
+ ///
+ [Display(Name = "报废类型")]
+ public string Type { get; set; }
+
+ ///
+ /// 明细列表
+ ///
+ [Display(Name = "明细列表")]
+ public List Details { get; set; }
+ #endregion
+}
diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/MesNotes/Inputs/MesNoteImportInput.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/MesNotes/Inputs/MesNoteImportInput.cs
new file mode 100644
index 000000000..138e02958
--- /dev/null
+++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/MesNotes/Inputs/MesNoteImportInput.cs
@@ -0,0 +1,20 @@
+using System.ComponentModel.DataAnnotations;
+
+namespace Win_in.Sfs.Wms.Store.Application.Contracts;
+
+public class MesNoteImportInput : SfsStoreImportInputBase
+{
+
+ ///
+ /// 任务ID
+ ///
+ [Display(Name = "任务ID")]
+ public string JobNumber { get; set; }
+
+ ///
+ /// 报废请求单号
+ ///
+ [Display(Name = "报废请求单号")]
+ public string ScrapRequestNumber { get; set; }
+
+}
diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/MesNotes/MesNotePermissions.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/MesNotes/MesNotePermissions.cs
new file mode 100644
index 000000000..42a48c72f
--- /dev/null
+++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/MesNotes/MesNotePermissions.cs
@@ -0,0 +1,30 @@
+using Volo.Abp.Authorization.Permissions;
+using Win_in.Sfs.Wms.Store.Domain;
+
+namespace Win_in.Sfs.Wms.Store.Application.Contracts;
+
+public static class MesNotePermissions
+{
+
+ public const string Default = StorePermissions.GroupName + "." + nameof(MesNote);
+ public const string Create = Default + "." + StorePermissions.CreateStr;
+ public const string Update = Default + "." + StorePermissions.UpdateStr;
+ public const string Delete = Default + "." + StorePermissions.DeleteStr;
+
+ //完工收货报废记录
+ public const string ProductScrapNote = StorePermissions.GroupName + "." + nameof(ProductScrapNote);
+ //线边报废记录
+ public const string WipScrapNote = StorePermissions.GroupName + "." + nameof(WipScrapNote);
+
+ public static void AddMesNotePermission(this PermissionGroupDefinition permissionGroup)
+ {
+ var scrapNotePermission = permissionGroup.AddPermission(Default, StorePermissionDefinitionProvider.L(nameof(MesNote)));
+ scrapNotePermission.AddChild(Create, StorePermissionDefinitionProvider.L(StorePermissions.CreateStr));
+ scrapNotePermission.AddChild(Update, StorePermissionDefinitionProvider.L(StorePermissions.UpdateStr));
+ scrapNotePermission.AddChild(Delete, StorePermissionDefinitionProvider.L(StorePermissions.DeleteStr));
+
+ permissionGroup.AddPermission(ProductScrapNote, StorePermissionDefinitionProvider.L(nameof(ProductScrapNote)));
+ permissionGroup.AddPermission(WipScrapNote, StorePermissionDefinitionProvider.L(nameof(WipScrapNote)));
+
+ }
+}
diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Permissions/StorePermissionDefinitionProvider.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Permissions/StorePermissionDefinitionProvider.cs
index 52618b9ac..9c8dad174 100644
--- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Permissions/StorePermissionDefinitionProvider.cs
+++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Permissions/StorePermissionDefinitionProvider.cs
@@ -37,6 +37,8 @@ public class StorePermissionDefinitionProvider : PermissionDefinitionProvider
storeGroup.AddUnplannedIssueNotePermission();
storeGroup.AddIsolationNotePermission();
storeGroup.AddScrapNotePermission();
+
+ storeGroup.AddMesNotePermission();
storeGroup.AddDeliverPlanPermission();
storeGroup.AddDeliverRequestPermission();
storeGroup.AddDeliverNotePermission();
diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/MesNotes/MesNoteAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/MesNotes/MesNoteAppService.cs
new file mode 100644
index 000000000..a93d60ac8
--- /dev/null
+++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/MesNotes/MesNoteAppService.cs
@@ -0,0 +1,134 @@
+using System;
+using System.Linq.Expressions;
+using System.Threading;
+using System.Threading.Tasks;
+using DocumentFormat.OpenXml.Bibliography;
+using Microsoft.AspNetCore.Authorization;
+using Microsoft.AspNetCore.Mvc;
+using Volo.Abp.Application.Dtos;
+using Volo.Abp.EventBus;
+using Win_in.Sfs.Basedata.Application.Contracts;
+using Win_in.Sfs.Wms.Store.Application.Contracts;
+using Win_in.Sfs.Wms.Store.Domain;
+using Win_in.Sfs.Wms.Store.Domain.Shared;
+
+namespace Win_in.Sfs.Wms.Store.Application;
+
+using System.Collections.Generic;
+using System.Linq;
+using IdentityModel;
+using Volo.Abp.Domain.Entities;
+using Volo.Abp.ObjectMapping;
+using Win_in.Sfs.Shared.Domain;
+using Win_in.Sfs.Shared.Domain.Shared;
+using Win_in.Sfs.Shared.Event;
+using Win_in.Sfs.Wms.Inventory.Application.Contracts;
+
+[Authorize]
+[Route($"{StoreConsts.RootPath}mes-note")]
+public class MesNoteAppService :
+ SfsStoreWithDetailsAppServiceBase,
+ IMesNoteAppService
+{
+ private readonly ILocationAppService _locationAppService;
+ private readonly IItemBasicAppService _itemBasicAppService;
+ private readonly IBalanceAppService _balanceAppService;
+ public MesNoteAppService(
+ IMesNoteRepository repository, ILocationAppService locationAppService, IItemBasicAppService itemBasicAppService,IBalanceAppService balanceAppService) : base(repository)
+ {
+ _locationAppService = locationAppService;
+ _itemBasicAppService = itemBasicAppService;
+ _balanceAppService = balanceAppService;
+ }
+
+ [HttpPost("")]
+ public override async Task CreateAsync(MesNoteEditInput input)
+ {
+ var entity = ObjectMapper.Map(input);
+
+ var number = string.IsNullOrEmpty(entity.Number) ? await GenerateNumberAsync(nameof(MesNote), entity.ActiveDate).ConfigureAwait(false) : entity.Number;
+ entity.SetIdAndNumberWithDetails(GuidGenerator, number);
+
+ foreach (var detail in entity.Details)
+ {
+ var fromLocation=await _locationAppService.GetByCodeAsync(detail.FromLocationCode).ConfigureAwait(false);
+ var toLocation =await _locationAppService.GetByCodeAsync(detail.ToLocationCode).ConfigureAwait(false);
+ var itemBasicDto =await _itemBasicAppService.GetByCodeAsync(detail.ItemCode).ConfigureAwait(false);
+
+ detail.SetIdAndNumber(GuidGenerator, entity.Id, entity.Number);
+ detail.FromLocationArea = fromLocation.AreaCode;
+ detail.FromLocationErpCode = fromLocation.ErpLocationCode;
+ detail.FromLocationGroup = fromLocation.LocationGroupCode;
+ detail.FromWarehouseCode = fromLocation.WarehouseCode;
+ detail.ToLocationArea = toLocation.AreaCode;
+ detail.ToLocationErpCode = toLocation.ErpLocationCode;
+ detail.ToLocationGroup = toLocation.LocationGroupCode;
+ detail.ToWarehouseCode = toLocation.WarehouseCode;
+ detail.ToStatus = detail.FromStatus;
+ detail.Uom = itemBasicDto.BasicUom;
+ detail.StdPackQty = itemBasicDto.StdPackQty;
+
+ #region 添加校验
+
+ RecommendBalanceRequestInput rInput = new RecommendBalanceRequestInput();
+ rInput.ItemCode = detail.ItemCode;
+ rInput.Locations = new List() { detail.FromLocationCode };
+ rInput.Qty = detail.Qty;
+ rInput.Statuses = new List { EnumInventoryStatus.OK };
+ var balanceLst = await _balanceAppService.GetRecommendBalancesByLocationsAsync(rInput).ConfigureAwait(false);
+
+ var first = balanceLst.FirstOrDefault();
+ if (first != null)
+ {
+ if (detail.Qty > first.Qty)
+ { }
+
+
+
+
+
+ }
+ else
+ {
+
+
+
+
+
+ }
+
+
+
+
+
+ #endregion
+
+
+
+ }
+
+ entity = await _repository.InsertAsync(entity).ConfigureAwait(false);
+ await LocalEventBus.PublishAsync(new SfsCreatedEntityEventData(entity), false).ConfigureAwait(false);
+
+ var dto = ObjectMapper.Map(entity);
+ return dto;
+ }
+
+ [HttpPost("by-type/{type}")]
+ public virtual async Task> GetListByTypeAsync(
+ SfsStoreRequestInputBase requestInput,
+ string type,
+ bool includeDetails = false,
+ CancellationToken cancellationToken = default)
+ {
+ Expression> expression = p => p.Type == type;
+ if (requestInput.Condition.Filters?.Count > 0)
+ {
+ expression = expression.And(requestInput.Condition.Filters.ToLambda());
+ }
+
+ return await GetPagedListAsync(expression, requestInput.SkipCount, requestInput.MaxResultCount,
+ requestInput.Sorting, includeDetails, cancellationToken).ConfigureAwait(false);
+ }
+}
diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/MesNotes/MesNoteAutoMapperProfile.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/MesNotes/MesNoteAutoMapperProfile.cs
new file mode 100644
index 000000000..a07613dc0
--- /dev/null
+++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/MesNotes/MesNoteAutoMapperProfile.cs
@@ -0,0 +1,38 @@
+using AutoMapper;
+using Volo.Abp.AutoMapper;
+using Win_in.Sfs.Wms.Store.Application.Contracts;
+using Win_in.Sfs.Wms.Store.Domain;
+
+namespace Win_in.Sfs.Wms.Store.Application;
+
+public partial class StoreApplicationAutoMapperProfile : Profile
+{
+ private void MesNoteAutoMapperProfile()
+ {
+ CreateMap()
+ .ReverseMap();
+
+ CreateMap();
+
+ CreateMap()
+ .IgnoreAuditedObjectProperties()
+ .Ignore(x => x.MasterID)
+ .Ignore(x => x.TenantId)
+ .Ignore(x => x.Number)
+ .Ignore(x => x.Id);
+
+ CreateMap()
+ .IgnoreAuditedObjectProperties()
+ .Ignore(x => x.TenantId)
+ .Ignore(x => x.Number)
+ .Ignore(x => x.Id);
+ ;
+ CreateMap()
+ .IgnoreAuditedObjectProperties()
+ .Ignore(x => x.MasterID)
+ .Ignore(x => x.TenantId)
+ .Ignore(x => x.Number)
+ .Ignore(x => x.Id);
+ ;
+ }
+}
diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/MesNotes/IMesNoteManager.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/MesNotes/IMesNoteManager.cs
new file mode 100644
index 000000000..53f1055f5
--- /dev/null
+++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/MesNotes/IMesNoteManager.cs
@@ -0,0 +1,5 @@
+namespace Win_in.Sfs.Wms.Store.Domain;
+
+public interface IMesNoteManager : ISfsStoreManager
+{
+}
diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/MesNotes/IMesNoteRepository.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/MesNotes/IMesNoteRepository.cs
new file mode 100644
index 000000000..6f80b8945
--- /dev/null
+++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/MesNotes/IMesNoteRepository.cs
@@ -0,0 +1,6 @@
+namespace Win_in.Sfs.Wms.Store.Domain;
+
+public interface IMesNoteRepository : ISfsStoreRepositoryBase
+{
+
+}
diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/MesNotes/MesNote.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/MesNotes/MesNote.cs
new file mode 100644
index 000000000..22b6cae8b
--- /dev/null
+++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/MesNotes/MesNote.cs
@@ -0,0 +1,34 @@
+using System.Collections.Generic;
+using Win_in.Sfs.Shared.Domain.Entities;
+
+namespace Win_in.Sfs.Wms.Store.Domain;
+
+///
+/// 报废记录
+///
+public class MesNote : SfsStoreAggregateRootBase, IHasJobNumber
+{
+ ///
+ /// 任务ID
+ ///
+ [IgnoreUpdate]
+ public string JobNumber { get; set; }
+
+ ///
+ /// 报废请求单号
+ ///
+ [IgnoreUpdate]
+ public string ScrapRequestNumber { get; set; }
+
+ ///
+ /// Mes类型
+ ///
+ [IgnoreUpdate]
+ public string Type { get; set; }
+
+ ///
+ /// 明细列表
+ ///
+ [IgnoreUpdate]
+ public override List Details { get; set; } = new List();
+}
diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/MesNotes/MesNoteDetail.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/MesNotes/MesNoteDetail.cs
new file mode 100644
index 000000000..bd893f82f
--- /dev/null
+++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/MesNotes/MesNoteDetail.cs
@@ -0,0 +1,13 @@
+using System.ComponentModel.DataAnnotations;
+
+namespace Win_in.Sfs.Wms.Store.Domain;
+
+public class MesNoteDetail : SfsStoreDetailWithFromToEntityBase
+{
+ ///
+ /// 原因代码
+ ///
+ [Display(Name = "原因代码")]
+ public string ReasonCode { get; set; }
+
+}
diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/MesNotes/MesNoteManager.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/MesNotes/MesNoteManager.cs
new file mode 100644
index 000000000..b9d428b45
--- /dev/null
+++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/MesNotes/MesNoteManager.cs
@@ -0,0 +1,14 @@
+using System.Threading.Tasks;
+
+namespace Win_in.Sfs.Wms.Store.Domain;
+
+public class MesNoteManager : SfsStoreManagerBase, IMesNoteManager
+{
+
+ public MesNoteManager(
+ IMesNoteRepository repository
+ ) : base(repository)
+ {
+
+ }
+}
diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Notes/MesNotes/MesNoteDbContextModelCreatingExtensions.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Notes/MesNotes/MesNoteDbContextModelCreatingExtensions.cs
new file mode 100644
index 000000000..27a3b4842
--- /dev/null
+++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Notes/MesNotes/MesNoteDbContextModelCreatingExtensions.cs
@@ -0,0 +1,65 @@
+using Microsoft.EntityFrameworkCore;
+using Volo.Abp.EntityFrameworkCore.Modeling;
+using Win_in.Sfs.Shared.Domain.Shared;
+using Win_in.Sfs.Wms.Store.Domain;
+
+namespace Win_in.Sfs.Wms.Store.EntityFrameworkCore;
+
+public static class MesNoteDbContextModelCreatingExtensions
+{
+ public static void ConfigureMesNote(this ModelBuilder builder, StoreModelBuilderConfigurationOptions options)
+ {
+ builder.Entity(b =>
+ {
+ //Configure table & schema name
+ b.ToTable(options.TablePrefix + nameof(MesNote), options.Schema);
+ //Configure ABP properties
+ b.ConfigureByConvention();
+ //Configure Sfs base properties
+ b.ConfigureSfsStoreBase();
+
+ //Properties
+ b.Property(q => q.Type).HasMaxLength(SfsPropertyConst.CodeLength);
+ b.Property(q => q.ScrapRequestNumber).HasMaxLength(SfsPropertyConst.CodeLength);
+ //Relations
+ b.HasMany(q => q.Details).WithOne().HasForeignKey(d => d.MasterID).IsRequired();
+
+ //Indexes
+ b.HasIndex(q => new { q.Number }).IsUnique();
+ });
+
+ builder.Entity(b =>
+ {
+ //Configure table & schema name
+ b.ToTable(options.TablePrefix + nameof(MesNoteDetail), options.Schema);
+ //Configure ABP properties
+ b.ConfigureByConvention();
+ //Configure Sfs base properties
+ b.ConfigureSfsStoreBase();
+ //Configure Sfs store detail properties
+ b.ConfigureSfsStoreDetailBase();
+
+ //Properties
+ b.Property(q => q.ReasonCode).HasMaxLength(SfsPropertyConst.CodeLength);
+ b.Property(q => q.FromStatus).HasMaxLength(SfsPropertyConst.NameLength).HasConversion();
+ b.Property(q => q.ToStatus).HasMaxLength(SfsPropertyConst.NameLength).HasConversion();
+ b.Property(q => q.FromPackingCode).HasMaxLength(SfsPropertyConst.CodeLength);
+ b.Property(q => q.FromLocationCode).HasMaxLength(SfsPropertyConst.CodeLength);
+
+ //Relations
+
+ //Indexes
+ b.HasIndex(
+ q => new
+ {
+ q.Number,
+ q.ItemCode,
+ q.FromPackingCode,
+ q.FromLocationCode,
+ q.ToLocationCode,
+ q.FromLot,
+ q.FromStatus
+ }).IsUnique();
+ });
+ }
+}
diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Notes/MesNotes/MesNoteEfCoreRepository.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Notes/MesNotes/MesNoteEfCoreRepository.cs
new file mode 100644
index 000000000..04e3b58c2
--- /dev/null
+++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Notes/MesNotes/MesNoteEfCoreRepository.cs
@@ -0,0 +1,11 @@
+using Volo.Abp.EntityFrameworkCore;
+using Win_in.Sfs.Wms.Store.Domain;
+
+namespace Win_in.Sfs.Wms.Store.EntityFrameworkCore;
+
+public class MesNoteEfCoreRepository : SfsStoreEfCoreRepositoryBase, IMesNoteRepository
+{
+ public MesNoteEfCoreRepository(IDbContextProvider dbContextProvider) : base(dbContextProvider)
+ {
+ }
+}