public JsonResult _CreateNewShift(MrpExShiftPlan shiftPlan) { try { var mrpExShiftPlanList = mrpMgr.GetMrpExShiftPlanList(shiftPlan.PlanDate, shiftPlan.ProductLine); shiftPlan.DateIndex = Utility.DateTimeHelper.GetWeekOfYear(shiftPlan.PlanDate); if (!string.IsNullOrWhiteSpace(shiftPlan.Item) && shiftPlan.Item != BusinessConstants.VIRTUALSECTION) { var section = bomMgr.GetSection(shiftPlan.Item); if (section != null) { shiftPlan.Section = section; var productExs = this.genericMgr.FindAll<ProdLineEx> (" from ProdLineEx where Item =? and StartDate <=? and EndDate>?", new object[] { section, shiftPlan.PlanDate, shiftPlan.PlanDate }) ?? new List<ProdLineEx>(); var productEx = productExs.FirstOrDefault(p => p.ProductLine == shiftPlan.ProductLine); if (productEx == null) { productEx = productExs.FirstOrDefault(); } if (productEx != null) { shiftPlan.Speed = productEx.MrpSpeed; shiftPlan.ShiftType = (int)productEx.ShiftType; } else { shiftPlan.Speed = 10; shiftPlan.ShiftType = 3; } } else { if (!itemMgr.GetCacheItem(shiftPlan.Item).Description.Contains(Resources.EXT.ControllerLan.Con_ForceMaterial)) { shiftPlan.Item = BusinessConstants.VIRTUALSECTION; } shiftPlan.Section = BusinessConstants.VIRTUALSECTION; shiftPlan.Qty = shiftPlan.ShiftQty; shiftPlan.Speed = 10; shiftPlan.ShiftType = 3; } } else { shiftPlan.Item = BusinessConstants.VIRTUALSECTION; shiftPlan.Section = BusinessConstants.VIRTUALSECTION; shiftPlan.Qty = shiftPlan.ShiftQty; shiftPlan.Speed = 10; shiftPlan.ShiftType = 3; } shiftPlan.PlanNo = shiftPlan.DateIndex.Substring(2, 2) + shiftPlan.DateIndex.Substring(5, 2) + "N" + shiftPlan.ProductLine + shiftPlan.Section; shiftPlan.StartTime = DateTime.Parse(shiftPlan.PlanDate.ToString("yyyy-MM-dd ") + shiftPlan.StartTime.ToString("HH:mm")); if (!string.IsNullOrWhiteSpace(shiftPlan.ProductType)) { var productType = genericMgr.FindById<ProductType>(shiftPlan.ProductType); shiftPlan.Remark = productType.Description; shiftPlan.IsFreeze = productType.NeedFreeze; } var oldShiftPlan = new MrpExShiftPlan(); if (mrpExShiftPlanList != null) { oldShiftPlan = mrpExShiftPlanList.Where(p => p.Section == shiftPlan.Section && p.Shift == shiftPlan.Shift && p.Item == shiftPlan.Item && shiftPlan.Section != BusinessConstants.VIRTUALSECTION).LastOrDefault() ?? oldShiftPlan; } if (oldShiftPlan.Item != null) { shiftPlan.Bom = shiftPlan.Item; //oldShiftPlan.Bom; shiftPlan.DateIndex = oldShiftPlan.DateIndex; shiftPlan.IsCorrection = oldShiftPlan.IsCorrection; shiftPlan.LocationFrom = oldShiftPlan.LocationFrom; shiftPlan.LocationTo = oldShiftPlan.LocationTo; shiftPlan.PlanDate = oldShiftPlan.PlanDate; shiftPlan.PlanStartTime = oldShiftPlan.PlanStartTime; shiftPlan.PlanVersion = oldShiftPlan.PlanVersion; shiftPlan.PlanWindowTime = oldShiftPlan.PlanWindowTime; shiftPlan.RateQty = oldShiftPlan.RateQty; shiftPlan.ReleaseVersion = oldShiftPlan.ReleaseVersion; //shiftPlan.Section = oldShiftPlan.Section; shiftPlan.ShiftType = oldShiftPlan.ShiftType; shiftPlan.Speed = oldShiftPlan.Speed; //shiftPlan.StartTime = oldShiftPlan.WindowTime; shiftPlan.SwitchTime = oldShiftPlan.SwitchTime; shiftPlan.Uom = oldShiftPlan.Uom; shiftPlan.UnitCount = oldShiftPlan.UnitCount; if (string.IsNullOrWhiteSpace(shiftPlan.ItemDescription)) { shiftPlan.ItemDescription = oldShiftPlan.ItemDescription; } } else { oldShiftPlan = mrpExShiftPlanList == null ? oldShiftPlan : mrpExShiftPlanList.Last(); if (oldShiftPlan.Item == null) { var mrpExPlanMaster = this.genericMgr.FindAll<MrpExPlanMaster> ("from MrpExPlanMaster where PlanDate =? and IsActive=? ", new object[] { shiftPlan.PlanDate, true }).FirstOrDefault(); oldShiftPlan.PlanVersion = mrpExPlanMaster.PlanVersion; oldShiftPlan.ReleaseVersion = DateTime.Now; MrpExPlanMaster mrpExPlanMasterCreate = new MrpExPlanMaster(); mrpExPlanMasterCreate.Shift = shiftPlan.Shift; mrpExPlanMasterCreate.ProductLine = shiftPlan.ProductLine; mrpExPlanMasterCreate.PlanDate = shiftPlan.PlanDate; mrpExPlanMasterCreate.DateIndex = mrpExPlanMaster.DateIndex; mrpExPlanMasterCreate.PlanVersion = oldShiftPlan.PlanVersion; mrpExPlanMasterCreate.ReleaseVersion = oldShiftPlan.ReleaseVersion; mrpExPlanMasterCreate.IsActive = true; this.genericMgr.Create(mrpExPlanMasterCreate); } var flow = this.genericMgr.FindById<FlowMaster>(shiftPlan.ProductLine); //用量取ItemPlan里面的值 var itemPlan = genericMgr.FindAllIn<MrpExItemPlan>("from MrpExItemPlan as m where m.PlanVersion=? and Item=? and PlanDate=? ", new object[] { oldShiftPlan.PlanVersion, shiftPlan.Item, shiftPlan.PlanDate }).FirstOrDefault(); if (itemPlan != null) { shiftPlan.RateQty = itemPlan.RateQty; } else { shiftPlan.RateQty = 1; } shiftPlan.Bom = shiftPlan.Item; //shiftPlan.DateIndex = oldShiftPlan.DateIndex; shiftPlan.IsCorrection = false; shiftPlan.LocationFrom = flow.LocationFrom; shiftPlan.LocationTo = flow.LocationTo; //shiftPlan.PlanDate = oldShiftPlan.PlanDate; shiftPlan.PlanStartTime = DateTime.Now; shiftPlan.PlanVersion = oldShiftPlan.PlanVersion; shiftPlan.PlanWindowTime = DateTime.Now; //shiftPlan.RateQty = 1; shiftPlan.ReleaseVersion = oldShiftPlan.ReleaseVersion; //shiftPlan.Section = BusinessConstants.VIRTUALSECTION; //shiftPlan.ShiftType = 3; //shiftPlan.Speed = 1; //shiftPlan.StartTime = DateTime.Now; //shiftPlan.SwitchTime = oldShiftPlan.SwitchTime; var item = this.itemMgr.GetCacheItem(shiftPlan.Item); shiftPlan.Uom = item.Uom; shiftPlan.UnitCount = (double)item.UnitCount; if (string.IsNullOrWhiteSpace(shiftPlan.ItemDescription)) { shiftPlan.ItemDescription = item.Description; } } shiftPlan.IsNew = true; shiftPlan.WindowTime = shiftPlan.StartTime.AddHours(shiftPlan.ShiftQty * (24 / shiftPlan.ShiftType)); this.genericMgr.Create(shiftPlan); //mrpExShiftPlanList.Add(shiftPlan); //mrpMgr.AdjustMrpExShiftPlanWorkingCalendar(mrpExShiftPlanList); SaveErrorMessage(Resources.EXT.ControllerLan.Con_NewAddedSuccessfully); return Json(shiftPlan); } catch (Exception) { SaveErrorMessage(Resources.EXT.ControllerLan.Con_NewAddedUnsuccessfully); return Json(null); } }
public ActionResult _WebMrpExShiftPlan(string flow, string itemCode, string dateIndex) { if (!string.IsNullOrEmpty(flow) && !string.IsNullOrEmpty(itemCode)) { var plan = new MrpExShiftPlan(); var item = itemMgr.GetCacheItem(itemCode); plan.Item = item.Code; plan.ItemDescription = item.Description; plan.Uom = item.Uom; plan.UnitCount = (float)item.UnitCount; plan.Remark = "SY01"; plan.Bom = plan.Item; var flowDetails = genericMgr.FindAll<FlowDetail>("from FlowDetail where Flow = ? and Item = ?", new object[] { flow, itemCode }); if (flowDetails != null && flowDetails.Count() > 0) { var flowDetail = flowDetails.First(); plan.Bom = flowDetail.Bom == null ? plan.Item : flowDetail.Bom; plan.Uom = flowDetail.Uom; plan.UnitCount = (float)flowDetail.UnitCount; } var bomDetail = bomMgr.GetOnlyNextLevelBomDetail(plan.Bom, DateTime.Now) .Where(p => p.Item.StartsWith("29")).FirstOrDefault(); if (bomDetail != null) { plan.Section = bomDetail.Item; } else { SaveErrorMessage(Resources.EXT.ControllerLan.Con_CanNotFindTheItemSectionbom, plan.Item); return null; } plan.PlanNo = dateIndex.Substring(2, 2) + dateIndex.Substring(5, 2) + "N" + flow + plan.Section; return this.Json(plan); } return null; }
public ActionResult _NewShift() { MrpExShiftPlan mrpExShiftPlan = new MrpExShiftPlan(); return PartialView(mrpExShiftPlan); }
public ActionResult _AjaxList(GridCommand command, MrpPlanSearchModel searchModel) { if (searchModel.StartDate == null || searchModel.EndDate == null) { return PartialView(new GridModel<MrpExShiftPlan>(new List<MrpExShiftPlan>())); } this.GetCommand(ref command, searchModel); if (command.SortDescriptors.Count > 0) { //if (command.SortDescriptors[0].Member == "ExternalOrderNo") //{ // command.SortDescriptors[0].Member = "ExtNo"; //} //else if (command.SortDescriptors[0].Member == "OrderedQty") //{ // command.SortDescriptors[0].Member = "OrderQty"; //} } SqlParameter[] parameters = new SqlParameter[7]; parameters[0] = new SqlParameter("@ProdLine", System.Data.SqlDbType.VarChar, 50); parameters[0].Value = searchModel.ProdLine; parameters[1] = new SqlParameter("@PlanStartDate", System.Data.SqlDbType.DateTime); parameters[1].Value = searchModel.StartDate; parameters[2] = new SqlParameter("@PlanEndDate", System.Data.SqlDbType.DateTime); parameters[2].Value = searchModel.EndDate; parameters[3] = new SqlParameter("@SortCloumn", System.Data.SqlDbType.VarChar, 50); parameters[3].Value = command.SortDescriptors.Count > 0 ? command.SortDescriptors[0].Member : string.Empty; parameters[4] = new SqlParameter("@SortRule", System.Data.SqlDbType.VarChar, 50); parameters[4].Value = command.SortDescriptors.Count > 0 ? command.SortDescriptors[0].SortDirection == ListSortDirection.Descending ? "desc" : "asc" : string.Empty; parameters[5] = new SqlParameter("@PageSize", SqlDbType.Int); parameters[5].Value = command.PageSize; parameters[6] = new SqlParameter("@Page", SqlDbType.Int); parameters[6].Value = command.Page; //parameters[7] = new SqlParameter("@RowCount", System.Data.SqlDbType.VarChar, 50); //parameters[7].Direction = ParameterDirection.Output; int totalCount = 0; IList<MrpExShiftPlan> returList = new List<MrpExShiftPlan>(); try { DataSet dataSet = sqlDao.GetDatasetByStoredProcedure("USP_Search_ExPlanExecutionControl", parameters); // Section, Item, ItemDescription, Shift, Uom,PlanDate,ProductLine,Name, Qty, //CorrectionQty, ReceivedQty,Remark,Sequence,StartTime,WindowTime,IsNew,IsFreeze if (dataSet.Tables[0] != null && dataSet.Tables[0].Rows.Count > 0) { foreach (DataRow row in dataSet.Tables[0].Rows) { MrpExShiftPlan mrpShiftPlan = new MrpExShiftPlan(); mrpShiftPlan.Section = row.ItemArray[0].ToString(); mrpShiftPlan.Item = row.ItemArray[1].ToString(); mrpShiftPlan.ItemDescription = row.ItemArray[2].ToString(); //mrpShiftPlan.Shift = row.ItemArray[3].ToString(); mrpShiftPlan.Uom = row.ItemArray[4].ToString(); mrpShiftPlan.PlanDate =Convert.ToDateTime( row.ItemArray[5].ToString()); mrpShiftPlan.ProductLine = row.ItemArray[6].ToString(); mrpShiftPlan.Shift = row.ItemArray[7].ToString(); mrpShiftPlan.Qty = Convert.ToDouble(row.ItemArray[8].ToString()); mrpShiftPlan.IsCorrection = Convert.ToBoolean(row.ItemArray[9].ToString()); mrpShiftPlan.ReceivedQty = Convert.ToDouble(row.ItemArray[10].ToString()); mrpShiftPlan.Remark = row.ItemArray[11].ToString(); mrpShiftPlan.Sequence = Convert.ToInt32(row.ItemArray[12].ToString()); mrpShiftPlan.StartTime = Convert.ToDateTime(row.ItemArray[13].ToString()); mrpShiftPlan.WindowTime = Convert.ToDateTime(row.ItemArray[14].ToString()); mrpShiftPlan.IsNew = Convert.ToBoolean(row.ItemArray[15].ToString()); mrpShiftPlan.IsFreeze = Convert.ToBoolean(row.ItemArray[16].ToString()); returList.Add(mrpShiftPlan); } totalCount = (int)dataSet.Tables[1].Rows[0][0]; } } catch (BusinessException be) { SaveBusinessExceptionMessage(be); } catch (Exception ex) { if (ex.InnerException != null) { if (ex.InnerException.InnerException != null) { SaveErrorMessage(ex.InnerException.InnerException.Message); } else { SaveErrorMessage(ex.InnerException.Message); } } else { SaveErrorMessage(ex.Message); } } GridModel<MrpExShiftPlan> gridModel = new GridModel<MrpExShiftPlan>(); gridModel.Total = totalCount; gridModel.Data = returList; TempData["DetailList"] = returList; return PartialView(gridModel); }
public void ExportXLS(MrpPlanSearchModel searchModel) { int value = Convert.ToInt32(base.systemMgr.GetEntityPreferenceValue(EntityPreference.CodeEnum.MaxRowSizeOnPage)); GridCommand command = new GridCommand(); command.Page = 1; command.PageSize = value; SqlParameter[] parameters = new SqlParameter[8]; parameters[0] = new SqlParameter("@ProdLine", System.Data.SqlDbType.VarChar, 50); parameters[0].Value = searchModel.ProdLine; parameters[1] = new SqlParameter("@PlanStartDate", System.Data.SqlDbType.DateTime); parameters[1].Value = searchModel.StartDate; parameters[2] = new SqlParameter("@PlanEndDate", System.Data.SqlDbType.DateTime); parameters[2].Value = searchModel.EndDate; parameters[3] = new SqlParameter("@SortCloumn", System.Data.SqlDbType.VarChar, 50); parameters[3].Value = command.SortDescriptors.Count > 0 ? command.SortDescriptors[0].Member : string.Empty; parameters[4] = new SqlParameter("@SortRule", System.Data.SqlDbType.VarChar, 50); parameters[4].Value = command.SortDescriptors.Count > 0 ? command.SortDescriptors[0].SortDirection == ListSortDirection.Descending ? "desc" : "asc" : string.Empty; parameters[5] = new SqlParameter("@PageSize", SqlDbType.Int); parameters[5].Value = command.PageSize; parameters[6] = new SqlParameter("@Page", SqlDbType.Int); parameters[6].Value = command.Page; parameters[7] = new SqlParameter("@RowCount", System.Data.SqlDbType.VarChar, 50); parameters[7].Direction = ParameterDirection.Output; IList<MrpExShiftPlan> returList = new List<MrpExShiftPlan>(); try { DataSet dataSet = sqlDao.GetDatasetByStoredProcedure("USP_Search_ExPlanExecutionControl", parameters); // Section, Item, ItemDescription, Shift, Uom,PlanDate,ProductLine,Name, Qty, //CorrectionQty, ReceivedQty,Remark,Sequence,StartTime,WindowTime,IsNew,IsFreeze if (dataSet.Tables[0] != null && dataSet.Tables[0].Rows.Count > 0) { foreach (DataRow row in dataSet.Tables[0].Rows) { MrpExShiftPlan mrpShiftPlan = new MrpExShiftPlan(); mrpShiftPlan.Section = row.ItemArray[0].ToString(); mrpShiftPlan.Item = row.ItemArray[1].ToString(); mrpShiftPlan.ItemDescription = row.ItemArray[2].ToString(); //mrpShiftPlan.Shift = row.ItemArray[3].ToString(); mrpShiftPlan.Uom = row.ItemArray[4].ToString(); mrpShiftPlan.PlanDate = Convert.ToDateTime(row.ItemArray[5].ToString()); mrpShiftPlan.ProductLine = row.ItemArray[6].ToString(); mrpShiftPlan.Shift = row.ItemArray[7].ToString(); mrpShiftPlan.Qty = Convert.ToDouble(row.ItemArray[8].ToString()); mrpShiftPlan.IsCorrection = Convert.ToBoolean(row.ItemArray[9].ToString()); mrpShiftPlan.ReceivedQty = Convert.ToDouble(row.ItemArray[10].ToString()); mrpShiftPlan.Remark = row.ItemArray[11].ToString(); mrpShiftPlan.Sequence = Convert.ToInt32(row.ItemArray[12].ToString()); mrpShiftPlan.StartTime = Convert.ToDateTime(row.ItemArray[13].ToString()); mrpShiftPlan.WindowTime = Convert.ToDateTime(row.ItemArray[14].ToString()); mrpShiftPlan.IsNew = Convert.ToBoolean(row.ItemArray[15].ToString()); mrpShiftPlan.IsFreeze = Convert.ToBoolean(row.ItemArray[16].ToString()); returList.Add(mrpShiftPlan); } } } catch (BusinessException be) { SaveBusinessExceptionMessage(be); } catch (Exception ex) { if (ex.InnerException != null) { if (ex.InnerException.InnerException != null) { SaveErrorMessage(ex.InnerException.InnerException.Message); } else { SaveErrorMessage(ex.InnerException.Message); } } else { SaveErrorMessage(ex.Message); } } ExportToXLS<MrpExShiftPlan>("ExportMrpExShiftPlan.xls", returList); }
private OrderMaster CreateExOrder(MrpExShiftPlan mrpExShiftPlan) { var flowMaster = genericMgr.FindById<FlowMaster>(mrpExShiftPlan.ProductLine); var orderMaster = orderMgr.TransferFlow2Order(flowMaster, false); OrderDetail orderDetail = new OrderDetail(); var item = this.itemMgr.GetCacheItem(mrpExShiftPlan.Item); orderDetail.Item = item.Code; orderDetail.UnitCount = (decimal)mrpExShiftPlan.UnitCount; orderDetail.Uom = item.Uom; orderDetail.ItemDescription = item.Description; orderDetail.Sequence = 10; orderDetail.MinUnitCount = item.UnitCount; orderDetail.OrderedQty = (decimal)mrpExShiftPlan.Qty; orderDetail.IsInspect = mrpExShiftPlan.IsFreeze; orderDetail.Remark = mrpExShiftPlan.Remark; if(item.ItemOption == com.Sconit.CodeMaster.ItemOption.NeedAging) { orderDetail.OldOption = Sconit.CodeMaster.HuOption.UnAging; } else { orderDetail.OldOption = Sconit.CodeMaster.HuOption.NoNeed; } var productType = this.genericMgr.FindById<ProductType>(mrpExShiftPlan.ProductType); orderDetail.ScheduleType = productType.SubType; orderMaster.AddOrderDetail(orderDetail); var flowDetailItems = this.flowMgr.GetFlowDetailList("EXV").Select(p => p.Item).Distinct().ToList(); if(flowDetailItems.Contains(orderDetail.Item)) { orderMaster.ProductLineFacility = "EXV"; } orderMaster.IsAutoRelease = true; orderMaster.IsAutoStart = true; orderMaster.IsAutoReceive = false; orderMaster.IsOpenOrder = true; orderMaster.IsInspect = true; orderMaster.Shift = mrpExShiftPlan.Shift; orderMaster.StartTime = mrpExShiftPlan.StartTime; orderMaster.WindowTime = mrpExShiftPlan.WindowTime; //orderMaster.EffectiveDate = mrpExShiftPlan.PlanVersion; orderMaster.ReferenceOrderNo = mrpExShiftPlan.Section; orderMaster.ExternalOrderNo = mrpExShiftPlan.Id.ToString(); orderMaster.Priority = CodeMaster.OrderPriority.Normal; orderMaster.CreateHuOption = Sconit.CodeMaster.CreateHuOption.Receive; orderMaster.EffectiveDate = DateTime.Now.AddHours(-7.75).Date; orderMaster.SubType = CodeMaster.OrderSubType.Normal; orderMgr.CreateOrder(orderMaster); mrpExShiftPlan.OrderNo = orderMaster.OrderNo; return orderMaster; }
public ReceiptMaster ReceiveExOrder(MrpExShiftPlan mrpExShiftPlan) { OrderMaster orderMaster = new OrderMaster(); if(!string.IsNullOrWhiteSpace(mrpExShiftPlan.OrderNo)) { try { orderMaster = orderMgr.LoadOrderMaster(mrpExShiftPlan.OrderNo, true, false, true); if(orderMaster.Status != CodeMaster.OrderStatus.InProcess) { orderMaster = CreateExOrder(mrpExShiftPlan); } } catch(Exception) { orderMaster = CreateExOrder(mrpExShiftPlan); } } else { orderMaster = CreateExOrder(mrpExShiftPlan); } var receiptMaster = new ReceiptMaster(); if(mrpExShiftPlan.CurrentQty <= 0)//只是打印废品条码 { //打印废品条码 var item = new Item(); if(!string.IsNullOrWhiteSpace(mrpExShiftPlan.Section) && mrpExShiftPlan.Section != "299999") { item = itemMgr.GetCacheItem(mrpExShiftPlan.Section); } else { this.itemMgr.GetCacheItem(mrpExShiftPlan.Item); } Hu hu = new Hu(); hu.Qty = 0; hu.Item = item.Code; hu.ItemDescription = item.Description; hu.BaseUom = item.Uom; hu.Uom = item.Uom; hu.UnitCount = item.UnitCount; hu.UnitQty = 1; hu.Qty = 0; hu.HuTemplate = "BarCodeEXScrap.xls"; hu.ManufactureDate = mrpExShiftPlan.PlanDate; hu.LotNo = Utility.LotNoHelper.GenerateLotNo(hu.ManufactureDate); hu.PrintCount = 0; hu.ConcessionCount = 0; hu.ReferenceItemCode = item.ReferenceCode; hu.LocationTo = mrpExShiftPlan.LocationTo; hu.OrderNo = orderMaster.OrderNo; hu.Shift = mrpExShiftPlan.Shift; hu.Flow = mrpExShiftPlan.ProductLine; hu.ManufactureParty = orderMaster.PartyFrom; //hu.HuId = Guid.NewGuid().ToString(); //hu.IsOdd = hu.Qty < hu.UnitCount; //hu.IsChangeUnitCount = false; //hu.UnitCountDescription = null; //hu.SupplierLotNo = null; //hu.ContainerDesc = null; receiptMaster.HuList = new List<Hu>(); receiptMaster.HuList.Add(hu); receiptMaster.CreateHuOption = orderMaster.CreateHuOption; receiptMaster.HuTemplate = orderMaster.HuTemplate; } else { OrderDetailInput orderDetailInput = new OrderDetailInput(); orderDetailInput.ReceiveQty = (decimal)mrpExShiftPlan.CurrentQty; orderMaster.OrderDetails[0].AddOrderDetailInput(orderDetailInput); orderMaster.OrderDetails[0].IsInspect = mrpExShiftPlan.IsFreeze; orderMaster.IsInspect = true; receiptMaster = orderMgr.ReceiveOrder(orderMaster.OrderDetails); mrpExShiftPlan.ReceivedQty += mrpExShiftPlan.CurrentQty; this.genericMgr.Update(mrpExShiftPlan); receiptMaster.HuList = receiptMaster.ReceiptDetails.SelectMany(p => p.ReceiptLocationDetails.Select(q => q.HuId)) .Select(p => { return this.genericMgr.FindById<Hu>(p); }).ToList(); foreach(var hu in receiptMaster.HuList) { hu.ItemVersion = mrpExShiftPlan.ProductType; this.genericMgr.Update(hu); } } return receiptMaster; }