public JsonResult SetSecrecy(E_tb_TestReport model) { model.setsecrecypid = CurrentUserInfo.PersonnelID; //设置保密人为当前用户 bool result = dTestReport.SetSecrecy(model); string msg = (result) ? "设置保密成功!" : "设置保密失败!"; return(Json(new { result = result, msg = msg }, JsonRequestBehavior.AllowGet)); }
/// <summary> /// 设置保密 /// </summary> /// <param name="model">参数实体</param> /// <returns>返回是否执行成功</returns> public bool SetSecrecy(E_tb_TestReport model) { StringBuilder strSql = new StringBuilder(); strSql.Append($"update tb_TestReport set issecrecy=1,secrecyexaminepid=@secrecyexaminepid,setsecrecypid=@setsecrecypid where ReportID=@ReportID"); using (IDbConnection conn = new SqlConnection(PubConstant.GetConnectionString())) { int count = conn.Execute(strSql.ToString(), model); return(count > 0); } }
/// <summary> /// 得到一个对象实体 /// </summary> public E_tb_TestReport GetModel(int ReportID) { E_tb_TestReport model = null; StringBuilder strSql = new StringBuilder(); strSql.Append(@"SELECT top 1 A.[ReportID] , A.[RecordIDS] , A.[TaskNoS] , A.[ReportNo] , A.[SampleNum] ,B.name as SampleName --, A.[SampleName] //样品名称 ,case when B.isDetection = 1 then B.detectionCompany else C.ClientName end as [Department] --, A.[Department] 动态获取样品管理对应的 送/抽检单位 , A.[TestType] , A.[IssuedTime] , A.[TestingCompany] , A.[Specifications] , A.[ProductionTime] , A.[Packing] , A.[productNum] , A.[ToSampleMode] , A.[SendTestAddress] ,B.detectionAdress as SamplingPlace --, A.[SamplingPlace] //抽样地点 ,B.detectionCompany as SamplingCompany --, A.[SamplingCompany] //抽样单位 , A.[SamplingPersonnel] , A.[SamplingTime] , A.[TestTime] , A.[ShelfLife] , A.[TestBasis] , A.[Conclusion] , A.[Remarks] , A.[Explain] , A.[ApprovalPersonnelID] , A.[examinePersonnelID] , A.[MainTestPersonnelID] , A.[FilePath] , A.[AreaID] , A.[EditPersonnelID] , A.[AddTime] , A.[UpdateTime] , A.[issecrecy] , A.[secrecyexaminepid] , A.[setsecrecypid] FROM [tb_TestReport] as A left join tb_Sample as B on A.[SampleNum] = B.[SampleNum] left join tb_ClientManage as C on B.InspectCompany = C.ClientID where ReportID=@ReportID"); using (IDbConnection conn = new SqlConnection(PubConstant.GetConnectionString())) { model = conn.Query <E_tb_TestReport>(strSql.ToString(), new { ReportID = ReportID }).FirstOrDefault(); return(model); } }
public bool Save(E_tb_TestReport eTestReport) { //检验数据 List <E_ReportData> ReportDataList = new List <E_ReportData>(); string strJson = eTestReport.TestReportDataJson; if (!string.IsNullOrEmpty(strJson)) { strJson = strJson.Replace("\r\n", "").Replace("\n", ""); ReportDataList = JsonHelper.JsonDeserialize <List <E_ReportData> >(strJson); } //删除原有检验数据 tTestReportData.DeleteByWhere("ReportID=" + eTestReport.ReportID); foreach (E_ReportData item in ReportDataList) { E_tb_TestReportData eTestReportData = new E_tb_TestReportData(); eTestReportData.ReportID = eTestReport.ReportID; eTestReportData.TestName = item.TestName; eTestReportData.TestStandard = item.TestStandard; eTestReportData.TestResult = item.TestResult; eTestReportData.QualifiedLevel = item.QualifiedLevel; eTestReportData.TestPersonnelName = item.TestPersonnelName; eTestReportData.RecordID = int.Parse(item.RecordID); eTestReportData.RecordFilePath = item.RecordFilePath; tTestReportData.Add(eTestReportData); } //结论 DataTable TestReportDataDT = tTestReportData.GetList("ReportID=" + eTestReport.ReportID + " and QualifiedLevel=''").Tables[0]; eTestReport.EditPersonnelID = CurrentUserInfo.PersonnelID; eTestReport.AreaID = tInPersonnel.GetModel(eTestReport.MainTestPersonnelID.Value).AreaID; eTestReport.RecordIDS = eTestReport.RecordIDS.TrimEnd(','); eTestReport.TaskNoS = eTestReport.TaskNoS.TrimEnd(','); eTestReport.UpdateTime = DateTime.Now; tTestReport.Update(eTestReport); //判断检验报告是否审核通过 if (eTestReport.ApprovalPersonnelID > 0 && eTestReport.examinePersonnelID > 0 && eTestReport.MainTestPersonnelID > 0) { dTestReport.ExpePlanPass(eTestReport.ReportID.ToString()); } return(true); }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(E_tb_TestReport model) { return(dal.Update(model)); }
/// <summary> /// 增加一条数据 /// </summary> public int Add(E_tb_TestReport model) { return(dal.Add(model)); }
/// <summary> /// 获得数据列表 /// </summary> public List <E_tb_TestReport> DataTableToList(DataTable dt) { List <E_tb_TestReport> modelList = new List <E_tb_TestReport>(); int rowsCount = dt.Rows.Count; if (rowsCount > 0) { E_tb_TestReport model; for (int n = 0; n < rowsCount; n++) { model = new E_tb_TestReport(); if (dt.Rows[n]["ReportID"].ToString() != "") { model.ReportID = int.Parse(dt.Rows[n]["ReportID"].ToString()); } model.RecordIDS = dt.Rows[n]["RecordIDS"].ToString(); model.TaskNoS = dt.Rows[n]["TaskNoS"].ToString(); model.ReportNo = dt.Rows[n]["ReportNo"].ToString(); model.SampleNum = dt.Rows[n]["SampleNum"].ToString(); model.SampleName = dt.Rows[n]["SampleName"].ToString(); model.Department = dt.Rows[n]["Department"].ToString(); if (dt.Rows[n]["TestType"].ToString() != "") { model.TestType = int.Parse(dt.Rows[n]["TestType"].ToString()); } if (dt.Rows[n]["IssuedTime"].ToString() != "") { model.IssuedTime = DateTime.Parse(dt.Rows[n]["IssuedTime"].ToString()); } model.TestingCompany = dt.Rows[n]["TestingCompany"].ToString(); model.Specifications = dt.Rows[n]["Specifications"].ToString(); if (dt.Rows[n]["ProductionTime"].ToString() != "") { model.ProductionTime = DateTime.Parse(dt.Rows[n]["ProductionTime"].ToString()); } model.Packing = dt.Rows[n]["Packing"].ToString(); model.productNum = dt.Rows[n]["productNum"].ToString(); model.ToSampleMode = dt.Rows[n]["ToSampleMode"].ToString(); model.SendTestAddress = dt.Rows[n]["SendTestAddress"].ToString(); model.SamplingPlace = dt.Rows[n]["SamplingPlace"].ToString(); model.SamplingCompany = dt.Rows[n]["SamplingCompany"].ToString(); model.SamplingPersonnel = dt.Rows[n]["SamplingPersonnel"].ToString(); if (dt.Rows[n]["SamplingTime"].ToString() != "") { model.SamplingTime = DateTime.Parse(dt.Rows[n]["SamplingTime"].ToString()); } if (dt.Rows[n]["TestTime"].ToString() != "") { model.TestTime = DateTime.Parse(dt.Rows[n]["TestTime"].ToString()); } model.ShelfLife = dt.Rows[n]["ShelfLife"].ToString(); model.TestBasis = dt.Rows[n]["TestBasis"].ToString(); model.Conclusion = dt.Rows[n]["Conclusion"].ToString(); model.Remarks = dt.Rows[n]["Remarks"].ToString(); model.Explain = dt.Rows[n]["Explain"].ToString(); if (dt.Rows[n]["ApprovalPersonnelID"].ToString() != "") { model.ApprovalPersonnelID = int.Parse(dt.Rows[n]["ApprovalPersonnelID"].ToString()); } if (dt.Rows[n]["examinePersonnelID"].ToString() != "") { model.examinePersonnelID = int.Parse(dt.Rows[n]["examinePersonnelID"].ToString()); } if (dt.Rows[n]["MainTestPersonnelID"].ToString() != "") { model.MainTestPersonnelID = int.Parse(dt.Rows[n]["MainTestPersonnelID"].ToString()); } model.FilePath = dt.Rows[n]["FilePath"].ToString(); if (dt.Rows[n]["AreaID"].ToString() != "") { model.AreaID = int.Parse(dt.Rows[n]["AreaID"].ToString()); } if (dt.Rows[n]["EditPersonnelID"].ToString() != "") { model.EditPersonnelID = int.Parse(dt.Rows[n]["EditPersonnelID"].ToString()); } if (dt.Rows[n]["AddTime"].ToString() != "") { model.AddTime = DateTime.Parse(dt.Rows[n]["AddTime"].ToString()); } if (dt.Rows[n]["UpdateTime"].ToString() != "") { model.UpdateTime = DateTime.Parse(dt.Rows[n]["UpdateTime"].ToString()); } modelList.Add(model); } } return(modelList); }
/// <summary> /// 增加一条数据 /// </summary> public int Add(E_tb_TestReport model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into tb_TestReport("); strSql.Append("RecordIDS,TaskNoS,ReportNo,SampleNum,SampleName,Department,TestType,IssuedTime,TestingCompany,Specifications,ProductionTime,Packing,productNum,ToSampleMode,SendTestAddress,SamplingPlace,SamplingCompany,SamplingPersonnel,SamplingTime,TestTime,ShelfLife,TestBasis,Conclusion,Remarks,Explain,ApprovalPersonnelID,examinePersonnelID,MainTestPersonnelID,FilePath,AreaID,EditPersonnelID,AddTime,UpdateTime)"); strSql.Append(" values ("); strSql.Append("@RecordIDS,@TaskNoS,@ReportNo,@SampleNum,@SampleName,@Department,@TestType,@IssuedTime,@TestingCompany,@Specifications,@ProductionTime,@Packing,@productNum,@ToSampleMode,@SendTestAddress,@SamplingPlace,@SamplingCompany,@SamplingPersonnel,@SamplingTime,@TestTime,@ShelfLife,@TestBasis,@Conclusion,@Remarks,@Explain,@ApprovalPersonnelID,@examinePersonnelID,@MainTestPersonnelID,@FilePath,@AreaID,@EditPersonnelID,@AddTime,@UpdateTime)"); strSql.Append(";select @@IDENTITY"); SqlParameter[] parameters = { new SqlParameter("@RecordIDS", SqlDbType.NVarChar, 100), new SqlParameter("@TaskNoS", SqlDbType.NVarChar, 200), new SqlParameter("@ReportNo", SqlDbType.NVarChar, 100), new SqlParameter("@SampleNum", SqlDbType.NVarChar, 100), new SqlParameter("@SampleName", SqlDbType.NVarChar, 100), new SqlParameter("@Department", SqlDbType.NVarChar, 50), new SqlParameter("@TestType", SqlDbType.Int, 4), new SqlParameter("@IssuedTime", SqlDbType.DateTime), new SqlParameter("@TestingCompany", SqlDbType.NVarChar, 50), new SqlParameter("@Specifications", SqlDbType.NVarChar, 100), new SqlParameter("@ProductionTime", SqlDbType.DateTime), new SqlParameter("@Packing", SqlDbType.NVarChar, 100), new SqlParameter("@productNum", SqlDbType.NVarChar, 100), new SqlParameter("@ToSampleMode", SqlDbType.NVarChar, 100), new SqlParameter("@SendTestAddress", SqlDbType.NVarChar, 200), new SqlParameter("@SamplingPlace", SqlDbType.NVarChar, 200), new SqlParameter("@SamplingCompany", SqlDbType.NVarChar, 100), new SqlParameter("@SamplingPersonnel", SqlDbType.NVarChar, 100), new SqlParameter("@SamplingTime", SqlDbType.DateTime), new SqlParameter("@TestTime", SqlDbType.DateTime), new SqlParameter("@ShelfLife", SqlDbType.NVarChar, 200), new SqlParameter("@TestBasis", SqlDbType.NVarChar, 200), new SqlParameter("@Conclusion", SqlDbType.NVarChar, 200), new SqlParameter("@Remarks", SqlDbType.NVarChar, 200), new SqlParameter("@Explain", SqlDbType.Text), new SqlParameter("@ApprovalPersonnelID", SqlDbType.Int, 4), new SqlParameter("@examinePersonnelID", SqlDbType.Int, 4), new SqlParameter("@MainTestPersonnelID", SqlDbType.Int, 4), new SqlParameter("@FilePath", SqlDbType.NVarChar, 50), new SqlParameter("@AreaID", SqlDbType.Int, 4), new SqlParameter("@EditPersonnelID", SqlDbType.Int, 4), new SqlParameter("@AddTime", SqlDbType.DateTime), new SqlParameter("@UpdateTime", SqlDbType.DateTime) }; parameters[0].Value = model.RecordIDS; parameters[1].Value = model.TaskNoS; parameters[2].Value = model.ReportNo; parameters[3].Value = model.SampleNum; parameters[4].Value = model.SampleName; parameters[5].Value = model.Department; parameters[6].Value = model.TestType; parameters[7].Value = model.IssuedTime; parameters[8].Value = model.TestingCompany; parameters[9].Value = model.Specifications; parameters[10].Value = model.ProductionTime; parameters[11].Value = model.Packing; parameters[12].Value = model.productNum; parameters[13].Value = model.ToSampleMode; parameters[14].Value = model.SendTestAddress; parameters[15].Value = model.SamplingPlace; parameters[16].Value = model.SamplingCompany; parameters[17].Value = model.SamplingPersonnel; parameters[18].Value = model.SamplingTime; parameters[19].Value = model.TestTime; parameters[20].Value = model.ShelfLife; parameters[21].Value = model.TestBasis; parameters[22].Value = model.Conclusion; parameters[23].Value = model.Remarks; parameters[24].Value = model.Explain; parameters[25].Value = model.ApprovalPersonnelID; parameters[26].Value = model.examinePersonnelID; parameters[27].Value = model.MainTestPersonnelID; parameters[28].Value = model.FilePath; parameters[29].Value = model.AreaID; parameters[30].Value = model.EditPersonnelID; parameters[31].Value = model.AddTime; parameters[32].Value = model.UpdateTime; object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters); if (obj == null) { return(0); } else { return(Convert.ToInt32(obj)); } }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(E_tb_TestReport model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update tb_TestReport set "); strSql.Append("RecordIDS=@RecordIDS,"); strSql.Append("TaskNoS=@TaskNoS,"); strSql.Append("ReportNo=@ReportNo,"); strSql.Append("SampleNum=@SampleNum,"); strSql.Append("SampleName=@SampleName,"); strSql.Append("Department=@Department,"); strSql.Append("TestType=@TestType,"); strSql.Append("IssuedTime=@IssuedTime,"); strSql.Append("TestingCompany=@TestingCompany,"); strSql.Append("Specifications=@Specifications,"); strSql.Append("ProductionTime=@ProductionTime,"); strSql.Append("Packing=@Packing,"); strSql.Append("productNum=@productNum,"); strSql.Append("ToSampleMode=@ToSampleMode,"); strSql.Append("SendTestAddress=@SendTestAddress,"); strSql.Append("SamplingPlace=@SamplingPlace,"); strSql.Append("SamplingCompany=@SamplingCompany,"); strSql.Append("SamplingPersonnel=@SamplingPersonnel,"); strSql.Append("SamplingTime=@SamplingTime,"); strSql.Append("TestTime=@TestTime,"); strSql.Append("ShelfLife=@ShelfLife,"); strSql.Append("TestBasis=@TestBasis,"); strSql.Append("Conclusion=@Conclusion,"); strSql.Append("Remarks=@Remarks,"); strSql.Append("Explain=@Explain,"); strSql.Append("ApprovalPersonnelID=@ApprovalPersonnelID,"); strSql.Append("examinePersonnelID=@examinePersonnelID,"); strSql.Append("MainTestPersonnelID=@MainTestPersonnelID,"); strSql.Append("FilePath=@FilePath,"); strSql.Append("AreaID=@AreaID,"); strSql.Append("EditPersonnelID=@EditPersonnelID,"); strSql.Append("AddTime=@AddTime,"); strSql.Append("UpdateTime=@UpdateTime"); strSql.Append(" where ReportID=@ReportID"); SqlParameter[] parameters = { new SqlParameter("@RecordIDS", SqlDbType.NVarChar, 100), new SqlParameter("@TaskNoS", SqlDbType.NVarChar, 200), new SqlParameter("@ReportNo", SqlDbType.NVarChar, 100), new SqlParameter("@SampleNum", SqlDbType.NVarChar, 100), new SqlParameter("@SampleName", SqlDbType.NVarChar, 100), new SqlParameter("@Department", SqlDbType.NVarChar, 50), new SqlParameter("@TestType", SqlDbType.Int, 4), new SqlParameter("@IssuedTime", SqlDbType.DateTime), new SqlParameter("@TestingCompany", SqlDbType.NVarChar, 50), new SqlParameter("@Specifications", SqlDbType.NVarChar, 100), new SqlParameter("@ProductionTime", SqlDbType.DateTime), new SqlParameter("@Packing", SqlDbType.NVarChar, 100), new SqlParameter("@productNum", SqlDbType.NVarChar, 100), new SqlParameter("@ToSampleMode", SqlDbType.NVarChar, 100), new SqlParameter("@SendTestAddress", SqlDbType.NVarChar, 200), new SqlParameter("@SamplingPlace", SqlDbType.NVarChar, 200), new SqlParameter("@SamplingCompany", SqlDbType.NVarChar, 100), new SqlParameter("@SamplingPersonnel", SqlDbType.NVarChar, 100), new SqlParameter("@SamplingTime", SqlDbType.DateTime), new SqlParameter("@TestTime", SqlDbType.DateTime), new SqlParameter("@ShelfLife", SqlDbType.NVarChar, 200), new SqlParameter("@TestBasis", SqlDbType.NVarChar, 200), new SqlParameter("@Conclusion", SqlDbType.NVarChar, 200), new SqlParameter("@Remarks", SqlDbType.NVarChar, 200), new SqlParameter("@Explain", SqlDbType.Text), new SqlParameter("@ApprovalPersonnelID", SqlDbType.Int, 4), new SqlParameter("@examinePersonnelID", SqlDbType.Int, 4), new SqlParameter("@MainTestPersonnelID", SqlDbType.Int, 4), new SqlParameter("@FilePath", SqlDbType.NVarChar, 50), new SqlParameter("@AreaID", SqlDbType.Int, 4), new SqlParameter("@EditPersonnelID", SqlDbType.Int, 4), new SqlParameter("@AddTime", SqlDbType.DateTime), new SqlParameter("@UpdateTime", SqlDbType.DateTime), new SqlParameter("@ReportID", SqlDbType.Int, 4) }; parameters[0].Value = model.RecordIDS; parameters[1].Value = model.TaskNoS; parameters[2].Value = model.ReportNo; parameters[3].Value = model.SampleNum; parameters[4].Value = model.SampleName; parameters[5].Value = model.Department; parameters[6].Value = model.TestType; parameters[7].Value = model.IssuedTime; parameters[8].Value = model.TestingCompany; parameters[9].Value = model.Specifications; parameters[10].Value = model.ProductionTime; parameters[11].Value = model.Packing; parameters[12].Value = model.productNum; parameters[13].Value = model.ToSampleMode; parameters[14].Value = model.SendTestAddress; parameters[15].Value = model.SamplingPlace; parameters[16].Value = model.SamplingCompany; parameters[17].Value = model.SamplingPersonnel; parameters[18].Value = model.SamplingTime; parameters[19].Value = model.TestTime; parameters[20].Value = model.ShelfLife; parameters[21].Value = model.TestBasis; parameters[22].Value = model.Conclusion; parameters[23].Value = model.Remarks; parameters[24].Value = model.Explain; parameters[25].Value = model.ApprovalPersonnelID; parameters[26].Value = model.examinePersonnelID; parameters[27].Value = model.MainTestPersonnelID; parameters[28].Value = model.FilePath; parameters[29].Value = model.AreaID; parameters[30].Value = model.EditPersonnelID; parameters[31].Value = model.AddTime; parameters[32].Value = model.UpdateTime; parameters[33].Value = model.ReportID; int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { return(true); } else { return(false); } }
/// <summary> /// 得到一个对象实体 /// </summary> public E_tb_TestReport GetModel(int ReportID) { StringBuilder strSql = new StringBuilder(); strSql.Append("select top 1 ReportID,RecordIDS,TaskNoS,ReportNo,SampleNum,SampleName,Department,TestType,IssuedTime,TestingCompany,Specifications,ProductionTime,Packing,productNum,ToSampleMode,SendTestAddress,SamplingPlace,SamplingCompany,SamplingPersonnel,SamplingTime,TestTime,ShelfLife,TestBasis,Conclusion,Remarks,Explain,ApprovalPersonnelID,examinePersonnelID,MainTestPersonnelID,FilePath,AreaID,EditPersonnelID,AddTime,UpdateTime from tb_TestReport "); strSql.Append(" where ReportID=@ReportID"); SqlParameter[] parameters = { new SqlParameter("@ReportID", SqlDbType.Int, 4) }; parameters[0].Value = ReportID; E_tb_TestReport model = new E_tb_TestReport(); DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { if (ds.Tables[0].Rows[0]["ReportID"].ToString() != "") { model.ReportID = int.Parse(ds.Tables[0].Rows[0]["ReportID"].ToString()); } if (ds.Tables[0].Rows[0]["RecordIDS"] != null) { model.RecordIDS = ds.Tables[0].Rows[0]["RecordIDS"].ToString(); } if (ds.Tables[0].Rows[0]["TaskNoS"] != null) { model.TaskNoS = ds.Tables[0].Rows[0]["TaskNoS"].ToString(); } if (ds.Tables[0].Rows[0]["ReportNo"] != null) { model.ReportNo = ds.Tables[0].Rows[0]["ReportNo"].ToString(); } if (ds.Tables[0].Rows[0]["SampleNum"] != null) { model.SampleNum = ds.Tables[0].Rows[0]["SampleNum"].ToString(); } if (ds.Tables[0].Rows[0]["SampleName"] != null) { model.SampleName = ds.Tables[0].Rows[0]["SampleName"].ToString(); } if (ds.Tables[0].Rows[0]["Department"] != null) { model.Department = ds.Tables[0].Rows[0]["Department"].ToString(); } if (ds.Tables[0].Rows[0]["TestType"].ToString() != "") { model.TestType = int.Parse(ds.Tables[0].Rows[0]["TestType"].ToString()); } if (ds.Tables[0].Rows[0]["IssuedTime"].ToString() != "") { model.IssuedTime = DateTime.Parse(ds.Tables[0].Rows[0]["IssuedTime"].ToString()); } if (ds.Tables[0].Rows[0]["TestingCompany"] != null) { model.TestingCompany = ds.Tables[0].Rows[0]["TestingCompany"].ToString(); } if (ds.Tables[0].Rows[0]["Specifications"] != null) { model.Specifications = ds.Tables[0].Rows[0]["Specifications"].ToString(); } if (ds.Tables[0].Rows[0]["ProductionTime"].ToString() != "") { model.ProductionTime = DateTime.Parse(ds.Tables[0].Rows[0]["ProductionTime"].ToString()); } if (ds.Tables[0].Rows[0]["Packing"] != null) { model.Packing = ds.Tables[0].Rows[0]["Packing"].ToString(); } if (ds.Tables[0].Rows[0]["productNum"] != null) { model.productNum = ds.Tables[0].Rows[0]["productNum"].ToString(); } if (ds.Tables[0].Rows[0]["ToSampleMode"] != null) { model.ToSampleMode = ds.Tables[0].Rows[0]["ToSampleMode"].ToString(); } if (ds.Tables[0].Rows[0]["SendTestAddress"] != null) { model.SendTestAddress = ds.Tables[0].Rows[0]["SendTestAddress"].ToString(); } if (ds.Tables[0].Rows[0]["SamplingPlace"] != null) { model.SamplingPlace = ds.Tables[0].Rows[0]["SamplingPlace"].ToString(); } if (ds.Tables[0].Rows[0]["SamplingCompany"] != null) { model.SamplingCompany = ds.Tables[0].Rows[0]["SamplingCompany"].ToString(); } if (ds.Tables[0].Rows[0]["SamplingPersonnel"] != null) { model.SamplingPersonnel = ds.Tables[0].Rows[0]["SamplingPersonnel"].ToString(); } if (ds.Tables[0].Rows[0]["SamplingTime"].ToString() != "") { model.SamplingTime = DateTime.Parse(ds.Tables[0].Rows[0]["SamplingTime"].ToString()); } if (ds.Tables[0].Rows[0]["TestTime"].ToString() != "") { model.TestTime = DateTime.Parse(ds.Tables[0].Rows[0]["TestTime"].ToString()); } if (ds.Tables[0].Rows[0]["ShelfLife"] != null) { model.ShelfLife = ds.Tables[0].Rows[0]["ShelfLife"].ToString(); } if (ds.Tables[0].Rows[0]["TestBasis"] != null) { model.TestBasis = ds.Tables[0].Rows[0]["TestBasis"].ToString(); } if (ds.Tables[0].Rows[0]["Conclusion"] != null) { model.Conclusion = ds.Tables[0].Rows[0]["Conclusion"].ToString(); } if (ds.Tables[0].Rows[0]["Remarks"] != null) { model.Remarks = ds.Tables[0].Rows[0]["Remarks"].ToString(); } if (ds.Tables[0].Rows[0]["Explain"] != null) { model.Explain = ds.Tables[0].Rows[0]["Explain"].ToString(); } if (ds.Tables[0].Rows[0]["ApprovalPersonnelID"].ToString() != "") { model.ApprovalPersonnelID = int.Parse(ds.Tables[0].Rows[0]["ApprovalPersonnelID"].ToString()); } if (ds.Tables[0].Rows[0]["examinePersonnelID"].ToString() != "") { model.examinePersonnelID = int.Parse(ds.Tables[0].Rows[0]["examinePersonnelID"].ToString()); } if (ds.Tables[0].Rows[0]["MainTestPersonnelID"].ToString() != "") { model.MainTestPersonnelID = int.Parse(ds.Tables[0].Rows[0]["MainTestPersonnelID"].ToString()); } if (ds.Tables[0].Rows[0]["FilePath"] != null) { model.FilePath = ds.Tables[0].Rows[0]["FilePath"].ToString(); } if (ds.Tables[0].Rows[0]["AreaID"].ToString() != "") { model.AreaID = int.Parse(ds.Tables[0].Rows[0]["AreaID"].ToString()); } if (ds.Tables[0].Rows[0]["EditPersonnelID"].ToString() != "") { model.EditPersonnelID = int.Parse(ds.Tables[0].Rows[0]["EditPersonnelID"].ToString()); } if (ds.Tables[0].Rows[0]["AddTime"].ToString() != "") { model.AddTime = DateTime.Parse(ds.Tables[0].Rows[0]["AddTime"].ToString()); } if (ds.Tables[0].Rows[0]["UpdateTime"].ToString() != "") { model.UpdateTime = DateTime.Parse(ds.Tables[0].Rows[0]["UpdateTime"].ToString()); } return(model); } else { return(null); } }
/// <summary> /// 显示详情页 /// </summary> /// <param name="EditType">编辑类型</param> /// <returns>返回编辑结果</returns> public ActionResult TestReportEdit(E_tb_TestReport eTestReport, string EditType, int?InfoID) { //ViewData["RecordList"] = tOriginalRecord.GetList("").Tables[0]; ViewData["_abclist"] = PageTools.GetSelectList(tTypeDict.GetList("SubjectID=5").Tables[0], "TypeID", "TypeName", false); ViewData["RecordSelect"] = new DataTable(); ViewData["ReportDataList"] = new DataTable(); ViewBag._userName = CurrentUserInfo.UserName; if (EditType == "Edit") { eTestReport = tTestReport.GetModel(Convert.ToInt32(InfoID)); //ViewData["RecordList"] = tOriginalRecord.GetList("RecordID not in (" + eTestReport.RecordIDS + ")").Tables[0]; //ViewData["RecordSelect"] = tOriginalRecord.GetList("RecordID in (" + eTestReport.RecordIDS + ")").Tables[0]; ViewData["ReportDataList"] = tTestReportData.GetList("ReportID=" + eTestReport.ReportID).Tables[0]; //检验数据 E_tb_InPersonnel eInPersonnel = null; if (eTestReport.ApprovalPersonnelID != null && eTestReport.ApprovalPersonnelID > 0) { eInPersonnel = tInPersonnel.GetModel(Convert.ToInt32(eTestReport.ApprovalPersonnelID)); eTestReport.ApprovalPersonnelName = (eInPersonnel != null ? eInPersonnel.PersonnelName : ""); } if (eTestReport.examinePersonnelID != null && eTestReport.examinePersonnelID > 0) { eInPersonnel = tInPersonnel.GetModel(Convert.ToInt32(eTestReport.examinePersonnelID)); eTestReport.examinePersonnelName = (eInPersonnel != null ? eInPersonnel.PersonnelName : ""); } if (eTestReport.MainTestPersonnelID != null && eTestReport.MainTestPersonnelID > 0) { eInPersonnel = tInPersonnel.GetModel(Convert.ToInt32(eTestReport.MainTestPersonnelID)); eTestReport.MainTestPersonnelName = (eInPersonnel != null ? eInPersonnel.PersonnelName : ""); } if (string.IsNullOrEmpty(eTestReport.Explain)) { eTestReport.Explain = @" 一、 本检验报告复印、涂改无效;封面未加盖检验专用章和无检验专用骑缝章(如2页以上)的检验报告无效。<br/> 二、 检验报告仅对送检、抽检样品负责。<br/> 三、 本检验报告及检验单位名称不得用于产品的标签、广告评优及商品宣传等。<br/> 四、 本检验报告一式二份,一份由检验单位存档,一份交送检、抽检单位。<br/> 五、 本检验报告由出具报告单位负责,并进行解释说明。<br/> 六、 检验单位保存该检验报告6年。<br/><br/>" ; if (eTestReport.MainTestPersonnelID > 0) { try { eInPersonnel = tInPersonnel.GetModel(eTestReport.MainTestPersonnelID.Value); var _areaid = (eInPersonnel != null ? eInPersonnel.AreaID : 0); if (_areaid > 0) { switch (_areaid) { case 2: { eTestReport.Explain += @"食品检测中心<br/> 检验单位地址:天津市塘沽区东沽石油新村配餐采购加工中心院内<br/> 邮政编码:300452<br/> 联系电话:022-66917343<br/> 传真:022-66917343<br/><br/>"; break; } case 3: { eTestReport.Explain += @"食品检测中心(葫芦岛)<br/> 检验单位地址:辽宁省葫芦岛市龙港区北港码头配餐公司葫芦岛配送基地<br/> 邮政编码:125000<br/> 联系电话:0429-2080522<br/> 传真:0429-2082522<br/><br/>"; break; } case 4: { eTestReport.Explain += @"食品检测中心(深圳)<br/> 检验单位地址:广东省惠州市大亚湾区石化大道中滨海十二路9号惠州物流基地W18<br/> 邮政编码:516082<br/> 联系电话:0752-5952819<br/> 传真:0752-5952818<br/><br/>"; break; } case 5: { eTestReport.Explain += @"食品检测中心(湛江)<br/> 检验单位地址:广东省湛江市坡头区南油一区配餐服务公司湛江分公司<br/> 邮政编码:524057<br/> 联系电话:0759-3910316<br/> 传真:0759-3901145<br/><br/>"; break; } case 6: { eTestReport.Explain += @"食品检测中心(龙口)<br/> 检验单位地址::山东省烟台市龙口市环海中路中海油物流码头配餐公司龙口配送基地<br/> 邮政编码:265700<br/> 联系电话:0535-8838131<br/> 传真:0535-8838131<br/><br/>"; break; } } } } catch { } } } } ViewBag.SampleName = eTestReport.SampleName; if (eTestReport.SampleName.ToString().IndexOf(')') > -1) { ViewBag.SampleName = eTestReport.SampleName.ToString().Substring(0, eTestReport.SampleName.ToString().IndexOf(')') + 1); } else { ViewBag.SampleName = Regex.Replace(ViewBag.SampleName, @"[^\u4e00-\u9fa5|(|)]", ""); } ViewBag.AreaName = tArea.GetModel(int.Parse(eTestReport.AreaID.ToString())).TestReportName; var sampleModel = new BLL.tb_SampleBLL().GetModelList(" sampleNum = '" + eTestReport.SampleNum + "'").FirstOrDefault(); ViewBag._cydw = "none"; ViewBag._sydw = "none"; if (sampleModel.isDetection) { eTestReport.ToSampleMode = "抽样"; ViewBag._cydw = ""; } else { eTestReport.ToSampleMode = "送样"; ViewBag._sydw = ""; } ViewBag.Department = eTestReport.Department; var _orlist = new BLL.OriginalRecord.T_tb_OriginalRecord().GetModelList(" RecordID in (" + eTestReport.RecordIDS + ")"); String _projectIds = ""; int _tempProjectId = 0; for (int i = 0; i < _orlist.Count; i++) { if (_tempProjectId == _orlist[i].ProjectID) { continue; } if (String.IsNullOrEmpty(_projectIds)) { _projectIds = _orlist[i].ProjectID.ToString(); } else { _projectIds += "," + _orlist[i].ProjectID.ToString(); } } eTestReport.TestBasis = ""; var _projectlist = new BLL.Laboratory.T_tb_Project().GetModelList(" ProjectID in (" + _projectIds + ")"); foreach (var item in _projectlist) { if (String.IsNullOrEmpty(eTestReport.TestBasis)) { eTestReport.TestBasis = item.ExpeMethod; } else { eTestReport.TestBasis += "," + item.ExpeMethod; } } //ViewBag.Department = ""; //if (sampleModel != null) //{ // if (sampleModel.isDetection) // { // ViewBag.Department = sampleModel.detectionCompany; // } // else // { // var clint = new BLL.ClientManage.T_tb_ClientManage().GetModel(Convert.ToInt32(sampleModel.InspectCompany)); // ViewBag.Department = clint.ClientName; // } //} ViewBag._TestType = ""; if (eTestReport.TestType != null) { ViewBag._TestType = tTypeDict.GetModel(int.Parse(eTestReport.TestType.ToString())).TypeName; } //ViewBag.TestTime = eTestReport.TestTime == null ? "" : Convert.ToDateTime(eTestReport.TestTime).ToString("yyyy/MM/dd"); ViewBag.TestTime = eTestReport.IssuedTime == null ? "" : Convert.ToDateTime(eTestReport.IssuedTime).ToString("yyyy/MM/dd"); ViewBag.DetectPersonnelID = CurrentUserInfo.PersonnelID; ViewBag.DetectPersonnelName = CurrentUserInfo.PersonnelName; if (string.IsNullOrEmpty(eTestReport.Remarks)) { eTestReport.Remarks = "无"; } eTestReport.EditType = EditType; return(View(eTestReport)); }
/// <summary> /// 更新检验报告 /// </summary> /// <param name="eOriginalRecord"></param> /// <param name="eExpePlan"></param> public JsonResult UpdateTestReport(int RecordID) { E_tb_OriginalRecord eOriginalRecord = _dOriginalRecord.GetModel(new E_tb_OriginalRecord() { RecordID = RecordID }); E_tb_ExpePlan eExpePlan = _dExpePlan.GetExpePlanInfo(new E_tb_ExpePlan() { TaskNo = eOriginalRecord.TaskNo }); tb_Sample eSample = tSample.GetModel(eOriginalRecord.SampleID.Value); string productNum = eSample.protNum;//产品批次 E_tb_TestReport eTestReport = null; var tempmodel = tTestReport.GetModelList(" A.SampleNum = '" + eSample.sampleNum + "'"); if (tempmodel != null && tempmodel.Count > 0) { eTestReport = tempmodel.First(); eTestReport.SampleNum = eSample.sampleNum; //样品编号 eTestReport.SampleName = eSample.name; //样品名称 } if (eTestReport == null) { eTestReport = new E_tb_TestReport(); eTestReport.productNum = productNum; //批次号 eTestReport.SampleNum = eSample.sampleNum; //样品编号 eTestReport.SampleName = eSample.name; //样品名称 eTestReport.ProductionTime = eSample.productDate; //生产日期 eTestReport.Specifications = eSample.modelType; //规格型号 eTestReport.ShelfLife = eSample.expirationDate; //保质期 string Department = "/"; if (eSample.isDetection) { Department = eSample.detectionCompany; } else { var client = new BLL.ClientManage.T_tb_ClientManage().GetModel(Convert.ToInt32(eSample.InspectCompany)); Department = (client != null ? client.ClientName : ""); } eTestReport.Department = Department; //送/抽检单位 eTestReport.SendTestAddress = eSample.InspectAddress; //送检单位地址 eTestReport.SamplingPlace = eSample.detectionAdress; //抽样地点 eTestReport.SamplingCompany = eSample.detectionCompany; //抽样单位 eTestReport.SamplingPersonnel = eSample.detectionUser; //抽样者 eTestReport.Packing = eSample.packaging; //包装形式 eTestReport.SamplingTime = eSample.detectionDate; //抽样日期 eTestReport.TestBasis = new BLL.Laboratory.T_tb_Project().GetModel(eOriginalRecord.ProjectID.Value).ExpeMethod; eTestReport.TestTime = eOriginalRecord.DetectTime; //检验日期 DataTable dt = tOriginalRecord.GetRecordIDListBySampleID(int.Parse(eExpePlan.SampleID.ToString())); string RecordIDS = ""; if (dt != null && dt.Rows.Count > 0) { for (int i = 0; i < dt.Rows.Count; i++) { RecordIDS += dt.Rows[i]["RecordID"].ToString() + ","; } RecordIDS = RecordIDS.TrimEnd(','); } eTestReport.RecordIDS = RecordIDS;//原始记录IDS DataTable dtExpePlan = tExpePlan.GetList("SampleID=" + eExpePlan.SampleID.ToString()).Tables[0]; string TaskNoS = ""; if (dtExpePlan != null && dtExpePlan.Rows.Count > 0) { for (int i = 0; i < dtExpePlan.Rows.Count; i++) { TaskNoS += dtExpePlan.Rows[i]["PlanID"].ToString() + ","; } TaskNoS = TaskNoS.TrimEnd(','); } eTestReport.TaskNoS = TaskNoS;//任务单号 对应的检验计划IDS eTestReport.EditPersonnelID = CurrentUserInfo.PersonnelID; eTestReport.AreaID = CurrentUserInfo.AreaID; eTestReport.AddTime = Convert.ToDateTime(DateTime.Now.ToShortDateString()); eTestReport.UpdateTime = DateTime.Now; eTestReport.ReportID = tTestReport.Add(eTestReport); } else { DataTable dt = tOriginalRecord.GetRecordIDListBySampleID(int.Parse(eExpePlan.SampleID.ToString())); string RecordIDS = ""; if (dt != null && dt.Rows.Count > 0) { for (int i = 0; i < dt.Rows.Count; i++) { RecordIDS += dt.Rows[i]["RecordID"].ToString() + ","; } RecordIDS = RecordIDS.TrimEnd(','); } eTestReport.RecordIDS = RecordIDS;//原始记录IDS DataTable dtExpePlan = tExpePlan.GetList("SampleID=" + eExpePlan.SampleID.ToString()).Tables[0]; string TaskNoS = ""; if (dtExpePlan != null && dtExpePlan.Rows.Count > 0) { for (int i = 0; i < dtExpePlan.Rows.Count; i++) { TaskNoS += dtExpePlan.Rows[i]["PlanID"].ToString() + ","; } TaskNoS = TaskNoS.TrimEnd(','); } eTestReport.TaskNoS = TaskNoS;//任务单号 对应的检验计划IDS eTestReport.AreaID = CurrentUserInfo.AreaID; eTestReport.EditPersonnelID = CurrentUserInfo.PersonnelID; eTestReport.UpdateTime = DateTime.Now; eTestReport.TestBasis = new BLL.Laboratory.T_tb_Project().GetModel(eOriginalRecord.ProjectID.Value).ExpeMethod; tTestReport.Update(eTestReport); } //更新检验报告数据 List <E_tb_TestReportData> eTestReportDataList = tTestReportData.GetModelList("RecordFilePath='" + eOriginalRecord.FilePath + "'"); if (eTestReportDataList != null) { E_tb_Project eProject = tProject.GetModel(Convert.ToInt32(eOriginalRecord.ProjectID)); if (eProject.IsPesCheck != null && int.Parse(eProject.IsPesCheck.ToString()) == 1)//判断是否为农药残留检查项目 { foreach (E_tb_TestReportData eTestReportData in eTestReportDataList) { eTestReportData.RecordID = eOriginalRecord.RecordID; //原始记录ID eTestReportData.ReportID = eTestReport.ReportID; //检验报告ID eTestReportData.TestStandard = eProject.ExpeMethod; //检验标准 if (!String.IsNullOrEmpty(eOriginalRecord.InsStand)) { String[] strs = eOriginalRecord.InsStand.Split(':'); if (strs == null || strs.Length <= 2) { strs = eOriginalRecord.InsStand.Split(':'); } if (strs != null && strs.Length >= 2) { String str = strs[1]; int result = 0; if (!String.IsNullOrEmpty(str)) { // 正则表达式剔除非数字字符(不包含小数点.) str = Regex.Replace(str, @"[^\d.\d]", ""); // 如果是数字,则转换为decimal类型 if (Regex.IsMatch(str, @"^[+-]?\d*[.]?\d*$")) { result = int.Parse(str); } if (!String.IsNullOrEmpty(eTestReportData.TestResult)) { Decimal _testResult = Convert.ToDecimal(eTestReportData.TestResult); if (_testResult <= result) { eTestReportData.QualifiedLevel = "合格"; } else { eTestReportData.QualifiedLevel = "不合格"; } } } } } tTestReportData.Update(eTestReportData); } } else { foreach (E_tb_TestReportData eTestReportData in eTestReportDataList) { eTestReportData.RecordID = eOriginalRecord.RecordID; //原始记录ID eTestReportData.ReportID = eTestReport.ReportID; //检验报告ID eTestReportData.TestName = eProject.ProjectName; //检验名称/检验项目名称 eTestReportData.TestStandard = eProject.ExpeMethod; //检验标准 if (!String.IsNullOrEmpty(eOriginalRecord.InsStand)) { String[] strs = eOriginalRecord.InsStand.Split(':'); if (strs == null || strs.Length <= 2) { strs = eOriginalRecord.InsStand.Split(':'); } if (strs != null && strs.Length >= 2) { String str = strs[1]; int result = 0; if (!String.IsNullOrEmpty(str)) { // 正则表达式剔除非数字字符(不包含小数点.) str = Regex.Replace(str, @"[^\d.\d]", ""); // 如果是数字,则转换为decimal类型 if (Regex.IsMatch(str, @"^[+-]?\d*[.]?\d*$") && !string.IsNullOrEmpty(str)) { result = int.Parse(str); } if (!String.IsNullOrEmpty(eTestReportData.TestResult) && !string.IsNullOrEmpty(str)) { Decimal _testResult = Convert.ToDecimal(eTestReportData.TestResult); if (_testResult <= result) { eTestReportData.QualifiedLevel = "合格"; } else { eTestReportData.QualifiedLevel = "不合格"; } } } } } tTestReportData.Update(eTestReportData); } } } return(Json(new { result = true, msg = "更新成功!" }, JsonRequestBehavior.AllowGet)); }
T_tb_Area tArea = new T_tb_Area(); //区域/单位 public ActionResult TestReportView(E_tb_TestReport eTestReport) { ViewData["ReportDataList"] = tTestReportData.GetList("ReportID=" + eTestReport.ReportID).Tables[0]; //检验数据 eTestReport = tTestReport.GetModel(eTestReport.ReportID); E_tb_TypeDict eTypeDict = tTypeDict.GetModel(Convert.ToInt32(eTestReport.TestType)); eTestReport.TestTypeName = (eTypeDict != null ? eTypeDict.TypeName : ""); E_tb_InPersonnel eInPersonnel = new E_tb_InPersonnel(); if (eTestReport.ApprovalPersonnelID != null && eTestReport.ApprovalPersonnelID > 0) { eInPersonnel = tInPersonnel.GetModel(Convert.ToInt32(eTestReport.ApprovalPersonnelID)); if (eInPersonnel != null) { eTestReport.ApprovalPersonnelName = eInPersonnel.PersonnelName; } } if (eTestReport.examinePersonnelID != null && eTestReport.examinePersonnelID > 0) { eInPersonnel = tInPersonnel.GetModel(Convert.ToInt32(eTestReport.examinePersonnelID)); if (eInPersonnel != null) { eTestReport.examinePersonnelName = eInPersonnel.PersonnelName; } } if (eTestReport.MainTestPersonnelID != null && eTestReport.MainTestPersonnelID > 0) { eInPersonnel = tInPersonnel.GetModel(Convert.ToInt32(eTestReport.MainTestPersonnelID)); if (eInPersonnel != null) { eTestReport.MainTestPersonnelName = eInPersonnel.PersonnelName; } } //eTestReport.SampleName = Regex.Replace(eTestReport.SampleName, @"[^\u4e00-\u9fa5]", ""); if (eTestReport.SampleName.ToString().IndexOf(')') > -1) { eTestReport.SampleName = eTestReport.SampleName.ToString().Substring(0, eTestReport.SampleName.ToString().IndexOf(')') + 1); } else if (eTestReport.SampleName.ToString().IndexOf(')') > -1) { eTestReport.SampleName = eTestReport.SampleName.ToString().Substring(0, eTestReport.SampleName.ToString().IndexOf(')') + 1); } else { eTestReport.SampleName = Regex.Replace(eTestReport.SampleName, @"[^\u4e00-\u9fa5|(|)]", ""); } var sampleModel = new BLL.tb_SampleBLL().GetModelList(" sampleNum = '" + eTestReport.SampleNum + "'").FirstOrDefault(); ViewBag._cydw = "none"; ViewBag._sydw = "none"; ViewBag._scjdw = ""; if (sampleModel != null) { if (sampleModel.isDetection) { eTestReport.ToSampleMode = "抽样"; ViewBag._cydw = ""; ViewBag._scjdw = eTestReport.SamplingCompany; eTestReport.Department = "/"; } else { eTestReport.ToSampleMode = "送样"; ViewBag._sydw = ""; eTestReport.SamplingCompany = "/"; ViewBag._scjdw = eTestReport.Department; } } if (String.IsNullOrEmpty(eTestReport.Specifications)) { eTestReport.Specifications = "/"; } if (String.IsNullOrEmpty(eTestReport.Packing)) { eTestReport.Packing = "/"; } if (String.IsNullOrEmpty(eTestReport.productNum)) { eTestReport.productNum = "/"; } ViewBag._IssuedTime = ""; if (eTestReport.IssuedTime != null) { ViewBag._IssuedTime = eTestReport.IssuedTime.Value.ToString("yyyy/MM/dd"); } var _orlist = new BLL.OriginalRecord.T_tb_OriginalRecord().GetModelList(" RecordID in (" + eTestReport.RecordIDS + ")"); String _projectIds = ""; int _tempProjectId = 0; for (int i = 0; i < _orlist.Count; i++) { if (_tempProjectId == _orlist[i].ProjectID) { continue; } if (String.IsNullOrEmpty(_projectIds)) { _projectIds = _orlist[i].ProjectID.ToString(); } else { _projectIds += "," + _orlist[i].ProjectID.ToString(); } } eTestReport.TestBasis = ""; var _projectlist = new BLL.Laboratory.T_tb_Project().GetModelList(" ProjectID in (" + _projectIds + ")"); foreach (var item in _projectlist) { if (String.IsNullOrEmpty(eTestReport.TestBasis)) { eTestReport.TestBasis = item.ExpeMethod; } else { eTestReport.TestBasis += "," + item.ExpeMethod; } } ViewBag.AreaName = tArea.GetModel(int.Parse(eTestReport.AreaID.ToString())).TestReportName; return(View(eTestReport)); }
public string Save(E_tb_TestReport eTestReport) { string msg = "0"; try { //检验数据 List <E_ReportData> ReportDataList = new List <E_ReportData>(); string strJson = eTestReport.TestReportDataJson; if (!string.IsNullOrEmpty(strJson)) { strJson = strJson.Replace("\r\n", ""); ReportDataList = JsonHelper.JsonDeserialize <List <E_ReportData> >(strJson); } //删除原有检验数据 tTestReportData.DeleteByWhere("ReportID=" + eTestReport.ReportID); foreach (E_ReportData item in ReportDataList) { E_tb_TestReportData eTestReportData = new E_tb_TestReportData(); eTestReportData.ReportID = eTestReport.ReportID; eTestReportData.TestName = item.TestName; eTestReportData.TestStandard = item.TestStandard; eTestReportData.TestResult = item.TestResult; eTestReportData.QualifiedLevel = item.QualifiedLevel; eTestReportData.TestPersonnelName = item.TestPersonnelName; eTestReportData.RecordID = int.Parse(item.RecordID); eTestReportData.RecordFilePath = item.RecordFilePath; tTestReportData.Add(eTestReportData); } //结论 //eTestReport.Conclusion = "合格"; DataTable TestReportDataDT = tTestReportData.GetList("ReportID=" + eTestReport.ReportID + " and QualifiedLevel=''").Tables[0]; //if (TestReportDataDT != null && TestReportDataDT.Rows.Count > 0) //{ // eTestReport.Conclusion = ""; //} //TestReportDataDT = tTestReportData.GetList("ReportID=" + eTestReport.ReportID + " and QualifiedLevel='不合格'").Tables[0]; //if (TestReportDataDT != null && TestReportDataDT.Rows.Count > 0) //{ // eTestReport.Conclusion = "不合格"; //} eTestReport.EditPersonnelID = CurrentUserInfo.PersonnelID; eTestReport.AreaID = new BLL.PersonnelManage.T_tb_InPersonnel().GetModel(eTestReport.MainTestPersonnelID.Value).AreaID; //if (CurrentUserInfo.DataRange != 1) //{ // eTestReport.AreaID = CurrentUserInfo.AreaID; //} eTestReport.RecordIDS = eTestReport.RecordIDS.TrimEnd(','); eTestReport.TaskNoS = eTestReport.TaskNoS.TrimEnd(','); eTestReport.UpdateTime = DateTime.Now; tTestReport.Update(eTestReport); //判断检验报告是否审核通过 if (eTestReport.ApprovalPersonnelID > 0 && eTestReport.examinePersonnelID > 0 && eTestReport.MainTestPersonnelID > 0) { tExpePlan.UpdateStatusByPlanIDS(eTestReport.TaskNoS, eTestReport.ReportID); } msg = "1"; } catch (Exception ex) { msg = ex.Message; } return(msg); }
T_tb_ExpePlan tExpePlan = new T_tb_ExpePlan(); //实验计划管理 // // GET: /Laboratory/ public ActionResult TestReportList(E_tb_TestReport eTestReport) { ViewData["AreaList"] = PageTools.GetSelectList(tArea.GetList("").Tables[0], "AreaID", "AreaName", true); ViewBag._userName = CurrentUserInfo.UserName; return(View(eTestReport)); }