コード例 #1
0
        public WriteBackWfm Xml2Model(string path)
        {
            XmlDocument  doc                = ReadXml2Doc(path);
            WriteBackWfm wfm                = new WriteBackWfm();
            XmlNode      PidsNode           = doc.DocumentElement.SelectSingleNode("PIDS");
            XmlNode      ViewNamesNode      = doc.DocumentElement.SelectSingleNode("ViewNames");
            XmlNode      WebserviceAddsNode = doc.DocumentElement.SelectSingleNode("WebserviceAdds");

            if (PidsNode != null)
            {
                wfm.PIDS = new List <PID>();
                XmlNodeList pidnodes = PidsNode.SelectNodes("PID");
                foreach (XmlNode xn in pidnodes)
                {
                    PID p = new PID();
                    p.PId      = xn.InnerText;
                    p.name     = xn.Attributes["name"].Value;
                    p.viewId   = xn.Attributes["viewId"].Value;
                    p.WSAID    = xn.Attributes["WSAID"].Value;
                    p.stepname = xn.Attributes["StepName"].Value;
                    wfm.PIDS.Add(p);
                }
            }
            if (ViewNamesNode != null)
            {
                wfm.ViewNames = new List <ViewName>();
                XmlNodeList viewNamenodes = ViewNamesNode.SelectNodes("ViewName");
                foreach (XmlNode xn in viewNamenodes)
                {
                    ViewName v = new ViewName();
                    v.name = xn.InnerText;
                    v.id   = xn.Attributes["id"].Value;
                    v.sql  = xn.Attributes["sql"].Value;
                    wfm.ViewNames.Add(v);
                }
            }
            if (WebserviceAddsNode != null)
            {
                wfm.WebserviceAdds = new List <WebserviceAdd>();
                XmlNodeList WebserviceAddnodes = WebserviceAddsNode.SelectNodes("WebserviceAdd");
                foreach (XmlNode xn in WebserviceAddnodes)
                {
                    WebserviceAdd w = new WebserviceAdd();
                    w.name = xn.InnerText;
                    w.id   = xn.Attributes["id"].Value;
                    wfm.WebserviceAdds.Add(w);
                }
            }
            return(wfm);
        }
コード例 #2
0
ファイル: Polling.cs プロジェクト: justseven/FCInterfaceData
        private bool PushDataTo(SlbhAndPid patchdata, WriteBackWfm Wfm, PID pid, string area, string addressType)
        {
            ViewName viewName = Wfm.ViewNames.Single(v => v.id == pid.viewId);
            DataSet  retdata  = GetPushData(patchdata, viewName, pid);

            if (retdata.Tables[0] == null || retdata.Tables[0].Rows.Count == 0)
            {
                //errInfo.WBerrInfo = "没有取到推送数据,View[" + viewName.name + "]";
                //errInfo.CGerrInfo = "没有取到推送数据,View[" + viewName.name + "]";
                ResetPushResult(patchdata.Slbh, pid.name, "-1", "", pid.PId, "没有取到推送数据,View[" + viewName.name + "]", patchdata.StepName, addressType);
                return(false);
            }
            WebserviceAdd add = Wfm.WebserviceAdds.Single(w => w.id == pid.WSAID);

            if (addressType.Equals("WB"))
            {
                string pushRet = PushDataWB(retdata, add.name, area);
                //string pushRet = PushData(retdata, add.name, area);
                //if(!IsError(errInfo))
                if (string.IsNullOrEmpty(pushRet))
                {//推送成功
                    ResetPushResult(patchdata.Slbh, pid.name, "1", SerialisePushData(retdata.Tables[0], viewName.name, add.name), pid.PId, pushRet, patchdata.StepName, addressType);
                }
                else
                {
                    ResetPushResult(patchdata.Slbh, pid.name, "0", SerialisePushData(retdata.Tables[0], viewName.name, add.name), pid.PId, pushRet, patchdata.StepName, addressType);
                }
                return(true);
            }
            if (addressType.Equals("CG"))
            {
                string pushRet = PushDataCG(retdata, add.name, area);
                //string pushRet = PushData(retdata, add.name, area);
                //if(!IsError(errInfo))
                if (string.IsNullOrEmpty(pushRet) || pushRet.Contains("推送成功"))
                {//推送成功
                    ResetPushResult(patchdata.Slbh, pid.name, "1", SerialisePushData(retdata.Tables[0], viewName.name, add.name), pid.PId, pushRet, patchdata.StepName, addressType);
                }
                else
                {
                    ResetPushResult(patchdata.Slbh, pid.name, "0", SerialisePushData(retdata.Tables[0], viewName.name, add.name), pid.PId, pushRet, patchdata.StepName, addressType);
                }
                return(true);
            }
            return(false);
        }
