Yue 3 роки тому
коміт
77c5824f50
100 змінених файлів з 6765 додано та 0 видалено
  1. 63 0
      .gitattributes
  2. 364 0
      .gitignore
  3. BIN
      Doc/玮博电子进销存管理系统2019.6.25_2.xmind
  4. BIN
      Doc/玮博电子进销存管理系统使用疑问.20190923.docx
  5. 33 0
      SourceCode/VberTech.Test/AppTestBase.cs
  6. 36 0
      SourceCode/VberTech.Test/Properties/AssemblyInfo.cs
  7. 40 0
      SourceCode/VberTech.Test/UserAppService_Tests.cs
  8. 252 0
      SourceCode/VberTech.Test/VberTech.Test.csproj
  9. 16 0
      SourceCode/VberTech.Test/VberTechTestModule.cs
  10. 61 0
      SourceCode/VberTech.Test/app.config
  11. 56 0
      SourceCode/VberTech.Test/packages.config
  12. 66 0
      SourceCode/VberTech.sln
  13. 44 0
      SourceCode/VberTech/VberTech.Application/BaseBusiness/ProjectTypes/Dto/ProjectTypeCreateDto.cs
  14. 39 0
      SourceCode/VberTech/VberTech.Application/BaseBusiness/ProjectTypes/Dto/ProjectTypeDto.cs
  15. 51 0
      SourceCode/VberTech/VberTech.Application/BaseBusiness/ProjectTypes/Dto/ProjectTypeUpdateDto.cs
  16. 25 0
      SourceCode/VberTech/VberTech.Application/BaseBusiness/ProjectTypes/IProjectTypesApplicationService.cs
  17. 219 0
      SourceCode/VberTech/VberTech.Application/BaseBusiness/ProjectTypes/ProjectTypesApplicationService.cs
  18. 43 0
      SourceCode/VberTech/VberTech.Application/BaseBusiness/StoreHouses/Dto/StoreHouseCreateDto.cs
  19. 38 0
      SourceCode/VberTech/VberTech.Application/BaseBusiness/StoreHouses/Dto/StoreHouseDto.cs
  20. 50 0
      SourceCode/VberTech/VberTech.Application/BaseBusiness/StoreHouses/Dto/StoreHouseUpdateDto.cs
  21. 24 0
      SourceCode/VberTech/VberTech.Application/BaseBusiness/StoreHouses/IStoreHousesApplicationService.cs
  22. 200 0
      SourceCode/VberTech/VberTech.Application/BaseBusiness/StoreHouses/StoreHousesApplicationService.cs
  23. 22 0
      SourceCode/VberTech/VberTech.Application/BaseSysInfo/AppGuids/Dto/SysAppGuidCreateDto.cs
  24. 22 0
      SourceCode/VberTech/VberTech.Application/BaseSysInfo/AppGuids/Dto/SysAppGuidDto.cs
  25. 25 0
      SourceCode/VberTech/VberTech.Application/BaseSysInfo/AppGuids/Dto/SysAppGuidUpdateDto.cs
  26. 15 0
      SourceCode/VberTech/VberTech.Application/BaseSysInfo/AppGuids/ISysAppGuidsApplicationService.cs
  27. 43 0
      SourceCode/VberTech/VberTech.Application/BaseSysInfo/AppGuids/SysAppGuidsApplicationService.cs
  28. 245 0
      SourceCode/VberTech/VberTech.Application/BaseSysInfo/AttachFile/AttachFilesAppService.cs
  29. 54 0
      SourceCode/VberTech/VberTech.Application/BaseSysInfo/AttachFile/Dto/AttachFileCreateDto.cs
  30. 20 0
      SourceCode/VberTech/VberTech.Application/BaseSysInfo/AttachFile/Dto/AttachFileDto.cs
  31. 33 0
      SourceCode/VberTech/VberTech.Application/BaseSysInfo/AttachFile/Dto/AttachFileUpdateDto.cs
  32. 15 0
      SourceCode/VberTech/VberTech.Application/BaseSysInfo/AttachFile/Dto/QueryAttachDto.cs
  33. 19 0
      SourceCode/VberTech/VberTech.Application/BaseSysInfo/AttachFile/IAttachFilesApplicationService.cs
  34. 129 0
      SourceCode/VberTech/VberTech.Application/BaseSysInfo/AuditLog/AuditLogsAppService.cs
  35. 7 0
      SourceCode/VberTech/VberTech.Application/BaseSysInfo/AuditLog/Dto/QueryMethodName.cs
  36. 22 0
      SourceCode/VberTech/VberTech.Application/BaseSysInfo/AuditLog/Dto/SysLogDto.cs
  37. 16 0
      SourceCode/VberTech/VberTech.Application/BaseSysInfo/AuditLog/IAuditLogsAppService.cs
  38. 14 0
      SourceCode/VberTech/VberTech.Application/BaseSysInfo/DataPermissionModelDto.cs
  39. 15 0
      SourceCode/VberTech/VberTech.Application/BaseSysInfo/ExcelImportDto.cs
  40. 35 0
      SourceCode/VberTech/VberTech.Application/BaseSysInfo/Functions/Dto/FunctionCreateDto.cs
  41. 28 0
      SourceCode/VberTech/VberTech.Application/BaseSysInfo/Functions/Dto/FunctionDto.cs
  42. 35 0
      SourceCode/VberTech/VberTech.Application/BaseSysInfo/Functions/Dto/FunctionUpdateDto.cs
  43. 21 0
      SourceCode/VberTech/VberTech.Application/BaseSysInfo/Functions/Dto/MoveFunctionDto.cs
  44. 249 0
      SourceCode/VberTech/VberTech.Application/BaseSysInfo/Functions/FunctionsAppService.cs
  45. 18 0
      SourceCode/VberTech/VberTech.Application/BaseSysInfo/Functions/IFunctionsAppService.cs
  46. 42 0
      SourceCode/VberTech/VberTech.Application/BaseSysInfo/Help/Dto/SysHelpCreateDto.cs
  47. 37 0
      SourceCode/VberTech/VberTech.Application/BaseSysInfo/Help/Dto/SysHelpDto.cs
  48. 43 0
      SourceCode/VberTech/VberTech.Application/BaseSysInfo/Help/Dto/SysHelpUpdateDto.cs
  49. 9 0
      SourceCode/VberTech/VberTech.Application/BaseSysInfo/Help/ISysHelpsApplicationService.cs
  50. 55 0
      SourceCode/VberTech/VberTech.Application/BaseSysInfo/Help/SysHelpsApplicationService.cs
  51. 16 0
      SourceCode/VberTech/VberTech.Application/BaseSysInfo/MoveDto.cs
  52. 14 0
      SourceCode/VberTech/VberTech.Application/BaseSysInfo/Roles/Dto/AuthDto.cs
  53. 24 0
      SourceCode/VberTech/VberTech.Application/BaseSysInfo/Roles/Dto/PermissionDto.cs
  54. 28 0
      SourceCode/VberTech/VberTech.Application/BaseSysInfo/Roles/Dto/RoleCreateDto.cs
  55. 33 0
      SourceCode/VberTech/VberTech.Application/BaseSysInfo/Roles/Dto/RoleDto.cs
  56. 25 0
      SourceCode/VberTech/VberTech.Application/BaseSysInfo/Roles/Dto/RoleUpdateDto.cs
  57. 21 0
      SourceCode/VberTech/VberTech.Application/BaseSysInfo/Roles/IRolesAppService.cs
  58. 240 0
      SourceCode/VberTech/VberTech.Application/BaseSysInfo/Roles/RolesAppService.cs
  59. 23 0
      SourceCode/VberTech/VberTech.Application/BaseSysInfo/Settings/Dto/SettingCreateDto.cs
  60. 17 0
      SourceCode/VberTech/VberTech.Application/BaseSysInfo/Settings/Dto/SettingDto.cs
  61. 24 0
      SourceCode/VberTech/VberTech.Application/BaseSysInfo/Settings/Dto/SettingUpdateDto.cs
  62. 11 0
      SourceCode/VberTech/VberTech.Application/BaseSysInfo/Settings/ISettingsAppService.cs
  63. 95 0
      SourceCode/VberTech/VberTech.Application/BaseSysInfo/Settings/SettingsAppService.cs
  64. 16 0
      SourceCode/VberTech/VberTech.Application/BaseSysInfo/States/Dto/QueryStateDisplayValue.cs
  65. 27 0
      SourceCode/VberTech/VberTech.Application/BaseSysInfo/States/Dto/StateCreateDto.cs
  66. 14 0
      SourceCode/VberTech/VberTech.Application/BaseSysInfo/States/Dto/StateDisplayDto.cs
  67. 17 0
      SourceCode/VberTech/VberTech.Application/BaseSysInfo/States/Dto/StateDto.cs
  68. 29 0
      SourceCode/VberTech/VberTech.Application/BaseSysInfo/States/Dto/StateUpdateDto.cs
  69. 26 0
      SourceCode/VberTech/VberTech.Application/BaseSysInfo/States/IStatesAppService.cs
  70. 157 0
      SourceCode/VberTech/VberTech.Application/BaseSysInfo/States/StatesAppService.cs
  71. 15 0
      SourceCode/VberTech/VberTech.Application/BaseSysInfo/TreeDto.cs
  72. 32 0
      SourceCode/VberTech/VberTech.Application/BaseSysInfo/Users/Dto/UserCreateDto.cs
  73. 40 0
      SourceCode/VberTech/VberTech.Application/BaseSysInfo/Users/Dto/UserDto.cs
  74. 30 0
      SourceCode/VberTech/VberTech.Application/BaseSysInfo/Users/Dto/UserUpdateDto.cs
  75. 24 0
      SourceCode/VberTech/VberTech.Application/BaseSysInfo/Users/IUsersAppService.cs
  76. 354 0
      SourceCode/VberTech/VberTech.Application/BaseSysInfo/Users/UsersAppService.cs
  77. 68 0
      SourceCode/VberTech/VberTech.Application/Bills/OrderSendBill/Dto/OrderSendBillCreateDto.cs
  78. 51 0
      SourceCode/VberTech/VberTech.Application/Bills/OrderSendBill/Dto/OrderSendBillDto.cs
  79. 60 0
      SourceCode/VberTech/VberTech.Application/Bills/OrderSendBill/Dto/OrderSendBillUpdateDto.cs
  80. 84 0
      SourceCode/VberTech/VberTech.Application/Bills/OrderSendBill/Dto/OrderSendItemDto.cs
  81. 35 0
      SourceCode/VberTech/VberTech.Application/Bills/OrderSendBill/IOrderSendBillsApplicationService.cs
  82. 343 0
      SourceCode/VberTech/VberTech.Application/Bills/OrderSendBill/OrderSendBillsApplicationService.cs
  83. 88 0
      SourceCode/VberTech/VberTech.Application/Bills/StatementBill/Dto/SendItemsDto.cs
  84. 49 0
      SourceCode/VberTech/VberTech.Application/Bills/StatementBill/Dto/StatementBillCreateDto.cs
  85. 41 0
      SourceCode/VberTech/VberTech.Application/Bills/StatementBill/Dto/StatementBillDto.cs
  86. 42 0
      SourceCode/VberTech/VberTech.Application/Bills/StatementBill/Dto/StatementBillUpdateDto.cs
  87. 35 0
      SourceCode/VberTech/VberTech.Application/Bills/StatementBill/IStatementBillsApplicationService.cs
  88. 316 0
      SourceCode/VberTech/VberTech.Application/Bills/StatementBill/StatementBillsApplicationService.cs
  89. 430 0
      SourceCode/VberTech/VberTech.Application/Common/CommonAppService.cs
  90. 49 0
      SourceCode/VberTech/VberTech.Application/Common/Dto/CommonDto.cs
  91. 57 0
      SourceCode/VberTech/VberTech.Application/Common/ICommonAppService.cs
  92. 84 0
      SourceCode/VberTech/VberTech.Application/Common/PlanTaskRemindService.cs
  93. 53 0
      SourceCode/VberTech/VberTech.Application/Common/RemindJob.cs
  94. 32 0
      SourceCode/VberTech/VberTech.Application/Customers/Address/Dto/CustomerSupplierAddressCreateDto.cs
  95. 29 0
      SourceCode/VberTech/VberTech.Application/Customers/Address/Dto/CustomerSupplierAddressDto.cs
  96. 37 0
      SourceCode/VberTech/VberTech.Application/Customers/Address/Dto/CustomerSupplierAddressUpdateDto.cs
  97. 355 0
      SourceCode/VberTech/VberTech.Application/Customers/CustomerSuppliersApplicationService.cs
  98. 21 0
      SourceCode/VberTech/VberTech.Application/Customers/DefaultProduct/Dto/CustomerDefaultProductCreateDto.cs
  99. 23 0
      SourceCode/VberTech/VberTech.Application/Customers/DefaultProduct/Dto/CustomerDefaultProductDto.cs
  100. 23 0
      SourceCode/VberTech/VberTech.Application/Customers/DefaultProduct/Dto/CustomerDefaultProductUpdateDto.cs

+ 63 - 0
.gitattributes

@@ -0,0 +1,63 @@
+###############################################################################
+# Set default behavior to automatically normalize line endings.
+###############################################################################
+* text=auto
+
+###############################################################################
+# Set default behavior for command prompt diff.
+#
+# This is need for earlier builds of msysgit that does not have it on by
+# default for csharp files.
+# Note: This is only used by command line
+###############################################################################
+#*.cs     diff=csharp
+
+###############################################################################
+# Set the merge driver for project and solution files
+#
+# Merging from the command prompt will add diff markers to the files if there
+# are conflicts (Merging from VS is not affected by the settings below, in VS
+# the diff markers are never inserted). Diff markers may cause the following 
+# file extensions to fail to load in VS. An alternative would be to treat
+# these files as binary and thus will always conflict and require user
+# intervention with every merge. To do so, just uncomment the entries below
+###############################################################################
+#*.sln       merge=binary
+#*.csproj    merge=binary
+#*.vbproj    merge=binary
+#*.vcxproj   merge=binary
+#*.vcproj    merge=binary
+#*.dbproj    merge=binary
+#*.fsproj    merge=binary
+#*.lsproj    merge=binary
+#*.wixproj   merge=binary
+#*.modelproj merge=binary
+#*.sqlproj   merge=binary
+#*.wwaproj   merge=binary
+
+###############################################################################
+# behavior for image files
+#
+# image files are treated as binary by default.
+###############################################################################
+#*.jpg   binary
+#*.png   binary
+#*.gif   binary
+
+###############################################################################
+# diff behavior for common document formats
+# 
+# Convert binary document formats to text before diffing them. This feature
+# is only available from the command line. Turn it on by uncommenting the 
+# entries below.
+###############################################################################
+#*.doc   diff=astextplain
+#*.DOC   diff=astextplain
+#*.docx  diff=astextplain
+#*.DOCX  diff=astextplain
+#*.dot   diff=astextplain
+#*.DOT   diff=astextplain
+#*.pdf   diff=astextplain
+#*.PDF   diff=astextplain
+#*.rtf   diff=astextplain
+#*.RTF   diff=astextplain

+ 364 - 0
.gitignore

