Browse Source

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

wangh 1 year ago
parent
commit
3d49b72ee7
26 changed files with 1027 additions and 102 deletions
  1. 3 1
      OASystem/EntitySync/Program.cs
  2. 108 3
      OASystem/OASystem.Api/Controllers/BusinessController.cs
  3. 21 25
      OASystem/OASystem.Api/Controllers/ResourceController.cs
  4. 25 2
      OASystem/OASystem.Api/Controllers/TencentOCRController.cs
  5. 93 0
      OASystem/OASystem.Api/OAMethodLib/ExcelOutput/Excel_BusConfItemList.cs
  6. 131 0
      OASystem/OASystem.Api/OAMethodLib/File/AsposeHelper.cs
  7. 146 0
      OASystem/OASystem.Api/OAMethodLib/File/NPOIHelper.cs
  8. 2 0
      OASystem/OASystem.Api/OASystem.API.csproj
  9. 4 1
      OASystem/OASystem.Api/appsettings.json
  10. 8 1
      OASystem/OASystem.Domain/AutoMappers/_baseMappingProfile.cs
  11. 21 0
      OASystem/OASystem.Domain/Common/SetDataDefaultParam.cs
  12. 25 0
      OASystem/OASystem.Domain/Dtos/Business/Edit_OptionalItemListDto.cs
  13. 5 0
      OASystem/OASystem.Domain/Dtos/Groups/Grp_ScheduleDto.cs
  14. 8 2
      OASystem/OASystem.Domain/Dtos/Resource/Res_ItemVendorDto.cs
  15. 6 0
      OASystem/OASystem.Domain/Entities/Business/Bus_ConfItemInfo.cs
  16. 10 1
      OASystem/OASystem.Domain/Entities/Business/Bus_ConfItemListInfo.cs
  17. 17 1
      OASystem/OASystem.Domain/Entities/Resource/Res_ItemVendor.cs
  18. 67 2
      OASystem/OASystem.Domain/ViewModels/Business/Bus_ConfItemListView.cs
  19. 18 3
      OASystem/OASystem.Domain/ViewModels/Resource/Res_ItemInfoView.cs
  20. 8 0
      OASystem/OASystem.Domain/ViewModels/TencentOCR/IDCardOCRView.cs
  21. 191 0
      OASystem/OASystem.Infrastructure/Repositories/Business/CommonBusRepository.cs
  22. 0 17
      OASystem/OASystem.Infrastructure/Repositories/Business/CommonBusRepositroy.cs
  23. 13 2
      OASystem/OASystem.Infrastructure/Repositories/Groups/GrpScheduleRepository.cs
  24. 66 31
      OASystem/OASystem.Infrastructure/Repositories/Resource/ResItemInfoRepository.cs
  25. 30 10
      OASystem/OASystem.Infrastructure/Repositories/System/SystemMenuPermissionRepository.cs
  26. 1 0
      OASystem/OASystem.Infrastructure/Tools/CommonFun.cs

+ 3 - 1
OASystem/EntitySync/Program.cs

@@ -89,7 +89,9 @@ db.CodeFirst.SetStringDefaultLength(50).BackupTable().InitTables(new Type[]
     
     //typeof(Res_ItemDetailInfo),
     //typeof(Res_ItemVendor)
-    typeof(Bus_ConfItemInfo)
+    //typeof(Res_ItemTypeInfo)
+    //typeof(Bus_ConfItemInfo)
+    //typeof(Bus_ConfItemListInfo)
     //typeof(Res_CountryFeeCost)
 });
 Console.WriteLine("数据库结构同步完成!");

+ 108 - 3
OASystem/OASystem.Api/Controllers/BusinessController.cs

@@ -1,7 +1,15 @@
 using Microsoft.AspNetCore.Mvc;
+using OASystem.API.OAMethodLib.ExcelOutput;
+using OASystem.Domain.Common;
+using OASystem.Domain.Dtos.Business;
+using OASystem.Domain.Dtos.Groups;
+using OASystem.Domain.Entities.Business;
 using OASystem.Domain.Entities.Groups;
+using OASystem.Domain.Entities.Resource;
+using OASystem.Domain.ViewModels.Business;
 using OASystem.Domain.ViewModels.Groups;
 using OASystem.Infrastructure.Repositories.Business;
