feat(hjgl): 支持按焊口匹配和回写管线材料
管线材料导入需要关联到具体焊口,并允许按材料编码匹配库存后回写 材料主编码。新增 HJGL_PipeLineMat 的焊口和材料编码字段,材料匹配、 任务生成和出库关系同步按焊口维度处理,避免仅按组件匹配导致材料 范围不准确。
This commit is contained in:
@@ -992,36 +992,22 @@ namespace BLL
|
||||
.Select(e => e.WeldJointId)
|
||||
.Distinct()
|
||||
.ToList();
|
||||
var taskComponents = (from relation in db.HJGL_Pipeline_ComponentJoint
|
||||
join component in db.HJGL_Pipeline_Component on relation.PipelineComponentId equals component.PipelineComponentId into componentJoin
|
||||
from componentItem in componentJoin.DefaultIfEmpty()
|
||||
join weldJointItem in db.HJGL_WeldJoint on relation.WeldJointId equals weldJointItem.WeldJointId
|
||||
where taskWeldJointIds.Contains(relation.WeldJointId)
|
||||
&& weldJointItem.PipelineId != null
|
||||
&& (relation.PipelineComponentCode != null || (componentItem != null && componentItem.PipelineComponentCode != null))
|
||||
select new
|
||||
{
|
||||
PipelineId = weldJointItem.PipelineId,
|
||||
PipelineComponentCode = componentItem != null && componentItem.PipelineComponentCode != null ? componentItem.PipelineComponentCode : relation.PipelineComponentCode
|
||||
}).Distinct().ToList();
|
||||
//领料出库需要排除散件材料
|
||||
var allMaterDatial = (from x in db.HJGL_PipeLineMat
|
||||
join y in db.HJGL_MaterialCodeLib on x.MaterialCode equals y.MaterialCode
|
||||
where pipelineList.Contains(x.PipelineId) && x.PrefabricatedComponents != null
|
||||
where pipelineList.Contains(x.PipelineId)
|
||||
&& taskWeldJointIds.Contains(x.WeldJointId)
|
||||
&& x.PrefabricatedComponents != null
|
||||
select new
|
||||
{
|
||||
x.PipelineId,
|
||||
x.PrefabricatedComponents,
|
||||
x.WeldJointId,
|
||||
x.MaterialCode,
|
||||
x.Number,
|
||||
y.MaterialUnit,
|
||||
}).ToList();
|
||||
var componentPipelineIds = taskComponents.Select(x => x.PipelineId).Distinct().ToList();
|
||||
var MaterDatial = taskComponents.Any()
|
||||
? allMaterDatial.Where(mat => !componentPipelineIds.Contains(mat.PipelineId)
|
||||
|| taskComponents.Any(component => component.PipelineId == mat.PipelineId
|
||||
&& component.PipelineComponentCode == mat.PrefabricatedComponents)).ToList()
|
||||
: allMaterDatial;
|
||||
var MaterDatial = allMaterDatial;
|
||||
//var outMateriaList = from x in db.HJGL_PipeLineMat
|
||||
// join y in db.HJGL_MaterialCodeLib on x.MaterialCode equals y.MaterialCode
|
||||
// where pipelineList.Contains(x.PipelineId)
|
||||
@@ -1077,12 +1063,13 @@ namespace BLL
|
||||
};
|
||||
TwInOutplandetailService.Add(detail);
|
||||
}
|
||||
var twinoutplandetailRelationList = MaterDatial.Select(x => new Tw_InOutPlanDetail_Relation
|
||||
var twinoutplandetailRelationList = MaterDatial.Where(x => x.MaterialUnit.Contains("个")).Select(x => new Tw_InOutPlanDetail_Relation
|
||||
{
|
||||
PipelineId = x.PipelineId,
|
||||
MaterialCode = x.MaterialCode,
|
||||
Number = x.Number,
|
||||
PrefabricatedComponents = x.PrefabricatedComponents,
|
||||
WeldJointId = x.WeldJointId,
|
||||
}).ToList();
|
||||
TwInoutplandetailRelationService.AddList(twinoutplandetailRelationList, table.Id);
|
||||
}
|
||||
@@ -1116,12 +1103,13 @@ namespace BLL
|
||||
};
|
||||
TwInOutplandetailService.Add(detail);
|
||||
}
|
||||
var twinoutplandetailRelationList = MaterDatial.Select(x => new Tw_InOutPlanDetail_Relation
|
||||
var twinoutplandetailRelationList = MaterDatial.Where(x => x.MaterialUnit.Contains("米")).Select(x => new Tw_InOutPlanDetail_Relation
|
||||
{
|
||||
PipelineId = x.PipelineId,
|
||||
MaterialCode = x.MaterialCode,
|
||||
Number = x.Number,
|
||||
PrefabricatedComponents = x.PrefabricatedComponents,
|
||||
WeldJointId = x.WeldJointId,
|
||||
}).ToList();
|
||||
TwInoutplandetailRelationService.AddList(twinoutplandetailRelationList, table.Id);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user