@@ -0,0 +1,364 @@
+## Ignore Visual Studio temporary files, build results, and
+## files generated by popular Visual Studio add-ons.
+##
+## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
+
+# User-specific files
+*.rsuser
+*.suo
+*.user
+*.userosscache
+*.sln.docstates
+
+# User-specific files (MonoDevelop/Xamarin Studio)
+*.userprefs
+
+# Mono auto generated files
+mono_crash.*
+
+# Build results
+[Dd]ebug/
+[Dd]ebugPublic/
+[Rr]elease/
+[Rr]eleases/
+x64/
+x86/
+[Ww][Ii][Nn]32/
+[Aa][Rr][Mm]/
+[Aa][Rr][Mm]64/
+bld/
+[Bb]in/
+[Oo]bj/
+[Oo]ut/
+[Ll]og/
+[Ll]ogs/
+_bundles/
+
+# Visual Studio 2015/2017 cache/options directory
+.vs/
+# Uncomment if you have tasks that create the project's static files in wwwroot
+#wwwroot/
+
+# Visual Studio 2017 auto generated files
+Generated\ Files/
+
+# MSTest test Results
+[Tt]est[Rr]esult*/
+[Bb]uild[Ll]og.*
+
+# NUnit
+*.VisualState.xml
+TestResult.xml
+nunit-*.xml
+
+# Build Results of an ATL Project
+[Dd]ebugPS/
+[Rr]eleasePS/
+dlldata.c
+
+# Benchmark Results
+BenchmarkDotNet.Artifacts/
+
+# .NET Core
+project.lock.json
+project.fragment.lock.json
+artifacts/
+
+# ASP.NET Scaffolding
+ScaffoldingReadMe.txt
+
+# StyleCop
+StyleCopReport.xml
+
+# Files built by Visual Studio
+*_i.c
+*_p.c
+*_h.h
+*.ilk
+*.meta
+*.obj
+*.iobj
+*.pch
+*.pdb
+*.ipdb
+*.pgc
+*.pgd
+*.rsp
+*.sbr
+*.tlb
+*.tli
+*.tlh
+*.tmp
+*.tmp_proj
+*_wpftmp.csproj
+*.log
+*.vspscc
+*.vssscc
+.builds
+*.pidb
+*.svclog
+*.scc
+
+# Chutzpah Test files
+_Chutzpah*
+
+# Visual C++ cache files
+ipch/
+*.aps
+*.ncb
+*.opendb
+*.opensdf
+*.sdf
+*.cachefile
+*.VC.db
+*.VC.VC.opendb
+
+# Visual Studio profiler
+*.psess
+*.vsp
+*.vspx
+*.sap
+
+# Visual Studio Trace Files
+*.e2e
+
+# TFS 2012 Local Workspace
+$tf/
+
+# Guidance Automation Toolkit
+*.gpState
+
+# ReSharper is a .NET coding add-in
+_ReSharper*/
+*.[Rr]e[Ss]harper
+*.DotSettings.user
+
+# TeamCity is a build add-in
+_TeamCity*
+
+# DotCover is a Code Coverage Tool
+*.dotCover
+
+# AxoCover is a Code Coverage Tool
+.axoCover/*
+!.axoCover/settings.json
+
+# Coverlet is a free, cross platform Code Coverage Tool
+coverage*.json
+coverage*.xml
+coverage*.info
+
+# Visual Studio code coverage results
+*.coverage
+*.coveragexml
+
+# NCrunch
+_NCrunch_*
+.*crunch*.local.xml
+nCrunchTemp_*
+
+# MightyMoose
+*.mm.*
+AutoTest.Net/
+
+# Web workbench (sass)
+.sass-cache/
+
+# Installshield output folder
+[Ee]xpress/
+
+# DocProject is a documentation generator add-in
+DocProject/buildhelp/
+DocProject/Help/*.HxT
+DocProject/Help/*.HxC
+DocProject/Help/*.hhc
+DocProject/Help/*.hhk
+DocProject/Help/*.hhp
+DocProject/Help/Html2
+DocProject/Help/html
+
+# Click-Once directory
+publish/
+
+# Publish Web Output
+*.[Pp]ublish.xml
+*.azurePubxml
+# Note: Comment the next line if you want to checkin your web deploy settings,
+# but database connection strings (with potential passwords) will be unencrypted
+*.pubxml
+*.publishproj
+
+# Microsoft Azure Web App publish settings. Comment the next line if you want to
+# checkin your Azure Web App publish settings, but sensitive information contained
+# in these scripts will be unencrypted
+PublishScripts/
+
+# NuGet Packages
+*.nupkg
+# NuGet Symbol Packages
+*.snupkg
+# The packages folder can be ignored because of Package Restore
+**/[Pp]ackages/*
+# except build/, which is used as an MSBuild target.
+!**/[Pp]ackages/build/
+# Uncomment if necessary however generally it will be regenerated when needed
+#!**/[Pp]ackages/repositories.config
+# NuGet v3's project.json files produces more ignorable files
+*.nuget.props
+*.nuget.targets
+
+# Microsoft Azure Build Output
+csx/
+*.build.csdef
+
+# Microsoft Azure Emulator
+ecf/
+rcf/
+
+# Windows Store app package directories and files
+AppPackages/
+BundleArtifacts/
+Package.StoreAssociation.xml
+_pkginfo.txt
+*.appx
+*.appxbundle
+*.appxupload
+
+# Visual Studio cache files
+# files ending in .cache can be ignored
+*.[Cc]ache
+# but keep track of directories ending in .cache
+!?*.[Cc]ache/
+
+# Others
+ClientBin/
+~$*
+*~
+*.dbmdl
+*.dbproj.schemaview
+*.jfm
+*.pfx
+*.publishsettings
+orleans.codegen.cs
+
+# Including strong name files can present a security risk
+# (https://github.com/github/gitignore/pull/2483#issue-259490424)
+#*.snk
+
+# Since there are multiple workflows, uncomment next line to ignore bower_components
+# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
+#bower_components/
+
+# RIA/Silverlight projects
+Generated_Code/
+
+# Backup & report files from converting an old project file
+# to a newer Visual Studio version. Backup files are not needed,
+# because we have git ;-)
+_UpgradeReport_Files/
+Backup*/
+UpgradeLog*.XML
+UpgradeLog*.htm
+ServiceFabricBackup/
+*.rptproj.bak
+
+# SQL Server files
+*.mdf
+*.ldf
+*.ndf
+
+# Business Intelligence projects
+*.rdl.data
+*.bim.layout
+*.bim_*.settings
+*.rptproj.rsuser
+*- [Bb]ackup.rdl
+*- [Bb]ackup ([0-9]).rdl
+*- [Bb]ackup ([0-9][0-9]).rdl
+
+# Microsoft Fakes
+FakesAssemblies/
+
+# GhostDoc plugin setting file
+*.GhostDoc.xml
+
+# Node.js Tools for Visual Studio
+.ntvs_analysis.dat
+node_modules/
+
+# Visual Studio 6 build log
+*.plg
+
+# Visual Studio 6 workspace options file
+*.opt
+
+# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
+*.vbw
+
+# Visual Studio LightSwitch build output
+**/*.HTMLClient/GeneratedArtifacts
+**/*.DesktopClient/GeneratedArtifacts
+**/*.DesktopClient/ModelManifest.xml
+**/*.Server/GeneratedArtifacts
+**/*.Server/ModelManifest.xml
+_Pvt_Extensions
+
+# Paket dependency manager
+.paket/paket.exe
+paket-files/
+
+# FAKE - F# Make
+.fake/
+
+# CodeRush personal settings
+.cr/personal
+
+# Python Tools for Visual Studio (PTVS)
+__pycache__/
+*.pyc
+
+# Cake - Uncomment if you are using it
+# tools/**
+# !tools/packages.config
+
+# Tabs Studio
+*.tss
+
+# Telerik's JustMock configuration file
+*.jmconfig
+
+# BizTalk build output
+*.btp.cs
+*.btm.cs
+*.odx.cs
+*.xsd.cs
+
+# OpenCover UI analysis results
+OpenCover/
+
+# Azure Stream Analytics local run output
+ASALocalRun/
+
+# MSBuild Binary and Structured Log
+*.binlog
+
+# NVidia Nsight GPU debugger configuration file
+*.nvuser
+
+# MFractors (Xamarin productivity tool) working folder
+.mfractor/
+
+# Local History for Visual Studio
+.localhistory/
+
+# BeatPulse healthcheck temp database
+healthchecksdb
+
+# Backup folder for Package Reference Convert tool in Visual Studio 2017
+MigrationBackup/
+
+# Ionide (cross platform F# VS Code tools) working folder
+.ionide/
+
+# Fody - auto-generated XML schema
+FodyWeavers.xsd

BIN
Doc/玮博电子进销存管理系统2019.6.25_2.xmind


BIN
Doc/玮博电子进销存管理系统使用疑问.20190923.docx


+ 33 - 0
SourceCode/VberTech.Test/AppTestBase.cs

@@ -0,0 +1,33 @@
+using System;
+using System.Collections.Generic;
+using System.Data.Common;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Abp.TestBase;
+using Castle.MicroKernel.Registration;
+using EntityFramework.DynamicFilters;
+using VberTech.EF;
+
+namespace VberTech.Test
+{
+    public class AppTestBase: AbpIntegratedTestBase<VberTechTestModule>
+    {
+        public AppTestBase()
+        {
+           
+        }
+        protected override void PreInitialize()
+        {
+            //Fake DbConnection using Effort!
+            LocalIocManager.IocContainer.Register(
+                Component.For<DbConnection>()
+                    .UsingFactoryMethod(Effort.DbConnectionFactory.CreateTransient)
+                    .LifestyleSingleton()
+            );
+
+            base.PreInitialize();
+        }
+
+    }
+}

+ 36 - 0
SourceCode/VberTech.Test/Properties/AssemblyInfo.cs

@@ -0,0 +1,36 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// 有关程序集的一般信息由以下
+// 控制。更改这些特性值可修改
+// 与程序集关联的信息。
+[assembly: AssemblyTitle("VberTech.Test")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("VberTech.Test")]
+[assembly: AssemblyCopyright("Copyright ©  2019")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// 将 ComVisible 设置为 false 会使此程序集中的类型
+//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
+//请将此类型的 ComVisible 特性设置为 true。
+[assembly: ComVisible(false)]
+
+// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
+[assembly: Guid("eaab7483-0a19-4cfa-a9c5-52a3ff80de22")]
+
+// 程序集的版本信息由下列四个值组成: 
+//
+//      主版本
+//      次版本
+//      生成号
+//      修订号
+//
+//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
+//通过使用 "*",如下所示:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]

+ 40 - 0
SourceCode/VberTech.Test/UserAppService_Tests.cs

@@ -0,0 +1,40 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Abp.Domain.Repositories;
+using Abp.Timing;
+using JetBrains.Annotations;
+using VberTech.EmailHelpers;
+using VberTech.PlanTaskTrack;
+using VberTech.PlanTaskTrack.Dto;
+using Xunit;
+using Xunit.Abstractions;
+
+namespace VberTech.Test
+{
+    public class UserAppService_Tests
+    {
+        //public IRepository<PlanTask> PlanTaskRepository { get; set; }
+        private readonly ITestOutputHelper _testOutputHelper;
+
+        public UserAppService_Tests( ITestOutputHelper testOutputHelper)
+        {
+            //PlanTaskRepository = planTaskRepository;
+            _testOutputHelper = testOutputHelper;
+        }
+        [Fact]
+        public void OutInfo()
+        {
+            SmtpEmailSenderConfig config = new SmtpEmailSenderConfig("smtp.163.com", 25, "klzhangweiya@163.com", "Aa1234", "", false, true);
+            SmtpEmailSenderConfig _config = new SmtpEmailSenderConfig("smtp.exmail.qq.com", 465, "zhangwy@iwbnet.com", "pCcxveGJS8w3vxN9", "", true, true);
+            SmtpEmailSenderConfig _configH = new SmtpEmailSenderConfig("smtp-mail.outlook.com", 25, "zhangwy2018@hotmail.com", "Asia0812,./", "", false, true);
+            EmailSendHelper.SendEmail("zhangwy2018@hotmail.com", "待办计划提醒","你的计划安排即将开始",displayName:"玮搏电子",smtpEmailSenderConfig: config);
+        }
+       
+
+     
+      
+    }
+}

+ 252 - 0
SourceCode/VberTech.Test/VberTech.Test.csproj

@@ -0,0 +1,252 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <Import Project="..\packages\xunit.core.2.4.1\build\xunit.core.props" Condition="Exists('..\packages\xunit.core.2.4.1\build\xunit.core.props')" />
+  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <ProjectGuid>{EAAB7483-0A19-4CFA-A9C5-52A3FF80DE22}</ProjectGuid>
+    <OutputType>Library</OutputType>
+    <AppDesignerFolder>Properties</AppDesignerFolder>
+    <RootNamespace>VberTech.Test</RootNamespace>
+    <AssemblyName>VberTech.Test</AssemblyName>
+    <TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
+    <FileAlignment>512</FileAlignment>
+    <Deterministic>true</Deterministic>
+    <NuGetPackageImportStamp>
+    </NuGetPackageImportStamp>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+    <DebugSymbols>true</DebugSymbols>
+    <DebugType>full</DebugType>
+    <Optimize>false</Optimize>
+    <OutputPath>bin\Debug\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+    <DebugType>pdbonly</DebugType>
+    <Optimize>true</Optimize>
+    <OutputPath>bin\Release\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="Abp, Version=4.1.0.0, Culture=neutral, processorArchitecture=MSIL">
+      <HintPath>..\packages\Abp.4.1.0\lib\netstandard2.0\Abp.dll</HintPath>
+    </Reference>
+    <Reference Include="Abp.EntityFramework, Version=4.1.0.0, Culture=neutral, processorArchitecture=MSIL">
+      <HintPath>..\packages\Abp.EntityFramework.4.1.0\lib\net461\Abp.EntityFramework.dll</HintPath>
+    </Reference>
+    <Reference Include="Abp.EntityFramework.Common, Version=4.1.0.0, Culture=neutral, processorArchitecture=MSIL">
+      <HintPath>..\packages\Abp.EntityFramework.Common.4.1.0\lib\netstandard2.0\Abp.EntityFramework.Common.dll</HintPath>
+    </Reference>
+    <Reference Include="Abp.TestBase, Version=4.1.0.0, Culture=neutral, processorArchitecture=MSIL">
+      <HintPath>..\packages\Abp.TestBase.4.1.0\lib\netstandard2.0\Abp.TestBase.dll</HintPath>
+    </Reference>
+    <Reference Include="Castle.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc, processorArchitecture=MSIL">
+      <HintPath>..\packages\Castle.Core.4.3.1\lib\net45\Castle.Core.dll</HintPath>
+    </Reference>
+    <Reference Include="Castle.Facilities.Logging, Version=4.0.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc, processorArchitecture=MSIL">
+      <HintPath>..\packages\Castle.LoggingFacility.4.1.1\lib\net45\Castle.Facilities.Logging.dll</HintPath>
+    </Reference>
+    <Reference Include="Castle.Windsor, Version=4.0.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc, processorArchitecture=MSIL">
+      <HintPath>..\packages\Castle.Windsor.4.1.1\lib\net45\Castle.Windsor.dll</HintPath>
+    </Reference>
+    <Reference Include="Effort, Version=2.2.2.0, Culture=neutral, PublicKeyToken=6a46696d54971e6d, processorArchitecture=MSIL">
+      <HintPath>..\packages\Effort.EF6.2.2.2\lib\net45\Effort.dll</HintPath>
+    </Reference>
+    <Reference Include="EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
+      <HintPath>..\packages\EntityFramework.6.2.0\lib\net45\EntityFramework.dll</HintPath>
+    </Reference>
+    <Reference Include="EntityFramework.DynamicFilters, Version=3.0.1.0, Culture=neutral, PublicKeyToken=59b66d028979105b, processorArchitecture=MSIL">
+      <HintPath>..\packages\EntityFramework.DynamicFilters.3.0.1\lib\net40\EntityFramework.DynamicFilters.dll</HintPath>
+    </Reference>
+    <Reference Include="EntityFramework.SqlServer, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
+      <HintPath>..\packages\EntityFramework.6.2.0\lib\net45\EntityFramework.SqlServer.dll</HintPath>
+    </Reference>
+    <Reference Include="JetBrains.Annotations, Version=2018.2.1.0, Culture=neutral, PublicKeyToken=1010a0d8d6380325, processorArchitecture=MSIL">
+      <HintPath>..\packages\JetBrains.Annotations.2018.2.1\lib\net20\JetBrains.Annotations.dll</HintPath>
+    </Reference>
+    <Reference Include="Microsoft.Extensions.Caching.Abstractions, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
+      <HintPath>..\packages\Microsoft.Extensions.Caching.Abstractions.2.2.0\lib\netstandard2.0\Microsoft.Extensions.Caching.Abstractions.dll</HintPath>
+    </Reference>
+    <Reference Include="Microsoft.Extensions.Caching.Memory, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
+      <HintPath>..\packages\Microsoft.Extensions.Caching.Memory.2.2.0\lib\netstandard2.0\Microsoft.Extensions.Caching.Memory.dll</HintPath>
+    </Reference>
+    <Reference Include="Microsoft.Extensions.DependencyInjection.Abstractions, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
+      <HintPath>..\packages\Microsoft.Extensions.DependencyInjection.Abstractions.2.2.0\lib\netstandard2.0\Microsoft.Extensions.DependencyInjection.Abstractions.dll</HintPath>
+    </Reference>
+    <Reference Include="Microsoft.Extensions.Options, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
+      <HintPath>..\packages\Microsoft.Extensions.Options.2.2.0\lib\netstandard2.0\Microsoft.Extensions.Options.dll</HintPath>
+    </Reference>
+    <Reference Include="Microsoft.Extensions.Primitives, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
+      <HintPath>..\packages\Microsoft.Extensions.Primitives.2.2.0\lib\netstandard2.0\Microsoft.Extensions.Primitives.dll</HintPath>
+    </Reference>
+    <Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
+      <HintPath>..\packages\Newtonsoft.Json.12.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
+    </Reference>
+    <Reference Include="Nito.AsyncEx.Context, Version=1.1.0.0, Culture=neutral, processorArchitecture=MSIL">
+      <HintPath>..\packages\Nito.AsyncEx.Context.1.1.0\lib\net46\Nito.AsyncEx.Context.dll</HintPath>
+    </Reference>
+    <Reference Include="Nito.AsyncEx.Coordination, Version=1.0.2.0, Culture=neutral, processorArchitecture=MSIL">
+      <HintPath>..\packages\Nito.AsyncEx.Coordination.1.0.2\lib\net46\Nito.AsyncEx.Coordination.dll</HintPath>
+    </Reference>
+    <Reference Include="Nito.AsyncEx.Tasks, Version=1.1.0.0, Culture=neutral, processorArchitecture=MSIL">
+      <HintPath>..\packages\Nito.AsyncEx.Tasks.1.1.0\lib\net46\Nito.AsyncEx.Tasks.dll</HintPath>
+    </Reference>
+    <Reference Include="Nito.Collections.Deque, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
+      <HintPath>..\packages\Nito.Collections.Deque.1.0.0\lib\portable45-net45+win8+wp8+wpa81\Nito.Collections.Deque.dll</HintPath>
+    </Reference>
+    <Reference Include="Nito.Disposables, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
+      <HintPath>..\packages\Nito.Disposables.1.0.0\lib\portable45-net45+win8+wp8+wpa81\Nito.Disposables.dll</HintPath>
+    </Reference>
+    <Reference Include="NMemory, Version=3.0.0.0, Culture=neutral, PublicKeyToken=afc61983f100d280, processorArchitecture=MSIL">
+      <HintPath>..\packages\NMemory.3.1.0\lib\net45\NMemory.dll</HintPath>
+    </Reference>
+    <Reference Include="Shouldly, Version=3.0.2.0, Culture=neutral, PublicKeyToken=6042cbcb05cbc941, processorArchitecture=MSIL">
+      <HintPath>..\packages\Shouldly.3.0.2\lib\net451\Shouldly.dll</HintPath>
+    </Reference>
+    <Reference Include="System" />
+    <Reference Include="System.Buffers, Version=4.0.2.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
+      <HintPath>..\packages\System.Buffers.4.4.0\lib\netstandard2.0\System.Buffers.dll</HintPath>
+    </Reference>
+    <Reference Include="System.Collections.Immutable, Version=1.2.3.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
+      <HintPath>..\packages\System.Collections.Immutable.1.5.0\lib\netstandard2.0\System.Collections.Immutable.dll</HintPath>
+    </Reference>
+    <Reference Include="System.ComponentModel.Annotations, Version=4.2.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
+      <HintPath>..\packages\System.ComponentModel.Annotations.4.5.0\lib\net461\System.ComponentModel.Annotations.dll</HintPath>
+    </Reference>
+    <Reference Include="System.ComponentModel.DataAnnotations" />
+    <Reference Include="System.Configuration" />
+    <Reference Include="System.Configuration.ConfigurationManager, Version=4.0.1.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
+      <HintPath>..\packages\System.Configuration.ConfigurationManager.4.5.0\lib\net461\System.Configuration.ConfigurationManager.dll</HintPath>
+    </Reference>
+    <Reference Include="System.Core" />
+    <Reference Include="System.Data.Common, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
+      <HintPath>..\packages\System.Data.Common.4.3.0\lib\net451\System.Data.Common.dll</HintPath>
+      <Private>True</Private>
+      <Private>True</Private>
+    </Reference>
+    <Reference Include="System.Data.OracleClient" />
+    <Reference Include="System.Drawing" />
+    <Reference Include="System.Linq.Dynamic.Core, Version=1.0.9.1, Culture=neutral, PublicKeyToken=0f07ec44de6ac832, processorArchitecture=MSIL">
+      <HintPath>..\packages\System.Linq.Dynamic.Core.1.0.9.1\lib\net46\System.Linq.Dynamic.Core.dll</HintPath>
+    </Reference>
+    <Reference Include="System.Memory, Version=4.0.1.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
+      <HintPath>..\packages\System.Memory.4.5.1\lib\netstandard2.0\System.Memory.dll</HintPath>
+    </Reference>
+    <Reference Include="System.Net" />
+    <Reference Include="System.Numerics" />
+    <Reference Include="System.Numerics.Vectors, Version=4.1.3.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
+      <HintPath>..\packages\System.Numerics.Vectors.4.4.0\lib\net46\System.Numerics.Vectors.dll</HintPath>
+    </Reference>
+    <Reference Include="System.Runtime.CompilerServices.Unsafe, Version=4.0.4.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
+      <HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.4.5.1\lib\netstandard2.0\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
+    </Reference>
+    <Reference Include="System.Runtime.InteropServices.RuntimeInformation, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
+      <HintPath>..\packages\System.Runtime.InteropServices.RuntimeInformation.4.3.0\lib\net45\System.Runtime.InteropServices.RuntimeInformation.dll</HintPath>
+      <Private>True</Private>
+      <Private>True</Private>
+    </Reference>
+    <Reference Include="System.Runtime.Remoting" />
+    <Reference Include="System.Runtime.Serialization" />
+    <Reference Include="System.Runtime.Serialization.Formatters, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
+      <HintPath>..\packages\System.Runtime.Serialization.Formatters.4.3.0\lib\net46\System.Runtime.Serialization.Formatters.dll</HintPath>
+      <Private>True</Private>
+      <Private>True</Private>
+    </Reference>
+    <Reference Include="System.Runtime.Serialization.Primitives, Version=4.1.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
+      <HintPath>..\packages\System.Runtime.Serialization.Primitives.4.3.0\lib\net46\System.Runtime.Serialization.Primitives.dll</HintPath>
+      <Private>True</Private>
+      <Private>True</Private>
+    </Reference>
+    <Reference Include="System.Security.Claims, Version=4.0.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
+      <HintPath>..\packages\System.Security.Claims.4.3.0\lib\net46\System.Security.Claims.dll</HintPath>
+      <Private>True</Private>
+      <Private>True</Private>
+    </Reference>
+    <Reference Include="System.Security.Permissions, Version=4.0.1.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
+      <HintPath>..\packages\System.Security.Permissions.4.5.0\lib\net461\System.Security.Permissions.dll</HintPath>
+    </Reference>
+    <Reference Include="System.ServiceProcess" />
+    <Reference Include="System.Transactions" />
+    <Reference Include="System.Web" />
+    <Reference Include="System.Xml.Linq" />
+    <Reference Include="System.Data.DataSetExtensions" />
+    <Reference Include="Microsoft.CSharp" />
+    <Reference Include="System.Data" />
+    <Reference Include="System.Net.Http" />
+    <Reference Include="System.Xml" />
+    <Reference Include="System.Xml.XmlDocument, Version=4.0.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
+      <HintPath>..\packages\System.Xml.XmlDocument.4.3.0\lib\net46\System.Xml.XmlDocument.dll</HintPath>
+      <Private>True</Private>
+      <Private>True</Private>
+    </Reference>
+    <Reference Include="System.Xml.XPath, Version=4.0.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
+      <HintPath>..\packages\System.Xml.XPath.4.3.0\lib\net46\System.Xml.XPath.dll</HintPath>
+      <Private>True</Private>
+      <Private>True</Private>
+    </Reference>
+    <Reference Include="System.Xml.XPath.XmlDocument, Version=4.0.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
+      <HintPath>..\packages\System.Xml.XPath.XmlDocument.4.3.0\lib\net46\System.Xml.XPath.XmlDocument.dll</HintPath>
+    </Reference>
+    <Reference Include="TimeZoneConverter, Version=2.5.1.0, Culture=neutral, processorArchitecture=MSIL">
+      <HintPath>..\packages\TimeZoneConverter.2.5.1\lib\net45\TimeZoneConverter.dll</HintPath>
+    </Reference>
+    <Reference Include="xunit.abstractions, Version=2.0.0.0, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c, processorArchitecture=MSIL">
+      <HintPath>..\packages\xunit.abstractions.2.0.3\lib\net35\xunit.abstractions.dll</HintPath>
+    </Reference>
+    <Reference Include="xunit.assert, Version=2.4.1.0, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c, processorArchitecture=MSIL">
+      <HintPath>..\packages\xunit.assert.2.4.1\lib\netstandard1.1\xunit.assert.dll</HintPath>
+    </Reference>
+    <Reference Include="xunit.core, Version=2.4.1.0, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c, processorArchitecture=MSIL">
+      <HintPath>..\packages\xunit.extensibility.core.2.4.1\lib\net452\xunit.core.dll</HintPath>
+    </Reference>
+    <Reference Include="xunit.execution.desktop, Version=2.4.1.0, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c, processorArchitecture=MSIL">
+      <HintPath>..\packages\xunit.extensibility.execution.2.4.1\lib\net452\xunit.execution.desktop.dll</HintPath>
+    </Reference>
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="AppTestBase.cs" />
+    <Compile Include="Properties\AssemblyInfo.cs" />
+    <Compile Include="UserAppService_Tests.cs" />
+    <Compile Include="VberTechTestModule.cs" />
+  </ItemGroup>
+  <ItemGroup>
+    <None Include="app.config" />
+    <None Include="packages.config" />
+  </ItemGroup>
+  <ItemGroup>
+    <Analyzer Include="..\packages\xunit.analyzers.0.10.0\analyzers\dotnet\cs\xunit.analyzers.dll" />
+  </ItemGroup>
+  <ItemGroup>
+    <ProjectReference Include="..\VberTech\VberTech.Application\VberTech.Application.csproj">
+      <Project>{5e8949f0-db9a-4a70-88ae-3b581ab59572}</Project>
+      <Name>VberTech.Application</Name>
+    </ProjectReference>
+    <ProjectReference Include="..\VberTech\VberTech.Core\VberTech.Core.csproj">
+      <Project>{85cc6fc9-c0b3-404a-bfcb-901428ffc3ff}</Project>
+      <Name>VberTech.Core</Name>
+    </ProjectReference>
+    <ProjectReference Include="..\VberTech\VberTech.EntityFramework\VberTech.EntityFramework.csproj">
+      <Project>{db37dbc0-6ca9-4d42-8c78-86f103c57d58}</Project>
+      <Name>VberTech.EntityFramework</Name>
+    </ProjectReference>
+    <ProjectReference Include="..\VberTech\VberTech.ToolCommon\VberTech.ToolCommon.csproj">
+      <Project>{393960d2-af62-4ed0-bccc-2bc91d72444b}</Project>
+      <Name>VberTech.ToolCommon</Name>
+    </ProjectReference>
+  </ItemGroup>
+  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+  <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
+    <PropertyGroup>
+      <ErrorText>这台计算机上缺少此项目引用的 NuGet 程序包。使用“NuGet 程序包还原”可下载这些程序包。有关更多信息,请参见 http://go.microsoft.com/fwlink/?LinkID=322105。缺少的文件是 {0}。</ErrorText>
+    </PropertyGroup>
+    <Error Condition="!Exists('..\packages\xunit.core.2.4.1\build\xunit.core.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\xunit.core.2.4.1\build\xunit.core.props'))" />
+    <Error Condition="!Exists('..\packages\xunit.core.2.4.1\build\xunit.core.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\xunit.core.2.4.1\build\xunit.core.targets'))" />
+  </Target>
+  <Import Project="..\packages\xunit.core.2.4.1\build\xunit.core.targets" Condition="Exists('..\packages\xunit.core.2.4.1\build\xunit.core.targets')" />
+</Project>

+ 16 - 0
SourceCode/VberTech.Test/VberTechTestModule.cs

@@ -0,0 +1,16 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Abp.Modules;
+using Abp.TestBase;
+
+namespace VberTech.Test
+{
+    [DependsOn(typeof(VberTechDataModule),typeof(VberTechApplicationModule),typeof(AbpTestBaseModule))]
+    public class VberTechTestModule:AbpModule
+    {
+
+    }
+}

+ 61 - 0
SourceCode/VberTech.Test/app.config

@@ -0,0 +1,61 @@
+<?xml version="1.0" encoding="utf-8"?>
+<configuration>
+  <configSections>
+    <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
+    <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
+  </configSections>
+  <runtime>
+    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
+      <dependentAssembly>
+        <assemblyIdentity name="System.Runtime.InteropServices.RuntimeInformation" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
+        <bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" />
+      </dependentAssembly>
+      <dependentAssembly>
+        <assemblyIdentity name="System.ComponentModel.Annotations" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
+        <bindingRedirect oldVersion="0.0.0.0-4.2.1.0" newVersion="4.2.1.0" />
+      </dependentAssembly>
+      <dependentAssembly>
+        <assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
+        <bindingRedirect oldVersion="0.0.0.0-4.0.4.0" newVersion="4.0.4.0" />
+      </dependentAssembly>
+      <dependentAssembly>
+        <assemblyIdentity name="Microsoft.Owin" publicKeyToken="31bf3856ad364e35" culture="neutral" />
+        <bindingRedirect oldVersion="0.0.0.0-4.0.1.0" newVersion="4.0.1.0" />
+      </dependentAssembly>
+      <dependentAssembly>
+        <assemblyIdentity name="Microsoft.Owin.Security.OAuth" publicKeyToken="31bf3856ad364e35" culture="neutral" />
+        <bindingRedirect oldVersion="0.0.0.0-4.0.1.0" newVersion="4.0.1.0" />
+      </dependentAssembly>
+      <dependentAssembly>
+        <assemblyIdentity name="Microsoft.Owin.Security" publicKeyToken="31bf3856ad364e35" culture="neutral" />
+        <bindingRedirect oldVersion="0.0.0.0-4.0.1.0" newVersion="4.0.1.0" />
+      </dependentAssembly>
+      <dependentAssembly>
+        <assemblyIdentity name="Microsoft.Owin.Security.Cookies" publicKeyToken="31bf3856ad364e35" culture="neutral" />
+        <bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" />
+      </dependentAssembly>
+      <dependentAssembly>
+        <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
+        <bindingRedirect oldVersion="0.0.0.0-12.0.0.0" newVersion="12.0.0.0" />
+      </dependentAssembly>
+      <dependentAssembly>
+        <assemblyIdentity name="System.Web.Cors" publicKeyToken="31bf3856ad364e35" culture="neutral" />
+        <bindingRedirect oldVersion="0.0.0.0-5.2.7.0" newVersion="5.2.7.0" />
+      </dependentAssembly>
+      <dependentAssembly>
+        <assemblyIdentity name="ICSharpCode.SharpZipLib" publicKeyToken="1b03e6acf1164f73" culture="neutral" />
+        <bindingRedirect oldVersion="0.0.0.0-1.1.0.145" newVersion="1.1.0.145" />
+      </dependentAssembly>
+    </assemblyBinding>
+  </runtime>
+  <entityFramework>
+    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
+      <parameters>
+        <parameter value="mssqllocaldb" />
+      </parameters>
+    </defaultConnectionFactory>
+    <providers>
+      <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
+    </providers>
+  </entityFramework>
+</configuration>

+ 56 - 0
SourceCode/VberTech.Test/packages.config

@@ -0,0 +1,56 @@
+<?xml version="1.0" encoding="utf-8"?>
+<packages>
+  <package id="Abp" version="4.1.0" targetFramework="net461" />
+  <package id="Abp.EntityFramework" version="4.1.0" targetFramework="net461" />
+  <package id="Abp.EntityFramework.Common" version="4.1.0" targetFramework="net461" />
+  <package id="Abp.TestBase" version="4.1.0" targetFramework="net461" />
+  <package id="Castle.Core" version="4.3.1" targetFramework="net461" />
+  <package id="Castle.LoggingFacility" version="4.1.1" targetFramework="net461" />
+  <package id="Castle.Windsor" version="4.1.1" targetFramework="net461" />
+  <package id="Effort.EF6" version="2.2.2" targetFramework="net461" />
+  <package id="EntityFramework" version="6.2.0" targetFramework="net461" />
+  <package id="EntityFramework.DynamicFilters" version="3.0.1" targetFramework="net461" />
+  <package id="JetBrains.Annotations" version="2018.2.1" targetFramework="net461" />
+  <package id="Microsoft.Extensions.Caching.Abstractions" version="2.2.0" targetFramework="net461" />
+  <package id="Microsoft.Extensions.Caching.Memory" version="2.2.0" targetFramework="net461" />
+  <package id="Microsoft.Extensions.DependencyInjection.Abstractions" version="2.2.0" targetFramework="net461" />
+  <package id="Microsoft.Extensions.Options" version="2.2.0" targetFramework="net461" />
+  <package id="Microsoft.Extensions.Primitives" version="2.2.0" targetFramework="net461" />
+  <package id="Newtonsoft.Json" version="12.0.1" targetFramework="net461" />
+  <package id="Nito.AsyncEx.Context" version="1.1.0" targetFramework="net461" />
+  <package id="Nito.AsyncEx.Coordination" version="1.0.2" targetFramework="net461" />
+  <package id="Nito.AsyncEx.Tasks" version="1.1.0" targetFramework="net461" />
+  <package id="Nito.Collections.Deque" version="1.0.0" targetFramework="net461" />
+  <package id="Nito.Disposables" version="1.0.0" targetFramework="net461" />
+  <package id="NMemory" version="3.1.0" targetFramework="net461" />
+  <package id="Shouldly" version="3.0.2" targetFramework="net461" />
+  <package id="System.Buffers" version="4.4.0" targetFramework="net461" />
+  <package id="System.Collections.Immutable" version="1.5.0" targetFramework="net461" />
+  <package id="System.ComponentModel.Annotations" version="4.5.0" targetFramework="net461" />
+  <package id="System.Configuration.ConfigurationManager" version="4.5.0" targetFramework="net461" />
+  <package id="System.Data.Common" version="4.3.0" targetFramework="net461" />
+  <package id="System.Linq.Dynamic.Core" version="1.0.9.1" targetFramework="net461" />
+  <package id="System.Linq.Queryable" version="4.3.0" targetFramework="net461" />
+  <package id="System.Memory" version="4.5.1" targetFramework="net461" />
+  <package id="System.Numerics.Vectors" version="4.4.0" targetFramework="net461" />
+  <package id="System.Runtime.CompilerServices.Unsafe" version="4.5.1" targetFramework="net461" />
+  <package id="System.Runtime.InteropServices.RuntimeInformation" version="4.3.0" targetFramework="net461" />
+  <package id="System.Runtime.Serialization.Formatters" version="4.3.0" targetFramework="net461" />
+  <package id="System.Runtime.Serialization.Primitives" version="4.3.0" targetFramework="net461" />
+  <package id="System.Security.AccessControl" version="4.5.0" targetFramework="net461" />
+  <package id="System.Security.Claims" version="4.3.0" targetFramework="net461" />
+  <package id="System.Security.Permissions" version="4.5.0" targetFramework="net461" />
+  <package id="System.Security.Principal.Windows" version="4.5.0" targetFramework="net461" />
+  <package id="System.Threading" version="4.3.0" targetFramework="net461" />
+  <package id="System.Xml.XmlDocument" version="4.3.0" targetFramework="net461" />
+  <package id="System.Xml.XPath" version="4.3.0" targetFramework="net461" />
+  <package id="System.Xml.XPath.XmlDocument" version="4.3.0" targetFramework="net461" />
+  <package id="TimeZoneConverter" version="2.5.1" targetFramework="net461" />
+  <package id="xunit" version="2.4.1" targetFramework="net461" />
+  <package id="xunit.abstractions" version="2.0.3" targetFramework="net461" />
+  <package id="xunit.analyzers" version="0.10.0" targetFramework="net461" />
+  <package id="xunit.assert" version="2.4.1" targetFramework="net461" />
+  <package id="xunit.core" version="2.4.1" targetFramework="net461" />
+  <package id="xunit.extensibility.core" version="2.4.1" targetFramework="net461" />
+  <package id="xunit.extensibility.execution" version="2.4.1" targetFramework="net461" />
+</packages>

+ 66 - 0
SourceCode/VberTech.sln

@@ -0,0 +1,66 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 16
+VisualStudioVersion = 16.0.29215.179
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VberTech.Web", "VberTech\VberTech.Web\VberTech.Web.csproj", "{2C8968A7-B686-4DC9-A40B-2C866625BED6}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VberTech.ToolCommon", "VberTech\VberTech.ToolCommon\VberTech.ToolCommon.csproj", "{393960D2-AF62-4ED0-BCCC-2BC91D72444B}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VberTech.Core", "VberTech\VberTech.Core\VberTech.Core.csproj", "{85CC6FC9-C0B3-404A-BFCB-901428FFC3FF}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VberTech.EntityFramework", "VberTech\VberTech.EntityFramework\VberTech.EntityFramework.csproj", "{DB37DBC0-6CA9-4D42-8C78-86F103C57D58}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VberTech.Application", "VberTech\VberTech.Application\VberTech.Application.csproj", "{5E8949F0-DB9A-4A70-88AE-3B581AB59572}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VberTech.WebApi", "VberTech\VberTech.WebApi\VberTech.WebApi.csproj", "{9BABA12D-3FA6-4300-B51E-9BE9C686E53D}"
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{AACBF643-BC89-49EC-B839-4013BBD0E607}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VberTech.Test", "VberTech.Test\VberTech.Test.csproj", "{EAAB7483-0A19-4CFA-A9C5-52A3FF80DE22}"
+EndProject
+Global
+	GlobalSection(SolutionConfigurationPlatforms) = preSolution
+		Debug|Any CPU = Debug|Any CPU
+		Release|Any CPU = Release|Any CPU
+	EndGlobalSection
+	GlobalSection(ProjectConfigurationPlatforms) = postSolution
+		{2C8968A7-B686-4DC9-A40B-2C866625BED6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{2C8968A7-B686-4DC9-A40B-2C866625BED6}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{2C8968A7-B686-4DC9-A40B-2C866625BED6}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{2C8968A7-B686-4DC9-A40B-2C866625BED6}.Release|Any CPU.Build.0 = Release|Any CPU
+		{393960D2-AF62-4ED0-BCCC-2BC91D72444B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{393960D2-AF62-4ED0-BCCC-2BC91D72444B}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{393960D2-AF62-4ED0-BCCC-2BC91D72444B}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{393960D2-AF62-4ED0-BCCC-2BC91D72444B}.Release|Any CPU.Build.0 = Release|Any CPU
+		{85CC6FC9-C0B3-404A-BFCB-901428FFC3FF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{85CC6FC9-C0B3-404A-BFCB-901428FFC3FF}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{85CC6FC9-C0B3-404A-BFCB-901428FFC3FF}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{85CC6FC9-C0B3-404A-BFCB-901428FFC3FF}.Release|Any CPU.Build.0 = Release|Any CPU
+		{DB37DBC0-6CA9-4D42-8C78-86F103C57D58}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{DB37DBC0-6CA9-4D42-8C78-86F103C57D58}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{DB37DBC0-6CA9-4D42-8C78-86F103C57D58}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{DB37DBC0-6CA9-4D42-8C78-86F103C57D58}.Release|Any CPU.Build.0 = Release|Any CPU
+		{5E8949F0-DB9A-4A70-88AE-3B581AB59572}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{5E8949F0-DB9A-4A70-88AE-3B581AB59572}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{5E8949F0-DB9A-4A70-88AE-3B581AB59572}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{5E8949F0-DB9A-4A70-88AE-3B581AB59572}.Release|Any CPU.Build.0 = Release|Any CPU
+		{9BABA12D-3FA6-4300-B51E-9BE9C686E53D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{9BABA12D-3FA6-4300-B51E-9BE9C686E53D}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{9BABA12D-3FA6-4300-B51E-9BE9C686E53D}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{9BABA12D-3FA6-4300-B51E-9BE9C686E53D}.Release|Any CPU.Build.0 = Release|Any CPU
+		{EAAB7483-0A19-4CFA-A9C5-52A3FF80DE22}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{EAAB7483-0A19-4CFA-A9C5-52A3FF80DE22}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{EAAB7483-0A19-4CFA-A9C5-52A3FF80DE22}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{EAAB7483-0A19-4CFA-A9C5-52A3FF80DE22}.Release|Any CPU.Build.0 = Release|Any CPU
+	EndGlobalSection
+	GlobalSection(SolutionProperties) = preSolution
+		HideSolutionNode = FALSE
+	EndGlobalSection
+	GlobalSection(NestedProjects) = preSolution
+		{EAAB7483-0A19-4CFA-A9C5-52A3FF80DE22} = {AACBF643-BC89-49EC-B839-4013BBD0E607}
+	EndGlobalSection
+	GlobalSection(ExtensibilityGlobals) = postSolution
+		SolutionGuid = {97621FEF-8385-4BB1-A6F6-49087229B855}
+	EndGlobalSection
+EndGlobal

+ 44 - 0
SourceCode/VberTech/VberTech.Application/BaseBusiness/ProjectTypes/Dto/ProjectTypeCreateDto.cs

@@ -0,0 +1,44 @@
+using System.ComponentModel.DataAnnotations;
+using Abp.AutoMapper;
+using VberTech.BaseBusiness;
+
+namespace VberTech.BaseBusiness.ProjectTypes.Dto
+{
+    
+    /// <summary>
+    /// 网站类型维护
+    /// </summary>   
+    [AutoMapTo(typeof(ProjectType))]
+    public class ProjectTypeCreateDto
+    {
+        /// <summary>
+        /// 类型编号
+        /// </summary>   
+        [StringLength(ProjectType.TypeNoMaxLength)]
+		public string TypeNo  { get; set; }
+        /// <summary>
+        /// 父编号
+        /// </summary>   
+        [StringLength(ProjectType.ParentNoMaxLength)]
+		public string ParentNo  { get; set; }
+        /// <summary>
+        /// 类型名称
+        /// </summary>   
+        [StringLength(ProjectType.TypeNameMaxLength)]
+		public string TypeName  { get; set; }
+        /// <summary>
+        /// 类型描述
+        /// </summary>   
+        [StringLength(ProjectType.TypeDescriptionMaxLength)]
+		public string TypeDescription  { get; set; }
+        /// <summary>
+        /// 深度
+        /// </summary>   
+		public int Depth  { get; set; }
+        /// <summary>
+        /// 父子路径
+        /// </summary>   
+        [StringLength(ProjectType.TypePathMaxLength)]
+		public string TypePath  { get; set; }
+    }
+}

+ 39 - 0
SourceCode/VberTech/VberTech.Application/BaseBusiness/ProjectTypes/Dto/ProjectTypeDto.cs

@@ -0,0 +1,39 @@
+using Abp.Application.Services.Dto;
+using Abp.AutoMapper;
+using VberTech.BaseBusiness;
+
+namespace VberTech.BaseBusiness.ProjectTypes.Dto
+{
+    
+    /// <summary>
+    /// 网站类型维护
+    /// </summary>   
+    [AutoMapTo(typeof(ProjectType)),AutoMapFrom(typeof(ProjectType))]
+    public class ProjectTypeDto: EntityDto<int>
+    {
+        /// <summary>
+        /// 类型编号
+        /// </summary>   
+		public string TypeNo  { get; set; }
+        /// <summary>
+        /// 父编号
+        /// </summary>   
+		public string ParentNo  { get; set; }
+        /// <summary>
+        /// 类型名称
+        /// </summary>   
+		public string TypeName  { get; set; }
+        /// <summary>
+        /// 类型描述
+        /// </summary>   
+		public string TypeDescription  { get; set; }
+        /// <summary>
+        /// 深度
+        /// </summary>   
+		public int Depth  { get; set; }
+        /// <summary>
+        /// 父子路径
+        /// </summary>   
+		public string TypePath  { get; set; }
+    }
+}

+ 51 - 0
SourceCode/VberTech/VberTech.Application/BaseBusiness/ProjectTypes/Dto/ProjectTypeUpdateDto.cs

@@ -0,0 +1,51 @@
+using System.ComponentModel.DataAnnotations;
+using Abp.Application.Services.Dto;
+using Abp.AutoMapper;
+using VberTech.BaseBusiness;
+
+namespace VberTech.BaseBusiness.ProjectTypes.Dto
+{
+    
+    /// <summary>
+    /// 网站类型维护
+    /// </summary>   
+    [AutoMapTo(typeof(ProjectType))]
+    public class ProjectTypeUpdateDto: EntityDto<int>
+    {
+        
+        /// <summary>
+        /// 类型编号
+        /// </summary>   
+        [StringLength(ProjectType.TypeNoMaxLength)]
+		public string TypeNo  { get; set; }
+        
+        /// <summary>
+        /// 父编号
+        /// </summary>   
+        [StringLength(ProjectType.ParentNoMaxLength)]
+		public string ParentNo  { get; set; }
+        
+        /// <summary>
+        /// 类型名称
+        /// </summary>   
+        [StringLength(ProjectType.TypeNameMaxLength)]
+		public string TypeName  { get; set; }
+        
+        /// <summary>
+        /// 类型描述
+        /// </summary>   
+        [StringLength(ProjectType.TypeDescriptionMaxLength)]
+		public string TypeDescription  { get; set; }
+        
+        /// <summary>
+        /// 深度
+        /// </summary>   
+		public int Depth  { get; set; }
+        
+        /// <summary>
+        /// 父子路径
+        /// </summary>   
+        [StringLength(ProjectType.TypePathMaxLength)]
+		public string TypePath  { get; set; }
+    }
+}

+ 25 - 0
SourceCode/VberTech/VberTech.Application/BaseBusiness/ProjectTypes/IProjectTypesApplicationService.cs

@@ -0,0 +1,25 @@
+using System.Collections.Generic;
+using System.Threading.Tasks;
+using System.Web.Mvc;
+using IwbZero.AppServiceBase;
+using VberTech.BaseBusiness;
+using VberTech.BaseBusiness.ProjectTypes.Dto;
+
+namespace VberTech.BaseBusiness.ProjectTypes
+{
+    public interface IProjectTypeAppService : IIwbAsyncCrudAppService<ProjectTypeDto, int, PagedRequestDto, ProjectTypeCreateDto, ProjectTypeUpdateDto >
+    {
+
+
+		Task<List<SelectListItem>> GetSelectList();
+		Task<string> GetSelectStr();
+
+		#region Get
+		Task<ProjectType> GetEntityById(int id);
+		Task<ProjectType> GetEntityByNo(string no);
+		Task<ProjectTypeDto> GetDtoById(int id);
+		Task<ProjectTypeDto> GetDtoByNo(string no);
+        #endregion
+
+    }
+}

+ 219 - 0
SourceCode/VberTech/VberTech.Application/BaseBusiness/ProjectTypes/ProjectTypesApplicationService.cs

@@ -0,0 +1,219 @@
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+using System.Web.Mvc;
+using Abp.Application.Services.Dto;
+using Abp.Auditing;
+using Abp.Authorization;
+using Abp.Domain.Repositories;
+using Abp.Extensions;
+using Abp.Runtime.Caching;
+
+using IwbZero.AppServiceBase;
+using IwbZero.Auditing;
+using IwbZero.IdentityFramework;
+using IwbZero.Setting;
+using VberTech;
+using VberTech.Authorization.Permissions;
+using VberTech.BaseBusiness;
+using VberTech.BaseBusiness.ProjectTypes.Dto;
+using VberTech.BaseSysInfo;
+using VberTech.BaseSysInfo.AppGuids;
+using VberTech.Lambda;
+using VberTech.StringModel;
+
+namespace VberTech.BaseBusiness.ProjectTypes
+{
+    [AbpAuthorize, AuditLog("项目类型维护")]
+    public class ProjectTypeAppService : VberTechAsyncCrudAppService<ProjectType, ProjectTypeDto, int, PagedRequestDto, ProjectTypeCreateDto, ProjectTypeUpdateDto >, IProjectTypeAppService
+    {
+        public SysAppGuidAppService SysAppGuidAppService { get; }
+
+        public ProjectTypeAppService(
+            SysAppGuidAppService sysAppGuidAppService,
+            IIwbSettingManager settingManager, 
+			ICacheManager cacheManager,
+			IRepository<ProjectType, int> repository) : base(repository, "")
+        {
+            SysAppGuidAppService = sysAppGuidAppService;
+            SettingManager = settingManager;
+            CacheManager = cacheManager;
+        }
+
+        protected override bool KeyIsAuto { get; set; } = false;
+
+        #region GetSelect
+
+        [DisableAuditing]
+        public async Task<List<SelectListItem>> GetSelectList()
+        {
+            var list = await Repository.GetAllListAsync();
+            var sList = new List<SelectListItem> {new SelectListItem {Text = @"请选择...", Value = "", Selected = true}};
+            foreach (var l in list)
+            {
+                sList.Add(new SelectListItem { Text = l.TypeName, Value = l.TypeNo });
+            }
+            return sList;
+        }
+        [DisableAuditing]
+        public async Task<string> GetSelectStr()
+        {
+            var list = await Repository.GetAllListAsync();
+            string str = "<option value=\"\" selected>请选择...</option>";
+            foreach (var l in list)
+            {
+                str += $"<option value=\"{l.TypeNo}\">{l.TypeName}</option>";
+            }
+            return str;
+        }
+
+        #endregion
+
+        #region CURD
+        
+		#region Get
+
+		[DisableAuditing]
+        [AbpAuthorize(PermissionNames.PagesBasicInfoProjectTypeMg)]
+        public override Task<ProjectType> GetEntityById(int id)
+        {
+            return Repository.FirstOrDefaultAsync(id);
+        }
+        [DisableAuditing]
+        [AbpAuthorize(PermissionNames.PagesBasicInfoProjectTypeMg)]
+        public override Task<ProjectType> GetEntityByNo(string no)
+        {
+            if (KeyFiledName.IsNullOrEmpty())
+            {
+                CheckErrors(IwbIdentityResult.Failed("编码/编号字段不明确,请检查后再操作!"));
+            }
+            LambdaObject obj = new LambdaObject()
+            {
+                FieldType = LambdaFieldType.S,
+                FieldName = KeyFiledName,
+                FieldValue = no,
+                ExpType = LambdaExpType.Equal
+            };
+            var exp = obj.GetExp<ProjectType>();
+            return Repository.FirstOrDefaultAsync(exp);
+        }
+
+		[DisableAuditing]
+        [AbpAuthorize(PermissionNames.PagesBasicInfoProjectTypeMg)]
+        public override async Task<ProjectTypeDto> GetDtoById(int id)
+        {
+            var entity = await GetEntityById(id);
+            return MapToEntityDto(entity);
+        }
+		[DisableAuditing]
+        [AbpAuthorize(PermissionNames.PagesBasicInfoProjectTypeMg)]
+        public override async Task<ProjectTypeDto> GetDtoByNo(string no)
+        {
+            var entity = await GetEntityByNo(no);
+            return MapToEntityDto(entity);
+        }
+
+        #endregion
+
+        [DisableAuditing]
+        [AbpAuthorize(PermissionNames.PagesBasicInfoProjectTypeMg)]
+        public override async Task<PagedResultDto<ProjectTypeDto>> GetAll(PagedRequestDto input)
+        {
+            var query = CreateFilteredQuery(input);
+            if (input.SearchList != null && input.SearchList.Count > 0)
+            {
+                List<LambdaObject> objList = new List<LambdaObject>();
+                foreach (var o in input.SearchList)
+                {
+                    if (o.KeyWords.IsNullOrEmpty())
+                        continue;
+                    object keyWords = o.KeyWords;
+                    objList.Add(new LambdaObject
+                    {
+                        FieldType = (LambdaFieldType)o.FieldType,
+                        FieldName = o.KeyField,
+                        FieldValue = keyWords,
+                        ExpType = (LambdaExpType)o.ExpType
+                    });
+                }
+                var exp = objList.GetExp<ProjectType>();
+                query = query.Where(exp);
+            }
+            var totalCount = await AsyncQueryableExecuter.CountAsync(query);
+
+            query = ApplySorting(query, input);
+            query = ApplyPaging(query, input);
+
+            var entities = await AsyncQueryableExecuter.ToListAsync(query);
+
+            var dtos = new PagedResultDto<ProjectTypeDto>(
+                totalCount,
+                entities.Select(MapToEntityDto).ToList()
+            );
+            return dtos;
+        }
+
+        [AbpAuthorize(PermissionNames.PagesBasicInfoProjectTypeMgCreate)]
+        public override async Task<ProjectTypeDto> Create(ProjectTypeCreateDto input)
+        {
+            
+            var guid = SysAppGuidAppService.GetAppGuid(AppGuidType.ProjectType);
+            CheckGuid(guid);
+            if (input.ParentNo.IsEmpty())
+            {
+                input.Depth = 1;
+                input.ParentNo = "0";
+                input.TypeNo = $"1{guid}";
+                input.TypePath = $"0,{input.TypeNo}";
+            }
+            else
+            {
+                var parent = await Repository.FirstOrDefaultAsync(a => a.TypeNo == input.ParentNo);
+                input.Depth = parent.Depth + 1;
+                input.TypeNo = $"{input.Depth}{guid}";
+                input.TypePath = $"{parent.TypePath},{input.TypeNo}";
+            }
+
+            return await CreateEntity(input);
+        }
+
+        [AbpAuthorize(PermissionNames.PagesBasicInfoProjectTypeMgUpdate)]
+        public override async Task<ProjectTypeDto> Update(ProjectTypeUpdateDto input)
+        {
+            var entity = await Repository.FirstOrDefaultAsync(a=>a.TypeNo==input.TypeNo);
+            if (entity == null)
+            {
+                CheckErrors($"未查询到编码为[{input.TypeNo}]的网站类型。");
+                return null;
+            }
+            entity.TypeName = input.TypeName;
+            entity.TypeDescription = input.TypeDescription;
+            await Repository.UpdateAsync(entity);
+            return MapToEntityDto(entity);
+        }
+
+        [AbpAuthorize(PermissionNames.PagesBasicInfoProjectTypeMgDelete)]
+        public override Task Delete(EntityDto<int> input)
+        {
+            return Repository.DeleteAsync(input.Id);
+        }
+
+        //protected override IQueryable<ProjectType> ApplySorting(IQueryable<ProjectType> query, PagedRequestDto input)
+        //{
+        //    return query.OrderBy(a => a.No);
+        //}
+
+        //protected override IQueryable<ProjectType> ApplyPaging(IQueryable<ProjectType> query, PagedRequestDto input)
+        //{
+        //    if (input is IPagedResultRequest pagedInput)
+        //    {
+        //        return query.Skip(pagedInput.SkipCount).Take(pagedInput.MaxResultCount);
+        //    }
+        //    return query;
+        //}
+
+        #endregion
+
+
+    }
+}

+ 43 - 0
SourceCode/VberTech/VberTech.Application/BaseBusiness/StoreHouses/Dto/StoreHouseCreateDto.cs

@@ -0,0 +1,43 @@
+using System.ComponentModel.DataAnnotations;
+using Abp.AutoMapper;
+
+namespace VberTech.BaseBusiness.StoreHouses.Dto
+{
+    
+    /// <summary>
+    /// 仓库信息维护
+    /// </summary>   
+    [AutoMapTo(typeof(StoreHouse))]
+    public class StoreHouseCreateDto
+    {
+        /// <summary>
+        /// 仓库名称
+        /// </summary>   
+        [StringLength(StoreHouse.StoreHouseNameMaxLength)]
+		public string StoreHouseName  { get; set; }
+        /// <summary>
+        /// 仓库类型
+        /// </summary>   
+		public int StoreHouseType  { get; set; }
+        /// <summary>
+        /// 仓库地址
+        /// </summary>   
+        [StringLength(StoreHouse.AddressMaxLength)]
+		public string Address  { get; set; }
+        /// <summary>
+        /// 仓库电话
+        /// </summary>   
+        [StringLength(StoreHouse.TelMaxLength)]
+		public string Tel  { get; set; }
+        /// <summary>
+        /// 仓库传真
+        /// </summary>   
+        [StringLength(StoreHouse.FaxMaxLength)]
+		public string Fax  { get; set; }
+        /// <summary>
+        /// 仓库联系人
+        /// </summary>   
+        [StringLength(StoreHouse.ContactManMaxLength)]
+		public string ContactMan  { get; set; }
+    }
+}

+ 38 - 0
SourceCode/VberTech/VberTech.Application/BaseBusiness/StoreHouses/Dto/StoreHouseDto.cs

@@ -0,0 +1,38 @@
+using Abp.Application.Services.Dto;
+using Abp.AutoMapper;
+
+namespace VberTech.BaseBusiness.StoreHouses.Dto
+{
+    
+    /// <summary>
+    /// 仓库信息维护
+    /// </summary>   
+    [AutoMapTo(typeof(StoreHouse)),AutoMapFrom(typeof(StoreHouse))]
+    public class StoreHouseDto: EntityDto<int>
+    {
+        /// <summary>
+        /// 仓库名称
+        /// </summary>   
+		public string StoreHouseName  { get; set; }
+        /// <summary>
+        /// 仓库类型
+        /// </summary>   
+		public int StoreHouseType  { get; set; }
+        /// <summary>
+        /// 仓库地址
+        /// </summary>   
+		public string Address  { get; set; }
+        /// <summary>
+        /// 仓库电话
+        /// </summary>   
+		public string Tel  { get; set; }
+        /// <summary>
+        /// 仓库传真
+        /// </summary>   
+		public string Fax  { get; set; }
+        /// <summary>
+        /// 仓库联系人
+        /// </summary>   
+		public string ContactMan  { get; set; }
+    }
+}

+ 50 - 0
SourceCode/VberTech/VberTech.Application/BaseBusiness/StoreHouses/Dto/StoreHouseUpdateDto.cs

@@ -0,0 +1,50 @@
+using System.ComponentModel.DataAnnotations;
+using Abp.Application.Services.Dto;
+using Abp.AutoMapper;
+
+namespace VberTech.BaseBusiness.StoreHouses.Dto
+{
+    
+    /// <summary>
+    /// 仓库信息维护
+    /// </summary>   
+    [AutoMapTo(typeof(StoreHouse))]
+    public class StoreHouseUpdateDto: EntityDto<int>
+    {
+        
+        /// <summary>
+        /// 仓库名称
+        /// </summary>   
+        [StringLength(StoreHouse.StoreHouseNameMaxLength)]
+		public string StoreHouseName  { get; set; }
+        
+        /// <summary>
+        /// 仓库类型
+        /// </summary>   
+		public int StoreHouseType  { get; set; }
+        
+        /// <summary>
+        /// 仓库地址
+        /// </summary>   
+        [StringLength(StoreHouse.AddressMaxLength)]
+		public string Address  { get; set; }
+        
+        /// <summary>
+        /// 仓库电话
+        /// </summary>   
+        [StringLength(StoreHouse.TelMaxLength)]
+		public string Tel  { get; set; }
+        
+        /// <summary>
+        /// 仓库传真
+        /// </summary>   
+        [StringLength(StoreHouse.FaxMaxLength)]
+		public string Fax  { get; set; }
+        
+        /// <summary>
+        /// 仓库联系人
+        /// </summary>   
+        [StringLength(StoreHouse.ContactManMaxLength)]
+		public string ContactMan  { get; set; }
+    }
+}

+ 24 - 0
SourceCode/VberTech/VberTech.Application/BaseBusiness/StoreHouses/IStoreHousesApplicationService.cs

@@ -0,0 +1,24 @@
+using System.Collections.Generic;
+using System.Threading.Tasks;
+using System.Web.Mvc;
+using IwbZero.AppServiceBase;
+using VberTech.BaseBusiness.StoreHouses.Dto;
+
+namespace VberTech.BaseBusiness.StoreHouses
+{
+    public interface IStoreHouseAppService : IIwbAsyncCrudAppService<StoreHouseDto, int, PagedRequestDto, StoreHouseCreateDto, StoreHouseUpdateDto >
+    {
+
+
+		Task<List<SelectListItem>> GetSelectList();
+		Task<string> GetSelectStr();
+
+		#region Get
+		Task<StoreHouse> GetEntityById(int id);
+		Task<StoreHouse> GetEntityByNo(string no);
+		Task<StoreHouseDto> GetDtoById(int id);
+		Task<StoreHouseDto> GetDtoByNo(string no);
+        #endregion
+
+    }
+}

+ 200 - 0
SourceCode/VberTech/VberTech.Application/BaseBusiness/StoreHouses/StoreHousesApplicationService.cs

@@ -0,0 +1,200 @@
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+using System.Web.Mvc;
+using Abp.Application.Services.Dto;
+using Abp.Auditing;
+using Abp.Authorization;
+using Abp.Domain.Repositories;
+using Abp.Extensions;
+using Abp.Runtime.Caching;
+using IwbZero.AppServiceBase;
+using IwbZero.Auditing;
+using IwbZero.IdentityFramework;
+using IwbZero.Setting;
+using VberTech.Authorization.Permissions;
+using VberTech.BaseBusiness.StoreHouses.Dto;
+using VberTech.Lambda;
+
+namespace VberTech.BaseBusiness.StoreHouses
+{
+    [AbpAuthorize, AuditLog("仓库信息维护")]
+    public class StoreHouseAppService : VberTechAsyncCrudAppService<StoreHouse, StoreHouseDto, int, PagedRequestDto, StoreHouseCreateDto, StoreHouseUpdateDto >, IStoreHouseAppService
+    {
+        public StoreHouseAppService(
+			IIwbSettingManager settingManager, 
+			ICacheManager cacheManager,
+			IRepository<StoreHouse, int> repository) : base(repository, "")
+        {
+			SettingManager = settingManager;
+            CacheManager = cacheManager;
+        }
+
+        protected override bool KeyIsAuto { get; set; } = false;
+
+        #region GetSelect
+
+        [DisableAuditing]
+        public async Task<List<SelectListItem>> GetSelectList()
+        {
+            var list = await Repository.GetAllListAsync();
+            var slist = new List<SelectListItem> {new SelectListItem {Text = @"请选择...", Value = "", Selected = true}};
+            foreach (var l in list)
+            {
+                slist.Add(new SelectListItem { Text = l.StoreHouseName, Value = l.Id+"" });
+            }
+            return slist;
+        }
+        [DisableAuditing]
+        public async Task<string> GetSelectStr()
+        {
+            var list = await Repository.GetAllListAsync();
+            string str = "<option value=\"\" selected>请选择...</option>";
+            foreach (var l in list)
+            {
+                str += $"<option value=\"{l.Id}\">{l.StoreHouseName}</option>";
+            }
+            return str;
+        }
+
+        #endregion
+
+        #region CURD
+
+        [AbpAuthorize(PermissionNames.PagesBasicInfoStoreHouseCreate)]
+        public override async Task<StoreHouseDto> Create(StoreHouseCreateDto input)
+        {
+            return await CreateEntity(input);
+        }
+
+        [AbpAuthorize(PermissionNames.PagesBasicInfoStoreHouseUpdate)]
+        public override async Task<StoreHouseDto> Update(StoreHouseUpdateDto input)
+        {
+            return await UpdateEntity(input);
+        }
+
+        [AbpAuthorize(PermissionNames.PagesBasicInfoStoreHouseDelete)]
+        public override Task Delete(EntityDto<int> input)
+        {
+            return Repository.DeleteAsync(input.Id);
+        }
+
+        [DisableAuditing]
+        [AbpAuthorize(PermissionNames.PagesBasicInfoStoreHouse)]
+        public override async Task<PagedResultDto<StoreHouseDto>> GetAll(PagedRequestDto input)
+        {
+            var query = CreateFilteredQuery(input);
+            query = ApplyFilter(query, input);
+            var totalCount = await AsyncQueryableExecuter.CountAsync(query);
+            query = ApplySorting(query, input);
+            query = ApplyPaging(query, input);
+            var entities = await AsyncQueryableExecuter.ToListAsync(query);
+            var dtoList = new PagedResultDto<StoreHouseDto>(totalCount, entities.Select(MapToEntityDto).ToList());
+            return dtoList;
+        }
+
+		#region Get
+
+		[DisableAuditing]
+        [AbpAuthorize(PermissionNames.PagesBasicInfoStoreHouse)]
+        public override Task<StoreHouse> GetEntityById(int id)
+        {
+            return Repository.FirstOrDefaultAsync(id);
+        }
+
+        [DisableAuditing]
+        [AbpAuthorize(PermissionNames.PagesBasicInfoStoreHouse)]
+        public override Task<StoreHouse> GetEntityByNo(string no)
+        {
+            if (KeyFiledName.IsNullOrEmpty())
+            {
+                CheckErrors(IwbIdentityResult.Failed("编码/编号字段不明确,请检查后再操作!"));
+            }
+            LambdaObject obj = new LambdaObject()
+            {
+                FieldType = LambdaFieldType.S,
+                FieldName = KeyFiledName,
+                FieldValue = no,
+                ExpType = LambdaExpType.Equal
+            };
+            var exp = obj.GetExp<StoreHouse>();
+            return Repository.FirstOrDefaultAsync(exp);
+        }
+
+		[DisableAuditing]
+        [AbpAuthorize(PermissionNames.PagesBasicInfoStoreHouse)]
+        public override async Task<StoreHouseDto> GetDtoById(int id)
+        {
+            var entity = await GetEntityById(id);
+            return MapToEntityDto(entity);
+        }
+		[DisableAuditing]
+        [AbpAuthorize(PermissionNames.PagesBasicInfoStoreHouse)]
+        public override async Task<StoreHouseDto> GetDtoByNo(string no)
+        {
+            var entity = await GetEntityByNo(no);
+            return MapToEntityDto(entity);
+        }
+
+        #endregion
+
+		#region Hide
+       
+        //protected override IQueryable<StoreHouse> ApplyFilter(IQueryable<StoreHouse> query, TGetAllInput input)
+        //{
+        //    if (!input.KeyWords.IsNullOrEmpty())
+        //    {
+        //        object keyWords = input.KeyWords;
+        //        LambdaObject obj = new LambdaObject()
+        //        {
+        //            FieldType = (LambdaFieldType)input.FieldType,
+        //            FieldName = input.KeyField,
+        //            FieldValue = keyWords,
+        //            ExpType = (LambdaExpType)input.ExpType
+        //        };
+        //        var exp = obj.GetExp<StoreHouse>();
+        //        query = query.Where(exp);
+        //    }
+        //    if (input.SearchList != null && input.SearchList.Count > 0)
+        //    {
+        //        List<LambdaObject> objList = new List<LambdaObject>();
+        //        foreach (var o in input.SearchList)
+        //        {
+        //            if (o.KeyWords.IsNullOrEmpty())
+        //                continue;
+        //            object keyWords = o.KeyWords;
+        //            objList.Add(new LambdaObject
+        //            {
+        //                FieldType = (LambdaFieldType)o.FieldType,
+        //                FieldName = o.KeyField,
+        //                FieldValue = keyWords,
+        //                ExpType = (LambdaExpType)o.ExpType
+        //            });
+        //        }
+        //        var exp = objList.GetExp<StoreHouse>();
+        //        query = query.Where(exp);
+        //    }
+        //    return query;
+        //}
+
+        //protected override IQueryable<StoreHouse> ApplySorting(IQueryable<StoreHouse> query, PagedRequestDto input)
+        //{
+        //    return query.OrderBy(a => a.No);
+        //}
+
+        //protected override IQueryable<StoreHouse> ApplyPaging(IQueryable<StoreHouse> query, PagedRequestDto input)
+        //{
+        //    if (input is IPagedResultRequest pagedInput)
+        //    {
+        //        return query.Skip(pagedInput.SkipCount).Take(pagedInput.MaxResultCount);
+        //    }
+        //    return query;
+        //}
+
+        #endregion
+
+        #endregion
+
+
+    }
+}

+ 22 - 0
SourceCode/VberTech/VberTech.Application/BaseSysInfo/AppGuids/Dto/SysAppGuidCreateDto.cs

@@ -0,0 +1,22 @@
+using Abp.AutoMapper;
+
+namespace VberTech.BaseSysInfo.AppGuids.Dto
+{
+    [AutoMapTo(typeof(SysAppGuid))]
+    public class SysAppGuidCreateDto
+    {
+        /// <summary>
+        /// 编码步长
+        /// </summary>   
+		public short Step { get; set; }
+        /// <summary>
+        /// 最后的编码
+        /// </summary>   
+		public int LastId { get; set; }
+
+        /// <summary>
+        /// 编码类型
+        /// </summary>   
+		public short IdType { get; set; }
+    }
+}

+ 22 - 0
SourceCode/VberTech/VberTech.Application/BaseSysInfo/AppGuids/Dto/SysAppGuidDto.cs

@@ -0,0 +1,22 @@
+using Abp.Application.Services.Dto;
+using Abp.AutoMapper;
+
+namespace VberTech.BaseSysInfo.AppGuids.Dto
+{
+    [AutoMapTo(typeof(SysAppGuid)), AutoMapFrom(typeof(SysAppGuid))]
+    public class SysAppGuidDto : EntityDto<int>
+    {
+        /// <summary>
+        /// 编码步长
+        /// </summary>   
+		public short Step { get; set; }
+        /// <summary>
+        /// 最后的编码
+        /// </summary>   
+		public int LastId { get; set; }
+        /// <summary>
+        /// 编码类型
+        /// </summary>   
+		public short IdType { get; set; }
+    }
+}

+ 25 - 0
SourceCode/VberTech/VberTech.Application/BaseSysInfo/AppGuids/Dto/SysAppGuidUpdateDto.cs

@@ -0,0 +1,25 @@
+using Abp.Application.Services.Dto;
+using Abp.AutoMapper;
+
+namespace VberTech.BaseSysInfo.AppGuids.Dto
+{
+    [AutoMapTo(typeof(SysAppGuid))]
+    public class SysAppGuidUpdateDto : EntityDto<int>
+    {
+
+        /// <summary>
+        /// 编码步长
+        /// </summary>   
+        public short Step { get; set; }
+
+        /// <summary>
+        /// 最后的编码
+        /// </summary>   
+        public int LastId { get; set; }
+
+        /// <summary>
+        /// 编码类型
+        /// </summary>   
+        public short IdType { get; set; }
+    }
+}

+ 15 - 0
SourceCode/VberTech/VberTech.Application/BaseSysInfo/AppGuids/ISysAppGuidsApplicationService.cs

@@ -0,0 +1,15 @@
+using VberTech.BaseSysInfo.AppGuids.Dto;
+using IwbZero.AppServiceBase;
+
+namespace VberTech.BaseSysInfo.AppGuids
+{
+    public interface ISysAppGuidAppService : IIwbAsyncCrudAppService<SysAppGuidDto, int, PagedRequestDto, SysAppGuidCreateDto, SysAppGuidUpdateDto>
+    {
+        /// <summary>
+        /// 获取自定义Guid
+        /// </summary>
+        /// <param name="type"></param>
+        /// <returns></returns>
+        int? GetAppGuid(AppGuidType type);
+    }
+}

+ 43 - 0
SourceCode/VberTech/VberTech.Application/BaseSysInfo/AppGuids/SysAppGuidsApplicationService.cs

@@ -0,0 +1,43 @@
+using System.Data;
+using System.Data.SqlClient;
+using Abp.Auditing;
+using Abp.Authorization;
+using Abp.Domain.Repositories;
+using Abp.Domain.Uow;
+using VberTech.BaseSysInfo.AppGuids.Dto;
+using VberTech.EF;
+using IwbZero.AppServiceBase;
+
+namespace VberTech.BaseSysInfo.AppGuids
+{
+    [AbpAuthorize]
+    public class SysAppGuidAppService : VberTechAsyncCrudAppService<SysAppGuid, SysAppGuidDto, int, PagedRequestDto, SysAppGuidCreateDto, SysAppGuidUpdateDto>, ISysAppGuidAppService
+    {
+        private readonly ISqlExecuter _sqlExecuter;
+        public SysAppGuidAppService(IRepository<SysAppGuid, int> repository, ISqlExecuter sqlExecuter) : base(repository)
+        {
+            _sqlExecuter = sqlExecuter;
+        }
+
+        protected override string GetPermissionName { get; set; } //= PermissionNames.PagesSysAppGuid;
+        protected override string GetAllPermissionName { get; set; } //= PermissionNames.PagesSysAppGuid;
+        protected override string CreatePermissionName { get; set; } //= PermissionNames.PagesSysAppGuidCreate;
+        protected override string UpdatePermissionName { get; set; } //= PermissionNames.PagesSysAppGuidUpdate;
+        protected override string DeletePermissionName { get; set; } //= PermissionNames.PagesSysAppGuidDelete;
+
+        [UnitOfWork]
+        [DisableAuditing]
+        public int? GetAppGuid(AppGuidType type)
+        {
+            var sqlParms = new object[3];
+            sqlParms[0] = new SqlParameter("@idtype", (int)type);
+            sqlParms[1] = new SqlParameter("@nextid", SqlDbType.Int) { Direction = ParameterDirection.Output };
+            sqlParms[2] = new SqlParameter("@maxid", SqlDbType.Int) { Direction = ParameterDirection.Output };
+            _sqlExecuter.Execute(@"exec [dbo].[Sp_AppGuid] @idtype,@nextid out,@maxid out", sqlParms);
+            int guid = (int)((SqlParameter)sqlParms[2]).Value;
+            return guid;
+        }
+    }
+
+
+}

+ 245 - 0
SourceCode/VberTech/VberTech.Application/BaseSysInfo/AttachFile/AttachFilesAppService.cs

@@ -0,0 +1,245 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Threading.Tasks;
+using System.Web.Mvc;
+using Abp.Application.Services.Dto;
+using Abp.Auditing;
+using Abp.Authorization;
+using Abp.Domain.Repositories;
+using Abp.Extensions;
+using Abp.Runtime.Caching;
+using VberTech.BaseSysInfo.AttachFile.Dto;
+using VberTech.LogHelpers;
+using IwbZero.AppServiceBase;
+using IwbZero.IdentityFramework;
+using IwbZero.Setting;
+
+
+namespace VberTech.BaseSysInfo.AttachFile
+{
+    [AbpAuthorize]
+    public class AttachFilesAppService : VberTechAsyncCrudAppService<SysAttachFile, AttachFileDto, int, PagedRequestDto, AttachFileCreateDto, AttachFileUpdateDto>
+        , IAttachFilesAppService
+    {
+        public AttachFilesAppService(
+            IIwbSettingManager settingManager,
+            ICacheManager cacheManager,
+            IRepository<SysAttachFile, int> repository) : base(repository, "AttachNo")
+        {
+            SettingManager = settingManager;
+            CacheManager = cacheManager;
+        }
+
+        protected override bool KeyIsAuto { get; set; } = true;
+
+        #region GetSelect
+
+        [DisableAuditing]
+        public async Task<List<SelectListItem>> GetSelectList()
+        {
+            var list = await Repository.GetAllListAsync();
+            var slist = new List<SelectListItem> { new SelectListItem { Text = @"请选择...", Value = "", Selected = true } };
+            foreach (var l in list)
+            {
+                slist.Add(new SelectListItem { Text = l.AttachNo, Value = l.FileTitle });
+            }
+            return slist;
+        }
+        [DisableAuditing]
+        public async Task<string> GetSelectStr()
+        {
+            var list = await Repository.GetAllListAsync();
+            string str = "<option value=\"\" selected>请选择...</option>";
+            foreach (var l in list)
+            {
+                str += $"<option value=\"{l.AttachNo}\">{l.FileTitle}</option>";
+            }
+            return str;
+        }
+
+
+        [DisableAuditing]
+        public async Task<List<SelectListItem>> GetTableSelectList(string tableName, string colName)
+        {
+            var list = await Repository.GetAllListAsync(a => a.TableName == tableName && a.ColumnName == colName);
+            var slist = new List<SelectListItem> { new SelectListItem { Text = @"请选择...", Value = "", Selected = true } };
+            foreach (var l in list)
+            {
+                slist.Add(new SelectListItem { Text = l.AttachNo, Value = l.FileTitle });
+            }
+            return slist;
+        }
+
+        [DisableAuditing]
+        public async Task<string> GetTableSelectStr(string tableName, string colName)
+        {
+            var list = await Repository.GetAllListAsync(a => a.TableName == tableName && a.ColumnName == colName);
+            string str = "<option value=\"\" selected>请选择...</option>";
+            foreach (var l in list)
+            {
+                str += $"<option value=\"{l.AttachNo}\">{l.FileTitle}</option>";
+            }
+            return str;
+        }
+
+        #endregion
+
+        #region CURD
+        /// <summary>
+        /// 查询附件
+        /// </summary>
+        /// <param name="input"></param>
+        /// <returns></returns>
+        [DisableAuditing]
+        public async Task<List<AttachFileDto>> QueryAttaches(QueryAttachDto input)
+        {
+            var entities = await Repository.GetAllListAsync(a =>
+                a.TableName == input.TableName && a.ColumnName == input.ColName && a.SourceKey == input.Key);
+            return entities.Select(MapToEntityDto).ToList();
+        }
+
+        /// <summary>
+        /// 查询附件
+        /// </summary>
+        /// <param name="input"></param>
+        /// <returns></returns>
+        [DisableAuditing]
+        public async Task<AttachFileDto> QueryAttach(QueryAttachDto input)
+        {
+            var entity = await Repository.FirstOrDefaultAsync(a =>
+                a.TableName == input.TableName && a.ColumnName == input.ColName && a.SourceKey == input.Key);
+            return MapToEntityDto(entity);
+        }
+      
+        /// <summary>
+        /// 上传附件
+        /// </summary>
+        /// <param name="input"></param>
+        /// <returns></returns>
+        [DisableAuditing]
+        public  async Task FileUpload(AttachFileCreateDto input)
+        {
+            if (await IsValidFileType(input))
+            {
+                string filePath = input.FilePath.IsNullOrEmpty()
+                    ? $"{SettingManager.GetSettingValue(SettingNames.DownloadPath)}/{input.TableName}/{input.ColumnName}"
+                    : input.FilePath;
+                var lcRetVal = Base64ToFile(input.FileInfo, $"{input.FileName}-{DateTime.Now:yyMMddHHmmss}{new Random().Next(1000, 9999)}", input.FileExt, filePath);
+                if (lcRetVal.StartsWith("error@"))
+                {
+                    CheckErrors(IwbIdentityResult.Failed(lcRetVal.Split(new[] { '@' }, StringSplitOptions.RemoveEmptyEntries)[1]));
+                    return ;
+                }
+                input.FilePath = lcRetVal;
+                var entity = await Repository.FirstOrDefaultAsync(a =>
+                    a.TableName == input.TableName && a.ColumnName == input.ColumnName &&
+                    a.SourceKey == input.SourceKey);
+                if (entity==null)
+                {
+                    await CreateEntity(input);
+                }
+                else
+                {
+                    entity.FileExt = input.FileExt;
+                    entity.FileName = input.FileName;
+                    entity.FileTitle = input.FileTitle;
+                    entity.FilePath = lcRetVal;
+                    entity.FileType = input.FileType;
+                    await Repository.UpdateAsync(entity);
+                }
+                await CurrentUnitOfWork.SaveChangesAsync();
+                return;
+            }
+
+            var allowExts = string.IsNullOrEmpty(input.AllowExt)
+                ? await SettingManager.GetSettingValueAsync(SettingNames.UploadFileExt)
+                : input.AllowExt;
+            CheckErrors(IwbIdentityResult.Failed($"[{input.FileName}.{input.FileExt}]文件类型不合法,请上传合法文件【{allowExts}】!"));
+        }
+
+        public override Task Delete(EntityDto<int> input)
+        {
+            return Repository.DeleteAsync(input.Id);
+        }
+
+        //protected override IQueryable<SysAttachFile> ApplySorting(IQueryable<SysAttachFile> query, PagedRequestDto input)
+        //{
+        //    return query.OrderBy(a => a.No);
+        //}
+
+        //protected override IQueryable<SysAttachFile> ApplyPaging(IQueryable<SysAttachFile> query, PagedRequestDto input)
+        //{
+        //    if (input is IPagedResultRequest pagedInput)
+        //    {
+        //        return query.Skip(pagedInput.SkipCount).Take(pagedInput.MaxResultCount);
+        //    }
+        //    return query;
+        //}
+
+        #endregion
+
+
+        private async Task<bool> IsValidFileType(AttachFileCreateDto input)
+        {
+            return await IsValidFileType(input.FileExt, input.AllowExt, false, string.IsNullOrEmpty(input.AllowExt));
+        }
+
+        private async Task<bool> IsValidFileType(string fileName, string allowExts = null, bool isName = false,
+            bool checkAll = false)
+        {
+            string ext = isName ? GetFileExt(fileName) : fileName;
+            allowExts = checkAll
+                ? $"{allowExts ?? ""},{await SettingManager.GetSettingValueAsync(SettingNames.UploadFileExt)}"
+                : allowExts;
+            if (string.IsNullOrEmpty(allowExts))
+                return true;
+            string[] extList = allowExts.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
+            foreach (var e in extList)
+            {
+                if (ext.ToLower() == e.ToLower())
+                    return true;
+            }
+            this.LogError("上传的文件非法:" + fileName);
+            return false;
+        }
+
+        private string GetFileExt(string fileName)
+        {
+            string fileExt = fileName.Substring(fileName.LastIndexOf(".", StringComparison.Ordinal) + 1, fileName.Length - fileName.LastIndexOf(".", StringComparison.Ordinal) - 1);
+            return fileExt.ToLower();
+        }
+
+        public static string Base64ToFile(string base64Str, string fileName, string fileExt, string filePath)
+        {
+            string lcRetVal = "error@";
+            try
+            {
+                fileName = $"{fileName}.{fileExt}";
+                filePath = filePath.StartsWith("/") ? filePath : ("/" + filePath);
+                filePath = filePath.EndsWith("/") ? filePath : (filePath + "/");
+
+                string path = $"{AppDomain.CurrentDomain.BaseDirectory}{filePath}";
+                if (!Directory.Exists(path))
+                    Directory.CreateDirectory(path);
+                byte[] bytes = Convert.FromBase64String(base64Str);
+                using (FileStream fs = new FileStream($"{path}{fileName}", FileMode.Create, FileAccess.Write))
+                {
+                    fs.Write(bytes, 0, bytes.Length);
+                    fs.Close();
+                }
+
+                lcRetVal = filePath + fileName;
+            }
+            catch (Exception e)
+            {
+                typeof(AttachFilesAppService).LogError(e);
+                lcRetVal += "文件上传异常。";
+            }
+
+            return lcRetVal;
+        }
+
+    }
+}

+ 54 - 0
SourceCode/VberTech/VberTech.Application/BaseSysInfo/AttachFile/Dto/AttachFileCreateDto.cs

@@ -0,0 +1,54 @@
+using System.ComponentModel.DataAnnotations;
+using Abp.AutoMapper;
+using AutoMapper;
+
+namespace VberTech.BaseSysInfo.AttachFile.Dto
+{
+    [AutoMapTo(typeof(SysAttachFile))]
+    public class AttachFileCreateDto
+    {
+        public AttachFileCreateDto(string tableName, string columnName, string sourceKey)
+        {
+            TableName = tableName;
+            ColumnName = columnName;
+            SourceKey = sourceKey;
+        }
+
+        public AttachFileCreateDto(string tableName, string columnName, string sourceKey,string fileInfo, string fileName, string fileExt,  string allowExt=null):this(tableName,columnName,sourceKey)
+        {
+            FileInfo = fileInfo;
+            FileName = fileName;
+            FileExt = fileExt;
+            AllowExt = allowExt;
+        }
+
+        public AttachFileCreateDto()
+        {
+        }
+
+        [StringLength(SysAttachFile.AttachNoMaxLength)]
+        public string AttachNo { get; set; }
+        [StringLength(SysAttachFile.TableNameMaxLength)]
+        public string TableName { get; set; }
+        [StringLength(SysAttachFile.ColumnNameMaxLength)]
+        public string ColumnName { get; set; }
+        [StringLength(SysAttachFile.SourceKeyMaxLength)]
+        public string SourceKey { get; set; }
+        [StringLength(SysAttachFile.FileTitleMaxLength)]
+        public string FileTitle { get; set; }
+        [StringLength(SysAttachFile.FileNameMaxLength)]
+        public string FileName { get; set; }
+        [StringLength(SysAttachFile.FilePathMaxLength)]
+        public string FilePath { get; set; }
+        [StringLength(SysAttachFile.FileTypeMaxLength)]
+        public string FileType { get; set; }
+        [StringLength(SysAttachFile.FileExtMaxLength)]
+        public string FileExt { get; set; }
+        [StringLength(SysAttachFile.DescriptionMaxLength)]
+        public string Description { get; set; }
+
+        public string FileInfo { get; set; }
+        [IgnoreMap]
+        public string AllowExt { get; set; }
+    }
+}

+ 20 - 0
SourceCode/VberTech/VberTech.Application/BaseSysInfo/AttachFile/Dto/AttachFileDto.cs

@@ -0,0 +1,20 @@
+using Abp.Application.Services.Dto;
+using Abp.AutoMapper;
+
+namespace VberTech.BaseSysInfo.AttachFile.Dto
+{
+    [AutoMapTo(typeof(SysAttachFile)), AutoMapFrom(typeof(SysAttachFile))]
+    public class AttachFileDto : EntityDto<int>
+    {
+        public string AttachNo { get; set; }
+        public string TableName { get; set; }
+        public string ColumnName { get; set; }
+        public string SourceKey { get; set; }
+        public string FileTitle { get; set; }
+        public string FileName { get; set; }
+        public string FilePath { get; set; }
+        public string FileType { get; set; }
+        public string FileExt { get; set; }
+        public string Description { get; set; }
+    }
+}

+ 33 - 0
SourceCode/VberTech/VberTech.Application/BaseSysInfo/AttachFile/Dto/AttachFileUpdateDto.cs

@@ -0,0 +1,33 @@
+using System.ComponentModel.DataAnnotations;
+using Abp.Application.Services.Dto;
+using Abp.AutoMapper;
+
+namespace VberTech.BaseSysInfo.AttachFile.Dto
+{
+    [AutoMapTo(typeof(SysAttachFile))]
+    public class AttachFileUpdateDto : EntityDto<int>
+    {
+        [StringLength(SysAttachFile.AttachNoMaxLength)]
+        public string AttachNo { get; set; }
+        [StringLength(SysAttachFile.TableNameMaxLength)]
+        public string TableName { get; set; }
+        [StringLength(SysAttachFile.ColumnNameMaxLength)]
+        public string ColumnName { get; set; }
+        [StringLength(SysAttachFile.SourceKeyMaxLength)]
+        public string SourceKey { get; set; }
+        [StringLength(SysAttachFile.FileTitleMaxLength)]
+        public string FileTitle { get; set; }
+        [StringLength(SysAttachFile.FileNameMaxLength)]
+        public string FileName { get; set; }
+        [StringLength(SysAttachFile.FilePathMaxLength)]
+        public string FilePath { get; set; }
+        [StringLength(SysAttachFile.FileTypeMaxLength)]
+        public string FileType { get; set; }
+        [StringLength(SysAttachFile.FileExtMaxLength)]
+        public string FileExt { get; set; }
+        [StringLength(SysAttachFile.DescriptionMaxLength)]
+        public string Description { get; set; }
+        public string FileInfo { get; set; }
+
+    }
+}

+ 15 - 0
SourceCode/VberTech/VberTech.Application/BaseSysInfo/AttachFile/Dto/QueryAttachDto.cs

@@ -0,0 +1,15 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace VberTech.BaseSysInfo.AttachFile.Dto
+{
+    public class QueryAttachDto
+    {
+        public string TableName { get; set; }
+        public string ColName { get; set; }
+        public string Key { get; set; }
+    }
+}

+ 19 - 0
SourceCode/VberTech/VberTech.Application/BaseSysInfo/AttachFile/IAttachFilesApplicationService.cs

@@ -0,0 +1,19 @@
+using System.Collections.Generic;
+using System.Threading.Tasks;
+using System.Web.Mvc;
+using VberTech.BaseSysInfo.AttachFile.Dto;
+using IwbZero.AppServiceBase;
+
+namespace VberTech.BaseSysInfo.AttachFile
+{
+    public interface IAttachFilesAppService : IIwbAsyncCrudAppService<AttachFileDto, int, PagedRequestDto, AttachFileCreateDto, AttachFileUpdateDto>
+    {
+        Task FileUpload(AttachFileCreateDto input);
+        Task<AttachFileDto> QueryAttach(QueryAttachDto input);
+        Task<List<AttachFileDto>> QueryAttaches(QueryAttachDto input);
+        Task<List<SelectListItem>> GetTableSelectList(string tableName, string colName);
+        Task<string> GetTableSelectStr(string tableName, string colName);
+        Task<List<SelectListItem>> GetSelectList();
+        Task<string> GetSelectStr();
+    }
+}

+ 129 - 0
SourceCode/VberTech/VberTech.Application/BaseSysInfo/AuditLog/AuditLogsAppService.cs

@@ -0,0 +1,129 @@
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+using System.Web.Mvc;
+using Abp.Application.Services.Dto;
+using Abp.Auditing;
+using Abp.Authorization;
+using Abp.Domain.Repositories;
+using Abp.Runtime.Caching;
+using Castle.Core.Internal;
+using VberTech.Authorization.Permissions;
+using VberTech.BaseSysInfo.AuditLog.Dto;
+using VberTech.Lambda;
+using VberTech.StringModel;
+using IwbZero.AppServiceBase;
+using IwbZero.Auditing;
+
+namespace VberTech.BaseSysInfo.AuditLog
+{
+    [AbpAuthorize, AuditLog("系统日志", "日志")]
+    public class AuditLogsAppService : VberTechAsyncCrudAppService<SysLog, SysLogDto, long, PagedRequestDto>, IAuditLogsAppService
+    {
+
+        public AuditLogsAppService(ICacheManager cacheManager, IRepository<SysLog, long> repository) : base(repository)
+        {
+            CacheManager = cacheManager;
+        }
+
+        protected override string GetPermissionName { get; set; } = PermissionNames.PagesSystemSysLog;
+        protected override string GetAllPermissionName { get; set; } = PermissionNames.PagesSystemSysLog;
+        //protected override string CreatePermissionName { get; set; } = PermissionNames.PagesSystemSysLogCreate;
+        //protected override string UpdatePermissionName { get; set; } = PermissionNames.PagesSystemSysLogUpdate;
+        //protected override string DeletePermissionName { get; set; } = PermissionNames.PagesSystemSysLogDelete;
+
+        #region GetSelectList
+
+        [DisableAuditing, AllowAnonymous]
+        public async Task<List<SelectListItem>> GetLogServiceSelectLists()
+        {
+            var slist = new List<SelectListItem>();
+            var list = await Repository.GetAllListAsync(a => a.LogType != 0);
+            list = list.MyDistinct(a => a.ServiceName).ToList();
+            foreach (var l in list)
+            {
+                slist.Add(new SelectListItem { Text = l.ServiceName, Value = l.ServiceName });
+            }
+            return slist;
+        }
+
+        [DisableAuditing, AllowAnonymous]
+        public async Task<string> GetLogServiceSelectListStrs()
+        {
+            var options = "";
+            var list = await Repository.GetAllListAsync(a => a.LogType != 0);
+            list = list.MyDistinct(a => a.ServiceName).ToList();
+            foreach (var l in list)
+            {
+                options += $"<option value=\"{l.ServiceName}\" >{l.ServiceName}</option>\r\n";
+            }
+            return options;
+        }
+
+        [DisableAuditing, AllowAnonymous]
+        public async Task<List<SelectListItem>> GetLogMethodSelectLists(QueryMethodName input)
+        {
+            var slist = new List<SelectListItem>();
+            var list = await Repository.GetAllListAsync(a =>
+                a.LogType != 0 && (string.IsNullOrEmpty(input.ServiceName) || a.ServiceName == input.ServiceName));
+            list = list.MyDistinct(a => a.MethodName).ToList();
+            foreach (var l in list)
+            {
+                slist.Add(new SelectListItem { Text = l.MethodName, Value = l.MethodName });
+            }
+            return slist;
+        }
+
+        [DisableAuditing, AllowAnonymous]
+        public async Task<string> GetLogMethodSelectListStrs(QueryMethodName input)
+        {
+            string options = "";
+            var list = await Repository.GetAllListAsync(a =>
+                a.LogType != 0 && (string.IsNullOrEmpty(input.ServiceName) || a.ServiceName == input.ServiceName));
+            list = list.MyDistinct(a => a.MethodName).ToList();
+            foreach (var l in list)
+            {
+                options += $"<option value=\"{l.MethodName}\" >{l.MethodName}</option>\r\n";
+            }
+            return options;
+        }
+
+        #endregion
+        [DisableAuditing]
+        public override async Task<PagedResultDto<SysLogDto>> GetAll(PagedRequestDto input)
+        {
+            CheckGetAllPermission();
+
+            var query = CreateFilteredQuery(input).Where(a => a.LogType != 0);
+            if (input.SearchList != null && input.SearchList.Count > 0)
+            {
+                List<LambdaObject> objList = new List<LambdaObject>();
+                foreach (var o in input.SearchList)
+                {
+                    if (o.KeyWords.IsNullOrEmpty())
+                        continue;
+                    object keyWords = o.KeyWords;
+                    objList.Add(new LambdaObject
+                    {
+                        FieldType = (LambdaFieldType)o.FieldType,
+                        FieldName = o.KeyField,
+                        FieldValue = keyWords,
+                        ExpType = (LambdaExpType)o.ExpType
+                    });
+                }
+                var exp = objList.GetExp<SysLog>();
+                query = query.Where(exp);
+            }
+            var totalCount = await AsyncQueryableExecuter.CountAsync(query);
+
+            query = ApplySorting(query, input);
+            query = ApplyPaging(query, input);
+            var entities = await AsyncQueryableExecuter.ToListAsync(query);
+            var dtos = new PagedResultDto<SysLogDto>(
+                totalCount,
+                entities.Select(MapToEntityDto).ToList()
+            );
+            return dtos;
+        }
+    }
+}

+ 7 - 0
SourceCode/VberTech/VberTech.Application/BaseSysInfo/AuditLog/Dto/QueryMethodName.cs

@@ -0,0 +1,7 @@
+namespace VberTech.BaseSysInfo.AuditLog.Dto
+{
+    public class QueryMethodName
+    {
+        public string ServiceName { get; set; }
+    }
+}

+ 22 - 0
SourceCode/VberTech/VberTech.Application/BaseSysInfo/AuditLog/Dto/SysLogDto.cs

@@ -0,0 +1,22 @@
+using System;
+using Abp.Application.Services.Dto;
+using Abp.AutoMapper;
+
+namespace VberTech.BaseSysInfo.AuditLog.Dto
+{
+    [AutoMapTo(typeof(SysLog)), AutoMapFrom(typeof(SysLog))]
+    public class SysLogDto : EntityDto<long>
+    {
+        public long? UserId { get; set; }
+        public string UserName { get; set; }
+        public string ServiceName { get; set; }
+        public string MethodName { get; set; }
+        public string Parameters { get; set; }
+        public DateTime ExecutionTime { get; set; }
+        public int ExecutionDuration { get; set; }
+        public string ClientIpAddress { get; set; }
+        public string ClientName { get; set; }
+        public string BrowserInfo { get; set; }
+
+    }
+}

+ 16 - 0
SourceCode/VberTech/VberTech.Application/BaseSysInfo/AuditLog/IAuditLogsAppService.cs

@@ -0,0 +1,16 @@
+using System.Collections.Generic;
+using System.Threading.Tasks;
+using System.Web.Mvc;
+using VberTech.BaseSysInfo.AuditLog.Dto;
+using IwbZero.AppServiceBase;
+
+namespace VberTech.BaseSysInfo.AuditLog
+{
+    public interface IAuditLogsAppService : IIwbAsyncCrudAppService<SysLogDto, long, PagedRequestDto>
+    {
+        Task<List<SelectListItem>> GetLogServiceSelectLists();
+        Task<string> GetLogServiceSelectListStrs();
+        Task<List<SelectListItem>> GetLogMethodSelectLists(QueryMethodName input);
+        Task<string> GetLogMethodSelectListStrs(QueryMethodName input);
+    }
+}

+ 14 - 0
SourceCode/VberTech/VberTech.Application/BaseSysInfo/DataPermissionModelDto.cs

@@ -0,0 +1,14 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace VberTech.BaseSysInfo
+{
+    public class DataPermissionModelDto<T>
+    {
+        public T Entity { get; set; }
+        public bool IsGranted { get; set; }
+    }
+}

+ 15 - 0
SourceCode/VberTech/VberTech.Application/BaseSysInfo/ExcelImportDto.cs

@@ -0,0 +1,15 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace VberTech.BaseSysInfo
+{
+    public class ExcelImportDto
+    {
+        public string ExcelName { get; set; }
+        public string ExcelInfo { get; set; }
+        public string ExcelExt { get; set; }
+    }
+}

+ 35 - 0
SourceCode/VberTech/VberTech.Application/BaseSysInfo/Functions/Dto/FunctionCreateDto.cs

@@ -0,0 +1,35 @@
+using System.ComponentModel.DataAnnotations;
+using Abp.AutoMapper;
+using VberTech.BaseSysInfo;
+
+namespace VberTech.BaseSysInfo.Functions.Dto
+{
+    [AutoMapTo(typeof(SysFunction))]
+    public class FunctionCreateDto
+    {
+
+        [MaxLength(SysFunction.FunctionNoMaxLength)]
+        public string FunctionNo { get; set; }
+        [MaxLength(SysFunction.FunctionNoMaxLength)]
+        public string ParentNo { get; set; }
+        [MaxLength(SysFunction.FunctionNameMaxLength)]
+        public string FunctionName { get; set; }
+        [MaxLength(SysFunction.PermissionNameMaxLength)]
+        public string PermissionName { get; set; }
+        public int FunctionType { get; set; }
+        [MaxLength(SysFunction.FunctionPathMaxLength)]
+        public string FunctionPath { get; set; }
+        [StringLength(SysFunction.ActionMaxLength)]
+        public string Action { get; set; }
+        [StringLength(SysFunction.ControllerMaxLength)]
+        public string Controller { get; set; }
+        public string Url { get; set; }
+        [StringLength(SysFunction.IconMaxLength)]
+        public string Icon { get; set; }
+        [StringLength(SysFunction.ClassMaxLength)]
+        public string Class { get; set; }
+        public string Script { get; set; }
+        public int Sort { get; set; }
+        public int Depth { get; set; }
+    }
+}

+ 28 - 0
SourceCode/VberTech/VberTech.Application/BaseSysInfo/Functions/Dto/FunctionDto.cs

@@ -0,0 +1,28 @@
+using Abp.Application.Services.Dto;
+using Abp.AutoMapper;
+using VberTech.BaseSysInfo;
+
+namespace VberTech.BaseSysInfo.Functions.Dto
+{
+    [AutoMapTo(typeof(SysFunction))]
+    public class FunctionDto : EntityDto<int>
+    {
+        public string FunctionNo { get; set; }
+        public string ParentNo { get; set; }
+        public string FunctionName { get; set; }
+        public string PermissionName { get; set; }
+        public int FunctionType { get; set; }
+        public string FunctionPath { get; set; }
+        public string Action { get; set; }
+        public string Controller { get; set; }
+        public string Url { get; set; }
+        public string Icon { get; set; }
+        public string Class { get; set; }
+        public string Script { get; set; }
+        public int Sort { get; set; }
+        public int Depth { get; set; }
+
+        public string FunctionTypeName { get; set; }
+
+    }
+}

+ 35 - 0
SourceCode/VberTech/VberTech.Application/BaseSysInfo/Functions/Dto/FunctionUpdateDto.cs

@@ -0,0 +1,35 @@
+using System.ComponentModel.DataAnnotations;
+using Abp.Application.Services.Dto;
+using Abp.AutoMapper;
+using VberTech.BaseSysInfo;
+
+namespace VberTech.BaseSysInfo.Functions.Dto
+{
+    [AutoMapTo(typeof(SysFunction)), AutoMapFrom(typeof(SysFunction))]
+    public class FunctionUpdateDto : EntityDto<int>
+    {
+        [MaxLength(SysFunction.FunctionNoMaxLength)]
+        public string FunctionNo { get; set; }
+        [MaxLength(SysFunction.FunctionNoMaxLength)]
+        public string ParentNo { get; set; }
+        [MaxLength(SysFunction.FunctionNameMaxLength)]
+        public string FunctionName { get; set; }
+        [MaxLength(SysFunction.PermissionNameMaxLength)]
+        public string PermissionName { get; set; }
+        public int FunctionType { get; set; }
+        [MaxLength(SysFunction.FunctionPathMaxLength)]
+        public string FunctionPath { get; set; }
+        [StringLength(SysFunction.ActionMaxLength)]
+        public string Action { get; set; }
+        [StringLength(SysFunction.ControllerMaxLength)]
+        public string Controller { get; set; }
+        public string Url { get; set; }
+        [StringLength(SysFunction.IconMaxLength)]
+        public string Icon { get; set; }
+        [StringLength(SysFunction.ClassMaxLength)]
+        public string Class { get; set; }
+        public string Script { get; set; }
+        public int Sort { get; set; }
+        public int Depth { get; set; }
+    }
+}

+ 21 - 0
SourceCode/VberTech/VberTech.Application/BaseSysInfo/Functions/Dto/MoveFunctionDto.cs

@@ -0,0 +1,21 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Abp.Domain.Entities;
+
+namespace VberTech.BaseSysInfo.Functions.Dto
+{
+    public class MoveUpFunctionDto : Entity<int>
+    {
+        [Required]
+        public int PrevId { get; set; }
+    }
+    public class MoveDownFunctionDto : Entity<int>
+    {
+        [Required]
+        public int NextId { get; set; }
+    }
+}

+ 249 - 0
SourceCode/VberTech/VberTech.Application/BaseSysInfo/Functions/FunctionsAppService.cs

@@ -0,0 +1,249 @@
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+using System.Web.Mvc;
+using Abp.Application.Services.Dto;
+using Abp.Auditing;
+using Abp.Authorization;
+using Abp.Domain.Repositories;
+using Abp.Runtime.Caching;
+using Castle.Core.Internal;
+using VberTech.Authorization.Permissions;
+using VberTech.BaseSysInfo.Functions.Dto;
+using VberTech.BaseSysInfo.States;
+using VberTech.Lambda;
+using IwbZero;
+using IwbZero.AppServiceBase;
+using IwbZero.Auditing;
+using IwbZero.Authorization.Permissions;
+using IwbZero.IdentityFramework;
+
+namespace VberTech.BaseSysInfo.Functions
+{
+    [AbpAuthorize, AuditLog("系统功能菜单", "菜单")]
+    public class FunctionsAppService : VberTechAsyncCrudAppService<SysFunction, FunctionDto, int, PagedRequestDto, FunctionCreateDto, FunctionUpdateDto>, IFunctionsAppService
+    {
+
+        public FunctionsAppService(ICacheManager cacheManager, IIwbPermissionManager permissionManager, IRepository<SysFunction, int> repository)
+            : base(repository, "FunctionNo")
+        {
+            CacheManager = cacheManager;
+            PermissionManager = permissionManager;
+        }
+
+        protected override bool KeyIsAuto { get; set; } = false;
+        protected override string ExistMessage { get; set; } = "功能菜单已存在,请检查后重试!";
+        protected override string NotExistMessage { get; set; } = "功能菜单不存在,请检查后重试!";
+        protected override string GetPermissionName { get; set; } = PermissionNames.PagesSystemSysFunction;
+        protected override string GetAllPermissionName { get; set; } = PermissionNames.PagesSystemSysFunction;
+        protected override string CreatePermissionName { get; set; } = PermissionNames.PagesSystemSysFunctionCreate;
+        protected override string UpdatePermissionName { get; set; } = PermissionNames.PagesSystemSysFunctionUpdate;
+        protected override string DeletePermissionName { get; set; } = PermissionNames.PagesSystemSysFunctionDelete;
+
+        #region SelectList
+
+        /// <summary>
+        /// 获取 Function 下拉框选项
+        /// </summary>
+        /// <returns></returns>
+        [DisableAuditing]
+        public async Task<List<SelectListItem>> GetFunctionSelect()
+        {
+            var list = await Repository.GetAllListAsync();
+            var sList = new List<SelectListItem>();
+            foreach (var l in list)
+            {
+                sList.Add(new SelectListItem() { Value = l.FunctionNo, Text = l.FunctionName });
+            }
+
+            return sList;
+        }
+
+        /// <summary>
+        /// 获取 Function 下拉框选项
+        /// </summary>
+        /// <returns></returns>
+        [DisableAuditing]
+        public async Task<string> GetFunctionSelectStr()
+        {
+            var list = await Repository.GetAllListAsync();
+            string options = "";
+            foreach (var f in list)
+            {
+                options += "<option value=\"" + f.FunctionNo + "\">" + f.FunctionName + "</option>";
+            }
+
+            return options;
+        }
+
+        ///// <summary>
+        ///// 获取 Function 下拉框选项
+        ///// </summary>
+        ///// <returns></returns>
+        //public async Task<string> GetLogSel()
+        //{
+        //    var list = (await Repository.GetAllListAsync()).Where(a => a.FunctionType == 1 && !a.Controller.IsNullOrEmpty());
+        //    string lcRetval = "";
+        //    foreach (var f in list)
+        //    {
+        //        lcRetval += "<option value=\"" + f.Controller + "\">" + f.FunctionName + "</option>";
+        //    }
+
+        //    return lcRetval;
+        //}
+
+
+        #endregion
+
+        #region CURD
+
+        [DisableAuditing]
+        public async Task<SysFunction> GetFunByPermissionName(string name)
+        {
+            var fun = await Repository.FirstOrDefaultAsync(a => a.PermissionName == name);
+            return fun;
+        }
+
+        [DisableAuditing]
+        public override async Task<PagedResultDto<FunctionDto>> GetAll(PagedRequestDto input)
+        {
+            CheckGetAllPermission();
+
+            var query = CreateFilteredQuery(input).Where(a => a.FunctionType != 0);
+            query = ApplyFilter(query, input);
+            var totalCount = await AsyncQueryableExecuter.CountAsync(query);
+            query = ApplySorting(query, input);
+            query = ApplyPaging(query, input);
+            var entities = await AsyncQueryableExecuter.ToListAsync(query);
+
+            //var dtos = new PagedResultDto<FunctionDto>(
+            //    totalCount,
+            //    entities.Select(a => new FunctionDto()
+            //    {
+            //        Id = a.Id,
+            //        FunctionNo = a.FunctionNo,
+            //        ParentNo = a.ParentNo,
+            //        FunctionName = a.FunctionName,
+            //        PermissionName = a.PermissionName,
+            //        FunctionType = a.FunctionType,
+            //        FunctionPath = a.FunctionPath,
+            //        Action = a.Action,
+            //        Controller = a.Controller,
+            //        Url = a.Url,
+            //        Icon = a.Icon,
+            //        Class = a.Class,
+            //        Script = a.Script,
+            //        Sort = a.Sort,
+            //        Depth = a.Depth,
+            //        FunctionTypeName = _statesAppService.GetDisplayValue("SysFunction", "FunctionType", a.FunctionType.ToString())
+            //    }).ToList()
+            //);
+
+            return new PagedResultDto<FunctionDto>(totalCount, entities.Select(MapToEntityDto).ToList());
+        }
+        public override async Task<FunctionDto> Create(FunctionCreateDto input)
+        {
+            input.ParentNo = input.ParentNo.IsNullOrEmpty() ? "0" : input.ParentNo;
+            var entity = await Repository.FirstOrDefaultAsync(a => a.FunctionNo == input.ParentNo);
+            input.FunctionPath = entity.FunctionPath + "," + input.FunctionNo;
+            input.PermissionName = entity.PermissionName + "." + input.FunctionNo;
+            var dto = await CreateEntity(input);
+            await Refresh();
+            return dto;
+        }
+        public override async Task<FunctionDto> Update(FunctionUpdateDto input)
+        {
+            input.ParentNo = input.ParentNo.IsNullOrEmpty() ? "0" : input.ParentNo;
+            var entity = await Repository.FirstOrDefaultAsync(a => a.Id == input.Id);
+            string sysUser = AbpSession.UserName.ToUpper();
+            if (sysUser != "ADMIN")
+            {
+                input.FunctionType = entity.FunctionType;
+                input.PermissionName = entity.PermissionName;
+                input.Action = entity.Action;
+                input.Controller = entity.Controller;
+                input.FunctionPath = entity.FunctionPath;
+                input.Script = entity.Script;
+                input.Class = entity.Class;
+                input.Url = entity.Url;
+            }
+
+            MapToEntity(input, entity);
+            entity = await Repository.UpdateAsync(entity);
+            await CacheManager.GetCache(IwbZeroConsts.SysFunctionItemCache).RemoveAsync(entity.FunctionNo);
+            return MapToEntityDto(entity);
+        }
+        public override async Task Delete(EntityDto<int> input)
+        {
+            CheckDeletePermission();
+            var entity = await Repository.FirstOrDefaultAsync(a => a.Id == input.Id);
+            if ((await Repository.GetAllListAsync(a => a.ParentNo == entity.FunctionNo)).Any())
+            {
+                CheckErrors(IwbIdentityResult.Failed("此菜单下还有子菜单,不能删除"));
+            }
+            await Repository.DeleteAsync(entity);
+            await CurrentUnitOfWork.SaveChangesAsync();
+            await CacheManager.GetCache(IwbZeroConsts.SysFunctionItemCache).RemoveAsync(entity.FunctionNo);
+        }
+
+        /// <summary>
+        /// 上移
+        /// </summary>
+        /// <param name="input"></param>
+        /// <returns></returns>
+        [AbpAuthorize(PermissionNames.PagesSystemSysFunctionMoveUp), AuditLog("上移菜单")]
+        public async Task MoveUp(MoveUpFunctionDto input)
+        {
+            var fun = await Repository.GetAsync(input.Id);
+            int sort = fun.Sort;
+            var prevFun = await Repository.GetAsync(input.PrevId);
+            int prevSort = prevFun.Sort;
+            fun.Sort = prevSort;
+            prevFun.Sort = sort;
+            await CurrentUnitOfWork.SaveChangesAsync();
+        }
+        /// <summary>
+        /// 下移
+        /// </summary>
+        /// <param name="input"></param>
+        /// <returns></returns>
+        [AbpAuthorize(PermissionNames.PagesSystemSysFunctionMoveDown), AuditLog("下移菜单")]
+        public async Task MoveDown(MoveDownFunctionDto input)
+        {
+            var fun = await Repository.GetAsync(input.Id);
+            int sort = fun.Sort;
+            var nextFun = await Repository.GetAsync(input.NextId);
+            int nextSort = nextFun.Sort;
+            fun.Sort = nextSort;
+            nextFun.Sort = sort;
+            await CurrentUnitOfWork.SaveChangesAsync();
+        }
+
+        /// <summary>
+        /// 强制刷新
+        /// </summary>
+        /// <returns></returns>
+        [AbpAuthorize(PermissionNames.PagesSystemSysFunctionRefresh), AuditLog("强制刷新")]
+        public async Task Refresh()
+        {
+            await CacheManager.GetCache(IwbZeroConsts.SysFunctionCache).ClearAsync();
+            await CacheManager.GetCache(IwbZeroConsts.SysFunctionItemCache).ClearAsync();
+            PermissionManager.Initialize();
+        }
+
+        /// <summary>
+        /// 重写排序方法
+        /// </summary>
+        /// <param name="query"></param>
+        /// <param name="input"></param>
+        /// <returns></returns>
+        protected override IQueryable<SysFunction> ApplySorting(IQueryable<SysFunction> query, PagedRequestDto input)
+        {
+            return query.OrderBy(a => a.FunctionType).ThenBy(a => a.Sort);
+        }
+
+        #endregion
+    }
+
+
+}

+ 18 - 0
SourceCode/VberTech/VberTech.Application/BaseSysInfo/Functions/IFunctionsAppService.cs

@@ -0,0 +1,18 @@
+using System.Collections.Generic;
+using System.Threading.Tasks;
+using System.Web.Mvc;
+using VberTech.BaseSysInfo.Functions.Dto;
+using IwbZero.AppServiceBase;
+
+namespace VberTech.BaseSysInfo.Functions
+{
+    public interface IFunctionsAppService : IIwbAsyncCrudAppService<FunctionDto, int, PagedRequestDto, FunctionCreateDto, FunctionUpdateDto>
+    {
+        Task<SysFunction> GetFunByPermissionName(string name);
+        Task<List<SelectListItem>> GetFunctionSelect();
+        Task<string> GetFunctionSelectStr();
+        Task MoveUp(MoveUpFunctionDto input);
+        Task MoveDown(MoveDownFunctionDto input);
+        Task Refresh();
+    }
+}

+ 42 - 0
SourceCode/VberTech/VberTech.Application/BaseSysInfo/Help/Dto/SysHelpCreateDto.cs

@@ -0,0 +1,42 @@
+using System.ComponentModel.DataAnnotations;
+using Abp.AutoMapper;
+
+namespace VberTech.BaseSysInfo.Help.Dto
+{
+    [AutoMapTo(typeof(SysHelp))]
+    public class SysHelpCreateDto
+    {
+        /// <summary>
+        /// 分类
+        /// </summary>
+        [StringLength(SysHelp.ClassificationMaxLength)]
+        public string Classification { get; set; }
+
+        [Required]
+        [StringLength(SysHelp.HelpTitleMaxLength)]
+        public string HelpTitle { get; set; }
+        /// <summary>
+        /// 关键字
+        /// </summary>
+        [StringLength(SysHelp.HelpKeyWordsMaxLength)]
+        public string HelpKeyWords { get; set; }
+        /// <summary>
+        /// 内容
+        /// </summary>
+        [StringLength(SysHelp.HelpContentWordsMaxLength)]
+        public string HelpContent { get; set; }
+        /// <summary>
+        /// 菜单名称(预留)
+        /// </summary>
+        [StringLength(SysFunction.FunctionNoMaxLength)]
+        public string FunctionNo { get; set; }
+        /// <summary>
+        /// 菜单权限ID(预留)
+        /// </summary>
+        [StringLength(SysFunction.PermissionNameMaxLength)]
+        public string PermissionName { get; set; }
+
+        public int Sequence { get; set; }
+
+    }
+}

+ 37 - 0
SourceCode/VberTech/VberTech.Application/BaseSysInfo/Help/Dto/SysHelpDto.cs

@@ -0,0 +1,37 @@
+using System.ComponentModel.DataAnnotations;
+using Abp.Application.Services.Dto;
+using Abp.AutoMapper;
+
+namespace VberTech.BaseSysInfo.Help.Dto
+{
+    [AutoMapTo(typeof(SysHelp)), AutoMapFrom(typeof(SysHelp))]
+    public class SysHelpDto : EntityDto
+    {
+
+        /// <summary>
+        /// 分类
+        /// </summary>
+        public string Classification { get; set; }
+
+        [Required]
+        public string HelpTitle { get; set; }
+        /// <summary>
+        /// 关键字
+        /// </summary>
+        public string HelpKeyWords { get; set; }
+        /// <summary>
+        /// 内容
+        /// </summary>
+        public string HelpContent { get; set; }
+        /// <summary>
+        /// 菜单名称(预留)
+        /// </summary>
+        public string FunctionNo { get; set; }
+        /// <summary>
+        /// 菜单权限ID(预留)
+        /// </summary>
+        public string PermissionName { get; set; }
+
+        public int Sequence { get; set; }
+    }
+}

+ 43 - 0
SourceCode/VberTech/VberTech.Application/BaseSysInfo/Help/Dto/SysHelpUpdateDto.cs

@@ -0,0 +1,43 @@
+using System.ComponentModel.DataAnnotations;
+using Abp.Application.Services.Dto;
+using Abp.AutoMapper;
+
+namespace VberTech.BaseSysInfo.Help.Dto
+{
+    [AutoMapTo(typeof(SysHelp))]
+    public class SysHelpUpdateDto : EntityDto
+    {
+
+        /// <summary>
+        /// 分类
+        /// </summary>
+        [StringLength(SysHelp.ClassificationMaxLength)]
+        public string Classification { get; set; }
+
+        [Required]
+        [StringLength(SysHelp.HelpTitleMaxLength)]
+        public string HelpTitle { get; set; }
+        /// <summary>
+        /// 关键字
+        /// </summary>
+        [StringLength(SysHelp.HelpKeyWordsMaxLength)]
+        public string HelpKeyWords { get; set; }
+        /// <summary>
+        /// 内容
+        /// </summary>
+        [StringLength(SysHelp.HelpContentWordsMaxLength)]
+        public string HelpContent { get; set; }
+        /// <summary>
+        /// 菜单名称(预留)
+        /// </summary>
+        [StringLength(SysFunction.FunctionNoMaxLength)]
+        public string FunctionNo { get; set; }
+        /// <summary>
+        /// 菜单权限ID(预留)
+        /// </summary>
+        [StringLength(SysFunction.PermissionNameMaxLength)]
+        public string PermissionName { get; set; }
+
+        public int Sequence { get; set; }
+    }
+}

+ 9 - 0
SourceCode/VberTech/VberTech.Application/BaseSysInfo/Help/ISysHelpsApplicationService.cs

@@ -0,0 +1,9 @@
+using VberTech.BaseSysInfo.Help.Dto;
+using IwbZero.AppServiceBase;
+
+namespace VberTech.BaseSysInfo.Help
+{
+    public interface IHelpsAppService : IIwbAsyncCrudAppService<SysHelpDto, int, PagedRequestDto, SysHelpCreateDto, SysHelpUpdateDto>
+    {
+    }
+}

+ 55 - 0
SourceCode/VberTech/VberTech.Application/BaseSysInfo/Help/SysHelpsApplicationService.cs

@@ -0,0 +1,55 @@
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+using Abp.Application.Services.Dto;
+using Abp.Auditing;
+using Abp.Authorization;
+using Abp.Domain.Repositories;
+using Abp.Extensions;
+using VberTech.Authorization.Permissions;
+using VberTech.BaseSysInfo.Help.Dto;
+using VberTech.Lambda;
+using IwbZero.AppServiceBase;
+using IwbZero.Auditing;
+
+
+namespace VberTech.BaseSysInfo.Help
+{
+    [AbpAuthorize, AuditLog("系统帮助", "帮助")]
+    public class HelpsAppService : VberTechAsyncCrudAppService<SysHelp, SysHelpDto, int, PagedRequestDto, SysHelpCreateDto, SysHelpUpdateDto>, IHelpsAppService
+    {
+        public HelpsAppService(IRepository<SysHelp, int> repository) : base(repository, "")
+        {
+        }
+        protected override string GetPermissionName { get; set; } = PermissionNames.PagesSystemSysHelp;
+        protected override string GetAllPermissionName { get; set; } = PermissionNames.PagesSystemSysHelp;
+        protected override string CreatePermissionName { get; set; } = PermissionNames.PagesSystemSysHelpCreate;
+        protected override string UpdatePermissionName { get; set; } = PermissionNames.PagesSystemSysHelpUpdate;
+        protected override string DeletePermissionName { get; set; } = PermissionNames.PagesSystemSysHelpDelete;
+        [DisableAuditing]
+        public override async Task<PagedResultDto<SysHelpDto>> GetAll(PagedRequestDto input)
+        {
+            CheckGetAllPermission();
+
+            var query = CreateFilteredQuery(input);
+            query = ApplyFilter(query, input);
+            var totalCount = await AsyncQueryableExecuter.CountAsync(query);
+
+            query = ApplySorting(query, input);
+            query = ApplyPaging(query, input);
+
+            var entities = await AsyncQueryableExecuter.ToListAsync(query);
+
+            var dtoList = new PagedResultDto<SysHelpDto>(
+                totalCount,
+                entities.Select(MapToEntityDto).ToList()
+            );
+            return dtoList;
+        }
+
+        protected override IQueryable<SysHelp> ApplySorting(IQueryable<SysHelp> query, PagedRequestDto input)
+        {
+            return query.OrderBy(a => a.Sequence);
+        }
+    }
+}

+ 16 - 0
SourceCode/VberTech/VberTech.Application/BaseSysInfo/MoveDto.cs

@@ -0,0 +1,16 @@
+using System.ComponentModel.DataAnnotations;
+using Abp.Domain.Entities;
+
+namespace VberTech.BaseSysInfo
+{
+    public class MoveUpDto : Entity<int>
+    {
+        [Required]
+        public int PrevId { get; set; }
+    }
+    public class MoveDownDto : Entity<int>
+    {
+        [Required]
+        public int NextId { get; set; }
+    }
+}

+ 14 - 0
SourceCode/VberTech/VberTech.Application/BaseSysInfo/Roles/Dto/AuthDto.cs

@@ -0,0 +1,14 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Abp.Application.Services.Dto;
+
+namespace VberTech.BaseSysInfo.Roles.Dto
+{
+    public class AuthDto : EntityDto<int>
+    {
+        public List<string> PermissionNames { get; set; }
+    }
+}

+ 24 - 0
SourceCode/VberTech/VberTech.Application/BaseSysInfo/Roles/Dto/PermissionDto.cs

@@ -0,0 +1,24 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Abp.Application.Services.Dto;
+using Abp.Authorization;
+using Abp.AutoMapper;
+
+namespace VberTech.BaseSysInfo.Roles.Dto
+{
+    [AutoMapFrom(typeof(Permission))]
+    public class PermissionDto : EntityDto<long>
+    {
+        public PermissionDto Parent { get; set; }
+        public string Name { get; set; }
+        public string PermDisplayName { get; set; }
+        public int Sort { get; set; }
+        public bool IsAuth { get; set; }
+        public List<PermissionDto> Children { get; set; }
+
+
+    }
+}

+ 28 - 0
SourceCode/VberTech/VberTech.Application/BaseSysInfo/Roles/Dto/RoleCreateDto.cs

@@ -0,0 +1,28 @@
+using System.ComponentModel.DataAnnotations;
+using Abp.AutoMapper;
+using VberTech.Authorization.Roles;
+using IwbZero.Authorization.Roles;
+
+namespace VberTech.BaseSysInfo.Roles.Dto
+{
+    [AutoMapTo(typeof(SysRole))]
+    public class RoleCreateDto
+    {
+        [Required]
+        [StringLength(RoleBase.MaxNameLength)]
+        public string Name { get; set; }
+
+        [Required]
+        [StringLength(RoleBase.MaxDisplayNameLength)]
+        public string RoleDisplayName { get; set; }
+
+        [StringLength(RoleBase.MaxDescriptionLength)]
+        public string Description { get; set; }
+        public int RoleType { get; set; }
+        public int AccountType { get; set; }
+
+        //public virtual bool IsStatic { get; set; }
+
+        //public virtual bool IsDefault { get; set; }
+    }
+}

+ 33 - 0
SourceCode/VberTech/VberTech.Application/BaseSysInfo/Roles/Dto/RoleDto.cs

@@ -0,0 +1,33 @@
+using System;
+using System.Collections.Generic;
+using Abp.Application.Services.Dto;
+using Abp.AutoMapper;
+using VberTech.Authorization.Roles;
+
+namespace VberTech.BaseSysInfo.Roles.Dto
+{
+    [AutoMapTo(typeof(SysRole)), AutoMapFrom(typeof(SysRole))]
+    public class RoleDto : EntityDto<int>
+    {
+        public string Name { get; set; }
+        public int RoleType { get; set; }
+        public int AccountType { get; set; }
+        public string Description { get; set; }
+        public string RoleDisplayName { get; set; }
+        public bool IsStatic { get; set; }
+    }
+    public class RoleDtoModel : EntityDto<int>
+    {
+        public string Name { get; set; }
+        public int RoleType { get; set; }
+        public int AccountType { get; set; }
+        public string RoleDisplayName { get; set; }
+        public string Description { get; set; }
+        public string RoleTypeName { get; set; }
+        public bool IsStatic { get; set; }
+        public DateTime? LastModificationTime { get; set; }
+        public long? LastModifierUserId { get; set; }
+        public List<string> Permissions { get; set; }
+        public string LastModifierUserName { get; set; }
+    }
+}

+ 25 - 0
SourceCode/VberTech/VberTech.Application/BaseSysInfo/Roles/Dto/RoleUpdateDto.cs

@@ -0,0 +1,25 @@
+using System.ComponentModel.DataAnnotations;
+using Abp.Application.Services.Dto;
+using Abp.AutoMapper;
+using VberTech.Authorization.Roles;
+using IwbZero.Authorization.Roles;
+
+namespace VberTech.BaseSysInfo.Roles.Dto
+{
+    [AutoMapTo(typeof(SysRole))]
+    public class RoleUpdateDto : EntityDto<int>
+    {
+        [Required]
+        [StringLength(RoleBase.MaxNameLength)]
+        public virtual string Name { get; set; }
+
+        [Required]
+        [StringLength(RoleBase.MaxDisplayNameLength)]
+        public virtual string RoleDisplayName { get; set; }
+
+        [StringLength(RoleBase.MaxDescriptionLength)]
+        public string Description { get; set; }
+        public int RoleType { get; set; }
+        public int AccountType { get; set; }
+    }
+}

+ 21 - 0
SourceCode/VberTech/VberTech.Application/BaseSysInfo/Roles/IRolesAppService.cs

@@ -0,0 +1,21 @@
+using System.Collections.Generic;
+using System.Threading.Tasks;
+using System.Web.Mvc;
+using Abp.Application.Services;
+using Abp.Application.Services.Dto;
+using VberTech.BaseSysInfo.Roles.Dto;
+using IwbZero.AppServiceBase;
+
+namespace VberTech.BaseSysInfo.Roles
+{
+    public interface IRolesAppService : IAsyncCrudAppService<RoleDto, int, PagedRequestDto, RoleCreateDto, RoleUpdateDto>
+    {
+        Task<RoleDto> GetRoleByIdAsync(int roleId);
+        List<SelectListItem> GetRoleTypeSelect();
+        Task<bool> IsGrantedAsync(int roleId, string permissionNmae);
+        Task<PagedResultDto<RoleDtoModel>> GetAllRole(PagedRequestDto input);
+        Task<ListResultDto<PermissionDto>> GetAllPermissions();
+        //Task<PagedResultDto<RoleDto>> GetRoles(PagedResultRequestDto input);
+        Task Auth(AuthDto input);
+    }
+}

+ 240 - 0
SourceCode/VberTech/VberTech.Application/BaseSysInfo/Roles/RolesAppService.cs

@@ -0,0 +1,240 @@
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+using System.Web.Mvc;
+using Abp.Application.Services.Dto;
+using Abp.Auditing;
+using Abp.Authorization;
+using Abp.Domain.Repositories;
+using Abp.Runtime.Caching;
+using Abp.UI;
+using Castle.Core.Internal;
+using VberTech.Authorization.Permissions;
+using VberTech.Authorization.Roles;
+using VberTech.Authorization.Users;
+using VberTech.BaseSysInfo.Roles.Dto;
+using VberTech.BaseSysInfo.States;
+using VberTech.Lambda;
+using IwbZero;
+using IwbZero.AppServiceBase;
+using IwbZero.Auditing;
+using IwbZero.Authorization.Permissions;
+using IwbZero.IdentityFramework;
+
+namespace VberTech.BaseSysInfo.Roles
+{
+    [AbpAuthorize(PermissionNames.PagesSystemRoles), AuditLog("系统角色", "角色")]
+    public class RolesAppService : VberTechAsyncCrudAppService<SysRole, RoleDto, int, PagedRequestDto, RoleCreateDto, RoleUpdateDto>, IRolesAppService
+    {
+        private readonly RoleManager _roleManager;
+        private readonly UserManager _userManager;
+        private readonly IRepository<SysUser, long> _userRepository;
+        private readonly IRepository<SysUserRole, long> _userRoleRepository;
+        private readonly IStatesAppService _stateAppService;
+
+        protected override string GetPermissionName { get; set; } = PermissionNames.PagesSystemRolesCreate;
+        protected override string GetAllPermissionName { get; set; } = PermissionNames.PagesSystemRolesCreate;
+        protected override string CreatePermissionName { get; set; } = PermissionNames.PagesSystemRolesCreate;
+        protected override string UpdatePermissionName { get; set; } = PermissionNames.PagesSystemRolesUpdate;
+        protected override string DeletePermissionName { get; set; } = PermissionNames.PagesSystemRolesDelete;
+
+        public RolesAppService(
+            IRepository<SysRole, int> repository,
+            RoleManager roleManager,
+            UserManager userManager,
+            IStatesAppService stateAppService,
+            IRepository<SysUser, long> userRepository,
+            IRepository<SysUserRole, long> userRoleRepository,
+            ICacheManager cacheManager)
+            : base(repository)
+        {
+            _roleManager = roleManager;
+            _userManager = userManager;
+            _stateAppService = stateAppService;
+            _userRepository = userRepository;
+            _userRoleRepository = userRoleRepository;
+            CacheManager = cacheManager;
+            LocalizationSourceName = IwbZeroConsts.IwbZeroLocalizationSourceName;
+        }
+
+
+        [DisableAuditing]
+        public List<SelectListItem> GetRoleTypeSelect()
+        {
+            var slist = new List<SelectListItem>();
+            var list = _stateAppService.GetStateList("SysRole", "RoleType");
+            foreach (var l in list)
+            {
+                if (int.TryParse(l.CodeValue, out var roleType))
+                {
+                    if (roleType <= AbpSession.UserType && AbpSession?.UserName.ToLower() != "admin")
+                    {
+                        continue;
+                    }
+                    slist.Add(new SelectListItem { Text = l.DisplayValue, Value = l.CodeValue });
+                }
+            }
+            return slist;
+        }
+
+        #region CURD
+
+        [DisableAuditing]
+        public async Task<RoleDto> GetRoleByIdAsync(int roleId)
+        {
+            var role = await _roleManager.GetRoleByIdAsync(roleId);
+            return MapToEntityDto(role);
+        }
+
+        [DisableAuditing]
+        public async Task<PagedResultDto<RoleDtoModel>> GetAllRole(PagedRequestDto input)
+        {
+            CheckGetAllPermission();
+            var query = CreateFilteredQuery(input);
+            if (AbpSession?.UserName?.ToLower() != "admin")
+                query = query.Where(a => a.Name.ToLower() != "admin" && a.RoleType > AbpSession.UserType);
+            query = ApplyFilter(query, input);
+            var totalCount = await AsyncQueryableExecuter.CountAsync(query);
+            query = ApplySorting(query, input);
+            query = ApplyPaging(query, input);
+            var entities = await AsyncQueryableExecuter.ToListAsync(query);
+            var dtoList = new PagedResultDto<RoleDtoModel>(
+                totalCount,
+                entities.Select(a => new RoleDtoModel()
+                {
+                    Id = a.Id,
+                    Name = a.Name,
+                    AccountType = a.AccountType,
+                    RoleDisplayName = a.RoleDisplayName,
+                    RoleType = a.RoleType,
+                    RoleTypeName = _stateAppService.GetDisplayValue("SysRole", "RoleType", a.RoleType + ""),
+                    Description = a.Description,
+                    IsStatic = a.IsStatic,
+                    LastModificationTime = a.LastModificationTime,
+                    LastModifierUserName = a.LastModifierUser?.UserName ?? ""
+                }).ToList()
+            );
+            return dtoList;
+        }
+
+        public override async Task<RoleDto> Create(RoleCreateDto input)
+        {
+            var role = ObjectMapper.Map<SysRole>(input);
+            CheckCreatePermission();
+            //var result=  await _roleManager.CheckDuplicateRoleNameAsync(input.Id, input.Name, input.RoleDisplayName);
+            //if (!result.Succeeded)
+            //{
+            //    CheckErrors(result);
+            //}
+            CheckErrors(await _roleManager.CreateAsync(role));
+
+            await CurrentUnitOfWork.SaveChangesAsync();
+
+            return new RoleDto();
+        }
+        public override async Task<RoleDto> Update(RoleUpdateDto input)
+        {
+            if (input.RoleType <= AbpSession.UserType && AbpSession?.UserName.ToLower() != "admin")
+            {
+                CheckErrors(IwbIdentityResult.Failed("没有此角色类型的权限,请检查后再操作!"));
+            }
+            CheckUpdatePermission();
+            var role = await _roleManager.GetRoleByIdAsync(input.Id);
+            MapToEntity(input, role);
+            CheckErrors(await _roleManager.UpdateAsync(role));
+            //var result=  await _roleManager.CheckDuplicateRoleNameAsync(input.Id, input.Name, input.RoleDisplayName);
+            //if (!result.Succeeded)
+            //{
+            //    CheckErrors(result);
+            //}
+            //var entity = await GetEntityByIdAsync(input.Id);
+
+            //MapToEntity(input, entity);
+            //await CurrentUnitOfWork.SaveChangesAsync();
+            return new RoleDto();
+        }
+        public override async Task Delete(EntityDto<int> input)
+        {
+            CheckDeletePermission();
+
+            var role = await _roleManager.FindByIdAsync(input.Id);
+            if (role.IsStatic)
+            {
+                throw new UserFriendlyException("CannotDeleteAStaticRole");
+            }
+
+            var users = await GetUsersInRoleAsync(role.Name);
+
+            foreach (var user in users)
+            {
+                CheckErrors(await _userManager.RemoveFromRoleAsync(user, role.Name));
+            }
+
+            CheckErrors(await _roleManager.DeleteAsync(role));
+        }
+
+        #endregion
+
+        [AbpAuthorize(PermissionNames.PagesSystemRolesAuth), AuditLog("角色权限配置")]
+        public async Task Auth(AuthDto input)
+        {
+            var role = await _roleManager.GetRoleByIdAsync(input.Id);
+            if (role?.RoleType == 1)
+            {
+                CheckErrors(IwbIdentityResult.Failed("超级管理员权限不能修改"));
+            }
+            var grantedPermissions = new List<Permission>();
+            if (input.PermissionNames != null && input.PermissionNames.Any())
+            {
+                grantedPermissions = PermissionManager
+                    .GetAllPermissions()
+                    .Where(p => input.PermissionNames.Contains(p.Name))
+                    .ToList();
+            }
+            await _roleManager.SetGrantedPermissionsAsync(role, grantedPermissions);
+        }
+
+        private Task<List<long>> GetUsersInRoleAsync(string roleName)
+        {
+            var users = (from user in _userRepository.GetAll()
+                         join userRole in _userRoleRepository.GetAll() on user.Id equals userRole.UserId
+                         join role in Repository.GetAll() on userRole.RoleId equals role.Id
+                         where role.Name == roleName
+                         select user.Id).Distinct().ToList();
+
+            return Task.FromResult(users);
+        }
+        [DisableAuditing]
+        public async Task<bool> IsGrantedAsync(int roleId, string permissionNmae)
+        {
+            return await _roleManager.IsGrantedAsync(roleId, permissionNmae);
+        }
+
+        [DisableAuditing]
+        public Task<ListResultDto<PermissionDto>> GetAllPermissions()
+        {
+            var permissions = PermissionManager.GetAllPermissions();
+
+            return Task.FromResult(new ListResultDto<PermissionDto>(
+                ObjectMapper.Map<List<PermissionDto>>(permissions)
+            ));
+        }
+
+        //protected override IQueryable<SysRole> CreateFilteredQuery(PagedRequestDto input)
+        //{
+        //    return Repository.GetAllIncluding(x => x.Permissions);
+        //}
+
+        //protected override Task<SysRole> GetEntityByIdAsync(int id)
+        //{
+        //    var role = Repository.GetAllIncluding(x => x.Permissions).FirstOrDefault(x => x.Id == id);
+        //    return Task.FromResult(role);
+        //}
+
+        protected override IQueryable<SysRole> ApplySorting(IQueryable<SysRole> query, PagedRequestDto input)
+        {
+            return query.OrderBy(r => r.RoleDisplayName);
+        }
+
+    }
+}

+ 23 - 0
SourceCode/VberTech/VberTech.Application/BaseSysInfo/Settings/Dto/SettingCreateDto.cs

@@ -0,0 +1,23 @@
+using System.ComponentModel.DataAnnotations;
+using Abp.AutoMapper;
+
+namespace VberTech.BaseSysInfo.Settings.Dto
+{
+    [AutoMapTo(typeof(SysSetting))]
+    public class SettingCreateDto
+    {
+        [StringLength(SysSetting.SettingNoMaxLength)]
+        public string SettingNo { get; set; }
+        [StringLength(SysSetting.SettingNameMaxLength)]
+        public string SettingName { get; set; }
+        public int SettingType { get; set; }
+        [StringLength(SysSetting.CodeMaxLength)]
+        public string Code { get; set; }
+        [StringLength(SysSetting.ValueMaxLength)]
+        public string Value { get; set; }
+        [StringLength(SysSetting.DesckMaxLength)]
+        public string Description { get; set; }
+        [StringLength(SysSetting.RemarkMaxLength)]
+        public string Remark { get; set; }
+    }
+}

+ 17 - 0
SourceCode/VberTech/VberTech.Application/BaseSysInfo/Settings/Dto/SettingDto.cs

@@ -0,0 +1,17 @@
+using Abp.Application.Services.Dto;
+using Abp.AutoMapper;
+
+namespace VberTech.BaseSysInfo.Settings.Dto
+{
+    [AutoMapTo(typeof(SysSetting)), AutoMapFrom(typeof(SysSetting))]
+    public class SettingDto : EntityDto<int>
+    {
+        public string SettingNo { get; set; }
+        public string SettingName { get; set; }
+        public int SettingType { get; set; }
+        public string Code { get; set; }
+        public string Value { get; set; }
+        public string Description { get; set; }
+        public string Remark { get; set; }
+    }
+}

+ 24 - 0
SourceCode/VberTech/VberTech.Application/BaseSysInfo/Settings/Dto/SettingUpdateDto.cs

@@ -0,0 +1,24 @@
+using System.ComponentModel.DataAnnotations;
+using Abp.Application.Services.Dto;
+using Abp.AutoMapper;
+
+namespace VberTech.BaseSysInfo.Settings.Dto
+{
+    [AutoMapTo(typeof(SysSetting))]
+    public class SettingUpdateDto : EntityDto<int>
+    {
+        [StringLength(SysSetting.SettingNoMaxLength)]
+        public string SettingNo { get; set; }
+        [StringLength(SysSetting.SettingNameMaxLength)]
+        public string SettingName { get; set; }
+        public int SettingType { get; set; }
+        [StringLength(SysSetting.CodeMaxLength)]
+        public string Code { get; set; }
+        [StringLength(SysSetting.ValueMaxLength)]
+        public string Value { get; set; }
+        [StringLength(SysSetting.DesckMaxLength)]
+        public string Description { get; set; }
+        [StringLength(SysSetting.RemarkMaxLength)]
+        public string Remark { get; set; }
+    }
+}

+ 11 - 0
SourceCode/VberTech/VberTech.Application/BaseSysInfo/Settings/ISettingsAppService.cs

@@ -0,0 +1,11 @@
+using System.Threading.Tasks;
+using VberTech.BaseSysInfo.Settings.Dto;
+using IwbZero.AppServiceBase;
+
+namespace VberTech.BaseSysInfo.Settings
+{
+    public interface ISettingsAppService : IIwbAsyncCrudAppService<SettingDto, int, PagedRequestDto, SettingCreateDto, SettingUpdateDto>
+    {
+        Task Refresh();
+    }
+}

+ 95 - 0
SourceCode/VberTech/VberTech.Application/BaseSysInfo/Settings/SettingsAppService.cs

@@ -0,0 +1,95 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+using Abp.Application.Services.Dto;
+using Abp.Auditing;
+using Abp.Authorization;
+using Abp.Domain.Repositories;
+using VberTech.BaseSysInfo.Settings.Dto;
+using VberTech.Lambda;
+using Castle.Core.Internal;
+using VberTech.Authorization.Permissions;
+using IwbZero.AppServiceBase;
+using IwbZero.Auditing;
+using IwbZero.IdentityFramework;
+using IwbZero.Setting;
+
+namespace VberTech.BaseSysInfo.Settings
+{
+    [AbpAuthorize, AuditLog("系统配置", "配置")]
+    public class SettingsAppService : VberTechAsyncCrudAppService<SysSetting, SettingDto, int, PagedRequestDto, SettingCreateDto, SettingUpdateDto>, ISettingsAppService
+    {
+
+        public SettingsAppService(IIwbSettingManager settingManager, IRepository<SysSetting, int> repository) : base(repository, "SettingNo")
+        {
+            SettingManager = settingManager;
+        }
+
+        protected override string GetPermissionName { get; set; } = PermissionNames.PagesSystemSysSetting;
+        protected override string GetAllPermissionName { get; set; } = PermissionNames.PagesSystemSysSetting;
+        protected override string CreatePermissionName { get; set; } = PermissionNames.PagesSystemSysSettingCreate;
+        protected override string UpdatePermissionName { get; set; } = PermissionNames.PagesSystemSysSettingUpdate;
+        protected override string DeletePermissionName { get; set; } = PermissionNames.PagesSystemSysSettingDelete;
+
+        [DisableAuditing]
+        public override async Task<PagedResultDto<SettingDto>> GetAll(PagedRequestDto input)
+        {
+            CheckGetAllPermission();
+            var query = CreateFilteredQuery(input).Where(a => a.SettingType != 0);
+            query = ApplyFilter(query, input);
+            var totalCount = await AsyncQueryableExecuter.CountAsync(query);
+            query = ApplySorting(query, input);
+            query = ApplyPaging(query, input);
+            var entities = await AsyncQueryableExecuter.ToListAsync(query);
+
+            var dtoList = new PagedResultDto<SettingDto>(
+                totalCount,
+                entities.Select(MapToEntityDto).ToList()
+            );
+            return dtoList;
+        }
+        public override async Task<SettingDto> Create(SettingCreateDto input)
+        {
+            CheckCreatePermission();
+            input.SettingType = input.SettingType == 0 ? 1 : input.SettingType;
+            if ((await Repository.FirstOrDefaultAsync(a => a.Code == input.Code)) != null)
+                CheckErrors(IwbIdentityResult.Failed("系统配置已存在,请检查后再试!"));
+            var entity = MapToEntity(input);
+            entity.SettingNo = Guid.NewGuid().ToString("N");
+            await Repository.InsertAsync(entity);
+            await CurrentUnitOfWork.SaveChangesAsync();
+            await Refresh();
+            return MapToEntityDto(entity);
+        }
+        public override async Task<SettingDto> Update(SettingUpdateDto input)
+        {
+            CheckUpdatePermission();
+            //input.SettingType = input.SettingType == 0 ? 1 : input.SettingType;
+            var entity = await Repository.FirstOrDefaultAsync(a => a.Code == input.Code);
+            if (entity == null)
+                CheckErrors(IwbIdentityResult.Failed("系统配置不存在,请检查后再试!"));
+            else
+            {
+                input.SettingNo = entity.SettingNo;
+                input.Code = entity.Code;
+                input.SettingType = entity.SettingType;
+            }
+            MapToEntity(input, entity);
+            await CurrentUnitOfWork.SaveChangesAsync();
+            await SettingManager.ChangeSettingForApplicationAsync(input.Code, input.Value);
+            return MapToEntityDto(entity);
+        }
+        public override async Task Delete(EntityDto<int> input)
+        {
+            CheckDeletePermission();
+            await Repository.DeleteAsync(input.Id);
+            await CurrentUnitOfWork.SaveChangesAsync();
+            await Refresh();
+        }
+        public Task Refresh()
+        {
+            return SettingManager.RefreshAsync();
+        }
+    }
+}

+ 16 - 0
SourceCode/VberTech/VberTech.Application/BaseSysInfo/States/Dto/QueryStateDisplayValue.cs

@@ -0,0 +1,16 @@
+namespace VberTech.BaseSysInfo.States.Dto
+{
+    public class QueryStateDisplayValue
+    {
+        public string TableName { get; set; }
+        public string ColumnName { get; set; }
+        public string CodeValue { get; set; }
+
+        public QueryStateDisplayValue(string tableName, string columnName, string codeValue)
+        {
+            TableName = tableName;
+            ColumnName = columnName;
+            CodeValue = codeValue;
+        }
+    }
+}

+ 27 - 0
SourceCode/VberTech/VberTech.Application/BaseSysInfo/States/Dto/StateCreateDto.cs

@@ -0,0 +1,27 @@
+using System.ComponentModel.DataAnnotations;
+using Abp.AutoMapper;
+using VberTech.BaseSysInfo;
+
+namespace VberTech.BaseSysInfo.States.Dto
+{
+    [AutoMapTo(typeof(SysState))]
+    public class StateCreateDto
+    {
+        [StringLength(SysState.StateNoMaxLength)]
+        public string StateNo { get; set; }
+        [StringLength(SysState.StateNameMaxLength)]
+        public string StateName { get; set; }
+        [Required]
+        [StringLength(SysState.TableNameMaxLength)]
+        public string TableName { get; set; }
+        [Required]
+        [StringLength(SysState.ColNameMaxLength)]
+        public string ColumnName { get; set; }
+        [Required]
+        [StringLength(SysState.CodeValueMaxLength)]
+        public string CodeValue { get; set; }
+        [Required]
+        [StringLength(SysState.DisplayValueMaxLength)]
+        public string DisplayValue { get; set; }
+    }
+}

+ 14 - 0
SourceCode/VberTech/VberTech.Application/BaseSysInfo/States/Dto/StateDisplayDto.cs

@@ -0,0 +1,14 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace VberTech.BaseSysInfo.States.Dto
+{
+    public class StateDisplayDto
+    {
+        public string CodeValue { get; set; }
+        public string DisplayValue { get; set; }
+    }
+}

+ 17 - 0
SourceCode/VberTech/VberTech.Application/BaseSysInfo/States/Dto/StateDto.cs

@@ -0,0 +1,17 @@
+using Abp.Application.Services.Dto;
+using Abp.AutoMapper;
+using VberTech.BaseSysInfo;
+
+namespace VberTech.BaseSysInfo.States.Dto
+{
+    [AutoMapTo(typeof(SysState)), AutoMapFrom(typeof(SysState))]
+    public class StateDto : EntityDto<int>
+    {
+        public string StateNo { get; set; }
+        public string StateName { get; set; }
+        public string TableName { get; set; }
+        public string ColumnName { get; set; }
+        public string CodeValue { get; set; }
+        public string DisplayValue { get; set; }
+    }
+}

+ 29 - 0
SourceCode/VberTech/VberTech.Application/BaseSysInfo/States/Dto/StateUpdateDto.cs

@@ -0,0 +1,29 @@
+using System.ComponentModel.DataAnnotations;
+using Abp.Application.Services.Dto;
+using Abp.AutoMapper;
+using VberTech.BaseSysInfo;
+
+namespace VberTech.BaseSysInfo.States.Dto
+{
+    [AutoMapTo(typeof(SysState))]
+    public class StateUpdateDto : EntityDto<int>
+    {
+        [StringLength(SysState.StateNoMaxLength)]
+        public string StateNo { get; set; }
+
+        [StringLength(SysState.StateNameMaxLength)]
+        public string StateName { get; set; }
+        [Required]
+        [StringLength(SysState.TableNameMaxLength)]
+        public string TableName { get; set; }
+        [Required]
+        [StringLength(SysState.ColNameMaxLength)]
+        public string ColumnName { get; set; }
+        [Required]
+        [StringLength(SysState.CodeValueMaxLength)]
+        public string CodeValue { get; set; }
+        [Required]
+        [StringLength(SysState.DisplayValueMaxLength)]
+        public string DisplayValue { get; set; }
+    }
+}

+ 26 - 0
SourceCode/VberTech/VberTech.Application/BaseSysInfo/States/IStatesAppService.cs

@@ -0,0 +1,26 @@
+using System;
+using System.Collections.Generic;
+using System.Linq.Expressions;
+using System.Threading.Tasks;
+using System.Web.Mvc;
+using VberTech.BaseSysInfo.States.Dto;
+using IwbZero.AppServiceBase;
+
+namespace VberTech.BaseSysInfo.States
+{
+    public interface IStatesAppService : IIwbAsyncCrudAppService<StateDto, int, PagedRequestDto, StateCreateDto, StateUpdateDto>
+    {
+        List<SelectListItem> GetSelectLists(QueryStateDisplayValue input, Expression<Func<SysState, bool>> exp = null);
+        List<SelectListItem> GetSelectLists(string tableName, string columnName, Expression<Func<SysState, bool>> exp = null);
+        string GetSelectListStrs(QueryStateDisplayValue input, Expression<Func<SysState, bool>> exp = null);
+        string GetSelectListStrs(string tableName, string columnName, Expression<Func<SysState, bool>> exp = null);
+        List<StateDisplayDto> GetStateList(QueryStateDisplayValue input, Expression<Func<SysState, bool>> exp = null);
+        List<StateDisplayDto> GetStateList(string tableName, string columnName, Expression<Func<SysState, bool>> exp = null);
+        string GetDisplayValue(QueryStateDisplayValue input);
+        string GetDisplayValue(string tableName, string columnName, string codeValue);
+        string GetCodeValue(QueryStateDisplayValue input);
+        string GetCodeValue(string tableName, string columnName, string value);
+        Task<string> GetDisplayValueAsync(QueryStateDisplayValue input);
+        Task<string> GetDisplayValueAsync(string tableName, string columnName, string codeValue);
+    }
+}

+ 157 - 0
SourceCode/VberTech/VberTech.Application/BaseSysInfo/States/StatesAppService.cs

@@ -0,0 +1,157 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Linq.Expressions;
+using System.Threading.Tasks;
+using System.Web.Mvc;
+using Abp.Auditing;
+using Abp.Authorization;
+using Abp.Domain.Repositories;
+using Abp.Runtime.Caching;
+using VberTech.Authorization.Permissions;
+using VberTech.BaseSysInfo.States.Dto;
+using IwbZero;
+using IwbZero.AppServiceBase;
+using IwbZero.Auditing;
+
+namespace VberTech.BaseSysInfo.States
+{
+    [AbpAuthorize, AuditLog("系统字典", "字典")]
+    public class StatesAppService : VberTechAsyncCrudAppService<SysState, StateDto, int, PagedRequestDto, StateCreateDto, StateUpdateDto>, IStatesAppService
+    {
+
+        public StatesAppService(ICacheManager cacheManager, IRepository<SysState, int> repository) : base(repository, "StateNo")
+        {
+            CacheManager = cacheManager;
+        }
+
+        protected override string GetPermissionName { get; set; } = PermissionNames.PagesSystemSysState;
+        protected override string GetAllPermissionName { get; set; } = PermissionNames.PagesSystemSysState;
+        protected override string CreatePermissionName { get; set; } = PermissionNames.PagesSystemSysStateCreate;
+        protected override string UpdatePermissionName { get; set; } = PermissionNames.PagesSystemSysStateUpdate;
+        protected override string DeletePermissionName { get; set; } = PermissionNames.PagesSystemSysStateDelete;
+
+        #region GetSelectList
+
+        [DisableAuditing, AllowAnonymous]
+        public List<SelectListItem> GetSelectLists(QueryStateDisplayValue input, Expression<Func<SysState, bool>> exp = null)
+        {
+            return GetSelectLists(input.TableName, input.ColumnName, exp);
+        }
+        [DisableAuditing, AllowAnonymous]
+        public List<SelectListItem> GetSelectLists(string tableName, string columnName, Expression<Func<SysState, bool>> exp = null)
+        {
+            var slist = new List<SelectListItem>();
+            var list = GetStateList(tableName, columnName, exp);
+            foreach (var l in list)
+            {
+                slist.Add(new SelectListItem { Text = l.DisplayValue, Value = l.CodeValue });
+            }
+            return slist;
+        }
+        [DisableAuditing, AllowAnonymous]
+        public string GetSelectListStrs(QueryStateDisplayValue input, Expression<Func<SysState, bool>> exp = null)
+        {
+            return GetSelectListStrs(input.TableName, input.ColumnName, exp);
+        }
+        [DisableAuditing, AllowAnonymous]
+        public string GetSelectListStrs(string tableName, string columnName, Expression<Func<SysState, bool>> exp = null)
+        {
+            var options = "";
+            var list = GetStateList(tableName, columnName, exp);
+            foreach (var l in list)
+            {
+                options += $"<option value=\"{l.CodeValue}\" >{l.DisplayValue}</option>\r\n";
+            }
+            return options;
+        }
+
+        [DisableAuditing, AllowAnonymous]
+        public List<StateDisplayDto> GetStateList(QueryStateDisplayValue input, Expression<Func<SysState, bool>> exp = null)
+        {
+            return GetStateList(input.TableName, input.ColumnName, exp);
+        }
+        [DisableAuditing, AllowAnonymous]
+        public List<StateDisplayDto> GetStateList(string tableName, string columnName, Expression<Func<SysState, bool>> exp = null)
+        {
+            var list = Repository.GetAll().Where(a => a.TableName == tableName && a.ColumnName == columnName);
+            if (exp != null)
+            {
+                list = list.Where(exp);
+            }
+            var dtos = list.Select(a => new StateDisplayDto()
+            {
+                CodeValue = a.CodeValue,
+                DisplayValue = a.DisplayValue
+            }).ToList();
+            return dtos;
+        }
+
+        #endregion
+
+        #region GetDisplayValue
+        [DisableAuditing]
+        public async Task<string> GetDisplayValueAsync(QueryStateDisplayValue input)
+        {
+            return await GetDisplayValueAsync(input.TableName, input.ColumnName, input.CodeValue);
+        }
+        [DisableAuditing]
+        public async Task<string> GetDisplayValueAsync(string tableName, string columnName, string codeValue)
+        {
+            return await CacheManager.GetCache(IwbZeroConsts.SysStateCache).GetAsync(
+                 tableName + "." + columnName + "." + codeValue, () => DisplayValueAsync(tableName, columnName, codeValue));
+        }
+        private async Task<string> DisplayValueAsync(string tableName, string columnName, string codeValue)
+        {
+            var state = await Repository.FirstOrDefaultAsync(a =>
+                a.TableName == tableName && a.ColumnName == columnName && a.CodeValue == codeValue);
+            return state?.DisplayValue;
+        }
+        [DisableAuditing]
+        public string GetDisplayValue(QueryStateDisplayValue input)
+        {
+            return GetDisplayValue(input.TableName, input.ColumnName, input.CodeValue);
+        }
+        [DisableAuditing]
+        public string GetDisplayValue(string tableName, string columnName, string codeValue)
+        {
+            return CacheManager.GetCache(IwbZeroConsts.SysStateCache).Get(
+                 tableName + "." + columnName + "." + codeValue, () => DisplayValue(tableName, columnName, codeValue));
+        }
+        private string DisplayValue(string tableName, string columnName, string codeValue)
+        {
+            var state = Repository.FirstOrDefault(a =>
+               a.TableName == tableName && a.ColumnName == columnName && a.CodeValue == codeValue);
+            return state?.DisplayValue;
+        }
+
+        [DisableAuditing]
+        public string GetCodeValue(QueryStateDisplayValue input)
+        {
+            return GetDisplayValue(input.TableName, input.ColumnName, input.CodeValue);
+        }
+        [DisableAuditing]
+        public string GetCodeValue(string tableName, string columnName, string value)
+        {
+            return CacheManager.GetCache(IwbZeroConsts.SysStateCache).Get(
+                 tableName + "." + columnName + "." + value, () => CodeValue(tableName, columnName, value));
+        }
+        private string CodeValue(string tableName, string columnName, string value)
+        {
+            var state = Repository.FirstOrDefault(a =>
+               a.TableName == tableName && a.ColumnName == columnName && a.DisplayValue == value);
+            return state?.CodeValue;
+        }
+
+        #endregion
+
+        public override async Task<StateDto> Update(StateUpdateDto input)
+        {
+            CheckUpdatePermission();
+            var dto = await UpdateEntity(input);
+            await CacheManager.GetCache(IwbZeroConsts.SysStateCache)
+                .RemoveAsync(input.TableName + "." + input.ColumnName + "." + input.CodeValue);
+            return dto;
+        }
+    }
+}

+ 15 - 0
SourceCode/VberTech/VberTech.Application/BaseSysInfo/TreeDto.cs

@@ -0,0 +1,15 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace VberTech.BaseSysInfo
+{
+    public class TreeDto
+    {
+        public string Id { get; set; }
+        public string Text { get; set; }
+        public List<TreeDto> Nodes { get; set; }
+    }
+}

+ 32 - 0
SourceCode/VberTech/VberTech.Application/BaseSysInfo/Users/Dto/UserCreateDto.cs

@@ -0,0 +1,32 @@
+using System.ComponentModel.DataAnnotations;
+using Abp.AutoMapper;
+using VberTech.Authorization.Users;
+using IwbZero.Authorization.Users;
+
+namespace VberTech.BaseSysInfo.Users.Dto
+{
+    [AutoMapTo(typeof(SysUser))]
+    public class UserCreateDto
+    {
+        [StringLength(UserBase.MaxUserNameLength)]
+        public string UserName { get; set; }
+        public int UserType { get; set; }
+        [Required]
+        [StringLength(UserBase.MaxEmailAddressLength)]
+        public string EmailAddress { get; set; }
+        [Required]
+        [StringLength(UserBase.MaxNameLength)]
+        public string RealName { get; set; }
+
+        [StringLength(UserBase.MaxPhoneNumberLength)]
+        public string PhoneNumber { get; set; }
+        public bool IsActive { get; set; }
+
+        public string RoleNames { get; set; }
+
+        public int? AccountType { get; set; }
+        [StringLength(UserBase.AccountNoMaxLength)]
+        public string AccountNo { get; set; }
+
+    }
+}

+ 40 - 0
SourceCode/VberTech/VberTech.Application/BaseSysInfo/Users/Dto/UserDto.cs

@@ -0,0 +1,40 @@
+using System;
+using Abp.Application.Services.Dto;
+using Abp.AutoMapper;
+using VberTech.Authorization.Users;
+
+namespace VberTech.BaseSysInfo.Users.Dto
+{
+    [AutoMapTo(typeof(SysUser)), AutoMapFrom(typeof(SysUser))]
+    public class UserDto : EntityDto<long>
+    {
+        public string UserName { get; set; }
+        public int UserType { get; set; }
+        public string EmailAddress { get; set; }
+        public string RealName { get; set; }
+        public string PhoneNumber { get; set; }
+        public bool IsActive { get; set; }
+        public string[] RoleNames { get; set; }
+        public int? AccountType { get; set; }
+        public string AccountNo { get; set; }
+
+        public string ImagePath { get; set; }
+    }
+    public class UserDtoModel : EntityDto<long>
+    {
+        public string UserName { get; set; }
+        public string RealName { get; set; }
+        public string EmailAddress { get; set; }
+        public int UserType { get; set; }
+        public string UserTypeName { get; set; }
+        public bool IsActive { get; set; }
+        public string IsActiveName { get; set; }
+        public DateTime? LastLoginTime { get; set; }
+        public DateTime? LastModificationTime { get; set; }
+        public DateTime CreationTime { get; set; }
+        public string[] RoleNames { get; set; }
+        public string LastModifierUserName { get; set; }
+        public int? AccountType { get; set; }
+        public string AccountNo { get; set; }
+    }
+}

+ 30 - 0
SourceCode/VberTech/VberTech.Application/BaseSysInfo/Users/Dto/UserUpdateDto.cs

@@ -0,0 +1,30 @@
+using System.ComponentModel.DataAnnotations;
+using Abp.Application.Services.Dto;
+using Abp.AutoMapper;
+using VberTech.Authorization.Users;
+using IwbZero.Authorization.Users;
+
+namespace VberTech.BaseSysInfo.Users.Dto
+{
+    [AutoMapTo(typeof(SysUser))]
+    public class UserUpdateDto : EntityDto<long>
+    {
+        [Required]
+        [StringLength(UserBase.MaxUserNameLength)]
+        public string UserName { get; set; }
+        public int UserType { get; set; }
+        [Required]
+        [StringLength(UserBase.MaxEmailAddressLength)]
+        public string EmailAddress { get; set; }
+        [Required]
+        [StringLength(UserBase.MaxNameLength)]
+        public string RealName { get; set; }
+        [StringLength(UserBase.MaxPhoneNumberLength)]
+        public string PhoneNumber { get; set; }
+        public bool IsActive { get; set; }
+        public string RoleNames { get; set; }
+        public int? AccountType { get; set; }
+        [StringLength(UserBase.AccountNoMaxLength)]
+        public string AccountNo { get; set; }
+    }
+}

+ 24 - 0
SourceCode/VberTech/VberTech.Application/BaseSysInfo/Users/IUsersAppService.cs

@@ -0,0 +1,24 @@
+using System.Collections.Generic;
+using System.Threading.Tasks;
+using System.Web.Mvc;
+using Abp.Application.Services.Dto;
+using VberTech.BaseSysInfo.Roles.Dto;
+using VberTech.BaseSysInfo.Users.Dto;
+using IwbZero.AppServiceBase;
+
+namespace VberTech.BaseSysInfo.Users
+{
+    public interface IUsersAppService : IIwbAsyncCrudAppService<UserDto, long, PagedRequestDto, UserCreateDto, UserUpdateDto>
+    {
+        Task ResetPassword(EntityDto<long> input);
+        List<SelectListItem> GetUserTypeSelect();
+        Task<UserDto> GetUserByIdAsync(long userId);
+        Task<ListResultDto<PermissionDto>> GetAllPermissions();
+        Task<ListResultDto<RoleDto>> GetRoles();
+        List<SelectListItem> GetRoleSelects();
+        Task<PagedResultDto<UserDtoModel>> GetAllUser(PagedRequestDto input);
+        Task Auth(AuthDto input);
+        Task<string[]> GetUserRoles(long userId);
+        Task<bool> IsGrantedOnlyUserAsync(long userId, string permissionNmae);
+    }
+}

+ 354 - 0
SourceCode/VberTech/VberTech.Application/BaseSysInfo/Users/UsersAppService.cs

@@ -0,0 +1,354 @@
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Linq;
+using System.Threading.Tasks;
+using System.Web.Mvc;
+using Abp.Application.Services.Dto;
+using Abp.Auditing;
+using Abp.Authorization;
+using Abp.Domain.Repositories;
+using Abp.Runtime.Caching;
+using Castle.Core.Internal;
+using VberTech.Authorization.Permissions;
+using VberTech.Authorization.Roles;
+using VberTech.Authorization.Users;
+using VberTech.BaseSysInfo.AppGuids;
+using VberTech.BaseSysInfo.Roles.Dto;
+using VberTech.BaseSysInfo.States;
+using VberTech.BaseSysInfo.Users.Dto;
+using VberTech.Lambda;
+using IwbZero;
+using IwbZero.AppServiceBase;
+using IwbZero.Auditing;
+using IwbZero.Authorization.Permissions;
+using IwbZero.Authorization.Users;
+using IwbZero.IdentityFramework;
+using IwbZero.Setting;
+using Microsoft.AspNet.Identity;
+
+namespace VberTech.BaseSysInfo.Users
+{
+    [AbpAuthorize(PermissionNames.PagesSystemUsers), AuditLog("系统用户", "用户")]
+    public class UsersAppService : VberTechAsyncCrudAppService<SysUser, UserDto, long, PagedRequestDto, UserCreateDto, UserUpdateDto>, IUsersAppService
+    {
+
+        private readonly UserManager _userManager;
+        private readonly RoleManager _roleManager;
+        private readonly IRepository<SysRole> _roleRepository;
+        private readonly IStatesAppService _stateAppService;
+        private readonly ISysAppGuidAppService _sysAppGuidAppService;
+
+
+        public UsersAppService(
+            IRepository<SysUser, long> repository,
+            UserManager userManager,
+            IRepository<SysRole> roleRepository,
+            IStatesAppService stateAppService,
+            ISysAppGuidAppService sysAppGuidAppService,
+            RoleManager roleManager,
+            IwbSettingManager settingManager,
+            ICacheManager cacheManager)
+            : base(repository)
+        {
+            _userManager = userManager;
+            _roleRepository = roleRepository;
+            _stateAppService = stateAppService;
+            _sysAppGuidAppService = sysAppGuidAppService;
+            _roleManager = roleManager;
+            SettingManager = settingManager;
+            CacheManager = cacheManager;
+        }
+
+
+        protected override string GetPermissionName { get; set; } = PermissionNames.PagesSystemUsers;
+        protected override string GetAllPermissionName { get; set; } = PermissionNames.PagesSystemUsers;
+        protected override string CreatePermissionName { get; set; } = PermissionNames.PagesSystemUsersCreate;
+        protected override string UpdatePermissionName { get; set; } = PermissionNames.PagesSystemUsersUpdate;
+        protected override string DeletePermissionName { get; set; } = PermissionNames.PagesSystemUsersDelete;
+
+
+        [DisableAuditing]
+        public List<SelectListItem> GetUserTypeSelect()
+        {
+            var slist = new List<SelectListItem>();
+            var list = _stateAppService.GetStateList("SysUser", "UserType");
+            foreach (var l in list)
+            {
+                if (int.TryParse(l.CodeValue, out var userType))
+                {
+                    if (userType <= AbpSession.UserType && AbpSession?.UserName.ToLower() != "admin")
+                    {
+                        continue;
+                    }
+                    slist.Add(new SelectListItem { Text = l.DisplayValue, Value = l.CodeValue });
+                }
+            }
+            return slist;
+        }
+
+        #region Roles
+
+
+        [DisableAuditing]
+        public async Task<string[]> GetUserRoles(long userId)
+        {
+            var roleList = await _userManager.GetRolesAsync(userId);
+            string[] roles = roleList.ToArray();
+            return roles;
+        }
+
+        [DisableAuditing]
+        public async Task<ListResultDto<RoleDto>> GetRoles()
+        {
+            var accountType = AbpSession.AccountType;
+            var roles = await _roleRepository.GetAllListAsync(a =>
+                (AbpSession.UserName == UserBase.AdminUserName || a.RoleType > AbpSession.UserType) &&
+                (accountType == 1 || a.AccountType == accountType));
+            return new ListResultDto<RoleDto>(ObjectMapper.Map<List<RoleDto>>(roles));
+        }
+        [DisableAuditing]
+        public List<SelectListItem> GetRoleSelects()
+        {
+            var accountType = AbpSession.AccountType;
+            var slist = new List<SelectListItem>();
+            var list = _roleRepository.GetAllList(a =>
+                (AbpSession.UserName == UserBase.AdminUserName || a.RoleType > AbpSession.UserType) &&
+                (accountType == 1 || a.AccountType == accountType));
+            foreach (var l in list)
+            {
+                slist.Add(new SelectListItem { Text = l.RoleDisplayName, Value = l.Name });
+            }
+            return slist;
+        }
+
+        #endregion
+
+        [AbpAuthorize(PermissionNames.PagesSystemUsersResetPwd), AuditLog("重置密码")]
+        public async Task ResetPassword(EntityDto<long> input)
+        {
+            var user = await _userManager.GetUserByIdAsync(input.Id);
+            if (user == null)
+            {
+                CheckErrors(IwbIdentityResult.Failed("用户不存在,请检查后再操作!"));
+                return;
+            }
+            var password = await SettingManager.GetSettingValueAsync(SettingNames.UserDefaultPassword);
+            user.Password = new PasswordHasher().HashPassword(password);
+            await Repository.UpdateAsync(user);
+        }
+
+        #region Auth
+
+        [AbpAuthorize(PermissionNames.PagesSystemUsersAuth), AuditLog("用户权限配置")]
+        public async Task Auth(AuthDto input)
+        {
+            var user = await _userManager.GetUserByIdAsync(input.Id);
+            var grantedPermissions = new List<Permission>();
+            if (input.PermissionNames != null && input.PermissionNames.Any())
+            {
+                grantedPermissions = PermissionManager
+                    .GetAllPermissions()
+                    .Where(p => input.PermissionNames.Contains(p.Name))
+                    .ToList();
+            }
+
+            await _userManager.SetUserGrantedPermissionsAsync(user, grantedPermissions);
+        }
+
+        [DisableAuditing]
+        public Task<ListResultDto<PermissionDto>> GetAllPermissions()
+        {
+            var permissions = PermissionManager.GetAllPermissions();
+
+            return Task.FromResult(new ListResultDto<PermissionDto>(
+                ObjectMapper.Map<List<PermissionDto>>(permissions)
+            ));
+        }
+
+        [DisableAuditing]
+        public async Task<UserDto> GetUserByIdAsync(long userId)
+        {
+            var user = await _userManager.GetUserByIdAsync(userId);
+            return MapToEntityDto(user);
+        }
+        [DisableAuditing]
+        public async Task<bool> IsGrantedOnlyUserAsync(long userId, string permissionNmae)
+        {
+            return await _userManager.IsGrantedOnlyUserAsync(userId, permissionNmae);
+        }
+
+        #endregion
+
+        #region CURD
+
+        [DisableAuditing]
+        public async Task<PagedResultDto<UserDtoModel>> GetAllUser(PagedRequestDto input)
+        {
+            CheckGetAllPermission();
+            var accountType = AbpSession.AccountType;
+            var query = CreateFilteredQuery(input);
+            if (AbpSession?.UserName?.ToLower() != "admin")
+                query = query.Where(a => a.UserName.ToLower() != "admin" &&
+                                         (a.UserType > AbpSession.UserType) &&
+                                         (accountType == 1 || a.AccountType == accountType));
+            query = ApplyFilter(query, input);
+            var totalCount = await AsyncQueryableExecuter.CountAsync(query);
+
+            query = ApplySorting(query, input);
+            query = ApplyPaging(query, input);
+
+            var entities = await AsyncQueryableExecuter.ToListAsync(query);
+
+            var dtoList = new PagedResultDto<UserDtoModel>(
+                totalCount,
+                entities.Select(a => new UserDtoModel()
+                {
+                    Id = a.Id,
+                    UserName = a.UserName,
+                    UserType = a.UserType,
+                    AccountType = a.AccountType,
+                    AccountNo = a.AccountNo,
+                    UserTypeName = _stateAppService.GetDisplayValue("SysUser", "UserType", a.UserType + ""),
+                    RealName = a.RealName,
+                    EmailAddress = a.EmailAddress,
+                    IsActive = a.IsActive,
+                    IsActiveName = _stateAppService.GetDisplayValue("SysUser", "IsActive", a.IsActive.ToString().ToLower()),
+                    LastLoginTime = a.LastLoginTime,
+                    LastModificationTime = a.LastModificationTime,
+                    CreationTime = a.CreationTime,
+                    LastModifierUserName = a.LastModifierUser?.UserName ?? ""
+                }).ToList()
+            );
+            return dtoList;
+        }
+
+        public override async Task<UserDto> Get(EntityDto<long> input)
+        {
+            var user = await base.Get(input);
+            var userRoles = await _userManager.GetRolesAsync(user.Id);
+            user.RoleNames = userRoles.Select(ur => ur).ToArray();
+            return user;
+        }
+
+        [AbpAuthorize(PermissionNames.PagesSystemUsersCreate)]
+        public override async Task<UserDto> Create(UserCreateDto input)
+        {
+            var user = ObjectMapper.Map<SysUser>(input);
+            //user.UserName = BindAccount(input.AccountType, input.AccountNo);
+            user.UserName = input.UserName;
+            var password = await SettingManager.GetSettingValueAsync(SettingNames.UserDefaultPassword);
+            user.Password = new PasswordHasher().HashPassword(password);
+            user.IsEmailConfirmed = false;
+         
+            //Assign roles
+            user.Roles = new Collection<SysUserRole>();
+            if (!input.RoleNames.IsNullOrEmpty())
+            {
+                foreach (var roleName in input.RoleNames.Split(','))
+                {
+                    var role = await _roleManager.GetRoleByNameAsync(roleName);
+                    user.Roles.Add(new SysUserRole(user.Id, role.Id));
+                }
+            }
+
+            CheckErrors(await _userManager.CreateAsync(user));
+
+            await CurrentUnitOfWork.SaveChangesAsync();
+
+            return MapToEntityDto(user);
+        }
+
+
+        [AbpAuthorize(PermissionNames.PagesSystemUsersUpdate)]
+        public override async Task<UserDto> Update(UserUpdateDto input)
+        {
+            if (AbpSession?.UserName.ToLower() != "admin")
+            {
+                var oldUser = await _userManager.GetOldUserAsync(input.Id);
+                if (oldUser.UserType <= AbpSession?.UserType)
+                    CheckErrors(IwbIdentityResult.Failed("没有修改此用户的权限。"));
+                if (input.UserType <= AbpSession?.UserType)
+                    CheckErrors(IwbIdentityResult.Failed("没有此用户类型的权限,请检查用户类型后再操作!"));
+            }
+
+            var user = await _userManager.GetUserByIdAsync(input.Id);
+            if (input.AccountType != user.AccountType)
+            {
+                CheckErrors(IwbIdentityResult.Failed("用户的账号类型不能修改,请检查后再操作!"));
+            }
+
+            /*修改绑定账号。。。 */
+
+            MapToEntity(input, user);
+            CheckErrors(await _userManager.UpdateAsync(user));
+            CheckErrors(await _userManager.SetRoles(user, input.RoleNames?.Split(',')));
+            CacheManager.GetCache(IwbZeroConsts.SystemUserCache)
+                .Set(input.Id + "", Repository.FirstOrDefault(input.Id));
+            return new UserDto();
+        }
+
+        [AbpAuthorize(PermissionNames.PagesSystemUsersDelete)]
+        public override async Task Delete(EntityDto<long> input)
+        {
+            var user = await _userManager.GetUserByIdAsync(input.Id);
+            if (user.UserName.ToLower() == "admin" || user.UserName.ToLower() == "system" || user.UserType <= AbpSession?.UserType)
+            {
+                CheckErrors(IwbIdentityResult.Failed("当前用户不能被删除。"));
+            }
+            await _userManager.DeleteAsync(user);
+            await CacheManager.GetCache(IwbZeroConsts.SystemUserCache).RemoveAsync(input.Id + "");
+        }
+
+        private string BindAccount(int? accountType, string accountNo)
+        {
+            string userName = "";
+            if (accountType == 1)
+            {
+                var guid = _sysAppGuidAppService.GetAppGuid(AppGuidType.UserNo);
+                CheckGuid(guid);
+                userName = "S" + guid;
+            }
+            else if (accountType == 2)
+            {
+                var guid = _sysAppGuidAppService.GetAppGuid(AppGuidType.Guest);
+                CheckGuid(guid);
+
+                /*绑定账号。。。             */
+
+                userName = "G" + guid;
+            }
+            else
+            {
+                CheckErrors(IwbIdentityResult.Failed("未知的账号类型,请检查后再试。"));
+            }
+            return userName;
+        }
+
+        private void CheckGuid(int? guid)
+        {
+            if (guid == null || guid == 0)
+            {
+                CheckErrors(IwbIdentityResult.Failed("获取Guid编码失败!"));
+            }
+        }
+
+        #endregion
+
+        protected override IQueryable<SysUser> CreateFilteredQuery(PagedRequestDto input)
+        {
+            return Repository.GetAllIncluding(x => x.Roles);
+        }
+
+        public override async Task<SysUser> GetEntityById(long id)
+        {
+            var user = Repository.GetAllIncluding(x => x.Roles).FirstOrDefault(x => x.Id == id);
+            return await Task.FromResult(user);
+        }
+
+        protected override IQueryable<SysUser> ApplySorting(IQueryable<SysUser> query, PagedRequestDto input)
+        {
+            return query.OrderBy(a => a.AccountType).ThenBy(a => a.UserType).ThenBy(a => a.UserName);
+        }
+
+    }
+}

