Bladeren bron

财务模块
已收款项
查询 添加 修改 删除

leiy 1 jaar geleden
bovenliggende
commit
9f7f85968c

+ 146 - 0
OASystem/OASystem.Api/Controllers/FinancialController.cs

@@ -729,6 +729,152 @@ namespace OASystem.API.Controllers
         }
 
 
+        #endregion
+
+        #region 已收款项
+
+        /// <summary>
+        /// 已收款项
+        /// 查询
+        /// </summary>
+        /// <param name="dto"></param>
+        /// <returns></returns>
+        [HttpPost]
+        [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
+        public async Task<IActionResult> PostAmountReceived(AmountReceivedDto dto)
+        {
+            try
+            {
+                if (dto == null)
+                {
+                    return Ok(JsonView(false, "参数不能为空!"));
+                }
+
+                Result ffrData = await _proceedsReceivedRep.PostAmountReceived(dto.DiId );
+                dynamic data = null;
+                if (dto.PortType == 1)
+                {
+                    if (ffrData.Code != 0)
+                    {
+                        return Ok(JsonView(false, ffrData.Msg));
+                    }
+                    data= ffrData.Data;
+                }
+                else if(dto.PortType == 2)
+                {
+                    if (ffrData.Code != 0)
+                    {
+                        return Ok(JsonView(false, ffrData.Msg));
+                    }
+                    data = ffrData.Data;
+                }
+                else if (dto.PortType == 2)
+                {
+                    if (ffrData.Code != 0)
+                    {
+                        return Ok(JsonView(false, ffrData.Msg));
+                    }
+                    data = ffrData.Data;
+
+                }
+                else
+                {
+                    return Ok(JsonView(false, "请选择正确的端口号!"));
+                }
+                return Ok(JsonView(true,"操作成功!", data));
+            }
+            catch (Exception ex)
+            {
+                return Ok(JsonView(false, ex.Message));
+            }
+        }
+
+        /// <summary>
+        /// 已收款项
+        /// Add Or Edit
+        /// </summary>
+        /// <param name="dto"></param>
+        /// <returns></returns>
+        [HttpPost]
+        [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
+        public async Task<IActionResult> PostAmountReceivedAddOrEdit(AmountReceivedAddOrEditDto dto)
+        {
+            try
+            {
+                if (dto == null)
+                {
+                    return Ok(JsonView(false, "参数不能为空!"));
+                }
+
+                Result ffrData = await _proceedsReceivedRep.PostAmountReceivedAddOrEditDto(dto);
+
+                if (dto.PortType == 1)
+                {
+                    if (ffrData.Code != 0)
+                    {
+                        return Ok(JsonView(false, ffrData.Msg));
+                    }
+
+                }
+                else if (dto.PortType == 2)
+                {
+                    if (ffrData.Code != 0)
+                    {
+                        return Ok(JsonView(false, ffrData.Msg));
+                    }
+
+                }
+                else if (dto.PortType == 2)
+                {
+                    if (ffrData.Code != 0)
+                    {
+                        return Ok(JsonView(false, ffrData.Msg));
+                    }
+                }
+                else
+                {
+                    return Ok(JsonView(false, "请选择正确的端口号!"));
+                }
+                return Ok(JsonView(true, "操作成功!"));
+            }
+            catch (Exception ex)
+            {
+                return Ok(JsonView(false, ex.Message));
+            }
+        }
+
+        /// <summary>
+        /// 已收款项
+        /// Del
+        /// </summary>
+        /// <param name="dto"></param>
+        /// <returns></returns>
+        [HttpPost]
+        [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
+        public async Task<IActionResult> PostAmountReceived_Del(AmountReceivedDelDto dto)
+        {
+            try
+            {
+                if (dto == null)
+                {
+                    return Ok(JsonView(false, "参数不能为空!"));
+                }
+
+                Result ffrData = await _proceedsReceivedRep.PostAmountReceivedDel(dto);
+
+                if (ffrData.Code != 0)
+                {
+                    return Ok(JsonView(false, ffrData.Msg));
+                }
+
+                return Ok(JsonView(true, "操作成功!"));
+            }
+            catch (Exception ex)
+            {
+                return Ok(JsonView(false, ex.Message));
+            }
+        }
+
         #endregion
     }
 }

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

@@ -7,6 +7,10 @@ using System.Threading.Tasks;
 namespace OASystem.Domain.Dtos.Financial
 {
 
+
+
+
+
     /// <summary>
     /// 已收款项 del Dto
     /// </summary>
@@ -124,6 +128,7 @@ namespace OASystem.Domain.Dtos.Financial
         /// </summary>
         public List<int>? SubIds { get; set; }
     }
+  
     #region word Download
 
     /// <summary>
@@ -145,4 +150,107 @@ namespace OASystem.Domain.Dtos.Financial
 
     #endregion
 
+    #region 已收款项
+    /// <summary>
+    /// 已收款项 Dto
+    /// </summary>
+    public class AmountReceivedDto:PortDtoBase
+    {
+        /// <summary>
+        /// 团组Id
+        /// </summary>
+        public int DiId { get; set; }
+    }
+
+
+    /// <summary>
+    /// 已收款项 Dto
+    /// </summary>
+    public class AmountReceivedAddOrEditDto : PortDtoBase
+    {
+        /// <summary>
+        /// 用户Id
+        /// </summary>
+        public int UserId { get; set; }
+
+        /// <summary>
+        /// 团组Id
+        /// </summary>
+        public int DiId { get; set; }
+
+        /// <summary>
+        /// 已收款项infos
+        /// </summary>
+        public List<ProceedsReceived1Info>? _ProceedsReceivedInfos { get; set; }
+
+    }
+
+    /// <summary>
+    /// 已收款项info
+    /// </summary>
+    public class ProceedsReceived1Info
+    {
+        /// <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>
+        /// 备注
+        /// </summary>
+        public string? Remark { get; set; }
+
+    }
+
+    /// <summary>
+    /// 已收款项 
+    /// 删除
+    /// </summary>
+    public class AmountReceivedDelDto
+    {
+        /// <summary>
+        /// 当前用户操作Id
+        /// </summary>
+        public int UserId { get; set; }
+
+        public int Id { get; set; }
+    }
+    #endregion
 }

