Beispiel #1
0
        public int UpdateCheckState(string strModelCode, string orderID, string strCheckStates, ref string strMsg)
        {
            int i = -1;

            try
            {
                using (FBCommonBLL bll = new FBCommonBLL())
                {
                    i = bll.UpdateCheckState(strModelCode, orderID, strCheckStates, ref strMsg);
                }
            }
            catch (Exception ex)
            {
                strMsg = "单据审核异常,请联系管理员";
                throw ex;
            }

            // 把消息通过异常机制返回
            if (!string.IsNullOrWhiteSpace(strMsg))
            {
                SystemBLL.Debug("审核" + strModelCode + "的单据[" + orderID + "]失败,提示消息为:" + strMsg);
                throw new Exception(strMsg);
            }

            return(i);
        }
Beispiel #2
0
        public T_FB_EXTENSIONALORDER UpdateExtensionOrder(string strModelCode, string orderID, string strCheckStates, ref string strMsg)
        {
            using (FBCommonBLL fbCommonBLL = new FBCommonBLL())
            {
                try
                {
                    SystemBLL.Debug("UpdateExtensionOrder方法已被调用,参数:strModelCode: " + strModelCode + ", orderID: " + orderID + ", strCheckStates: " + strCheckStates);

                    QueryExpression queryExpression = QueryExpression.Equal("ORDERID", orderID);

                    if (strModelCode == "Travel")
                    {
                        QueryExpression tempQE = QueryExpression.Equal("TravelSubject", "1");

                        tempQE.RelatedExpression          = QueryExpression.Equal("EXTENSIONALTYPECODE", "CCPX");
                        queryExpression.RelatedExpression = tempQE;
                    }
                    //查出保存的外部单据
                    queryExpression.QueryType    = typeof(T_FB_EXTENSIONALORDER).Name;
                    queryExpression.IsNoTracking = true;
                    List <FBEntity> listDetail = fbCommonBLL.QueryFBEntities(queryExpression);
                    //如果存在外部单据
                    if (listDetail.Count > 0)
                    {
                        var saveFBEntity = listDetail[0];
                        saveFBEntity.Entity.SetValue("CHECKSTATES", Decimal.Parse(strCheckStates));
                        saveFBEntity.FBEntityState = FBEntityState.Modified;
                        //var temp = fbCommonBLL.FBCommSaveEntity(listDetail[0]);
                        SaveResult temp = new SaveResult();
                        try
                        {
                            temp.FBEntity   = fbCommonBLL.SaveT_FB_EXTENSIONALORDER(listDetail[0]);
                            temp.Successful = true;
                        }
                        catch (Exception ex)
                        {
                            temp.Exception  = ex.Message;
                            temp.Successful = false;
                        }

                        if (temp.Successful)
                        {
                            return(temp.FBEntity.Entity as T_FB_EXTENSIONALORDER);
                        }
                        else
                        {
                            strMsg = temp.Exception;
                        }
                    }
                    else
                    {
                        strMsg = "没有可操作的数据";
                    }
                }
                catch (Exception ex)
                {
                    strMsg = ex.Message;
                    if (!(ex is FBBLLException))
                    {
                        // strMsg = "单据审核异常,请联系管理员";
                        Tracer.Debug("审核" + strModelCode + "的单据[" + orderID + "]出现异常,错误消息为:" + ex.ToString());
                    }
                }
                return(null);
            }
        }
Beispiel #3
0
        public int UpdateCheckState(string strModelCode, string orderID, string strCheckStates, ref string strMsg)
        {
            int i = -1;

            try
            {
                SystemBLL.Debug("UpdateCheckState方法已被调用,参数:strModelCode: " + strModelCode + ", orderID: " + orderID + ", strCheckStates: " + strCheckStates);

                // begin 用于出差报销、事项审批的手机提交
                if (strModelCode == "Travel")
                {
                    var tempResult = UpdateExtensionOrder(strModelCode, orderID, strCheckStates, ref strMsg);
                    return((tempResult == null) ? -1 : 1);
                }
                // end
                FBCommonService   fbCommonService = new FBCommonService();
                List <EntityInfo> EntityInfoList  = fbCommonService.GetEntityInfoList();
                if (EntityInfoList == null)
                {
                    strMsg = "预算服务初始化异常,请重试。";
                    return(-1);
                }

                if (EntityInfoList.Count() == 0)
                {
                    strMsg = "预算服务初始化异常,请重试。";
                    return(-1);
                }

                string      strTypeName = "";
                string      strKeyName  = "";
                CheckStates cs          = CheckStates.UnSubmit;
                switch (strCheckStates)
                {
                case "1":
                    cs = CheckStates.Approving;
                    break;

                case "2":
                    cs = CheckStates.Approved;
                    break;

                case "3":
                    cs = CheckStates.UnApproved;
                    break;

                default:
                    break;
                }

                var entityInfo = EntityInfoList.Where(t => t.Type == strModelCode).FirstOrDefault();
                strTypeName = entityInfo.Type;
                strKeyName  = entityInfo.KeyName;
                /////add 2012.12.12
                /////传入报销月份为时间去和当前时间判断,如果不在同一年
                /////说明该报销单是跨年的,则不能进行审核操作,即当年的报销单只能在当年进行报销
                //if (dNewCheckStates == FBAEnums.CheckStates.Approved || dNewCheckStates == FBAEnums.CheckStates.Approving)
                //{
                //    if (IsOverYear(entity.BUDGETARYMONTH))
                //    {
                //        strMsg = "报销单跨年后只能终审不通过(财务规定)";
                //        Tracer.Debug(strMsg);
                //        return;
                //    }
                //}
                using (FBCommonBLL bllCommon = new FBCommonBLL())
                {
                    bllCommon.BeginTransaction();
                    SystemBLL.Debug("BeginTransaction " + strModelCode + " 的单据[" + orderID + "]");
                    try
                    {
                        QueryExpression qe = QueryExpression.Equal(strKeyName, orderID);
                        qe.QueryType = strTypeName;

                        var data  = qe.Query(bllCommon);
                        var order = data.FirstOrDefault();
                        if (order == null)
                        {
                            strMsg = "没有可操作的数据";
                            return(-1);
                        }

                        bllCommon.AuditFBEntityWithoutFlow(order, cs, ref strMsg);
                        i = 1;
                        if (string.IsNullOrEmpty(strMsg))
                        {
                            bllCommon.CommitTransaction();
                            SystemBLL.Debug("CommitTransaction " + strModelCode + " 的单据[" + orderID + "]");
                        }
                        else
                        {
                            bllCommon.RollbackTransaction();
                            SystemBLL.Debug("RollbackTransaction 审核" + strModelCode + "的单据[" + orderID + "]失败,提示消息为:" + strMsg);
                        }
                    }
                    catch (Exception ex)
                    {
                        bllCommon.RollbackTransaction();
                        SystemBLL.Debug("RollbackTransaction 审核" + strModelCode + "的单据[" + orderID + "]失败,提示消息为:" + strMsg);
                        throw ex;
                    }
                }
            }
            catch (Exception ex)
            {
                strMsg = "单据审核异常,请联系管理员";
                throw ex;
            }

            // 把消息通过异常机制返回
            if (!string.IsNullOrWhiteSpace(strMsg))
            {
                SystemBLL.Debug("审核" + strModelCode + "的单据[" + orderID + "]失败,提示消息为:" + strMsg);
                throw new Exception(strMsg);
            }

            return(i);
        }