feat(hjgl): 支持按焊口匹配和回写管线材料
管线材料导入需要关联到具体焊口,并允许按材料编码匹配库存后回写 材料主编码。新增 HJGL_PipeLineMat 的焊口和材料编码字段,材料匹配、 任务生成和出库关系同步按焊口维度处理,避免仅按组件匹配导致材料 范围不准确。
This commit is contained in:
@@ -102,6 +102,7 @@ namespace BLL
|
||||
MaterialCode = newtable.MaterialCode,
|
||||
PrefabricatedComponents = newtable.PrefabricatedComponents,
|
||||
Number = newtable.Number,
|
||||
WeldJointId = newtable.WeldJointId,
|
||||
};
|
||||
Funs.DB.Tw_InOutPlanDetail_Relation.InsertOnSubmit(table);
|
||||
Funs.DB.SubmitChanges();
|
||||
@@ -133,6 +134,7 @@ namespace BLL
|
||||
table.MaterialCode = newtable.MaterialCode;
|
||||
table.PrefabricatedComponents = newtable.PrefabricatedComponents;
|
||||
table.Number = newtable.Number;
|
||||
table.WeldJointId = newtable.WeldJointId;
|
||||
Funs.DB.SubmitChanges();
|
||||
}
|
||||
|
||||
@@ -158,56 +160,6 @@ namespace BLL
|
||||
}
|
||||
}
|
||||
|
||||
public static void InsertByPipeLineMat(string inOutPlanMasterId, List<Model.Tw_PipeLineMat> tw_PipeLineMats)
|
||||
{
|
||||
var master = TwInOutplanmasterService.GetById(inOutPlanMasterId);
|
||||
if (master == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
var outMateriaList = from x in tw_PipeLineMats
|
||||
group x by new { x.MaterialCode, x.MaterialUnit }
|
||||
into g
|
||||
select new
|
||||
{
|
||||
g.Key.MaterialCode,
|
||||
planNum = g.Sum(x => x.Number) ?? 0,
|
||||
MaterialName = g.Key.MaterialUnit,
|
||||
};
|
||||
|
||||
switch (master.Category)
|
||||
{
|
||||
case (int)TwConst.Category.管段:
|
||||
outMateriaList.Where(x => x.MaterialName.Contains("米"));//管段
|
||||
break;
|
||||
case (int)TwConst.Category.管件:
|
||||
outMateriaList.Where(x => x.MaterialName.Contains("个"));//管件
|
||||
break;
|
||||
}
|
||||
|
||||
foreach (var item in outMateriaList)
|
||||
{
|
||||
Model.Tw_InOutPlanDetail detail = new Model.Tw_InOutPlanDetail
|
||||
{
|
||||
Id = Guid.NewGuid().ToString(),
|
||||
InOutPlanMasterId = inOutPlanMasterId,
|
||||
MaterialCode = item.MaterialCode,
|
||||
PlanNum = item.planNum,
|
||||
};
|
||||
TwInOutplandetailService.Add(detail);
|
||||
}
|
||||
var twinoutplandetailRelationList = tw_PipeLineMats.Select(x => new Tw_InOutPlanDetail_Relation
|
||||
{
|
||||
PipelineId = x.PipelineId,
|
||||
MaterialCode = x.MaterialCode,
|
||||
Number = x.Number,
|
||||
PrefabricatedComponents = x.PrefabricatedComponents,
|
||||
}).ToList();
|
||||
TwInoutplandetailRelationService.AddList(twinoutplandetailRelationList, inOutPlanMasterId);
|
||||
|
||||
}
|
||||
|
||||
|
||||
public static IEnumerable GetPrintListByOutputMasterIds(List<string> outputMasterIds)
|
||||
{
|
||||
var q = from x in Funs.DB.Tw_InOutPlanDetail_Relation
|
||||
|
||||
Reference in New Issue
Block a user