/// 填写结果日志 /// </summary> /// <param name="dtResultSrc">页面载入时取得的结果数据DataTable</param> /// <param name="strResultIDs">发送的结果id串,多个id用半角逗号分隔</param> /// <param name="strSampleIDs">发送的样品id串,多个id用半角逗号分隔</param> /// <param name="strCurrentUserId">当前用户ID</param> /// <param name="strCurrResultStatus">20</param> /// <param name="bIsSampleID">true,根据样品id串处理;false,根据结果id串处理</param> /// <returns></returns> public bool WriteResultLog(DataTable dtResultSrc, string strResultIDs, string strSampleIDs, string strCurrentUserId, string strCurrResultStatus, bool bIsSampleID) { if (bIsSampleID) { strSampleIDs = "'" + strSampleIDs.Replace(",", "','") + "'"; strResultIDs = ""; DataTable dtResult_WithSample = access.SelectResult_WithSampleIDs(strSampleIDs, strCurrentUserId, strCurrResultStatus); for (int i = 0; i < dtResult_WithSample.Rows.Count; i++) { strResultIDs += (strResultIDs.Length > 0 ? "," : "") + dtResult_WithSample.Rows[i]["ID"].ToString(); } } strResultIDs = "'" + strResultIDs.Replace(",", "','") + "'"; DataTable dtResultTar = access.SelectResult_WithIDs(strResultIDs); DataTable dtResultApp = access.SelectResultApp_WithIDs(strResultIDs); string strLogs = ""; for (int i = 0; i < dtResultTar.Rows.Count; i++) { for (int j = 0; j < dtResultSrc.Rows.Count; j++) { if (dtResultSrc.Rows[j]["ID"].ToString() == dtResultTar.Rows[i]["ID"].ToString()) { if (dtResultSrc.Rows[j]["ITEM_RESULT"].ToString() != dtResultTar.Rows[i]["ITEM_RESULT"].ToString()) { DataRow[] drs = dtResultApp.Select(string.Format("RESULT_ID='{0}'", dtResultSrc.Rows[j]["ID"].ToString())); string strLog = dtResultSrc.Rows[j]["ID"].ToString() + "|"; strLog += dtResultSrc.Rows[j]["ITEM_RESULT"].ToString() + "|"; strLog += dtResultSrc.Rows[j]["REMARK_2"].ToString() + "|"; strLog += dtResultTar.Rows[i]["ITEM_RESULT"].ToString() + "|"; strLog += dtResultTar.Rows[i]["REMARK_2"].ToString() + "|";//原始单号 strLog += drs[0]["HEAD_USERID"].ToString() + "|"; strLog += drs[0]["ASSISTANT_USERID"].ToString() + "|"; strLog += System.DateTime.Now.ToShortDateString(); strLogs += (strLogs.Length > 0 ? "@" : "") + strLog; } } } } if (strLogs.Length > 0) { string[] arrLog = strLogs.Split('@'); string strSerials = new TSysSerialLogic().GetSerialNumberList("MONITOR_RESULT_LOG", strLogs.Length); string[] arrSerial = strSerials.Split(','); for (int i = 0; i < arrLog.Length; i++) { arrLog[i] = arrSerial[i] + "|" + arrLog[i]; } return(access.InsertResultLog(arrLog)); } else { return(true); } }