移动系统liao
2025-02-18 8b613a5275e6fe23b91f65cc6a7fba720ae4d7ef
cylsg/cylsg.Application/CyOS/CyOSStaffController.cs
@@ -5,6 +5,7 @@
using cylsg.utility.Extend;
using Cylsg.Filter;
using ECTESTOA;
using EzCoreNet.Redis;
using Furion.LinqBuilder;
using System;
using System.Collections.Generic;
@@ -25,12 +26,14 @@
    {
        private readonly IOAServices _OAServices;
        private readonly ISqlSugarClient _SugarClient;
        private readonly IEzCoreNetRedisService _ezCoreNetRedisService;
        private  ECTESTOAPermissions Permissions;
        public CyOSStaffController(IOAServices oaServices, ISqlSugarClient sugarClient)
        public CyOSStaffController(IOAServices oaServices, ISqlSugarClient sugarClient,IEzCoreNetRedisService netRedisService)
        {
            _OAServices = oaServices;
            _SugarClient = sugarClient.AsTenant().GetConnection("ECTESTOADB");
            _ezCoreNetRedisService = netRedisService;
        }
        /// <summary>
@@ -39,6 +42,7 @@
        [HttpPost]
        public async Task<WorekPlandto> getplanelist(SearchOaWorekPlan param)
        {
            if(! await CheckRols())
            {
                throw Oops.Oh("没有权限");
@@ -48,6 +52,7 @@
            SearchList = SearchList.And(x => x.MemberId == _OAServices.firmId);
            SearchList = SearchList.And(x => x.PlanType == 3);
            SearchList = SearchList.And(x => x.PlanDataType == 17);
            if (!string.IsNullOrEmpty(param.StaffName))
            {
                SearchList = SearchList.And(x => x.SentStaff.Name.Contains(param.StaffName));
@@ -159,6 +164,10 @@
                   
                }
            }
            if (pram.ApprovalStatus != PlanStatusType.Uncommitted)
                pram.EvaluationContent = _ezCoreNetRedisService.GetYYYMMddAnd4sn();
            else
                pram.EvaluationContent = "";
            pram.PlanType = 3;//固定为3
            pram.MemberId = _OAServices.firmId;
            pram.SentStaffId = Permissions.MemberId;
@@ -174,22 +183,20 @@
            pram.PlanRemark = "";
            pram.PlanPeople = Permissions.Name;
            pram.PlanComplany = "";
            pram.PlanStatus = PlanStatusType.unApproval;
            if(pram.PlanStatus!= PlanStatusType.Uncommitted)
            {
                pram.PlanStatus = PlanStatusType.unApproval;
            }
            pram.ApprovalStaffId = Guid.Empty;
            pram.ApprovalTime=DateTime.Now;
            pram.ApprovalContent = "";
            pram.EvaluationContent = "";
            pram.ApprovalContent = "";
            pram.EvaluationStaffId = Guid.Empty;
            pram.EvaluationTime = DateTime.Now;     
            pram.RewardMoney = 0;
            pram.RewardType = 1;
            pram.Keyid = null;
            await  _SugarClient.InsertNav(pram).Include(x=>x.WorkPlanAttachments).ExecuteCommandAsync();
            return true;
            
@@ -230,18 +237,21 @@
            var data= await _SugarClient.Queryable<OaWorkPlan>().Includes(x=>x.WorkPlanAttachments).Includes(x=>x.OaWorkPlanShenpis).Where(x=>x.Keyid==pram.Keyid&&x.SentStaffId==Permissions.MemberId).FirstAsync();
            if(data==null)
                throw Oops.Oh("没有权限");
            if(data.ApprovalStatus!= PlanStatusType.unApproval||data.OaWorkPlanShenpis.Count>0)
            if (data.ApprovalStatus != PlanStatusType.Uncommitted)
            {
                if(data.HoubufapiaoStatus == HoubufapiaoStatusType.HouBuFaPiao&&data.HoubufapiaoStatus== HoubufapiaoStatusType.HouBuFaPiao)
                if (data.ApprovalStatus != PlanStatusType.unApproval || data.OaWorkPlanShenpis.Count > 0)
                {
                    //后补发票,只能修改发票和附件
                    await _SugarClient.UpdateNav(data).Include(x => x.WorkPlanAttachments).ExecuteCommandAsync();
                    return true;
                }
                else
                    if (data.HoubufapiaoStatus == HoubufapiaoStatusType.HouBuFaPiao && data.HoubufapiaoStatus == HoubufapiaoStatusType.HouBuFaPiao)
                    {
                        //后补发票,只能修改发票和附件
                        await _SugarClient.UpdateNav(data).Include(x => x.WorkPlanAttachments).ExecuteCommandAsync();
                        return true;
                    }
                    else
                throw Oops.Oh("已经进入审批流程不可修改");
                        throw Oops.Oh("已经进入审批流程不可修改");
                }
            }
            if (data.RewardResult != pram.RewardResult)
@@ -265,7 +275,15 @@
                }
            }
            if(data.ApprovalStatus== PlanStatusType.Uncommitted&&pram.ApprovalStatus== PlanStatusType.unApproval)
            {
                //重新提交必须修改新的单号
                data.EvaluationContent = _ezCoreNetRedisService.GetYYYMMddAnd4sn();
                data.ApprovalStatus = pram.ApprovalStatus;
            }
             data.PlanMoney=pram.PlanMoney;
            //摘要
             data.PlanContent =pram.PlanContent;
@@ -295,12 +313,11 @@
            {
                throw Oops.Oh("没有权限");
            }
            return await _SugarClient.Queryable<OaWorkPlan>().Includes(x=>x.SentStaff).Includes(x=>x.Depart).Includes(x=>x.WorkPlanAttachments).Where(x => x.Keyid == id).FirstAsync();
            return await _SugarClient.Queryable<OaWorkPlan>().Includes(x=>x.SentStaff).Includes(x => x.OaWorkPlanShenpis,y=>y.ApprovalStaff).Includes(x=>x.Depart).Includes(x=>x.WorkPlanAttachments).Where(x => x.Keyid == id).FirstAsync();
        }
        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="pram"></param>
        /// <returns></returns>
        [HttpDelete]
        public async Task<bool> DelOderAsync(int id )