public Dictionary <string, object> ModifyPaperFault(ModifyPaperFaultRequestData reqData) { Dictionary <string, object> dictionary = new Dictionary <string, object>(); DataOpt dbopt = new DataOpt(); bool isModify = true; // 解析数据 foreach (ModifyPaperFaultDetail tmp in reqData.selectDefectInfoList) { if (isModify) { // 是否关联停机代码 string stopRecordId = "0"; for (int pk = 0; pk < reqData.stopRecordList.Count; pk++) { if (tmp.pfId == reqData.stopRecordList[pk].pfId && reqData.stopRecordList[pk].stopRecordId.Count > 0) { stopRecordId = reqData.stopRecordList[pk].stopRecordId[0].ToString(); } } DataSet ds = dbopt.insertDefectInfo(tmp.pfId, reqData.ppID, reqData.eventID, reqData.rollNum, reqData.userId, reqData.pathId, "0", "0", "0", "0", "0", tmp.pfCode.Split('_')[0], tmp.pcCode.Split('_')[1], tmp.isTreatment, tmp.startMeter, tmp.endMeter, tmp.remark, tmp.webNum.Substring(0, 1), tmp.webNum.Substring(1, 1), tmp.webNum.Substring(2, 1), tmp.webNum.Substring(3, 1), tmp.webNum.Substring(4, 1), tmp.webNum.Substring(5, 1), tmp.webNum.Substring(6, 1), tmp.webNum.Substring(7, 1), tmp.webNum.Substring(8, 1), tmp.webNum.Substring(9, 1), "0", "0", "0", stopRecordId); if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) { isModify = true; } else { isModify = false; } } } // 返回状态,message,defectid, 更新页面两个表格 if (!isModify) { dictionary.Add("state", 2); dictionary.Add("errmessage", "写入数据库失败!"); return(dictionary); } dictionary.Add("state", 1); return(dictionary); }