+ 68 - 0
SourceCode/VberTech/VberTech.Application/Bills/OrderSendBill/Dto/OrderSendBillCreateDto.cs

@@ -0,0 +1,68 @@
+using System;
+using System.Collections.Generic;
+using Abp.AutoMapper;
+using System.ComponentModel.DataAnnotations;
+using AutoMapper;
+using VberTech.OrderSends;
+
+namespace VberTech.Bills.OrderSendBill.Dto
+{
+    [AutoMapTo(typeof(OrderSendBill))]
+    public class OrderSendBillCreateDto
+    {
+
+        /// <summary>
+        /// 送货单编号
+        /// </summary>   
+        [StringLength(OrderSendBill.OrderSendBillNoMaxLength)]
+		public string OrderSendBillNo  { get; set; }
+        /// <summary>
+        /// 客户
+        /// </summary>   
+		public int CustomerSupplierId  { get; set; }
+        /// <summary>
+        /// 客户编号
+        /// </summary>   
+        [StringLength(OrderSendBill.CustomerSupplierNoMaxLength)]
+		public string CustomerSupplierNo  { get; set; }
+		//public VberTech.Customers.CustomerSupplier CustomerSupplier  { get; set; }
+        /// <summary>
+        /// 发货地址
+        /// </summary>   
+		public int CustomerSupplierAddressId  { get; set; }
+		//public VberTech.Customers.CustomerSupplierAddress CustomerSupplierAddress  { get; set; }
+		public int CustomerSupplierPersonId  { get; set; }
+		//public VberTech.Customers.CustomerSupplierPerson CustomerSupplierPerson  { get; set; }
+        /// <summary>
+        /// 送货日期
+        /// </summary>   
+		public DateTime? SendDate  { get; set; }
+        /// <summary>
+        /// 发货人
+        /// </summary>   
+		public string SendPerson  { get; set; }
+        /// <summary>
+        /// 快递物流信息
+        /// </summary>   
+        [StringLength(OrderSendBill.ExpressInfoMaxLength)]
+		public string ExpressInfo  { get; set; }
+        /// <summary>
+        /// 备注
+        /// </summary>   
+        [StringLength(OrderSendBill.RemarkMaxLength)]
+		public string Remark  { get; set; }
+
+        [IgnoreMap]
+        public string OrderSendItemIds { get; set; }
+    }
+
+    public class OrderSendDelete
+    {
+        //public int OrderSendItemId { get; set; }
+
+       
+
+        //public int OrderItemId { get; set; }
+        public List<OrderSendItem> OrderSendItems{ get; set; }
+    }
+}

