From 2c24ce7fe2de409d6f7b82a95a4bc307852a7c24 Mon Sep 17 00:00:00 2001
From: zhaoxinyu <89237069@qq.com>
Date: Tue, 2 Apr 2024 15:10:04 +0800
Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E7=89=88=E6=9C=AC?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../Equipments/DTOs/EquipmentDTO.cs | 2 +-
.../Equipments/Inputs/EquipmentEditInput.cs | 2 +-
.../Equipments/Inputs/EquipmentImportInput.cs | 4 +-
.../Equipments/Equipment.cs | 2 +-
.../Notes/MesNotes/MesNoteAppService.cs | 50 ++++++++++++-------
.../StoreApplicationAutoMapperProfile.cs | 2 +-
.../StoreDbContextModelCreatingExtensions.cs | 1 +
.../StoreEntityFrameworkCoreModule.cs | 6 +++
.../Notes/MesNoteAutoMapperProfile.cs | 44 ++++++++++++++++
.../StoreEventAutoMapperProfile.cs | 1 +
10 files changed, 90 insertions(+), 24 deletions(-)
create mode 100644 be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Notes/MesNoteAutoMapperProfile.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
index 33fdd9dc1..fbffb43a2 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 EnumContainerType Type { get; set; }
+ public string Type { 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 29f3c2020..03b54c027 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 EnumContainerType Type { get; set; }
+ public string Type { 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 88d88bfce..b06546790 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
@@ -12,7 +12,7 @@ public class EquipmentImportInput : SfsBaseDataImportInputBase
/// 类型
///
[Display(Name = "类型")]
- public EnumContainerType Type { get; set; }
+ public string Type { get; set; }
///
/// 器具编号
///
@@ -37,7 +37,7 @@ public class EquipmentImportInput : SfsBaseDataImportInputBase
/// 库位编号
///
[Display(Name = "库位代码")]
- //[Required(ErrorMessage = "{0}是必填项")]
+ [Required(ErrorMessage = "{0}是必填项")]
public string LocCode { get; set; } = string.Empty;
///
/// 状态
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 154422405..c57ae54f6 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
@@ -22,7 +22,7 @@ public class Equipment : SfsBaseDataAggregateRootBase, IHasCode
///
/// 器具类型
///
- public EnumContainerType Type { get; set; }
+ public string Type { get; set; }
///
/// 器具规格
///
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
index 86d8c6e5d..5b154ffb1 100644
--- 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
@@ -51,12 +51,23 @@ public class MesNoteAppService :
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);
+ if (fromLocation == null)
+ {
+
+ throw new UserFriendlyException($"库位为空");
+
+ }
detail.SetIdAndNumber(GuidGenerator, entity.Id, entity.Number);
detail.FromLocationArea = fromLocation.AreaCode;
detail.FromLocationErpCode = fromLocation.ErpLocationCode;
@@ -71,24 +82,27 @@ public class MesNoteAppService :
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)
- {
- throw new UserFriendlyException($"库存数量不足");
- }
- }
- else
- {
- throw new UserFriendlyException($"库存数量不足");
- }
+ //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)
+ // {
+ // throw new UserFriendlyException($"库存数量不足");
+ // }
+ //}
+ //else
+ //{
+ // throw new UserFriendlyException($"库存数量不足");
+ //}
#endregion
}
diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/StoreApplicationAutoMapperProfile.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/StoreApplicationAutoMapperProfile.cs
index 8c64426d3..8f5e9efa0 100644
--- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/StoreApplicationAutoMapperProfile.cs
+++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/StoreApplicationAutoMapperProfile.cs
@@ -91,7 +91,7 @@ public partial class StoreApplicationAutoMapperProfile : Profile
NoOkConvertOkNoteAutoMapperProfile();
InventoryInitialNoteAutoMapperProfile();
WipWarehouseAdjustNoteMapperProfile();
-
+ MesNoteAutoMapperProfile();
#endregion
#region Jobs
diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/StoreDbContextModelCreatingExtensions.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/StoreDbContextModelCreatingExtensions.cs
index cd0750295..f81e92ce5 100644
--- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/StoreDbContextModelCreatingExtensions.cs
+++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/StoreDbContextModelCreatingExtensions.cs
@@ -103,6 +103,7 @@ public static class StoreDbContextModelCreatingExtensions
builder.ConfigureNoOkConvertOKNote(options);
builder.ConfigureInventoryInitialNote(options);
builder.ConfigureWipWarehouseAdjustNote(options);
+ builder.ConfigureMesNote(options);
#endregion
#region Jobs
diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/StoreEntityFrameworkCoreModule.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/StoreEntityFrameworkCoreModule.cs
index 997949441..fff22749d 100644
--- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/StoreEntityFrameworkCoreModule.cs
+++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/StoreEntityFrameworkCoreModule.cs
@@ -121,6 +121,8 @@ public class StoreEntityFrameworkCoreModule : AbpModule
context.Services.AddTransient();
context.Services.AddTransient();
+ context.Services.AddTransient();
+
#endregion
#region Jobs
@@ -249,6 +251,8 @@ public class StoreEntityFrameworkCoreModule : AbpModule
orderOptions.DefaultWithDetailsFunc = query => query.Include(o => o.Details));
options.Entity(orderOptions =>
orderOptions.DefaultWithDetailsFunc = query => query.Include(o => o.Details));
+ options.Entity(orderOptions =>
+ orderOptions.DefaultWithDetailsFunc = query => query.Include(o => o.Details));
options.Entity(orderOptions =>
orderOptions.DefaultWithDetailsFunc = query => query.Include(o => o.Details));
options.Entity(orderOptions =>
@@ -257,6 +261,8 @@ public class StoreEntityFrameworkCoreModule : AbpModule
orderOptions.DefaultWithDetailsFunc = query => query.Include(o => o.Details));
options.Entity(orderOptions =>
orderOptions.DefaultWithDetailsFunc = query => query.Include(o => o.Details));
+ options.Entity(orderOptions =>
+ orderOptions.DefaultWithDetailsFunc = query => query.Include(o => o.Details));
options.Entity(orderOptions =>
orderOptions.DefaultWithDetailsFunc = query => query.Include(o => o.Details));
options.Entity(orderOptions =>
diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Notes/MesNoteAutoMapperProfile.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Notes/MesNoteAutoMapperProfile.cs
new file mode 100644
index 000000000..e5d6f22db
--- /dev/null
+++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Notes/MesNoteAutoMapperProfile.cs
@@ -0,0 +1,44 @@
+using AutoMapper;
+using Volo.Abp.AutoMapper;
+using Win_in.Sfs.Shared.Application;
+using Win_in.Sfs.Wms.Inventory.Application.Contracts;
+using Win_in.Sfs.Wms.Store.Domain;
+
+namespace Win_in.Sfs.Wms.Store.Event;
+
+public partial class StoreEventAutoMapperProfile : Profile
+{
+ private void MesNoteAutoMapperProfile()
+ {
+ CreateMap()
+ .Ignore(x => x.ExtraProperties)
+ .Ignore(x => x.DocNumber)
+ .Ignore(x => x.JobNumber)
+ .Ignore(x => x.Worker)
+ .Ignore(x => x.TransType)
+ .Ignore(x => x.TransSubType)
+ ;
+
+ CreateMap()
+ .MapNegativeQty()
+ .ForMember(x => x.PackingCode, y => y.MapFrom(d => d.FromPackingCode))
+ .ForMember(x => x.ContainerCode, y => y.MapFrom(d => d.FromContainerCode))
+ .ForMember(x => x.Lot, y => y.MapFrom(d => d.FromLot))
+ .ForMember(x => x.Status, y => y.MapFrom(d => d.FromStatus))
+ .ForMember(x => x.LocationCode, y => y.MapFrom(d => d.FromLocationCode))
+ .ForMember(x => x.LocationArea, y => y.MapFrom(d => d.FromLocationArea))
+ .ForMember(x => x.LocationGroup, y => y.MapFrom(d => d.FromLocationGroup))
+ .ForMember(x => x.LocationErpCode, y => y.MapFrom(d => d.FromLocationErpCode))
+ .ForMember(x => x.WarehouseCode, y => y.MapFrom(d => d.FromWarehouseCode))
+ .Ignore(x => x.ExtraProperties)
+ .Ignore(x => x.DocNumber)
+ .Ignore(x => x.JobNumber)
+ .Ignore(x => x.Worker)
+ .Ignore(x => x.ManageType)
+ .Ignore(x => x.TransType)
+ .Ignore(x => x.TransSubType)
+ .Ignore(x => x.TransInOut)
+ ;
+ }
+
+}
diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/StoreEventAutoMapperProfile.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/StoreEventAutoMapperProfile.cs
index 3f57465d5..d79336d0a 100644
--- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/StoreEventAutoMapperProfile.cs
+++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/StoreEventAutoMapperProfile.cs
@@ -107,6 +107,7 @@ public partial class StoreEventAutoMapperProfile : Profile
CoatingIssueJobAutoMapperProfile();
CoatingIssueNoteAutoMapperProfile();
CoatingMaterialRequestAutoMapperProfile();
+ MesNoteAutoMapperProfile();
}
}