Browse Source

财务模块 收款账单,已收款项
增删改查 完善

leiy 1 year ago
parent
commit
7200090446

+ 108 - 4
OASystem/OASystem.Api/Controllers/FinancialController.cs

@@ -27,11 +27,12 @@ namespace OASystem.API.Controllers
         private readonly DailyFeePaymentRepository _daiRep;    //日付申请仓库
         private readonly DailyFeePaymentRepository _daiRep;    //日付申请仓库
         private readonly TeamRateRepository _teamRateRep;      //团组汇率仓库
         private readonly TeamRateRepository _teamRateRep;      //团组汇率仓库
         private readonly ForeignReceivablesRepository _ForForeignReceivablesRep;  //对外收款账单仓库
         private readonly ForeignReceivablesRepository _ForForeignReceivablesRep;  //对外收款账单仓库
+        private readonly ProceedsReceivedRepository _proceedsReceivedRep;  //已收款项仓库
 
 
         /// <summary>
         /// <summary>
         /// 初始化
         /// 初始化
         /// </summary>
         /// </summary>
-        public FinancialController(IMapper mapper, IConfiguration configuration, DailyFeePaymentRepository daiRep, SqlSugarClient sqlSugar, SetDataTypeRepository setDataTypeRep, TeamRateRepository teamRateRep, ForeignReceivablesRepository ForForeignReceivablesRep) 
+        public FinancialController(IMapper mapper, IConfiguration configuration, DailyFeePaymentRepository daiRep, SqlSugarClient sqlSugar, SetDataTypeRepository setDataTypeRep, TeamRateRepository teamRateRep, ForeignReceivablesRepository ForForeignReceivablesRep, ProceedsReceivedRepository proceedsReceivedRep) 
         {
         {
             _mapper = mapper;
             _mapper = mapper;
             _config = configuration;
             _config = configuration;
@@ -40,6 +41,7 @@ namespace OASystem.API.Controllers
             _setDataTypeRep = setDataTypeRep;
             _setDataTypeRep = setDataTypeRep;
             _teamRateRep = teamRateRep;
             _teamRateRep = teamRateRep;
             _ForForeignReceivablesRep = ForForeignReceivablesRep;
             _ForForeignReceivablesRep = ForForeignReceivablesRep;
+            _proceedsReceivedRep = proceedsReceivedRep;
         }
         }
 
 
         #region 日付申请
         #region 日付申请
@@ -64,6 +66,27 @@ namespace OASystem.API.Controllers
             return Ok(JsonView(data));
             return Ok(JsonView(data));
         }
         }
 
 
+        
+        /// <summary>
+        /// 获取日付申请 基础数据源 - 转账表识 
+        /// </summary>
+        /// <param name="dto"> 日付申请 分页 dto</param>
+        /// <returns></returns>
+        [HttpPost]
+        [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
+        public async Task<IActionResult> GetSearchDailyPaymentPriceTypeAddData(PortDtoBase dto)
+        {
+            var result = await _daiRep.GetPriceTypeAddData(dto);
+
+            if (result == null || result.Code != 0)
+            {
+                return Ok(JsonView(false, result.Msg));
+            }
+            var data = result.Data;
+
+            return Ok(JsonView(data));
+        }
+
         /// <summary>
         /// <summary>
         /// 日付申请 Page Search
         /// 日付申请 Page Search
         /// </summary>
         /// </summary>
@@ -427,19 +450,20 @@ namespace OASystem.API.Controllers
             }
             }
         }
         }
 
 
+
         /// <summary>
         /// <summary>
         /// 对外收款账单 
         /// 对外收款账单 