+ 51 - 0
SourceCode/VberTech/VberTech.Application/Bills/OrderSendBill/Dto/OrderSendBillDto.cs

@@ -0,0 +1,51 @@
+using System;
+using Abp.AutoMapper;
+using Abp.Application.Services.Dto;
+
+namespace VberTech.Bills.OrderSendBill.Dto
+{
+    [AutoMapTo(typeof(OrderSendBill)),AutoMapFrom(typeof(OrderSendBill))]
+    public class OrderSendBillDto: EntityDto<int>
+    {
+        /// <summary>
+        /// 送货单编号
+        /// </summary>   
+		public string OrderSendBillNo  { get; set; }
+        /// <summary>
+        /// 客户
+        /// </summary>   
+		public int CustomerSupplierId  { get; set; }
+        /// <summary>
+        /// 客户编号
+        /// </summary>   
+		public string CustomerSupplierNo  { get; set; }
+		public string CustomerSupplierName  { get; set; }
+		//public VberTech.Customers.CustomerSupplier CustomerSupplier  { get; set; }
+        /// <summary>
+        /// 发货地址
+        /// </summary>   
+		public int CustomerSupplierAddressId  { get; set; }
+		//public VberTech.Customers.CustomerSupplierAddress CustomerSupplierAddress  { get; set; }
+        public string AddressDetail { get; set; }
+		public int CustomerSupplierPersonId  { get; set; }
+		//public VberTech.Customers.CustomerSupplierPerson CustomerSupplierPerson  { get; set; }
+        public string PersonName { get; set; }
+        public string MobilePhone { get; set; }
+        /// <summary>
+        /// 送货日期
+        /// </summary>   
+		public DateTime? SendDate  { get; set; }
+        /// <summary>
+        /// 发货人
+        /// </summary>   
+		public string SendPerson  { get; set; }
+        /// <summary>
+        /// 快递物流信息
+        /// </summary>   
+		public string ExpressInfo  { get; set; }
+        /// <summary>
+        /// 备注
+        /// </summary>   
+		public string Remark  { get; set; }
+    }
+}

