移动系统liao
2025-01-24 f4a0b32daa9e021227707bcfb70b67738bd1b000
修改报销部分逻辑
9个文件已修改
149 ■■■■ 已修改文件
cylsg/cylsg.Application/CyOS/CyOSBaoXiaoCaiWuController.cs 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cylsg/cylsg.Application/CyOS/CyOSBaoXiaoJingLiController.cs 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cylsg/cylsg.Application/CyOS/CyOSBaoXiaoZHuGuanController.cs 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cylsg/cylsg.Application/CyOS/CyOSSettingController.cs 16 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cylsg/cylsg.Application/CyOS/CyOSStaffController.cs 51 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cylsg/cylsg.Model/ECTEModel/OaWorkPlan.cs 9 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cylsg/cylsg.Model/ECTEModel/OaWorkPlanShenpi.cs 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cylsg/cylsg.redis/EzCoreNetRedisService.cs 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cylsg/cylsg.redis/IEzCoreNetRedisService.cs 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cylsg/cylsg.Application/CyOS/CyOSBaoXiaoCaiWuController.cs
@@ -42,7 +42,7 @@
            }
            Expression<Func<OaWorkPlan, bool>> SearchList = (x) => true;
            SearchList = SearchList.And(x => x.ApprovalStatus != PlanStatusType.Uncommitted);
            //川印工作单
            SearchList = SearchList.And(x => x.MemberId == _OAServices.firmId);
            SearchList = SearchList.And(x => x.PlanType == 3);
@@ -158,7 +158,7 @@
                    try
                    {
                        data.EvaluationStatus = BaoxiaoStausType.Reimbursed;
                        data.PlanContent = plan.PlanContent;
                        //data.PlanContent = plan.PlanContent;
                        data.LastUpdateTime = DateTime.Now;
                        await _SugarClient.Updateable(data).ExecuteCommandAsync();
cylsg/cylsg.Application/CyOS/CyOSBaoXiaoJingLiController.cs
@@ -1,5 +1,6 @@
using cylsg.Model.ECTEModel;
using cylsg.Model.utilityViewModel;
using cylsg.utility.Extend;
using ECTESTOA;
using Furion.LinqBuilder;
using Models;
@@ -42,6 +43,7 @@
            Expression<Func<OaWorkPlan, bool>> SearchList = (x) => true;
            //川印工作单
            SearchList = SearchList.And(x => x.ApprovalStatus != PlanStatusType.Uncommitted);
            SearchList = SearchList.And(x => x.MemberId == _OAServices.firmId);
            SearchList = SearchList.And(x => x.PlanType == 3);
            SearchList = SearchList.And(x => x.PlanDataType == 17);
@@ -135,6 +137,10 @@
                throw Oops.Oh("没有找到报销单");
            if ( data.ApprovalStatus != PlanStatusType.unApproval)
                throw Oops.Oh("报销单已经批复完毕");
            if (data.ApprovalStatus == PlanStatusType.Uncommitted)
            {
                throw Oops.Oh("报销单未提交不可审批");
            }
            OaWorkPlanShenpi shenpi = data.OaWorkPlanShenpis.Where(x => x.ApprovalStaffId == Permissions.MemberId&&x.Buzhou==2).FirstOrDefault();
            await _SugarClient.AsTenant().BeginTranAsync();
            try
@@ -168,6 +174,17 @@
                    };
                    await _SugarClient.Insertable(shenpi).ExecuteCommandAsync();
                }
                if(!(param.RewardResult?.isPureNum()==true))
                {
                    throw Oops.Oh("科目选择错误");
                }
                //审批时可修改内容
                data.RewardResult = param.RewardResult;
                data.PlanContent = param.PlanContent;
                if(param.PlanMoney>0&&param.PlanMoney<=data.PlanMoney)
                data.PlanMoney = param.PlanMoney;
                data.ApprovalTime = DateTime.Now;
                data.ApprovalStatus = param.ApprovalStatus;
cylsg/cylsg.Application/CyOS/CyOSBaoXiaoZHuGuanController.cs
@@ -41,6 +41,7 @@
            Expression<Func<OaWorkPlan, bool>> SearchList = (x) => true;
            //川印工作单
            SearchList = SearchList.And(x => x.ApprovalStatus != PlanStatusType.Uncommitted);
            SearchList = SearchList.And(x => x.MemberId == _OAServices.firmId);
            SearchList = SearchList.And(x => x.PlanType == 3);
            SearchList = SearchList.And(x => x.PlanDataType == 17);