コード例 #3
0
ファイル: Polling.cs プロジェクト: justseven/FCInterfaceData
 /// <summary>
 /// 一次轮询执行的操作
 /// </summary>
 public bool GetOnce(string wrkId, WriteBackWfm Wfm, string area)
 {
     try
     {
         string    pids = Wfm.GetPIDSString();
         DataTable dt   = GetPushDataInfos(wrkId, pids);
         if (dt == null || dt.Rows.Count == 0)
         {
             return(false);
         }
         SlbhAndPid patchdata = DispatchData(dt, Wfm);
         if (patchdata == null)
         {
             return(false);
         }
         //解析如果不存在,则抛异常 所以用single
         IList <PID> pidList = Wfm.PIDS.Where(p => p.PId == patchdata.Pid).ToList();
         if (!pidList.Any())
         {
             return(false);
         }
         foreach (PID pid in pidList)
         {
             bool flag = PushDataTo(patchdata, Wfm, pid, area, "WB");
             if (!flag)
             {
                 break;
             }
             flag = PushDataTo(patchdata, Wfm, pid, area, "CG");
             if (!flag)
             {
                 break;
             }
         }
         return(true);
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message);
         // return false;
     }
 }
コード例 #4
0
 public ReceiptFlow()
 {
     try
     {
         System.Web.Caching.Cache cache = HttpRuntime.Cache;
         object o = cache["FCWriteBackWfm"];
         if (o == null)
         {
             string path            = ConfigurationManager.AppSettings["FCWriteBackWfm_Address"].ToString();
             WriteBackXMLOperate op = new WriteBackXMLOperate();
             wfm = op.Xml2Model(path);
             cache.Insert("FCWriteBackWfm", wfm);
         }
         else
         {
             wfm = (WriteBackWfm)o;
         }
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message);
     }
 }
コード例 #5
0
ファイル: Polling.cs プロジェクト: justseven/FCInterfaceData
        public List <dynamic> GetPushList(SlbhAndPid patchdata, WriteBackWfm Wfm, string area)
        {
            if (patchdata == null)
            {
                return(null);
            }
            IList <PID> pidList = Wfm.PIDS.Where(p => p.PId == patchdata.Pid).ToList();

            if (!pidList.Any())
            {
                return(null);
            }
            var modelList = new List <dynamic>();

            foreach (PID pid in pidList)
            {
                ViewName viewName = Wfm.ViewNames.Single(v => v.id == pid.viewId);
                DataSet  retdata  = GetPushData(patchdata, viewName, pid);
                if (retdata.Tables[0] == null || retdata.Tables[0].Rows.Count == 0)
                {
                    return(null);
                }
                WebserviceAdd add = Wfm.WebserviceAdds.Single(w => w.id == pid.WSAID);
                for (int i = 0; i < retdata.Tables[0].Rows.Count; i++)
                {
                    dynamic model = new ExpandoObject();
                    var     dict  = (IDictionary <string, object>)model;
                    foreach (DataColumn column in retdata.Tables[0].Columns)
                    {
                        dict[column.ColumnName] = retdata.Tables[0].Rows[i][column];
                    }
                    model.WebServiceAdd = add.name;
                    modelList.Add(model);
                }
            }
            return(modelList);
        }