+ 60 - 0
SourceCode/VberTech/VberTech.Application/Bills/OrderSendBill/Dto/OrderSendBillUpdateDto.cs

@@ -0,0 +1,60 @@
+using System;
+using Abp.AutoMapper;
+using Abp.Application.Services.Dto;
+using System.ComponentModel.DataAnnotations;
+
+namespace VberTech.Bills.OrderSendBill.Dto
+{
+    [AutoMapTo(typeof(OrderSendBill))]
+    public class OrderSendBillUpdateDto: EntityDto<int>
+    {
+        
+        /// <summary>
+        /// 送货单编号
+        /// </summary>   
+        [StringLength(OrderSendBill.OrderSendBillNoMaxLength)]
+		public string OrderSendBillNo  { get; set; }
+        
+        /// <summary>
+        /// 客户
+        /// </summary>   
+		public int CustomerSupplierId  { get; set; }
+        
+        /// <summary>
+        /// 客户编号
+        /// </summary>   
+        [StringLength(OrderSendBill.CustomerSupplierNoMaxLength)]
+		public string CustomerSupplierNo  { get; set; }
+		public VberTech.Customers.CustomerSupplier CustomerSupplier  { get; set; }
+        
+        /// <summary>
+        /// 发货地址
+        /// </summary>   
+		public int CustomerSupplierAddressId  { get; set; }
+		public VberTech.Customers.CustomerSupplierAddress CustomerSupplierAddress  { get; set; }
+		public int CustomerSupplierPersonId  { get; set; }
+		public VberTech.Customers.CustomerSupplierPerson CustomerSupplierPerson  { get; set; }
+        
+        /// <summary>
+        /// 送货日期
+        /// </summary>   
+		public DateTime? SendDate  { get; set; }
+        
+        /// <summary>
+        /// 发货人
+        /// </summary>   
+		public string SendPerson  { get; set; }
+        
+        /// <summary>
+        /// 快递物流信息
+        /// </summary>   
+        [StringLength(OrderSendBill.ExpressInfoMaxLength)]
+		public string ExpressInfo  { get; set; }
+        
+        /// <summary>
+        /// 备注
+        /// </summary>   
+        [StringLength(OrderSendBill.RemarkMaxLength)]
+		public string Remark  { get; set; }
+    }
+}

