zhupei 3 lat temu
rodzic
commit
bc742deef1

+ 123 - 11
codegit/CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/weixin/WxLoginController.cs

1407
         public string judgmentDept(int deptid)
1407
         public string judgmentDept(int deptid)
1408
         {
1408
         {
1409
             string deptcode = "";
1409
             string deptcode = "";
1410
-            string sql = " ";
1410
+            string sql = "";
1411
 
1411
 
1412
             if (CirculMarket(deptid, 11))
1412
             if (CirculMarket(deptid, 11))
1413
             {
1413
             {
1444
         }
1444
         }
1445
 
1445
 
1446
         /// <summary>
1446
         /// <summary>
1447
+        /// 找到事业部中的高层
1448
+        /// </summary>
1449
+        /// <param name="deptid"></param>
1450
+        /// <returns></returns>
1451
+        public int GetGCDept(int deptid)
1452
+        {
1453
+            string deptcode = "";
1454
+            int gcdeptid = 0;
1455
+
1456
+            if (CirculMarket(deptid, 11))
1457
+            {
1458
+                deptcode = "|0|1|11|";
1459
+            }
1460
+            else if (CirculMarket(deptid, 14))
1461
+            {
1462
+                deptcode = "|0|1|14|";
1463
+            }
1464
+            else if (CirculMarket(deptid, 15))
1465
+            {
1466
+                deptcode = "|0|1|15|";
1467
+            }
1468
+            else if (CirculMarket(deptid, 16))
1469
+            {
1470
+                deptcode = "|0|1|16|";
1471
+            }
1472
+            else if (CirculMarket(deptid, 18))
1473
+            {
1474
+                deptcode = "|0|1|18|";
1475
+
1476
+            }
1477
+            else if (CirculMarket(deptid, 20))
1478
+            {
1479
+                deptcode = "|0|1|20|";
1480
+            }
1481
+            if (!string.IsNullOrEmpty(deptcode))
1482
+            {
1483
+                var dept = departmentBLL.GetModelList($" F_DeptCode LIKE '" + deptcode + "%' and F_DeptName like '%总经理%'").FirstOrDefault();
1484
+                if (dept != null)
1485
+                    gcdeptid = dept.F_DeptId;
1486
+            }
1487
+            return gcdeptid;
1488
+        }
1489
+        /// <summary>
1447
         ///综合查询列表
1490
         ///综合查询列表
1448
         /// </summary>
1491
         /// </summary>
1449
         public ActionResult GetComprehensive(string description,string OpenId, string code, string createby, string createtel, string cusname, string keywords, string cusphone, string companyname, string province, string city,
1492
         public ActionResult GetComprehensive(string description,string OpenId, string code, string createby, string createtel, string cusname, string keywords, string cusphone, string companyname, string province, string city,
1566
                                 {
1609
                                 {
1567
                                     sql += $"  and T_Wo_WorkOrder.F_ID in ( " + strsq + ") ";
1610
                                     sql += $"  and T_Wo_WorkOrder.F_ID in ( " + strsq + ") ";
1568
                                 }
1611
                                 }
1612
+                                else
1613
+                                {
1614
+                                    sql += $" and 1!=1";
1615
+                                }
1569
                             }
1616
                             }
1570
                             #endregion
1617
                             #endregion
1571
                             else
1618
                             else
2115
                                     {
2162
                                     {
2116
                                         sql += $"  and T_Wo_WorkOrder.F_ID in ( " + strsq + ") ";
2163
                                         sql += $"  and T_Wo_WorkOrder.F_ID in ( " + strsq + ") ";
2117
                                     }
2164
                                     }
2165
+                                    else
2166
+                                    {
2167
+                                        sql += $" and 1!=1";
2168
+                                    }
2118
                                 }
2169
                                 }
2119
                                 #endregion
2170
                                 #endregion
2120
                                 else
2171
                                 else
6169
         /// <returns></returns>
6220
         /// <returns></returns>
6170
 
6221
 
6171
         [WechatActionFilter]
6222
         [WechatActionFilter]