コード例 #6
0
ファイル: Polling.cs プロジェクト: justseven/FCInterfaceData
        private SlbhAndPid DispatchData2(DataTable dt, WriteBackWfm Wfm)
        {
            //string[] bzs = null;
            //if (!string.IsNullOrEmpty(LXBZ)) {
            //    bzs = LXBZ.Split('|');
            //}
            SlbhAndPid slbhandpid = null;

            if (dt.Rows.Count > 0)
            {
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    PID PID = Wfm.PIDS.FirstOrDefault(p => p.PId == dt.Rows[i]["pid"].ToString() && (p.stepname == dt.Rows[i]["stepName"].ToString()));//|| (bzs!=null&&bzs.Contains(p.stepname))));
                    //ILog log = new ErrorLog(GetType());
                    // log.WriteLog(new Exception("DT.PzzID:" + dt.Rows[i]["pid"].ToString() + "DT.PzzID:" + dt.Rows[i]["stepName"].ToString()), LogType.Information);
                    if (PID != null)
                    {
                        string slbh     = dt.Rows[i]["slbh"].ToString();//受理号
                        string pid      = dt.Rows[i]["pid"].ToString();
                        string stepName = dt.Rows[i]["stepName"].ToString();
                        slbhandpid = new SlbhAndPid
                        {
                            Slbh     = slbh,
                            Pid      = pid,
                            StepName = stepName
                        };
                        break;
                    }
                }
            }
            else
            {
                return(null);
            }
            return(slbhandpid);
        }
コード例 #7
0
ファイル: Polling.cs プロジェクト: justseven/FCInterfaceData
 private SlbhAndPid DispatchData(DataTable dt, WriteBackWfm Wfm)
 {
     if (dt.Rows.Count > 0)
     {
         PID PID = Wfm.PIDS.FirstOrDefault(p => p.PId == dt.Rows[0]["pid"].ToString() && p.stepname == dt.Rows[0]["stepName"].ToString());
         if (PID != null)
         {
             string slbh     = dt.Rows[0]["slbh"].ToString();//受理号
             string pid      = dt.Rows[0]["pid"].ToString();
             string stepName = dt.Rows[0]["stepName"].ToString();
             return(new SlbhAndPid
             {
                 Slbh = slbh,
                 Pid = pid,
                 StepName = stepName
             });
         }
     }
     else
     {
         return(null);
     }
     return(null);
 }