+using Org.BouncyCastle.Asn1.Mozilla;
 
 namespace OASystem.API.Controllers
 {
@@ -12,8 +20,8 @@ namespace OASystem.API.Controllers
     public class BusinessController : ControllerBase
     {
         private readonly IMapper _mapper;
-        private readonly CommonBusRepositroy _busRep;
-        public BusinessController(IMapper mapper, CommonBusRepositroy busRep)
+        private readonly CommonBusRepository _busRep;
+        public BusinessController(IMapper mapper, CommonBusRepository busRep)
         {
             _mapper = mapper;
             _busRep = busRep;
@@ -51,7 +59,104 @@ namespace OASystem.API.Controllers
         [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
         public async Task<IActionResult> PostConfItemList(int ConfId)
         {
-            
+            Bus_ConfItemListView view = new Bus_ConfItemListView();
+
+            Bus_ConfItemListInfo _confListInfo = await _busRep.Query<Bus_ConfItemListInfo>(s => s.Diid == ConfId).FirstAsync();
+            if (_confListInfo != null)
+            {
+                view.TotalCost = _confListInfo.TotalCost;
+
+                string sqlItem = string.Format(@" Select c.Id,c.ItemId,d.ItemName,c.[Count],c.CurrCost,c.OpRemark
+From Bus_ConfItem as c With(Nolock) 
+Inner Join Res_ItemDetail as d with(Nolock) On c.ItemId=d.Id
+Where c.ConfListId = {0}", ConfId);
+                List<Bus_ConfItemView> confItemList = await _busRep._sqlSugar.SqlQueryable<Bus_ConfItemView>(sqlItem).ToListAsync();
+                view.ItemList = new List<Bus_ConfItemView>(confItemList);
+            }
+            else
+            {
+                view.ItemList = new List<Bus_ConfItemView>();
+                view.TotalCost = 0;
+            }
+
+            return Ok(JsonView(view));
+        }
+
+        /// <summary>
+        /// 获取会务可采购的物料集合
+        /// </summary>
+        /// <returns></returns>
+        [HttpPost]
+        [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
+        public async Task<IActionResult> PostOptionalItemList()
+        {
+            List<OptionalBusRangeView> result = await _busRep.GetViewList_OptionalItem();
+
+            return Ok(JsonView(result));
+        }
+
+        /// <summary>
+        /// 编辑物料采购清单
+        /// </summary>
+        /// <returns></returns>
+        [HttpPost]
+        [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
+        public async Task<IActionResult> PostEditOptionalItemList(JsonDtoBase jsonDto)
+        {
+            if (string.IsNullOrEmpty(jsonDto.Paras))
+            {
+                return Ok(JsonView(false, "参数为空"));
+            }
+            Edit_OptionalItemListDto _dto = JsonConvert.DeserializeObject<Edit_OptionalItemListDto>(jsonDto.Paras);
+            //Edit_OptionalItemListDto _dto = System.Text.Json.JsonSerializer.Deserialize<Edit_OptionalItemListDto>(jsonDto.Paras);
+
+            if (_dto.DiId < 1)
+            {
+                return Ok(JsonView(false, "团组Id为空"));
+            }
+
+            if (_dto.ConfItemListId < 1)
+            {
+                //新增
+                int rstInsert = await _busRep.Insert_ConfItemList(_dto);
+                return Ok(JsonView(rstInsert == 0));
+            }
+            else
+            {
+                //修改
+                int rstUpdate = await _busRep.Edit_ConfItemList(_dto);
+                return Ok(JsonView(rstUpdate == 0));
+            }
+
+            return Ok(JsonView(false));
+        }
+
+        /// <summary>
+        /// 获取会务采购物料清单Excel
+        /// </summary>
+        /// <returns></returns>
+        [HttpPost]
+        [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
+        public async Task<IActionResult> Excel_ConfItemList(JsonDtoBase jsonDto)
+        {
+            if (string.IsNullOrEmpty(jsonDto.Paras))
+            {
+                return Ok(JsonView(false, "参数为空"));
+            }
+
+            dynamic confList = JsonConvert.DeserializeObject<dynamic>(jsonDto.Paras);
+            int confListId = confList.ConfListId;
+            Bus_ConfItemListInfo _entityConfList = await _busRep.Query<Bus_ConfItemListInfo>(s => s.Id == confListId).FirstAsync();
+            if (_entityConfList != null)
+            {
+                string result = new Excel_BusConfItemList().Excel(_entityConfList);
+
+
+            }
+            else
+            {
+                return Ok(JsonView(false, "请先保存数据"));
+            }
 
             return Ok(JsonView(false));
         }

+ 21 - 25
OASystem/OASystem.Api/Controllers/ResourceController.cs

@@ -1,4 +1,6 @@
-namespace OASystem.API.Controllers
+using System.Collections.Generic;
+
+namespace OASystem.API.Controllers
 {
     /// <summary>
     /// 资料相关
@@ -34,7 +36,7 @@
             _countryFeeRep = countryFeeRep;
             _setDataTypeRep = setDataTypeRep;
         }
-      
+
 
         #region 车公司资料板块
 
@@ -63,8 +65,8 @@
                 return Ok(JsonView(false, "程序错误!"));
                 throw;
             }
-           
-            
+
+
         }
 
         /// <summary>
@@ -85,7 +87,7 @@
                 CarData.Add(new CarDataSelectView { Id = 0, UnitArea = "全部" });
                 CarData = CarData.Where((x, i) => CarData.FindIndex(z => z.UnitArea == x.UnitArea) == i).ToList();
                 CarData = CarData.OrderBy(x => x.Id).ToList();
-                List<CarDataSelectView> data= new List<CarDataSelectView>();
+                List<CarDataSelectView> data = new List<CarDataSelectView>();
                 foreach (CarDataSelectView car in CarData)
                 {
                     if (!string.IsNullOrWhiteSpace(car.UnitArea))
@@ -147,7 +149,7 @@
                 throw;
             }
         }
-       
+
         /// <summary>
         /// 车公司信息修改
         /// </summary>
@@ -668,7 +670,7 @@
                 return Ok(JsonView(false, "程序错误!"));
                 throw;
             }
-           
+
         }
 
         /// <summary>
@@ -755,14 +757,14 @@
         /// <returns></returns>
         [HttpPost]
         [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
-        public async Task<IActionResult> PostSearchItemVendor(string paras)
+        public async Task<IActionResult> PostSearchItemVendor(JsonDtoBase _jsonDto)
         {
-            if (string.IsNullOrEmpty(paras))
+            if (string.IsNullOrEmpty(_jsonDto.Paras))
             {
                 return Ok(JsonView(false, "参数为空"));
             }
 
-            Search_ResItemVendorDto _ItemVendorDto = System.Text.Json.JsonSerializer.Deserialize<Search_ResItemVendorDto>(paras);
+            Search_ResItemVendorDto _ItemVendorDto = System.Text.Json.JsonSerializer.Deserialize<Search_ResItemVendorDto>(_jsonDto.Paras);
             if (_ItemVendorDto != null)
             {
                 if (_ItemVendorDto.SearchType == 2) //获取列表
@@ -812,6 +814,12 @@
                 {
                     return Ok(JsonView(false, "联系人手机号未填写"));
                 }
+
+                if (string.IsNullOrEmpty(_dto.BusRange))
+                {
+                    return Ok(JsonView(false, "经营范围未选择"));
+                }
+
                 if (_dto.EditType == 0)
                 {
                     var checkEmpty = _resItemInfoRep.Query<Res_ItemVendor>(s => s.FullName == _dto.VendorFullName).First();
@@ -910,7 +918,7 @@
                 {
                     return Ok(JsonView(false, "物料名称为空"));
                 }
-                if (_dto.SetDataId < 1)
+                if (_dto.ItemTypeId < 1)
                 {
                     return Ok(JsonView(false, "未选择物料类型"));
                 }
@@ -926,7 +934,7 @@
                 if (_dto.EditType == 0)
                 {
                     //判断物料名称、类型、供应商全部重复
-                    var checkEmpty = _resItemInfoRep.Query<Res_ItemDetailInfo>(s => s.ItemName == _dto.ItemName && s.SetDataId == _dto.SetDataId && s.VendorId == _dto.VendorId).First();
+                    var checkEmpty = _resItemInfoRep.Query<Res_ItemDetailInfo>(s => s.ItemName == _dto.ItemName && s.ItemTypeId == _dto.ItemTypeId && s.VendorId == _dto.VendorId).First();
                     if (checkEmpty != null)
                     {
                         return Ok(JsonView(false, "已存在重复物料信息"));
@@ -974,22 +982,10 @@
         }
         #endregion
         #region 物料类型获取
-        /// <summary>
-        /// 物料类型列表获取
-        /// </summary>
-        /// <param name="paras">Json序列化</param>
-        /// <returns></returns>
-        [HttpGet]
-        [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
-        public async Task<IActionResult> GetItemTypeListBySetData()
-        {
-            List<SetDataView> list = _resItemInfoRep.GetItemTypeListBySetData();
 
-            return Ok(JsonView(list));
-        }
         #endregion
         #endregion
     }
 
-   
+
 }

+ 25 - 2
OASystem/OASystem.Api/Controllers/TencentOCRController.cs

@@ -1,8 +1,11 @@
-using OASystem.API.OAMethodLib.TencentCloudAPI;
+using OASystem.API.OAMethodLib.File;
+using OASystem.API.OAMethodLib.NPOI;
+using OASystem.API.OAMethodLib.TencentCloudAPI;
 using OASystem.Domain.Dtos.CRM;
 using OASystem.Domain.Dtos.Tencent;
 using OASystem.Domain.ViewModels.TencentOCR;
 using OASystem.Infrastructure.Repositories.CRM;
+using Org.BouncyCastle.Crypto;
 using StackExchange.Redis;
 using System.Net.NetworkInformation;
 using TencentCloud.Ocr.V20181119.Models;
@@ -107,7 +110,7 @@ namespace OASystem.API.Controllers
                     CerdAddress = idCardData.Data.Address,
                 });
 
-            IDCardOCRView iDCardOCRView = new IDCardOCRView()
+            IDCardOCRAndDownUrlView iDCardOCRView = new IDCardOCRAndDownUrlView()
             {
                 Status = cerdStatus,
                 Name = idCardData.Data.Name,
@@ -120,6 +123,26 @@ namespace OASystem.API.Controllers
                 ValidDate = idCardData.Data.ValidDate
             };
 
+            #region word生成 返回地址
+            string tempPath = string.Format("{0}", "C:\\Server\\File\\OA2023\\Office\\Word\\TencentOCR\\Template\\ocr_身份证(人像面).doc");
+
+            Dictionary<string, object> dic = new Dictionary<string, object>();
+            dic.Add("Name", iDCardOCRView.Name);
+            dic.Add("Sex", iDCardOCRView.Sex);
+            dic.Add("Nation", iDCardOCRView.Nation);
+            dic.Add("Birth", iDCardOCRView.Birth);
+            dic.Add("Address", iDCardOCRView.Address);
+            dic.Add("IdNum", iDCardOCRView.IdNum);
+            dic.Add("Authority", iDCardOCRView.Authority);
+            dic.Add("ValidDate", iDCardOCRView.ValidDate);
+
+            string downPath = string.Format("{0}.doc",dic["Name"].ToString() + "身份证(人像面)" + DateTime.Now.ToString("yyyyMMddHHmmss"));
+
+            string serverPathh = AsposeHelper.ExpertWordToModel(tempPath, downPath, dic, null);
+
+            iDCardOCRView.DownUrl = serverPathh.Replace("C:", "http:\\132.232.92.186");
+            #endregion
+
             return Ok(JsonView(iDCardOCRView));
         }
 

+ 93 - 0
OASystem/OASystem.Api/OAMethodLib/ExcelOutput/Excel_BusConfItemList.cs

@@ -0,0 +1,93 @@
+using Aspose.Cells;
+using OASystem.Domain.Entities.Business;
+using OASystem.Domain.Entities.Groups;
+using OASystem.Domain.ViewModels.Business;
+using OASystem.Infrastructure.Repositories.Business;
+using StackExchange.Redis;
+using System.Web;
+
+namespace OASystem.API.OAMethodLib.ExcelOutput
+{
+    public class Excel_BusConfItemList
+    {
+        private CommonBusRepository _busRep;
+        private string url;
+        private string path;
+        public Excel_BusConfItemList()
+        {
+            _busRep = AutofacIocManager.Instance.GetService<CommonBusRepository>();
+            url = AppSettingsHelper.Get("ExcelBaseUrl");
+            path = AppSettingsHelper.Get("ExcelBasePath");
+            if (!System.IO.Directory.Exists(path))
+            {
+                System.IO.Directory.CreateDirectory(path);//不存在就创建文件夹
+            }
+        }
+
+
+        public string Excel(Bus_ConfItemListInfo _entity)
+        {
+
+
+            if (!string.IsNullOrEmpty(_entity.ExcelPath))
+            {
+                if (System.IO.File.Exists(_entity.ExcelPath))
+                {
+                    //存在 
+                    string fileUrl = url + path + _entity.ExcelPath;
+                    return fileUrl;
+                }
+                else
+                {
+                    //不存在 
+                    return CreateExcel(_entity);
+                }
+            }
+            else
+            {
+                return CreateExcel(_entity);
+            }
+
+            return "";
+        }
+
+        private string CreateExcel(Bus_ConfItemListInfo _entity)
+        {
+            string sql = string.Format(@" Select * From(
+Select ROW_NUMBER() Over(order By Id desc) as RowNumber,riv.FullName as VendorName,rid.ItemName
+,rit.TypeName as ItemTypeName,bci.[Count],bci.CurrCost as Price,bci.OpRemark as ItemRemark
+From Bus_ConfItemList as bcil With(Nolock) 
+Inner Join Bus_ConfItem as bci With(Nolock) On bcil.Id=bci.ConfListId
+Inner Join Res_ItemDetail as rid With(Nolock) On bci.ItemId=rid.Id
+Inner Join Res_ItemType as rit With(Nolock) On rid.ItemTypeId=rit.Id
+Inner Join Res_ItemVendor as riv With(nolock) On rid.VendorId=riv.Id
+Where bcil.Id={0}
+) as tb  ", _entity.Id);
+
+            List<Bus_ConfItemExportView> _confItemList = _busRep._sqlSugar.SqlQueryable<Bus_ConfItemExportView>(sql).ToList();
+            Grp_DelegationInfo _DelegationInfo = _busRep.Query<Grp_DelegationInfo>(s => s.Id == _entity.Diid).First();
+            string diName = _DelegationInfo != null ? _DelegationInfo.TeamName : "未知团组" + _entity.Diid;
+
+            WorkbookDesigner designer = new WorkbookDesigner();
+            designer.Workbook = new Workbook(AppSettingsHelper.Get("ExcelBasePath") + "Model/会务物料清单模板.xlsx");
+            designer.SetDataSource("Export", _confItemList);
+            designer.SetDataSource("ExportDiName", diName);
+            designer.SetDataSource("ExportOutputDt", DateTime.Now.ToString("yyyy-MM-dd"));
+            designer.SetDataSource("ExportListRemark", _entity.Remark);
+
+            designer.Process();
+            string fileName = HttpUtility.UrlEncode("") + "_" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".xlsx";
+            designer.Workbook.Save(fileName);
+            designer = null;
+
+            _entity.ExcelPath = path + fileName;
+            _busRep._sqlSugar.Updateable<Bus_ConfItemListInfo>()
+                .Where(s => s.Id == _entity.Id)
+                .UpdateColumns(s => s.ExcelPath)
+                .ExecuteCommand();
+
+            string fileUrl = url + path + _entity.ExcelPath;
+            return fileUrl;
+        }
+    }
+}

File diff suppressed because it is too large
+ 131 - 0
OASystem/OASystem.Api/OAMethodLib/File/AsposeHelper.cs


+ 146 - 0
OASystem/OASystem.Api/OAMethodLib/File/NPOIHelper.cs

@@ -0,0 +1,146 @@
+//using NPOI.XWPF.UserModel;
+
+namespace OASystem.API.OAMethodLib.NPOI
+{
+    /// <summary>
+    /// word / excel 
+    /// </summary>
+    public class NPOIHelper
+    {
+        //#region Word
+        ///// <summary>
+        ///// 输出模板docx文档(使用字典)
+        ///// </summary>
+        ///// <param name="tempFilePath">docx文件路径</param>
+        ///// <param name="outPath">输出文件路径</param>
+        ///// <param name="data">字典数据源</param>
+        //public static void Export(string tempFilePath, string outPath, Dictionary<string, string> data)
+        //{
+        //    try
+        //    {
+        //        using (FileStream stream = File.OpenRead(tempFilePath ))
+        //        {
+        //            XWPFDocument doc = new XWPFDocument(stream);
+        //            //遍历段落                  
+        //            foreach (var para in doc.Paragraphs)
+        //            {
+        //                ReplaceKey(para, data);
+        //            }
+
+        //            //遍历表格      
+        //            foreach (var table in doc.Tables)
+        //            {
+        //                foreach (var row in table.Rows)
+        //                {
+        //                    foreach (var cell in row.GetTableCells())
+        //                    {
+        //                        foreach (var para in cell.Paragraphs)
+        //                        {
+        //                            ReplaceKey(para, data);
+        //                        }
+        //                    }
+        //                }
+        //            }
+
+        //            //写文件
+        //            FileStream outFile = new FileStream(outPath, FileMode.Create);
+        //            doc.Write(outFile);
+        //            outFile.Close();
+        //        }
+        //    }
+        //    catch (Exception ex)
+        //    {
+
+        //        throw;
+        //    }
+            
+        //}
+        //private static void ReplaceKey(XWPFParagraph para, Dictionary<string, string> data)
+        //{
+        //    string text = "";
+        //    foreach (var run in para.Runs)
+        //    {
+        //        text = run.ToString();
+        //        foreach (var key in data.Keys)
+        //        {
+        //            //$$模板中数据占位符为$KEY$
+        //            if (text.Contains($"${key}$"))
+        //            {
+        //                text = text.Replace($"${key}$", data[key]);
+        //            }
+        //        }
+        //        run.SetText(text, 0);
+        //    }
+        //}
+
+        ///// <summary>
+        ///// 输出模板docx文档(使用反射)
+        ///// </summary>
+        ///// <param name="tempFilePath">docx文件路径</param>
+        ///// <param name="outPath">输出文件路径</param>
+        ///// <param name="data">对象数据源</param>
+        //public static void ExportObjet(string tempFilePath, string outPath, object data)
+        //{
+        //    using (FileStream stream = File.OpenRead(tempFilePath))
+        //    {
+        //        XWPFDocument doc = new XWPFDocument(stream);
+        //        //遍历段落                  
+        //        foreach (var para in doc.Paragraphs)
+        //        {
+        //            ReplaceKeyObjet(para, data);
+        //        }
+        //        //遍历表格      
+        //        foreach (var table in doc.Tables)
+        //        {
+        //            foreach (var row in table.Rows)
+        //            {
+        //                foreach (var cell in row.GetTableCells())
+        //                {
+        //                    foreach (var para in cell.Paragraphs)
+        //                    {
+        //                        ReplaceKeyObjet(para, data);
+        //                    }
+        //                }
+        //            }
+        //        }
+        //        //写文件
+        //        FileStream outFile = new FileStream(outPath, FileMode.Create);
+        //        doc.Write(outFile);
+        //        outFile.Close();
+        //    }
+        //}
+        //private static void ReplaceKeyObjet(XWPFParagraph para, object model)
+        //{
+        //    string text = "";
+        //    Type t = model.GetType();
+        //    PropertyInfo[] pi = t.GetProperties();
+        //    foreach (var run in para.Runs)
+        //    {
+        //        text = run.ToString();
+        //        foreach (PropertyInfo p in pi)
+        //        {
+        //            //$$模板中数据占位符为$KEY$
+        //            string key = $"${p.Name}$";
+        //            if (text.Contains(key))
+        //            {
+        //                try
+        //                {
+        //                    text = text.Replace(key, p.GetValue(model, null).ToString());
+        //                }
+        //                catch (Exception ex)
+        //                {
+        //                    //可能有空指针异常
+        //                    text = text.Replace(key, "");
+        //                }
+        //            }
+        //        }
+        //        run.SetText(text, 0);
+        //    }
+        //}
+        //#endregion
+
+
+
+
+    }
+}

+ 2 - 0
OASystem/OASystem.Api/OASystem.API.csproj

@@ -20,6 +20,8 @@
   </ItemGroup>
 
   <ItemGroup>
+    <PackageReference Include="Aspose.Words" Version="21.8.0" />
+    <PackageReference Include="Aspose.Cells" Version="23.4.0" />
     <PackageReference Include="Autofac" Version="6.4.0" />
     <PackageReference Include="Autofac.Extensions.DependencyInjection" Version="8.0.0" />
     <PackageReference Include="AutoMapper" Version="12.0.0" />

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

@@ -102,5 +102,8 @@
       "CurrencyName": "韩国元",
       "CurrencyCode": "ZAR"
     }
-  ]
+  ],
+  "ExcelBaseUrl": "http://132.232.92.186/",
+  "ExcelBasePath": "C:/Server/File/OA2023/Office/Excel/"
+
 }

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