-        /// 添加 Or 更新
+        /// 账单 删除
         /// </summary>
         /// </summary>
         /// <param name="dto"></param>
         /// <param name="dto"></param>
         /// <returns></returns>
         /// <returns></returns>
         [HttpPost]
         [HttpPost]
         [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
         [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
-        public async Task<IActionResult> PostGroupReceivablesUpdate(ForForeignReceivablesInfoDto dto)
+        public async Task<IActionResult> PostGroupReceivablesDel(DelForForeignReceivablesInfoDto dto)
         {
         {
             try
             try
             {
             {
-                Result ffrData = await _ForForeignReceivablesRep.GetGroupReceivablesInfoByDiId(dto);
+                Result ffrData = await _ForForeignReceivablesRep._Del(dto);
                 if (ffrData.Code != 0)
                 if (ffrData.Code != 0)
                 {
                 {
                     return Ok(JsonView(false, ffrData.Msg));
                     return Ok(JsonView(false, ffrData.Msg));
@@ -453,6 +477,86 @@ namespace OASystem.API.Controllers
             }
             }
         }
         }
 
 
+        /// <summary>
+        /// 对外收款账单 
+        /// 添加 And 更新
+        /// </summary>
+        /// <param name="dto"></param>
+        /// <returns></returns>
+        [HttpPost]
+        [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
+        public async Task<IActionResult> PostReceivablesOperate(ForeignReceivablesAddAndUpdateDto dto)
+        {
+            try
+            {
+                Result ffrData = await _ForForeignReceivablesRep.PostReceivablesOperate(dto);
+                if (ffrData.Code != 0)
+                {
+                    return Ok(JsonView(false, ffrData.Msg));
+                }
+                return Ok(JsonView(true, ffrData.Msg, ffrData.Data));
+            }
+            catch (Exception ex)
+            {
+                return Ok(JsonView(false, ex.Message));
+                throw;
+            }
+        }
+
+        /// <summary>
+        /// 已收款项 
+        /// 账单 删除
+        /// </summary>
+        /// <param name="dto"></param>
+        /// <returns></returns>
+        [HttpPost]
+        [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
+        public async Task<IActionResult> PostAmountReceivedDel(ProceedsReceivedDelDto dto)
+        {
+            try
+            {
+                Result ffrData = await _proceedsReceivedRep._Del(dto);
+                if (ffrData.Code != 0)
+                {
+                    return Ok(JsonView(false, ffrData.Msg));
+                }
+                return Ok(JsonView(true, ffrData.Msg, ffrData.Data));
+            }
+            catch (Exception ex)
+            {
+                return Ok(JsonView(false, ex.Message));
+                throw;
+            }
+        }
+
+        /// <summary>
+        /// 已收款项 
+        /// 添加 And 更新
+        /// </summary>
+        /// <param name="dto"></param>
+        /// <returns></returns>
+        [HttpPost]
+        [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
+        public async Task<IActionResult> PostAmountReceivedOperate(ProceedsReceivedDto dto)
+        {
+            try
+            {
+                Result ffrData = await _proceedsReceivedRep.PostAmountReceivedOperate(dto);
+                if (ffrData.Code != 0)
+                {
+                    return Ok(JsonView(false, ffrData.Msg));
+                }
+                return Ok(JsonView(true, ffrData.Msg, ffrData.Data));
+            }
+            catch (Exception ex)
+            {
+                return Ok(JsonView(false, ex.Message));
+                throw;
+            }
+        }
+
+        
+        
         #endregion
         #endregion
     }
     }
 }
 }

+ 75 - 10
OASystem/OASystem.Domain/Dtos/Financial/ForForeignReceivablesDto.cs

@@ -20,37 +20,102 @@ namespace OASystem.Domain.Dtos.Financial
 
 
     /// <summary>
     /// <summary>
     /// 财务模块
     /// 财务模块
-    /// 对外收款
+    /// 收款账单
+    /// Add or Update Info
     /// </summary>
     /// </summary>
-    public class ForForeignReceivablesUpdateDto : PortDtoBase
+    public class ForeignReceivablesAddAndUpdateDto : PortDtoBase
     {
     {
+        /// <summary>
+        /// 团组Id
+        /// </summary>
+        public int DiId { get; set; }
+
         /// <summary>
         /// <summary>
         /// 用户Id
         /// 用户Id
         /// </summary>
         /// </summary>
         public int UserId { get; set; }
         public int UserId { get; set; }
 
 
         /// <summary>
         /// <summary>
-        /// 团组Id
+        /// 财务模块
+        /// Add or Update Info
         /// </summary>
         /// </summary>
-        public int DiId { get; set; }
+        public List<ForeignReceivablesInfo>? foreignReceivablesInfos { get; set; }
+    }
+
+    /// <summary>
+    /// 财务模块
+    /// Add or Update Info
+    /// </summary>
+    public class ForeignReceivablesInfo 
+    {
+        /// <summary>
+        /// 主键编号
+        /// id=0 时添加
+        /// 其他值时 修改
+        /// </summary>
+        public int Id { get; set; }
+        /// <summary>
+        /// 费用名称
+        /// </summary>
+        public string? PriceName { get; set; }
+
+        /// <summary>
+        /// 费用
+        /// </summary>
+        public decimal Price { get; set; }
+
+        /// <summary>
+        /// 数量
+        /// </summary>
+        public int Count { get; set; }
+
+        /// <summary>
+        /// 单位
+        /// </summary>
+        public string? Unit { get; set; }
 
 
-        /// 付款方
+        /// <summary>
+        /// 单项总和
         /// </summary>
         /// </summary>
-        public string? To { get; set; }
+        public decimal ItemSumPrice { get; set; }
 
 
         /// <summary>
         /// <summary>
-        /// 付款方电话
+        /// 汇率
         /// </summary>
         /// </summary>
-        public string? ToTel { get; set; }
+        public decimal Rate { get; set; }
 
 
         /// <summary>
         /// <summary>
-        /// 付款日期
+        /// 币种
         /// </summary>
         /// </summary>
-        public string? PayDate { get; set; }
+        public int Currency { get; set; }
+
+        /// <summary>
+        /// 添加方式   
+        /// 0 - 账单页面添加   1 - 预算成本页面添加
+        /// </summary>
+        public int AddingWay { get; set; }
 
 
         /// <summary>
         /// <summary>
         /// 备注
         /// 备注
         /// </summary>
         /// </summary>
         public string? Remark { get; set; }
         public string? Remark { get; set; }
     }
     }
+
+    /// <summary>
+    /// 应收款项 删除Id dto
+    /// </summary>
+    public class DelForForeignReceivablesInfoDto
+    {
+        /// <summary>
+        /// 用户Id
+        /// </summary>
+        public int UserId { get; set; }
+
+        /// <summary>
+        /// 主键
+        /// </summary>
+        public int Id { get; set; }
+    }
+
+    
 }
 }

+ 107 - 0
OASystem/OASystem.Domain/Dtos/Financial/ProceedsReceivedDto.cs

@@ -0,0 +1,107 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace OASystem.Domain.Dtos.Financial
+{
+
+    /// <summary>
+    /// 已收款项 del Dto
+    /// </summary>
+    public class ProceedsReceivedDelDto : PortDtoBase
+    {
+        /// <summary>
+        /// 用户Id
+        /// </summary>
+        public int UserId { get; set; }
+
+        /// <summary>
+        /// id
+        /// </summary>
+        public int Id { get; set; }
+    }
+
+    /// <summary>
+    /// 已收款项 Dto
+    /// </summary>
+    public class ProceedsReceivedDto : PortDtoBase
+    {
+        /// <summary>
+        /// 用户Id
+        /// </summary>
+        public int UserId { get; set; }
+
+        /// <summary>
+        /// 团组Id
+        /// </summary>
+        public int DiId { get; set; }
+
+        /// <summary>
+        /// 已收款项infos
+        /// </summary>
+        public List<ProceedsReceivedInfo>? _ProceedsReceivedInfos { get; set; }
+
+    }
+
+    /// <summary>
+    /// 已收款项info
+    /// </summary>
+    public class ProceedsReceivedInfo
+    {
+        /// <summary>
+        /// 主键
+        /// id == 0 Add
+        /// 其他值时 Updata
+        /// </summary>
+        public int Id { get; set; }
+
+
+        /// <summary>
+        /// 到款时间
+        /// </summary>
+        public string? SectionTime { get; set; }
+
+        /// <summary>
+        /// 费用
+        /// </summary>
+        public decimal Price { get; set; }
+
+        /// <summary>
+        /// 币种
+        /// </summary>
+        public int Currency { get; set; }
+
+        /// <summary>
+        /// 收款类型
+        /// </summary>
+        public int ReceivablesType { get; set; }
+
+        /// <summary>
+        /// 收款单位
+        /// </summary>
+        public string? Client { get; set; }
+
+        /// <summary>
+        /// 收款单位 负责人 姓名
+        /// </summary>
+        public string? CustomerName { get; set; }
+
+        /// <summary>
+        /// 收款单位 负责人 姓名
+        /// </summary>
+        public string? CustomerTel { get; set; }
+
+        /// <summary>
+        /// 应付项id
+        /// </summary>
+        public int FID { get; set; }
+
+        /// <summary>
+        /// 备注
+        /// </summary>
+        public string? Remark { get; set; }
+
+    }
+}

+ 12 - 0
OASystem/OASystem.Domain/ViewModels/Financial/Fin_ForeignReceivablesView.cs

@@ -116,4 +116,16 @@ namespace OASystem.Domain.ViewModels.Financial
         /// </summary>
         /// </summary>
         public DateTime? CreateTime { get; set; }
         public DateTime? CreateTime { get; set; }
     }
     }
