/// <summary> /// 通过成品Id获取成品报表详情 /// </summary> /// <param name="id"> 成品 Id</param> /// <returns></returns> private VM_Report_Product getProductDetailById(int id) { var vmPd = new VM_Report_Product(); var bllPd = new MesWeb.BLL.T_Report_Product(); var bllReportStd = new MesWeb.BLL.T_Report_Product_Standard(); var bllReportActual = new MesWeb.BLL.T_Report_Product_Actual(); var pd = bllPd.GetModel(id); if (pd != null) { try { vmPd.updateReportProduct(pd); if (pd.StandardId.Value > 0) { var std = bllReportStd.GetModel(pd.StandardId.Value); vmPd.updateReportStd(std); } if (pd.ActualId.Value > 0) { var actual = bllReportActual.GetModel(pd.ActualId.Value); vmPd.updateReportActual(actual); } } catch (Exception e) { log = LogFactory.GetLogger(MethodBase.GetCurrentMethod().DeclaringType.FullName + ":" + MethodBase.GetCurrentMethod().Name); log.Error(e); } } return(vmPd); }
public JsonResult SaveReportProductAction(VM_Report_Product product) { var retData = new VM_Result_Data(); retData.Content = "更新成品表失败"; var bllPd = new MesWeb.BLL.T_Report_Product(); var bllRpStd = new MesWeb.BLL.T_Report_Product_Standard(); var bllRpActual = new MesWeb.BLL.T_Report_Product_Actual(); var oldPd = bllPd.GetModel(product.Id); if (oldPd != null) { try { //更新主表 var oldPdId = oldPd.Id; var rpStdId = oldPd.StandardId; var rpActualId = oldPd.ActualId; var newPd = product.ReportProduct; newPd.Id = oldPd.Id; newPd.ActualId = rpActualId; newPd.StandardId = rpStdId; bllPd.Update(newPd); //更新标准值表 if (rpStdId.HasValue) { var rpStd = product.ReportProductStd; rpStd.Id = rpStdId.Value; bllRpStd.Update(rpStd); } //更新实际值表 if (rpActualId.HasValue) { var rpActual = product.ReportProductActual; rpActual.Id = rpActualId.Value; bllRpActual.Update(rpActual); } retData.Code = RESULT_CODE.OK; retData.Content = "更新成品表成功"; } catch (Exception e) { log = LogFactory.GetLogger(MethodBase.GetCurrentMethod().DeclaringType.FullName + ":" + MethodBase.GetCurrentMethod().Name); log.Error(e); } } return(Json(retData)); }