6172
-        public ActionResult HigApprovalOrder(string OpenId, long orderid, string cont)
6223
+        public ActionResult HigApprovalOrder(string OpenId, long orderid, string cont, int isApproval = 0)
6173
         {
6224
         {
6174
             if (!string.IsNullOrEmpty(OpenId))
6225
             if (!string.IsNullOrEmpty(OpenId))
6175
             {
6226
             {
6176
                 var ua = userAccountBLL.GetModelList(" F_WxOpenId='" + OpenId + "'").FirstOrDefault();
6227
                 var ua = userAccountBLL.GetModelList(" F_WxOpenId='" + OpenId + "'").FirstOrDefault();
6177
                 if (ua != null)
6228
                 if (ua != null)
6178
                 {
6229
                 {
6230
+                    string isagreestr = "";
6231
+                    string touser = "";
6179
                     Model.T_Wo_WorkOrder model = woBLL.GetModel(orderid);
6232
                     Model.T_Wo_WorkOrder model = woBLL.GetModel(orderid);
6180
                     //验证信息
6233
                     //验证信息
6181
                     if (model != null)
6234
                     if (model != null)
6182
                     {
6235
                     {
6183
                         var itemlast = itembll.GetModelList("  F_ItemType=" + (int)EnumItemType.audit + " and  F_OptType=" + (int)EnumItemOpt.audit + "and F_NextUser= '" + ua.F_UserCode + "'" + "and F_IsUsed=2  and  F_WoID = " + orderid);
6236
                         var itemlast = itembll.GetModelList("  F_ItemType=" + (int)EnumItemType.audit + " and  F_OptType=" + (int)EnumItemOpt.audit + "and F_NextUser= '" + ua.F_UserCode + "'" + "and F_IsUsed=2  and  F_WoID = " + orderid);
6184
-                        int overtime = 0, sms = 0;
6237
+                        var itemlist1 = itembll.GetModelList("  F_WoState=" + (int)EnumWorkOrderState.audit + " and  F_OptType=" + (int)EnumItemOpt.deal + "" + " and  F_WoID = " + orderid).Where(p => p.F_Type == 1 || p.F_Type == 3).OrderByDescending(t => t.F_CreateTime).FirstOrDefault();
6238
+                        var itemlist2 = itembll.GetModelList("  F_WoState=" + (int)EnumWorkOrderState.audit + " and  F_OptType=" + (int)EnumItemOpt.deal + "" + " and  F_WoID = " + orderid).Where(p => p.F_Type == 2).OrderByDescending(t => t.F_CreateTime).FirstOrDefault();
6185
                         if (itemlast.Count > 0)
6239
                         if (itemlast.Count > 0)
6186
                         {
6240
                         {
6187
                             foreach (var it in itemlast)
6241
                             foreach (var it in itemlast)
6188
                             {
6242
                             {
6189
-                                if (!string .IsNullOrEmpty (it.F_LimitTime))
6190
-                                    overtime = int.Parse(it.F_LimitTime);
6191
-                                sms = int .Parse (it.F_IsSMS.ToString ());
6192
-
6193
                                 it.F_IsUsed = 1;
6243
                                 it.F_IsUsed = 1;
6194
                                 itembll.Update(it);
6244
                                 itembll.Update(it);
6195
                             }
6245
                             }
6196
                         }
6246
                         }
6197
                         model.F_Highopinions = cont;
6247
                         model.F_Highopinions = cont;
6248
+                        if (isApproval == 1)
6249
+                            isagreestr = " 通过 " + cont;
6250
+                        else
6251
+                            isagreestr = " 未通过 " + cont;
6198
                         string deptname = "";
6252
                         string deptname = "";
6199
                         var deptmodel = departmentBLL.GetModel(ua.F_DeptId);
6253
                         var deptmodel = departmentBLL.GetModel(ua.F_DeptId);
6200
                         if (deptmodel != null)
6254
                         if (deptmodel != null)
6201
                         {
6255
                         {
6202
                             deptname = deptmodel.F_DeptName + "-";
6256
                             deptname = deptmodel.F_DeptName + "-";
6203
                         }
6257
                         }
6204
-                        AddLog(model.F_ID, model.F_State.Value, deptname + ua.F_UserName + "(" + ua.F_WorkNumber + ")" + "高层已审批", (int)EnumItemType.audit, (int)EnumItemOpt.reaudit, "", 0, ua, overtime, sms, "", 1);
6258
+                        if (itemlist1 != null)
6259
+                        {
6260
+                            int type = Convert.ToInt32(itemlist1.F_Type);
6261
+                            if (isApproval == 1)
6262
+                            {
6263
+                                model.F_State = (int)EnumWorkOrderState.finish;
6264
+                                AddLog(model.F_ID, (int)EnumWorkOrderState.finish, deptname + ua.F_UserName + "(" + ua.F_WorkNumber + ")" + "高层已审批" + isagreestr, (int)EnumItemType.audit, (int)EnumItemOpt.reaudit, "", 0, ua, 0, 0, "", 1, type);
6265
+                            }
6266
+                            else
6267
+                            {
6268
+                                touser = itemlist1.F_CreateUser;
6269
+                                model.F_State = (int)EnumWorkOrderState.receive;
6270
+                                AddLog(model.F_ID, (int)EnumWorkOrderState.receive, deptname + ua.F_UserName + "(" + ua.F_WorkNumber + ")" + "高层已审批" + isagreestr, (int)EnumItemType.deal, (int)EnumItemOpt.reaudit, touser, 0, ua, 0, 0, "", 0, type);
6271
+                            }
6272
+                        }
6273
+                        if (itemlist2 != null)
6274
+                        {
6275
+                            int type = Convert.ToInt32(itemlist2.F_Type);
6276
+                            if (isApproval == 1)
6277
+                            {
6278
+                                model.F_State2 = (int)EnumWorkOrderState.finish;
6279
+                                AddLog(model.F_ID, (int)EnumWorkOrderState.finish, deptname + ua.F_UserName + "(" + ua.F_WorkNumber + ")" + "高层已审批" + isagreestr, (int)EnumItemType.audit, (int)EnumItemOpt.reaudit, "", 0, ua, 0, 0, "", 1, type);
6280
+                            }
6281
+                            else
6282
+                            {
6283
+                                touser = itemlist1.F_CreateUser;
6284
+                                model.F_State2 = (int)EnumWorkOrderState.receive;
6285
+                                AddLog(model.F_ID, (int)EnumWorkOrderState.receive, deptname + ua.F_UserName + "(" + ua.F_WorkNumber + ")" + "高层已审批" + isagreestr, (int)EnumItemType.deal, (int)EnumItemOpt.reaudit, touser, 0, ua, 0, 0, "", 0, type);
6286
+                            }
6287
+                        }
6288
+
6289
+                        //AddLog(model.F_ID, model.F_State.Value, deptname + ua.F_UserName + "(" + ua.F_WorkNumber + ")" + "高层已审批"+ isagreestr, (int)EnumItemType.audit, (int)EnumItemOpt.reaudit, touser, 0, ua, 0, 0, "", 1);
6205
                         bool n = woBLL.Update(model);
6290
                         bool n = woBLL.Update(model);
6206
                         if (n)
6291
                         if (n)
6207
                             return Success("审批成功");
6292
                             return Success("审批成功");
6301
         [WechatActionFilter]
6386
         [WechatActionFilter]
6302
         public ActionResult DealWorkOrder(string OpenId, long orderid, string F_Files, string cont, WorkOrdeDeptment deptment,
6387
         public ActionResult DealWorkOrder(string OpenId, long orderid, string F_Files, string cont, WorkOrdeDeptment deptment,
6303
          string uncont = "",
6388
          string uncont = "",
6304
-        int isvisit = 1, int isover = 0, int inoutflag = 0)
6389
+        int isvisit = 1, int isover = 0, int inoutflag = 0, int isApprovalp = 0)
6305
         {
6390
         {
6306
             string markdepts = "37,57,74,88,268,295,339,422,213,427,433";
6391
             string markdepts = "37,57,74,88,268,295,339,422,213,427,433";
6307
             string qualdepts = "12,36,295,245";
6392
             string qualdepts = "12,36,295,245";
6388
                                 return Error("工单已处理请勿重复操作!");
6473
                                 return Error("工单已处理请勿重复操作!");
6389
                             else
6474
                             else
6390
                             {
6475
                             {
6391
-                                var res = DealWO(ua, model, F_Files, input, cont, isover, uncont, Convert.ToInt32(zflag));
6476
+                                var res = DealWO(ua, model, F_Files, input, cont, isover, uncont, Convert.ToInt32(zflag),"", 0, isApprovalp);
6392
                                 if (res)
6477
                                 if (res)
6393
                                     return Success("处理成功");
6478
                                     return Success("处理成功");
6394
                                 else
6479
                                 else
7008
         /// <summary>
7093
         /// <summary>
7009
         /// 处理工单
7094
         /// 处理工单
7010
         /// </summary>
7095
         /// </summary>
7011
-        public bool DealWO(Model.T_Sys_UserAccount nowUser, Model.T_Wo_WorkOrder model, string F_Files, WorkOrderNewInput input, string cont, int isover = 0, string uncont = "",int flag=1, string eventreason = "", int flagstate = 0)
7096
+        public bool DealWO(Model.T_Sys_UserAccount nowUser, Model.T_Wo_WorkOrder model, string F_Files, WorkOrderNewInput input, string cont, int isover = 0, string uncont = "",int flag=1, string eventreason = "", int flagstate = 0, int isApprovalp = 0)
7012
         {
7097
         {
7013
             #region 工单处理
7098
             #region 工单处理
7014
             int sms = 0;
7099
             int sms = 0;
7047
                 nextuser = nowUser.F_UserCode;
7132
                 nextuser = nowUser.F_UserCode;
7048
                 nextdept = nowUser.F_DeptId;
7133
                 nextdept = nowUser.F_DeptId;
7049
             }
7134
             }
7135
+            #region 高层审批
7136
+            string htouser = "", htousername = ""; int hclbm = 0;
7137
+            if (isApprovalp != 0)
7138
+            {
7139
+                hclbm = GetGCDept(nowUser.F_DeptId);
7140
+                if (hclbm != 0)
7141
+                {
7142
+                    var cluslist = userAccountBLL.GetModelList($"F_DeptId = {hclbm}");
7143
+                    if (cluslist.Count > 0)
7144
+                    {
7145
+                        foreach (var l in cluslist)
7146
+                        {
7147
+                            if (string.IsNullOrEmpty(htouser))
7148
+                            {
7149
+                                htouser = string.IsNullOrEmpty(htouser) ? l.F_UserCode : htouser + "," + l.F_UserCode;
7150
+                                htousername = string.IsNullOrEmpty(htousername) ? l.F_UserName + "(" + l.F_WorkNumber + ")" : htousername + "," + l.F_UserName + "(" + l.F_WorkNumber + ")";
7151
+                            }
7152
+                        }
7153
+                    }
7154
+                    wostate = (int)EnumWorkOrderState.audit;
7155
+                }
7156
+
7157
+            }
7158
+
7159
+            #endregion
7050
             #region 读取当前登录人部门
7160
             #region 读取当前登录人部门
7051
             string deptname = "";
7161
             string deptname = "";
7052
             var deptmodel = departmentBLL.GetModel(nowUser.F_DeptId);
7162
             var deptmodel = departmentBLL.GetModel(nowUser.F_DeptId);
7060
                 optcont = ",处理内容:" + cont;
7170
                 optcont = ",处理内容:" + cont;
7061
             var content = deptname + nowUser.F_UserName + "(" + nowUser.F_WorkNumber + ")" + opt + "工单" + optcont;
7171
             var content = deptname + nowUser.F_UserName + "(" + nowUser.F_WorkNumber + ")" + opt + "工单" + optcont;
7062
             var itemid = AddLog(model.F_ID, wostate, content, (int)EnumItemType.deal, optbut, nextuser, nextdept, nowUser, model.F_limit, sms, "", 0, flag, flagstate);
7172
             var itemid = AddLog(model.F_ID, wostate, content, (int)EnumItemType.deal, optbut, nextuser, nextdept, nowUser, model.F_limit, sms, "", 0, flag, flagstate);
7173
+            if (hclbm>0)
7174
+                AddLog(model.F_ID, (int)EnumWorkOrderState.audit, htousername + "高层待审批", (int)EnumItemType.audit, (int)EnumItemOpt.audit, htouser, hclbm, nowUser, model.F_limit, sms, "", 2, flag);
7063
             if (itemid > 0)
7175
             if (itemid > 0)
7064
             {
7176
             {
7065
                 #region 处理工单
7177
                 #region 处理工单

+ 121 - 6
codegit/CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/workorder/WorkOrderNewController.cs

1243
                                         }
1243
                                         }
1244
                                         else
1244
                                         else
1245
                                         {
1245
                                         {
1246
-                                            sql += $"and 1!=1";
1246
+                                            sql += $" and 1!=1";
1247
                                         }
1247
                                         }
1248
                                     }
1248
                                     }
1249
                                     else
1249
                                     else
2407
             return sql;
2407
             return sql;
2408
         }
2408
         }
2409
         /// <summary>
2409
         /// <summary>
2410
+        /// 找到事业部中的高层
2411
+        /// </summary>
2412
+        /// <param name="deptid"></param>
2413
+        /// <returns></returns>
2414
+        public int GetGCDept(int deptid)
2415
+        {
2416
+            string deptcode = "";
2417
+            int gcdeptid = 0;
2418
+
2419
+            if (CirculMarket(deptid, 11))
2420
+            {
2421
+                deptcode = "|0|1|11|";
2422
+            }
2423
+            else if (CirculMarket(deptid, 14))
2424
+            {
2425
+                deptcode = "|0|1|14|";
2426
+            }
2427
+            else if (CirculMarket(deptid, 15))
2428
+            {
2429
+                deptcode = "|0|1|15|";
2430
+            }
2431
+            else if (CirculMarket(deptid, 16))
2432
+            {
2433
+                deptcode = "|0|1|16|";
2434
+            }
2435
+            else if (CirculMarket(deptid, 18))
2436
+            {
2437
+                deptcode = "|0|1|18|";
2438
+
2439
+            }
2440
+            else if (CirculMarket(deptid, 20))
2441
+            {
2442
+                deptcode = "|0|1|20|";
2443
+            }
2444
+            if (!string.IsNullOrEmpty(deptcode))
2445
+            {
2446
+                var dept = departmentBLL.GetModelList($" F_DeptCode LIKE '" + deptcode + "%' and F_DeptName like '%总经理%'").FirstOrDefault();
2447
+                if (dept != null)
2448
+                    gcdeptid = dept.F_DeptId;
2449
+            }
2450
+            return gcdeptid;
2451
+        }
2452
+        /// <summary>
2410
         /// 获取待接单的工单编号
2453
         /// 获取待接单的工单编号
2411
         /// </summary>
2454
         /// </summary>
2412
         /// <returns></returns>
2455
         /// <returns></returns>
3231
                             {
3274
                             {
3232
                                 sql += $"  and T_Wo_WorkOrder.F_ID in ( " + strsq + ") ";
3275
                                 sql += $"  and T_Wo_WorkOrder.F_ID in ( " + strsq + ") ";
3233
                             }
3276
                             }
3277
+                            else
3278
+                            {
3279
+                                sql += $" and 1!=1";
3280
+                            }
3234
                         }
3281
                         }
3235
                         #endregion
3282
                         #endregion
3236
                         else
3283
                         else
8886
         [Authority]
8933
         [Authority]
8887
         public ActionResult DealWorkOrder(long orderid, string cont, WorkOrdeDeptment deptment,
8934
         public ActionResult DealWorkOrder(long orderid, string cont, WorkOrdeDeptment deptment,
8888
      string F_Files, string uncont = "",
8935
      string F_Files, string uncont = "",
8889
-          int isvisit = 1, int isover = 0,int inoutflag=0)
8936
+          int isvisit = 1, int isover = 0,int inoutflag=0,int isApprovalp = 0)
8890
         {
8937
         {
8891
             int userId = CurrentUser.UserData.F_UserId;
8938
             int userId = CurrentUser.UserData.F_UserId;
8892
             if (userId != 0)
8939
             if (userId != 0)
9010
                             else
9057
                             else
9011
                             {
9058
                             {
9012
 
9059
 
9013
-                                var res = DealWO(ua, model, input, cont, F_Files, isover, uncont, Convert.ToInt32(zflag));
9060
+                                var res = DealWO(ua, model, input, cont, F_Files, isover, uncont, Convert.ToInt32(zflag),0,isApprovalp);
9014
 
9061
 
9015
                                 if (res)
9062
                                 if (res)
9016
                                     return Success("处理成功");
9063
                                     return Success("处理成功");
9036
         /// <param name="input"></param>
9083
         /// <param name="input"></param>
9037
         /// <returns></returns>
9084
         /// <returns></returns>
9038
         [Authority]
9085
         [Authority]
9039
-        public ActionResult HigApprovalOrder(long orderid, string cont)
9086
+        public ActionResult HigApprovalOrder(long orderid, string cont,int isApproval=0)
9040
         {
9087
         {
9041
             int userId = CurrentUser.UserData.F_UserId;
9088
             int userId = CurrentUser.UserData.F_UserId;
9042
             if (userId != 0)
9089
             if (userId != 0)
9044
                 Model.T_Sys_UserAccount ua = sysUserAccountBll.GetModel(userId);
9091
                 Model.T_Sys_UserAccount ua = sysUserAccountBll.GetModel(userId);
9045
                 if (ua != null)
9092
                 if (ua != null)
9046
                 {
9093
                 {
9094
+                    string isagreestr = "";
9095
+                    string touser = "";
9047
                     Model.T_Wo_WorkOrder model = workOrder.GetModel(orderid);
9096
                     Model.T_Wo_WorkOrder model = workOrder.GetModel(orderid);
9048
                     //验证信息
9097
                     //验证信息
9049
                     if (model != null)
9098
                     if (model != null)
9050
                     {
9099
                     {
9051
                         var itemlast = itembll.GetModelList("  F_ItemType=" + (int)EnumItemType.audit + " and  F_OptType=" + (int)EnumItemOpt.audit + "and F_NextUser= '" + ua.F_UserCode + "'" + "and F_IsUsed=2  and  F_WoID = " + orderid);
9100
                         var itemlast = itembll.GetModelList("  F_ItemType=" + (int)EnumItemType.audit + " and  F_OptType=" + (int)EnumItemOpt.audit + "and F_NextUser= '" + ua.F_UserCode + "'" + "and F_IsUsed=2  and  F_WoID = " + orderid);
9101
+                        var itemlist1 = itembll.GetModelList("  F_WoState=" + (int)EnumWorkOrderState.audit + " and  F_OptType=" + (int)EnumItemOpt.deal + "" + " and  F_WoID = " + orderid).Where(p=>p.F_Type==1 || p.F_Type == 3).OrderByDescending(t=>t.F_CreateTime).FirstOrDefault();
9102
+                        var itemlist2 = itembll.GetModelList("  F_WoState=" + (int)EnumWorkOrderState.audit + " and  F_OptType=" + (int)EnumItemOpt.deal + "" + " and  F_WoID = " + orderid).Where(p => p.F_Type == 2).OrderByDescending(t => t.F_CreateTime).FirstOrDefault();
9052
                         if (itemlast.Count > 0)
9103
                         if (itemlast.Count > 0)
9053
                         {
9104
                         {
9054
                             foreach (var it in itemlast)
9105
                             foreach (var it in itemlast)
9058
                             }
9109
                             }
9059
                         }
9110
                         }
9060
                         model.F_Highopinions = cont;
9111
                         model.F_Highopinions = cont;
9112
+                        if (isApproval == 1)
9113
+                            isagreestr = " 通过 "+ cont;
9114
+                        else
9115
+                            isagreestr = " 未通过 "+ cont;
9061
                         string deptname = "";
9116
                         string deptname = "";
9062
                         var deptmodel = departmentBLL.GetModel(ua.F_DeptId);
9117
                         var deptmodel = departmentBLL.GetModel(ua.F_DeptId);
9063
                         if (deptmodel != null)
9118
                         if (deptmodel != null)
9064
                         {
9119
                         {
9065
                             deptname = deptmodel.F_DeptName + "-";
9120
                             deptname = deptmodel.F_DeptName + "-";
9066
                         }
9121
                         }
9067
-                        AddLog(model.F_ID, model.F_State.Value, deptname + ua.F_UserName + "(" + ua.F_WorkNumber + ")" + "高层已审批", (int)EnumItemType.audit, (int)EnumItemOpt.reaudit, "", 0, ua, 0, 0, "", 1);
9122
+                        if (itemlist1 != null)
9123
+                        {
9124
+                            int type = Convert.ToInt32(itemlist1.F_Type);
9125
+                            if (isApproval == 1)
9126
+                            {
9127
+                                model.F_State = (int)EnumWorkOrderState.finish;
9128
+                                AddLog(model.F_ID, (int)EnumWorkOrderState.finish, deptname + ua.F_UserName + "(" + ua.F_WorkNumber + ")" + "高层已审批" + isagreestr, (int)EnumItemType.audit, (int)EnumItemOpt.reaudit, "", 0, ua, 0, 0, "", 1, type);
9129
+                            }
9130
+                            else
9131
+                            {
9132
+                                touser = itemlist1.F_CreateUser;
9133
+                                model.F_State = (int)EnumWorkOrderState.receive;
9134
+                                AddLog(model.F_ID, (int)EnumWorkOrderState.receive, deptname + ua.F_UserName + "(" + ua.F_WorkNumber + ")" + "高层已审批" + isagreestr, (int)EnumItemType.deal, (int)EnumItemOpt.reaudit, touser, 0, ua, 0, 0, "", 0, type);
9135
+                            }
9136
+                        }
9137
+                        if (itemlist2 != null)
9138
+                        {
9139
+                            int type = Convert.ToInt32(itemlist2.F_Type);
9140
+                            if (isApproval == 1)
9141
+                            {
9142
+                                model.F_State2 = (int)EnumWorkOrderState.finish;
9143
+                                AddLog(model.F_ID, (int)EnumWorkOrderState.finish, deptname + ua.F_UserName + "(" + ua.F_WorkNumber + ")" + "高层已审批" + isagreestr, (int)EnumItemType.audit, (int)EnumItemOpt.reaudit, "", 0, ua, 0, 0, "", 1, type);
9144
+                            }
9145
+                            else
9146
+                            {
9147
+                                touser = itemlist1.F_CreateUser;
9148
+                                model.F_State2 = (int)EnumWorkOrderState.receive;
9149
+                                AddLog(model.F_ID, (int)EnumWorkOrderState.receive, deptname + ua.F_UserName + "(" + ua.F_WorkNumber + ")" + "高层已审批" + isagreestr, (int)EnumItemType.deal, (int)EnumItemOpt.reaudit, touser, 0, ua, 0, 0, "", 0, type);
9150
+                            }
9151
+                        }
9152
+
9153
+                        //AddLog(model.F_ID, model.F_State.Value, deptname + ua.F_UserName + "(" + ua.F_WorkNumber + ")" + "高层已审批"+ isagreestr, (int)EnumItemType.audit, (int)EnumItemOpt.reaudit, touser, 0, ua, 0, 0, "", 1);
9068
                         bool n = workOrder.Update(model);
9154
                         bool n = workOrder.Update(model);
9069
                         if (n)
9155
                         if (n)
9070
                             return Success("审批成功");
9156
                             return Success("审批成功");
10024
         /// <summary>
10110
         /// <summary>
10025
         /// 处理工单
10111
         /// 处理工单
10026
         /// </summary>
10112
         /// </summary>
10027
-        public bool DealWO(Model.T_Sys_UserAccount nowUser, Model.T_Wo_WorkOrder model, WorkOrderNewInput input, string cont, string F_Files, int isover = 0, string uncont = "", int flag = 1,string eventreason="",int flagstate=0)
10113
+        public bool DealWO(Model.T_Sys_UserAccount nowUser, Model.T_Wo_WorkOrder model, WorkOrderNewInput input, string cont, string F_Files, int isover = 0, string uncont = "", int flag = 1,int flagstate=0, int isApprovalp = 0)
10028
         {
10114
         {
10029
             #region 工单处理
10115
             #region 工单处理
10030
             int sms = 0;
10116
             int sms = 0;
10062
                 nextuser = nowUser.F_UserCode;
10148
                 nextuser = nowUser.F_UserCode;
10063
                 nextdept = nowUser.F_DeptId;
10149
                 nextdept = nowUser.F_DeptId;
10064
             }
10150
             }
10151
+
10152
+            #region 高层审批
10153
+            string htouser = "", htousername = ""; int hclbm = 0;
10154
+            if (isApprovalp != 0)
10155
+            {
10156
+                 hclbm = GetGCDept(nowUser.F_DeptId);
10157
+                if (hclbm != 0)
10158
+                {
10159
+                    var cluslist = sysUserAccountBll.GetModelList($"F_DeptId = {hclbm}");
10160
+                    if (cluslist.Count>0)
10161
+                    {
10162
+                        foreach (var l in cluslist)
10163
+                        {
10164
+                            if (string.IsNullOrEmpty(htouser))
10165
+                            {
10166
+                                htouser = string.IsNullOrEmpty(htouser)? l.F_UserCode: htouser + "," + l.F_UserCode;
10167
+                                htousername = string.IsNullOrEmpty(htousername) ? l.F_UserName + "(" + l.F_WorkNumber + ")": htousername + "," + l.F_UserName + "(" + l.F_WorkNumber + ")";
10168
+                            }                          
10169
+                        }
10170
+                    }
10171
+                    wostate = (int)EnumWorkOrderState.audit;                  
10172
+                }
10173
+              
10174
+            }
10175
+
10176
+            #endregion
10177
+
10065
             #region 读取当前登录人部门
10178
             #region 读取当前登录人部门
10066
             string deptname = "";
10179
             string deptname = "";
10067
             var deptmodel = departmentBLL.GetModel(nowUser.F_DeptId);
10180
             var deptmodel = departmentBLL.GetModel(nowUser.F_DeptId);
10075
                 optcont = ",处理内容:" + cont;
10188
                 optcont = ",处理内容:" + cont;
10076
             var content = deptname + nowUser.F_UserName + "(" + nowUser.F_WorkNumber + ")" + opt + "工单" + optcont;
10189
             var content = deptname + nowUser.F_UserName + "(" + nowUser.F_WorkNumber + ")" + opt + "工单" + optcont;
10077
             var itemid = AddLog(model.F_ID, wostate, content, (int)EnumItemType.deal, optbut, nextuser, nextdept, nowUser, model.F_limit, sms, "", 0, flag, flagstate);
10190
             var itemid = AddLog(model.F_ID, wostate, content, (int)EnumItemType.deal, optbut, nextuser, nextdept, nowUser, model.F_limit, sms, "", 0, flag, flagstate);
10191
+            if (hclbm > 0)
10192
+                AddLog(model.F_ID, (int)EnumWorkOrderState.audit, htousername + "高层待审批", (int)EnumItemType.audit, (int)EnumItemOpt.audit, htouser, hclbm, nowUser, model.F_limit, sms, "", 2, flag);
10078
             if (itemid > 0)
10193
             if (itemid > 0)
10079
             {
10194
             {
10080
                 #region 处理工单
10195
                 #region 处理工单