+
+    /// <summary>
+    /// 团组应收款项 含已收款项
+    /// </summary>
+    public class ForeignReceivablesView : ForeignReceivablesInfoView
+    {
+        /// <summary>
+        /// 对应收款账单Id
+        /// 已收款项 信息
+        /// </summary>
+        public List<ProceedsReceivedView>? _ProceedsReceivedDatas { get; set; }
+    }
 }
 }

+ 7 - 0
OASystem/OASystem.Domain/ViewModels/Financial/Fin_ProceedsReceivedView.cs

@@ -19,6 +19,8 @@ namespace OASystem.Domain.ViewModels.Financial
     /// </summary>
     /// </summary>
     public class ProceedsReceivedView
     public class ProceedsReceivedView
     {
     {
+        public int Id { get; set; }
+
         /// <summary>
         /// <summary>
         /// 团组Id
         /// 团组Id
         /// </summary>
         /// </summary>
@@ -63,5 +65,10 @@ namespace OASystem.Domain.ViewModels.Financial
         /// 应付项id
         /// 应付项id
         /// </summary>
         /// </summary>
         public int FID { get; set; }
         public int FID { get; set; }
+
+        /// <summary>
+        /// 备注
+        /// </summary>
+        public string? Remark { get; set; }
     }
     }
 }
 }