@@ -168,6 +169,10 @@
                throw Oops.Oh("没有找到报销单");
            if (data.ApprovalStatus != null && data.ApprovalStatus != PlanStatusType.unApproval)
                throw Oops.Oh("报销单已经批复完毕");
            if(data.ApprovalStatus== PlanStatusType.Uncommitted)
            {
                throw Oops.Oh("报销单未提交不可审批");
            }
            OaWorkPlanShenpi shenpi = data.OaWorkPlanShenpis.Where(x => x.ApprovalStaffId == Permissions.MemberId&&x.Buzhou==1).FirstOrDefault();
             if (shenpi!=null)
            {
@@ -178,7 +183,14 @@
            }
             else
            {
              await   _SugarClient.AsTenant().BeginTranAsync();
                data.RewardResult = param.RewardResult;
                data.PlanContent = param.PlanContent;
                if (param.PlanMoney > 0 && param.PlanMoney <= data.PlanMoney)
                    data.PlanMoney = param.PlanMoney;
                await   _SugarClient.AsTenant().BeginTranAsync();
                try
                {
                    if (param.ApprovalStatus == PlanStatusType.No)
cylsg/cylsg.Application/CyOS/CyOSSettingController.cs
@@ -1,5 +1,6 @@
using cylsg.Model.ECTEModel;
using ECTESTOA;
using EzCoreNet.Redis;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -16,10 +17,13 @@
        private readonly ISqlSugarClient _client;
        private readonly IOAServices _oAServices;
        public CYOSSettingController( ISqlSugarClient client,IOAServices oAServices )
        private readonly IEzCoreNetRedisService _eZCoreNetRedisService;
        public CYOSSettingController( ISqlSugarClient client,IOAServices oAServices,IEzCoreNetRedisService netRedisService )
        {
            _client = client.AsTenant().GetConnection("ECTESTOADB");
            _oAServices = oAServices;
            _eZCoreNetRedisService = netRedisService;
        }
        /// <summary>
@@ -50,6 +54,14 @@
                Remark = x.Remark,
            }).WithCache(3600).ToListAsync();
        }
        /// <summary>
        /// 获取流水号
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        public  string GetShowID()
        {
          return   _eZCoreNetRedisService.GetYYYMMddAnd4sn();
        }
    }
}
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>
@@ -48,6 +51,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 +163,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,11 +182,15 @@
            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;
@@ -230,18 +242,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 +280,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;
cylsg/cylsg.Model/ECTEModel/OaWorkPlan.cs
@@ -170,7 +170,7 @@
        public BaoxiaoStausType? EvaluationStatus { get; set; } = BaoxiaoStausType.NotReimbursed;
            /// <summary>
            /// 考评内容
            /// 考评内容// 变更为 报销单编号
            /// </summary>
            [SugarColumn(ColumnName = "EvaluationContent", Length = 200)]
            public string? EvaluationContent { get; set; }
@@ -256,7 +256,12 @@
        /// 否定
        /// </summary>
        [Description("否定")]
        No
        No,
        /// <summary>
        ///
        /// </summary>
        [Description("未提交")]
        Uncommitted
    }
    /// <summary>
    /// 后补发票状态
cylsg/cylsg.Model/ECTEModel/OaWorkPlanShenpi.cs
@@ -78,6 +78,21 @@
            /// </summary>
            [SugarColumn(ColumnName = "Buzhou")]
            public int? Buzhou { get; set; }
        }
        /// <summary>
        /// 审批时传递科目ID
        /// </summary>
        [SugarColumn( IsIgnore= true)]
        public string? RewardResult { get; set; }
        /// <summary>
        /// 审批时传递摘要
        /// </summary>
        [SugarColumn(IsIgnore = true)]
        public string? PlanContent { get; set; }
        /// <summary>
        /// 审批时传递金额
        /// </summary>
        [SugarColumn(IsIgnore = true)]
        public decimal? PlanMoney { get; set; }
    }
    
}
cylsg/cylsg.redis/EzCoreNetRedisService.cs
@@ -121,6 +121,22 @@
            return re;
        }
        public string GetYYYMMddAnd4sn()
        {
            string formattedDate = DateTime.Now.ToString("yyyyMMdd");
            var sn = Incrby($"CreatYYYMMddAnd4snKey:{formattedDate}");
            if (sn < 1)
            {
                //设置有效期限为24小时
                SetTtl($"CreatYYYMMddAnd4snKey:{formattedDate}", 24 * 60 * 60);
            }
            string re =   formattedDate + sn.ToString("D4");
            return re;
        }
        /// <summary>
        ///
        /// </summary>
cylsg/cylsg.redis/IEzCoreNetRedisService.cs
@@ -87,6 +87,11 @@
        /// </summary>
        string Get32sn();
        /// <summary>
        /// 获取yyymmdd +4位流水号
        /// </summary>
        /// <returns></returns>
         string GetYYYMMddAnd4sn();
        /// <summary>
        /// 设置锁
        /// </summary>
        /// <param name="LockKey"> 锁Key</param>