小飞侠
2025-12-01 7eca0ab1b6d5142d623efd471985b2a20b559616
cylsg/cylsg.Application/CyOS/CyOSBaoXiaoZHuGuanController.cs
@@ -2,6 +2,7 @@
using cylsg.Model.utilityViewModel;
using ECTESTOA;
using Furion.LinqBuilder;
using Models;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -67,8 +68,9 @@
            SearchList = SearchList.And(x => x.MemberId == _OAServices.firmId);
            SearchList = SearchList.And(x => x.PlanType == 3);
            SearchList = SearchList.And(x => x.PlanDataType == 17);
            //SearchList = SearchList.And(x =>  x.ApprovalStatus == PlanStatusType.unApproval);
            //SearchList = SearchList.And(x =>  x.OaWorkPlanShenpis.Where(y => y.Buzhou == 1 && y.ApprovalStaffId == Permissions.MemberId).Count()<=0);
            SearchList = SearchList.And(x => x.OaWorkPlanShenpis.Count(y => y.Buzhou == 1&& y.ApprovalStaffId != Permissions.MemberId) < 2);//只需要两个人审批 另外两个人审批了,不在显示
            //SearchList = SearchList.And(x => x.ApprovalStatus == PlanStatusType.unApproval);
            //SearchList = SearchList.And(x => x.OaWorkPlanShenpis.Where(y => y.Buzhou == 1 && y.ApprovalStaffId == Permissions.MemberId).Count() <= 0);
            //SearchList = SearchList.And(x => x.DepartId == Permissions.DepartId); 部门筛选
            if (!string.IsNullOrEmpty(param.StaffName))
            {
@@ -115,7 +117,7 @@
            //强制增加员工过滤
   
            var data = await _SugarClient.Queryable<OaWorkPlan>().Includes(x=>x.Depart)
                    .Includes(x=>x.OaWorkPlanShenpis.Where(y=>y.ApprovalStaffId==Permissions.MemberId&&y.Buzhou==1).ToList())
                    .Includes(x=>x.OaWorkPlanShenpis.Where(y=>y.Buzhou==1).ToList())
                    .Where(SearchList).OrderByDescending(x => x.PlanStartTime).Mapper(
                    x =>
                    {
@@ -195,6 +197,13 @@
            {
                throw Oops.Oh("报销单未提交不可审批");
            }
            int shenpiCount = data.OaWorkPlanShenpis.Where(x => x.ApprovalStaffId != Permissions.MemberId && x.Buzhou == 1).Count();
            if(shenpiCount >= 2)
            {
                //两个人审批后。不可再审批
                throw Oops.Oh("已经已经结束");
            }
            OaWorkPlanShenpi shenpi = data.OaWorkPlanShenpis.Where(x => x.ApprovalStaffId == Permissions.MemberId&&x.Buzhou==1).FirstOrDefault();
             if (shenpi!=null)
            {
@@ -224,6 +233,15 @@
                        data.Operator = Permissions.Name;
                       await  _SugarClient.Updateable(data).ExecuteCommandAsync();
                        //设置设备weixiu状态为拒绝
                        var shenpis = await _SugarClient.Queryable<OA_ShebeiWeixiu>().Where(x => x.FukuanShebeiId == data.Keyid).FirstAsync();
                        if (shenpis != null)
                        {
                            shenpis.ApprovalStatus = (int )PlanStatusType.No;
                            await _SugarClient.Updateable(shenpis).ExecuteCommandAsync();
                        }
                    }
                    shenpi = new OaWorkPlanShenpi()