+ 49 - 15
OASystem/OASystem.Infrastructure/Repositories/Financial/DailyFeePaymentRepository.cs

@@ -73,32 +73,66 @@ namespace OASystem.Infrastructure.Repositories.Financial
             }
             }
             else if (dto.PortType == 2) //安卓
             else if (dto.PortType == 2) //安卓
             {
             {
-                //DailyFeePaymentPagePriceTypeView
 
 
-                List<DailyFeePaymentDataSourceView> priceTypeDatas = new List<DailyFeePaymentDataSourceView>();
-                foreach (Fin_DailyFeePaymentPagePriceTypeView item in priceTypeData) 
+                DailyFeePaymentList = new
                 {
                 {
-                    List<Fin_DailyFeePaymentPagePriceSubTypeView> data1 = setData.Where(s => s.STid == item.Id).ToList();
+                    UserNameData = userNameData.Data,
+                    FeeTypeData = priceTypeData,
+                    FeeTypeSubData = priceSubTypeData
+                };
+            }
 
 
-                    priceTypeDatas.Add(new DailyFeePaymentDataSourceView { Id = item.Id,Name=item.Name,SubDatas= data1 });
-                }
+            result.Code = 0;
+            result.Msg = "查询成功!";
+            result.Data = DailyFeePaymentList;
+            return result;
 
 
-                List<DailyFeePaymentDataSourceView> feeMarkTypeDatas = new List<DailyFeePaymentDataSourceView>();
+        }
 
 
-                foreach (Fin_DailyFeePaymentPagePriceTypeView item in feeMarkTypeData)
-                {
-                    List<Fin_DailyFeePaymentPagePriceSubTypeView> data1 = feeMarkSubTypeData.Where(s => s.STid == item.Id).ToList();
+        /// <summary>
+        /// 日付申请查询 使用的数据源
+        /// </summary>
+        /// <param name="dto"></param>
+        /// <returns></returns>
+        public async Task<Result> GetPriceTypeAddData(PortDtoBase dto)
+        {
+            Result result = new Result() { Code = -2 };
 
 
-                    feeMarkTypeDatas.Add(new DailyFeePaymentDataSourceView { Id = item.Id, Name = item.Name, SubDatas = data1 });
-                }
+            dynamic? DailyFeePaymentList = null;
 
 
+            var setTypeData = _setDataTypeRep.QueryDto<Sys_SetDataType, Fin_DailyFeePaymentPagePriceTypeView>().ToList();
+            var setData = _setDataTypeRep.QueryDto<Sys_SetData, Fin_DailyFeePaymentPagePriceSubTypeView>().ToList();
+
+            //48人员费用  49办公费用 50 销售费用 51 其他费用 55 大运会
+            var priceTypeData = setTypeData.Where(s => s.Id == 48 || s.Id == 49 || s.Id == 50 || s.Id == 51 || s.Id == 55).ToList();
+            var priceSubTypeData = setData.Where(s => s.STid == 48 || s.STid == 49 || s.STid == 50 || s.STid == 51 || s.STid == 55).ToList();
+            //员工姓名列表
+            var userNameData = await _UsersRep.GetUserNameList(dto.PortType);
+            //62 公转 63 私转
+            var feeMarkTypeData = setTypeData.Where(s => s.Id == 62 || s.Id == 63).ToList();
+            var feeMarkSubTypeData = setData.Where(s => s.STid == 62 || s.STid == 63).ToList();
+            var companyNameData = await _CompanyRep.GetCompanyNameData();
+
+            if (dto.PortType == 1) //web
+            {
+                DailyFeePaymentList = new Fin_DailyFeePaymentPagePriceTypeDataView
+                {
+                    FeeTypeData = priceTypeData,
+                    FeeSubTypeData = priceSubTypeData,
+                    UserNameData = userNameData.Data,
+                    FeeMarkTypeData = feeMarkTypeData,
+                    FeeMarkSubTypeData = feeMarkSubTypeData,
+                    CompanyNameData = companyNameData.Data
+                };
+            }
+            else if (dto.PortType == 2) //安卓
+            {
 
 
                 DailyFeePaymentList = new
                 DailyFeePaymentList = new
                 {
                 {
                     CompanyNameData = companyNameData.Data,
                     CompanyNameData = companyNameData.Data,
-                    UserNameData = userNameData.Data,
-                    FeeTypeData = priceTypeDatas,
-                    FeeMarkTypeData = feeMarkTypeDatas
+                    FeeTypeData = feeMarkTypeData,
+                    FeeTypeSubData = feeMarkSubTypeData
                 };
                 };
             }
             }
 
 