+ 84 - 0
SourceCode/VberTech/VberTech.Application/Bills/OrderSendBill/Dto/OrderSendItemDto.cs

@@ -0,0 +1,84 @@
+using Abp.AutoMapper;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Abp.Application.Services.Dto;
+using VberTech.Customers;
+using VberTech.OrderSends;
+
+namespace VberTech.Bills.OrderSendBill.Dto
+{
+    [AutoMapTo(typeof(OrderSendItem)), AutoMapFrom(typeof(OrderSendItem))]
+    public class OrderSendItemDto : EntityDto<int>
+    {
+        /// <summary>
+        /// 订单明细
+        /// </summary>   
+        public int OrderItemId { get; set; }
+       
+        /// <summary>
+        /// 发货日期
+        /// </summary>   
+        public DateTime? SendDate { get; set; }
+        /// <summary>
+        /// 发货数量
+        /// </summary>   
+        public decimal SendQuantity { get; set; }
+        public int? OrderSendBillId { get; set; }
+      
+        /// <summary>
+        /// 发货单编号
+        /// </summary>   
+        public string OrderSendBillNo { get; set; }
+        public int? CustomerInvoiceId { get; set; }
+       
+        /// <summary>
+        /// 客户发票号
+        /// </summary>   
+        public string CustomerInvoiceNo { get; set; }
+        public int? StatementBillId { get; set; }
+       
+        /// <summary>
+        /// 对账单编号
+        /// </summary>   
+        public string StatementBillNo { get; set; }
+        /// <summary>
+        /// 备注
+        /// </summary>   
+        public string Remark { get; set; }
+
+        public string ProductNo { get; set; }
+
+        public string ProductName { get; set; }
+
+        public string CustomerSupplierNo { get; set; }
+        /// <summary>
+        /// 名称
+        /// </summary>
+        public string CustomerSupplierName { get; set; }
+
+        public int UnitId { get; set; }
+
+
+        public string PersonName { get; set; }
+        public string MobilePhone { get; set; }
+        /// <summary>
+        /// 发货地址
+        /// </summary>
+        public string AddressDetail { get; set; }
+
+        /// <summary>
+        /// 订单日期
+        /// </summary>
+        public DateTime? OrderDate { get; set; }
+
+        public string OrderNo { get; set; }
+
+        public string Material { get; set; }
+
+        public string Model { get; set; }
+
+    }
+}

+ 35 - 0
SourceCode/VberTech/VberTech.Application/Bills/OrderSendBill/IOrderSendBillsApplicationService.cs

@@ -0,0 +1,35 @@
+using System.Collections.Generic;
+using System.Threading.Tasks;
+using System.Web.Mvc;
+using Abp.Application.Services.Dto;
+using IwbZero.AppServiceBase;
+using VberTech.Bills.OrderSendBill.Dto;
+using VberTech.OrderSends;
+
+namespace VberTech.Bills.OrderSendBill
+{
+    public interface IOrderSendBillAppService : IIwbAsyncCrudAppService<OrderSendBillDto, int, PagedRequestDto, OrderSendBillCreateDto, OrderSendBillUpdateDto >
+    {
+
+
+		Task<List<SelectListItem>> GetSelectList();
+		Task<string> GetSelectStr();
+
+		#region Get
+		Task<OrderSendBill> GetEntityById(int id);
+		Task<OrderSendBill> GetEntityByNo(string no);
+		Task<OrderSendBillDto> GetDtoById(int id);
+		Task<OrderSendBillDto> GetDtoByNo(string no);
+        #endregion
+
+        string CreateNewSendBillNum();
+        Task<List<SelectListItem>> GetHasSendOrderCustomer();
+
+        Task<List<OrderSendItemDto>> GetNotSendBillSendItems(PagedRequestDto input);
+
+        Task<OrderSendBillDto> CreateSendOrderBill(OrderSendBillCreateDto input);
+        Task CancelSendOrder(OrderSendDelete input);
+        Task Invalid(EntityDto input);
+
+    }
+}

+ 343 - 0
SourceCode/VberTech/VberTech.Application/Bills/OrderSendBill/OrderSendBillsApplicationService.cs

@@ -0,0 +1,343 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+using System.Web.Mvc;
+using Abp.Application.Services.Dto;
+using Abp.Auditing;
+using Abp.Authorization;
+using Abp.Domain.Repositories;
+using Abp.Extensions;
+using Abp.Runtime.Caching;
+using Abp.Timing;
+using IwbZero.Auditing;
+using IwbZero.AppServiceBase;
+using IwbZero.IdentityFramework;
+using IwbZero.Setting;
+using VberTech.Authorization.Permissions;
+using VberTech.Lambda;
+using VberTech.Customers.Dto;
+using VberTech.Orders;
+using VberTech.OrderSends;
+using VberTech.StringModel;
+using VberTech.Bills.OrderSendBill.Dto;
+using VberTech.Customers;
+using VberTech.EF;
+using VberTech.StoreHouseInfos;
+
+namespace VberTech.Bills.OrderSendBill
+{
+    [AbpAuthorize]
+    public class OrderSendBillAppService : VberTechAsyncCrudAppService<OrderSendBill, OrderSendBillDto, int, PagedRequestDto, OrderSendBillCreateDto, OrderSendBillUpdateDto >, IOrderSendBillAppService
+    {
+        public OrderSendBillAppService(
+			IIwbSettingManager settingManager, 
+			ICacheManager cacheManager,
+			IRepository<OrderSendBill, int> repository, IRepository<OrderSendItem> orderSendItemRepository, IRepository<ViewOrderItem> viewOrderItemRepository, ISqlExecuter sqlExecuter, IRepository<OutStoreHouse> outStoreHouseRepository, IRepository<OrderItem> orderItemRepository, IRepository<CustomerSupplier> customerSupplierRepository) : base(repository, "OrderSendBillNo")
+        {
+            OrderSendItemRepository = orderSendItemRepository;
+            ViewOrderItemRepository = viewOrderItemRepository;
+            SqlExecuter = sqlExecuter;
+            OutStoreHouseRepository = outStoreHouseRepository;
+            OrderItemRepository = orderItemRepository;
+            CustomerSupplierRepository = customerSupplierRepository;
+            SettingManager = settingManager;
+            CacheManager = cacheManager;
+        }
+
+        protected override bool KeyIsAuto { get; set; } = true;
+
+        public IRepository<OrderSendItem> OrderSendItemRepository { get; }
+        public IRepository<ViewOrderItem> ViewOrderItemRepository { get; }
+        public ISqlExecuter SqlExecuter { get; }
+        public IRepository<OrderItem> OrderItemRepository { get; }
+        public IRepository<OutStoreHouse> OutStoreHouseRepository { get; }
+        public IRepository<CustomerSupplier> CustomerSupplierRepository { get; }
+
+        #region GetSelect
+
+        [DisableAuditing]
+        public async Task<List<SelectListItem>> GetSelectList()
+        {
+            var list = await Repository.GetAllListAsync();
+            var slist = new List<SelectListItem> {new SelectListItem {Text = @"请选择...", Value = "", Selected = true}};
+            foreach (var l in list)
+            {
+                //slist.Add(new SelectListItem { Text = l., Value = l. });
+            }
+            return slist;
+        }
+        [DisableAuditing]
+        public async Task<string> GetSelectStr()
+        {
+            var list = await Repository.GetAllListAsync();
+            string str = "<option value=\"\" selected>请选择...</option>";
+            foreach (var l in list)
+            {
+                //str += $"<option value=\"{l.}\">{l.}</option>";
+            }
+            return str;
+        }
+
+        #endregion
+
+        #region CURD
+
+        [AbpAuthorize(PermissionNames.PagesOrderSendOrderSendBillCreate)]
+        public override async Task<OrderSendBillDto> Create(OrderSendBillCreateDto input)
+        {
+            return await CreateEntity(input);
+        }
+
+        [AbpAuthorize(PermissionNames.PagesOrderSendOrderSendBillUpdate)]
+        public override async Task<OrderSendBillDto> Update(OrderSendBillUpdateDto input)
+        {
+            var entity = Repository.Get(input.Id);
+            entity.SendDate = input.SendDate;
+            entity.SendPerson = input.SendPerson;
+            entity.ExpressInfo = input.ExpressInfo;
+            return MapToEntityDto(await Repository.UpdateAsync(entity)) ;
+        }
+
+        //[AbpAuthorize(PermissionNames.PagesOrderSendOrderSendBillDelete)]
+        public override Task Delete(EntityDto<int> input)
+        {
+            return Repository.DeleteAsync(input.Id);
+        }
+
+        [DisableAuditing]
+        [AbpAuthorize(PermissionNames.PagesOrderSendOrderSendBill)]
+        public override async Task<PagedResultDto<OrderSendBillDto>> GetAll(PagedRequestDto input)
+        {
+            var query = CreateFilteredQuery(input);
+            query = ApplyFilter(query, input);
+            var totalCount = await AsyncQueryableExecuter.CountAsync(query);
+            query = ApplySorting(query, input);
+            query = ApplyPaging(query, input);
+            var entities = await AsyncQueryableExecuter.ToListAsync(query);
+            var dtoList = new PagedResultDto<OrderSendBillDto>(totalCount, entities.Select(MapToEntityDto).ToList());
+            return dtoList;
+        }
+
+		#region Get
+
+		[DisableAuditing]
+        [AbpAuthorize(PermissionNames.PagesOrderSendOrderSendBill)]
+        public override Task<OrderSendBill> GetEntityById(int id)
+        {
+            return Repository.FirstOrDefaultAsync(id);
+        }
+
+        [DisableAuditing]
+        [AbpAuthorize(PermissionNames.PagesOrderSendOrderSendBill)]
+        public override Task<OrderSendBill> GetEntityByNo(string no)
+        {
+            if (KeyFiledName.IsNullOrEmpty())
+            {
+                CheckErrors(IwbIdentityResult.Failed("编码/编号字段不明确,请检查后再操作!"));
+            }
+            LambdaObject obj = new LambdaObject()
+            {
+                FieldType = LambdaFieldType.S,
+                FieldName = KeyFiledName,
+                FieldValue = no,
+                ExpType = LambdaExpType.Equal
+            };
+            var exp = obj.GetExp<OrderSendBill>();
+            return Repository.FirstOrDefaultAsync(exp);
+        }
+
+		[DisableAuditing]
+        [AbpAuthorize(PermissionNames.PagesOrderSendOrderSendBill)]
+        public override async Task<OrderSendBillDto> GetDtoById(int id)
+        {
+            var entity = await GetEntityById(id);
+            return MapToEntityDto(entity);
+        }
+		[DisableAuditing]
+        [AbpAuthorize(PermissionNames.PagesOrderSendOrderSendBill)]
+        public override async Task<OrderSendBillDto> GetDtoByNo(string no)
+        {
+            var entity = await GetEntityByNo(no);
+            return MapToEntityDto(entity);
+        }
+        [AbpAuthorize(PermissionNames.PagesOrderSendOrderSendBill)]
+        public async Task<List<SelectListItem>> GetHasSendOrderCustomer()
+        {
+            List<SelectListItem> listItems = new List<SelectListItem>();
+            var queryAllList = await OrderSendItemRepository.GetAllListAsync(i => i.OrderSendBillId == null);
+            var itemIds = queryAllList.Select(i => i.OrderItemId);
+            var orderItems = await ViewOrderItemRepository.GetAllListAsync(i => itemIds.Contains(i.Id));
+            var customers = orderItems.Select(i => new CustomerSupplierDto
+            { Id = i.CustomerSupplierId, CustomerSupplierNo = i.CustomerSupplierNo }).MyDistinct(i => i.CustomerSupplierNo).ToList();
+            foreach (var c in customers)
+            {
+                listItems.Add(new SelectListItem()
+                {
+                    Text = c.CustomerSupplierNo,
+                    Value = c.Id.ToString()
+                });
+            }
+
+            return listItems;
+        }
+        [AbpAuthorize(PermissionNames.PagesOrderSendOrderSendBill)]
+        public async Task<List<OrderSendItemDto>> GetNotSendBillSendItems(PagedRequestDto input)
+        {
+            var searchList = input.SearchList;
+            if (searchList==null||searchList[0].KeyWords.IsNullOrEmpty())
+            {
+                return new List<OrderSendItemDto>();
+            }
+
+            int customerId = 0;
+            int.TryParse(searchList[0].KeyWords,out customerId);
+            var orderItemEntity =await ViewOrderItemRepository.GetAllListAsync(i => i.CustomerSupplierId == customerId);
+            var itemIds = orderItemEntity.Select(i => i.Id).ToList();
+            var entity = OrderSendItemRepository.GetAll().Where(i=>i.OrderSendBillId == null&& itemIds.Contains(i.OrderItemId));
+            return ObjectMapper.Map<List<OrderSendItemDto>>(entity.ToList());
+        }
+
+        public string CreateNewSendBillNum()
+        {
+            return "S" + DateTime.Now.ToString("yyMMddHHmmss") + new Random(100).Next(99);
+        }
+        [AbpAuthorize(PermissionNames.PagesOrderSendOrderSendBillCreate)]
+        public async Task<OrderSendBillDto> CreateSendOrderBill(OrderSendBillCreateDto input)
+        {
+            //var idarr = id.Split(new[] {','}, StringSplitOptions.RemoveEmptyEntries);
+            if (input.OrderSendItemIds.IsNullOrEmpty())
+            {
+                CheckErrors("传参有误!");
+            }
+            var customerInfo = await CustomerSupplierRepository.FirstOrDefaultAsync(input.CustomerSupplierId);
+            input.CustomerSupplierNo = customerInfo.CustomerSupplierNo;
+            OrderSendBill entity = MapToEntity(input);
+            entity.OrderSendBillNo = "S" + DateTime.Now.ToString("yyMMddHHmmss")+new Random(100).Next(99);
+            int eId =await Repository.InsertAndGetIdAsync(entity);
+            SqlExecuter.Execute("update Iwb_OrderSendItems set OrderSendBillId=" + eId + ", OrderSendBillNo='" +
+                                entity.OrderSendBillNo + "' where Id in (" + input.OrderSendItemIds + ")");
+            return MapToEntityDto(entity);
+        }
+
+        public async Task CancelSendOrder(OrderSendDelete input)
+        {
+            if (input==null||!input.OrderSendItems.Any())
+            {
+                CheckErrors("传参有误!");
+                return;
+            }
+            //string orderSendItemIds = "";
+            foreach (var sendDelete in input.OrderSendItems)
+            {
+                //orderSendItemIds += ","+ sendDelete.Id ;
+                
+                var productOutStore =await OutStoreHouseRepository.FirstOrDefaultAsync(i => i.OrderSendItemId == sendDelete.Id);
+                if (productOutStore == null)
+                {
+                    CheckErrors(IwbIdentityResult.Failed("未发现出库记录!"));
+                    return;
+                }
+                if (productOutStore.Status == DefineConsts.StoreStatusComplete)
+                {
+                    CheckErrors(IwbIdentityResult.Failed("发货记录:" + sendDelete.Id + "的出库申请已确认出库,发货明细不可撤销!"));
+                    return ;
+                }
+                productOutStore.IsClose = true;//关闭出库申请记录
+                await  OutStoreHouseRepository.UpdateAsync(productOutStore);
+
+                //OrderSendItemRepository.DeleteAsync(i=>i.Id=);//删除发货明细
+                //loOrderItem.OrderItemStatusId = OrderItemStatusEnum.Audited.ToInt();//更新订单明细状态
+                //loOrderItem.TimeLastMod = Clock.Now;
+                //loOrderItem.UserIDLastMod = AbpSession.UserName;
+                var loOrderItem =await OrderItemRepository.FirstOrDefaultAsync(sendDelete.OrderItemId);
+                loOrderItem.OrderItemStatus = DefineConsts.OrderItemStatusAudit;
+                await OrderItemRepository.UpdateAsync(loOrderItem);
+                await OrderSendItemRepository.DeleteAsync(sendDelete.Id);
+            }
+
+            //SqlExecuter.Execute("delete from Iwb_OrderSendItems where Id in (" +
+            //                    orderSendItemIds.Substring(1) + ")");
+             
+        }
+
+        [AbpAuthorize(PermissionNames.PagesOrderSendOrderSendBillInvalid)]
+        public async Task Invalid(EntityDto input)
+        {
+            var entity = Repository.Get(input.Id);
+            var orderSends = await OrderSendItemRepository.GetAllListAsync(i => i.OrderSendBillId == entity.Id);
+            foreach (var send in orderSends)
+            {
+                send.OrderSendBillId = null;
+                send.OrderSendBillNo = "";
+                await OrderSendItemRepository.UpdateAsync(send);
+            }
+          
+            //this.Logger.Info("撤销发货单!"+entity.ToString());
+            await Repository.DeleteAsync(input.Id);
+        }
+
+
+
+        #endregion
+
+        #region Hide
+
+        //protected override IQueryable<OrderSendBill> ApplyFilter(IQueryable<OrderSendBill> query, TGetAllInput input)
+        //{
+        //    if (!input.KeyWords.IsNullOrEmpty())
+        //    {
+        //        object keyWords = input.KeyWords;
+        //        LambdaObject obj = new LambdaObject()
+        //        {
+        //            FieldType = (LambdaFieldType)input.FieldType,
+        //            FieldName = input.KeyField,
+        //            FieldValue = keyWords,
+        //            ExpType = (LambdaExpType)input.ExpType
+        //        };
+        //        var exp = obj.GetExp<OrderSendBill>();
+        //        query = query.Where(exp);
+        //    }
+        //    if (input.SearchList != null && input.SearchList.Count > 0)
+        //    {
+        //        List<LambdaObject> objList = new List<LambdaObject>();
+        //        foreach (var o in input.SearchList)
+        //        {
+        //            if (o.KeyWords.IsNullOrEmpty())
+        //                continue;
+        //            object keyWords = o.KeyWords;
+        //            objList.Add(new LambdaObject
+        //            {
+        //                FieldType = (LambdaFieldType)o.FieldType,
+        //                FieldName = o.KeyField,
+        //                FieldValue = keyWords,
+        //                ExpType = (LambdaExpType)o.ExpType
+        //            });
+        //        }
+        //        var exp = objList.GetExp<OrderSendBill>();
+        //        query = query.Where(exp);
+        //    }
+        //    return query;
+        //}
+
+        //protected override IQueryable<OrderSendBill> ApplySorting(IQueryable<OrderSendBill> query, PagedRequestDto input)
+        //{
+        //    return query.OrderBy(a => a.No);
+        //}
+
+        //protected override IQueryable<OrderSendBill> ApplyPaging(IQueryable<OrderSendBill> query, PagedRequestDto input)
+        //{
+        //    if (input is IPagedResultRequest pagedInput)
+        //    {
+        //        return query.Skip(pagedInput.SkipCount).Take(pagedInput.MaxResultCount);
+        //    }
+        //    return query;
+        //}
+
+        #endregion
+
+        #endregion
+
+
+    }
+}

+ 88 - 0
SourceCode/VberTech/VberTech.Application/Bills/StatementBill/Dto/SendItemsDto.cs

