username@email.com
2025-04-29 7e7ab84905d5c52c9ad774ec18478026fef1de40
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
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
using CY.Model;
using CY.BLL;
using CY.Infrastructure.Common;
using CY.BLL.Sys;
using CY.BLL.EC;
using CY.Infrastructure.DESEncrypt;
using CY.Infrastructure.Query;
using System.Transactions;
using CY.BLL.OA;
 
namespace CY.WebForm.Pages.work
{
    //吴辉
    //工作考评
    public partial class BaoxiaoPiliangReply : BasePage
    {
        OA_WorkPlanBll oA_WorkReminderBll = null;
        OA_KaipiaoshenqingBLL _oA_KaipiaoshenqingBLL = null;
        EC_OrderBLL _eC_OrderBLL = null;
        OA_FukuanshenqingBLL _oA_FukuanshenqingBLL = null;
        EC_MemberBasicBLL _eC_MemberBasicBLL = null;
        OA_WorkPlan_attachmentBLL oA_WorkPlan_AttachmentBLL = null;
        OA_WorkPlan_shenpiBLL oA_WorkPlan_ShenpiBLL = null;
        OA_StaffBLL oA_StaffBLL = null;
        OA_DepartmentBll oA_DepartmentBll = null;
        public string planDataType = "";
        OA_SubjectSetBLL _OA_SubjectSetBLL = null;
        public BaoxiaoPiliangReply()
        {
            oA_WorkReminderBll = new OA_WorkPlanBll();
            _oA_KaipiaoshenqingBLL = new OA_KaipiaoshenqingBLL();
            _eC_OrderBLL = new EC_OrderBLL();
            _oA_FukuanshenqingBLL = new OA_FukuanshenqingBLL();
            _eC_MemberBasicBLL = new EC_MemberBasicBLL();
            oA_WorkPlan_AttachmentBLL = new OA_WorkPlan_attachmentBLL();
            oA_WorkPlan_ShenpiBLL = new OA_WorkPlan_shenpiBLL();
            oA_StaffBLL = new OA_StaffBLL();
            oA_DepartmentBll = new OA_DepartmentBll();
            _OA_SubjectSetBLL = new OA_SubjectSetBLL();
        }
 
