/// <summary> /// 报事报事跟进 /// </summary> /// <param name="datas"></param> /// <param name="TaskItem_1"></param> /// <returns></returns> public static void SynchronizeData_workFollowSynchronize(Dictionary <string, string> drData, string strLoginSQLConnStr) { string Results = ""; string json = ""; string status = ""; XmlDocument xmlDoc = new XmlDocument(); try { //请求 HK_webServiecReference.hkserviceImplService hkserver = new HK_webServiecReference.hkserviceImplService(); json = "[" + (new JavaScriptSerializer()).Serialize(drData) + "]"; json = json.Replace("null", "\" \""); Results = hkserver.workFollowSynchronize(json); xmlDoc.LoadXml(Results); //xml 读取 status = GetxmlNodeValue(xmlDoc.SelectSingleNode("response").ChildNodes, "Status").Trim() == "0" ? "成功" : "失败"; } catch (Exception ms) { Model.Task.Tb_HSPR_IncidentError IncidentError = new Model.Task.Tb_HSPR_IncidentError(); // JObject obj1 = (JObject)JsonConvert.DeserializeObject(Results); //写入日志 IncidentError.Method = "workFollowSynchronize"; IncidentError.Parameter = json; IncidentError.State = "[App]请求接口失败"; IncidentError.ErrorDate = DateTime.Now; IncidentError.ErrorContent = ms.ToString(); new BLL.Task.Bll_Tb_HSPR_IncidentError().Add(IncidentError); return; } //写入日志 Model.Task.Tb_HSPR_IncidentError IncidentError2 = new Model.Task.Tb_HSPR_IncidentError(); IncidentError2.Method = "workFollowSynchronize"; IncidentError2.Parameter = json; IncidentError2.State = "[App]" + status; IncidentError2.ErrorDate = DateTime.Now; IncidentError2.ErrorContent = GetxmlNodeValue(xmlDoc.SelectSingleNode("response").ChildNodes, "message").Trim(); new BLL.Task.Bll_Tb_HSPR_IncidentError().Add(IncidentError2); }
/// <summary> /// 报事处理 增 删 改 同步 /// </summary> /// <param name="drData"></param> /// <param name="strLoginSQLConnStr"></param> /// <param name="sTitle">日志表中State 加入特定词 区分数据源</param> public static void SynchronizeData_WorkOrderInfo(Dictionary <string, string> drData, string strLoginSQLConnStr, string sTitle = null) { string Results = ""; string json = ""; string status = ""; string sLogTitle = string.IsNullOrEmpty(sTitle) ? "" : "(" + sTitle + ")"; XmlDocument xmlDoc = new XmlDocument(); try { //加载参数 //string sql = string.Format("select * from View_Incident_Reception_Filter where ReceCode='{0}'"); //DataTable dTable = new HM.DBUtility.DbHelperSQLP(strLoginSQLConnStr).Query(sql).Tables[0]; Dictionary <string, string> dir = new Dictionary <string, string>(); //请求 HK_webServiecReference.hkserviceImplService hkserver = new HK_webServiecReference.hkserviceImplService(); json = "[" + (new JavaScriptSerializer()).Serialize(drData) + "]"; json = json.Replace("null", "\" \""); Results = hkserver.workOrderInfoSynchronize(json); // Results = "<?xml version=\"1.0\" encoding=\"UTF - 8\"?><?access-control allow=\" * \"?><response><Status>1</Status><message>成功</message><callCenterIncidentID>314</callCenterIncidentID></response>"; // JObject obj = (JObject)JsonConvert.DeserializeObject(Results); json 读取 xmlDoc.LoadXml(Results); //xml 读取 status = GetxmlNodeValue(xmlDoc.SelectSingleNode("response").ChildNodes, "Status").Trim() == "0" ? "成功" : "失败"; //Status 结果状态0:成功 1:失败 //message 返回结果对应的描述 //反写数据 if (status == "成功" && drData["operateType"] == "0") { //返回CallCenterid //存入 提交的报事单中 SqlParameter[] parameters = { new SqlParameter("@incidentID", SqlDbType.BigInt), new SqlParameter("@callCenterIncidentID", SqlDbType.NVarChar, 100) }; parameters[0].Value = Convert.ToInt64(drData["incidentID"]); parameters[1].Value = GetxmlNodeValue(xmlDoc.SelectSingleNode("response").ChildNodes, "callCenterIncidentID").Trim(); new MobileSoft.DBUtility.DbHelperSQLP(strLoginSQLConnStr).RunProcedure("proc_Interface_workOrderInfoSynchronize", parameters); } } catch (Exception ms) { Model.Task.Tb_HSPR_IncidentError IncidentError = new Model.Task.Tb_HSPR_IncidentError(); // JObject obj1 = (JObject)JsonConvert.DeserializeObject(Results); //写入日志 IncidentError.Method = "workOrderInfoSynchronize"; IncidentError.Parameter = json; IncidentError.State = "[app]请求接口失败" + sLogTitle; IncidentError.ErrorDate = DateTime.Now; IncidentError.ErrorContent = ms.ToString(); new BLL.Task.Bll_Tb_HSPR_IncidentError().Add(IncidentError); return; } //写入日志 Model.Task.Tb_HSPR_IncidentError IncidentError2 = new Model.Task.Tb_HSPR_IncidentError(); IncidentError2.Method = "workOrderInfoSynchronize"; IncidentError2.Parameter = json; IncidentError2.State = "[app]" + status + sLogTitle; IncidentError2.ErrorDate = DateTime.Now; IncidentError2.ErrorContent = GetxmlNodeValue(xmlDoc.SelectSingleNode("response").ChildNodes, "message").Trim(); new BLL.Task.Bll_Tb_HSPR_IncidentError().Add(IncidentError2); }