@@ -5,10 +5,12 @@ using OASystem.Domain.Dtos.System;
 using OASystem.Domain.Dtos.UserDto;
 using OASystem.Domain.Entities;
 using OASystem.Domain.Entities.Customer;
+using OASystem.Domain.Entities.Business;
 using OASystem.Domain.Entities.Groups;
 using OASystem.Domain.Entities.Resource;
 using OASystem.Domain.Entities.System;
 using OASystem.Domain.ViewModels;
+using OASystem.Domain.ViewModels.Business;
 using OASystem.Domain.ViewModels.Resource;
 using OASystem.Domain.ViewModels.System;
 
@@ -105,7 +107,9 @@ namespace OASystem.Domain.AutoMappers
                  .ForMember(dest => dest.Job, opt => opt.MapFrom(src => src.VendorJob))
                  .ForMember(dest => dest.Linker, opt => opt.MapFrom(src => src.VendorLinker))
                  .ForMember(dest => dest.Mobile, opt => opt.MapFrom(src => src.VendorMobile))
-                 .ForMember(dest => dest.ShortName, opt => opt.MapFrom(src => src.VendorShortName));
+                 .ForMember(dest => dest.ShortName, opt => opt.MapFrom(src => src.VendorShortName))
+                 .ForMember(dest => dest.BusRange, opt => opt.MapFrom(src => src.BusRange));
+
 
             CreateMap<Edit_ResItemInfoDto, Res_ItemDetailInfo>();
             #endregion