@@ -0,0 +1,88 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Abp.Application.Services.Dto;
+using Abp.AutoMapper;
+using Abp.Domain.Entities;
+using VberTech.OrderSends;
+
+namespace VberTech.Bills.Dto
+{
+    [AutoMapTo(typeof(ViewOrderSendItem)), AutoMapFrom(typeof(ViewOrderSendItem))]
+    public  class SendItemsDto:EntityDto
+    { /// <summary>
+        /// 订单明细
+        /// </summary>   
+        public int OrderItemId { get; set; }
+
+        /// <summary>
+        /// 发货日期
+        /// </summary>   
+        public DateTime? SendDate { get; set; }
+        /// <summary>
+        /// 发货数量
+        /// </summary>   
+        public decimal SendQuantity { get; set; }
+        public int? OrderSendBillId { get; set; }
+
+        /// <summary>
+        /// 发货单编号
+        /// </summary>   
+        public string OrderSendBillNo { get; set; }
+        public int? CustomerInvoiceId { get; set; }
+
+        /// <summary>
+        /// 客户发票号
+        /// </summary>   
+        public string CustomerInvoiceNo { get; set; }
+        public int? StatementBillId { get; set; }
+
+        /// <summary>
+        /// 对账单编号
+        /// </summary>   
+        public string StatementBillNo { get; set; }
+        /// <summary>
+        /// 备注
+        /// </summary>   
+        public string Remark { get; set; }
+
+        public string ProductNo { get; set; }
+
+        public string ProductName { get; set; }
+
+        public string CustomerSupplierNo { get; set; }
+        /// <summary>
+        /// 名称
+        /// </summary>
+        public string CustomerSupplierName { get; set; }
+
+        public int Unit { get; set; }
+
+
+        public string PersonName { get; set; }
+        public string MobilePhone { get; set; }
+        /// <summary>
+        /// 发货地址
+        /// </summary>
+        public string AddressDetail { get; set; }
+
+        /// <summary>
+        /// 订单日期
+        /// </summary>
+        public DateTime? OrderDate { get; set; }
+
+        public string OrderNo { get; set; }
+
+        public string Material { get; set; }
+
+        public string Model { get; set; }
+
+        public decimal Price { get; set; }
+
+        public decimal TaxPrice { get; set; }
+
+        
+    }
+}

+ 49 - 0
SourceCode/VberTech/VberTech.Application/Bills/StatementBill/Dto/StatementBillCreateDto.cs

@@ -0,0 +1,49 @@
+using System;
+using Abp.AutoMapper;
+using System.ComponentModel.DataAnnotations;
+using AutoMapper;
+
+namespace VberTech.Bills.Dto
+{
+    [AutoMapTo(typeof(StatementBill))]
+    public class StatementBillCreateDto
+    {
+        [StringLength(StatementBill.StatementNoMaxLength)]
+		public string StatementNo  { get; set; }
+        /// <summary>
+        /// 对账单日期
+        /// </summary>
+        public DateTime? StatementDate { get; set; }
+        public int CustomerSupplierId { get; set; }
+		
+        /// <summary>
+        /// 客户是否确认
+        /// </summary>   
+		public bool IsConfirm  { get; set; }
+        /// <summary>
+        /// 总金额
+        /// </summary>   
+		public decimal AllAmount  { get; set; }
+        /// <summary>
+        /// 预计付款日期
+        /// </summary>   
+		public DateTime? ExpectedPayDate  { get; set; }
+        /// <summary>
+        /// 是否支付
+        /// </summary>   
+		public bool IsPay  { get; set; }
+
+
+        [IgnoreMap]
+        public string OrderSendItemId { get; set; }
+
+        [IgnoreMap]
+        public string AttachInfo { get; set; }
+
+        [IgnoreMap]
+        public string AttachName { get; set; }
+
+        [IgnoreMap]
+        public string AttachExt { get; set; }
+    }
+}

+ 41 - 0
SourceCode/VberTech/VberTech.Application/Bills/StatementBill/Dto/StatementBillDto.cs

@@ -0,0 +1,41 @@
+using System;
+using Abp.AutoMapper;
+using Abp.Application.Services.Dto;
+
+namespace VberTech.Bills.Dto
+{
+    [AutoMapTo(typeof(StatementBill)),AutoMapFrom(typeof(StatementBill))]
+    public class StatementBillDto: EntityDto<int>
+    {
+		public string StatementNo  { get; set; }
+		//public int Year  { get; set; }
+		//public int Month  { get; set; }
+        /// <summary>
+        /// 对账单日期
+        /// </summary>
+        public DateTime? StatementDate { get; set; }
+		public int CustomerSupplierId { get; set; }
+	
+        /// <summary>
+        /// 客户是否确认
+        /// </summary>   
+		public bool IsConfirm  { get; set; }
+        /// <summary>
+        /// 总金额
+        /// </summary>   
+		public decimal AllAmount  { get; set; }
+        /// <summary>
+        /// 预计付款日期
+        /// </summary>   
+		public DateTime? ExpectedPayDate  { get; set; }
+        /// <summary>
+        /// 是否支付
+        /// </summary>   
+		public bool IsPay  { get; set; }
+        public string CustomerSupplierNo { get; set; }
+        public string CustomerSupplierName { get; set; }
+
+        public string Remark { get; set; }
+
+    }
+}

+ 42 - 0
SourceCode/VberTech/VberTech.Application/Bills/StatementBill/Dto/StatementBillUpdateDto.cs

@@ -0,0 +1,42 @@
+using System;
+using Abp.AutoMapper;
+using Abp.Application.Services.Dto;
+using System.ComponentModel.DataAnnotations;
+
+namespace VberTech.Bills.Dto
+{
+    [AutoMapTo(typeof(StatementBill))]
+    public class StatementBillUpdateDto: EntityDto<int>
+    {
+        [StringLength(StatementBill.StatementNoMaxLength)]
+		public string StatementNo  { get; set; }
+        /// <summary>
+        /// 对账单日期
+        /// </summary>
+        public DateTime? StatementDate { get; set; }
+        public int CustomerSupplierId { get; set; }
+		//public VberTech.Customers.CustomerSupplier Customer  { get; set; }
+        
+        /// <summary>
+        /// 客户是否确认
+        /// </summary>   
+		public bool IsConfirm  { get; set; }
+        
+        /// <summary>
+        /// 总金额
+        /// </summary>   
+		public decimal AllAmount  { get; set; }
+        
+        /// <summary>
+        /// 预计付款日期
+        /// </summary>   
+		public DateTime? ExpectedPayDate  { get; set; }
+        
+        /// <summary>
+        /// 是否支付
+        /// </summary>   
+		public bool IsPay  { get; set; }
+
+        public string Remark { get; set; }
+    }
+}

+ 35 - 0
SourceCode/VberTech/VberTech.Application/Bills/StatementBill/IStatementBillsApplicationService.cs

@@ -0,0 +1,35 @@
+using System.Collections.Generic;
+using System.Threading.Tasks;
+using System.Web.Mvc;
+using Abp.Application.Services.Dto;
+using IwbZero.AppServiceBase;
+using VberTech.Bills.Dto;
+using VberTech.Bills.OrderSendBill.Dto;
+using VberTech.OrderSends;
+
+namespace VberTech.Bills
+{
+    public interface IStatementBillAppService : IIwbAsyncCrudAppService<StatementBillDto, int, PagedRequestDto, StatementBillCreateDto, StatementBillUpdateDto >
+    {
+
+
+		Task<List<SelectListItem>> GetSelectList();
+		Task<string> GetSelectStr();
+
+		#region Get
+		Task<StatementBill> GetEntityById(int id);
+		Task<StatementBill> GetEntityByNo(string no);
+		Task<StatementBillDto> GetDtoById(int id);
+		Task<StatementBillDto> GetDtoByNo(string no);
+        #endregion
+
+        string CreateNewStatementNum();
+        Task<List<SelectListItem>> GetHasSendOrderCustomer();
+       List<SendItemsDto> GetNotStatementBillSendItems(PagedRequestDto input);
+
+        Task<StatementBillDto> CreateStatementBill(StatementBillCreateDto input);
+       // Task CancelSendOrder(OrderSendDelete input);
+        Task Invalid(EntityDto input);
+
+    }
+}

+ 316 - 0
SourceCode/VberTech/VberTech.Application/Bills/StatementBill/StatementBillsApplicationService.cs

@@ -0,0 +1,316 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+using System.Web.Mvc;
+using Abp.Application.Services.Dto;
+using Abp.Auditing;
+using Abp.Authorization;
+using Abp.Domain.Repositories;
+using Abp.Extensions;
+using Abp.Runtime.Caching;
+using IwbZero.Auditing;
+using IwbZero.AppServiceBase;
+using IwbZero.IdentityFramework;
+using IwbZero.Setting;
+using VberTech.Authorization.Permissions;
+using VberTech.BaseSysInfo.AttachFile;
+using VberTech.BaseSysInfo.AttachFile.Dto;
+using VberTech.Lambda;
+using VberTech.Bills.Dto;
+using VberTech.Bills.OrderSendBill.Dto;
+using VberTech.Customers;
+using VberTech.Customers.Dto;
+using VberTech.EF;
+using VberTech.Orders;
+using VberTech.OrderSends;
+using VberTech.StoreHouseInfos;
+using VberTech.StringModel;
+
+namespace VberTech.Bills
+{
+    [AbpAuthorize]
+    public class StatementBillAppService : VberTechAsyncCrudAppService<StatementBill, StatementBillDto, int, PagedRequestDto, StatementBillCreateDto, StatementBillUpdateDto >, IStatementBillAppService
+    {
+        public StatementBillAppService(
+			IIwbSettingManager settingManager, 
+			ICacheManager cacheManager,
+			IRepository<StatementBill, int> repository, IRepository<OrderSendItem> orderSendItemRepository, IRepository<ViewOrderItem> viewOrderItemRepository, ISqlExecuter sqlExecuter, IRepository<OrderItem> orderItemRepository, IRepository<OutStoreHouse> outStoreHouseRepository, IRepository<CustomerSupplier> customerSupplierRepository, IRepository<ViewOrderSendItem> viewOrderSendItemRepository, IAttachFilesAppService attachFilesAppService) : base(repository, "StatementNo")
+        {
+            OrderSendItemRepository = orderSendItemRepository;
+            ViewOrderItemRepository = viewOrderItemRepository;
+            SqlExecuter = sqlExecuter;
+            OrderItemRepository = orderItemRepository;
+            OutStoreHouseRepository = outStoreHouseRepository;
+            CustomerSupplierRepository = customerSupplierRepository;
+            ViewOrderSendItemRepository = viewOrderSendItemRepository;
+            AttachFilesAppService = attachFilesAppService;
+            SettingManager = settingManager;
+            CacheManager = cacheManager;
+        }
+
+        protected override bool KeyIsAuto { get; set; } = false;
+        public IRepository<OrderSendItem> OrderSendItemRepository { get; }
+        public IRepository<ViewOrderItem> ViewOrderItemRepository { get; }
+        public ISqlExecuter SqlExecuter { get; }
+        public IRepository<OrderItem> OrderItemRepository { get; }
+        public IRepository<OutStoreHouse> OutStoreHouseRepository { get; }
+        public IRepository<CustomerSupplier> CustomerSupplierRepository { get; }
+        public IAttachFilesAppService AttachFilesAppService { get; }
+        public IRepository<ViewOrderSendItem> ViewOrderSendItemRepository { get; }
+        #region GetSelect
+
+        [DisableAuditing]
+        public async Task<List<SelectListItem>> GetSelectList()
+        {
+            var list = await Repository.GetAllListAsync();
+            var slist = new List<SelectListItem> {new SelectListItem {Text = @"请选择...", Value = "", Selected = true}};
+            foreach (var l in list)
+            {
+                //slist.Add(new SelectListItem { Text = l., Value = l. });
+            }
+            return slist;
+        }
+        [DisableAuditing]
+        public async Task<string> GetSelectStr()
+        {
+            var list = await Repository.GetAllListAsync();
+            string str = "<option value=\"\" selected>请选择...</option>";
+            foreach (var l in list)
+            {
+                //str += $"<option value=\"{l.}\">{l.}</option>";
+            }
+            return str;
+        }
+
+        #endregion
+
+        #region CURD
+
+        //[AbpAuthorize(PermissionNames.PagesStatementBillCreate)]
+        public override async Task<StatementBillDto> Create(StatementBillCreateDto input)
+        {
+            return await CreateEntity(input);
+        }
+
+       [AbpAuthorize(PermissionNames.PagesInvoiceStatementUpdate)]
+        public override async Task<StatementBillDto> Update(StatementBillUpdateDto input)
+       {
+           StatementBill entity =Repository.Get(input.Id);
+           entity.StatementNo = input.StatementNo;
+           entity.AllAmount = input.AllAmount;
+           entity.IsConfirm = input.IsConfirm;
+           entity.IsPay = input.IsPay;
+           entity.Remark = input.Remark;
+
+           return MapToEntityDto(await Repository.UpdateAsync(entity));
+       }
+
+        //[AbpAuthorize(PermissionNames.PagesInvoiceStatementDelete)]
+        public override Task Delete(EntityDto<int> input)
+        {
+            return Repository.DeleteAsync(input.Id);
+        }
+
+        [DisableAuditing]
+        [AbpAuthorize(PermissionNames.PagesInvoiceStatementUpdate)]
+        public override async Task<PagedResultDto<StatementBillDto>> GetAll(PagedRequestDto input)
+        {
+            var query = CreateFilteredQuery(input);
+            query = ApplyFilter(query, input);
+            var totalCount = await AsyncQueryableExecuter.CountAsync(query);
+            query = ApplySorting(query, input);
+            query = ApplyPaging(query, input);
+            var entities = await AsyncQueryableExecuter.ToListAsync(query);
+            var dtoList = new PagedResultDto<StatementBillDto>(totalCount, entities.Select(MapToEntityDto).ToList());
+            return dtoList;
+        }
+
+		#region Get
+
+		[DisableAuditing]
+        //[AbpAuthorize(PermissionNames.PagesInvoiceStatement)]
+        public override Task<StatementBill> GetEntityById(int id)
+        {
+            return Repository.FirstOrDefaultAsync(id);
+        }
+
+        [DisableAuditing]
+        // [AbpAuthorize(PermissionNames.PagesInvoiceStatement)]
+        public override Task<StatementBill> GetEntityByNo(string no)
+        {
+            if (KeyFiledName.IsNullOrEmpty())
+            {
+                CheckErrors(IwbIdentityResult.Failed("编码/编号字段不明确,请检查后再操作!"));
+            }
+            LambdaObject obj = new LambdaObject()
+            {
+                FieldType = LambdaFieldType.S,
+                FieldName = KeyFiledName,
+                FieldValue = no,
+                ExpType = LambdaExpType.Equal
+            };
+            var exp = obj.GetExp<StatementBill>();
+            return Repository.FirstOrDefaultAsync(exp);
+        }
+
+		[DisableAuditing]
+		[AbpAuthorize(PermissionNames.PagesInvoiceStatement)]
+        public override async Task<StatementBillDto> GetDtoById(int id)
+        {
+            var entity = await GetEntityById(id);
+            return MapToEntityDto(entity);
+        }
+		[DisableAuditing]
+		[AbpAuthorize(PermissionNames.PagesInvoiceStatement)]
+        public override async Task<StatementBillDto> GetDtoByNo(string no)
+        {
+            var entity = await GetEntityByNo(no);
+            return MapToEntityDto(entity);
+        }
+
+
+
+        #endregion
+
+        #region Hide
+
+        //protected override IQueryable<StatementBill> ApplyFilter(IQueryable<StatementBill> query, TGetAllInput input)
+        //{
+        //    if (!input.KeyWords.IsNullOrEmpty())
+        //    {
+        //        object keyWords = input.KeyWords;
+        //        LambdaObject obj = new LambdaObject()
+        //        {
+        //            FieldType = (LambdaFieldType)input.FieldType,
+        //            FieldName = input.KeyField,
+        //            FieldValue = keyWords,
+        //            ExpType = (LambdaExpType)input.ExpType
+        //        };
+        //        var exp = obj.GetExp<StatementBill>();
+        //        query = query.Where(exp);
+        //    }
+        //    if (input.SearchList != null && input.SearchList.Count > 0)
+        //    {
+        //        List<LambdaObject> objList = new List<LambdaObject>();
+        //        foreach (var o in input.SearchList)
+        //        {
+        //            if (o.KeyWords.IsNullOrEmpty())
+        //                continue;
+        //            object keyWords = o.KeyWords;
+        //            objList.Add(new LambdaObject
+        //            {
+        //                FieldType = (LambdaFieldType)o.FieldType,
+        //                FieldName = o.KeyField,
+        //                FieldValue = keyWords,
+        //                ExpType = (LambdaExpType)o.ExpType
+        //            });
+        //        }
+        //        var exp = objList.GetExp<StatementBill>();
+        //        query = query.Where(exp);
+        //    }
+        //    return query;
+        //}
+
+        //protected override IQueryable<StatementBill> ApplySorting(IQueryable<StatementBill> query, PagedRequestDto input)
+        //{
+        //    return query.OrderBy(a => a.No);
+        //}
+
+        //protected override IQueryable<StatementBill> ApplyPaging(IQueryable<StatementBill> query, PagedRequestDto input)
+        //{
+        //    if (input is IPagedResultRequest pagedInput)
+        //    {
+        //        return query.Skip(pagedInput.SkipCount).Take(pagedInput.MaxResultCount);
+        //    }
+        //    return query;
+        //}
+
+        #endregion
+
+        #endregion
+        [AbpAuthorize(PermissionNames.PagesInvoiceStatement)]
+        public string CreateNewStatementNum()
+        {
+            return "B" + DateTime.Now.ToString("yyMMddHHmmss") + new Random(100).Next(99);
+        }
+
+        [AbpAuthorize(PermissionNames.PagesInvoiceStatement)]
+        public async Task<List<SelectListItem>> GetHasSendOrderCustomer()
+        {
+            List<SelectListItem> listItems = new List<SelectListItem>();
+            var queryAllList = await ViewOrderSendItemRepository.GetAllListAsync(i => i.OrderSendBillId >0&&i.CustomerInvoiceId>0 && i.StatementBillId ==null);
+            queryAllList = queryAllList.MyDistinct(i => i.CustomerSupplierId).ToList();
+              var customers = queryAllList.Select(i => new CustomerSupplierDto
+                { Id = i.CustomerSupplierId, CustomerSupplierNo = i.CustomerSupplierNo }).ToList();
+            foreach (var c in customers)
+            {
+                listItems.Add(new SelectListItem()
+                {
+                    Text = c.CustomerSupplierNo,
+                    Value = c.Id.ToString()
+                });
+            }
+
+            return listItems;
+        }
+        public List<SendItemsDto> GetNotStatementBillSendItems(PagedRequestDto input)
+        {
+            var searchList = input.SearchList;
+            if (searchList == null || searchList[0].KeyWords.IsNullOrEmpty())
+            {
+                return new List<SendItemsDto>();
+            }
+
+            int customerId = 0;
+            int.TryParse(searchList[0].KeyWords, out customerId);
+            //var orderItemEntity = await ViewOrderItemRepository.GetAllListAsync(i => i.CustomerSupplierId == customerId);
+            //var itemIds = orderItemEntity.Select(i => i.Id).ToList();
+            var entity = ViewOrderSendItemRepository.GetAllList(i => i.OrderSendBillId > 0 && i.CustomerInvoiceId > 0 && i.StatementBillId == null && i.CustomerSupplierId == customerId);
+            return ObjectMapper.Map<List<SendItemsDto>>(entity);
+        }
+        [AbpAuthorize(PermissionNames.PagesInvoiceStatementCreate)]
+        public async Task<StatementBillDto> CreateStatementBill(StatementBillCreateDto input)
+        {
+            //var idarr = id.Split(new[] {','}, StringSplitOptions.RemoveEmptyEntries);
+            if (input.OrderSendItemId.IsNullOrEmpty())
+            {
+                CheckErrors("传参有误!");
+            }
+            // var customerInfo = await CustomerSupplierRepository.FirstOrDefaultAsync(input.CustomerSupplierId);
+            // input.cu = customerInfo.CustomerSupplierNo;
+            StatementBill entity = MapToEntity(input);
+            entity.StatementNo = input.StatementNo.IsNullOrEmpty() ? "B" + DateTime.Now.ToString("yyMMddHHmmss") + new Random(100).Next(99) : input.StatementNo;
+            int eId = await Repository.InsertAndGetIdAsync(entity);
+            SqlExecuter.Execute("update Iwb_OrderSendItems set StatementBillId=" + eId + ", StatementBillNo='" +
+                                entity.StatementNo + "' where Id in (" + input.OrderSendItemId + ")");
+            if (!input.AttachInfo.IsNullOrEmpty())
+            {
+                await AttachFilesAppService.FileUpload(new AttachFileCreateDto("StatementBill", "Attach", input.StatementNo, input.AttachInfo, input.AttachName, input.AttachExt, "png,jpg,jpeg,pdf,doc,xls,docx,xlsx"));
+            }
+            return MapToEntityDto(entity);
+        }
+
+        public async Task Invalid(EntityDto input)
+        {
+            var entity = await Repository.FirstOrDefaultAsync(a => a.Id == input.Id);
+            if (entity == null)
+            {
+                CheckErrors("未查询到对账单!");
+                return;
+            }
+            entity.IsDeleted = true;
+            await Repository.UpdateAsync(entity);
+
+            var sendItems = await OrderSendItemRepository.GetAllListAsync(i => i.StatementBillId == entity.Id);
+            foreach (var sendItem in sendItems)
+            {
+                sendItem.StatementBillId = null;
+                sendItem.StatementBillNo = "";
+                await OrderSendItemRepository.UpdateAsync(sendItem);
+            }
+        }
+
+
+    }
+}

+ 430 - 0
SourceCode/VberTech/VberTech.Application/Common/CommonAppService.cs

@@ -0,0 +1,430 @@
+using System;
+using System.Collections.Generic;
+using System.Data.Entity;
+using System.Linq;
+using System.Threading.Tasks;
+using Abp.Application.Services;
+using Abp.Application.Services.Dto;
+using Abp.Auditing;
+using Abp.Dependency;
+using Abp.Domain.Repositories;
+using Abp.Extensions;
+using Abp.Json;
+using Abp.Net.Mail;
+using Abp.Net.Mail.Smtp;
+using Abp.Timing;
+using Abp.Web.Models;
+using IwbZero.AppServiceBase;
+using IwbZero.Session;
+using Microsoft.AspNet.SignalR;
+using Microsoft.AspNet.SignalR.Hubs;
+using VberTech.Authorization.Users;
+using VberTech.BaseBusiness;
+using VberTech.BaseSysInfo.Users;
+using VberTech.Common.Dto;
+using VberTech.Customers;
+using VberTech.Customers.Dto;
+using VberTech.EmailHelpers;
+using VberTech.Hubs;
+using VberTech.Lambda;
+using VberTech.PlanTaskTrack;
+using VberTech.PlanTaskTrack.Dto;
+using VberTech.Products;
+using VberTech.Products.Dto;
+using VberTech.StoreHouseInfos;
+
+namespace VberTech.Common
+{
+    [DisableAuditing]
+    public class CommonAppService : ApplicationService, ICommonAppService
+    {
+       
+        public CommonAppService(IRepository<Product, int> productRepository, IRepository<CustomerDefaultProduct, int> customerDefaultProductRepository, IRepository<CustomerSupplier, int> customerSupplierRepository, IRepository<CustomerSupplierPerson, int> customerSupplierPersonRepository, IRepository<CustomerSupplierAddress, int> customerSupplierAddressRepository, IRepository<StoreHouse, int> storeHouseRepository, IRepository<ViewCurrentStoreHouse, int> viewCurrentStoreHouseRepository, IRepository<PlanTask> planTaskRepository, JobTaskHelp jobTaskHelp, IRepository<SysUser, long> usersRepository, IRepository<CommonTag> commonTagRepository)//, ISmtpEmailSenderConfiguration smtpEmialSenderConfigtion
+        {
+            ProductRepository = productRepository;
+            CustomerDefaultProductRepository = customerDefaultProductRepository;
+            CustomerSupplierRepository = customerSupplierRepository;
+            CustomerSupplierPersonRepository = customerSupplierPersonRepository;
+            CustomerSupplierAddressRepository = customerSupplierAddressRepository;
+            StoreHouseRepository = storeHouseRepository;
+            ViewCurrentStoreHouseRepository = viewCurrentStoreHouseRepository;
+            PlanTaskRepository = planTaskRepository;
+            IwbHub = GlobalHost.ConnectionManager.GetHubContext<IwbHub>();
+            JobTaskHelp = jobTaskHelp;
+          
+            //_smtpEmialSenderConfig = smtpEmialSenderConfigtion;
+            UsersRepository = usersRepository;
+            CommonTagRepository = commonTagRepository;
+        }
+        public IRepository<Product, int> ProductRepository { get; }
+        public  IRepository<CustomerDefaultProduct,int> CustomerDefaultProductRepository { get; }
+        public  IRepository<CustomerSupplier,int> CustomerSupplierRepository { get; }
+        public IRepository<CustomerSupplierPerson, int> CustomerSupplierPersonRepository { get; }
+        public IRepository<CustomerSupplierAddress, int> CustomerSupplierAddressRepository { get; }
+        public IRepository<StoreHouse, int> StoreHouseRepository { get; }
+        public IRepository<ViewCurrentStoreHouse, int> ViewCurrentStoreHouseRepository { get; }
+        public IRepository<SysUser, long> UsersRepository { get; }
+        public IHubContext IwbHub { get; }
+        public JobTaskHelp JobTaskHelp { get; }
+        public IRepository<PlanTask> PlanTaskRepository { get; }
+
+        public IRepository<CommonTag> CommonTagRepository { get; }
+
+       // private readonly ISmtpEmailSenderConfiguration _smtpEmialSenderConfig;
+        public async Task<PagedResultDto<CustomerSupplierDto>> GetCustomer(PagedRequestDto input)
+        {
+            var query = CustomerSupplierRepository.GetAll().Where(i => i.Flag != 2);
+            query = ApplyFilter(query, input);
+            var totalCount = await query.CountAsync();
+            query = query.OrderBy(a => a.CustomerSupplierNo);
+            query = query.Skip(input.SkipCount).Take(input.MaxResultCount);
+            var entities = await query.ToListAsync();
+            var dtoList = new PagedResultDto<CustomerSupplierDto>(totalCount, ObjectMapper.Map<List<CustomerSupplierDto>>(entities));
+            return dtoList;
+        }
+        public async Task<PagedResultDto<CustomerSupplierDto>> GetSupplier(PagedRequestDto input)
+        {
+            var query = CustomerSupplierRepository.GetAll().Where(i => i.Flag != 1);
+            query = ApplyFilter(query, input);
+            var totalCount = await query.CountAsync();
+            query = query.OrderBy(a => a.CustomerSupplierNo);
+            query = query.Skip(input.SkipCount).Take(input.MaxResultCount);
+            var entities = await query.ToListAsync();
+            var dtoList = new PagedResultDto<CustomerSupplierDto>(totalCount, ObjectMapper.Map<List<CustomerSupplierDto>>(entities));
+            return dtoList;
+        }
+        
+        public async Task<PagedResultDto<ProductDto>> GetProductForCus(PagedRequestDto input)
+        {
+            int exCustomerId = 0;
+            var catalogNo = input.KeyWords;
+            var query = ProductRepository.GetAll().Where(a => string.IsNullOrEmpty(catalogNo) || (a.ProductCatalog.Path + ",").Contains(catalogNo + ","));
+            input.KeyWords = "";
+            if (input.SearchList != null && input.SearchList.Count > 0)
+            {
+                List<LambdaObject> objList = new List<LambdaObject>();
+                foreach (var o in input.SearchList)
+                {
+                    if (o.KeyWords.IsNullOrEmpty())
+                        continue;
+                    object keyWords = o.KeyWords;
+                    string fields = o.KeyField;
+                    if (fields.ToLower() == "customerid")
+                    {
+                        int.TryParse(keyWords.ToString(), out exCustomerId);
+                        continue;
+                        
+                    }
+                    //if (fields.ToLower() == "productcatalogid")
+                    //{
+                    //    query = query.Where(a => (a.ProductCatalog.Path + ",").Contains(o.KeyWords + ","));
+                    //    continue;
+                    //}
+                    objList.Add(new LambdaObject
+                    {
+                        FieldType = (LambdaFieldType)o.FieldType,
+                        FieldName = o.KeyField,
+                        FieldValue = keyWords,
+                        ExpType = (LambdaExpType)o.ExpType
+                    });
+                }
+                if (objList.Any())
+                {
+                    var exp = objList.GetExp<Product>();
+                    query = query.Where(exp);
+                }
+            }
+
+            var exProducts = await CustomerDefaultProductRepository.GetAllListAsync(i => i.CustomerId == exCustomerId);
+            List<int> exProductId = new List<int>();
+            if (exProducts.Any())
+            {
+                exProductId = exProducts.Select(i => i.ProductId).ToList();
+            }
+
+            if (exProductId.Any())
+            {
+                query = query.Where(i => !exProductId.Contains(i.Id));
+            }
+            //var entities = await query.ToListAsync();
+            //var totalCount = entities.Count();
+            //entities = entities.OrderBy(i => i.ProductNo).ToList();
+            //entities = entities.Skip(input.SkipCount).Take(input.MaxResultCount).ToList();
+            var totalCount = await query.CountAsync();
+            query = query.OrderBy(a => a.Id);
+            query = query.Skip(input.SkipCount).Take(input.MaxResultCount);
+            var entities = await query.ToListAsync();
+            var dtoList = new PagedResultDto<ProductDto>(totalCount, ObjectMapper.Map<List<ProductDto>>(entities));
+            return dtoList;
+        }
+
+        /// <summary>
+        /// 查询产品
+        /// </summary>
+        /// <param name="input"></param>
+        /// <returns></returns>
+        public async Task<PagedResultDto<ProductDto>> GetProduct(PagedRequestDto input)
+        {
+            var catalogNo = input.KeyWords;
+            var query = ProductRepository.GetAll().Where(a => string.IsNullOrEmpty(catalogNo) || (a.ProductCatalog.Path + ",").Contains(catalogNo + ","));
+            input.KeyWords = "";
+            query = ApplyFilter(query, input);
+            var totalCount = await query.CountAsync();
+            query = query.OrderBy(a => a.Id);
+            query = query.Skip(input.SkipCount).Take(input.MaxResultCount);
+            var entities =await query.ToListAsync();
+            var dtoList = new PagedResultDto<ProductDto>(totalCount, ObjectMapper.Map<List<ProductDto>>(entities));
+            return dtoList;
+        }
+
+        public async Task<List<StoreHouse>> GetStoreHouse(int type)
+        {
+            return type == 0
+                ? await StoreHouseRepository.GetAllListAsync()
+                : await StoreHouseRepository.GetAllListAsync(i => i.StoreHouseType == type);
+        }
+
+        public async Task<ViewCurrentStoreHouse> GetStoreByProId(int productId,int storeHouseId)
+        {
+            return await ViewCurrentStoreHouseRepository.FirstOrDefaultAsync(i =>
+                i.Id == productId && i.StoreHouseId == storeHouseId);
+        }
+        private IQueryable<T> ApplyFilter<T>(IQueryable<T> query, PagedRequestDto input)
+        {
+            if (!input.KeyWords.IsNullOrEmpty())
+            {
+                object keyWords = input.KeyWords;
+                LambdaObject obj = new LambdaObject()
+                {
+                    FieldType = (LambdaFieldType)input.FieldType,
+                    FieldName = input.KeyField,
+                    FieldValue = keyWords,
+                    ExpType = (LambdaExpType)input.ExpType
+                };
+                var exp = obj.GetExp<T>();
+                query = query.Where(exp);
+            }
+            if (input.SearchList != null && input.SearchList.Count > 0)
+            {
+                List<LambdaObject> objList = new List<LambdaObject>();
+                foreach (var o in input.SearchList)
+                {
+                    if (o.KeyWords.IsNullOrEmpty())
+                        continue;
+                    object keyWords = o.KeyWords;
+                    objList.Add(new LambdaObject
+                    {
+                        FieldType = (LambdaFieldType)o.FieldType,
+                        FieldName = o.KeyField,
+                        FieldValue = keyWords,
+                        ExpType = (LambdaExpType)o.ExpType
+                    });
+                }
+                if (objList.Any())
+                {
+                    var exp = objList.GetExp<T>();
+                    query = query.Where(exp);
+                }
+            }
+            return query;
+        }
+
+
+
+        public async Task<CustomerSupplierPersonDto> GetCustomerPersonById(int id)
+        {
+            var entity = await CustomerSupplierPersonRepository.GetAsync(id);
+            return ObjectMapper.Map<CustomerSupplierPersonDto>(entity);
+        }
+
+        public async Task<CustomerSupplierAddressDto> GetCustomerAddressById(int id)
+        {
+            var entity = await CustomerSupplierAddressRepository.GetAsync(id);
+            return ObjectMapper.Map<CustomerSupplierAddressDto>(entity);
+        }
+        //public async Task<List<CustomerSupplierPersonDto>> GetCustomerPersonByCid(int customerId)
+        //{
+        //    var entity = await CustomerSupplierPersonRepository.GetAllListAsync(i => i.CustomerSupplierId == customerId);
+        //    return ObjectMapper.Map<List<CustomerSupplierPersonDto>>(entity);
+        //}
+
+        //public async Task<List<CustomerSupplierAddressDto>> GetCustomerAddressByCid(int customerId)
+        //{
+        //    var entity = await CustomerSupplierAddressRepository.GetAllListAsync(i => i.CustomerSupplierId == customerId);
+        //    return ObjectMapper.Map<List<CustomerSupplierAddressDto>>(entity);
+        //}
+        public async Task<CustomerPersonAndAddressDto> GetPersonAddressByCustomerId(int customerId)
+        {
+            var entity = await CustomerSupplierRepository.FirstOrDefaultAsync(i => i.Id == customerId);
+            if (entity == null)
+            {
+                return null;
+            }
+            var entityPersons = await CustomerSupplierPersonRepository.GetAllListAsync(i => i.CustomerSupplierId == entity.Id);
+            var entityAddress = await CustomerSupplierAddressRepository.GetAllListAsync(i => i.CustomerSupplierId == entity.Id);
+            CustomerPersonAndAddressDto loEntity = new CustomerPersonAndAddressDto()
+            {
+                CustomerSupplierAddress = ObjectMapper.Map<List<CustomerSupplierAddressDto>>(entityAddress),
+                CustomerSupplierPersons = ObjectMapper.Map<List<CustomerSupplierPersonDto>>(entityPersons)
+            };
+            return loEntity;
+        }
+        public async Task<CustomerPersonAndAddressDto> GetPersonAddressByCid(string customerNo)
+        {
+            var entity =await CustomerSupplierRepository.FirstOrDefaultAsync(i => i.CustomerSupplierNo == customerNo);
+            if (entity == null)
+            {
+                return null;
+            }
+            var entityPersons = await CustomerSupplierPersonRepository.GetAllListAsync(i => i.CustomerSupplierId == entity.Id);
+            var entityAddress = await CustomerSupplierAddressRepository.GetAllListAsync(i => i.CustomerSupplierId == entity.Id);
+            CustomerPersonAndAddressDto loEntity = new CustomerPersonAndAddressDto()
+            {
+                CustomerSupplierAddress = ObjectMapper.Map<List<CustomerSupplierAddressDto>>(entityAddress),
+                CustomerSupplierPersons = ObjectMapper.Map<List<CustomerSupplierPersonDto>>(entityPersons)
+            };
+            return loEntity;
+        }
+
+        public async Task<OrderItemProductDto> GetOrderItemProductByNo(CusProIdDto input)
+        {
+            var entity =await ProductRepository.FirstOrDefaultAsync(i => i.ProductNo == input.ProductNo);
+
+            //return ObjectMapper.Map<ProductDto>(entity) ;
+            CustomerDefaultProduct cp = await CustomerDefaultProductRepository.FirstOrDefaultAsync(i =>
+                i.ProductId == entity.Id && i.CustomerId == input.CustomerId);
+            OrderItemProductDto loResult = new OrderItemProductDto()
+            {
+                CustomerDefaultProduct = ObjectMapper.Map<CustomerDefaultProductDto>(cp),
+                Product = ObjectMapper.Map<ProductDto>(entity)
+            };
+            return loResult;
+        }
+        /// <summary>
+        /// 系统启动时加载需要提醒的安排计划
+        /// </summary>
+        /// <returns></returns>
+        public async Task StartPlanTasksRemind()
+        {
+            var ps = await GetPlanTaskRemind();
+            foreach (var planTask in ps)
+            {
+                StartPlanTaskRemind(planTask);
+            }
+        }
+        /// <summary>
+        /// 启动单个安排计划
+        /// </summary>
+        /// <param name="planTask"></param>
+        public void StartPlanTaskRemind(PlanTask planTask)
+        {
+            var rt = planTask.RemindTime?.ToString("ss mm HH dd MM ? yyyy");
+            IDictionary<string,object> dic = new Dictionary<string, object>();
+            dic.Add("PlanTask", planTask.ToJsonString());
+            JobTaskHelp.StopJob("pt" + planTask.PlanTaskNum, "pt" + planTask.PlanTaskNum + "-G");
+            JobTaskHelp.StartJob<RemindJob>("pt" + planTask.PlanTaskNum, "pt" + planTask.PlanTaskNum + "-G", rt, dic);
+        }
+        public async Task<List<PlanTask>> GetPlanTaskRemind()
+        {
+            
+            var entities = PlanTaskRepository.GetAll().Where(i => i.RemindTime != null && i.RemindTime > Clock.Now);
+            return await entities.ToListAsync();
+        }
+        /// <summary>
+        /// 执行计安排的消息通知
+        /// </summary>
+        /// <param name="input"></param>
+        public void ExcuteRemind(PlanTask input)
+        {
+            string result = input.ToJsonString();
+            IwbHub.Clients.All.getPlanTaskShortMsg(result);//推送消息到页面
+            var creatorUser = UsersRepository.Get(input.CreatorUserId ?? 0);
+            var email = creatorUser.EmailAddress;
+            //var email = AbpSession.GetClaimValue(IwbClaimTypes.EmailAddress);
+            if (input.RemindType != DefineConsts.PlanTaskRemindTypeSystem&&input.RemindType != DefineConsts.PlanTaskRemindTypeSms)
+            {
+                //发送邮件
+                Action ac = () =>
+                {
+                    EmailSendHelper.SendEmail(email, "待办计划提醒",
+                        input.TaskSubject + "[" + input.TaskContent + "],即将开始!");
+                };
+                ac.BeginInvoke(null, null);
+            }
+            if (input.RemindType != DefineConsts.PlanTaskRemindTypeSystem && input.RemindType != DefineConsts.PlanTaskRemindTypeEmail)
+            {
+                //发送短信
+            }
+        }
+
+       
+        public List<CustomerDefaultProductDto> GetCusDefProByCid(int customerId)
+        {
+            var cps =  CustomerDefaultProductRepository.GetAll().Where(i =>i.CustomerId == customerId);
+            cps = cps.OrderByDescending(i=>i.Sequence);
+            return ObjectMapper.Map<List<CustomerDefaultProductDto>>(cps.ToList());
+        }
+        /// <summary>
+        /// 添加标签
+        /// </summary>
+        /// <param name="input"></param>
+        public KeyValueSelectInputDto InsertTags(KeyValueSelectInputDto input)
+        {
+            var va = input.Text;
+            var t = input.AddType;
+            KeyValueSelectInputDto dto = new KeyValueSelectInputDto();
+            if (!string.IsNullOrEmpty(va) && !string.IsNullOrEmpty(t))
+            {
+                CommonTag entity = new CommonTag()
+                {
+                    TagName = va,
+                    TagType = t
+                };
+               var preEntity = CommonTagRepository.FirstOrDefault(i =>
+                    i.TagName == va && i.TagType == t && i.CreatorUserId == AbpSession.UserId);
+               if (preEntity != null)
+               {
+                   dto.Value = preEntity.Id;
+                   dto.Text = va;
+                   dto.AddType = t;
+                   return dto;
+               }
+               var reTagId = CommonTagRepository.InsertAndGetId(entity);
+               dto.Value = reTagId;
+               dto.Text = va;
+               dto.AddType = t;
+            }
+            return dto;
+        }
+        /// <summary>
+        /// 查询标签
+        /// </summary>
+        /// <param name="addType"></param>
+        /// <param name="creatorUserId"></param>
+        /// <returns></returns>
+        [DontWrapResult]
+        public async Task<List<KeyValueSelectInputDto>> GetTagsToKeyValueInput(string addType="1",long creatorUserId=0)
+        {
+            //addType = string.IsNullOrEmpty(addType) ? "1" : addType;
+            var query =  CommonTagRepository.GetAll().Where(i => i.TagType == addType);
+            if (creatorUserId > 0)
+            {
+                query = query.Where(i => i.CreatorUserId == creatorUserId);
+            }
+
+            var entities = await query.ToListAsync();
+            List<KeyValueSelectInputDto> inputDtos = new List<KeyValueSelectInputDto>();
+            entities.ForEach((v) =>
+            {
+                KeyValueSelectInputDto kv = new KeyValueSelectInputDto()
+                {
+                    Text = v.TagName,
+                    Value = v.Id,
+                    AddType = v.TagType
+                };
+                inputDtos.Add(kv);
+            });
+            return inputDtos;
+        }
+    }
+}

