diff --git a/be/Hosts/Basedata.Host/Win_in.Sfs.Basedata.HttpApi.Host/Properties/PublishProfiles/FolderProfile.pubxml b/be/Hosts/Basedata.Host/Win_in.Sfs.Basedata.HttpApi.Host/Properties/PublishProfiles/FolderProfile.pubxml
index ef3bc86af..39db2b9e4 100644
--- a/be/Hosts/Basedata.Host/Win_in.Sfs.Basedata.HttpApi.Host/Properties/PublishProfiles/FolderProfile.pubxml
+++ b/be/Hosts/Basedata.Host/Win_in.Sfs.Basedata.HttpApi.Host/Properties/PublishProfiles/FolderProfile.pubxml
@@ -10,7 +10,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
Release
Any CPU
FileSystem
- C:\发布\WMS
+ D:\发布\WMS\base
FileSystem
net6.0
diff --git a/be/Hosts/Wms.Host/Win_in.Sfs.Wms.Store.HttpApi.Host/Properties/PublishProfiles/FolderProfile.pubxml b/be/Hosts/Wms.Host/Win_in.Sfs.Wms.Store.HttpApi.Host/Properties/PublishProfiles/FolderProfile.pubxml
index 83d3b93a7..c238ca481 100644
--- a/be/Hosts/Wms.Host/Win_in.Sfs.Wms.Store.HttpApi.Host/Properties/PublishProfiles/FolderProfile.pubxml
+++ b/be/Hosts/Wms.Host/Win_in.Sfs.Wms.Store.HttpApi.Host/Properties/PublishProfiles/FolderProfile.pubxml
@@ -4,17 +4,13 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
-->
- true
- false
- true
+ False
+ False
+ True
Release
Any CPU
FileSystem
- .\..\..\..\OutPut\StoreHost\
+ D:\~all-publish\WMS2.0_东阳\Win_in.Sfs.Wms.Store.HttpApi.Host
FileSystem
-
- net6.0
- 488eeada-cfed-4016-9884-7a1dcbe5eb9c
- false
-
+
\ No newline at end of file
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
deleted file mode 100644
index c238ca481..000000000
--- a/be/Hosts/Wms.Host/Win_in.Sfs.Wms.Store.HttpApi.Host/Properties/PublishProfiles/FolderProfile1.pubxml
+++ /dev/null
@@ -1,16 +0,0 @@
-
-
-
-
- False
- False
- True
- Release
- Any CPU
- FileSystem
- D:\~all-publish\WMS2.0_东阳\Win_in.Sfs.Wms.Store.HttpApi.Host
- FileSystem
-
-
\ No newline at end of file
diff --git a/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/PositionCode/Inputs/PositionCodeImportInput.cs b/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/PositionCode/Inputs/PositionCodeImportInput.cs
index 9136deffe..53432b077 100644
--- a/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/PositionCode/Inputs/PositionCodeImportInput.cs
+++ b/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/PositionCode/Inputs/PositionCodeImportInput.cs
@@ -13,6 +13,7 @@ public class PositionCodeImportInput : SfsBaseDataImportInputBase
[Key]
[Display(Name = "代码")]
[StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")]
+ [Required(ErrorMessage = "{0}是必填项")]
public string Code { get; set; }
///
/// 物料号
@@ -60,6 +61,7 @@ public class PositionCodeImportInput : SfsBaseDataImportInputBase
/// 类型
///
[Display(Name = "类型")]
+ [Required(ErrorMessage = "{0}是必填项")]
public EnumRecommendType Type { get; set; }
}
diff --git a/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/PositionCode/PositionCodeAppService.cs b/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/PositionCode/PositionCodeAppService.cs
index 48117759c..29bd0b204 100644
--- a/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/PositionCode/PositionCodeAppService.cs
+++ b/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/PositionCode/PositionCodeAppService.cs
@@ -6,6 +6,7 @@ using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using Volo.Abp;
using Volo.Abp.Caching;
+using Volo.Abp.Domain.Repositories;
using Volo.Abp.Uow;
using Win_in.Sfs.Basedata.Application.Contracts;
using Win_in.Sfs.Basedata.Domain;
@@ -22,6 +23,7 @@ public class PositionCodeAppService
, IPositionCodeAppService
{
private readonly IPositionCodeManager _manager;
+ private new readonly IPositionCodeRepository _repository;
public PositionCodeAppService(IPositionCodeRepository repository, IDistributedCache cache, IPositionCodeManager manager) : base(repository, cache)
{
@@ -29,6 +31,7 @@ public class PositionCodeAppService
base.UpdatePolicyName = CategoryPermissions.Update;
base.DeletePolicyName = CategoryPermissions.Delete;
_manager = manager;
+ _repository = repository;
}
@@ -42,6 +45,12 @@ public class PositionCodeAppService
throw new UserFriendlyException($"{input.Code} 已存在");
}
+ var itemEntity = await _repository.FirstOrDefaultAsync(p => p.PartCode == input.PartCode).ConfigureAwait(false);
+ if(itemEntity != null)
+ {
+ throw new UserFriendlyException($"{input.PartCode} 物品已存在");
+ }
+
var itemBasic = await ItemBasicAppService.GetByCodeAsync(input.PartCode).ConfigureAwait(false);
Check.NotNull(itemBasic, "物品代码", $"物品 {input.PartCode} 不存在");
input.PartName = itemBasic.Name;
diff --git a/be/Modules/BaseData/src/Win_in.Sfs.Basedata.EntityFrameworkCore/PositionCode/PositionCodeDbContextModelCreatingExtensions.cs b/be/Modules/BaseData/src/Win_in.Sfs.Basedata.EntityFrameworkCore/PositionCode/PositionCodeDbContextModelCreatingExtensions.cs
index b679f5f79..33f7bd550 100644
--- a/be/Modules/BaseData/src/Win_in.Sfs.Basedata.EntityFrameworkCore/PositionCode/PositionCodeDbContextModelCreatingExtensions.cs
+++ b/be/Modules/BaseData/src/Win_in.Sfs.Basedata.EntityFrameworkCore/PositionCode/PositionCodeDbContextModelCreatingExtensions.cs
@@ -33,6 +33,8 @@ public static class PositionCodeDbContextModelCreatingExtensions
//Indexes
b.HasIndex(q => new { q.Code,q.PartCode,q.LocationCode }).IsUnique();
+ b.HasIndex(q => new { q.Code }).IsUnique();
+ b.HasIndex(q => new { q.PartCode }).IsUnique();
});
}
}
diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/ProductRecycleJobs/DTOs/ProductRecycleJobDTO.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/ProductRecycleJobs/DTOs/ProductRecycleJobDTO.cs
new file mode 100644
index 000000000..12e3f745f
--- /dev/null
+++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/ProductRecycleJobs/DTOs/ProductRecycleJobDTO.cs
@@ -0,0 +1,23 @@
+using System.ComponentModel.DataAnnotations;
+using Win_in.Sfs.Shared.Domain;
+
+namespace Win_in.Sfs.Wms.Store.Application.Contracts;
+
+[Display(Name = "客户退拆任务")]
+public class ProductRecycleJobDTO : SfsJobDTOBase
+{
+
+ ///
+ /// 车间
+ ///
+ [Display(Name = "车间")]
+ [StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")]
+ public string Workshop { get; set; }
+
+ ///
+ /// 班次
+ ///
+ [Display(Name = "班次")]
+ [StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")]
+ public string Shift { get; set; }
+}
diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/ProductRecycleJobs/DTOs/ProductRecycleJobDetailDTO.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/ProductRecycleJobs/DTOs/ProductRecycleJobDetailDTO.cs
new file mode 100644
index 000000000..32f7be931
--- /dev/null
+++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/ProductRecycleJobs/DTOs/ProductRecycleJobDetailDTO.cs
@@ -0,0 +1,90 @@
+using System.ComponentModel.DataAnnotations;
+using System.ComponentModel.DataAnnotations.Schema;
+using Volo.Abp.Data;
+using Win_in.Sfs.Shared.Domain;
+using Win_in.Sfs.Shared.Domain.Shared;
+
+namespace Win_in.Sfs.Wms.Store.Application.Contracts;
+
+public class ProductRecycleJobDetailDTO : SfsJobRecommendToDetailDTOBase
+{
+ ///
+ /// Bom版本
+ ///
+ public string BomVersion { get; set; }
+
+ ///
+ /// 库位代码
+ ///
+ public string LocationCode { get; set; }
+
+ ///
+ /// 库区
+ ///
+ public string LocationArea { get; set; }
+
+ ///
+ /// 库位组
+ ///
+ public string LocationGroup { get; set; }
+
+ ///
+ /// ERP库位代码
+ ///
+ public string LocationErpCode { get; set; }
+
+ ///
+ /// 原料库位代码
+ ///
+ public string RawLocationCode { get; set; }
+
+ ///
+ /// 原料库区
+ ///
+ public string RawLocationArea { get; set; }
+
+ ///
+ /// 原料库位组
+ ///
+ public string RawLocationGroup { get; set; }
+
+ ///
+ /// 原料ERP库位
+ ///
+ public string RawLocationErpCode { get; set; }
+
+ ///
+ /// 原料仓库
+ ///
+ public string RawWarehouseCode { get; set; }
+
+ ///
+ /// 计量单位
+ ///
+ [Display(Name = "计量单位")]
+ [MaxLength(SfsPropertyConst.CodeLength)]
+ public string Uom { get; set; }
+
+ ///
+ /// 数量
+ ///
+ [Display(Name = "数量")]
+ [Column(TypeName = "decimal(18,6)")]
+ public decimal Qty { get; set; }
+
+ ///
+ /// 扩展属性
+ ///
+ public ExtraPropertyDictionary ExtraProperties { get; } = new ExtraPropertyDictionary();
+
+ ///
+ /// 库存状态
+ ///
+ public EnumInventoryStatus Status { get; set; }
+
+ ///
+ /// 仓库代码
+ ///
+ public string WarehouseCode { get; set; }
+
+}
diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/ProductRecycleJobs/IProductRecycleJobAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/ProductRecycleJobs/IProductRecycleJobAppService.cs
new file mode 100644
index 000000000..c68fa097a
--- /dev/null
+++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/ProductRecycleJobs/IProductRecycleJobAppService.cs
@@ -0,0 +1,10 @@
+using System.Threading.Tasks;
+
+namespace Win_in.Sfs.Wms.Store.Application.Contracts;
+
+public interface IProductRecycleJobAppService
+ : ISfsJobAppServiceBase
+
+{
+
+}
diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/ProductRecycleJobs/Inputs/ProductRecycleJobCheckInput.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/ProductRecycleJobs/Inputs/ProductRecycleJobCheckInput.cs
new file mode 100644
index 000000000..4dc7816e5
--- /dev/null
+++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/ProductRecycleJobs/Inputs/ProductRecycleJobCheckInput.cs
@@ -0,0 +1,6 @@
+namespace Win_in.Sfs.Wms.Store.Application.Contracts;
+
+public class ProductRecycleJobCheckInput : SfsJobCheckInputBase
+{
+
+}
diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/ProductRecycleJobs/Inputs/ProductRecycleJobDetailInput.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/ProductRecycleJobs/Inputs/ProductRecycleJobDetailInput.cs
new file mode 100644
index 000000000..696e2b713
--- /dev/null
+++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/ProductRecycleJobs/Inputs/ProductRecycleJobDetailInput.cs
@@ -0,0 +1,90 @@
+using System.ComponentModel.DataAnnotations;
+using System.ComponentModel.DataAnnotations.Schema;
+using Volo.Abp.Data;
+using Win_in.Sfs.Shared.Domain;
+using Win_in.Sfs.Shared.Domain.Shared;
+
+namespace Win_in.Sfs.Wms.Store.Application.Contracts;
+
+public class ProductRecycleJobDetailInput : SfsJobRecommendToDetailInputBase
+{
+ ///
+ /// Bom版本
+ ///
+ public string BomVersion { get; set; }
+
+ ///
+ /// 库位代码
+ ///
+ public string LocationCode { get; set; }
+
+ ///
+ /// 库区
+ ///
+ public string LocationArea { get; set; }
+
+ ///
+ /// 库位组
+ ///
+ public string LocationGroup { get; set; }
+
+ ///
+ /// ERP库位代码
+ ///
+ public string LocationErpCode { get; set; }
+
+ ///
+ /// 原料库位代码
+ ///
+ public string RawLocationCode { get; set; }
+
+ ///
+ /// 原料库区
+ ///
+ public string RawLocationArea { get; set; }
+
+ ///
+ /// 原料库位组
+ ///
+ public string RawLocationGroup { get; set; }
+
+ ///
+ /// 原料ERP库位
+ ///
+ public string RawLocationErpCode { get; set; }
+
+ ///
+ /// 原料仓库
+ ///
+ public string RawWarehouseCode { get; set; }
+
+ ///
+ /// 计量单位
+ ///
+ [Display(Name = "计量单位")]
+ [MaxLength(SfsPropertyConst.CodeLength)]
+ public string Uom { get; set; }
+
+ ///
+ /// 数量
+ ///
+ [Display(Name = "数量")]
+ [Column(TypeName = "decimal(18,6)")]
+ public decimal Qty { get; set; }
+
+ ///
+ /// 扩展属性
+ ///
+ public ExtraPropertyDictionary ExtraProperties { get; } = new ExtraPropertyDictionary();
+
+ ///
+ /// 库存状态
+ ///
+ public EnumInventoryStatus Status { get; set; }
+
+ ///
+ /// 仓库代码
+ ///
+ public string WarehouseCode { get; set; }
+
+}
diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/ProductRecycleJobs/Inputs/ProductRecycleJobDetailSaveInput.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/ProductRecycleJobs/Inputs/ProductRecycleJobDetailSaveInput.cs
new file mode 100644
index 000000000..fa5580803
--- /dev/null
+++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/ProductRecycleJobs/Inputs/ProductRecycleJobDetailSaveInput.cs
@@ -0,0 +1,43 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
+using Win_in.Sfs.FileStorage.Application.Contracts;
+using Win_in.Sfs.Shared.Domain.Shared;
+
+namespace Win_in.Sfs.Wms.Store.Application.Contracts;
+
+///
+/// 客户退拆 保存模型
+///
+public class ProductRecycleJobDetailSaveInput
+{
+ ///
+ /// Id
+ ///
+ [Display(Name = "Id")]
+ public Guid Id { get; set; }
+ ///
+ /// 详情ID
+ ///
+ [Display(Name = "详情ID")]
+ public Guid DetailId { get; set; }
+
+ ///
+ /// 不合格原因
+ ///
+ [Display(Name = "不合格原因")]
+ public string FailedReason { get; set; }
+
+ ///
+ /// 质量缺陷
+ ///
+ [Display(Name = "质量缺陷")]
+ public string MassDefect { get; set; }
+
+
+ ///
+ /// 图片字节流
+ ///
+ [Display(Name = "图片字节流")]
+ public List FilesList { get; set; }
+}
diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/ProductRecycleJobs/Inputs/ProductRecycleJobEditInput.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/ProductRecycleJobs/Inputs/ProductRecycleJobEditInput.cs
new file mode 100644
index 000000000..3fc12e68e
--- /dev/null
+++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/ProductRecycleJobs/Inputs/ProductRecycleJobEditInput.cs
@@ -0,0 +1,48 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
+using Win_in.Sfs.Shared.Domain;
+using Win_in.Sfs.Shared.Domain.Shared;
+
+namespace Win_in.Sfs.Wms.Store.Application.Contracts;
+
+public class ProductRecycleJobEditInput : SfsJobCreateUpdateInputBase, ISfsJobCreateInput
+{
+ #region Create
+
+ ///
+ /// 上游任务编号
+ ///
+ [Display(Name = "上游任务编号")]
+ [StringLength(SfsEfCorePropertyConst.CodeLength, ErrorMessage = "{0}最多输入{1}个字符")]
+ public string UpStreamJobNumber { get; set; }
+
+ ///
+ /// 任务类型
+ ///
+ [Display(Name = "任务类型")]
+ [Required(ErrorMessage = "{0}是必填项")]
+ public EnumJobType JobType { get; set; }
+
+ ///
+ /// 是否自动完成
+ ///
+ [Display(Name = "是否自动完成")]
+ [Required(ErrorMessage = "{0}是必填项")]
+ public bool IsAutoComplete { get; set; }
+
+ ///
+ /// 过期时间
+ ///
+ [Display(Name = "过期时间")]
+ [Required(ErrorMessage = "{0}是必填项")]
+ public DateTime ExpiredTime { get; set; }
+
+ ///
+ /// 任务明细
+ ///
+ [Display(Name = "任务明细")]
+ [Required(ErrorMessage = "{0}是必填项")]
+ public List Details { get; set; }
+ #endregion
+}
diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/ProductRecycleJobs/ProductRecyclePermissions.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/ProductRecycleJobs/ProductRecycleJobPermissions.cs
similarity index 95%
rename from be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/ProductRecycleJobs/ProductRecyclePermissions.cs
rename to be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/ProductRecycleJobs/ProductRecycleJobPermissions.cs
index ca438e6ff..545314ba2 100644
--- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/ProductRecycleJobs/ProductRecyclePermissions.cs
+++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Jobs/ProductRecycleJobs/ProductRecycleJobPermissions.cs
@@ -3,7 +3,7 @@ using Win_in.Sfs.Wms.Store.Domain;
namespace Win_in.Sfs.Wms.Store.Application.Contracts;
-public static class ProductRecyclePermissions
+public static class ProductRecycleJobPermissions
{
public const string Default = StorePermissions.GroupName + "." + nameof(ProductRecycleJob);
public const string Create = Default + "." + StorePermissions.CreateStr;
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 92bbc9d6d..f0ef3dfc6 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
@@ -91,6 +91,7 @@ public class StorePermissionDefinitionProvider : PermissionDefinitionProvider
storeGroup.AddDeliverJobPermission();
storeGroup.AddPurchaseReturnJobPermission();
storeGroup.AddProductReceiveJobPermission();
+ storeGroup.AddProductRecycleJobPermission();
storeGroup.AddCheckJobPermission();
storeGroup.AddCountJobPermission();
storeGroup.AddJisDeliverJobPermission();
diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Win_in.Sfs.Wms.Store.Application.Contracts.csproj b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Win_in.Sfs.Wms.Store.Application.Contracts.csproj
index 7430f5c7e..a14d0abb2 100644
--- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Win_in.Sfs.Wms.Store.Application.Contracts.csproj
+++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Win_in.Sfs.Wms.Store.Application.Contracts.csproj
@@ -42,8 +42,6 @@
-
-
diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/InspectJobs/InspectJobAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/InspectJobs/InspectJobAppService.cs
index 677079a54..9ecba3c87 100644
--- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/InspectJobs/InspectJobAppService.cs
+++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/InspectJobs/InspectJobAppService.cs
@@ -170,7 +170,7 @@ public class InspectJobAppService
public virtual async Task SaveDetail_SplitPackingAsync(SplitPacking_UpdateJobDetailInput input)
{
InspectJob job = await _repository.FindAsync(p => p.Number == input.Number).ConfigureAwait(false);
- InspectJobDetail detail = job.Details.FirstOrDefault(p => p.PackingCode == input.FromPackingCode && p.InspectQty == input.FromQty);
+ InspectJobDetail detail = job.Details.FirstOrDefault(p => p.PackingCode == input.FromPackingCode); /* && p.ReceiveQty == input.FromQty*/
if (detail == null)
{
throw new UserFriendlyException($"根据PackingCode={input.FromPackingCode}取InspectDetail表为空!");
diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/IssueJobs/IssueJobAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/IssueJobs/IssueJobAppService.cs
index 6439fc1e8..f1e5d8d17 100644
--- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/IssueJobs/IssueJobAppService.cs
+++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/IssueJobs/IssueJobAppService.cs
@@ -168,23 +168,24 @@ public class IssueJobAppService
public virtual async Task SaveDetail_SplitPackingAsync(SplitPacking_UpdateJobDetailInput input)
{
var job = await _repository.FindAsync(p => p.Number == input.Number).ConfigureAwait(false);
- IssueJobDetail detail = job.Details.FirstOrDefault(p => p.HandledPackingCode == input.FromPackingCode && p.HandledQty == input.FromQty);
+ IssueJobDetail detail = job.Details.FirstOrDefault(p => p.RecommendPackingCode == input.FromPackingCode ); /*&& p.HandledQty == input.FromQty*/
if (detail == null)
{
- throw new UserFriendlyException($"根据HandledPackingCode={input.FromPackingCode}取IssueJobDetail表为空!");
+ //throw new UserFriendlyException($"根据HandledPackingCode={input.FromPackingCode}取IssueJobDetail表为空!");
+ throw new UserFriendlyException($"根据RecommendPackingCode={input.FromPackingCode}取IssueJobDetail表为空!");
}
//插入目标箱
var newDetail = CommonHelper.CloneObj(detail);
newDetail.SetId(GuidGenerator.Create());
newDetail.RecommendPackingCode = input.ToPackingCode;
newDetail.RecommendQty = input.ToQty;
- newDetail.HandledPackingCode = input.ToPackingCode;
- newDetail.HandledQty = input.ToQty;
+ newDetail.HandledPackingCode = detail.HandledPackingCode.HasValue() ? input.ToPackingCode : null; //源实际实际箱码有值,则新记录实际箱码有值
+ newDetail.HandledQty = detail.HandledQty > 0 ? input.ToQty : 0;
//newDetail.CreationTime = CommonHelper.CurTime;
job.Details.Add(newDetail);
//修改源箱
detail.RecommendQty = input.FromQty - input.ToQty;
- detail.HandledQty = input.FromQty - input.ToQty;
+ detail.HandledQty = detail.HandledQty > 0 ? input.FromQty - input.ToQty : 0;
var entity = await _repository.UpdateAsync(job).ConfigureAwait(false);
var ret = ObjectMapper.Map(entity);
return ret;
diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/ProductRecycleJobs/ProductRecycleJobAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/ProductRecycleJobs/ProductRecycleJobAppService.cs
new file mode 100644
index 000000000..a7842a0b5
--- /dev/null
+++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/ProductRecycleJobs/ProductRecycleJobAppService.cs
@@ -0,0 +1,28 @@
+using System.Threading.Tasks;
+using Microsoft.AspNetCore.Authorization;
+using Microsoft.AspNetCore.Mvc;
+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;
+
+[Authorize]
+[Route($"{StoreConsts.RootPath}production-recycle-job")]
+
+public class ProductRecycleJobAppService
+ : SfsJobAppServiceBase
+ , IProductRecycleJobAppService
+{
+ private readonly IProductRecycleJobManager _productRecycleJobManager;
+
+ public ProductRecycleJobAppService(
+ IProductRecycleJobRepository repository, IProductRecycleJobManager productRecycleJobManager)
+ : base(repository, productRecycleJobManager)
+ {
+ _productRecycleJobManager = productRecycleJobManager;
+ }
+
+
+
+}
diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/ProductRecycleJobs/ProductRecycleJobAutoMapperProfile.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/ProductRecycleJobs/ProductRecycleJobAutoMapperProfile.cs
new file mode 100644
index 000000000..87069a2b4
--- /dev/null
+++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/ProductRecycleJobs/ProductRecycleJobAutoMapperProfile.cs
@@ -0,0 +1,31 @@
+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 ProductRecycleJobAutoMapperProfile()
+ {
+ CreateMap()
+ .ReverseMap();
+
+ CreateMap()
+ ;
+
+ CreateMap();
+
+ CreateMap()
+ .IgnoreAuditedObjectProperties()
+ .Ignore(x => x.MasterID)
+ .Ignore(x => x.TenantId)
+ .Ignore(x => x.Number)
+ .Ignore(x => x.Id);
+
+ CreateMap()
+ ;
+
+ }
+}
diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/PurchaseReceiptJobs/PurchaseReceiptJobAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/PurchaseReceiptJobs/PurchaseReceiptJobAppService.cs
index 75d502fb6..ec046020f 100644
--- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/PurchaseReceiptJobs/PurchaseReceiptJobAppService.cs
+++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Jobs/PurchaseReceiptJobs/PurchaseReceiptJobAppService.cs
@@ -237,23 +237,25 @@ public class PurchaseReceiptJobAppService :
public virtual async Task SaveDetail_SplitPackingAsync(SplitPacking_UpdateJobDetailInput input)
{
var job = await _repository.FindAsync(p => p.Number == input.Number).ConfigureAwait(false);
- PurchaseReceiptJobDetail detail = job.Details.FirstOrDefault(p => p.HandledPackingCode == input.FromPackingCode && p.HandledQty == input.FromQty);
+ PurchaseReceiptJobDetail detail = job.Details.FirstOrDefault(p => p.RecommendPackingCode == input.FromPackingCode); /* && p.RecommendQty == input.FromQty*/
if (detail == null)
{
- throw new UserFriendlyException($"根据HandledPackingCode={input.FromPackingCode}取ReceiptRequestDetail表为空!");
+ //throw new UserFriendlyException($"根据HandledPackingCode={input.FromPackingCode}取ReceiptRequestDetail表为空!");
+ throw new UserFriendlyException($"根据RecommendPackingCode={input.FromPackingCode}取PurchaseReceiptJobDetail表为空!");
+
}
//插入目标箱
var newDetail = CommonHelper.CloneObj(detail);
newDetail.SetId(GuidGenerator.Create());
newDetail.RecommendPackingCode = input.ToPackingCode;
newDetail.RecommendQty = input.ToQty;
- newDetail.HandledPackingCode = input.ToPackingCode;
- newDetail.HandledQty = input.ToQty;
+ newDetail.HandledPackingCode = detail.HandledPackingCode.HasValue() ? input.ToPackingCode : null; //源实际实际箱码有值,则新记录实际箱码有值
+ newDetail.HandledQty = detail.HandledQty > 0 ? input.ToQty : 0;
//newDetail.CreationTime = CommonHelper.CurTime;
job.Details.Add(newDetail);
//修改源箱
detail.RecommendQty = input.FromQty - input.ToQty;
- detail.HandledQty = input.FromQty - input.ToQty;
+ detail.HandledQty = detail.HandledQty > 0 ? input.FromQty - input.ToQty : 0;
var entity = await _repository.UpdateAsync(job).ConfigureAwait(false);
var ret = ObjectMapper.Map(entity);
return ret;
diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/PurchaseReceiptRequests/PurchaseReceiptRequestAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/PurchaseReceiptRequests/PurchaseReceiptRequestAppService.cs
index 2c0039268..f146614c1 100644
--- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/PurchaseReceiptRequests/PurchaseReceiptRequestAppService.cs
+++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/PurchaseReceiptRequests/PurchaseReceiptRequestAppService.cs
@@ -168,10 +168,11 @@ public class PurchaseReceiptRequestAppService :
public virtual async Task SaveDetail_SplitPackingAsync(SplitPacking_UpdateJobDetailInput input, string packingCode)
{
var request = await _repository.FindAsync(p => p.Number == packingCode).ConfigureAwait(false);
- PurchaseReceiptRequestDetail detail = request.Details.FirstOrDefault(p => p.PackingCode == input.FromPackingCode && p.Qty == input.FromQty);
+ PurchaseReceiptRequestDetail detail = request.Details.FirstOrDefault(p => p.PackingCode == input.FromPackingCode); /* && p.Qty == input.FromQty*/
if (detail == null)
{
- throw new UserFriendlyException($"根据PackingCode={input.FromPackingCode}取ReceiptRequestDetail表为空!");
+ //throw new UserFriendlyException($"根据PackingCode={input.FromPackingCode}取ReceiptRequestDetail表为空!");
+ throw new UserFriendlyException($"根据PackingCode={input.FromPackingCode}取PurchaseReceiptRequestDetail表为空!");
}
//插入目标箱
var newDetail = CommonHelper.CloneObj(detail);
diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Jobs/ProductRecycleJobs/ProductRecycleJobManager.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Jobs/ProductRecycleJobs/ProductRecycleJobManager.cs
index f6f8db851..f27a29a7c 100644
--- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Jobs/ProductRecycleJobs/ProductRecycleJobManager.cs
+++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Jobs/ProductRecycleJobs/ProductRecycleJobManager.cs
@@ -1,10 +1,61 @@
-using System;
+using System;
using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
using System.Linq;
-using System.Text;
+using System.Linq.Expressions;
using System.Threading.Tasks;
+using Volo.Abp.Domain.Repositories;
+using Volo.Abp.Users;
+using Volo.Abp.Validation;
+using Win_in.Sfs.Shared.Domain.Shared;
-namespace Win_in.Sfs.Wms.Store.Jobs.ProductRecycleJobs;
-internal class ProductRecycleJobManager
+namespace Win_in.Sfs.Wms.Store.Domain;
+
+public class ProductRecycleJobManager : SfsJobManagerBase, IProductRecycleJobManager
{
+
+ public ProductRecycleJobManager(
+ IProductRecycleJobRepository repository
+ ) : base(repository)
+ {
+ }
+
+ public override void CheckDetails(ProductRecycleJob entity, AbpValidationResult result)
+ {
+ var details = entity.Details;
+ foreach (var detail in details)
+ {
+ if (detail.HandledToLocationCode == null)
+ {
+ result.Errors.Add(new ValidationResult($"{detail.HandledToLocationCode} 不能为空"));
+ }
+
+ }
+ }
+
+ public override async Task> GetWorkingListByPackingAsync(string packingCode)
+ {
+ return await Repository.GetListAsync(
+ c => c.Details.Any(p => p.RecommendPackingCode == packingCode)
+ && c.JobStatus != EnumJobStatus.Closed
+ && c.JobStatus != EnumJobStatus.Cancelled
+ , true).ConfigureAwait(false);
+
+ }
+
+ public override async Task> GetWorkingListByContainerAsync(string containerCode)
+ {
+ return await Repository.GetListAsync(
+ c => c.Details.Any(p => p.RecommendContainerCode == containerCode)
+ && c.JobStatus != EnumJobStatus.Closed
+ && c.JobStatus != EnumJobStatus.Cancelled
+ , true).ConfigureAwait(false);
+
+ }
+
+ public async Task GetAsync(Expression> expression)
+ {
+ return await Repository.FindAsync(expression).ConfigureAwait(false);
+ }
+
}
diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/IStoreDbContext.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/IStoreDbContext.cs
index dc0a7a333..a171f29dc 100644
--- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/IStoreDbContext.cs
+++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/IStoreDbContext.cs
@@ -96,6 +96,7 @@ public interface IStoreDbContext : IEfCoreDbContext
public DbSet JisDeliverJobs { get; }
public DbSet PurchaseReturnJobs { get; }
public DbSet ProductReceiveJobs { get; }
+ public DbSet ProductRecycleJobs { get; }
public DbSet CheckJobs { get; }
public DbSet CountJobs { get; }
public DbSet UnplannedIssueJobs { get; }
diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Jobs/IssueJobs/IssueJobDbContextModelCreatingExtensions.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Jobs/IssueJobs/IssueJobDbContextModelCreatingExtensions.cs
index f13b3c4ac..2a6c87990 100644
--- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Jobs/IssueJobs/IssueJobDbContextModelCreatingExtensions.cs
+++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Jobs/IssueJobs/IssueJobDbContextModelCreatingExtensions.cs
@@ -56,7 +56,8 @@ public static class IssueJobDbContextModelCreatingExtensions
b.Property(q => q.TruncType).HasMaxLength(SfsPropertyConst.NameLength).HasConversion();
b.Property(q => q.PlannedSplitRule).HasMaxLength(SfsPropertyConst.NameLength).HasConversion();
b.Property(q => q.OnTheWayLocationCode).HasMaxLength(SfsPropertyConst.CodeLength);
- b.Property(q => q.RecommendType).HasMaxLength(SfsPropertyConst.NameLength).HasConversion();
+ b.Property(q => q.PositionCode).HasMaxLength(SfsPropertyConst.CodeLength).IsRequired(false);
+ b.Property(q => q.RecommendType).HasMaxLength(SfsPropertyConst.CodeLength).HasConversion();
//Relations
//None
diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Jobs/ProductRecycleJobs/ProductRecycleJobDbContextModelCreatingExtensions.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Jobs/ProductRecycleJobs/ProductRecycleJobDbContextModelCreatingExtensions.cs
new file mode 100644
index 000000000..de07c7b69
--- /dev/null
+++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Jobs/ProductRecycleJobs/ProductRecycleJobDbContextModelCreatingExtensions.cs
@@ -0,0 +1,52 @@
+using Microsoft.EntityFrameworkCore;
+using Volo.Abp.EntityFrameworkCore.Modeling;
+using Win_in.Sfs.Shared.Domain.Shared;
+using Win_in.Sfs.Shared.EntityFrameworkCore;
+using Win_in.Sfs.Wms.Store.Domain;
+
+namespace Win_in.Sfs.Wms.Store.EntityFrameworkCore;
+
+public static class ProductRecycleJobDbContextModelCreatingExtensions
+{
+ public static void ConfigureProductRecycleJob(this ModelBuilder builder, StoreModelBuilderConfigurationOptions options)
+ {
+ builder.Entity(b =>
+ {
+ //Configure table & schema name
+ b.ToTable(StoreDbProperties.JobDbTablePrefix + nameof(ProductRecycleJob), options.Schema);
+ //Configure ABP properties
+ b.ConfigureByConvention();
+ //Configure Sfs base properties
+ b.ConfigureSfsBase();
+ //Configure Job base properties
+ b.ConfigureJob();
+ //Properties
+ b.Property(q => q.Workshop).IsRequired().HasMaxLength(SfsPropertyConst.CodeLength);
+ b.Property(q => q.Shift).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(StoreDbProperties.JobDbTablePrefix + nameof(ProductRecycleJobDetail), options.Schema);
+ //Configure ABP properties
+ b.ConfigureByConvention();
+ //Configure Sfs base properties
+ b.ConfigureSfsBase();
+ //Configure Job base properties
+ b.ConfigureJobRecommendToDetail();
+ //Properties
+
+
+ //Relations
+ //None
+
+ //Indexes
+ //b.HasIndex(q => new { q.PackingCode }).IsUnique();
+ });
+ }
+}
diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Jobs/ProductRecycleJobs/ProductRecycleJobEfCoreRepository.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Jobs/ProductRecycleJobs/ProductRecycleJobEfCoreRepository.cs
new file mode 100644
index 000000000..7e7a9b688
--- /dev/null
+++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Jobs/ProductRecycleJobs/ProductRecycleJobEfCoreRepository.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 ProductRecycleJobEfCoreRepository : SfsJobEfCoreRepositoryBase, IProductRecycleJobRepository
+{
+ public ProductRecycleJobEfCoreRepository(IDbContextProvider dbContextProvider) : base(dbContextProvider)
+ {
+ }
+}
diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/StoreDbContext.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/StoreDbContext.cs
index 12527670d..f9ed7239c 100644
--- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/StoreDbContext.cs
+++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/StoreDbContext.cs
@@ -96,6 +96,7 @@ public class StoreDbContext : AbpDbContext, IStoreDbContext
public DbSet JisDeliverJobs { get; set; }
public DbSet PurchaseReturnJobs { get; set; }
public DbSet ProductReceiveJobs { get; set; }
+ public DbSet ProductRecycleJobs { get; set; }
public DbSet CheckJobs { get; set; }
public DbSet CountJobs { get; set; }
public DbSet UnplannedIssueJobs { get; set; }
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 67eb52523..62d3e058d 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
@@ -115,6 +115,7 @@ public static class StoreDbContextModelCreatingExtensions
builder.ConfigureJisDeliverJob(options);
builder.ConfigurePurchaseReturnJob(options);
builder.ConfigureProductReceiveJob(options);
+ builder.ConfigureProductRecycleJob(options);
builder.ConfigureCheckJob(options);
builder.ConfigureCountJob(options);
builder.ConfigureUnplannedIssueJob(options);
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 2b05879e9..504232437 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
@@ -116,6 +116,7 @@ public class StoreEntityFrameworkCoreModule : AbpModule
context.Services.AddTransient();
context.Services.AddTransient();
context.Services.AddTransient();
+ context.Services.AddTransient();
context.Services.AddTransient();
context.Services.AddTransient();
context.Services.AddTransient();
@@ -279,6 +280,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/Jobs/ProductionRecycleJobEventHandler.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Jobs/ProductionRecycleJobEventHandler.cs
new file mode 100644
index 000000000..8e6c7fc5b
--- /dev/null
+++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Jobs/ProductionRecycleJobEventHandler.cs
@@ -0,0 +1,75 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+using Volo.Abp.EventBus;
+using Volo.Abp.Uow;
+using Win_in.Sfs.Shared.Domain.Shared;
+using Win_in.Sfs.Shared.Event;
+using Win_in.Sfs.Wms.Store.Application.Contracts;
+using Win_in.Sfs.Wms.Store.Domain;
+
+namespace Win_in.Sfs.Wms.Store.Event.BusinessJob;
+
+
+public class ProductionRecycleJobEventHandler :
+ StoreEventHandlerBase
+, ILocalEventHandler>
+, ILocalEventHandler>
+{
+ private readonly IProductRecycleNoteAppService _productRecycleNoteAppService;
+
+ public ProductionRecycleJobEventHandler(
+ IProductRecycleNoteAppService productRecycleNoteAppService
+ )
+ {
+ _productRecycleNoteAppService = productRecycleNoteAppService;
+ }
+
+ [UnitOfWork]
+ public virtual async Task HandleEventAsync(SfsCreatedEntityEventData eventData)
+ {
+ var entity = eventData.Entity;
+
+ if (entity.IsAutoComplete)
+ {
+ entity.CompleteTime = Clock.Now;
+ entity.JobStatus = EnumJobStatus.Done;
+
+ foreach (var detail in eventData.Entity.Details)
+ {
+ detail.SetHandledFromRecommend();
+ }
+
+ var note = BuildProductionReturnNote(entity);
+ await _productRecycleNoteAppService.CreateAsync(note).ConfigureAwait(false);
+ }
+ }
+
+ [UnitOfWork]
+ public virtual async Task HandleEventAsync(SfsCompletedEntityEventData eventData)
+ {
+ var entity = eventData.Entity;
+
+ var productRecycleNote = BuildProductionReturnNote(entity);
+ await _productRecycleNoteAppService.CreateAsync(productRecycleNote).ConfigureAwait(false);
+
+ }
+
+ private ProductRecycleNoteEditInput BuildProductionReturnNote(ProductRecycleJob entity)
+ {
+ var input = ObjectMapper.Map(entity);
+
+
+ input.Details = new List();
+
+ foreach (var detail in entity.Details.Where(detail => detail.HandledQty != 0))
+ {
+ var inputDetail = ObjectMapper.Map(detail);
+
+ input.Details.Add(inputDetail);
+ }
+
+ return input;
+ }
+}