+ 1 - 1
OASystem/OASystem.Domain/Entities/Financial/Fin_ProceedsReceived.cs

@@ -64,6 +64,6 @@ namespace OASystem.Domain.Entities.Financial
         /// 应付项id
         /// </summary>
         [SugarColumn(IsNullable = true, ColumnDataType = "int")]
-        public int FID { get; set; }
+        public int FID { get; set; } = 0;
     }
 }

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

@@ -71,4 +71,59 @@ namespace OASystem.Domain.ViewModels.Financial
         /// </summary>
         public string? Remark { get; set; }
     }
+
+
+
+    /// <summary>
+    /// 团组已收款项-1Info View
+    /// </summary>
+    public class ProceedsReceived1View
+    {
+        public int Id { get; set; }
+
+        /// <summary>
+        /// 团组Id
+        /// </summary>
+        public int Diid { 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>
+        /// 备注
+        /// </summary>
+        public string? Remark { get; set; }
+    }
 }

+ 116 - 6
OASystem/OASystem.Infrastructure/Repositories/Financial/ProceedsReceivedRepository.cs

@@ -31,7 +31,7 @@ namespace OASystem.Infrastructure.Repositories.Financial
         }
 
         /// <summary>
-        /// 根据diid查询团组已收款项
+        /// 根据diid查询团组已收款项 已关联应收款项
         /// </summary>
         /// <param name="diid"></param>
         /// <returns></returns>
@@ -39,7 +39,7 @@ namespace OASystem.Infrastructure.Repositories.Financial
         {
             Result result = new() { Code = -2 };
 
-            string sql = string.Format(@"Select * From ProceedsReceived Where IsDel=0 And Diid={0}", diid);
+            string sql = string.Format(@"Select * From Fin_ProceedsReceived Where IsDel=0 And Diid={0}", diid);
 
             var groupReceivablesList = await _sqlSugar.SqlQueryable<Fin_ProceedsReceivedView>(sql).ToListAsync();
 
@@ -52,7 +52,7 @@ namespace OASystem.Infrastructure.Repositories.Financial
         }
 
         /// <summary>
-        /// 根据diid 数组 查询团组已收款项
+        /// 根据diid 数组 查询团组已收款项 已关联应收款项
         /// </summary>
         /// <param name="diid"></param>
         /// <returns></returns>
@@ -73,7 +73,7 @@ namespace OASystem.Infrastructure.Repositories.Financial
         }
 
         /// <summary>
-        /// 应收款项 删除
+        /// 已收款项 已关联应收款项 删除 
         /// </summary>
         /// <param name="dto"></param>
         /// <returns></returns>
@@ -106,7 +106,7 @@ namespace OASystem.Infrastructure.Repositories.Financial
         }
 
         /// <summary>
-        /// 已收款项
+        /// 已收款项 已关联应收款项
         /// Add And Update
         /// </summary>
         /// <param name="diid"></param>
@@ -160,7 +160,7 @@ namespace OASystem.Infrastructure.Repositories.Financial
 
 
         /// <summary>
-        /// 已收款项
+        /// 已收款项 已关联应收款项
         /// 分配已收款项至 应收项下
         /// </summary>
         /// <param name="diid"></param>
@@ -196,5 +196,115 @@ namespace OASystem.Infrastructure.Repositories.Financial
 
             return result;
         }
+
+
+
+
+        /// <summary>
+        /// 根据diid查询团组已收款项
+        /// </summary>
+        /// <param name="diid"></param>
+        /// <returns></returns>
+        public async Task<Result> PostAmountReceived(int diid)
+        {
+            Result result = new() { Code = -2 };
+
+            string sql = string.Format(@"Select Id,Diid,SectionTime,Price,Currency,ReceivablesType,Client,CustomerName,CustomerTel, Remark From Fin_ProceedsReceived 
+                                         Where IsDel=0 And Diid={0}", diid);
+
+            var groupReceivablesList = await _sqlSugar.SqlQueryable<ProceedsReceived1View>(sql).ToListAsync();
+
+            result.Code = 0;
+            result.Msg = "查询成功!";
+            result.Data = groupReceivablesList;
+
+            return result;
+        }
+
+        /// <summary>
+        /// 已收款项
+        /// Add And Update
+        /// </summary>
+        /// <param name="diid"></param>
+        /// <returns></returns>
+        public async Task<Result> PostAmountReceivedAddOrEditDto(AmountReceivedAddOrEditDto 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 = 0,
+                        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;
+        }
+
+        /// <summary>
+        /// 已收款项  删除 
+        /// </summary>
+        /// <param name="dto"></param>
+        /// <returns></returns>
+        public async Task<Result> PostAmountReceivedDel(AmountReceivedDelDto 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;
+        }
     }
 }