+ 49 - 0
SourceCode/VberTech/VberTech.Application/Common/Dto/CommonDto.cs

@@ -0,0 +1,49 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using VberTech.Customers;
+using VberTech.Customers.Dto;
+using VberTech.Products.Dto;
+
+namespace VberTech.Common.Dto
+{
+    public class CustomerPersonAndAddressDto
+    {
+        public List<CustomerSupplierPersonDto> CustomerSupplierPersons { get; set; }
+        public List<CustomerSupplierAddressDto> CustomerSupplierAddress { get; set; }
+    }
+
+    public class CusProIdDto
+    {
+        public string ProductNo { get; set; }
+
+        public int CustomerId { get; set; }
+    }
+    public class OrderItemProductDto
+    {
+        //productNo","编号",false),
+        //new QueryItem("productName","名称",true),
+        //new QueryItem("model","型号规格",true),
+        //new QueryItem("material","材质",true),
+        //new QueryItem("productCatalogName","目录",false),
+        //new QueryItem("useScope","使用范围",false),
+        //new QueryItem("lowestPrice","最低单价",false),
+        //new QueryItem("unit","单位",false),
+        public ProductDto Product { get; set; }
+        public CustomerDefaultProductDto CustomerDefaultProduct { get; set; }
+    }
+
+    public class KeyValueSelectInputDto
+    {
+        public object Value { get; set; }
+
+        public string Text  { get; set; }
+
+        public string AddType { get; set; }
+
+    }
+
+ 
+}

+ 57 - 0
SourceCode/VberTech/VberTech.Application/Common/ICommonAppService.cs

@@ -0,0 +1,57 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Abp.Application.Services;
+using Abp.Application.Services.Dto;
+using Abp.Web.Models;
+using IwbZero.AppServiceBase;
+using VberTech.BaseBusiness;
+using VberTech.Common.Dto;
+using VberTech.Customers.Dto;
+using VberTech.PlanTaskTrack;
+using VberTech.Products;
+using VberTech.Products.Dto;
+using VberTech.StoreHouseInfos;
+
+namespace VberTech.Common
+{
+    public interface ICommonAppService : IApplicationService
+    {
+        
+        Task<PagedResultDto<ProductDto>> GetProductForCus(PagedRequestDto input);
+        Task<PagedResultDto<CustomerSupplierDto>> GetCustomer(PagedRequestDto input);
+        Task<PagedResultDto<CustomerSupplierDto>> GetSupplier (PagedRequestDto input);
+        Task<PagedResultDto<ProductDto>> GetProduct(PagedRequestDto input);
+
+        Task<List<StoreHouse>> GetStoreHouse(int type=0);
+
+        Task<ViewCurrentStoreHouse> GetStoreByProId(int productId,int storeHouseId);
+
+
+
+
+        Task<CustomerSupplierPersonDto> GetCustomerPersonById(int id);
+        Task<CustomerSupplierAddressDto> GetCustomerAddressById(int id);
+        //Task<List<CustomerSupplierPersonDto>> GetCustomerPersonByCid(int customerId);
+        //Task<List<CustomerSupplierAddressDto>> GetCustomerAddressByCid(int customerId);
+
+        List<CustomerDefaultProductDto> GetCusDefProByCid(int customerId);
+        Task<CustomerPersonAndAddressDto> GetPersonAddressByCustomerId(int customerId);
+        Task<CustomerPersonAndAddressDto> GetPersonAddressByCid(string customerNo);
+        Task<OrderItemProductDto> GetOrderItemProductByNo(CusProIdDto input);
+
+
+        Task<List<PlanTask>> GetPlanTaskRemind();
+        void ExcuteRemind(PlanTask input);
+        Task StartPlanTasksRemind();
+        void StartPlanTaskRemind(PlanTask planTask);
+        [DontWrapResult]
+        KeyValueSelectInputDto InsertTags(KeyValueSelectInputDto input);
+        [DontWrapResult]
+        Task<List<KeyValueSelectInputDto>> GetTagsToKeyValueInput(string addType = "1",long creatorUserId = 0);
+
+
+    }
+}

+ 84 - 0
SourceCode/VberTech/VberTech.Application/Common/PlanTaskRemindService.cs

@@ -0,0 +1,84 @@
+using Abp.Dependency;
+using Microsoft.AspNet.SignalR;
+using System;
+using System.Collections.Generic;
+using System.Data.Entity;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Abp.Domain.Repositories;
+using Abp.Json;
+using Abp.Net.Mail;
+using Abp.Timing;
+using Newtonsoft.Json;
+using VberTech.Hubs;
+using VberTech.PlanTaskTrack;
+
+namespace VberTech.Common
+{
+    public class PlanTaskRemindService: ITransientDependency
+    {
+        public IHubContext IwbHub { get; }
+        public JobTaskHelp JobTaskHelp { get; }
+        public IRepository<PlanTask> PlanTaskRepository { get; }
+
+        public IEmailSender _emailSender;
+
+        public PlanTaskRemindService(IEmailSender emailSender, JobTaskHelp jobTaskHelp, IRepository<PlanTask> planTaskRepository)
+        {
+            IwbHub = GlobalHost.ConnectionManager.GetHubContext<IwbHub>();
+            _emailSender = emailSender;
+            JobTaskHelp = jobTaskHelp;
+            PlanTaskRepository = planTaskRepository;
+        }
+        /// <summary>
+        /// 系统启动时加载需要提醒的安排计划
+        /// </summary>
+        /// <returns></returns>
+        public  void StartPlanTasksRemind()
+        {
+            var ps = GetPlanTaskRemind();
+            foreach (var planTask in ps)
+            {
+                StartPlanTaskRemind(planTask);
+            }
+        }
+        /// <summary>
+        /// 启动单个安排计划
+        /// </summary>
+        /// <param name="planTask"></param>
+        public void StartPlanTaskRemind(PlanTask planTask)
+        {
+            var rt = planTask.RemindTime?.ToString("ss mm HH dd MM ? yyyy");
+            IDictionary<string, object> dic = new Dictionary<string, object>();
+            dic.Add("PlanTask", JsonConvert.SerializeObject(planTask));
+            JobTaskHelp.StopJob("pt" + planTask.PlanTaskNum, "pt" + planTask.PlanTaskNum + "-G");
+            JobTaskHelp.StartJob<RemindJob>("pt" + planTask.PlanTaskNum, "pt" + planTask.PlanTaskNum + "-G", rt, dic);
+        }
+        public  List<PlanTask> GetPlanTaskRemind()
+        {
+            var entities = PlanTaskRepository.GetAllIncluding(i=>i.CreatorUser,i=>i.LastModifierUser,i=>i.DeleterUser).ToList();
+            return entities;
+        }
+        /// <summary>
+        /// 执行计安排的消息通知
+        /// </summary>
+        /// <param name="input"></param>
+        public void ExcuteRemind(PlanTask input)
+        {
+            string result = input.ToJsonString();
+            IwbHub.Clients.All.getPlanTaskShortMsg(result);//推送消息到页面
+            var email = input.CreatorUser.EmailAddress;
+            //var email = AbpSession.GetClaimValue(IwbClaimTypes.EmailAddress);
+            if (input.RemindType != DefineConsts.PlanTaskRemindTypeSystem && input.RemindType != DefineConsts.PlanTaskRemindTypeSms)
+            {
+                //发送短信
+            }
+            if (input.RemindType != DefineConsts.PlanTaskRemindTypeSystem && input.RemindType != DefineConsts.PlanTaskRemindTypeEmail)
+            {
+                //发送邮件
+                _emailSender.Send(email, "待办计划提醒", input.TaskSubject + "[" + input.TaskContent + "],即将开始!", true);
+            }
+        }
+    }
+}

+ 53 - 0
SourceCode/VberTech/VberTech.Application/Common/RemindJob.cs

@@ -0,0 +1,53 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Security.Cryptography.X509Certificates;
+using System.Text;
+using System.Threading.Tasks;
+using Abp.Dependency;
+using Abp.Net.Mail;
+using Abp.Quartz;
+using Abp.Runtime.Session;
+using IwbZero.Session;
+using Microsoft.AspNet.SignalR;
+using Newtonsoft.Json;
+using Quartz;
+using VberTech.EmailHelpers;
+using VberTech.Hubs;
+using VberTech.PlanTaskTrack;
+
+namespace VberTech.Common
+{
+    public class RemindJob : JobBase, ITransientDependency
+    {
+        public IHubContext IwbHub { get; }
+
+       
+        public RemindJob(IEmailSender emailSender)
+        {
+            IwbHub = GlobalHost.ConnectionManager.GetHubContext<IwbHub>();
+          
+        }
+        public override  Task Execute(IJobExecutionContext context)
+        {
+            var dataMap =  context.JobDetail.JobDataMap;
+            var pl = dataMap.GetString("PlanTask");
+            var entity = JsonConvert.DeserializeObject<PlanTask>(pl);
+            IwbHub.Clients.All.getPlanTaskShortMsg(pl);//推送消息到页面
+            var email = entity.CreatorUser.EmailAddress;
+            if (entity.RemindType != DefineConsts.PlanTaskRemindTypeSystem&&entity.RemindType != DefineConsts.PlanTaskRemindTypeSms)
+            {
+                //发送邮件
+                //EmailSender.Send(email, "待办计划提醒", entity.TaskSubject + "[" + entity.TaskContent + "],即将开始!", true);
+                EmailSendHelper.SendEmail(email, "待办计划提醒",
+                    entity.TaskSubject + "[" + entity.TaskContent + "],即将开始!");
+            }
+            if (entity.RemindType != DefineConsts.PlanTaskRemindTypeSystem&&entity.RemindType != DefineConsts.PlanTaskRemindTypeEmail)
+            {
+                //发送短信
+                
+            }
+            return Task.CompletedTask;
+        }
+    }
+}

+ 32 - 0
SourceCode/VberTech/VberTech.Application/Customers/Address/Dto/CustomerSupplierAddressCreateDto.cs

@@ -0,0 +1,32 @@
+using System;
+using Abp.AutoMapper;
+using System.ComponentModel.DataAnnotations;
+
+namespace VberTech.Customers.Dto
+{
+    [AutoMapTo(typeof(CustomerSupplierAddress))]
+    public class CustomerSupplierAddressCreateDto
+    {
+        /// <summary>
+        /// 客户
+        /// </summary>   
+		public int CustomerSupplierId  { get; set; }
+		public VberTech.Customers.CustomerSupplier CustomerSupplier  { get; set; }
+        /// <summary>
+        /// 地址详情
+        /// </summary>   
+        [StringLength(CustomerSupplierAddress.AddressDetailMaxLength)]
+		public string AddressDetail  { get; set; }
+        /// <summary>
+        /// 联系人
+        /// </summary>   
+        [StringLength(CustomerSupplierAddress.LinkManMaxLength)]
+		public string LinkMan  { get; set; }
+        /// <summary>
+        /// 联系电话
+        /// </summary>   
+        [StringLength(CustomerSupplierAddress.LinkTelMaxLength)]
+		public string LinkTel  { get; set; }
+		public bool IsDefault  { get; set; }
+    }
+}

+ 29 - 0
SourceCode/VberTech/VberTech.Application/Customers/Address/Dto/CustomerSupplierAddressDto.cs

@@ -0,0 +1,29 @@
+using System;
+using Abp.AutoMapper;
+using Abp.Application.Services.Dto;
+
+namespace VberTech.Customers.Dto
+{
+    [AutoMapTo(typeof(CustomerSupplierAddress)),AutoMapFrom(typeof(CustomerSupplierAddress))]
+    public class CustomerSupplierAddressDto: EntityDto<int>
+    {
+        /// <summary>
+        /// 客户
+        /// </summary>   
+		public int CustomerSupplierId  { get; set; }
+	
+        /// <summary>
+        /// 地址详情
+        /// </summary>   
+		public string AddressDetail  { get; set; }
+        /// <summary>
+        /// 联系人
+        /// </summary>   
+		public string LinkMan  { get; set; }
+        /// <summary>
+        /// 联系电话
+        /// </summary>   
+		public string LinkTel  { get; set; }
+		public bool IsDefault  { get; set; }
+    }
+}

+ 37 - 0
SourceCode/VberTech/VberTech.Application/Customers/Address/Dto/CustomerSupplierAddressUpdateDto.cs

@@ -0,0 +1,37 @@
+using System;
+using Abp.AutoMapper;
+using Abp.Application.Services.Dto;
+using System.ComponentModel.DataAnnotations;
+
+namespace VberTech.Customers.Dto
+{
+    [AutoMapTo(typeof(CustomerSupplierAddress))]
+    public class CustomerSupplierAddressUpdateDto: EntityDto<int>
+    {
+        
+        /// <summary>
+        /// 客户
+        /// </summary>   
+		public int CustomerSupplierId  { get; set; }
+		public VberTech.Customers.CustomerSupplier CustomerSupplier  { get; set; }
+        
+        /// <summary>
+        /// 地址详情
+        /// </summary>   
+        [StringLength(CustomerSupplierAddress.AddressDetailMaxLength)]
+		public string AddressDetail  { get; set; }
+        
+        /// <summary>
+        /// 联系人
+        /// </summary>   
+        [StringLength(CustomerSupplierAddress.LinkManMaxLength)]
+		public string LinkMan  { get; set; }
+        
+        /// <summary>
+        /// 联系电话
+        /// </summary>   
+        [StringLength(CustomerSupplierAddress.LinkTelMaxLength)]
+		public string LinkTel  { get; set; }
+		public bool IsDefault  { get; set; }
+    }
+}

+ 355 - 0
SourceCode/VberTech/VberTech.Application/Customers/CustomerSuppliersApplicationService.cs

@@ -0,0 +1,355 @@
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+using System.Web.Mvc;
+using Abp.Application.Services.Dto;
+using Abp.Auditing;
+using Abp.Authorization;
+using Abp.Domain.Repositories;
+using Abp.Extensions;
+using Abp.Runtime.Caching;
+using AutoMapper;
+using IwbZero.Auditing;
+using IwbZero.AppServiceBase;
+using IwbZero.IdentityFramework;
+using IwbZero.Setting;
+using VberTech.Authorization.Permissions;
+using VberTech.BaseSysInfo;
+using VberTech.Lambda;
+using VberTech.Customers.Dto;
+namespace VberTech.Customers
+{
+    [AbpAuthorize]
+    public class CustomerSupplierAppService : VberTechAsyncCrudAppService<CustomerSupplier, CustomerSupplierDto, int, PagedRequestDto, CustomerSupplierCreateDto, CustomerSupplierUpdateDto>, ICustomerSupplierAppService
+    {
+        public IRepository<CustomerSupplierType> CustomerSupplierTypeRepository { get; }
+
+        public IRepository<CustomerSupplierAddress> CustomerSupplierAddressRepository { get; }
+        public IRepository<CustomerSupplierPerson> CustomerSupplierPersonRepository { get; }
+
+        public IRepository<CustomerDefaultProduct> CustomerDefaultProductRepository { get; }
+
+        public CustomerSupplierAppService(
+			IIwbSettingManager settingManager, 
+			ICacheManager cacheManager,
+			IRepository<CustomerSupplier, int> repository, IRepository<CustomerSupplierType> customerSupplierTypeRepository, IRepository<CustomerSupplierAddress> customerSupplierAddressRepository, IRepository<CustomerDefaultProduct> customerDefaultProductRepository, IRepository<CustomerSupplierPerson> customerSupplierPersonRepository) : base(repository, "CustomerSupplierNo")
+        {
+            CustomerSupplierTypeRepository = customerSupplierTypeRepository;
+            CustomerSupplierAddressRepository = customerSupplierAddressRepository;
+            CustomerDefaultProductRepository = customerDefaultProductRepository;
+            CustomerSupplierPersonRepository = customerSupplierPersonRepository;
+            SettingManager = settingManager;
+            CacheManager = cacheManager;
+        }
+
+        protected override bool KeyIsAuto { get; set; } = false;
+
+        #region GetSelect
+        [DisableAuditing]
+        public async Task<string> GetTypeSelectStr()
+        {
+            var list = await CustomerSupplierTypeRepository.GetAllListAsync(a => a.ParentNo != "root");
+            string str = "<option value=\"0\" disabled selected>请选择...</option>";
+            foreach (var l in list)
+            {
+                str += $"<option value=\"{l.TypeNo}\" parent=\"{l.ParentNo}\" data-id=\"{l.Id}\">{l.TypeName}</option>";
+            }
+            return str;
+        }
+
+        [DisableAuditing]
+        public async Task<List<SelectListItem>> GetSelectList()
+        {
+            var list = await Repository.GetAllListAsync();
+            var slist = new List<SelectListItem> {new SelectListItem {Text = @"请选择...", Value = "", Selected = true}};
+            foreach (var l in list)
+            {
+                //slist.Add(new SelectListItem { Text = l., Value = l. });
+            }
+            return slist;
+        }
+        [DisableAuditing]
+        public async Task<string> GetSelectStr()
+        {
+            var list = await Repository.GetAllListAsync();
+            string str = "<option value=\"\" selected>请选择...</option>";
+            foreach (var l in list)
+            {
+                //str += $"<option value=\"{l.}\">{l.}</option>";
+            }
+            return str;
+        }
+        [DisableAuditing]
+        public async Task<List<TreeDto>> GetTypeTree()
+        {
+            var list = (await CustomerSupplierTypeRepository.GetAllListAsync(a => a.ParentNo != "root"));
+            return GetChildTypes(list, "0");
+        }
+
+        private List<TreeDto> GetChildTypes(List<CustomerSupplierType> list, string parentNo)
+        {
+            var dtoList = new List<TreeDto>();
+            var parents = list.Where(a => a.ParentNo == parentNo).ToList();
+            if (!parents.Any())
+            {
+                return null;
+            }
+            foreach (var item in parents)
+            {
+                var dto = new TreeDto
+                {
+                    Id = item.Id + "",
+                    Text = item.TypeName,
+                    Nodes = GetChildTypes(list, item.TypeNo)
+                };
+                dtoList.Add(dto);
+            }
+            return dtoList;
+        }
+        #endregion
+
+        #region CURD
+
+        [AbpAuthorize(PermissionNames.PagesCustomerSupplierCustomerSupplierMgCreate)]
+        public override async Task<CustomerSupplierDto> Create(CustomerSupplierCreateDto input)
+        {
+            return await CreateEntity(input);
+        }
+
+        [AbpAuthorize(PermissionNames.PagesCustomerSupplierCustomerSupplierMgUpdate)]
+        public override async Task<CustomerSupplierDto> Update(CustomerSupplierUpdateDto input)
+        {
+            return await UpdateEntity(input);
+        }
+
+        [AbpAuthorize(PermissionNames.PagesCustomerSupplierCustomerSupplierMgDelete)]
+        public override Task Delete(EntityDto<int> input)
+        {
+            return Repository.DeleteAsync(input.Id);
+        }
+
+        [DisableAuditing]
+        [AbpAuthorize(PermissionNames.PagesCustomerSupplier)]
+        public override async Task<PagedResultDto<CustomerSupplierDto>> GetAll(PagedRequestDto input)
+        {
+            var query = CreateFilteredQuery(input);
+            query = ApplyFilter(query, input);
+            var totalCount = await AsyncQueryableExecuter.CountAsync(query);
+            query = ApplySorting(query, input);
+            query = ApplyPaging(query, input);
+            var entities = await AsyncQueryableExecuter.ToListAsync(query);
+            var dtoList = new PagedResultDto<CustomerSupplierDto>(totalCount, entities.Select(MapToEntityDto).ToList());
+            return dtoList;
+        }
+
+		#region Get
+
+		[DisableAuditing]
+        [AbpAuthorize(PermissionNames.PagesCustomerSupplier)]
+        public override Task<CustomerSupplier> GetEntityById(int id)
+        {
+            return Repository.FirstOrDefaultAsync(id);
+        }
+
+        [DisableAuditing]
+        [AbpAuthorize(PermissionNames.PagesCustomerSupplier)]
+        public override Task<CustomerSupplier> GetEntityByNo(string no)
+        {
+            if (KeyFiledName.IsNullOrEmpty())
+            {
+                CheckErrors(IwbIdentityResult.Failed("编码/编号字段不明确,请检查后再操作!"));
+            }
+            LambdaObject obj = new LambdaObject()
+            {
+                FieldType = LambdaFieldType.S,
+                FieldName = KeyFiledName,
+                FieldValue = no,
+                ExpType = LambdaExpType.Equal
+            };
+            var exp = obj.GetExp<CustomerSupplier>();
+            return Repository.FirstOrDefaultAsync(exp);
+        }
+
+		[DisableAuditing]
+        [AbpAuthorize(PermissionNames.PagesCustomerSupplier)]
+        public override async Task<CustomerSupplierDto> GetDtoById(int id)
+        {
+            var entity = await GetEntityById(id);
+            return MapToEntityDto(entity);
+        }
+		[DisableAuditing]
+        [AbpAuthorize(PermissionNames.PagesCustomerSupplier)]
+        public override async Task<CustomerSupplierDto> GetDtoByNo(string no)
+        {
+            var entity = await GetEntityByNo(no);
+            return MapToEntityDto(entity);
+        }
+
+        #endregion
+
+        #region Hide
+
+        //protected override IQueryable<CustomerSupplier> ApplyFilter(IQueryable<CustomerSupplier> query, TGetAllInput input)
+        //{
+        //    if (!input.KeyWords.IsNullOrEmpty())
+        //    {
+        //        object keyWords = input.KeyWords;
+        //        LambdaObject obj = new LambdaObject()
+        //        {
+        //            FieldType = (LambdaFieldType)input.FieldType,
+        //            FieldName = input.KeyField,
+        //            FieldValue = keyWords,
+        //            ExpType = (LambdaExpType)input.ExpType
+        //        };
+        //        var exp = obj.GetExp<CustomerSupplier>();
+        //        query = query.Where(exp);
+        //    }
+        //    if (input.SearchList != null && input.SearchList.Count > 0)
+        //    {
+        //        List<LambdaObject> objList = new List<LambdaObject>();
+        //        foreach (var o in input.SearchList)
+        //        {
+        //            if (o.KeyWords.IsNullOrEmpty())
+        //                continue;
+        //            object keyWords = o.KeyWords;
+        //            objList.Add(new LambdaObject
+        //            {
+        //                FieldType = (LambdaFieldType)o.FieldType,
+        //                FieldName = o.KeyField,
+        //                FieldValue = keyWords,
+        //                ExpType = (LambdaExpType)o.ExpType
+        //            });
+        //        }
+        //        var exp = objList.GetExp<CustomerSupplier>();
+        //        query = query.Where(exp);
+        //    }
+        //    return query;
+        //}
+
+        //protected override IQueryable<CustomerSupplier> ApplySorting(IQueryable<CustomerSupplier> query, PagedRequestDto input)
+        //{
+        //    return query.OrderBy(a => a.No);
+        //}
+
+        //protected override IQueryable<CustomerSupplier> ApplyPaging(IQueryable<CustomerSupplier> query, PagedRequestDto input)
+        //{
+        //    if (input is IPagedResultRequest pagedInput)
+        //    {
+        //        return query.Skip(pagedInput.SkipCount).Take(pagedInput.MaxResultCount);
+        //    }
+        //    return query;
+        //}
+
+        #endregion
+
+        #endregion
+
+
+        #region Address
+        [AbpAuthorize(PermissionNames.PagesCustomerSupplierCustomerSupplierAddressMg)]
+        public async Task<List<CustomerSupplierAddressDto>> GetAllAddress(PagedRequestDto input)
+        {
+            var query = CustomerSupplierAddressRepository.GetAll();
+            query = ApplyFilterEx<CustomerSupplierAddress>(query, input);
+            query = ApplySortingEx<CustomerSupplierAddress>(query, input);
+            var entities = await AsyncQueryableExecuter.ToListAsync(query);
+            var dtoList = ObjectMapper.Map<List<CustomerSupplierAddressDto>>(entities);
+            return dtoList;
+        }
+        [AbpAuthorize(PermissionNames.PagesCustomerSupplierCustomerSupplierAddressMgCreateAddress)]
+        public  async Task<CustomerSupplierAddress> CreateAddress(CustomerSupplierAddressCreateDto input)
+        {
+            CustomerSupplierAddress entity = ObjectMapper.Map<CustomerSupplierAddress>(input);
+            return await CustomerSupplierAddressRepository.InsertAsync(entity);
+        }
+
+        [AbpAuthorize(PermissionNames.PagesCustomerSupplierCustomerSupplierAddressMgUpdateAddress)]
+        public  async Task<CustomerSupplierAddress> UpdateAddress(CustomerSupplierAddressUpdateDto input)
+        {
+            CustomerSupplierAddress entity = ObjectMapper.Map<CustomerSupplierAddress>(input);
+
+            return await CustomerSupplierAddressRepository.UpdateAsync(entity);
+        }
+
+        [AbpAuthorize(PermissionNames.PagesCustomerSupplierCustomerSupplierAddressMgDeleteAddress)]
+        public  Task DeleteAddress(EntityDto<int> input)
+        {
+            return CustomerSupplierAddressRepository.DeleteAsync(input.Id);
+        }
+
+
+        #endregion
+
+        #region Person
+        [AbpAuthorize(PermissionNames.PagesCustomerSupplierCustomerSupplierPersonMg)]
+        public async Task<List<CustomerSupplierPersonDto>> GetAllPerson(PagedRequestDto input)
+        {
+            var query = CustomerSupplierPersonRepository.GetAll();
+            query = ApplyFilterEx(query, input);
+            query = ApplySortingEx(query, input);
+            var entities = await AsyncQueryableExecuter.ToListAsync(query);
+            var dtoList = ObjectMapper.Map<List<CustomerSupplierPersonDto>>(entities);
+            return dtoList;
+        }
+        [AbpAuthorize(PermissionNames.PagesCustomerSupplierCustomerSupplierPersonMgCreatePerson)]
+        public async Task<CustomerSupplierPerson> CreatePerson(CustomerSupplierPersonCreateDto input)
+        {
+            CustomerSupplierPerson entity = ObjectMapper.Map<CustomerSupplierPerson>(input);
+            return await CustomerSupplierPersonRepository.InsertAsync(entity);
+        }
+
+        [AbpAuthorize(PermissionNames.PagesCustomerSupplierCustomerSupplierPersonMgUpdatePerson)]
+        public async Task<CustomerSupplierPerson> UpdatePerson(CustomerSupplierPersonUpdateDto input)
+        {
+            CustomerSupplierPerson entity = ObjectMapper.Map<CustomerSupplierPerson>(input);
+
+            return await CustomerSupplierPersonRepository.UpdateAsync(entity);
+        }
+
+        [AbpAuthorize(PermissionNames.PagesCustomerSupplierCustomerSupplierPersonMgDeletePerson)]
+        public Task DeletePerson(EntityDto<int> input)
+        {
+            return CustomerSupplierPersonRepository.DeleteAsync(input.Id);
+        }
+        #endregion
+
+        #region DefaultPerson
+        [AbpAuthorize(PermissionNames.PagesCustomerSupplierCustomerDefaultProductMg)]
+        public async Task<List<CustomerDefaultProductDto>> GetAllProduct(PagedRequestDto input)
+        {
+            var query = CustomerDefaultProductRepository.GetAll();
+            query = ApplyFilterEx(query, input);
+            query = ApplySortingEx(query, input);
+            var entities = await AsyncQueryableExecuter.ToListAsync(query);
+            var dtoList = ObjectMapper.Map<List<CustomerDefaultProductDto>>(entities);
+            return dtoList;
+        }
+        [AbpAuthorize(PermissionNames.PagesCustomerSupplierCustomerDefaultProductMgCreateProduct)]
+        public async Task<CustomerDefaultProduct> CreateProduct(CustomerDefaultProductCreateDto input)
+        {
+            CustomerDefaultProduct entity = ObjectMapper.Map<CustomerDefaultProduct>(input);
+            return await CustomerDefaultProductRepository.InsertAsync(entity);
+        }
+
+        [AbpAuthorize(PermissionNames.PagesCustomerSupplierCustomerDefaultProductMgUpdateProduct)]
+        public async Task<CustomerDefaultProduct> UpdateProduct(CustomerDefaultProductUpdateDto input)
+        {
+            CustomerDefaultProduct entity = ObjectMapper.Map<CustomerDefaultProduct>(input);
+
+            return await CustomerDefaultProductRepository.UpdateAsync(entity);
+        }
+
+        [AbpAuthorize(PermissionNames.PagesCustomerSupplierCustomerDefaultProductMgDeleteProduct)]
+        public Task DeleteProduct(EntityDto<int> input)
+        {
+            return CustomerDefaultProductRepository.DeleteAsync(input.Id);
+        }
+
+        #endregion
+
+
+      
+       
+
+    }
+}

+ 21 - 0
SourceCode/VberTech/VberTech.Application/Customers/DefaultProduct/Dto/CustomerDefaultProductCreateDto.cs

@@ -0,0 +1,21 @@
+using System;
+using Abp.AutoMapper;
+using System.ComponentModel.DataAnnotations;
+
+namespace VberTech.Customers.Dto
+{
+    [AutoMapTo(typeof(CustomerDefaultProduct))]
+    public class CustomerDefaultProductCreateDto
+    {
+		public int CustomerId  { get; set; }
+		public VberTech.Customers.CustomerSupplier CustomerSupplier  { get; set; }
+		public int ProductId  { get; set; }
+		public VberTech.Products.Product Product  { get; set; }
+        /// <summary>
+        /// 客户产品名称
+        /// </summary>   
+        [StringLength(CustomerDefaultProduct.CustomerProductNameMaxLength)]
+		public string CustomerProductName  { get; set; }
+		public int Sequence  { get; set; }
+    }
+}

+ 23 - 0
SourceCode/VberTech/VberTech.Application/Customers/DefaultProduct/Dto/CustomerDefaultProductDto.cs

@@ -0,0 +1,23 @@
+using System;
+using Abp.AutoMapper;
+using Abp.Application.Services.Dto;
+
+namespace VberTech.Customers.Dto
+{
+    [AutoMapTo(typeof(CustomerDefaultProduct)),AutoMapFrom(typeof(CustomerDefaultProduct))]
+    public class CustomerDefaultProductDto: EntityDto<int>
+    {
+		public int CustomerId  { get; set; }
+	
+		public int ProductId  { get; set; }
+		public string ProductNo  { get; set; }
+		public string ProductName  { get; set; }
+		public string Model  { get; set; }
+        public string Material { get; set; }
+        /// <summary>
+        /// 客户产品名称
+        /// </summary>   
+		public string CustomerProductName  { get; set; }
+		public int Sequence  { get; set; }
+    }
+}

+ 23 - 0
SourceCode/VberTech/VberTech.Application/Customers/DefaultProduct/Dto/CustomerDefaultProductUpdateDto.cs

@@ -0,0 +1,23 @@
+using System;
+using Abp.AutoMapper;
+using Abp.Application.Services.Dto;
+using System.ComponentModel.DataAnnotations;
+
+namespace VberTech.Customers.Dto
+{
+    [AutoMapTo(typeof(CustomerDefaultProduct))]
+    public class CustomerDefaultProductUpdateDto: EntityDto<int>
+    {
+		public int CustomerId  { get; set; }
+		public VberTech.Customers.CustomerSupplier CustomerSupplier  { get; set; }
+		public int ProductId  { get; set; }
+		public VberTech.Products.Product Product  { get; set; }
+        
+        /// <summary>
+        /// 客户产品名称
+        /// </summary>   
+        [StringLength(CustomerDefaultProduct.CustomerProductNameMaxLength)]
+		public string CustomerProductName  { get; set; }
+		public int Sequence  { get; set; }
+    }
+}

Деякі файли не було показано, через те що забагато файлів було змінено