Преглед на файлове

Merge branch 'develop' of http://132.232.92.186:3000/XinXiBu/OA2023 into develop

yuanrf преди 9 месеца
родител
ревизия
82cc1c4d0c
променени са 21 файла, в които са добавени 2213 реда и са изтрити 123 реда
  1. 8 5
      OASystem/EntitySync/Program.cs
  2. 88 6
      OASystem/OASystem.Api/Controllers/FinancialController.cs
  3. 78 3
      OASystem/OASystem.Api/Controllers/GroupsController.cs
  4. 249 1
      OASystem/OASystem.Api/Controllers/PersonnelModuleController.cs
  5. 67 35
      OASystem/OASystem.Api/Controllers/ResourceController.cs
  6. 1 1
      OASystem/OASystem.Api/appsettings.json
  7. 8 0
      OASystem/OASystem.Domain/AutoMappers/_baseMappingProfile.cs
  8. 45 2
      OASystem/OASystem.Domain/Dtos/Groups/VisaCommissionDto.cs
  9. 308 0
      OASystem/OASystem.Domain/Dtos/PersonnelModule/GoodsDTO.cs
  10. 8 1
      OASystem/OASystem.Domain/Dtos/Resource/InvitationOfficialActivityDataDto.cs
  11. 64 0
      OASystem/OASystem.Domain/Entities/PersonnelModule/Pm_GoodsInfo.cs
  12. 62 0
      OASystem/OASystem.Domain/Entities/PersonnelModule/Pm_GoodsReceive.cs
  13. 65 0
      OASystem/OASystem.Domain/Entities/PersonnelModule/Pm_GoodsStorage.cs
  14. 8 0
      OASystem/OASystem.Domain/Entities/Resource/Res_InvitationOfficialActivityData.cs
  15. 31 0
      OASystem/OASystem.Domain/Enums/GoodsAuditEnum.cs
  16. 79 0
      OASystem/OASystem.Domain/ViewModels/PersonnelModule/GoodsInfoView.cs
  17. 117 1
      OASystem/OASystem.Domain/ViewModels/Resource/InvitationOfficialActivityDataView.cs
  18. 52 0
      OASystem/OASystem.Infrastructure/Repositories/Groups/VisaCommissionRepository.cs
  19. 6 1
      OASystem/OASystem.Infrastructure/Repositories/Groups/VisaPriceRepository.cs
  20. 757 0
      OASystem/OASystem.Infrastructure/Repositories/PersonnelModule/GoodsRepository.cs
  21. 112 67
      OASystem/OASystem.Infrastructure/Repositories/Resource/InvitationOfficialActivityDataRepository.cs

+ 8 - 5
OASystem/EntitySync/Program.cs

@@ -135,11 +135,14 @@ db.CodeFirst.SetStringDefaultLength(50).BackupTable().InitTables(new Type[]
     //typeof(Grp_HotelReservationsContent),  //酒店费用子表
     //typeof(Grp_VisitingClients),  //拜访团组客户
     //typeof(Grp_ApprovalTravelDetails),  //公务出访表
-     //typeof(Sys_Countries),  //洲
-     //typeof(Sys_Continent),  //国家
-     //typeof(Sys_Cities),  //城市
-     //typeof(Grp_GroupModelFile),//团组文件 
-     typeof(Grp_VisaCommission),//签证费用录入 
+    //typeof(Sys_Countries),  //洲
+    //typeof(Sys_Continent),  //国家
+    //typeof(Sys_Cities),  //城市
+    //typeof(Grp_GroupModelFile),//团组文件 
+    //typeof(Grp_VisaCommission),//签证费用录入 
+    typeof(Pm_GoodsReceive),//物品领用表 
+    typeof(Pm_GoodsStorage),//物品入库表 
+    //typeof(Pm_GoodsInfo),//物品详细表 
 
 });
 Console.WriteLine("数据库结构同步完成!");

+ 88 - 6
OASystem/OASystem.Api/Controllers/FinancialController.cs

@@ -1142,7 +1142,7 @@ namespace OASystem.API.Controllers
 
                                     string currencyCode = currData.Find(it => it.Id == item.Currency)?.Remark ?? "Unknown";
                                     SetCells(ChildTable, doc, rowIndex, 2, item.Cost.ToString("#0.00") + currencyCode + "/晚");
-                                    SetCells(ChildTable, doc, rowIndex, 3, " 汇率" + (item.SubTotal / item.Cost).ToString("#0.00"));
+                                    SetCells(ChildTable, doc, rowIndex, 3, "汇率" + (item.SubTotal / item.Cost).ToString("#0.0000"));
                                     SetCells(ChildTable, doc, rowIndex, 4, "CNY " + item.SubTotal + "\r\n");
                                     rowIndex++;
                                     zsinfo += item.Place + "  " + days + "晚 " + item.Cost.ToString("#0.00") + currencyCode + "/晚" + " 汇率" + (item.SubTotal / item.Cost).ToString("#0.0000") + "   CNY " + item.SubTotal * days + "\r\n";
@@ -1179,7 +1179,7 @@ namespace OASystem.API.Controllers
 
                                     string currencyCode = currData.Find(it => it.Id == item.Currency)?.Remark ?? "Unknown";
                                     SetCells(ChildTable1, doc, rowIndex, 2, item.Cost.ToString("#0.00") + currencyCode + "/天");
-                                    SetCells(ChildTable1, doc, rowIndex, 3, " 汇率" + (item.SubTotal / item.Cost).ToString("#0.00"));
+                                    SetCells(ChildTable1, doc, rowIndex, 3, "汇率" + (item.SubTotal / item.Cost).ToString("#0.0000"));
                                     SetCells(ChildTable1, doc, rowIndex, 4, "CNY " + item.SubTotal);
                                     rowIndex++;
                                     hsinfo += item.Place + "  " + days + "天 " + item.Cost.ToString("#0.00") + currencyCode + "/天" + " 汇率" + (item.SubTotal / item.Cost).ToString("#0.0000") + "   CNY " + item.SubTotal * days + "\r\n";
@@ -1216,7 +1216,7 @@ namespace OASystem.API.Controllers
 
                                     string currencyCode = currData.Find(it => it.Id == item.Currency)?.Remark ?? "Unknown";
                                     SetCells(ChildTable2, doc, rowIndex, 2, item.Cost.ToString("#0.00") + currencyCode + "/天");
-                                    SetCells(ChildTable2, doc, rowIndex, 3, " 汇率" + (item.SubTotal / item.Cost).ToString("#0.00"));
+                                    SetCells(ChildTable2, doc, rowIndex, 3, "汇率" + (item.SubTotal / item.Cost).ToString("#0.0000"));
                                     SetCells(ChildTable2, doc, rowIndex, 4, "CNY " + item.SubTotal + "\r\n");
                                     rowIndex++;
                                     gzinfo += item.Place + "  " + days + "天 " + item.Cost.ToString("#0.00") + currencyCode + "/天" + " 汇率" + (item.SubTotal / item.Cost).ToString("#0.00") + "   CNY " + item.SubTotal * days + "\r\n";
@@ -1350,6 +1350,14 @@ namespace OASystem.API.Controllers
             Aspose.Words.Tables.Cell lshCell = table.Rows[rows].Cells[cells];
             //将单元格中的第一个段落移除
             lshCell.FirstParagraph.Remove();
+
+
+            //if (cells == 0) lshCell.CellFormat.Width = 120;
+            //else if (cells == 1) lshCell.CellFormat.Width = 50;
+            //else if (cells == 2) lshCell.CellFormat.Width = 120;
+            //else if (cells == 3) lshCell.CellFormat.Width = 100;
+            //else if (cells == 4) lshCell.CellFormat.Width = 120;
+
             //新建一个段落
             Paragraph p = new Paragraph(doc);
             var r = new Run(doc, val);
@@ -2375,7 +2383,44 @@ namespace OASystem.API.Controllers
                             priName = $"[费用名称:{ioaDatas.Find(it => payInfo.DIId == it.DiId && payInfo.CId == it.Id)?.Inviter ?? " -"}]";
                             break;
                         case 82:  // 82	团组客户保险
-                            priName = $"[费用名称:{insureDatas.Find(it => payInfo.DIId == it.DiId && payInfo.CId == it.Id)?.ClientName ?? " -"}]";
+
+                            string bx_sql = string.Format("select b.Id,b.Pinyin,b.lastName,b.firstName,b.phone from  Grp_TourClientList a, Crm_DeleClient b where a.clientid = b.id and a.isdel = 0 and a.diid = {0}", groupInfo.Id);
+                            List<SimplClientInfo> bx_arr = _sqlSugar.SqlQueryable<SimplClientInfo>(bx_sql).ToList();
+
+                            string bx_ClientName = insureDatas.Find(it => payInfo.DIId == it.DiId && payInfo.CId == it.Id)?.ClientName ?? "";
+                            string bx_clientName = "-";
+                            if (Regex.Match(bx_ClientName, @"\d+,?").Value.Length > 0)
+                            {
+                                string[] temparr = bx_ClientName.Split(',');
+                                string fistrStr = temparr[0];
+                                int count = temparr.Count();
+
+                                int tempId;
+                                bool success = int.TryParse(fistrStr, out tempId);
+                                if (success)
+                                {
+                                    SimplClientInfo tempInfo = bx_arr.FirstOrDefault(s => s.Id == tempId);
+                                    if (tempInfo != null)
+                                    {
+                                        if (count > 1)
+                                        {
+                                            bx_clientName = string.Format(@"{0}{1}等{2}人", tempInfo.LastName, tempInfo.FirstName, count);
+                                        }
+                                        else
+                                        {
+                                            bx_clientName = string.Format(@"{0}{1}", tempInfo.LastName, tempInfo.FirstName);
+                                        }
+                                    }
+                                }
+                                else
+                                {
+                                    bx_clientName = fistrStr;
+                                }
+                            }
+
+                            //priName = $"[费用名称:{insureDatas.Find(it => payInfo.DIId == it.DiId && payInfo.CId == it.Id)?.ClientName ?? " -"}]";
+                            priName = $"[费用名称:{bx_clientName}]";
+
                             break;
                         case 85:  // 85	机票预订
                             string flightsCode = airDatas.Find(it => payInfo.DIId == it.DIId && payInfo.CId == it.Id)?.FlightsCode ?? "-";
@@ -6049,7 +6094,7 @@ Group by PriceType ", dto.diId);
         /// <param name="endDt"></param>
         /// <returns></returns>
         [HttpGet]
-        public async Task<IActionResult> GroupUnAuditFeeList(string beginDt,string endDt)
+        public async Task<IActionResult> GroupUnAuditFeeList(string beginDt,string endDt,string teamName)
         {
             var jw = JsonView(false);
 
@@ -6067,6 +6112,7 @@ Group by PriceType ", dto.diId);
                                                 x.VisitDate >= _beginDt &&
                                                 x.VisitDate <= _endDt
                                              )
+                                       .WhereIF(!string.IsNullOrEmpty(teamName), x => x.TeamName.Contains(teamName))
                                        .ToList();
             var _groupIds = _groupDatas.Select(x => x.Id).ToList();
             if (_groupIds.Count < 1)
@@ -6263,7 +6309,43 @@ Group by PriceType ", dto.diId);
                                 priName = $"[费用名称:{ioaDatas.Find(it => payInfo.DIId == it.DiId && payInfo.CId == it.Id)?.Inviter ?? " -"}]";
                                 break;
                             case 82:  // 82	团组客户保险
-                                priName = $"[费用名称:{insureDatas.Find(it => payInfo.DIId == it.DiId && payInfo.CId == it.Id)?.ClientName ?? " -"}]";
+
+                                string bx_sql = string.Format("select b.Id,b.Pinyin,b.lastName,b.firstName,b.phone from  Grp_TourClientList a, Crm_DeleClient b where a.clientid = b.id and a.isdel = 0 and a.diid = {0}", groupInfo.Id);
+                                List<SimplClientInfo> bx_arr = _sqlSugar.SqlQueryable<SimplClientInfo>(bx_sql).ToList();
+
+                                string bx_ClientName = insureDatas.Find(it => payInfo.DIId == it.DiId && payInfo.CId == it.Id)?.ClientName ?? "";
+                                string bx_clientName = "-";
+                                if (Regex.Match(bx_ClientName, @"\d+,?").Value.Length > 0)
+                                {
+                                    string[] temparr = bx_ClientName.Split(',');
+                                    string fistrStr = temparr[0];
+                                    int count = temparr.Count();
+
+                                    int tempId;
+                                    bool success = int.TryParse(fistrStr, out tempId);
+                                    if (success)
+                                    {
+                                        SimplClientInfo tempInfo = bx_arr.FirstOrDefault(s => s.Id == tempId);
+                                        if (tempInfo != null)
+                                        {
+                                            if (count > 1)
+                                            {
+                                                bx_clientName = string.Format(@"{0}{1}等{2}人", tempInfo.LastName, tempInfo.FirstName, count);
+                                            }
+                                            else
+                                            {
+                                                bx_clientName = string.Format(@"{0}{1}", tempInfo.LastName, tempInfo.FirstName);
+                                            }
+                                        }
+                                    }
+                                    else
+                                    {
+                                        bx_clientName = fistrStr;
+                                    }
+                                }
+
+                                //priName = $"[费用名称:{insureDatas.Find(it => payInfo.DIId == it.DiId && payInfo.CId == it.Id)?.ClientName ?? " -"}]";
+                                priName = $"[费用名称:{bx_clientName}]";
                                 break;
                             case 85:  // 85	机票预订
                                 string flightsCode = airDatas.Find(it => payInfo.DIId == it.DIId && payInfo.CId == it.Id)?.FlightsCode ?? "-";