@@ -118,6 +122,9 @@ namespace OASystem.Domain.AutoMappers
             #endregion
 
             #endregion
+
+            #region Business
+            #endregion
         }
     }
 }

+ 21 - 0
OASystem/OASystem.Domain/Common/SetDataDefaultParam.cs

@@ -0,0 +1,21 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace OASystem.Domain.Common
+{
+    public class SetDataDefaultParam
+    {
+        //public static 
+    }
+
+    public class SetDataTypeDefaultParam
+    {
+        /// <summary>
+        /// 传媒供应分类(会务)
+        /// </summary>
+        public static int Media = 21;
+    }
+}

+ 25 - 0
OASystem/OASystem.Domain/Dtos/Business/Edit_OptionalItemListDto.cs

@@ -0,0 +1,25 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace OASystem.Domain.Dtos.Business
+{
+    public class Edit_OptionalItemListDto
+    {
+        public int ConfItemListId { get; set; }
+
+        public int DiId { get; set; }
+
+        public List<Edit_OptionalItemDto> ConfItemList { get; set; }
+    }
+
+    public class Edit_OptionalItemDto
+    {
+        public int ItemId { get; set; }
+        public int Count { get; set; }
+        public decimal CurrCost { get; set; }
+        public string OpRemark { get; set; }
+    }
+}

+ 5 - 0
OASystem/OASystem.Domain/Dtos/Groups/Grp_ScheduleDto.cs

@@ -29,6 +29,11 @@ namespace OASystem.Domain.Dtos.Groups
         /// </summary>
         public int ScheduleId { get; set; }
 
+        /// <summary>
+        /// 团组Id
+        /// </summary>
+        public int DiId { get; set; }
+
         #endregion
 
         /// <summary>

+ 8 - 2
OASystem/OASystem.Domain/Dtos/Resource/Res_ItemVendorDto.cs

@@ -49,6 +49,11 @@ namespace OASystem.Domain.Dtos.Resource
         /// 供应商联系方式
         /// </summary>
         public string VendorMobile { get; set; }
+
+        /// <summary>
+        /// 供应商经营范围,单数值
+        /// </summary>
+        public string BusRange { get; set; }
     }
 
     #endregion
@@ -66,6 +71,7 @@ namespace OASystem.Domain.Dtos.Resource
         public string Remark { get; set; }
 
         public int SysUserId { get; set; }
+        public string BusRange { get; set; }
 
         /// <summary>
         /// 0:添加,1:修改,-1:删除
@@ -106,7 +112,7 @@ namespace OASystem.Domain.Dtos.Resource
         /// <summary>
         /// 类型Id
         /// </summary>
-        public int SetDataId { get; set; }
+        public int ItemTypeId { get; set; }
 
         /// <summary>
         /// 价格区间(最低)
@@ -125,7 +131,7 @@ namespace OASystem.Domain.Dtos.Resource
         public int ItemId { get; set; }
         public int VendorId { get; set; }
         public string ItemName { get; set; }
-        public int SetDataId { get; set; }
+        public int ItemTypeId { get; set; }
         public decimal CurrRate { get; set; }
         public string Remark { get; set; }
 

+ 6 - 0
OASystem/OASystem.Domain/Entities/Business/Bus_ConfItemInfo.cs

@@ -27,6 +27,12 @@ namespace OASystem.Domain.Entities.Business
         /// </summary>
         [SugarColumn(IsNullable = true, ColumnDataType = "int")]
         public int Count { get; set; }
+        /// <summary>
+        /// 规格
+        /// </summary>
+        [SugarColumn(IsNullable = true, ColumnDataType = "varchar(20)")]
+        public string Specs { get; set; }
+
         /// <summary>
         /// 本次采购金额
         /// </summary>

+ 10 - 1
OASystem/OASystem.Domain/Entities/Business/Bus_ConfItemListInfo.cs

@@ -6,6 +6,9 @@ using System.Threading.Tasks;
 
 namespace OASystem.Domain.Entities.Business
 {
+    /// <summary>
+    /// 会务物料采购总计
+    /// </summary>
     [SugarTable("Bus_ConfItemList")]
     public class Bus_ConfItemListInfo : EntityBase
     {
@@ -19,6 +22,12 @@ namespace OASystem.Domain.Entities.Business
         /// </summary>
         [SugarColumn(IsNullable = true, ColumnDataType = "decimal(10,2)")]
         public decimal TotalCost { get; set; }
-        
+
+        /// <summary>
+        /// Excel文件路径
+        /// </summary>
+        [SugarColumn(IsNullable = true, ColumnDataType = "nvarchar(255)")]
+        public string ExcelPath { get; set; }
+
     }
 }

