|
|
@@ -9,6 +9,7 @@ using Business.PriorityManagement;
|
|
|
using Business.Replenishment;
|
|
|
using Business.ReplenishmentManagement;
|
|
|
using Business.ResourceExamineManagement.Dto;
|
|
|
+using Business.StructuredDB.MES.IC;
|
|
|
using Business.StructuredDB.Replenishment;
|
|
|
using Business.StructuredDB.SaleFcst;
|
|
|
using Business.StructuredDB.WMS;
|
|
|
@@ -278,6 +279,11 @@ namespace Business.ResourceExamineManagement
|
|
|
/// </summary>
|
|
|
private ISqlRepository<WorkOrdMaster> _workOrdMaster;
|
|
|
|
|
|
+ /// <summary>
|
|
|
+ /// 成品虚拟件工序关系表
|
|
|
+ /// </summary>
|
|
|
+ private readonly ISqlRepository<ProductStructureOp> _productStructureOp;
|
|
|
+
|
|
|
/// <summary>
|
|
|
/// 工单物料明细
|
|
|
/// </summary>
|
|
|
@@ -457,6 +463,7 @@ namespace Business.ResourceExamineManagement
|
|
|
ISqlRepository<ProductStructureMaster> productStructureMaster,
|
|
|
ISqlRepository<WorkOrdRouting> workOrdRouting,
|
|
|
ISqlRepository<WorkOrdMaster> workOrdMaster,
|
|
|
+ ISqlRepository<ProductStructureOp> productStructureOp,
|
|
|
ISqlRepository<WorkOrdDetail> workOrdDetail,
|
|
|
ISqlRepository<NbrMaster> nbrMaster,
|
|
|
ISqlRepository<NbrDetail> nbrDetail,
|
|
|
@@ -556,6 +563,7 @@ namespace Business.ResourceExamineManagement
|
|
|
_productStructureMaster = productStructureMaster;
|
|
|
_workOrdRouting = workOrdRouting;
|
|
|
_workOrdMaster = workOrdMaster;
|
|
|
+ _productStructureOp = productStructureOp;
|
|
|
_workOrdDetail = workOrdDetail;
|
|
|
_lineMaster = lineMaster;
|
|
|
_itemMaster = itemMaster;
|
|
|
@@ -3331,6 +3339,8 @@ namespace Business.ResourceExamineManagement
|
|
|
}
|
|
|
rtn.examines = examines;
|
|
|
List<WorkOrdDetail> workOrdDetails = new List<WorkOrdDetail>();
|
|
|
+ //成品虚拟件对应关系
|
|
|
+ var productOpList = _productStructureOp.Select(x => workOrds.Select(c => c.ItemNum).Contains(x.ProductItem) && x.Domain == param.factoryId.ToString());
|
|
|
foreach (var workord in workOrds)
|
|
|
{
|
|
|
var exm = examines.Find(s => s.morder_no == workord.WorkOrd);
|
|
|
@@ -3344,7 +3354,8 @@ namespace Business.ResourceExamineManagement
|
|
|
continue;
|
|
|
}
|
|
|
List<BomChildExamineDto> returnList = new List<BomChildExamineDto>();
|
|
|
- GetWorkDetalis(childs.Where(s => s.parent_id == child.fid).ToList(), returnList, childs);
|
|
|
+ var productOps = productOpList.Where(x => x.ProductItem == workord.ItemNum).ToList();
|
|
|
+ GetWorkDetalis(childs.Where(s => s.parent_id == child.fid).ToList(), returnList, childs, productOps);
|
|
|
if (returnList.Any())
|
|
|
{
|
|
|
WorkOrdDetail woDetail = null;
|
|
|
@@ -4190,8 +4201,10 @@ namespace Business.ResourceExamineManagement
|
|
|
WorkOrdMaster workOrd;
|
|
|
//工单工艺路线表
|
|
|
WorkOrdRouting woRouting;
|
|
|
- //工单物料表
|
|
|
- var productStructureMs = _productStructureMaster.Select(x => morders.Select(c => c.morder_no).Contains(x.ParentItem) && x.Domain == param.factoryId.ToString());
|
|
|
+ List<string> orderCode = morders.Select(c => c.product_code).ToList();
|
|
|
+ //成品虚拟件对应关系
|
|
|
+ var productOpList = _productStructureOp.Select(x => orderCode.Contains(x.ProductItem) && x.Domain == param.factoryId.ToString());
|
|
|
+
|
|
|
foreach (var item in morders)
|
|
|
{
|
|
|
//添加工单数据
|
|
|
@@ -4249,7 +4262,8 @@ namespace Business.ResourceExamineManagement
|
|
|
continue;
|
|
|
}
|
|
|
List<b_bom_child_examine> returnList = new List<b_bom_child_examine>();
|
|
|
- GetWorkDetalis(childs.Where(s => s.parent_id == child.fid).ToList(), returnList, childs);
|
|
|
+ var productOps = productOpList.Where(x => x.ProductItem == item.product_code).ToList();
|
|
|
+ GetWorkDetalis(childs.Where(s => s.parent_id == child.fid).ToList(), returnList, childs, productOps);
|
|
|
if (returnList.Any())
|
|
|
{
|
|
|
WorkOrdDetail woDetail = null;
|
|
|
@@ -4308,13 +4322,29 @@ namespace Business.ResourceExamineManagement
|
|
|
/// <param name="dtl"></param>
|
|
|
/// <param name="returnList"></param>
|
|
|
/// <param name="childs"></param>
|
|
|
- public void GetWorkDetalis(List<BomChildExamineDto> dtl, List<BomChildExamineDto> returnList, List<BomChildExamineDto> childs)
|
|
|
+ public void GetWorkDetalis(List<BomChildExamineDto> dtl, List<BomChildExamineDto> returnList, List<BomChildExamineDto> childs, List<ProductStructureOp> productOps)
|
|
|
{
|
|
|
returnList.AddRange(dtl.Where(x => x.erp_cls != 4).ToList());
|
|
|
var rst = childs.Where(s => dtl.Where(x => x.erp_cls == 4).Select(c => c.fid).Contains(s.parent_id.GetValueOrDefault())).ToList();
|
|
|
if (rst.Any())
|
|
|
{
|
|
|
- GetWorkDetalis(rst, returnList, childs);
|
|
|
+ if (productOps.Any())
|
|
|
+ {
|
|
|
+ //rst 虚拟件的子物料
|
|
|
+ foreach (var item in rst)
|
|
|
+ {
|
|
|
+ var parent = childs.Find(x => x.fid == item.parent_id);
|
|
|
+ if (parent != null)
|
|
|
+ {
|
|
|
+ var proOp = productOps.Find(x => x.ParentItem == parent.item_number && x.ComponentItem == item.item_number);
|
|
|
+ if (proOp != null)
|
|
|
+ {
|
|
|
+ item.Op = proOp.Op;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ GetWorkDetalis(rst, returnList, childs, productOps);
|
|
|
}
|
|
|
return;
|
|
|
}
|
|
|
@@ -4325,13 +4355,29 @@ namespace Business.ResourceExamineManagement
|
|
|
/// <param name="dtl"></param>
|
|
|
/// <param name="returnList"></param>
|
|
|
/// <param name="childs"></param>
|
|
|
- public void GetWorkDetalis(List<b_bom_child_examine> dtl, List<b_bom_child_examine> returnList, List<b_bom_child_examine> childs)
|
|
|
+ public void GetWorkDetalis(List<b_bom_child_examine> dtl, List<b_bom_child_examine> returnList, List<b_bom_child_examine> childs, List<ProductStructureOp> productOps)
|
|
|
{
|
|
|
returnList.AddRange(dtl.Where(x => x.erp_cls != 4).ToList());
|
|
|
var rst = childs.Where(s => dtl.Where(x => x.erp_cls == 4).Select(c => c.fid).Contains(s.parent_id.GetValueOrDefault())).ToList();
|
|
|
if (rst.Any())
|
|
|
{
|
|
|
- GetWorkDetalis(rst, returnList, childs);
|
|
|
+ if (productOps.Any())
|
|
|
+ {
|
|
|
+ //rst 虚拟件的子物料
|
|
|
+ foreach (var item in rst)
|
|
|
+ {
|
|
|
+ var parent = childs.Find(x => x.fid == item.parent_id);
|
|
|
+ if (parent != null)
|
|
|
+ {
|
|
|
+ var proOp = productOps.Find(x => x.ParentItem == parent.item_number && x.ComponentItem == item.item_number);
|
|
|
+ if (proOp != null)
|
|
|
+ {
|
|
|
+ item.Op = proOp.Op;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ GetWorkDetalis(rst, returnList, childs, productOps);
|
|
|
}
|
|
|
return;
|
|
|
}
|