+ 78 - 3
OASystem/OASystem.Api/Controllers/GroupsController.cs

@@ -3353,6 +3353,56 @@ namespace OASystem.API.Controllers
         [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
         public async Task<IActionResult> UploadProject(IFormFile file)
         {
+            //var TypeName = Request.Headers["TypeName"].ToString();
+
+            //if (file == null) return Ok(JsonView(false, "文件不存在!"));
+
+            //var fileDir = AppSettingsHelper.Get("GrpFileBasePath");
+            ////文件名称
+            //string projectFileName = file.FileName;
+            ////上传的文件的路径
+            //string filePath = $"{fileDir}/{projectFileName}";
+
+            //if (TypeName == "A")//A代表团组增减款项
+            //{
+            //    filePath = fileDir + $@"\团组增减款项相关文件";
+            //    if (!Directory.Exists(filePath))
+            //    {
+            //        Directory.CreateDirectory(filePath);
+            //    }
+
+            //    //上传的文件的路径
+            //    filePath += $@"\{projectFileName}";
+
+            //}
+            //else if (TypeName == "B")//B代表商邀相关文件
+            //{
+            //    //上传的文件的路径
+            //    filePath = fileDir + $@"\商邀相关文件\{projectFileName}";
+
+            //    if (!Directory.Exists(filePath))
+            //    {
+            //        Directory.CreateDirectory(filePath);
+            //    }
+
+            //    //上传的文件的路径
+            //    filePath = $@"\{projectFileName}";
+            //}
+            //try
+            //{
+            //    using (FileStream fs = System.IO.File.Create(filePath))
+            //    {
+            //        file.CopyTo(fs);
+            //        fs.Flush();
+            //    }
+            //}
+            //catch (Exception ex)
+            //{
+            //    return Ok(JsonView(false, $"文件上传失败! Error:{ex.Message}"));
+            //}
+
+            //return Ok(JsonView(true, "上传成功!", projectFileName));
+
             try
             {
                 var TypeName = Request.Headers["TypeName"].ToString();
@@ -3363,7 +3413,7 @@ namespace OASystem.API.Controllers
                     string projectFileName = file.FileName;
 
                     //上传的文件的路径
-                    string filePath = "";
+                    string filePath = $"{fileDir}/{projectFileName}";
                     if (TypeName == "A")//A代表团组增减款项
                     {
 
@@ -3401,7 +3451,6 @@ namespace OASystem.API.Controllers
             catch (Exception ex)
             {
                 return Ok(JsonView(false, "程序错误!"));
-                throw;
             }
 
         }
@@ -6452,6 +6501,32 @@ namespace OASystem.API.Controllers
             return Ok(await _visaCommissionRep.Item(_dto));
         }
 
+
+        /// <summary>
+        /// 签证提成录入 
+        /// Save
+        /// </summary>
+        /// <param name="_dto"></param>
+        /// <returns></returns>
+        [HttpPost]
+        [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
+        public async Task<IActionResult> VisaCommissionSave(VisaCommissionSaveDto _dto)
+        {
+            //参数验证
+            if (_dto.Items.Length < 1) return Ok(JsonView(false, "请输入有效的请求!"));
+
+            foreach (var item in _dto.Items)
+            {
+                if (item.CurrUserId < 1) return Ok(JsonView(false, "请输入有效的CurrUserId!"));
+                if (item.DiId < 1) return Ok(JsonView(false, "请输入有效的DiId!"));
+                if (string.IsNullOrEmpty( item.Country) ) return Ok(JsonView(false, "国家为空!"));
+                //if (item.Quantity < 1) return Ok(JsonView(false, "请输入有效的Qauntity!"));
+            }
+            
+
+            return Ok(await _visaCommissionRep.Save(_dto));
+        }
+
         /// <summary>
         /// 签证提成录入 
         /// Create
@@ -11514,7 +11589,7 @@ ORDER by  gctggrc.id DESC
                 return Ok(JsonView(StatusCodes.Status400BadRequest, $"团组汇率-->酒店模块 {_currency} 币种未设置汇率,不支持预定成本Excel导出", ""));
 
             }
-
+            
             if (!_currency.ToUpper().Equals("CNY"))
             {
                 _rate = _GroupCostParameter.Rate;

+ 249 - 1
OASystem/OASystem.Api/Controllers/PersonnelModuleController.cs

@@ -1,6 +1,8 @@
 using Aliyun.Credentials.Utils;
 using Aspose.Cells;
+using FluentValidation;
 using Microsoft.AspNetCore.SignalR;
+using Microsoft.IdentityModel.Tokens;
 using NPOI.POIFS.Crypt.Dsig;
 using OASystem.API.OAMethodLib;
 using OASystem.API.OAMethodLib.Hub.HubClients;
@@ -43,6 +45,7 @@ namespace OASystem.API.Controllers
         private string url;
         private string path;
         private readonly IHubContext<ChatHub, IChatClient> _hubContext;
+        private readonly GoodsRepository _goodsRep;
 
         /// <summary>
         /// 初始化
@@ -52,7 +55,7 @@ namespace OASystem.API.Controllers
         /// <param name="usersRep"></param>
         /// <param name="mapper"></param>
         public PersonnelModuleController(IQiYeWeChatApiService qiYeWeChatApiService, WageSheetRepository wageSheetRep, UsersRepository usersRep, IMapper mapper,
-            TaskAllocationRepository taskAllocationRep, IHubContext<ChatHub, IChatClient> hubContext)
+            TaskAllocationRepository taskAllocationRep, IHubContext<ChatHub, IChatClient> hubContext, GoodsRepository goodsRep)
         {
             _mapper = mapper;
             _usersRep = usersRep;
@@ -69,6 +72,7 @@ namespace OASystem.API.Controllers
 
             this._taskAllocationRep = taskAllocationRep;
             _hubContext = hubContext;
+            _goodsRep = goodsRep;
         }
 
         #region 工资表单
@@ -1767,5 +1771,249 @@ namespace OASystem.API.Controllers
         }
 
         #endregion
+
+        #region 物资进销存
+
+        /// <summary>
+        /// 物资进销存
+        /// 基础数据类型
+        /// </summary>
+        /// <returns></returns>
+        [HttpGet]
+        [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
+        public async Task<IActionResult> GoodsInitDataSource()
+        {
+            return Ok(await _goodsRep.InitDataSource());
+        }
+
+        /// <summary>
+        /// 物资进销存
+        /// 物品 列表
+        /// </summary>
+        /// <returns></returns>
+        [HttpPost]
+        [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
+        public async Task<IActionResult> GoodsList(GoodsListDTO _dto)
+        {
+            if (_dto.PortType > 1 || _dto.PortType > 3) return Ok(JsonView(false,MsgTips.Port));
+            if (_dto.PageIndex < 1 || _dto.PageSize < 1) return Ok(JsonView(false, MsgTips.PageIndex));
+
+            return Ok(await _goodsRep.GoodsList(_dto));
+        }
+
+        /// <summary>
+        /// 物资进销存
+        /// 物品 详情
+        /// </summary>
+        /// <returns></returns>
+        [HttpGet]
+        [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
+        public async Task<IActionResult> GoodsInfo(int portType, int id)
+        {
+            if (portType > 1 || portType > 3) return Ok(JsonView(false, MsgTips.Port));
+            if (id < 1) return Ok(JsonView(false, MsgTips.Id));
+
+            return Ok(await _goodsRep.GoodsInfo(portType, id));
+        }
+
+        /// <summary>
+        /// 物资进销存
+        /// 物品 OP(Add OR Edit)
+        /// </summary>
+        /// <returns></returns>
+        [HttpPost]
+        [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
+        public async Task<IActionResult> GoodsOP(GoodsOPDTO _dto)
+        {
+            var validator = new GoodsOPDTOValidator();
+            var validatorRes = await validator.ValidateAsync(_dto);
+            if (!validatorRes.IsValid)
+            {
+                var sb = new StringBuilder();
+                foreach (var error in validatorRes.Errors) sb.AppendLine(error.ErrorMessage);
+                return Ok(JsonView(false, sb.ToString()));
+            }
+
+            return Ok(await _goodsRep.GoodsOP(_dto));
+        }
+
+        /// <summary>
+        /// 物资进销存
+        /// 物品 Del
+        /// </summary>
+        /// <returns></returns>
+        [HttpDelete("{id}")]
+        [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
+        public async Task<IActionResult> GoodsDel(int id,[FromQuery] int currUserId)
+        {
+            if (id < 1) return Ok(JsonView(false, MsgTips.Id));
+            if (currUserId < 1) return Ok(JsonView(false, MsgTips.UserId));
+
+            return Ok(await _goodsRep.GoodsDel(id,currUserId));
+        }
+
+        /// <summary>
+        /// 物资进销存
+        /// 入库 列表
+        /// </summary>
+        /// <returns></returns>
+        [HttpPost]
+        [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
+        public async Task<IActionResult> GoodsStorageList(GoodsStorageListDTO _dto)
+        {
+            if (_dto.PortType > 1 || _dto.PortType > 3) return Ok(JsonView(false, MsgTips.Port));
+            if (_dto.PageIndex < 1 || _dto.PageSize < 1) return Ok(JsonView(false, MsgTips.PageIndex));
+            
+            return Ok(await _goodsRep.GoodsStorageList(_dto));
+        }
+
+        /// <summary>
+        /// 物资进销存
+        /// 入库 详情
+        /// </summary>
+        /// <returns></returns>
+        [HttpGet]
+        [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
+        public async Task<IActionResult> GoodsStorageInfo(int portType, int id)
+        {
+            if (portType > 1 || portType > 3) return Ok(JsonView(false, MsgTips.Port));
+            if (id < 1) return Ok(JsonView(false, MsgTips.Id));
+
+            return Ok(await _goodsRep.GoodsStorageInfo(portType,id));
+        }
+
+        /// <summary>
+        /// 物资进销存
+        /// 入库 OP(Add OR Edit)
+        /// </summary>
+        /// <returns></returns>
+        [HttpPost]
+        [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
+        public async Task<IActionResult> GoodsStorageOP(GoodsStorageOPDTO _dto)
+        {
+            var vadalitor = new GoodsStorageOPDTOValidator();
+            var vadalitorRes = await vadalitor.ValidateAsync(_dto);
+            if (!vadalitorRes.IsValid)
+            {
+                var sb = new StringBuilder();
+                foreach (var error in vadalitorRes.Errors) sb.AppendLine(error.ErrorMessage);
+                return Ok(JsonView(false, sb.ToString()));
+            }
+
+            return Ok(await _goodsRep.GoodsStorageOP(_dto));
+        }
+
+        /// <summary>
+        /// 物资进销存
+        /// 入库 Del
+        /// </summary>
+        /// <returns></returns>
+        [HttpDelete("{id}")]
+        [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
+        public async Task<IActionResult> GoodsStorageDel(int id, [FromQuery] int currUserId)
+        {
+            if (id < 1) return Ok(JsonView(false, MsgTips.Id));
+            if (currUserId < 1) return Ok(JsonView(false, MsgTips.UserId));
+
+            return Ok(await _goodsRep.GoodsStorageDel(id,currUserId));
+        }
+
+        /// <summary>
+        /// 物资进销存
+        /// 领用 List
+        /// </summary>
+        /// <returns></returns>
+        [HttpPost]
+        [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
+        public async Task<IActionResult> GoodsReceiveList(GoodsReceiveListDTO _dto)
+        {
+            if (_dto.PortType > 1 || _dto.PortType > 3) return Ok(JsonView(false, MsgTips.Port));
+            if (_dto.PageIndex < 1 || _dto.PageSize < 1) return Ok(JsonView(false, MsgTips.PageIndex));
+
+            return Ok(await _goodsRep.GoodsReceiveList(_dto));
+        }
+
+        /// <summary>
+        /// 物资进销存
+        /// 领用详情
+        /// </summary>
+        /// <returns></returns>
+        [HttpGet]
+        [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
+        public async Task<IActionResult> GoodsReceiveInfo(int portType, int id)
+        {
+            if (portType > 1 || portType > 3) return Ok(JsonView(false, MsgTips.Port));
+            if (id < 1) return Ok(JsonView(false, MsgTips.Id));
+
+            return Ok(await _goodsRep.GoodsReceiveInfo(portType, id));
+        }
+
+        /// <summary>
+        /// 物资进销存
+        /// 领用 OP
+        /// </summary>
+        /// <returns></returns>
+        [HttpPost]
+        [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
+        public async Task<IActionResult> GoodsReceiveOP(GoodsReceiveOPDTO _dto)
+        {
+            var vadalitor = new GoodsReceiveOPDTOValidator();
+            var vadalitorRes = await vadalitor.ValidateAsync(_dto);
+            if (!vadalitorRes.IsValid)
+            {
+                var sb = new StringBuilder();
+                foreach (var error in vadalitorRes.Errors) sb.AppendLine(error.ErrorMessage);
+                return Ok(JsonView(false, sb.ToString()));
+            }
+
+            return Ok(await _goodsRep.GoodsReceiveOP(_dto));
+        }
+
+        /// <summary>
+        /// 物资进销存
+        /// 领用 审核
+        /// </summary>
+        /// <param name="_dto"></param>
+        /// <returns></returns>
+        [HttpPost]
+        [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
+        public async Task<IActionResult> GoodsReceiveAudit(GoodsReceiveAuditDTO _dto)
+        {
+            var vadalitor = new GoodsReceiveAuditDTOValidator();
+            var vadalitorRes = await vadalitor.ValidateAsync(_dto);
+            if (!vadalitorRes.IsValid)
+            {
+                var sb = new StringBuilder();
+                foreach (var error in vadalitorRes.Errors) sb.AppendLine(error.ErrorMessage);
+                return Ok(JsonView(false, sb.ToString()));
+            }
+            int[] idArray = _dto.Label
+                                .Split(',')
+                                .Select(x => 
+                                {
+                                    int id;
+                                    if (int.TryParse(x, out id)) return id;
+                                    else return id;
+                                })
+                                .ToArray();
+            return Ok(await _goodsRep.GoodsReceiveAudit(idArray,_dto.CurrUserId,_dto.AuditEnum));
+        }
+        
+
+        /// <summary>
+        /// 物资进销存
+        /// 领用 Del
+        /// </summary>
+        /// <returns></returns>
+        [HttpDelete("{id}")]
+        [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
+        public async Task<IActionResult> GoodsReceiveDel(int id, [FromQuery] int currUserId)
+        {
+            if (id < 1) return Ok(JsonView(false, MsgTips.Id));
+            if (currUserId < 1) return Ok(JsonView(false, MsgTips.UserId));
+
+            return Ok(await _goodsRep.GoodsReceiveDel(id, currUserId));
+        }
+        #endregion
     }
 }

+ 67 - 35
OASystem/OASystem.Api/Controllers/ResourceController.cs

@@ -1599,25 +1599,14 @@ Inner Join Sys_Department as d With(Nolock) On u.DepId=d.Id Where m.Id={0} ", _m
         /// </summary>
         /// <param name="dto"></param>
         /// <returns></returns>
-        [HttpPost]
+        [HttpGet]
         [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
-        public async Task<IActionResult> QueryInvitationOfficialActivityById(QueryInvitationOfficialActivityByIdDto dto)
+        public async Task<IActionResult> QueryInvitationOfficialActivityById(int id)
         {
-            try
-            {
-                Result groupData = await _InvitationOfficialActivityDataRep.QueryInvitationOfficialActivityById(dto);
-                if (groupData.Code != 0)
-                {
-                    return Ok(JsonView(false, groupData.Msg));
-                }
-                return Ok(JsonView(true, groupData.Msg, groupData.Data));
-            }
-            catch (Exception ex)
-            {
-                return Ok(JsonView(false, "程序错误!"));
-                throw;
-            }
+            if (id < 1) return Ok(JsonView(false, "Id参数错误!"));
+            return Ok(await _InvitationOfficialActivityDataRep.Info(id));
         }
+
         /// <summary>
         /// 商邀资料操作(Status:1.新增,2.修改)
         /// </summary>
@@ -1625,23 +1614,53 @@ Inner Join Sys_Department as d With(Nolock) On u.DepId=d.Id Where m.Id={0} ", _m
         /// <returns></returns>
         [HttpPost]
         [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
-        public async Task<IActionResult> OpInvitationOfficialActivity(OpInvitationOfficialActivityDto dto)
+        public async Task<IActionResult> OpInvitationOfficialActivity([FromForm]OpInvitationOfficialActivityDto dto)
         {
+            return Ok(await _InvitationOfficialActivityDataRep.IOA_OP(dto));
+        }
+
+        /// <summary>
+        /// 商邀资料 删除文件
+        /// </summary>
+        /// <param name="id"></param>
+        /// <param name="fileName"></param>
+        /// <returns></returns>
+        [HttpDelete("{id}")]
+        [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
+        public async Task<IActionResult> InvitationOfficialActivityDelFile(int id,string fileName)
+        {
+            if (id < 1 ) return Ok(JsonView(false, "请传入有效的Id"));
+            if(string.IsNullOrEmpty(fileName)) return Ok(JsonView(false, "文件名称不能为空!"));
+
+            var info = await _sqlSugar.Queryable<Res_InvitationOfficialActivityData>().FirstAsync(x => x.Id == id);
+            if (info == null) return Ok(JsonView(false, "该条数据不存在!"));
+
+            var files = new List<string>();
             try
             {
-                Result groupData = await _InvitationOfficialActivityDataRep.OpInvitationOfficialActivity(dto);
-                if (groupData.Code != 0)
-                {
-                    return Ok(JsonView(false, groupData.Msg));
-                }
-                return Ok(JsonView(true, groupData.Msg, groupData.Data));
+                files = JsonConvert.DeserializeObject<List<string>>(info.SndFileName);
             }
-            catch (Exception ex)
+            catch (Exception) { }
+
+            if (files != null && files.Count > 0 && files.Contains(fileName)) 
             {
-                return Ok(JsonView(false, "程序错误!"));
-                throw;
+                var filePath = $@"{AppSettingsHelper.Get("GrpFileBasePath")}/商邀相关文件/{fileName}";
+                if (System.IO.File.Exists(filePath))
+                {
+                    System.IO.File.Delete(filePath);
+
+                    //更改文件值
+                    files.Remove(fileName);
+                    var fileUpd = await _sqlSugar.Updateable<Res_InvitationOfficialActivityData>()
+                                                 .SetColumns(x => x.SndFileName == JsonConvert.SerializeObject(files))
+                                                 .Where(x => x.Id != id)
+                                                 .ExecuteCommandAsync();
+                }
             }
+
+            return Ok(JsonView(true, "操作成功!"));
         }
+
         /// <summary>
         /// 删除商邀资料信息
         /// </summary>
@@ -1651,20 +1670,33 @@ Inner Join Sys_Department as d With(Nolock) On u.DepId=d.Id Where m.Id={0} ", _m
         [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
         public async Task<IActionResult> DelInvitationOfficialActivity(DelBaseDto dto)
         {
+
+            var res = await _InvitationOfficialActivityDataRep.SoftDeleteByIdAsync<Res_InvitationOfficialActivityData>(dto.Id.ToString(), dto.DeleteUserId);
+            if (!res) return Ok(JsonView(false, "删除失败"));
+
+
+            var info = await _sqlSugar.Queryable<Res_InvitationOfficialActivityData>().FirstAsync(x => x.Id == dto.Id);
+            if (info == null) return Ok(JsonView(false, "该条数据不存在!"));
+
+            var files = new List<string>();
             try
             {
-                var res = await _InvitationOfficialActivityDataRep.SoftDeleteByIdAsync<Res_InvitationOfficialActivityData>(dto.Id.ToString(), dto.DeleteUserId);
-                if (!res)
-                {
-                    return Ok(JsonView(false, "删除失败"));
-                }
-                return Ok(JsonView(true, "删除成功!"));
+                files = JsonConvert.DeserializeObject<List<string>>(info.SndFileName);
             }
-            catch (Exception ex)
+            catch (Exception) { }
+
+            if (files != null && files.Count > 0)
             {
-                return Ok(JsonView(false, "程序错误!"));
-                throw;
+                foreach (var fileName in files)
+                {
+                    var filePath = $@"{AppSettingsHelper.Get("GrpFileBasePath")}/商邀相关文件/{fileName}";
+                    if (System.IO.File.Exists(filePath))
+                    {
+                        System.IO.File.Delete(filePath);
+                    }
+                }
             }
+            return Ok(JsonView(true, "删除成功!"));
         }
         #endregion
 

+ 1 - 1
OASystem/OASystem.Api/appsettings.json

@@ -1,7 +1,7 @@
 {
   "ConnectionStrings": {
     "OA2023DB": "server=132.232.92.186;uid=sa;pwd=Yjx@158291;database=OA2023DB;MultipleActiveResultSets=True;",
-    "OA2014DB": "server=132.232.92.186;uid=sa;pwd=Yjx@158291;database=OA2014;MultipleActiveResultSets=True"
+    "OA2014DB": "server=132.232.92.186;uid=sa;pwd=Yjx@158291;database=OA2014;MultipleActiveResultSets=True;"
   },
   "JwtSecurityKey": "48d3f4fe770940a1068052f581536b81", //jwt密钥
   "UseSwagger": "true", //启用Swagger

+ 8 - 0
OASystem/OASystem.Domain/AutoMappers/_baseMappingProfile.cs

@@ -170,9 +170,11 @@ namespace OASystem.Domain.AutoMappers
             #region 签证提成录入
 
             CreateMap<VisaCommissionCreateDto, Grp_VisaCommission>();
+            CreateMap<VisaCommissionCreateView, Grp_VisaCommission>();
             #endregion
 
             #endregion
+
             #region Resource
 
             #region 车公司资料
@@ -218,6 +220,7 @@ namespace OASystem.Domain.AutoMappers
             #endregion
             #region 商邀资料
             CreateMap<OpInvitationOfficialActivityDto, Res_InvitationOfficialActivityData>();
+            CreateMap<Res_InvitationOfficialActivityData, IOAInfoView>();
             #endregion
 
             #region 公务出访
@@ -273,6 +276,11 @@ namespace OASystem.Domain.AutoMappers
             CreateMap<WageSheetMonthWorkdaysAddOrEditDto, Pm_WageIssueWorkingDay>();
             CreateMap<CalendarInfoView, Sys_Calendar>();
             CreateMap<TaskAllocationAddOrEditDto, Pm_TaskAllocation>();
+
+            #region 进销存
+            CreateMap<GoodsStorageOPDTO, Pm_GoodsStorage>();
+            CreateMap<GoodsReceiveOPDTO, Pm_GoodsReceive>();
+            #endregion
             #endregion
 
             #region 倒推表

+ 45 - 2
OASystem/OASystem.Domain/Dtos/Groups/VisaCommissionDto.cs

@@ -1,4 +1,6 @@
-using FluentValidation;
+using EyeSoft.Collections.Generic;
+using FluentValidation;
+using Org.BouncyCastle.Utilities;
 using System;
 using System.Collections.Generic;
 using System.Linq;
@@ -11,7 +13,7 @@ namespace OASystem.Domain.Dtos.Groups
     {
     }
 
-    public class VisaCommissionItemDto: PortDtoBase
+    public class VisaCommissionItemDto : PortDtoBase
     {
         public int CurrUserId { get; set; }
 
@@ -30,6 +32,47 @@ namespace OASystem.Domain.Dtos.Groups
         }
     }
 
+
+    public class VisaCommissionSaveDto
+    {
+
+        public VisaCommissionCreateView[] Items { get; set; }
+    }
+
+
+    public class VisaCommissionCreateView 
+    {
+        /// <summary>
+        /// ID
+        /// ID<1 添加
+        /// ID>0 修改
+        /// </summary>
+        public int Id { get; set; }
+        /// 用户ID
+        /// </summary>
+        public int CurrUserId { get; set; }
+        /// <summary>
+        /// 团组ID
+        /// </summary>
+        public int DiId { get; set; }
+
+        /// <summary>
+        /// 国家
+        /// </summary>
+        public string Country { get; set; }
+
+        /// <summary>
+        /// 数量
+        /// </summary>
+        public int Quantity { get; set; }
+
+        /// <summary>
+        /// 备注
+        /// </summary>
+        public string Remark { get; set; }
+    }
+
+
     /// <summary>
     /// Create Dto
     /// </summary>

+ 308 - 0
OASystem/OASystem.Domain/Dtos/PersonnelModule/GoodsDTO.cs

@@ -0,0 +1,308 @@
+using FluentValidation;
+using OASystem.Domain.Enums;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace OASystem.Domain.Dtos.PersonnelModule
+{
+    /// <summary>
+    /// 物品DTO
+    /// </summary>
+    public class GoodsDTO
+    {
+    }
+
+    #region 物品 DTO
+
+    /// <summary>
+    /// 物品List DTO
+    /// </summary>
+    public class GoodsListDTO : DtoBase
+    {
+        /// <summary>
+        /// 类型Id
+        /// 全部类型:""
+        /// 其他类型:"1,2,3,4,5"
+        /// </summary>
+        public string TypeIds { get; set; }
+        public string GoodsName { get; set; }
+    }
+
+    /// <summary>
+    /// 物品 OP  DTO
+    /// </summary>
+    public class GoodsOPDTO
+    {
+        /// <summary>
+        /// 当前用户id
+        /// </summary>
+        public int CurrUserId { get; set; }
+
+        /// <summary>
+        /// ID编号
+        /// ID > 0 Edit
+        /// ID < 1 Add
+        /// </summary>
+        public int Id { get; set; }
+
+        /// <summary>
+        /// 物品名称
+        /// </summary>
+        public string Name { get; set; }
+
+        /// <summary>
+        /// 类型
+        /// </summary>
+        public int Type { get; set; }
+
+        /// <summary>
+        /// 备注
+        /// </summary>
+        public string Remark { get; set; }
+    }
+
+    /// <summary>
+    /// 物品 OP  DTO
+    /// Validator
+    /// </summary>
+    public class GoodsOPDTOValidator : AbstractValidator<GoodsOPDTO>
+    {
+        /// <summary>
+        /// 初始化
+        /// </summary>
+        public GoodsOPDTOValidator()
+        {
+            RuleFor(x => x.CurrUserId).Must(x => x > 0).WithMessage("请传入当前登陆用户ID!");
+            RuleFor(x => x.Name).NotEmpty().WithMessage("物品名称为空!");
+            RuleFor(x => x.Type).Must(x => x > 0).WithMessage("物品所属类型未选择!");
+        }
+    }
+
+
+    #endregion
+
+
+    #region 物品入库 DTO
+
+    /// <summary>
+    /// 物品入库List DTO
+    /// </summary>
+    public class GoodsStorageListDTO : DtoBase
+    {
+        /// <summary>
+        /// 物品Id
+        /// </summary>
+        public int GoodsId { get; set; }
+    }
+
+    /// <summary>
+    /// 物品入库 操作(Create Or Edit)
+    /// </summary>
+    public class GoodsStorageOPDTO
+    {
+        /// <summary>
+        /// 当前用户id
+        /// </summary>
+        public int CurrUserId { get; set; }
+
+        /// <summary>
+        /// ID编号
+        /// ID > 0 Edit
+        /// ID < 1 Add
+        /// </summary>
+        public int Id { get; set; }
+
+        /// <summary>
+        /// 商品Id
+        /// </summary>
+        public int GoodsId { get; set; }
+
+        /// <summary>
+        /// 此次入库数量
+        /// </summary>
+        public decimal Quantity { get; set; }
+
+        /// <summary>
+        /// 此次物品单价
+        /// </summary>
+        public decimal UnitPrice { get; set; }
+
+        /// <summary>
+        /// 此次物品总价
+        /// </summary>
+        public decimal TotalPrice { get; set; }
+
+        /// <summary>
+        /// 此次供应商名称
+        /// </summary>
+        public string? SupplierName { get; set; }
+
+        /// <summary>
+        /// 此次供应商电话
+        /// </summary>
+        public string? SupplierTel { get; set; }
+
+        /// <summary>
+        /// 此次供应商地址
+        /// </summary>
+        public string? SupplierAddress { get; set; }
+
+        /// <summary>
+        /// 此次供应商来源
+        /// </summary>
+        public string? SupplierSource { get; set; }
+
+        /// <summary>
+        /// 备注
+        /// </summary>
+        public string Remark { get; set; }
+
+    }
+
+    /// <summary>
+    /// 物品入库 操作(Create Or Edit) 
+    /// Validator
+    /// </summary>
+    public class GoodsStorageOPDTOValidator : AbstractValidator<GoodsStorageOPDTO>
+    {
+        /// <summary>
+        /// 初始化
+        /// </summary>
+        public GoodsStorageOPDTOValidator()
+        {
+            RuleFor(x => x.CurrUserId).Must(x => x > 0).WithMessage("请传入当前登陆用户ID!");
+            RuleFor(x => x.GoodsId).Must(x => x > 0).WithMessage("请传入有效的物品Id!");
+            RuleFor(x => x.Quantity).Must(x => x > 0).WithMessage("请传入有效的物品数量!");
+            RuleFor(x => x.UnitPrice).Must(x => x > 0).WithMessage("请传入有效的物品单价!");
+            RuleFor(x => x.TotalPrice).Must(x => x > 0).WithMessage("请传入有效的物品价格合计!");
+        }
+    }
+
+
+
+    #endregion
+
+    #region 物品领用
+    /// <summary>
+    /// 物品领用List DTO
+    /// </summary>
+    public class GoodsReceiveListDTO : DtoBase
+    {
+
+        /// <summary>
+        /// 物品Id
+        /// </summary>
+        public int GoodsId { get; set; }
+
+        /// <summary>
+        /// 当前登录UserId
+        /// </summary>
+        public int CurrUserId { get; set; }
+    }
+
+    /// <summary>
+    /// 物品领用 OP DTO
+    /// </summary>
+    public class GoodsReceiveOPDTO
+    {
+        public int CurrUserId { get; set; }
+
+        /// <summary>
+        /// ID
+        /// Id > 0 修改
+        /// Id < 1 添加
+        /// </summary>
+        public int Id { get; set; }
+
+        /// <summary>
+        /// 团组Id
+        /// Grp_DelegationInfo Id
+        /// </summary>
+        public int GroupId { get; set; }
+
+        /// <summary>
+        /// 商品Id
+        /// Pm_GoodsInfo Id
+        /// </summary>
+        public int GoodsId { get; set; }
+
+        /// <summary>
+        /// 领用数量
+        /// </summary>
+        public decimal Quantity { get; set; }
+
+        /// <summary>
+        /// 领用原因
+        /// </summary>
+        public string? Reason { get; set; }
+
+        /// <summary>
+        /// 备注
+        /// </summary>
+        public string? Remark { get; set; }
+    }
+
+    /// <summary>
+    /// 物品领用 OP
+    /// Validator
+    /// </summary>
+    public class GoodsReceiveOPDTOValidator : AbstractValidator<GoodsReceiveOPDTO>
+    {
+        /// <summary>
+        /// 初始化
+        /// </summary>
+        public GoodsReceiveOPDTOValidator()
+        {
+            RuleFor(x => x.CurrUserId).Must(x => x > 0).WithMessage("请传入当前登陆用户ID!");
+            RuleFor(x => x.GoodsId).Must(x => x > 0).WithMessage("请传入有效的物品Id!");
+            RuleFor(x => x.Quantity).Must(x => x > 0).WithMessage("请传入有效的物品数量!");
+            RuleFor(x => x.Reason).NotEmpty().WithMessage("请填写领用原由!");
+        }
+    }
+
+    /// <summary>
+    /// 物品领用 Audit DTO
+    /// </summary>
+    public class GoodsReceiveAuditDTO
+    {
+        /// <summary>
+        /// 数据ID string
+        /// 1,2,3,4
+        /// </summary>
+        public string Label { get; set; }
+
+        /// <summary>
+        /// 用户Id
+        /// </summary>
+        public int CurrUserId { get; set; }
+
+        /// <summary>
+        /// 审核状态
+        /// </summary>
+        public GoodsAuditEnum AuditEnum { get; set; }
+    }
+
+    /// <summary>
+    /// 物品领用 Audit
+    /// Validator
+    /// </summary>
+    public class GoodsReceiveAuditDTOValidator : AbstractValidator<GoodsReceiveAuditDTO>
+    {
+        /// <summary>
+        /// 初始化
+        /// </summary>
+        public GoodsReceiveAuditDTOValidator()
+        {
+            RuleFor(x => x.CurrUserId).Must(x => x > 0).WithMessage("请传入当前登陆用户ID!");
+            RuleFor(x => x.Label).NotEmpty().WithMessage("数据ID字符串为空!");
+        }
+    }
+    #endregion
+
+
+
+
+}

+ 8 - 1
OASystem/OASystem.Domain/Dtos/Resource/InvitationOfficialActivityDataDto.cs

@@ -1,4 +1,5 @@
-using System;
+using Microsoft.AspNetCore.Http;
+using System;
 using System.Collections.Generic;
 using System.Linq;
 using System.Text;
@@ -61,6 +62,12 @@ namespace OASystem.Domain.Dtos.Resource
         /// 编号
         /// </summary>
         public int Id { get; set; }
+
+        /// <summary>
+        /// 文件集合
+        /// </summary>
+        public IFormFile[] Files { get; set; }
+
         /// <summary>
         /// 邀请方国家
         /// </summary>

+ 64 - 0
OASystem/OASystem.Domain/Entities/PersonnelModule/Pm_GoodsInfo.cs

@@ -0,0 +1,64 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace OASystem.Domain.Entities.PersonnelModule
+{
+    /// <summary>
+    /// 物品详细表
+    /// </summary>
+    [SugarTable(tableName: "Pm_GoodsInfo", tableDescription: "物品详细表")]
+    public class Pm_GoodsInfo : EntityBase
+    {
+        /// <summary>
+        /// 类型Id
+        /// SetData Id
+        /// </summary>
+        [SugarColumn(ColumnDescription = "类型Id", IsNullable = true, ColumnDataType = "int")]
+        public int Type { get; set; }
+
+        /// <summary>
+        /// 物品名称
+        /// </summary>
+        [SugarColumn(ColumnDescription = "物品名称", IsNullable = true, ColumnDataType = "varchar(100)")]
+        public string? Name { get; set; }
+
+        /// <summary>
+        /// 累计入库数量
+        /// </summary>
+        [SugarColumn(ColumnDescription = "累计入库数量", IsNullable = true, ColumnDataType = "decimal(8,2)")]
+        public decimal SQ_Total { get; set; }
+
+        /// <summary>
+        /// 累计出库数量
+        /// </summary>
+        [SugarColumn(ColumnDescription = "累计出库数量", IsNullable = true, ColumnDataType = "decimal(8,2)")]
+        public decimal OQ_Total { get; set; }
+
+        /// <summary>
+        /// 累计金额
+        /// </summary>
+        [SugarColumn(ColumnDescription = "累计金额", IsNullable = true, ColumnDataType = "decimal(10,2)")]
+        public decimal PriceTotal { get; set; }
+
+        /// <summary>
+        /// 现有库存
+        /// </summary>
+        [SugarColumn(ColumnDescription = "现有库存", IsNullable = true, ColumnDataType = "decimal(8,2)")]
+        public decimal StockQuantity { get; set; }
+
+        /// <summary>
+        /// 最后操作人
+        /// </summary>
+        [SugarColumn(ColumnDescription = "最后操作人", IsNullable = true, ColumnDataType = "int")]
+        public int LastUpdateUserId { get; set; }
+
+        /// <summary>
+        /// 最后操作时间
+        /// </summary>
+        [SugarColumn(ColumnDescription = "最后操作时间", IsNullable = true, ColumnDataType = "datetime")]
+        public DateTime LastUpdateTime { get; set; }
+    }
+}

+ 62 - 0
OASystem/OASystem.Domain/Entities/PersonnelModule/Pm_GoodsReceive.cs

@@ -0,0 +1,62 @@
+using OASystem.Domain.Enums;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace OASystem.Domain.Entities.PersonnelModule
+{
+
+    /// <summary>
+    /// 物品领用表
+    /// </summary>
+    [SugarTable(tableName: "Pm_GoodsReceive", tableDescription: "物品领用表")]
+    public class Pm_GoodsReceive: EntityBase
+    {
+        /// <summary>
+        /// 团组Id
+        /// Grp_DelegationInfo Id
+        /// </summary>
+        [SugarColumn(ColumnDescription = "团组Id", IsNullable = true, ColumnDataType = "int")]
+        public int GroupId { get; set; }
+
+        /// <summary>
+        /// 商品Id
+        /// Pm_GoodsInfo Id
+        /// </summary>
+        [SugarColumn(ColumnDescription = "商品Id", IsNullable = true, ColumnDataType = "int")]
+        public int GoodsId { get; set; }
+
+        /// <summary>
+        /// 领用数量
+        /// </summary>
+        [SugarColumn(ColumnDescription = "领用数量", IsNullable = true, ColumnDataType = "decimal(8,2)")]
+        public decimal Quantity { get; set; }
+
+        /// <summary>
+        /// 领用原因
+        /// </summary>
+        [SugarColumn(ColumnDescription = "领用原因", IsNullable = true, ColumnDataType = "varchar(200)")]
+        public string? Reason { get; set; }
+
+        /// <summary>
+        /// 审核状态
+        /// </summary>
+        [SugarColumn(ColumnDescription = "审核状态", IsNullable = true, ColumnDataType = "int")]
+        public GoodsAuditEnum AuditStatus { get; set; } = GoodsAuditEnum.Pending;
+
+        /// <summary>
+        /// 审核人 Id
+        /// Sys_User Id
+        /// </summary>
+        [SugarColumn(ColumnDescription = "审核人Id", IsNullable = true, ColumnDataType = "int")]
+        public int AuditUserId { get; set; }
+
+        /// <summary>
+        /// 审核时间
+        /// </summary>
+        [SugarColumn(ColumnDescription = "审核时间", IsNullable = true, ColumnDataType = "datetime")]
+        public DateTime AuditTime { get; set; }
+    }
+}

+ 65 - 0
OASystem/OASystem.Domain/Entities/PersonnelModule/Pm_GoodsStorage.cs

@@ -0,0 +1,65 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace OASystem.Domain.Entities.PersonnelModule
+{
+    /// <summary>
+    /// 物品入库表
+    /// </summary>
+    [SugarTable(tableName: "Pm_GoodsStorage", tableDescription: "物品入库表")]
+    public class Pm_GoodsStorage : EntityBase
+    {
+        /// <summary>
+        /// 商品Id
+        /// Pm_GoodsInfo Id
+        /// </summary>
+        [SugarColumn(ColumnDescription = "商品Id", IsNullable = true, ColumnDataType = "int")]
+        public int GoodsId { get; set; }
+
+        /// <summary>
+        /// 此次入库数量
+        /// </summary>
+        [SugarColumn(ColumnDescription = "此次入库数量", IsNullable = true, ColumnDataType = "decimal(10,2)")]
+        public decimal Quantity { get; set; }
+
+        /// <summary>
+        /// 此次物品单价
+        /// </summary>
+        [SugarColumn(ColumnDescription = "此次数量单价", IsNullable = true, ColumnDataType = "decimal(10,2)")]
+        public decimal UnitPrice { get; set; }
+
+        /// <summary>
+        /// 此次物品总价
+        /// </summary>
+        [SugarColumn(ColumnDescription = "此次物品总价", IsNullable = true, ColumnDataType = "decimal(10,2)")]
+        public decimal TotalPrice { get; set; }
+
+        /// <summary>
+        /// 此次供应商名称
+        /// </summary>
+        [SugarColumn(ColumnDescription = "此次供应商名称", IsNullable = true, ColumnDataType = "varchar(100)")]
+        public string? SupplierName { get; set; }
+
+        /// <summary>
+        /// 此次供应商电话
+        /// </summary>
+        [SugarColumn(ColumnDescription = "此次供应商电话", IsNullable = true, ColumnDataType = "varchar(30)")]
+        public string? SupplierTel { get; set; }
+
+        /// <summary>
+        /// 此次供应商地址
+        /// </summary>
+        [SugarColumn(ColumnDescription = "此次供应商地址", IsNullable = true, ColumnDataType = "varchar(200)")]
+        public string? SupplierAddress { get; set; }
+
+        /// <summary>
+        /// 此次供应商来源
+        /// </summary>
+        [SugarColumn(ColumnDescription = "此次供应商来源", IsNullable = true, ColumnDataType = "varchar(200)")]
+        public string? SupplierSource { get; set; }
+
+    }
+}

+ 8 - 0
OASystem/OASystem.Domain/Entities/Resource/Res_InvitationOfficialActivityData.cs

@@ -88,11 +88,19 @@ namespace OASystem.Domain.Entities.Resource
         /// </summary>
         [SugarColumn(IsNullable = true, ColumnDataType = "varchar(120)")]
         public string Delegation { get; set; }
+
         /// <summary>
         /// 文件地址
         /// </summary>
         [SugarColumn(IsNullable = true, ColumnDataType = "varchar(120)")]
         public string FilePath { get; set; }
+
+        /// <summary>
+        /// 文件地址
+        /// </summary>
+        [SugarColumn(IsNullable = true, ColumnDataType = "varchar(300)")]
+        public string SndFileName { get; set; }
+
         /// <summary>
         /// 修改版文件地址
         /// </summary>

+ 31 - 0
OASystem/OASystem.Domain/Enums/GoodsAuditEnum.cs

@@ -0,0 +1,31 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace OASystem.Domain.Enums
+{
+    /// <summary>
+    /// 物品审核
+    /// </summary>
+    public enum GoodsAuditEnum :int
+    {
+        /// <summary>
+        /// 待审核
+        /// </summary>
+        [Description("待审核")]
+        Pending,
+        /// <summary>
+        /// 已通过审核
+        /// </summary>
+        [Description("已通过审核")]
+        Approved,
+        /// <summary>
+        /// 已拒绝审核
+        /// </summary>
+        [Description("未通过审核")]
+        UnApproved
+    }
+}

+ 79 - 0
OASystem/OASystem.Domain/ViewModels/PersonnelModule/GoodsInfoView.cs

@@ -0,0 +1,79 @@
+using OASystem.Domain.Entities.PersonnelModule;
+using OASystem.Domain.Enums;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace OASystem.Domain.ViewModels.PersonnelModule
+{
+    /// <summary>
+    /// 物品详细信息 View
+    /// </summary>
+    public class GoodsInfoView:Pm_GoodsInfo
+    {
+    }
+
+    /// <summary>
+    /// 物品类型View
+    /// </summary>
+    [SugarTable("Sys_SetDataType")]
+    public class GoodsTypeView
+    {
+        /// <summary>
+        /// 物品类型Id
+        /// </summary>
+        [SugarColumn(IsPrimaryKey = true, IsIdentity = true)]
+        public int Id { get; set; }
+
+        public string Name { get; set; }
+
+        [Navigate(NavigateType.OneToMany, nameof(GoodsSubTypeView.STid))]
+        public List<GoodsSubTypeView> SubTypeItems { get; set; }
+
+        public string Remark { get; set; }
+        
+        public int IsDel { get; set; }
+    }
+
+    /// <summary>
+    /// 物品Sub类型
+    /// View
+    /// </summary>
+    [SugarTable("Sys_SetData")]
+    public class GoodsSubTypeView
+    {
+        /// <summary>
+        /// 物品类型Id
+        /// </summary>
+        [SugarColumn(IsPrimaryKey = true, IsIdentity = true)]
+        public int Id { get; set; }
+
+        public int STid { get; set; }
+
+        public string Name { get; set; }
+
+        public int IsDel { get; set; }
+    }
+
+
+    public class GoodsReceiveListView
+    {
+        public int Id { get; set; }
+        public int GroupId { get; set; }
+        public int GoodsId { get; set; }
+        public string GoodsName { get; set; }
+        public decimal Quantity { get; set; }
+        public string Reason { get; set; }
+        public string Remark { get; set; }
+        public GoodsAuditEnum AuditStatus { get; set; }
+        public string AuditStatusText { get { return AuditStatus.GetEnumDescription(); } }
+        public int AuditUserId { get; set; }
+        public string AuditUserName { get; set; }
+        public DateTime AuditTime { get; set; }
+        public string CreateUserName { get; set; }
+        public DateTime CreateTime { get; set; }
+
+    }
+}

+ 117 - 1
OASystem/OASystem.Domain/ViewModels/Resource/InvitationOfficialActivityDataView.cs

@@ -1,9 +1,11 @@
-using OASystem.Domain.Entities;
+
+using OASystem.Domain.Entities;
 using OASystem.Domain.Entities.Resource;
 using System;
 using System.Collections.Generic;
 using System.Linq;
 using System.Text;
+using System.Text.Json;
 using System.Threading.Tasks;
 
 namespace OASystem.Domain.ViewModels.Resource
@@ -14,4 +16,118 @@ namespace OASystem.Domain.ViewModels.Resource
         public string CreateUserName { get; set; }
         public string DelegationStr { get;set; }
     }
+
+    public class IOAInfoView
+    {
+        public int Id { get; set; }
+
+        // <summary>
+        /// 邀请方国家
+        /// </summary>
+        public string Country { get; set; }
+        /// <summary>
+        /// 城市
+        /// </summary>
+        public string City { get; set; }
+        /// <summary>
+        /// 邀请方名称
+        /// </summary>
+        public string UnitName { get; set; }
+        /// <summary>
+        ///邀请方官网
+        /// </summary>
+        public string UnitWeb { get; set; }
+        /// <summary>
+        /// 涉及领域
+        /// </summary>
+        public string Field { get; set; }
+        /// <summary>
+        /// 邀请方地址
+        /// </summary>
+        public string Address { get; set; }
+        /// <summary>
+        /// 邀请方信息
+        /// </summary>
+        public string UnitInfo { get; set; }
+        /// <summary>
+        /// 联系人
+        /// </summary>
+        public string Contact { get; set; }
+        /// <summary>
+        /// 职务
+        /// </summary>
+        public string Job { get; set; }
+        /// <summary>
+        /// 联系电话
+        /// </summary>
+        public string Tel { get; set; }
+        /// <summary>
+        /// 电子邮箱
+        /// </summary>
+        public string Email { get; set; }
+        /// <summary>
+        /// 微信
+        /// </summary>
+        public string WeChat { get; set; }
+        /// <summary>
+        /// fb
+        /// </summary>
+        public string FaceBook { get; set; }
+        /// <summary>
+        /// ins
+        /// </summary>
+        public string Ins { get; set; }
+        /// <summary>
+        /// 团名
+        /// </summary>
+        public string Delegation { get; set; }
+
+        /// <summary>
+        /// 文件地址
+        /// </summary>
+        public string SndFileName { get; set; }
+
+        /// <summary>
+        /// 修改版文件地址
+        /// </summary>
+        public string[] SndFilePathItem
+        {
+            get
+            {
+                var urls = new List<string>();
+                if (string.IsNullOrEmpty(SndFileName)) return urls.ToArray();
+
+                var filePath = @$"http://132.232.92.186:24/Office/GrpFile/商邀相关文件/";
+                try
+                {
+                    var strs = JsonSerializer.Deserialize<List<string>>(SndFileName);
+                    foreach (var str in strs)
+                    {
+                        urls.Add(@$"{filePath}{str}");
+                    }
+                }
+                catch (Exception ex)
+                {
+                    urls.Add(@$"{filePath}{SndFileName}");
+                }
+                return urls.ToArray();
+            }
+        }
+
+        /// <summary>
+        /// 传真号码
+        /// </summary>
+        public string Fax { get; set; }
+
+        /// <summary>
+        /// 其他信息
+        /// </summary>
+        public string OtherInfo { get; set; }
+
+        /// <summary>
+        /// 背景
+        /// </summary>
+        public string Background { get; set; }
+    }
+
 }

+ 52 - 0
OASystem/OASystem.Infrastructure/Repositories/Groups/VisaCommissionRepository.cs

@@ -5,6 +5,7 @@ using OASystem.Domain.ViewModels.Groups;
 using System;
 using System.Collections.Generic;
 using System.Linq;
+using System.Runtime;
 using System.Text;
 using System.Threading.Tasks;
 
@@ -75,6 +76,57 @@ namespace OASystem.Infrastructure.Repositories.Groups
         }
 
 
+        /// <summary>
+        /// Save
+        /// </summary>
+        /// <returns></returns>
+        public async Task<JsonView> Save(VisaCommissionSaveDto _dto)
+        {
+            var data = _mapper.Map<List<Grp_VisaCommission>>(_dto.Items);
+            for (int i = 0; i < data.Count; i++)
+            {
+                data[i].CreateUserId = _dto.Items.FirstOrDefault()?.CurrUserId ?? 0;
+                data[i].UId = _dto.Items.FirstOrDefault()?.CurrUserId ?? 0;
+            }
+
+            //添加数据
+            var addData = data.Where(x => x.Id < 1).ToList();
+            //修改数据
+            var updData = data.Where(x => x.Id > 0).ToList();
+
+            _sqlSugar.BeginTran();
+            bool status = false;
+            if (addData.Count > 0) { 
+            
+                var addCount = await _sqlSugar.Insertable<Grp_VisaCommission>(addData).ExecuteCommandAsync();
+                if (addCount > 0) status=true;
+            }
+
+            if (updData.Count > 0)
+            {
+                var updCount =  await _sqlSugar.Updateable<Grp_VisaCommission>(updData)
+                                               .UpdateColumns(x => new
+                                               {
+                                                   x.Country,
+                                                   x.Quantity,
+                                                   x.Remark
+                                               })
+                                               .WhereColumns(x => x.Id)
+                                               .ExecuteCommandAsync();
+                if (updCount > 0) status = true;
+            }
+
+            var jv = new JsonView() { Code = StatusCodes.Status200OK, Msg = "操作成功!" };
+            if (status) _sqlSugar.CommitTran();
+            else
+            {
+                _sqlSugar.RollbackTran();
+                jv.Code = StatusCodes.Status400BadRequest;
+                jv.Msg = "操作失败";
+            }
+
+            return jv;
+        }
         /// <summary>
         /// Create
         /// </summary>

+ 6 - 1
OASystem/OASystem.Infrastructure/Repositories/Groups/VisaPriceRepository.cs

@@ -357,7 +357,12 @@ From Grp_VisaInfo as v With(Nolock) left Join Grp_CreditCardPayment as c With(No
 
                 if (dto.Status == 1)//添加
                 {
-                    Grp_VisaInfo grp_Visa = _sqlSugar.Queryable<Grp_VisaInfo>().First(a => a.IsDel == 0 && a.VisaCurrency == dto.VisaCurrency && a.VisaPrice == dto.VisaPrice && a.VisaClient == dto.VisaClient);
+                    Grp_VisaInfo grp_Visa = _sqlSugar.Queryable<Grp_VisaInfo>().First(a => a.IsDel == 0 &&   
+                                                                                           a.VisaDescription.Equals(dto.VisaDescription) && 
+                                                                                           a.VisaCurrency == dto.VisaCurrency && 
+                                                                                           a.VisaPrice == dto.VisaPrice && 
+                                                                                           a.VisaClient == dto.VisaClient
+                                                                                     );
                     if (grp_Visa != null)
                     {
                         return result = new Result() { Code = -1, Msg = "该笔费用已存在,请勿重复添加!" };

+ 757 - 0
OASystem/OASystem.Infrastructure/Repositories/PersonnelModule/GoodsRepository.cs

@@ -0,0 +1,757 @@
+using OASystem.Domain.Entities.PersonnelModule;
+using OASystem.Domain.ViewModels.PersonnelModule;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using AutoMapper;
+using OASystem.Domain.Dtos.PersonnelModule;
+using SqlSugar;
+using NPOI.SS.Formula.Functions;
+using OASystem.Domain.Entities.Groups;
+
+namespace OASystem.Infrastructure.Repositories.PersonnelModule
+{
+    /// <summary>
+    /// 物品进销存 
+    /// 仓储
+    /// </summary>
+    public class GoodsRepository : BaseRepository<Pm_GoodsInfo, GoodsInfoView>
+    {
+        private readonly IMapper _mapper;
+        private JsonView _jv;
+        public GoodsRepository(SqlSugarClient sqlSugar, IMapper mapper) : base(sqlSugar)
+        {
+            _mapper = mapper;
+            _jv = new JsonView() { Code = StatusCodes.Status400BadRequest, Msg = "操作失败!" };
+        }
+
+        /// <summary>
+        /// 基础数据
+        /// </summary>
+        /// <returns></returns>
+        public async Task<JsonView> InitDataSource()
+        {
+
+            var typeData = await _sqlSugar.Queryable<GoodsTypeView>()
+                                          .Includes(x => x.SubTypeItems.Where(z => z.IsDel == 0)
+                                                                       //.Select(z => new {
+                                                                       //     z.Id,
+                                                                       //     z.STid,
+                                                                       //     z.Name
+                                                                       //})
+                                                                       .ToList())
+                                          .Where(x => x.IsDel == 0 &&
+                                                      x.Remark.Equals("GoodsType"))
+                                          //.Select(x => new { 
+                                          //        x.Id,
+                                          //        x.Name,
+                                          //        x.SubTypeItems
+                                          //})
+                                          .ToListAsync();
+
+            var groupData = await _sqlSugar.Queryable<Grp_DelegationInfo>()
+                                           .Where(x => x.IsDel == 0)
+                                           .Select(x => new
+                                           {
+                                               id = x.Id,
+                                               groupName = x.TeamName
+                                           })
+                                           .OrderByDescending(x => x.id)
+                                           .ToListAsync();
+
+
+            _jv.Code = StatusCodes.Status200OK;
+            _jv.Data = new { goodsTypeData = typeData, groupNameData = groupData };
+            _jv.Msg = $"操作成功";
+            return _jv;
+        }
+
+        /// <summary>
+        /// 物品列表
+        /// </summary>
+        /// <param name="_dto"></param>
+        /// <returns></returns>
+        public async Task<JsonView> GoodsList(GoodsListDTO _dto)
+        {
+            var ids = new List<int>();
+            if (!string.IsNullOrEmpty(_dto.TypeIds))
+            {
+                var strArray = _dto.TypeIds.Split(',');
+                foreach (var str in strArray)
+                {
+                    if (int.TryParse(str, out int id))
+                    {
+                        ids.Add(id);
+                    }
+                }
+            }
+
+            RefAsync<int> total = 0;
+            var data = await _sqlSugar.Queryable<Pm_GoodsInfo>()
+                                      .LeftJoin<Sys_SetData>((gi, sd) => gi.Type == sd.Id)
+                                      .LeftJoin<Sys_Users>((gi, sd, u) => gi.LastUpdateUserId == u.Id)
+                                      .Where((gi, sd, u) => gi.IsDel == 0)
+                                      .WhereIF(ids.Count > 0, (gi, sd, u) => ids.Contains(gi.Type))
+                                      .WhereIF(!string.IsNullOrEmpty(_dto.GoodsName), (gi, sd, u) => gi.Name.Contains(_dto.GoodsName))
+                                      .Select((gi, sd, u) => new
+                                      {
+                                          gi.Id,
+                                          gi.Name,
+                                          gi.Type,
+                                          TypeName = sd.Name,
+                                          gi.StockQuantity,
+                                          LastUpdateUserName = u.CnName,
+                                          gi.LastUpdateTime,
+                                          gi.Remark,
+                                      })
+                                      .OrderByDescending(gi => gi.LastUpdateTime)
+                                      .ToPageListAsync(_dto.PageIndex, _dto.PageSize, total);
+
+
+            _jv.Code = StatusCodes.Status200OK;
+            _jv.Data = data;
+            _jv.Count = total;
+            _jv.Msg = $"操作成功";
+            return _jv;
+        }
+
+        /// <summary>
+        /// 物品Info
+        /// </summary>
+        /// <param name="_dto"></param>
+        /// <returns></returns>
+        public async Task<JsonView> GoodsInfo(int portType, int id)
+        {
+            var data = await _sqlSugar.Queryable<Pm_GoodsInfo>()
+                                      .LeftJoin<Sys_SetData>((gi, sd) => gi.Type == sd.Id)
+                                      .LeftJoin<Sys_Users>((gi, sd, u1) => gi.LastUpdateUserId == u1.Id)
+                                      .LeftJoin<Sys_Users>((gi, sd, u1, u2) => gi.CreateUserId == u2.Id)
+                                      .Where((gi, sd, u1, u2) => gi.IsDel == 0 && gi.Id == id)
+                                      .Select((gi, sd, u1, u2) => new
+                                      {
+                                          gi.Id,
+                                          gi.Name,
+                                          gi.Type,
+                                          TypeName = sd.Name,
+                                          gi.SQ_Total,
+                                          gi.OQ_Total,
+                                          gi.PriceTotal,
+                                          gi.StockQuantity,
+                                          gi.Remark,
+                                          LastUpdateUserName = u1.CnName,
+                                          gi.LastUpdateTime,
+                                          CreateUserName = u2.CnName,
+                                          gi.CreateTime,
+                                      })
+                                      .FirstAsync();
+
+            _jv.Code = StatusCodes.Status200OK;
+            _jv.Data = data;
+            _jv.Msg = $"操作成功";
+            return _jv;
+        }
+
+        /// <summary>
+        /// 物品 OP(Create Or Edit)
+        /// </summary>
+        /// <param name="_dto"></param>
+        /// <returns></returns>
+        public async Task<JsonView> GoodsOP(GoodsOPDTO _dto)
+        {
+            var info = new Pm_GoodsInfo()
+            {
+                Id = _dto.Id,
+                Name = _dto.Name,
+                Type = _dto.Type,
+                SQ_Total = 0,
+                OQ_Total = 0,
+                PriceTotal = 0,
+                StockQuantity = 0,
+                Remark = _dto.Remark,
+                LastUpdateUserId = _dto.CurrUserId,
+                LastUpdateTime = DateTime.Now,
+                CreateUserId = _dto.CurrUserId
+            };
+
+            if (_dto.Id > 0) //Edit
+            {
+                var upd = await _sqlSugar.Updateable<Pm_GoodsInfo>(info)
+                                         .UpdateColumns(x => new
+                                         {
+                                             x.Name,
+                                             x.Type,
+                                             x.Remark,
+                                             x.LastUpdateUserId,
+                                             x.LastUpdateTime,
+                                         })
+                                         .ExecuteCommandAsync();
+                if (upd > 0)
+                {
+                    _jv.Msg = $"修改成功!";
+                    _jv.Code = StatusCodes.Status200OK;
+                    return _jv;
+                }
+            }
+            else if (_dto.Id < 1) //添加
+            {
+                var selectInfo = await _sqlSugar.Queryable<Pm_GoodsInfo>().FirstAsync(x => x.Name.Equals(info.Name));
+                if (selectInfo != null)
+                {
+                    _jv.Msg = $"“{info.Name}”该物品已存在,请勿重新添加!";
+                    return _jv;
+                }
+
+                var add = await _sqlSugar.Insertable<Pm_GoodsInfo>(info).ExecuteCommandAsync();
+                if (add > 0)
+                {
+                    _jv.Msg = $"添加成功!";
+                    _jv.Code = StatusCodes.Status200OK;
+                    return _jv;
+                }
+            }
+            return _jv;
+        }
+
+        /// <summary>
+        /// 物品 Del
+        /// </summary>
+        /// <param name="id"></param>
+        /// <param name="currUserId"></param>
+        /// <returns></returns>
+        public async Task<JsonView> GoodsDel(int id, int currUserId)
+        {
+            _sqlSugar.BeginTran();
+
+            var goods = await _sqlSugar.Updateable<Pm_GoodsInfo>()
+                                       .SetColumns(x => new Pm_GoodsInfo()
+                                       {
+                                           IsDel = 1,
+                                           DeleteUserId = currUserId,
+                                           DeleteTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")
+                                       })
+                                       .Where(x => x.Id == id)
+                                       .ExecuteCommandAsync();
+            if (goods < 1)
+            {
+                _sqlSugar.RollbackTran();
+                _jv.Msg = $"操作失败";
+                return _jv;
+            }
+
+            var goodsStorage = await _sqlSugar.Updateable<Pm_GoodsStorage>()
+                                              .SetColumns(x => new Pm_GoodsStorage()
+                                              {
+                                                  IsDel = 1,
+                                                  DeleteUserId = currUserId,
+                                                  DeleteTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")
+                                              })
+                                              .Where(x => x.Id == id)
+                                              .ExecuteCommandAsync();
+
+            var goodsReceive = await _sqlSugar.Updateable<Pm_GoodsReceive>()
+                                              .SetColumns(x => new Pm_GoodsReceive()
+                                              {
+                                                  IsDel = 1,
+                                                  DeleteUserId = currUserId,
+                                                  DeleteTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")
+                                              })
+                                              .Where(x => x.Id == id)
+                                              .ExecuteCommandAsync();
+            _sqlSugar.CommitTran();
+            _jv.Code = StatusCodes.Status200OK;
+            _jv.Msg = $"操作成功!";
+            return _jv;
+        }
+
+        /// <summary>
+        /// 物品入库列表
+        /// </summary>
+        /// <param name="_dto"></param>
+        /// <returns></returns>
+        public async Task<JsonView> GoodsStorageList(GoodsStorageListDTO _dto)
+        {
+            RefAsync<int> total = 0;
+            var data = await _sqlSugar.Queryable<Pm_GoodsStorage>()
+                                      .LeftJoin<Pm_GoodsInfo>((gs, gi) => gs.GoodsId == gi.Id)
+                                      .LeftJoin<Sys_Users>((gs, gi, u) => gs.CreateUserId == u.Id)
+                                      .Where((gs, gi, u) => gs.IsDel == 0)
+                                      .WhereIF(_dto.GoodsId > 0, (gs, gi, u) => gs.GoodsId == _dto.GoodsId)
+                                      .Select((gs, gi, u) => new
+                                      {
+                                          gs.Id,
+                                          gs.GoodsId,
+                                          GoodsName = gi.Name,
+                                          gs.Quantity,
+                                          gs.UnitPrice,
+                                          gs.TotalPrice,
+                                          gs.SupplierName,
+                                          gs.SupplierTel,
+                                          gs.SupplierAddress,
+                                          gs.SupplierSource,
+                                          CreateUserName = u.CnName,
+                                          gs.CreateTime,
+                                      })
+                                      .OrderByDescending(gs => gs.CreateTime)
+                                      .ToPageListAsync(_dto.PageIndex, _dto.PageSize, total);
+
+
+            _jv.Code = StatusCodes.Status200OK;
+            _jv.Data = data;
+            _jv.Count = total;
+            _jv.Msg = $"操作成功";
+            return _jv;
+        }
+
+        /// <summary>
+        /// 物品入库详情
+        /// </summary>
+        /// <param name="id"></param>
+        /// <returns></returns>
+        public async Task<JsonView> GoodsStorageInfo(int portType, int id)
+        {
+            var data = await _sqlSugar.Queryable<Pm_GoodsStorage>()
+                                      .LeftJoin<Pm_GoodsInfo>((gs, gi) => gs.GoodsId == gi.Id)
+                                      .LeftJoin<Sys_Users>((gs, gi, u) => gs.CreateUserId == u.Id)
+                                      .Where((gs, gi, u) => gs.IsDel == 0)
+                                      .WhereIF(id > 0, (gs, gi, u) => gs.GoodsId == id)
+                                      .Select((gs, gi, u) => new
+                                      {
+                                          gs.Id,
+                                          gs.GoodsId,
+                                          GoodsName = gi.Name,
+                                          gs.Quantity,
+                                          gs.UnitPrice,
+                                          gs.TotalPrice,
+                                          gs.SupplierName,
+                                          gs.SupplierTel,
+                                          gs.SupplierAddress,
+                                          gs.SupplierSource,
+                                          CreateUserName = u.CnName,
+                                          gs.CreateTime,
+                                          gs.Remark
+                                      })
+                                      .FirstAsync();
+
+            _jv.Msg = $"操作成功!";
+            _jv.Code = StatusCodes.Status200OK;
+            _jv.Data = data;
+            return _jv;
+        }
+
+        /// <summary>
+        /// 物品入库 操作(Create Or Edit)
+        /// </summary>
+        /// <param name="id"></param>
+        /// <returns></returns>
+        public async Task<JsonView> GoodsStorageOP(GoodsStorageOPDTO _dto)
+        {
+            var info = _mapper.Map<Pm_GoodsStorage>(_dto);
+            info.CreateUserId = _dto.CurrUserId;
+
+            decimal editAgoQauntity = 0.00M,
+                    editAgoTotalPrice = 0.00M;
+
+            _sqlSugar.BeginTran();
+            if (info.Id > 0) //修改
+            {
+                var selectInfo = await _sqlSugar.Queryable<Pm_GoodsStorage>()
+                                                .Where(x => x.Id == _dto.Id)
+                                                .FirstAsync();
+                editAgoQauntity = selectInfo.Quantity;
+                editAgoTotalPrice = selectInfo.TotalPrice;
+
+                var stoageEdit = await _sqlSugar.Updateable<Pm_GoodsStorage>(info)
+                                                .UpdateColumns(x => new
+                                                {
+                                                    x.Quantity,
+                                                    x.UnitPrice,
+                                                    x.TotalPrice,
+                                                    x.SupplierName,
+                                                    x.SupplierTel,
+                                                    x.SupplierAddress,
+                                                    x.SupplierSource,
+                                                })
+                                                .Where(x => x.Id == _dto.Id)
+                                                .ExecuteCommandAsync();
+                if (stoageEdit < 1)
+                {
+                    _sqlSugar.RollbackTran();
+                    _jv.Msg = $"修改失败!";
+                    return _jv;
+                }
+            }
+            else if (info.Id < 1) //添加
+            {
+                var stoageAdd = await _sqlSugar.Insertable(info).ExecuteCommandAsync();
+                if (stoageAdd < 1)
+                {
+                    _sqlSugar.RollbackTran();
+                    _jv.Msg = $"添加失败!";
+                    return _jv;
+                }
+            }
+            var goodsInfo = await _sqlSugar.Queryable<Pm_GoodsInfo>().FirstAsync(x => x.Id == info.GoodsId);
+            goodsInfo.SQ_Total = goodsInfo.SQ_Total - editAgoQauntity + info.Quantity;
+            goodsInfo.StockQuantity = goodsInfo.StockQuantity - editAgoQauntity + info.Quantity;
+            goodsInfo.PriceTotal = goodsInfo.PriceTotal - editAgoTotalPrice + info.TotalPrice;
+            goodsInfo.LastUpdateUserId = _dto.CurrUserId;
+            goodsInfo.LastUpdateTime = DateTime.Now;
+
+            var goodsEdit = await _sqlSugar.Updateable(goodsInfo)
+                                           .UpdateColumns(x => new
+                                           {
+                                               x.SQ_Total,
+                                               x.StockQuantity,
+                                               x.PriceTotal,
+                                               x.LastUpdateUserId,
+                                               x.LastUpdateTime,
+                                           })
+                                           .Where(x => x.Id == info.GoodsId)
+                                           .ExecuteCommandAsync();
+            if (goodsEdit > 0)
+            {
+                _sqlSugar.CommitTran();
+                _jv.Msg = $"操作成功!";
+                _jv.Code = StatusCodes.Status200OK;
+                return _jv;
+            }
+
+            _sqlSugar.RollbackTran();
+            _jv.Msg = $"操作失败!";
+            return _jv;
+        }
+
+        /// <summary>
+        /// 物品入库 Del
+        /// </summary>
+        /// <param name="id"></param>
+        /// <returns></returns>
+        public async Task<JsonView> GoodsStorageDel(int id, int userId)
+        {
+            var storageInfo = await _sqlSugar.Queryable<Pm_GoodsStorage>()
+                                                 .Where(x => x.Id == id)
+                                                 .FirstAsync();
+            if (storageInfo == null) return _jv;
+
+            decimal delAgoQauntity = storageInfo.Quantity,
+                    delAgoTotalPrice = storageInfo.TotalPrice;
+            int goodsId = storageInfo.GoodsId;
+
+            _sqlSugar.BeginTran();
+
+            var storageDel = await _sqlSugar.Updateable<Pm_GoodsStorage>()
+                                           .SetColumns(x => new Pm_GoodsStorage
+                                           {
+                                               DeleteUserId = userId,
+                                               DeleteTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
+                                               IsDel = 1
+                                           })
+                                           .Where(x => x.Id == id)
+                                           .ExecuteCommandAsync();
+            if (storageDel < 1)
+            {
+                _sqlSugar.RollbackTran();
+                _jv.Msg = $"操作失败!";
+                return _jv;
+            }
+
+            var goodsInfo = await _sqlSugar.Queryable<Pm_GoodsInfo>().FirstAsync(x => x.Id == goodsId);
+            goodsInfo.SQ_Total = goodsInfo.SQ_Total - delAgoQauntity;
+            goodsInfo.StockQuantity = goodsInfo.StockQuantity - delAgoQauntity;
+            goodsInfo.PriceTotal = goodsInfo.PriceTotal - delAgoTotalPrice;
+            goodsInfo.LastUpdateUserId = userId;
+            goodsInfo.LastUpdateTime = DateTime.Now;
+
+            var goodsEdit = await _sqlSugar.Updateable(goodsInfo)
+                                           .UpdateColumns(x => new
+                                           {
+                                               x.SQ_Total,
+                                               x.StockQuantity,
+                                               x.PriceTotal,
+                                               x.LastUpdateUserId,
+                                               x.LastUpdateTime,
+                                           })
+                                           .Where(x => x.Id == goodsId)
+                                           .ExecuteCommandAsync();
+            if (goodsEdit > 0)
+            {
+                _sqlSugar.CommitTran();
+                _jv.Msg = $"操作成功!";
+                _jv.Code = StatusCodes.Status200OK;
+                return _jv;
+            }
+
+            _sqlSugar.RollbackTran();
+            _jv.Msg = $"操作失败!";
+            return _jv;
+        }
+
+
+        /// <summary>
+        /// 物品领用列表
+        /// </summary>
+        /// <param name="_dto"></param>
+        /// <returns></returns>
+        public async Task<JsonView> GoodsReceiveList(GoodsReceiveListDTO _dto)
+        {
+            RefAsync<int> total = 0;
+            var data = await _sqlSugar.Queryable<Pm_GoodsReceive>()
+                                      .LeftJoin<Pm_GoodsInfo>((gr, gi) => gr.GoodsId == gi.Id)
+                                      .LeftJoin<Sys_Users>((gr, gi, u1) => gr.AuditUserId == u1.Id)
+                                      .LeftJoin<Sys_Users>((gr, gi, u1, u2) => gr.CreateUserId == u2.Id)
+                                      .Where((gr, gi, u1, u2) => gr.IsDel == 0)
+                                      .WhereIF(_dto.GoodsId > 0, (gr, gi, u1, u2) => gr.GoodsId == _dto.GoodsId)
+                                      .WhereIF(_dto.GoodsId > 0, (gr, gi, u1, u2) => gr.CreateUserId == _dto.CurrUserId)
+                                      .Select((gr, gi, u1, u2) => new GoodsReceiveListView
+                                      {
+                                          Id = gr.Id,
+                                          GroupId = gr.GroupId,
+                                          GoodsId = gr.GoodsId,
+                                          GoodsName = gi.Name,
+                                          Quantity = gr.Quantity,
+                                          Reason = gr.Reason,
+                                          Remark = gr.Remark,
+                                          AuditStatus = gr.AuditStatus,
+                                          //AuditStatusText = gr.AuditStatus.GetEnumDescription(),
+                                          AuditUserId = gr.AuditUserId,
+                                          AuditUserName = u1.CnName,
+                                          AuditTime = gr.AuditTime,
+                                          CreateUserName = u2.CnName,
+                                          CreateTime = gr.CreateTime
+                                      })
+                                      .OrderByDescending(gr => gr.CreateTime)
+                                      .ToPageListAsync(_dto.PageIndex, _dto.PageSize, total);
+
+            _jv.Code = StatusCodes.Status200OK;
+            _jv.Data = data;
+            _jv.Count = total;
+            _jv.Msg = $"操作成功";
+            return _jv;
+        }
+
+        /// <summary>
+        /// 物品领用详情
+        /// </summary>
+        /// <param name="portType"></param>
+        /// <param name="id"></param>
+        /// <returns></returns>
+        public async Task<JsonView> GoodsReceiveInfo(int portType, int id)
+        {
+            var data = await _sqlSugar.Queryable<Pm_GoodsReceive>()
+                                      .LeftJoin<Pm_GoodsInfo>((gr, gi) => gr.GoodsId == gi.Id)
+                                      .LeftJoin<Sys_Users>((gr, gi, u1) => gr.AuditUserId == u1.Id)
+                                      .LeftJoin<Sys_Users>((gr, gi, u1, u2) => gr.CreateUserId == u2.Id)
+                                      .Where((gr, gi, u1, u2) => gr.IsDel == 0)
+                                      .WhereIF(id > 0, (gr, gi, u1, u2u) => gr.GoodsId == id)
+                                      .Select((gr, gi, u1, u2) => new
+                                      {
+                                          gr.Id,
+                                          gr.GroupId,
+                                          gr.GoodsId,
+                                          GoodsName = gi.Name,
+                                          gr.Quantity,
+                                          gr.Reason,
+                                          gr.Remark,
+                                          gr.AuditStatus,
+                                          AuditStatusText = gr.AuditStatus.GetDescription(),
+                                          gr.AuditUserId,
+                                          AuditUserName = u1.CnName,
+                                          gr.AuditTime,
+                                          CreateUserName = u2.CnName,
+                                          gr.CreateTime
+                                      })
+                                      .FirstAsync();
+
+
+            _jv.Code = StatusCodes.Status200OK;
+            _jv.Data = data;
+            _jv.Msg = $"操作成功";
+            return _jv;
+        }
+
+        /// <summary>
+        /// 物品领用 OP(Add Or Edit)
+        /// </summary>
+        /// <param name="id"></param>
+        /// <returns></returns>
+        public async Task<JsonView> GoodsReceiveOP(GoodsReceiveOPDTO _dto)
+        {
+            var info = _mapper.Map<Pm_GoodsReceive>(_dto);
+            info.CreateUserId = _dto.CurrUserId;
+            _sqlSugar.BeginTran();
+
+            //物品现有库存
+            var stockQuantity = _sqlSugar.Queryable<Pm_GoodsInfo>()
+                                               .First(x => x.Id == info.GoodsId)
+                                               ?.StockQuantity;
+
+            //待审核 该物品数量
+            var waitAuditQuantity = await _sqlSugar.Queryable<Pm_GoodsReceive>()
+                                                   .Where(x => x.IsDel == 0 &&
+                                                               x.GoodsId == _dto.GoodsId &&
+                                                               x.AuditStatus == GoodsAuditEnum.Pending
+                                                         )
+                                                   .SumAsync(x => x.Quantity);
+            if (info.Id > 0) //修改
+            {
+                //审核验证
+                var selectInfo = await _sqlSugar.Queryable<Pm_GoodsReceive>().FirstAsync(x => x.Id == info.Id);
+                if (selectInfo.AuditStatus == GoodsAuditEnum.Approved)
+                {
+                    _sqlSugar.RollbackTran();
+                    _jv.Msg = $"该条数据已通过审核,不可更改!";
+                    return _jv;
+                }
+                //物品数量验证
+                decimal editAfterQuantity = waitAuditQuantity - selectInfo.Quantity + info.Quantity;
+                if (editAfterQuantity > stockQuantity)
+                {
+                    _sqlSugar.RollbackTran();
+                    _jv.Msg = $"该物品现有库存不足,不可更改!请联系采购人员购买!";
+                    return _jv;
+                }
+
+                var edit = await _sqlSugar.Updateable(info)
+                                          .UpdateColumns(x => new
+                                          {
+                                              x.GroupId,
+                                              x.Quantity,
+                                              x.Reason,
+                                              x.Remark,
+                                          })
+                                          .Where(x => x.Id == info.Id)
+                                          .ExecuteCommandAsync();
+                if (edit > 0)
+                {
+                    _sqlSugar.CommitTran();
+                    _jv.Msg = $"操作成功!";
+                    _jv.Code = StatusCodes.Status200OK;
+                    return _jv;
+                }
+            }
+            else if (info.Id < 1) //添加
+            {
+                //物品数量验证
+                decimal addAgoQuantity = waitAuditQuantity + info.Quantity;
+                if (addAgoQuantity > stockQuantity)
+                {
+                    _sqlSugar.RollbackTran();
+                    _jv.Msg = $"该物品现有库存不足,不可更改!请联系采购人员购买!";
+                    return _jv;
+                }
+
+                var add = await _sqlSugar.Insertable(info).ExecuteCommandAsync();
+                if (add > 0)
+                {
+                    _sqlSugar.CommitTran();
+                    _jv.Msg = $"操作成功!";
+                    _jv.Code = StatusCodes.Status200OK;
+                    return _jv;
+                }
+            }
+            _sqlSugar.RollbackTran();
+            return _jv;
+        }
+
+        /// <summary>
+        /// 物品领用 Audit
+        /// </summary>
+        /// <param name="idArray"></param>
+        /// <param name="userId"></param>
+        /// <param name="auditEnum"></param>
+        /// <returns></returns>
+        public async Task<JsonView> GoodsReceiveAudit(int[] idArray, int userId, GoodsAuditEnum auditEnum)
+        {
+            if (idArray.Length < 1) return _jv;
+
+            //TODO: 审核权限验证
+
+            _sqlSugar.BeginTran();
+            var receiveInfos = await _sqlSugar.Queryable<Pm_GoodsReceive>()
+                                              .Where(x => x.IsDel == 0 && idArray.Contains(x.Id))
+                                              .ToListAsync();
+
+            bool status = true;
+            foreach (var id in idArray)
+            {
+                var currInfo = receiveInfos.Find(x => x.Id == id);
+                var edit = await _sqlSugar.Updateable<Pm_GoodsReceive>()
+                                          .SetColumns(x => new Pm_GoodsReceive()
+                                          {
+                                              AuditStatus = auditEnum,
+                                              AuditUserId = userId,
+                                              AuditTime = DateTime.Now,
+                                          })
+                                          .Where(x => x.Id == id)
+                                          .ExecuteCommandAsync();
+                if (edit < 1) status = false;
+
+                var goodsInfo = await _sqlSugar.Queryable<Pm_GoodsInfo>().Where(x => x.Id == currInfo.GoodsId).FirstAsync();
+                goodsInfo.StockQuantity = goodsInfo.StockQuantity - currInfo.Quantity;
+                goodsInfo.LastUpdateTime = DateTime.Now;
+                goodsInfo.LastUpdateUserId = userId;
+
+                var editGoods = await _sqlSugar.Updateable<Pm_GoodsInfo>(goodsInfo)
+                                               .UpdateColumns(x => new
+                                               {
+                                                   x.StockQuantity,
+                                                   x.LastUpdateUserId,
+                                                   x.LastUpdateTime,
+                                               })
+                                               .Where(x => x.Id == id)
+                                               .ExecuteCommandAsync();
+                if (editGoods < 1) status = false;
+            }
+
+            if (status)
+            {
+                _sqlSugar.CommitTran();
+                _jv.Msg = $"操作成功!";
+                _jv.Code = StatusCodes.Status200OK;
+                return _jv;
+            }
+
+            _sqlSugar.RollbackTran();
+            return _jv;
+        }
+
+        /// <summary>
+        /// 物品领用 Del
+        /// </summary>
+        /// <param name="idArray"></param>
+        /// <param name="userId"></param>
+        /// <param name="auditEnum"></param>
+        /// <returns></returns>
+        public async Task<JsonView> GoodsReceiveDel(int id, int currUserId)
+        {
+            var receiveInfo = await _sqlSugar.Queryable<Pm_GoodsReceive>()
+                                             .Where(x => x.IsDel == 0 && x.Id == id)
+                                             .FirstAsync();
+            if (receiveInfo.AuditStatus == GoodsAuditEnum.Approved)
+            {
+                _jv.Msg = $"该条数据已通过审核,不可删除!";
+                return _jv;
+            }
+
+            var edit = await _sqlSugar.Updateable<Pm_GoodsReceive>()
+                                        .UpdateColumns(x => new Pm_GoodsReceive()
+                                        {
+                                            IsDel = 1,
+                                            DeleteUserId = currUserId,
+                                            DeleteTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
+                                        })
+                                        .Where(x => x.Id == id)
+                                        .ExecuteCommandAsync();
+            if (edit > 0)
+            {
+                _jv.Msg = $"操作成功!";
+                _jv.Code = StatusCodes.Status200OK;
+                return _jv;
+            }
+
+            return _jv;
+        }
+    }
+}

+ 112 - 67
OASystem/OASystem.Infrastructure/Repositories/Resource/InvitationOfficialActivityDataRepository.cs

@@ -1,4 +1,5 @@
 using AutoMapper;
+using Newtonsoft.Json;
 using OASystem.Domain;
 using OASystem.Domain.Dtos.Groups;
 using OASystem.Domain.Dtos.Resource;
@@ -7,6 +8,7 @@ using OASystem.Domain.Entities.Resource;
 using OASystem.Domain.ViewModels;
 using OASystem.Domain.ViewModels.Groups;
 using OASystem.Domain.ViewModels.Resource;
+using OASystem.Infrastructure.Tools;
 using System;
 using System.Collections.Generic;
 using System.Linq;
@@ -127,93 +129,136 @@ namespace OASystem.Infrastructure.Repositories.Resource
         /// <param name="dto"></param>
         /// <returns></returns>
         /// <exception cref="NotImplementedException"></exception>
-        public async Task<Result> QueryInvitationOfficialActivityById(QueryInvitationOfficialActivityByIdDto dto)
+        public async Task<JsonView> Info(int id)
         {
-            Result result = new Result() { Code = -2, Msg = "未知错误" };
-            try
+            var res = await _sqlSugar.Queryable<Res_InvitationOfficialActivityData>()
+                                     .Where(x => x.Id == id && x.IsDel == 0)
+                                     .FirstAsync();
+            
+            var _view = _mapper.Map<IOAInfoView>(res);
+            return new JsonView() { Code = StatusCodes.Status200OK, Msg = "操作成功", Data = _view };
+        }
+
+        public async Task<JsonView> IOA_OP(OpInvitationOfficialActivityDto dto)
+        {
+            JsonView result = new JsonView() { Code = StatusCodes.Status400BadRequest, Msg = "操作失败1" };
+
+            var _info = _mapper.Map<Res_InvitationOfficialActivityData>(dto);
+
+            if (dto.Status == 1)//添加
             {
-                Res_InvitationOfficialActivityData res_Invitation = await _sqlSugar.Queryable<Res_InvitationOfficialActivityData>().FirstAsync(a => a.Id == dto.Id && a.IsDel == 0);
-                if (res_Invitation!=null) {
-                    result = new Result() { Code = 0, Msg = "查询成功!", Data = res_Invitation };
+                string selectSql = string.Format(@"select * from Res_InvitationOfficialActivityData where UnitName='{0}' and IsDel='{1}'", dto.UnitName, 0);
+                var res_InvitationOfficial = await _sqlSugar.SqlQueryable<Res_InvitationOfficialActivityData>(selectSql).FirstAsync();//查询是否存在
+                if (res_InvitationOfficial != null)
+                {
+                    result.Msg = $"该信息已存在,请勿重复添加!";
+                    return result;
                 }
-                else
+
+                #region 处理上传文件
+                var fileNames = await Upload(dto.Files);
+                if (fileNames.Count > 0)
                 {
-                    result = new Result() { Code = 0, Msg = "暂无数据!", Data = res_Invitation };
+                    _info.SndFileName = JsonConvert.SerializeObject(fileNames);
                 }
+
+                #endregion
+
+                var id = await _sqlSugar.Insertable(_info).ExecuteReturnIdentityAsync();
+                if (id < 1) return result;
+
             }
-            catch (Exception ex)
+            else if (dto.Status == 2)//修改
+            {
+                var fileNameJsonStr = string.Empty;
+                var fileNames = await Upload(dto.Files);
+                if (fileNames.Count > 0)
+                { 
+                    var ioaInfo = await _sqlSugar.Queryable<Res_InvitationOfficialActivityData>().FirstAsync(x => x.IsDel == 0 && x.Id == dto.Id);
+                    if (ioaInfo != null) {
+                        var fileName = ioaInfo.SndFileName;
+                        if (!string.IsNullOrEmpty(fileName))
+                        {
+                            try
+                            {
+                                var ioaFiles = JsonConvert.DeserializeObject<List<string>>(fileName);
+                                fileNames.AddRange(ioaFiles);
+                            }
+                            catch (Exception)
+                            {
+                                fileNames.Add(fileName);
+                            }
+                        }
+                    }
+
+                    fileNameJsonStr = JsonConvert.SerializeObject(fileNames);
+                }
+
+                bool res = await UpdateAsync(a => a.Id == dto.Id, a => new Res_InvitationOfficialActivityData
+                {
+                    Country = dto.Country,
+                    City = dto.City,
+                    UnitName = dto.UnitName,
+                    UnitWeb = dto.UnitWeb,
+                    Field = dto.Field,
+                    Address = dto.Address,
+                    UnitInfo = dto.UnitInfo,
+                    Contact = dto.Contact,
+                    Job = dto.Job,
+                    Tel = dto.Tel,
+                    Email = dto.Email,
+                    WeChat = dto.WeChat,
+                    FaceBook = dto.FaceBook,
+                    Ins = dto.Ins,
+                    Delegation = dto.Delegation,
+                    FilePath = dto.FilePath,
+                    SndFileName = fileNameJsonStr,
+                    Fax = dto.Fax,
+                    CreateUserId = dto.CreateUserId,
+                    Remark = dto.Remark
+                });
+                if (!res) return result;
+            }
+            else
             {
-                result = new Result() { Code = -2, Msg = "未知错误" };
+                result.Msg = $"请传入Status参数,1添加 2修改!";
+                return result;
             }
+
+            result.Msg = $"操作成功!";
+            result.Code = StatusCodes.Status200OK;
             return result;
         }
 
-        public async Task<Result> OpInvitationOfficialActivity(OpInvitationOfficialActivityDto dto)
+
+        public async Task< List<string>> Upload(IFormFile[] formFiles)
         {
-            Result result = new Result() { Code = -2, Msg = "未知错误" };
-            try
+            var fileNames = new List<string>();
+
+            if (formFiles != null && formFiles.Length > 0)
             {
-                if (dto.Status == 1)//添加
+                var filePath = $@"{AppSettingsHelper.Get("GrpFileBasePath")}/商邀相关文件";
+                if (!Directory.Exists(filePath))
                 {
-                    string selectSql = string.Format(@"select * from Res_InvitationOfficialActivityData where UnitName='{0}' and IsDel='{1}'", dto.UnitName, 0);
-                    var res_InvitationOfficial = await _sqlSugar.SqlQueryable<Res_InvitationOfficialActivityData>(selectSql).FirstAsync();//查询是否存在
-                    if (res_InvitationOfficial != null)
-                    {
-                        return result = new Result() { Code = -1, Msg = "该信息已存在,请勿重复添加!" };
-
-                    }
-                    else//不存在,可添加
-                    {
-                        Res_InvitationOfficialActivityData _InvitationOfficialActivityData = _mapper.Map<Res_InvitationOfficialActivityData>(dto);
-                        int id = await _sqlSugar.Insertable(_InvitationOfficialActivityData).ExecuteReturnIdentityAsync();
-                        if (id == 0)
-                        {
-                            return result = new Result() { Code = -1, Msg = "添加失败!" };
-
-                        }
-                        return result = new Result() { Code = 0, Msg = "添加成功!", Data = new { Id = id } };
-                    }
+                    Directory.CreateDirectory(filePath);
                 }
-                else if (dto.Status == 2)//修改
+
+                foreach (var file in formFiles)
                 {
-                    bool res = await UpdateAsync(a => a.Id == dto.Id, a => new Res_InvitationOfficialActivityData
-                    {
-                        Country = dto.Country,
-                        City = dto.City,
-                        UnitName = dto.UnitName,
-                        UnitWeb = dto.UnitWeb,
-                        Field = dto.Field,
-                        Address = dto.Address,
-                        UnitInfo = dto.UnitInfo,
-                        Contact = dto.Contact,
-                        Job = dto.Job,
-                        Tel = dto.Tel,
-                        Email = dto.Email,
-                        WeChat = dto.WeChat,
-                        FaceBook = dto.FaceBook,
-                        Ins = dto.Ins,
-                        Delegation = dto.Delegation,
-                        FilePath = dto.FilePath,
-                        SndFilePath = dto.SndFilePath,
-                        Fax = dto.Fax,
-                        CreateUserId = dto.CreateUserId,
-                        Remark = dto.Remark
-                    });
-                    if (!res)
+                    //filePath = @$"{filePath}/{file.FileName}";
+
+                    var path = Path.Combine(filePath, file.FileName);
+
+                    using (var stream = new FileStream(path, FileMode.Create))
                     {
-                        return result = new Result() { Code = -1, Msg = "修改失败!" };
+                        await file.CopyToAsync(stream);
                     }
-                    return result = new Result() { Code = 0, Msg = "修改成功!" };
-                }
-                else
-                {
-                    return result = new Result() { Code = -1, Msg = "请传入Status参数,1添加 2修改!" };
+
+                    fileNames.Add(file.FileName);
                 }
             }
-            catch (Exception ex)
-            {
-                return result = new Result() { Code = -2, Msg = "程序错误!" };
-            }
+
+            return fileNames;
         }
     }
 }