1
This commit is contained in:
@@ -74,8 +74,6 @@ namespace BLL
|
||||
{
|
||||
return Funs.DB.Tw_InOutPlanDetail.FirstOrDefault(x => x.Id == Id);
|
||||
}
|
||||
|
||||
|
||||
public static void Add(Model.Tw_InOutPlanDetail newtable)
|
||||
{
|
||||
if (string.IsNullOrEmpty(newtable.Id))
|
||||
@@ -136,7 +134,6 @@ namespace BLL
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static void DeleteByInOutPlanMasterId (string inoutPlanMasterId)
|
||||
{
|
||||
var list = Funs.DB.Tw_InOutPlanDetail.Where(x => x.InOutPlanMasterId == inoutPlanMasterId);
|
||||
@@ -147,5 +144,30 @@ namespace BLL
|
||||
}
|
||||
}
|
||||
|
||||
public static void GenInOutPlanDetailByInoutPlanMasterId(string inOutPlanMasterId)
|
||||
{
|
||||
var list = Funs.DB.Tw_InOutPlanDetail_Relation.Where(x => x.InOutPlanMasterId == inOutPlanMasterId).ToList();
|
||||
var outMateriaList = from x in list
|
||||
group x by x.MaterialCode
|
||||
into g
|
||||
select new
|
||||
{
|
||||
g.Key,
|
||||
planNum = g.Sum(x => x.Number) ?? 0
|
||||
};
|
||||
TwInOutplandetailService.DeleteByInOutPlanMasterId(inOutPlanMasterId);
|
||||
foreach (var item in outMateriaList)
|
||||
{
|
||||
Model.Tw_InOutPlanDetail detail = new Model.Tw_InOutPlanDetail
|
||||
{
|
||||
Id = Guid.NewGuid().ToString(),
|
||||
InOutPlanMasterId = inOutPlanMasterId,
|
||||
MaterialCode = item.Key,
|
||||
PlanNum = item.planNum,
|
||||
};
|
||||
TwInOutplandetailService.Add(detail);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user