        //页面加载
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                InitData();
            }
        }
 
        //数据加载
        public void InitData()
        {
            //科目名称
            var keyids = Request["keyids"].Trim(',').Split(',');
            var sss = "";
            foreach (var keyid in keyids)
            {
                OA_WorkPlan m_OA_WorkPlan = oA_WorkReminderBll.GetModelByKeyid(keyid.ToInt32());
                if (m_OA_WorkPlan != null)
                {
                    sss += m_OA_WorkPlan.EvaluationContent + ",";
                }
            }
 
            this.spanDepart.InnerText = sss;
 
 
        }
 
        //表单提交
        protected void btn_submit_form(object sender, EventArgs e)
        {
            var keyids = Request["keyids"].Trim(',').Split(',');
            using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required,
    new TransactionOptions
    {
        IsolationLevel = System.Transactions.IsolationLevel.ReadCommitted,
        Timeout = TransactionManager.MaximumTimeout
    }
    )
             )
            {
                try
                {
 
                   
                    string Messagezhuguan = null;
                    string Messagejingli = null;
                    var res = false;
                    var oA_Staff = oA_StaffBLL.GetModelByMemberId(CurrentUser.TrueMemberId);
                    if (!oA_Staff.BF_IsBaoxiaozhuguan && !oA_Staff.BF_Isbaoxiaojingli)
                    {
                        JavaScript.MessageBox("你没有审批权限", this);
                        return;
                    }
 
 
                    foreach (var keyid in keyids)
                    {
                        OA_WorkPlan m_OA_WorkPlan = oA_WorkReminderBll.GetModelByKeyid(keyid.ToInt32());
                        if (m_OA_WorkPlan.ApprovalStatus == 1 || m_OA_WorkPlan.ApprovalStatus == 2)
                        {
                            JavaScript.MessageBox(m_OA_WorkPlan.EvaluationContent + "该报销已经审批完成", this);
                            return;
                        }
 
 
                        var oA_WorkPlan_Shenpis = oA_WorkPlan_ShenpiBLL.GetModelByKaipiaoId(keyid.ToInt32().Value).ToList();
 
 
                        if (oA_Staff.BF_IsBaoxiaozhuguan)
                        {
                            var oA_WorkPlan_Shenpis1 = oA_WorkPlan_Shenpis.Where(x => x.Buzhou == 1).ToList();
                            if (oA_WorkPlan_Shenpis1.Count > 1)
                            {
                                Messagezhuguan = m_OA_WorkPlan.EvaluationContent + "该流程已经不在主管审批步骤!";
                            }
 
                            var shenpicount = oA_WorkPlan_Shenpis1.Count(x => x.ApprovalStaffId == CurrentUser.TrueMemberId);
                            if (shenpicount > 0)
                            {
                                Messagezhuguan = m_OA_WorkPlan.EvaluationContent + "你已经审批过该流程!";
                            }
                        }
                        if (oA_Staff.BF_IsBaoxiaozhuguan && !oA_Staff.BF_Isbaoxiaojingli)
                        {
                            if (!string.IsNullOrEmpty(Messagezhuguan))
                            {
 
                                JavaScript.MessageBox(Messagezhuguan, this);
                                return;
                            }
                        }
 
                        if (oA_Staff.BF_Isbaoxiaojingli)
                        {
                            if (oA_WorkPlan_Shenpis.Count > 2)
                            {
                                Messagejingli = "该流程已经审批完成!";
                            }
                            if (oA_WorkPlan_Shenpis.Count < 2)
                            {
                                Messagejingli = "没到经理审批步骤!";
                            }
                        }
                        if (!oA_Staff.BF_IsBaoxiaozhuguan && oA_Staff.BF_Isbaoxiaojingli)
                        {
                            if (!string.IsNullOrEmpty(Messagejingli))
                            {
 
                                JavaScript.MessageBox(Messagejingli, this);
                                return;
                            }
                        }
 
                        if (oA_Staff.BF_IsBaoxiaozhuguan && oA_Staff.BF_Isbaoxiaojingli)
                        {
                            if (!string.IsNullOrEmpty(Messagezhuguan) && !string.IsNullOrEmpty(Messagejingli))
                            {
 
                                JavaScript.MessageBox(Messagezhuguan + Messagejingli, this);
                                return;
                            }
                        }
 
                        DateTime nowTime = DateTime.Now;
                       
                        OA_WorkPlan_shenpi oA_WorkPlan_Shenpi = new OA_WorkPlan_shenpi();
                        oA_WorkPlan_Shenpi.OA_WorkPlanId = keyid.ToInt32();
                        oA_WorkPlan_Shenpi.ApprovalStaffId = CurrentUser.TrueMemberId;
                        oA_WorkPlan_Shenpi.ApprovalStatus = this.selApprovalStatus.Value.ToInt32();
                        oA_WorkPlan_Shenpi.ApprovalTime = nowTime;
                        oA_WorkPlan_Shenpi.ApprovalContent = this.txtApprovalContent.Value.Trim();
                        oA_WorkPlan_Shenpi.CreateTime = nowTime;
                        oA_WorkPlan_Shenpi.Operator = CurrentUser.TrueName;
                        if (oA_WorkPlan_Shenpis.Count == 2)
                        {
                            oA_WorkPlan_Shenpi.Buzhou = 2;
                        }
                        else
                        {
                            oA_WorkPlan_Shenpi.Buzhou = 1;
                        }
                        res = oA_WorkPlan_ShenpiBLL.InsertModel(oA_WorkPlan_Shenpi);
 
 
                        if (oA_WorkPlan_Shenpis.Count == 2 || this.selApprovalStatus.Value == "2")
                        {
 
                            m_OA_WorkPlan.ApprovalContent = this.txtApprovalContent.Value.Trim();
                            m_OA_WorkPlan.ApprovalStaffId = CurrentUser.TrueMemberId;
                            m_OA_WorkPlan.ApprovalStaffName = CurrentUser.TrueName;
                            m_OA_WorkPlan.ApprovalStatus = this.selApprovalStatus.Value.ToInt32();
                            m_OA_WorkPlan.ApprovalTime = nowTime;
                            m_OA_WorkPlan.PlanStatus = 2;
                            m_OA_WorkPlan.Operator = CurrentUser.ShortName;
                            m_OA_WorkPlan.LastUpdateTime = nowTime;
                            res = oA_WorkReminderBll.UpdateModel(m_OA_WorkPlan);
                        }
                        else
                        {
                            res = oA_WorkReminderBll.UpdateModel(m_OA_WorkPlan);
                        }
                    }
 
                   
                    
                   
 
                  
                    
 
                  
 
 
 
                   
 
 
 
 
 
                    if (keyids.Length > 0)
                    {
                        if (res)
                        {
                            scope.Complete();
                            JavaScript.MessageBox("审批成功", this, true, true);
                        }
                          
                        else
                            JavaScript.MessageBox("操作失败", this);
                    }
                    else
                        JavaScript.MessageBox("操作失败", this);
                }
                catch (Exception ex)
                {
                    PAGEHandleException(ex);
                    JavaScript.MessageBox("操作失败", this);
                }
                finally
                {
                    // 释放资源
                    scope.Dispose();
                }
            }
        }
    }
}