LEIYI 2 weeks ago
parent
commit
e867da2981

+ 34 - 0
OASystem/OASystem.Api/Controllers/PersonnelModuleController.cs

@@ -8,6 +8,7 @@ using OASystem.API.OAMethodLib.QiYeWeChatAPI;
 using OASystem.API.OAMethodLib.Quartz.Business;
 using OASystem.Domain.Dtos.Groups;
 using OASystem.Domain.Dtos.PersonnelModule;
+using OASystem.Domain.Entities.Groups;
 using OASystem.Domain.Entities.PersonnelModule;
 using OASystem.Domain.ViewModels.PersonnelModule;
 using OASystem.Domain.ViewModels.QiYeWeChat;
@@ -1703,6 +1704,39 @@ namespace OASystem.API.Controllers
             return Ok(await _goodsRep.InitDataSource());
         }
 
+        /// <summary>
+        /// 物资进销存
+        /// 基础数据类型 --> 团组名称列表 分页
+        /// </summary>
+        /// <returns></returns>
+        [HttpPost]
+        [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
+        public async Task<IActionResult> GoodsGroupNameInit(QueryGroupListOffsetDto dto)
+        {
+            var watch = new Stopwatch();
+            watch.Start();
+            var countyDatas = await _sqlSugar
+                .Queryable<Grp_DelegationInfo>()
+                .Where((di) => di.IsDel == 0 && !string.IsNullOrWhiteSpace(di.TeamName))
+                .OrderBy((di) => new { id = SqlFunc.Desc(di.Id) })
+                .Select((di) => new { id = di.Id, name = di.TeamName})
+                .ToListAsync();
+
+            countyDatas.Insert(0, new { id = 0, name = "其他物资(公司内部物资)"});
+            countyDatas.Insert(0, new { id = -1, name = "拜访客户所使用的物资" });
+            var total = countyDatas.Count;
+            countyDatas = countyDatas.WhereIF(!string.IsNullOrEmpty(dto.Search), x => x.name.Contains(dto.Search)).ToList();
+            countyDatas = countyDatas
+                .Skip((dto.PageIndex - 1) * dto.PageSize)
+                .Take(dto.PageSize)
+                .ToList();
+
+            watch.Stop();
+
+            return Ok(JsonView(true, $"{MsgTips.Succeed},耗时 {watch.ElapsedMilliseconds} ms", countyDatas, total));
+
+        }
+
         /// <summary>
         /// 物资进销存
         /// 物品 列表

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

@@ -57,6 +57,8 @@ namespace OASystem.Infrastructure.Repositories.PersonnelModule
                                            .OrderByDescending(x => x.id)
                                            .ToListAsync();
 
+            groupData.Insert(0, new { id = 0, groupName = "其他物资(公司内部物资)" });
+            groupData.Insert(0, new { id = -1, groupName = "拜访客户所使用的物资" });
 
             var userData = await _sqlSugar.Queryable<Sys_Users>()
                 .Where(x => x.IsDel == 0)