Esempio n. 1
0
        private DataSet GetPushData4House(SlbhAndPid patchdata, ViewName viewName, PID pid, string HouseId)
        {
            string sql = string.Empty;

            sql = viewName.sql + string.Format(" where slbh like '{0}%' and HouseId='{0}'", patchdata.Slbh, HouseId);

            return(DBHelper.GetDataSet(sql, ConnectType.SXK));
        }
Esempio n. 2
0
        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);
        }
Esempio n. 3
0
        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);
        }
Esempio n. 4
0
 /// <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;
     }
 }
Esempio n. 5
0
        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);
        }
Esempio n. 6
0
        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);
        }
Esempio n. 7
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;
            }
        }