+ 17 - 1
OASystem/OASystem.Domain/Entities/Resource/Res_ItemVendor.cs

@@ -12,6 +12,11 @@ namespace OASystem.Domain.Entities.Resource
     [SugarTable("Res_ItemVendor")]
     public class Res_ItemVendor : EntityBase
     {
+        /// <summary>
+        /// 供应商公司经营范围,SetDataId拼接,请注意拼接格式统一为英文逗号
+        /// </summary>
+        [SugarColumn(IsNullable = true, ColumnDataType = "varchar(50)")]
+        public string BusRange { get; set; }
         /// <summary>
         /// 供应商名称(公司全称)
         /// </summary>
@@ -50,6 +55,17 @@ namespace OASystem.Domain.Entities.Resource
 
     }
 
+    [SugarTable("Res_ItemType")]
+    public class Res_ItemTypeInfo : EntityBase
+    {
+        [SugarColumn(IsNullable = true, ColumnDataType = "int")]
+        public int SdId { get; set; }
+
+        [SugarColumn(IsNullable = true, ColumnDataType = "varchar(50)")]
+        public string TypeName { get; set; }
+
+    }
+
     /// <summary>
     /// 物料供应详细信息表
     /// </summary>
@@ -72,7 +88,7 @@ namespace OASystem.Domain.Entities.Resource
         /// 物料类型Id
         /// </summary>
         [SugarColumn(IsNullable = true, ColumnDataType = "int")]
-        public int SetDataId { get; set; }
+        public int ItemTypeId { get; set; }
 
         /// <summary>
         /// 最低单价

+ 67 - 2
OASystem/OASystem.Domain/ViewModels/Business/Bus_ConfItemListView.cs

@@ -1,4 +1,5 @@
-using System;
+using OASystem.Domain.ViewModels.Resource;
+using System;
 using System.Collections.Generic;
 using System.Linq;
 using System.Text;
@@ -8,6 +9,70 @@ namespace OASystem.Domain.ViewModels.Business
 {
     public class Bus_ConfItemListView
     {
-        public int MyProperty { get; set; }
+        public decimal TotalCost { get; set; }
+        public List<Bus_ConfItemView> ItemList { get; set; }
     }
+
+    public class Bus_ConfItemView
+    {
+        public int Id { get; set; }
+        public int ItemId { get; set; }
+        public string ItemName { get; set; }
+        public int Count { get; set; }
+        public decimal CurrCost { get; set; }
+        public string OpRemark { get; set; }
+    }
+
+    #region 可选物料列表
+
+    public class OptionalBusRangeView
+    {
+        public int SdId { get; set; }
+        public string SdName { get; set; }
+        public List<OptionalItemTypeView> ItemTypeList { get; set; }
+    }
+
+    public class OptionalItemTypeView
+    {
+        /// <summary>
+        /// 物料类型编号
+        /// </summary>
+        public int ItemTypeId { get; set; }
+
+        /// <summary>
+        /// 物料类型名称
+        /// </summary>
+        public string ItemTypeName { get; set; }
+
+        /// <summary>
+        /// 物料列表
+        /// </summary>
+        public List<Res_ItemInfoView> ItemList { get; set; }
+    }
+
+    #endregion
+
+
+    #region Excel
+
+    public class Bus_ConfItemExportView
+    {
+        public int RowNumber { get; set; }
+        public string VendorName { get; set; }
+        public string ItemName { get; set; }
+        public string ItemTypeName { get; set; }
+        public string Specs { get; set; }
+        public int Count { get; set; }
+        public decimal Price { get; set; }
+        public decimal TotalPrice
+        {
+            get
+            {
+                return this.Count * this.Price;
+            }
+        }
+        public string ItemRemark { get; set; }
+    }
+
+    #endregion
 }

+ 18 - 3
OASystem/OASystem.Domain/ViewModels/Resource/Res_ItemInfoView.cs

@@ -10,11 +10,18 @@ namespace OASystem.Domain.ViewModels.Resource
 
     public class Res_ItemInfoView
     {
+        
+
         /// <summary>
         /// 物料Id
         /// </summary>
         public int ItemId { get; set; }
 
+        /// <summary>
+        /// 物料名称
+        /// </summary>
+        public string ItemName { get; set; }
+
         /// <summary>
         /// 供应商Id
         /// </summary>
@@ -31,15 +38,20 @@ namespace OASystem.Domain.ViewModels.Resource
         public string VendorShortName { get; set; }
 
         /// <summary>
-        /// SetDataId
+        /// 物料类型Id
         /// </summary>
-        public int SetDataId { get; set; }
+        public int ItemTypeId { get; set; }
 
         /// <summary>
-        /// 物料类型,SetDataName
+        /// 物料类型名称
         /// </summary>
         public string ItemTypeName { get; set; }
 
+        /// <summary>
+        /// 物料类型所属SetDataId
+        /// </summary>
+        public int ItemTypeSetDataId { get; set; }
+
         /// <summary>
         /// 价格区间(最低)
         /// </summary>
@@ -65,12 +77,15 @@ namespace OASystem.Domain.ViewModels.Resource
 
     #endregion
 
+    
 
     #region 供应商
 
     public class Res_ItemVendorView
     {
         public int Id { get; set; }
+        public string BusRange { get; set; }
+        public string BusRange_Text { get; set; }
         public string FullName { get; set; }
         public string ShortName { get; set; }
         public string Address { get; set; }

+ 8 - 0
OASystem/OASystem.Domain/ViewModels/TencentOCR/IDCardOCRView.cs

@@ -57,4 +57,12 @@ namespace OASystem.Domain.ViewModels.TencentOCR
         /// </summary>
         public string ValidDate { get; set; }
     }
+
+    public class IDCardOCRAndDownUrlView : IDCardOCRView
+    {
+        /// <summary>
+        /// 下载文档地址
+        /// </summary>
+        public string DownUrl { get; set; }
+    }
 }

+ 191 - 0
OASystem/OASystem.Infrastructure/Repositories/Business/CommonBusRepository.cs

