diff --git a/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/Boms/IBomAppService.cs b/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/Boms/IBomAppService.cs index 1084d0dbd..b41d72059 100644 --- a/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/Boms/IBomAppService.cs +++ b/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/Boms/IBomAppService.cs @@ -41,5 +41,5 @@ public interface IBomAppService /// 总成数量 /// Task> GetMaterialTotalQtyAsync(string productCode, int productNum); - + Task> GetBomTreeByCodeAsync(string productCode); } diff --git a/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/Boms/BomAppService.cs b/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/Boms/BomAppService.cs index ec2e12831..1a620f23a 100644 --- a/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/Boms/BomAppService.cs +++ b/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/Boms/BomAppService.cs @@ -90,7 +90,20 @@ public class BomAppService : { return await _bomManager.GetListOfComponentAsync(component).ConfigureAwait(false); } + /// + /// 获取bomtree + /// + /// + /// + [HttpGet("get-bom-tree-by-code")] + public virtual async Task> GetBomTreeByCodeAsync(string productCode) + { + var entities = await _bomManager.GetAllItemByCode(productCode).ConfigureAwait(false); + var dtos = ObjectMapper.Map, List>(entities); + + return dtos; + } /// /// 获取所有子物料关系 /// diff --git a/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Domain/Boms/BomManager.cs b/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Domain/Boms/BomManager.cs index 2be49a698..2479c3625 100644 --- a/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Domain/Boms/BomManager.cs +++ b/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Domain/Boms/BomManager.cs @@ -213,4 +213,21 @@ public class BomManager : DomainService, IBomManager } return lst; } + /// + /// 获取所有bomtree + /// + /// + /// + public virtual async Task> GetAllItemByCode(string productCode) + { + List boms = new List(); + var lst = await _repository.GetListAsync(p => p.Product == productCode).ConfigureAwait(false); + foreach (var bom in lst) + { + boms.Add(bom); + var results= await GetAllItemByCode(bom.Component).ConfigureAwait(false); + boms.AddRange(results); + } + return boms; + } } diff --git a/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Domain/Boms/IBomManager.cs b/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Domain/Boms/IBomManager.cs index 9687f556e..8a801c2bf 100644 --- a/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Domain/Boms/IBomManager.cs +++ b/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Domain/Boms/IBomManager.cs @@ -40,5 +40,5 @@ public interface IBomManager : IDomainService, IBulkImportService /// 总成数量 /// Task> GetMaterialTotalQtyAsync(string productCode, int productNum); - + Task> GetAllItemByCode(string productCode); } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/DeliverRequests/DeliverRequestAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/DeliverRequests/DeliverRequestAppService.cs index 9f59ab043..39849fe91 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/DeliverRequests/DeliverRequestAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/DeliverRequests/DeliverRequestAppService.cs @@ -69,7 +69,7 @@ public class DeliverRequestAppService : public override async Task CreateAsync(DeliverRequestEditInput input) { var entity = ObjectMapper.Map(input); - + await SetRequestAutoPropertiesAsync(entity).ConfigureAwait(false); await _deliverRequestManager.CreateAsync(entity).ConfigureAwait(false); var dto = ObjectMapper.Map(entity); @@ -248,7 +248,16 @@ public class DeliverRequestAppService : private async Task SetRequestAutoPropertiesAsync(DeliverRequest entity) { - var tranType = await TransactionTypeAclService.GetByTransTypeAsync(EnumTransType.Deliver, EnumTransSubType.Deliver_Standard).ConfigureAwait(false); + var transType = EnumTransSubType.Deliver_Standard; + if (entity.DeliverRequestType == EnumDeliverRequestType.FIS) + { + transType = EnumTransSubType.Deliver_FIS; + } + else if (entity.DeliverRequestType == EnumDeliverRequestType.RAW) + { + transType = EnumTransSubType.Deliver_RAW; + } + var tranType = await TransactionTypeAclService.GetByTransTypeAsync(EnumTransType.Deliver, transType).ConfigureAwait(false); Check.NotNull(tranType, "事务类型", "事务类型不存在"); @@ -257,7 +266,7 @@ public class DeliverRequestAppService : entity.AutoAgree = tranType.AutoAgreeRequest; entity.AutoHandle = tranType.AutoHandleRequest; entity.DirectCreateNote = tranType.DirectCreateNote; - entity.DeliverRequestType = EnumDeliverRequestType.Normal; + entity.DeliverRequestType = entity.DeliverRequestType; } private static void CheckTransactionType(TransactionTypeDTO transactionType, ItemBasicDTO item)