Exemplo n.º 1
0
        public string Audit(string progId, string billNo, int rowId, string userId, string password, bool isPass)
        {
            //模拟用户登录
            SystemService server    = new SystemService();
            LoginInfo     loginInfo = server.Login(userId, password, false);

            if (loginInfo.PersonId == null)
            {
                return("登录失败");
            }
            //根据progid构建bcf
            LibBcfData bcf = (LibBcfData)LibBcfSystem.Default.GetBcfInstance(progId);

            bcf.Handle = LibHandleCache.Default.GetHandle(string.Empty, LibHandeleType.None, userId, loginInfo.PersonId, loginInfo.PersonName, "");

            //根据rowid判断是行审核还是单据审核
            if (rowId > 0)
            {
                Dictionary <int, SortedList <int, List <LibApproveFlowInfo> > > dic =
                    new Dictionary <int, SortedList <int, List <LibApproveFlowInfo> > >();
                dic.Add(rowId, new SortedList <int, List <LibApproveFlowInfo> >( ));
                bcf.AuditRow(new object[] { billNo }, isPass, dic, new Dictionary <int, int>());
            }
            else
            {
                bcf.Audit(new object[] { billNo }, isPass, new Dictionary <string, LibChangeRecord>(), -1, null);
            }

            StringBuilder sb = new StringBuilder();

            //根据messagelist判断是否操作成功
            if (bcf.ManagerMessage.IsThrow)
            {
                foreach (LibMessage item in bcf.ManagerMessage.MessageList)
                {
                    sb.Append(item.Message);
                }
                return(sb.ToString());
            }
            else
            {
                return("审核成功");
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// 审核操作
        /// </summary>
        /// <param name="progId"></param>
        /// <param name="billNo"></param>
        /// <param name="rowId"></param>
        /// <param name="userId"></param>
        /// <param name="handle"></param>
        /// <param name="isPass"></param>
        /// <param name="message"></param>
        /// <returns></returns>
        public static Result Audit(string progId, string billNo, int rowId, string userId, string handle, bool isPass, string message)
        {
            Result res = new Result();

            res.ReturnValue = true;
            LibHandle Handle = LibHandleCache.Default.IsExistsHandle(LibHandeleType.PC, userId);

            VerificationHandle(userId, handle, Handle, res);
            if (res.ReturnValue)
            {
                try
                {
                    //根据progid构建bcf
                    LibBcfData bcf = (LibBcfData)LibBcfSystem.Default.GetBcfInstance(progId);
                    if (bcf == null)
                    {
                        res.ReturnValue = false;
                        res.Message     = "请输入正确progId!";
                        return(res);
                    }
                    bcf.Handle = Handle;

                    //根据rowid判断是行审核还是单据审核
                    if (rowId > 0)
                    {
                        Dictionary <int, SortedList <int, List <LibApproveFlowInfo> > > dic =
                            new Dictionary <int, SortedList <int, List <LibApproveFlowInfo> > >();
                        dic.Add(rowId, new SortedList <int, List <LibApproveFlowInfo> >());
                        bcf.AuditRow(new object[] { billNo }, isPass, dic, new Dictionary <int, int>());
                    }
                    else
                    {
                        //string.Empty 为审核意见,后期加上
                        bcf.Audit(new object[] { billNo }, isPass, string.Empty, new Dictionary <string, LibChangeRecord>(), -1, null);
                    }

                    StringBuilder sb = new StringBuilder();

                    //根据messagelist判断是否操作成功
                    if (bcf.ManagerMessage.IsThrow)
                    {
                        foreach (LibMessage item in bcf.ManagerMessage.MessageList)
                        {
                            sb.Append(item.Message);
                        }
                        res.Message     = sb.ToString();
                        res.ReturnValue = false;
                    }
                    else
                    {
                        res.ReturnValue = true;
                        res.Message     = "审核成功!";
                        PushMessage(userId, PushType.Approval);
                    }
                }
                catch (Exception ex)
                {
                    res.ReturnValue = false;
                    res.Message     = "审核失败!" + ex.Message;
                }
            }
            return(res);
        }