@@ -0,0 +1,191 @@
+using OASystem.Domain.Common;
+using OASystem.Domain.Dtos.Business;
+using OASystem.Domain.Entities.Business;
+using OASystem.Domain.ViewModels.Business;
+using OASystem.Domain.ViewModels.Resource;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace OASystem.Infrastructure.Repositories.Business
+{
+    public class CommonBusRepository : BaseRepository<EntityBase, ViewBase>
+    {
+        public CommonBusRepository(SqlSugarClient sqlSugar) : base(sqlSugar)
+        {
+        }
+
+        #region 可选物料集合
+
+        /// <summary>
+        /// 获取可选物料集合
+        /// </summary>
+        /// <returns></returns>
+        public async Task<List<OptionalBusRangeView>> GetViewList_OptionalItem()
+        {
+            List<OptionalBusRangeView> result = new List<OptionalBusRangeView>();
+
+            //获取业务范围
+            string sqlRange = string.Format(@" Select * From Sys_SetData With(Nolock) Where STid = {0} And IsDel=0 ", SetDataTypeDefaultParam.Media);
+            List<Sys_SetData> entitySetDataList = _sqlSugar.SqlQueryable<Sys_SetData>(sqlRange).ToList();
+
+            //获取物料信息
+            List<Res_ItemInfoView> itemSource = new List<Res_ItemInfoView>();
+            string sqlItemList = string.Format(@" Select 
+d.ItemName,d.Id as ItemId,s.Id as ItemTypeSetDataId,d.VendorId,v.FullName as VendorFullName,
+ v.ShortName as VendorShortName,t.Id as ItemTypeId,t.TypeName as ItemTypeName,
+ d.MinRate,d.MaxRate,d.CurrRate,d.Remark
+From Res_ItemDetail as d With(Nolock) 
+Inner Join Res_ItemType as t With(Nolock) On d.ItemTypeId = t.Id
+Inner Join Res_ItemVendor as v With(Nolock) On d.VendorId=v.Id
+Inner Join Sys_SetData as s With(Nolock) On t.SdId=s.Id ");
+
+            itemSource = _sqlSugar.SqlQueryable<Res_ItemInfoView>(sqlItemList).ToList();
+            if (itemSource.Count > 0)
+            {
+                foreach (var item in entitySetDataList)
+                {
+                    List<Res_ItemInfoView> tempList = itemSource.Where(s => s.ItemTypeSetDataId == item.Id).ToList();
+                    if (tempList.Count > 0)
+                    {
+                        OptionalBusRangeView _tempView = new OptionalBusRangeView()
+                        {
+                            SdId = item.Id,
+                            SdName = item.Name
+                        };
+
+                        List<OptionalItemTypeView> optionalItemTypeViewList = new List<OptionalItemTypeView>();
+
+                        var itemGroups = tempList.GroupBy(p => p.ItemTypeId);
+                        foreach (var group in itemGroups)
+                        {
+                            OptionalItemTypeView tempOptional = new OptionalItemTypeView();
+                            tempOptional.ItemTypeId = group.Key;
+                            tempOptional.ItemTypeName = group.First().ItemTypeName;
+                            tempOptional.ItemList = new List<Res_ItemInfoView>(group.ToList());
+                            optionalItemTypeViewList.Add(tempOptional);
+                        }
+                        _tempView.ItemTypeList = new List<OptionalItemTypeView>(optionalItemTypeViewList);
+                        result.Add(_tempView);
+                    }
+                }
+            }
+
+            return result;
+        }
+
+        #endregion
+
+        #region 会务物料采购清单
+
+        /// <summary>
+        /// 新增会务物料采购清单和具体采购物料信息
+        /// </summary>
+        /// <param name="_dto"></param>
+        /// <returns></returns>
+        public async Task<int> Insert_ConfItemList(Edit_OptionalItemListDto _dto)
+        {
+            Bus_ConfItemListInfo _check1 = await Query<Bus_ConfItemListInfo>(s => s.Diid == _dto.DiId).FirstAsync();
+            if (_check1 != null)
+            {
+                return -2;//已存在数据,无法新增,请检查BusController中非空验证
+            }
+
+            Bus_ConfItemListInfo _insert = new Bus_ConfItemListInfo();
+            _insert.Diid = _dto.DiId;
+            _insert.TotalCost = _dto.ConfItemList.Sum(s => (s.CurrCost * s.Count));
+            BeginTran();
+            try
+            {
+                int result = await _sqlSugar.Insertable(_insert).ExecuteReturnIdentityAsync();
+                if (result > 0)
+                {
+                    List<Bus_ConfItemInfo> insertList = new List<Bus_ConfItemInfo>();
+                    foreach (var item in _dto.ConfItemList)
+                    {
+                        Bus_ConfItemInfo temp = new Bus_ConfItemInfo();
+                        temp.ConfListId = result;
+                        temp.Count = item.Count;
+                        temp.CurrCost = item.CurrCost;
+                        temp.ItemId = item.ItemId;
+                        temp.OpRemark = item.OpRemark;
+                        insertList.Add(temp);
+                    }
+                    _sqlSugar.Insertable(insertList).UseParameter().ExecuteCommand();
+                    return 0;
+                }
+                else
+                {
+                    return -3;//保存清单主体数据失败
+                }
+            }
+            catch (Exception ex)
+            {
+                RollbackTran();
+                return -4;
+            }
+
+
+            return -1;
+        }
+
+        /// <summary>
+        /// 修改会务物料采购清单和具体采购物料信息(未存在删除、暂时)
+        /// </summary>
+        /// <param name="_dto"></param>
+        /// <returns></returns>
+        public async Task<int> Edit_ConfItemList(Edit_OptionalItemListDto _dto)
+        {
+            Bus_ConfItemListInfo _eidt = await Query<Bus_ConfItemListInfo>(s => s.Id == _dto.ConfItemListId).FirstAsync();
+            if (_eidt == null)
+            {
+                return -2;//不存在数据,无法修改,请检查BusController中非空验证
+            }
+
+            _eidt.TotalCost = _dto.ConfItemList.Sum(s => (s.CurrCost * s.Count));
+
+            BeginTran();
+            try
+            {
+                int result = await _sqlSugar.Updateable<Bus_ConfItemInfo>()
+                            .Where(s => s.Id == _dto.ConfItemListId)
+                            .UpdateColumns(s => new { TotalCost = _eidt.TotalCost })
+                            .ExecuteCommandAsync();
+                _sqlSugar.Deleteable<Bus_ConfItemInfo>().Where(it => it.ConfListId == _dto.ConfItemListId).ExecuteCommand();
+
+                if (result > 0)
+                {
+
+                    List<Bus_ConfItemInfo> insertList = new List<Bus_ConfItemInfo>();
+                    foreach (var item in _dto.ConfItemList)
+                    {
+                        Bus_ConfItemInfo temp = new Bus_ConfItemInfo();
+                        temp.ConfListId = result;
+                        temp.Count = item.Count;
+                        temp.CurrCost = item.CurrCost;
+                        temp.ItemId = item.ItemId;
+                        temp.OpRemark = item.OpRemark;
+                        insertList.Add(temp);
+                    }
+                    _sqlSugar.Insertable(insertList).UseParameter().ExecuteCommand();
+                    return 0;
+                }
+                else
+                {
+                    return -3;//保存清单主体数据失败
+                }
+            }
+            catch (Exception ex)
+            {
+                RollbackTran();
+                return -4;
+            }
+
+            return -1;
+        }
+
+        #endregion
+    }
+}

+ 0 - 17
OASystem/OASystem.Infrastructure/Repositories/Business/CommonBusRepositroy.cs

@@ -1,17 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace OASystem.Infrastructure.Repositories.Business
-{
-    public class CommonBusRepositroy : BaseRepository<EntityBase, ViewBase>
-    {
-        public CommonBusRepositroy(SqlSugarClient sqlSugar) : base(sqlSugar)
-        {
-        }
-
-
-    }
-}

+ 13 - 2
OASystem/OASystem.Infrastructure/Repositories/Groups/GrpScheduleRepository.cs

@@ -24,9 +24,15 @@ namespace OASystem.Infrastructure.Repositories.Groups
                 sqlWhere += string.Format(@" And s.Id in ( Select Id From Grp_SchedulePerson With(Nolock) Where SysUserId = '{0}' ) ", _dto.SysUserId);
             }
 
+            if (_dto.DiId > 0)
+            {
+                sqlWhere = string.Format(@" And s.DiId = '{0}' ", _dto.DiId);
+            }
+
+            //请放在最后
             if (_dto.ScheduleId > 0)
             {
-                sqlWhere += string.Format(@" And s.Id = '{0}' ", _dto.ScheduleId);
+                sqlWhere = string.Format(@" And s.Id = '{0}' ", _dto.ScheduleId);
             }
 
             if (!string.IsNullOrEmpty(sqlWhere.Trim()))
@@ -170,7 +176,12 @@ namespace OASystem.Infrastructure.Repositories.Groups
         {
             List<Grp_ScheduleView> _viewList = new List<Grp_ScheduleView>();
             string sqlInner = this.SetSql_GrpScheduleDto(_dto);
-            string sql = string.Format(@" Select * From ( Select ROW_NUMBER() Over(order By Id desc) as RowNumber,* From ( {2} ) ) as tb Where tb.RowNumber Between {0} And {1} ", (((_dto.PageIndex > 0) ? (_dto.PageIndex - 1) : 0) * _dto.PageSize) + 1, (((_dto.PageIndex > 0) ? (_dto.PageIndex - 1) : 0) + 1) * _dto.PageSize, sqlInner);
+            string sql = string.Format(@" Select * From(
+Select * From ( Select ROW_NUMBER() Over(order By Id desc) as RowNumber,* From ( {2} )
+as a ) as tb Where tb.RowNumber Between {0} And {1} ",
+(((_dto.PageIndex > 0) ? (_dto.PageIndex - 1) : 0) * _dto.PageSize) + 1,
+(((_dto.PageIndex > 0) ? (_dto.PageIndex - 1) : 0) + 1) * _dto.PageSize,
+sqlInner);
             _viewList = await _sqlSugar.SqlQueryable<Grp_ScheduleView>(sql).ToListAsync();
             return _viewList;
         }

