This commit is contained in:
2024-09-24 20:38:50 +08:00
parent 4e9832dc8a
commit 8edf7e1389
46 changed files with 3109 additions and 748 deletions
+25 -3
View File
@@ -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);
}
}
}
}