コード例 #8
0
ファイル: Polling.cs プロジェクト: justseven/FCInterfaceData
        public BusinessResult PushASLBH(string Slbh, WriteBackWfm Wfm, string area)
        {
            try
            {
                string    pids = Wfm.GetPIDSString();
                DataTable dt   = GetPushDataInfos4SLBH(Slbh, pids);
                if (dt == null || dt.Rows.Count == 0)
                {
                    //ILog log1 = new ErrorLog(typeof(Polling));
                    //log1.WriteLog(new Exception("1111111111111"));
                    return(new BusinessResult {
                        IsSuccess = true, Message = "对应的流程不需要推送"
                    });
                }
                //ILog log7= new ErrorLog(typeof(Polling));
                //log7.WriteLog(new Exception(dt.Rows.Count.ToString()));
                SlbhAndPid patchdata = DispatchData2(dt, Wfm);
                if (patchdata == null)
                {
                    //ILog log2 = new ErrorLog(typeof(Polling));
                    // log2.WriteLog(new Exception("222222222222222"));
                    return(new BusinessResult {
                        IsSuccess = true, Message = "对应的流程不需要推送"
                    });
                }
                //解析如果不存在,则抛异常 所以用single
                IList <PID> pidList = Wfm.PIDS.Where(p => p.PId == patchdata.Pid).ToList();
                if (!pidList.Any())
                {
                    //ILog log3 = new ErrorLog(typeof(Polling));
                    //log3.WriteLog(new Exception("3333333333333"));
                    return(new BusinessResult {
                        IsSuccess = true, Message = "对应的流程不需要推送"
                    });
                }
                string pushRet = string.Empty;
                string message = string.Empty;

                foreach (PID pid in pidList)
                {
                    string   wbMessage = "";
                    string   cgMessage = "";
                    ViewName viewName  = Wfm.ViewNames.Single(v => v.id == pid.viewId);

                    DataSet retdata = GetPushData(patchdata, viewName, pid);

                    InterfaceAddress add = GetRoute(Slbh, area);
                    if (add.WB)
                    {
                        wbMessage = PushDataRouter(retdata, patchdata, pid, Wfm, viewName, "WB", area);
                    }
                    if (add.CG)
                    {
                        cgMessage = PushDataRouter(retdata, patchdata, pid, Wfm, viewName, "CG", area);
                    }
                    if (wbMessage.Contains("成功") && cgMessage.Contains("成功"))
                    {
                        message = "";
                    }
                    else
                    {
                        if (!wbMessage.Contains("成功"))
                        {
                            message += wbMessage;
                        }
                        if (!cgMessage.Contains("成功"))
                        {
                            message += cgMessage;
                        }
                    }
                }
                if (string.IsNullOrEmpty(message))
                {
                    return new BusinessResult {
                               IsSuccess = true, Message = pushRet
                    }
                }
                ;
                else
                {
                    return(new BusinessResult {
                        IsSuccess = false, Message = message
                    });
                }
            }
            catch (Exception ex)
            {
                return(new BusinessResult {
                    IsSuccess = false, Message = ex.Message
                });

                // return false;
            }
        }
コード例 #9
0
ファイル: Polling.cs プロジェクト: justseven/FCInterfaceData
        private string PushDataRouter(DataSet retdata, SlbhAndPid patchdata, PID pid, WriteBackWfm Wfm, ViewName viewName, string addressType, string area)
        {
            string pushRet = "-1";
            string message = "";

            if (retdata.Tables[0] == null || retdata.Tables[0].Rows.Count == 0)//表示没有取到推送数据
            {
                ResetPushResult(patchdata.Slbh, pid.name, pushRet, "", "", pid.PId, patchdata.StepName, addressType);
                message = "没有数据";
            }
            else
            {
                WebserviceAdd add = Wfm.WebserviceAdds.Single(w => w.id == pid.WSAID);
                if (addressType.Equals("WB"))
                {
                    message += pushRet = PushDataWB(retdata, add.name, area) + "\n";
                    //errInfo = PushData(retdata, add.name, area, errInfo);
                    //if (!IsError(errInfo))
                    if (pushRet.Trim().Equals("推送成功"))
                    {
                        ResetPushResult(patchdata.Slbh, pid.name, "1", SerialisePushData(retdata.Tables[0], viewName.name, add.name), GetInLength(pushRet), pid.PId, patchdata.StepName, addressType);
                    }
                    else
                    {
                        ResetPushResult(patchdata.Slbh, pid.name, "0", SerialisePushData(retdata.Tables[0], viewName.name, add.name), GetInLength(pushRet), pid.PId, patchdata.StepName, addressType);
                    }
                }
                if (addressType.Equals("CG"))
                {
                    message += pushRet = PushDataCG(retdata, add.name, area) + "\n";
                    //errInfo = PushData(retdata, add.name, area, errInfo);
                    //if (!IsError(errInfo))
                    if (pushRet.Trim().Equals("推送成功"))
                    {
                        ResetPushResult(patchdata.Slbh, pid.name, "1", SerialisePushData(retdata.Tables[0], viewName.name, add.name), GetInLength(pushRet), pid.PId, patchdata.StepName, addressType);
                    }
                    else
                    {
                        ResetPushResult(patchdata.Slbh, pid.name, "0", SerialisePushData(retdata.Tables[0], viewName.name, add.name), GetInLength(pushRet), pid.PId, patchdata.StepName, addressType);
                    }
                }
            }
            return(message);
        }