+ 66 - 31
OASystem/OASystem.Infrastructure/Repositories/Resource/ResItemInfoRepository.cs

@@ -45,6 +45,12 @@ namespace OASystem.Infrastructure.Repositories.Resource
             {
                 sqlWhere += string.Format(" And ( FullName Like '%{0}%' Or ShortName Like '%{0}%' ) ", _dto.VendorName);
             }
+            if (!string.IsNullOrEmpty(_dto.BusRange))//供应商经营范围
+            {
+                //List<int> list = _dto.BusRange.Split(',').ToList().ConvertAll(t => Convert.ToInt32(t));
+                //单数值匹配
+                sqlWhere += string.Format(" And BusRange Like '%,{0},%' ", _dto.BusRange);
+            }
 
             //if (!string.IsNullOrEmpty(sqlWhere.Trim()))
             //{
@@ -56,13 +62,26 @@ namespace OASystem.Infrastructure.Repositories.Resource
             int currPIndex = (((_dto.PageIndex > 0) ? (_dto.PageIndex - 1) : 0) * _dto.PageSize) + 1;
             int currPSize = (((_dto.PageIndex > 0) ? (_dto.PageIndex - 1) : 0) + 1) * _dto.PageSize;
 
-            string sql = string.Format(@" Select ROW_NUMBER() Over(order By Id desc) as RowNumber,* From ( 
- Select Id,FullName,ShortName,Address,Linker,Job,Mobile,Remark From Res_ItemVendor With(Nolock) {2}
-) ) as tb Where tb.RowNumber Between {0} And {1} ", currPIndex, currPSize, sqlWhere);
+            string sql = string.Format(@" Select * From(Select ROW_NUMBER() Over(order By Id desc) as RowNumber, Id,FullName,ShortName,Address,Linker,
+Job,Mobile,Remark From Res_ItemVendor With(Nolock) {2}
+) as tb Where tb.RowNumber Between {0} And {1} ", currPIndex, currPSize, sqlWhere);
             Res_ItemVendorListView rst = new Res_ItemVendorListView();
             rst.CurrPageIndex = currPIndex;
             rst.CurrPageSize = currPSize;
-            rst.DataList = _sqlSugar.SqlQueryable<Res_ItemVendorView>(sql).ToList();
+            List<Res_ItemVendorView> dataSource = _sqlSugar.SqlQueryable<Res_ItemVendorView>(sql).ToList();
+
+            foreach (var item in dataSource)
+            {
+                string rangeStr = "";
+                List<int> rangeList = item.BusRange.TrimStart(',').Split(',').ToList().ConvertAll(t => Convert.ToInt32(t));
+                foreach (var item2 in rangeList)
+                {
+                    rangeStr += GetText_BusRanger(item2) + ",";
+                }
+                item.BusRange_Text = rangeStr;
+            }
+            rst.DataList = new List<Res_ItemVendorView>(dataSource);
+
             if (rst.DataList.Count > 0)
             {
                 string sqlCount = string.Format(@" Select Id From Res_ItemVendor With(Nolock) {0} ", sqlWhere);
@@ -73,6 +92,17 @@ namespace OASystem.Infrastructure.Repositories.Resource
             return rst;
         }
 
+        private string GetText_BusRanger(int sdid)
+        {
+            List<Sys_SetData> dataList = _sqlSugar.Queryable<Sys_SetData>().Where(s => s.STid == 21).ToList();
+            string result = "未知类型" + sdid;
+            if (dataList.FirstOrDefault(s => s.Id == sdid) != null)
+            {
+                result = dataList.FirstOrDefault(s => s.Id == sdid).Name;
+            }
+            return result;
+        }
+
         /// <summary>
         /// 供应商信息查询
         /// </summary>
@@ -85,6 +115,13 @@ namespace OASystem.Infrastructure.Repositories.Resource
             if (_dto.VendorId > 0)
             {
                 Res_ItemVendorView _view = _sqlSugar.Queryable<Res_ItemVendorView>().Where(s => s.Id == _dto.VendorId).First();
+                string rangeStr = "";
+                List<int> rangeList = _view.BusRange.TrimStart(',').Split(',').ToList().ConvertAll(t => Convert.ToInt32(t));
+                foreach (var item2 in rangeList)
+                {
+                    rangeStr += GetText_BusRanger(item2) + ",";
+                }
+                _view.BusRange_Text = rangeStr;
                 return _view;
             }
             else
@@ -116,6 +153,7 @@ namespace OASystem.Infrastructure.Repositories.Resource
             dic.Add("DeleteTime", "Null");
             dic.Add("Remark", _dto.Remark);
             dic.Add("IsDel", 0);
+            dic.Add("BusRange", string.IsNullOrEmpty(_dto.BusRange) ? "," : _dto.BusRange);
 
             return await InsertDataByDictionary(dic, "Res_ItemVendor");
 
