llj
16 小时以前 a91fdba94705dd25cecccc7a4a5dcc2b3f2c09a6
DAL/¼Æ»®¹ÜÀí/ClsGy_RoutingBill.cs
@@ -421,6 +421,88 @@
            }
        }
        //驳回
        public override bool RejectCheckFlowProgress(Int64 lngBillKey, string HBillNo, string sUser, ref string sReturn)
        {
            if (isUse(lngBillKey, ref sReturn))
            {
                return false;
            }
            try
            {
                //开启事务
                oCn.BeginTran();
                //判断是否存在审核过的项目
                //string sql0 = "select * from Xt_BillCheckFlowStatus where HBillInterID = " + lngBillKey + " and HBillTypeID = '" + this.BillType + "' and ISNULL(HChecker,'') <> ''";
                //DataSet ds0 = oCn.RunProcReturn(sql0, "Xt_BillCheckFlowStatus");
                //if (ds0 != null && ds0.Tables[0].Rows.Count == 0)
                //{
                //    sReturn = "单据不存在已经审核的项目!";
                //    return false;
                //}
                //获取需要驳回的审核项目
                string sql0 = "select c.* from Xt_CheckFlowMain as a " +
                              "inner join Xt_CheckFlowSub as b on a.HInterID = b.HInterID " +
                              "inner join Xt_BillCheckFlowStatus as c on a.HBillTypeID = c.HBillTypeID and b.HCheckItemID = c.HCheckItemID " +
                              "where c.HBillTypeID = '" + this.BillType + "' and c.HBillInterID = " + lngBillKey + " " +
                              "order by b.HFlowNo asc";
                DataSet ds0 = oCn.RunProcReturn(sql0, "Xt_BillCheckFlowStatus");
                if (ds0 == null || ds0.Tables[0].Rows.Count == 0)
                {
                    sReturn = "驳回失败!原因:未发起审批!!";
                    return false;
                }
                //获取当前审核项目
                string HCheckFlowID = ds0.Tables[0].Rows[0]["HCheckFlowID"].ToString();             //审批流内码
                sql0 = "select * from " + MvarItemKey + " where HInterID = " + lngBillKey;
                ds0 = oCn.RunProcReturn(sql0, MvarItemKey);
                string HCheckItemNowID = ds0.Tables[0].Rows[0]["HCheckItemNowID"].ToString();       //当前审批项目内码
                //查找是否有权限
                string sql01 = "select * from Xt_CheckUserRight where HUserID = '" + sUser + "' and HCheckFlowInterID = " + HCheckFlowID + " and HCheckItemID = " + HCheckItemNowID + "";
                DataSet ds01 = oCn.RunProcReturn(sql01, "Xt_CheckUserRight");
                //获取用户名称
                DataSet DsUser = new DataSet();
                DsUser = oCn.RunProcReturn("select * from gy_czygl where czybm='" + sUser.Trim() + "'", "gy_czygl");
                if(DsUser.Tables[0].Rows.Count == 0)
                {
                    sReturn = "无法找到该用户!";
                    return false;
                }
                string userName = DsUser.Tables[0].Rows[0]["czymc"].ToString();
                if (ds01.Tables[0].Rows.Count == 0 && !DBUtility.ClsPub.Security_Log_second("Gy_RoutingBill_Check", 1, false, userName))//单据原审核权限为多级审核驳回权限
                {
                    sReturn = "无权限!";
                    return false;
                }
                //更新 é©³å›žåˆ é™¤å®¡æ ¸æµçŠ¶æ€è¡¨
                string sql02 = "Delete Xt_BillCheckFlowStatus where HBillTypeID = '" + this.BillType + "' and HBillInterID=" + lngBillKey + " and HCheckFlowID=" + HCheckFlowID;
                oCn.RunProc(sql02);
                oCn.RunProc(" Update " + MvarItemKey + " set HChecker='',HCheckDate=null,HBillStatus=5,HCheckItemNowID = 0,HCheckItemNextID = 0 Where HInterID=" + lngBillKey.ToString());
                //写入日志
                string WorkList = "驳回单据,单据号:" + HBillNo;
                string SystemName = "LMES-" + MvarReportTitle + "模块";
                oCn.RunProc("Insert into  System_Log(GeginDate,userid,WorkstationName,WorkList,SystemName,NetUserName,State) values " +
                    "(getdate(),'" + sUser + "','" + "111" + "','" + WorkList + "','" + SystemName + "','" + "1111" + "','驳回')"
                    );
                sReturn = "反审核单据成功!";
                oCn.Commit();
                return true;
            }
            catch (Exception e)
            {
                oCn.RollBack();
                sReturn = e.Message;
                throw (e);
            }
        }
        //启用工艺路线
        public bool Sub_RoutingCheckAndUsed(Int64 HInterID)
        {