示例#1
0
        protected override void AfterGetData(System.Data.DataTable dt, bool isNew, string upperVersionID)
        {
            var cbsNodeID = dt.Rows[0]["CBSNode"] == DBNull.Value || dt.Rows[0]["CBSNode"] == null ? "" : dt.Rows[0]["CBSNode"].ToString();

            dt.Columns.Add("IsLeaf");
            dt.Columns.Add("HasReserved");
            dt.Rows[0]["IsLeaf"]      = false.ToString().ToLower();
            dt.Rows[0]["HasReserved"] = false.ToString().ToLower();
            var cbsDic = this.GetDataDicByID("S_EP_CBSNode", cbsNodeID);

            if (cbsDic == null)
            {
                throw new Formula.Exceptions.BusinessValidationException("没有找到对应的CBS产值节点,无法补贴");
            }
            var cbsNode        = new S_EP_CBSNode(cbsDic);
            var defineChildren = cbsNode.DefineNode.ChildrenNode.Where(c => c.ModelDic.GetValue("NodeType") != CBSNodeType.Communal.ToString() &&
                                                                       c.ModelDic.GetValue("NodeType") != CBSNodeType.Reserved.ToString()).ToList();

            if (defineChildren.Count == 0)
            {
                dt.Rows[0]["IsLeaf"] = true.ToString().ToLower();
            }
            if (cbsNode.DefineNode.ChildrenNode.Count(c => c.ModelDic.GetValue("NodeType") == CBSNodeType.Reserved.ToString()) > 0)
            {
                dt.Rows[0]["HasReserved"] = true.ToString().ToLower();
            }
            else
            {
                dt.Rows[0]["ProductionReserveValue"] = 0;
                dt.Rows[0]["ReserveScale"]           = 0;
            }
        }
示例#2
0
        public JsonResult ValidateCBSIsLeaf(string cbsNodeID)
        {
            var result = new Dictionary <string, object>();

            result.SetValue("IsLeaf", "false");
            var cbsDic = this.GetDataDicByID("S_EP_CBSNode", cbsNodeID);

            if (cbsDic == null)
            {
                throw new Formula.Exceptions.BusinessValidationException("没有找到对应的CBS产值节点,无法补贴");
            }
            var cbsNode        = new S_EP_CBSNode(cbsDic);
            var defineChildren = cbsNode.DefineNode.ChildrenNode.Where(c => c.ModelDic.GetValue("NodeType") != CBSNodeType.Communal.ToString() &&
                                                                       c.ModelDic.GetValue("NodeType") != CBSNodeType.Reserved.ToString()).ToList();

            if (defineChildren.Count > 0)
            {
                result.SetValue("IsLeaf", "true");
            }
            return(Json(result));
        }
        public JsonResult ValidateDistribute(string cbsNodeID)
        {
            var cbsDic = this.GetDataDicByID("S_EP_CBSNode", cbsNodeID);

            if (cbsDic == null)
            {
                throw new Formula.Exceptions.BusinessValidationException("没有找到指定的CBS节点,无法重新分解");
            }
            var cbsNode = new S_EP_CBSNode(cbsDic);

            if (cbsNode.DefineNode.ChildrenNode.Count == 0)
            {
                throw new Formula.Exceptions.BusinessValidationException(String.Format("【{0}】已经是末级节点,不能进行分解", cbsDic.GetValue("Name")));
            }

            var adjustRTCount = this.SQLDB.ExecuteScalar(string.Format("select count(*) from S_EP_ProductionDistribute where FlowPhase != 'End' and CBSNode = '{0}'", cbsNodeID));

            if (Convert.ToInt32(adjustRTCount) > 0)
            {
                throw new BusinessException("存在正在进行的计划产值调整审批,无法发起新的计划产值调整流程");
            }
            return(Json(""));
        }