+ 107 - 5
OASystem/OASystem.Infrastructure/Repositories/Financial/ForeignReceivablesRepository.cs

@@ -1,4 +1,6 @@
 using AutoMapper;
 using AutoMapper;
+using MathNet.Numerics.Statistics.Mcmc;
+using NPOI.SS.Formula.Functions;
 using OASystem.Domain;
 using OASystem.Domain;
 using OASystem.Domain.Dtos.Financial;
 using OASystem.Domain.Dtos.Financial;
 using OASystem.Domain.Dtos.Groups;
 using OASystem.Domain.Dtos.Groups;
@@ -69,15 +71,21 @@ namespace OASystem.Infrastructure.Repositories.Financial
 
 
             //应收款项
             //应收款项
             string groupReceivedSql = string.Format(@"Select * From Fin_ForeignReceivables Where IsDel=0 And Diid={0}", dto.DiId);
             string groupReceivedSql = string.Format(@"Select * From Fin_ForeignReceivables Where IsDel=0 And Diid={0}", dto.DiId);
-            var groupReceivedList = await _sqlSugar.SqlQueryable<ForeignReceivablesInfoView>(groupReceivedSql).ToListAsync();
+            var groupReceivedList = await _sqlSugar.SqlQueryable<ForeignReceivablesView>(groupReceivedSql).ToListAsync();
 
 
             //已收款项
             //已收款项
