zrg
2024-05-09 8fe3e47aeda2f957aa521766a2ec22a9dbbfdb8c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Windows.Forms;
 
namespace DBUtility
{
    public class ClsPub:Pub_Class.ClsPub
    { 
        //  
 
 
 
        #region 其他处理
 
 
 
        //多审审核状态
        public static int Xt_BillCheckFlowStatus(Int64 lngBillKey,string sBillNo, string mvarItemKey, Int64 HCheckFlowID, string HBillName)
        {
            //
            Pub_Class.ClsPub.HCheckStatus = -1;
            Xt_BillCheckFlowStatusNow(mvarItemKey, lngBillKey, sBillNo, HCheckFlowID, "", 1, HBillName);
            return Pub_Class.ClsPub.HCheckStatus;
            //
        }
 
        //多审审核
        public static int Xt_BillCheckFlowStatus(Int64 lngBillKey,string sBillNo, string mvarItemKey, Int64 HCheckFlowID, string HCheckNote, string HBillName)
        {
            DataSet Ds;
            SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
            string sWhere = "";
            sWhere = sWhere + "," + HCheckFlowID + "";
            sWhere = sWhere + ",'" + mvarItemKey + "'";
            sWhere = sWhere + "," + lngBillKey + "";
            //sWhere = sWhere + ",'" + sBillNo + "'";
            sWhere = sWhere + ",'" + HCheckNote + "'";
            sWhere = sWhere + ",'" + ClsPub.CurUserName + "'";
            if (sWhere.Trim().Length > 0)
            {
                sWhere = sWhere.Substring(1, sWhere.Length - 1);
            }
 
            Ds = oCn.RunProcReturn("exec h_p_Xt_BillCheckFlowStatus " + sWhere, "h_p_Xt_BillCheckFlowStatus");
            if (Ds == null || Ds.Tables[0].Rows.Count == 0)
            {
                MessageBox.Show("判断审核状态失败!");
                return -1;
            }
            else
            {
                if (ClsPub.isInt(Ds.Tables[0].Rows[0]["sStatus"]) == -1) //异常 没有权限
                {
                    MessageBox.Show(Ds.Tables[0].Rows[0]["sMsg"].ToString());
                    return -1;
                }
                else if (ClsPub.isInt(Ds.Tables[0].Rows[0]["sStatus"]) == -2) //没有审批流
                {
                    MessageBox.Show("全部审核完毕!没有审核流!");
                    oCn.RunProc("update " + HBillName + " set HBillStatus=2 Where HinterID=" + lngBillKey.ToString());
                    return -2;
                }
                else if (ClsPub.isInt(Ds.Tables[0].Rows[0]["sStatus"]) == -3) //多审核完毕,不需要再审核
                {
                    MessageBox.Show("全部审核完毕!不需要再审核!");
                    return -3;
                }
                else if (ClsPub.isInt(Ds.Tables[0].Rows[0]["sStatus"]) == 1) //终审核完毕
                {
                    oCn.RunProc("update " + HBillName + " set HBillStatus=2 Where HinterID=" + lngBillKey.ToString());
                    return 1;
                }
                else        //返回 0   正在审核中,审核成功。
                {
                    oCn.RunProc("update " + HBillName + " set HBillStatus=6 Where HinterID=" + lngBillKey.ToString());
                    return 0;
                }
            }
        }
        //多审反审状态
        public static int Xt_BillCheckFlowStatusback1(Int64 lngBillKey,string sBillNo, string mvarItemKey, Int64 HCheckFlowID, string HBillName)
        {
            ClsPub.HCheckStatus = -1;
            ClsPub.Xt_BillCheckFlowStatusNow(mvarItemKey, lngBillKey, sBillNo, HCheckFlowID, "", 2, HBillName);
            return HCheckStatus;
        }
        //多审反审核
        public static int Xt_BillCheckFlowStatusback(Int64 lngBillKey, string sBillNo, string mvarItemKey, Int64 HCheckFlowID, string HBillName)
        {
            DataSet Ds;
            SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
            string sWhere = "";
            sWhere = sWhere + "," + HCheckFlowID + "";
            sWhere = sWhere + "," + mvarItemKey + "";
            sWhere = sWhere + "," + lngBillKey + "";
            //sWhere = sWhere + ",'" + sBillNo + "'";
            sWhere = sWhere + "," + ClsPub.CurUserName;
            if (sWhere.Trim().Length > 0)
            {
                sWhere = sWhere.Substring(1, sWhere.Length - 1);
            }
            Ds = oCn.RunProcReturn("exec h_p_Xt_BillCheckFlowStatusback " + sWhere, "h_p_Xt_BillCheckFlowStatus");
            if (Ds == null || Ds.Tables[0].Rows.Count == 0)
            {
                MessageBox.Show("判断审核状态失败!");
                return -1;
            }
            else
            {
                if (ClsPub.isInt(Ds.Tables[0].Rows[0]["sStatus"]) == -1)//没反审权限
                {
                    MessageBox.Show(Ds.Tables[0].Rows[0]["sMsg"].ToString());
                    return -1;
                }
                else if (ClsPub.isInt(Ds.Tables[0].Rows[0]["sStatus"]) == -2)//没有审批流  
                {
                    MessageBox.Show("全部反审完毕!");
                    oCn.RunProc("update " + HBillName + " set HBillStatus=1 Where HinterID=" + lngBillKey.ToString());
                    return -2;
                }
                else if (ClsPub.isInt(Ds.Tables[0].Rows[0]["sStatus"]) == -3)// 还未开始审核,不需要反审核
                {
                    MessageBox.Show("还没有审核,不需要反审核!");
                    return -3;
                }
                else if (ClsPub.isInt(Ds.Tables[0].Rows[0]["sStatus"]) == 1)  //全部反审完毕
                {
                    oCn.RunProc("update " + HBillName + " set HBillStatus=1 Where HinterID=" + lngBillKey.ToString());
                    return 1;
                }
                else      //反审核中  0
                {
                    oCn.RunProc("update " + HBillName + " set HBillStatus=6 Where HinterID=" + lngBillKey.ToString());
                    return 0;
                }
            }
        }
        //查看审核状态
        public static void Xt_BillCheckFlowStatusNow(string HBillTypeID, Int64 HBillInterID,string sBillNo, Int64 HCheckFlowID, string sMsg, int sStatus, string HBillName)
        {
            Xt_BillCheckFlowStatusNow oCheck = new Xt_BillCheckFlowStatusNow();
            oCheck.HBillTypeID = HBillTypeID;
            oCheck.HBillInterID = HBillInterID;
            oCheck.HCheckFlowID = HCheckFlowID;
            oCheck.sBillNo = sBillNo;
            oCheck.lblMsg.Text = sMsg;
            oCheck.HBillName = HBillName;
            oCheck.sStatus = sStatus;
            if (sStatus == 1)
            {
                oCheck.button1.Text = "审核";
            }
            else if (sStatus == 2)
            {
                oCheck.button1.Text = "反审";
            }
            else if (sStatus == 0)
            {
                oCheck.button1.Text = "确定";
                oCheck.button1.Visible = false;
            }
            oCheck.ShowDialog();
            return;
        }
 
        
        #endregion
    }
}