Exemple #1
0
        private InterfaceAddress GetRoute(string slbh, string arae)
        {
            InterfaceAddress errInfo = new InterfaceAddress();

            errInfo.CG = false;
            errInfo.WB = false;
            string sql = "select * from fc_spfhx_tag where slbh='{0}'";

            sql = string.Format(sql, slbh);
            DataTable dt = DBHelper.GetDataTable(sql, ConnectType.SXK);

            if (!arae.Equals("徐州"))
            {
                errInfo.WB = true;
                errInfo.CG = false;
                return(errInfo);
            }
            if (null != dt && dt.Rows.Count > 0)
            {
                foreach (DataRow row in dt.Rows)
                {
                    if (!row["SFTS"].ToString().Equals("1"))
                    {
                        if (string.IsNullOrEmpty(row["ADDRESSTYPE"].ToString()))
                        {
                            if (!row["WBERRINFO"].ToString().Equals("推送成功"))
                            {
                                errInfo.WB = true;
                            }
                            if (!row["CGERRINFO"].ToString().Equals("推送成功"))
                            {
                                errInfo.CG = true;
                            }
                        }
                        else if (row["ADDRESSTYPE"].ToString().Equals("WB"))
                        {
                            errInfo.WB = true;
                        }
                        else
                        {
                            errInfo.CG = true;
                        }
                    }
                }
            }
            else
            {
                errInfo.CG = true;
                errInfo.WB = true;
            }
            return(errInfo);
        }
Exemple #2
0
        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;
            }
        }