public void SaveAllDetailInfo(List <FlowChartDetailAndMGDataInputDTO> list, int AccountID) { var idList = list.Select(m => m.FlowChart_Detail_UID).ToList(); var mgDataList = flowChartMgDataRepository.GetMany(m => idList.Contains(m.FlowChart_Detail_UID)).ToList(); foreach (var item in list) { var mgDataItem = mgDataList.Where(m => m.FlowChart_Detail_UID == item.FlowChart_Detail_UID).FirstOrDefault(); if (mgDataItem != null) { mgDataItem.Product_Plan = item.Product_Plan; mgDataItem.Target_Yield = double.Parse(item.Target_Yield.Substring(0, item.Target_Yield.Length - 1)) / 100; mgDataItem.Modified_Date = DateTime.Now; mgDataItem.Modified_UID = AccountID; flowChartMgDataRepository.Update(mgDataItem); } } unitOfWork.Commit(); }
public string FlowChartPlan(FlowChartPlanManagerVM ent) { var items = flowChartMasterRepository.UpdatePlan(ent.Detail_UID, ent.date); int i = 0; foreach (var item in items) { i++; if (Week(item.Product_Date) == "星期一") { item.Product_Plan = int.Parse(ent.MondayProduct_Plan.ToString()); if (ent.MondayProper_WIP != null) { item.Proper_WIP = int.Parse(ent.MondayProper_WIP.ToString()); } item.Target_Yield = double.Parse(ent.MondayTarget_Yield.ToString()); flowChartMgDataRepository.Update(item); } if (Week(item.Product_Date) == "星期二") { item.Product_Plan = int.Parse(ent.TuesdayProduct_Plan.ToString()); if (ent.TuesdayProper_WIP != null) { item.Proper_WIP = int.Parse(ent.TuesdayProper_WIP.ToString()); } item.Target_Yield = double.Parse(ent.TuesdayTarget_Yield.ToString()); flowChartMgDataRepository.Update(item); } if (Week(item.Product_Date) == "星期三") { item.Product_Plan = int.Parse(ent.WednesdayProduct_Plan.ToString()); if (ent.WednesdayProper_WIP != null) { item.Proper_WIP = int.Parse(ent.WednesdayProper_WIP.ToString()); } item.Target_Yield = double.Parse(ent.WednesdayTarget_Yield.ToString()); flowChartMgDataRepository.Update(item); } if (Week(item.Product_Date) == "星期四") { item.Product_Plan = int.Parse(ent.ThursdayProduct_Plan.ToString()); if (ent.ThursdayProper_WIP != null) { item.Proper_WIP = int.Parse(ent.ThursdayProper_WIP.ToString()); } item.Target_Yield = double.Parse(ent.ThursdayTarget_Yield.ToString()); flowChartMgDataRepository.Update(item); } if (Week(item.Product_Date) == "星期五") { item.Product_Plan = int.Parse(ent.FridayProduct_Plan.ToString()); if (ent.FridayProper_WIP != null) { item.Proper_WIP = int.Parse(ent.FridayProper_WIP.ToString()); } item.Target_Yield = double.Parse(ent.FridayTarget_Yield.ToString()); flowChartMgDataRepository.Update(item); } if (Week(item.Product_Date) == "星期六") { item.Product_Plan = int.Parse(ent.SaterdayProduct_Plan.ToString()); if (ent.SaterdayProper_WIP != null) { item.Proper_WIP = int.Parse(ent.SaterdayProper_WIP.ToString()); } item.Target_Yield = double.Parse(ent.SaterdayTarget_Yield.ToString()); flowChartMgDataRepository.Update(item); } if (Week(item.Product_Date) == "星期日") { item.Product_Plan = int.Parse(ent.SundayProduct_Plan.ToString()); if (ent.SundayProper_WIP != null) { item.Proper_WIP = int.Parse(ent.SundayProper_WIP.ToString()); } item.Target_Yield = double.Parse(ent.SundayTarget_Yield.ToString()); flowChartMgDataRepository.Update(item); } } unitOfWork.Commit(); return("SUCCESS"); }