Example #1
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;
     }
 }
Example #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;
            }
        }