Browse Source

更新版本

dev_DY_CC
赵新宇 1 year ago
parent
commit
eb284fc462
  1. 17
      be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/Boms/DTOs/BomComponentDTO.cs
  2. 7
      be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/Boms/BomAppService.cs
  3. 27
      be/Modules/BaseData/src/Win_in.Sfs.Basedata.Domain/Boms/BomManager.cs
  4. 15
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Plans/InjectioModelPlans/InjectioModelPlanAppService.cs

17
be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/Boms/DTOs/BomComponentDTO.cs

@ -1,24 +1,35 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Xml.Linq;
namespace Win_in.Sfs.Basedata.Boms.DTOs; namespace Win_in.Sfs.Basedata.Boms.DTOs;
public class BomComponentDTO public class BomComponentDTO
{ {
[Display(Name = "根物料号")]
public string Root { get; set; } public string Root { get; set; }
[Display(Name = "物料号")]
public string Component { get; set; } public string Component { get; set; }
[Display(Name = "单位")]
public string ComponentUom { get; set; } public string ComponentUom { get; set; }
[Display(Name = "用量")]
public decimal ComponentQty { get; set; } public decimal ComponentQty { get; set; }
[Display(Name = "父物料号")]
public string ParentComponent { get; set; } public string ParentComponent { get; set; }
[Display(Name = "合计数量")]
public decimal SumQty { get; set; } public decimal SumQty { get; set; }
[Display(Name = "层数")]
public int Level { get; set; } public int Level { get; set; }
public List<BomComponent> SubComponents { get; set; } public List<BomComponent> SubComponents { get; set; }
[Display(Name = "拆解路径")]
public string Path { set; get; } public string Path { set; get; }
} }

7
be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/Boms/BomAppService.cs

@ -37,6 +37,13 @@ public class BomAppService :
base.DeletePolicyName = BomPermissions.Delete; base.DeletePolicyName = BomPermissions.Delete;
} }
#region Get #region Get
[HttpGet("get-by-productitemcode")] [HttpGet("get-by-productitemcode")]

27
be/Modules/BaseData/src/Win_in.Sfs.Basedata.Domain/Boms/BomManager.cs

@ -291,13 +291,30 @@ public class BomManager : DomainService, IBomManager
} }
return returnList; return returnList;
} }
//private static List<BomComponent> BomComponents = new List<BomComponent>();
//private static List<BomComponent> GetBomComponents()
//{
// if(BomComponents.Any() && )
// var lst = await _repository.GetListAsync(p => p.Product == productCode).ConfigureAwait(false);
//}
/// <summary>
/// 层级、拆解、一维结构、树状结构
/// </summary>
/// <param name="p_component">上级组件(初始时为根元素)</param>
/// <param name="level">层级一般为1</param>
/// <param name="sumQty">累计数量</param>
/// <param name="root">根</param>
/// <param name="p_actionLast">拆解到最终零件时</param>
/// <param name="p_actionDimension">树型转成一维表用</param>
/// <returns></returns>
@ -310,19 +327,19 @@ public class BomManager : DomainService, IBomManager
/// <param name="root">根</param> /// <param name="root">根</param>
/// <param name="p_actionLast">拆解到最终零件时</param> /// <param name="p_actionLast">拆解到最终零件时</param>
/// <param name="p_actionDimension">树型转成一维表用</param> /// <param name="p_actionDimension">树型转成一维表用</param>
/// <param name="bomList"></param>
/// <returns></returns> /// <returns></returns>
private async Task<List<BomComponent>> GetSubcomponentsRecursive(BomComponent p_component, int level, decimal sumQty, string root, Action<BomComponent> p_actionLast, private async Task<List<BomComponent>> GetSubcomponentsRecursive(BomComponent p_component, int level, decimal sumQty, string root, Action<BomComponent> p_actionLast,
Action<BomComponent> p_actionDimension Action<BomComponent> p_actionDimension
/*,List<BomComponent> partcodeList =null*/ /* ,List<Bom> bomList =null*/
) )
{ {
List<BomComponent> subComponents = new List<BomComponent>(); List<BomComponent> subComponents = new List<BomComponent>();
// 假设 GetComponentsByProduct 方法可获取某个物料号下的所有子零件 // 假设 GetComponentsByProduct 方法可获取某个物料号下的所有子零件
//List<BomComponent> directSubComponents=new List<BomComponent>();
//if (partcodeList.Any())
//{
// partcodeList.Where(p => p.Component == p_component.Component);
//if (bomList != null && bomList.Count() > 0)
//{
// = bomList.Where(p => p.Product == p_component.Component)
//} //}
//else //else
//{ //{

15
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Plans/InjectioModelPlans/InjectioModelPlanAppService.cs

@ -128,11 +128,9 @@ public class InjectioModelPlanAppService :
[HttpPost("get-sumdetails-byNumbers")] [HttpPost("get-sumdetails-byNumbers")]
public virtual async Task<IActionResult> GetBomList(List<string> p_nodes) public virtual async Task<List<BomComponentDTO>> GetBomList(List<string> p_nodes)
{ {
var list = _repository.WithDetails().Where(p => p_nodes.Contains(p.Number)); var list = _repository.WithDetails().Where(p => p_nodes.Contains(p.Number));
List<BomComponentDTO> inputs = new List<BomComponentDTO>(); List<BomComponentDTO> inputs = new List<BomComponentDTO>();
foreach (var itm in list) foreach (var itm in list)
{ {
@ -149,11 +147,12 @@ public class InjectioModelPlanAppService :
} }
var bomlist = await _bomAppService.GetSubcomponentsRecursiveList(inputs, EnumBomSelectedType.Last).ConfigureAwait(false); var bomlist = await _bomAppService.GetSubcomponentsRecursiveList(inputs, EnumBomSelectedType.Last).ConfigureAwait(false);
if(bomlist.Count==0) return bomlist;
{ //if(bomlist.Count==0)
throw new Exception("Bom中没有查到零件BOM结构"); //{
} // throw new Exception("Bom中没有查到零件BOM结构");
return ExportImportService.Export(bomlist); //}
//return ExportImportService.Export(bomlist);
} }
[HttpPost("get-bom-by-detail")] [HttpPost("get-bom-by-detail")]

Loading…
Cancel
Save