コード例 #1
0
        /// <summary>
        /// 保存
        /// </summary>
        /// <param name="paramHead">单头UIModel</param>
        /// <returns></returns>
        public bool SaveDetailDS(AccountReceivableBillManagerUIModel paramHead)
        {
            var funcName = "SaveDetailDS";

            LogHelper.WriteBussLogStart(BussID, LoginInfoDAX.UserName, funcName, "", "", null);
            //服务端检查
            if (!ServerCheck(paramHead))
            {
                LogHelper.WriteBussLogEndNG(BussID, LoginInfoDAX.UserName, funcName, ResultMsg, "", null);
                return(false);
            }

            #region 准备数据

            #region 单头
            //将UIModel转为TBModel
            var argsHead = paramHead.ToTBModelForSaveAndDelete <MDLFM_AccountReceivableBill>();
            //判断主键是否被赋值
            if (string.IsNullOrEmpty(paramHead.ARB_ID))
            {
                argsHead.ARB_ID = Guid.NewGuid().ToString();
                //单号
                argsHead.ARB_No          = BLLCom.GetCoeusDocumentNo(DocumentTypeEnums.Code.ARB);
                argsHead.ARB_CreatedBy   = LoginInfoDAX.UserName;
                argsHead.ARB_CreatedTime = BLLCom.GetCurStdDatetime();
            }
            argsHead.ARB_UpdatedBy   = LoginInfoDAX.UserName;
            argsHead.ARB_UpdatedTime = BLLCom.GetCurStdDatetime();

            #endregion

            #endregion

            #region 带事务的保存

            try
            {
                DBManager.BeginTransaction(DBCONFIG.Coeus);

                #region 保存单头

                //执行保存
                if (!_bll.Save(argsHead, argsHead.ARB_ID))
                {
                    DBManager.RollBackTransaction(DBCONFIG.Coeus);
                    ResultMsg = MsgHelp.GetMsg(MsgCode.E_0010, new object[] { SystemActionEnum.Name.SAVE + SystemTableEnums.Name.FM_AccountReceivableBill });
                    LogHelper.WriteBussLogEndNG(BussID, LoginInfoDAX.UserName, funcName, ResultMsg, "", null);
                    return(false);
                }

                #endregion

                DBManager.CommitTransaction(DBCONFIG.Coeus);
            }
            catch (Exception ex)
            {
                DBManager.RollBackTransaction(DBCONFIG.Coeus);
                ResultMsg = MsgHelp.GetMsg(MsgCode.E_0018, new object[] { SystemActionEnum.Name.SAVE, ex.Message });
                LogHelper.WriteBussLogEndNG(BussID, LoginInfoDAX.UserName, funcName, ex.Message, "", null);
                return(false);
            }

            #endregion

            //将最新数据回写给DetailDS
            CopyModel(argsHead, paramHead);

            return(true);
        }
コード例 #2
0
        /// <summary>
        /// 反审核
        /// </summary>
        /// <param name="paramHead">UIModel</param>
        /// <returns></returns>
        public bool UnApproveDetailDS(AccountReceivableBillManagerUIModel paramHead)
        {
            var funcName = "UnApproveDetailDS";

            LogHelper.WriteBussLogStart(BussID, LoginInfoDAX.UserName, funcName, "", "", null);

            #region 验证

            if (paramHead == null ||
                string.IsNullOrEmpty(paramHead.ARB_ID) ||
                string.IsNullOrEmpty(paramHead.ARB_No))
            {
                //没有获取到应收单,反审核失败
                ResultMsg = MsgHelp.GetMsg(MsgCode.W_0024, new object[] { SystemTableEnums.Name.FM_AccountReceivableBill, SystemActionEnum.Name.UNAPPROVE });
                LogHelper.WriteBussLogEndNG(BussID, LoginInfoDAX.UserName, funcName, ResultMsg, "", null);
                return(false);
            }
            #endregion

            #region 准备数据

            #region 更新[应收单]

            //更新应收单[业务状态]为[已生成],[审核状态]为[待审核]
            paramHead.ARB_BusinessStatusName = AccountReceivableBillStatusEnum.Name.YSC;
            paramHead.ARB_BusinessStatusCode = AccountReceivableBillStatusEnum.Code.YSC;
            paramHead.ARB_ApprovalStatusName = ApprovalStatusEnum.Name.DSH;
            paramHead.ARB_ApprovalStatusCode = ApprovalStatusEnum.Code.DSH;
            paramHead.ARB_UpdatedBy          = LoginInfoDAX.UserName;
            paramHead.ARB_UpdatedTime        = BLLCom.GetCurStdDatetime();
            //将UIModel转为TBModel
            var updateHead = paramHead.ToTBModelForSaveAndDelete <MDLFM_AccountReceivableBill>();

            #endregion

            #endregion

            #region 带事务的新增和保存

            try
            {
                DBManager.BeginTransaction(DBCONFIG.Coeus);

                #region 保存[应收单]

                bool updateAccountReceivableBill = _bll.Save(updateHead);
                if (!updateAccountReceivableBill)
                {
                    DBManager.RollBackTransaction(DBCONFIG.Coeus);
                    ResultMsg = MsgHelp.GetMsg(MsgCode.E_0010, new object[] { MsgParam.UPDATE + SystemTableEnums.Name.FM_AccountReceivableBill });
                    LogHelper.WriteBussLogEndNG(BussID, LoginInfoDAX.UserName, funcName, ResultMsg, "", null);
                    return(false);
                }

                #endregion

                DBManager.CommitTransaction(DBCONFIG.Coeus);
            }
            catch (Exception ex)
            {
                DBManager.RollBackTransaction(DBCONFIG.Coeus);
                ResultMsg = MsgHelp.GetMsg(MsgCode.E_0018, new object[] { SystemActionEnum.Name.UNAPPROVE, ex.Message });
                LogHelper.WriteBussLogEndNG(BussID, LoginInfoDAX.UserName, funcName, ResultMsg, "", null);
                return(false);
            }
            #endregion

            //将最新数据回写给DetailDS
            CopyModel(updateHead, paramHead);

            return(true);
        }