@@ -131,7 +169,7 @@ namespace OASystem.Infrastructure.Repositories.Resource
         {
             var result = await _sqlSugar.Updateable<Res_ItemVendor>()
                 .Where(s => s.Id == _entity.Id)
-                .UpdateColumns(s => new { s.FullName, s.ShortName, s.Address, s.Linker, s.Mobile, s.Job, s.Remark })
+                .UpdateColumns(s => new { s.FullName, s.ShortName, s.Address, s.Linker, s.Mobile, s.BusRange, s.Job, s.Remark })
                 .ExecuteCommandAsync();
 
             return result > 0;
@@ -178,9 +216,9 @@ namespace OASystem.Infrastructure.Repositories.Resource
             {
                 sqlWhere += string.Format(" And d.VendorId = {0} ", _dto.VendorId);
             }
-            if (_dto.SetDataId > 0)//类型Id
+            if (_dto.ItemTypeId > 0)//类型Id
             {
-                sqlWhere += string.Format(" And d.SetDataId = {0} ", _dto.SetDataId);
+                sqlWhere += string.Format(" And d.ItemTypeId = {0} ", _dto.ItemTypeId);
             }
             if (_dto.MinRate > 0)//价格区间(最低)
             {
@@ -201,20 +239,23 @@ namespace OASystem.Infrastructure.Repositories.Resource
             int currPIndex = (((_dto.PageIndex > 0) ? (_dto.PageIndex - 1) : 0) * _dto.PageSize) + 1;
             int currPSize = (((_dto.PageIndex > 0) ? (_dto.PageIndex - 1) : 0) + 1) * _dto.PageSize;
 
-            string sql = string.Format(@" Select ROW_NUMBER() Over(order By Id desc) as RowNumber,* From ( 
- Select d.Id as ItemId,d.VendorId,v.FullName as VendorFullName,v.ShortName as VendorShortName,sd.Id as SetDataId,sd.Name as ItemTypeName,d.MinRate,d.MaxRate,d.CurrRate,d.Remark
+            string sql = string.Format(@" SELECT * FROM(
+ Select ROW_NUMBER() Over(order By d.Id desc) as RowNumber, d.ItemName,d.Id as ItemId,d.VendorId,v.FullName as VendorFullName,
+ v.ShortName as VendorShortName,t.Id as ItemTypeId,t.TypeName as ItemTypeName,
+ d.MinRate,d.MaxRate,d.CurrRate,d.Remark
  From Res_ItemDetail as d With(Nolock) 
  Inner Join Res_ItemVendor as v With(Nolock) On d.VendorId=v.Id
- Inner Join Sys_SetData as sd With(Nolock) On d.SetDataId=sd.Id
-{2}
-) ) as tb Where tb.RowNumber Between {0} And {1} ", currPIndex, currPSize, sqlWhere);
+ Inner Join Res_ItemType as t With(Nolock) On d.ItemTypeId=t.Id
+ {2}
+)  as tb Where tb.RowNumber Between {0} And {1} ", currPIndex, currPSize, sqlWhere);
+
             Res_ItemInfoListView rst = new Res_ItemInfoListView();
             rst.CurrPageIndex = currPIndex;
             rst.CurrPageSize = currPSize;
             rst.DataList = _sqlSugar.SqlQueryable<Res_ItemInfoView>(sql).ToList();
             if (rst.DataList.Count > 0)
             {
-                string sqlCount = string.Format(@" Select Id From Res_ItemDetail as d 5 With(Nolock) {0} ", sqlWhere);
+                string sqlCount = string.Format(@" Select Id From Res_ItemDetail as d  With(Nolock) {0} ", sqlWhere);
                 int dataCount = _sqlSugar.SqlQueryable<Res_ItemInfoView>(sqlCount).Count();
                 rst.DataCount = dataCount;
             }
@@ -233,9 +274,12 @@ namespace OASystem.Infrastructure.Repositories.Resource
 
             if (_dto.ItemId > 0)
             {
-                string sql = string.Format(@" Select d.Id as ItemId,d.VendorId,v.FullName as VendorFullName,v.ShortName as VendorShortName,sd.Id as SetDataId,sd.Name as ItemTypeName,
+                string sql = string.Format(@" Select d.ItemName,d.Id as ItemId,d.VendorId,v.FullName as VendorFullName,v.ShortName as VendorShortName,t.Id as ItemTypeId,t.TypeName as ItemTypeName,
  d.MinRate,d.MaxRate,d.CurrRate,d.Remark
- From Res_ItemDetail as d With(Nolock) Where d.Id={0} ", _dto.ItemId);
+ From Res_ItemDetail as d With(Nolock)
+ Inner Join Res_ItemType as t With(Nolock) On d.ItemTypeId=t.Id
+Inner Join Res_ItemVendor as v With(Nolock) On d.VendorId=v.Id
+Where d.Id={0} ", _dto.ItemId);
 
                 Res_ItemInfoView _view = _sqlSugar.SqlQueryable<Res_ItemInfoView>(sql).First();
                 return _view;
@@ -248,6 +292,11 @@ namespace OASystem.Infrastructure.Repositories.Resource
             return null;
         }
 
+        /// <summary>
+        /// 修改物料信息
+        /// </summary>
+        /// <param name="_entity"></param>
+        /// <returns></returns>
         public async Task<bool> updItemInfo(Res_ItemDetailInfo _entity)
         {
             var source = await _sqlSugar.Queryable<Res_ItemDetailInfo>().Where(s => s.Id == _entity.Id).FirstAsync();
@@ -283,7 +332,7 @@ namespace OASystem.Infrastructure.Repositories.Resource
 
                 var result = await _sqlSugar.Updateable<Res_ItemDetailInfo>()
                    .Where(s => s.Id == _entity.Id)
-                   .UpdateColumns(s => new { s.CurrDt, s.CurrRate, s.ItemName, s.MaxDt, s.MaxRate, s.MinDt, s.MinRate, s.Remark, s.SetDataId, s.VendorId })
+                   .UpdateColumns(s => new { s.CurrDt, s.CurrRate, s.ItemName, s.MaxDt, s.MaxRate, s.MinDt, s.MinRate, s.Remark, s.ItemTypeId, s.VendorId })
                    .ExecuteCommandAsync();
                 return result > 0;
             }
@@ -291,7 +340,7 @@ namespace OASystem.Infrastructure.Repositories.Resource
         }
 
         /// <summary>
-        /// 删除供应商信息
+        /// 删除物料信息
         /// </summary>
         /// <param name="_entity"></param>
         /// <returns></returns>
@@ -310,19 +359,5 @@ namespace OASystem.Infrastructure.Repositories.Resource
 
         #endregion
 
-
-        /// <summary>
-        /// 获取 物料类型列表
-        /// </summary>
-        /// <returns></returns>
-        public List<SetDataView> GetItemTypeListBySetData()
-        {
-            string sql = string.Format(@" Select d.Id,d.Name,d.STid From Sys_SetData as d With(Nolock) 
-Inner Join Sys_SetDataType as t With(Nolock) On d.STid=t.Id 
-Where t.IsDel=0 And d.IsDel=0 And t.Id=58 ");
-            List<SetDataView> list = _sqlSugar.SqlQueryable<SetDataView>(sql).ToList();
-
-            return list;
-        }
     }
 }

+ 30 - 10
OASystem/OASystem.Infrastructure/Repositories/System/SystemMenuPermissionRepository.cs

@@ -79,12 +79,12 @@ namespace OASystem.Infrastructure.Repositories.System
                       d.IosUrl
                       from Sys_UserAuthority a inner join Sys_PageFunctionPermission b on a.FId = b.Id 
                       inner join Sys_SystemMenuPermission d on a.SmId = d.Id inner join Sys_SetData c on c.Id = d.Mid
-                      where uid = {uid} and b.Id = 1 and a.IsDel= 0  and b.IsDel = 0 
+                      where uid = {uid} and a.IsDel= 0  and b.IsDel = 0 
                       and b.IsEnable = 1 and c.IsDel = 0 and d.IsDel = 0   ";
 
                 if (PortType == 1)
                 {
-                    sql += $@"   and d.IsEnable = 1  group by 
+                    sql += $@" and b.Id = 1 and d.IsEnable = 1  group by 
                       a.UId,a.SmId,b.Id,b.FunctionName,b.FunctionCode,c.Id,
                       c.Name,c.STid,d.Id,d.Name,d.SystemMenuCode,d.webUrl,d.AndroidUrl,d.icon,
                       d.IosUrl";
@@ -92,7 +92,7 @@ namespace OASystem.Infrastructure.Repositories.System
                 }
                 else if (PortType == 2)
                 {
-                    sql += $@"  and d.phoneIsEnable = 1 group by 
+                    sql += $@" and d.phoneIsEnable = 1 group by 
                       a.UId,a.SmId,b.Id,b.FunctionName,b.FunctionCode,c.Id,
                       c.Name,c.STid,d.Id,d.Name,d.SystemMenuCode,d.webUrl,d.AndroidUrl,d.icon,
                       d.IosUrl ";
@@ -116,20 +116,40 @@ namespace OASystem.Infrastructure.Repositories.System
                             var modul = item.FirstOrDefault();
                             if (modul != null)
                             {
-                                arr.Add(new
+                                if (modul.modulName.Contains("主页"))
                                 {
-                                    modulName = modul.modulName,
-                                    modulid = modul.modulid,
-                                    pageList = item
-                                });
+                                    arr.Insert(0, new
+                                    {
+                                        modulName = modul.modulName,
+                                        modulid = modul.modulid,
+                                        pageList = item
+                                    });
+                                }
+                                else
+                                {
+                                    arr.Add(new
+                                    {
+                                        modulName = modul.modulName,
+                                        modulid = modul.modulid,
+                                        pageList = item
+                                    });
+                                }
                             }
                         }
 
                     }
                     else if (PortType == 2)
                     {
-                        var pages = DBData.Select(x => x.pageid).ToArray();
-                        arr = ArrayList.Adapter(pages);
+                        var AndMenu = DBData.GroupBy(x => x.SmId).ToList();
+
+                        foreach (var item in AndMenu)
+                        {
+                            arr.Add(new
+                            {
+                                pageid = item.Key,
+                                opList = item.Select(x=>x.Funid).ToList(),
+                            });
+                        }           
                     }
 
                     result.Data = arr;

+ 1 - 0
OASystem/OASystem.Infrastructure/Tools/CommonFun.cs

@@ -234,4 +234,5 @@ public static class CommonFun
     }
 
     #endregion
+
 }