|
@@ -13,6 +13,10 @@ using XCZ;
|
|
|
using Business.ResourceExamineManagement.Dto;
|
|
using Business.ResourceExamineManagement.Dto;
|
|
|
using Bussiness.Model.MES.IC;
|
|
using Bussiness.Model.MES.IC;
|
|
|
using AutoMapper.Internal.Mappers;
|
|
using AutoMapper.Internal.Mappers;
|
|
|
|
|
+using Business.Core.Utilities;
|
|
|
|
|
+using Hangfire.Storage.Monitoring;
|
|
|
|
|
+using Business.BookManagement.Dto;
|
|
|
|
|
+using Volo.Abp.ObjectMapping;
|
|
|
|
|
|
|
|
namespace Business.ResourceExamineManagement
|
|
namespace Business.ResourceExamineManagement
|
|
|
{
|
|
{
|
|
@@ -21,14 +25,17 @@ namespace Business.ResourceExamineManagement
|
|
|
|
|
|
|
|
private IRepository<ic_item, long> _ic_item;
|
|
private IRepository<ic_item, long> _ic_item;
|
|
|
private IRepository<ic_bom, long> _ic_bom;
|
|
private IRepository<ic_bom, long> _ic_bom;
|
|
|
|
|
+ private IRepository<ic_bom_child, long> _ic_bom_child;
|
|
|
|
|
|
|
|
public ResourceExamineAppService(
|
|
public ResourceExamineAppService(
|
|
|
IRepository<ic_item, long> icitem,
|
|
IRepository<ic_item, long> icitem,
|
|
|
- IRepository<ic_bom, long> icbom
|
|
|
|
|
|
|
+ IRepository<ic_bom, long> icbom,
|
|
|
|
|
+ IRepository<ic_bom_child, long> icbomchild
|
|
|
)
|
|
)
|
|
|
{
|
|
{
|
|
|
_ic_item = icitem;
|
|
_ic_item = icitem;
|
|
|
_ic_bom = icbom;
|
|
_ic_bom = icbom;
|
|
|
|
|
+ _ic_bom_child = icbomchild;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
/// <summary>
|
|
@@ -37,26 +44,92 @@ namespace Business.ResourceExamineManagement
|
|
|
/// <param name="input"></param>
|
|
/// <param name="input"></param>
|
|
|
/// <returns></returns>
|
|
/// <returns></returns>
|
|
|
/// <exception cref="NotImplementedException"></exception>
|
|
/// <exception cref="NotImplementedException"></exception>
|
|
|
- public Task<PschedDto> ReceiveResult(SeorderentryDto input)
|
|
|
|
|
|
|
+ public async Task<PschedDto> ReceiveResult(SeorderentryDto input)
|
|
|
{
|
|
{
|
|
|
- throw new NotImplementedException();
|
|
|
|
|
-
|
|
|
|
|
|
|
+ //throw new NotImplementedException();
|
|
|
|
|
+ long orderid=0;
|
|
|
|
|
+ long BomId=0;
|
|
|
|
|
+ int Quantity=0;
|
|
|
|
|
+ await BomPretreatmentAsync(orderid, BomId, Quantity);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
/// <summary>
|
|
|
/// BOM预处理
|
|
/// BOM预处理
|
|
|
/// </summary>
|
|
/// </summary>
|
|
|
|
|
+ /// <param name="orderid">订单行id</param>
|
|
|
/// <param name="BomId">Bom主键</param>
|
|
/// <param name="BomId">Bom主键</param>
|
|
|
/// <param name="Quantity">需要数量</param>
|
|
/// <param name="Quantity">需要数量</param>
|
|
|
- public async Task BomPretreatmentAsync(long? BomId, int Quantity)
|
|
|
|
|
|
|
+ public async Task BomPretreatmentAsync(long? orderid,long? BomId, int Quantity)
|
|
|
{
|
|
{
|
|
|
|
|
+ if (orderid == null)
|
|
|
|
|
+ {
|
|
|
|
|
+ //throw new bu
|
|
|
|
|
+ }
|
|
|
if (BomId == null)
|
|
if (BomId == null)
|
|
|
{
|
|
{
|
|
|
//throw new bu
|
|
//throw new bu
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- var query = (await _ic_bom.GetQueryableAsync()).WhereIf(true, a => a.bom_id == BomId).ToList();
|
|
|
|
|
|
|
+ var help = new SnowFlake(1, 1);
|
|
|
|
|
+ var id = help.NextId();
|
|
|
|
|
+ var level = 0;
|
|
|
|
|
+ var bomlist = (await _ic_bom.GetQueryableAsync()).ToList();
|
|
|
|
|
+ var bomchildlist = (await _ic_bom_child.GetQueryableAsync()).ToList();
|
|
|
|
|
+ var icitemlist = (await _ic_item.GetQueryableAsync()).ToList();
|
|
|
|
|
+ //GetBomListAsync();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ public void GetBomList(List<ic_bom> bomlist, List<ic_bom_child> bomchildlist, List<ic_item> icitemlist, long bomId, List<BomChildExamineDto> returnlist, long? parent_id, int le)
|
|
|
|
|
+ {
|
|
|
|
|
+ int level = le++;//初始化定义level层级
|
|
|
|
|
+ var help = new SnowFlake(1, 1);
|
|
|
|
|
+
|
|
|
|
|
+ var bom = bomlist.WhereIf(true, s => s.bom_id == bomId).FirstOrDefault();
|
|
|
|
|
+ if (bom == null)
|
|
|
|
|
+ {
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+ var dto = new BomChildExamineDto();
|
|
|
|
|
+ dto.level = level;
|
|
|
|
|
+ dto.bom_id = bomId;
|
|
|
|
|
+ dto.id = help.NextId();
|
|
|
|
|
+ dto.parent_id = parent_id;
|
|
|
|
|
+ dto.item_id = bom.icitem_id;
|
|
|
|
|
+ dto.item_name = bom.item_name;
|
|
|
|
|
+ dto.item_code = bom.item_number;
|
|
|
|
|
+ //var bdto = ObjectMapper.Map<ic_bom,BomChildExamineDto>(bom);
|
|
|
|
|
+ returnlist.Add(dto);
|
|
|
|
|
+ var childlist = bomchildlist.WhereIf(true, a => a.bom_id == bom.bom_id).ToList();
|
|
|
|
|
+ foreach (var c in childlist)
|
|
|
|
|
+ {
|
|
|
|
|
+ var icitem = icitemlist.WhereIf(true, a => a.icitem_id == c.icitem_id).FirstOrDefault();
|
|
|
|
|
+ //如果此明细查的到BOM信息,则代表此child是一个子BOM。
|
|
|
|
|
+ if (c.is_bom == 1)
|
|
|
|
|
+ {
|
|
|
|
|
+ var childBom = bomlist.WhereIf(true, a => a.icitem_id == c.icitem_id).FirstOrDefault();
|
|
|
|
|
+ if (childBom != null)
|
|
|
|
|
+ {
|
|
|
|
|
+ GetBomList(bomlist, bomchildlist, icitemlist, childBom.bom_id, returnlist, dto.id, level);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ else {
|
|
|
|
|
+ if (icitem != null)
|
|
|
|
|
+ {
|
|
|
|
|
+ var childDto = new BomChildExamineDto();
|
|
|
|
|
+ childDto.level = level++;
|
|
|
|
|
+ childDto.bom_id = bomId;
|
|
|
|
|
+ childDto.id = help.NextId();
|
|
|
|
|
+ childDto.parent_id = parent_id;
|
|
|
|
|
+ childDto.item_id = icitem.icitem_id;
|
|
|
|
|
+ childDto.item_name = icitem.name;
|
|
|
|
|
+ childDto.item_code = icitem.number;
|
|
|
|
|
+ returnlist.Add(childDto);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
}
|
|
}
|
|
|
/// <summary>
|
|
/// <summary>
|
|
|
/// 检查在制工单
|
|
/// 检查在制工单
|