-            string groupProceedsReceivedSql = string.Format(@"Select * From Fin_ForeignReceivables Where IsDel=0 And Diid={0}", dto.DiId);
-            var groupProceedsReceivedList = await _sqlSugar.SqlQueryable<ForeignReceivablesInfoView>(groupReceivedSql).ToListAsync();
-
+            string groupProceedsReceivedSql = string.Format(@"Select * From Fin_ProceedsReceived Where IsDel=0 And Diid={0}", dto.DiId);
+            var groupProceedsReceivedList = await _sqlSugar.SqlQueryable<ProceedsReceivedView>(groupProceedsReceivedSql).ToListAsync();
 
 
+            List<ProceedsReceivedView> NotFIDData = new List<ProceedsReceivedView>();
             if (dto.PortType == 1 )
             if (dto.PortType == 1 )
             {
             {
+                foreach (var item in groupReceivedList)
+                {
+                    item._ProceedsReceivedDatas = groupProceedsReceivedList.Where(s => s.FID == item.Id).ToList();
+                }
+
+                NotFIDData = groupProceedsReceivedList.Where(s =>! groupReceivedList.Any(e => s.FID == e.Id)).ToList();
 
 
             }
             }
 
 
@@ -86,7 +94,11 @@ namespace OASystem.Infrastructure.Repositories.Financial
             result.Data = new
             result.Data = new
             {
             {
                 GroupInfo = groupInfoData.Data,
                 GroupInfo = groupInfoData.Data,
-                GroupReceivedData = groupReceivedList
+                GroupCollectionStatementData = new
+                {
+                    ReceivedData = groupReceivedList,
+                    UnallocatedData = NotFIDData
+                }
             };
             };
 
 
             return result;
             return result;
@@ -94,6 +106,93 @@ namespace OASystem.Infrastructure.Repositories.Financial
         }
         }
 
 
 
 
+        /// <summary>
+        /// 应收款项 删除
+        /// </summary>
+        /// <param name="dto"></param>
+        /// <returns></returns>
+        public async Task<Result> _Del(DelForForeignReceivablesInfoDto dto)
+        {
+            Result result = new Result() { Code = -1, Msg = "程序错误!" };
+
+
+            var res = await _sqlSugar.Updateable<Fin_ForeignReceivables>()
+                .Where(it => it.Id == dto.Id)
+                .SetColumns(it => new Fin_ForeignReceivables()
+                 {
+                     IsDel = 1,
+                     DeleteUserId = dto.UserId,
+                     DeleteTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")
+                 }
+                ).ExecuteCommandAsync();
+
+            if (res > 0)
+            {
+                result.Msg = "删除成功!";
+                result.Code = 0;
+            }
+            else
+            {
+                result.Msg = "删除失败!";
+            }
+
+            return result;
+        }
+
+        /// <summary>
+        /// 财务模块
+        /// 收款账单 Add And Update
+        /// </summary>
+        /// <param name="diid"></param>
+        /// <returns></returns>
+        public async Task<Result> PostReceivablesOperate(ForeignReceivablesAddAndUpdateDto dto)
+        {
+            Result result = new() { Code = -2 };
+
+            if (dto.foreignReceivablesInfos.Count <= 0)
+            {
+                result.Msg = "收款账单没有信息,不能进行,添加或修改操作!!!";
+                return result;
+            }
+
+
+            int addCount = 0, updateCount = 0;
+            if (dto.PortType == 1)
+            {
+                List<Fin_ForeignReceivables> _ForeignReceivables = new List<Fin_ForeignReceivables>();
+                foreach (var item in dto.foreignReceivablesInfos)
+                {
+                    _ForeignReceivables.Add(new Fin_ForeignReceivables()
+                    {
+                        Diid = dto.DiId,
+                        Id = item.Id,
+                        PriceName = item.PriceName,
+                        Price = item.Price,
+                        Count = item.Count,
+                        Unit = item.Unit,
+                        ItemSumPrice = item.ItemSumPrice,
+                        Rate = item.Rate,
+                        Currency = item.Currency,
+                        AddingWay = item.AddingWay,
+                        CreateUserId = dto.UserId,
+                        CreateTime = DateTime.Now,
+                        Remark = item.Remark
+                    });
+                }
+                if (_ForeignReceivables.Count > 0)
+                {
+                    var x =  _sqlSugar.Storageable(_ForeignReceivables).ToStorage();
+                    addCount = x.AsInsertable.ExecuteCommand();        //不存在插入
+                    updateCount = x.AsUpdateable.ExecuteCommand();    //存在更新
+                }
+                result.Code = 0;
+                result.Msg = string.Format(@"操作成功!添加:{0}条;更新:{1};", addCount, updateCount);
+            }
+
+            return result;
+        }
+
+
         /// <summary>
         /// <summary>
         /// 根据diid查询团组应收款项
         /// 根据diid查询团组应收款项
         /// </summary>
         /// </summary>
