Ejemplo n.º 1
0
        /// <summary>
        /// 核心方法1-批阅资产(调用时,必须起用事务)
        /// </summary>
        /// <param name="spid"></param>
        /// <param name="ht"></param>
        /// <returns></returns>
        private string PiYue(string spid, Hashtable ht)
        {
            string             zcspstatus = "";
            string             czid       = "";
            List <SearchField> list1      = new List <SearchField>();

            //修改批阅数据中的相关信息
            list1.Add(new SearchField("id", spid, SearchFieldType.数值型));
            DataSet ds1 = this.tabCommand.SearchData("*", list1);

            czid = ds1.Tables[0].Rows[0]["czid"].ToString();
            if (ds1.Tables[0].Rows.Count > 0)
            {
                foreach (DictionaryEntry item in ht)
                {
                    ds1.Tables[0].Rows[0][item.Key.ToString()] = item.Value;
                }
                this.tabCommand.Update(ds1);
            }

            //修改资产中相关的数据
            int NewStatus = 0;                      //表示资产调整后的状态;

            list1.Clear();
            string bid = ds1.Tables[0].Rows[0]["bID"].ToString();

            this.tabCommand.TabName = "U_ZCBAO";
            list1.Add(new SearchField("id", bid, SearchFieldType.数值型));
            DataSet ds2 = this.tabCommand.SearchData("id,bstatus", list1);

            if (ds2.Tables[0].Rows.Count > 0)
            {
                int curStatus = Int32.Parse(ds2.Tables[0].Rows[0]["bstatus"].ToString());//表示资产的当前状态;
                NewStatus = curStatus;

                SP curSP = (SP)curStatus;                             //资产当前状态的枚举值
                if (curStatus == 4)
                {
                    curStatus = 10;
                }
                int NextStatus  = curStatus + 1;     //表示资产的下一个状态
                int BeginStatus = (int)SP.开始审批;      //表示资产审批的开始状态


                //处理审核委员会和决策委员会主席的情况
                U_RolesBU role1   = new U_RolesBU();
                string    zxname1 = role1.GetRoleAllUsers("审核委员会主席");
                bool      zx1     = false;
                if (ht["zeren"].ToString() == zxname1)
                {
                    zx1 = true;
                }
                string zxname2 = role1.GetRoleAllUsers("决策委员会主席");
                bool   zx2     = false;
                if (ht["zeren"].ToString() == zxname2)
                {
                    zx2 = true;
                }
                role1.Close();


                //根据资产的当前状况进行不同的处理
                if (ht["ps"].ToString() == "不同意")
                {
                    if (curSP == SP.部门审批 ||
                        (curSP == SP.审核委员会审批 && zx1) ||
                        (curSP == SP.决策委员会审批 && zx2)
                        )
                    {
                        NewStatus = BeginStatus;    //回到原来的状态
                    }
                }
                else if (ht["ps"].ToString() == "同意")
                {
                    if (curSP == SP.部门审批 ||
                        curSP == SP.机要室编号 ||
                        (curSP == SP.审核委员会审批 && zx1) ||
                        (curSP == SP.决策委员会审批 && zx2)
                        )
                    {
                        NewStatus = curStatus + 1;    //前进到下一个状态
                    }
                }
                else
                {
                    if (curSP == SP.审核委员会审批 && zx1)
                    {
                        NewStatus = curStatus + 1;    //前进到"决策委员会审批"
                    }
                }
                string sp1 = NewStatus + "";
                ds2.Tables[0].Rows[0]["bstatus"] = sp1.PadLeft(2, '0');
                this.tabCommand.Update(ds2);
            }

            this.tabCommand.TabName = TabName;
            //修改资产审批的状态
            zcspstatus = NewStatus + "";
            zcspstatus = zcspstatus.PadLeft(2, '0');
            list1.Clear();
            if (bid != "" && zcspstatus != "")
            {
                this.tabCommand.TabName = "U_ZCB2";
                list1.Add(new SearchField("id", czid, SearchFieldType.数值型));
                Hashtable ht0 = new Hashtable();
                ht0["status"] = zcspstatus;
                this.tabCommand.EditQuickData(list1, ht0);
                this.tabCommand.TabName = TabName;
            }

            U_ZCBAOBU zc1 = new U_ZCBAOBU();

            zc1.UpdateZcstatus(bid, zcspstatus, "0");
            zc1.Close();

            return(czid);
        }