@@ -136,5 +235,8 @@ namespace OASystem.Infrastructure.Repositories.Financial
             return result;
             return result;
 
 
         }
         }
+
+
+       
     }
     }
 }
 }

+ 87 - 0
OASystem/OASystem.Infrastructure/Repositories/Financial/ProceedsReceivedRepository.cs

@@ -1,5 +1,6 @@
 using AutoMapper;
 using AutoMapper;
 using OASystem.Domain;
 using OASystem.Domain;
+using OASystem.Domain.Dtos.Financial;
 using OASystem.Domain.Entities.Financial;
 using OASystem.Domain.Entities.Financial;
 using OASystem.Domain.ViewModels.Financial;
 using OASystem.Domain.ViewModels.Financial;
 using System;
 using System;
@@ -70,5 +71,91 @@ namespace OASystem.Infrastructure.Repositories.Financial
             return result;
             return result;
 
 
         }
         }
+
+        /// <summary>
+        /// 应收款项 删除
+        /// </summary>
+        /// <param name="dto"></param>
+        /// <returns></returns>
+        public async Task<Result> _Del(ProceedsReceivedDelDto dto)
+        {
+            Result result = new Result() { Code = -1, Msg = "程序错误!" };
+
+
+            var res = await _sqlSugar.Updateable<Fin_ProceedsReceived>()
+                .Where(it => it.Id == dto.Id)
+                .SetColumns(it => new Fin_ProceedsReceived()
+                {
+                    IsDel = 1,
+                    DeleteUserId = dto.UserId,
+                    DeleteTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")
+                }
+                ).ExecuteCommandAsync();
+
+            if (res > 0)
+            {
+                result.Msg = "删除成功!";
+                result.Code = 0;
+            }
+            else
+            {
+                result.Msg = "删除失败!";
+            }
+
+            return result;
+        }
+
+        /// <summary>
+        /// 已收款项
+        /// Add And Update
+        /// </summary>
+        /// <param name="diid"></param>
+        /// <returns></returns>
+        public async Task<Result> PostAmountReceivedOperate(ProceedsReceivedDto dto)
+        {
+            Result result = new() { Code = -2 };
+
+            if (dto._ProceedsReceivedInfos.Count <= 0)
+            {
+                result.Msg = "已收款项没有信息,不能进行,添加或修改操作!!!";
+                return result;
+            }
+
+
+            int addCount = 0, updateCount = 0;
+            if (dto.PortType == 1)
+            {
+                List<Fin_ProceedsReceived> _ProceedsReceived = new List<Fin_ProceedsReceived>();
+                foreach (var item in dto._ProceedsReceivedInfos)
+                {
+                    _ProceedsReceived.Add(new Fin_ProceedsReceived()
+                    {
+                        Diid = dto.DiId,
+                        Id = item.Id,
+                        SectionTime = item.SectionTime,
+                        Price = item.Price,
+                        Currency = item.Currency,
+                        ReceivablesType = item.ReceivablesType,
+                        Client = item.Client,
+                        CustomerName = item.CustomerName,
+                        CustomerTel = item.CustomerTel,
+                        FID = item.FID,
+                        CreateUserId = dto.UserId,
+                        CreateTime = DateTime.Now,
+                        Remark = item.Remark
+                    });
+                }
+                if (_ProceedsReceived.Count > 0)
+                {
+                    var x = _sqlSugar.Storageable(_ProceedsReceived).ToStorage();
+                    addCount = x.AsInsertable.ExecuteCommand();        //不存在插入
+                    updateCount = x.AsUpdateable.ExecuteCommand();    //存在更新
+                }
+                result.Code = 0;
+                result.Msg = string.Format(@"操作成功!添加:{0}条;更新:{1};", addCount, updateCount);
+            }
+
+            return result;
+        }
     }
     }
 }
 }