From 1eaedea85d11516f3d5fae365cf5c6ddeb007a67 Mon Sep 17 00:00:00 2001 From: 18923810322 <1666941798@qq.com> Date: Wed, 30 Apr 2025 17:01:05 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E9=A1=B9=E7=9B=AE=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .dockerignore | 30 + .gitattributes | 63 + .gitignore | 366 ++ Dockerfile | 40 + src/BarCode.Web.Api/.config/dotnet-tools.json | 12 + .../Controllers/BoxController.cs | 199 + .../Controllers/BoxMarkController.cs | 89 + .../Controllers/ClientLogController.cs | 82 + .../Controllers/FileDownManagerController.cs | 107 + .../Controllers/HeartController.cs | 20 + .../Controllers/LoginController.cs | 143 + .../Controllers/MaterialController.cs | 118 + .../Controllers/SecurityController.cs | 59 + .../Controllers/SecurityNumberController.cs | 189 + .../Controllers/SerialNumberController.cs | 309 ++ .../Controllers/SysConfigController.cs | 180 + .../Controllers/TestController.cs | 508 ++ .../Controllers/WmsBoxController.cs | 150 + src/BarCode.Web.Api/CustomResultFilter .cs | 40 + src/BarCode.Web.Api/Program.cs | 60 + .../Properties/launchSettings.json | 50 + .../appsettings.Development.json | 8 + src/BarCode.Web.Api/appsettings.json | 100 + .../wwwroot/BarCode.Web.Api.xml | 396 ++ .../wwwroot/BarCode.Web.Core.xml | 4526 +++++++++++++++++ .../wwwroot/BarCode.Web.Domain.xml | 4028 +++++++++++++++ src/BarCode.Web.Core/BarCode.Web.Core.csproj | 33 + .../ERP/ConnectedService.json | 99 + .../Connected Services/ERP/Reference.cs | 1236 +++++ .../Dto/Box/BoxDetailsResponse.cs | 31 + .../Dto/Box/BoxInfoResponse.cs | 83 + .../Dto/Box/BoxQueryRequest.cs | 69 + src/BarCode.Web.Core/Dto/Box/BoxResponse.cs | 67 + .../Dto/Box/DeleteBoxSerialNumberRequest.cs | 31 + .../Dto/Box/GenerateBoxRequest.cs | 27 + .../Dto/Box/SaveBoxDetailsRequest.cs | 26 + .../Dto/Box/SaveBoxRequest.cs | 30 + src/BarCode.Web.Core/Dto/Box/WmsBoxRequest.cs | 47 + .../Dto/Box/WmsBoxResponse.cs | 95 + .../Dto/BoxMark/BoxMarkQueryRequest.cs | 52 + .../Dto/BoxMark/BoxMarkQueryResponse.cs | 124 + .../Dto/BoxMark/GenerateBoxMarkDto.cs | 83 + .../Dto/EnumStatusResponse.cs | 71 + .../Dto/Erp/Customer/ErpCustomerDto.cs | 27 + src/BarCode.Web.Core/Dto/Erp/ErpBaseDto.cs | 15 + .../Dto/Erp/ErpBillQueryDto.cs | 40 + .../Dto/Erp/ErpBillQueryParamDto.cs | 55 + .../Dto/Erp/ErpInStockResultDto.cs | 92 + .../Dto/Erp/ErpInventoryDto.cs | 30 + src/BarCode.Web.Core/Dto/Erp/ErpNumberDto.cs | 50 + src/BarCode.Web.Core/Dto/Erp/ErpOperateDto.cs | 28 + .../Dto/Erp/ErpPurchaseInStockSaveDto.cs | 74 + src/BarCode.Web.Core/Dto/Erp/ErpPushDto.cs | 62 + src/BarCode.Web.Core/Dto/Erp/ErpSave.cs | 28 + .../Dto/Erp/Material/ErpMaterialDto.cs | 68 + src/BarCode.Web.Core/Dto/Erp/Org/ErpOrgDto.cs | 27 + .../ErpDeliveryNoticeOutStockResultDto.cs | 65 + .../Dto/Erp/OutStock/ErpOutStockSaveDto.cs | 94 + .../Dto/Erp/OutStock/ErpSalOutStockSaveDto.cs | 48 + .../Dto/Erp/PullDownStrResponse.cs | 29 + .../Dto/Erp/Stock/ErpStockDto.cs | 33 + .../Dto/Erp/Stock/ErpSubStockDto.cs | 37 + .../Dto/Erp/Supplier/ErpSupplierDto.cs | 31 + .../Dto/Erp/TakeStock/ErpTakeStockSaveDto.cs | 138 + .../Dto/FileDownManagerRequest.cs | 43 + .../Dto/FileDownManagerResponse.cs | 73 + .../Dto/FileDownManagerStatusResponse.cs | 19 + .../Dto/Login/AccessTokenDto.cs | 37 + src/BarCode.Web.Core/Dto/Login/DeptInfoDto.cs | 17 + src/BarCode.Web.Core/Dto/Login/LoginInDto.cs | 25 + .../Dto/Login/LoginOutAuthorizeRequest.cs | 14 + src/BarCode.Web.Core/Dto/Login/LoginOutDto.cs | 44 + .../Dto/Login/LoginRequest.cs | 86 + .../Dto/Login/Menu/MenuRequest.cs | 29 + .../Dto/Login/Menu/MenuResponse.cs | 105 + .../Dto/Login/Single/LoginSingleRequest.cs | 27 + .../Dto/Login/Single/LoginSingleResponse.cs | 33 + src/BarCode.Web.Core/Dto/Login/TagInfoDto.cs | 13 + .../Dto/Login/Temp/LoginJsonDeptTempDto.cs | 19 + .../Dto/Login/Temp/LoginJsonTokenTempDto.cs | 107 + .../Dto/Login/Temp/LoginTempDto.cs | 70 + .../Login/Temp/v3/LoginJsonCompanyTempDto.cs | 13 + .../Login/Temp/v3/LoginJsonDeptV3TempDto.cs | 13 + .../Dto/Login/Temp/v3/LoginJsonOrgTempDto.cs | 13 + .../Dto/Login/Temp/v3/LoginJsonRoleTempDto.cs | 13 + .../Login/Temp/v3/LoginJsonTokenV3TempDto.cs | 30 + src/BarCode.Web.Core/Dto/Login/UserInfoDto.cs | 101 + .../Dto/Login/UserInfoV3Dto.cs | 30 + src/BarCode.Web.Core/Dto/MaterialResponse.cs | 65 + src/BarCode.Web.Core/Dto/MaterialSubStock.cs | 37 + src/BarCode.Web.Core/Dto/OperateRequest.cs | 29 + .../Dto/PaginationRequestDto.cs | 28 + .../GenerateSecurityNumberRequest.cs | 30 + .../OperateSecurityNumberRequest.cs | 27 + .../SecurityGenerateRecordInfoResponse.cs | 63 + .../SecurityGenerateRecordQueryRequest.cs | 45 + .../SecurityNumberInfoResponse.cs | 62 + .../SecurityNumberQueryRequest.cs | 50 + .../SecurityNumbersExportReponse.cs | 41 + .../SecurityNumbersExportRequest.cs | 16 + .../Dto/SecurityNumbers/SecurityResponse.cs | 31 + src/BarCode.Web.Core/Dto/SendDataDto.cs | 98 + .../GenerateSerialNumberRequest.cs | 59 + .../OperateSerialNumberRequest.cs | 27 + .../SGenerateRecordInfoResponse.cs | 84 + .../SGenerateRecordQueryRequest.cs | 71 + .../SerialNumberByBoxIdQueryRequest.cs | 21 + .../SerialNumbers/SerialNumberInfoResponse.cs | 121 + .../SerialNumbers/SerialNumberQueryRequest.cs | 87 + .../SerialNumbersExportReponse.cs | 56 + .../SerialNumbersExportRequest.cs | 19 + .../SerialNumbersExternalResponse.cs | 44 + .../SerialNumbers/SerialNumbersResponse.cs | 73 + .../SerialNumbers/SerialNumbersWmsRequest.cs | 19 + .../SerialNumbers/SerialNumbersWmsResponse.cs | 31 + .../SerialNumbers/UpdateMaterialRequest.cs | 30 + .../Dto/SingleData/CodeRequest.cs | 19 + .../Dto/SingleData/CodesRequest.cs | 19 + .../Dto/SingleData/IdRequest.cs | 25 + .../Dto/SingleData/IdsRequest.cs | 22 + .../Dto/SingleData/NameRequest.cs | 25 + .../Dto/SingleData/OrgAllResponse.cs | 51 + .../Dto/SingleData/SingleDataRequest.cs | 24 + .../Dto/SingleData/SingleDataResponse.cs | 40 + .../Dto/SingleData/SubStockRequest.cs | 24 + .../Dto/SingleData/SupplierInfoResponse.cs | 25 + .../Dto/SingleData/SysOrgResponse.cs | 54 + .../Dto/SingleData/SysStaffResponse.cs | 37 + .../Dto/SingleData/SystemCodeRequest.cs | 32 + .../Dto/SingleData/UcStockResponse.cs | 38 + .../Dto/SingleData/UcSubStockResponse.cs | 48 + .../Dto/SingleData/UserRequest.cs | 24 + src/BarCode.Web.Core/Dto/SubUcStockRequset.cs | 27 + src/BarCode.Web.Core/Dto/TemplateExcel.cs | 34 + src/BarCode.Web.Core/EntityBase.cs | 29 + src/BarCode.Web.Core/EnumOperate.cs | 49 + .../Exceptions/WebHttpException.cs | 23 + src/BarCode.Web.Core/Help/CacheHelp.cs | 50 + src/BarCode.Web.Core/Help/ClassClone.cs | 34 + src/BarCode.Web.Core/Help/ClassCopyUtil.cs | 63 + src/BarCode.Web.Core/Help/DateTimeUtil.cs | 239 + src/BarCode.Web.Core/Help/HttpClientHelp.cs | 174 + src/BarCode.Web.Core/Help/RedisClient.cs | 119 + .../Help/ValidatetionHelper.cs | 77 + .../Internal/Results/Result.cs | 184 + .../Internal/Results/Result2.cs | 102 + .../Internal/Results/ResultCodes.cs | 62 + .../Internal/Results/ResultList.cs | 102 + .../Internal/Results/ResultPagedList.cs | 112 + src/BarCode.Web.Core/Internal/Security/RSA.cs | 463 ++ src/BarCode.Web.Core/NumericalProcess.cs | 63 + .../BarCode.Web.Domain.csproj | 28 + src/BarCode.Web.Domain/Entitys/Box.cs | 195 + src/BarCode.Web.Domain/Entitys/BoxDetails.cs | 45 + src/BarCode.Web.Domain/Entitys/BoxMark.cs | 192 + .../Entitys/BoxMarkBillNo.cs | 87 + .../Entitys/CenerateData.cs | 40 + .../Entitys/FileDownManager.cs | 90 + src/BarCode.Web.Domain/Entitys/Materials.cs | 77 + .../Entitys/SecurityNumberGenerateRecord.cs | 116 + .../Entitys/SecurityNumbers.cs | 110 + .../Entitys/SerialNumberGenerateRecord.cs | 150 + .../Entitys/SerialNumbers.cs | 287 ++ .../IService/IBoxMarkService.cs | 32 + .../IService/IBoxService.cs | 60 + .../IService/IExportExcelService.cs | 56 + .../IService/IQiniuUploadService.cs | 22 + .../IService/ISecurityNumberService.cs | 32 + .../IService/ISerialNumberService.cs | 50 + .../Public/IErpBasicDataExtendService.cs | 191 + .../IService/Public/IErpService.cs | 100 + .../IService/Public/IHttpClientService.cs | 18 + .../IService/Public/ILoginService.cs | 77 + .../IService/Public/IMaterialService.cs | 25 + .../Public/IRedisConcurrentProcessService.cs | 15 + .../IService/Public/ISingleDataService.cs | 128 + .../IService/Public/IWmsService.cs | 22 + .../Infrastructure/IAllFielRepositories.cs | 28 + .../Infrastructure/IBasicsRepositories.cs | 93 + .../Infrastructure/IBoxMarkRepositories.cs | 60 + .../Infrastructure/IBoxRepositories.cs | 47 + .../ICenerateDataRepositories.cs | 23 + .../IFileDownManagerRepositories.cs | 32 + .../Infrastructure/ILoginRepositories.cs | 24 + .../Infrastructure/IMaterialsRepositories.cs | 77 + .../ISGenerateRecordRepositories.cs | 34 + .../ISecurityGenerateRecordRepositories.cs | 35 + .../ISecurityNumbersRepositories.cs | 43 + .../ISerialNumbersRepositories.cs | 62 + .../ITransactionRepositories.cs | 22 + src/BarCode.Web.Domain/Mappers/AppMapper.cs | 74 + src/BarCode.Web.Domain/Mappers/BoxMapper.cs | 36 + .../Mappers/BoxMarkMapper.cs | 20 + src/BarCode.Web.Domain/Mappers/MapperList.cs | 98 + .../Mappers/MaterialMapper.cs | 21 + .../Mappers/SecurityNumberMapper.cs | 20 + .../Mappers/SerialNumberMapper.cs | 21 + src/BarCode.Web.Domain/Options/AppOptions.cs | 44 + .../Options/EmailOptions.cs | 42 + src/BarCode.Web.Domain/Options/ErpOptions.cs | 39 + .../Options/QiniuOptions.cs | 31 + .../Options/QuartzJobOptions.cs | 155 + src/BarCode.Web.Domain/Options/SmsOptions.cs | 32 + src/BarCode.Web.Domain/Options/SoaOptions.cs | 47 + src/BarCode.Web.Domain/Options/WmsOptions.cs | 14 + .../QuartzJob/CenerateDataQuartzJob.cs | 48 + .../QuartzJob/MaterialsBarQuartzJob.cs | 39 + .../QuartzJob/MaterialsQuartzJob.cs | 42 + .../Services/BoxMarkService.cs | 131 + src/BarCode.Web.Domain/Services/BoxService.cs | 459 ++ .../Services/ExportExcelService.cs | 229 + .../Services/Public/ErpBaseDataSync.cs | 83 + .../Public/ErpBasicDataExtendService.cs | 442 ++ .../Services/Public/ErpService.cs | 1207 +++++ .../Services/Public/HostedService.cs | 55 + .../Services/Public/HttpClientService.cs | 230 + .../Services/Public/LoginService.cs | 567 +++ .../Services/Public/MaterialService.cs | 150 + .../Services/Public/Radix.cs | 344 ++ .../Services/Public/RedisClientService.cs | 93 + .../Public/RedisConcurrentProcessService.cs | 37 + .../Services/Public/SingleDataService.cs | 476 ++ .../Services/Public/WmsService.cs | 57 + .../Services/QiniuUploadService.cs | 73 + .../Services/SecurityNumberService.cs | 234 + .../Services/SerialNumberService.cs | 423 ++ .../TimedJob/ErpBaseDataSyncJob.cs | 76 + src/BarCode.Web.Domain/Values/BoxStatus.cs | 32 + .../Values/CenerateDataType.cs | 19 + .../Values/Erp/FormIdParam.cs | 85 + src/BarCode.Web.Domain/Values/ExportStatus.cs | 30 + .../Values/FileDownLoadOrderType.cs | 34 + src/BarCode.Web.Domain/Values/ResultCodes.cs | 64 + .../Values/Single/SingleAction.cs | 122 + .../Values/Single/SingleControllerType.cs | 29 + .../Values/Single/SingleLoginAction.cs | 42 + .../Values/Single/SysConfigAction.cs | 223 + .../BarCode.Web.Repositories.csproj | 30 + .../BasicsRepositories.cs | 197 + .../BoxMarkRepositories.cs | 312 ++ .../BoxRepositories.cs | 381 ++ .../CenerateDataRepositories.cs | 87 + .../Configuration/DbContextExtensions.cs | 225 + .../Configuration/EFLog/EFCoreLogger.cs | 39 + .../EFLog/EFCoreLoggerProvider.cs | 13 + .../Configuration/RepositoryDbContext.cs | 135 + .../DependencyInjection/AppBuilder.cs | 300 ++ .../AppBuilderExtensions.cs | 63 + .../AuthorizationTokenSecurityPolicy.cs | 198 + .../ErrorHandlingMiddleware.cs | 85 + .../PlatformActionMiddleware.cs | 85 + .../ServiceCollectionExtensions.cs | 40 + .../FileDownManagerRepositories.cs | 110 + .../LoginRepositories.cs | 49 + .../MaterialsRepositories.cs | 177 + .../MySqlDataAccess.cs | 68 + .../SGenerateRecordRepositories.cs | 339 ++ .../SecurityGenerateRecordRepositories.cs | 275 + .../SecurityNumbersRepositories.cs | 315 ++ .../SerialNumbersRepositories.cs | 723 +++ .../TransactionRepositories.cs | 47 + 261 files changed, 33985 insertions(+) create mode 100644 .dockerignore create mode 100644 .gitattributes create mode 100644 .gitignore create mode 100644 Dockerfile create mode 100644 src/BarCode.Web.Api/.config/dotnet-tools.json create mode 100644 src/BarCode.Web.Api/Controllers/BoxController.cs create mode 100644 src/BarCode.Web.Api/Controllers/BoxMarkController.cs create mode 100644 src/BarCode.Web.Api/Controllers/ClientLogController.cs create mode 100644 src/BarCode.Web.Api/Controllers/FileDownManagerController.cs create mode 100644 src/BarCode.Web.Api/Controllers/HeartController.cs create mode 100644 src/BarCode.Web.Api/Controllers/LoginController.cs create mode 100644 src/BarCode.Web.Api/Controllers/MaterialController.cs create mode 100644 src/BarCode.Web.Api/Controllers/SecurityController.cs create mode 100644 src/BarCode.Web.Api/Controllers/SecurityNumberController.cs create mode 100644 src/BarCode.Web.Api/Controllers/SerialNumberController.cs create mode 100644 src/BarCode.Web.Api/Controllers/SysConfigController.cs create mode 100644 src/BarCode.Web.Api/Controllers/TestController.cs create mode 100644 src/BarCode.Web.Api/Controllers/WmsBoxController.cs create mode 100644 src/BarCode.Web.Api/CustomResultFilter .cs create mode 100644 src/BarCode.Web.Api/Program.cs create mode 100644 src/BarCode.Web.Api/Properties/launchSettings.json create mode 100644 src/BarCode.Web.Api/appsettings.Development.json create mode 100644 src/BarCode.Web.Api/appsettings.json create mode 100644 src/BarCode.Web.Api/wwwroot/BarCode.Web.Api.xml create mode 100644 src/BarCode.Web.Api/wwwroot/BarCode.Web.Core.xml create mode 100644 src/BarCode.Web.Api/wwwroot/BarCode.Web.Domain.xml create mode 100644 src/BarCode.Web.Core/BarCode.Web.Core.csproj create mode 100644 src/BarCode.Web.Core/Connected Services/ERP/ConnectedService.json create mode 100644 src/BarCode.Web.Core/Connected Services/ERP/Reference.cs create mode 100644 src/BarCode.Web.Core/Dto/Box/BoxDetailsResponse.cs create mode 100644 src/BarCode.Web.Core/Dto/Box/BoxInfoResponse.cs create mode 100644 src/BarCode.Web.Core/Dto/Box/BoxQueryRequest.cs create mode 100644 src/BarCode.Web.Core/Dto/Box/BoxResponse.cs create mode 100644 src/BarCode.Web.Core/Dto/Box/DeleteBoxSerialNumberRequest.cs create mode 100644 src/BarCode.Web.Core/Dto/Box/GenerateBoxRequest.cs create mode 100644 src/BarCode.Web.Core/Dto/Box/SaveBoxDetailsRequest.cs create mode 100644 src/BarCode.Web.Core/Dto/Box/SaveBoxRequest.cs create mode 100644 src/BarCode.Web.Core/Dto/Box/WmsBoxRequest.cs create mode 100644 src/BarCode.Web.Core/Dto/Box/WmsBoxResponse.cs create mode 100644 src/BarCode.Web.Core/Dto/BoxMark/BoxMarkQueryRequest.cs create mode 100644 src/BarCode.Web.Core/Dto/BoxMark/BoxMarkQueryResponse.cs create mode 100644 src/BarCode.Web.Core/Dto/BoxMark/GenerateBoxMarkDto.cs create mode 100644 src/BarCode.Web.Core/Dto/EnumStatusResponse.cs create mode 100644 src/BarCode.Web.Core/Dto/Erp/Customer/ErpCustomerDto.cs create mode 100644 src/BarCode.Web.Core/Dto/Erp/ErpBaseDto.cs create mode 100644 src/BarCode.Web.Core/Dto/Erp/ErpBillQueryDto.cs create mode 100644 src/BarCode.Web.Core/Dto/Erp/ErpBillQueryParamDto.cs create mode 100644 src/BarCode.Web.Core/Dto/Erp/ErpInStockResultDto.cs create mode 100644 src/BarCode.Web.Core/Dto/Erp/ErpInventoryDto.cs create mode 100644 src/BarCode.Web.Core/Dto/Erp/ErpNumberDto.cs create mode 100644 src/BarCode.Web.Core/Dto/Erp/ErpOperateDto.cs create mode 100644 src/BarCode.Web.Core/Dto/Erp/ErpPurchaseInStockSaveDto.cs create mode 100644 src/BarCode.Web.Core/Dto/Erp/ErpPushDto.cs create mode 100644 src/BarCode.Web.Core/Dto/Erp/ErpSave.cs create mode 100644 src/BarCode.Web.Core/Dto/Erp/Material/ErpMaterialDto.cs create mode 100644 src/BarCode.Web.Core/Dto/Erp/Org/ErpOrgDto.cs create mode 100644 src/BarCode.Web.Core/Dto/Erp/OutStock/ErpDeliveryNoticeOutStockResultDto.cs create mode 100644 src/BarCode.Web.Core/Dto/Erp/OutStock/ErpOutStockSaveDto.cs create mode 100644 src/BarCode.Web.Core/Dto/Erp/OutStock/ErpSalOutStockSaveDto.cs create mode 100644 src/BarCode.Web.Core/Dto/Erp/PullDownStrResponse.cs create mode 100644 src/BarCode.Web.Core/Dto/Erp/Stock/ErpStockDto.cs create mode 100644 src/BarCode.Web.Core/Dto/Erp/Stock/ErpSubStockDto.cs create mode 100644 src/BarCode.Web.Core/Dto/Erp/Supplier/ErpSupplierDto.cs create mode 100644 src/BarCode.Web.Core/Dto/Erp/TakeStock/ErpTakeStockSaveDto.cs create mode 100644 src/BarCode.Web.Core/Dto/FileDownManagerRequest.cs create mode 100644 src/BarCode.Web.Core/Dto/FileDownManagerResponse.cs create mode 100644 src/BarCode.Web.Core/Dto/FileDownManagerStatusResponse.cs create mode 100644 src/BarCode.Web.Core/Dto/Login/AccessTokenDto.cs create mode 100644 src/BarCode.Web.Core/Dto/Login/DeptInfoDto.cs create mode 100644 src/BarCode.Web.Core/Dto/Login/LoginInDto.cs create mode 100644 src/BarCode.Web.Core/Dto/Login/LoginOutAuthorizeRequest.cs create mode 100644 src/BarCode.Web.Core/Dto/Login/LoginOutDto.cs create mode 100644 src/BarCode.Web.Core/Dto/Login/LoginRequest.cs create mode 100644 src/BarCode.Web.Core/Dto/Login/Menu/MenuRequest.cs create mode 100644 src/BarCode.Web.Core/Dto/Login/Menu/MenuResponse.cs create mode 100644 src/BarCode.Web.Core/Dto/Login/Single/LoginSingleRequest.cs create mode 100644 src/BarCode.Web.Core/Dto/Login/Single/LoginSingleResponse.cs create mode 100644 src/BarCode.Web.Core/Dto/Login/TagInfoDto.cs create mode 100644 src/BarCode.Web.Core/Dto/Login/Temp/LoginJsonDeptTempDto.cs create mode 100644 src/BarCode.Web.Core/Dto/Login/Temp/LoginJsonTokenTempDto.cs create mode 100644 src/BarCode.Web.Core/Dto/Login/Temp/LoginTempDto.cs create mode 100644 src/BarCode.Web.Core/Dto/Login/Temp/v3/LoginJsonCompanyTempDto.cs create mode 100644 src/BarCode.Web.Core/Dto/Login/Temp/v3/LoginJsonDeptV3TempDto.cs create mode 100644 src/BarCode.Web.Core/Dto/Login/Temp/v3/LoginJsonOrgTempDto.cs create mode 100644 src/BarCode.Web.Core/Dto/Login/Temp/v3/LoginJsonRoleTempDto.cs create mode 100644 src/BarCode.Web.Core/Dto/Login/Temp/v3/LoginJsonTokenV3TempDto.cs create mode 100644 src/BarCode.Web.Core/Dto/Login/UserInfoDto.cs create mode 100644 src/BarCode.Web.Core/Dto/Login/UserInfoV3Dto.cs create mode 100644 src/BarCode.Web.Core/Dto/MaterialResponse.cs create mode 100644 src/BarCode.Web.Core/Dto/MaterialSubStock.cs create mode 100644 src/BarCode.Web.Core/Dto/OperateRequest.cs create mode 100644 src/BarCode.Web.Core/Dto/PaginationRequestDto.cs create mode 100644 src/BarCode.Web.Core/Dto/SecurityNumbers/GenerateSecurityNumberRequest.cs create mode 100644 src/BarCode.Web.Core/Dto/SecurityNumbers/OperateSecurityNumberRequest.cs create mode 100644 src/BarCode.Web.Core/Dto/SecurityNumbers/SecurityGenerateRecordInfoResponse.cs create mode 100644 src/BarCode.Web.Core/Dto/SecurityNumbers/SecurityGenerateRecordQueryRequest.cs create mode 100644 src/BarCode.Web.Core/Dto/SecurityNumbers/SecurityNumberInfoResponse.cs create mode 100644 src/BarCode.Web.Core/Dto/SecurityNumbers/SecurityNumberQueryRequest.cs create mode 100644 src/BarCode.Web.Core/Dto/SecurityNumbers/SecurityNumbersExportReponse.cs create mode 100644 src/BarCode.Web.Core/Dto/SecurityNumbers/SecurityNumbersExportRequest.cs create mode 100644 src/BarCode.Web.Core/Dto/SecurityNumbers/SecurityResponse.cs create mode 100644 src/BarCode.Web.Core/Dto/SendDataDto.cs create mode 100644 src/BarCode.Web.Core/Dto/SerialNumbers/GenerateSerialNumberRequest.cs create mode 100644 src/BarCode.Web.Core/Dto/SerialNumbers/OperateSerialNumberRequest.cs create mode 100644 src/BarCode.Web.Core/Dto/SerialNumbers/SGenerateRecordInfoResponse.cs create mode 100644 src/BarCode.Web.Core/Dto/SerialNumbers/SGenerateRecordQueryRequest.cs create mode 100644 src/BarCode.Web.Core/Dto/SerialNumbers/SerialNumberByBoxIdQueryRequest.cs create mode 100644 src/BarCode.Web.Core/Dto/SerialNumbers/SerialNumberInfoResponse.cs create mode 100644 src/BarCode.Web.Core/Dto/SerialNumbers/SerialNumberQueryRequest.cs create mode 100644 src/BarCode.Web.Core/Dto/SerialNumbers/SerialNumbersExportReponse.cs create mode 100644 src/BarCode.Web.Core/Dto/SerialNumbers/SerialNumbersExportRequest.cs create mode 100644 src/BarCode.Web.Core/Dto/SerialNumbers/SerialNumbersExternalResponse.cs create mode 100644 src/BarCode.Web.Core/Dto/SerialNumbers/SerialNumbersResponse.cs create mode 100644 src/BarCode.Web.Core/Dto/SerialNumbers/SerialNumbersWmsRequest.cs create mode 100644 src/BarCode.Web.Core/Dto/SerialNumbers/SerialNumbersWmsResponse.cs create mode 100644 src/BarCode.Web.Core/Dto/SerialNumbers/UpdateMaterialRequest.cs create mode 100644 src/BarCode.Web.Core/Dto/SingleData/CodeRequest.cs create mode 100644 src/BarCode.Web.Core/Dto/SingleData/CodesRequest.cs create mode 100644 src/BarCode.Web.Core/Dto/SingleData/IdRequest.cs create mode 100644 src/BarCode.Web.Core/Dto/SingleData/IdsRequest.cs create mode 100644 src/BarCode.Web.Core/Dto/SingleData/NameRequest.cs create mode 100644 src/BarCode.Web.Core/Dto/SingleData/OrgAllResponse.cs create mode 100644 src/BarCode.Web.Core/Dto/SingleData/SingleDataRequest.cs create mode 100644 src/BarCode.Web.Core/Dto/SingleData/SingleDataResponse.cs create mode 100644 src/BarCode.Web.Core/Dto/SingleData/SubStockRequest.cs create mode 100644 src/BarCode.Web.Core/Dto/SingleData/SupplierInfoResponse.cs create mode 100644 src/BarCode.Web.Core/Dto/SingleData/SysOrgResponse.cs create mode 100644 src/BarCode.Web.Core/Dto/SingleData/SysStaffResponse.cs create mode 100644 src/BarCode.Web.Core/Dto/SingleData/SystemCodeRequest.cs create mode 100644 src/BarCode.Web.Core/Dto/SingleData/UcStockResponse.cs create mode 100644 src/BarCode.Web.Core/Dto/SingleData/UcSubStockResponse.cs create mode 100644 src/BarCode.Web.Core/Dto/SingleData/UserRequest.cs create mode 100644 src/BarCode.Web.Core/Dto/SubUcStockRequset.cs create mode 100644 src/BarCode.Web.Core/Dto/TemplateExcel.cs create mode 100644 src/BarCode.Web.Core/EntityBase.cs create mode 100644 src/BarCode.Web.Core/EnumOperate.cs create mode 100644 src/BarCode.Web.Core/Exceptions/WebHttpException.cs create mode 100644 src/BarCode.Web.Core/Help/CacheHelp.cs create mode 100644 src/BarCode.Web.Core/Help/ClassClone.cs create mode 100644 src/BarCode.Web.Core/Help/ClassCopyUtil.cs create mode 100644 src/BarCode.Web.Core/Help/DateTimeUtil.cs create mode 100644 src/BarCode.Web.Core/Help/HttpClientHelp.cs create mode 100644 src/BarCode.Web.Core/Help/RedisClient.cs create mode 100644 src/BarCode.Web.Core/Help/ValidatetionHelper.cs create mode 100644 src/BarCode.Web.Core/Internal/Results/Result.cs create mode 100644 src/BarCode.Web.Core/Internal/Results/Result2.cs create mode 100644 src/BarCode.Web.Core/Internal/Results/ResultCodes.cs create mode 100644 src/BarCode.Web.Core/Internal/Results/ResultList.cs create mode 100644 src/BarCode.Web.Core/Internal/Results/ResultPagedList.cs create mode 100644 src/BarCode.Web.Core/Internal/Security/RSA.cs create mode 100644 src/BarCode.Web.Core/NumericalProcess.cs create mode 100644 src/BarCode.Web.Domain/BarCode.Web.Domain.csproj create mode 100644 src/BarCode.Web.Domain/Entitys/Box.cs create mode 100644 src/BarCode.Web.Domain/Entitys/BoxDetails.cs create mode 100644 src/BarCode.Web.Domain/Entitys/BoxMark.cs create mode 100644 src/BarCode.Web.Domain/Entitys/BoxMarkBillNo.cs create mode 100644 src/BarCode.Web.Domain/Entitys/CenerateData.cs create mode 100644 src/BarCode.Web.Domain/Entitys/FileDownManager.cs create mode 100644 src/BarCode.Web.Domain/Entitys/Materials.cs create mode 100644 src/BarCode.Web.Domain/Entitys/SecurityNumberGenerateRecord.cs create mode 100644 src/BarCode.Web.Domain/Entitys/SecurityNumbers.cs create mode 100644 src/BarCode.Web.Domain/Entitys/SerialNumberGenerateRecord.cs create mode 100644 src/BarCode.Web.Domain/Entitys/SerialNumbers.cs create mode 100644 src/BarCode.Web.Domain/IService/IBoxMarkService.cs create mode 100644 src/BarCode.Web.Domain/IService/IBoxService.cs create mode 100644 src/BarCode.Web.Domain/IService/IExportExcelService.cs create mode 100644 src/BarCode.Web.Domain/IService/IQiniuUploadService.cs create mode 100644 src/BarCode.Web.Domain/IService/ISecurityNumberService.cs create mode 100644 src/BarCode.Web.Domain/IService/ISerialNumberService.cs create mode 100644 src/BarCode.Web.Domain/IService/Public/IErpBasicDataExtendService.cs create mode 100644 src/BarCode.Web.Domain/IService/Public/IErpService.cs create mode 100644 src/BarCode.Web.Domain/IService/Public/IHttpClientService.cs create mode 100644 src/BarCode.Web.Domain/IService/Public/ILoginService.cs create mode 100644 src/BarCode.Web.Domain/IService/Public/IMaterialService.cs create mode 100644 src/BarCode.Web.Domain/IService/Public/IRedisConcurrentProcessService.cs create mode 100644 src/BarCode.Web.Domain/IService/Public/ISingleDataService.cs create mode 100644 src/BarCode.Web.Domain/IService/Public/IWmsService.cs create mode 100644 src/BarCode.Web.Domain/Infrastructure/IAllFielRepositories.cs create mode 100644 src/BarCode.Web.Domain/Infrastructure/IBasicsRepositories.cs create mode 100644 src/BarCode.Web.Domain/Infrastructure/IBoxMarkRepositories.cs create mode 100644 src/BarCode.Web.Domain/Infrastructure/IBoxRepositories.cs create mode 100644 src/BarCode.Web.Domain/Infrastructure/ICenerateDataRepositories.cs create mode 100644 src/BarCode.Web.Domain/Infrastructure/IFileDownManagerRepositories.cs create mode 100644 src/BarCode.Web.Domain/Infrastructure/ILoginRepositories.cs create mode 100644 src/BarCode.Web.Domain/Infrastructure/IMaterialsRepositories.cs create mode 100644 src/BarCode.Web.Domain/Infrastructure/ISGenerateRecordRepositories.cs create mode 100644 src/BarCode.Web.Domain/Infrastructure/ISecurityGenerateRecordRepositories.cs create mode 100644 src/BarCode.Web.Domain/Infrastructure/ISecurityNumbersRepositories.cs create mode 100644 src/BarCode.Web.Domain/Infrastructure/ISerialNumbersRepositories.cs create mode 100644 src/BarCode.Web.Domain/Infrastructure/ITransactionRepositories.cs create mode 100644 src/BarCode.Web.Domain/Mappers/AppMapper.cs create mode 100644 src/BarCode.Web.Domain/Mappers/BoxMapper.cs create mode 100644 src/BarCode.Web.Domain/Mappers/BoxMarkMapper.cs create mode 100644 src/BarCode.Web.Domain/Mappers/MapperList.cs create mode 100644 src/BarCode.Web.Domain/Mappers/MaterialMapper.cs create mode 100644 src/BarCode.Web.Domain/Mappers/SecurityNumberMapper.cs create mode 100644 src/BarCode.Web.Domain/Mappers/SerialNumberMapper.cs create mode 100644 src/BarCode.Web.Domain/Options/AppOptions.cs create mode 100644 src/BarCode.Web.Domain/Options/EmailOptions.cs create mode 100644 src/BarCode.Web.Domain/Options/ErpOptions.cs create mode 100644 src/BarCode.Web.Domain/Options/QiniuOptions.cs create mode 100644 src/BarCode.Web.Domain/Options/QuartzJobOptions.cs create mode 100644 src/BarCode.Web.Domain/Options/SmsOptions.cs create mode 100644 src/BarCode.Web.Domain/Options/SoaOptions.cs create mode 100644 src/BarCode.Web.Domain/Options/WmsOptions.cs create mode 100644 src/BarCode.Web.Domain/QuartzJob/CenerateDataQuartzJob.cs create mode 100644 src/BarCode.Web.Domain/QuartzJob/MaterialsBarQuartzJob.cs create mode 100644 src/BarCode.Web.Domain/QuartzJob/MaterialsQuartzJob.cs create mode 100644 src/BarCode.Web.Domain/Services/BoxMarkService.cs create mode 100644 src/BarCode.Web.Domain/Services/BoxService.cs create mode 100644 src/BarCode.Web.Domain/Services/ExportExcelService.cs create mode 100644 src/BarCode.Web.Domain/Services/Public/ErpBaseDataSync.cs create mode 100644 src/BarCode.Web.Domain/Services/Public/ErpBasicDataExtendService.cs create mode 100644 src/BarCode.Web.Domain/Services/Public/ErpService.cs create mode 100644 src/BarCode.Web.Domain/Services/Public/HostedService.cs create mode 100644 src/BarCode.Web.Domain/Services/Public/HttpClientService.cs create mode 100644 src/BarCode.Web.Domain/Services/Public/LoginService.cs create mode 100644 src/BarCode.Web.Domain/Services/Public/MaterialService.cs create mode 100644 src/BarCode.Web.Domain/Services/Public/Radix.cs create mode 100644 src/BarCode.Web.Domain/Services/Public/RedisClientService.cs create mode 100644 src/BarCode.Web.Domain/Services/Public/RedisConcurrentProcessService.cs create mode 100644 src/BarCode.Web.Domain/Services/Public/SingleDataService.cs create mode 100644 src/BarCode.Web.Domain/Services/Public/WmsService.cs create mode 100644 src/BarCode.Web.Domain/Services/QiniuUploadService.cs create mode 100644 src/BarCode.Web.Domain/Services/SecurityNumberService.cs create mode 100644 src/BarCode.Web.Domain/Services/SerialNumberService.cs create mode 100644 src/BarCode.Web.Domain/TimedJob/ErpBaseDataSyncJob.cs create mode 100644 src/BarCode.Web.Domain/Values/BoxStatus.cs create mode 100644 src/BarCode.Web.Domain/Values/CenerateDataType.cs create mode 100644 src/BarCode.Web.Domain/Values/Erp/FormIdParam.cs create mode 100644 src/BarCode.Web.Domain/Values/ExportStatus.cs create mode 100644 src/BarCode.Web.Domain/Values/FileDownLoadOrderType.cs create mode 100644 src/BarCode.Web.Domain/Values/ResultCodes.cs create mode 100644 src/BarCode.Web.Domain/Values/Single/SingleAction.cs create mode 100644 src/BarCode.Web.Domain/Values/Single/SingleControllerType.cs create mode 100644 src/BarCode.Web.Domain/Values/Single/SingleLoginAction.cs create mode 100644 src/BarCode.Web.Domain/Values/Single/SysConfigAction.cs create mode 100644 src/BarCode.Web.Repositories/BarCode.Web.Repositories.csproj create mode 100644 src/BarCode.Web.Repositories/BasicsRepositories.cs create mode 100644 src/BarCode.Web.Repositories/BoxMarkRepositories.cs create mode 100644 src/BarCode.Web.Repositories/BoxRepositories.cs create mode 100644 src/BarCode.Web.Repositories/CenerateDataRepositories.cs create mode 100644 src/BarCode.Web.Repositories/Configuration/DbContextExtensions.cs create mode 100644 src/BarCode.Web.Repositories/Configuration/EFLog/EFCoreLogger.cs create mode 100644 src/BarCode.Web.Repositories/Configuration/EFLog/EFCoreLoggerProvider.cs create mode 100644 src/BarCode.Web.Repositories/Configuration/RepositoryDbContext.cs create mode 100644 src/BarCode.Web.Repositories/DependencyInjection/AppBuilder.cs create mode 100644 src/BarCode.Web.Repositories/DependencyInjection/AppBuilderExtensions.cs create mode 100644 src/BarCode.Web.Repositories/DependencyInjection/AuthorizationTokenSecurityPolicy.cs create mode 100644 src/BarCode.Web.Repositories/DependencyInjection/ErrorHandlingMiddleware.cs create mode 100644 src/BarCode.Web.Repositories/DependencyInjection/PlatformActionMiddleware.cs create mode 100644 src/BarCode.Web.Repositories/DependencyInjection/ServiceCollectionExtensions.cs create mode 100644 src/BarCode.Web.Repositories/FileDownManagerRepositories.cs create mode 100644 src/BarCode.Web.Repositories/LoginRepositories.cs create mode 100644 src/BarCode.Web.Repositories/MaterialsRepositories.cs create mode 100644 src/BarCode.Web.Repositories/MySqlDataAccess.cs create mode 100644 src/BarCode.Web.Repositories/SGenerateRecordRepositories.cs create mode 100644 src/BarCode.Web.Repositories/SecurityGenerateRecordRepositories.cs create mode 100644 src/BarCode.Web.Repositories/SecurityNumbersRepositories.cs create mode 100644 src/BarCode.Web.Repositories/SerialNumbersRepositories.cs create mode 100644 src/BarCode.Web.Repositories/TransactionRepositories.cs diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..fe1152b --- /dev/null +++ b/.dockerignore @@ -0,0 +1,30 @@ +**/.classpath +**/.dockerignore +**/.env +**/.git +**/.gitignore +**/.project +**/.settings +**/.toolstarget +**/.vs +**/.vscode +**/*.*proj.user +**/*.dbmdl +**/*.jfm +**/azds.yaml +**/bin +**/charts +**/docker-compose* +**/Dockerfile* +**/node_modules +**/npm-debug.log +**/obj +**/secrets.dev.yaml +**/values.dev.yaml +LICENSE +README.md +!**/.gitignore +!.git/HEAD +!.git/config +!.git/packed-refs +!.git/refs/heads/** \ No newline at end of file diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..1ff0c42 --- /dev/null +++ b/.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 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..bc1364c --- /dev/null +++ b/.gitignore @@ -0,0 +1,366 @@ +## 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/ + +# 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 +/BarCode.Web.sln +/src/BarCode.Web.Api/BarCode.Web.Api.csproj +/src/BarCode.Web.Api/BarCode.Web.Api.csproj diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..2690cf5 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,40 @@ +#See https://aka.ms/customizecontainer to learn how to customize your debug container and how Visual Studio uses this Dockerfile to build your images for faster debugging. +#文档地址 https://github.com/dotnet/dotnet-docker/ +FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base +WORKDIR /app +EXPOSE 8080 +EXPOSE 80 +EXPOSE 443 + +#安装apt-get 安装 libc6-dev , libgdiplus 用于支持system.drawing 组件绘制,默认ubuntu命令 +#RUN apt-get update -qq && apt-get -y install libgdiplus libc6-dev +#安装 curl +RUN apt-get update && apt-get install -y curl + +COPY ["src/BarCode.Web.Api/wwwroot/BarCode.Web.Api.xml", "/app/BarCode.Web.Api.xml"] +COPY ["src/BarCode.Web.Api/wwwroot/BarCode.Web.Core.xml", "/app/BarCode.Web.Core.xml"] +COPY ["src/BarCode.Web.Api/wwwroot/BarCode.Web.Domain.xml", "/app/BarCode.Web.Domain.xml"] + +USER app + +#FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build +FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build +ARG BUILD_CONFIGURATION=Release +WORKDIR /src +COPY ["src/BarCode.Web.Api/BarCode.Web.Api.csproj", "src/BarCode.Web.Api/"] +COPY ["src/BarCode.Web.Repositories/BarCode.Web.Repositories.csproj", "src/BarCode.Web.Repositories/"] +COPY ["src/BarCode.Web.Core/BarCode.Web.Core.csproj", "src/BarCode.Web.Core/"] +COPY ["src/BarCode.Web.Domain/BarCode.Web.Domain.csproj", "src/BarCode.Web.Domain/"] +RUN dotnet restore "./src/BarCode.Web.Api/BarCode.Web.Api.csproj" +COPY . . +WORKDIR "/src/src/BarCode.Web.Api" +RUN dotnet build "./BarCode.Web.Api.csproj" -c $BUILD_CONFIGURATION -o /app/build + +FROM build AS publish +ARG BUILD_CONFIGURATION=Release +RUN dotnet publish "./BarCode.Web.Api.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false + +FROM base AS final +WORKDIR /app +COPY --from=publish /app/publish . +ENTRYPOINT ["dotnet", "BarCode.Web.Api.dll"] \ No newline at end of file diff --git a/src/BarCode.Web.Api/.config/dotnet-tools.json b/src/BarCode.Web.Api/.config/dotnet-tools.json new file mode 100644 index 0000000..305bdb1 --- /dev/null +++ b/src/BarCode.Web.Api/.config/dotnet-tools.json @@ -0,0 +1,12 @@ +{ + "version": 1, + "isRoot": true, + "tools": { + "dotnet-ef": { + "version": "9.0.0", + "commands": [ + "dotnet-ef" + ] + } + } +} \ No newline at end of file diff --git a/src/BarCode.Web.Api/Controllers/BoxController.cs b/src/BarCode.Web.Api/Controllers/BoxController.cs new file mode 100644 index 0000000..4ba50c6 --- /dev/null +++ b/src/BarCode.Web.Api/Controllers/BoxController.cs @@ -0,0 +1,199 @@ +锘縰sing AutoMapper; +using BarCode.Web.Core.Dto; +using BarCode.Web.Core.Dto.Box; +using BarCode.Web.Core.Dto.SerialNumbers; +using BarCode.Web.Core.Internal.Results; +using BarCode.Web.Domain.Infrastructure; +using BarCode.Web.Domain.IService; +using BarCode.Web.Domain.IService.Public; +using BarCode.Web.Domain.Services; +using BarCode.Web.Domain.Values; +using BarCode.Web.Repositories; +using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Mvc; +using System.Text.RegularExpressions; + +namespace BarCode.Web.Api.Controllers +{ + /// + /// 绠卞瓙 + /// + [Route("api/[controller]")] + [ApiController] + public class BoxController : ControllerBase + { + private readonly IBoxRepositories _boxRepositories; + private readonly IMapper _mapper; + private readonly ILoginService _loginService; + private readonly IBoxService _boxService; + public BoxController(IMapper mapper, ILoginService loginService, IBoxRepositories boxRepositories, + IBoxService boxService) + { + _boxRepositories = boxRepositories; + _mapper = mapper; + _loginService = loginService; + _boxService = boxService; + } + + /// + /// 绠变俊鎭-鍒楄〃 + /// + /// + /// + [HttpPost] + [Route("GetList")] + public async Task> GetPagedList([FromBody] BoxQueryRequest dto) + { + var loginInfo = _loginService.GetLoginInfo(this.HttpContext.Request.Headers["Authorization"]); + if (loginInfo == null || loginInfo.UserInfo == null) + return ResultPagedList.ReFailure(ResultCodes.Token_Invalid_Error); + + if (!string.IsNullOrEmpty(dto.BoxBeginNo) + && !Regex.Match(dto.BoxBeginNo.ToUpper().Replace("CTN", ""), "^[0-9]*$").Success) + return ResultPagedList.ReFailure(ResultCodes.BoxNO_Invalid_Error); + if (!string.IsNullOrEmpty(dto.BoxEndNo) + && !Regex.Match(dto.BoxEndNo.ToUpper().Replace("CTN", ""), "^[0-9]*$").Success) + return ResultPagedList.ReFailure(ResultCodes.BoxNO_Invalid_Error); + + var (list, count) = await _boxRepositories.GetListAsync(dto, loginInfo); + var result = ResultPagedList.ReSuccess(list, count); + return result; + } + ///// + ///// 鑾峰彇璇︽儏 + ///// + ///// + ///// + //[HttpGet] + //[Route("GetInfo/{id}")] + //public async Task> GetInfo([FromRoute] int id) + //{ + // var loginInfo = _loginService.GetLoginInfo(this.HttpContext.Request.Headers["Authorization"]); + // if (loginInfo == null || loginInfo.UserInfo == null) + // return Result.ReFailure(ResultCodes.Token_Invalid_Error); + + // var response = await _repositories.GetInfo(id); + // return Result.ReSuccess(response); + //} + + /// + /// 鐢熸垚绠辩爜 + /// + /// + /// + [HttpPost] + [Route("Generate")] + public async Task Generate(GenerateBoxRequest dto) + { + var loginInfo = _loginService.GetLoginInfo(this.HttpContext.Request.Headers["Authorization"]); + if (loginInfo == null || loginInfo.UserInfo == null) + return Result.ReFailure(ResultCodes.Token_Invalid_Error); + return await _boxService.Generate(dto, loginInfo); + } + + /// + /// 瑁呯淇濆瓨 + /// + /// + /// + [HttpPost] + [Route("Save")] + public async Task Save(SaveBoxRequest dto) + { + var loginInfo = _loginService.GetLoginInfo(this.HttpContext.Request.Headers["Authorization"]); + if (loginInfo == null || loginInfo.UserInfo == null) + return Result.ReFailure(ResultCodes.Token_Invalid_Error); + + return await _boxService.Save(dto, loginInfo); + } + /// + /// 鎵撳嵃 + /// + /// + /// + [HttpPost] + [Route("Print")] + public async Task Print(OperateRequest dto) + { + var loginInfo = _loginService.GetLoginInfo(this.HttpContext.Request.Headers["Authorization"]); + if (loginInfo == null || loginInfo.UserInfo == null) + return Result.ReFailure(ResultCodes.Token_Invalid_Error); + return await _boxService.Print(dto); + } + /// + /// 鍒犻櫎 + /// + /// + /// + [HttpPost] + [Route("Delete")] + public async Task Delete(DeleteBoxSerialNumberRequest dto) + { + var loginInfo = _loginService.GetLoginInfo(this.HttpContext.Request.Headers["Authorization"]); + if (loginInfo == null || loginInfo.UserInfo == null) + return Result.ReFailure(ResultCodes.Token_Invalid_Error); + return await _boxService.Delete(dto, loginInfo); + } + /// + /// 娓呯┖瑁呯淇℃伅 + /// + /// + /// + [HttpGet] + [Route("Clear")] + public async Task Clear([FromQuery] int boxId) + { + var loginInfo = _loginService.GetLoginInfo(this.HttpContext.Request.Headers["Authorization"]); + if (loginInfo == null || loginInfo.UserInfo == null) + return Result.ReFailure(ResultCodes.Token_Invalid_Error); + return await _boxService.Clear(boxId, loginInfo); + } + /// + /// 鏍规嵁绠卞彿鑾峰彇绠变俊鎭 + /// + /// + /// + [HttpGet] + [Route("GetBoxByNo")] + public async Task> GetBoxByNo([FromQuery] string boxBillNo) + { + var loginInfo = _loginService.GetLoginInfo(this.HttpContext.Request.Headers["Authorization"]); + if (loginInfo == null || loginInfo.UserInfo == null) + return Result.ReFailure(ResultCodes.Token_Invalid_Error); + var entity = await _boxRepositories.GetByNo(boxBillNo); + if (entity == null) + return Result.ReFailure(ResultCodes.BoxNoDataError); + + return Result.ReSuccess(_mapper.Map(entity)); + } + /// + /// 閲嶆柊瑁呯 + /// + /// + /// + [HttpPost] + [Route("Restart")] + public async Task Restart(OperateRequest dto) + { + var loginInfo = _loginService.GetLoginInfo(this.HttpContext.Request.Headers["Authorization"]); + if (loginInfo == null || loginInfo.UserInfo == null) + return Result.ReFailure(ResultCodes.Token_Invalid_Error); + return await _boxService.Restart(dto, loginInfo); + } + /// + /// 寮濮嬭绠 + /// + /// + /// + [HttpGet] + [Route("BeginCarton")] + public async Task BeginCarton([FromQuery] int boxId) + { + var loginInfo = _loginService.GetLoginInfo(this.HttpContext.Request.Headers["Authorization"]); + if (loginInfo == null || loginInfo.UserInfo == null) + return Result.ReFailure(ResultCodes.Token_Invalid_Error); + return await _boxService.BeginCarton(boxId, loginInfo); + } + + } +} diff --git a/src/BarCode.Web.Api/Controllers/BoxMarkController.cs b/src/BarCode.Web.Api/Controllers/BoxMarkController.cs new file mode 100644 index 0000000..44c4d10 --- /dev/null +++ b/src/BarCode.Web.Api/Controllers/BoxMarkController.cs @@ -0,0 +1,89 @@ +锘縰sing Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Mvc; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using BarCode.Web.Core.Dto; +using BarCode.Web.Core.Internal.Results; +using BarCode.Web.Domain.Infrastructure; +using BarCode.Web.Domain.IService; +using BarCode.Web.Domain.IService.Public; +using BarCode.Web.Domain.Values; + +namespace BarCode.Web.Api.Controllers +{ + /// + /// 绠卞敍-鎺ュ彛 + /// + [Route("api/[controller]")] + [ApiController] + public class BoxMarkController : ControllerBase + { + + private readonly ILoginService _loginService; + private readonly IBoxMarkService _boxMarkService; + private readonly IBoxMarkRepositories _boxMarkRepositories; + private readonly IExportExcelService _exportExcelService; + public BoxMarkController( + ILoginService loginService, + IBoxMarkRepositories boxMarkRepositories, + IBoxMarkService boxMarkService, + IExportExcelService exportExcelService) + { + this._loginService = loginService; + this._boxMarkService = boxMarkService; + this._exportExcelService = exportExcelService; + this._boxMarkRepositories = boxMarkRepositories; + } + + /// + /// 绠卞敍--鍒楄〃 + /// + /// + /// + [HttpPost] + [Route("GetList")] + public async Task> GetPagedList([FromBody] BoxMarkQueryRequest dto) + { + var loginInfo = _loginService.GetLoginInfo(this.HttpContext.Request.Headers["Authorization"]); + if (loginInfo == null || loginInfo.UserInfo == null) + return ResultPagedList.ReFailure(ResultCodes.Token_Invalid_Error); + var (list, count) = await _boxMarkService.GetPagedList(dto, loginInfo); + return ResultPagedList.ReSuccess(list, count); + } + + /// + /// 鐢熸垚 + /// + /// + /// + [HttpPost] + [Route("generate")] + public async Task> GenerateAsync([FromBody] GenerateBoxMarkDto dto) + { + var loginInfo = _loginService.GetLoginInfo(this.HttpContext.Request.Headers["Authorization"]); + if (loginInfo == null || loginInfo.UserInfo == null) + return ResultPagedList.ReFailure(ResultCodes.Token_Invalid_Error); + return await _boxMarkService.Generate(dto, loginInfo); + } + + /// + /// 鎵归噺鍒犻櫎 + /// + /// + /// + [HttpPost] + [Route("delete")] + public async Task Delete([FromBody] OperateRequest dto) + { + var loginInfo = _loginService.GetLoginInfo(this.HttpContext.Request.Headers["Authorization"]); + if (loginInfo == null || loginInfo.UserInfo == null) + return ResultPagedList.ReFailure(ResultCodes.Token_Invalid_Error); + var isSuccess= await _boxMarkRepositories.DeleteRange(dto.Ids); + if(!isSuccess) + return Result.ReFailure(ResultCodes.DateWriteError); + return Result.ReSuccess(); + } + } +} diff --git a/src/BarCode.Web.Api/Controllers/ClientLogController.cs b/src/BarCode.Web.Api/Controllers/ClientLogController.cs new file mode 100644 index 0000000..cdd40b6 --- /dev/null +++ b/src/BarCode.Web.Api/Controllers/ClientLogController.cs @@ -0,0 +1,82 @@ +锘縰sing Microsoft.AspNetCore.Hosting; +using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Mvc; +using Microsoft.Extensions.Logging; +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using BarCode.Web.Core.Internal.Results; +using Microsoft.Extensions.Hosting; + +namespace BarCode.Web.Api.Controllers +{ + /// + /// 鍓嶇璁板綍鏃ュ織 + /// + [Route("api/[controller]")] + [ApiController] + public class ClientLogController : ControllerBase + { + private readonly ILogger _Logger; + public IWebHostEnvironment _webHostEnvironment { get; set; } + public ClientLogController(ILogger Logger, IWebHostEnvironment webHostEnvironment) + { + _Logger = Logger; + _webHostEnvironment = webHostEnvironment; + } + /// + /// 鍓嶇璁板綍鏃ュ織 + /// + /// + /// + [HttpGet] + [Route("Log")] + public Task Log([FromQuery] string log) + { + if (!_webHostEnvironment.IsDevelopment()) + _Logger.LogInformation($"鍓嶇鏃ュ織 鏃堕棿:{DateTime.Now} 鍐呭:{log}"); + + return Task.FromResult(Result.ReSuccess()); + } + + /// + /// 鍓嶇璁板綍鏃ュ織 + /// + /// + /// + [HttpGet] + [Route("test")] + public Task Log() + { + return Task.FromResult(Result.ReSuccess()); + } + + /// + /// 鍓嶇璁板綍鏃ュ織(鏁扮粍) + /// + /// + /// + [HttpPost] + [Route("Logs")] + public Task Logs(List logs) + { + if (!_webHostEnvironment.IsDevelopment()) + _Logger.LogInformation($"鍓嶇鏃ュ織(鏁扮粍) 鏃堕棿:{DateTime.Now} 鍐呭:{JsonConvert.SerializeObject(logs)}"); + + return Task.FromResult(Result.ReSuccess()); + } + } + /// + /// 娑堟伅鏁扮粍 + /// + [Serializable] + public class LogRequest + { + /// + /// 娑堟伅鍐呭鏁扮粍 + /// + public List logs { get; set; } = new List(); + } +} diff --git a/src/BarCode.Web.Api/Controllers/FileDownManagerController.cs b/src/BarCode.Web.Api/Controllers/FileDownManagerController.cs new file mode 100644 index 0000000..b0ad382 --- /dev/null +++ b/src/BarCode.Web.Api/Controllers/FileDownManagerController.cs @@ -0,0 +1,107 @@ +锘縰sing Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Mvc; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using BarCode.Web.Core; +using BarCode.Web.Core.Dto; +using BarCode.Web.Core.Internal.Results; +using BarCode.Web.Domain.Infrastructure; +using BarCode.Web.Domain.IService.Public; +using BarCode.Web.Domain.Values; +using Microsoft.AspNetCore.StaticFiles; +using NPOI.SS.Formula.Functions; +using Npoi.Mapper; + +namespace BarCode.Web.Api.Controllers +{ + /// + /// 涓婁紶涓嬭浇涓績 + /// + [Route("api/[controller]")] + [ApiController] + public class FileDownManagerController : ControllerBase + { + private readonly ILoginService _loginService; + private readonly IFileDownManagerRepositories _repositories; + public FileDownManagerController(ILoginService loginService, IFileDownManagerRepositories repositories) + { + _loginService = loginService; + _repositories = repositories; + } + + /// + /// 鑾峰彇闇瑕佺殑鐘舵佸垪琛 + /// + /// + [HttpGet] + [Route("GetStatus")] + public Task> GetStatus() + { + FileDownManagerStatusResponse response = new FileDownManagerStatusResponse(); + foreach (FileDownLoadOrderType enumv in Enum.GetValues(typeof(FileDownLoadOrderType))) + { + response.Type.Add((int)enumv, enumv.GetRemark()); + } + foreach (ExportStatus enumv in Enum.GetValues(typeof(ExportStatus))) + { + response.Status.Add((int)enumv, enumv.GetRemark()); + } + return Task.FromResult(Result.ReSuccess(response)); + } + + /// + /// 涓嬭浇瀵煎嚭鏂囦欢 鍒楄〃 + /// + /// + /// + [HttpPost] + [Route("FileDownManagerQuery")] + public async Task> FileDownManagerQuery(FileDownManagerRequest dto) + { + var loginInfo = _loginService.GetLoginInfo(this.HttpContext.Request.Headers["Authorization"]); + if (loginInfo == null) + return Result.ReFailure(ResultCodes.Token_Invalid_Error); + dto.SupplierId = loginInfo.UserInfo.SupplierId; + + var result = await _repositories.GetList(dto, loginInfo); + return Result.ReSuccess(result); + } + /// + /// 妯℃澘(鐢熸垚搴忓垪鐮) + /// + /// + [HttpGet] + [Route("TemplateExcel")] + public IActionResult TemplateExcel() + { + Mapper mapper = new Mapper(); + + //绗竴涓弬鏁颁负瀵煎嚭Excel鍚嶇О + //绗簩涓弬鏁颁负Excel鏁版嵁鏉ユ簮 + //绗笁涓弬鏁颁负瀵煎嚭鐨凷heet鍚嶇О + //overwrite鍙傛暟濡傛灉鏄瑕嗙洊宸插瓨鍦ㄧ殑Excel鎴栬呮柊寤篍xcel鍒欎负true锛屽鏋滃湪鍘熸湁Excel涓婅拷鍔犳暟鎹垯涓篺alse + //xlsx鍙傛暟鏄敤浜庡尯鍒嗗鍑虹殑鏁版嵁鏍煎紡涓簒lsx杩樻槸xls + byte[] buffer = null; + using (MemoryStream stream = new MemoryStream()) + { + try + { + List list = new List(); + mapper.Put(list, "sheet1", true); + + mapper.Save(stream); + } + catch (Exception) + { + } + + buffer = stream.ToArray(); + } + // .xlsx鏂囦欢瀵瑰簲鐨凪ime淇℃伅 + var mime = new FileExtensionContentTypeProvider().Mappings[".xlsx"]; + return File(buffer, mime, "鎵归噺鐢熸垚鏉$爜妯℃澘.xlsx"); + } + } +} diff --git a/src/BarCode.Web.Api/Controllers/HeartController.cs b/src/BarCode.Web.Api/Controllers/HeartController.cs new file mode 100644 index 0000000..66c7130 --- /dev/null +++ b/src/BarCode.Web.Api/Controllers/HeartController.cs @@ -0,0 +1,20 @@ +锘縰sing Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Mvc; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace BarCode.Web.Api.Controllers +{ + [Route("api/[controller]")] + [ApiController] + public class HeartController : ControllerBase + { + [HttpGet] + public Task Heart() + { + return Task.FromResult("Success"); + } + } +} diff --git a/src/BarCode.Web.Api/Controllers/LoginController.cs b/src/BarCode.Web.Api/Controllers/LoginController.cs new file mode 100644 index 0000000..9e3b391 --- /dev/null +++ b/src/BarCode.Web.Api/Controllers/LoginController.cs @@ -0,0 +1,143 @@ +锘縰sing Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Mvc; +using Microsoft.Extensions.Logging; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using BarCode.Web.Core.Dto.Login; +using BarCode.Web.Core.Internal.Results; +using BarCode.Web.Domain.IService.Public; +using BarCode.Web.Domain.Values; + +namespace BarCode.Web.Api.Controllers +{ + /// + /// 鐧诲綍鎺ュ彛 + /// + [Route("api/[controller]")] + [ApiController] + public class LoginController : ControllerBase + { + private readonly ILoginService _loginService; + private readonly ILogger _logger; + public LoginController(ILoginService loginService,ILogger logger) + { + this._logger = logger; + this._loginService = loginService; + + } + + /// + /// 鐧诲綍 + /// + /// + /// + [HttpGet] + [Route("LoginIn")] + public async Task> LoginIn([FromQuery] string code) + { + //var result = await _loginService.GetUserInfoAsync(code); + var result = await _loginService.GetUserInfoByCode(code); + return result; + } + + /// + /// 鐧诲綍-APP鍜屽皬绋嬪簭 + /// + /// + /// + [HttpPost] + [Route("LoginInPwd")] + public async Task> LoginInPwd([FromBody] LoginRequest dto) + { + var result = await _loginService.GetUserInfo(dto.UserName,dto.Password); + return result; + } + + /// + /// 閫鍑虹櫥褰 + /// + /// + [HttpPost] + [Route("LoginOut")] + public async Task LoginOut() + { + string authorization = this.HttpContext.Request.Headers["Authorization"]; + //if (string.IsNullOrEmpty(authorization)) + //{ + // return Result.ReFailure(BaseResultCodes.UnAuthorized); + //} + + //if (logininfo == null || logininfo.UserInfo == null) + // return Result.ReFailure(BaseResultCodes.UnAuthorized); + if (!string.IsNullOrEmpty(authorization)) + { + var logininfo = _loginService.GetLoginInfo(authorization); + if (logininfo != null && logininfo.UserInfo != null) + { + var dto = new LoginOutDto() + { + UcId = logininfo.UserInfo.UcId.ToString(), + SessionId = logininfo.UserInfo.SeesionId, + Token = logininfo.TokenInfo.Token, + AccessToken = logininfo.TokenInfo.PhpToken, + RefreshToken=logininfo.TokenInfo.RefreshToken, + ExpiresIn = logininfo.TokenInfo.Expired + }; + var res = await _loginService.LoginOut(dto); + } + } + return Result.ReSuccess(); + } + /// + /// PHP鍗曠偣閫鍑轰娇鐢 + /// + /// + [HttpGet] + [Route("LoginOutSingle")] + public async Task LoginOutSingle() + { + this.HttpContext.Request.Cookies.TryGetValue("PHPSESSID", out string value); + if (string.IsNullOrEmpty(value)) + value = string.Empty; + if (!string.IsNullOrEmpty(value)) + await _loginService.LoginOutSingleAsync(value); + return Result.ReSuccess(); + } + + /// + /// 鑿滃崟鍒楄〃 + /// + /// + [HttpGet] + [Route("Menus")] + public async Task>> GetMenuList() + { + var loginInfo = _loginService.GetLoginInfo(this.HttpContext.Request.Headers["Authorization"]); + if (loginInfo == null || loginInfo.UserInfo == null) + return Result>.ReFailure(ResultCodes.Token_Invalid_Error); + + _logger.LogInformation($"鐢ㄦ埛ID锛歿loginInfo.UserInfo.UcId}"); + var list = await _loginService.GetMenuList(loginInfo.UserInfo.UcId); + _logger.LogInformation($"鑿滃崟鏁伴噺锛歿list.Count}"); + if (list.Count == 0) + { + //璋冪敤鍗曠偣鐨勯鍑烘帴鍙 + var dto = new LoginOutDto() + { + UcId = loginInfo.UserInfo.UcId.ToString(), + SessionId = loginInfo.UserInfo.SeesionId, + Token = loginInfo.TokenInfo.Token, + AccessToken = loginInfo.TokenInfo.PhpToken, + ExpiresIn = loginInfo.TokenInfo.Expired + + }; + await _loginService.LoginOut(dto); + return Result>.ReFailure(ResultCodes.NoRoot); + } + var res = Result>.ReSuccess(list); + return res; + } + } +} diff --git a/src/BarCode.Web.Api/Controllers/MaterialController.cs b/src/BarCode.Web.Api/Controllers/MaterialController.cs new file mode 100644 index 0000000..ee7f664 --- /dev/null +++ b/src/BarCode.Web.Api/Controllers/MaterialController.cs @@ -0,0 +1,118 @@ +锘縰sing AutoMapper; +using BarCode.Web.Core.Dto.Erp; +using BarCode.Web.Core.Help; +using BarCode.Web.Core.Internal.Results; +using BarCode.Web.Domain.Entitys; +using BarCode.Web.Domain.Infrastructure; +using BarCode.Web.Domain.IService.Public; +using BarCode.Web.Domain.Options; +using BarCode.Web.Domain.Services; +using BarCode.Web.Domain.Services.Public; +using BarCode.Web.Domain.Values; +using BarCode.Web.Repositories; +using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Mvc; +using Microsoft.Extensions.Caching.Memory; +using Microsoft.Extensions.Options; +using Newtonsoft.Json; + +namespace BarCode.Web.Api.Controllers +{ + /// + /// 鐗╂枡 + /// + [Route("api/[controller]")] + [ApiController] + public class MaterialController : ControllerBase + { + private IMapper _mapper; + private ILogger _logger; + private IErpService _erpService; + private IMaterialsRepositories _materialsRepositories; + private ErpOptions _erpOptions; + private readonly IMemoryCache _memoryCache; + public MaterialController(IMapper mapper, ILogger logger, IErpService erpService, + IMaterialsRepositories materialsRepositories, IOptions erpOptions, IMemoryCache memoryCache) + { + _mapper = mapper; + _logger = logger; + _erpService = erpService; + _materialsRepositories = materialsRepositories; + this._erpOptions = erpOptions.Value; + this._memoryCache = memoryCache; + } + + /// + /// 鍒锋柊鐗╂枡 69鏉$爜鎴杋d32杩涘埗 + /// + /// 鐗╂枡缂栫爜 + /// 69 鏉$爜,id id32杩涘埗,other 鍚嶅瓧鍜岃鏍煎瀷鍙 + /// + [HttpGet] + [Route("Refresh/{number}/{type}")] + public async Task Refresh([FromRoute] string number, [FromRoute] string type) + { + if (string.IsNullOrEmpty(number)) + return Result.ReFailure("鐗╂枡缂栫爜涓嶈兘涓虹┖", 556677); + if (string.IsNullOrEmpty(type) || (!type.Equals("69") && !type.Equals("id")&& !type.Equals("other"))) + return Result.ReFailure("绫诲瀷鍙兘鏄69鎴杋d鎴杘ther", 556677); + + List numbers = new List(); + numbers.Add(number); + + var list = await _materialsRepositories.GetEntityList(numbers); + if (list.Count() <= 0) return Result.ReFailure(ResultCodes.MateriaNoData); + + var mDtos = await _erpService.BillQueryForMaterialByNumbers(numbers); + if (!mDtos.IsSuccess) return Result.ReFailure(mDtos.Message, mDtos.Status); + if (mDtos.Data.Count() <= 0) return Result.ReFailure(ResultCodes.MateriaNoData); + + var materials = _memoryCache.Get>(_erpOptions.cache_materail_key); + + List update_list = new List(); + foreach (var m in mDtos.Data) + { + var entity = list.FirstOrDefault(f => f.MaterialNumber.Equals(m.MaterialNumber)); + if (entity == null) continue; + if (type.Equals("69")) + { + entity.BarCode = m.BarCode.Trim(); + update_list.Add(entity); + } + if (type.Equals("id")) + { + entity.IdConvertBar = m.IdConvertBar.Trim(); + update_list.Add(entity); + } + if (type.Equals("other")) + { + entity.MaterialName = m.MaterialName; + entity.Specifications = m.Specifications; + update_list.Add(entity); + } + + //淇敼缂撳瓨 + if (materials == null) continue; + var entity_cache = materials.FirstOrDefault(f => f.MaterialNumber.Equals(m.MaterialNumber)); + if (entity_cache == null) continue; + if (type.Equals("69")) + entity_cache.BarCode = m.BarCode.Trim(); + if (type.Equals("id")) + entity_cache.IdConvertBar = m.IdConvertBar.Trim(); + if (type.Equals("other")) + { + entity_cache.MaterialName = m.MaterialName; + entity_cache.Specifications = m.Specifications; + } + + } + //淇敼缂撳瓨 + if (materials != null && materials.Count() > 0) + { + _memoryCache.Set(_erpOptions.cache_materail_key, materials, new MemoryCacheEntryOptions().SetAbsoluteExpiration(TimeSpan.FromMinutes(DateTimeUtil.GetTotalMinutesTimeSpan()))); + } + await _materialsRepositories.UpdateRange(update_list); + return Result.ReSuccess(); + } + } +} diff --git a/src/BarCode.Web.Api/Controllers/SecurityController.cs b/src/BarCode.Web.Api/Controllers/SecurityController.cs new file mode 100644 index 0000000..2218df0 --- /dev/null +++ b/src/BarCode.Web.Api/Controllers/SecurityController.cs @@ -0,0 +1,59 @@ +锘縰sing BarCode.Web.Core.Dto.SecurityNumbers; +using BarCode.Web.Core.Dto.SerialNumbers; +using BarCode.Web.Core.Help; +using BarCode.Web.Core.Internal.Results; +using BarCode.Web.Domain.Infrastructure; +using BarCode.Web.Domain.Values; +using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Mvc; +using Newtonsoft.Json; +using System.Text.Json.Serialization; +using System.Text.RegularExpressions; + +namespace BarCode.Web.Api.Controllers +{ + [Route("api/[controller]")] + [ApiController] + public class SecurityController : ControllerBase + { + public readonly ISecurityNumbersRepositories _securityNumbersRepositories; + public readonly ILogger _logger; + public SecurityController(ISecurityNumbersRepositories securityNumbersRepositories, ILogger logger) + { + _securityNumbersRepositories = securityNumbersRepositories; + _logger = logger; + } + /// + /// 鑾峰彇搴忓垪鍙蜂俊鎭 + /// + /// 闃蹭吉鐮 + /// + [HttpGet] + [Route("Get")] + public async Task> Get([FromQuery] string security) + { + _logger.LogInformation($"璇锋眰闃蹭吉鐮:{security}"); + var zz = "^[0-9A-Za-z]{6,15}$"; + Regex regex = new Regex(zz); + if (!regex.IsMatch(security)) return Result.ReSuccess(new SecurityResponse()); + + var res = await _securityNumbersRepositories.GetEntity(security); + if (res == null) return Result.ReSuccess(new SecurityResponse()); + + res.Get(); + res = await _securityNumbersRepositories.Edit(res); + //涓轰簡璁╁墠绔彲浠ュ仛璇█鍒ゆ柇 杩欎釜鎺ュ彛鎵鏈夐敊璇兘鎻愮ず500 + if (res == null) return Result.ReFailure(BaseResultCodes.UnknowError); + + var response = new SecurityResponse() + { + Security = res.SecurityNumber, + QueryCount = res.QueryCount, + IsOneQuery = res.QueryCount == 1 ? true : false, + QueryTime = res.QueryTime.DateToStringSeconds() + }; + _logger.LogInformation($"璇锋眰闃蹭吉鐮佽繑鍥:{JsonConvert.SerializeObject(response)}"); + return Result.ReSuccess(response); + } + } +} diff --git a/src/BarCode.Web.Api/Controllers/SecurityNumberController.cs b/src/BarCode.Web.Api/Controllers/SecurityNumberController.cs new file mode 100644 index 0000000..9816bab --- /dev/null +++ b/src/BarCode.Web.Api/Controllers/SecurityNumberController.cs @@ -0,0 +1,189 @@ +锘縰sing AutoMapper; +using BarCode.Web.Core.Dto.SecurityNumbers; +using BarCode.Web.Core.Dto; +using BarCode.Web.Core.Help; +using BarCode.Web.Core.Internal.Results; +using BarCode.Web.Domain.Infrastructure; +using BarCode.Web.Domain.IService.Public; +using BarCode.Web.Domain.IService; +using BarCode.Web.Domain.Options; +using BarCode.Web.Domain.Values; +using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Mvc; +using Microsoft.Extensions.Options; +using BarCode.Web.Core.Dto.SerialNumbers; +using BarCode.Web.Domain.Services; +using BarCode.Web.Core; + +namespace BarCode.Web.Api.Controllers +{ + /// + /// 闃蹭吉鐮 + /// + [Route("api/[controller]")] + [ApiController] + public class SecurityNumberController : ControllerBase + { + private readonly IMapper _mapper; + private readonly ILoginService _loginService; + private readonly ISecurityNumbersRepositories _securityNumbersRepositories; + private readonly ISecurityNumberService _securityNumberService; + private readonly IExportExcelService _exportExcelService; + private readonly QiniuOptions _option; + private readonly ISecurityGenerateRecordRepositories _sGenerateRecordRepositories; + public SecurityNumberController(IMapper mapper, ILoginService loginService, ISecurityNumbersRepositories SecurityNumbersRepositories, + ISecurityNumberService SecurityNumberService, IExportExcelService exportExcelService, + IOptions option, ISecurityGenerateRecordRepositories sGenerateRecordRepositories) + { + _mapper = mapper; + _loginService = loginService; + _securityNumbersRepositories = SecurityNumbersRepositories; + _securityNumberService = SecurityNumberService; + _exportExcelService = exportExcelService; + _option = option?.Value; + _sGenerateRecordRepositories = sGenerateRecordRepositories; + } + /// + /// 闃蹭吉鐮佺敓鎴愯褰曞垪琛 + /// + /// + /// + [HttpPost] + [Route("GetGenerateRecordList")] + public async Task> GetGenerateRecordList([FromBody] SecurityGenerateRecordQueryRequest dto) + { + var loginInfo = _loginService.GetLoginInfo(this.HttpContext.Request.Headers["Authorization"]); + if (loginInfo == null || loginInfo.UserInfo == null) + return ResultPagedList.ReFailure(ResultCodes.Token_Invalid_Error); + + var (list, count) = await _sGenerateRecordRepositories.GetListAsync(dto, loginInfo); + var result = ResultPagedList.ReSuccess(list, count); + return result; + } + /// + /// 闃蹭吉鐮佸垪琛 + /// + /// + /// + [HttpPost] + [Route("GetList")] + public async Task> GetPagedList([FromBody] SecurityNumberQueryRequest dto) + { + var loginInfo = _loginService.GetLoginInfo(this.HttpContext.Request.Headers["Authorization"]); + if (loginInfo == null || loginInfo.UserInfo == null) + return ResultPagedList.ReFailure(ResultCodes.Token_Invalid_Error); + + var (list, count) = await _securityNumbersRepositories.GetListAsync(dto, loginInfo); + var result = ResultPagedList.ReSuccess(list, count); + return result; + } + /// + /// 闃蹭吉鐮佺敓鎴愯褰曢〉闈-涓嬭浇鏉$爜 + /// + /// + /// + [HttpPost] + [Route("ExportAll")] + public Task> ExportAll(OperateRequest dto) + { + var loginInfo = _loginService.GetLoginInfo(this.HttpContext.Request.Headers["Authorization"]); + if (loginInfo == null) + return Task.FromResult(Result.ReFailure(ResultCodes.Token_Invalid_Error)); + + var entityList = _sGenerateRecordRepositories.GetEntityList(dto.Ids).GetAwaiter().GetResult(); + if (entityList.Count < 0)return Task.FromResult(Result.ReFailure(ResultCodes.NoDateError)); + string orgCode = entityList.First().OrgCode; + //鍙嶅啓涓嬭浇鏁版嵁 + var resSuccess = this.DownLoad(new OperateSecurityNumberRequest() { GenerateRecordIds = dto.Ids, IsAll = true }).GetAwaiter().GetResult(); + if (!resSuccess.IsSuccess) Task.FromResult(Result.ReFailure(resSuccess.Message, resSuccess.Status)); + + string fileName = FileDownLoadOrderType.SecurityNumbers.GetRemark() + DateTime.Now.DateToStringSecondsNoSpace() + ".xlsx"; + string res = _option.Url + fileName; + + SecurityNumbersExportRequest request = new SecurityNumbersExportRequest(); + request.Ids = dto.Ids; + + Task.Run(async () => + { + await _exportExcelService.ExportList(request, fileName, loginInfo.UserInfo.UcId, loginInfo, FileDownLoadOrderType.SecurityNumbers, orgCode); + }); + + return Task.FromResult(Result.ReSuccess(res)); + } + /// + /// 闃蹭吉鐮侀〉闈-鏉$爜涓嬭浇 + /// + /// + /// + [HttpPost] + [Route("Export")] + public Task> Export([FromBody] SecurityNumberQueryRequest dto) + { + var loginInfo = _loginService.GetLoginInfo(this.HttpContext.Request.Headers["Authorization"]); + if (loginInfo == null) + return Task.FromResult(Result.ReFailure(ResultCodes.Token_Invalid_Error)); + + var entity = _sGenerateRecordRepositories.GetEntity(dto.GenerateRecordId).GetAwaiter().GetResult(); + if (entity==null) return Task.FromResult(Result.ReFailure(ResultCodes.NoDateError)); + string orgCode = entity.OrgCode; + //鍙嶅啓涓嬭浇鏁版嵁 + Result resSuccess; + if (dto.SecurityNumbers.Count() > 0) + { + resSuccess = this.DownLoad(new OperateSecurityNumberRequest() + { + GenerateRecordIds = new List() { dto.GenerateRecordId }, + IsAll = false, + SecurityNumbers = dto.SecurityNumbers + }).GetAwaiter().GetResult(); + } + else + { + resSuccess = this.DownLoad(new OperateSecurityNumberRequest() + { + GenerateRecordIds = new List() { dto.GenerateRecordId }, + IsAll = true + }).GetAwaiter().GetResult(); + } + if (!resSuccess.IsSuccess) return Task.FromResult(Result.ReFailure(resSuccess.Message, resSuccess.Status)); + + string fileName = FileDownLoadOrderType.SecurityNumberInfo.GetRemark() + DateTime.Now.DateToStringSecondsNoSpace() + ".xlsx"; + string res = _option.Url + fileName; + + Task.Run(async () => + { + await _exportExcelService.ExportList(dto, fileName, loginInfo.UserInfo.UcId, loginInfo, FileDownLoadOrderType.SecurityNumberInfo, orgCode); + }); + + return Task.FromResult(Result.ReSuccess(res)); + } + /// + /// 涓嬭浇(涓鑸悗绔唴閮ㄨ皟鐢) + /// + /// + /// + [HttpPost] + [Route("DownLoad")] + public async Task DownLoad(OperateSecurityNumberRequest dto) + { + var loginInfo = _loginService.GetLoginInfo(this.HttpContext.Request.Headers["Authorization"]); + if (loginInfo == null || loginInfo.UserInfo == null) + return Result.ReFailure(ResultCodes.Token_Invalid_Error); + return await _securityNumberService.DownLoad(dto); + } + /// + /// 鐢熸垚搴忓垪鍙 + /// + /// + /// + [HttpPost] + [Route("Generate")] + public async Task Generate(GenerateSecurityNumberRequest dto) + { + var loginInfo = _loginService.GetLoginInfo(this.HttpContext.Request.Headers["Authorization"]); + if (loginInfo == null || loginInfo.UserInfo == null) + return Result.ReFailure(ResultCodes.Token_Invalid_Error); + return await _securityNumberService.Generate(dto, loginInfo); + } + } +} diff --git a/src/BarCode.Web.Api/Controllers/SerialNumberController.cs b/src/BarCode.Web.Api/Controllers/SerialNumberController.cs new file mode 100644 index 0000000..e003ac8 --- /dev/null +++ b/src/BarCode.Web.Api/Controllers/SerialNumberController.cs @@ -0,0 +1,309 @@ +锘縰sing AutoMapper; +using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Mvc; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using BarCode.Web.Core.Internal.Results; +using BarCode.Web.Domain.Infrastructure; +using BarCode.Web.Domain.IService.Public; +using BarCode.Web.Domain.Values; +using BarCode.Web.Core.Dto.SerialNumbers; +using BarCode.Web.Repositories; +using BarCode.Web.Core.Dto; +using BarCode.Web.Domain.IService; +using BarCode.Web.Core.Help; +using BarCode.Web.Core; +using BarCode.Web.Domain.Services; +using BarCode.Web.Domain.Options; +using Microsoft.Extensions.Options; +using NPOI.SS.Formula.Functions; +using System.Diagnostics.Eventing.Reader; +using BarCode.Web.Core.Dto.Box; +using System.Text.RegularExpressions; + +namespace BarCode.Web.Api.Controllers +{ + /// + /// 搴忓垪鍙 + /// + [Route("api/[controller]")] + [ApiController] + public class SerialNumberController : ControllerBase + { + private readonly IMapper _mapper; + private readonly ILoginService _loginService; + private readonly ISerialNumbersRepositories _serialNumbersRepositories; + private readonly ISerialNumberService _serialNumberService; + private readonly IExportExcelService _exportExcelService; + private readonly QiniuOptions _option; + private readonly ISGenerateRecordRepositories _sGenerateRecordRepositories; + public SerialNumberController(IMapper mapper, ILoginService loginService, ISerialNumbersRepositories serialNumbersRepositories, + ISerialNumberService serialNumberService, IExportExcelService exportExcelService, + IOptions option, ISGenerateRecordRepositories sGenerateRecordRepositories) + { + _mapper = mapper; + _loginService = loginService; + _serialNumbersRepositories = serialNumbersRepositories; + _serialNumberService = serialNumberService; + _exportExcelService = exportExcelService; + _option = option?.Value; + _sGenerateRecordRepositories = sGenerateRecordRepositories; + } + /// + /// 搴忓垪鐮佺敓鎴愯褰曞垪琛 + /// + /// + /// + [HttpPost] + [Route("GetGenerateRecordList")] + public async Task> GetGenerateRecordList([FromBody] SGenerateRecordQueryRequest dto) + { + var loginInfo = _loginService.GetLoginInfo(this.HttpContext.Request.Headers["Authorization"]); + if (loginInfo == null || loginInfo.UserInfo == null) + return ResultPagedList.ReFailure(ResultCodes.Token_Invalid_Error); + + var (list, count) = await _sGenerateRecordRepositories.GetListAsync(dto, loginInfo); + var result = ResultPagedList.ReSuccess(list, count); + return result; + } + /// + /// 搴忓垪鐮佸垪琛 + /// + /// + /// + [HttpPost] + [Route("GetList")] + public async Task> GetPagedList([FromBody] SerialNumberQueryRequest dto) + { + var loginInfo = _loginService.GetLoginInfo(this.HttpContext.Request.Headers["Authorization"]); + if (loginInfo == null || loginInfo.UserInfo == null) + return ResultPagedList.ReFailure(ResultCodes.Token_Invalid_Error); + + if (!string.IsNullOrEmpty(dto.NumberCodeBegin) + && (!Regex.Match(dto.NumberCodeBegin, "^[0-9]*$").Success || dto.NumberCodeBegin.Length < 12)) + return ResultPagedList.ReFailure(ResultCodes.NumberCode_Invalid_Error); + if (!string.IsNullOrEmpty(dto.NumberCodeEnd) + && (!Regex.Match(dto.NumberCodeEnd, "^[0-9]*$").Success || dto.NumberCodeEnd.Length < 12)) + return ResultPagedList.ReFailure(ResultCodes.NumberCode_Invalid_Error); + + var (list, count) = await _serialNumbersRepositories.GetListAsync(dto, loginInfo); + var result = ResultPagedList.ReSuccess(list, count); + return result; + } + /// + /// 鏉$爜鐢熸垚璁板綍椤甸潰-涓嬭浇鏉$爜 + /// + /// + /// + [HttpPost] + [Route("ExportAll")] + public Task> ExportAll(OperateRequest dto) + { + var loginInfo = _loginService.GetLoginInfo(this.HttpContext.Request.Headers["Authorization"]); + if (loginInfo == null) + return Task.FromResult(Result.ReFailure(ResultCodes.Token_Invalid_Error)); + + var entityList = _sGenerateRecordRepositories.GetEntityList(dto.Ids).GetAwaiter().GetResult(); + if (entityList.Count < 0) return Task.FromResult(Result.ReFailure(ResultCodes.NoDateError)); + string orgCode = entityList.First().OrgCode; + + //鍙嶅啓涓嬭浇鏁版嵁 + var resSuccess = this.DownLoad(new OperateSerialNumberRequest() { GenerateRecordIds = dto.Ids, IsAll = true }).GetAwaiter().GetResult(); + if (!resSuccess.IsSuccess) Task.FromResult(Result.ReFailure(resSuccess.Message, resSuccess.Status)); + + string fileName = FileDownLoadOrderType.SerialNumbers.GetRemark() + DateTime.Now.DateToStringSecondsNoSpace() + ".xlsx"; + string res = _option.Url + fileName; + + SerialNumbersExportRequest request = new SerialNumbersExportRequest(); + request.Ids = dto.Ids; + + Task.Run(async () => + { + await _exportExcelService.ExportList(request, fileName, loginInfo.UserInfo.UcId, loginInfo, FileDownLoadOrderType.SerialNumbers, orgCode); + }); + + return Task.FromResult(Result.ReSuccess(res)); + } + /// + /// 搴忓垪鐮侀〉闈-鏉$爜涓嬭浇 + /// + /// + /// + [HttpPost] + [Route("Export")] + public Task> Export([FromBody] SerialNumberQueryRequest dto) + { + var loginInfo = _loginService.GetLoginInfo(this.HttpContext.Request.Headers["Authorization"]); + if (loginInfo == null) + return Task.FromResult(Result.ReFailure(ResultCodes.Token_Invalid_Error)); + + var entity = _sGenerateRecordRepositories.GetEntity(dto.GenerateRecordId).GetAwaiter().GetResult(); + if (entity == null) return Task.FromResult(Result.ReFailure(ResultCodes.NoDateError)); + string orgCode = entity.OrgCode; + + //鍙嶅啓涓嬭浇鏁版嵁 + Result resSuccess; + if (dto.SerialNumbers.Count() > 0) + { + resSuccess = this.DownLoad(new OperateSerialNumberRequest() + { + GenerateRecordIds = new List() { dto.GenerateRecordId }, + IsAll = false, + SerialNumbers = dto.SerialNumbers + }).GetAwaiter().GetResult(); + } + else + { + resSuccess = this.DownLoad(new OperateSerialNumberRequest() + { + GenerateRecordIds = new List() { dto.GenerateRecordId }, + IsAll = true + }).GetAwaiter().GetResult(); + } + if (!resSuccess.IsSuccess) return Task.FromResult(Result.ReFailure(resSuccess.Message, resSuccess.Status)); + + string fileName = FileDownLoadOrderType.SerialNumberInfo.GetRemark() + DateTime.Now.DateToStringSecondsNoSpace() + ".xlsx"; + string res = _option.Url + fileName; + + Task.Run(async () => + { + await _exportExcelService.ExportList(dto, fileName, loginInfo.UserInfo.UcId, loginInfo, FileDownLoadOrderType.SerialNumberInfo, orgCode); + }); + + return Task.FromResult(Result.ReSuccess(res)); + } + /// + /// 鐢熸垚搴忓垪鍙 + /// + /// + /// + [HttpPost] + [Route("Generate")] + public async Task Generate(GenerateSerialNumberRequest dto) + { + var loginInfo = _loginService.GetLoginInfo(this.HttpContext.Request.Headers["Authorization"]); + if (loginInfo == null || loginInfo.UserInfo == null) + return Result.ReFailure(ResultCodes.Token_Invalid_Error); + return await _serialNumberService.Generate(dto, loginInfo); + } + + /// + /// 鎵撳嵃 + /// + /// + /// + [HttpPost] + [Route("Print")] + public async Task Print(OperateSerialNumberRequest dto) + { + var loginInfo = _loginService.GetLoginInfo(this.HttpContext.Request.Headers["Authorization"]); + if (loginInfo == null || loginInfo.UserInfo == null) + return Result.ReFailure(ResultCodes.Token_Invalid_Error); + return await _serialNumberService.Print(dto); + } + + /// + /// 涓嬭浇(涓鑸悗绔唴閮ㄨ皟鐢) + /// + /// + /// + [HttpPost] + [Route("DownLoad")] + public async Task DownLoad(OperateSerialNumberRequest dto) + { + var loginInfo = _loginService.GetLoginInfo(this.HttpContext.Request.Headers["Authorization"]); + if (loginInfo == null || loginInfo.UserInfo == null) + return Result.ReFailure(ResultCodes.Token_Invalid_Error); + return await _serialNumberService.DownLoad(dto); + } + + + /// + /// 鑾峰彇搴忓垪鍙蜂俊鎭 + /// + /// 绠盜d + /// + [HttpPost] + [Route("GetByBoxId")] + public async Task> GetByBoxId(SerialNumberByBoxIdQueryRequest dto) + { + var loginInfo = _loginService.GetLoginInfo(this.HttpContext.Request.Headers["Authorization"]); + if (loginInfo == null || loginInfo.UserInfo == null) + return ResultPagedList.ReFailure(ResultCodes.Token_Invalid_Error); + if (dto.BoxId == 0) + return ResultPagedList.ReFailure(ResultCodes.NoDateError); + + var (list, count) = await _serialNumbersRepositories.GetEntityListByBoxId(dto); + var result = ResultPagedList.ReSuccess(list, count); + return result; + } + + + ///// + ///// 鑾峰彇搴忓垪鍙蜂俊鎭 + ///// + ///// 搴忓垪鍙 + ///// 缁勭粐鎴栦緵搴斿晢缂栫爜 + ///// + //[HttpGet] + //[Route("Get")] + //public async Task> Get([FromQuery] string serialNumber, [FromQuery] string orgCode) + //{ + // var loginInfo = _loginService.GetLoginInfo(this.HttpContext.Request.Headers["Authorization"]); + // if (loginInfo == null || loginInfo.UserInfo == null) + // return ResultList.ReFailure(ResultCodes.Token_Invalid_Error); + // if (string.IsNullOrEmpty(orgCode)) + // return ResultList.ReFailure(ResultCodes.NoOrgError); + + // var res = await _serialNumbersRepositories.GetEntityList(serialNumber, orgCode, loginInfo); + // // var res = await _serialNumbersRepositories.GetEntityList(serialNumber, orgCode, loginInfo); + // if (res == null) return ResultList.ReFailure(ResultCodes.SerialNumberNoData); + + // // return ResultList.ReSuccess(res); + // return ResultList.ReSuccess(res.ToList()); + //} + + + /// + /// 鑾峰彇搴忓垪鍙蜂俊鎭 + /// + /// 搴忓垪鍙 + /// 缁勭粐鎴栦緵搴斿晢缂栫爜 + /// + [HttpGet] + [Route("Get")] + public async Task> Get([FromQuery] string serialNumber, [FromQuery] string orgCode) + { + var loginInfo = _loginService.GetLoginInfo(this.HttpContext.Request.Headers["Authorization"]); + if (loginInfo == null || loginInfo.UserInfo == null) + return Result.ReFailure(ResultCodes.Token_Invalid_Error); + if (string.IsNullOrEmpty(orgCode)) + return Result.ReFailure(ResultCodes.NoOrgError); + + var res = await _serialNumbersRepositories.GetEntity(serialNumber, orgCode, loginInfo); + // var res = await _serialNumbersRepositories.GetEntityList(serialNumber, orgCode, loginInfo); + if (res == null) return Result.ReFailure(ResultCodes.SerialNumberNoData); + + // return ResultList.ReSuccess(res); + return Result.ReSuccess(res); + } + + /// + /// 淇敼搴忓垪鐮佺墿鏂 + /// + /// + /// + [HttpPost] + [Route("UpdateMaterial")] + public async Task UpdateMaterial(UpdateMaterialRequest dto) + { + var loginInfo = _loginService.GetLoginInfo(this.HttpContext.Request.Headers["Authorization"]); + if (loginInfo == null || loginInfo.UserInfo == null) + return Result.ReFailure(ResultCodes.Token_Invalid_Error); + return await _serialNumberService.UpdateMaterial(dto); + } + + } +} diff --git a/src/BarCode.Web.Api/Controllers/SysConfigController.cs b/src/BarCode.Web.Api/Controllers/SysConfigController.cs new file mode 100644 index 0000000..9423ddb --- /dev/null +++ b/src/BarCode.Web.Api/Controllers/SysConfigController.cs @@ -0,0 +1,180 @@ +锘縰sing AutoMapper; +using BarCode.Web.Core.Dto.Erp; +using BarCode.Web.Core.Dto.Erp.Org; +using BarCode.Web.Core.Dto.Erp.Supplier; +using BarCode.Web.Core.Dto.Login; +using BarCode.Web.Core.Dto.SingleData; +using BarCode.Web.Core.Internal.Results; +using BarCode.Web.Domain.Infrastructure; +using BarCode.Web.Domain.IService.Public; +using BarCode.Web.Domain.Options; +using BarCode.Web.Domain.Values; +using BarCode.Web.Domain.Values.Single; +using BarCode.Web.Repositories; +using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Mvc; +using Microsoft.Extensions.Caching.Memory; +using Microsoft.Extensions.Options; +using NPOI.POIFS.FileSystem; +using System.ComponentModel.Design; + +namespace BarCode.Web.Api.Controllers +{ + /// + /// 绯荤粺閰嶇疆 + /// + [Route("api/[controller]")] + [ApiController] + public class SysConfigController : ControllerBase + { + private readonly ILoginService _loginService; + private readonly IBasicsRepositories _basicsRepositories; + private readonly IErpService _erpService; + private readonly ISingleDataService _singleDataService; + private readonly IMapper _mapper; + private readonly IErpBasicDataExtendService _erpBasicDataExtendService; + private readonly ILogger _logger; + private ErpOptions _erpOptions; + private readonly IMemoryCache _memoryCache; + + public SysConfigController(ILoginService loginService, IBasicsRepositories basicsRepositories, IOptions erpOptions, IErpService erpService, ISingleDataService singleDataService, IMemoryCache memoryCache, + IMapper mapper, IErpBasicDataExtendService erpBasicDataExtendService, + ILogger logger) + { + this._erpOptions = erpOptions?.Value; + this._memoryCache = memoryCache; + _loginService = loginService; + _basicsRepositories = basicsRepositories; + _erpService = erpService; + _singleDataService = singleDataService; + _mapper = mapper; + _erpBasicDataExtendService = erpBasicDataExtendService; + _logger = logger; + } + /// + /// 鑾峰彇鐗╂枡锛涢氳繃瑙勬牸鍨嬪彿 + /// + /// + /// + [HttpGet] + [Route("GetMaterialList")] + public async Task> GetMaterialList([FromQuery] string speci) + { + var loginInfo = _loginService.GetLoginInfo(this.HttpContext.Request.Headers["Authorization"]); + if (loginInfo == null || loginInfo.UserInfo == null) + return ResultList.ReFailure(ResultCodes.Token_Invalid_Error); + + var materials = _memoryCache.Get>(_erpOptions.cache_materail_key); + if (materials == null) + { + var res = await _erpService.BillQueryForMaterial(); + if (res.IsSuccess) + materials = res.Data.ToList(); + } + if (materials == null) return ResultList.ReFailure(ResultCodes.MateriaNoData); + //娌℃湁鐗╂枡Id 32杩涘埗鐨勪篃杩囨护鎺 + var result = materials.Where(x => x.Specifications.Contains(speci) + && !string.IsNullOrEmpty(x.IdConvertBar.Trim())).Take(30).ToList(); + return ResultList.ReSuccess(result); + } + /// + /// 鑾峰彇渚涘簲鍟-erp鍩虹鏁版嵁 + /// 浣跨敤code鍋氶敭 + /// + /// 渚涘簲鍟嗗悕瀛 + /// 缁勭粐缂栫爜 + /// + [HttpGet] + [Route("GetSupplierOrOrg")] + public async Task> GetSupplierOrOrg([FromQuery] string? name, [FromQuery] string orgCode) + { + var loginInfo = _loginService.GetLoginInfo(this.HttpContext.Request.Headers["Authorization"]); + if (loginInfo == null) + return ResultList.ReFailure(ResultCodes.Token_Invalid_Error); + + var result = await _singleDataService.GetSingleDataNoCache, NameRequest, SysConfigAction>( + new NameRequest(name, loginInfo.UserInfo.CompanyId), SysConfigAction.GetSupplierByNameAndCompany, SingleControllerType.SysConfig); + if (!result.IsSuccess) + return ResultList.ReFailure(result.Message, result.Status); + + List suppliers = result.Data.ToList(); + //suppliers = suppliers.Where(w => w.ErpOrgCode.Equals(orgCode)).ToList(); + if (!string.IsNullOrEmpty(name)) + suppliers = suppliers.Where(w => w.Name.Contains(name)).ToList(); + List pullList = new List(); + foreach (var c in suppliers) + { + pullList.Add(new PullDownStrResponse() + { + Id = "s_" + c.Id.ToString(), + Name = c.Name, + Code = "s_" + c.Code + }); + } + + //var org_result = await _erpService.BillQueryForOrg(); + //List orgs = org_result.Data.ToList(); + //if (!string.IsNullOrEmpty(name)) + // orgs = orgs.Where(w => w.Name.Contains(name)).ToList(); + //foreach (var c in orgs) + //{ + // pullList.Add(new PullDownStrResponse() + // { + // Id = "o_" + c.Id.ToString(), + // Name = c.Name, + // Code = "o_" + c.Number + // }); + //} + + return ResultList.ReSuccess(pullList); + } + /// + /// 鑾峰彇缁勭粐-erp鍩虹鏁版嵁 + /// 浣跨敤 code鍋氶敭 + /// + /// + [HttpGet] + [Route("GetOrg")] + public async Task> GetOrg([FromQuery] string? name) + { + var loginInfo = _loginService.GetLoginInfo(this.HttpContext.Request.Headers["Authorization"]); + if (loginInfo == null) + return ResultList.ReFailure(ResultCodes.Token_Invalid_Error); + + List pullList = new List(); + + if (loginInfo.UserInfo.Identity == 2) + { + pullList.Add(new PullDownStrResponse() + { + Id = loginInfo.UserInfo.SupplierId.ToString(), + Name = loginInfo.UserInfo.SupplierName, + Code = "s_" + loginInfo.UserInfo.SupplierCode, + IsDefault = true + }); ; + return ResultList.ReSuccess(pullList); + } + var result = await _singleDataService.GetSingleDataNoCache, UserRequest, SysConfigAction>( + new UserRequest(loginInfo.UserInfo.UcId), SysConfigAction.GetOrgByUser, SingleControllerType.SysConfig); + if (!result.IsSuccess) + return ResultList.ReFailure(result.Message, result.Status); + + List orgs = result.Data.ToList(); + if (!string.IsNullOrEmpty(name)) + orgs = orgs.Where(w => w.Name.Contains(name)).ToList(); + foreach (var c in orgs) + { + pullList.Add(new PullDownStrResponse() + { + Id = c.Id.ToString(), + Name = c.Name, + Code = "o_" + c.ErpOrgCode + }); + } + //榛樿鏄剧ず绗竴涓 + pullList.First().IsDefault = true; + + return ResultList.ReSuccess(pullList); + } + } +} diff --git a/src/BarCode.Web.Api/Controllers/TestController.cs b/src/BarCode.Web.Api/Controllers/TestController.cs new file mode 100644 index 0000000..e42223d --- /dev/null +++ b/src/BarCode.Web.Api/Controllers/TestController.cs @@ -0,0 +1,508 @@ +锘縰sing AutoMapper; +using AutoMapper.Internal.Mappers; +using BarCode.Web.Core.Dto.Box; +using BarCode.Web.Core.Dto.Erp.Org; +using BarCode.Web.Core.Dto.SerialNumbers; +using BarCode.Web.Core.Help; +using BarCode.Web.Core.Internal.Results; +using BarCode.Web.Domain.Entitys; +using BarCode.Web.Domain.Infrastructure; +using BarCode.Web.Domain.IService; +using BarCode.Web.Domain.IService.Public; +using BarCode.Web.Domain.Services; +using BarCode.Web.Domain.Services.Public; +using BarCode.Web.Domain.Values; +using BarCode.Web.Repositories; +using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Mvc; +using Microsoft.EntityFrameworkCore.Storage; +using Newtonsoft.Json; +using NPOI.SS.Formula.Functions; +using StackExchange.Redis; +using System.ComponentModel.Design; +using System.Diagnostics.Eventing.Reader; +using System.Json; +using System.Runtime.InteropServices.JavaScript; +using System.Text.Json.Nodes; +using System.Text.RegularExpressions; + +namespace BarCode.Web.Api.Controllers +{ + [Route("api/[controller]")] + [ApiController] + public class TestController : ControllerBase + { + private readonly ILoginService _loginService; + private readonly IFileDownManagerRepositories _repositories; + private readonly IMaterialService _materialService; + private readonly ISerialNumberService _serialNumberService; + private readonly IBoxRepositories _boxRepositories; + private readonly IMapper _mapper; + private readonly ISecurityGenerateRecordRepositories _securityGenerateRecordRepositories; + private IBasicsRepositories _transactionRepositories; + private readonly IBoxService _boxService; + private readonly IErpService _erpService; + private readonly ISGenerateRecordRepositories _sGenerateRecordRepositories; + private readonly ISerialNumbersRepositories _serialNumbersRepositories; + private readonly ISecurityNumbersRepositories _securityNumbersRepositories; + public TestController(ILoginService loginService, IFileDownManagerRepositories repositories, IMaterialService materialService, + ISerialNumberService serialNumberService, IBoxRepositories boxRepositories, IMapper mapper, + ISecurityGenerateRecordRepositories securityGenerateRecordRepositories, IBasicsRepositories transactionRepositories, + IBoxService boxService, IErpService erpService, ISGenerateRecordRepositories sGenerateRecordRepositories, + ISerialNumbersRepositories serialNumbersRepositories, ISecurityNumbersRepositories securityNumbersRepositories) + { + _loginService = loginService; + _repositories = repositories; + _materialService = materialService; + _serialNumberService = serialNumberService; + _boxRepositories = boxRepositories; + _mapper = mapper; + _securityGenerateRecordRepositories = securityGenerateRecordRepositories; + _transactionRepositories = transactionRepositories; + _boxService = boxService; + _erpService = erpService; + _sGenerateRecordRepositories = sGenerateRecordRepositories; + _serialNumbersRepositories = serialNumbersRepositories; + _securityNumbersRepositories = securityNumbersRepositories; + } + [HttpGet] + [Route("Get")] + public async Task Get() + { + //await GetFSer(); + + //Dictionary dic = new Dictionary(); + //dic.Add("ABCD", "1111"); + //dic.Add("ABCE", "2222"); + //dic.Add("ABCF", "3333"); + //dic.Add("BCDD", "4444"); + //var v = from d in dic where d.Value.Equals("2222") select d; + + //var b = v.Select(s => s.Key).ToList(); + + //await _materialService.SyncBar(); + + //await GetSer(); + + //await GetSer(); + //GetBox(); + //await GetBox(); + //string msg = "o_sdf"; + //string s = msg.Substring(0, 2); + //string s2 = msg.Substring(2, msg.Length-2); + + //var supplier_result = await _erpService.BillQueryForSupplier(); + + //DateTime begin = DateTime.Now.AddDays(-1); + //begin = begin.AddHours(-1); + //WmsBoxRequest request = new WmsBoxRequest(begin, DateTime.Now); + //var b = await _boxService.GetCartonListAsync(request); + + // List ids = new List(); + // ids.Add(1);ids.Add(2); + // var bList = await _boxRepositories.GetEntityList(ids); + // foreach(var b in bList) + // { + // //var d= b.Details.FirstOrDefault(f=>f.MaterialNumber=="1"); + // // d.Qty = 2; + // if (b.Id == 1) + // { + // var d = b.Details.FirstOrDefault(f => f.MaterialNumber == "1"); + // d.Qty = 10; + // b.Details.Add(new BoxDetails() + // { + // MaterialNumber = "3", + // Qty = 3 + // }); + // }else + // { + // var d= b.Details.FirstOrDefault(f=>f.MaterialNumber=="2"); + // b.Details.Remove(d); + // } + // } + //var s= await _boxRepositories.EditEntityList(bList); + + + //鎻愪氦浜嬪姟 + // var isSuccess = _transactionRepositories.CommitTransaction(true, _transaction); + //var b=await _boxRepositories.Get(1); + + + + //var c=_mapper.Map(b); + //string exclude = "WXYZ"; + //int? FLength = 9; + //for (int i = 1; i < 100; i++) + //{ + // var bc = Radix.ConvertRadix36((ulong)i, exclude.ToCharArray()).PadLeft(FLength ?? 0, '0'); + // Console.WriteLine($"闃蹭吉鐮亄i} : {bc}"); + //} + //var b = await _boxRepositories.Get(1); + //GenerateSerialNumberRequest r = new GenerateSerialNumberRequest(); + //r.OrgCode = "101"; + //r.Details = new List(); + ////r.Details.Add(new GenerateSerialNumberInfoRequest() + ////{ + //// MaterialId = 260845, + //// MaterialNumber = "AS-005-000-002", + //// Number = 10 + ////}); + //r.Details.Add(new GenerateSerialNumberInfoRequest() + //{ + // IdConvertBar = "", + // MaterialNumber = "G01-12-005834", + // Number = 3 + //}); + //await _serialNumberService.Generate(r, null); + + // await _materialService.SyncNewMaterials(); + //var s= await _repositories.GetList(new Core.Dto.FileDownManagerRequest(), 0); + return Result.ReSuccess(); + } + + private async Task GetBox() + { + string[] arr = System.IO.File.ReadAllLines("E:\\1\\x.txt"); + var sList = GetS(); + //var sList = new List(); + List boxs = new List(); + int i = 0; + foreach (string str in arr) + { + i++; + Console.WriteLine("鎿嶄綔鏉℃暟:" + i); + var strarr = str.Split('\t'); + if (strarr[3] == "NULL") + { + Box box = new Box() + { + CompanyId = 1, + Id = Convert.ToInt32(strarr[2].Replace("CTN", "")), + BoxBillNo = strarr[2], + OrgCode = strarr[0].Replace("-", ""), + SupplierCode = strarr[1].Replace("-", ""), + CreateTime = strarr[6] != "-" ? Convert.ToDateTime(strarr[6]) : DateTime.Now + }; + if (string.IsNullOrEmpty(box.OrgCode) && string.IsNullOrEmpty(box.SupplierCode)) + box.OrgCode = "101"; + boxs.Add(box); + } + else + { + var box = boxs.FirstOrDefault(w => w.BoxBillNo.Equals(strarr[2])); + if (box == null) + { + box = new Box() + { + CompanyId = 1, + Id = Convert.ToInt32(strarr[2].Replace("CTN", "")), + BoxBillNo = strarr[2], + OrgCode = strarr[0].Replace("-", ""), + SupplierCode = strarr[1].Replace("-", ""), + CreateTime = strarr[6] != "-" ? Convert.ToDateTime(strarr[6]) : DateTime.Now, + CartonBeginTime = strarr[7] != "-" ? Convert.ToDateTime(strarr[7]) : null, + CartonEndTime = strarr[8] != "-" ? Convert.ToDateTime(strarr[8]) : null, + Status = strarr[8] != "-" ? BoxStatus.Complete : BoxStatus.NoComplete, + PrintNumber = Convert.ToInt32(strarr[10]) + }; + if (string.IsNullOrEmpty(box.OrgCode) && string.IsNullOrEmpty(box.SupplierCode)) + box.OrgCode = "101"; + + var sers = sList.Where(w => w.BoxId == box.Id && w.MaterialNumber == strarr[3]).Select(s => s.SerialNumber).ToList(); + + box.Details.Add(new BoxDetails() + { + MaterialNumber = strarr[3], + Qty = Convert.ToInt32(strarr[4]), + SerialNumbers = sers + }); + boxs.Add(box); + } + else + { + var sers = sList.Where(w => w.BoxId == box.Id && w.MaterialNumber == strarr[3]).Select(s => s.SerialNumber).ToList(); + + box.Details.Add(new BoxDetails() + { + MaterialNumber = strarr[3], + Qty = Convert.ToInt32(strarr[4]), + SerialNumbers = sers + }); + } + } + } + var lis = boxs.GroupBy(g => new { g.OrgCode, g.SupplierCode }).Select(s => s.Key).ToList(); + + var c = boxs.Where(w => w.CreateTime > DateTime.Now.AddHours(-1)).Count(); + var c1 = boxs.Where(w => w.Status == BoxStatus.Complete).Count(); + var c2 = boxs.Where(w => w.Status == BoxStatus.NoComplete).Count(); + + var res = await _boxRepositories.AddRange(boxs); + } + + private List GetS() + { + List serialNumbers = new List(); + + string[] arr_t = System.IO.File.ReadAllLines("E:\\1\\t.txt"); + long number = 200000000; + foreach (var str in arr_t) + { + var strarr = str.Split('\t'); + try + { + number = number - 1; + var s = new SerialNumbers(); + + s.Id = number; + s.SerialNumber = strarr[1]; + s.OrgCode = strarr[2].Replace("-", ""); + s.SupplierCode = strarr[3].Replace("-", ""); + s.MaterialNumber = strarr[5]; + if (string.IsNullOrEmpty(strarr[6]) || strarr[6] == "-") + s.BoxId = 0; + else + s.BoxId = Convert.ToInt32(strarr[6].ToUpper().Replace("CTN", "")); + if (string.IsNullOrEmpty(strarr[6]) || strarr[6] == "-") + s.IsUse = false; + else + s.IsUse = true; + if (!string.IsNullOrEmpty(strarr[7]) && strarr[7] != "-") + s.CreateTime = Convert.ToDateTime(strarr[7]); + if (!string.IsNullOrEmpty(strarr[8]) && strarr[8] != "-") + s.CompleteCartonTime = Convert.ToDateTime(strarr[8]); + s.NumberCode = ""; + + if (string.IsNullOrEmpty(s.OrgCode) && string.IsNullOrEmpty(s.SupplierCode)) + s.OrgCode = "101"; + serialNumbers.Add(s); + } + catch (Exception ex) + { + Console.WriteLine("鏁版嵁澶勭悊閿欒:" + str); + } + } + return serialNumbers; + //int couont_1 = serialNumbers.Where(w => w.OrgCode == "" && w.SupplierCode == "").Count(); + //int couont_2 = serialNumbers.GroupBy(g =>new { g.MaterialNumber ,g.OrgCode,g.SupplierCode}).Count(); + + //var lis= serialNumbers.GroupBy(g => new { g.OrgCode, g.SupplierCode }).Select(s=>s.Key).ToList(); + } + + private List GetE() + { + List serialNumbers = new List(); + + string[] arr_t = System.IO.File.ReadAllLines("E:\\1\\e.txt"); + long number = 199000000; + foreach (var str in arr_t) + { + var strarr = str.Split('\t'); + try + { + number = number - 1; + var s = new SerialNumbers(); + + s.Id = number; + s.SerialNumber = strarr[5]; + s.OrgCode = "101"; + s.SupplierCode = ""; + s.MaterialNumber = strarr[0]; + s.BoxId = 0; + s.IsUse = false; + s.CreateTime = Convert.ToDateTime("2023-09-06 00:00:05"); + s.NumberCode = ""; + serialNumbers.Add(s); + } + catch (Exception ex) + { + Console.WriteLine("鏁版嵁澶勭悊閿欒:" + str); + } + } + return serialNumbers; + //int couont_1 = serialNumbers.Where(w => w.OrgCode == "" && w.SupplierCode == "").Count(); + //int couont_2 = serialNumbers.GroupBy(g =>new { g.MaterialNumber ,g.OrgCode,g.SupplierCode}).Count(); + + //var lis= serialNumbers.GroupBy(g => new { g.OrgCode, g.SupplierCode }).Select(s=>s.Key).ToList(); + } + + + private async Task GetSer() + { + IDbContextTransaction _transaction = _transactionRepositories.GetTransaction(); + + Result res_Rollback = Result.ReSuccess(); + bool isSuccess = true; + + // var sList = GetS(); + var sList = GetE(); + var mList = sList.GroupBy(g => new { g.MaterialNumber, g.OrgCode, g.SupplierCode }).Select(s => s.Key).ToList(); + int numberid = 2620; + List records = new List(); + int bid = 0; + foreach (var m in mList) + { + bid++; + Console.WriteLine($"澶勭悊鐢熸垚璁″垝鏁版嵁{bid}"); + + var scountList = sList.Where(w => w.MaterialNumber == m.MaterialNumber && w.OrgCode == m.OrgCode && w.SupplierCode == m.SupplierCode).ToList(); + var scount = scountList.Count(); + SerialNumberGenerateRecord record = new SerialNumberGenerateRecord() + { + Id = numberid, + MaterialNumber = m.MaterialNumber, + OrgCode = m.OrgCode, + SupplierCode = m.SupplierCode, + CompanyId = 1, + IsGenerateComplete = true, + Number = scount, + GenerateCompleteTime = Convert.ToDateTime("2023-09-06 00:00:05"), + CreateTime = Convert.ToDateTime("2023-09-06 00:00:05") + }; + records.Add(record); + scountList.ForEach(f => f.GenerateRecordId = numberid); + numberid++; + } + var cs = sList.Where(w => w.GenerateRecordId == 0).Count(); + try + { + if (res_Rollback.IsSuccess) + { + var res = await _sGenerateRecordRepositories.AddRange(records, false); + if (!res) res_Rollback = Result.ReFailure(ResultCodes.DateWriteError); + } + if (res_Rollback.IsSuccess) + { + for (int i = 1; i <= 7; i++) + { + Console.WriteLine($"姝e湪澶勭悊绗瑊i}椤垫暟鎹"); + var sis = sList.Skip((i - 1) * 100000).Take(100000).ToList(); + if (sis.Count() <= 0) break; + var res = await _serialNumbersRepositories.AddRange(sis, false); + if (!res) + { + res_Rollback = Result.ReFailure(ResultCodes.DateWriteError); + break; + } + } + } + } + catch (Exception ex) + { + + throw ex; + } + + //鎻愪氦浜嬪姟An error occurred while saving the entity changes. See the inner exception for details.鈥 + + isSuccess = _transactionRepositories.CommitTransaction(res_Rollback.IsSuccess ? false : true, _transaction); + } + + + + private List GetFE() + { + List serialNumbers = new List(); + + string[] arr_t = System.IO.File.ReadAllLines("E:\\1\\b6.txt"); + + foreach (var str in arr_t) + { + var strarr = str.Split('\t'); + try + { + var s = new SecurityNumbers(); + + s.SecurityNumber = strarr[3]; + s.OrgCode = "101"; + s.SupplierCode = ""; + s.MaterialNumber = strarr[0]; + s.CreateTime = Convert.ToDateTime("2024-06-13 12:10:00"); + serialNumbers.Add(s); + } + catch (Exception ex) + { + Console.WriteLine("鏁版嵁澶勭悊閿欒:" + str); + } + } + return serialNumbers; + //int couont_1 = serialNumbers.Where(w => w.OrgCode == "" && w.SupplierCode == "").Count(); + //int couont_2 = serialNumbers.GroupBy(g =>new { g.MaterialNumber ,g.OrgCode,g.SupplierCode}).Count(); + + //var lis= serialNumbers.GroupBy(g => new { g.OrgCode, g.SupplierCode }).Select(s=>s.Key).ToList(); + } + + + private async Task GetFSer() + { + IDbContextTransaction _transaction = _transactionRepositories.GetTransaction(); + + Result res_Rollback = Result.ReSuccess(); + bool isSuccess = true; + + // var sList = GetS(); + var sList = GetFE(); + var mList = sList.GroupBy(g => new { g.MaterialNumber }).Select(s => s.Key).ToList(); + int numberid = 30872924; + List records = new List(); + int bid = 0; + foreach (var m in mList) + { + bid++; + Console.WriteLine($"澶勭悊鐢熸垚璁″垝鏁版嵁{bid}"); + + var scountList = sList.Where(w => w.MaterialNumber == m.MaterialNumber).ToList(); + var scount = scountList.Count(); + SecurityNumberGenerateRecord record = new SecurityNumberGenerateRecord() + { + Id = numberid, + LotNumber = "", + MaterialNumber = m.MaterialNumber, + OrgCode = "101", + SupplierCode = "", + CompanyId = 1, + IsGenerateComplete = true, + Number = scount, + GenerateCompleteTime = Convert.ToDateTime("2024-06-13 12:15:00"), + CreateTime = Convert.ToDateTime("2024-06-13 12:10:00") + }; + records.Add(record); + scountList.ForEach(f => f.GenerateRecordId = numberid); + numberid++; + } + var cs = sList.Where(w => w.GenerateRecordId == 0).Count(); + try + { + if (res_Rollback.IsSuccess) + { + var res = await _securityGenerateRecordRepositories.AddRange(records, false); + if (!res) res_Rollback = Result.ReFailure(ResultCodes.DateWriteError); + } + if (res_Rollback.IsSuccess) + { + for (int i = 1; i <= 7; i++) + { + Console.WriteLine($"姝e湪澶勭悊绗瑊i}椤垫暟鎹"); + var sis = sList.Skip((i - 1) * 100000).Take(100000).ToList(); + if (sis.Count() <= 0) break; + var res = await _securityNumbersRepositories.AddRange(sis, false); + if (!res) + { + res_Rollback = Result.ReFailure(ResultCodes.DateWriteError); + break; + } + } + } + } + catch (Exception ex) + { + + throw ex; + } + + //鎻愪氦浜嬪姟An error occurred while saving the entity changes. See the inner exception for details.鈥 + + isSuccess = _transactionRepositories.CommitTransaction(res_Rollback.IsSuccess ? false : true, _transaction); + } + } +} diff --git a/src/BarCode.Web.Api/Controllers/WmsBoxController.cs b/src/BarCode.Web.Api/Controllers/WmsBoxController.cs new file mode 100644 index 0000000..0e2c118 --- /dev/null +++ b/src/BarCode.Web.Api/Controllers/WmsBoxController.cs @@ -0,0 +1,150 @@ +锘縰sing AutoMapper; +using BarCode.Web.Domain.Infrastructure; +using BarCode.Web.Domain.IService.Public; +using BarCode.Web.Domain.IService; +using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Mvc; +using BarCode.Web.Core.Dto.Box; +using BarCode.Web.Core.Internal.Results; +using BarCode.Web.Domain.Values; +using System.Text.RegularExpressions; +using NPOI.SS.Formula.Functions; +using System.Collections.Generic; +using Newtonsoft.Json; +using BarCode.Web.Core.Dto.SerialNumbers; +using BarCode.Web.Domain.Services.Public; +using BarCode.Web.Domain.Values.Single; +using System.ComponentModel.Design; + +namespace BarCode.Web.Api.Controllers +{ + [Route("api/[controller]")] + [ApiController] + public class WmsBoxController : ControllerBase + { + private readonly IBoxRepositories _boxRepositories; + private readonly IMapper _mapper; + private readonly ILoginService _loginService; + private readonly IBoxService _boxService; + private readonly ILogger _logger; + private readonly ISerialNumbersRepositories _serialNumbersRepositories; + private readonly ISingleDataService _singleDataService; + public WmsBoxController(IMapper mapper, ILoginService loginService, IBoxRepositories boxRepositories, + IBoxService boxService, ILogger logger, + ISerialNumbersRepositories serialNumbersRepositories, ISingleDataService singleDataService) + { + _boxRepositories = boxRepositories; + _mapper = mapper; + _loginService = loginService; + _boxService = boxService; + _logger = logger; + _serialNumbersRepositories = serialNumbersRepositories; + _singleDataService = singleDataService; + } + + /// + /// Wms鑾峰彇绠变俊鎭-鍒楄〃 + /// + /// + /// + [HttpPost] + [Route("GetList")] + public async Task GetList(WmsBoxRequest dto) + { + _logger.LogInformation($"璇锋眰娑堟伅:{JsonConvert.SerializeObject(dto)}"); + List list = new List(); + int count = 0; + try + { + (list, count) = await _boxService.GetCartonListAsync(dto); + } + catch (Exception ex) + { + _logger.LogError($"wms绯荤粺鑾峰彇绠变俊鎭紓甯:{ex.Message}"); + return new OpsReponse() + { + succeeded = false + }; + } + OpsInfo info = new OpsInfo() + { + date = JsonConvert.SerializeObject(list) + }; + OpsReponse reponse = new OpsReponse() + { + succeeded = true, + data = info + }; + return reponse; + } + /// + /// Wms鑾峰彇搴忓垪鍙蜂俊鎭 + /// + /// + /// + [HttpPost] + [Route("GetSerialNumber")] + public async Task> GetSerialNumber(SerialNumbersWmsRequest dto) + { + _logger.LogInformation($"wms鑾峰彇搴忓垪鐮:{JsonConvert.SerializeObject(dto)}"); + + var entity = await _serialNumbersRepositories.GetEntityWms(dto.SerialNumber); + if (entity == null) return Result.ReFailure(ResultCodes.SerialNumberNoData); + if (entity.BoxId > 0) + return Result.ReFailure(ResultCodes.SerialNumberBindBox); + if (entity.IsUse == true) + return Result.ReFailure(ResultCodes.SerialNumberIsUse); + var response = new SerialNumbersWmsResponse() + { + SerialNumber = entity.SerialNumber.Equals(dto.SerialNumber) ? entity.SerialNumber : entity.NumberCode, + MaterialNumber = entity.MaterialNumber, + CreateTime = entity.CreateTime, + Creator = _singleDataService.GetSingleData(SingleAction.Users, 1, entity.CreatorId) + }; + //鎶婃煡璇㈠埌鐨勫簭鍒楃爜淇敼鎴愪娇鐢 + entity.WmsGet(dto.SerialNumber); + var list = new List(); + list.Add(entity); + var res = await _serialNumbersRepositories.EditEntityList(list); + if (!res) return Result.ReFailure(ResultCodes.DateWriteError); + + _logger.LogInformation($"wms鑾峰彇搴忓垪鐮佽繑鍥炲簭鍒楃爜淇℃伅:{JsonConvert.SerializeObject(response)}"); + + return Result.ReSuccess(response); + } + + /// + /// 鑾峰彇搴忓垪鍙蜂俊鎭 + /// + /// 搴忓垪鍙 + /// + [HttpGet] + [Route("Get/{serialNumber}")] + public async Task> Get([FromRoute] string serialNumber) + { + if (string.IsNullOrEmpty(serialNumber)) + return Result.ReFailure(ResultCodes.SerialNumbersNoData); + + var serial = await _serialNumbersRepositories.GetExternal(serialNumber); + if (serial == null) return Result.ReFailure(ResultCodes.SerialNumbersNoData); + return Result.ReSuccess(serial); + } + } + + public class OpsInfo + { + public int code { get; set; } + public string message { get; set; } + public string date { get; set; } + public string token { get; set; } + } + public class OpsReponse + { + public int statusCode { get; set; } + public bool succeeded { get; set; } + public string errors { get; set; } + public string extras { get; set; } + + public OpsInfo data { get; set; } + } +} diff --git a/src/BarCode.Web.Api/CustomResultFilter .cs b/src/BarCode.Web.Api/CustomResultFilter .cs new file mode 100644 index 0000000..a4f711c --- /dev/null +++ b/src/BarCode.Web.Api/CustomResultFilter .cs @@ -0,0 +1,40 @@ +锘縰sing Microsoft.AspNetCore.Mvc; +using Microsoft.AspNetCore.Mvc.Filters; +using BarCode.Web.Core.Internal.Results; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace BarCode.Web.Api +{ + /// + /// 閿欒鎷︽埅 + /// + public class CustomResultFilter : ActionFilterAttribute + { + public override void OnResultExecuting(ResultExecutingContext context) + { + if (!context.ModelState.IsValid) + { + var result = new Result(); + + foreach (var item in context.ModelState.Values) + { + foreach (var error in item.Errors) + { + result.Message += error.ErrorMessage + ","; + result.Status = 4204004; + } + } + result.Message = result.Message.TrimEnd(','); + context.Result = new JsonResult(result); + } + } + + public override void OnActionExecuting(ActionExecutingContext context) + { + } + + } +} diff --git a/src/BarCode.Web.Api/Program.cs b/src/BarCode.Web.Api/Program.cs new file mode 100644 index 0000000..43bda42 --- /dev/null +++ b/src/BarCode.Web.Api/Program.cs @@ -0,0 +1,60 @@ +using BarCode.Web.Api; +using BarCode.Web.Domain.Options; +using BarCode.Web.Repositories.DependencyInjection; +using Microsoft.AspNetCore.Hosting; +using Microsoft.EntityFrameworkCore; +using Microsoft.OpenApi.Models; +using Swashbuckle.AspNetCore.SwaggerUI; +using System.Configuration; +using System.IdentityModel.Tokens.Jwt; + +var builder = WebApplication.CreateBuilder(args); + +// Add services to the container. +JwtSecurityTokenHandler.DefaultInboundClaimTypeMap.Clear(); +var option = builder.Configuration.GetSection("AppOptions").Get(); +var option_soa = builder.Configuration.GetSection("SoaOptions").Get(); + +var isDevelopment = builder.Configuration.GetSection("IsDevelopment").Get(); +var serverVersion = new MySqlServerVersion(new Version(8, 0, 18)); +//数据库注入 +builder.Services.AddApp(builder.Configuration, isDevelopment, builder => +{ + builder.AddDbContext( + opt => { opt.UseMySql(option.DBConnectionString, serverVersion); }); +}); + + +builder.Services.AddControllers(options => +{ + options.Filters.Add(); +}); + +var app = builder.Build(); + +// Configure the HTTP request pipeline. +// Swagger中间件 +if (isDevelopment) +{ + app.UseSwagger(); + // SwaggerUI + app.UseSwaggerUI(c => + { + c.SwaggerEndpoint($"/swagger/v1/swagger.json", "BarCode-Api"); + c.RoutePrefix = string.Empty; + c.DocExpansion(DocExpansion.None); + }); +} + +app.UseHttpsRedirection(); +app.UseStaticFiles(); +app.UseCors("AllowAllOrigin"); +//统一异常处理中间件 +app.UseMiddleware(); +app.UseMiddleware(); + +//app.UseAuthorization(); + +app.MapControllers(); + +app.Run(); diff --git a/src/BarCode.Web.Api/Properties/launchSettings.json b/src/BarCode.Web.Api/Properties/launchSettings.json new file mode 100644 index 0000000..703b688 --- /dev/null +++ b/src/BarCode.Web.Api/Properties/launchSettings.json @@ -0,0 +1,50 @@ +{ + "profiles": { + "http": { + "commandName": "Project", + "launchBrowser": true, + "launchUrl": "weatherforecast", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + }, + "dotnetRunMessages": true, + "applicationUrl": "http://localhost:5050" + }, + "IIS Express": { + "commandName": "IISExpress", + "launchBrowser": true, + "launchUrl": "weatherforecast", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "Container (Dockerfile)": { + "commandName": "Docker", + "launchBrowser": true, + "launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}/weatherforecast", + "environmentVariables": { + "ASPNETCORE_HTTP_PORTS": "8080" + }, + "publishAllPorts": true + }, + "WSL": { + "commandName": "WSL2", + "launchBrowser": true, + "launchUrl": "http://localhost:5050/weatherforecast", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development", + "ASPNETCORE_URLS": "http://localhost:5050" + }, + "distributionName": "" + } + }, + "$schema": "http://json.schemastore.org/launchsettings.json", + "iisSettings": { + "windowsAuthentication": false, + "anonymousAuthentication": true, + "iisExpress": { + "applicationUrl": "http://localhost:56505", + "sslPort": 0 + } + } +} \ No newline at end of file diff --git a/src/BarCode.Web.Api/appsettings.Development.json b/src/BarCode.Web.Api/appsettings.Development.json new file mode 100644 index 0000000..0c208ae --- /dev/null +++ b/src/BarCode.Web.Api/appsettings.Development.json @@ -0,0 +1,8 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + } +} diff --git a/src/BarCode.Web.Api/appsettings.json b/src/BarCode.Web.Api/appsettings.json new file mode 100644 index 0000000..0a82c14 --- /dev/null +++ b/src/BarCode.Web.Api/appsettings.json @@ -0,0 +1,100 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + }, + "AllowedHosts": "*", //鍏佽鎵鏈変富鏈 + "IsDevelopment": true, //鏄惁鏄紑鍙戞ā寮 + "AllowedCores": "localhost,http://localhost:8080,http://192.168.1.188:8080",//璺ㄥ煙 + "AppOptions": { + "DBConnectionString": "Server=rm-wz9215skklas0287pwo.mysql.rds.aliyuncs.com; Database=test_barcode_db;User Id=orico_erp;password=Orico2023;port=3306;CharSet=gb2312;Connect Timeout=150;", //鏁版嵁搴撹繛鎺ュ湴鍧 + "RedisConnectionString": "47.106.232.90:6379,password=orico.2020,DefaultDatabase=7", //redis杩炴帴鍦板潃 + "RedisIpRateLimitingConnectionString": "47.110.156.96:16379,password=123456,DefaultDatabase=3", //redis杩炴帴鍦板潃 + "SingleBaseUrl": "http://127.0.0.1:8066/api", //鍗曠偣鏈嶅姟杩炴帴鍦板潃 + "DBType": "Mysql", //鏁版嵁搴撶被鍨 + "CompanyId": 1, //鍏徃Id + "AllowCache": false, //鍏佽缂撳瓨 + "RedisDirectory": "Test" //redis鏍囪 + }, + "SoaOptions": { + "ModuleID": 30,//绯荤粺鍦ㄥ崟鐐圭郴缁熺殑鏍囪 + "AdminUser": [ 1 ],//绠$悊鍛樼敤鎴 + "Url_V3": "https://dev.uc.v3.f2b211.com", //姝e紡http://uc.v3.f2b211.com //鍗曠偣绯荤粺鐨勮繛鎺ュ湴鍧v3鐗 + "Url": "http://dev.uc.f2b211.com",//鍗曠偣绯荤粺鐨勮繛鎺ュ湴鍧(鑰佺増 搴旇娌$敤浜) + "AppId": "100829382855098368",//绯荤粺Id + "AppSecret": "d0ebed53e67ec9b0be4e23918bb11792",//绯荤粺鎺堟潈 + "PublicKey": "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAs7b9r5qLgy4R/caQi2ZwfCULhOOZsfyBwlhqL0Y/nyBI/bFwc0+iIVHp/gq78PYXAUOplQC5YnaLMHsAV4y3pfGPiA7jD5ZmnoEJq1MLIDBCbm7H8JaBdW4b48w7afccTgnkqFQP3vs7JS8VSTkOEO32lyX6LYjP6o32juUsDu4VKZH922BHvaNC0ewt1dOT4v6XHiGPOyJs3dW86yqhCWRDRGZjUPMZDlZfQx1qF3thMc4DObgKWYVS5RWsKvDg5DwbQznUuhneCABHpqZ0ICtkq187K29dHmk8KmCNtsHM8+zwP+j1GU9/zVT4XVw+oGJcO6II0ZTWkA/ESSUTmQIDAQAB",//鍏挜 + "PrivateKey": "MIIEvwIBADANBgkqhkiG9w0BAQEFAASCBKkwggSlAgEAAoIBAQCztv2vmouDLhH9xpCLZnB8JQuE45mx/IHCWGovRj+fIEj9sXBzT6IhUen+Crvw9hcBQ6mVALlidoswewBXjLel8Y+IDuMPlmaegQmrUwsgMEJubsfwloF1bhvjzDtp9xxOCeSoVA/e+zslLxVJOQ4Q7faXJfotiM/qjfaO5SwO7hUpkf3bYEe9o0LR7C3V05Pi/pceIY87Imzd1bzrKqEJZENEZmNQ8xkOVl9DHWoXe2ExzgM5uApZhVLlFawq8ODkPBtDOdS6Gd4IAEempnQgK2SrXzsrb10eaTwqYI22wczz7PA/6PUZT3/NVPhdXD6gYlw7ogjRlNaQD8RJJROZAgMBAAECggEABeEWq4gCyGfZbtPwJp9TTrxnhBFuFcSM+i6qSqGhszL7MFF9vEf+pdhoL0dqnpduaTwtcBJ1/iKiqxNbD4Iq/+LHL0xNYVUqRkUya8hrtMHfan11TQmfcpgHkYw85VqQMn1gXaFiY4kUhkLkD2EudJ9UUd2MMbEoHCRIzKPyrQpO3We/4iwYFh96DW+iSzxRuqjtWE4+rnWaQECPzeOu7TMaktnccqw+dPM49EXPmtGCCqfSwLAAYEewL0q4dcaLgFL4qugABsTM7NQaS8AgE5so2RErcpeGSIy0s1aNgSPmdhJ8Msc+AMVc6xYpkylYYmmSNMKVnnQgVhAJsIrmAQKBgQDSFh/V52LffsYV69ePtgMnNlp+fGeYb1zqSAREKJlPjEB24BTPbbUhPQSrdi9ZFa0W93lEPTPyokWx8Rj/1GnHd5k9QPkPzIejO3ljuCtEXBn0Y+4S24T1gMEgGpiMgOQdmTI1xQ2btifvLFsu+63TDPeYiXJclTjFMtGGHMHw1QKBgQDa/aQmxLV+5/2hzf+ijsklJ4w3DTzzXl1OTdcyQia2oxs6fJ/9YEs0zzVLvcs3JA+evuJtuzteXmexUEv8hH9OGMJFbSiJ2ePwGNJ1JKPN4zRAA2FVtrmVdS4rVwjb/kuVU+4KFxpM98R/YZAnymhD9obepD23kxOdhVFgff0ZtQKBgQCqwBSr9F6mLBGvq3oOce7qJgEzIMXKXWj1egcNprnEr8eNVt9TIGXBWCi9e1dMXpPKQOWtEtlv8XgYAk9BT1GSL6C66l4D+0aa4zHsXLm92+W0fqv3Y7gTGczd3P/z4qaFcAghL8G5tzmJ6VFLRH+pM7bhoYTzvszfakhlamYu6QKBgQCYeoMRe2XkNyQixYx5Y3IqrJ60tkL6MXpGS2zLUcQi5u7OinfbtHCpFJ3HXx9gBXvazI5cWUG9M35/t6kw6hC6EAM01Ayl71EGnEHtztU/RjPbXn8nb1NI/Y5oHvHMPAPktcvIus1VSi9HgmcdTZHLwJun6jQO3hmKVImU5iSVAQKBgQC2xZ9KkzAui1YSadtD6jNtBzdXgEQ0K2MziRBlVslFfxmlJ/0X9r4lIw4RJJmsCS6To9n1h0DGK9uveVwE+oGPLD95ISala+OYj9ewiBnZwbkDD201q0Ui2ji4PCZa462ZNKJw/G8vQ5oc/zu2EBER/85Y5h+RtJfFs3b5TKtNxA=="//绉侀挜 + }, + "ErpOptions": { + "EndpointAddress": "http://erp.orico.com.cn/k3cloud/ERPGW.asmx",//閲戣澏杩炴帴鍦板潃 + "UserName": "mes",//閲戣澏璐︽埛鍚 + "Password": "A1B2C3Dh.",//閲戣澏瀵嗙爜 + "ErpId": "ce20210909"//閲戣澏Id + }, + "WmsOptions": { + "Url": "https://api.wms.test.f2b211.com/" //WMS绯荤粺鐨勮繛鎺ュ湴鍧 + }, + "Qiniu": { + "AccessKey": "dOsTum4a5qvhPTBbZRPX0pIOU7PZWRX7htKjztms",//涓冪墰浜戣处鍙 + "SecretKey": "KFxsGbnErkALFfeGdMa8QWTdodJbamMX0iznLe-q",//涓冪墰浜戞巿鏉 + "Bucket": "orico-wms-test", //姝e紡 orico-wms //涓冪墰浜戞枃浠朵笅鐨勬枃浠跺悕 + "Url": "https://wmstestfile.f2b211.com/" //娴嬭瘯 https://wmstestfile.f2b211.com/ 姝e紡 https://wmsfile.f2b211.com/ //璁块棶涓冪墰浜戞枃浠剁殑閾炬帴鍦板潃 + }, //瀹氭椂浠诲姟閰嶇疆椤 + "QuartzJobOptions": { + //瀛樺偍绫诲瀷:閿拰鍊 + "JobStoreTypeKey": "quartz.jobStore.type", + "JobStoreTypeValue": "Quartz.Impl.AdoJobStore.JobStoreTX, Quartz", + + //鏁版嵁搴撻┍鍔ㄧ被鍨-杩欓噷鏄痬ysql:閿拰鍊 + "JobStoreDriverDelegateTypeKey": "quartz.jobStore.driverDelegateType", + "JobStoreDriverDelegateTypeValue": "Quartz.Impl.AdoJobStore.MySQLDelegate, Quartz", + + //鏁版嵁搴撹〃鍚嶅墠缂:閿拰鍊 + "JobStoreTablePrefixKey": "quartz.jobStore.tablePrefix", + "JobStoreTablePrefixValue": "QRTZ_", + + //鏁版嵁婧愮殑鍚嶇О:閿拰鍊 + "JobStoreDataSourceKey": "quartz.jobStore.dataSource", + "JobStoreDataSourceValue": "myDS", + + //杩炴帴瀛楃涓:閿拰鍊 + "JobStoreConnectionStringKey": "quartz.dataSource.myDS.connectionString", + "JobStoreConnectionStringValue": "Server=rm-wz9215skklas0287pwo.mysql.rds.aliyuncs.com; Database=test_barcode_db;User Id=orico_erp;password=Orico2023;port=3306;CharSet=gb2312;Connect Timeout=150;", + + //mysql鎻愪緵鍣:閿拰鍊 + "JobStoreProviderKey": "quartz.dataSource.myDS.provider", + "JobStoreProviderValue": "MySql", + + //鍑犵偣寮濮嬫墽琛 + "JobStartHour": [ 15, 11, 1, 0, 0, 10 ], + //鍑犲垎閽熷紑濮嬫墽琛 + "JobStartMinute": [ 30, 39, 30, 20, 5, 5 ], + + //鎵цCron琛ㄨ揪寮忥細鍙互鏄嚑灏忔椂or鍑犲垎閽無r鍑犵閽無r鍑犲ぉor鍑犲懆锛 + "JobStartExpre": "0 0 * * * ?", + "JobStartExpreAmount": "0 50 23 * * ?", + "JobStartExpreSend": "0 0 12,16,20 * * ?", + "JobStartExpreMaterial": "0 30 23 * * ?", + "JobStartExpreCenerateData": "0 1 0 * * ?", //鍑屾櫒0鐐1鍒嗘墽琛 + + //a.鏄惁鍚敤闆嗙兢锛氶敭鍜屽 + "JobStoreClusteredKey": "quartz.jobStore.clustered", + "JobStoreClusteredValue": true, + + //b.闆嗙兢涓殑姣忎釜鑺傜偣閮藉繀椤绘湁涓涓敮涓鐨 instanceId + // 閫氳繃灏嗏淎UTO鈥濊缃负璇ュ睘鎬х殑鍊兼潵瀹屾垚 + //澶囨敞锛歛灞炴у拰b灞炴ч厤濂椾娇鐢紱濡傛灉涓嶅紑鍚泦缇よ繖涓や釜灞炴у幓鎺 + "JobStoreInstanceIdKey": "quartz.scheduler.instanceId", + "JobStoreInstanceIdValue": "AUTO", + + //浠ヤ笅鍙互鑷畾涔夐厤缃 + "QuartzJobKey": "OpsJob", + "QuartzJobValue": "OpsJobGroup", + "QuartzJobDescription": "OpsJob", + "QuartzTriggerIdentity": "OpsTrigger", + "QuartzTriggerDescription": "OpsJobTrigger" + } +} diff --git a/src/BarCode.Web.Api/wwwroot/BarCode.Web.Api.xml b/src/BarCode.Web.Api/wwwroot/BarCode.Web.Api.xml new file mode 100644 index 0000000..7dcd7a8 --- /dev/null +++ b/src/BarCode.Web.Api/wwwroot/BarCode.Web.Api.xml @@ -0,0 +1,396 @@ + + + + BarCode.Web.Api + + + + + 绠卞瓙 + + + + + 绠变俊鎭-鍒楄〃 + + + + + + + 鐢熸垚绠辩爜 + + + + + + + 瑁呯淇濆瓨 + + + + + + + 鎵撳嵃 + + + + + + + 鍒犻櫎 + + + + + + + 娓呯┖瑁呯淇℃伅 + + + + + + + 鏍规嵁绠卞彿鑾峰彇绠变俊鎭 + + + + + + + 閲嶆柊瑁呯 + + + + + + + 寮濮嬭绠 + + + + + + + 绠卞敍-鎺ュ彛 + + + + + 绠卞敍--鍒楄〃 + + + + + + + 鐢熸垚 + + + + + + + 鎵归噺鍒犻櫎 + + + + + + + 鍓嶇璁板綍鏃ュ織 + + + + + 鍓嶇璁板綍鏃ュ織 + + + + + + + 鍓嶇璁板綍鏃ュ織 + + + + + + + 鍓嶇璁板綍鏃ュ織(鏁扮粍) + + + + + + + 娑堟伅鏁扮粍 + + + + + 娑堟伅鍐呭鏁扮粍 + + + + + 涓婁紶涓嬭浇涓績 + + + + + 鑾峰彇闇瑕佺殑鐘舵佸垪琛 + + + + + + 涓嬭浇瀵煎嚭鏂囦欢 鍒楄〃 + + + + + + + 妯℃澘(鐢熸垚搴忓垪鐮) + + + + + + 鐧诲綍鎺ュ彛 + + + + + 鐧诲綍 + + + + + + + 鐧诲綍-APP鍜屽皬绋嬪簭 + + + + + + + 閫鍑虹櫥褰 + + + + + + PHP鍗曠偣閫鍑轰娇鐢 + + + + + + 鑿滃崟鍒楄〃 + + + + + + 鐗╂枡 + + + + + 鍒锋柊鐗╂枡 69鏉$爜鎴杋d32杩涘埗 + + 鐗╂枡缂栫爜 + 69 鏉$爜,id id32杩涘埗,other 鍚嶅瓧鍜岃鏍煎瀷鍙 + + + + + 鑾峰彇搴忓垪鍙蜂俊鎭 + + 闃蹭吉鐮 + + + + + 闃蹭吉鐮 + + + + + 闃蹭吉鐮佺敓鎴愯褰曞垪琛 + + + + + + + 闃蹭吉鐮佸垪琛 + + + + + + + 闃蹭吉鐮佺敓鎴愯褰曢〉闈-涓嬭浇鏉$爜 + + + + + + + 闃蹭吉鐮侀〉闈-鏉$爜涓嬭浇 + + + + + + + 涓嬭浇(涓鑸悗绔唴閮ㄨ皟鐢) + + + + + + + 鐢熸垚搴忓垪鍙 + + + + + + + 搴忓垪鍙 + + + + + 搴忓垪鐮佺敓鎴愯褰曞垪琛 + + + + + + + 搴忓垪鐮佸垪琛 + + + + + + + 鏉$爜鐢熸垚璁板綍椤甸潰-涓嬭浇鏉$爜 + + + + + + + 搴忓垪鐮侀〉闈-鏉$爜涓嬭浇 + + + + + + + 鐢熸垚搴忓垪鍙 + + + + + + + 鎵撳嵃 + + + + + + + 涓嬭浇(涓鑸悗绔唴閮ㄨ皟鐢) + + + + + + + 鑾峰彇搴忓垪鍙蜂俊鎭 + + 绠盜d + + + + + 鑾峰彇搴忓垪鍙蜂俊鎭 + + 搴忓垪鍙 + 缁勭粐鎴栦緵搴斿晢缂栫爜 + + + + + 淇敼搴忓垪鐮佺墿鏂 + + + + + + + 绯荤粺閰嶇疆 + + + + + 鑾峰彇鐗╂枡锛涢氳繃瑙勬牸鍨嬪彿 + + + + + + + 鑾峰彇渚涘簲鍟-erp鍩虹鏁版嵁 + 浣跨敤code鍋氶敭 + + 渚涘簲鍟嗗悕瀛 + 缁勭粐缂栫爜 + + + + + 鑾峰彇缁勭粐-erp鍩虹鏁版嵁 + 浣跨敤 code鍋氶敭 + + + + + + Wms鑾峰彇绠变俊鎭-鍒楄〃 + + + + + + + Wms鑾峰彇搴忓垪鍙蜂俊鎭 + + + + + + + 鑾峰彇搴忓垪鍙蜂俊鎭 + + 搴忓垪鍙 + + + + + 閿欒鎷︽埅 + + + + diff --git a/src/BarCode.Web.Api/wwwroot/BarCode.Web.Core.xml b/src/BarCode.Web.Api/wwwroot/BarCode.Web.Core.xml new file mode 100644 index 0000000..788cabf --- /dev/null +++ b/src/BarCode.Web.Api/wwwroot/BarCode.Web.Core.xml @@ -0,0 +1,4526 @@ + + + + BarCode.Web.Core + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 璇锋眰瀵硅薄 + + + + + 缁勭粐Code + + + + + 璁㈠崟缂栧彿闆嗗悎瀛楃涓 + + + + + 鐗╂枡涓変欢濂楁悳绱 + + + + + 寮濮嬬殑绠卞敍缂栧彿 + + + + + 缁撴潫鐨勭鍞涚紪鍙 + + + + + 鎿嶄綔浜 + + + + + 鐢熸垚寮濮嬫椂闂 + + + + + 鐢熸垚缁撴潫鏃堕棿 + + + + + 鍒楄〃鍝嶅簲瀵硅薄 + + + + + 鍞竴ID + + + + + 鏄庣粏缂栧彿ID + + + + + 绠卞敍缂栧彿 + + + + + 璁㈠崟缂栧彿 + + + + + 鐗╂枡瑙勬牸鍨嬪彿 + + + + + 鐗╂枡缂栫爜 + + + + + 鐗╂枡鍚嶇О + + + + + 69鏉$爜 + + + + + 瑁呯鏁伴噺 + + + + + 瑁呯鍑閲 + + + + + 瑁呯姣涢噸 + + + + + 灏剧鏁伴噺 + + + + + 灏剧鍑閲 + + + + + 灏剧姣涢噸 + + + + + 澶囨敞 + + + + + 鎿嶄綔浜 + + + + + 鍒涘缓鏃堕棿锛堢敓鎴愭椂闂达級 + + + + + 鏄惁鏄熬绠 + + + + + 瑁呯鎬绘暟 + + + + + 浜у搧鏁伴噺 + + + + + 鎺掑簭 + + + + + 娴佹按鍙(寮濮) + + + + + 娴佹按鍙(缁撴潫) + + + + + 鐢熸垚绠卞敍dto + + + + + 缁勭粐Code + + + + + + 鐗╂枡 + + + + + 浜у搧鏁伴噺 + + + + + 瑁呯鏁伴噺 + + + + + 瑁呯鍑閲 + + + + + 瑁呯姣涢噸 + + + + + 灏剧鏁伴噺 + + + + + 灏剧鍑閲 + + + + + 灏剧姣涢噸 + + + + + 澶囨敞 + + + + + 娴佹按鍙(寮濮) + + + + + 娴佹按鍙(缁撴潫) + + + + + 绠辨槑缁嗕俊鎭 + + + + + ID + + + + + 鐗╂枡缂栫爜 + + + + + 鏁伴噺锛堣绠辨暟閲忥級 + + + + + 搴忓垪鍙 + + + + + 绠卞垪琛ㄨ繑鍥炰俊鎭 + + + + + ID + + + + + 鏄庣粏Id(鍙兘涓0) + + + + + 绠辩紪鍙 + + + + + 渚涘簲鍟嗘垨缁勭粐 + + + + + 鐗╂枡瑙勬牸鍨嬪彿 + + + + + 鐗╂枡缂栫爜 + + + + + 鐗╂枡鍚嶇О + + + + + 鐗╂枡鏉$爜 + + + + + 搴忓垪鍙 + + + + + 鏁伴噺锛堣绠辨暟閲忥級 + + + + + 绠辩姸鎬 + + + + + 瑁呯寮濮嬫椂闂 + + + + + 瑁呯缁撴潫鏃堕棿(瀹屾垚瑁呯鏃堕棿) + + + + + 瑁呯浜 + + + + + 鐢熸垚浜 + + + + + 鍒涘缓鏃堕棿 + + + + + 绠卞彿鎵撳嵃娆℃暟 + + + + + 绠变俊鎭垪琛 + + + + + 缁勭粐Code + + + + + 绠卞彿(寮濮) + + + + + 绠卞彿(缁撴潫) + + + + + 绠辩姸鎬 + + + + + 鍒涘缓鏃堕棿 + + + + + 鍒涘缓鏃堕棿 + + + + + 瑁呯瀹屾垚鏃堕棿 + + + + + 瑁呯瀹屾垚鏃堕棿 + + + + + 鐗╂枡缂栫爜/鍚嶇О/鍨嬪彿瑙勬牸 + + + + + 搴忓垪鍙 + + + + + 绠卞彿鎵撳嵃鐘舵 鎵撳嵃 true 鏈墦鍗癴alse + + + + + 渚涘簲鍟嗘垨缁勭粐 + + + + + 鐢熸垚浜 + + + + + 绠变俊鎭 + + + + + ID + + + + + 绠辩紪鍙 + + + + + 渚涘簲鍟咰ode + + + + + 缁勭粐Code + + + + + 绠辩姸鎬 + + + + + 瑁呯寮濮嬫椂闂 + + + + + 瑁呯缁撴潫鏃堕棿(瀹屾垚瑁呯鏃堕棿) + + + + + 瀹屾垚瑁呯鐢ㄦ埛 + + + + + 绠卞瓙鍒涘缓鐢ㄦ埛 + + + + + 鍒涘缓鏃堕棿 + + + + + 绠卞彿鎵撳嵃娆℃暟 + + + + + 鏈鏂版墦鍗版椂闂 + + + + + 鏄庣粏 + + + + + 鍒犻櫎绠卞拰搴忓垪鐮佺粦瀹 + + + + + 绠盜d + + + + + 鐗╂枡缂栫爜 + + + + + 搴忓垪鍙 + + + + + 鐢熸垚绠辩爜 + + + + + 缁勭粐Code + + + + + 鐢熸垚鏁伴噺 + + + + + 绠变俊鎭槑缁 + + + + + 鐗╂枡缂栫爜 + + + + + 搴忓垪鍙 + + + + + 淇濆瓨绠变俊鎭(瑁呯淇濆瓨,瀹屾垚瑁呯) + + + + + 绠盜d + + + + + 鏄惁瀹屾垚瑁呯(淇濆瓨 false 瀹屾垚瑁呯 true) + + + + + 鏄庣粏淇℃伅 + + + + + 鑰乷ps绠变俊鎭姹 + + + + + + + + + + + + + + + + + 寮濮嬫椂闂 + + + + + 缁撴潫鏃堕棿 + + + + + 绠卞彿 + + + + + 椤电爜 + + + + + 姣忛〉鏉℃暟 + + + + + 鑰乷ps绠变俊鎭 + + + + + 瀵瑰簲鑰丱PS鐨勭ID + + + + + 绠辩紪鍙凤紙鑰丱PS鐢熸垚鐨勭鍙凤級 + + + + + 渚涘簲鍟咺d + + + + + 缁勭粐Id + + + + + 瀹屾垚瑁呯鏃堕棿 + + + + + 瀹屾垚瑁呯鐢ㄦ埛 + + + + + 绠卞瓙鍒涘缓鐢ㄦ埛 + + + + + 鍒涘缓鏃堕棿锛堝搴旇丱PS鐨勫垱寤烘椂闂达級 + + + + + 鏄庣粏 + + + + + 搴忓垪鍙 + + + + + 搴忓垪鍙风敓鎴愭椂闂 + + + + + 搴忓垪鍙风敓鎴愮敤鎴 + + + + + 鐗╂枡缂栫爜 + + + + + 鏁伴噺锛堣绠辨暟閲忥級 + + + + + 搴忓垪鍙烽泦 + + + + + 鎵鏈夋灇涓句俊鎭 + + + + + 鍑哄簱鍗曠被鍨 + + + + + 绉诲簱鍗曠被鍨 + + + + + 鐩樼偣缁撴灉绫诲瀷 + + + + + 鍏ュ簱鍗曠被鍨 + + + + + 鍏ュ簱鐘舵 + + + + + 绫诲瀷锛1涓哄叆搴撳洖閫涓嬫灦锛2涓哄嚭搴撳洖閫涓婃灦 + + + + + 绫诲瀷锛1涓哄叆搴擄紝2涓哄嚭搴 + + + + + 鍗曟嵁绫诲瀷 + + + + + 闈為噰璐笂鏋舵柟寮 + + + + + 涓嬭浇瀵煎嚭璁㈠崟绫诲瀷 + + + + + 涓嬭浇瀵煎嚭鐘舵 + + + + + 鍑哄叆搴撴柟寮忥細鎸夌鎴栬呮寜浜у搧 + + + + + 鍑哄簱鐘舵 + + + + + 鍚屾閲戣澏鐘舵 + + + + + 瀹㈡埛 + + + + + ID + + + + + 缂栫爜 + + + + + 鍚嶇О + + + + + ERP锛氬崟鎹煡璇-dto + + + + + 浠ょ墝 + + + + + 鍙傛暟 + + + + + 鍙傛暟(淇濆瓨鎻愪氦瀹℃牳formId鍦ㄥ灞) + + + + + ERP锛氬崟鎹煡璇-鍙傛暟-dto + + + + + 涓氬姟瀵硅薄琛ㄥ崟Id锛堝繀褰曪級 + + + + + 闇鏌ヨ鐨勫瓧娈祂ey闆嗗悎锛屽瓧绗︿覆绫诲瀷锛屾牸寮忥細"key1,key2,..."锛堝繀褰曪級 娉紙鏌ヨ鍗曟嵁浣撳唴鐮,闇鍔犲崟鎹綋Key鍜屼笅鍒掔嚎,濡傦細FEntryKey_FEntryId锛 + + + + + 杩囨护鏉′欢锛屾暟缁勭被鍨嬶紝濡傦細[{"Left":"(","FieldName":"Field1","Compare":"=","Value":"111","Right":")","Logic":"AND"},{"Left":"(","FieldName":"Field2","Compare":"=","Value":"222","Right":")","Logic":""}] + + + + + 鎺掑簭瀛楁锛屽瓧绗︿覆绫诲瀷锛堥潪蹇呭綍锛 + + + + + 杩斿洖鎬昏鏁帮紝鏁村瀷锛堥潪蹇呭綍锛 + + + + + 寮濮嬭绱㈠紩锛屾暣鍨嬶紙闈炲繀褰曪級 + + + + + 鏈澶ц鏁帮紝鏁村瀷锛屼笉鑳借秴杩10000锛堥潪蹇呭綍锛 + + + + + 琛ㄥ崟鎵鍦ㄧ殑瀛愮郴缁熷唴鐮侊紝瀛楃涓茬被鍨嬶紙闈炲繀褰曪級 + + + + + ERP:鍏ュ簱鍗-缁熶竴鍝嶅簲瀵硅薄 + + + + + 鍗曟嵁缂栧彿 + + + + + 缁勭粐 + + + + + erp鐨勬槑缁咺D + + + + + 缁勭粐缂栫爜 + + + + + 渚涘簲鍟 + + + + + 鐗╂枡缂栫爜 + + + + + 浠撳簱ID + + + + + 浠撳簱code + + + + + 鏁伴噺 + + + + + 鍑哄巶浠 + + + + + 宸蹭氦鏁伴噺锛堝搴旈噾铦剁殑宸蹭氦鏁伴噺-瀵瑰簲鐗╂枡锛夛紝鐩墠鍙湁閲囪喘璁㈠崟鏈 + + + + + 鏄庣粏澶囨敞 + + + + + 鍒涘缓鏃堕棿 + + + + + 鍗曟嵁绫诲瀷 + + + + + 閿鍞鍗 + + + + + 瀹㈡埛缂栫爜 + + + + + 鐗╂枡缂栫爜 + + + + + 缁勭粐缂栫爜 + + + + + 浠撳簱 + + + + + 瀛愪粨搴(璺熼噾铦朵氦浜掑瓧娈) + + + + + 鏁伴噺 + + + + + 缂栫爜 + + + + + 缂栫爜 + + + + + 鐩樼偣瀛愪粨搴 + + + + + GD浠 + + + + + HD浠 + + + + + erp 鎻愪氦鍜屽鏍 + + + + + 涓氬姟瀵硅薄琛ㄥ崟Id锛堝繀褰曪級 + + + + + 鍗曟嵁缂栫爜 + + + + + 淇敼閲囪喘鍏ュ簱鍗 + + + + + 鍗曟嵁Id + + + + + 鏄庣粏 + + + + + 鏄庣粏 + + + + + 鏄庣粏Id + + + + + 閲囪喘璁㈠崟鏄庣粏Id + + + + + 鏁伴噺 + + + + + 鎵瑰彿 + + + + + 鎵瑰彿 + + + + + 鎵瑰彿 + + + + + 涓嬫帹 + + + + + 涓氬姟瀵硅薄琛ㄥ崟Id锛堝繀褰曪級 + + + + + 鍒嗗綍鍐呯爜闆嗗悎锛岄楀彿鍒嗛殧锛堝垎褰曚笅鎺ㄦ椂蹇呭綍锛 娉紙鎸夊垎褰曚笅鎺ㄦ椂锛屽崟鎹唴鐮佸拰缂栫爜涓嶉渶瑕佸~,鍚﹀垯鎸夋暣鍗曚笅鎺級 + + + + + 鐩爣鍗曟嵁绫诲瀷 + + + + + 鏄惁鍚敤榛樿杞崲瑙勫垯锛屽竷灏旂被鍨嬶紝榛樿false锛堥潪蹇呭綍锛 + false 闇瑕佺┛ RuleId true 涓嶉渶瑕佷紶RuleId + + + + + 杞崲瑙勫垯鍐呯爜 + + + + + 淇濆瓨澶辫触鏃舵槸鍚︽殏瀛橈紝甯冨皵绫诲瀷锛岄粯璁alse锛堥潪蹇呭綍锛 娉紙鏆傚瓨鐨勫崟鎹槸娌℃湁缂栫爜鐨勶級 + + + + + Erp鍚屾鏁版嵁鏃跺崟鎹ご + + + + + 涓氬姟瀵硅薄琛ㄥ崟Id锛堝繀褰曪級 + + + + + 鍗曟嵁浣 + + + + + 瀵瑰簲閲戣澏锛岀墿鏂欎俊鎭 + + + + + 缁勭粐ID + + + + + 缁勭粐缂栫爜 + + + + + 鐗╂枡ID + + + + + 鐗╂枡鍚嶇О + + + + + 鐗╂枡缂栫爜 + + + + + 鐗╂枡瑙勬牸鍨嬪彿 + + + + + 鍩烘湰鍗曚綅 + + + + + 鍩烘湰鍗曚綅鍚嶇О + + + + + 鍩烘湰鍗曚綅缂栫爜 + + + + + 鏉$爜 + + + + + 鏄惁鍚敤鎵瑰彿绠$悊 + + + + + 鐗╂枡Id 32杩涘埗瀛楃涓 + + + + + 閲戣澏缁勭粐-鍩烘湰淇℃伅 + + + + + Id + + + + + 缂栫爜 + + + + + 鍚嶇О + + + + + 鍙戣揣閫氱煡鍗曡浆鍑哄簱浠诲姟 + + + + + 鏉ユ簮鍗曞彿 + + + + + 閿鍞鍗曞彿 + + + + + 鍙戣揣缁勭粐 + + + + + 缁勭粐缂栫爜 + + + + + 鏀惰揣瀹㈡埛 + + + + + 瀵瑰簲閲戣澏鍗曟嵁鏄庣粏id(閿鍞嚭搴撳悓姝ラ噾铦朵笅鎺ㄤ娇鐢) + + + + + 鐗╂枡缂栫爜 + + + + + 浠撳簱ID + + + + + 浠撲綅ID + + + + + 搴斿嚭搴撴暟閲 + + + + + 璁㈠崟鏄庣粏澶囨敞 + + + + + 鍒涘缓鏃堕棿锛坋rp閭h竟鐨勫垱寤烘椂闂达級 + + + + + 鐢ㄦ潵鑷姩鏋勫缓鍗曟嵁绫诲瀷 璺烵utStockType 涓鑷 + + + + + 鍑哄簱鍗曞悓姝ラ噾铦 + + + + + 鍗曟嵁缂栧彿 + + + + + 鍗曟嵁绫诲瀷 + + + + + 鍙戣揣缁勭粐 + + + + + 鏀惰揣瀹㈡埛 + + + + + 鍒涘缓鏃堕棿锛堝嚭搴撴椂闂达級 + + + + + 缁撶畻甯佸埆榛樿涓: 浜烘皯甯 + + + + + 閿鍞粍缁囧彇瀵瑰簲鍙戣揣閫氱煡鍗曠殑閿鍞粍缁 + + + + + 閿鍞儴闂ㄥ彇瀵瑰簲鍙戣揣閫氱煡鍗曠殑閿鍞儴闂 + + + + + 鐗╂枡Id + + + + + 浠撳簱ID + + + + + 鍑哄簱鏁伴噺 + + + + + 鍑哄簱鏁伴噺 + + + + + 搴斿彂鏁伴噺锛屽彇瀵瑰簲鍙戣揣閫氱煡鍗曠殑閿鍞暟閲 + + + + + 鍗曚环 鍙栧搴斿彂璐ч氱煡鍗曞搴旂墿鏂欑紪鐮佽鐨 鍗曚环 + + + + + 鍚◣鍗曚环 鍙栧搴斿彂璐ч氱煡鍗曞搴旂墿鏂欑紪鐮佽鐨 鍚◣鍗曚环 + + + + + 淇敼閿鍞嚭搴撳崟 + + + + + 鍗曟嵁Id + + + + + 鏄庣粏 + + + + + 鏄庣粏Id + + + + + 鍙戣揣閫氱煡鍗曟槑缁咺d + + + + + 鏁伴噺 + + + + + key涓簊tring 涓嬫媺鍒楄〃瀵硅薄 + + + + + id + + + + + 缂栫爜 + + + + + 鍚嶅瓧 + + + + + 鏄惁榛樿閫変腑 + + + + + 浠撳簱淇℃伅 + + + + + id + + + + + 缂栫爜 + + + + + 鍚嶅瓧 + + + + + 涓氬姟缁勭粐(浣跨敤缁勭粐) + + + + + 涓氬姟缁勭粐(浣跨敤缁勭粐)缂栫爜 + + + + + 瀛愪粨搴撲俊鎭 + + + + + id + + + + + 缂栫爜 + + + + + 鍚嶅瓧 + + + + + 涓氬姟缁勭粐(浣跨敤缁勭粐) + + + + + 涓氬姟缁勭粐(浣跨敤缁勭粐)缂栫爜 + + + + + 浠撳簱缂栫爜 + + + + + erp渚涘簲鍟嗗熀纭鏁版嵁 + + + + + ID + + + + + 缂栫爜 + + + + + 鍚嶇О + + + + + 缁勭粐缂栫爜 + + + + + 鐩樼偣鍗 + + + + + 鍗曟嵁绫诲瀷(鏍囧噯鐩樹簭鍗; 鏍囧噯鐩樼泩鍗 PY01_SYS) 鐩樹簭 PK01_SYS + + + + + 搴撳瓨缁勭粐 (鍙栦粨搴撳搴旂殑搴撳瓨缁勭粐) + + + + + 璐т富绫诲瀷: 榛樿涓轰笟鍔$粍缁 BD_OwnerOrg + + + + + 鍗曟嵁缂栧彿 + + + + + 鐩樼偣鏃ユ湡 + + + + + 鏄庣粏 + + + + + 搴撳瓨鐘舵 KCZT01_SYS + + + + + 璐т富绫诲瀷: 榛樿涓轰笟鍔$粍缁 BD_OwnerOrg + + + + + 鍙栦粨搴撳搴旂殑璐т富淇℃伅 璐т富: 绛変簬搴撳瓨缁勭粐 + + + + + 淇濈鑰呯被鍨 + + + + + 淇濈鑰 浠撳簱鈥濆簱瀛樼粍缁団 + + + + + 鐗╂枡ID + + + + + 鍗曚綅ID + + + + + 浠撳簱ID + + + + + 浠撲綅ID + + + + + 鐩樼偣鍓嶆暟閲忥紙wms绯荤粺鏁伴噺锛 + + + + + 鐩樼偣瀹為檯鏁伴噺锛堝疄闄呬粨搴撴暟閲忥級 + + + + + 鐩樼泩鏁伴噺 + + + + + 鐩樹簭鏁伴噺 + + + + + 澶囨敞 + + + + + 涓婁紶涓嬭浇鍒楄〃 + + + + + 缁勭粐Code + + + + + 鍗曟嵁绫诲瀷(浠诲姟绫诲瀷) + + + + + 鐘舵 + + + + + 涓嬪崟鏃堕棿 寮濮 + + + + + 涓嬪崟鏃堕棿 缁撴潫 + + + + + 鎿嶄綔浜 + + + + + 渚涘簲鍟嗙敤鎴稩d + + + + + 涓婁紶涓嬭浇鍒楄〃 + + + + + 鏌ヨ鍒楄〃鍐呭 + + + + + 鎬绘潯鏁 + + + + + 涓婁紶涓嬭浇鍒楄〃 + + + + + 涓婚敭 璁㈠崟缂栧彿 + + + + + 鏃ユ湡 + + + + + 鍗曟嵁绫诲瀷(浠诲姟绫诲瀷) + + + + + 鐘舵(Key锛 + + + + + 鐘舵 + + + + + 鏂囦欢鍦板潃 + + + + + 鎿嶄綔浜 + + + + + 澶辫触鍘熷洜 + + + + + 浠诲姟绫诲瀷 + + + + + 鐘舵 + + + + + 瀹㈡埛绔悕绉 + + + + + 鎺堟潈token -- 缁欏墠绔敤鐨勯獙璇乼oken + + + + + 鎺堟潈token -- 鍗曠偣缁欒繃鏉ョ殑token + + + + + token澶存爣璇 + + + + + 鍒锋柊token + + + + + 杩囨湡鏃堕棿 + + + + + 鐧诲綍鍚庤淇濆瓨鐨勪俊鎭 + + + + + 鐢ㄦ埛淇℃伅 + + + + + token淇℃伅 + + + + + 鐧诲嚭鐨刣to + + + + + 鎺堟潈token + + + + + 鐢ㄦ埛ID + + + + + PHP-session-ID + + + + + PHP鐧诲綍杩斿洖鐨則oken + + + + + PHP鐧诲綍鐨勮繃鏈熸椂闂 + + + + + ops鑷繁浜х敓鐨則oken 缁欏墠绔獙璇佺敤鐨 + + + + + 鐧诲綍璇锋眰瀵硅薄 + + + + + 璐﹀彿 + + + + + 瀵嗙爜 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 鑿滃崟鐨勮姹傚璞 + + + + + 鐢ㄦ埛ID锛堜笉鏄汉鍛業D锛 + + + + + 搴旂敤ID + + + + + 鑿滃崟鍝嶅簲瀵硅薄 + + + + + + + + + + 涓婄骇鑿滃崟 + + + + + 妯″潡ID锛屽搴攁pps琛↖D + + + + + 鑿滃崟鏍囬 + + + + + 鑿滃崟鏍囩 + + + + + 鑿滃崟璺緞 + + + + + 鎿嶄綔锛屾瘮濡 /admin/info + + + + + 鍥炬爣 + + + + + + + + + + 鎺掑簭 + + + + + 0涓烘櫘閫氭寜閽/杩炴帴锛1涓哄乏渚ц彍鍗 + + + + + 鏄惁鏄剧ず锛0涓哄惁锛1涓烘槸 + + + + + 鏄惁绂佺敤锛0涓哄惁锛1涓烘槸 + + + + + 鏄惁绂佺敤锛歵rue涓虹鐢紝false涓哄惎鐢 + + + + + 瀛愰泦 + + + + + meta + + + + + 鑿滃崟鍚嶅瓧 + + + + + 鑿滃崟鍥炬爣 + + + + + 鐧诲綍鍚庯細璇锋眰鐩稿叧鍏ㄩ儴淇℃伅瀵硅薄 + + + + + 鐢ㄦ埛ID + + + + + 渚涘簲鍟 + + + + + 瀹㈡埛 + + + + + 鐧诲綍鍚庯細鍝嶅簲鐩稿叧鍏ㄩ儴淇℃伅瀵硅薄 + + + + + 浜哄憳 + + + + + 鍏徃 + + + + + 渚涘簲鍟 + + + + + 瀹㈡埛 + + + + + 閮ㄩ棬 + + + + + 鍩烘湰淇℃伅浜哄憳--鍜屽崟鐐圭郴缁熺殑瀛楁涓涓瀵瑰簲 + + + + + 鐢ㄦ埛鍦ㄥ崟鐐逛腑缁翠竴ID + + + + + 鐢ㄦ埛缂栫爜 + + + + + 鐢ㄦ埛涓氬姟鍛樼紪鐮 + + + + + 瑙掕壊id + + + + + 濮撳悕 + + + + + 澶村儚 + + + + + 鐢ㄦ埛鎵嬫満 + + + + + 鐢ㄦ埛閭欢 + + + + + 鍏徃id + + + + + 缁勭粐id + + + + + 渚涘簲鍟唅d + + + + + 瀹㈡埛id + + + + + 鍒涘缓鏃堕棿 + + + + + 鏇存柊鏃堕棿 + + + + + 绛惧悕(鐧诲綍锛夋椂闂 + + + + + 绛惧悕(鐧诲綍锛塱p + + + + + 鍏抽棴鐘舵侊紝0涓烘湭鍏抽棴 + + + + + 鐢ㄦ埛绫诲瀷 1涓哄憳宸ワ紝2涓轰緵搴斿晢锛3涓哄鎴 + + + + + 閮ㄩ棬 + + + + + 鐧诲綍鍚庤幏鍙栫殑:token 淇℃伅-鍜屽崟鐐圭郴缁熺殑瀛楁涓涓瀵瑰簲 + + + + + 鐢ㄦ埛鍦ㄥ崟鐐逛腑缁翠竴ID + + + + + 鍗曠偣璁块棶鐨剆ession id + + + + + 鍚庣画涓庡崟鐐归氫俊楠岃瘉token + + + + + access token杩囨湡鏃堕棿 + + + + + 鐢ㄤ簬access_token杩囨湡鍚庡埛鏂扮敤 + + + + + 鍔犲瘑鍚庣殑鐢ㄦ埛鏁版嵁 + + + + + 鐧诲綍鍚庤幏鍙栫殑:token 淇℃伅-鍜屽崟鐐圭郴缁熺殑瀛楁涓涓瀵瑰簲 + + + + + 鍚庣画涓庡崟鐐归氫俊楠岃瘉token + + + + + access token杩囨湡鏃堕棿 + + + + + 鐢ㄤ簬access_token杩囨湡鍚庡埛鏂扮敤 + + + + + 鍔犲瘑鍚庣殑鐢ㄦ埛鏁版嵁 + + + + + 鐢ㄦ埛鍦ㄥ崟鐐逛腑缁翠竴ID + + + + + 浜哄憳ID + + + + + 鐢ㄦ埛缂栫爜 + + + + + 鐢ㄦ埛涓氬姟鍛樼紪鐮 + + + + + 澶村儚 + + + + + 鏄惁鏄痑dmin璐︽埛 + + + + + 鍏徃id + + + + + 鍏徃鍚嶇О + + + + + 缁勭粐id 鐢ㄦ埛绫诲瀷涓哄唴閮ㄥ憳宸ョ殑鏃跺欐墠鏈夊 + + + + + 渚涘簲鍟唅d 鐢ㄦ埛绫诲瀷涓轰緵搴斿晢鐨勬椂鍊欐墠鏈夊 + + + + + 渚涘簲鍟咰ode 鐢ㄦ埛绫诲瀷涓轰緵搴斿晢鐨勬椂鍊欐墠鏈夊 + + + + + 渚涘簲鍟嗗悕绉 + + + + + 瀹㈡埛id 鐢ㄦ埛绫诲瀷涓哄鎴风殑鏃跺欐墠鏈夊 + + + + + 瀹㈡埛鍚嶇О + + + + + 鐢ㄦ埛绫诲瀷锛1涓哄憳宸ワ紝2涓轰緵搴斿晢锛3涓哄鎴 + + + + + 鐢ㄦ埛鍦ㄥ崟鐐逛腑缁翠竴ID + + + + + 搴忓垪鍙蜂俊鎭 + + + + + 绠盜d + + + + + 绠卞彿 + + + + + 浠撲綅缂栫爜(搴忓垪鍙蜂笉瀛樺湪搴撳瓨鐨勮瘽浠撲綅鏄"") + + + + + 浠撳簱缂栫爜 + + + + + 鏄惁瀛樺湪浜庣搴撳瓨涓 + + + + + 搴忓垪鍙 + + + + + 鐗╂枡鍚嶇О + + + + + 鐗╂枡缂栫爜 + + + + + 鐗╂枡瑙勬牸鍨嬪彿 + + + + + 鏄惁鏄丱ps鏉$爜 + + + + + 鏄惁鍐荤粨 + + + + + 鏄惁婵娲昏繃(鍙湁鍋氳繃 鐩樼偣 閲囪喘鍜岄潪閲囪喘涓婃灦 鍑哄簱鍥為涓婃灦 鎵嶇畻婵娲) + + + + + 鐗╂枡瀵瑰簲鐨勪粨浣嶆湁鍝簺 + + + + + 鐗╂枡缂栫爜 + + + + + 浠撲綅缂栫爜 + + + + + 浠撲綅鍚嶇О + + + + + 缁勭粐 + + + + + 浠撳簱 + + + + + 鎿嶄綔 Id闆嗗悎 + + + + + 鎿嶄綔 Id闆嗗悎 + + + + + 鎿嶄綔 string闆嗗悎 + + + + + 缁勭粐Id(鎵鏈夊垪琛ㄩ〉閮介渶瑕 鍏ㄥ眬) + + + + + 椤垫暟 涓嶄紶榛樿涓1 + + + + + 姣忛〉鏉℃暟 涓嶄紶榛樿姣忛〉10 鏉 + + + + + 鐢熸垚闃蹭吉鐮 + + + + + 缁勭粐Code + + + + + 鐗╂枡缂栫爜 + + + + + 鏁伴噺 + + + + + 闃蹭吉鐮佷笅杞 + + + + + 鐢熸垚璁板綍Id + + + + + 鏄惁鍏ㄩ儴鎿嶄綔 + + + + + 濡傛灉鏄儴鍒嗘搷浣(闃蹭吉鐮) 鍏ㄩ儴鎿嶄綔鐨勮瘽鍙笉浼 + + + + + 闃蹭吉鐮佺敓鎴愬垪琛ㄨ褰 + + + + + 涓婚敭 璁㈠崟缂栧彿 + + + + + 闃蹭吉鐮佹壒娆 + + + + + 鐗╂枡瑙勬牸鍨嬪彿 + + + + + 鐗╂枡缂栫爜 + + + + + 鐗╂枡鍚嶇О + + + + + 鐗╂枡鏉$爜 + + + + + 鐢熸垚瀹屾垚 1 鐢熸垚涓 0 + + + + + 鐢熸垚鏉$爜鏁伴噺 + + + + + 涓嬭浇鏁 + + + + + 鍒涘缓浜 + + + + + 鐢熸垚鏃堕棿 + + + + + 鐢熸垚瀹屾垚鏃堕棿 + + + + + 闃蹭吉鐮佺敓鎴愬垪琛 + + + + + 缁勭粐Code + + + + + 鍒涘缓鏃堕棿 + + + + + 鍒涘缓鏃堕棿 + + + + + 闃蹭吉鐮侀泦鍚 + + + + + 闃蹭吉鐮佹壒鍙 + + + + + 鐢熸垚瀹屾垚 true 鐢熸垚涓 false 涓嶆悳 null鎴栦笉浼 + + + + + 鐗╂枡缂栫爜 + + + + + 闃蹭吉鐮佸垪琛 + + + + + 娴佹按鍙 + + + + + 鐢熸垚璁板綍Id + + + + + 闃蹭吉鐮 + + + + + 鐗╂枡瑙勬牸鍨嬪彿 + + + + + 鏁伴噺 + + + + + 鐢熸垚鏃堕棿 + + + + + 涓嬭浇娆℃暟 + + + + + 鏈鏂颁笅杞芥椂闂 + + + + + 鍒涘缓浜 + + + + + 闃蹭吉鐮佸垪琛 + + + + + 缁勭粐Code + + + + + 鐢熸垚璁板綍Id + + + + + 娴佹按鍙峰尯闂-寮濮 + + + + + 娴佹按鍙峰尯闂-缁撴潫 + + + + + 鏄惁涓嬭浇 true 涓嬭浇 false 鏈笅杞 + + + + + 涓嬭浇鏃堕棿 + + + + + 涓嬭浇鏃堕棿 + + + + + 闃蹭吉鐮 + + + + + 闃蹭吉鐮佸鍑 + + + + + 闃蹭吉鐮 + + + + + 鐗╂枡瑙勬牸鍨嬪彿 + + + + + 鏁伴噺 + + + + + 涓嬭浇娆℃暟 + + + + + 鏈鏂颁笅杞芥椂闂 + + + + + 鐢熸垚璁板綍Ids + + + + + 闃蹭吉鐮佷俊鎭 + + + + + 闃蹭吉鐮 + + + + + 鏄惁绗竴娆℃煡璇 true 绗竴娆 false 涓嶆槸绗竴娆 + + + + + 鏌ヨ娆℃暟 + + + + + 绗竴娆℃煡璇㈡椂闂 + + + + + 瀹㈡埛缂栫爜 + + + + + 瀹㈡埛鍚嶇О + + + + + 鎵嬫満鍙风爜 + + + + + 閭 + + + + + 閭 + + + + + 鏄庣粏 + + + + + 閭 + + + + + 鍚嶇О + + + + + 鍦板潃 + + + + + 鏄庣粏 + + + + + 鍏ュ簱鏄庣粏ID + + + + + 鐗╂枡鍚嶇О + + + + + 鐗╂枡缂栫爜 + + + + + 鐗╂枡瑙勬牸鍨嬪彿 + + + + + 鏁伴噺 + + + + + 鐢熸垚搴忓垪鍙疯姹傚弬鏁 + + + + + 缁勭粐Code + + + + + 鏄庣粏鏁版嵁 + + + + + 鐢熸垚搴忓垪鍙疯姹傚弬鏁拌鎯 + + + + + 鐗╂枡Id杞32杩涘埗 + + + + + 鐗╂枡缂栫爜 + + + + + 瑙勬牸鍨嬪彿 + + + + + 鏁伴噺 + + + + + 閲囪喘鍗曞彿 + + + + + 鏄惁濂楄 + + + + + 鎿嶄綔搴忓垪鍙疯姹傛帴鍙(鎵撳嵃 涓嬭浇) + + + + + 鐢熸垚璁板綍Id + + + + + 鏄惁鍏ㄩ儴鎿嶄綔 + + + + + 濡傛灉鏄儴鍒嗘搷浣(搴忓垪鍙) 鍏ㄩ儴鎿嶄綔鐨勮瘽鍙笉浼 + + + + + 鏍规嵁绠盜d鑾峰彇搴忓垪鐮佷俊鎭 + + + + + 绠盜d + + + + + 搴忓垪鍙峰垪琛ㄦ悳绱㈣繑鍥炲弬鏁 + + + + + 鐗╂枡缂栫爜 + + + + + 鐗╂枡鍚嶇О + + + + + 鐗╂枡瑙勬牸鍨嬪彿 + + + + + 杞崲鍓嶈鏍煎瀷鍙 + + + + + 鐗╂枡鏉$爜 + + + + + 搴忓垪鐮 + + + + + 鏁板瓧搴忓垪鐮 + + + + + 搴忓垪鐮佹祦姘村彿 + + + + + 鏁伴噺 + + + + + 鏄惁浣跨敤 + + + + + 鏄惁浣跨敤 + + + + + 绠卞彿 + + + + + 鍒涘缓浜 + + + + + 鐢熸垚鏃堕棿 + + + + + 鎵撳嵃娆℃暟 + + + + + 涓嬭浇娆℃暟 + + + + + 鏈鏂版墦鍗版椂闂 + + + + + 鏈鏂颁笅杞芥椂闂 + + + + + 鏄惁鍏佽鎵撳嵃(搴忓垪鐮佸凡缁忚浣跨敤 浣嗘病鏈夌鍙,閭d箞灏辨槸琚玾ms绯荤粺鎷夊幓浣跨敤浜,涓嶈兘鍐嶈鎵撳嵃) + + + + + 鏄惁涓轰袱浠惰锛屼负浜嗘帶鍒跺悗闈㈢殑鍙樺姩锛岃涓烘暣鏁板舰锛0鍜1鐪嬩綔1锛2浠h〃2浠惰锛3浠h〃涓変欢瑁 alter by yzh + + + + + 绗簩涓簭鍒楀彿 + + + + + 搴忓垪鍙峰垪琛ㄦ悳绱㈣姹傚弬鏁 + + + + + 缁勭粐Code + + + + + 鐢熸垚璁板綍Id + + + + + 鎵撳嵃鐘舵 宸叉墦鍗 true 鏈墦鍗 false + + + + + 浣跨敤鐘舵 宸蹭娇鐢 true 鏈娇鐢 false + + + + + 涓嬭浇鏃堕棿 + + + + + 涓嬭浇鏃堕棿 + + + + + 鎵撳嵃鏃堕棿 + + + + + 鎵撳嵃鏃堕棿 + + + + + 搴忓垪鍙 + + + + + 搴忓彿鍖洪棿-寮濮 + + + + + 搴忓彿鍖洪棿-缁撴潫 + + + + + 鏄惁鏇存敼杩囩墿鏂欑紪鐮 + + + + + 绠卞彿 + + + + + 鏁板瓧搴忓垪鍙 + + + + + 鏁板瓧搴忓垪鐮-寮濮 + + + + + 鏁板瓧搴忓垪鐮-缁撴潫 + + + + + 鏄惁涓轰袱浠惰锛屼负浜嗘帶鍒跺悗闈㈢殑鍙樺姩锛岃涓烘暣鏁板舰锛0鍜1鐪嬩綔1锛2浠h〃2浠惰锛3浠h〃涓変欢瑁 alter by yzh + + + + + 搴忓垪鐮佸鍑烘暟鎹 + + + + + 渚涘簲鍟嗘垨缁勭粐 + + + + + 鐗╂枡缂栫爜 + + + + + 鐗╂枡鍚嶇О + + + + + 鐗╂枡瑙勬牸鍨嬪彿 + + + + + 鐗╂枡鏉$爜 + + + + + 搴忓垪鐮 + + + + + 鏁板瓧搴忓垪鐮 + + + + + 鏁伴噺 + + + + + 搴忓垪鐮佸鍑哄弬鏁 + + + + + 鐢熸垚璁板綍Ids + + + + + 搴忓垪鐮佷俊鎭 + + + + + 搴忓垪鍙 + + + + + 鐗╂枡鍚嶇О + + + + + 鐗╂枡缂栫爜 + + + + + 鐗╂枡瑙勬牸鍨嬪彿 + + + + + 鐢熸垚鏃堕棿鏃堕棿 + + + + + 閲囪喘鍗曞彿 + + + + + 渚涘簲鍟 + + + + + 搴忓垪鍙蜂俊鎭 + + + + + 鐗╂枡瑙勬牸鍨嬪彿 + + + + + 鐗╂枡缂栫爜 + + + + + 鐗╂枡鍚嶇О + + + + + 鐗╂枡鏉$爜 + + + + + 搴忓垪鍙 + + + + + 鏁板瓧搴忓垪鍙 + + + + + 绠卞彿 + + + + + 鏄惁宸茬粡瑁呯 true 宸茬粡瑁呯 false 鏈绠 + + + + + 鏄惁鏄凡缁忓瓨鍦ㄧ殑鏁版嵁 榛樿灏辨槸true + 鍓嶇鎿嶄綔鏂板鍔犵殑鏁版嵁灏辨槸false 鍚庣淇濆瓨鍒版暟鎹簱鎵嶄細鍙樻垚true + + + + + 鏄惁浣跨敤鐨勬槸鏁板瓧搴忓垪鐮佹湭浣跨敤null,鏁板瓧搴忓垪鐮乼rue,搴忓垪鐮乫alse + + + + + 鏄惁涓轰袱浠跺浜у搧 + + + + + 濂楄缂栫爜 + + + + + 绗簩涓簭鍒楃爜 + + + + + 鑾峰彇娌℃湁瑁呰繃绠辩殑搴忓垪鐮 + + + + + 搴忓垪鍙 + + + + + wms绯荤粺璇锋眰搴忓垪鐮佽繑鍥 + + + + + 搴忓垪鍙 + + + + + 鐗╂枡缂栫爜 + + + + + 鍒涘缓浜 + + + + + 鐢熸垚鏃堕棿 + + + + + 搴忓垪鍙风敓鎴愯褰曞垪琛ㄨ繑鍥炲弬鏁 + + + + + 涓婚敭缂栧彿 + + + + + 鐗╂枡瑙勬牸鍨嬪彿 + + + + + 鐗╂枡缂栫爜 + + + + + 鐗╂枡鍚嶇О + + + + + 鐗╂枡鏉$爜 + + + + + 閲囪喘鍗曞彿 + + + + + 鐢熸垚瀹屾垚 1 鐢熸垚涓 0 + + + + + 鐢熸垚鏉$爜鏁伴噺 + + + + + 鎵撳嵃鏁 + + + + + 涓嬭浇鏁 + + + + + 浣跨敤鏁 + + + + + 鍒涘缓浜 + + + + + 鐢熸垚鏃堕棿 + + + + + 鐢熸垚瀹屾垚鏃堕棿 + + + + + 渚涘簲鍟嗘垨缁勭粐 + + + + + 鏄惁鏇存敼杩囩墿鏂欑紪鐮 + + + + + 鏄惁涓や欢瑁 + + + + + 搴忓垪鍙风敓鎴愯褰曞垪琛ㄨ姹傚弬鏁 + + + + + 缁勭粐Code + + + + + 渚涘簲鍟嗘垨缁勭粐 + + + + + 鍒涘缓鏃堕棿 + + + + + 鍒涘缓鏃堕棿 + + + + + 搴忓垪鍙烽泦鍚 + + + + + 鐢熸垚瀹屾垚 true 鐢熸垚涓 false 涓嶆悳 null鎴栦笉浼 + + + + + 鐗╂枡缂栫爜 + + + + + 閲囪喘鍗曞彿 + + + + + 绠卞彿 + + + + + 鏁板瓧搴忓垪鍙 + + + + + 鐢熸垚浜 + + + + + 鏄惁鏇存敼杩囩墿鏂欑紪鐮 + + + + + 鏄惁涓や欢瑁 + + + + + 淇敼搴忓垪鍙风殑鐗╂枡 + + + + + 鐢熸垚璁板綍Id + + + + + 鐗╂枡缂栫爜 + + + + + 鎿嶄綔(搴忓垪鍙) + + + + + ID璇锋眰瀵硅薄 + + + + + ID + + + + + Id闆嗗悎 + + + + + 鍚嶇О璇锋眰瀵硅薄 + + + + + 鍚嶇О + + + + + + + + + + 缂栫爜 + + + + + erp瀵瑰簲Code + + + + + 鍚嶇О + + + + + 缁勭粐绫诲瀷锛1涓轰富涓氬姟锛2涓鸿緟涓氬姟 3涓哄伐鍘 + + + + + 鏈綅甯佸悕绉 + + + + + 鏈綅甯乮d + + + + + 鑷姩鎺掍骇榛樿鍏ュ簱浠撳簱 + + + + + 鏄惁绂佺敤锛歵rue涓虹鐢紝false涓哄惎鐢 + + + + + 鍗曠偣鏁版嵁-璇锋眰缁熶竴瀵硅薄 + + + + + 鍏徃ID + + + + + 鍗曠偣鏁版嵁鍝嶅簲-缁熶竴瀵硅薄 + + + + + ID + + + + + 缂栫爜 + + + + + 鍚嶇О + + + + + 缁勭粐缂栫爜瀵瑰簲閲戣澏 + + + + + 鏁板 + + + + + 鏄惁绂佺敤锛歵rue涓虹鐢紝false涓哄惎鐢 + + + + + 浠撲綅 + + + + + 浠撳簱ID + + + + + 渚涘簲鍟嗕俊鎭 + + + + + 渚涘簲鍟咺d + + + + + 渚涘簲鍟嗙紪鐮 + + + + + 渚涘簲鍟嗗悕瀛 + + + + + 缁勭粐杩斿洖瀵硅薄 + + + + + + + + + + 缂栫爜 + + + + + 鍚嶇О + + + + + 缁勭粐绫诲瀷锛1涓轰富涓氬姟锛2涓鸿緟涓氬姟 3涓哄伐鍘 + + + + + 鏈綅甯佸悕绉 + + + + + 鏈綅甯乮d + + + + + 鑷姩鎺掍骇榛樿鍏ュ簱浠撳簱 + + + + + 鏄惁绂佺敤锛歵rue涓虹鐢紝false涓哄惎鐢 + + + + + erp瀵瑰簲Code + + + + + 鍛樺伐鍝嶅簲 + + + + + StaffID + + + + + 鍚嶇О + + + + + 閮ㄩ棬ID + + + + + 鐢佃瘽 + + + + + 鏄惁绂佺敤锛歵rue涓虹鐢紝false涓哄惎鐢 + + + + + 绯荤粺code鑾峰彇 + + + + + 绯荤粺code + + + + + 浠撳簱鍚嶇О + + + + + 浠撳簱鍝嶅簲 + + + + + id + + + + + 鍚嶇О + + + + + 缂栫爜 + + + + + 瀵瑰簲閲戣澏鐨勭粍缁囩紪鐮 + + + + + 鏄惁绂佺敤锛歵rue涓虹鐢紝false涓哄惎鐢 + + + + + 浠撲綅鍝嶅簲瀵硅薄 + + + + + id + + + + + 浠撳簱ID + + + + + 浠撳簱鍚嶇О + + + + + 浠撳簱code + + + + + 瀵瑰簲鐨勯噾铦剁粍缁囩紪鐮 + + + + + 鍚嶇О + + + + + 缂栫爜 + + + + + 浜哄憳璇锋眰瀵硅薄 + + + + + 鐢ㄦ埛ID + + + + + 璇锋眰浠撲綅瀵硅薄 + + + + + 鍚嶇О + + + + + 浠撳簱 + + + + + 缁勭粐 + + + + + 鐢熸垚搴忓垪鍙锋ā鏉 + + + + + 鐗╂枡瑙勬牸鍨嬪彿 + + + + + 鐗╂枡鍚嶇О + + + + + 閲囪喘鍗曞彿 + + + + + 鍩虹被 + + + + + Id + + + + + 鍩虹被 + + + + + Id + + + + + 瀹氫箟cache + + + + + 璁剧疆cache + + 閿 + 鍊 + + + + 鑾峰彇cache + + 閿 + + + + + 鏃堕棿杞崲 + + + + + 鏃堕棿鎴宠鏃跺紑濮嬫椂闂 + + + + + DateTime杞崲涓10浣嶆椂闂存埑锛堝崟浣嶏細绉掞級 + + DateTime + 10浣嶆椂闂存埑锛堝崟浣嶏細绉掞級 + + + + DateTime杞崲涓13浣嶆椂闂存埑锛堝崟浣嶏細姣锛 + + DateTime + 13浣嶆椂闂存埑锛堝崟浣嶏細姣锛 + + + + 10浣嶆椂闂存埑锛堝崟浣嶏細绉掞級杞崲涓篋ateTime + + 10浣嶆椂闂存埑锛堝崟浣嶏細绉掞級 + DateTime + + + + 13浣嶆椂闂存埑锛堝崟浣嶏細姣锛夎浆鎹负DateTime + + 13浣嶆椂闂存埑锛堝崟浣嶏細姣锛 + DateTime + + + + 杞瓧绗︿覆 + + 锛 + DateTime + + + + 杞瓧绗︿覆 + + 锛 + DateTime + + + + 杞瓧绗︿覆(娌℃湁绌烘牸) + + 锛 + DateTime + + + + 杞瓧绗︿覆(娌℃湁绌烘牸) + + 锛 + DateTime + + + + 杞瓧绗︿覆 + + 锛 + DateTime + + + + 杞瓧绗︿覆 + + 锛 + DateTime + + + + 杞瓧绗︿覆 + + 锛 + DateTime + + + + 杞瓧绗︿覆 + + 锛 + DateTime + + + + 涓や釜鏃堕棿鐨勫樊锛氬垎閽 + + + + + + + + 褰撳墠鏃堕棿鍜屼粖鏅0鐐逛箣闂寸殑鏃堕棿鐨勫樊锛氬垎閽 + + + + + + 淇濆瓨鍗曚釜key value + + 淇濆瓨鐨勫 + 杩囨湡鏃堕棿 + + + + 鑾峰彇鍗曚釜key鐨勫 + + + + + 绉婚櫎redis + + + + + + + 鑾峰彇涓涓猭ey鐨勫璞 + + + + + 淇濆瓨涓涓璞 + + + + + + 缁撴灉瀵硅薄 + + + + + 杩斿洖缁撴灉瀵硅薄 + + + + + 杩斿洖缁撴灉瀵硅薄 + + + + + + + 杩斿洖缁撴灉瀵硅薄 + + + + + + 鎵ц鏄惁鎴愬姛 + + + + + 鎵ц鏄惁鎴愬姛 + + + + + 涓氬姟杩斿洖鐮 + + + + + 鎵ц杩斿洖娑堟伅 + + + + + 杞崲瀹炰綋 + + + + + + 杞崲瀹炰綋 + + + + + + + 杞崲瀹炰綋 + + 缁撴灉瀵硅薄 + + + + 鍒涘缓杩斿洖淇℃伅锛堣繑鍥炲鐞嗗け璐ワ級 + + 缁撴灉娑堟伅 + 缁撴灉鐘舵 + + + + + 鍒涘缓杩斿洖淇℃伅锛堣繑鍥炲鐞嗗け璐ワ級 + + 缁撴灉娑堟伅 + + + + + 鍒涘缓杩斿洖淇℃伅锛堣繑鍥炲鐞嗗け璐ワ級 + + 缁撴灉 + + + + + 鍒涘缓杩斿洖淇℃伅锛堣繑鍥炲鐞嗗け璐ワ級 + + 缁撴灉娑堟伅 + 缁撴灉鐘舵 + + + + + 鍒涘缓杩斿洖淇℃伅锛堣繑鍥炲鐞嗗け璐ワ級 + + 缁撴灉娑堟伅 + + + + + 鍒涘缓鎴愬姛鐨勮繑鍥炴秷鎭 + + + + + + 鍒涘缓鎴愬姛鐨勮繑鍥炴秷鎭 + + + + + + 杞崲涓 task + + + + + + 瀹炰綋缁撴灉瀵硅薄 + + + + + + 瀹炰綋缁撴灉 + + + + + 瀹炰綋缁撴灉 + + + + + + 杩斿洖缁撴灉瀵硅薄 + + + + + + + 杩斿洖瀵硅薄 + + + + + 鍒涘缓鎴愬姛鐨勮繑鍥炴秷鎭 + + + + + + 鍒涘缓杩斿洖淇℃伅锛堣繑鍥炲鐞嗗け璐ワ級 + + 缁撴灉娑堟伅 + 缁撴灉鐘舵 + + + + + 鍒涘缓杩斿洖淇℃伅锛堣繑鍥炲鐞嗗け璐ワ級 + + 缁撴灉娑堟伅 + + + + + 鍒涘缓杩斿洖淇℃伅锛堣繑鍥炲鐞嗗け璐ワ級 + + 缁撴灉 + + + + + 杞崲涓簍ask + + + + + + 澶勭悊鎴愬姛 + + + + + 閿欒璇锋眰 + + + + + 鏈巿鏉 + + + + + 鎷掔粷璇锋眰 + + + + + 鏈壘鍒版湇鍔 + + + + + 绯荤粺閿欒 + + + + + 璇锋眰瓒呮椂 + + + + + 杩斿洖瀵硅薄鎵╁睍 + + + + + 鏍规嵁鏇挎崲绗﹁繘琛屾浛鎹㈡敮浠 + + 缁撴灉瀵硅薄 + 鏇挎崲瀛楃 + + + + + 闆嗗悎缁撴灉绫 + + + + + + 瀹炰綋闆嗗悎缁撴灉 + + + + + 瀹炰綋闆嗗悎缁撴灉 + + 瀹炰綋闆嗗悎 + + + + 瀹炰綋闆嗗悎缁撴灉 + + 瀹炰綋闆嗗悎 + 缁撴灉鐘舵 + + + + 鍒涘缓鎴愬姛鐨勮繑鍥炴秷鎭 + + + + + + 鍒涘缓鎴愬姛鐨勮繑鍥炴秷鎭 + + + + + + 鍒涘缓杩斿洖淇℃伅锛堣繑鍥炲鐞嗗け璐ワ級 + + 缁撴灉娑堟伅 + 缁撴灉鐘舵 + + + + + 鍒涘缓杩斿洖淇℃伅锛堣繑鍥炲鐞嗗け璐ワ級 + + 缁撴灉娑堟伅 + + + + + 鍒涘缓杩斿洖淇℃伅锛堣繑鍥炲鐞嗗け璐ワ級 + + 缁撴灉 + + + + + 杞崲涓 task + + + + + + 鍒嗛〉鍒楄〃缁撴灉瀵硅薄 + + + + + 瀹炰綋鍒嗛〉闆嗗悎缁撴灉 + + + + + 瀹炰綋鍒嗛〉闆嗗悎缁撴灉 + + 瀹炰綋闆嗗悎 + 鎬绘潯鏁 + + + + 瀹炰綋鍒嗛〉闆嗗悎缁撴灉 + + + + + + + + Total count of Items. + + + + + 鍒涘缓鎴愬姛鐨勮繑鍥炴秷鎭 + + 瀹炰綋闆嗗悎 + 鎬绘潯鏁 + + + + + 鍒涘缓鎴愬姛鐨勮繑鍥炴秷鎭 + + + + + + 鍒涘缓杩斿洖淇℃伅锛堣繑鍥炲鐞嗗け璐ワ級 + + 缁撴灉娑堟伅 + 缁撴灉鐘舵 + + + + + 鍒涘缓杩斿洖淇℃伅锛堣繑鍥炲鐞嗗け璐ワ級 + + 缁撴灉娑堟伅 + + + + + 鍒涘缓杩斿洖淇℃伅锛堣繑鍥炲鐞嗗け璐ワ級 + + 缁撴灉 + + + + + 杞崲涓 task + + + + + + 鐢ㄤ簬绛惧悕鐨勭閽 + + + + + 鐢ㄤ簬楠岃瘉鐨勫叕閽 + + + + + 绛惧悕 + + 绛惧悕鍐呭 + 绉侀挜 + 缂栫爜绫诲瀷 + 鍔犲瘑鏂瑰紡 + 鍔犲瘑瀵嗘枃 + + + + 楠岃瘉绛惧悕 + + 楠岃瘉绛惧悕鍐呭 + 鍏挜 + 绛惧悕瀵嗘枃 + 缂栫爜绫诲瀷 + 鍔犲瘑鏂瑰紡 + 鍔犲瘑瀵嗘枃 + + + + 瑙e瘑 + + 瀵嗘枃 + 绉侀挜 + 缂栫爜 + 鏄庢枃 + + + + 鍔犲瘑 + + 鏄庢枃 + 鍏挜 + 缂栫爜 + 瀵嗘枃 + + + + 瑙e瘑鍏挜 + + + + + + + + + 绉侀挜瑙e瘑 + + + + + + + + + Pkcs#8 璇佷功瑙e瘑 + + + + + + + 鑾峰彇Integer鐨勫ぇ灏 + + + + + + + 鑾峰彇绉侀挜鐨勭被鍨 + + + + + + + php鍗曠偣鐧诲綍瑙f瀽token鏍规嵁瀵嗛挜-鍒嗘瑙f瀽 + + + + + + + + 瀵嗛挜绫诲瀷鏋氫妇 + + + + + 1024 + + + + + 2048 + + + + + 1023 + + + + + 2048 + + + + + 鏁板煎鐞 + + + + + Decimal 鏁板肩簿搴﹁浆鎹 + + decimal鏁板 + 绮惧害鍊 + 鑸嶅叆绫诲瀷锛1涓鸿繘浣嶏紝2涓鸿垗浣嶏紝3涓哄洓鑸嶄簲鍏 + decimal鏁板 + + + + Decimal 鏁板肩簿搴﹁浆鎹 + + decimal鏁板 + 绮惧害鍊 + 鑸嶅叆绫诲瀷锛1涓鸿繘浣嶏紝2涓鸿垗浣嶏紝3涓哄洓鑸嶄簲鍏 + decimal鏁板 + + + + Decimal 鍘绘帀鍚庨潰鏃犳晥鐨0 + + + + + + diff --git a/src/BarCode.Web.Api/wwwroot/BarCode.Web.Domain.xml b/src/BarCode.Web.Api/wwwroot/BarCode.Web.Domain.xml new file mode 100644 index 0000000..80207e2 --- /dev/null +++ b/src/BarCode.Web.Api/wwwroot/BarCode.Web.Domain.xml @@ -0,0 +1,4028 @@ + + + + BarCode.Web.Domain + + + + + 绠变俊鎭ご + alter table t_barcode_box_details AUTO_INCREMENT=50000; + + + + + ID + + + + + 绠辩紪鍙 + + + + + 渚涘簲鍟咰ode + + + + + 缁勭粐Code + + + + + 鍏徃Id + + + + + 绠辩姸鎬 + + + + + 瑁呯寮濮嬫椂闂 + + + + + 瑁呯缁撴潫鏃堕棿(瀹屾垚瑁呯鏃堕棿) + + + + + 瑁呯鐢ㄦ埛 + + + + + 绠卞瓙鍒涘缓鐢ㄦ埛 + + + + + 鍒涘缓鏃堕棿 + + + + + 绠卞彿鎵撳嵃娆℃暟 + + + + + 鏈鏂版墦鍗版椂闂 + + + + + 鏄庣粏 + + + + + 鎵撳嵃 + + + + + 瑙g粦搴忓垪鍙 + + + + + + + 娓呯┖ + + + + + 瑁呯 + + + + + 寮濮嬭绠 + + + + + + + 閲嶇疆 + + + + + 鑰乷ps绠变俊鎭槑缁 + alter table t_barcode_box_details AUTO_INCREMENT=50000; + + + + + ID + + + + + 鍗曟嵁澶碔D + + + + + 鐗╂枡缂栫爜 + + + + + 鏁伴噺锛堣绠辨暟閲忥級 + + + + + 搴忓垪鍙 + + + + + 绠卞敍琛 + + + + + ID + + + + + 渚涘簲鍟咰ode + + + + + 缁勭粐Code + + + + + 璁㈠崟缂栧彿 + + + + + 鐗╂枡缂栫爜 + + + + + 浜у搧鏁伴噺 + + + + + 瑁呯鏁伴噺 + + + + + 瑁呯鍑閲 + + + + + 瑁呯姣涢噸 + + + + + 灏剧鏁伴噺 + + + + + 灏剧鍑閲 + + + + + 灏剧姣涢噸 + + + + + 澶囨敞 + + + + + 鎿嶄綔浜 + + + + + 鍒涘缓鏃堕棿锛堢敓鎴愭椂闂达級 + + + + + 娴佹按鍙(寮濮) + + + + + 娴佹按鍙(缁撴潫) + + + + + 缂栧彿闆嗗悎 + + + + + 鍒涘缓 + + + + + + 鐢熸垚缂栧彿 + + + + + + + 绠卞敍琛-缂栧彿琛 + + + + + ID + + + + + 涓婄骇ID + + + + + 绠卞敍缂栧彿 + + + + + 绠卞敍缂栧彿-棣栦綅 + + + + + 绠卞敍缂栧彿-鏈熬搴忓彿 + + + + + 鏄惁鏄熬绠 + + + + + 鎺掑簭 + + + + + 娴佹按鍙(寮濮) + + + + + 娴佹按鍙(缁撴潫) + + + + + 鐢熸垚缂栧彿 + + + + + + + 鐢熸垚璁″垝绠$悊 + + + + + 涓婚敭 璁㈠崟缂栧彿 + + + + + 鍚屾绫诲瀷 + + + + + 鏁伴噺 + + + + + 鏂囦欢涓嬭浇绫诲瀷 + + + + + 涓婚敭 璁㈠崟缂栧彿 + + + + + 鏃ユ湡 + + + + + 鍗曟嵁绫诲瀷(浠诲姟绫诲瀷) + + + + + 鐘舵 + + + + + 鍏徃Id + + + + + 缁勭粐缂栫爜 + + + + + 鏂囦欢鍦板潃 + + + + + 鎿嶄綔浜 + + + + + 澶辫触鍘熷洜 + + + + + 渚涘簲鍟嗙紪鐮 + + + + + 鐗╂枡 + + + + + ID + + + + + 缁勭粐Id + + + + + 缁勭粐缂栫爜 + + + + + 鐗╂枡ID + + + + + 鐗╂枡鍚嶇О + + + + + 鐗╂枡缂栫爜 + + + + + 鐗╂枡瑙勬牸鍨嬪彿 + + + + + 鍩烘湰鍗曚綅 + + + + + 鍩烘湰鍗曚綅鍚嶇О + + + + + 鍩烘湰鍗曚綅缂栫爜 + + + + + 鏉$爜 + + + + + 鏄惁鍚敤鎵瑰彿绠$悊 + + + + + 鐗╂枡Id 32杩涘埗瀛楃涓 + + + + + 闃蹭吉鐮佺敓鎴愯褰 + + + + + 涓婚敭 璁㈠崟缂栧彿 + + + + + 闃蹭吉鐮佹壒娆 + + + + + 鐗╂枡缂栫爜 + + + + + 鍏徃Id + + + + + 缁勭粐Id + + + + + 渚涘簲鍟哻ode + + + + + 鐢熸垚瀹屾垚 1 鐢熸垚涓 0 + + + + + 鐢熸垚鏉$爜鏁伴噺 + + + + + 涓嬭浇鏁 + + + + + 鍒涘缓浜 + + + + + 鐢熸垚鏃堕棿 + + + + + 鐢熸垚瀹屾垚鏃堕棿 + + + + + 鐢熸垚瀹屾垚 + + + + + 涓嬭浇 + + + + + 鐢熸垚鎵瑰彿 + + + + + 闃蹭吉鐮 + + + + + 涓婚敭 璁㈠崟缂栧彿 + + + + + 缁勭粐Code + + + + + 渚涘簲鍟哻ode + + + + + 鐢熸垚璁板綍Id + + + + + 闃蹭吉鐮 + + + + + 鐗╂枡缂栫爜 + + + + + 涓嬭浇娆℃暟 + + + + + 鏈鏂颁笅杞芥椂闂 + + + + + 鏌ヨ娆℃暟 + + + + + 绗竴娆℃煡璇㈡椂闂 + + + + + 鍒涘缓浜 + + + + + 鐢熸垚鏃堕棿 + + + + + 涓嬭浇 + + + + + 鐢熸垚闃蹭吉鐮 + + + + + 琚煡璇 + + + + + 搴忓垪鍙风敓鎴愯褰 + + + + + 涓婚敭 璁㈠崟缂栧彿 + + + + + 鐗╂枡Id杞32杩涘埗 + + + + + 鐗╂枡缂栫爜 + + + + + 鏄惁鏇存敼杩囩墿鏂欑紪鐮 + + + + + 閲囪喘鍗曞彿 + + + + + 渚涘簲鍟哻ode + + + + + 鍏徃Id + + + + + 缁勭粐Id + + + + + 鐢熸垚瀹屾垚 1 鐢熸垚涓 0 + + + + + 鐢熸垚鏉$爜鏁伴噺 + + + + + 鐢熸垚鏉$爜璧峰浣嶆暟閲(鍚庣鐢ㄦ潵鍋氭爣璁) + + + + + 鎵撳嵃鏁 + + + + + 涓嬭浇鏁 + + + + + 浣跨敤鏁 + + + + + 鍒涘缓浜 + + + + + 鏄惁濂楄锛岄粯璁ゆ槸涓1锛1鍗充负鍗曚釜锛屼笉鏄瑁匒lter by yzh + + + + + 鐢熸垚鏃堕棿 + + + + + 鐢熸垚瀹屾垚鏃堕棿 + + + + + 鐢熸垚瀹屾垚 + + + + + 鎵撳嵃 + + + + + 涓嬭浇 + + + + + 鍙嶅啓浣跨敤鏁 + + + + + + 鏍囪淇敼鐗╂枡 + + + + + 搴忓垪鍙 榛樿Id浠 200000000 璧峰 + alter table users AUTO_INCREMENT=200000000; + + + + + 涓婚敭 璁㈠崟缂栧彿 + + + + + 缁勭粐Code + + + + + 渚涘簲鍟哻ode + + + + + 鐢熸垚璁板綍Id + + + + + 搴忓垪鍙 + + + + + 濂楄(1浠h〃鍗曞锛2浠h〃2濂楋紝3浠h〃3濂楋級 aLTER BY YZH + + + + + 褰撴搴忓彿锛岀敤鏉ヨ褰曞綋娆℃墍浜х敓鏃舵墍澶勭殑搴忓垪鍙 + + + + + 搴忓垪鍙 + + + + + 浜х敓绗簩涓 + + + + + 鐗╂枡Id + + + + + 鐗╂枡缂栫爜 + + + + + 鑰佺墿鏂欑紪鐮(涓婁竴娆$墿鏂欑紪鐮) + + + + + 绠盜D + + + + + 鏁板瓧搴忓垪鐮 + + + + + 鏁板瓧搴忓垪鐮(涓嶅寘鍚棩鏈) + + + + + 鏄惁浣跨敤 + + + + + 鍒涘缓浜 + + + + + 鐢熸垚鏃堕棿 + + + + + 瀹屾垚瑁呯鏃堕棿 + + + + + 鎵撳嵃娆℃暟 + + + + + 涓嬭浇娆℃暟 + + + + + 鏈鏂版墦鍗版椂闂 + + + + + 鏈鏂颁笅杞芥椂闂 + + + + + 鏄惁浣跨敤鐨勬槸鏁板瓧搴忓垪鐮佹湭浣跨敤null,鏁板瓧搴忓垪鐮乼rue,搴忓垪鐮乫alse + + + + + 鐢熸垚搴忓垪鐮 + + + + + 鐢熸垚鏃堕棿搴忓垪鐮 + + + + + 浜х敓濂楄缂栫爜 alter by yzh + + + + + + 浜х敓绗簩涓簭鍒楀彿 + + + + + + 鎵撳嵃 + + + + + 涓嬭浇 + + + + + 瑁呯 + + + + + + + 瑙g粦绠 + + + + + wms绯荤粺鑾峰彇搴忓垪鐮佸悗 搴忓垪鐮佽皟鏁翠负宸蹭娇鐢 + + + + + 淇敼鐗╂枡缂栫爜 + + + + + + 鍒楄〃瀛楁瀵煎嚭鎺ュ彛 + + + + + + + + 鍩虹鏁版嵁 + + + + + 鏍规嵁鐢ㄦ埛绮剧‘鎼滅储鐢ㄦ埛 + + + + + + + 鑾峰彇鎵鏈変汉鍛-鏍规嵁涓讳綋 + + + + + + + 鏍规嵁浠撳簱鑾峰彇瀛愪粨搴 + + 浠撳簱id + + + + + 鑾峰彇浠撲綅锛氭牴鎹畁ame妯$硦锛屽拰绯荤粺code鍜屽叕鍙 + + + + + + + + + 鑾峰彇浠撲綅璇︽儏锛氭牴鎹粨浣岻D鍜屽叕鍙窱D + + + + + + + + 鑾峰彇浠撲綅闆嗗悎锛氭牴鎹粨浣岻D闆嗗悎鍜屽叕鍙窱D + + + + + + + + 鑾峰彇浠撲綅璇︽儏锛氭牴鎹粨浣岻D鍜屽叕鍙窱D + + + + + + + + 鑾峰彇浠撲綅闆嗗悎锛氭牴鎹粨浣嶇紪鐮侀泦鍚堝拰鍏徃ID + + + + + + + + 鑾峰彇浠撳簱 + + + + + + 鑾峰彇浜嬪姟 鐢ㄦ潵澶勭悊鍗虫椂搴撳瓨 + + + + + + 鑾峰彇浜嬪姟 鐢ㄦ潵澶勭悊鍗虫椂搴撳瓨 + + + + + + 绠卞敍-浠撳偍鎺ュ彛 + + + + + 鍒楄〃鍒嗛〉 + + + + + + + + 娣诲姞 + + + + + + + + 璇︽儏-鏍规嵁鏈鏂扮殑ID + + + + + + 鍒楄〃-璇︽儏淇℃伅鍒楄〃 + + + + + + + + 鑾峰彇鏈鏂扮殑缂栧彿瀹炰綋 + + + + + + 鎵归噺鍒犻櫎 + + + + + + + + 鑰乷ps绠变俊鎭 + + + + + 鑾峰彇鍒楄〃 + + + + + + + + 鎵归噺娣诲姞 + + + + + + + 鏌ヨ瀹炰綋闆嗗悎 + + + 鏌ヨ瀹炰綋闆嗗悎 + + + + 鐢熸垚鏁版嵁绠$悊 + + + + 鑾峰彇鏈鏂颁竴娆℃洿鏂版椂闂 + + + 瀹氭椂浠诲姟鎵ц鍚庢洿鏂版椂闂 + + + 瀹氭椂浠诲姟鎵ц鍚庡垱寤 + + + + 淇濆瓨 + + + + + + + 缂栬緫 + + + + + + + 鑾峰彇閿鍞垪琛 + + + + + + 鍏徃Id + + + + + 鍛樺伐ID + + + + + 鐧诲綍鐢ㄦ埛淇℃伅 + + + + + 鐗╂枡浠撳偍鎺ュ彛 + + + + + 鐗╂枡娣诲姞 + + + + + + + + 鍒楄〃 + + + + + + 鐗╂枡 + + + + + + + 鐗╂枡 + + + + + + + + + + + + + + 鍒楄〃 + + + + + + + + 鍒楄〃(鑾峰彇鎵鏈夋病鏈塱d32杩涘埗鐨勭墿鏂) + + + + + + 淇敼鐗╂枡 + + + + + + + + 闆嗗悎 + + + + + + + 闃蹭吉鐮佺敓鎴愯褰 + + + + 鑾峰彇鍒楄〃 + + + 鏂板 + + + 缂栬緫 + + + 鎵归噺娣诲姞 + + + 淇敼瀹炰綋闆嗗悎 + + + 鏌ヨ瀹炰綋闆嗗悎 + + + 鏌ヨ瀹炰綋 + + + 鑾峰彇褰撳ぉ鐢熸垚璁板綍鏉℃暟 + + + + 闃蹭吉鐮 + + + + 鑾峰彇鍒楄〃 + + + 鎵归噺娣诲姞 + + + 淇敼瀹炰綋闆嗗悎 + + + 鏌ヨ瀹炰綋闆嗗悎 + + + 鏍规嵁鐢熸垚璁板綍id鏌ヨ搴忓垪鐮 + + + 鏍规嵁鐢熸垚璁板綍id鏌ヨ搴忓垪鐮 + + + 鏌ヨ瀹炰綋 + + + 淇敼瀹炰綋 + + + + 涓嬭浇鍙嶅啓 鎵цsql璇彞 + + + + + + + 搴忓垪鐮 + + + + + 鑾峰彇鍒楄〃 + + + + + + + + 鎵归噺娣诲姞 + + + + + + + 淇敼瀹炰綋闆嗗悎 + + + 鏌ヨ瀹炰綋闆嗗悎 + + + 鏌ヨ瀹炰綋闆嗗悎 + + + 鏍规嵁绠盜d鏌ヨ搴忓垪鐮 + + + 鏍规嵁鐢熸垚璁板綍id鏌ヨ搴忓垪鐮 + + + 鏍规嵁濂楄鐮佹煡璇㈠簭鍒楃爜 + + + 鏍规嵁鐢熸垚璁板綍id鏌ヨ搴忓垪鐮 + + + 鏍规嵁绠卞彿鏌ヨ搴忓垪鐮 + + + 鏌ヨ瀹炰綋 + + + 鏌ヨ瀹炰綋 + + + WMS鏌ヨ瀹炰綋 + + + + 鏍规嵁搴忓垪鍙锋悳绱俊鎭 + + + + + + + 鎵归噺娣诲姞 + + + + + + + 淇敼瀹炰綋闆嗗悎 + + + 鏌ヨ瀹炰綋闆嗗悎 + + + 鏌ヨ瀹炰綋 + + + + 鑾峰彇浜嬪姟 鐢ㄦ潵澶勭悊鍗虫椂搴撳瓨 + + + + + + 鑾峰彇浜嬪姟 鐢ㄦ潵澶勭悊鍗虫椂搴撳瓨 + + + + + + 绠卞敍-鏈嶅姟鎺ュ彛 + + + + + 鐢熸垚 + + + + + + + + 鍒楄〃-鍒嗛〉 + + + + + + + + 绠 + + + + + wms鑾峰彇宸插畬鎴愯绠辩淇℃伅 + + + + + + + + 瑁呯 + + + + + + + + 鐢熸垚绠辩爜 + + + + + + + 鎵撳嵃 + + + + 鍒犻櫎 + + + + + + 娓呯┖ + + + + + 閲嶆柊瑁呯 + + + + 寮濮嬭绠 + + + + + + 鍏ㄥ瓧娈靛鍑烘暟鎹 + + + + + + + + + + + + + + + 鍒楄〃瀛楁瀵煎嚭鏁版嵁 + + + + + + + + + + + + + + + 鍒楄〃椤靛鍑烘暟鎹 + + + + + + + + + + + + + + 涓婁紶鏂囦欢 + + + + 鏄惁寮鍚嚜鍔ㄥ垹闄 濡傛灉寮鍚 3澶╁悗鑷姩鍒犻櫎 瀵煎嚭鐨別xecl鏂囦欢 + + + + + 闃蹭吉鐮 + + + + + 涓嬭浇 + + + + + + + 鐢熸垚闃蹭吉鐮 + + + + + + + + 搴忓垪鍙锋湇鍔 + + + + + 鐢熸垚搴忓垪鍙 + + + + + + + + 鎵撳嵃 + + + + + + + 涓嬭浇 + + + + + + + 瑁呯鍚庡弽鍐欎娇鐢ㄦ暟 + + + + + + + 淇敼搴忓垪鍙风墿鏂 + + + + + + + erp鍩虹鏁版嵁锛氭墿灞曟湇鍔℃帴鍙 + + + + + 鑾峰彇鐗╂枡鍚嶇О + + + + + + + 鑾峰彇鐗╂枡缂栫爜 + + + + + + + + 鑾峰彇鐗╂枡瑙勬牸鍨嬪彿 + + + + + + + + 鑾峰彇鐗╂枡鍚嶇О + + + + + + + 鑾峰彇鐗╂枡瑙勬牸鍨嬪彿 + + + + + + + + 鑾峰彇鐗╂枡鍩烘湰鍗曚綅鍚嶇О + + + + + + + + 鑾峰彇鐗╂枡鍩烘湰鍗曚綅鍚嶇О + + + + + + + + 鑾峰彇鐗╂枡鐨勬潯鐮 + + + + + + + + 鑾峰彇鐗╂枡鐨勬潯鐮 + + + + + + + + 鑾峰彇鐗╂枡鍩烘湰鍗曚綅id + + + + + + + + 鑾峰彇鐗╂枡鍩烘湰鍗曚綅缂栫爜 + + + + + + + + 鑾峰彇鐗╂枡鍩烘湰鍗曚綅缂栫爜 + + + + + + + + 鑾峰彇缁勭粐鍚嶇О + + + + + + + + 鑾峰彇缁勭粐鍚嶇О + + + + + + + + 鑾峰彇缁勭粐ID + + + + + + + 鑾峰彇渚涘簲鍟嗗悕绉 + + + + + + + + 鑾峰彇渚涘簲鍟嗗悕绉 + + + + + + + + 鑾峰彇瀹㈡埛鍚嶇О + + + + + + + + 鑾峰彇浠撳簱鍚嶇О + + + + + + + + 鑾峰彇浠撳簱鍚嶇О + + + + + + + + 鑾峰彇浠撳簱缂栫爜 + + + + + + + + 鑾峰彇瀛愪粨搴撳悕绉 + + + + + + + + 鑾峰彇鍗曠偣缁勭粐鍚嶅瓧 + + + + + + + 鏌ュ崟鎹被鍨嬬殑鍊 + + + + + + erp:鍗曟嵁鏌ヨ-鐗╂枡闆嗗悎 + + + + + + 鑾峰彇鐗╂枡id32杩涘埗 + + + + + + + erp:鍩虹鏁版嵁-鐗╂枡淇℃伅 + + + + + + + erp:鍩虹鏁版嵁-鐗╂枡淇℃伅 + + + + + + + + + + + + + + + + + + + + + + + + + + + 渚涘簲鍟 + + + + + + 瀹㈡埛 + + + + + + 鑾峰彇浠撳簱淇℃伅 + + + + + + 鑾峰彇浠撲綅淇℃伅淇℃伅 鏍规嵁浠撳簱缂栫爜 + + + + + + 鐧诲綍鏈嶅姟鎺ュ彛 + + + + + 鍒涘缓token + + + + + + + + + + + + + + + + 鑾峰彇鍗曠偣鐢ㄦ埛淇℃伅 + + + + + + + + 鐧诲綍閫鍑 + + + + + + + 鍒锋柊token + + + + + + + + 鍗曠偣閫鍑洪氱煡token澶辨晥 + + + + + + + 鑾峰彇鐧诲綍鍚庣殑淇℃伅 + + + + + + + 鑾峰彇鑿滃崟 + + + + + + + 鍗曠偣鏁版嵁杩斿洖鏈嶅姟鎺ュ彛 + + + + + 鑾峰彇鍗曠偣鏁版嵁锛氭牴鎹柟娉曞悕鍜屽叕鍙窱D + + + + + + + + + 鑾峰彇鍗曠偣鏁版嵁锛氭牴鎹柟娉曞悕鍜屽叕鍙窱D + + + + + + + + + 鑾峰彇鍗曠偣鏁版嵁:鏍规嵁鏂规硶鍚嶅拰鍏徃ID + + + + + + + + + 鑾峰彇鍗曠偣鏁版嵁锛氭牴鎹柟娉曞悕鍜屽叕鍙窱D + + + + + 鍔犱笂ID闃叉缂栫爜閲嶅 + + + + + 鏍规嵁鍚嶅瓧妯$硦鍖归厤 + + + + + + + + + 鑾峰彇鍗曠偣鏁版嵁闆嗗悎锛氭硾鍨-鍚屾 + + + + + + + + + 鑾峰彇鍗曠偣鏁版嵁闆嗗悎锛氭硾鍨-寮傛 + + + + + + + + + 鑾峰彇鍗曠偣鏁版嵁闆嗗悎锛氭硾鍨-寮傛-鏃犵紦瀛 + + + + + + + + + 鍗曠偣鏁版嵁锛氬彲瀵规帴鍏ㄩ儴鎺ュ彛 + + 杩斿洖瀵硅薄 + 璇锋眰瀵硅薄 + 鏂规硶鍚嶇О + 璇锋眰瀵硅薄 + 鏂规硶鍚嶇О + 鎺у埗鍣ㄥ悕绉 + + + + + 鍗曠偣鏁版嵁锛氬彲瀵规帴鍏ㄩ儴鎺ュ彛-鏃犵紦瀛 + + + + + + + + + + + + 鑾峰彇鍗曠偣鏁版嵁锛氳姹傚璞″拰鎺ュ彛鏂规硶鍚 + + + + + + + + + + 鑾峰彇瀹㈡埛浠撳簱 + + + + + + + + wms閲嶇疆绠变俊鎭 + + + + + 閲嶇疆wms绠变俊鎭 + + + + + + + 鐗╂枡鏈嶅姟鎺ュ彛 + + + + + 鍚屾閲戣澏鏂扮墿鏂 + + + + + + 鍚屾鐗╂枡id32杩涘埗 + + + + + + mapper鏄犲皠 + + + + + 绠眒apper鏄犲皠 + + + + + 绠眒apper鏄犲皠 + + + + + 闆嗗悎鏄犲皠 + + + + + 鏄犲皠瀹炰綋閲 闆嗗悎灞炴 + + + + + + + + + + + 鏄犲皠瀹炰綋閲 闆嗗悎灞炴 + + + + + + + + + + + 鏁版嵁搴 + + + + + redis + + + + + 鍗曠偣鏁版嵁璇锋眰鍦板潃-鍚庣浣跨敤鎺ュ彛鍦板潃 + + + + + redis鏁版嵁鐩綍 + + + + + 鏁版嵁搴撶被鍨 + + + + + 鏄惁鍏佽缂撳瓨 + + + + + 鍏徃ID + + + + + 閭 + + + + + SMTP 鏈嶅姟鍣ㄥ湴鍧 + + + + + SMTP 鏈嶅姟鍣ㄧ鍙e彿 + + + + + 鍚嶇О + + + + + 涓婚 + + + + + 鍙戜欢浜洪偖绠卞湴鍧 + + + + + 鍙戜欢浜洪偖绠卞瘑鐮 + + + + + erp鐩稿叧閰嶇疆鏂囦欢 + + + + + erp-璇锋眰鍦板潃 + + + + + 璐﹀彿 + + + + + 瀵嗙爜 + + + + + erp-Id + + + + + 涓冪墰浜 閰嶇疆 + + + + + 璁块棶key + + + + + 绉橀挜 + + + + + 鍖哄潡鏂囦欢澶 + + + + + 璁块棶鍩熷悕 + + + + + Quartz瀹氭椂浠诲姟-閰嶇疆椤 + + + + + 瀛樺偍绫诲瀷:閿 + + + + + 瀛樺偍绫诲瀷:鍊 + + + + + 鏁版嵁搴撻┍鍔ㄧ被鍨-杩欓噷鏄痬ysql:閿 + + + + + 鏁版嵁搴撻┍鍔ㄧ被鍨-杩欓噷鏄痬ysql:鍊 + + + + + 鏁版嵁搴撹〃鍚嶅墠缂:閿 + + + + + 鏁版嵁搴撹〃鍚嶅墠缂:鍊 + + + + + 鏁版嵁婧愮殑鍚嶇О:閿 + + + + + 鏁版嵁婧愮殑鍚嶇О:鍊 + + + + + 杩炴帴瀛楃涓:閿 + + + + + 杩炴帴瀛楃涓:鍊 + + + + + mysql鎻愪緵鍣:閿 + + + + + mysql鎻愪緵鍣:鍊 + + + + + 鍑犵偣鍚庡紑濮嬫墽琛 + + + + + 鍑犲垎閽熷悗寮濮嬫墽琛 + + + + + 鎵цCron琛ㄨ揪寮忥細鍙互鏄嚑灏忔椂or鍑犲垎閽無r鍑犵閽無r鍑犲ぉor鍑犲懆 + + + + + + + + + + 鍙戦侀氱煡鎵цcron琛ㄨ揪寮忥細姣忓ぉ12锛16锛20鏁寸偣鍙戦 + + + + + 鍚屾鏂扮墿鏂欐墽琛宑ron琛ㄨ揪寮忥細姣忓ぉ23锛30鏁寸偣鍚屾 + + + + + 鍚屾鏂扮墿鏂欐墽琛宑ron琛ㄨ揪寮忥細姣忓ぉ0锛01鎵ц + + + + + 鏄惁鍚敤闆嗙兢锛氶敭 + + + + + 鏄惁鍚敤闆嗙兢锛氬 + + + + + 鑺傜偣閮藉繀椤绘湁涓涓敮涓ID锛氶敭 + + + + + 鑺傜偣閮藉繀椤绘湁涓涓敮涓ID锛氬 + + + + + 宸ヤ綔鍚嶇О锛氶敭 + + + + + 宸ヤ綔鍚嶇О锛氬 + + + + + 宸ヤ綔鎻忚堪 + + + + + 瑙﹀彂鍣ㄨ韩浠借璇佷俊鎭 + + + + + 瑙﹀彂鍣ㄦ弿杩 + + + + + 鐭俊閰嶇疆椤 + + + + + 璁块棶鍑瘉ID + + + + + 璁块棶绉橀挜 + + + + + 鐭俊绛惧悕 + + + + + 鐭俊妯℃澘缂栧彿 + + + + + 鍗曠偣绯荤粺鍦板潃 + + + + + 鍗曠偣绯荤粺鍦板潃 + + + + + admin璐﹀彿鐨処d + + + + + 搴旂敤id + + + + + AppId + + + + + AppSecret + + + + + 鍏挜 + + + + + 绉侀挜 + + + + + 鑰乷ps瀵规帴 + + + + + 鑷姩鐢熸垚鏁版嵁缁存姢 鍑屾櫒娓呯┖ + + + + + 鎵ц鏂规硶 + + + + + + + 鎵ц鏂规硶 + + + + + + + 鐗╂枡鍚屾鎵ц瀹氭椂浠诲姟 + + + + + 鎵ц鏂规硶 + + + + + + + 绠卞敍-鏈嶅姟 + + + + + 鐢熸垚 + + + + + + + + 鍒楄〃鍒嗛〉 + + + + + + + + 瑁呯鎬绘暟 + + + + + + + + 绠变俊鎭 + + + + + 鐢熸垚绠辩爜 + + + + + + + + + 瑁呯 + + + + + + + + + 鎵撳嵃 + + + + + + + + 鍒犻櫎 + + + + + + + + 娓呯┖瑁呯淇℃伅 + + + + + + + + wms绯荤粺璋冪敤 鑾峰彇瀹屾垚瑁呯绠变俊鎭 + + + + + + + + 閲嶆柊瑁呯 + + + + + + + + 寮濮嬭绠 + + + + + + + + 鍒楄〃椤靛鍑 + + + + + + + + + + + + + 鍏ㄥ瓧娈靛鍑 + + + + + + + + + + + + + + 鍚屾erp鍩虹鏁版嵁 + + + + + erp鍩虹鏁版嵁锛氭墿灞曟湇鍔 + + + + + 鑾峰彇鐗╂枡鍚嶇О + + + + + + + + 鑾峰彇鐗╂枡缂栫爜 + + + + + + + + 鑾峰彇鐗╂枡瑙勬牸鍨嬪彿 + + + + + + + + 鑾峰彇鐗╂枡鍚嶇О + + + + + + + + 鑾峰彇鐗╂枡缂栫爜 + + + + + + + + 鑾峰彇鐗╂枡鍩烘湰鍗曚綅鍚嶇О + + + + + + + + 鑾峰彇鐗╂枡鍩烘湰鍗曚綅鍚嶇О + + + + + + + + 鑾峰彇鐗╂枡鐨勬潯鐮 + + + + + + + + 鑾峰彇鐗╂枡鐨勬潯鐮 + + + + + + + + 鑾峰彇鐗╂枡鍩烘湰鍗曚綅Id + + + + + + + + 鑾峰彇鐗╂枡鍩烘湰鍗曚綅缂栫爜 + + + + + + + + 鑾峰彇鐗╂枡鍩烘湰鍗曚綅缂栫爜 + + + + + + + + 鑾峰彇缁勭粐鍚嶇О + + + + + + + + 鑾峰彇缁勭粐鍚嶇О + + + + + + + + 鑾峰彇缁勭粐id + + + + + + + + 鑾峰彇渚涘簲鍟嗗悕绉 + + + + + + + + 鑾峰彇渚涘簲鍟嗗悕绉 + + + + + + + + 鑾峰彇瀹㈡埛鍚嶇О + + + + + + + + 鑾峰彇浠撳簱鍚嶇О + + + + + + + + 鑾峰彇浠撳簱鍚嶇О + + + + + + + + 鑾峰彇浠撳簱缂栫爜 + + + + + + + + 瀛愪粨搴 + + + + + + + + 鑾峰彇鍗曠偣缁勭粐鍚嶅瓧 + + + + + + + + + erp鏁版嵁浜や簰鏈嶅姟 + + + + + 鍒濆鍖朎RP锛氱櫥褰曞埌ERP + + + + + + 鏌ュ崟鎹被鍨嬬殑鍊 + + + + + + erp:鍗曟嵁鏌ヨ-鐗╂枡闆嗗悎 + + + + + + 鑾峰彇鐗╂枡id32杩涘埗 + + + + + + + + erp:鍩虹鏁版嵁-鐗╂枡淇℃伅 + + + + + + + erp:鍩虹鏁版嵁-鐗╂枡淇℃伅 + + + + + + + erp:鍩虹鏁版嵁-鐗╂枡-鍒嗛〉鏌ヨ + + + + + + erp:鍩虹鏁版嵁-鐗╂枡-ids鏌ヨ + + + + + + + erp:鍩虹鏁版嵁-鐗╂枡-number鏌ヨ + + + + + + + erp:鍗曟嵁鏌ヨ-缁勭粐鏁版嵁 + + + + + + erp:渚涘簲鍟 + + + + + + 瀹㈡埛 + + + + + + erp:浠撳簱 + + + + + + 鏍规嵁浠撳簱缂栫爜鑾峰彇浠撲綅 + + + + + + + 鍚屾鏁版嵁(淇濆瓨鎻愪氦瀹℃牳) + + + + + + + + 鎻愪氦 + + + + + + + + 瀹℃牳 + + + + + + + + 鍙嶅鏍 + + + + + + + + 鍒犻櫎 + + + + + + + + 涓嬫帹 + + + + + + + Get鏂规硶 + + + + + + + + + + Get鏂规硶 + + + + + + + + + + Post鏂规硶 + + + + + + + + + + + Post鏂规硶 + + + + + + + + + + 鍏叡http璇锋眰 + + + + + + + + + + + + 璁剧疆HttpRequestMessage + + + + + + + + + + 璁剧疆璇锋眰鍐呭 + + + + + + + + 璁剧疆璇锋眰澶村拰瓒呮椂鏃堕棿锛氳繑鍥瀋lient + + + + + + + + 鍒涘缓token + + + + + + + + + 鍒涘缓token + + + + + + + + + 鑾峰彇鍗曠偣鐧诲綍淇℃伅 + + + + + + + 鑾峰彇鍗曠偣鐢ㄦ埛淇℃伅 + + + + + + + + 鐧诲綍閫鍑 + + + + + + + 鍒锋柊token + + + + + + + + 鍗曠偣閫鍑洪氱煡token澶辨晥 + + 杩欎釜鏄崟鐐逛紶杩囨潵鐨凷eesionId + + + + + 缂撳瓨閫鍑虹殑token + + + + + + + 鑾峰彇鐧诲綍鍚庣殑淇℃伅 + + + + + + + 绉婚櫎鐧诲綍鍚庣殑鐢ㄦ埛淇℃伅 + + + + + + 鑾峰彇鑿滃崟鏁版嵁 + + + + + + + + + + + + + + + + + + + + + + 杩涘埗杞崲 + + 鏁村舰鏁板瓧 + 鎺掗櫎鐨勫瓧绗"0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", + "C", "D", "E", "F", "G", "H", "I", "J", "K","L", "M", "N", "O", "P", "Q", "R", "S", + "T", "U", "V", "W", "X", "Y", "Z" + + + + + 淇濆瓨鍗曚釜key value + + + + + + + + + 鑾峰彇鍗曚釜key鐨勫 + + + + + 绉婚櫎redis + + + + + + + 鑾峰彇涓涓猭ey鐨勫璞 + + + + + 淇濆瓨涓涓璞 + + + + + + 鍗曠偣鏁版嵁杩斿洖鏈嶅姟 + + + + + 鑾峰彇鍗曠偣鏁版嵁锛氭牴鎹帴鍙f柟娉曞悕鍜屽叕鍙窱D + 鍚庣鍒楄〃鏌ヨ缁熶竴浣跨敤 + + + + + + + + 鑾峰彇鍗曠偣鏁版嵁锛氭牴鎹帴鍙f柟娉曞悕鍜屽叕鍙窱D + 鍚庣鍒楄〃鏌ヨ缁熶竴浣跨敤 + + + + + + + + 鑾峰彇鍗曠偣鏁版嵁锛氭牴鎹帴鍙f柟娉曞悕鍜屽叕鍙窱D + 鍚庣鍒楄〃鏌ヨ缁熶竴浣跨敤 + + + + + + + + 鏍规嵁鍚嶅瓧妯$硦鍖归厤 + + + + + + + + + 鑾峰彇鍗曠偣鏁版嵁锛氭牴鎹帴鍙f柟娉曞悕鍜屽叕鍙窱D + 鍚庣鍒楄〃鏌ヨ缁熶竴浣跨敤 + + + + + + + + 鑾峰彇鍗曠偣鏁版嵁闆嗗悎锛氭硾鍨-鍚屾 + + + + + + + + + 鑾峰彇鍗曠偣鏁版嵁闆嗗悎锛氭硾鍨-寮傛 + + + + + + + + + 鑾峰彇鍗曠偣鏁版嵁闆嗗悎锛氭硾鍨-寮傛-鏃犵紦瀛 + + + + + + + + + 鍗曠偣鏁版嵁锛氬彲瀵规帴鍏ㄩ儴鎺ュ彛 + + 杩斿洖瀵硅薄 + 璇锋眰瀵硅薄 + 鏂规硶鍚嶇О + 璇锋眰瀵硅薄 + 鏂规硶鍚嶇О + 鎺у埗鍣ㄥ悕绉 + + + + + 鍗曠偣鏁版嵁锛氬彲瀵规帴鍏ㄩ儴鎺ュ彛 + + 杩斿洖瀵硅薄 + 璇锋眰瀵硅薄 + 鏂规硶鍚嶇О + 璇锋眰瀵硅薄 + 鏂规硶鍚嶇О + 鎺у埗鍣ㄥ悕绉 + + + + + 鑾峰彇鍗曠偣鏁版嵁锛氶厤缃」鎺ュ彛 + + + + + + + + + + 璇锋眰鍗曠偣鏈嶅姟鎺ュ彛锛氬悓姝 + + + + + + + + + 璇锋眰鍗曠偣鏈嶅姟鎺ュ彛锛氬紓姝 + + + + + + + + + 鑾峰彇瀹㈡埛浠撳簱 + + + + + + + + ops鏈嶅姟 + + + + + 閲嶇疆绠变俊鎭 + + + + + + + + 鐗╂枡鏈嶅姟 + + + + + 鍚屾鐗╂枡32杩涘埗 + + + + + + + 鍚屾閲戣澏鏂扮殑鐗╂枡 + + + + + + 涓婁紶鏂囦欢 + + + + + + + + + 闃蹭吉鐮 + + + + + 搴忓垪鍙锋湇鍔 + + + + + + + + + + + 涓嬭浇 + + + + + + + + 鐢熸垚闃蹭吉鐮 + + + + + + + + + 寰幆鐢熸垚搴忓垪鐮 + + + + + + 搴忓垪鍙锋湇鍔 + + + + + 搴忓垪鍙锋湇鍔 + + + + + + + + + + + + 鐢熸垚搴忓垪鍙 + + + + + + + + + 寰幆鐢熸垚搴忓垪鐮 + + + + + + + 涓嬭浇 + + + + + + + + 鎵撳嵃 + + + + + + + + 鍙嶅啓浣跨敤鏁 + + + + + + + 淇敼搴忓垪鐮佺墿鏂 + + + + + + + + erp鍩虹鏁版嵁-鍚屾瀹氭椂浠诲姟 + + + + + 绠辩姸鎬 + + + + + 鏈娇鐢 + + + + + 鏈畬鎴 + + + + + 宸插畬鎴 + + + + + 鑷姩鐢熸垚鏁版嵁 搴忓垪鐮佸拰闃蹭吉鐮 + + + + + 搴忓垪鐮佺敓鎴 + + + + + 涓氬姟瀵硅薄琛ㄥ崟Id锛氬搴攅rp鐨勫崟鎹〃鐨勫悕绉 + + + + + 閲囪喘璁㈠崟 + + + + + 閲囪喘鍏ュ簱鍗 + + + + + 鍏朵粬鍏ュ簱鍗 + + + + + 鐩存帴璋冩嫧鍗-閲岄潰鍖呭惈鍑哄拰鍏 + + + + + 鍒嗘寮忚皟鍏ュ崟 + + + + + 缁勮鎷嗗嵏鍗曪細閲岄潰鍖呭惈鍑哄拰鍏 + + + + + 缁勭粐 + + + + + 渚涘簲鍟 + + + + + 浠撳簱 + + + + + 鐩樼泩鍗 + + + + + 鐩樹簭鍗 + + + + + 鐗╂枡 + + + + + 閿鍞彂璐ч氱煡鍗 + + + + + 鍏朵粬鍑哄簱鍗 + + + + + 鍒嗗竷寮忚皟鍑哄崟 + + + + + 瀹㈡埛 + + + + + 閿鍞嚭搴撳崟 + + + + + 鍗虫椂搴撳瓨 + + + + + 鏂囦欢瀵煎嚭鐘舵 + + + + + 姝e湪瀵煎嚭 + + + + + 瀵煎嚭鎴愬姛 + + + + + 瀵煎嚭澶辫触 + + + + + 瀵煎嚭鍗曟嵁绫诲瀷 + + + + + 鏉$爜涓嬭浇 + + + + + 鏉$爜璇︽儏涓嬭浇 + + + + + 闃蹭吉鐮佷笅杞 + + + + + 闃蹭吉鐮佽鎯呬笅杞 + + + + + 閿欒鎻愮ず淇℃伅 + + + + + 鏃犳晥 + + + + + 鏁版嵁鎿嶄綔澶辫触 + + + + + 娌℃湁鑿滃崟鏉冮檺锛屾棤娉曠櫥褰 + + + + + 绠卞彿涓嶇鍚堣鍒 + + + + + 瀵规帴鍗曠偣鐨勬帴鍙f柟娉-鏋氫妇 + + + + + 缁勭粐闆嗗悎 + + + + + 鐢ㄦ埛闆嗗悎 + + + + + 浜哄憳闆嗗悎 + + + + + 渚涘簲鍟嗛泦鍚 + + + + + 瀹㈡埛闆嗗悎 + + + + + 鏀舵鏉′欢闆嗗悎 + + + + + 浠樻鏉′欢闆嗗悎 + + + + + 缁撶畻鏂瑰紡闆嗗悎 + + + + + 缁撶畻甯佸埆闆嗗悎 + + + + + 绋庣巼闆嗗悎 + + + + + 姹囩巼闆嗗悎 + + + + + 浠撳簱闆嗗悎 + + + + + 鍗曚綅闆嗗悎 + + + + + 瀹㈡埛浠撳簱闆嗗悎 + + + + + 閮ㄩ棬闆嗗悎 + + + + + 浠撳簱211闆嗗悎 + + + + + 渚涘簲鍟嗛粯璁よ仈绯讳汉闆嗗悎 + + + + + 鑿滃崟闆嗗悎 + + + + + 浠撲綅闆嗗悎 + + + + + 浠撳簱锛氱紪鐮佷笌缁勭粐缂栫爜缁撳悎 + + + + + 浠撳簱锛氱紪鐮佷笌缁勭粐缂栫爜缁撳悎 + + + + + 鍗曠偣-鎺у埗鍣ㄦ灇涓 + + + + + 鍗曠偣OPS鍒楄〃鏁版嵁-鎺у埗鍣 + + + + + 鍗曠偣閰嶇疆椤规暟鎹-鎺у埗鍣 + + + + + 鍗曠偣鐧诲綍椤规暟鎹-鎺у埗鍣 + + + + + 鍗曠偣鍏叡鎺ュ彛鏁版嵁-鎺у埗鍣 + + + + + 鍗曠偣鏁版嵁鎺ュ彛-鐧诲綍瑕佷娇鐢ㄧ殑鏁版嵁鎺ュ彛-鏂规硶鏋氫妇 + + + + + 鑿滃崟 + + + + + 浜哄憳 + + + + + 鍏徃 + + + + + 渚涘簲鍟 + + + + + 瀹㈡埛 + + + + + 鍏ㄩ儴淇℃伅 + + + + + 鍏徃淇℃伅 + + + + + 鍗曠偣鏁版嵁锛氶厤缃」鍜屽叕鍏辨帴鍙g殑鏂规硶鏋氫妇鍊 + + + + + 渚涘簲鍟-鏍规嵁鍚嶇О鍜屽叕鍙 + + + + + 缁勭粐-鏍规嵁鍏徃 + + + + + 閮ㄩ棬-鏍规嵁缁勭粐鍜屽叕鍙 + + + + + 浜哄憳-鏍规嵁鍏徃 + + + + + 浜哄憳-鏍规嵁閮ㄩ棬鍜屽叕鍙 + + + + + 浜哄憳-鏍规嵁缁勭粐鍜屽叕鍙 + + + + + 瀹㈡埛-鏍规嵁鍏徃 + + + + + 瀹㈡埛-鏍规嵁瀹㈡埛鍜岀粍缁囧拰鍏徃 + + + + + 瀹㈡埛淇℃伅-鏍规嵁瀹㈡埛鍜岀粍缁囧拰鍏徃 + + + + + 鏀舵鏉′欢-鏍规嵁鍏徃 + + + + + 浠樻鏉′欢-鏍规嵁鍏徃 + + + + + 缁撶畻鏂瑰紡-鏍规嵁鍏徃 + + + + + 缁撶畻甯佸埆-鏍规嵁鍏徃 + + + + + 鍗曚綅-鏍规嵁鍏徃 + + + + + 鍗曚綅锛堥儴鍒嗗睘鎬э級-鏍规嵁鍏徃 + + + + + 绋庣巼-鏍规嵁鍏徃 + + + + + 浠撳簱-鏍规嵁鍚嶇О鍜屽叕鍙 + + + + + 浠撳簱-鏍规嵁缁勭粐鍜屽叕鍙 + + + + + 浠撳簱锛堜笉鏄皟鎷ㄤ腑杞粨锛-鏍规嵁缁勭粐鍜屽叕鍙 + + + + + 浠撳簱锛211锛-鏍规嵁缁勭粐鍜屽叕鍙 + + + + + 浠撳簱-鏍规嵁瀹㈡埛鍜屽叕鍙 + + + + + 浠撲綅-鏍规嵁浠撳簱 + + + + + 浠撲綅-鏍规嵁- + + + + + 姹囩巼淇℃伅-鏍规嵁鍘熷竵銆佺洰鏍囧竵鍜屽叕鍙 + + + + + 瀹㈡埛浠撳簱-鏍规嵁瀹㈡埛鍜岀粍缁囧拰鍏徃 + + + + + 浠樻鏉′欢锛岀粨绠楀竵鍒紝缁撶畻鏂瑰紡,閲囪喘鍛橈紝閲囪喘閮ㄩ棬-鏍规嵁渚涘簲鍟嗗拰缁勭粐 + + + + + 鑾峰彇浠撳簱锛氭牴鎹粨搴搃d + + + + + 鑾峰彇搴撳瓨锛氭牴鎹粍缁囧拰鍏徃 + + + + + 鑾峰彇瀹㈡埛浠撳簱锛氭牴鎹鎴稩DS鍜岀粍缁囧拰鍏徃 + + + + + 姹囩巼(鎵鏈) + + + + + 渚涘簲鍟嗛夋嫨鍚庤幏鍙栵細浠樻鏉′欢锛岀粨绠楀竵鍒紝缁撶畻鏂瑰紡,閲囪喘鍛橈紝閲囪喘閮ㄩ棬,鏍规嵁缁勭粐IDS + + + + + 鑾峰彇瀹㈡埛浠撳簱锛氭牴鎹甤ode闆嗗悎 + + + + + 渚涘簲鍟:鏍规嵁ids + + + + + 鏍规嵁鍏徃鎼滅储鎵鏈変粨搴(璁$畻琛ヨ揣棰戞) + + + + + 鑾峰彇浠撳簱锛氭牴鎹甤odes + + + + + 鑾峰彇瀹㈡埛浠撳簱锛氭牴鎹甤odes + + + + + 鑾峰彇璋冩嫧涓浆浠撳簱锛氭牴鎹叕鍙 + + + + + 鑾峰彇渚涘簲鍟嗘暟鎹牴鎹甶ds + + + + + 鑾峰彇浠撳簱:鏍规嵁榛樿琛ヨ揣瀹㈡埛 + + + + + 鑾峰彇鐢ㄦ埛锛圛D鍜孨ame锛夛細鏍规嵁鍏徃 + + + + + 鍏ㄩ儴閮ㄩ棬-鏍规嵁缁勭粐鍜屽叕鍙革細涓嶅鐞嗗瓙绾 + + + + + 鑾峰彇鍏ㄩ儴鍛樺伐锛氭牴鎹叕鍙稿拰缁勭粐 + + + + + 鑾峰彇浠撳簱:锛氭牴鎹鐞嗙郴缁焎ode鍜屼粨搴撳悕绉板拰鍏徃ID锛屽娉ㄧ郴缁焎ode鍜屽叕鍙窱D鏄繀濉 + + + + + 鑾峰彇浠撳簱:锛氭牴鎹鐞嗙郴缁焎ode鍜屼粨浣嶅悕绉板拰鍏徃ID锛屽娉ㄧ郴缁焎ode鍜屽叕鍙窱D鏄繀濉 + + + + + 鑾峰彇浠撲綅璇︽儏锛氭牴鎹粨浣岻D鍜屽叕鍙窱D + + + + + 鑾峰彇浠撲綅璇︽儏锛氭牴鎹粨浣岻D闆嗗悎鍜屽叕鍙窱D + + + + + 鑾峰彇浠撲綅璇︽儏锛氭牴鎹粨浣岰ode鍜屽叕鍙窱D + + + + + 鑾峰彇浠撲綅璇︽儏锛氭牴鎹粨浣岰odes闆嗗悎鍜屽叕鍙窱D + + + + + 鏍规嵁鐢ㄦ埛鑾峰彇缁勭粐 + + + + + 鏍规嵁鐢ㄦ埛鑾峰彇渚涘簲鍟 + + + + diff --git a/src/BarCode.Web.Core/BarCode.Web.Core.csproj b/src/BarCode.Web.Core/BarCode.Web.Core.csproj new file mode 100644 index 0000000..4eab3ba --- /dev/null +++ b/src/BarCode.Web.Core/BarCode.Web.Core.csproj @@ -0,0 +1,33 @@ +锘 + + + net8.0 + enable + enable + True + ../BarCode.Web.Api/wwwroot/BarCode.Web.Core.xml + true + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/BarCode.Web.Core/Connected Services/ERP/ConnectedService.json b/src/BarCode.Web.Core/Connected Services/ERP/ConnectedService.json new file mode 100644 index 0000000..9e86b81 --- /dev/null +++ b/src/BarCode.Web.Core/Connected Services/ERP/ConnectedService.json @@ -0,0 +1,99 @@ +{ + "ExtendedData": { + "inputs": [ + "http://119.23.206.129/K3cloud/erpgw.asmx?WSDL" + ], + "collectionTypes": [ + "System.Array", + "System.Collections.Generic.Dictionary`2" + ], + "namespaceMappings": [ + "*, ERP" + ], + "references": [ + "BouncyCastle.Cryptography, {BouncyCastle.Cryptography, 2.2.1}", + "Enums.NET, {Enums.NET, 4.0.1}", + "Google.Protobuf, {Google.Protobuf, 3.25.1}", + "ICSharpCode.SharpZipLib, {SharpZipLib, 1.3.3}", + "K4os.Compression.LZ4, {K4os.Compression.LZ4, 1.3.5}", + "K4os.Compression.LZ4.Streams, {K4os.Compression.LZ4.Streams, 1.3.5}", + "K4os.Hash.xxHash, {K4os.Hash.xxHash, 1.0.8}", + "LogicExtensions, {LogicExtensions, 0.0.3}", + "MathNet.Numerics, {MathNet.Numerics.Signed, 4.15.0}", + "Microsoft.EntityFrameworkCore, {Microsoft.EntityFrameworkCore, 8.0.2}", + "Microsoft.EntityFrameworkCore.Abstractions, {Microsoft.EntityFrameworkCore.Abstractions, 8.0.2}", + "Microsoft.EntityFrameworkCore.Relational, {Microsoft.EntityFrameworkCore.Relational, 8.0.2}", + "Microsoft.Extensions.Caching.Abstractions, {Microsoft.Extensions.Caching.Abstractions, 8.0.0}", + "Microsoft.Extensions.Caching.Memory, {Microsoft.Extensions.Caching.Memory, 8.0.0}", + "Microsoft.Extensions.Configuration.Abstractions, {Microsoft.Extensions.Configuration.Abstractions, 8.0.0}", + "Microsoft.Extensions.DependencyInjection, {Microsoft.Extensions.DependencyInjection, 8.0.0}", + "Microsoft.Extensions.DependencyInjection.Abstractions, {Microsoft.Extensions.DependencyInjection.Abstractions, 8.0.0}", + "Microsoft.Extensions.Diagnostics.Abstractions, {Microsoft.Extensions.Diagnostics.Abstractions, 8.0.0}", + "Microsoft.Extensions.Diagnostics.HealthChecks, {Microsoft.Extensions.Diagnostics.HealthChecks, 8.0.0}", + "Microsoft.Extensions.Diagnostics.HealthChecks.Abstractions, {Microsoft.Extensions.Diagnostics.HealthChecks.Abstractions, 8.0.0}", + "Microsoft.Extensions.FileProviders.Abstractions, {Microsoft.Extensions.FileProviders.Abstractions, 8.0.0}", + "Microsoft.Extensions.Hosting.Abstractions, {Microsoft.Extensions.Hosting.Abstractions, 8.0.0}", + "Microsoft.Extensions.Logging, {Microsoft.Extensions.Logging, 8.0.0}", + "Microsoft.Extensions.Logging.Abstractions, {Microsoft.Extensions.Logging.Abstractions, 8.0.0}", + "Microsoft.Extensions.ObjectPool, {Microsoft.Extensions.ObjectPool, 6.0.16}", + "Microsoft.Extensions.Options, {Microsoft.Extensions.Options, 8.0.0}", + "Microsoft.Extensions.Primitives, {Microsoft.Extensions.Primitives, 8.0.0}", + "Microsoft.IdentityModel.Abstractions, {Microsoft.IdentityModel.Abstractions, 7.5.1}", + "Microsoft.IdentityModel.Logging, {Microsoft.IdentityModel.Logging, 7.5.1}", + "Microsoft.IdentityModel.Tokens, {Microsoft.IdentityModel.Tokens, 7.5.1}", + "Microsoft.IO.RecyclableMemoryStream, {Microsoft.IO.RecyclableMemoryStream, 2.3.2}", + "Microsoft.Win32.SystemEvents, {Microsoft.Win32.SystemEvents, 6.0.0}", + "MySql.Data, {MySql.Data, 8.3.0}", + "MySqlConnector, {MySqlConnector, 2.3.5}", + "Newtonsoft.Json, {Newtonsoft.Json, 13.0.3}", + "NPOI.Core, {NPOI, 2.6.2}", + "Npoi.Mapper, {Npoi.Mapper, 6.2.1}", + "NPOI.OOXML, {NPOI, 2.6.2}", + "NPOI.OpenXml4Net, {NPOI, 2.6.2}", + "NPOI.OpenXmlFormats, {NPOI, 2.6.2}", + "Pipelines.Sockets.Unofficial, {Pipelines.Sockets.Unofficial, 2.2.8}", + "Pomelo.EntityFrameworkCore.MySql, {Pomelo.EntityFrameworkCore.MySql, 8.0.2}", + "Quartz, {Quartz, 3.8.1}", + "Quartz.AspNetCore, {Quartz.AspNetCore, 3.8.1}", + "Quartz.Extensions.DependencyInjection, {Quartz.Extensions.DependencyInjection, 3.8.1}", + "Quartz.Extensions.Hosting, {Quartz.Extensions.Hosting, 3.8.1}", + "Quartz.Serialization.Json, {Quartz.Serialization.Json, 3.8.1}", + "SixLabors.Fonts, {SixLabors.Fonts, 1.0.0}", + "SixLabors.ImageSharp, {SixLabors.ImageSharp, 2.1.4}", + "StackExchange.Redis, {StackExchange.Redis, 2.7.33}", + "System.ComponentModel.Annotations, {System.ComponentModel.Annotations, 5.0.0}", + "System.Configuration.ConfigurationManager, {System.Configuration.ConfigurationManager, 6.0.1}", + "System.Diagnostics.DiagnosticSource, {System.Diagnostics.DiagnosticSource, 8.0.0}", + "System.Drawing.Common, {System.Drawing.Common, 6.0.0}", + "System.Formats.Asn1, {System.Formats.Asn1, 6.0.0}", + "System.IO, {System.IO, 4.3.0}", + "System.IO.Pipelines, {System.IO.Pipelines, 6.0.3}", + "System.Json, {System.Json, 4.7.1}", + "System.Reflection, {System.Reflection, 4.3.0}", + "System.Reflection.Primitives, {System.Reflection.Primitives, 4.3.0}", + "System.Runtime, {System.Runtime, 4.3.0}", + "System.Runtime.CompilerServices.Unsafe, {System.Runtime.CompilerServices.Unsafe, 6.0.0}", + "System.Runtime.Loader, {System.Runtime.Loader, 4.3.0}", + "System.Security.AccessControl, {System.Security.AccessControl, 6.0.0}", + "System.Security.Cryptography.Pkcs, {System.Security.Cryptography.Pkcs, 6.0.1}", + "System.Security.Cryptography.ProtectedData, {System.Security.Cryptography.ProtectedData, 6.0.0}", + "System.Security.Cryptography.Xml, {System.Security.Cryptography.Xml, 6.0.1}", + "System.Security.Permissions, {System.Security.Permissions, 6.0.0}", + "System.ServiceModel.Duplex, {System.ServiceModel.Duplex, 6.0.0}", + "System.ServiceModel.Http, {System.ServiceModel.Http, 8.0.0}", + "System.ServiceModel.NetFramingBase, {System.ServiceModel.NetFramingBase, 8.0.0}", + "System.ServiceModel.NetTcp, {System.ServiceModel.NetTcp, 8.0.0}", + "System.ServiceModel.Primitives, {System.ServiceModel.Primitives, 8.0.0}", + "System.ServiceModel.Security, {System.ServiceModel.Security, 6.0.0}", + "System.Text.Encoding, {System.Text.Encoding, 4.3.0}", + "System.Text.Encoding.CodePages, {System.Text.Encoding.CodePages, 5.0.0}", + "System.Text.Encodings.Web, {System.Text.Encodings.Web, 7.0.0}", + "System.Text.Json, {System.Text.Json, 7.0.1}", + "System.Threading.Tasks, {System.Threading.Tasks, 4.3.0}", + "System.Windows.Extensions, {System.Windows.Extensions, 6.0.0}", + "ZstdSharp, {ZstdSharp.Port, 0.7.1}" + ], + "targetFramework": "net8.0", + "typeReuseMode": "All" + } +} \ No newline at end of file diff --git a/src/BarCode.Web.Core/Connected Services/ERP/Reference.cs b/src/BarCode.Web.Core/Connected Services/ERP/Reference.cs new file mode 100644 index 0000000..295b378 --- /dev/null +++ b/src/BarCode.Web.Core/Connected Services/ERP/Reference.cs @@ -0,0 +1,1236 @@ +锘//------------------------------------------------------------------------------ +// +// 姝や唬鐮佺敱宸ュ叿鐢熸垚銆 +// +// 瀵规鏂囦欢鐨勬洿鏀瑰彲鑳藉鑷翠笉姝g‘鐨勮涓猴紝骞跺湪浠ヤ笅鏉′欢涓嬩涪澶: +// 浠g爜閲嶆柊鐢熸垚銆 +// +//------------------------------------------------------------------------------ + +namespace ERP +{ + + + [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Tools.ServiceModel.Svcutil", "2.2.0-preview1.23462.5")] + [System.ServiceModel.ServiceContractAttribute(ConfigurationName="ERP.ERPGWSoap")] + public interface ERPGWSoap + { + + [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/Draft", ReplyAction="*")] + [System.ServiceModel.XmlSerializerFormatAttribute(SupportFaults=true)] + System.Threading.Tasks.Task DraftAsync(string json); + + [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/Save", ReplyAction="*")] + [System.ServiceModel.XmlSerializerFormatAttribute(SupportFaults=true)] + System.Threading.Tasks.Task SaveAsync(string json); + + [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/Submit", ReplyAction="*")] + [System.ServiceModel.XmlSerializerFormatAttribute(SupportFaults=true)] + System.Threading.Tasks.Task SubmitAsync(string json); + + [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/Audit", ReplyAction="*")] + [System.ServiceModel.XmlSerializerFormatAttribute(SupportFaults=true)] + System.Threading.Tasks.Task AuditAsync(string json); + + [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/ExecuteBillQuery", ReplyAction="*")] + [System.ServiceModel.XmlSerializerFormatAttribute(SupportFaults=true)] + System.Threading.Tasks.Task ExecuteBillQueryAsync(string json); + + [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/Push", ReplyAction="*")] + [System.ServiceModel.XmlSerializerFormatAttribute(SupportFaults=true)] + System.Threading.Tasks.Task PushAsync(string json); + + [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/ExecuteOperation", ReplyAction="*")] + [System.ServiceModel.XmlSerializerFormatAttribute(SupportFaults=true)] + System.Threading.Tasks.Task ExecuteOperationAsync(string json); + + [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/UnAudit", ReplyAction="*")] + [System.ServiceModel.XmlSerializerFormatAttribute(SupportFaults=true)] + System.Threading.Tasks.Task UnAuditAsync(string json); + + [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/Delete", ReplyAction="*")] + [System.ServiceModel.XmlSerializerFormatAttribute(SupportFaults=true)] + System.Threading.Tasks.Task DeleteAsync(string json); + + [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/BatchSave", ReplyAction="*")] + [System.ServiceModel.XmlSerializerFormatAttribute(SupportFaults=true)] + System.Threading.Tasks.Task BatchSaveAsync(string json); + + [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/WorkflowAudit", ReplyAction="*")] + [System.ServiceModel.XmlSerializerFormatAttribute(SupportFaults=true)] + System.Threading.Tasks.Task WorkflowAuditAsync(string json); + + [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/CancelAssign", ReplyAction="*")] + [System.ServiceModel.XmlSerializerFormatAttribute(SupportFaults=true)] + System.Threading.Tasks.Task CancelAssignAsync(string json); + + [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/Allocate", ReplyAction="*")] + [System.ServiceModel.XmlSerializerFormatAttribute(SupportFaults=true)] + System.Threading.Tasks.Task AllocateAsync(string json); + + [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/CancelAllocate", ReplyAction="*")] + [System.ServiceModel.XmlSerializerFormatAttribute(SupportFaults=true)] + System.Threading.Tasks.Task CancelAllocateAsync(string json); + + [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/GroupSave", ReplyAction="*")] + [System.ServiceModel.XmlSerializerFormatAttribute(SupportFaults=true)] + System.Threading.Tasks.Task GroupSaveAsync(string json); + + [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/QueryGroupInfo", ReplyAction="*")] + [System.ServiceModel.XmlSerializerFormatAttribute(SupportFaults=true)] + System.Threading.Tasks.Task QueryGroupInfoAsync(string json); + + [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/GroupDelete", ReplyAction="*")] + [System.ServiceModel.XmlSerializerFormatAttribute(SupportFaults=true)] + System.Threading.Tasks.Task GroupDeleteAsync(string json); + + [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/SaveMaterial", ReplyAction="*")] + [System.ServiceModel.XmlSerializerFormatAttribute(SupportFaults=true)] + System.Threading.Tasks.Task SaveMaterialAsync(string json); + + [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/WebApiSale", ReplyAction="*")] + [System.ServiceModel.XmlSerializerFormatAttribute(SupportFaults=true)] + System.Threading.Tasks.Task WebApiSaleAsync(string json); + + [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/AR_receivableY", ReplyAction="*")] + [System.ServiceModel.XmlSerializerFormatAttribute(SupportFaults=true)] + System.Threading.Tasks.Task AR_receivableYAsync(string json); + + [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/SelMaterial", ReplyAction="*")] + [System.ServiceModel.XmlSerializerFormatAttribute(SupportFaults=true)] + System.Threading.Tasks.Task SelMaterialAsync(string json); + + [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/SetJdture", ReplyAction="*")] + [System.ServiceModel.XmlSerializerFormatAttribute(SupportFaults=true)] + System.Threading.Tasks.Task SetJdtureAsync(string json); + + [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/Selects", ReplyAction="*")] + [System.ServiceModel.XmlSerializerFormatAttribute(SupportFaults=true)] + System.Threading.Tasks.Task SelectsAsync(string json); + + [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/K3Client", ReplyAction="*")] + [System.ServiceModel.XmlSerializerFormatAttribute(SupportFaults=true)] + System.Threading.Tasks.Task K3ClientAsync(string json); + + [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/CkZck", ReplyAction="*")] + [System.ServiceModel.XmlSerializerFormatAttribute(SupportFaults=true)] + System.Threading.Tasks.Task CkZckAsync(string json); + + [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/SerBom", ReplyAction="*")] + [System.ServiceModel.XmlSerializerFormatAttribute(SupportFaults=true)] + System.Threading.Tasks.Task SerBomAsync(string json); + + [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/OricoYG", ReplyAction="*")] + [System.ServiceModel.XmlSerializerFormatAttribute(SupportFaults=true)] + System.Threading.Tasks.Task OricoYGAsync(string json); + + [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/OricoBM", ReplyAction="*")] + [System.ServiceModel.XmlSerializerFormatAttribute(SupportFaults=true)] + System.Threading.Tasks.Task OricoBMAsync(string json); + + [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/OricoWLFZ", ReplyAction="*")] + [System.ServiceModel.XmlSerializerFormatAttribute(SupportFaults=true)] + System.Threading.Tasks.Task OricoWLFZAsync(string json); + + [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IdOricoWLFZ", ReplyAction="*")] + [System.ServiceModel.XmlSerializerFormatAttribute(SupportFaults=true)] + System.Threading.Tasks.Task IdOricoWLFZAsync(string json); + + [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/OricoGYS", ReplyAction="*")] + [System.ServiceModel.XmlSerializerFormatAttribute(SupportFaults=true)] + System.Threading.Tasks.Task OricoGYSAsync(string json); + + [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/Dw", ReplyAction="*")] + [System.ServiceModel.XmlSerializerFormatAttribute(SupportFaults=true)] + System.Threading.Tasks.Task DwAsync(string json); + + [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/Sktj", ReplyAction="*")] + [System.ServiceModel.XmlSerializerFormatAttribute(SupportFaults=true)] + System.Threading.Tasks.Task SktjAsync(string json); + + [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/Fktj", ReplyAction="*")] + [System.ServiceModel.XmlSerializerFormatAttribute(SupportFaults=true)] + System.Threading.Tasks.Task FktjAsync(string json); + + [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/Jsfs", ReplyAction="*")] + [System.ServiceModel.XmlSerializerFormatAttribute(SupportFaults=true)] + System.Threading.Tasks.Task JsfsAsync(string json); + + [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/Jsbb", ReplyAction="*")] + [System.ServiceModel.XmlSerializerFormatAttribute(SupportFaults=true)] + System.Threading.Tasks.Task JsbbAsync(string json); + + [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/HL", ReplyAction="*")] + [System.ServiceModel.XmlSerializerFormatAttribute(SupportFaults=true)] + System.Threading.Tasks.Task HLAsync(string json); + + [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/SL", ReplyAction="*")] + [System.ServiceModel.XmlSerializerFormatAttribute(SupportFaults=true)] + System.Threading.Tasks.Task SLAsync(string json); + + [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/CreateVoucher", ReplyAction="*")] + [System.ServiceModel.XmlSerializerFormatAttribute(SupportFaults=true)] + System.Threading.Tasks.Task CreateVoucherAsync(ERP.VoucherInfo[] param); + + [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/CreatePo_InStock", ReplyAction="*")] + [System.ServiceModel.XmlSerializerFormatAttribute(SupportFaults=true)] + System.Threading.Tasks.Task CreatePo_InStockAsync(string json); + + [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/CreateStockSearch", ReplyAction="*")] + [System.ServiceModel.XmlSerializerFormatAttribute(SupportFaults=true)] + System.Threading.Tasks.Task CreateStockSearchAsync(string json); + + [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/CreateSale", ReplyAction="*")] + [System.ServiceModel.XmlSerializerFormatAttribute(SupportFaults=true)] + System.Threading.Tasks.Task CreateSaleAsync(string json); + + [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/CreateShopSale", ReplyAction="*")] + [System.ServiceModel.XmlSerializerFormatAttribute(SupportFaults=true)] + System.Threading.Tasks.Task CreateShopSaleAsync(string json); + + [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/CreateSaleMerge", ReplyAction="*")] + [System.ServiceModel.XmlSerializerFormatAttribute(SupportFaults=true)] + System.Threading.Tasks.Task CreateSaleMergeAsync(string json); + + [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/CreateSaleShopFH", ReplyAction="*")] + [System.ServiceModel.XmlSerializerFormatAttribute(SupportFaults=true)] + System.Threading.Tasks.Task CreateSaleShopFHAsync(string json); + + [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/REQUIREMENTORDER", ReplyAction="*")] + [System.ServiceModel.XmlSerializerFormatAttribute(SupportFaults=true)] + System.Threading.Tasks.Task REQUIREMENTORDERAsync(string json); + + [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/Zzjxqd115", ReplyAction="*")] + [System.ServiceModel.XmlSerializerFormatAttribute(SupportFaults=true)] + System.Threading.Tasks.Task Zzjxqd115Async(string json); + + [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/PoBill", ReplyAction="*")] + [System.ServiceModel.XmlSerializerFormatAttribute(SupportFaults=true)] + System.Threading.Tasks.Task PoBillAsync(string json); + + [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/SaleLock", ReplyAction="*")] + [System.ServiceModel.XmlSerializerFormatAttribute(SupportFaults=true)] + System.Threading.Tasks.Task SaleLockAsync(string json); + + [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/Outsource", ReplyAction="*")] + [System.ServiceModel.XmlSerializerFormatAttribute(SupportFaults=true)] + System.Threading.Tasks.Task OutsourceAsync(string json); + + [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/SaleReturn", ReplyAction="*")] + [System.ServiceModel.XmlSerializerFormatAttribute(SupportFaults=true)] + System.Threading.Tasks.Task SaleReturnAsync(string json); + + [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/Misdelivery", ReplyAction="*")] + [System.ServiceModel.XmlSerializerFormatAttribute(SupportFaults=true)] + System.Threading.Tasks.Task MisdeliveryAsync(string json); + + [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/StockCountLoss", ReplyAction="*")] + [System.ServiceModel.XmlSerializerFormatAttribute(SupportFaults=true)] + System.Threading.Tasks.Task StockCountLossAsync(string json); + + [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/StockCountGain", ReplyAction="*")] + [System.ServiceModel.XmlSerializerFormatAttribute(SupportFaults=true)] + System.Threading.Tasks.Task StockCountGainAsync(string json); + + [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/OtherRecAble", ReplyAction="*")] + [System.ServiceModel.XmlSerializerFormatAttribute(SupportFaults=true)] + System.Threading.Tasks.Task OtherRecAbleAsync(string json); + + [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/OUTSTOCK", ReplyAction="*")] + [System.ServiceModel.XmlSerializerFormatAttribute(SupportFaults=true)] + System.Threading.Tasks.Task OUTSTOCKAsync(string json); + + [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/Purchase_Rk", ReplyAction="*")] + [System.ServiceModel.XmlSerializerFormatAttribute(SupportFaults=true)] + System.Threading.Tasks.Task Purchase_RkAsync(string json); + + [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/PRD_MO_Rk", ReplyAction="*")] + [System.ServiceModel.XmlSerializerFormatAttribute(SupportFaults=true)] + System.Threading.Tasks.Task PRD_MO_RkAsync(string json); + + [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/鐢熶骇璁㈠崟鍒涘缓", ReplyAction="*")] + [System.ServiceModel.XmlSerializerFormatAttribute(SupportFaults=true)] + System.Threading.Tasks.Task 鐢熶骇璁㈠崟鍒涘缓Async(string json); + + [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/PUR_MRB", ReplyAction="*")] + [System.ServiceModel.XmlSerializerFormatAttribute(SupportFaults=true)] + System.Threading.Tasks.Task PUR_MRBAsync(string json); + + [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/Pro_s", ReplyAction="*")] + [System.ServiceModel.XmlSerializerFormatAttribute(SupportFaults=true)] + System.Threading.Tasks.Task Pro_sAsync(string json); + + [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/Otsc_s", ReplyAction="*")] + [System.ServiceModel.XmlSerializerFormatAttribute(SupportFaults=true)] + System.Threading.Tasks.Task Otsc_sAsync(string json); + + [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/MesFh_Rk", ReplyAction="*")] + [System.ServiceModel.XmlSerializerFormatAttribute(SupportFaults=true)] + System.Threading.Tasks.Task MesFh_RkAsync(string json); + + [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/MesSavaTransferDirect", ReplyAction="*")] + [System.ServiceModel.XmlSerializerFormatAttribute(SupportFaults=true)] + System.Threading.Tasks.Task MesSavaTransferDirectAsync(string json); + + [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/MesPd", ReplyAction="*")] + [System.ServiceModel.XmlSerializerFormatAttribute(SupportFaults=true)] + System.Threading.Tasks.Task MesPdAsync(string json); + + [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/Miscellaneous", ReplyAction="*")] + [System.ServiceModel.XmlSerializerFormatAttribute(SupportFaults=true)] + System.Threading.Tasks.Task MiscellaneousAsync(string json); + + [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/LLDel", ReplyAction="*")] + [System.ServiceModel.XmlSerializerFormatAttribute(SupportFaults=true)] + System.Threading.Tasks.Task LLDelAsync(string json); + + [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/MesFbsdb", ReplyAction="*")] + [System.ServiceModel.XmlSerializerFormatAttribute(SupportFaults=true)] + System.Threading.Tasks.Task MesFbsdbAsync(string json); + + [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/STK_InStock", ReplyAction="*")] + [System.ServiceModel.XmlSerializerFormatAttribute(SupportFaults=true)] + System.Threading.Tasks.Task STK_InStockAsync(string json); + + [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/K3Del", ReplyAction="*")] + [System.ServiceModel.XmlSerializerFormatAttribute(SupportFaults=true)] + System.Threading.Tasks.Task K3DelAsync(string json); + + [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/K3Lock", ReplyAction="*")] + [System.ServiceModel.XmlSerializerFormatAttribute(SupportFaults=true)] + System.Threading.Tasks.Task K3LockAsync(string json); + + [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/RETURNNOTICE", ReplyAction="*")] + [System.ServiceModel.XmlSerializerFormatAttribute(SupportFaults=true)] + System.Threading.Tasks.Task RETURNNOTICEAsync(string json); + + [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/K3ProDel", ReplyAction="*")] + [System.ServiceModel.XmlSerializerFormatAttribute(SupportFaults=true)] + System.Threading.Tasks.Task K3ProDelAsync(string json); + + [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/Ops_STK_InStock", ReplyAction="*")] + [System.ServiceModel.XmlSerializerFormatAttribute(SupportFaults=true)] + System.Threading.Tasks.Task Ops_STK_InStockAsync(string json); + + [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/AP_Payable", ReplyAction="*")] + [System.ServiceModel.XmlSerializerFormatAttribute(SupportFaults=true)] + System.Threading.Tasks.Task AP_PayableAsync(string json); + + [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/AR_receivable", ReplyAction="*")] + [System.ServiceModel.XmlSerializerFormatAttribute(SupportFaults=true)] + System.Threading.Tasks.Task AR_receivableAsync(string json); + + [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/JstPd", ReplyAction="*")] + [System.ServiceModel.XmlSerializerFormatAttribute(SupportFaults=true)] + System.Threading.Tasks.Task JstPdAsync(string json); + + [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/APPAYBILL", ReplyAction="*")] + [System.ServiceModel.XmlSerializerFormatAttribute(SupportFaults=true)] + System.Threading.Tasks.Task APPAYBILLAsync(string json); + + [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/ValidateSystem", ReplyAction="*")] + [System.ServiceModel.XmlSerializerFormatAttribute(SupportFaults=true)] + System.Threading.Tasks.Task ValidateSystemAsync(string userName, string pwd, string ERPid, string id); + + [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/ValidateToken", ReplyAction="*")] + [System.ServiceModel.XmlSerializerFormatAttribute(SupportFaults=true)] + System.Threading.Tasks.Task ValidateTokenAsync(string token); + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Tools.ServiceModel.Svcutil", "2.2.0-preview1.23462.5")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.Xml.Serialization.XmlTypeAttribute(Namespace="http://tempuri.org/")] + public partial class VoucherInfo + { + + private string aCCESSTOKENField; + + private string fVOUCHERBILLField; + + private string fACCOUNTBOOKIDField; + + private string fACCBOOKORGIDField; + + private System.DateTime fDATEField; + + private string fVOUCHERGROUPIDField; + + private string fATTACHMENTSField; + + private string fVOUCHERGROUPNOField; + + private credentialDetail[] vOUCHERDETAILSField; + + /// + [System.Xml.Serialization.XmlElementAttribute(Order=0)] + public string ACCESSTOKEN + { + get + { + return this.aCCESSTOKENField; + } + set + { + this.aCCESSTOKENField = value; + } + } + + /// + [System.Xml.Serialization.XmlElementAttribute(Order=1)] + public string FVOUCHERBILL + { + get + { + return this.fVOUCHERBILLField; + } + set + { + this.fVOUCHERBILLField = value; + } + } + + /// + [System.Xml.Serialization.XmlElementAttribute(Order=2)] + public string FACCOUNTBOOKID + { + get + { + return this.fACCOUNTBOOKIDField; + } + set + { + this.fACCOUNTBOOKIDField = value; + } + } + + /// + [System.Xml.Serialization.XmlElementAttribute(Order=3)] + public string FACCBOOKORGID + { + get + { + return this.fACCBOOKORGIDField; + } + set + { + this.fACCBOOKORGIDField = value; + } + } + + /// + [System.Xml.Serialization.XmlElementAttribute(Order=4)] + public System.DateTime FDATE + { + get + { + return this.fDATEField; + } + set + { + this.fDATEField = value; + } + } + + /// + [System.Xml.Serialization.XmlElementAttribute(Order=5)] + public string FVOUCHERGROUPID + { + get + { + return this.fVOUCHERGROUPIDField; + } + set + { + this.fVOUCHERGROUPIDField = value; + } + } + + /// + [System.Xml.Serialization.XmlElementAttribute(Order=6)] + public string FATTACHMENTS + { + get + { + return this.fATTACHMENTSField; + } + set + { + this.fATTACHMENTSField = value; + } + } + + /// + [System.Xml.Serialization.XmlElementAttribute(Order=7)] + public string FVOUCHERGROUPNO + { + get + { + return this.fVOUCHERGROUPNOField; + } + set + { + this.fVOUCHERGROUPNOField = value; + } + } + + /// + [System.Xml.Serialization.XmlArrayAttribute(Order=8)] + public credentialDetail[] VOUCHERDETAILS + { + get + { + return this.vOUCHERDETAILSField; + } + set + { + this.vOUCHERDETAILSField = value; + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Tools.ServiceModel.Svcutil", "2.2.0-preview1.23462.5")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.Xml.Serialization.XmlTypeAttribute(Namespace="http://tempuri.org/")] + public partial class credentialDetail + { + + private string fEXPLANATIONField; + + private string fSubordinateUnitField; + + private string fBankAccountField; + + private string fACCOUNTIDField; + + private double fDEBITField; + + private double fCREDITField; + + /// + [System.Xml.Serialization.XmlElementAttribute(Order=0)] + public string FEXPLANATION + { + get + { + return this.fEXPLANATIONField; + } + set + { + this.fEXPLANATIONField = value; + } + } + + /// + [System.Xml.Serialization.XmlElementAttribute(Order=1)] + public string FSubordinateUnit + { + get + { + return this.fSubordinateUnitField; + } + set + { + this.fSubordinateUnitField = value; + } + } + + /// + [System.Xml.Serialization.XmlElementAttribute(Order=2)] + public string FBankAccount + { + get + { + return this.fBankAccountField; + } + set + { + this.fBankAccountField = value; + } + } + + /// + [System.Xml.Serialization.XmlElementAttribute(Order=3)] + public string FACCOUNTID + { + get + { + return this.fACCOUNTIDField; + } + set + { + this.fACCOUNTIDField = value; + } + } + + /// + [System.Xml.Serialization.XmlElementAttribute(Order=4)] + public double FDEBIT + { + get + { + return this.fDEBITField; + } + set + { + this.fDEBITField = value; + } + } + + /// + [System.Xml.Serialization.XmlElementAttribute(Order=5)] + public double FCREDIT + { + get + { + return this.fCREDITField; + } + set + { + this.fCREDITField = value; + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Tools.ServiceModel.Svcutil", "2.2.0-preview1.23462.5")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.Xml.Serialization.XmlTypeAttribute(Namespace="http://tempuri.org/")] + public partial class AccessResulDetail + { + + private string codeField; + + private string messageField; + + private string billNOField; + + private string yidField; + + /// + [System.Xml.Serialization.XmlElementAttribute(Order=0)] + public string Code + { + get + { + return this.codeField; + } + set + { + this.codeField = value; + } + } + + /// + [System.Xml.Serialization.XmlElementAttribute(Order=1)] + public string Message + { + get + { + return this.messageField; + } + set + { + this.messageField = value; + } + } + + /// + [System.Xml.Serialization.XmlElementAttribute(Order=2)] + public string BillNO + { + get + { + return this.billNOField; + } + set + { + this.billNOField = value; + } + } + + /// + [System.Xml.Serialization.XmlElementAttribute(Order=3)] + public string Yid + { + get + { + return this.yidField; + } + set + { + this.yidField = value; + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Tools.ServiceModel.Svcutil", "2.2.0-preview1.23462.5")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.Xml.Serialization.XmlTypeAttribute(Namespace="http://tempuri.org/")] + public partial class AccessResult + { + + private string codeField; + + private string messageField; + + private AccessResulDetail[] detailsField; + + private string accessTokenField; + + /// + [System.Xml.Serialization.XmlElementAttribute(Order=0)] + public string Code + { + get + { + return this.codeField; + } + set + { + this.codeField = value; + } + } + + /// + [System.Xml.Serialization.XmlElementAttribute(Order=1)] + public string Message + { + get + { + return this.messageField; + } + set + { + this.messageField = value; + } + } + + /// + [System.Xml.Serialization.XmlArrayAttribute(Order=2)] + public AccessResulDetail[] Details + { + get + { + return this.detailsField; + } + set + { + this.detailsField = value; + } + } + + /// + [System.Xml.Serialization.XmlElementAttribute(Order=3)] + public string AccessToken + { + get + { + return this.accessTokenField; + } + set + { + this.accessTokenField = value; + } + } + } + + [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Tools.ServiceModel.Svcutil", "2.2.0-preview1.23462.5")] + public interface ERPGWSoapChannel : ERP.ERPGWSoap, System.ServiceModel.IClientChannel + { + } + + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Tools.ServiceModel.Svcutil", "2.2.0-preview1.23462.5")] + public partial class ERPGWSoapClient : System.ServiceModel.ClientBase, ERP.ERPGWSoap + { + + /// + /// 瀹炵幇姝ゅ垎閮ㄦ柟娉曪紝閰嶇疆鏈嶅姟缁堢粨鐐广 + /// + /// 瑕侀厤缃殑缁堢粨鐐 + /// 瀹㈡埛绔嚟鎹 + static partial void ConfigureEndpoint(System.ServiceModel.Description.ServiceEndpoint serviceEndpoint, System.ServiceModel.Description.ClientCredentials clientCredentials); + + public ERPGWSoapClient(EndpointConfiguration endpointConfiguration) : + base(ERPGWSoapClient.GetBindingForEndpoint(endpointConfiguration), ERPGWSoapClient.GetEndpointAddress(endpointConfiguration)) + { + this.Endpoint.Name = endpointConfiguration.ToString(); + ConfigureEndpoint(this.Endpoint, this.ClientCredentials); + } + + public ERPGWSoapClient(EndpointConfiguration endpointConfiguration, string remoteAddress) : + base(ERPGWSoapClient.GetBindingForEndpoint(endpointConfiguration), new System.ServiceModel.EndpointAddress(remoteAddress)) + { + this.Endpoint.Name = endpointConfiguration.ToString(); + ConfigureEndpoint(this.Endpoint, this.ClientCredentials); + } + + public ERPGWSoapClient(EndpointConfiguration endpointConfiguration, System.ServiceModel.EndpointAddress remoteAddress) : + base(ERPGWSoapClient.GetBindingForEndpoint(endpointConfiguration), remoteAddress) + { + this.Endpoint.Name = endpointConfiguration.ToString(); + ConfigureEndpoint(this.Endpoint, this.ClientCredentials); + } + + public ERPGWSoapClient(System.ServiceModel.Channels.Binding binding, System.ServiceModel.EndpointAddress remoteAddress) : + base(binding, remoteAddress) + { + } + + public System.Threading.Tasks.Task DraftAsync(string json) + { + return base.Channel.DraftAsync(json); + } + + public System.Threading.Tasks.Task SaveAsync(string json) + { + return base.Channel.SaveAsync(json); + } + + public System.Threading.Tasks.Task SubmitAsync(string json) + { + return base.Channel.SubmitAsync(json); + } + + public System.Threading.Tasks.Task AuditAsync(string json) + { + return base.Channel.AuditAsync(json); + } + + public System.Threading.Tasks.Task ExecuteBillQueryAsync(string json) + { + return base.Channel.ExecuteBillQueryAsync(json); + } + + public System.Threading.Tasks.Task PushAsync(string json) + { + return base.Channel.PushAsync(json); + } + + public System.Threading.Tasks.Task ExecuteOperationAsync(string json) + { + return base.Channel.ExecuteOperationAsync(json); + } + + public System.Threading.Tasks.Task UnAuditAsync(string json) + { + return base.Channel.UnAuditAsync(json); + } + + public System.Threading.Tasks.Task DeleteAsync(string json) + { + return base.Channel.DeleteAsync(json); + } + + public System.Threading.Tasks.Task BatchSaveAsync(string json) + { + return base.Channel.BatchSaveAsync(json); + } + + public System.Threading.Tasks.Task WorkflowAuditAsync(string json) + { + return base.Channel.WorkflowAuditAsync(json); + } + + public System.Threading.Tasks.Task CancelAssignAsync(string json) + { + return base.Channel.CancelAssignAsync(json); + } + + public System.Threading.Tasks.Task AllocateAsync(string json) + { + return base.Channel.AllocateAsync(json); + } + + public System.Threading.Tasks.Task CancelAllocateAsync(string json) + { + return base.Channel.CancelAllocateAsync(json); + } + + public System.Threading.Tasks.Task GroupSaveAsync(string json) + { + return base.Channel.GroupSaveAsync(json); + } + + public System.Threading.Tasks.Task QueryGroupInfoAsync(string json) + { + return base.Channel.QueryGroupInfoAsync(json); + } + + public System.Threading.Tasks.Task GroupDeleteAsync(string json) + { + return base.Channel.GroupDeleteAsync(json); + } + + public System.Threading.Tasks.Task SaveMaterialAsync(string json) + { + return base.Channel.SaveMaterialAsync(json); + } + + public System.Threading.Tasks.Task WebApiSaleAsync(string json) + { + return base.Channel.WebApiSaleAsync(json); + } + + public System.Threading.Tasks.Task AR_receivableYAsync(string json) + { + return base.Channel.AR_receivableYAsync(json); + } + + public System.Threading.Tasks.Task SelMaterialAsync(string json) + { + return base.Channel.SelMaterialAsync(json); + } + + public System.Threading.Tasks.Task SetJdtureAsync(string json) + { + return base.Channel.SetJdtureAsync(json); + } + + public System.Threading.Tasks.Task SelectsAsync(string json) + { + return base.Channel.SelectsAsync(json); + } + + public System.Threading.Tasks.Task K3ClientAsync(string json) + { + return base.Channel.K3ClientAsync(json); + } + + public System.Threading.Tasks.Task CkZckAsync(string json) + { + return base.Channel.CkZckAsync(json); + } + + public System.Threading.Tasks.Task SerBomAsync(string json) + { + return base.Channel.SerBomAsync(json); + } + + public System.Threading.Tasks.Task OricoYGAsync(string json) + { + return base.Channel.OricoYGAsync(json); + } + + public System.Threading.Tasks.Task OricoBMAsync(string json) + { + return base.Channel.OricoBMAsync(json); + } + + public System.Threading.Tasks.Task OricoWLFZAsync(string json) + { + return base.Channel.OricoWLFZAsync(json); + } + + public System.Threading.Tasks.Task IdOricoWLFZAsync(string json) + { + return base.Channel.IdOricoWLFZAsync(json); + } + + public System.Threading.Tasks.Task OricoGYSAsync(string json) + { + return base.Channel.OricoGYSAsync(json); + } + + public System.Threading.Tasks.Task DwAsync(string json) + { + return base.Channel.DwAsync(json); + } + + public System.Threading.Tasks.Task SktjAsync(string json) + { + return base.Channel.SktjAsync(json); + } + + public System.Threading.Tasks.Task FktjAsync(string json) + { + return base.Channel.FktjAsync(json); + } + + public System.Threading.Tasks.Task JsfsAsync(string json) + { + return base.Channel.JsfsAsync(json); + } + + public System.Threading.Tasks.Task JsbbAsync(string json) + { + return base.Channel.JsbbAsync(json); + } + + public System.Threading.Tasks.Task HLAsync(string json) + { + return base.Channel.HLAsync(json); + } + + public System.Threading.Tasks.Task SLAsync(string json) + { + return base.Channel.SLAsync(json); + } + + public System.Threading.Tasks.Task CreateVoucherAsync(ERP.VoucherInfo[] param) + { + return base.Channel.CreateVoucherAsync(param); + } + + public System.Threading.Tasks.Task CreatePo_InStockAsync(string json) + { + return base.Channel.CreatePo_InStockAsync(json); + } + + public System.Threading.Tasks.Task CreateStockSearchAsync(string json) + { + return base.Channel.CreateStockSearchAsync(json); + } + + public System.Threading.Tasks.Task CreateSaleAsync(string json) + { + return base.Channel.CreateSaleAsync(json); + } + + public System.Threading.Tasks.Task CreateShopSaleAsync(string json) + { + return base.Channel.CreateShopSaleAsync(json); + } + + public System.Threading.Tasks.Task CreateSaleMergeAsync(string json) + { + return base.Channel.CreateSaleMergeAsync(json); + } + + public System.Threading.Tasks.Task CreateSaleShopFHAsync(string json) + { + return base.Channel.CreateSaleShopFHAsync(json); + } + + public System.Threading.Tasks.Task REQUIREMENTORDERAsync(string json) + { + return base.Channel.REQUIREMENTORDERAsync(json); + } + + public System.Threading.Tasks.Task Zzjxqd115Async(string json) + { + return base.Channel.Zzjxqd115Async(json); + } + + public System.Threading.Tasks.Task PoBillAsync(string json) + { + return base.Channel.PoBillAsync(json); + } + + public System.Threading.Tasks.Task SaleLockAsync(string json) + { + return base.Channel.SaleLockAsync(json); + } + + public System.Threading.Tasks.Task OutsourceAsync(string json) + { + return base.Channel.OutsourceAsync(json); + } + + public System.Threading.Tasks.Task SaleReturnAsync(string json) + { + return base.Channel.SaleReturnAsync(json); + } + + public System.Threading.Tasks.Task MisdeliveryAsync(string json) + { + return base.Channel.MisdeliveryAsync(json); + } + + public System.Threading.Tasks.Task StockCountLossAsync(string json) + { + return base.Channel.StockCountLossAsync(json); + } + + public System.Threading.Tasks.Task StockCountGainAsync(string json) + { + return base.Channel.StockCountGainAsync(json); + } + + public System.Threading.Tasks.Task OtherRecAbleAsync(string json) + { + return base.Channel.OtherRecAbleAsync(json); + } + + public System.Threading.Tasks.Task OUTSTOCKAsync(string json) + { + return base.Channel.OUTSTOCKAsync(json); + } + + public System.Threading.Tasks.Task Purchase_RkAsync(string json) + { + return base.Channel.Purchase_RkAsync(json); + } + + public System.Threading.Tasks.Task PRD_MO_RkAsync(string json) + { + return base.Channel.PRD_MO_RkAsync(json); + } + + public System.Threading.Tasks.Task 鐢熶骇璁㈠崟鍒涘缓Async(string json) + { + return base.Channel.鐢熶骇璁㈠崟鍒涘缓Async(json); + } + + public System.Threading.Tasks.Task PUR_MRBAsync(string json) + { + return base.Channel.PUR_MRBAsync(json); + } + + public System.Threading.Tasks.Task Pro_sAsync(string json) + { + return base.Channel.Pro_sAsync(json); + } + + public System.Threading.Tasks.Task Otsc_sAsync(string json) + { + return base.Channel.Otsc_sAsync(json); + } + + public System.Threading.Tasks.Task MesFh_RkAsync(string json) + { + return base.Channel.MesFh_RkAsync(json); + } + + public System.Threading.Tasks.Task MesSavaTransferDirectAsync(string json) + { + return base.Channel.MesSavaTransferDirectAsync(json); + } + + public System.Threading.Tasks.Task MesPdAsync(string json) + { + return base.Channel.MesPdAsync(json); + } + + public System.Threading.Tasks.Task MiscellaneousAsync(string json) + { + return base.Channel.MiscellaneousAsync(json); + } + + public System.Threading.Tasks.Task LLDelAsync(string json) + { + return base.Channel.LLDelAsync(json); + } + + public System.Threading.Tasks.Task MesFbsdbAsync(string json) + { + return base.Channel.MesFbsdbAsync(json); + } + + public System.Threading.Tasks.Task STK_InStockAsync(string json) + { + return base.Channel.STK_InStockAsync(json); + } + + public System.Threading.Tasks.Task K3DelAsync(string json) + { + return base.Channel.K3DelAsync(json); + } + + public System.Threading.Tasks.Task K3LockAsync(string json) + { + return base.Channel.K3LockAsync(json); + } + + public System.Threading.Tasks.Task RETURNNOTICEAsync(string json) + { + return base.Channel.RETURNNOTICEAsync(json); + } + + public System.Threading.Tasks.Task K3ProDelAsync(string json) + { + return base.Channel.K3ProDelAsync(json); + } + + public System.Threading.Tasks.Task Ops_STK_InStockAsync(string json) + { + return base.Channel.Ops_STK_InStockAsync(json); + } + + public System.Threading.Tasks.Task AP_PayableAsync(string json) + { + return base.Channel.AP_PayableAsync(json); + } + + public System.Threading.Tasks.Task AR_receivableAsync(string json) + { + return base.Channel.AR_receivableAsync(json); + } + + public System.Threading.Tasks.Task JstPdAsync(string json) + { + return base.Channel.JstPdAsync(json); + } + + public System.Threading.Tasks.Task APPAYBILLAsync(string json) + { + return base.Channel.APPAYBILLAsync(json); + } + + public System.Threading.Tasks.Task ValidateSystemAsync(string userName, string pwd, string ERPid, string id) + { + return base.Channel.ValidateSystemAsync(userName, pwd, ERPid, id); + } + + public System.Threading.Tasks.Task ValidateTokenAsync(string token) + { + return base.Channel.ValidateTokenAsync(token); + } + + public virtual System.Threading.Tasks.Task OpenAsync() + { + return System.Threading.Tasks.Task.Factory.FromAsync(((System.ServiceModel.ICommunicationObject)(this)).BeginOpen(null, null), new System.Action(((System.ServiceModel.ICommunicationObject)(this)).EndOpen)); + } + + private static System.ServiceModel.Channels.Binding GetBindingForEndpoint(EndpointConfiguration endpointConfiguration) + { + if ((endpointConfiguration == EndpointConfiguration.ERPGWSoap)) + { + System.ServiceModel.BasicHttpBinding result = new System.ServiceModel.BasicHttpBinding(); + result.MaxBufferSize = int.MaxValue; + result.ReaderQuotas = System.Xml.XmlDictionaryReaderQuotas.Max; + result.MaxReceivedMessageSize = int.MaxValue; + result.AllowCookies = true; + return result; + } + if ((endpointConfiguration == EndpointConfiguration.ERPGWSoap12)) + { + System.ServiceModel.Channels.CustomBinding result = new System.ServiceModel.Channels.CustomBinding(); + System.ServiceModel.Channels.TextMessageEncodingBindingElement textBindingElement = new System.ServiceModel.Channels.TextMessageEncodingBindingElement(); + textBindingElement.MessageVersion = System.ServiceModel.Channels.MessageVersion.CreateVersion(System.ServiceModel.EnvelopeVersion.Soap12, System.ServiceModel.Channels.AddressingVersion.None); + result.Elements.Add(textBindingElement); + System.ServiceModel.Channels.HttpTransportBindingElement httpBindingElement = new System.ServiceModel.Channels.HttpTransportBindingElement(); + httpBindingElement.AllowCookies = true; + httpBindingElement.MaxBufferSize = int.MaxValue; + httpBindingElement.MaxReceivedMessageSize = int.MaxValue; + result.Elements.Add(httpBindingElement); + return result; + } + throw new System.InvalidOperationException(string.Format("鎵句笉鍒板悕绉颁负鈥渰0}鈥濈殑缁堢粨鐐广", endpointConfiguration)); + } + + private static System.ServiceModel.EndpointAddress GetEndpointAddress(EndpointConfiguration endpointConfiguration) + { + if ((endpointConfiguration == EndpointConfiguration.ERPGWSoap)) + { + return new System.ServiceModel.EndpointAddress("http://119.23.206.129/K3cloud/erpgw.asmx"); + } + if ((endpointConfiguration == EndpointConfiguration.ERPGWSoap12)) + { + return new System.ServiceModel.EndpointAddress("http://119.23.206.129/K3cloud/erpgw.asmx"); + } + throw new System.InvalidOperationException(string.Format("鎵句笉鍒板悕绉颁负鈥渰0}鈥濈殑缁堢粨鐐广", endpointConfiguration)); + } + + public enum EndpointConfiguration + { + + ERPGWSoap, + + ERPGWSoap12, + } + } +} diff --git a/src/BarCode.Web.Core/Dto/Box/BoxDetailsResponse.cs b/src/BarCode.Web.Core/Dto/Box/BoxDetailsResponse.cs new file mode 100644 index 0000000..bf1c810 --- /dev/null +++ b/src/BarCode.Web.Core/Dto/Box/BoxDetailsResponse.cs @@ -0,0 +1,31 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BarCode.Web.Core.Dto.Box +{ + /// + /// 绠辨槑缁嗕俊鎭 + /// + public class BoxDetailsResponse + { + /// + /// ID + /// + public int Id { get; set; } + /// + /// 鐗╂枡缂栫爜 + /// + public string MaterialNumber { get; set; } = ""; + /// + /// 鏁伴噺锛堣绠辨暟閲忥級 + /// + public decimal Qty { get; set; } = 0; + /// + /// 搴忓垪鍙 + /// + public List SerialNumbers { get; set; } = new List(); + } +} diff --git a/src/BarCode.Web.Core/Dto/Box/BoxInfoResponse.cs b/src/BarCode.Web.Core/Dto/Box/BoxInfoResponse.cs new file mode 100644 index 0000000..83963ed --- /dev/null +++ b/src/BarCode.Web.Core/Dto/Box/BoxInfoResponse.cs @@ -0,0 +1,83 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BarCode.Web.Core.Dto.Box +{ + /// + /// 绠卞垪琛ㄨ繑鍥炰俊鎭 + /// + public class BoxInfoResponse + { + /// + /// ID + /// + public int Id { get; set; } + /// + /// 鏄庣粏Id(鍙兘涓0) + /// + public int DetailId { get; set; } = 0; + /// + /// 绠辩紪鍙 + /// + public string BoxBillNo { get; set; } = string.Empty; + /// + /// 渚涘簲鍟嗘垨缁勭粐 + /// + public string SupplierOrOrg { get; set; } = string.Empty; + /// + /// 鐗╂枡瑙勬牸鍨嬪彿 + /// + public string Specifications { get; set; } = string.Empty; + /// + /// 鐗╂枡缂栫爜 + /// + public string MaterialNumber { get; set; } = string.Empty; + /// + /// 鐗╂枡鍚嶇О + /// + public string MaterialName { get; set; } = string.Empty; + /// + /// 鐗╂枡鏉$爜 + /// + public string BarCode { get; set; } = string.Empty; + /// + /// 搴忓垪鍙 + /// + public string SerialNumbers { get; set; } = string.Empty; + /// + /// 鏁伴噺锛堣绠辨暟閲忥級 + /// + public decimal Qty { get; set; } = 0; + /// + /// 绠辩姸鎬 + /// + public string Status { get; set; } = string.Empty; + /// + /// 瑁呯寮濮嬫椂闂 + /// + public string CartonBeginTime { get; set; } = string.Empty; + /// + /// 瑁呯缁撴潫鏃堕棿(瀹屾垚瑁呯鏃堕棿) + /// + public string CartonEndTime { get; set; } = string.Empty; + /// + /// 瑁呯浜 + /// + public string CartonUser { get; set; } = string.Empty; + /// + /// 鐢熸垚浜 + /// + public string Creator { get; set; } = string.Empty; + /// + /// 鍒涘缓鏃堕棿 + /// + public string CreateTime { get; set; } = string.Empty; + /// + /// 绠卞彿鎵撳嵃娆℃暟 + /// + public int PrintNumber { get; set; } = 0; + } +} diff --git a/src/BarCode.Web.Core/Dto/Box/BoxQueryRequest.cs b/src/BarCode.Web.Core/Dto/Box/BoxQueryRequest.cs new file mode 100644 index 0000000..82c9a6b --- /dev/null +++ b/src/BarCode.Web.Core/Dto/Box/BoxQueryRequest.cs @@ -0,0 +1,69 @@ +锘縰sing System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BarCode.Web.Core.Dto.Box +{ + /// + /// 绠变俊鎭垪琛 + /// + public class BoxQueryRequest : PaginationBaseRequestDto + { + /// + /// 缁勭粐Code + /// + [Required(ErrorMessage = "缁勭粐涓嶈兘涓虹┖")] + public string OrgCode { get; set; } = ""; + /// + /// 绠卞彿(寮濮) + /// + public string BoxBeginNo { get; set; } = string.Empty; + /// + /// 绠卞彿(缁撴潫) + /// + public string BoxEndNo { get; set; } = string.Empty; + /// + /// 绠辩姸鎬 + /// + public int? Status { get; set; } + /// + /// 鍒涘缓鏃堕棿 + /// + public DateTime? CreateBeginDate { get; set; } = null; + /// + /// 鍒涘缓鏃堕棿 + /// + public DateTime? CreateEndDate { get; set; } = null; + /// + /// 瑁呯瀹屾垚鏃堕棿 + /// + public DateTime? CartonBeginDate { get; set; } = null; + /// + /// 瑁呯瀹屾垚鏃堕棿 + /// + public DateTime? CartonEndDate { get; set; } = null; + /// + /// 鐗╂枡缂栫爜/鍚嶇О/鍨嬪彿瑙勬牸 + /// + public string MaterialNumber { get; set; } = string.Empty; + /// + /// 搴忓垪鍙 + /// + public List SerialNumbers { get; set; } = new List(); + /// + /// 绠卞彿鎵撳嵃鐘舵 鎵撳嵃 true 鏈墦鍗癴alse + /// + public bool? BoxPrintStatus { get; set; } = null; + /// + /// 渚涘簲鍟嗘垨缁勭粐 + /// + public string SupplierOrOrg { get; set; } = string.Empty; + /// + /// 鐢熸垚浜 + /// + public string CreateUser { get; set; } = string.Empty; + } +} diff --git a/src/BarCode.Web.Core/Dto/Box/BoxResponse.cs b/src/BarCode.Web.Core/Dto/Box/BoxResponse.cs new file mode 100644 index 0000000..b1688b1 --- /dev/null +++ b/src/BarCode.Web.Core/Dto/Box/BoxResponse.cs @@ -0,0 +1,67 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BarCode.Web.Core.Dto.Box +{ + /// + /// 绠变俊鎭 + /// + public class BoxResponse + { + /// + /// ID + /// + public int Id { get; set; } = 0; + /// + /// 绠辩紪鍙 + /// + public string BoxBillNo { get; set; } = ""; + /// + /// 渚涘簲鍟咰ode + /// + public string SupplierCode { get; set; } = ""; + /// + /// 缁勭粐Code + /// + public string OrgCode { get; set; } = ""; + /// + /// 绠辩姸鎬 + /// + public string Status { get; set; } = string.Empty; + /// + /// 瑁呯寮濮嬫椂闂 + /// + public string CartonBeginTime { get; set; } = string.Empty; + /// + /// 瑁呯缁撴潫鏃堕棿(瀹屾垚瑁呯鏃堕棿) + /// + public string CartonEndTime { get; set; } = string.Empty; + /// + /// 瀹屾垚瑁呯鐢ㄦ埛 + /// + public int CartonUserId { get; set; } = 0; + /// + /// 绠卞瓙鍒涘缓鐢ㄦ埛 + /// + public int CreatorId { get; set; } = 0; + /// + /// 鍒涘缓鏃堕棿 + /// + public string CreateTime { get; set; } = string.Empty; + /// + /// 绠卞彿鎵撳嵃娆℃暟 + /// + public int PrintNumber { get; set; } = 0; + /// + /// 鏈鏂版墦鍗版椂闂 + /// + public string PrintTime { get; set; } + /// + /// 鏄庣粏 + /// + public List Details { get; set; } = new List(); + } +} diff --git a/src/BarCode.Web.Core/Dto/Box/DeleteBoxSerialNumberRequest.cs b/src/BarCode.Web.Core/Dto/Box/DeleteBoxSerialNumberRequest.cs new file mode 100644 index 0000000..2ee366c --- /dev/null +++ b/src/BarCode.Web.Core/Dto/Box/DeleteBoxSerialNumberRequest.cs @@ -0,0 +1,31 @@ +锘縰sing System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BarCode.Web.Core.Dto.Box +{ + /// + /// 鍒犻櫎绠卞拰搴忓垪鐮佺粦瀹 + /// + public class DeleteBoxSerialNumberRequest + { + /// + /// 绠盜d + /// + [Required(ErrorMessage = "绠变笉鑳戒负绌")] + public int BoxId { get; set; } + /// + /// 鐗╂枡缂栫爜 + /// + [Required(ErrorMessage = "鐗╂枡涓嶈兘涓虹┖")] + public string MaterialNumber { get; set; } = string.Empty; + /// + /// 搴忓垪鍙 + /// + [Required(ErrorMessage = "搴忓垪鍙蜂笉鑳戒负绌")] + public string SerialNumber { get; set; } = string.Empty; + } +} diff --git a/src/BarCode.Web.Core/Dto/Box/GenerateBoxRequest.cs b/src/BarCode.Web.Core/Dto/Box/GenerateBoxRequest.cs new file mode 100644 index 0000000..9403ecb --- /dev/null +++ b/src/BarCode.Web.Core/Dto/Box/GenerateBoxRequest.cs @@ -0,0 +1,27 @@ +锘縰sing System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BarCode.Web.Core.Dto.Box +{ + /// + /// 鐢熸垚绠辩爜 + /// + public class GenerateBoxRequest + { + /// + /// 缁勭粐Code + /// + [Required(ErrorMessage = "缁勭粐涓嶈兘涓虹┖")] + public string OrgCode { get; set; } = ""; + /// + /// 鐢熸垚鏁伴噺 + /// + [Required(ErrorMessage = "鏁伴噺涓嶈兘涓虹┖")] + [Range(0.0000000001, 10000000000, ErrorMessage = "0<鏁伴噺<=10000000000")] + public int Number { get; set; } = 0; + } +} diff --git a/src/BarCode.Web.Core/Dto/Box/SaveBoxDetailsRequest.cs b/src/BarCode.Web.Core/Dto/Box/SaveBoxDetailsRequest.cs new file mode 100644 index 0000000..a970df1 --- /dev/null +++ b/src/BarCode.Web.Core/Dto/Box/SaveBoxDetailsRequest.cs @@ -0,0 +1,26 @@ +锘縰sing System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BarCode.Web.Core.Dto.Box +{ + /// + /// 绠变俊鎭槑缁 + /// + public class SaveBoxDetailsRequest + { + /// + /// 鐗╂枡缂栫爜 + /// + [Required(ErrorMessage = "鐗╂枡涓嶈兘涓虹┖")] + public string MaterialNumber { get; set; } = string.Empty; + /// + /// 搴忓垪鍙 + /// + [Required(ErrorMessage = "搴忓垪鍙蜂笉鑳戒负绌")] + public string SerialNumber { get; set; } = string.Empty; + } +} diff --git a/src/BarCode.Web.Core/Dto/Box/SaveBoxRequest.cs b/src/BarCode.Web.Core/Dto/Box/SaveBoxRequest.cs new file mode 100644 index 0000000..ac93314 --- /dev/null +++ b/src/BarCode.Web.Core/Dto/Box/SaveBoxRequest.cs @@ -0,0 +1,30 @@ +锘縰sing System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BarCode.Web.Core.Dto.Box +{ + /// + /// 淇濆瓨绠变俊鎭(瑁呯淇濆瓨,瀹屾垚瑁呯) + /// + public class SaveBoxRequest + { + /// + /// 绠盜d + /// + [Required(ErrorMessage = "绠变笉鑳戒负绌")] + public int BoxId { get; set; } = 0; + /// + /// 鏄惁瀹屾垚瑁呯(淇濆瓨 false 瀹屾垚瑁呯 true) + /// + [Required(ErrorMessage = "瑁呯鐘舵佷笉鑳戒负绌")] + public bool IsCarton { get; set; } = false; + /// + /// 鏄庣粏淇℃伅 + /// + public List Details { get; set; } = new List(); + } +} diff --git a/src/BarCode.Web.Core/Dto/Box/WmsBoxRequest.cs b/src/BarCode.Web.Core/Dto/Box/WmsBoxRequest.cs new file mode 100644 index 0000000..b71c6b5 --- /dev/null +++ b/src/BarCode.Web.Core/Dto/Box/WmsBoxRequest.cs @@ -0,0 +1,47 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; + +namespace BarCode.Web.Core.Dto.Box +{ + /// + /// 鑰乷ps绠变俊鎭姹 + /// + public class WmsBoxRequest + { + /// + /// + /// + public WmsBoxRequest() { } + /// + /// + /// + /// + /// + public WmsBoxRequest(DateTime strartTime, DateTime endTime) + { + this.StrartTime = strartTime; + this.EndTime = endTime; + } + /// + /// 寮濮嬫椂闂 + /// + public DateTime? StrartTime { get; set; } = null; + /// + /// 缁撴潫鏃堕棿 + /// + public DateTime? EndTime { get; set; } = null; + /// + /// 绠卞彿 + /// + public string? BoxBillNo { get; set; } = null; + /// + /// 椤电爜 + /// + public int Page { get; set; } = 1; + /// + /// 姣忛〉鏉℃暟 + /// + public int Limit { get; set; } = 10000000; + } +} diff --git a/src/BarCode.Web.Core/Dto/Box/WmsBoxResponse.cs b/src/BarCode.Web.Core/Dto/Box/WmsBoxResponse.cs new file mode 100644 index 0000000..cd091dc --- /dev/null +++ b/src/BarCode.Web.Core/Dto/Box/WmsBoxResponse.cs @@ -0,0 +1,95 @@ +锘縰sing Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Text; + +namespace BarCode.Web.Core.Dto.Box +{ + /// + /// 鑰乷ps绠变俊鎭 + /// + public class WmsBoxResponse + { + /// + /// 瀵瑰簲鑰丱PS鐨勭ID + /// + [JsonProperty("CartonId")] + public int OpsBoxId { get; set; } + /// + /// 绠辩紪鍙凤紙鑰丱PS鐢熸垚鐨勭鍙凤級 + /// + [JsonProperty("CartonNo")] + public string BoxBillNo { get; set; } + /// + /// 渚涘簲鍟咺d + /// + [JsonProperty("GysNo")] + public int? SupplierId { get; set; } + /// + /// 缁勭粐Id + /// + [JsonProperty("orgId")] + public int? OrgId { get; set; } + /// + /// 瀹屾垚瑁呯鏃堕棿 + /// + [JsonProperty("CompleteCartonTime")] + public DateTime CompleteCartonTime { get; set; } = DateTime.Now; + /// + /// 瀹屾垚瑁呯鐢ㄦ埛 + /// + [JsonProperty("BoxUser")] + public string CompleteCartonUser { get; set; } + /// + /// 绠卞瓙鍒涘缓鐢ㄦ埛 + /// + [JsonProperty("Create_user")] + public string CreateUser { get; set; } + /// + /// 鍒涘缓鏃堕棿锛堝搴旇丱PS鐨勫垱寤烘椂闂达級 + /// + [JsonProperty("cartonCreateTime")] + public DateTime CreateTime { get; set; } = DateTime.Now; + /// + /// 鏄庣粏 + /// + [JsonProperty("BoxReturnDetails")] + public List Details { get; set; } = new List(); + } + public class OpsSerialNumbersResponse + { + /// + /// 搴忓垪鍙 + /// + [JsonProperty("sn")] + public string SerialNumber { get; set; } + /// + /// 搴忓垪鍙风敓鎴愭椂闂 + /// + [JsonProperty("barCreateTime")] + public DateTime? BarCreateTime { get; set; } = DateTime.Now; + /// + /// 搴忓垪鍙风敓鎴愮敤鎴 + /// + [JsonProperty("barCereateUser")] + public string BarCereateUser { get; set; } + + } + public class OpsBoxDetailsResponse { + /// + /// 鐗╂枡缂栫爜 + /// + [JsonProperty("FMaterialNo")] + public string MaterialNumber { get; set; } + /// + /// 鏁伴噺锛堣绠辨暟閲忥級 + /// + [JsonProperty("Qty")] + public decimal Qty { get; set; } + /// + /// 搴忓垪鍙烽泦 + /// + [JsonProperty("SerialNumbers")] + public List SerialNumbers { get; set; } = new List(); + } +} diff --git a/src/BarCode.Web.Core/Dto/BoxMark/BoxMarkQueryRequest.cs b/src/BarCode.Web.Core/Dto/BoxMark/BoxMarkQueryRequest.cs new file mode 100644 index 0000000..6598e9f --- /dev/null +++ b/src/BarCode.Web.Core/Dto/BoxMark/BoxMarkQueryRequest.cs @@ -0,0 +1,52 @@ +锘縰sing System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.Text; + +namespace BarCode.Web.Core.Dto +{ + /// + /// 璇锋眰瀵硅薄 + /// + public class BoxMarkQueryRequest : PaginationBaseRequestDto + { + /// + /// 缁勭粐Code + /// + [Required(ErrorMessage = "缁勭粐涓嶈兘涓虹┖")] + public string OrgCode { get; set; } = ""; + /// + /// 璁㈠崟缂栧彿闆嗗悎瀛楃涓 + /// + public string OrderBillNos { get; set; } = string.Empty; + + /// + /// 鐗╂枡涓変欢濂楁悳绱 + /// + public string Material { get; set; } = string.Empty; + + /// + /// 寮濮嬬殑绠卞敍缂栧彿 + /// + public string BeginBillNo { get; set; } = string.Empty; + + /// + /// 缁撴潫鐨勭鍞涚紪鍙 + /// + public string EndBillNo { get; set; } = string.Empty; + + /// + /// 鎿嶄綔浜 + /// + public string Creator { get; set; } = string.Empty; + + /// + /// 鐢熸垚寮濮嬫椂闂 + /// + public DateTime? CreateBeginDate { get; set; } = null; + /// + /// 鐢熸垚缁撴潫鏃堕棿 + /// + public DateTime? CreateEndDate { get; set; } = null; + } +} diff --git a/src/BarCode.Web.Core/Dto/BoxMark/BoxMarkQueryResponse.cs b/src/BarCode.Web.Core/Dto/BoxMark/BoxMarkQueryResponse.cs new file mode 100644 index 0000000..51fe966 --- /dev/null +++ b/src/BarCode.Web.Core/Dto/BoxMark/BoxMarkQueryResponse.cs @@ -0,0 +1,124 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; + +namespace BarCode.Web.Core.Dto +{ + /// + /// 鍒楄〃鍝嶅簲瀵硅薄 + /// + public class BoxMarkQueryResponse + { + /// + /// 鍞竴ID + /// + public int Id { get; set; } + + /// + /// 鏄庣粏缂栧彿ID + /// + public int DetailId { get; set; } + + /// + /// 绠卞敍缂栧彿 + /// + public string BillNo { get; set; } + + /// + /// 璁㈠崟缂栧彿 + /// + public string OrderBillNo { get; set; } + + /// + /// 鐗╂枡瑙勬牸鍨嬪彿 + /// + public string Specifications { get; set; } + /// + /// 鐗╂枡缂栫爜 + /// + public string MaterialNumber { get; set; } + + /// + /// 鐗╂枡鍚嶇О + /// + public string MaterialName { get; set; } + + /// + /// 69鏉$爜 + /// + public string BarCode { get; set; } + + /// + /// 瑁呯鏁伴噺 + /// + public decimal CratingQty { get; set; } + + /// + /// 瑁呯鍑閲 + /// + public decimal CratingNetWeightQty { get; set; } + + /// + /// 瑁呯姣涢噸 + /// + public decimal CratingGrossWeightQty { get; set; } + + /// + /// 灏剧鏁伴噺 + /// + public decimal TailboxQty { get; set; } + + /// + /// 灏剧鍑閲 + /// + public decimal TailboxNetWeightQty { get; set; } + + /// + /// 灏剧姣涢噸 + /// + public decimal TailboxGrossWeightQty { get; set; } + + /// + /// 澶囨敞 + /// + public string Remark { get; set; } + + /// + /// 鎿嶄綔浜 + /// + public string Creator { get; set; } + + /// + /// 鍒涘缓鏃堕棿锛堢敓鎴愭椂闂达級 + /// + public string CreateTime { get; set; } + + /// + /// 鏄惁鏄熬绠 + /// + public bool IsTail { get; set; } + + /// + /// 瑁呯鎬绘暟 + /// + public int BoxSortCount { get; set; } + + /// + /// 浜у搧鏁伴噺 + /// + public decimal ProductQty { get; set; } + + /// + /// 鎺掑簭 + /// + public int Sort { get; set; } + /// + /// 娴佹按鍙(寮濮) + /// + public Int64? BeginNumber { get; set; } = null; + /// + /// 娴佹按鍙(缁撴潫) + /// + public Int64? EndNumber { get; set; } = null; + } +} diff --git a/src/BarCode.Web.Core/Dto/BoxMark/GenerateBoxMarkDto.cs b/src/BarCode.Web.Core/Dto/BoxMark/GenerateBoxMarkDto.cs new file mode 100644 index 0000000..a11834a --- /dev/null +++ b/src/BarCode.Web.Core/Dto/BoxMark/GenerateBoxMarkDto.cs @@ -0,0 +1,83 @@ +锘縰sing System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.Text; + +namespace BarCode.Web.Core.Dto +{ + /// + /// 鐢熸垚绠卞敍dto + /// + public class GenerateBoxMarkDto + { + /// + /// 缁勭粐Code + /// + [Required(ErrorMessage = "缁勭粐涓嶈兘涓虹┖")] + public string OrgCode { get; set; } = ""; + /// + /// 璁㈠崟缂栧彿 + /// + /// + [Required(ErrorMessage = "璁㈠崟缂栧彿涓嶈兘涓虹┖")] + public string OrderBillNo { get; set; } = string.Empty; + + /// + /// 鐗╂枡 + /// + [Required(ErrorMessage = "鐗╂枡涓嶈兘涓虹┖")] + public string MaterialNumber { get; set; } = string.Empty; + + /// + /// 浜у搧鏁伴噺 + /// + [Required(ErrorMessage = "浜у搧鏁伴噺涓嶈兘涓虹┖")] + [Range(1, int.MaxValue, ErrorMessage = "浜у搧鏁伴噺涓嶈兘涓0")] + public decimal ProductQty { get; set; } + + /// + /// 瑁呯鏁伴噺 + /// + [Required(ErrorMessage = "瑁呯鏁伴噺涓嶈兘涓虹┖")] + [Range(1, int.MaxValue, ErrorMessage = "瑁呯鏁伴噺涓嶈兘涓0")] + public decimal CratingQty { get; set; } + + /// + /// 瑁呯鍑閲 + /// + public decimal CratingNetWeightQty { get; set; } + + /// + /// 瑁呯姣涢噸 + /// + public decimal CratingGrossWeightQty { get; set; } + + /// + /// 灏剧鏁伴噺 + /// + public decimal TailboxQty { get; set; } + + /// + /// 灏剧鍑閲 + /// + public decimal TailboxNetWeightQty { get; set; } + + /// + /// 灏剧姣涢噸 + /// + public decimal TailboxGrossWeightQty { get; set; } + + /// + /// 澶囨敞 + /// + public string Remark { get; set; } = string.Empty; + /// + /// 娴佹按鍙(寮濮) + /// + public Int64? BeginNumber { get; set; } = null; + /// + /// 娴佹按鍙(缁撴潫) + /// + public Int64? EndNumber { get; set; } = null; + } +} diff --git a/src/BarCode.Web.Core/Dto/EnumStatusResponse.cs b/src/BarCode.Web.Core/Dto/EnumStatusResponse.cs new file mode 100644 index 0000000..7b8cd23 --- /dev/null +++ b/src/BarCode.Web.Core/Dto/EnumStatusResponse.cs @@ -0,0 +1,71 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; + +namespace BarCode.Web.Core.Dto +{ + /// + /// 鎵鏈夋灇涓句俊鎭 + /// + public class EnumStatusResponse + { + public EnumStatusResponse() { } + /// + /// 鍑哄簱鍗曠被鍨 + /// + public Dictionary OutStockType { get; set; } = new Dictionary(); + /// + /// 绉诲簱鍗曠被鍨 + /// + public Dictionary MoveBoxType { get; set; } = new Dictionary(); + /// + /// 鐩樼偣缁撴灉绫诲瀷 + /// + public Dictionary TakeStockType { get; set; } = new Dictionary(); + /// + /// 鍏ュ簱鍗曠被鍨 + /// + public Dictionary InstockType { get; set; } = new Dictionary(); + /// + /// 鍏ュ簱鐘舵 + /// + public Dictionary InstockStatus { get; set; } = new Dictionary(); + /// + /// 绫诲瀷锛1涓哄叆搴撳洖閫涓嬫灦锛2涓哄嚭搴撳洖閫涓婃灦 + /// + public Dictionary BackRecordType { get; set; } = new Dictionary(); + /// + /// 绫诲瀷锛1涓哄叆搴擄紝2涓哄嚭搴 + /// + public Dictionary InventoryInOutType { get; set; } = new Dictionary(); + /// + /// 鍗曟嵁绫诲瀷 + /// + public Dictionary OrderType { get; set; } = new Dictionary(); + /// + /// 闈為噰璐笂鏋舵柟寮 + /// + public Dictionary ShelfMethod { get; set; } = new Dictionary(); + /// + /// 涓嬭浇瀵煎嚭璁㈠崟绫诲瀷 + /// + public Dictionary FileDownLoadOrderType { get; set; } = new Dictionary(); + /// + /// 涓嬭浇瀵煎嚭鐘舵 + /// + public Dictionary ExportStatus { get; set; } = new Dictionary(); + /// + /// 鍑哄叆搴撴柟寮忥細鎸夌鎴栬呮寜浜у搧 + /// + public Dictionary InventoryInOutMethod { get; set; } = new Dictionary(); + /// + /// 鍑哄簱鐘舵 + /// + public Dictionary OutStockStatus { get; set; } = new Dictionary(); + /// + /// 鍚屾閲戣澏鐘舵 + /// + public Dictionary SyncStatus { get; set; } = new Dictionary(); + + } +} diff --git a/src/BarCode.Web.Core/Dto/Erp/Customer/ErpCustomerDto.cs b/src/BarCode.Web.Core/Dto/Erp/Customer/ErpCustomerDto.cs new file mode 100644 index 0000000..419c7bc --- /dev/null +++ b/src/BarCode.Web.Core/Dto/Erp/Customer/ErpCustomerDto.cs @@ -0,0 +1,27 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; + +namespace BarCode.Web.Core.Dto.Erp.Customer +{ + /// + /// 瀹㈡埛 + /// + public class ErpCustomerDto + { + /// + /// ID + /// + public int Id { get; set; } + + /// + /// 缂栫爜 + /// + public string Number { get; set; } + + /// + /// 鍚嶇О + /// + public string Name { get; set; } + } +} diff --git a/src/BarCode.Web.Core/Dto/Erp/ErpBaseDto.cs b/src/BarCode.Web.Core/Dto/Erp/ErpBaseDto.cs new file mode 100644 index 0000000..8cf96ed --- /dev/null +++ b/src/BarCode.Web.Core/Dto/Erp/ErpBaseDto.cs @@ -0,0 +1,15 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; + +namespace BarCode.Web.Core.Dto.Erp +{ + public class ErpBaseDto + { + public string Id { get; set; } + + public string Number { get; set; } + + public string Name { get; set; } + } +} diff --git a/src/BarCode.Web.Core/Dto/Erp/ErpBillQueryDto.cs b/src/BarCode.Web.Core/Dto/Erp/ErpBillQueryDto.cs new file mode 100644 index 0000000..8043889 --- /dev/null +++ b/src/BarCode.Web.Core/Dto/Erp/ErpBillQueryDto.cs @@ -0,0 +1,40 @@ +锘縰sing Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Text; + +namespace BarCode.Web.Core.Dto.Erp +{ + /// + /// ERP锛氬崟鎹煡璇-dto + /// + public class ErpBillQueryDto + { + public ErpBillQueryDto() { } + + public ErpBillQueryDto(string accessToken) + { + this.AccessToken = accessToken; + } + public ErpBillQueryDto(string accessToken,string formid) + { + this.AccessToken = accessToken; + this.FormId = formid; + } + /// + /// 浠ょ墝 + /// + [JsonProperty(PropertyName = "ACCESSTOKEN")] + public string AccessToken { get; set; } + /// + /// 鍙傛暟 + /// + [JsonProperty(PropertyName = "data")] + public string Data { get; set; } + /// + /// 鍙傛暟(淇濆瓨鎻愪氦瀹℃牳formId鍦ㄥ灞) + /// + [JsonProperty(PropertyName = "formid")] + public string FormId { get; set; } + } +} diff --git a/src/BarCode.Web.Core/Dto/Erp/ErpBillQueryParamDto.cs b/src/BarCode.Web.Core/Dto/Erp/ErpBillQueryParamDto.cs new file mode 100644 index 0000000..ccdaa65 --- /dev/null +++ b/src/BarCode.Web.Core/Dto/Erp/ErpBillQueryParamDto.cs @@ -0,0 +1,55 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; + +namespace BarCode.Web.Core.Dto.Erp +{ + /// + /// ERP锛氬崟鎹煡璇-鍙傛暟-dto + /// + public class ErpBillQueryParamDto + { + public ErpBillQueryParamDto() { } + + public ErpBillQueryParamDto(string formId) + { + this.FormId = formId; + } + + /// + /// 涓氬姟瀵硅薄琛ㄥ崟Id锛堝繀褰曪級 + /// + public string FormId { get; set; } + /// + /// 闇鏌ヨ鐨勫瓧娈祂ey闆嗗悎锛屽瓧绗︿覆绫诲瀷锛屾牸寮忥細"key1,key2,..."锛堝繀褰曪級 娉紙鏌ヨ鍗曟嵁浣撳唴鐮,闇鍔犲崟鎹綋Key鍜屼笅鍒掔嚎,濡傦細FEntryKey_FEntryId锛 + /// + public string FieldKeys { get; set; } + /// + /// 杩囨护鏉′欢锛屾暟缁勭被鍨嬶紝濡傦細[{"Left":"(","FieldName":"Field1","Compare":"=","Value":"111","Right":")","Logic":"AND"},{"Left":"(","FieldName":"Field2","Compare":"=","Value":"222","Right":")","Logic":""}] + /// + public string FilterString { get; set; } + + /// + /// 鎺掑簭瀛楁锛屽瓧绗︿覆绫诲瀷锛堥潪蹇呭綍锛 + /// + public string OrderString { get; set; } + + /// + /// 杩斿洖鎬昏鏁帮紝鏁村瀷锛堥潪蹇呭綍锛 + /// + public int TopRowCount { get; set; } + /// + /// 寮濮嬭绱㈠紩锛屾暣鍨嬶紙闈炲繀褰曪級 + /// + public int StartRow { get; set; } = 0; + /// + /// 鏈澶ц鏁帮紝鏁村瀷锛屼笉鑳借秴杩10000锛堥潪蹇呭綍锛 + /// + public int Limit { get; set; } = 1; + + /// + /// 琛ㄥ崟鎵鍦ㄧ殑瀛愮郴缁熷唴鐮侊紝瀛楃涓茬被鍨嬶紙闈炲繀褰曪級 + /// + public string SubSystemId { get; set; } + } +} diff --git a/src/BarCode.Web.Core/Dto/Erp/ErpInStockResultDto.cs b/src/BarCode.Web.Core/Dto/Erp/ErpInStockResultDto.cs new file mode 100644 index 0000000..837e613 --- /dev/null +++ b/src/BarCode.Web.Core/Dto/Erp/ErpInStockResultDto.cs @@ -0,0 +1,92 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; + +namespace BarCode.Web.Core.Dto.Erp +{ + /// + /// ERP:鍏ュ簱鍗-缁熶竴鍝嶅簲瀵硅薄 + /// + public class ErpInStockResultDto + { + /// + /// 鍗曟嵁缂栧彿 + /// + public string BillNo { get; set; } + /// + /// 缁勭粐 + /// + public int OrgId { get; set; } + + /// + /// erp鐨勬槑缁咺D + /// + public int ErpDetailId { get; set; } + + /// + /// 缁勭粐缂栫爜 + /// + public string OrgCode { get; set; } + + /// + /// 渚涘簲鍟 + /// + public int SupplierId { get; set; } + + /// + /// 鐗╂枡缂栫爜 + /// + public string MaterialNumber { get; set; } + + + /// + /// 浠撳簱ID + /// + public int StockId { get; set; } + + /// + /// 浠撳簱code + /// + public string StockCode { get; set; } + + /// + /// 鏁伴噺 + /// + public decimal Qty { get; set; } + + /// + /// 鍑哄巶浠 + /// + public decimal FactoryPrice { get; set; } + + /// + /// 宸蹭氦鏁伴噺锛堝搴旈噾铦剁殑宸蹭氦鏁伴噺-瀵瑰簲鐗╂枡锛夛紝鐩墠鍙湁閲囪喘璁㈠崟鏈 + /// + public decimal DeliveredQty { get; set; } + + /// + /// 鏄庣粏澶囨敞 + /// + public string Remark { get; set; } + + /// + /// 鍒涘缓鏃堕棿 + /// + public DateTime CreateTime { get; set; } + + /// + /// 鍗曟嵁绫诲瀷 + /// + public int Type { get; set; } + + /// + /// 閿鍞鍗 + /// + public string SaleBillNo { get; set; } + + /// + /// 瀹㈡埛缂栫爜 + /// + public string CustomerCode { get; set; } + } +} diff --git a/src/BarCode.Web.Core/Dto/Erp/ErpInventoryDto.cs b/src/BarCode.Web.Core/Dto/Erp/ErpInventoryDto.cs new file mode 100644 index 0000000..db08767 --- /dev/null +++ b/src/BarCode.Web.Core/Dto/Erp/ErpInventoryDto.cs @@ -0,0 +1,30 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; + +namespace BarCode.Web.Core.Dto.Erp +{ + public class ErpInventoryDto + { + /// + /// 鐗╂枡缂栫爜 + /// + public string MaterialNumber { get; set; } + /// + /// 缁勭粐缂栫爜 + /// + public string OrgCode { get; set; } + /// + /// 浠撳簱 + /// + public string StockCode { get; set; } + /// + /// 瀛愪粨搴(璺熼噾铦朵氦浜掑瓧娈) + /// + public int Erp_SubStockId { get; set; } + /// + /// 鏁伴噺 + /// + public decimal Qty { get; set; } + } +} diff --git a/src/BarCode.Web.Core/Dto/Erp/ErpNumberDto.cs b/src/BarCode.Web.Core/Dto/Erp/ErpNumberDto.cs new file mode 100644 index 0000000..5fde1ba --- /dev/null +++ b/src/BarCode.Web.Core/Dto/Erp/ErpNumberDto.cs @@ -0,0 +1,50 @@ +锘縰sing Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Text; + +namespace BarCode.Web.Core.Dto.Erp +{ + /// + /// 缂栫爜 + /// + public class ErpNumberDto + { + public ErpNumberDto() { } + public ErpNumberDto(string number) + { + this.Number = number; + } + /// + /// 缂栫爜 + /// + [JsonProperty("FNumber")] + public string Number { get; set; } + } + + /// + /// 鐩樼偣瀛愪粨搴 + /// + public class ErpSubStockDto + { + public ErpSubStockDto() { } + public ErpSubStockDto(string stockCode, string subCode) + { + if (stockCode != null && stockCode.Equals("GD")) + this.GD = new ErpNumberDto(subCode ?? ""); + if (stockCode != null && stockCode.Equals("HD")) + this.HD = new ErpNumberDto(subCode ?? ""); + } + /// + /// GD浠 + /// + [JsonProperty("FSTOCKLOCID__FF100005")] + public ErpNumberDto GD { get; set; } = new ErpNumberDto(""); + + /// + /// HD浠 + /// + [JsonProperty("FSTOCKLOCID__FF100007")] + public ErpNumberDto HD { get; set; } = new ErpNumberDto(""); + } +} diff --git a/src/BarCode.Web.Core/Dto/Erp/ErpOperateDto.cs b/src/BarCode.Web.Core/Dto/Erp/ErpOperateDto.cs new file mode 100644 index 0000000..23fbbf2 --- /dev/null +++ b/src/BarCode.Web.Core/Dto/Erp/ErpOperateDto.cs @@ -0,0 +1,28 @@ +锘縰sing Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Text; + +namespace BarCode.Web.Core.Dto.Erp +{ + /// + /// erp 鎻愪氦鍜屽鏍 + /// + public class ErpOperateDto + { + public ErpOperateDto(string formId, string number) + { + this.FormId = formId; + this.Numbers =new List() { number }; + } + /// + /// 涓氬姟瀵硅薄琛ㄥ崟Id锛堝繀褰曪級 + /// + [JsonProperty("FormId")] + public string FormId { get; set; } + /// + /// 鍗曟嵁缂栫爜 + /// + public List Numbers { get; set; } + } +} diff --git a/src/BarCode.Web.Core/Dto/Erp/ErpPurchaseInStockSaveDto.cs b/src/BarCode.Web.Core/Dto/Erp/ErpPurchaseInStockSaveDto.cs new file mode 100644 index 0000000..df6540d --- /dev/null +++ b/src/BarCode.Web.Core/Dto/Erp/ErpPurchaseInStockSaveDto.cs @@ -0,0 +1,74 @@ +锘縰sing Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Text; + +namespace BarCode.Web.Core.Dto.Erp +{ + /// + /// 淇敼閲囪喘鍏ュ簱鍗 + /// + public class ErpPurchaseInStockSaveDto + { + public ErpPurchaseInStockSaveDto() { } + public ErpPurchaseInStockSaveDto(string id) + { + this.Id = id; + } + + /// + /// 鍗曟嵁Id + /// + [JsonProperty("FID")] + public string Id { get; set; } + + /// + /// 鏄庣粏 + /// + [JsonProperty("FInStockEntry")] + public List Details { get; set; } = new List(); + } + + /// + /// 鏄庣粏 + /// + public class ErpPurchaseInStockDetailsSaveDto + { + /// + /// 鏄庣粏Id + /// + [JsonProperty("FEntryID")] + public string DetailId { get; set; } + /// + /// 閲囪喘璁㈠崟鏄庣粏Id + /// + [JsonIgnore] + public string PurchaseDetailId { get; set; } + /// + /// 鏁伴噺 + /// + [JsonProperty("FRealQty")] + public decimal Qty { get; set; } + + /// + /// 鎵瑰彿 + /// + [JsonProperty("FLot")] + public ErpLotSaveDto Lot { get; set; } + + + + } + + /// + /// 鎵瑰彿 + /// + public class ErpLotSaveDto + { + /// + /// 鎵瑰彿 + /// + [JsonProperty("FNumber")] + public string Number { get; set; } + } +} diff --git a/src/BarCode.Web.Core/Dto/Erp/ErpPushDto.cs b/src/BarCode.Web.Core/Dto/Erp/ErpPushDto.cs new file mode 100644 index 0000000..2a3d6e2 --- /dev/null +++ b/src/BarCode.Web.Core/Dto/Erp/ErpPushDto.cs @@ -0,0 +1,62 @@ +锘縰sing Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Text; + +namespace BarCode.Web.Core.Dto.Erp +{ + /// + /// 涓嬫帹 + /// + public class ErpPushDto + { + public ErpPushDto() { } + + public ErpPushDto(string formId,List detailIds,string targetFormId) + { + this.FormId = formId; + //this.Numbers.Add(number); + this.DetailsId = detailIds.ToString(); + this.TargetFormId = targetFormId; + } + + /// + /// 涓氬姟瀵硅薄琛ㄥ崟Id锛堝繀褰曪級 + /// + [JsonProperty("FormId")] + public string FormId { get; set; } + ///// + ///// 涓氬姟瀵硅薄琛ㄥ崟Id锛堝繀褰曪級 + ///// + //[JsonProperty("Numbers")] + //public List Numbers { get; set; } + /// + /// 鍒嗗綍鍐呯爜闆嗗悎锛岄楀彿鍒嗛殧锛堝垎褰曚笅鎺ㄦ椂蹇呭綍锛 娉紙鎸夊垎褰曚笅鎺ㄦ椂锛屽崟鎹唴鐮佸拰缂栫爜涓嶉渶瑕佸~,鍚﹀垯鎸夋暣鍗曚笅鎺級 + /// + [JsonProperty("EntryIds")] + public string DetailsId { get; set; } + /// + /// 鐩爣鍗曟嵁绫诲瀷 + /// + [JsonProperty("TargetFormId")] + public string TargetFormId { get; set; } + /// + /// 鏄惁鍚敤榛樿杞崲瑙勫垯锛屽竷灏旂被鍨嬶紝榛樿false锛堥潪蹇呭綍锛 + /// false 闇瑕佺┛ RuleId true 涓嶉渶瑕佷紶RuleId + /// + [JsonProperty("IsEnableDefaultRule")] + public bool IsEnableDefaultRule { get; set; } = false; + /// + /// 杞崲瑙勫垯鍐呯爜 + /// + [JsonProperty("RuleId")] + public string RuleId { get; set; } + + /// + /// 淇濆瓨澶辫触鏃舵槸鍚︽殏瀛橈紝甯冨皵绫诲瀷锛岄粯璁alse锛堥潪蹇呭綍锛 娉紙鏆傚瓨鐨勫崟鎹槸娌℃湁缂栫爜鐨勶級 + /// + [JsonProperty("IsDraftWhenSaveFail")] + public bool IsDraftWhenSaveFail { get; set; } = false; + + } +} diff --git a/src/BarCode.Web.Core/Dto/Erp/ErpSave.cs b/src/BarCode.Web.Core/Dto/Erp/ErpSave.cs new file mode 100644 index 0000000..76af023 --- /dev/null +++ b/src/BarCode.Web.Core/Dto/Erp/ErpSave.cs @@ -0,0 +1,28 @@ +锘縰sing Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Text; + +namespace BarCode.Web.Core.Dto.Erp +{ + /// + /// Erp鍚屾鏁版嵁鏃跺崟鎹ご + /// + public class ErpSave + { + public ErpSave(string formId,T model) + { + this.FormId = formId; + this.Model = model; + } + /// + /// 涓氬姟瀵硅薄琛ㄥ崟Id锛堝繀褰曪級 + /// + [JsonProperty("FormId")] + public string FormId { get; set; } + /// + /// 鍗曟嵁浣 + /// + public T Model { get; set; } + } +} diff --git a/src/BarCode.Web.Core/Dto/Erp/Material/ErpMaterialDto.cs b/src/BarCode.Web.Core/Dto/Erp/Material/ErpMaterialDto.cs new file mode 100644 index 0000000..7322c1c --- /dev/null +++ b/src/BarCode.Web.Core/Dto/Erp/Material/ErpMaterialDto.cs @@ -0,0 +1,68 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; + +namespace BarCode.Web.Core.Dto.Erp +{ + /// + /// 瀵瑰簲閲戣澏锛岀墿鏂欎俊鎭 + /// + public class ErpMaterialDto + { + /// + /// 缁勭粐ID + /// + public int OrgId { get; set; } + + /// + /// 缁勭粐缂栫爜 + /// + public string OrgCode { get; set; } + + /// + /// 鐗╂枡ID + /// + public int MaterialId { get; set; } + + /// + /// 鐗╂枡鍚嶇О + /// + public string MaterialName { get; set; } + /// + /// 鐗╂枡缂栫爜 + /// + public string MaterialNumber { get; set; } + /// + /// 鐗╂枡瑙勬牸鍨嬪彿 + /// + public string Specifications { get; set; } + + /// + /// 鍩烘湰鍗曚綅 + /// + public int BaseUnitId { get; set; } + + /// + /// 鍩烘湰鍗曚綅鍚嶇О + /// + public string BaseUnitName { get; set; } + /// + /// 鍩烘湰鍗曚綅缂栫爜 + /// + public string BaseUnitNumber { get; set; } + + /// + /// 鏉$爜 + /// + public string BarCode { get; set; } + + /// + /// 鏄惁鍚敤鎵瑰彿绠$悊 + /// + public bool IsBatchManage { get; set; } + /// + /// 鐗╂枡Id 32杩涘埗瀛楃涓 + /// + public string IdConvertBar { get; set; } + } +} diff --git a/src/BarCode.Web.Core/Dto/Erp/Org/ErpOrgDto.cs b/src/BarCode.Web.Core/Dto/Erp/Org/ErpOrgDto.cs new file mode 100644 index 0000000..0c95bb7 --- /dev/null +++ b/src/BarCode.Web.Core/Dto/Erp/Org/ErpOrgDto.cs @@ -0,0 +1,27 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; + +namespace BarCode.Web.Core.Dto.Erp.Org +{ + /// + /// 閲戣澏缁勭粐-鍩烘湰淇℃伅 + /// + public class ErpOrgDto + { + /// + /// Id + /// + public int Id { get; set; } + + /// + /// 缂栫爜 + /// + public string Number { get; set; } + + /// + /// 鍚嶇О + /// + public string Name { get; set; } + } +} diff --git a/src/BarCode.Web.Core/Dto/Erp/OutStock/ErpDeliveryNoticeOutStockResultDto.cs b/src/BarCode.Web.Core/Dto/Erp/OutStock/ErpDeliveryNoticeOutStockResultDto.cs new file mode 100644 index 0000000..85de10b --- /dev/null +++ b/src/BarCode.Web.Core/Dto/Erp/OutStock/ErpDeliveryNoticeOutStockResultDto.cs @@ -0,0 +1,65 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; + +namespace BarCode.Web.Core.Dto.Erp.OutStock +{ + /// + /// 鍙戣揣閫氱煡鍗曡浆鍑哄簱浠诲姟 + /// + public class ErpDeliveryNoticeOutStockResultDto + { + /// + /// 鏉ユ簮鍗曞彿 + /// + public string SourceBillNo { get; set; } + /// + /// 閿鍞鍗曞彿 + /// + public string SaleBillNo { get; set; } + /// + /// 鍙戣揣缁勭粐 + /// + public int DeliveryOrgId { get; set; } + /// + /// 缁勭粐缂栫爜 + /// + public string OrgCode { get; set; } + /// + /// 鏀惰揣瀹㈡埛 + /// + public int ReceiptCustomerId { get; set; } + /// + /// 瀵瑰簲閲戣澏鍗曟嵁鏄庣粏id(閿鍞嚭搴撳悓姝ラ噾铦朵笅鎺ㄤ娇鐢) + /// + public int Erp_DetailId { get; set; } = 0; + /// + /// 鐗╂枡缂栫爜 + /// + public string MaterialNumber { get; set; } + /// + /// 浠撳簱ID + /// + public string StockCode { get; set; } + /// + /// 浠撲綅ID + /// + public int? SubStockId { get; set; } + /// + /// 搴斿嚭搴撴暟閲 + /// + public decimal AccruedQty { get; set; } + /// + /// 璁㈠崟鏄庣粏澶囨敞 + /// + public string Remark { get; set; } + /// + /// 鍒涘缓鏃堕棿锛坋rp閭h竟鐨勫垱寤烘椂闂达級 + /// + public DateTime? CreateTime { get; set; } + /// + /// 鐢ㄦ潵鑷姩鏋勫缓鍗曟嵁绫诲瀷 璺烵utStockType 涓鑷 + /// + public int Type { get; set; } + } +} diff --git a/src/BarCode.Web.Core/Dto/Erp/OutStock/ErpOutStockSaveDto.cs b/src/BarCode.Web.Core/Dto/Erp/OutStock/ErpOutStockSaveDto.cs new file mode 100644 index 0000000..a9456c7 --- /dev/null +++ b/src/BarCode.Web.Core/Dto/Erp/OutStock/ErpOutStockSaveDto.cs @@ -0,0 +1,94 @@ +锘縰sing Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Text; + +namespace BarCode.Web.Core.Dto.Erp.OutStock +{ + /// + /// 鍑哄簱鍗曞悓姝ラ噾铦 + /// + public class ErpOutStockSaveDto + { + /// + /// 鍗曟嵁缂栧彿 + /// + [JsonProperty("BillNo")] + public string BillNo { get; set; } + /// + /// 鍗曟嵁绫诲瀷 + /// + [JsonProperty("BillNo")] + public string Type { get; set; } + /// + /// 鍙戣揣缁勭粐 + /// + [JsonProperty("DeliveryOrgId")] + public int DeliveryOrgId { get; set; } + /// + /// 鏀惰揣瀹㈡埛 + /// + [JsonProperty("ReceiptCustomerId")] + public int ReceiptCustomerId { get; set; } + /// + /// 鍒涘缓鏃堕棿锛堝嚭搴撴椂闂达級 + /// + [JsonProperty("CreateTime")] + public DateTime CreateTime { get; set; } = DateTime.Now; + /// + /// 缁撶畻甯佸埆榛樿涓: 浜烘皯甯 + /// + [JsonProperty("Currency")] + public string Currency { get; set; } + /// + /// 閿鍞粍缁囧彇瀵瑰簲鍙戣揣閫氱煡鍗曠殑閿鍞粍缁 + /// + [JsonProperty("Currency")] + public string SalOrg { get; set; } + /// + /// 閿鍞儴闂ㄥ彇瀵瑰簲鍙戣揣閫氱煡鍗曠殑閿鍞儴闂 + /// + [JsonProperty("Currency")] + public string SalDept { get; set; } + + } + + public class ErpOutStockSaveDetailsDto + { + /// + /// 鐗╂枡Id + /// + [JsonProperty("MaterialId")] + public string MaterialId { get; set; } + /// + /// 浠撳簱ID + /// + [JsonProperty("StockId")] + public string StockId { get; set; } + /// + /// 鍑哄簱鏁伴噺 + /// + [JsonProperty("UnitId")] + public string UnitId { get; set; } + /// + /// 鍑哄簱鏁伴噺 + /// + [JsonProperty("Qty")] + public decimal Qty { get; set; } + /// + /// 搴斿彂鏁伴噺锛屽彇瀵瑰簲鍙戣揣閫氱煡鍗曠殑閿鍞暟閲 + /// + [JsonProperty("YFQty")] + public string YFQty { get; set; } + /// + /// 鍗曚环 鍙栧搴斿彂璐ч氱煡鍗曞搴旂墿鏂欑紪鐮佽鐨 鍗曚环 + /// + [JsonProperty("Price")] + public string Price { get; set; } + /// + ///鍚◣鍗曚环 鍙栧搴斿彂璐ч氱煡鍗曞搴旂墿鏂欑紪鐮佽鐨 鍚◣鍗曚环 + /// + [JsonProperty("HSPrice")] + public string HSPrice { get; set; } + } +} diff --git a/src/BarCode.Web.Core/Dto/Erp/OutStock/ErpSalOutStockSaveDto.cs b/src/BarCode.Web.Core/Dto/Erp/OutStock/ErpSalOutStockSaveDto.cs new file mode 100644 index 0000000..851669a --- /dev/null +++ b/src/BarCode.Web.Core/Dto/Erp/OutStock/ErpSalOutStockSaveDto.cs @@ -0,0 +1,48 @@ +锘縰sing Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Text; + +namespace BarCode.Web.Core.Dto.Erp.OutStock +{ + /// + /// 淇敼閿鍞嚭搴撳崟 + /// + public class ErpSalOutStockSaveDto + { + public ErpSalOutStockSaveDto() { } + public ErpSalOutStockSaveDto(string id) + { + this.Id = id; + } + /// + /// 鍗曟嵁Id + /// + [JsonProperty("FID")] + public string Id { get; set; } + /// + /// 鏄庣粏 + /// + [JsonProperty("FEntity")] + public List Details { get; set; } = new List(); + } + public class ErpSalOutStockDetailsSaveDto + { + public ErpSalOutStockDetailsSaveDto(){} + /// + /// 鏄庣粏Id + /// + [JsonProperty("FENTRYID")] + public string DetailId { get; set; } + /// + /// 鍙戣揣閫氱煡鍗曟槑缁咺d + /// + [JsonIgnore] + public string DeliveryNoticeDetailId { get; set; } + /// + /// 鏁伴噺 + /// + [JsonProperty("FRealQty")] + public decimal Qty { get; set; } + } +} diff --git a/src/BarCode.Web.Core/Dto/Erp/PullDownStrResponse.cs b/src/BarCode.Web.Core/Dto/Erp/PullDownStrResponse.cs new file mode 100644 index 0000000..b147e87 --- /dev/null +++ b/src/BarCode.Web.Core/Dto/Erp/PullDownStrResponse.cs @@ -0,0 +1,29 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; + +namespace BarCode.Web.Core.Dto.Erp +{ + /// + /// key涓簊tring 涓嬫媺鍒楄〃瀵硅薄 + /// + public class PullDownStrResponse + { + /// + /// id + /// + public string Id { get; set; } + /// + /// 缂栫爜 + /// + public string Code { get; set; } + /// + /// 鍚嶅瓧 + /// + public string Name { get; set; } + /// + /// 鏄惁榛樿閫変腑 + /// + public bool IsDefault { get; set; } = false; + } +} diff --git a/src/BarCode.Web.Core/Dto/Erp/Stock/ErpStockDto.cs b/src/BarCode.Web.Core/Dto/Erp/Stock/ErpStockDto.cs new file mode 100644 index 0000000..7a4a8eb --- /dev/null +++ b/src/BarCode.Web.Core/Dto/Erp/Stock/ErpStockDto.cs @@ -0,0 +1,33 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; + +namespace BarCode.Web.Core.Dto.Erp +{ + /// + /// 浠撳簱淇℃伅 + /// + public class ErpStockDto + { + /// + /// id + /// + public int Id { get; set; } + /// + /// 缂栫爜 + /// + public string Code { get; set; } + /// + /// 鍚嶅瓧 + /// + public string Name { get; set; } + /// + /// 涓氬姟缁勭粐(浣跨敤缁勭粐) + /// + public int OrgId { get; set; } + /// + /// 涓氬姟缁勭粐(浣跨敤缁勭粐)缂栫爜 + /// + public string OrgCode { get; set; } + } +} diff --git a/src/BarCode.Web.Core/Dto/Erp/Stock/ErpSubStockDto.cs b/src/BarCode.Web.Core/Dto/Erp/Stock/ErpSubStockDto.cs new file mode 100644 index 0000000..8bfb3da --- /dev/null +++ b/src/BarCode.Web.Core/Dto/Erp/Stock/ErpSubStockDto.cs @@ -0,0 +1,37 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; + +namespace BarCode.Web.Core.Dto.Erp +{ + /// + /// 瀛愪粨搴撲俊鎭 + /// + public class Erp_SubStockDto + { + /// + /// id + /// + public int Id { get; set; } + /// + /// 缂栫爜 + /// + public string Code { get; set; } + /// + /// 鍚嶅瓧 + /// + public string Name { get; set; } + /// + /// 涓氬姟缁勭粐(浣跨敤缁勭粐) + /// + public int OrgId { get; set; } + /// + /// 涓氬姟缁勭粐(浣跨敤缁勭粐)缂栫爜 + /// + public string OrgCode { get; set; } + /// + /// 浠撳簱缂栫爜 + /// + public string StockCode { get; set; } + } +} diff --git a/src/BarCode.Web.Core/Dto/Erp/Supplier/ErpSupplierDto.cs b/src/BarCode.Web.Core/Dto/Erp/Supplier/ErpSupplierDto.cs new file mode 100644 index 0000000..364b35b --- /dev/null +++ b/src/BarCode.Web.Core/Dto/Erp/Supplier/ErpSupplierDto.cs @@ -0,0 +1,31 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; + +namespace BarCode.Web.Core.Dto.Erp.Supplier +{ + /// + /// erp渚涘簲鍟嗗熀纭鏁版嵁 + /// + public class ErpSupplierDto + { + /// + /// ID + /// + public int Id { get; set; } + + /// + /// 缂栫爜 + /// + public string Number { get; set; } + + /// + /// 鍚嶇О + /// + public string Name { get; set; } + /// + /// 缁勭粐缂栫爜 + /// + public string OrgCode { get; set; } + } +} diff --git a/src/BarCode.Web.Core/Dto/Erp/TakeStock/ErpTakeStockSaveDto.cs b/src/BarCode.Web.Core/Dto/Erp/TakeStock/ErpTakeStockSaveDto.cs new file mode 100644 index 0000000..2eb2586 --- /dev/null +++ b/src/BarCode.Web.Core/Dto/Erp/TakeStock/ErpTakeStockSaveDto.cs @@ -0,0 +1,138 @@ +锘縰sing Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Text; + +namespace BarCode.Web.Core.Dto.Erp.TakeStock +{ + /// + /// 鐩樼偣鍗 + /// + public class ErpTakeStockSaveDto + { + + public ErpTakeStockSaveDto() { } + /* + * 鍗曟嵁缂栧彿锛欶BillNo + 鏃ユ湡锛欶Date (蹇呭~椤) + + 搴撳瓨缁勭粐锛欶StockOrgId (蹇呭~椤) + 鍗曟嵁绫诲瀷锛欶BillTypeID (蹇呭~椤) + 璐т富绫诲瀷锛欶OwnerTypeIdHead (蹇呭~椤) BD_OwnerOrg + + 鐗╂枡缂栫爜锛欶MaterialId (蹇呭~椤) + 鍗曚綅锛欶UnitID (蹇呭~椤) + 浠撳簱锛欶StockId (蹇呭~椤) + 搴撳瓨鐘舵侊細FStockStatusId (蹇呭~椤) + 璐т富绫诲瀷锛欶OwnerTypeId (蹇呭~椤) BD_OwnerOrg + 璐т富锛欶Ownerid (蹇呭~椤) + 淇濈鑰呯被鍨嬶細FKeeperTypeId (蹇呭~椤) BD_KeeperOrg + 淇濈鑰咃細FKeeperId (蹇呭~椤) + 瀛愪粨搴擄細FStockLocId + */ + + /// + /// 鍗曟嵁绫诲瀷(鏍囧噯鐩樹簭鍗; 鏍囧噯鐩樼泩鍗 PY01_SYS) 鐩樹簭 PK01_SYS + /// + [JsonProperty("FBillTypeID")] + public ErpNumberDto Type { get; set; } + /// + /// 搴撳瓨缁勭粐 (鍙栦粨搴撳搴旂殑搴撳瓨缁勭粐) + /// + [JsonProperty("FStockOrgId")] + public ErpNumberDto StockOrgId { get; set; } + /// + /// 璐т富绫诲瀷: 榛樿涓轰笟鍔$粍缁 BD_OwnerOrg + /// + [JsonProperty("FOwnerTypeIdHead")] + public string FOwnerTypeIdHead { get; set; } = "BD_OwnerOrg"; + /// + /// 鍗曟嵁缂栧彿 + /// + [JsonProperty("FBillNo")] + public string BillNo { get; set; } + /// + /// 鐩樼偣鏃ユ湡 + /// + [JsonProperty("FDate")] + public DateTime Date { get; set; } + /// + /// 鏄庣粏 + /// + [JsonProperty("FBillEntry")] + public List Details = new List(); + } + public class ErpTakeStockDetailsSaveDto + { + /// + /// 搴撳瓨鐘舵 KCZT01_SYS + /// + [JsonProperty("FStockStatusId")] + public ErpNumberDto FStockStatusId { get; set; } = new ErpNumberDto("KCZT01_SYS"); + /// + /// 璐т富绫诲瀷: 榛樿涓轰笟鍔$粍缁 BD_OwnerOrg + /// + [JsonProperty("FOwnerTypeId")] + public string FOwnerTypeId { get; set; } = "BD_OwnerOrg"; + /// + /// 鍙栦粨搴撳搴旂殑璐т富淇℃伅 璐т富: 绛変簬搴撳瓨缁勭粐 + /// + [JsonProperty("FOwnerid")] + public ErpNumberDto FOwnerid { get; set; } + /// + /// 淇濈鑰呯被鍨 + /// + [JsonProperty("FKeeperTypeId")] + public string FKeeperTypeId { get; set; } = "BD_KeeperOrg"; + /// + /// 淇濈鑰 浠撳簱鈥濆簱瀛樼粍缁団 + /// + [JsonProperty("FKeeperId")] + public ErpNumberDto FKeeperId { get; set; } + /// + /// 鐗╂枡ID + /// + [JsonProperty("FMaterialId")] + public ErpNumberDto MaterialId { get; set; } + /// + /// 鍗曚綅ID + /// + [JsonProperty("FUnitID")] + public ErpNumberDto UnitId { get; set; } + /// + /// 浠撳簱ID + /// + [JsonProperty("FStockId")] + public ErpNumberDto StockId { get; set; } + /// + /// 浠撲綅ID + /// + [JsonProperty("FStockLocId")] + public ErpSubStockDto SubStockId { get; set; } + /// + /// 鐩樼偣鍓嶆暟閲忥紙wms绯荤粺鏁伴噺锛 + /// + [JsonProperty("FAcctQty")] + public decimal BeforeQty { get; set; } + /// + /// 鐩樼偣瀹為檯鏁伴噺锛堝疄闄呬粨搴撴暟閲忥級 + /// + [JsonProperty("FCountQty")] + public decimal AfterQty { get; set; } + /// + /// 鐩樼泩鏁伴噺 + /// + [JsonProperty("FGainQty")] + public decimal FinalQty { get; set; } + /// + /// 鐩樹簭鏁伴噺 + /// + [JsonProperty("FLossQty")] + public decimal LossQty { get; set; } + /// + /// 澶囨敞 + /// + [JsonProperty("Fnote")] + public string Fnote { get; set; } + } +} diff --git a/src/BarCode.Web.Core/Dto/FileDownManagerRequest.cs b/src/BarCode.Web.Core/Dto/FileDownManagerRequest.cs new file mode 100644 index 0000000..0833a1d --- /dev/null +++ b/src/BarCode.Web.Core/Dto/FileDownManagerRequest.cs @@ -0,0 +1,43 @@ +锘縰sing System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.Text; + +namespace BarCode.Web.Core.Dto +{ + /// + /// 涓婁紶涓嬭浇鍒楄〃 + /// + public class FileDownManagerRequest: PaginationBaseRequestDto + { + /// + /// 缁勭粐Code + /// + [Required(ErrorMessage = "缁勭粐涓嶈兘涓虹┖")] + public string OrgCode { get; set; } = string.Empty; + /// + /// 鍗曟嵁绫诲瀷(浠诲姟绫诲瀷) + /// + public int? Type { get; set; } + /// + /// 鐘舵 + /// + public int? Status { get; set; } + /// + /// 涓嬪崟鏃堕棿 寮濮 + /// + public DateTime? BeginDate { get; set; } + /// + /// 涓嬪崟鏃堕棿 缁撴潫 + /// + public DateTime? EndDate { get; set; } + /// + /// 鎿嶄綔浜 + /// + public string User { get; set; } = string.Empty; + /// + /// 渚涘簲鍟嗙敤鎴稩d + /// + public int? SupplierId { get; set; } = null; + } +} diff --git a/src/BarCode.Web.Core/Dto/FileDownManagerResponse.cs b/src/BarCode.Web.Core/Dto/FileDownManagerResponse.cs new file mode 100644 index 0000000..1ae3e6a --- /dev/null +++ b/src/BarCode.Web.Core/Dto/FileDownManagerResponse.cs @@ -0,0 +1,73 @@ +锘 +using System; +using System.Collections.Generic; +using System.Text; +using BarCode.Web.Core.Help; + +namespace BarCode.Web.Core.Dto +{ + /// + /// 涓婁紶涓嬭浇鍒楄〃 + /// + public class FileDownManagerResponse + { + public FileDownManagerResponse(List list, int? total) + { + this.List = list; + this.Total = total; + } + + /// + /// 鏌ヨ鍒楄〃鍐呭 + /// + public List List { get; set; } = new List(); + /// + /// 鎬绘潯鏁 + /// + public int? Total { get; set; } + } + + /// + /// 涓婁紶涓嬭浇鍒楄〃 + /// + public class FileDownInfoManagerResponse + { + public FileDownInfoManagerResponse() { } + public FileDownInfoManagerResponse(FileDownInfoManagerResponse response) + { + response.CopyPropertiesToD(this); + } + /// + /// 涓婚敭 璁㈠崟缂栧彿 + /// + public int Id { get; set; } + /// + /// 鏃ユ湡 + /// + public string Date { get; set; } + /// + /// 鍗曟嵁绫诲瀷(浠诲姟绫诲瀷) + /// + public int Type { get; set; } + /// + /// 鐘舵(Key锛 + /// + public int StatusKey { get; set; } + /// + /// 鐘舵 + /// + public string Status { get; set; } + /// + /// 鏂囦欢鍦板潃 + /// + public string FilePath { get; set; } + /// + /// 鎿嶄綔浜 + /// + public string UserName { get; set; } + /// + /// 澶辫触鍘熷洜 + /// + public string Reason { get; set; } + } +} diff --git a/src/BarCode.Web.Core/Dto/FileDownManagerStatusResponse.cs b/src/BarCode.Web.Core/Dto/FileDownManagerStatusResponse.cs new file mode 100644 index 0000000..6858205 --- /dev/null +++ b/src/BarCode.Web.Core/Dto/FileDownManagerStatusResponse.cs @@ -0,0 +1,19 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; + +namespace BarCode.Web.Core.Dto +{ + public class FileDownManagerStatusResponse + { + public FileDownManagerStatusResponse() { } + /// + /// 浠诲姟绫诲瀷 + /// + public Dictionary Type { get; set; } = new Dictionary(); + /// + /// 鐘舵 + /// + public Dictionary Status { get; set; } = new Dictionary(); + } +} diff --git a/src/BarCode.Web.Core/Dto/Login/AccessTokenDto.cs b/src/BarCode.Web.Core/Dto/Login/AccessTokenDto.cs new file mode 100644 index 0000000..f10c00c --- /dev/null +++ b/src/BarCode.Web.Core/Dto/Login/AccessTokenDto.cs @@ -0,0 +1,37 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; + +namespace BarCode.Web.Core.Dto.Login +{ + public class AccessTokenDto + { + /// + /// 瀹㈡埛绔悕绉 + /// + public string ClientName { get; set; } + + /// + /// 鎺堟潈token -- 缁欏墠绔敤鐨勯獙璇乼oken + /// + public string Token { get; set; } + + /// + /// 鎺堟潈token -- 鍗曠偣缁欒繃鏉ョ殑token + /// + public string PhpToken { get; set; } + + /// + /// token澶存爣璇 + /// + public string TokenType { get; set; } = "Bearer"; + /// + /// 鍒锋柊token + /// + public string RefreshToken { get; set; } + /// + /// 杩囨湡鏃堕棿 + /// + public DateTime Expired { get; set; } + } +} diff --git a/src/BarCode.Web.Core/Dto/Login/DeptInfoDto.cs b/src/BarCode.Web.Core/Dto/Login/DeptInfoDto.cs new file mode 100644 index 0000000..15a8dcf --- /dev/null +++ b/src/BarCode.Web.Core/Dto/Login/DeptInfoDto.cs @@ -0,0 +1,17 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; + +namespace BarCode.Web.Core.Dto.Login +{ + public class DeptInfoDto + { + public int Id { get; set; } + + public string DeptCode { get; set; } + + public string DeptName { get; set; } + + public int? ManagerId { get; set; } + } +} diff --git a/src/BarCode.Web.Core/Dto/Login/LoginInDto.cs b/src/BarCode.Web.Core/Dto/Login/LoginInDto.cs new file mode 100644 index 0000000..e435d5f --- /dev/null +++ b/src/BarCode.Web.Core/Dto/Login/LoginInDto.cs @@ -0,0 +1,25 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; + +namespace BarCode.Web.Core.Dto.Login +{ + /// + /// 鐧诲綍鍚庤淇濆瓨鐨勪俊鎭 + /// + public class LoginInDto + { + + public bool SignedIn { get; set; } + + /// + /// 鐢ㄦ埛淇℃伅 + /// + public UserInfoDto UserInfo { get; set; } + + /// + /// token淇℃伅 + /// + public AccessTokenDto TokenInfo { get; set; } + } +} diff --git a/src/BarCode.Web.Core/Dto/Login/LoginOutAuthorizeRequest.cs b/src/BarCode.Web.Core/Dto/Login/LoginOutAuthorizeRequest.cs new file mode 100644 index 0000000..e494e7e --- /dev/null +++ b/src/BarCode.Web.Core/Dto/Login/LoginOutAuthorizeRequest.cs @@ -0,0 +1,14 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; + +namespace BarCode.Web.Core.Dto.Login +{ + public class LoginOutAuthorizeRequest + { + public string AccessToken { get; set; } + + public string RefreshToken { get; set; } + + } +} diff --git a/src/BarCode.Web.Core/Dto/Login/LoginOutDto.cs b/src/BarCode.Web.Core/Dto/Login/LoginOutDto.cs new file mode 100644 index 0000000..b1f70b9 --- /dev/null +++ b/src/BarCode.Web.Core/Dto/Login/LoginOutDto.cs @@ -0,0 +1,44 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; + +namespace BarCode.Web.Core.Dto.Login +{ + /// + /// 鐧诲嚭鐨刣to + /// + public class LoginOutDto + { + /// + /// 鎺堟潈token + /// + public string Authorization { get; set; } + + /// + /// 鐢ㄦ埛ID + /// + public string UcId { get; set; } + + /// + /// PHP-session-ID + /// + public string SessionId { get; set; } + + /// + /// PHP鐧诲綍杩斿洖鐨則oken + /// + public string AccessToken { get; set; } + + /// + /// PHP鐧诲綍鐨勮繃鏈熸椂闂 + /// + public DateTime ExpiresIn { get; set; } + + /// + ///ops鑷繁浜х敓鐨則oken 缁欏墠绔獙璇佺敤鐨 + /// + public string Token { get; set; } + + public string RefreshToken { get; set; } + } +} diff --git a/src/BarCode.Web.Core/Dto/Login/LoginRequest.cs b/src/BarCode.Web.Core/Dto/Login/LoginRequest.cs new file mode 100644 index 0000000..6f9a757 --- /dev/null +++ b/src/BarCode.Web.Core/Dto/Login/LoginRequest.cs @@ -0,0 +1,86 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; + +namespace BarCode.Web.Core.Dto.Login +{ + /// + /// 鐧诲綍璇锋眰瀵硅薄 + /// + public class LoginRequest + { + /// + /// 璐﹀彿 + /// + public string UserName { get; set; } + + /// + /// 瀵嗙爜 + /// + public string Password { get; set; } + } + + public class LoginAuthorizeRequest : LoginRequest + { + /// + /// + /// + public string ClientId { get; set; } + + /// + /// + /// + public string ClientSecret { get; set; } + + /// + /// + /// + public string GrantType { get; set; } + + public string Scope { get; set; } + } + + public class LoginAuthorizeCodeRequest + { + /// + /// + /// + public string ClientId { get; set; } + + /// + /// + /// + public string ClientSecret { get; set; } + + /// + /// + /// + public string GrantType { get; set; } + + public string Code { get; set; } + + public string Scope { get; set; } + } + + public class LoginAuthorizeRefreshTokenRequest + { + /// + /// + /// + public string ClientId { get; set; } + + /// + /// + /// + public string ClientSecret { get; set; } + + /// + /// + /// + public string GrantType { get; set; } + + public string RefreshToken { get; set; } + + public string Scope { get; set; } + } +} diff --git a/src/BarCode.Web.Core/Dto/Login/Menu/MenuRequest.cs b/src/BarCode.Web.Core/Dto/Login/Menu/MenuRequest.cs new file mode 100644 index 0000000..8c69996 --- /dev/null +++ b/src/BarCode.Web.Core/Dto/Login/Menu/MenuRequest.cs @@ -0,0 +1,29 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; + +namespace BarCode.Web.Core.Dto.Login +{ + /// + /// 鑿滃崟鐨勮姹傚璞 + /// + public class MenuRequest + { + public MenuRequest() { } + public MenuRequest(int userId, int moduleId) + { + this.UserId = userId; + this.ModuleID = moduleId; + } + + /// + /// 鐢ㄦ埛ID锛堜笉鏄汉鍛業D锛 + /// + public int UserId { get; set; } + + /// + /// 搴旂敤ID + /// + public int ModuleID { get; set; } + } +} diff --git a/src/BarCode.Web.Core/Dto/Login/Menu/MenuResponse.cs b/src/BarCode.Web.Core/Dto/Login/Menu/MenuResponse.cs new file mode 100644 index 0000000..8df83a1 --- /dev/null +++ b/src/BarCode.Web.Core/Dto/Login/Menu/MenuResponse.cs @@ -0,0 +1,105 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; + +namespace BarCode.Web.Core.Dto.Login +{ + /// + /// 鑿滃崟鍝嶅簲瀵硅薄 + /// + public class MenuResponse + { + /// + /// + /// + + public int ID { get; set; } + /// + /// 涓婄骇鑿滃崟 + /// + + public int? Pid { get; set; } + /// + /// 妯″潡ID锛屽搴攁pps琛↖D + /// + + public int? Module { get; set; } + /// + /// 鑿滃崟鏍囬 + /// + + public string Title { get; set; } + /// + /// 鑿滃崟鏍囩 + /// + + public string Name { get; set; } + /// + /// 鑿滃崟璺緞 + /// + + public string Path { get; set; } + /// + /// 鎿嶄綔锛屾瘮濡 /admin/info + /// + + public string Component { get; set; } + /// + /// 鍥炬爣 + /// + + public string Icon { get; set; } + /// + /// + /// + + public string Redirect { get; set; } + /// + /// 鎺掑簭 + /// + + public int? Sort { get; set; } + /// + /// 0涓烘櫘閫氭寜閽/杩炴帴锛1涓哄乏渚ц彍鍗 + /// + + public int? Type { get; set; } + /// + /// 鏄惁鏄剧ず锛0涓哄惁锛1涓烘槸 + /// + + public bool Hidden { get; set; } + /// + /// 鏄惁绂佺敤锛0涓哄惁锛1涓烘槸 + /// + + public bool Closed { get; set; } + + /// + /// 鏄惁绂佺敤锛歵rue涓虹鐢紝false涓哄惎鐢 + /// + public bool Disable { get; set; } + + /// + /// 瀛愰泦 + /// + public List Children { get; set; } + + /// + /// meta + /// + public Meta meta { get; set; } + } + + public class Meta + { + /// + /// 鑿滃崟鍚嶅瓧 + /// + public string title { get; set; } + /// + /// 鑿滃崟鍥炬爣 + /// + public string icon { get; set; } + } +} diff --git a/src/BarCode.Web.Core/Dto/Login/Single/LoginSingleRequest.cs b/src/BarCode.Web.Core/Dto/Login/Single/LoginSingleRequest.cs new file mode 100644 index 0000000..bc6b02e --- /dev/null +++ b/src/BarCode.Web.Core/Dto/Login/Single/LoginSingleRequest.cs @@ -0,0 +1,27 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; + +namespace BarCode.Web.Core.Dto.Login +{ + /// + /// 鐧诲綍鍚庯細璇锋眰鐩稿叧鍏ㄩ儴淇℃伅瀵硅薄 + /// + public class LoginSingleRequest + { + /// + /// 鐢ㄦ埛ID + /// + public int UserId { get; set; } + + /// + /// 渚涘簲鍟 + /// + public int SupplierId { get; set; } + + /// + /// 瀹㈡埛 + /// + public int CustomerId { get; set; } + } +} diff --git a/src/BarCode.Web.Core/Dto/Login/Single/LoginSingleResponse.cs b/src/BarCode.Web.Core/Dto/Login/Single/LoginSingleResponse.cs new file mode 100644 index 0000000..0f8b349 --- /dev/null +++ b/src/BarCode.Web.Core/Dto/Login/Single/LoginSingleResponse.cs @@ -0,0 +1,33 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; +using BarCode.Web.Core.Dto.SingleData; + +namespace BarCode.Web.Core.Dto.Login +{ + /// + /// 鐧诲綍鍚庯細鍝嶅簲鐩稿叧鍏ㄩ儴淇℃伅瀵硅薄 + /// + public class LoginSingleResponse + { + /// + /// 浜哄憳 + /// + public SingleDataResponse Staff { get; set; } + + /// + /// 鍏徃 + /// + public SingleDataResponse Company { get; set; } + + /// + /// 渚涘簲鍟 + /// + public SingleDataResponse Supplier { get; set; } + + /// + /// 瀹㈡埛 + /// + public SingleDataResponse Customer { get; set; } + } +} diff --git a/src/BarCode.Web.Core/Dto/Login/TagInfoDto.cs b/src/BarCode.Web.Core/Dto/Login/TagInfoDto.cs new file mode 100644 index 0000000..382d1a2 --- /dev/null +++ b/src/BarCode.Web.Core/Dto/Login/TagInfoDto.cs @@ -0,0 +1,13 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; + +namespace BarCode.Web.Core.Dto.Login +{ + public class TagInfoDto + { + public int Id { get; set; } + public string Name { get; set; } + public string Code { get; set; } + } +} diff --git a/src/BarCode.Web.Core/Dto/Login/Temp/LoginJsonDeptTempDto.cs b/src/BarCode.Web.Core/Dto/Login/Temp/LoginJsonDeptTempDto.cs new file mode 100644 index 0000000..8c9e7f7 --- /dev/null +++ b/src/BarCode.Web.Core/Dto/Login/Temp/LoginJsonDeptTempDto.cs @@ -0,0 +1,19 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; + +namespace BarCode.Web.Core.Dto.Login.Temp +{ + /// + /// 閮ㄩ棬 + /// + public class LoginJsonDeptTempDto + { + public int id { get; set; } + + public string dept_code { get; set; } + public string dept_name { get; set; } + + public int? manager { get; set; } + } +} diff --git a/src/BarCode.Web.Core/Dto/Login/Temp/LoginJsonTokenTempDto.cs b/src/BarCode.Web.Core/Dto/Login/Temp/LoginJsonTokenTempDto.cs new file mode 100644 index 0000000..56bdcc9 --- /dev/null +++ b/src/BarCode.Web.Core/Dto/Login/Temp/LoginJsonTokenTempDto.cs @@ -0,0 +1,107 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; + +namespace BarCode.Web.Core.Dto.Login.Temp +{ + /// + /// 鍩烘湰淇℃伅浜哄憳--鍜屽崟鐐圭郴缁熺殑瀛楁涓涓瀵瑰簲 + /// + public class LoginJsonTokenTempDto + { + /// + /// 鐢ㄦ埛鍦ㄥ崟鐐逛腑缁翠竴ID + /// + public int uc_id { get; set; } + + /// + /// 鐢ㄦ埛缂栫爜 + /// + public string staff_code { get; set; } + + /// + /// 鐢ㄦ埛涓氬姟鍛樼紪鐮 + /// + public string business_code { get; set; } + + /// + /// 瑙掕壊id + /// + public string role_id { get; set; } + + /// + /// 濮撳悕 + /// + public string nickname { get; set; } + + /// + /// 澶村儚 + /// + public string avatar { get; set; } + + /// + /// 鐢ㄦ埛鎵嬫満 + /// + public string mobile { get; set; } + + /// + /// 鐢ㄦ埛閭欢 + /// + public string email { get; set; } + + /// + /// 鍏徃id + /// + public int? company_id { get; set; } + + /// + /// 缁勭粐id + /// + public int? org_id { get; set; } + + /// + /// 渚涘簲鍟唅d + /// + public int? supplier_id { get; set; } + + /// + /// 瀹㈡埛id + /// + public int? customer_id { get; set; } + + /// + /// 鍒涘缓鏃堕棿 + /// + public string created_at { get; set; } + + /// + /// 鏇存柊鏃堕棿 + /// + public string updated_at { get; set; } + + /// + /// 绛惧悕(鐧诲綍锛夋椂闂 + /// + public string signin_at { get; set; } + + /// + /// 绛惧悕(鐧诲綍锛塱p + /// + public string signin_ip { get; set; } + + /// + /// 鍏抽棴鐘舵侊紝0涓烘湭鍏抽棴 + /// + public string closed { get; set; } + + /// + /// 鐢ㄦ埛绫诲瀷 1涓哄憳宸ワ紝2涓轰緵搴斿晢锛3涓哄鎴 + /// + public int? identity { get; set; } + + /// + /// 閮ㄩ棬 + /// + public List depts { get; set; } + } +} diff --git a/src/BarCode.Web.Core/Dto/Login/Temp/LoginTempDto.cs b/src/BarCode.Web.Core/Dto/Login/Temp/LoginTempDto.cs new file mode 100644 index 0000000..d8370bc --- /dev/null +++ b/src/BarCode.Web.Core/Dto/Login/Temp/LoginTempDto.cs @@ -0,0 +1,70 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; + +namespace BarCode.Web.Core.Dto.Login.Temp +{ + /// + /// 鐧诲綍鍚庤幏鍙栫殑:token 淇℃伅-鍜屽崟鐐圭郴缁熺殑瀛楁涓涓瀵瑰簲 + /// + public class LoginTempDto + { + /// + /// 鐢ㄦ埛鍦ㄥ崟鐐逛腑缁翠竴ID + /// + public int uc_id { get; set; } + + /// + /// 鍗曠偣璁块棶鐨剆ession id + /// + public string uc_sessid { get; set; } + + /// + /// 鍚庣画涓庡崟鐐归氫俊楠岃瘉token + /// + public string access_token { get; set; } + + /// + ///access token杩囨湡鏃堕棿 + /// + public int expires_in { get; set; } + + + /// + /// 鐢ㄤ簬access_token杩囨湡鍚庡埛鏂扮敤 + /// + public string refresh_token { get; set; } + + /// + /// 鍔犲瘑鍚庣殑鐢ㄦ埛鏁版嵁 + /// + public string encryptedData { get; set; } + } + + /// + /// 鐧诲綍鍚庤幏鍙栫殑:token 淇℃伅-鍜屽崟鐐圭郴缁熺殑瀛楁涓涓瀵瑰簲 + /// + public class LoginTempV2Dto + { + /// + /// 鍚庣画涓庡崟鐐归氫俊楠岃瘉token + /// + public string access_token { get; set; } + + /// + ///access token杩囨湡鏃堕棿 + /// + public int access_expired_at { get; set; } + + + /// + /// 鐢ㄤ簬access_token杩囨湡鍚庡埛鏂扮敤 + /// + public string refresh_token { get; set; } + + /// + /// 鍔犲瘑鍚庣殑鐢ㄦ埛鏁版嵁 + /// + public string encrypted_data { get; set; } + } +} diff --git a/src/BarCode.Web.Core/Dto/Login/Temp/v3/LoginJsonCompanyTempDto.cs b/src/BarCode.Web.Core/Dto/Login/Temp/v3/LoginJsonCompanyTempDto.cs new file mode 100644 index 0000000..76c7819 --- /dev/null +++ b/src/BarCode.Web.Core/Dto/Login/Temp/v3/LoginJsonCompanyTempDto.cs @@ -0,0 +1,13 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; + +namespace BarCode.Web.Core.Dto.Login.Temp +{ + public class LoginJsonCompanyTempDto + { + public int company_id { get; set; } + public string company_name { get; set; } + public string company_code { get; set; } + } +} diff --git a/src/BarCode.Web.Core/Dto/Login/Temp/v3/LoginJsonDeptV3TempDto.cs b/src/BarCode.Web.Core/Dto/Login/Temp/v3/LoginJsonDeptV3TempDto.cs new file mode 100644 index 0000000..e6519e9 --- /dev/null +++ b/src/BarCode.Web.Core/Dto/Login/Temp/v3/LoginJsonDeptV3TempDto.cs @@ -0,0 +1,13 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; + +namespace BarCode.Web.Core.Dto.Login.Temp.v3 +{ + public class LoginJsonDeptV3TempDto + { + public int dept_id { get; set; } + public string dept_name { get; set; } + public string dept_code { get; set; } + } +} diff --git a/src/BarCode.Web.Core/Dto/Login/Temp/v3/LoginJsonOrgTempDto.cs b/src/BarCode.Web.Core/Dto/Login/Temp/v3/LoginJsonOrgTempDto.cs new file mode 100644 index 0000000..2ea317a --- /dev/null +++ b/src/BarCode.Web.Core/Dto/Login/Temp/v3/LoginJsonOrgTempDto.cs @@ -0,0 +1,13 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; + +namespace BarCode.Web.Core.Dto.Login.Temp +{ + public class LoginJsonOrgTempDto + { + public int org_id { get; set; } + public string org_name { get; set; } + public string org_code { get; set; } + } +} diff --git a/src/BarCode.Web.Core/Dto/Login/Temp/v3/LoginJsonRoleTempDto.cs b/src/BarCode.Web.Core/Dto/Login/Temp/v3/LoginJsonRoleTempDto.cs new file mode 100644 index 0000000..be9a736 --- /dev/null +++ b/src/BarCode.Web.Core/Dto/Login/Temp/v3/LoginJsonRoleTempDto.cs @@ -0,0 +1,13 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; + +namespace BarCode.Web.Core.Dto.Login.Temp.v3 +{ + public class LoginJsonRoleTempDto + { + public int role_id { get; set; } + public string role_name { get; set; } + public string role_code { get; set; } + } +} diff --git a/src/BarCode.Web.Core/Dto/Login/Temp/v3/LoginJsonTokenV3TempDto.cs b/src/BarCode.Web.Core/Dto/Login/Temp/v3/LoginJsonTokenV3TempDto.cs new file mode 100644 index 0000000..4ece9ee --- /dev/null +++ b/src/BarCode.Web.Core/Dto/Login/Temp/v3/LoginJsonTokenV3TempDto.cs @@ -0,0 +1,30 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; + +namespace BarCode.Web.Core.Dto.Login.Temp.v3 +{ + public class LoginJsonTokenV3TempDto + { + /// + /// 鐢ㄦ埛鍦ㄥ崟鐐逛腑缁翠竴ID + /// + public int id { get; set; } + + public string dingtalk_uid { get; set; } + + public string dingtalk_unionid { get; set; } + + public string nickname { get; set; } + public string realname { get; set; } + + public string mobile { get; set; } + + public int identity { get; set; } + + public LoginJsonCompanyTempDto company { get; set; } + public List orgs { get; set; } + public List depts { get; set; } + public List roles { get; set; } + } +} diff --git a/src/BarCode.Web.Core/Dto/Login/UserInfoDto.cs b/src/BarCode.Web.Core/Dto/Login/UserInfoDto.cs new file mode 100644 index 0000000..89a0dee --- /dev/null +++ b/src/BarCode.Web.Core/Dto/Login/UserInfoDto.cs @@ -0,0 +1,101 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; + +namespace BarCode.Web.Core.Dto.Login +{ + public class UserInfoDto + { + public string SeesionId { get; set; } + + public int UcId { get; set; } + + public List Depts { get; set; } + + /// + /// 浜哄憳ID + /// + public int StaffId { get; set; } + + /// + /// 鐢ㄦ埛缂栫爜 + /// + public string staff_code { get; set; } + + /// + /// 鐢ㄦ埛涓氬姟鍛樼紪鐮 + /// + public string business_code { get; set; } + /// + /// 澶村儚 + /// + public string Avatar { get; set; } + /// + /// 鏄惁鏄痑dmin璐︽埛 + /// + public bool IsAdmin { get; set; } = false; + + public int Closed { get; set; } + + public string CreatedAt { get; set; } + + public string Email { get; set; } + + public string Mobile { get; set; } + + public string Nickname { get; set; } + + public string RoleId { get; set; } + + public string SigninAt { get; set; } + + public string UpdatedAt { get; set; } + + /// + /// 鍏徃id + /// + public int CompanyId { get; set; } + + /// + /// 鍏徃鍚嶇О + /// + public string CompanyName { get; set; } + + //org_id, supplier_id ,customer_id, identity: 1涓哄憳宸ワ紝2涓轰緵搴斿晢锛3涓哄鎴 + + /// + /// 缁勭粐id 鐢ㄦ埛绫诲瀷涓哄唴閮ㄥ憳宸ョ殑鏃跺欐墠鏈夊 + /// + public int? OrgId { get; set; } + + /// + /// 渚涘簲鍟唅d 鐢ㄦ埛绫诲瀷涓轰緵搴斿晢鐨勬椂鍊欐墠鏈夊 + /// + public int? SupplierId { get; set; } + /// + /// 渚涘簲鍟咰ode 鐢ㄦ埛绫诲瀷涓轰緵搴斿晢鐨勬椂鍊欐墠鏈夊 + /// + public string SupplierCode { get; set; } = ""; + /// + /// 渚涘簲鍟嗗悕绉 + /// + public string SupplierName { get; set; } = ""; + + /// + /// 瀹㈡埛id 鐢ㄦ埛绫诲瀷涓哄鎴风殑鏃跺欐墠鏈夊 + /// + public int? CustomerId { get; set; } + + /// + /// 瀹㈡埛鍚嶇О + /// + public string CustomerName { get; set; } + + /// + /// 鐢ㄦ埛绫诲瀷锛1涓哄憳宸ワ紝2涓轰緵搴斿晢锛3涓哄鎴 + /// + public int? Identity { get; set; } + + //public string AuthList { get; set; } + } +} diff --git a/src/BarCode.Web.Core/Dto/Login/UserInfoV3Dto.cs b/src/BarCode.Web.Core/Dto/Login/UserInfoV3Dto.cs new file mode 100644 index 0000000..9d1d1ea --- /dev/null +++ b/src/BarCode.Web.Core/Dto/Login/UserInfoV3Dto.cs @@ -0,0 +1,30 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; + +namespace BarCode.Web.Core.Dto.Login +{ + public class UserInfoV3Dto + { + /// + /// 鐢ㄦ埛鍦ㄥ崟鐐逛腑缁翠竴ID + /// + public int Id { get; set; } + + public string DingtalkUid { get; set; } + + public string DingtalkUnionid { get; set; } + + public string Nickname { get; set; } + public string Realname { get; set; } + + public string Mobile { get; set; } + + public int Identity { get; set; } + + public TagInfoDto Company { get; set; } + public List Orgs { get; set; } = new List(); + public List Depts { get; set; }= new List(); + public List Roles { get; set; }= new List(); + } +} diff --git a/src/BarCode.Web.Core/Dto/MaterialResponse.cs b/src/BarCode.Web.Core/Dto/MaterialResponse.cs new file mode 100644 index 0000000..e86239b --- /dev/null +++ b/src/BarCode.Web.Core/Dto/MaterialResponse.cs @@ -0,0 +1,65 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; + +namespace BarCode.Web.Core.Dto +{ + /// + /// 搴忓垪鍙蜂俊鎭 + /// + public class MaterialResponse + { + /// + /// 绠盜d + /// + public int BoxId { get; set; } = 0; + /// + /// 绠卞彿 + /// + public string BoxBillNo { get; set; } + ///// + ///// 浠撲綅Id(搴忓垪鍙蜂笉瀛樺湪搴撳瓨鐨勮瘽浠撲綅鏄0) + ///// + //public int SubStockId { get; set; } = 0; + /// + /// 浠撲綅缂栫爜(搴忓垪鍙蜂笉瀛樺湪搴撳瓨鐨勮瘽浠撲綅鏄"") + /// + public string SubStockCode { get; set; } = ""; + /// + /// 浠撳簱缂栫爜 + /// + public string StockCode { get; set; } = ""; + /// + /// 鏄惁瀛樺湪浜庣搴撳瓨涓 + /// + public bool IsBoxInventory { get; set; } = false; + /// + /// 搴忓垪鍙 + /// + public string SerialNumber { get; set; } + /// + /// 鐗╂枡鍚嶇О + /// + public string MaterialName { get; set; } + /// + /// 鐗╂枡缂栫爜 + /// + public string MaterialNumber { get; set; } + /// + /// 鐗╂枡瑙勬牸鍨嬪彿 + /// + public string Specifications { get; set; } + /// + /// 鏄惁鏄丱ps鏉$爜 + /// + public bool IsOldOps { get; set; } = false; + /// + /// 鏄惁鍐荤粨 + /// + public bool IsDelete { get; set; } = false; + /// + /// 鏄惁婵娲昏繃(鍙湁鍋氳繃 鐩樼偣 閲囪喘鍜岄潪閲囪喘涓婃灦 鍑哄簱鍥為涓婃灦 鎵嶇畻婵娲) + /// + public bool IsActivate { get; set; } = false; + } +} diff --git a/src/BarCode.Web.Core/Dto/MaterialSubStock.cs b/src/BarCode.Web.Core/Dto/MaterialSubStock.cs new file mode 100644 index 0000000..2d26018 --- /dev/null +++ b/src/BarCode.Web.Core/Dto/MaterialSubStock.cs @@ -0,0 +1,37 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; + +namespace BarCode.Web.Core.Dto +{ + /// + /// 鐗╂枡瀵瑰簲鐨勪粨浣嶆湁鍝簺 + /// + public class MaterialSubStock + { + /// + /// 鐗╂枡缂栫爜 + /// + public string MaterialNumber { get; set; } + + /// + /// 浠撲綅缂栫爜 + /// + public string SubStockCode { get; set; } + + /// + /// 浠撲綅鍚嶇О + /// + public string SubStock { get; set; } + + /// + /// 缁勭粐 + /// + public string OrgCode { get; set; } + + /// + /// 浠撳簱 + /// + public string StockCode { get; set; } + } +} diff --git a/src/BarCode.Web.Core/Dto/OperateRequest.cs b/src/BarCode.Web.Core/Dto/OperateRequest.cs new file mode 100644 index 0000000..0072d13 --- /dev/null +++ b/src/BarCode.Web.Core/Dto/OperateRequest.cs @@ -0,0 +1,29 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; + +namespace BarCode.Web.Core.Dto +{ + /// + /// 鎿嶄綔 Id闆嗗悎 + /// + public class OperateRequest + { + public List Ids { get; set; } = new List(); + } + + /// + /// 鎿嶄綔 Id闆嗗悎 + /// + public class OperatePagedRequest : PaginationBaseRequestDto + { + public List Ids { get; set; } = new List(); + } + /// + /// 鎿嶄綔 string闆嗗悎 + /// + public class OperateStrRequest + { + public List Ids { get; set; } = new List(); + } +} diff --git a/src/BarCode.Web.Core/Dto/PaginationRequestDto.cs b/src/BarCode.Web.Core/Dto/PaginationRequestDto.cs new file mode 100644 index 0000000..1fc5cd4 --- /dev/null +++ b/src/BarCode.Web.Core/Dto/PaginationRequestDto.cs @@ -0,0 +1,28 @@ +锘縰sing System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.Text; + +namespace BarCode.Web.Core.Dto +{ + public class PaginationRequestDto: PaginationBaseRequestDto + { + /// + /// 缁勭粐Id(鎵鏈夊垪琛ㄩ〉閮介渶瑕 鍏ㄥ眬) + /// + [Required(ErrorMessage = "缁勭粐涓嶈兘涓虹┖")] + public virtual int OrgId { get; set; } + } + + public class PaginationBaseRequestDto + { + /// + /// 椤垫暟 涓嶄紶榛樿涓1 + /// + public int PageNo { get; set; } = 1; + /// + /// 姣忛〉鏉℃暟 涓嶄紶榛樿姣忛〉10 鏉 + /// + public int PageSize { get; set; } = 10; + } +} diff --git a/src/BarCode.Web.Core/Dto/SecurityNumbers/GenerateSecurityNumberRequest.cs b/src/BarCode.Web.Core/Dto/SecurityNumbers/GenerateSecurityNumberRequest.cs new file mode 100644 index 0000000..4199cfd --- /dev/null +++ b/src/BarCode.Web.Core/Dto/SecurityNumbers/GenerateSecurityNumberRequest.cs @@ -0,0 +1,30 @@ +锘縰sing System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BarCode.Web.Core.Dto.SecurityNumbers +{ + /// + /// 鐢熸垚闃蹭吉鐮 + /// + public class GenerateSecurityNumberRequest + { + /// + /// 缁勭粐Code + /// + [Required(ErrorMessage = "缁勭粐涓嶈兘涓虹┖")] + public string OrgCode { get; set; } = string.Empty; + /// + /// 鐗╂枡缂栫爜 + /// + public string MaterialNumber { get; set; } = ""; + /// + /// 鏁伴噺 + /// + [Required(ErrorMessage = "鏁伴噺涓嶈兘涓虹┖")] + public int Number { get; set; } + } +} diff --git a/src/BarCode.Web.Core/Dto/SecurityNumbers/OperateSecurityNumberRequest.cs b/src/BarCode.Web.Core/Dto/SecurityNumbers/OperateSecurityNumberRequest.cs new file mode 100644 index 0000000..7fbe8bc --- /dev/null +++ b/src/BarCode.Web.Core/Dto/SecurityNumbers/OperateSecurityNumberRequest.cs @@ -0,0 +1,27 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BarCode.Web.Core.Dto.SecurityNumbers +{ + /// + /// 闃蹭吉鐮佷笅杞 + /// + public class OperateSecurityNumberRequest + { + /// + /// 鐢熸垚璁板綍Id + /// + public List GenerateRecordIds { get; set; } = new List(); + /// + /// 鏄惁鍏ㄩ儴鎿嶄綔 + /// + public bool IsAll { get; set; } = false; + /// + /// 濡傛灉鏄儴鍒嗘搷浣(闃蹭吉鐮) 鍏ㄩ儴鎿嶄綔鐨勮瘽鍙笉浼 + /// + public List SecurityNumbers { get; set; } = new List(); + } +} diff --git a/src/BarCode.Web.Core/Dto/SecurityNumbers/SecurityGenerateRecordInfoResponse.cs b/src/BarCode.Web.Core/Dto/SecurityNumbers/SecurityGenerateRecordInfoResponse.cs new file mode 100644 index 0000000..c5d4b84 --- /dev/null +++ b/src/BarCode.Web.Core/Dto/SecurityNumbers/SecurityGenerateRecordInfoResponse.cs @@ -0,0 +1,63 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BarCode.Web.Core.Dto.SecurityNumbers +{ + /// + /// 闃蹭吉鐮佺敓鎴愬垪琛ㄨ褰 + /// + public class SecurityGenerateRecordInfoResponse + { + /// + /// 涓婚敭 璁㈠崟缂栧彿 + /// + public int Id { get; set; } + /// + /// 闃蹭吉鐮佹壒娆 + /// + public string LotNumber { get; set; } = string.Empty; + /// + /// 鐗╂枡瑙勬牸鍨嬪彿 + /// + public string Specifications { get; set; } = string.Empty; + /// + /// 鐗╂枡缂栫爜 + /// + public string MaterialNumber { get; set; } = string.Empty; + /// + /// 鐗╂枡鍚嶇О + /// + public string MaterialName { get; set; } = string.Empty; + /// + /// 鐗╂枡鏉$爜 + /// + public string BarCode { get; set; } = string.Empty; + /// + /// 鐢熸垚瀹屾垚 1 鐢熸垚涓 0 + /// + public string GenerateComplete { get; set; } = string.Empty; + /// + /// 鐢熸垚鏉$爜鏁伴噺 + /// + public int Number { get; set; } = 0; + /// + /// 涓嬭浇鏁 + /// + public int DownLoadNumber { get; set; } = 0; + /// + /// 鍒涘缓浜 + /// + public string Creator { get; set; } = string.Empty; + /// + /// 鐢熸垚鏃堕棿 + /// + public string CreateTime { get; set; } = string.Empty; + /// + /// 鐢熸垚瀹屾垚鏃堕棿 + /// + public string GenerateCompleteTime { get; set; } = string.Empty; + } +} diff --git a/src/BarCode.Web.Core/Dto/SecurityNumbers/SecurityGenerateRecordQueryRequest.cs b/src/BarCode.Web.Core/Dto/SecurityNumbers/SecurityGenerateRecordQueryRequest.cs new file mode 100644 index 0000000..5ac187e --- /dev/null +++ b/src/BarCode.Web.Core/Dto/SecurityNumbers/SecurityGenerateRecordQueryRequest.cs @@ -0,0 +1,45 @@ +锘縰sing System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BarCode.Web.Core.Dto.SecurityNumbers +{ + /// + /// 闃蹭吉鐮佺敓鎴愬垪琛 + /// + public class SecurityGenerateRecordQueryRequest : PaginationBaseRequestDto + { + /// + /// 缁勭粐Code + /// + [Required(ErrorMessage = "缁勭粐涓嶈兘涓虹┖")] + public string OrgCode { get; set; } = ""; + /// + /// 鍒涘缓鏃堕棿 + /// + public DateTime? CreateBeginDate { get; set; } = null; + /// + /// 鍒涘缓鏃堕棿 + /// + public DateTime? CreateEndDate { get; set; } = null; + /// + /// 闃蹭吉鐮侀泦鍚 + /// + public List SecurityNumbers { get; set; } = new List(); + /// + /// 闃蹭吉鐮佹壒鍙 + /// + public List LotNumbers { get; set; } = new List(); + /// + /// 鐢熸垚瀹屾垚 true 鐢熸垚涓 false 涓嶆悳 null鎴栦笉浼 + /// + public bool? GenerateComplete { get; set; } = null; + /// + /// 鐗╂枡缂栫爜 + /// + public string MaterialNumber { get; set; } = string.Empty; + } +} diff --git a/src/BarCode.Web.Core/Dto/SecurityNumbers/SecurityNumberInfoResponse.cs b/src/BarCode.Web.Core/Dto/SecurityNumbers/SecurityNumberInfoResponse.cs new file mode 100644 index 0000000..e6ef1cd --- /dev/null +++ b/src/BarCode.Web.Core/Dto/SecurityNumbers/SecurityNumberInfoResponse.cs @@ -0,0 +1,62 @@ +锘縰sing Npoi.Mapper.Attributes; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BarCode.Web.Core.Dto.SecurityNumbers +{ + /// + /// 闃蹭吉鐮佸垪琛 + /// + public class SecurityNumberInfoResponse + { + /// + /// 娴佹按鍙 + /// + [Column("娴佹按鍙")] + public long Id { get; set; } + /// + /// 鐢熸垚璁板綍Id + /// + [Ignore] + public int GenerateRecordId { get; set; } = 0; + /// + /// 闃蹭吉鐮 + /// + [Column("闃蹭吉鐮")] + public string SecurityNumber { get; set; } = string.Empty; + /// + /// 鐗╂枡瑙勬牸鍨嬪彿 + /// + [Column("瑙勬牸鍨嬪彿")] + public string Specifications { get; set; } = string.Empty; + /// + /// 鏁伴噺 + /// + [Column("鏁伴噺")] + public int Number { get; set; } = 0; + /// + /// 鐢熸垚鏃堕棿 + /// + [Column("鐢熸垚鏃堕棿")] + public string CreateTime { get; set; } = string.Empty; + /// + /// 涓嬭浇娆℃暟 + /// + [Column("涓嬭浇娆℃暟")] + public int DownLoadNumber { get; set; } = 0; + /// + /// 鏈鏂颁笅杞芥椂闂 + /// + [Column("鏈杩戜笅杞芥椂闂")] + public string DownLoadTime { get; set; } = string.Empty; + /// + /// 鍒涘缓浜 + /// + [Ignore] + public string Creator { get; set; } = string.Empty; + + } +} diff --git a/src/BarCode.Web.Core/Dto/SecurityNumbers/SecurityNumberQueryRequest.cs b/src/BarCode.Web.Core/Dto/SecurityNumbers/SecurityNumberQueryRequest.cs new file mode 100644 index 0000000..5885ed9 --- /dev/null +++ b/src/BarCode.Web.Core/Dto/SecurityNumbers/SecurityNumberQueryRequest.cs @@ -0,0 +1,50 @@ +锘縰sing System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BarCode.Web.Core.Dto.SecurityNumbers +{ + /// + /// 闃蹭吉鐮佸垪琛 + /// + public class SecurityNumberQueryRequest : PaginationBaseRequestDto + { + /// + /// 缁勭粐Code + /// + [Required(ErrorMessage = "缁勭粐涓嶈兘涓虹┖")] + public string OrgCode { get; set; } = string.Empty; + /// + /// 鐢熸垚璁板綍Id + /// + [Required(ErrorMessage = "鐢熸垚璁板綍涓嶈兘涓虹┖")] + public int GenerateRecordId { get; set; } = 0; + /// + /// 娴佹按鍙峰尯闂-寮濮 + /// + public int? IdBegin { get; set; } = null; + /// + /// 娴佹按鍙峰尯闂-缁撴潫 + /// + public int? IdEnd { get; set; } = null; + /// + /// 鏄惁涓嬭浇 true 涓嬭浇 false 鏈笅杞 + /// + public bool? IsDownLoad { get; set; } = null; + /// + /// 涓嬭浇鏃堕棿 + /// + public DateTime? DownLoadBeginDate { get; set; } = null; + /// + /// 涓嬭浇鏃堕棿 + /// + public DateTime? DownLoadEndDate { get; set; } = null; + /// + /// 闃蹭吉鐮 + /// + public List SecurityNumbers { get; set; } = new List(); + } +} diff --git a/src/BarCode.Web.Core/Dto/SecurityNumbers/SecurityNumbersExportReponse.cs b/src/BarCode.Web.Core/Dto/SecurityNumbers/SecurityNumbersExportReponse.cs new file mode 100644 index 0000000..2821fcd --- /dev/null +++ b/src/BarCode.Web.Core/Dto/SecurityNumbers/SecurityNumbersExportReponse.cs @@ -0,0 +1,41 @@ +锘縰sing Npoi.Mapper.Attributes; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BarCode.Web.Core.Dto.SecurityNumbers +{ + /// + /// 闃蹭吉鐮佸鍑 + /// + public class SecurityNumbersExportReponse + { + /// + /// 闃蹭吉鐮 + /// + [Column("闃蹭吉鐮")] + public string SecurityNumber { get; set; } = string.Empty; + /// + /// 鐗╂枡瑙勬牸鍨嬪彿 + /// + [Column("瑙勬牸鍨嬪彿")] + public string Specifications { get; set; } = string.Empty; + /// + /// 鏁伴噺 + /// + [Column("鏁伴噺")] + public int Number { get; set; } = 0; + /// + /// 涓嬭浇娆℃暟 + /// + [Column("涓嬭浇娆℃暟")] + public int DownLoadNumber { get; set; } = 0; + /// + /// 鏈鏂颁笅杞芥椂闂 + /// + [Column("鏈杩戜笅杞芥椂闂")] + public string DownLoadTime { get; set; } = string.Empty; + } +} diff --git a/src/BarCode.Web.Core/Dto/SecurityNumbers/SecurityNumbersExportRequest.cs b/src/BarCode.Web.Core/Dto/SecurityNumbers/SecurityNumbersExportRequest.cs new file mode 100644 index 0000000..968f8cb --- /dev/null +++ b/src/BarCode.Web.Core/Dto/SecurityNumbers/SecurityNumbersExportRequest.cs @@ -0,0 +1,16 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BarCode.Web.Core.Dto.SecurityNumbers +{ + public class SecurityNumbersExportRequest : PaginationBaseRequestDto + { + /// + /// 鐢熸垚璁板綍Ids + /// + public List Ids { get; set; } = new List(); + } +} diff --git a/src/BarCode.Web.Core/Dto/SecurityNumbers/SecurityResponse.cs b/src/BarCode.Web.Core/Dto/SecurityNumbers/SecurityResponse.cs new file mode 100644 index 0000000..a65ef54 --- /dev/null +++ b/src/BarCode.Web.Core/Dto/SecurityNumbers/SecurityResponse.cs @@ -0,0 +1,31 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BarCode.Web.Core.Dto.SecurityNumbers +{ + /// + /// 闃蹭吉鐮佷俊鎭 + /// + public class SecurityResponse + { + /// + /// 闃蹭吉鐮 + /// + public string Security { get; set; } = ""; + /// + /// 鏄惁绗竴娆℃煡璇 true 绗竴娆 false 涓嶆槸绗竴娆 + /// + public bool IsOneQuery { get; set; } = false; + /// + /// 鏌ヨ娆℃暟 + /// + public int QueryCount { get; set; } = 0; + /// + /// 绗竴娆℃煡璇㈡椂闂 + /// + public string QueryTime { get; set; } = ""; + } +} diff --git a/src/BarCode.Web.Core/Dto/SendDataDto.cs b/src/BarCode.Web.Core/Dto/SendDataDto.cs new file mode 100644 index 0000000..889adb2 --- /dev/null +++ b/src/BarCode.Web.Core/Dto/SendDataDto.cs @@ -0,0 +1,98 @@ +锘 +using System; +using System.Collections.Generic; +using System.Text; + +namespace BarCode.Web.Core.Dto +{ + public class SendDataDto + { + /// + /// 瀹㈡埛缂栫爜 + /// + public string CustomerCode { get; set; } + + /// + /// 瀹㈡埛鍚嶇О + /// + public string CustomerName { get; set; } + + /// + /// 鎵嬫満鍙风爜 + /// + public string PhoneNumbers { get; set; } + + /// + /// 閭 + /// + public string Emails { get; set; } + + /// + /// 閭 + /// + public List EmailList { get; set; } = new List(); + + /// + /// 鏄庣粏 + /// + public List Details { get; set; } = new List(); + + } + + /// + /// 閭 + /// + public class MailAddress + { + public MailAddress(string name,string email) + { + this.Name = name; + this.Email = email; + } + + /// + /// 鍚嶇О + /// + public string Name { get; set; } + + /// + /// 鍦板潃 + /// + public string Email { get; set; } + } + + /// + /// 鏄庣粏 + /// + public class SendDataDetailsDto + { + + ///// + ///// 浠诲姟鏄庣粏ID + ///// + //public int TaskDetailId { get; set; } + + /// + /// 鍏ュ簱鏄庣粏ID + /// + public int InStockDetailId { get; set; } + + /// + /// 鐗╂枡鍚嶇О + /// + public string MaterialName { get; set; } + /// + /// 鐗╂枡缂栫爜 + /// + public string MaterialNumber { get; set; } + /// + /// 鐗╂枡瑙勬牸鍨嬪彿 + /// + public string Specifications { get; set; } + + /// + /// 鏁伴噺 + /// + public decimal Qty { get; set; } + } +} diff --git a/src/BarCode.Web.Core/Dto/SerialNumbers/GenerateSerialNumberRequest.cs b/src/BarCode.Web.Core/Dto/SerialNumbers/GenerateSerialNumberRequest.cs new file mode 100644 index 0000000..f8c03a4 --- /dev/null +++ b/src/BarCode.Web.Core/Dto/SerialNumbers/GenerateSerialNumberRequest.cs @@ -0,0 +1,59 @@ +锘縰sing System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BarCode.Web.Core.Dto.SerialNumbers +{ + /// + /// 鐢熸垚搴忓垪鍙疯姹傚弬鏁 + /// + public class GenerateSerialNumberRequest + { + /// + /// 缁勭粐Code + /// + [Required(ErrorMessage = "缁勭粐涓嶈兘涓虹┖")] + public string OrgCode { get; set; } = ""; + /// + /// 鏄庣粏鏁版嵁 + /// + public List Details { get; set; } = new List(); + } + /// + /// 鐢熸垚搴忓垪鍙疯姹傚弬鏁拌鎯 + /// + public class GenerateSerialNumberInfoRequest + { + /// + /// 鐗╂枡Id杞32杩涘埗 + /// + public string IdConvertBar { get; set; } = ""; + /// + /// 鐗╂枡缂栫爜 + /// + public string MaterialNumber { get; set; } = ""; + /// + /// 瑙勬牸鍨嬪彿 + /// + [Required(ErrorMessage = "鐗╂枡涓嶈兘涓虹┖")] + public string Specifications { get; set; } = ""; + /// + /// 鏁伴噺 + /// + [Required(ErrorMessage = "鏁伴噺涓嶈兘涓虹┖")] + public int Number { get; set; } + /// + /// 閲囪喘鍗曞彿 + /// + [Required(ErrorMessage = "閲囪喘璁㈠崟鍙蜂笉鑳戒负绌")] + public string PurchaseBillNo { get; set; } = ""; + + /// + /// 鏄惁濂楄 + /// + public int isTwo { get; set; } = 1; + } +} diff --git a/src/BarCode.Web.Core/Dto/SerialNumbers/OperateSerialNumberRequest.cs b/src/BarCode.Web.Core/Dto/SerialNumbers/OperateSerialNumberRequest.cs new file mode 100644 index 0000000..f59c2e1 --- /dev/null +++ b/src/BarCode.Web.Core/Dto/SerialNumbers/OperateSerialNumberRequest.cs @@ -0,0 +1,27 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BarCode.Web.Core.Dto.SerialNumbers +{ + /// + /// 鎿嶄綔搴忓垪鍙疯姹傛帴鍙(鎵撳嵃 涓嬭浇) + /// + public class OperateSerialNumberRequest + { + /// + /// 鐢熸垚璁板綍Id + /// + public List GenerateRecordIds { get; set; } = new List(); + /// + /// 鏄惁鍏ㄩ儴鎿嶄綔 + /// + public bool IsAll { get; set; } = false; + /// + /// 濡傛灉鏄儴鍒嗘搷浣(搴忓垪鍙) 鍏ㄩ儴鎿嶄綔鐨勮瘽鍙笉浼 + /// + public List SerialNumbers { get; set; } = new List(); + } +} diff --git a/src/BarCode.Web.Core/Dto/SerialNumbers/SGenerateRecordInfoResponse.cs b/src/BarCode.Web.Core/Dto/SerialNumbers/SGenerateRecordInfoResponse.cs new file mode 100644 index 0000000..2facbb3 --- /dev/null +++ b/src/BarCode.Web.Core/Dto/SerialNumbers/SGenerateRecordInfoResponse.cs @@ -0,0 +1,84 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BarCode.Web.Core.Dto.SerialNumbers +{ + /// + /// 搴忓垪鍙风敓鎴愯褰曞垪琛ㄨ繑鍥炲弬鏁 + /// + public class SGenerateRecordInfoResponse + { + /// + /// 涓婚敭缂栧彿 + /// + public int Id { get; set; } + /// + /// 鐗╂枡瑙勬牸鍨嬪彿 + /// + public string Specifications { get; set; } = string.Empty; + /// + /// 鐗╂枡缂栫爜 + /// + public string MaterialNumber { get; set; } = string.Empty; + /// + /// 鐗╂枡鍚嶇О + /// + public string MaterialName { get; set; } = string.Empty; + /// + /// 鐗╂枡鏉$爜 + /// + public string BarCode { get; set; } = string.Empty; + /// + /// 閲囪喘鍗曞彿 + /// + public string PurchaseBillNo { get; set; } = string.Empty; + /// + /// 鐢熸垚瀹屾垚 1 鐢熸垚涓 0 + /// + public string GenerateComplete { get; set; } = string.Empty; + /// + /// 鐢熸垚鏉$爜鏁伴噺 + /// + public int Number { get; set; } = 0; + /// + /// 鎵撳嵃鏁 + /// + public int PrintNumber { get; set; } = 0; + /// + /// 涓嬭浇鏁 + /// + public int DownLoadNumber { get; set; } = 0; + /// + /// 浣跨敤鏁 + /// + public int UseNumber { get; set; } = 0; + /// + /// 鍒涘缓浜 + /// + public string Creator { get; set; } = string.Empty; + /// + /// 鐢熸垚鏃堕棿 + /// + public string CreateTime { get; set; } = string.Empty; + /// + /// 鐢熸垚瀹屾垚鏃堕棿 + /// + public string GenerateCompleteTime { get; set; } = string.Empty; + /// + /// 渚涘簲鍟嗘垨缁勭粐 + /// + public string SupplierOrOrg { get; set; } = string.Empty; + /// + /// 鏄惁鏇存敼杩囩墿鏂欑紪鐮 + /// + public bool? IsUpdateMaterial { get; set; } = false; + /// + /// 鏄惁涓や欢瑁 + /// + public int? IsTwo { get; set; } = 1; + + } +} diff --git a/src/BarCode.Web.Core/Dto/SerialNumbers/SGenerateRecordQueryRequest.cs b/src/BarCode.Web.Core/Dto/SerialNumbers/SGenerateRecordQueryRequest.cs new file mode 100644 index 0000000..189d2f3 --- /dev/null +++ b/src/BarCode.Web.Core/Dto/SerialNumbers/SGenerateRecordQueryRequest.cs @@ -0,0 +1,71 @@ +锘縰sing System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BarCode.Web.Core.Dto.SerialNumbers +{ + /// + /// 搴忓垪鍙风敓鎴愯褰曞垪琛ㄨ姹傚弬鏁 + /// + public class SGenerateRecordQueryRequest : PaginationBaseRequestDto + { + /// + /// 缁勭粐Code + /// + [Required(ErrorMessage = "缁勭粐涓嶈兘涓虹┖")] + public string OrgCode { get; set; } = ""; + /// + /// 渚涘簲鍟嗘垨缁勭粐 + /// + public string SupplierOrOrg { get; set; } = ""; + /// + /// 鍒涘缓鏃堕棿 + /// + public DateTime? CreateBeginDate { get; set; } = null; + /// + /// 鍒涘缓鏃堕棿 + /// + public DateTime? CreateEndDate { get; set; } = null; + /// + /// 搴忓垪鍙烽泦鍚 + /// + public List SerialNumbers { get; set; } = new List(); + /// + /// 鐢熸垚瀹屾垚 true 鐢熸垚涓 false 涓嶆悳 null鎴栦笉浼 + /// + public bool? GenerateComplete { get; set; } = null; + /// + /// 鐗╂枡缂栫爜 + /// + public string MaterialNumber { get; set; } = ""; + /// + /// 閲囪喘鍗曞彿 + /// + public List PurchaseBillNos { get; set; } = new List(); + /// + /// 绠卞彿 + /// + public List BoxBillNos { get; set; } = new List(); + /// + /// 鏁板瓧搴忓垪鍙 + /// + public List NumberCodes { get; set; } = new List(); + /// + /// 鐢熸垚浜 + /// + public string CreateUser { get; set; } = string.Empty; + /// + /// 鏄惁鏇存敼杩囩墿鏂欑紪鐮 + /// + public bool? IsUpdateMaterial { get; set; } = null; + + /// + /// 鏄惁涓や欢瑁 + /// + public int IsTwo { get; set; } = 0; + + } +} diff --git a/src/BarCode.Web.Core/Dto/SerialNumbers/SerialNumberByBoxIdQueryRequest.cs b/src/BarCode.Web.Core/Dto/SerialNumbers/SerialNumberByBoxIdQueryRequest.cs new file mode 100644 index 0000000..6ca8980 --- /dev/null +++ b/src/BarCode.Web.Core/Dto/SerialNumbers/SerialNumberByBoxIdQueryRequest.cs @@ -0,0 +1,21 @@ +锘縰sing System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BarCode.Web.Core.Dto.SerialNumbers +{ + /// + /// 鏍规嵁绠盜d鑾峰彇搴忓垪鐮佷俊鎭 + /// + public class SerialNumberByBoxIdQueryRequest : PaginationBaseRequestDto + { + /// + /// 绠盜d + /// + [Required(ErrorMessage = "绠变笉鑳戒负绌")] + public int BoxId { get; set; } = 0; + } +} diff --git a/src/BarCode.Web.Core/Dto/SerialNumbers/SerialNumberInfoResponse.cs b/src/BarCode.Web.Core/Dto/SerialNumbers/SerialNumberInfoResponse.cs new file mode 100644 index 0000000..4a042a8 --- /dev/null +++ b/src/BarCode.Web.Core/Dto/SerialNumbers/SerialNumberInfoResponse.cs @@ -0,0 +1,121 @@ +锘縰sing Npoi.Mapper.Attributes; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BarCode.Web.Core.Dto.SerialNumbers +{ + /// + /// 搴忓垪鍙峰垪琛ㄦ悳绱㈣繑鍥炲弬鏁 + /// + public class SerialNumberInfoResponse + { + /// + /// 鐗╂枡缂栫爜 + /// + [Column("鐗╂枡缂栫爜")] + public string MaterialNumber { get; set; } = string.Empty; + /// + /// 鐗╂枡鍚嶇О + /// + [Column("鍚嶇О")] + public string MaterialName { get; set; } = string.Empty; + /// + /// 鐗╂枡瑙勬牸鍨嬪彿 + /// + [Column("瑙勬牸鍨嬪彿")] + public string Specifications { get; set; } = string.Empty; + /// + /// 杞崲鍓嶈鏍煎瀷鍙 + /// + [Column("杞崲鍓嶈鏍煎瀷鍙")] + public string Old_Specifications { get; set; } = string.Empty; + /// + /// 鐗╂枡鏉$爜 + /// + [Column("鏉$爜")] + public string BarCode { get; set; } = string.Empty; + /// + /// 搴忓垪鐮 + /// + [Column("搴忓垪鐮")] + public string SerialNumber { get; set; } = string.Empty; + /// + /// 鏁板瓧搴忓垪鐮 + /// + [Column("鏁板瓧搴忓垪鐮")] + public string NumberCode { get; set; } = string.Empty; + /// + /// 搴忓垪鐮佹祦姘村彿 + /// + [Column("搴忓彿")] + public long Id { get; set; } + /// + /// 鏁伴噺 + /// + [Column("鏁伴噺")] + public int Number { get; set; } = 0; + /// + /// 鏄惁浣跨敤 + /// + [Ignore] + public bool IsUse { get; set; } = false; + /// + /// 鏄惁浣跨敤 + /// + [Column("鏄惁浣跨敤")] + public string IsUseStr { get; set; } = ""; + /// + /// 绠卞彿 + /// + [Column("鎵鍦ㄧ鍙")] + public string Box { get; set; } = string.Empty; + /// + /// 鍒涘缓浜 + /// + [Ignore] + public string Creator { get; set; } = string.Empty; + /// + /// 鐢熸垚鏃堕棿 + /// + [Column("鐢熸垚鏃堕棿")] + public string CreateTime { get; set; } = string.Empty; + /// + /// 鎵撳嵃娆℃暟 + /// + [Column("鎵撳嵃娆℃暟")] + public int PrintNumber { get; set; } = 0; + /// + /// 涓嬭浇娆℃暟 + /// + [Column("涓嬭浇娆℃暟")] + public int DownLoadNumber { get; set; } = 0; + /// + /// 鏈鏂版墦鍗版椂闂 + /// + [Column("鏈杩戞墦鍗版椂闂")] + public string PrintTime { get; set; } = string.Empty; + /// + /// 鏈鏂颁笅杞芥椂闂 + /// + [Column("鏈杩戜笅杞芥椂闂")] + public string DownLoadTime { get; set; } = string.Empty; + /// + /// 鏄惁鍏佽鎵撳嵃(搴忓垪鐮佸凡缁忚浣跨敤 浣嗘病鏈夌鍙,閭d箞灏辨槸琚玾ms绯荤粺鎷夊幓浣跨敤浜,涓嶈兘鍐嶈鎵撳嵃) + /// + [Ignore] + public bool IsEnablePrint { get; set; } = true; + + /// + /// 鏄惁涓轰袱浠惰锛屼负浜嗘帶鍒跺悗闈㈢殑鍙樺姩锛岃涓烘暣鏁板舰锛0鍜1鐪嬩綔1锛2浠h〃2浠惰锛3浠h〃涓変欢瑁 alter by yzh + /// + public int IsTwo { get; set; } = 1; + /// + /// 绗簩涓簭鍒楀彿 + /// + public string TwoSerialNumber { get; set; } = string.Empty; + + } +} diff --git a/src/BarCode.Web.Core/Dto/SerialNumbers/SerialNumberQueryRequest.cs b/src/BarCode.Web.Core/Dto/SerialNumbers/SerialNumberQueryRequest.cs new file mode 100644 index 0000000..d8aa648 --- /dev/null +++ b/src/BarCode.Web.Core/Dto/SerialNumbers/SerialNumberQueryRequest.cs @@ -0,0 +1,87 @@ +锘縰sing System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BarCode.Web.Core.Dto.SerialNumbers +{ + /// + /// 搴忓垪鍙峰垪琛ㄦ悳绱㈣姹傚弬鏁 + /// + public class SerialNumberQueryRequest : PaginationBaseRequestDto + { + /// + /// 缁勭粐Code + /// + [Required(ErrorMessage = "缁勭粐涓嶈兘涓虹┖")] + public string OrgCode { get; set; } = ""; + /// + /// 鐢熸垚璁板綍Id + /// + [Required(ErrorMessage = "鐢熸垚璁板綍涓嶈兘涓虹┖")] + public int GenerateRecordId { get; set; } = 0; + /// + /// 鎵撳嵃鐘舵 宸叉墦鍗 true 鏈墦鍗 false + /// + public bool? IsPrint { get; set; } = null; + /// + /// 浣跨敤鐘舵 宸蹭娇鐢 true 鏈娇鐢 false + /// + public bool? IsUse { get; set; } = null; + /// + /// 涓嬭浇鏃堕棿 + /// + public DateTime? DownLoadBeginDate { get; set; } = null; + /// + /// 涓嬭浇鏃堕棿 + /// + public DateTime? DownLoadEndDate { get; set; } = null; + /// + /// 鎵撳嵃鏃堕棿 + /// + public DateTime? PrintBeginDate { get; set; } = null; + /// + /// 鎵撳嵃鏃堕棿 + /// + public DateTime? PrintEndDate { get; set; } = null; + /// + /// 搴忓垪鍙 + /// + public List SerialNumbers { get; set; } = new List(); + /// + /// 搴忓彿鍖洪棿-寮濮 + /// + public long? SerialNumberBegin { get; set; } = null; + /// + /// 搴忓彿鍖洪棿-缁撴潫 + /// + public long? SerialNumberEnd { get; set; } = null; + /// + /// 鏄惁鏇存敼杩囩墿鏂欑紪鐮 + /// + public bool? IsUpdateMaterial { get; set; } = null; + /// + /// 绠卞彿 + /// + public string BoxBillNo { get; set; } = ""; + /// + /// 鏁板瓧搴忓垪鍙 + /// + public List NumberCodes { get; set; } = new List(); + /// + /// 鏁板瓧搴忓垪鐮-寮濮 + /// + public string NumberCodeBegin { get; set; } = string.Empty; + /// + /// 鏁板瓧搴忓垪鐮-缁撴潫 + /// + public string NumberCodeEnd { get; set; } = string.Empty; + /// + /// 鏄惁涓轰袱浠惰锛屼负浜嗘帶鍒跺悗闈㈢殑鍙樺姩锛岃涓烘暣鏁板舰锛0鍜1鐪嬩綔1锛2浠h〃2浠惰锛3浠h〃涓変欢瑁 alter by yzh + /// + public int isTwo { get; set; } =1; + + } +} diff --git a/src/BarCode.Web.Core/Dto/SerialNumbers/SerialNumbersExportReponse.cs b/src/BarCode.Web.Core/Dto/SerialNumbers/SerialNumbersExportReponse.cs new file mode 100644 index 0000000..bd0c1cb --- /dev/null +++ b/src/BarCode.Web.Core/Dto/SerialNumbers/SerialNumbersExportReponse.cs @@ -0,0 +1,56 @@ +锘縰sing Npoi.Mapper.Attributes; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BarCode.Web.Core.Dto.SerialNumbers +{ + /// + /// 搴忓垪鐮佸鍑烘暟鎹 + /// + public class SerialNumbersExportReponse + { + /// + /// 渚涘簲鍟嗘垨缁勭粐 + /// + [Column("渚涘簲鍟")] + public string SupplierOrOrg { get; set; } = string.Empty; + /// + /// 鐗╂枡缂栫爜 + /// + [Column("鐗╂枡缂栫爜")] + public string MaterialNumber { get; set; } = string.Empty; + /// + /// 鐗╂枡鍚嶇О + /// + [Column("鐗╂枡鍚嶇О")] + public string MaterialName { get; set; } = string.Empty; + /// + /// 鐗╂枡瑙勬牸鍨嬪彿 + /// + [Column("瑙勬牸鍨嬪彿")] + public string Specifications { get; set; } = string.Empty; + /// + /// 鐗╂枡鏉$爜 + /// + [Column("鏉$爜")] + public string BarCode { get; set; } = string.Empty; + /// + /// 搴忓垪鐮 + /// + [Column("搴忓垪鐮")] + public string SerialNumber { get; set; } = string.Empty; + /// + /// 鏁板瓧搴忓垪鐮 + /// + [Column("鏁板瓧搴忓垪鐮")] + public string NumberCode { get; set; } = string.Empty; + /// + /// 鏁伴噺 + /// + [Column("鏁伴噺")] + public int Number { get; set; } = 0; + } +} diff --git a/src/BarCode.Web.Core/Dto/SerialNumbers/SerialNumbersExportRequest.cs b/src/BarCode.Web.Core/Dto/SerialNumbers/SerialNumbersExportRequest.cs new file mode 100644 index 0000000..2a3877d --- /dev/null +++ b/src/BarCode.Web.Core/Dto/SerialNumbers/SerialNumbersExportRequest.cs @@ -0,0 +1,19 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BarCode.Web.Core.Dto.SerialNumbers +{ + /// + /// 搴忓垪鐮佸鍑哄弬鏁 + /// + public class SerialNumbersExportRequest : PaginationBaseRequestDto + { + /// + /// 鐢熸垚璁板綍Ids + /// + public List Ids { get; set; } = new List(); + } +} diff --git a/src/BarCode.Web.Core/Dto/SerialNumbers/SerialNumbersExternalResponse.cs b/src/BarCode.Web.Core/Dto/SerialNumbers/SerialNumbersExternalResponse.cs new file mode 100644 index 0000000..d02bc14 --- /dev/null +++ b/src/BarCode.Web.Core/Dto/SerialNumbers/SerialNumbersExternalResponse.cs @@ -0,0 +1,44 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BarCode.Web.Core.Dto.SerialNumbers +{ + /// + /// 搴忓垪鐮佷俊鎭 + /// + public class SerialNumbersExternalResponse + { + /// + /// 搴忓垪鍙 + /// + public string SerialNumber { get; set; } + /// + /// 鐗╂枡鍚嶇О + /// + public string MaterialName { get; set; } + /// + /// 鐗╂枡缂栫爜 + /// + public string MaterialNumber { get; set; } + /// + /// 鐗╂枡瑙勬牸鍨嬪彿 + /// + public string Specifications { get; set; } + /// + /// 鐢熸垚鏃堕棿鏃堕棿 + /// + public string CreateTime { get; set; } + /// + /// 閲囪喘鍗曞彿 + /// + public string PurchaseBillNo { get; set; } + /// + /// 渚涘簲鍟 + /// + public string Supplier { get; set; } = ""; + + } +} diff --git a/src/BarCode.Web.Core/Dto/SerialNumbers/SerialNumbersResponse.cs b/src/BarCode.Web.Core/Dto/SerialNumbers/SerialNumbersResponse.cs new file mode 100644 index 0000000..d230dab --- /dev/null +++ b/src/BarCode.Web.Core/Dto/SerialNumbers/SerialNumbersResponse.cs @@ -0,0 +1,73 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BarCode.Web.Core.Dto.SerialNumbers +{ + /// + /// 搴忓垪鍙蜂俊鎭 + /// + public class SerialNumbersResponse + { + /// + /// 鐗╂枡瑙勬牸鍨嬪彿 + /// + public string Specifications { get; set; } = string.Empty; + /// + /// 鐗╂枡缂栫爜 + /// + public string MaterialNumber { get; set; } = string.Empty; + /// + /// 鐗╂枡鍚嶇О + /// + public string MaterialName { get; set; } = string.Empty; + + /// + /// 鐗╂枡鏉$爜 + /// + public string BarCode { get; set; } = string.Empty; + /// + /// 搴忓垪鍙 + /// + public string SerialNumber { get; set; } = string.Empty; + /// + /// 鏁板瓧搴忓垪鍙 + /// + public string NumberCode { get; set; } = string.Empty; + /// + /// 绠卞彿 + /// + public int BoxId { get; set; } + /// + /// 鏄惁宸茬粡瑁呯 true 宸茬粡瑁呯 false 鏈绠 + /// + public bool IsCarton { get; set; } + /// + /// 鏄惁鏄凡缁忓瓨鍦ㄧ殑鏁版嵁 榛樿灏辨槸true + /// 鍓嶇鎿嶄綔鏂板鍔犵殑鏁版嵁灏辨槸false 鍚庣淇濆瓨鍒版暟鎹簱鎵嶄細鍙樻垚true + /// + public bool IsOldData { get; set; } = true; + /// + /// 鏄惁浣跨敤鐨勬槸鏁板瓧搴忓垪鐮佹湭浣跨敤null,鏁板瓧搴忓垪鐮乼rue,搴忓垪鐮乫alse + /// + public bool? IsUseNumber { get; set; } = null; + /// + /// 鏄惁涓轰袱浠跺浜у搧 + /// + public int IsTwo { get; set; } = 1; + + /// + /// 濂楄缂栫爜 + /// + public string SuitNumber { get; set; } = string.Empty; + + /// + /// 绗簩涓簭鍒楃爜 + /// + public string TwoSerialNumber { get; set; } = string.Empty; + + + } +} diff --git a/src/BarCode.Web.Core/Dto/SerialNumbers/SerialNumbersWmsRequest.cs b/src/BarCode.Web.Core/Dto/SerialNumbers/SerialNumbersWmsRequest.cs new file mode 100644 index 0000000..dd8258c --- /dev/null +++ b/src/BarCode.Web.Core/Dto/SerialNumbers/SerialNumbersWmsRequest.cs @@ -0,0 +1,19 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BarCode.Web.Core.Dto.SerialNumbers +{ + /// + /// 鑾峰彇娌℃湁瑁呰繃绠辩殑搴忓垪鐮 + /// + public class SerialNumbersWmsRequest + { + /// + /// 搴忓垪鍙 + /// + public string SerialNumber { get; set; } = string.Empty; + } +} diff --git a/src/BarCode.Web.Core/Dto/SerialNumbers/SerialNumbersWmsResponse.cs b/src/BarCode.Web.Core/Dto/SerialNumbers/SerialNumbersWmsResponse.cs new file mode 100644 index 0000000..069a3f6 --- /dev/null +++ b/src/BarCode.Web.Core/Dto/SerialNumbers/SerialNumbersWmsResponse.cs @@ -0,0 +1,31 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BarCode.Web.Core.Dto.SerialNumbers +{ + /// + /// wms绯荤粺璇锋眰搴忓垪鐮佽繑鍥 + /// + public class SerialNumbersWmsResponse + { + /// + /// 搴忓垪鍙 + /// + public string SerialNumber { get; set; } = string.Empty; + /// + /// 鐗╂枡缂栫爜 + /// + public string MaterialNumber { get; set; } = string.Empty; + /// + /// 鍒涘缓浜 + /// + public string Creator { get; set; } = string.Empty; + /// + /// 鐢熸垚鏃堕棿 + /// + public DateTime CreateTime { get; set; } = DateTime.Now; + } +} diff --git a/src/BarCode.Web.Core/Dto/SerialNumbers/UpdateMaterialRequest.cs b/src/BarCode.Web.Core/Dto/SerialNumbers/UpdateMaterialRequest.cs new file mode 100644 index 0000000..a26e362 --- /dev/null +++ b/src/BarCode.Web.Core/Dto/SerialNumbers/UpdateMaterialRequest.cs @@ -0,0 +1,30 @@ +锘縰sing System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BarCode.Web.Core.Dto.SerialNumbers +{ + /// + /// 淇敼搴忓垪鍙风殑鐗╂枡 + /// + public class UpdateMaterialRequest + { + /// + /// 鐢熸垚璁板綍Id + /// + [Required(ErrorMessage = "鐢熸垚璁板綍涓嶈兘涓虹┖")] + public int GenerateRecordId { get; set; } + /// + /// 鐗╂枡缂栫爜 + /// + [Required(ErrorMessage = "鐗╂枡缂栫爜涓嶈兘涓虹┖")] + public string MaterialNumber { get; set; } = string.Empty; + /// + /// 鎿嶄綔(搴忓垪鍙) + /// + public List SerialNumbers { get; set; } = new List(); + } +} diff --git a/src/BarCode.Web.Core/Dto/SingleData/CodeRequest.cs b/src/BarCode.Web.Core/Dto/SingleData/CodeRequest.cs new file mode 100644 index 0000000..9e5ee41 --- /dev/null +++ b/src/BarCode.Web.Core/Dto/SingleData/CodeRequest.cs @@ -0,0 +1,19 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; + +namespace BarCode.Web.Core.Dto.SingleData +{ + public class CodeRequest : SingleDataRequest + { + public CodeRequest() { } + + public CodeRequest(string code, int companyId) + { + this.Code = code; + this.CompanyId = companyId; + } + + public string Code { get; set; } + } +} diff --git a/src/BarCode.Web.Core/Dto/SingleData/CodesRequest.cs b/src/BarCode.Web.Core/Dto/SingleData/CodesRequest.cs new file mode 100644 index 0000000..c562c99 --- /dev/null +++ b/src/BarCode.Web.Core/Dto/SingleData/CodesRequest.cs @@ -0,0 +1,19 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; + +namespace BarCode.Web.Core.Dto.SingleData +{ + public class CodesRequest : SingleDataRequest + { + public CodesRequest() { } + + public CodesRequest(List codes, int companyId) + { + this.Codes = codes; + this.CompanyId = companyId; + } + + public List Codes { get; set; } = new List(); + } +} diff --git a/src/BarCode.Web.Core/Dto/SingleData/IdRequest.cs b/src/BarCode.Web.Core/Dto/SingleData/IdRequest.cs new file mode 100644 index 0000000..a33f451 --- /dev/null +++ b/src/BarCode.Web.Core/Dto/SingleData/IdRequest.cs @@ -0,0 +1,25 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; + +namespace BarCode.Web.Core.Dto.SingleData +{ + /// + /// ID璇锋眰瀵硅薄 + /// + public class IdRequest:SingleDataRequest + { + public IdRequest() { } + + public IdRequest(int id, int companyId) + { + this.Id = id; + this.CompanyId = companyId; + } + + /// + /// ID + /// + public int Id { get; set; } + } +} diff --git a/src/BarCode.Web.Core/Dto/SingleData/IdsRequest.cs b/src/BarCode.Web.Core/Dto/SingleData/IdsRequest.cs new file mode 100644 index 0000000..8b04534 --- /dev/null +++ b/src/BarCode.Web.Core/Dto/SingleData/IdsRequest.cs @@ -0,0 +1,22 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; + +namespace BarCode.Web.Core.Dto.SingleData +{ + public class IdsRequest : SingleDataRequest + { + public IdsRequest() { } + + public IdsRequest(List ids,int companyId) + { + this.Ids = ids; + this.CompanyId = companyId; + } + + /// + /// Id闆嗗悎 + /// + public List Ids { get; set; } = new List(); + } +} diff --git a/src/BarCode.Web.Core/Dto/SingleData/NameRequest.cs b/src/BarCode.Web.Core/Dto/SingleData/NameRequest.cs new file mode 100644 index 0000000..58dc856 --- /dev/null +++ b/src/BarCode.Web.Core/Dto/SingleData/NameRequest.cs @@ -0,0 +1,25 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; + +namespace BarCode.Web.Core.Dto.SingleData +{ + /// + /// 鍚嶇О璇锋眰瀵硅薄 + /// + public class NameRequest:SingleDataRequest + { + public NameRequest() { } + + public NameRequest(string name,int companyId) + { + this.Name = name; + this.CompanyId = companyId; + } + + /// + /// 鍚嶇О + /// + public string Name { get; set; } + } +} diff --git a/src/BarCode.Web.Core/Dto/SingleData/OrgAllResponse.cs b/src/BarCode.Web.Core/Dto/SingleData/OrgAllResponse.cs new file mode 100644 index 0000000..ae32fa9 --- /dev/null +++ b/src/BarCode.Web.Core/Dto/SingleData/OrgAllResponse.cs @@ -0,0 +1,51 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; + +namespace BarCode.Web.Core.Dto.SingleData +{ + public class OrgAllResponse + { + /// + /// + /// + public int Id { get; set; } + + /// + /// 缂栫爜 + /// + public string OrgCode { get; set; } = string.Empty; + /// + /// erp瀵瑰簲Code + /// + public string ErpOrgCode { get; set; } = string.Empty; + /// + /// 鍚嶇О + /// + public string Name { get; set; } = string.Empty; + /// + /// 缁勭粐绫诲瀷锛1涓轰富涓氬姟锛2涓鸿緟涓氬姟 3涓哄伐鍘 + /// + public string OrgType { get; set; } = string.Empty; + + /// + /// 鏈綅甯佸悕绉 + /// + public string StandardCoin { get; set; } = string.Empty; + + /// + /// 鏈綅甯乮d + /// + public int? StandardCoinId { get; set; } + + /// + /// 鑷姩鎺掍骇榛樿鍏ュ簱浠撳簱 + /// + public int? AutoDetaultStockId { get; set; } + + /// + /// 鏄惁绂佺敤锛歵rue涓虹鐢紝false涓哄惎鐢 + /// + public bool Disable { get; set; } + } +} diff --git a/src/BarCode.Web.Core/Dto/SingleData/SingleDataRequest.cs b/src/BarCode.Web.Core/Dto/SingleData/SingleDataRequest.cs new file mode 100644 index 0000000..f56f289 --- /dev/null +++ b/src/BarCode.Web.Core/Dto/SingleData/SingleDataRequest.cs @@ -0,0 +1,24 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; + +namespace BarCode.Web.Core.Dto.SingleData +{ + /// + /// 鍗曠偣鏁版嵁-璇锋眰缁熶竴瀵硅薄 + /// + public class SingleDataRequest + { + public SingleDataRequest() { } + + public SingleDataRequest(int companyId) + { + this.CompanyId = companyId; + } + + /// + /// 鍏徃ID + /// + public int CompanyId { get; set; } + } +} diff --git a/src/BarCode.Web.Core/Dto/SingleData/SingleDataResponse.cs b/src/BarCode.Web.Core/Dto/SingleData/SingleDataResponse.cs new file mode 100644 index 0000000..7d7d5f3 --- /dev/null +++ b/src/BarCode.Web.Core/Dto/SingleData/SingleDataResponse.cs @@ -0,0 +1,40 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; + +namespace BarCode.Web.Core.Dto.SingleData +{ + /// + /// 鍗曠偣鏁版嵁鍝嶅簲-缁熶竴瀵硅薄 + /// + public class SingleDataResponse + { + /// + /// ID + /// + public int Id { get; set; } + + /// + /// 缂栫爜 + /// + public string Code { get; set; } + + /// + /// 鍚嶇О + /// + public string Name { get; set; } + /// + /// 缁勭粐缂栫爜瀵瑰簲閲戣澏 + /// + public string ErpOrgCode { get; set; } = ""; + /// + /// 鏁板 + /// + public decimal Number { get; set; } + + /// + /// 鏄惁绂佺敤锛歵rue涓虹鐢紝false涓哄惎鐢 + /// + public bool Disable { get; set; } + } +} diff --git a/src/BarCode.Web.Core/Dto/SingleData/SubStockRequest.cs b/src/BarCode.Web.Core/Dto/SingleData/SubStockRequest.cs new file mode 100644 index 0000000..c743fd0 --- /dev/null +++ b/src/BarCode.Web.Core/Dto/SingleData/SubStockRequest.cs @@ -0,0 +1,24 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; + +namespace BarCode.Web.Core.Dto.SingleData +{ + /// + /// 浠撲綅 + /// + public class SubStockRequest + { + + public SubStockRequest() { } + public SubStockRequest(int stockId) + { + this.StockId = stockId; + } + + /// + /// 浠撳簱ID + /// + public int StockId { get; set; } + } +} diff --git a/src/BarCode.Web.Core/Dto/SingleData/SupplierInfoResponse.cs b/src/BarCode.Web.Core/Dto/SingleData/SupplierInfoResponse.cs new file mode 100644 index 0000000..4036b8b --- /dev/null +++ b/src/BarCode.Web.Core/Dto/SingleData/SupplierInfoResponse.cs @@ -0,0 +1,25 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; + +namespace BarCode.Web.Core.Dto.SingleData +{ + /// + /// 渚涘簲鍟嗕俊鎭 + /// + public class SupplierInfoResponse + { + /// + /// 渚涘簲鍟咺d + /// + public int Id { get; set; } + /// + /// 渚涘簲鍟嗙紪鐮 + /// + public string Code { get; set; } = string.Empty; + /// + /// 渚涘簲鍟嗗悕瀛 + /// + public string Name { get; set; } = string.Empty; + } +} diff --git a/src/BarCode.Web.Core/Dto/SingleData/SysOrgResponse.cs b/src/BarCode.Web.Core/Dto/SingleData/SysOrgResponse.cs new file mode 100644 index 0000000..5f6edf8 --- /dev/null +++ b/src/BarCode.Web.Core/Dto/SingleData/SysOrgResponse.cs @@ -0,0 +1,54 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; + +namespace BarCode.Web.Core.Dto.SingleData +{ + /// + /// 缁勭粐杩斿洖瀵硅薄 + /// + public class SysOrgResponse + { + /// + /// + /// + public int Id { get; set; } + + /// + /// 缂栫爜 + /// + public string OrgCode { get; set; } + /// + /// 鍚嶇О + /// + public string Name { get; set; } + /// + /// 缁勭粐绫诲瀷锛1涓轰富涓氬姟锛2涓鸿緟涓氬姟 3涓哄伐鍘 + /// + public string OrgType { get; set; } + + /// + /// 鏈綅甯佸悕绉 + /// + public string StandardCoin { get; set; } + + /// + /// 鏈綅甯乮d + /// + public int? StandardCoinId { get; set; } + + /// + /// 鑷姩鎺掍骇榛樿鍏ュ簱浠撳簱 + /// + public int? AutoDetaultStockId { get; set; } + + /// + /// 鏄惁绂佺敤锛歵rue涓虹鐢紝false涓哄惎鐢 + /// + public bool Disable { get; set; } + /// + /// erp瀵瑰簲Code + /// + public string ErpOrgCode { get; set; } + } +} diff --git a/src/BarCode.Web.Core/Dto/SingleData/SysStaffResponse.cs b/src/BarCode.Web.Core/Dto/SingleData/SysStaffResponse.cs new file mode 100644 index 0000000..20b9367 --- /dev/null +++ b/src/BarCode.Web.Core/Dto/SingleData/SysStaffResponse.cs @@ -0,0 +1,37 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; + +namespace BarCode.Web.Core.Dto.SingleData +{ + /// + /// 鍛樺伐鍝嶅簲 + /// + public class SysStaffResponse + { + /// + /// StaffID + /// + public int Id { get; set; } + + /// + /// 鍚嶇О + /// + public string Name { get; set; } + + /// + /// 閮ㄩ棬ID + /// + public int DeptId { get; set; } + + /// + /// 鐢佃瘽 + /// + public string Telephone { get; set; } + + /// + /// 鏄惁绂佺敤锛歵rue涓虹鐢紝false涓哄惎鐢 + /// + public bool Disable { get; set; } + } +} diff --git a/src/BarCode.Web.Core/Dto/SingleData/SystemCodeRequest.cs b/src/BarCode.Web.Core/Dto/SingleData/SystemCodeRequest.cs new file mode 100644 index 0000000..2bc4d53 --- /dev/null +++ b/src/BarCode.Web.Core/Dto/SingleData/SystemCodeRequest.cs @@ -0,0 +1,32 @@ +锘縰sing System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.Text; + +namespace BarCode.Web.Core.Dto.SingleData +{ + /// + /// 绯荤粺code鑾峰彇 + /// + public class SystemCodeRequest : SingleDataRequest + { + public SystemCodeRequest() { } + + public SystemCodeRequest(string systemCode,string name, int companyId) + { + this.Code = systemCode; + this.Name = name; + this.CompanyId = companyId; + } + /// + /// 绯荤粺code + /// + [Required(ErrorMessage = "绯荤粺code涓嶈兘鏈┖")] + public string Code { get; set; } + + /// + /// 浠撳簱鍚嶇О + /// + public string Name { get; set; } + } +} diff --git a/src/BarCode.Web.Core/Dto/SingleData/UcStockResponse.cs b/src/BarCode.Web.Core/Dto/SingleData/UcStockResponse.cs new file mode 100644 index 0000000..f7014ae --- /dev/null +++ b/src/BarCode.Web.Core/Dto/SingleData/UcStockResponse.cs @@ -0,0 +1,38 @@ +锘縰sing System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations.Schema; +using System.Text; + +namespace BarCode.Web.Core.Dto.SingleData +{ + /// + /// 浠撳簱鍝嶅簲 + /// + public class UcStockResponse + { + /// + /// id + /// + public int Id { get; set; } + /// + /// 鍚嶇О + /// + public string Name { get; set; } + /// + /// 缂栫爜 + /// + public string Code { get; set; } + + /// + /// 瀵瑰簲閲戣澏鐨勭粍缁囩紪鐮 + /// + public string ErpOrgCode { get; set; } + + /// + /// 鏄惁绂佺敤锛歵rue涓虹鐢紝false涓哄惎鐢 + /// + public bool Disable { get; set; } + + + } +} diff --git a/src/BarCode.Web.Core/Dto/SingleData/UcSubStockResponse.cs b/src/BarCode.Web.Core/Dto/SingleData/UcSubStockResponse.cs new file mode 100644 index 0000000..8ee7e09 --- /dev/null +++ b/src/BarCode.Web.Core/Dto/SingleData/UcSubStockResponse.cs @@ -0,0 +1,48 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; + +namespace BarCode.Web.Core.Dto.SingleData +{ + /// + /// 浠撲綅鍝嶅簲瀵硅薄 + /// + public class UcSubStockResponse + { + /// + /// id + /// + public int Id { get; set; } + + /// + /// 浠撳簱ID + /// + public int StockId { get; set; } + + /// + /// 浠撳簱鍚嶇О + /// + public string StockName { get; set; } + + /// + /// 浠撳簱code + /// + public string StockCode { get; set; } + + /// + /// 瀵瑰簲鐨勯噾铦剁粍缁囩紪鐮 + /// + public string ErpOrgCode { get; set; } + + + /// + /// 鍚嶇О + /// + public string Name { get; set; } + + /// + /// 缂栫爜 + /// + public string Code { get; set; } + } +} diff --git a/src/BarCode.Web.Core/Dto/SingleData/UserRequest.cs b/src/BarCode.Web.Core/Dto/SingleData/UserRequest.cs new file mode 100644 index 0000000..83613e2 --- /dev/null +++ b/src/BarCode.Web.Core/Dto/SingleData/UserRequest.cs @@ -0,0 +1,24 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; + +namespace BarCode.Web.Core.Dto.SingleData +{ + /// + /// 浜哄憳璇锋眰瀵硅薄 + /// + public class UserRequest + { + public UserRequest() + { + } + public UserRequest(int userId) + { + this.UserId = userId; + } + /// + /// 鐢ㄦ埛ID + /// + public int UserId { get; set; } + } +} diff --git a/src/BarCode.Web.Core/Dto/SubUcStockRequset.cs b/src/BarCode.Web.Core/Dto/SubUcStockRequset.cs new file mode 100644 index 0000000..f32e2e0 --- /dev/null +++ b/src/BarCode.Web.Core/Dto/SubUcStockRequset.cs @@ -0,0 +1,27 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; + +namespace BarCode.Web.Core.Dto +{ + /// + /// 璇锋眰浠撲綅瀵硅薄 + /// + public class SubUcStockRequset + { + /// + /// 鍚嶇О + /// + public string Name { get; set; } + + /// + /// 浠撳簱 + /// + public string StockCode { get; set; } + + /// + /// 缁勭粐 + /// + public string OrgCode { get; set; } + } +} diff --git a/src/BarCode.Web.Core/Dto/TemplateExcel.cs b/src/BarCode.Web.Core/Dto/TemplateExcel.cs new file mode 100644 index 0000000..d3cc8aa --- /dev/null +++ b/src/BarCode.Web.Core/Dto/TemplateExcel.cs @@ -0,0 +1,34 @@ +锘縰sing Npoi.Mapper.Attributes; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BarCode.Web.Core.Dto +{ + /// + /// 鐢熸垚搴忓垪鍙锋ā鏉 + /// + public class TemplateExcel + { + public TemplateExcel() + { + } + /// + /// 鐗╂枡瑙勬牸鍨嬪彿 + /// + [Column("瑙勬牸鍨嬪彿*")] + public string Specifications { get; set; } = string.Empty; + /// + /// 鐗╂枡鍚嶇О + /// + [Column("鐢熸垚鏁伴噺*")] + public string Number { get; set; } + /// + /// 閲囪喘鍗曞彿 + /// + [Column("閲囪喘璁㈠崟鍙*")] + public string PurchaseBillNo { get; set; } = string.Empty; + } +} diff --git a/src/BarCode.Web.Core/EntityBase.cs b/src/BarCode.Web.Core/EntityBase.cs new file mode 100644 index 0000000..79122b0 --- /dev/null +++ b/src/BarCode.Web.Core/EntityBase.cs @@ -0,0 +1,29 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; + +namespace BarCode.Web.Core +{ + /// + /// 鍩虹被 + /// + [Serializable] + public class EntityBase + { + /// + /// Id + /// + public virtual int Id { get; set; } + } + /// + /// 鍩虹被 + /// + [Serializable] + public class EntityLongBase + { + /// + /// Id + /// + public virtual long Id { get; set; } + } +} diff --git a/src/BarCode.Web.Core/EnumOperate.cs b/src/BarCode.Web.Core/EnumOperate.cs new file mode 100644 index 0000000..53654e7 --- /dev/null +++ b/src/BarCode.Web.Core/EnumOperate.cs @@ -0,0 +1,49 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Reflection; +using System.Text; + +namespace BarCode.Web.Core +{ + public class EnumRemarkAttribute : Attribute + { + public string Remark { get; set; } + public EnumRemarkAttribute(string remark) + { + this.Remark = remark; + } + } + + + public static class EnumOperate + { + public static string GetRemark(this Enum enumInfo) + { + if (enumInfo == null) return ""; + Type type = enumInfo.GetType(); + //鑾峰彇瀛楁淇℃伅 + FieldInfo field = type.GetField(enumInfo.ToString()); + if (field == null) return ""; + //妫鏌ュ瓧娈垫槸鍚﹀惈鏈夋寚瀹氱壒鎬 + if (field.IsDefined(typeof(EnumRemarkAttribute), true)) + { + //鑾峰彇瀛楁涓婄殑鑷畾涔夌壒鎬 + EnumRemarkAttribute remarkAttribute = (EnumRemarkAttribute)field.GetCustomAttribute(typeof(EnumRemarkAttribute)); + return remarkAttribute.Remark; + } + else + { + return enumInfo.ToString(); + } + } + } + + public class PropertyRemarkAttribute : Attribute + { + public string Remark { get; set; } + public PropertyRemarkAttribute(string remark) + { + this.Remark = remark; + } + } +} diff --git a/src/BarCode.Web.Core/Exceptions/WebHttpException.cs b/src/BarCode.Web.Core/Exceptions/WebHttpException.cs new file mode 100644 index 0000000..b0e9578 --- /dev/null +++ b/src/BarCode.Web.Core/Exceptions/WebHttpException.cs @@ -0,0 +1,23 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; + +namespace BarCode.Web.Core.Exceptions +{ + public class WebHttpException : Exception + { + public string ErrorCode { get; set; } + + public string ErrorMessage { get; set; } + + public WebHttpException() + { + } + + public WebHttpException(string errorCode, string errorMessage) + { + ErrorCode = errorCode; + ErrorMessage = errorMessage; + } + } +} diff --git a/src/BarCode.Web.Core/Help/CacheHelp.cs b/src/BarCode.Web.Core/Help/CacheHelp.cs new file mode 100644 index 0000000..fdfda6e --- /dev/null +++ b/src/BarCode.Web.Core/Help/CacheHelp.cs @@ -0,0 +1,50 @@ +锘縰sing Microsoft.Extensions.Caching.Memory; +using System; +using System.Collections.Generic; +using System.Text; + +namespace BarCode.Web.Core.Help +{ + public class CacheHelp + { + + /// + /// 瀹氫箟cache + /// + private static MemoryCache cache = new MemoryCache(new MemoryCacheOptions()); + + /// + /// 璁剧疆cache + /// + /// 閿 + /// 鍊 + public static void SetCacheValue(string key, object value) + { + if (key != null) + { + cache.Set(key, value, new MemoryCacheEntryOptions + { + //SlidingExpiration = TimeSpan.FromSeconds(10) + }); + } + } + + /// + /// 鑾峰彇cache + /// + /// 閿 + /// + public static object GetCacheValue(string key) + { + object val = null; + if (key != null && cache.TryGetValue(key, out val)) + { + return val; + } + else + { + return default(object); + } + } + } +} diff --git a/src/BarCode.Web.Core/Help/ClassClone.cs b/src/BarCode.Web.Core/Help/ClassClone.cs new file mode 100644 index 0000000..7b5cc03 --- /dev/null +++ b/src/BarCode.Web.Core/Help/ClassClone.cs @@ -0,0 +1,34 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Reflection; +using System.Text; + +namespace BarCode.Web.Core.Help +{ + [Serializable] + public static class ClassClone + { + public static void CopyPropertiesToD(this object s, D d) + { + try + { + var Types = s.GetType();//鑾峰緱绫诲瀷 + var Typed = d.GetType(); + foreach (PropertyInfo sp in Types.GetProperties())//鑾峰緱绫诲瀷鐨勫睘鎬у瓧娈 + { + foreach (PropertyInfo dp in Typed.GetProperties()) + { + if (dp.Name == sp.Name)//鍒ゆ柇灞炴у悕鏄惁鐩稿悓 + { + dp.SetValue(d, sp.GetValue(s, null), null);//鑾峰緱s瀵硅薄灞炴х殑鍊煎鍒剁粰d瀵硅薄鐨勫睘鎬 + } + } + } + } + catch (Exception e) + { + throw e; + } + } + } +} diff --git a/src/BarCode.Web.Core/Help/ClassCopyUtil.cs b/src/BarCode.Web.Core/Help/ClassCopyUtil.cs new file mode 100644 index 0000000..1c76aec --- /dev/null +++ b/src/BarCode.Web.Core/Help/ClassCopyUtil.cs @@ -0,0 +1,63 @@ +锘縰sing System; +using System.Collections.Generic; +using System.IO; +using System.Linq.Expressions; +using System.Runtime.Serialization.Formatters.Binary; +using System.Text; + +namespace BarCode.Web.Core.Help +{ + [Serializable] + public static class ClassCopyUtil + { + ///// + ///// 娣卞害copy + ///// + ///// + ///// + ///// + //public static T Clone(this T t) where T : class + //{ + // if (!typeof(T).IsSerializable) + // { + // throw new ArgumentException("The class type must be serializable.", "source"); + // } + // object retval; + // using (MemoryStream ms = new MemoryStream()) + // { + // BinaryFormatter bf = new BinaryFormatter(); + // //搴忓垪鍖栨垚娴 + // bf.Serialize(ms, obj); + // ms.Seek(0, SeekOrigin.Begin); + // //鍙嶅簭鍒楀寲鎴愬璞 + // retval = bf.Deserialize(ms); + // ms.Close(); + // } + // return (T)retval; + //} + private static readonly Func cache = GetFunc(); + private static Func GetFunc() + { + ParameterExpression parameterExpression = Expression.Parameter(typeof(TIn), "p"); + List memberBindingList = new List(); + + foreach (var item in typeof(TOut).GetProperties()) + { + if (!item.CanWrite) continue; + MemberExpression property = Expression.Property(parameterExpression, typeof(TIn).GetProperty(item.Name)); + MemberBinding memberBinding = Expression.Bind(item, property); + memberBindingList.Add(memberBinding); + } + + MemberInitExpression memberInitExpression = Expression.MemberInit(Expression.New(typeof(TOut)), memberBindingList.ToArray()); + Expression> lambda = Expression.Lambda>(memberInitExpression, new ParameterExpression[] { parameterExpression }); + + return lambda.Compile(); + } + + public static TOut Trans(TIn tIn) + { + return cache(tIn); + } + } +} diff --git a/src/BarCode.Web.Core/Help/DateTimeUtil.cs b/src/BarCode.Web.Core/Help/DateTimeUtil.cs new file mode 100644 index 0000000..85e6fb1 --- /dev/null +++ b/src/BarCode.Web.Core/Help/DateTimeUtil.cs @@ -0,0 +1,239 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; + +namespace BarCode.Web.Core.Help +{ + /// + /// 鏃堕棿杞崲 + /// + public static class DateTimeUtil + { + /// + /// 鏃堕棿鎴宠鏃跺紑濮嬫椂闂 + /// + private static DateTime timeStampStartTime = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc); + + /// + /// DateTime杞崲涓10浣嶆椂闂存埑锛堝崟浣嶏細绉掞級 + /// + /// DateTime + /// 10浣嶆椂闂存埑锛堝崟浣嶏細绉掞級 + public static long DateTimeToTimeStamp(this DateTime dateTime) + { + return (long)(dateTime.ToUniversalTime() - timeStampStartTime).TotalSeconds; + } + + /// + /// DateTime杞崲涓13浣嶆椂闂存埑锛堝崟浣嶏細姣锛 + /// + /// DateTime + /// 13浣嶆椂闂存埑锛堝崟浣嶏細姣锛 + public static long DateTimeToLongTimeStamp(this DateTime dateTime) + { + return (long)(dateTime.ToUniversalTime() - timeStampStartTime).TotalMilliseconds; + } + + /// + /// 10浣嶆椂闂存埑锛堝崟浣嶏細绉掞級杞崲涓篋ateTime + /// + /// 10浣嶆椂闂存埑锛堝崟浣嶏細绉掞級 + /// DateTime + public static DateTime TimeStampToDateTime(this long timeStamp) + { + return timeStampStartTime.AddSeconds(timeStamp).ToLocalTime(); + } + + /// + /// 13浣嶆椂闂存埑锛堝崟浣嶏細姣锛夎浆鎹负DateTime + /// + /// 13浣嶆椂闂存埑锛堝崟浣嶏細姣锛 + /// DateTime + public static DateTime LongTimeStampToDateTime(this long longTimeStamp) + { + return timeStampStartTime.AddMilliseconds(longTimeStamp).ToLocalTime(); + } + + + /// + /// 杞瓧绗︿覆 + /// + /// 锛 + /// DateTime + public static string DateToStringDay(this DateTime? date) + { + if (date == null) return ""; + try + { + DateTime dt = Convert.ToDateTime(date); + return dt.ToString("yyyy-MM-dd"); + } + catch (Exception) + { + return ""; + } + } + /// + /// 杞瓧绗︿覆 + /// + /// 锛 + /// DateTime + public static string DateToStringSeconds(this DateTime? date) + { + if (date == null) return ""; + try + { + DateTime dt = Convert.ToDateTime(date); + return dt.ToString("yyyy-MM-dd HH:mm:ss"); + } + catch (Exception) + { + return ""; + } + } + /// + /// 杞瓧绗︿覆(娌℃湁绌烘牸) + /// + /// 锛 + /// DateTime + public static string DateToStringSecondsNoSpace(this DateTime? date) + { + if (date == null) return ""; + try + { + DateTime dt = Convert.ToDateTime(date); + return dt.ToString("yyyyMMddHHmmss"); + } + catch (Exception) + { + return ""; + } + } + /// + /// 杞瓧绗︿覆(娌℃湁绌烘牸) + /// + /// 锛 + /// DateTime + public static string DateToStringSecondsNoSpace(this DateTime date) + { + if (date == null) return ""; + try + { + DateTime dt = Convert.ToDateTime(date); + return dt.ToString("yyyyMMddHHmmssfff"); + } + catch (Exception) + { + return ""; + } + } + /// + /// 杞瓧绗︿覆 + /// + /// 锛 + /// DateTime + public static string DateToStringMonth(this DateTime? date) + { + if (date == null) return ""; + try + { + DateTime dt = Convert.ToDateTime(date); + return dt.ToString("MM骞磀d鏈"); + } + catch (Exception) + { + return ""; + } + } + + /// + /// 杞瓧绗︿覆 + /// + /// 锛 + /// DateTime + public static string DateToStringDay(this DateTime date) + { + if (date == null) return ""; + try + { + DateTime dt = Convert.ToDateTime(date); + return dt.ToString("yyyy-MM-dd"); + } + catch (Exception) + { + return ""; + } + } + /// + /// 杞瓧绗︿覆 + /// + /// 锛 + /// DateTime + public static string DateToStringSeconds(this DateTime date) + { + if (date == null) return ""; + try + { + DateTime dt = Convert.ToDateTime(date); + return dt.ToString("yyyy-MM-dd HH:mm:ss"); + } + catch (Exception) + { + return ""; + } + } + /// + /// 杞瓧绗︿覆 + /// + /// 锛 + /// DateTime + public static string DateToStringMonth(this DateTime date) + { + if (date == null) return ""; + try + { + DateTime dt = Convert.ToDateTime(date); + return dt.ToString("MM骞磀d鏈"); + } + catch (Exception) + { + return ""; + } + } + + /// + /// 涓や釜鏃堕棿鐨勫樊锛氬垎閽 + /// + /// + /// + /// + public static double GetTotalMinutesTimeSpan(DateTime beginTime, DateTime endTime) + { + string dateDiff = null;//鑾峰彇褰撳墠鏃堕棿 + TimeSpan ts1 = new TimeSpan(beginTime.Ticks); + TimeSpan ts2 = new TimeSpan(endTime.Ticks); + //鏃堕棿姣旇緝锛屽緱鍑哄樊鍊 + TimeSpan ts = ts1.Subtract(ts2).Duration();//缁撴灉 + dateDiff = ts.Days.ToString() + "澶" + ts.Hours.ToString() + "灏忔椂" + ts.Minutes.ToString() + "鍒嗛挓" + ts.Seconds.ToString() + "绉"; + return ts.TotalMinutes; + } + + /// + /// 褰撳墠鏃堕棿鍜屼粖鏅0鐐逛箣闂寸殑鏃堕棿鐨勫樊锛氬垎閽 + /// + /// + public static double GetTotalMinutesTimeSpan() + { + string dateDiff = null;//鑾峰彇褰撳墠鏃堕棿 + DateTime DateTime1 = DateTime.Now; + //绗簩澶╃殑0鐐00鍒00绉 + DateTime DateTime2 = DateTime.Now.AddDays(1).Date;//鎶2涓椂闂磋浆鎴怲imeSpan,鏂逛究璁$畻 + TimeSpan ts1 = new TimeSpan(DateTime1.Ticks); + TimeSpan ts2 = new TimeSpan(DateTime2.Ticks); + //鏃堕棿姣旇緝锛屽緱鍑哄樊鍊 + TimeSpan ts = ts1.Subtract(ts2).Duration();//缁撴灉 + dateDiff = ts.Days.ToString() + "澶" + ts.Hours.ToString() + "灏忔椂" + ts.Minutes.ToString() + "鍒嗛挓" + ts.Seconds.ToString() + "绉"; + return ts.TotalMinutes; + } + } +} diff --git a/src/BarCode.Web.Core/Help/HttpClientHelp.cs b/src/BarCode.Web.Core/Help/HttpClientHelp.cs new file mode 100644 index 0000000..88cc1ea --- /dev/null +++ b/src/BarCode.Web.Core/Help/HttpClientHelp.cs @@ -0,0 +1,174 @@ +锘縰sing Microsoft.Extensions.Logging; +using Microsoft.Extensions.Options; +using System; +using System.Collections.Generic; +using System.IO; +using System.Json; +using System.Net; +using System.Net.Http; +using System.Net.Http.Headers; +using System.Security.Cryptography; +using System.Text; +using System.Threading.Tasks; +using BarCode.Web.Core.Dto.Login; + +namespace BarCode.Web.Core.Help +{ + public class HttpClientHelp + { + private ILogger _logger; + + public HttpClientHelp(ILogger logger) + { + this._logger = logger; + } + + public string PostHttp(string url, LoginAuthorizeRequest reqData) + { + var str = string.Format("client_id={0}&client_secret={1}&grant_type={2}&username={3}&password={4}&scope={5}", + reqData.ClientId, reqData.ClientSecret, reqData.GrantType, reqData.UserName, reqData.Password, reqData.Scope); + ASCIIEncoding encoding = new ASCIIEncoding(); + byte[] byte1 = encoding.GetBytes(str); + HttpContent httpContent = new StringContent(str); + httpContent.Headers.Expires = DateTime.Now; + httpContent.Headers.ContentType = new MediaTypeHeaderValue("application/x-www-form-urlencoded"); + httpContent.Headers.ContentLength = byte1.Length; + httpContent.Headers.ContentType.CharSet = "utf-8"; + HttpClient httpClient = new HttpClient(); + httpClient.BaseAddress = new Uri(url); + httpClient.Timeout = new TimeSpan(0, 0, 10); + HttpResponseMessage response = httpClient.PostAsync(url, httpContent).Result; + if (response.IsSuccessStatusCode) + { + var resData = response.Content.ReadAsStringAsync().Result; + return resData; + + } + else + { + var resData = response.Content.ReadAsStringAsync().Result; + return resData; + } + + } + + public string PostHttp(string url, LoginAuthorizeCodeRequest reqData) + { + var str = string.Format("client_id={0}&client_secret={1}&grant_type={2}&code={3}&scope={4}", + reqData.ClientId, reqData.ClientSecret, reqData.GrantType, reqData.Code, reqData.Scope); + ASCIIEncoding encoding = new ASCIIEncoding(); + byte[] byte1 = encoding.GetBytes(str); + HttpContent httpContent = new StringContent(str); + httpContent.Headers.Expires = DateTime.Now; + httpContent.Headers.ContentType = new MediaTypeHeaderValue("application/x-www-form-urlencoded"); + httpContent.Headers.ContentLength = byte1.Length; + httpContent.Headers.ContentType.CharSet = "utf-8"; + HttpClient httpClient = new HttpClient(); + httpClient.BaseAddress = new Uri(url); + httpClient.Timeout = new TimeSpan(0, 0, 10); + HttpResponseMessage response = httpClient.PostAsync(url, httpContent).Result; + if (response.IsSuccessStatusCode) + { + var resData = response.Content.ReadAsStringAsync().Result; + return resData; + + } + else + { + var resData = response.Content.ReadAsStringAsync().Result; + return resData; + } + + } + + public string PostHttp(string url, LoginAuthorizeRefreshTokenRequest reqData) + { + var str = string.Format("client_id={0}&client_secret={1}&grant_type={2}&refresh_token={3}&scope={4}", + reqData.ClientId, reqData.ClientSecret, reqData.GrantType, reqData.RefreshToken, reqData.Scope); + ASCIIEncoding encoding = new ASCIIEncoding(); + byte[] byte1 = encoding.GetBytes(str); + HttpContent httpContent = new StringContent(str); + httpContent.Headers.Expires = DateTime.Now; + httpContent.Headers.ContentType = new MediaTypeHeaderValue("application/x-www-form-urlencoded"); + httpContent.Headers.ContentLength = byte1.Length; + httpContent.Headers.ContentType.CharSet = "utf-8"; + HttpClient httpClient = new HttpClient(); + httpClient.BaseAddress = new Uri(url); + httpClient.Timeout = new TimeSpan(0, 0, 10); + HttpResponseMessage response = httpClient.PostAsync(url, httpContent).Result; + if (response.IsSuccessStatusCode) + { + var resData = response.Content.ReadAsStringAsync().Result; + return resData; + + } + else + { + var resData = response.Content.ReadAsStringAsync().Result; + return resData; + } + + } + + public async Task PostHttp(string url, string accessToken, string refreshToken) + { + try + { + HttpClient client = new HttpClient(); + //璇锋眰澶存坊鍔犲叾浠栧 + client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", accessToken); + client.DefaultRequestHeaders.Add("Refresh-Authorization", "Bearer " + refreshToken); + client.DefaultRequestHeaders.Connection.Add("Keep-Alive"); + client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); + client.DefaultRequestHeaders.AcceptCharset.Add(new StringWithQualityHeaderValue("utf-8")); + HttpResponseMessage response = await client.PostAsync(url,null); + if (response.IsSuccessStatusCode) + { + var resData = response.Content.ReadAsStringAsync().Result; + return resData; + + } + else + { + var resData = response.Content.ReadAsStringAsync().Result; + return resData; + } + } + catch (Exception ex) + { + return ""; + } + } + + public string GetHttpOut(string url, LoginOutAuthorizeRequest reqData) + { + try + { + HttpClient client = new HttpClient(); + //璇锋眰澶存坊鍔犲叾浠栧 + client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", reqData.AccessToken); + client.DefaultRequestHeaders.Add("Refresh-Authorization", "Bearer " + reqData.RefreshToken); + client.DefaultRequestHeaders.Connection.Add("Keep-Alive"); + client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); + client.DefaultRequestHeaders.AcceptCharset.Add(new StringWithQualityHeaderValue ("utf-8")); + + HttpResponseMessage response = client.GetAsync(url).Result; + if (response.IsSuccessStatusCode) + { + var resData = response.Content.ReadAsStringAsync().Result; + return resData; + + } + else + { + var resData = response.Content.ReadAsStringAsync().Result; + return resData; + } + } + catch (Exception ex) + { + return ""; + } + } + } +} diff --git a/src/BarCode.Web.Core/Help/RedisClient.cs b/src/BarCode.Web.Core/Help/RedisClient.cs new file mode 100644 index 0000000..292d1df --- /dev/null +++ b/src/BarCode.Web.Core/Help/RedisClient.cs @@ -0,0 +1,119 @@ +锘縰sing Newtonsoft.Json; +using StackExchange.Redis; +using System; +using System.Collections.Generic; +using System.Text; + +namespace BarCode.Web.Core.Help +{ + public class RedisClient + { + private static readonly object Locker = new object(); + + private ConnectionMultiplexer redisMultiplexer; + + IDatabase db = null; + + private static RedisClient _redisClient = null; + public static RedisClient redisClient + { + get + { + if (_redisClient == null) + { + lock (Locker) + { + if (_redisClient == null) + { + _redisClient = new RedisClient(); + + } + } + } + return _redisClient; + } + } + + public void InitConnect(string RedisConnection) + { + try + { + redisMultiplexer = ConnectionMultiplexer.Connect(RedisConnection); + db = redisMultiplexer.GetDatabase(); + } + catch (Exception ex) + { + Console.WriteLine(ex.Message); + redisMultiplexer = null; + db = null; + } + } + + public RedisClient() + { + + } + + #region String + /// + /// 淇濆瓨鍗曚釜key value + /// + /// 淇濆瓨鐨勫 + /// 杩囨湡鏃堕棿 + public bool SetStringKey(string key, string value, TimeSpan? expiry = default(TimeSpan?)) + { + return db.StringSet(key, value, expiry); + } + + /// + /// 鑾峰彇鍗曚釜key鐨勫 + /// + public RedisValue GetStringKey(string key) + { + return db.StringGet(key); + } + + /// + /// 绉婚櫎redis + /// + /// + /// + public bool RemoveStringKey(string key) + { + return db.KeyDelete(key); + } + /// + /// 鑾峰彇涓涓猭ey鐨勫璞 + /// + public T GetStringKey(string key) + { + if (db == null) + { + return default; + } + var value = db.StringGet(key); + if (value.IsNullOrEmpty) + { + return default; + } + return JsonConvert.DeserializeObject(value); + } + + /// + /// 淇濆瓨涓涓璞 + /// + /// + public bool SetStringKey(string key, T obj, TimeSpan? expiry = default(TimeSpan?)) + { + if (db == null) + { + return false; + } + string json = JsonConvert.SerializeObject(obj); + return db.StringSet(key, json, expiry); + } + + #endregion + + } +} diff --git a/src/BarCode.Web.Core/Help/ValidatetionHelper.cs b/src/BarCode.Web.Core/Help/ValidatetionHelper.cs new file mode 100644 index 0000000..a3e530e --- /dev/null +++ b/src/BarCode.Web.Core/Help/ValidatetionHelper.cs @@ -0,0 +1,77 @@ +锘縰sing System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.Linq; +using System.Text; + +namespace BarCode.Web.Core.Help +{ + public class ValidResult + { + public List ErrorMembers { get; set; } + public bool IsVaild { get; set; } + + public string GetMessage() + { + string msg = ""; + for (int i = 0; i < ErrorMembers.Count(); i++) + { + if (i == 0) + msg = ErrorMembers[i].ErrorMessage; + else + msg += "\r\n" + ErrorMembers[i].ErrorMessage; + } + + return msg; + } + } + + public class ErrorMember + { + public string ErrorMessage { get; set; } + public string ErrorMemberName { get; set; } + } + public static class ValidatetionHelper + { + public static ValidResult IsValid(object value) + { + ValidResult result = new ValidResult(); + try + { + var validationContext = new ValidationContext(value); + var results = new List(); + var isValid = Validator.TryValidateObject(value, validationContext, results, true); + + if (!isValid) + { + result.IsVaild = false; + result.ErrorMembers = new List(); + foreach (var item in results) + { + result.ErrorMembers.Add(new ErrorMember() + { + ErrorMessage = item.ErrorMessage, + ErrorMemberName = item.MemberNames.FirstOrDefault() + }); + } + } + else + { + result.IsVaild = true; + } + } + catch (Exception ex) + { + result.IsVaild = false; + result.ErrorMembers = new List(); + result.ErrorMembers.Add(new ErrorMember() + { + ErrorMessage = ex.Message, + ErrorMemberName = "Internal error" + }); + } + + return result; + } + } +} diff --git a/src/BarCode.Web.Core/Internal/Results/Result.cs b/src/BarCode.Web.Core/Internal/Results/Result.cs new file mode 100644 index 0000000..4b8e50f --- /dev/null +++ b/src/BarCode.Web.Core/Internal/Results/Result.cs @@ -0,0 +1,184 @@ +锘縰sing Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Text; +using System.Threading.Tasks; + +namespace BarCode.Web.Core.Internal.Results +{ + /// + /// 缁撴灉瀵硅薄 + /// + public class Result + { + /// + /// 杩斿洖缁撴灉瀵硅薄 + /// + public Result() + { + } + + /// + /// 杩斿洖缁撴灉瀵硅薄 + /// + /// + /// + public Result(string message, int status) + { + Status = status; + Message = message; + } + + /// + /// 杩斿洖缁撴灉瀵硅薄 + /// + /// + public Result(ValueTuple result) + { + Status = result.Item1; + Message = result.Item2; + } + + /// + /// 鎵ц鏄惁鎴愬姛 + /// + [JsonIgnore] + public bool Success => Status == 200; + + /// + /// 鎵ц鏄惁鎴愬姛 + /// + [JsonProperty(PropertyName = "isSuccess")] + public bool IsSuccess => Status == 200; + + /// + /// 涓氬姟杩斿洖鐮 + /// + [JsonProperty(PropertyName = "status")] + public int Status { get; set; } + + /// + /// 鎵ц杩斿洖娑堟伅 + /// + [JsonProperty(PropertyName = "message")] + public string Message { get; set; } + + /// + /// 杞崲瀹炰綋 + /// + /// + protected void To(Result result) + { + Status = result.Status; + Message = result.Message; + } + + /// + /// 杞崲瀹炰綋 + /// + /// + /// + protected void To(string message, int status) + { + Status = status; + Message = message; + } + + /// + /// 杞崲瀹炰綋 + /// + /// 缁撴灉瀵硅薄 + protected void To(ValueTuple result) + { + Status = result.Item1; + Message = result.Item2; + } + + /// + /// 鍒涘缓杩斿洖淇℃伅锛堣繑鍥炲鐞嗗け璐ワ級 + /// + /// 缁撴灉娑堟伅 + /// 缁撴灉鐘舵 + /// + public static Result ReFailure(string message, int status) + { + return new Result(message, status); + } + + /// + /// 鍒涘缓杩斿洖淇℃伅锛堣繑鍥炲鐞嗗け璐ワ級 + /// + /// 缁撴灉娑堟伅 + /// + public static Result ReFailure(ValueTuple result) + { + return new Result(result.Item2, result.Item1); + } + + /// + /// 鍒涘缓杩斿洖淇℃伅锛堣繑鍥炲鐞嗗け璐ワ級 + /// + /// 缁撴灉 + /// + public static T ReFailure(Result result) where T : Result, new() + { + var r = new T(); + r.To(result); + return r; + } + + /// + /// 鍒涘缓杩斿洖淇℃伅锛堣繑鍥炲鐞嗗け璐ワ級 + /// + /// 缁撴灉娑堟伅 + /// 缁撴灉鐘舵 + /// + public static T ReFailure(string message, int status) where T : Result, new() + { + var result = new T(); + result.To(message, status); + return result; + } + + /// + /// 鍒涘缓杩斿洖淇℃伅锛堣繑鍥炲鐞嗗け璐ワ級 + /// + /// 缁撴灉娑堟伅 + /// + public static T ReFailure(ValueTuple result) where T : Result, new() + { + var ret = new T(); + ret.To(result); + return ret; + } + + /// + /// 鍒涘缓鎴愬姛鐨勮繑鍥炴秷鎭 + /// + /// + public static Result ReSuccess() + { + return new Result(BaseResultCodes.Success); + } + + /// + /// 鍒涘缓鎴愬姛鐨勮繑鍥炴秷鎭 + /// + /// + public static T ReSuccess() where T : Result, new() + { + var result = new T(); + result.To(BaseResultCodes.Success); + return result; + } + + /// + /// 杞崲涓 task + /// + /// + public Task AsTask() + { + return Task.FromResult(this); + } + } +} diff --git a/src/BarCode.Web.Core/Internal/Results/Result2.cs b/src/BarCode.Web.Core/Internal/Results/Result2.cs new file mode 100644 index 0000000..853d0e9 --- /dev/null +++ b/src/BarCode.Web.Core/Internal/Results/Result2.cs @@ -0,0 +1,102 @@ +锘縰sing Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Text; +using System.Threading.Tasks; + +namespace BarCode.Web.Core.Internal.Results +{ + /// + /// 瀹炰綋缁撴灉瀵硅薄 + /// + /// + public class Result : Result + { + /// + /// 瀹炰綋缁撴灉 + /// + public Result() + { + } + + /// + /// 瀹炰綋缁撴灉 + /// + /// + public Result(T data) : base(BaseResultCodes.Success) + { + Data = data; + } + + /// + /// 杩斿洖缁撴灉瀵硅薄 + /// + /// + /// + public Result(T data, ValueTuple result) : base(result) + { + Data = data; + } + + /// + /// 杩斿洖瀵硅薄 + /// + [JsonProperty(PropertyName = "data")] + public T Data { get; set; } + + /// + /// 鍒涘缓鎴愬姛鐨勮繑鍥炴秷鎭 + /// + /// + public static Result ReSuccess(T data) + { + return new Result(data); + } + + /// + /// 鍒涘缓杩斿洖淇℃伅锛堣繑鍥炲鐞嗗け璐ワ級 + /// + /// 缁撴灉娑堟伅 + /// 缁撴灉鐘舵 + /// + public new static Result ReFailure(string message, int status) + { + var result = new Result(); + result.To(message, status); + return result; + } + + /// + /// 鍒涘缓杩斿洖淇℃伅锛堣繑鍥炲鐞嗗け璐ワ級 + /// + /// 缁撴灉娑堟伅 + /// + public new static Result ReFailure(ValueTuple result) + { + var res = new Result(); + res.To(result); + return res; + } + + /// + /// 鍒涘缓杩斿洖淇℃伅锛堣繑鍥炲鐞嗗け璐ワ級 + /// + /// 缁撴灉 + /// + public static Result ReFailure(Result result) + { + var re = new Result(); + re.To(result); + return re; + } + + /// + /// 杞崲涓簍ask + /// + /// + public new Task> AsTask() + { + return Task.FromResult(this); + } + } +} diff --git a/src/BarCode.Web.Core/Internal/Results/ResultCodes.cs b/src/BarCode.Web.Core/Internal/Results/ResultCodes.cs new file mode 100644 index 0000000..dd3d986 --- /dev/null +++ b/src/BarCode.Web.Core/Internal/Results/ResultCodes.cs @@ -0,0 +1,62 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; + +namespace BarCode.Web.Core.Internal.Results +{ + public class BaseResultCodes + { + /// + /// 澶勭悊鎴愬姛 + /// + public static ValueTuple Success = (200, "Success"); + + /// + /// 閿欒璇锋眰 + /// + public static ValueTuple BadRequest = (400, "{0}"); + + /// + /// 鏈巿鏉 + /// + public static ValueTuple UnAuthorized = (401, "鐧诲綍淇℃伅宸茶繃鏈燂紝璇烽噸鏂扮櫥褰"); + + /// + /// 鎷掔粷璇锋眰 + /// + public static ValueTuple NotAcceptable = (403, "Not Acceptable"); + + /// + /// 鏈壘鍒版湇鍔 + /// + public static ValueTuple NotFound = (404, "Not Found"); + + /// + /// 绯荤粺閿欒 + /// + public static ValueTuple UnknowError = (500, "Internal Server Error"); + + /// + /// 璇锋眰瓒呮椂 + /// + public static ValueTuple RequestTimeout = (408, "Request Timeout"); + } + + /// + /// 杩斿洖瀵硅薄鎵╁睍 + /// + public static class BaseResultCodesExtension + { + /// + /// 鏍规嵁鏇挎崲绗﹁繘琛屾浛鎹㈡敮浠 + /// + /// 缁撴灉瀵硅薄 + /// 鏇挎崲瀛楃 + /// + public static ValueTuple ToFormat(this ValueTuple result, params string[] args) + { + result.Item2 = string.Format(result.Item2, args); + return result; + } + } +} diff --git a/src/BarCode.Web.Core/Internal/Results/ResultList.cs b/src/BarCode.Web.Core/Internal/Results/ResultList.cs new file mode 100644 index 0000000..b217678 --- /dev/null +++ b/src/BarCode.Web.Core/Internal/Results/ResultList.cs @@ -0,0 +1,102 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; +using System.Threading.Tasks; + +namespace BarCode.Web.Core.Internal.Results +{ + /// + /// 闆嗗悎缁撴灉绫 + /// + /// + public class ResultList : Result> + { + /// + /// 瀹炰綋闆嗗悎缁撴灉 + /// + public ResultList() + { + } + + /// + /// 瀹炰綋闆嗗悎缁撴灉 + /// + /// 瀹炰綋闆嗗悎 + public ResultList(IList data) : base(data) + { + } + + /// + /// 瀹炰綋闆嗗悎缁撴灉 + /// + /// 瀹炰綋闆嗗悎 + /// 缁撴灉鐘舵 + public ResultList(IList data, ValueTuple result) : base(data, result) + { + } + + /// + /// 鍒涘缓鎴愬姛鐨勮繑鍥炴秷鎭 + /// + /// + public new static ResultList ReSuccess(IList data) + { + return new ResultList(data); + } + + /// + /// 鍒涘缓鎴愬姛鐨勮繑鍥炴秷鎭 + /// + /// + public new static ResultList ReSuccess() + { + return new ResultList(new List()); + } + + /// + /// 鍒涘缓杩斿洖淇℃伅锛堣繑鍥炲鐞嗗け璐ワ級 + /// + /// 缁撴灉娑堟伅 + /// 缁撴灉鐘舵 + /// + public new static ResultList ReFailure(string message, int status) + { + var result = new ResultList(); + result.To(message, status); + return result; + } + + /// + /// 鍒涘缓杩斿洖淇℃伅锛堣繑鍥炲鐞嗗け璐ワ級 + /// + /// 缁撴灉娑堟伅 + /// + public new static ResultList ReFailure(ValueTuple result) + { + var res = new ResultList(); + res.To(result); + return res; + } + + /// + /// 鍒涘缓杩斿洖淇℃伅锛堣繑鍥炲鐞嗗け璐ワ級 + /// + /// 缁撴灉 + /// + public new static ResultList ReFailure(Result result) + { + var re = new ResultList(); + re.To(result); + return re; + } + + /// + /// 杞崲涓 task + /// + /// + public new Task> AsTask() + { + return Task.FromResult(this); + } + } +} diff --git a/src/BarCode.Web.Core/Internal/Results/ResultPagedList.cs b/src/BarCode.Web.Core/Internal/Results/ResultPagedList.cs new file mode 100644 index 0000000..3d5154b --- /dev/null +++ b/src/BarCode.Web.Core/Internal/Results/ResultPagedList.cs @@ -0,0 +1,112 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; +using System.Threading.Tasks; + +namespace BarCode.Web.Core.Internal.Results +{ + /// + /// 鍒嗛〉鍒楄〃缁撴灉瀵硅薄 + /// + public class ResultPagedList : ResultList + { + /// + /// 瀹炰綋鍒嗛〉闆嗗悎缁撴灉 + /// + public ResultPagedList() + { + } + + /// + /// 瀹炰綋鍒嗛〉闆嗗悎缁撴灉 + /// + /// 瀹炰綋闆嗗悎 + /// 鎬绘潯鏁 + public ResultPagedList(IList data, int totalCount) : base(data) + { + TotalCount = totalCount; + } + + /// + /// 瀹炰綋鍒嗛〉闆嗗悎缁撴灉 + /// + /// + /// + /// + public ResultPagedList(IList data, int totalCount, ValueTuple result) : base(data, result) + { + TotalCount = totalCount; + } + + /// + /// Total count of Items. + /// + public int TotalCount { get; set; } + + /// + /// 鍒涘缓鎴愬姛鐨勮繑鍥炴秷鎭 + /// + /// 瀹炰綋闆嗗悎 + /// 鎬绘潯鏁 + /// + public static ResultPagedList ReSuccess(IList data, int totalCount) + { + return new ResultPagedList(data, totalCount); + } + + /// + /// 鍒涘缓鎴愬姛鐨勮繑鍥炴秷鎭 + /// + /// + public new static ResultPagedList ReSuccess() + { + return new ResultPagedList(new List(), 0); + } + + /// + /// 鍒涘缓杩斿洖淇℃伅锛堣繑鍥炲鐞嗗け璐ワ級 + /// + /// 缁撴灉娑堟伅 + /// 缁撴灉鐘舵 + /// + public new static ResultPagedList ReFailure(string message, int status) + { + var result = new ResultPagedList(); + result.To(message, status); + return result; + } + + /// + /// 鍒涘缓杩斿洖淇℃伅锛堣繑鍥炲鐞嗗け璐ワ級 + /// + /// 缁撴灉娑堟伅 + /// + public new static ResultPagedList ReFailure(ValueTuple result) + { + var res = new ResultPagedList(); + res.To(result); + return res; + } + + /// + /// 鍒涘缓杩斿洖淇℃伅锛堣繑鍥炲鐞嗗け璐ワ級 + /// + /// 缁撴灉 + /// + public new static ResultPagedList ReFailure(Result result) + { + var re = new ResultPagedList(); + re.To(result); + return re; + } + + /// + /// 杞崲涓 task + /// + /// + public new Task> AsTask() + { + return Task.FromResult(this); + } + } +} diff --git a/src/BarCode.Web.Core/Internal/Security/RSA.cs b/src/BarCode.Web.Core/Internal/Security/RSA.cs new file mode 100644 index 0000000..38e33c6 --- /dev/null +++ b/src/BarCode.Web.Core/Internal/Security/RSA.cs @@ -0,0 +1,463 @@ +锘縰sing Microsoft.IdentityModel.Tokens; +using System; +using System.Collections.Generic; +using System.IO; +using System.Security.Cryptography; +using System.Text; + +namespace BarCode.Web.Core.Internal.Security +{ + public class RSA + { + #region 绛惧悕楠岃瘉浣跨敤 + //encoded OID sequence for PKCS #1 rsaEncryption szOID_RSA_RSA = "1.2.840.113549.1.1.1" + private static byte[] SeqOID = { 0x30, 0x0D, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x01, 0x05, 0x00 }; + private static byte[] Seq = new byte[15]; + /// + /// 鐢ㄤ簬绛惧悕鐨勭閽 + /// + public static RsaSecurityKey RSAPrivateKey { get; } + + /// + /// 鐢ㄤ簬楠岃瘉鐨勫叕閽 + /// + public static RsaSecurityKey RSAPublicKey { get; } + + static RSA() + { + using (var rsa = new RSACryptoServiceProvider(2048)) + { + RSAPrivateKey = new RsaSecurityKey(rsa.ExportParameters(true)); + RSAPublicKey = new RsaSecurityKey(rsa.ExportParameters(false)); + rsa.PersistKeyInCsp = false; + } + } + + /// + /// 绛惧悕 + /// + /// 绛惧悕鍐呭 + /// 绉侀挜 + /// 缂栫爜绫诲瀷 + /// 鍔犲瘑鏂瑰紡 + /// 鍔犲瘑瀵嗘枃 + public static string Sign(string content, string privateKey, Encoding encoding, HashAlgorithmName hashAlgorithm) + { + var rsa = System.Security.Cryptography.RSA.Create(); + rsa.ImportParameters(DecodePkcsPrivateKey(privateKey)); + var contentBytes = encoding.GetBytes(content); + var cipherBytes = rsa.SignData(contentBytes, hashAlgorithm, RSASignaturePadding.Pkcs1); + return Convert.ToBase64String(cipherBytes); + } + /// + /// 楠岃瘉绛惧悕 + /// + /// 楠岃瘉绛惧悕鍐呭 + /// 鍏挜 + /// 绛惧悕瀵嗘枃 + /// 缂栫爜绫诲瀷 + /// 鍔犲瘑鏂瑰紡 + /// 鍔犲瘑瀵嗘枃 + public static bool CheckSign(string content, string publicKey, string sign, Encoding encoding, HashAlgorithmName hashAlgorithm) + { + var rsa = System.Security.Cryptography.RSA.Create(); + rsa.ImportParameters(DecodePkcsPublicKey(publicKey)); + var contentBytes = encoding.GetBytes(content); + var signBytes = Convert.FromBase64String(sign); + return rsa.VerifyData(contentBytes, signBytes, hashAlgorithm, RSASignaturePadding.Pkcs1); + + } + /// + /// 瑙e瘑 + /// + /// 瀵嗘枃 + /// 绉侀挜 + /// 缂栫爜 + /// 鏄庢枃 + public static string Decrypt(string cipher, string privateKey, Encoding encoding) + { + var rsa = System.Security.Cryptography.RSA.Create(); + rsa.ImportParameters(DecodePkcsPrivateKey(privateKey)); + var cipherBytes = System.Convert.FromBase64String(cipher); + var plainTextBytes = rsa.Decrypt(cipherBytes, RSAEncryptionPadding.Pkcs1); + return encoding.GetString(plainTextBytes); + } + + + public static System.Security.Cryptography.RSA CreateRSA(string privatekey) + { + var rsa = System.Security.Cryptography.RSA.Create(); + rsa.ImportParameters(DecodePkcsPrivateKey(privatekey)); + return rsa; + } + + public static string DecryptToDo(System.Security.Cryptography.RSA rsa, string cipher, Encoding encoding) + { + var cipherBytes = System.Convert.FromBase64String(cipher); + var plainTextBytes = rsa.Decrypt(cipherBytes, RSAEncryptionPadding.Pkcs1); + return encoding.GetString(plainTextBytes); + } + + /// + /// 鍔犲瘑 + /// + /// 鏄庢枃 + /// 鍏挜 + /// 缂栫爜 + /// 瀵嗘枃 + public static string Encrypt(string plainText, string publicKey, Encoding encoding) + { + var rsa = System.Security.Cryptography.RSA.Create(); + rsa.ImportParameters(DecodePkcsPublicKey(publicKey)); + var plainTextBytes = Encoding.UTF8.GetBytes(plainText); + var cipherBytes = rsa.Encrypt(plainTextBytes, RSAEncryptionPadding.Pkcs1); + return Convert.ToBase64String(cipherBytes); + } + /// + /// 瑙e瘑鍏挜 + /// + /// + /// + /// + /// + public static RSAParameters DecodePkcsPublicKey(string publicKey) + { + if (string.IsNullOrEmpty(publicKey)) + throw new ArgumentNullException("publicKey", "This arg cann't be empty."); + + publicKey = publicKey.Replace("-----BEGIN PUBLIC KEY-----", "").Replace("-----END PUBLIC KEY-----", "").Replace("\n", "").Replace("\r", ""); + var publicKeyData = Convert.FromBase64String(publicKey); + //鐢熸垚RSA鍙傛暟 + var rsaParams = new RSAParameters(); + + // --------- Set up stream to read the asn.1 encoded SubjectPublicKeyInfo blob ----- + using (BinaryReader binr = new BinaryReader(new MemoryStream(publicKeyData))) + { + byte bt = 0; + ushort twobytes = 0; + + twobytes = binr.ReadUInt16(); + if (twobytes == 0x8130)//data read as little endian order (actual data order for Sequence is 30 81) + binr.ReadByte(); //advance 1 byte + else if (twobytes == 0x8230) + binr.ReadInt16(); //advance 2 bytes + else + throw new ArgumentException("PemToXmlPublicKey Conversion failed"); + + Seq = binr.ReadBytes(15); //read the Sequence OID + if (!CompareBytearrays(Seq, SeqOID)) //make sure Sequence for OID is correct + throw new ArgumentException("PemToXmlPublicKey Conversion failed"); + + twobytes = binr.ReadUInt16(); + if (twobytes == 0x8103) //data read as little endian order (actual data order for Bit String is 03 81) + binr.ReadByte(); //advance 1 byte + else if (twobytes == 0x8203) + binr.ReadInt16(); //advance 2 bytes + else + throw new ArgumentException("PemToXmlPublicKey Conversion failed"); + + bt = binr.ReadByte(); + if (bt != 0x00) //expect null byte next + throw new ArgumentException("PemToXmlPublicKey Conversion failed"); + + twobytes = binr.ReadUInt16(); + if (twobytes == 0x8130) //data read as little endian order (actual data order for Sequence is 30 81) + binr.ReadByte(); //advance 1 byte + else if (twobytes == 0x8230) + binr.ReadInt16(); //advance 2 bytes + else + throw new ArgumentException("PemToXmlPublicKey Conversion failed"); + + twobytes = binr.ReadUInt16(); + byte lowbyte = 0x00; + byte highbyte = 0x00; + + if (twobytes == 0x8102) //data read as little endian order (actual data order for Integer is 02 81) + lowbyte = binr.ReadByte(); // read next bytes which is bytes in modulus + else if (twobytes == 0x8202) + { + highbyte = binr.ReadByte(); //advance 2 bytes + lowbyte = binr.ReadByte(); + } + else + throw new ArgumentException("PemToXmlPublicKey Conversion failed"); + byte[] modint = { lowbyte, highbyte, 0x00, 0x00 }; //reverse byte order since asn.1 key uses big endian order + int modsize = BitConverter.ToInt32(modint, 0); + + int firstbyte = binr.PeekChar(); + if (firstbyte == 0x00) + { //if first byte (highest order) of modulus is zero, don't include it + binr.ReadByte(); //skip this null byte + modsize -= 1; //reduce modulus buffer size by 1 + } + + byte[] modulus = binr.ReadBytes(modsize); //read the modulus bytes + + if (binr.ReadByte() != 0x02) //expect an Integer for the exponent data + throw new ArgumentException("PemToXmlPublicKey Conversion failed"); + int expbytes = (int)binr.ReadByte(); // should only need one byte for actual exponent data (for all useful values) + byte[] exponent = binr.ReadBytes(expbytes); + + // ------- create RSACryptoServiceProvider instance and initialize with public key ----- + rsaParams.Modulus = modulus; + rsaParams.Exponent = exponent; + } + return rsaParams; + } + /// + /// 绉侀挜瑙e瘑 + /// + /// + /// + /// + /// + public static RSAParameters DecodePkcsPrivateKey(string privateKey) + { + + if (string.IsNullOrEmpty(privateKey)) + { + throw new ArgumentNullException("pemFileConent", "This arg cann't be empty."); + } + try + { + privateKey = privateKey.Replace("-----BEGIN RSA PRIVATE KEY-----", "").Replace("-----END RSA PRIVATE KEY-----", "").Replace("\n", "").Replace("\r", ""); + var privateKeyData = Convert.FromBase64String(privateKey); + + //瑙f瀽Pkcs璇佷功 + PKCSType type = GetPrivateKeyType(privateKeyData.Length); + if (type == PKCSType.PKCS_8_1024 || type == PKCSType.PKCS_8_2048) + { + //Pkcs#8绉橀挜闇瑕佺壒娈婂鐞 + privateKeyData = DecodePkcs8PrivateKey(privateKeyData); + } + var rsaParams = new RSAParameters(); + byte bt = 0; + ushort twobytes = 0; + //杞崲涓轰簩杩涘埗鍊 + using (var binr = new BinaryReader(new MemoryStream(privateKeyData))) + { + twobytes = binr.ReadUInt16(); + if (twobytes == 0x8130) + binr.ReadByte(); + else if (twobytes == 0x8230) + binr.ReadInt16(); + else + throw new ArgumentException("Unexpected value read )"); + + twobytes = binr.ReadUInt16(); + if (twobytes != 0x0102) + throw new ArgumentException("Unexpected version"); + + bt = binr.ReadByte(); + if (bt != 0x00) + throw new ArgumentException("Unexpected value read "); + + //杞崲XML + rsaParams.Modulus = binr.ReadBytes(GetIntegerSize(binr)); + rsaParams.Exponent = binr.ReadBytes(GetIntegerSize(binr)); + rsaParams.D = binr.ReadBytes(GetIntegerSize(binr)); + rsaParams.P = binr.ReadBytes(GetIntegerSize(binr)); + rsaParams.Q = binr.ReadBytes(GetIntegerSize(binr)); + rsaParams.DP = binr.ReadBytes(GetIntegerSize(binr)); + rsaParams.DQ = binr.ReadBytes(GetIntegerSize(binr)); + rsaParams.InverseQ = binr.ReadBytes(GetIntegerSize(binr)); + } + return rsaParams; + } + catch (Exception ex) + { + throw new ArgumentException("姝ょ閽ヨ瘉涔︽棤鏁", ex); + } + } + + /// + /// Pkcs#8 璇佷功瑙e瘑 + /// + /// + /// + private static byte[] DecodePkcs8PrivateKey(byte[] privateKeyData) + { + byte bt = 0; + ushort twobytes = 0; + MemoryStream mem = new MemoryStream(privateKeyData); + int lenstream = (int)mem.Length; + using (var binr = new BinaryReader(mem)) + { + twobytes = binr.ReadUInt16(); + if (twobytes == 0x8130) //data read as little endian order (actual data order for Sequence is 30 81) + binr.ReadByte(); //advance 1 byte + else if (twobytes == 0x8230) + binr.ReadInt16(); //advance 2 bytes + else + throw new Exception("Unexpected value read"); + + bt = binr.ReadByte(); + if (bt != 0x02) + throw new Exception("Unexpected version"); + + twobytes = binr.ReadUInt16(); + + if (twobytes != 0x0001) + throw new Exception("Unexpected value read"); + + Seq = binr.ReadBytes(15); //read the Sequence OID + if (!CompareBytearrays(Seq, SeqOID)) //make sure Sequence for OID is correct + throw new Exception("Unexpected value read"); + + bt = binr.ReadByte(); + if (bt != 0x04) //expect an Octet string + throw new Exception("Unexpected value read"); + + bt = binr.ReadByte(); //read next byte, or next 2 bytes is 0x81 or 0x82; otherwise bt is the byte count + if (bt == 0x81) + binr.ReadByte(); + else + if (bt == 0x82) + binr.ReadUInt16(); + //------ at this stage, the remaining sequence should be the RSA private key + + return binr.ReadBytes((int)(lenstream - mem.Position)); + } + } + + /// + /// 鑾峰彇Integer鐨勫ぇ灏 + /// + /// + /// + private static int GetIntegerSize(BinaryReader binr) + { + byte bt = 0; + byte lowbyte = 0x00; + byte highbyte = 0x00; + int count = 0; + bt = binr.ReadByte(); + if (bt != 0x02) + return 0; + bt = binr.ReadByte(); + + if (bt == 0x81) + count = binr.ReadByte(); + else + if (bt == 0x82) + { + highbyte = binr.ReadByte(); + lowbyte = binr.ReadByte(); + byte[] modint = { lowbyte, highbyte, 0x00, 0x00 }; + count = BitConverter.ToInt32(modint, 0); + } + else + { + count = bt; + } + + while (binr.ReadByte() == 0x00) + { + count -= 1; + } + binr.BaseStream.Seek(-1, SeekOrigin.Current); + return count; + } + private static bool CompareBytearrays(byte[] a, byte[] b) + { + if (a.Length != b.Length) + return false; + int i = 0; + foreach (byte c in a) + { + if (c != b[i]) + return false; + i++; + } + return true; + } + + /// + /// 鑾峰彇绉侀挜鐨勭被鍨 + /// + /// + /// + private static PKCSType GetPrivateKeyType(int privateKeyLength) + { + if (privateKeyLength >= 630 && privateKeyLength <= 640) + return PKCSType.PKCS_8_1024; + if (privateKeyLength >= 600 && privateKeyLength <= 610) + return PKCSType.PKCS_1_1024; + if (privateKeyLength >= 1210 && privateKeyLength <= 1220) + return PKCSType.PKCS_8_2048; + if (privateKeyLength >= 1190 && privateKeyLength <= 1199) + return PKCSType.PKCS_1_2048; + else + throw new ArgumentException("姝ょ閽ヨ瘉涔︽爣鍑嗕笉鏀寔"); + } + + #endregion + + #region 澶栭儴浣跨敤 + /// + /// php鍗曠偣鐧诲綍瑙f瀽token鏍规嵁瀵嗛挜-鍒嗘瑙f瀽 + /// + /// + /// + /// + public static string DecryptSection(string privateKey, List items) + { + string data = ""; + using (var rsa = new RSACryptoServiceProvider()) + { + var para = DecodePkcsPrivateKey(privateKey); + rsa.ImportParameters(para); + + foreach (var item in items) + { + //var aa= "lhIweHzS3fYrnhM0HmmQIJIm9jsCAOAHEZFYRF+96vsoWRxxEwkmZsjESMIy7UXGQmo1/Q3GIs96ItlJ0LbJWY0tBggS3JHQ9bnfWKIzeFY2aMi9wPqJbWujXzwlAvi0div2YUnn+fj5sGPdYPN0RAwGUbVHpuT/XOSMYfHaGJkt/FcD+ihvx7/GP+sxXbTr/4/NwhSVDd8lmzavu+RaQKOBcYZ4AXNSS1CZ9mQ3Fau+o2eJL6byBqVtAtBdD9bki1yMMNTkOdl0LyUc4T2EtZOdYAa4EenVsFV0W7SBq7yqc/WCEThMEOQfu4t/tiRg8UrySrZmWHD1AUJnzSKvMg==Sl0Fnt+sP0pCivX/F+6/TJfIN9gh9E/CfmgUWEZmWJXURSYXIIjA1T8guUwPnmSt7buMlDAWSKByk6q9Qry1kt6DFJM92uPXyRsgYO3/ZkuDVupt22Jmdk5n075gJ+wbQfr1o05Pc84t0SGo2ZwNdsaynLk/4oZzezSiQTKLUqv3XuDBHo9QGe0dlPAk/g+KzwA3RGTX+r8bJFlhjP2kSpPd6aemeAjKElKqHnXXUem4nq1mK1SvIhejrM8m2uA7oFY+yo00ZLp9ZfD8HT1tqbpdisWbkf22vbB9Y0TPITWgAIAOcv13H6oCQJ+UAHpRmcRUpWYph3LyrU6GW9b6uA=="; + + //鑰佺殑澶勭悊鏂瑰紡锛屽弽杞琤yte瀛楄妭锛堝崟鐐硅繑鍥炴暟鎹級 + //var bty = Convert.FromBase64String(item); + //byte[] DecryptByte = rsa.Decrypt(bty, false); + //Array.Reverse(DecryptByte, 0, DecryptByte.Length); + //data += Encoding.UTF8.GetString(DecryptByte,0, DecryptByte.Length); + + //鏂扮殑澶勭悊鏂瑰紡锛屽弽杞瓧绗︿覆锛堝崟鐐硅繑鍥炴暟鎹-鍋氫簡鍏跺畠缁熶竴澶勭悊锛 + var bty = Convert.FromBase64String(item); + byte[] DecryptByte = rsa.Decrypt(bty, false); + var result = Encoding.UTF8.GetString(DecryptByte, 0, DecryptByte.Length); + + var chars = result.ToCharArray(); + Array.Reverse(chars, 0, chars.Length); + string reverse = String.Empty; + foreach (var chr in chars) + { + reverse += chr; + } + data += reverse; + } + return data; + } + } + #endregion + } + + /// + /// 瀵嗛挜绫诲瀷鏋氫妇 + /// + public enum PKCSType + { + /// + /// 1024 + /// + PKCS_1_1024, + /// + /// 2048 + /// + PKCS_1_2048, + /// + /// 1023 + /// + PKCS_8_1024, + /// + /// 2048 + /// + PKCS_8_2048, + } +} diff --git a/src/BarCode.Web.Core/NumericalProcess.cs b/src/BarCode.Web.Core/NumericalProcess.cs new file mode 100644 index 0000000..8094337 --- /dev/null +++ b/src/BarCode.Web.Core/NumericalProcess.cs @@ -0,0 +1,63 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; + +namespace BarCode.Web.Core +{ + /// + /// 鏁板煎鐞 + /// + public static class NumericalProcess + { + /// + /// Decimal 鏁板肩簿搴﹁浆鎹 + /// + /// decimal鏁板 + /// 绮惧害鍊 + /// 鑸嶅叆绫诲瀷锛1涓鸿繘浣嶏紝2涓鸿垗浣嶏紝3涓哄洓鑸嶄簲鍏 + /// decimal鏁板 + public static decimal DecimalPrecision(this decimal? number, int? precision, int? RoundoffType) + { + if (RoundoffType == 1) + return Decimal.Round(number ?? 0, precision ?? 0, MidpointRounding.ToPositiveInfinity); + else if (RoundoffType == 2) + return Decimal.Round(number ?? 0, precision ?? 0, MidpointRounding.ToZero); + else if (RoundoffType == 3) + return Decimal.Round(number ?? 0, precision ?? 0, MidpointRounding.AwayFromZero); + return number ?? 0; + } + + /// + /// Decimal 鏁板肩簿搴﹁浆鎹 + /// + /// decimal鏁板 + /// 绮惧害鍊 + /// 鑸嶅叆绫诲瀷锛1涓鸿繘浣嶏紝2涓鸿垗浣嶏紝3涓哄洓鑸嶄簲鍏 + /// decimal鏁板 + public static decimal DecimalPrecision(this decimal number, int? precision, int? RoundoffType) + { + if (RoundoffType == 1) + return Decimal.Round(number, precision ?? 0, MidpointRounding.ToPositiveInfinity); + else if (RoundoffType == 2) + return Decimal.Round(number, precision ?? 0, MidpointRounding.ToZero); + else if (RoundoffType == 3) + return Decimal.Round(number, precision ?? 0, MidpointRounding.AwayFromZero); + return number; + } + + /// + /// Decimal 鍘绘帀鍚庨潰鏃犳晥鐨0 + /// + /// + /// + public static string DecimalToStringNoZero(this decimal? data) + { + return (data ?? 0).ToString("#0.##########"); + } + + public static string DecimalToStringNoZero(this decimal data) + { + return data.ToString("#0.##########"); + } + } +} diff --git a/src/BarCode.Web.Domain/BarCode.Web.Domain.csproj b/src/BarCode.Web.Domain/BarCode.Web.Domain.csproj new file mode 100644 index 0000000..f64810e --- /dev/null +++ b/src/BarCode.Web.Domain/BarCode.Web.Domain.csproj @@ -0,0 +1,28 @@ +锘 + + + net8.0 + enable + enable + True + ../BarCode.Web.Api/wwwroot/BarCode.Web.Domain.xml + true + + + + + + + + + + + + + + + + + + + diff --git a/src/BarCode.Web.Domain/Entitys/Box.cs b/src/BarCode.Web.Domain/Entitys/Box.cs new file mode 100644 index 0000000..b57d348 --- /dev/null +++ b/src/BarCode.Web.Domain/Entitys/Box.cs @@ -0,0 +1,195 @@ +锘縰sing System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations.Schema; +using System.Linq; +using System.Text; +using BarCode.Web.Core; +using BarCode.Web.Core.Help; +using BarCode.Web.Core.Internal.Results; +using BarCode.Web.Domain.Values; + +namespace BarCode.Web.Domain.Entitys +{ + /// + /// 绠变俊鎭ご + /// alter table t_barcode_box_details AUTO_INCREMENT=50000; + /// + + [Serializable] + [Table("t_barcode_box")] + public class Box : EntityBase + { + /// + /// ID + /// + [Column("Id")] + public override int Id { get; set; } + /// + /// 绠辩紪鍙 + /// + [Column("BoxBillNo")] + public string BoxBillNo { get; set; } = ""; + /// + /// 渚涘簲鍟咰ode + /// + [Column("SupplierCode")] + public string SupplierCode { get; set; } = ""; + /// + /// 缁勭粐Code + /// + [Column("OrgCode")] + public string OrgCode { get; set; } = ""; + /// + /// 鍏徃Id + /// + [Column("CompanyId")] + public int CompanyId { get; set; } = 0; + /// + /// 绠辩姸鎬 + /// + [Column("Status")] + public BoxStatus Status { get; set; } = BoxStatus.NoUse; + /// + /// 瑁呯寮濮嬫椂闂 + /// + [Column("CartonBeginTime")] + public DateTime? CartonBeginTime { get; set; } + /// + /// 瑁呯缁撴潫鏃堕棿(瀹屾垚瑁呯鏃堕棿) + /// + [Column("CartonEndTime")] + public DateTime? CartonEndTime { get; set; } + /// + /// 瑁呯鐢ㄦ埛 + /// + [Column("CartonUserId")] + public int CartonUserId { get; set; } = 0; + /// + /// 绠卞瓙鍒涘缓鐢ㄦ埛 + /// + [Column("CreatorId")] + public int CreatorId { get; set; } = 0; + /// + /// 鍒涘缓鏃堕棿 + /// + [Column("CreateTime")] + public DateTime CreateTime { get; set; } = DateTime.Now; + /// + /// 绠卞彿鎵撳嵃娆℃暟 + /// + [Column("PrintNumber")] + public int PrintNumber { get; set; } = 0; + /// + /// 鏈鏂版墦鍗版椂闂 + /// + [Column("PrintTime")] + public DateTime? PrintTime { get; set; } + /// + /// 鏄庣粏 + /// + public List Details { get; set; } = new List(); + + public void GenerateNo() + { + //鐢ㄦ埛鎵嬪姩杈撳叆浜 灏变笉鑷姩鐢熸垚浜 + if (!string.IsNullOrEmpty(this.BoxBillNo)) return; + + if (this.Id.ToString().Length >= 8) + { + this.BoxBillNo = "CTN" + this.Id.ToString(); + return; + } + + string idStr = this.Id.ToString(); + while (true) + { + idStr = "0" + idStr; + if (idStr.Length >= 8) break; + } + this.BoxBillNo = "CTN" + idStr; + } + /// + /// 鎵撳嵃 + /// + public void Print() + { + this.PrintNumber++; + this.PrintTime = DateTime.Now; + } + /// + /// 瑙g粦搴忓垪鍙 + /// + /// + /// + public Result UnSerialNumber(string serialNumber, string materialNumber) + { + var detail = this.Details.FirstOrDefault(f => f.MaterialNumber.Equals(materialNumber)); + if (detail == null) + return Result.ReFailure(ResultCodes.BoxMaterialNoDataError); + var serial = detail.SerialNumbers.FirstOrDefault(f => f.Equals(serialNumber)); + if (serial == null) + return Result.ReFailure(ResultCodes.BoxSerialNumberNoDataError); + detail.SerialNumbers.Remove(serialNumber); + detail.Qty = detail.SerialNumbers.Count(); + //濡傛灉鏁伴噺涓0浜嗗氨鍒犻櫎杩欐潯鏄庣粏 + if (detail.SerialNumbers.Count() <= 0) + this.Details.Remove(detail); + //濡傛灉娌℃湁鏄庣粏浜 灏辨妸鐘舵佹敼鎴愭湭浣跨敤 + if (this.Details.Count() <= 0) + this.Status = BoxStatus.NoUse; + + return Result.ReSuccess(); + } + + /// + /// 娓呯┖ + /// + public void Clear() + { + this.Details.Clear(); + } + /// + /// 瑁呯 + /// + public Result Carton(bool isComplete, int cartonUserId) + { + if (this.Status == BoxStatus.Complete) + return Result.ReFailure(ResultCodes.CartonCompleteError); + if (this.CartonBeginTime == null) this.CartonBeginTime = DateTime.Now; + this.CartonUserId = cartonUserId; + if (isComplete == true) + { + //瀹屾垚瑁呯 + this.Status = BoxStatus.Complete; + this.CartonEndTime = DateTime.Now; + return Result.ReSuccess(); + } + this.Status = BoxStatus.NoComplete; + return Result.ReSuccess(); + } + /// + /// 寮濮嬭绠 + /// + /// + /// + public Result BeginCarton(int cartonUserId) + { + if (this.Status == BoxStatus.Complete) + return Result.ReFailure(ResultCodes.CartonCompleteError); + if (this.CartonBeginTime == null) + this.CartonBeginTime = DateTime.Now; + if (this.CartonUserId == 0) + this.CartonUserId = cartonUserId; + this.Status = BoxStatus.NoComplete; + return Result.ReSuccess(); + } + /// + /// 閲嶇疆 + /// + public void Restart() + { + this.Status = BoxStatus.NoComplete; + this.CartonEndTime = null; + } + } +} diff --git a/src/BarCode.Web.Domain/Entitys/BoxDetails.cs b/src/BarCode.Web.Domain/Entitys/BoxDetails.cs new file mode 100644 index 0000000..fbc48cd --- /dev/null +++ b/src/BarCode.Web.Domain/Entitys/BoxDetails.cs @@ -0,0 +1,45 @@ +锘縰sing System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations.Schema; +using System.Text; +using BarCode.Web.Core; + +namespace BarCode.Web.Domain.Entitys +{ + /// + /// 鑰乷ps绠变俊鎭槑缁 + /// alter table t_barcode_box_details AUTO_INCREMENT=50000; + /// + + [Serializable] + [Table("t_barcode_box_details")] + public class BoxDetails : EntityBase + { + /// + /// ID + /// + [Column("Id")] + public override int Id { get; set; } + /// + /// 鍗曟嵁澶碔D + /// + [Column("Fid")] + public int Fid { get; set; } + /// + /// 鐗╂枡缂栫爜 + /// + [Column("MaterialNumber")] + public string MaterialNumber { get; set; } = ""; + /// + /// 鏁伴噺锛堣绠辨暟閲忥級 + /// + [Column("Qty")] + public decimal Qty { get; set; } = 0; + /// + /// 搴忓垪鍙 + /// + [Column("SerialNumbers")] + public List SerialNumbers { get; set; } = new List(); + + } +} diff --git a/src/BarCode.Web.Domain/Entitys/BoxMark.cs b/src/BarCode.Web.Domain/Entitys/BoxMark.cs new file mode 100644 index 0000000..df3a2e3 --- /dev/null +++ b/src/BarCode.Web.Domain/Entitys/BoxMark.cs @@ -0,0 +1,192 @@ +锘縰sing System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations.Schema; +using System.Text; +using BarCode.Web.Core; + +namespace BarCode.Web.Domain.Entitys +{ + /// + /// 绠卞敍琛 + /// + [Serializable] + [Table("t_barcode_box_mark")] + public class BoxMark : EntityBase + { + /// + /// ID + /// + public override int Id { get; set; } + /// + /// 渚涘簲鍟咰ode + /// + [Column("SupplierCode")] + public string SupplierCode { get; set; } = ""; + /// + /// 缁勭粐Code + /// + [Column("OrgCode")] + public string OrgCode { get; set; } = ""; + + /// + /// 璁㈠崟缂栧彿 + /// + public string OrderBillNo { get; set; } + + /// + /// 鐗╂枡缂栫爜 + /// + public string MaterialNumber { get; set; } + + /// + /// 浜у搧鏁伴噺 + /// + public decimal ProductQty { get; set; } + + /// + /// 瑁呯鏁伴噺 + /// + public decimal CratingQty { get; set; } + + /// + /// 瑁呯鍑閲 + /// + public decimal CratingNetWeightQty { get; set; } + + /// + /// 瑁呯姣涢噸 + /// + public decimal CratingGrossWeightQty { get; set; } + + /// + /// 灏剧鏁伴噺 + /// + public decimal TailboxQty { get; set; } + + /// + /// 灏剧鍑閲 + /// + public decimal TailboxNetWeightQty { get; set; } + + /// + /// 灏剧姣涢噸 + /// + public decimal TailboxGrossWeightQty { get; set; } + + /// + /// 澶囨敞 + /// + public string Remark { get; set; } + + /// + /// 鎿嶄綔浜 + /// + public int CreatorId { get; set; } + + /// + /// 鍒涘缓鏃堕棿锛堢敓鎴愭椂闂达級 + /// + public DateTime CreateTime { get; set; } + /// + /// 娴佹按鍙(寮濮) + /// + public Int64? BeginNumber { get; set; } = null; + /// + /// 娴佹按鍙(缁撴潫) + /// + public Int64? EndNumber { get; set; } = null; + + /// + /// 缂栧彿闆嗗悎 + /// + public List BillNos { get; set; } = new List(); + + /// + /// 鍒涘缓 + /// + /// + public void Create(int creatorId) + { + this.CreatorId = creatorId; + this.CreateTime = DateTime.Now; + } + + /// + /// 鐢熸垚缂栧彿 + /// + /// + /// + public void GenerateBillNo(int firstBillNo, int lastBillNo) + { + if (this.BillNos == null) + this.BillNos = new List(); + + //璁$畻瑕佽鐨勭鏁伴噺 + var boxCount_tag = this.ProductQty / this.CratingQty; + var boxCount = Convert.ToInt32(boxCount_tag); + + //鍒ゆ柇鏄惁瀛樺湪灏忔暟鐐癸紱true琛ㄦ槑鏈夊熬绠辨暟,false娌℃湁灏剧鏁 + var hasPart = Math.Floor(boxCount_tag) != boxCount_tag; + + //鏈夊皬鏁扮偣鍚戜笂鍙栨暣 + if (hasPart) + boxCount = Convert.ToInt32(Math.Ceiling(boxCount_tag)); + + for (int i = 1; i <= boxCount; i++) + { + //娣诲姞缂栧彿鐢熸垚 + var bill = new BoxMarkBillNo(); + bill.Sort = i; + if (hasPart && i == boxCount && boxCount > 1) + bill.IsTail = true; + bill.GenerateBillNo(firstBillNo, lastBillNo); + + //鐢ㄦ埛璁剧疆浜嗗簭鍒楀彿鎵嶈绠 + if (this.BeginNumber != null && this.EndNumber != null) + { + //鍙湁涓涓瀛 灏辩敤浜у搧鏁伴噺 + if (boxCount == 1) + { + //濡傛灉鏄熬绠 + if (bill.IsTail) + { + bill.BeginNumber = this.BeginNumber + Convert.ToInt64((i - 1) * ProductQty); + bill.EndNumber = this.EndNumber; + } + else + { + //涓嶆槸灏剧 + bill.BeginNumber = this.BeginNumber + Convert.ToInt64((i - 1) * ProductQty); + bill.EndNumber = Convert.ToInt64(bill.BeginNumber + ProductQty) - 1; + } + } + else + { + //濡傛灉鏄熬绠 + if (bill.IsTail) + { + bill.BeginNumber = this.BeginNumber + Convert.ToInt64((i - 1) * CratingQty); + bill.EndNumber = this.EndNumber; + } + else + { + //涓嶆槸灏剧 + bill.BeginNumber = this.BeginNumber + Convert.ToInt64((i - 1) * CratingQty); + bill.EndNumber = Convert.ToInt64(bill.BeginNumber + CratingQty) - 1; + } + } + } + + this.BillNos.Add(bill); + + //鏀瑰彉鍓嶅悗鐨刡illNo鍊,鏂扮殑鍊煎啀涓娆¤浣跨敤 + firstBillNo = bill.FirstBillNo; + lastBillNo = bill.LastBillNo; + } + //鍒ゆ柇鏈夊皬鏁扮偣锛岄偅涔堝畠灏辨湁灏剧,鎶婂綋鍓嶇涓鏉$殑缂栧彿鏄惁鏄熬绠卞瓧娈垫敼涓簍rue + //if (this.BillNos.Count != 0 && hasPart) + // this.BillNos[0].IsTail = true; + } + + } +} diff --git a/src/BarCode.Web.Domain/Entitys/BoxMarkBillNo.cs b/src/BarCode.Web.Domain/Entitys/BoxMarkBillNo.cs new file mode 100644 index 0000000..a50b266 --- /dev/null +++ b/src/BarCode.Web.Domain/Entitys/BoxMarkBillNo.cs @@ -0,0 +1,87 @@ +锘縰sing System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations.Schema; +using System.Text; +using BarCode.Web.Core; + +namespace BarCode.Web.Domain.Entitys +{ + /// + /// 绠卞敍琛-缂栧彿琛 + /// + [Serializable] + [Table("t_barcode_box_mark_billno")] + public class BoxMarkBillNo : EntityBase + { + /// + /// ID + /// + public override int Id { get; set; } + + /// + /// 涓婄骇ID + /// + public int Fid { get; set; } + + /// + /// 绠卞敍缂栧彿 + /// + public string BillNo { get; set; } + + /// + /// 绠卞敍缂栧彿-棣栦綅 + /// + public int FirstBillNo { get; set; } + + /// + /// 绠卞敍缂栧彿-鏈熬搴忓彿 + /// + public int LastBillNo { get; set; } + + /// + /// 鏄惁鏄熬绠 + /// + public bool IsTail { get; set; } + + /// + /// 鎺掑簭 + /// + public int Sort { get; set; } + /// + /// 娴佹按鍙(寮濮) + /// + public Int64? BeginNumber { get; set; } = null; + /// + /// 娴佹按鍙(缁撴潫) + /// + public Int64? EndNumber { get; set; } = null; + + /// + /// 鐢熸垚缂栧彿 + /// + /// + /// + public void GenerateBillNo(int firstBillNo, int lastBillNo) + { + this.FirstBillNo = Convert.ToInt32(DateTime.Now.ToString("yyMMdd")); + if (this.FirstBillNo == firstBillNo) + this.LastBillNo = lastBillNo + 1; + else + this.LastBillNo = 1; + + if (this.LastBillNo.ToString().Length >= 5) + { + this.BillNo = "XM" + this.FirstBillNo + this.LastBillNo; + return; + } + + string lastStr = this.LastBillNo.ToString(); + while (true) + { + lastStr = "0" + lastStr; + if (lastStr.Length >= 5) break; + } + this.BillNo = "XM" + this.FirstBillNo + lastStr; + } + } +} diff --git a/src/BarCode.Web.Domain/Entitys/CenerateData.cs b/src/BarCode.Web.Domain/Entitys/CenerateData.cs new file mode 100644 index 0000000..e9eb958 --- /dev/null +++ b/src/BarCode.Web.Domain/Entitys/CenerateData.cs @@ -0,0 +1,40 @@ +锘縰sing BarCode.Web.Core; +using BarCode.Web.Domain.Values; +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations.Schema; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BarCode.Web.Domain.Entitys +{ + /// + /// 鐢熸垚璁″垝绠$悊 + /// + [Serializable] + [Table("t_wms_cenerate_date")] + public class CenerateData : EntityBase + { + public CenerateData() { } + public CenerateData(CenerateDataType type) + { + this.Type = type; + } + /// + /// 涓婚敭 璁㈠崟缂栧彿 + /// + [Column("Id")] + public override int Id { get; set; } + /// + /// 鍚屾绫诲瀷 + /// + [Column("Type")] + public CenerateDataType Type { get; set; } = CenerateDataType.Serial; + /// + /// 鏁伴噺 + /// + [Column("Number")] + public int Number { get; set; } = 1; + } +} diff --git a/src/BarCode.Web.Domain/Entitys/FileDownManager.cs b/src/BarCode.Web.Domain/Entitys/FileDownManager.cs new file mode 100644 index 0000000..1a7be0d --- /dev/null +++ b/src/BarCode.Web.Domain/Entitys/FileDownManager.cs @@ -0,0 +1,90 @@ +锘 +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations.Schema; +using System.Text; +using BarCode.Web.Core; +using BarCode.Web.Domain.Values; + +namespace BarCode.Web.Domain.Entitys +{ + /// + /// 鏂囦欢涓嬭浇绫诲瀷 + /// + [Serializable] + [Table("t_barcode_file_down_manager")] + public class FileDownManager : EntityBase + { + public FileDownManager() { } + public FileDownManager(int userId, int companyId, FileDownLoadOrderType type,string orgCode, string path, string supplierCode) + { + this.UserId = userId; + this.CompanyId = companyId; + this.Type = type; + this.FilePath = path; + this.SupplierCode = supplierCode; + this.OrgCode = orgCode; + } + /// + /// 涓婚敭 璁㈠崟缂栧彿 + /// + [Column("Id")] + public override int Id { get; set; } + /// + /// 鏃ユ湡 + /// + [Column("Date")] + public DateTime? Date { get; set; } = DateTime.Now; + /// + /// 鍗曟嵁绫诲瀷(浠诲姟绫诲瀷) + /// + [Column("Type")] + public FileDownLoadOrderType Type { get; set; } = FileDownLoadOrderType.SerialNumbers; + /// + /// 鐘舵 + /// + [Column("Status")] + public ExportStatus Status { get; set; } = ExportStatus.Ing; + /// + /// 鍏徃Id + /// + [Column("CompanyId")] + public int CompanyId { get; set; } + /// + /// 缁勭粐缂栫爜 + /// + [Column("OrgCode")] + public string OrgCode { get; set; } = ""; + /// + /// 鏂囦欢鍦板潃 + /// + [Column("FilePath")] + public string FilePath { get; set; } + /// + /// 鎿嶄綔浜 + /// + [Column("UserId")] + public int UserId { get; set; } + /// + /// 澶辫触鍘熷洜 + /// + [Column("Reason")] + public string Reason { get; set; } = ""; + /// + /// 渚涘簲鍟嗙紪鐮 + /// + [Column("SupplierCode")] + public string SupplierCode { get; set; } = ""; + + public void Finish(bool IsSuccess, string reson) + { + if (IsSuccess) + this.Status = ExportStatus.Success; + else + { + this.Status = ExportStatus.Fail; + this.Reason = reson; + } + } + } +} diff --git a/src/BarCode.Web.Domain/Entitys/Materials.cs b/src/BarCode.Web.Domain/Entitys/Materials.cs new file mode 100644 index 0000000..9eae68f --- /dev/null +++ b/src/BarCode.Web.Domain/Entitys/Materials.cs @@ -0,0 +1,77 @@ +锘縰sing System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations.Schema; +using System.Text; +using BarCode.Web.Core; + +namespace BarCode.Web.Domain.Entitys +{ + /// + /// 鐗╂枡 + /// + [Serializable] + [Table("t_barcode_materials")] + public class Materials : EntityBase + { + /// + /// ID + /// + public override int Id { get; set; } + + /// + /// 缁勭粐Id + /// + public int OrgId { get; set; } + + /// + /// 缁勭粐缂栫爜 + /// + public string OrgCode { get; set; } + + /// + /// 鐗╂枡ID + /// + public int MaterialId { get; set; } + + /// + /// 鐗╂枡鍚嶇О + /// + public string MaterialName { get; set; } + /// + /// 鐗╂枡缂栫爜 + /// + public string MaterialNumber { get; set; } + /// + /// 鐗╂枡瑙勬牸鍨嬪彿 + /// + public string Specifications { get; set; } + + /// + /// 鍩烘湰鍗曚綅 + /// + public int BaseUnitId { get; set; } + + /// + /// 鍩烘湰鍗曚綅鍚嶇О + /// + public string BaseUnitName { get; set; } + /// + /// 鍩烘湰鍗曚綅缂栫爜 + /// + public string BaseUnitNumber { get; set; } + + /// + /// 鏉$爜 + /// + public string BarCode { get; set; } + + /// + /// 鏄惁鍚敤鎵瑰彿绠$悊 + /// + public bool IsBatchManage { get; set; } + /// + /// 鐗╂枡Id 32杩涘埗瀛楃涓 + /// + public string IdConvertBar { get; set; } + } +} diff --git a/src/BarCode.Web.Domain/Entitys/SecurityNumberGenerateRecord.cs b/src/BarCode.Web.Domain/Entitys/SecurityNumberGenerateRecord.cs new file mode 100644 index 0000000..a2e7607 --- /dev/null +++ b/src/BarCode.Web.Domain/Entitys/SecurityNumberGenerateRecord.cs @@ -0,0 +1,116 @@ +锘縰sing BarCode.Web.Core; +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations.Schema; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BarCode.Web.Domain.Entitys +{ + /// + /// 闃蹭吉鐮佺敓鎴愯褰 + /// + [Serializable] + [Table("t_barcode_securitynumbergeneraterecord")] + public class SecurityNumberGenerateRecord : EntityBase + { + /// + /// 涓婚敭 璁㈠崟缂栧彿 + /// + [Column("Id")] + public override int Id { get; set; } + /// + /// 闃蹭吉鐮佹壒娆 + /// + [Column("LotNumber")] + public string LotNumber { get; set; } = string.Empty; + /// + /// 鐗╂枡缂栫爜 + /// + [Column("MaterialNumber")] + public string MaterialNumber { get; set; } = string.Empty; + /// + /// 鍏徃Id + /// + [Column("CompanyId")] + public int CompanyId { get; set; } = 0; + /// + /// 缁勭粐Id + /// + [Column("OrgCode")] + public string OrgCode { get; set; } = ""; + /// + /// 渚涘簲鍟哻ode + /// + [Column("SupplierCode")] + public string SupplierCode { get; set; } = ""; + /// + /// 鐢熸垚瀹屾垚 1 鐢熸垚涓 0 + /// + [Column("IsGenerateComplete")] + public bool IsGenerateComplete { get; set; } = false; + /// + /// 鐢熸垚鏉$爜鏁伴噺 + /// + [Column("Number")] + public int Number { get; set; } = 0; + /// + /// 涓嬭浇鏁 + /// + [Column("DownLoadNumber")] + public int DownLoadNumber { get; set; } = 0; + /// + /// 鍒涘缓浜 + /// + [Column("CreatorId")] + public int CreatorId { get; set; } = 0; + /// + /// 鐢熸垚鏃堕棿 + /// + [Column("CreateTime")] + public DateTime CreateTime { get; set; } = DateTime.Now; + /// + /// 鐢熸垚瀹屾垚鏃堕棿 + /// + [Column("GenerateCompleteTime")] + public DateTime? GenerateCompleteTime { get; set; } = null; + /// + /// 鐢熸垚瀹屾垚 + /// + public void Complete() + { + this.IsGenerateComplete = true; + this.GenerateCompleteTime = DateTime.Now; + } + /// + /// 涓嬭浇 + /// + public void DownLoad(int number) + { + this.DownLoadNumber = number; + } + /// + /// 鐢熸垚鎵瑰彿 + /// + public void GenerateLotNumber(int number) + { + //鐢ㄦ埛鎵嬪姩杈撳叆浜 灏变笉鑷姩鐢熸垚浜 + if (!string.IsNullOrEmpty(this.LotNumber)) return; + + if (number.ToString().Length >= 3) + { + this.LotNumber = "FWM" + DateTime.Now.ToString("yyMMdd") + number; + return; + } + + string idStr = number.ToString(); + while (true) + { + idStr = "0" + idStr; + if (idStr.Length >= 3) break; + } + this.LotNumber = "FWM" + DateTime.Now.ToString("yyMMdd") + idStr; + } + } +} diff --git a/src/BarCode.Web.Domain/Entitys/SecurityNumbers.cs b/src/BarCode.Web.Domain/Entitys/SecurityNumbers.cs new file mode 100644 index 0000000..adc830a --- /dev/null +++ b/src/BarCode.Web.Domain/Entitys/SecurityNumbers.cs @@ -0,0 +1,110 @@ +锘縰sing BarCode.Web.Core; +using BarCode.Web.Domain.Services.Public; +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations.Schema; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BarCode.Web.Domain.Entitys +{ + /// + /// 闃蹭吉鐮 + /// + [Serializable] + [Table("t_barcode_securitynumbers")] + public class SecurityNumbers : EntityLongBase + { + /// + /// 涓婚敭 璁㈠崟缂栧彿 + /// + [Column("Id")] + public override long Id { get; set; } + /// + /// 缁勭粐Code + /// + [Column("OrgCode")] + public string OrgCode { get; set; } = string.Empty; + /// + /// 渚涘簲鍟哻ode + /// + [Column("SupplierCode")] + public string SupplierCode { get; set; } = ""; + /// + /// 鐢熸垚璁板綍Id + /// + [Column("GenerateRecordId")] + public int GenerateRecordId { get; set; } = 0; + /// + /// 闃蹭吉鐮 + /// + [Column("SecurityNumber")] + public string SecurityNumber { get; set; } = ""; + /// + /// 鐗╂枡缂栫爜 + /// + [Column("MaterialNumber")] + public string MaterialNumber { get; set; } = string.Empty; + /// + /// 涓嬭浇娆℃暟 + /// + [Column("DownLoadNumber")] + public int DownLoadNumber { get; set; } = 0; + /// + /// 鏈鏂颁笅杞芥椂闂 + /// + [Column("DownLoadTime")] + public DateTime? DownLoadTime { get; set; } + /// + /// 鏌ヨ娆℃暟 + /// + [Column("QueryCount")] + public int QueryCount { get; set; } = 0; + /// + /// 绗竴娆℃煡璇㈡椂闂 + /// + [Column("QueryTime")] + public DateTime? QueryTime { get; set; } + /// + /// 鍒涘缓浜 + /// + [Column("CreatorId")] + public int CreatorId { get; set; } = 0; + /// + /// 鐢熸垚鏃堕棿 + /// + [Column("CreateTime")] + public DateTime? CreateTime { get; set; } = DateTime.Now; + /// + /// 涓嬭浇 + /// + public void DownLoad() + { + this.DownLoadNumber++; + this.DownLoadTime = DateTime.Now; + } + /// + /// 鐢熸垚闃蹭吉鐮 + /// + public void GenerateSecurityNumber() + { + if (!string.IsNullOrEmpty(this.SecurityNumber)) return; + string exclude = "WXYZ"; + int? FLength = 9; + + var idStr = Radix.ConvertRadix36((ulong)this.Id, exclude.ToCharArray()).PadLeft(FLength ?? 0, '0'); + this.SecurityNumber = "A" + idStr; + } + /// + /// 琚煡璇 + /// + public void Get() + { + if (this.QueryCount <= 0) + this.QueryTime = DateTime.Now; + this.QueryCount++; + + } + } +} diff --git a/src/BarCode.Web.Domain/Entitys/SerialNumberGenerateRecord.cs b/src/BarCode.Web.Domain/Entitys/SerialNumberGenerateRecord.cs new file mode 100644 index 0000000..8814ee6 --- /dev/null +++ b/src/BarCode.Web.Domain/Entitys/SerialNumberGenerateRecord.cs @@ -0,0 +1,150 @@ +锘縰sing BarCode.Web.Core; +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BarCode.Web.Domain.Entitys +{ + /// + /// 搴忓垪鍙风敓鎴愯褰 + /// + [Serializable] + [Table("t_barcode_serialnumbergeneraterecord")] + public class SerialNumberGenerateRecord : EntityBase + { + /// + /// 涓婚敭 璁㈠崟缂栧彿 + /// + [Column("Id")] + public override int Id { get; set; } + /// + /// 鐗╂枡Id杞32杩涘埗 + /// + [Column("IdConvertBar")] + public string IdConvertBar { get; set; } = ""; + /// + /// 鐗╂枡缂栫爜 + /// + [Column("MaterialNumber")] + public string MaterialNumber { get; set; } = ""; + /// + /// 鏄惁鏇存敼杩囩墿鏂欑紪鐮 + /// + [Column("IsUpdateMaterial")] + public bool? IsUpdateMaterial { get; set; } = false; + /// + /// 閲囪喘鍗曞彿 + /// + [Column("PurchaseBillNo")] + public string PurchaseBillNo { get; set; } = ""; + /// + /// 渚涘簲鍟哻ode + /// + [Column("SupplierCode")] + public string SupplierCode { get; set; } = ""; + /// + /// 鍏徃Id + /// + [Column("CompanyId")] + public int CompanyId { get; set; } = 0; + /// + /// 缁勭粐Id + /// + [Column("OrgCode")] + public string OrgCode { get; set; } = ""; + /// + /// 鐢熸垚瀹屾垚 1 鐢熸垚涓 0 + /// + [Column("IsGenerateComplete")] + public bool IsGenerateComplete { get; set; } = false; + /// + /// 鐢熸垚鏉$爜鏁伴噺 + /// + [Column("Number")] + public int Number { get; set; } = 0; + /// + /// 鐢熸垚鏉$爜璧峰浣嶆暟閲(鍚庣鐢ㄦ潵鍋氭爣璁) + /// + [Column("BeginNumber")] + public int BeginNumber { get; set; } = 0; + /// + /// 鎵撳嵃鏁 + /// + [Column("PrintNumber")] + public int PrintNumber { get; set; } = 0; + /// + /// 涓嬭浇鏁 + /// + [Column("DownLoadNumber")] + public int DownLoadNumber { get; set; } = 0; + /// + /// 浣跨敤鏁 + /// + [Column("UseNumber")] + public int UseNumber { get; set; } = 0; + /// + /// 鍒涘缓浜 + /// + [Column("CreatorId")] + public int CreatorId { get; set; } = 0; + + /// + /// 鏄惁濂楄锛岄粯璁ゆ槸涓1锛1鍗充负鍗曚釜锛屼笉鏄瑁匒lter by yzh + /// + [Column("IsTwo")] + public int IsTwo { get; set; } = 1; + + + /// + /// 鐢熸垚鏃堕棿 + /// + [Column("CreateTime")] + public DateTime CreateTime { get; set; } = DateTime.Now; + /// + /// 鐢熸垚瀹屾垚鏃堕棿 + /// + [Column("GenerateCompleteTime")] + public DateTime? GenerateCompleteTime { get; set; } = null; + /// + /// 鐢熸垚瀹屾垚 + /// + public void Complete() + { + this.IsGenerateComplete = true; + this.GenerateCompleteTime = DateTime.Now; + } + /// + /// 鎵撳嵃 + /// + public void Print(int number) + { + this.PrintNumber= number; + } + /// + /// 涓嬭浇 + /// + public void DownLoad(int number) + { + this.DownLoadNumber= number; + } + /// + /// 鍙嶅啓浣跨敤鏁 + /// + /// + public void Use(int number) + { + this.UseNumber = number; + } + /// + /// 鏍囪淇敼鐗╂枡 + /// + public void UpdateMaterial() + { + this.IsUpdateMaterial = true; + } + } +} diff --git a/src/BarCode.Web.Domain/Entitys/SerialNumbers.cs b/src/BarCode.Web.Domain/Entitys/SerialNumbers.cs new file mode 100644 index 0000000..04ae230 --- /dev/null +++ b/src/BarCode.Web.Domain/Entitys/SerialNumbers.cs @@ -0,0 +1,287 @@ +锘縰sing BarCode.Web.Core; +using BarCode.Web.Core.Help; +using BarCode.Web.Core.Internal.Results; +using BarCode.Web.Domain.Services.Public; +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations.Schema; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BarCode.Web.Domain.Entitys +{ + /// + /// 搴忓垪鍙 榛樿Id浠 200000000 璧峰 + /// alter table users AUTO_INCREMENT=200000000; + /// + [Serializable] + [Table("t_barcode_serialnumbers")] + public class SerialNumbers : EntityLongBase + { + /// + /// 涓婚敭 璁㈠崟缂栧彿 + /// + [Column("Id")] + public override long Id { get; set; } + /// + /// 缁勭粐Code + /// + [Column("OrgCode")] + public string OrgCode { get; set; } = string.Empty; + /// + /// 渚涘簲鍟哻ode + /// + [Column("SupplierCode")] + public string SupplierCode { get; set; } = ""; + /// + /// 鐢熸垚璁板綍Id + /// + [Column("GenerateRecordId")] + public int GenerateRecordId { get; set; } = 0; + /// + /// 搴忓垪鍙 + /// + [Column("SerialNumber")] + public string SerialNumber { get; set; } = string.Empty; + + + /// + /// 濂楄(1浠h〃鍗曞锛2浠h〃2濂楋紝3浠h〃3濂楋級 aLTER BY YZH + /// + [Column("IsTwo")] + public int IsTwo { get; set; } =1; + + /// + ///褰撴搴忓彿锛岀敤鏉ヨ褰曞綋娆℃墍浜х敓鏃舵墍澶勭殑搴忓垪鍙 + /// + [Column("thisNumber")] + public int thisNumber { get; set; } = 1; + + /// + /// 搴忓垪鍙 + /// + [Column("SuitNumber")] + public string SuitNumber { get; set; } = string.Empty; + /// + /// 浜х敓绗簩涓 + /// + [Column("TwoSerialNumber")] + public string TwoSerialNumber { get; set; } = string.Empty; + /// + /// 鐗╂枡Id + /// + [Column("MaterialId")] + public int MaterialId { get; set; } = 0; + /// + /// 鐗╂枡缂栫爜 + /// + [Column("MaterialNumber")] + public string MaterialNumber { get; set; } = string.Empty; + /// + /// 鑰佺墿鏂欑紪鐮(涓婁竴娆$墿鏂欑紪鐮) + /// + [Column("Old_MaterialNumber")] + public string? Old_MaterialNumber { get; set; } = string.Empty; + /// + /// 绠盜D + /// + [Column("BoxId")] + public int BoxId { get; set; } = 0; + /// + /// 鏁板瓧搴忓垪鐮 + /// + [Column("NumberCode")] + public string NumberCode { get; set; } = string.Empty; + /// + /// 鏁板瓧搴忓垪鐮(涓嶅寘鍚棩鏈) + /// + [Column("Number")] + public int Number { get; set; } = 1; + /// + /// 鏄惁浣跨敤 + /// + [Column("IsUse")] + public bool IsUse { get; set; } = false; + /// + /// 鍒涘缓浜 + /// + [Column("CreatorId")] + public int CreatorId { get; set; } = 0; + /// + /// 鐢熸垚鏃堕棿 + /// + [Column("CreateTime")] + public DateTime CreateTime { get; set; } = DateTime.Now; + /// + /// 瀹屾垚瑁呯鏃堕棿 + /// + [Column("CompleteCartonTime")] + public DateTime? CompleteCartonTime { get; set; } + /// + /// 鎵撳嵃娆℃暟 + /// + [Column("PrintNumber")] + public int PrintNumber { get; set; } = 0; + /// + /// 涓嬭浇娆℃暟 + /// + [Column("DownLoadNumber")] + public int DownLoadNumber { get; set; } = 0; + /// + /// 鏈鏂版墦鍗版椂闂 + /// + [Column("PrintTime")] + public DateTime? PrintTime { get; set; } + /// + /// 鏈鏂颁笅杞芥椂闂 + /// + [Column("DownLoadTime")] + public DateTime? DownLoadTime { get; set; } + /// + /// 鏄惁浣跨敤鐨勬槸鏁板瓧搴忓垪鐮佹湭浣跨敤null,鏁板瓧搴忓垪鐮乼rue,搴忓垪鐮乫alse + /// + [Column("IsUseNumber")] + public bool? IsUseNumber { get; set; } = null; + /// + /// 鐢熸垚搴忓垪鐮 + /// + public string GenerateSerialNumber() + { + string exclude = "ISOZ"; + int? FLength = 6; + + var idStr = Radix.ConvertRadix36((ulong)this.Id, exclude.ToCharArray()).PadLeft(FLength ?? 0, '0'); + this.SerialNumber = this.SerialNumber + "-" + idStr; + return this.SerialNumber; + } + + ///// + ///// 鐢熸垚濂楄缂栫爜 alter by yzh + ///// + //public void GenerateSuitNumber(string sn,) + //{ + + + // string exclude = "ISOZ"; + // int? FLength = 6; + + // var idStr = Radix.ConvertRadix36((ulong)this.Id, exclude.ToCharArray()).PadLeft(FLength ?? 0, '0'); + // this.SerialNumber = this.SerialNumber + "-" + idStr; + //} + + + /// + /// 鐢熸垚鏃堕棿搴忓垪鐮 + /// + public void GenerateNumberCode() + { + //鐢ㄦ埛鎵嬪姩杈撳叆浜 灏变笉鑷姩鐢熸垚浜 + if (!string.IsNullOrEmpty(this.NumberCode)) return; + + if (this.Number.ToString().Length >= 6) + { + this.NumberCode = this.CreateTime.ToString("yyMMdd") + this.Number.ToString(); + return; + } + + string idStr = this.Number.ToString(); + while (true) + { + idStr = "0" + idStr; + if (idStr.Length >= 6) break; + } + this.NumberCode = this.CreateTime.ToString("yyMMdd") + idStr; + } + /// + /// 浜х敓濂楄缂栫爜 alter by yzh + /// + /// + + public void GenerateSuitNumber(string sn) + { + this.SuitNumber = sn; + + } + /// + /// 浜х敓绗簩涓簭鍒楀彿 + /// + /// + public void GenerateTwoSerialNumber(string sn) + { + this.TwoSerialNumber = sn; + + } + + + + /// + /// 鎵撳嵃 + /// + public void Print() + { + //琚玾ms浣跨敤鐨勬暟鎹笉鑳借鎵撳嵃 + if (this.BoxId <= 0 && this.IsUse == true) return; + + this.PrintNumber++; + this.PrintTime = DateTime.Now; + } + /// + /// 涓嬭浇 + /// + public void DownLoad() + { + this.DownLoadNumber++; + this.DownLoadTime = DateTime.Now; + } + /// + /// 瑁呯 + /// + /// + /// + public void CompleteBox(int boxId, string str) + { + //姣忎釜搴忓垪鐮佸欢鏃1姣鏉ヨ绠 杩欐牱鍒版椂鍊欒幏鍙栧簭鍒楃爜鏃跺氨鍙互鏉ユ帓搴 + Thread.Sleep(1); + this.BoxId = boxId; + this.CompleteCartonTime = DateTime.Now; + this.IsUse = true; + this.IsUseNumber = this.NumberCode.Equals(str) ? true : false; + } + /// + /// 瑙g粦绠 + /// + public void UnBox() + { + this.BoxId = 0; + this.CompleteCartonTime = null; + this.IsUse = false; + this.IsUseNumber = null; + } + /// + /// wms绯荤粺鑾峰彇搴忓垪鐮佸悗 搴忓垪鐮佽皟鏁翠负宸蹭娇鐢 + /// + public void WmsGet(string str) + { + this.BoxId = -1; + this.IsUse = true; + this.IsUseNumber = this.NumberCode.Equals(str) ? true : false; + } + /// + /// 淇敼鐗╂枡缂栫爜 + /// + /// + public Result UpdateMaterial(string number) + { + if (this.IsUse) + return Result.ReFailure($"搴忓垪鐮 {this.SerialNumber} 宸茶浣跨敤,涓嶅厑璁歌鏍艰浆鎹", 600007); + if (!this.MaterialNumber.Equals(number)) + { + this.Old_MaterialNumber = this.MaterialNumber; + this.MaterialNumber = number; + } + + return Result.ReSuccess(); + } + } +} diff --git a/src/BarCode.Web.Domain/IService/IBoxMarkService.cs b/src/BarCode.Web.Domain/IService/IBoxMarkService.cs new file mode 100644 index 0000000..6e5fc19 --- /dev/null +++ b/src/BarCode.Web.Domain/IService/IBoxMarkService.cs @@ -0,0 +1,32 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; +using System.Threading.Tasks; +using BarCode.Web.Core.Dto; +using BarCode.Web.Core.Dto.Login; +using BarCode.Web.Core.Internal.Results; + +namespace BarCode.Web.Domain.IService +{ + /// + /// 绠卞敍-鏈嶅姟鎺ュ彛 + /// + public interface IBoxMarkService + { + /// + /// 鐢熸垚 + /// + /// + /// + /// + Task> Generate(GenerateBoxMarkDto dto, LoginInDto loginInfo); + + /// + /// 鍒楄〃-鍒嗛〉 + /// + /// + /// + /// + Task<(List list, int total)> GetPagedList(BoxMarkQueryRequest dto, LoginInDto loginInfo); + } +} diff --git a/src/BarCode.Web.Domain/IService/IBoxService.cs b/src/BarCode.Web.Domain/IService/IBoxService.cs new file mode 100644 index 0000000..b7f6b9d --- /dev/null +++ b/src/BarCode.Web.Domain/IService/IBoxService.cs @@ -0,0 +1,60 @@ +锘縰sing BarCode.Web.Core.Dto; +using BarCode.Web.Core.Dto.Box; +using BarCode.Web.Core.Dto.Login; +using BarCode.Web.Core.Dto.SerialNumbers; +using BarCode.Web.Core.Internal.Results; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BarCode.Web.Domain.IService +{ + /// + /// 绠 + /// + public interface IBoxService + { + /// + /// wms鑾峰彇宸插畬鎴愯绠辩淇℃伅 + /// + /// + /// + /// + Task<(List list, int total)> GetCartonListAsync(WmsBoxRequest dto); + /// + /// 瑁呯 + /// + /// + /// + /// + Task Save(SaveBoxRequest dto, LoginInDto loginInfo); + /// + /// 鐢熸垚绠辩爜 + /// + /// + /// + /// + Task Generate(GenerateBoxRequest dto, LoginInDto loginInfo); + /// 鎵撳嵃 + Task Print(OperateRequest dto); + /// + /// 鍒犻櫎 + /// + /// + Task Delete(DeleteBoxSerialNumberRequest dto, LoginInDto loginInfo); + /// + /// 娓呯┖ + /// + /// + Task Clear(int boxId, LoginInDto loginInfo); + /// 閲嶆柊瑁呯 + Task Restart(OperateRequest dto, LoginInDto loginInfo); + /// + /// 寮濮嬭绠 + /// + /// + Task BeginCarton(int boxId, LoginInDto loginInfo); + } +} diff --git a/src/BarCode.Web.Domain/IService/IExportExcelService.cs b/src/BarCode.Web.Domain/IService/IExportExcelService.cs new file mode 100644 index 0000000..ae945f3 --- /dev/null +++ b/src/BarCode.Web.Domain/IService/IExportExcelService.cs @@ -0,0 +1,56 @@ +锘縰sing Npoi.Mapper; +using System; +using System.Collections.Generic; +using System.Text; +using System.Threading.Tasks; +using BarCode.Web.Core.Dto; +using BarCode.Web.Domain.Values; +using BarCode.Web.Core.Dto.Login; + +namespace BarCode.Web.Domain.IService +{ + public interface IExportExcelService + { + /// + /// 鍏ㄥ瓧娈靛鍑烘暟鎹 + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + Task ExportAll(Request request, string fileName, int userId, LoginInDto loginInfo, FileDownLoadOrderType type, string orgCode, Mapper mapper = null, int? supplierId = null) where Request : PaginationBaseRequestDto; + /// + /// 鍒楄〃瀛楁瀵煎嚭鏁版嵁 + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + Task ExportList(Request request, string fileName, int userId, LoginInDto loginInfo, FileDownLoadOrderType type,string orgCode, Mapper mapper = null, int? supplierId = null) where Request : PaginationBaseRequestDto; + /// + /// 鍒楄〃椤靛鍑烘暟鎹 + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + Task Export(List dataList, string fileName,int userId, LoginInDto loginInfo, FileDownLoadOrderType type, string orgCode, Mapper mapper = null, int? supplierId = null); + } +} diff --git a/src/BarCode.Web.Domain/IService/IQiniuUploadService.cs b/src/BarCode.Web.Domain/IService/IQiniuUploadService.cs new file mode 100644 index 0000000..bde2e4c --- /dev/null +++ b/src/BarCode.Web.Domain/IService/IQiniuUploadService.cs @@ -0,0 +1,22 @@ +锘 +using System; +using System.Collections.Generic; +using System.IO; +using System.Text; +using System.Threading.Tasks; +using BarCode.Web.Core.Internal.Results; + +namespace BarCode.Web.Domain.IService +{ + public interface IQiniuUploadService + { + /// + /// 涓婁紶鏂囦欢 + /// + /// + /// + /// 鏄惁寮鍚嚜鍔ㄥ垹闄 濡傛灉寮鍚 3澶╁悗鑷姩鍒犻櫎 瀵煎嚭鐨別xecl鏂囦欢 + /// + Task> Upload(string fileName, Stream stream,bool isAutoDelte= false); + } +} diff --git a/src/BarCode.Web.Domain/IService/ISecurityNumberService.cs b/src/BarCode.Web.Domain/IService/ISecurityNumberService.cs new file mode 100644 index 0000000..e07766f --- /dev/null +++ b/src/BarCode.Web.Domain/IService/ISecurityNumberService.cs @@ -0,0 +1,32 @@ +锘縰sing BarCode.Web.Core.Dto.Login; +using BarCode.Web.Core.Dto.SecurityNumbers; +using BarCode.Web.Core.Dto.SerialNumbers; +using BarCode.Web.Core.Internal.Results; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BarCode.Web.Domain.IService +{ + /// + /// 闃蹭吉鐮 + /// + public interface ISecurityNumberService + { + /// + /// 涓嬭浇 + /// + /// + /// + Task DownLoad(OperateSecurityNumberRequest dto); + /// + /// 鐢熸垚闃蹭吉鐮 + /// + /// + /// + /// + Task Generate(GenerateSecurityNumberRequest dto, LoginInDto loginInfo); + } +} diff --git a/src/BarCode.Web.Domain/IService/ISerialNumberService.cs b/src/BarCode.Web.Domain/IService/ISerialNumberService.cs new file mode 100644 index 0000000..170b40c --- /dev/null +++ b/src/BarCode.Web.Domain/IService/ISerialNumberService.cs @@ -0,0 +1,50 @@ +锘縰sing BarCode.Web.Core.Dto; +using BarCode.Web.Core.Dto.Login; +using BarCode.Web.Core.Dto.SerialNumbers; +using BarCode.Web.Core.Internal.Results; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BarCode.Web.Domain.IService +{ + /// + /// 搴忓垪鍙锋湇鍔 + /// + public interface ISerialNumberService + { + /// + /// 鐢熸垚搴忓垪鍙 + /// + /// + /// + /// + Task Generate(GenerateSerialNumberRequest dto, LoginInDto loginInfo); + /// + /// 鎵撳嵃 + /// + /// + /// + Task Print(OperateSerialNumberRequest dto); + /// + /// 涓嬭浇 + /// + /// + /// + Task DownLoad(OperateSerialNumberRequest dto); + /// + /// 瑁呯鍚庡弽鍐欎娇鐢ㄦ暟 + /// + /// + /// + Task Use(List sGIds); + /// + /// 淇敼搴忓垪鍙风墿鏂 + /// + /// + /// + Task UpdateMaterial(UpdateMaterialRequest dto); + } +} diff --git a/src/BarCode.Web.Domain/IService/Public/IErpBasicDataExtendService.cs b/src/BarCode.Web.Domain/IService/Public/IErpBasicDataExtendService.cs new file mode 100644 index 0000000..d529157 --- /dev/null +++ b/src/BarCode.Web.Domain/IService/Public/IErpBasicDataExtendService.cs @@ -0,0 +1,191 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; +using BarCode.Web.Core.Dto.Erp; +using BarCode.Web.Core.Dto.Erp.Customer; +using BarCode.Web.Core.Dto.Erp.Org; +using BarCode.Web.Core.Dto.Erp.Supplier; +using BarCode.Web.Core.Dto.SingleData; + +namespace BarCode.Web.Domain.IService.Public +{ + /// + /// erp鍩虹鏁版嵁锛氭墿灞曟湇鍔℃帴鍙 + /// + public interface IErpBasicDataExtendService + { + /// + /// 鑾峰彇鐗╂枡鍚嶇О + /// + /// + /// + string GetMaterialName(List erpMaterials, int materialId); + + /// + /// 鑾峰彇鐗╂枡缂栫爜 + /// + /// + /// + /// + string GetMaterialNumber(List erpMaterials, int materialId); + + /// + /// 鑾峰彇鐗╂枡瑙勬牸鍨嬪彿 + /// + /// + /// + /// + string GetMaterialSpecifications(List erpMaterials, int materialId); + + /// + /// 鑾峰彇鐗╂枡鍚嶇О + /// + /// + /// + string GetMaterialName(List erpMaterials, string materialNumber); + + /// + /// 鑾峰彇鐗╂枡瑙勬牸鍨嬪彿 + /// + /// + /// + /// + string GetMaterialSpecifications(List erpMaterials, string materialNumber); + + /// + /// 鑾峰彇鐗╂枡鍩烘湰鍗曚綅鍚嶇О + /// + /// + /// + /// + string GetMaterialUnitName(List erpMaterials, int materialId); + /// + /// 鑾峰彇鐗╂枡鍩烘湰鍗曚綅鍚嶇О + /// + /// + /// + /// + string GetMaterialUnitName(List erpMaterials, string materialnumber); + + /// + /// 鑾峰彇鐗╂枡鐨勬潯鐮 + /// + /// + /// + /// + string GetMaterialBarCode(List erpMaterials, int materialId); + + /// + /// 鑾峰彇鐗╂枡鐨勬潯鐮 + /// + /// + /// + /// + string GetMaterialBarCode(List erpMaterials, string materialNumber); + + /// + /// 鑾峰彇鐗╂枡鍩烘湰鍗曚綅id + /// + /// + /// + /// + int GetMaterialUnitId(List erpMaterials, int materialId); + /// + /// 鑾峰彇鐗╂枡鍩烘湰鍗曚綅缂栫爜 + /// + /// + /// + /// + string GetMaterialUnitNumber(List erpMaterials, int materialId); + + /// + /// 鑾峰彇鐗╂枡鍩烘湰鍗曚綅缂栫爜 + /// + /// + /// + /// + string GetMaterialUnitNumber(List erpMaterials, string materialNumber); + /// + /// 鑾峰彇缁勭粐鍚嶇О + /// + /// + /// + /// + string GetOrgName(List erpOrgs, int orgId); + + /// + /// 鑾峰彇缁勭粐鍚嶇О + /// + /// + /// + /// + string GetOrgName(List erpOrgs, string orgCode); + + /// + /// 鑾峰彇缁勭粐ID + /// + /// + /// + int GetOrgId(List erpOrgs, string orgCode); + + /// + /// 鑾峰彇渚涘簲鍟嗗悕绉 + /// + /// + /// + /// + string GetSupplierName(List erpSuppliers, int supplierId); + /// + /// 鑾峰彇渚涘簲鍟嗗悕绉 + /// + /// + /// + /// + string GetSupplierName(List erpSuppliers, string supplierCode); + /// + /// 鑾峰彇瀹㈡埛鍚嶇О + /// + /// + /// + /// + string GetCustomerName(List erpCustomers, int customerId); + + /// + /// 鑾峰彇浠撳簱鍚嶇О + /// + /// + /// + /// + string GetStockName(List erpStocks, int stockId); + + /// + /// 鑾峰彇浠撳簱鍚嶇О + /// + /// + /// + /// + string GetStockName(List erpStocks, string code); + + /// + /// 鑾峰彇浠撳簱缂栫爜 + /// + /// + /// + /// + string GetStockCode(List erpStocks, int stockId); + + /// + /// 鑾峰彇瀛愪粨搴撳悕绉 + /// + /// + /// + /// + string GetSubStockName(List erpStocks, string code); + /// + /// 鑾峰彇鍗曠偣缁勭粐鍚嶅瓧 + /// + /// + /// + string GetSingleOrgName(List orgs, string code); + } +} diff --git a/src/BarCode.Web.Domain/IService/Public/IErpService.cs b/src/BarCode.Web.Domain/IService/Public/IErpService.cs new file mode 100644 index 0000000..b3ef88d --- /dev/null +++ b/src/BarCode.Web.Domain/IService/Public/IErpService.cs @@ -0,0 +1,100 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; +using System.Threading.Tasks; +using BarCode.Web.Core.Dto.Erp; +using BarCode.Web.Core.Dto.Erp.Customer; +using BarCode.Web.Core.Dto.Erp.Org; +using BarCode.Web.Core.Dto.Erp.OutStock; +using BarCode.Web.Core.Dto.Erp.Supplier; +using BarCode.Web.Core.Internal.Results; +using BarCode.Web.Domain.Entitys; + +namespace BarCode.Web.Domain.IService.Public +{ + public interface IErpService + { + /// + /// 鏌ュ崟鎹被鍨嬬殑鍊 + /// + /// + Task> BillQueryForBillType(); + /// + /// erp:鍗曟嵁鏌ヨ-鐗╂枡闆嗗悎 + /// + /// + Task> BillQueryForMaterial(bool isCache = true); + /// + /// 鑾峰彇鐗╂枡id32杩涘埗 + /// + /// + /// + Task> BillQueryForMaterialByNumbers(List materialNumbers); + + /// + /// erp:鍩虹鏁版嵁-鐗╂枡淇℃伅 + /// + /// + /// + Task> BillQueryForMaterial(int id); + /// + /// erp:鍩虹鏁版嵁-鐗╂枡淇℃伅 + /// + /// + /// + Task> BillQueryForMaterial(string number); + + /// + /// + /// + /// + /// + Task BillQueryForMaterialByNumber(string number); + /// + /// + /// + /// + /// + Task BillQueryForMaterialByNumber(string number, string orgCode); + + /// + /// + /// + /// + Task> BillQueryForOrg(); + + /// + /// 渚涘簲鍟 + /// + /// + Task> BillQueryForSupplier(); + /// + /// 瀹㈡埛 + /// + /// + Task> BillQueryForCustomer(); + /// + /// 鑾峰彇浠撳簱淇℃伅 + /// + /// + Task> BillQueryForStock(); + /// + /// 鑾峰彇浠撲綅淇℃伅淇℃伅 鏍规嵁浠撳簱缂栫爜 + /// + /// + Task> BillQueryForSubStock(); + + //鍚屾鏁版嵁(淇濆瓨鎻愪氦瀹℃牳) + Task> Save(T dto, string formId); + //鎻愪氦 + Task Submit(ErpOperateDto dto, string formId); + //瀹℃牳 + Task Audit(ErpOperateDto dto, string formId); + //鍙嶅鏍 + Task NoAudit(ErpOperateDto dto, string formId); + //鍒犻櫎 + Task Delete(ErpOperateDto dto, string formId); + //涓嬫帹 + Task> Push(ErpPushDto dto); + } +} diff --git a/src/BarCode.Web.Domain/IService/Public/IHttpClientService.cs b/src/BarCode.Web.Domain/IService/Public/IHttpClientService.cs new file mode 100644 index 0000000..404e72b --- /dev/null +++ b/src/BarCode.Web.Domain/IService/Public/IHttpClientService.cs @@ -0,0 +1,18 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Net.Http; +using System.Text; +using System.Threading.Tasks; + +namespace BarCode.Web.Domain.IService.Public +{ + public interface IHttpClientService + { + HttpClient BuildHttpClient(Dictionary dicDefaultHeaders, int? timeoutSecond = 180); + Task GetAsync(string url, int timeoutSecond = 180); + Task GetAsync(string url, Dictionary dicHeaders, int timeoutSecond = 180); + Task PostAsync(string url, string requestBody, int timeoutSecond = 180); + Task PostAsync(string url, string requestBody, Dictionary dicHeaders, int timeoutSecond = 180); + Task ExecuteAsync(string url, HttpMethod method, string requestBody, Dictionary dicHeaders, int timeoutSecond = 180); + } +} diff --git a/src/BarCode.Web.Domain/IService/Public/ILoginService.cs b/src/BarCode.Web.Domain/IService/Public/ILoginService.cs new file mode 100644 index 0000000..e1ab277 --- /dev/null +++ b/src/BarCode.Web.Domain/IService/Public/ILoginService.cs @@ -0,0 +1,77 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; +using System.Threading.Tasks; +using BarCode.Web.Core.Dto.Login; +using BarCode.Web.Core.Dto.Login.Temp; +using BarCode.Web.Core.Internal.Results; + +namespace BarCode.Web.Domain.IService.Public +{ + /// + /// 鐧诲綍鏈嶅姟鎺ュ彛 + /// + public interface ILoginService + { + + /// + /// 鍒涘缓token + /// + /// + /// + /// + /// + Task CreateToken(UserInfoDto data, LoginTempDto tempDto, string NewToken); + + /// + /// + /// + /// + /// + Task> GetUserInfoByCode(string code); + + /// + /// 鑾峰彇鍗曠偣鐢ㄦ埛淇℃伅 + /// + /// + /// + /// + Task> GetUserInfo(string username, string password); + + /// + /// 鐧诲綍閫鍑 + /// + /// + /// + Task LoginOut(LoginOutDto dto); + + /// + /// 鍒锋柊token + /// + /// + /// + /// + Task> RefreshTokenNew(string Token, string RefreshToken); + + /// + /// 鍗曠偣閫鍑洪氱煡token澶辨晥 + /// + /// + /// + Task LoginOutSingleAsync(string SeesionId); + + /// + /// 鑾峰彇鐧诲綍鍚庣殑淇℃伅 + /// + /// + /// + LoginInDto GetLoginInfo(string authorization); + + /// + /// 鑾峰彇鑿滃崟 + /// + /// + /// + Task> GetMenuList(int userId); + } +} diff --git a/src/BarCode.Web.Domain/IService/Public/IMaterialService.cs b/src/BarCode.Web.Domain/IService/Public/IMaterialService.cs new file mode 100644 index 0000000..60d9179 --- /dev/null +++ b/src/BarCode.Web.Domain/IService/Public/IMaterialService.cs @@ -0,0 +1,25 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; +using System.Threading.Tasks; +using BarCode.Web.Core.Internal.Results; + +namespace BarCode.Web.Domain.IService +{ + /// + /// 鐗╂枡鏈嶅姟鎺ュ彛 + /// + public interface IMaterialService + { + /// + /// 鍚屾閲戣澏鏂扮墿鏂 + /// + /// + Task SyncNewMaterials(); + /// + /// 鍚屾鐗╂枡id32杩涘埗 + /// + /// + Task SyncBar(); + } +} diff --git a/src/BarCode.Web.Domain/IService/Public/IRedisConcurrentProcessService.cs b/src/BarCode.Web.Domain/IService/Public/IRedisConcurrentProcessService.cs new file mode 100644 index 0000000..50cdccb --- /dev/null +++ b/src/BarCode.Web.Domain/IService/Public/IRedisConcurrentProcessService.cs @@ -0,0 +1,15 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; + +namespace BarCode.Web.Domain.IService.Public +{ + public interface IRedisConcurrentProcessService + { + bool CanAccessMethod(string cacheKey); + + bool GetRedisKeyValue(string cacheKey); + + void UpdateAccessStatus(string cacheKey, bool canAccess); + } +} diff --git a/src/BarCode.Web.Domain/IService/Public/ISingleDataService.cs b/src/BarCode.Web.Domain/IService/Public/ISingleDataService.cs new file mode 100644 index 0000000..27adcdb --- /dev/null +++ b/src/BarCode.Web.Domain/IService/Public/ISingleDataService.cs @@ -0,0 +1,128 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; +using System.Threading.Tasks; +using BarCode.Web.Domain.Values.Single; + +namespace BarCode.Web.Domain.IService.Public +{ + /// + /// 鍗曠偣鏁版嵁杩斿洖鏈嶅姟鎺ュ彛 + /// + public interface ISingleDataService + { + /// + /// 鑾峰彇鍗曠偣鏁版嵁锛氭牴鎹柟娉曞悕鍜屽叕鍙窱D + /// + /// + /// + /// + /// + string GetSingleData(SingleAction action, int companyId, int id); + + /// + /// 鑾峰彇鍗曠偣鏁版嵁锛氭牴鎹柟娉曞悕鍜屽叕鍙窱D + /// + /// + /// + /// + /// + decimal GetSingleDataNumber(SingleAction action, int companyId, int id); + /// + /// 鑾峰彇鍗曠偣鏁版嵁:鏍规嵁鏂规硶鍚嶅拰鍏徃ID + /// + /// + /// + /// + /// + string GetSingleDataCode(SingleAction action, int companyId, int id); + + /// + /// 鑾峰彇鍗曠偣鏁版嵁锛氭牴鎹柟娉曞悕鍜屽叕鍙窱D + /// + /// + /// + /// + /// 鍔犱笂ID闃叉缂栫爜閲嶅 + /// + string GetSingleData(SingleAction action, int companyId, string code); + /// + /// 鏍规嵁鍚嶅瓧妯$硦鍖归厤 + /// + /// + /// + /// + /// + List GetIdsBySingleName(SingleAction action, int companyId, string name); + + + /// + /// 鑾峰彇鍗曠偣鏁版嵁闆嗗悎锛氭硾鍨-鍚屾 + /// + /// + /// + /// + /// + List GetSingleData(SingleAction action, int companyId) where T : class; + + /// + /// 鑾峰彇鍗曠偣鏁版嵁闆嗗悎锛氭硾鍨-寮傛 + /// + /// + /// + /// + /// + Task> GetSingleDataAsync(SingleAction action, int companyId) where T : class; + + /// + /// 鑾峰彇鍗曠偣鏁版嵁闆嗗悎锛氭硾鍨-寮傛-鏃犵紦瀛 + /// + /// + /// + /// + /// + Task> GetSingleDataNoCacheAsync(SingleAction action, int companyId) where T : class; + + /// + /// 鍗曠偣鏁版嵁锛氬彲瀵规帴鍏ㄩ儴鎺ュ彛 + /// + /// 杩斿洖瀵硅薄 + /// 璇锋眰瀵硅薄 + /// 鏂规硶鍚嶇О + /// 璇锋眰瀵硅薄 + /// 鏂规硶鍚嶇О + /// 鎺у埗鍣ㄥ悕绉 + /// + Task GetSingleData(X dto, Y action, SingleControllerType type = SingleControllerType.Single) where T : class; + + /// + /// 鍗曠偣鏁版嵁锛氬彲瀵规帴鍏ㄩ儴鎺ュ彛-鏃犵紦瀛 + /// + /// + /// + /// + /// + /// + /// + /// + Task GetSingleDataNoCache(X dto, Y action, SingleControllerType type = SingleControllerType.Single) where T : class; + + /// + /// 鑾峰彇鍗曠偣鏁版嵁锛氳姹傚璞″拰鎺ュ彛鏂规硶鍚 + /// + /// + /// + /// + /// + /// + Task GetSysConfigData(X dto, SysConfigAction action); + + /// + /// 鑾峰彇瀹㈡埛浠撳簱 + /// + /// + /// + /// + string GetCustomerStock(int companyId, string customerStockCode); + } +} diff --git a/src/BarCode.Web.Domain/IService/Public/IWmsService.cs b/src/BarCode.Web.Domain/IService/Public/IWmsService.cs new file mode 100644 index 0000000..596419b --- /dev/null +++ b/src/BarCode.Web.Domain/IService/Public/IWmsService.cs @@ -0,0 +1,22 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; +using System.Threading.Tasks; +using BarCode.Web.Core.Dto; +using BarCode.Web.Core.Internal.Results; + +namespace BarCode.Web.Domain.IService.Public +{ + /// + /// wms閲嶇疆绠变俊鎭 + /// + public interface IWmsService + { + /// + /// 閲嶇疆wms绠变俊鎭 + /// + /// + /// + Task>> Restart(List boxBillNos); + } +} diff --git a/src/BarCode.Web.Domain/Infrastructure/IAllFielRepositories.cs b/src/BarCode.Web.Domain/Infrastructure/IAllFielRepositories.cs new file mode 100644 index 0000000..ba81166 --- /dev/null +++ b/src/BarCode.Web.Domain/Infrastructure/IAllFielRepositories.cs @@ -0,0 +1,28 @@ +锘 +using BarCode.Web.Core.Dto.Login; +using System; +using System.Collections.Generic; +using System.IO; +using System.Text; +using System.Threading.Tasks; + +namespace BarCode.Web.Domain.Infrastructure +{ + public interface IAllFielRepositories + { + /// + /// 鍏ㄥ瓧娈靛鍑烘帴鍙 + /// + /// + /// + //Task<(object obj, int total)> GetListAllField(Request dto, int companyId); + + /// + /// 鍒楄〃瀛楁瀵煎嚭鎺ュ彛 + /// + /// + /// + /// + Task<(object obj, int total)> GetListField(Request dto, LoginInDto loginInfo); + } +} diff --git a/src/BarCode.Web.Domain/Infrastructure/IBasicsRepositories.cs b/src/BarCode.Web.Domain/Infrastructure/IBasicsRepositories.cs new file mode 100644 index 0000000..e235aca --- /dev/null +++ b/src/BarCode.Web.Domain/Infrastructure/IBasicsRepositories.cs @@ -0,0 +1,93 @@ +锘縰sing Microsoft.EntityFrameworkCore.Storage; +using System; +using System.Collections.Generic; +using System.Text; +using System.Threading.Tasks; +using BarCode.Web.Core.Dto.SingleData; + +namespace BarCode.Web.Domain.Infrastructure +{ + /// + /// 鍩虹鏁版嵁 + /// + public interface IBasicsRepositories + { + /// + /// 鏍规嵁鐢ㄦ埛绮剧‘鎼滅储鐢ㄦ埛 + /// + /// + /// + Task> GetUserIdsAsync(string name, int companyId); + /// + /// 鑾峰彇鎵鏈変汉鍛-鏍规嵁涓讳綋 + /// + /// + /// + Task> GetStaffListAsync(int CompanyId); + /// + /// 鏍规嵁浠撳簱鑾峰彇瀛愪粨搴 + /// + /// 浠撳簱id + /// + Task> GetSubUcStockAsync(int stockId); + + /// + /// 鑾峰彇浠撲綅锛氭牴鎹畁ame妯$硦锛屽拰绯荤粺code鍜屽叕鍙 + /// + /// + /// + /// + /// + Task> GetSubUcStockAsync(string systemCode, string name, int companyId); + + /// + /// 鑾峰彇浠撲綅璇︽儏锛氭牴鎹粨浣岻D鍜屽叕鍙窱D + /// + /// + /// + /// + Task GetSubUcStockAsync(int id, int companyId); + + /// + /// 鑾峰彇浠撲綅闆嗗悎锛氭牴鎹粨浣岻D闆嗗悎鍜屽叕鍙窱D + /// + /// + /// + /// + Task> GetSubUcStockAsync(List ids, int companyId); + + /// + /// 鑾峰彇浠撲綅璇︽儏锛氭牴鎹粨浣岻D鍜屽叕鍙窱D + /// + /// + /// + /// + Task GetSubUcStockAsync(string code, int companyId); + + /// + /// 鑾峰彇浠撲綅闆嗗悎锛氭牴鎹粨浣嶇紪鐮侀泦鍚堝拰鍏徃ID + /// + /// + /// + /// + Task> GetSubUcStockAsync(List codes, int companyId); + + /// + /// 鑾峰彇浠撳簱 + /// + /// + Task> GetUcStockAsync(string systemCode,string name, int companyId); + + /// + /// 鑾峰彇浜嬪姟 鐢ㄦ潵澶勭悊鍗虫椂搴撳瓨 + /// + /// + IDbContextTransaction GetTransaction(); + + /// + /// 鑾峰彇浜嬪姟 鐢ㄦ潵澶勭悊鍗虫椂搴撳瓨 + /// + /// + bool CommitTransaction(bool isRollback, IDbContextTransaction transaction); + } +} diff --git a/src/BarCode.Web.Domain/Infrastructure/IBoxMarkRepositories.cs b/src/BarCode.Web.Domain/Infrastructure/IBoxMarkRepositories.cs new file mode 100644 index 0000000..7a367ff --- /dev/null +++ b/src/BarCode.Web.Domain/Infrastructure/IBoxMarkRepositories.cs @@ -0,0 +1,60 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; +using System.Threading.Tasks; +using BarCode.Web.Core.Dto; +using BarCode.Web.Core.Dto.Login; +using BarCode.Web.Domain.Entitys; + +namespace BarCode.Web.Domain.Infrastructure +{ + /// + /// 绠卞敍-浠撳偍鎺ュ彛 + /// + public interface IBoxMarkRepositories + { + /// + /// 鍒楄〃鍒嗛〉 + /// + /// + /// + /// + Task<(List list, int total)> GetPagedList(BoxMarkQueryRequest dto, LoginInDto loginInfo); + + /// + /// 娣诲姞 + /// + /// + /// + /// + Task Add(BoxMark entity, bool isTransaction = true); + + /// + /// 璇︽儏-鏍规嵁鏈鏂扮殑ID + /// + /// + Task GetBy(); + + /// + /// 鍒楄〃-璇︽儏淇℃伅鍒楄〃 + /// + /// + /// + /// + Task> GetListInfoBy(int id, int companyId); + + /// + /// 鑾峰彇鏈鏂扮殑缂栧彿瀹炰綋 + /// + /// + Task GetLastBillNo(); + + /// + /// 鎵归噺鍒犻櫎 + /// + /// + /// + /// + Task DeleteRange(List ids, bool isTransaction = true); + } +} diff --git a/src/BarCode.Web.Domain/Infrastructure/IBoxRepositories.cs b/src/BarCode.Web.Domain/Infrastructure/IBoxRepositories.cs new file mode 100644 index 0000000..2f39fb2 --- /dev/null +++ b/src/BarCode.Web.Domain/Infrastructure/IBoxRepositories.cs @@ -0,0 +1,47 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; +using System.Threading.Tasks; +using BarCode.Web.Core.Dto; +using BarCode.Web.Core.Dto.Box; +using BarCode.Web.Core.Dto.Login; +using BarCode.Web.Core.Dto.SerialNumbers; +using BarCode.Web.Domain.Entitys; + +namespace BarCode.Web.Domain.Infrastructure +{ + /// + /// 鑰乷ps绠变俊鎭 + /// + public interface IBoxRepositories + { + /// + /// 鑾峰彇鍒楄〃 + /// + /// + /// + /// + Task<(List list, int total)> GetListAsync(BoxQueryRequest dto, LoginInDto loginInfo); + Task Get(int id); + Task GetByNo(string billNo); + //鏍规嵁绠卞彿鎼滅储 鐢ㄦ潵姣斿纭畾鏄惁绠卞彿淇℃伅鏄惁瀛樺湪 + Task> GetByNos(List billNos); + //缂栬緫 + Task Edit(Box entity, bool isTransaction = true); + //鎵归噺淇敼 + Task EditEntityList(List entitys, bool isTransaction = true); + /// + /// 鎵归噺娣诲姞 + /// + /// + /// + /// + Task AddRange(List entitys, bool isTransaction = true); + /// 鏌ヨ瀹炰綋闆嗗悎 + Task> GetEntityList(List ids); + + Task> GetEntityListByNos(List billNos); + /// 鏌ヨ瀹炰綋闆嗗悎 + Task<(List, int tota)> GetEntityByWmsList(WmsBoxRequest dto); + } +} diff --git a/src/BarCode.Web.Domain/Infrastructure/ICenerateDataRepositories.cs b/src/BarCode.Web.Domain/Infrastructure/ICenerateDataRepositories.cs new file mode 100644 index 0000000..3590388 --- /dev/null +++ b/src/BarCode.Web.Domain/Infrastructure/ICenerateDataRepositories.cs @@ -0,0 +1,23 @@ +锘縰sing BarCode.Web.Domain.Entitys; +using BarCode.Web.Domain.Values; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BarCode.Web.Domain.Infrastructure +{ + /// + /// 鐢熸垚鏁版嵁绠$悊 + /// + public interface ICenerateDataRepositories + { + ///鑾峰彇鏈鏂颁竴娆℃洿鏂版椂闂 + Task Get(CenerateDataType type); + ///瀹氭椂浠诲姟鎵ц鍚庢洿鏂版椂闂 + Task Edit(CenerateData entity, bool isTransaction = true); + ///瀹氭椂浠诲姟鎵ц鍚庡垱寤 + Task Add(CenerateData entity, bool isTransaction = true); + } +} diff --git a/src/BarCode.Web.Domain/Infrastructure/IFileDownManagerRepositories.cs b/src/BarCode.Web.Domain/Infrastructure/IFileDownManagerRepositories.cs new file mode 100644 index 0000000..f221a34 --- /dev/null +++ b/src/BarCode.Web.Domain/Infrastructure/IFileDownManagerRepositories.cs @@ -0,0 +1,32 @@ +锘 +using System; +using System.Collections.Generic; +using System.Text; +using System.Threading.Tasks; +using BarCode.Web.Core.Dto; +using BarCode.Web.Core.Dto.Login; +using BarCode.Web.Domain.Entitys; + +namespace BarCode.Web.Domain.Infrastructure +{ + public interface IFileDownManagerRepositories + { + /// + /// 淇濆瓨 + /// + /// + /// + Task Add(FileDownManager entity); + /// + /// 缂栬緫 + /// + /// + /// + Task Edit(FileDownManager entity); + /// + /// 鑾峰彇閿鍞垪琛 + /// + /// + Task GetList(FileDownManagerRequest dto, LoginInDto loginInfo); + } +} diff --git a/src/BarCode.Web.Domain/Infrastructure/ILoginRepositories.cs b/src/BarCode.Web.Domain/Infrastructure/ILoginRepositories.cs new file mode 100644 index 0000000..272367c --- /dev/null +++ b/src/BarCode.Web.Domain/Infrastructure/ILoginRepositories.cs @@ -0,0 +1,24 @@ +锘縰sing BarCode.Web.Core.Dto.Login; +using System; +using System.Collections.Generic; +using System.Text; + +namespace BarCode.Web.Domain.Infrastructure +{ + public interface ILoginRepositories + { + /// + /// 鍏徃Id + /// + int CompanyId { get; set; } + + /// + /// 鍛樺伐ID + /// + int StaffId { get; set; } + /// + /// 鐧诲綍鐢ㄦ埛淇℃伅 + /// + LoginInDto loginInfo { get; set; } + } +} diff --git a/src/BarCode.Web.Domain/Infrastructure/IMaterialsRepositories.cs b/src/BarCode.Web.Domain/Infrastructure/IMaterialsRepositories.cs new file mode 100644 index 0000000..f3eba04 --- /dev/null +++ b/src/BarCode.Web.Domain/Infrastructure/IMaterialsRepositories.cs @@ -0,0 +1,77 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; +using System.Threading.Tasks; +using BarCode.Web.Domain.Entitys; + +namespace BarCode.Web.Domain.Infrastructure +{ + /// + /// 鐗╂枡浠撳偍鎺ュ彛 + /// + public interface IMaterialsRepositories + { + /// + /// 鐗╂枡娣诲姞 + /// + /// + /// + /// + Task AddRange(List entitys, bool isTransaction = true); + + /// + /// 鍒楄〃 + /// + /// + Task> GetEntityList(int? orgId = null); + + /// + /// 鐗╂枡 + /// + /// + /// + Task Get(int mid); + + /// + /// 鐗╂枡 + /// + /// + /// + /// + Task Get(string code, int orgId); + + /// + /// + /// + /// + Task> GetAllNumbers(); + + /// + /// 鍒楄〃 + /// + /// + /// + /// + Task> GetEntityList(List materNumbers, bool isBatchManage); + + /// + /// 鍒楄〃(鑾峰彇鎵鏈夋病鏈塱d32杩涘埗鐨勭墿鏂) + /// + /// + Task> GetEntityListByNoBar(); + + /// + /// 淇敼鐗╂枡 + /// + /// + /// + /// + Task UpdateRange(List entitys, bool isTransaction = true); + /// + /// 闆嗗悎 + /// + /// + /// + Task> GetEntityList(List materNumbers); + } +} diff --git a/src/BarCode.Web.Domain/Infrastructure/ISGenerateRecordRepositories.cs b/src/BarCode.Web.Domain/Infrastructure/ISGenerateRecordRepositories.cs new file mode 100644 index 0000000..5fb4e19 --- /dev/null +++ b/src/BarCode.Web.Domain/Infrastructure/ISGenerateRecordRepositories.cs @@ -0,0 +1,34 @@ +锘縰sing BarCode.Web.Core.Dto.Login; +using BarCode.Web.Core.Dto.SerialNumbers; +using BarCode.Web.Domain.Entitys; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BarCode.Web.Domain.Infrastructure +{ + public interface ISGenerateRecordRepositories + { + // 鑾峰彇鍒楄〃 + Task<(List list, int total)> GetListAsync(SGenerateRecordQueryRequest dto, LoginInDto loginInfo); + // 鏂板 + Task Add(SerialNumberGenerateRecord entity, bool isTransaction = true); + //缂栬緫 + Task Edit(SerialNumberGenerateRecord entity, bool isTransaction = true); + /// + /// 鎵归噺娣诲姞 + /// + /// + /// + /// + Task AddRange(List entitys, bool isTransaction = true); + /// 淇敼瀹炰綋闆嗗悎 + Task EditEntityList(List entitys, bool isTransaction = true); + /// 鏌ヨ瀹炰綋闆嗗悎 + Task> GetEntityList(List ids); + /// 鏌ヨ瀹炰綋 + Task GetEntity(int id); + } +} diff --git a/src/BarCode.Web.Domain/Infrastructure/ISecurityGenerateRecordRepositories.cs b/src/BarCode.Web.Domain/Infrastructure/ISecurityGenerateRecordRepositories.cs new file mode 100644 index 0000000..a5ef688 --- /dev/null +++ b/src/BarCode.Web.Domain/Infrastructure/ISecurityGenerateRecordRepositories.cs @@ -0,0 +1,35 @@ +锘縰sing BarCode.Web.Core.Dto.Login; +using BarCode.Web.Core.Dto.SecurityNumbers; +using BarCode.Web.Core.Dto.SerialNumbers; +using BarCode.Web.Domain.Entitys; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BarCode.Web.Domain.Infrastructure +{ + /// + /// 闃蹭吉鐮佺敓鎴愯褰 + /// + public interface ISecurityGenerateRecordRepositories + { + /// 鑾峰彇鍒楄〃 + Task<(List list, int total)> GetListAsync(SecurityGenerateRecordQueryRequest dto, LoginInDto loginInfo); + /// 鏂板 + Task Add(SecurityNumberGenerateRecord entity, bool isTransaction = true); + ///缂栬緫 + Task Edit(SecurityNumberGenerateRecord entity, bool isTransaction = true); + /// 鎵归噺娣诲姞 + Task AddRange(List entitys, bool isTransaction = true); + /// 淇敼瀹炰綋闆嗗悎 + Task EditEntityList(List entitys, bool isTransaction = true); + /// 鏌ヨ瀹炰綋闆嗗悎 + Task> GetEntityList(List ids); + /// 鏌ヨ瀹炰綋 + Task GetEntity(int id); + /// 鑾峰彇褰撳ぉ鐢熸垚璁板綍鏉℃暟 + Task GetGenerateRecordDayCount(); + } +} diff --git a/src/BarCode.Web.Domain/Infrastructure/ISecurityNumbersRepositories.cs b/src/BarCode.Web.Domain/Infrastructure/ISecurityNumbersRepositories.cs new file mode 100644 index 0000000..f505b4a --- /dev/null +++ b/src/BarCode.Web.Domain/Infrastructure/ISecurityNumbersRepositories.cs @@ -0,0 +1,43 @@ +锘縰sing BarCode.Web.Core.Dto.Login; +using BarCode.Web.Core.Dto.SecurityNumbers; +using BarCode.Web.Domain.Entitys; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BarCode.Web.Domain.Infrastructure +{ + /// + /// 闃蹭吉鐮 + /// + public interface ISecurityNumbersRepositories + { + /// 鑾峰彇鍒楄〃 + Task<(List list, int total)> GetListAsync(SecurityNumberQueryRequest dto, LoginInDto loginInfo); + + /// 鎵归噺娣诲姞 + Task AddRange(List entitys, bool isTransaction = true); + /// 淇敼瀹炰綋闆嗗悎 + Task EditEntityList(List entitys, bool isTransaction = true); + /// 鏌ヨ瀹炰綋闆嗗悎 + Task> GetEntityList(List SecurityNumbers); + /// 鏍规嵁鐢熸垚璁板綍id鏌ヨ搴忓垪鐮 + Task> GetEntityListByGRIds(List gRIds); + /// 鏍规嵁鐢熸垚璁板綍id鏌ヨ搴忓垪鐮 + Task> GetEntityListByGRId(int gRId); + /// 鏌ヨ瀹炰綋 + Task GetEntity(string securityNumbers); + /// 淇敼瀹炰綋 + Task Edit(SecurityNumbers entity, bool isTransaction = true); + + /// + /// 涓嬭浇鍙嶅啓 鎵цsql璇彞 + /// + /// + /// + Task DownLoad(List ids, bool isTransaction = true); + + } +} diff --git a/src/BarCode.Web.Domain/Infrastructure/ISerialNumbersRepositories.cs b/src/BarCode.Web.Domain/Infrastructure/ISerialNumbersRepositories.cs new file mode 100644 index 0000000..dc8c89b --- /dev/null +++ b/src/BarCode.Web.Domain/Infrastructure/ISerialNumbersRepositories.cs @@ -0,0 +1,62 @@ +锘縰sing BarCode.Web.Core.Dto.Login; +using BarCode.Web.Core.Dto.SerialNumbers; +using BarCode.Web.Domain.Entitys; +using Microsoft.AspNetCore.Mvc; +using Org.BouncyCastle.Bcpg.OpenPgp; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BarCode.Web.Domain.Infrastructure +{ + /// + /// 搴忓垪鐮 + /// + public interface ISerialNumbersRepositories + { + /// + /// 鑾峰彇鍒楄〃 + /// + /// + /// + /// + Task<(List list, int total)> GetListAsync(SerialNumberQueryRequest dto, LoginInDto loginInfo); + /// + /// 鎵归噺娣诲姞 + /// + /// + /// + /// + Task AddRange(List entitys, bool isTransaction = true); + /// 淇敼瀹炰綋闆嗗悎 + Task EditEntityList(List entitys, bool isTransaction = true); + /// 鏌ヨ瀹炰綋闆嗗悎 + Task> GetEntityList(List serialNumbers); + /// 鏌ヨ瀹炰綋闆嗗悎 + Task> GetEntityListContainNumber(List serialNumbers); + /// 鏍规嵁绠盜d鏌ヨ搴忓垪鐮 + Task> GetEntityListByBoxIds(List boxIds); + /// 鏍规嵁鐢熸垚璁板綍id鏌ヨ搴忓垪鐮 + Task> GetEntityListBySuitNumber(string suitNumber); + /// 鏍规嵁濂楄鐮佹煡璇㈠簭鍒楃爜 + Task> GetEntityListByGRIds(List gRIds); + /// 鏍规嵁鐢熸垚璁板綍id鏌ヨ搴忓垪鐮 + Task> GetEntityListByGRId(int gRId); + /// 鏍规嵁绠卞彿鏌ヨ搴忓垪鐮 + Task<(List list, int total)> GetEntityListByBoxId(SerialNumberByBoxIdQueryRequest dto); + /// 鏌ヨ瀹炰綋 + Task GetEntity(string serialNumber, string orgCode, LoginInDto loginInfo); + /// 鏌ヨ瀹炰綋 + Task> GetEntityList(string serialNumber, string orgCode, LoginInDto loginInfo); + /// WMS鏌ヨ瀹炰綋 + Task GetEntityWms(string serialNumbers); + /// + /// 鏍规嵁搴忓垪鍙锋悳绱俊鎭 + /// + /// + /// + Task GetExternal(string serialNumber); + } +} diff --git a/src/BarCode.Web.Domain/Infrastructure/ITransactionRepositories.cs b/src/BarCode.Web.Domain/Infrastructure/ITransactionRepositories.cs new file mode 100644 index 0000000..1c78776 --- /dev/null +++ b/src/BarCode.Web.Domain/Infrastructure/ITransactionRepositories.cs @@ -0,0 +1,22 @@ +锘縰sing Microsoft.EntityFrameworkCore.Storage; +using System; +using System.Collections.Generic; +using System.Text; + +namespace BarCode.Web.Domain.Infrastructure +{ + public interface ITransactionRepositories + { + /// + /// 鑾峰彇浜嬪姟 鐢ㄦ潵澶勭悊鍗虫椂搴撳瓨 + /// + /// + IDbContextTransaction GetTransaction(); + + /// + /// 鑾峰彇浜嬪姟 鐢ㄦ潵澶勭悊鍗虫椂搴撳瓨 + /// + /// + bool CommitTransaction(bool isRollback, IDbContextTransaction transaction); + } +} diff --git a/src/BarCode.Web.Domain/Mappers/AppMapper.cs b/src/BarCode.Web.Domain/Mappers/AppMapper.cs new file mode 100644 index 0000000..d88adc9 --- /dev/null +++ b/src/BarCode.Web.Domain/Mappers/AppMapper.cs @@ -0,0 +1,74 @@ +锘縰sing AutoMapper; +using BarCode.Web.Core.Dto; +using BarCode.Web.Core.Dto.Login; +using BarCode.Web.Core.Dto.Login.Temp; +using BarCode.Web.Core.Dto.Login.Temp.v3; +using BarCode.Web.Core.Help; +using System; +using System.Collections.Generic; +using System.Text; +using BarCode.Web.Domain.Entitys; + +namespace BarCode.Web.Domain.Mappers +{ + /// + /// mapper鏄犲皠 + /// + public class AppMapper : Profile + { + public AppMapper() + { + //pc绔櫥褰曠殑鐩稿叧dto + CreateMap() + .ForMember(x => x.Email, ops => ops.MapFrom(x => x.email)) + .ForMember(x => x.Avatar, ops => ops.MapFrom(x => x.avatar)) + .ForMember(x => x.RoleId, ops => ops.MapFrom(x => x.role_id)) + .ForMember(x => x.CreatedAt, ops => ops.MapFrom(x => x.created_at)) + .ForMember(x => x.SigninAt, ops => ops.MapFrom(x => x.signin_at)) + .ForMember(x => x.UpdatedAt, ops => ops.MapFrom(x => x.updated_at)) + .ReverseMap(); + + CreateMap() + .ForMember(x => x.Id, ops => ops.MapFrom(x => x.id)) + .ForMember(x => x.DeptCode, ops => ops.MapFrom(x => x.dept_code)) + .ForMember(x => x.DeptName, ops => ops.MapFrom(x => x.dept_name)) + .ForMember(x => x.ManagerId, ops => ops.MapFrom(x => x.manager)).ReverseMap(); + + //app绔拰灏忕▼搴忕鐧诲綍鐨勭浉鍏砫to + + + CreateMap() + .ForMember(x => x.Id, ops => ops.MapFrom(x => x.dept_id)) + .ForMember(x => x.Name, ops => ops.MapFrom(x => x.dept_name)) + .ForMember(x => x.Code, ops => ops.MapFrom(x => x.dept_code)).ReverseMap(); + CreateMap() + .ForMember(x => x.Id, ops => ops.MapFrom(x => x.company_id)) + .ForMember(x => x.Name, ops => ops.MapFrom(x => x.company_name)) + .ForMember(x => x.Code, ops => ops.MapFrom(x => x.company_code)).ReverseMap(); + CreateMap() + .ForMember(x => x.Id, ops => ops.MapFrom(x => x.role_id)) + .ForMember(x => x.Name, ops => ops.MapFrom(x => x.role_name)) + .ForMember(x => x.Code, ops => ops.MapFrom(x => x.role_code)).ReverseMap(); + + CreateMap() + .ForMember(x => x.Id, ops => ops.MapFrom(x => x.id)) + .ForMember(x => x.DingtalkUid, ops => ops.MapFrom(x => x.dingtalk_uid)) + .ForMember(x => x.DingtalkUnionid, ops => ops.MapFrom(x => x.dingtalk_unionid)) + .ForMember(x => x.Nickname, ops => ops.MapFrom(x => x.nickname)) + .ForMember(x => x.Realname, ops => ops.MapFrom(x => x.realname)) + .ForMember(x => x.Mobile, ops => ops.MapFrom(x => x.mobile)) + .ForMember(x => x.Identity, ops => ops.MapFrom(x => x.identity)) + .ForMember(x => x.Company, ops => ops.MapFrom(x => x.company)) + .ForMember(x => x.Orgs, opt => opt.Ignore()) + .ForMember(x => x.Depts, opt => opt.Ignore()) + .ForMember(x => x.Roles, opt => opt.Ignore()).ReverseMap(); + + + CreateMap() + .ForMember(x => x.Date, ops => ops.MapFrom(x => x.Date.DateToStringSeconds())) + //.ForMember(x => x.StatusKey, ops => ops.MapFrom(x => (int)x.Status)) + // .ForMember(x => x.Status, ops => ops.MapFrom(x => x.Status.GetRemark())) + .ForMember(x => x.Type, ops => ops.MapFrom(x => (int)x.Type)); + } + } +} diff --git a/src/BarCode.Web.Domain/Mappers/BoxMapper.cs b/src/BarCode.Web.Domain/Mappers/BoxMapper.cs new file mode 100644 index 0000000..04fe24b --- /dev/null +++ b/src/BarCode.Web.Domain/Mappers/BoxMapper.cs @@ -0,0 +1,36 @@ +锘縰sing AutoMapper; +using BarCode.Web.Core; +using BarCode.Web.Core.Dto.Box; +using BarCode.Web.Core.Help; +using BarCode.Web.Domain.Entitys; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BarCode.Web.Domain.Mappers +{ + /// + /// 绠眒apper鏄犲皠 + /// + public class BoxMapper: Profile + { + /// + /// 绠眒apper鏄犲皠 + /// + public BoxMapper() + { + CreateMap().ReverseMap(); + CreateMap().ReverseMap(); + + CreateMap() + .ForMember(x => x.Status, ops => ops.MapFrom(x => x.Status.GetRemark())) + .ForMember(x => x.CreateTime, ops => ops.MapFrom(x => x.CreateTime.DateToStringSeconds())) + .ForMember(x => x.PrintTime, ops => ops.MapFrom(x => x.PrintTime.DateToStringSeconds())) + .ForMember(x => x.CartonEndTime, ops => ops.MapFrom(x => x.CartonEndTime.DateToStringSeconds())) + .ForMember(x => x.CartonBeginTime, ops => ops.MapFrom(x => x.CartonBeginTime.DateToStringSeconds())); + CreateMap(); + } + } +} diff --git a/src/BarCode.Web.Domain/Mappers/BoxMarkMapper.cs b/src/BarCode.Web.Domain/Mappers/BoxMarkMapper.cs new file mode 100644 index 0000000..61d6e85 --- /dev/null +++ b/src/BarCode.Web.Domain/Mappers/BoxMarkMapper.cs @@ -0,0 +1,20 @@ +锘縰sing AutoMapper; +using System; +using System.Collections.Generic; +using System.Text; +using BarCode.Web.Core.Dto; +using BarCode.Web.Domain.Entitys; + +namespace BarCode.Web.Domain.Mappers +{ + public class BoxMarkMapper : Profile + { + public BoxMarkMapper() + { + CreateMap(); + + CreateMap() + .ForMember(x => x.BillNos, opt => opt.Ignore()); + } + } +} diff --git a/src/BarCode.Web.Domain/Mappers/MapperList.cs b/src/BarCode.Web.Domain/Mappers/MapperList.cs new file mode 100644 index 0000000..dbc6e2c --- /dev/null +++ b/src/BarCode.Web.Domain/Mappers/MapperList.cs @@ -0,0 +1,98 @@ +锘縰sing AutoMapper; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using BarCode.Web.Core; + +namespace BarCode.Web.Domain.Mappers +{ + /// + /// 闆嗗悎鏄犲皠 + /// + public static class MapperList + { + /// + /// 鏄犲皠瀹炰綋閲 闆嗗悎灞炴 + /// + /// + /// + /// + /// + /// + /// + public static List
ToMapList(this IMapper mapper, List sourcList, List
destinationList) + where ST : EntityBase + where DT : EntityBase + { + for (int i = 0; i < destinationList.Count; i++) + { + int id = destinationList[i].Id; + var detail = sourcList.FirstOrDefault(f => f.Id == id); + if (detail == null) + { + destinationList.Remove(destinationList[i]); + i--;//鍦ㄥ垪琛ㄧЩ闄ゆ帀涓鏉℃暟鎹悗 蹇呴』鎶奿ndex鍥炴嫧涓浣 鍥犱负鏁版嵁鍦ㄧЩ闄や竴鏉″悗浼氳皟鏁翠笅鏍 + } + } + + foreach (var st in sourcList) + { + if (st.Id == 0) + destinationList.Add(mapper.Map
(st)); + else + { + var detail = destinationList.FirstOrDefault(f => f.Id == st.Id); + + if (detail != null) + mapper.Map(st, detail); + //濡傛灉鍦ㄧ洰鏍囨暟鎹噷娌℃壘鍒拌繖鏉d鐨勬暟鎹 鍒欎笉浣滃鐞 + } + } + + return destinationList; + } + + + /// + /// 鏄犲皠瀹炰綋閲 闆嗗悎灞炴 + /// + /// + /// + /// + /// + /// + /// + public static List
ToMapLongList(this IMapper mapper, List sourcList, List
destinationList) + where ST : EntityLongBase + where DT : EntityLongBase + { + for (int i = 0; i < destinationList.Count; i++) + { + long id = destinationList[i].Id; + var detail = sourcList.FirstOrDefault(f => f.Id == id); + if (detail == null) + { + destinationList.Remove(destinationList[i]); + i--;//鍦ㄥ垪琛ㄧЩ闄ゆ帀涓鏉℃暟鎹悗 蹇呴』鎶奿ndex鍥炴嫧涓浣 鍥犱负鏁版嵁鍦ㄧЩ闄や竴鏉″悗浼氳皟鏁翠笅鏍 + } + } + + foreach (var st in sourcList) + { + if (st.Id == 0) + destinationList.Add(mapper.Map
(st)); + else + { + var detail = destinationList.FirstOrDefault(f => f.Id == st.Id); + + if (detail != null) + mapper.Map(st, detail); + //濡傛灉鍦ㄧ洰鏍囨暟鎹噷娌℃壘鍒拌繖鏉d鐨勬暟鎹 鍒欎笉浣滃鐞 + } + } + + return destinationList; + } + } +} diff --git a/src/BarCode.Web.Domain/Mappers/MaterialMapper.cs b/src/BarCode.Web.Domain/Mappers/MaterialMapper.cs new file mode 100644 index 0000000..e45f918 --- /dev/null +++ b/src/BarCode.Web.Domain/Mappers/MaterialMapper.cs @@ -0,0 +1,21 @@ +锘縰sing AutoMapper; +using System; +using System.Collections.Generic; +using System.Text; +using BarCode.Web.Core.Dto.Erp; +using BarCode.Web.Domain.Entitys; + +namespace BarCode.Web.Domain.Mappers +{ + public class MaterialMapper : Profile + { + public MaterialMapper() + { + CreateMap() + .ForMember(x => x.IdConvertBar, ops => ops.MapFrom(x => x.IdConvertBar.Trim())) + .ReverseMap(); + + CreateMap(); + } + } +} diff --git a/src/BarCode.Web.Domain/Mappers/SecurityNumberMapper.cs b/src/BarCode.Web.Domain/Mappers/SecurityNumberMapper.cs new file mode 100644 index 0000000..802574f --- /dev/null +++ b/src/BarCode.Web.Domain/Mappers/SecurityNumberMapper.cs @@ -0,0 +1,20 @@ +锘縰sing AutoMapper; +using BarCode.Web.Domain.Entitys; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BarCode.Web.Domain.Mappers +{ + public class SecurityNumberMapper: Profile + { + public SecurityNumberMapper() + { + CreateMap().ReverseMap(); + + CreateMap().ReverseMap(); + } + } +} diff --git a/src/BarCode.Web.Domain/Mappers/SerialNumberMapper.cs b/src/BarCode.Web.Domain/Mappers/SerialNumberMapper.cs new file mode 100644 index 0000000..4e08e05 --- /dev/null +++ b/src/BarCode.Web.Domain/Mappers/SerialNumberMapper.cs @@ -0,0 +1,21 @@ +锘縰sing AutoMapper; +using BarCode.Web.Core.Dto.Erp; +using BarCode.Web.Domain.Entitys; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BarCode.Web.Domain.Mappers +{ + public class SerialNumberMapper : Profile + { + public SerialNumberMapper() + { + CreateMap().ReverseMap(); + + CreateMap().ReverseMap(); + } + } +} diff --git a/src/BarCode.Web.Domain/Options/AppOptions.cs b/src/BarCode.Web.Domain/Options/AppOptions.cs new file mode 100644 index 0000000..3b1430b --- /dev/null +++ b/src/BarCode.Web.Domain/Options/AppOptions.cs @@ -0,0 +1,44 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; + +namespace BarCode.Web.Domain.Options +{ + public class AppOptions + { + /// + /// 鏁版嵁搴 + /// + public string DBConnectionString { get; set; } + + /// + /// redis + /// + public string RedisConnectionString { get; set; } + + /// + /// 鍗曠偣鏁版嵁璇锋眰鍦板潃-鍚庣浣跨敤鎺ュ彛鍦板潃 + /// + public string SingleBaseUrl { get; set; } + + /// + /// redis鏁版嵁鐩綍 + /// + public string RedisDirectory { get; set; } + + /// + /// 鏁版嵁搴撶被鍨 + /// + public string DBType { get; set; } + + /// + /// 鏄惁鍏佽缂撳瓨 + /// + public bool AllowCache { get; set; } + + /// + /// 鍏徃ID + /// + public int CompanyId { get; set; } + } +} diff --git a/src/BarCode.Web.Domain/Options/EmailOptions.cs b/src/BarCode.Web.Domain/Options/EmailOptions.cs new file mode 100644 index 0000000..f2eff52 --- /dev/null +++ b/src/BarCode.Web.Domain/Options/EmailOptions.cs @@ -0,0 +1,42 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; + +namespace BarCode.Web.Domain.Options +{ + /// + /// 閭 + /// + public class EmailOptions + { + /// + /// SMTP 鏈嶅姟鍣ㄥ湴鍧 + /// + public string SmtpServer { get; set; } + + /// + /// SMTP 鏈嶅姟鍣ㄧ鍙e彿 + /// + public int SmtpPort { get; set; } + + /// + /// 鍚嶇О + /// + public string SenderName { get; set; } + + /// + /// 涓婚 + /// + public string SendTitle { get; set; } + + /// + /// 鍙戜欢浜洪偖绠卞湴鍧 + /// + public string SenderEmail { get; set; } + + /// + /// 鍙戜欢浜洪偖绠卞瘑鐮 + /// + public string SenderEmailPwd { get; set; } + } +} diff --git a/src/BarCode.Web.Domain/Options/ErpOptions.cs b/src/BarCode.Web.Domain/Options/ErpOptions.cs new file mode 100644 index 0000000..72afb9e --- /dev/null +++ b/src/BarCode.Web.Domain/Options/ErpOptions.cs @@ -0,0 +1,39 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; + +namespace BarCode.Web.Domain.Options +{ + /// + /// erp鐩稿叧閰嶇疆鏂囦欢 + /// + public class ErpOptions + { + /// + /// erp-璇锋眰鍦板潃 + /// + public string EndpointAddress { get; set; } + + /// + /// 璐﹀彿 + /// + public string UserName { get; set; } + + /// + /// 瀵嗙爜 + /// + public string Password { get; set; } + + /// + /// erp-Id + /// + public string ErpId { get; set; } + public readonly string cache_materail_all_key = "erp_materials_list_all"; + public readonly string cache_materail_key = "erp_materials_list"; + public readonly string cache_org_key = "erp_org_list"; + public readonly string cache_supplier_key = "erp_supplier_list"; + public readonly string cache_customer_key = "erp_customer_list"; + public readonly string cache_stock_key = "erp_stock_list"; + public readonly string cache_substock_key = "erp_substock_list"; + } +} diff --git a/src/BarCode.Web.Domain/Options/QiniuOptions.cs b/src/BarCode.Web.Domain/Options/QiniuOptions.cs new file mode 100644 index 0000000..c7b07e1 --- /dev/null +++ b/src/BarCode.Web.Domain/Options/QiniuOptions.cs @@ -0,0 +1,31 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; + +namespace BarCode.Web.Domain.Options +{ + /// + /// 涓冪墰浜 閰嶇疆 + /// + public class QiniuOptions + { + /// + /// 璁块棶key + /// + public string AccessKey { get; set; } + /// + /// 绉橀挜 + /// + public string SecretKey { get; set; } + /// + /// 鍖哄潡鏂囦欢澶 + /// + public string Bucket { get; set; } + /// + /// 璁块棶鍩熷悕 + /// + public string Url { get; set; } + //瀵煎嚭鏁版嵁涓椤垫潯鏁 + public int PageSize { get; set; } = 50000; + } +} diff --git a/src/BarCode.Web.Domain/Options/QuartzJobOptions.cs b/src/BarCode.Web.Domain/Options/QuartzJobOptions.cs new file mode 100644 index 0000000..1b8dd2e --- /dev/null +++ b/src/BarCode.Web.Domain/Options/QuartzJobOptions.cs @@ -0,0 +1,155 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; + +namespace BarCode.Web.Domain.Options +{ + /// + /// Quartz瀹氭椂浠诲姟-閰嶇疆椤 + /// + public class QuartzJobOptions + { + /// + /// 瀛樺偍绫诲瀷:閿 + /// + public string JobStoreTypeKey { get; set; } + + /// + /// 瀛樺偍绫诲瀷:鍊 + /// + public string JobStoreTypeValue { get; set; } + + /// + /// 鏁版嵁搴撻┍鍔ㄧ被鍨-杩欓噷鏄痬ysql:閿 + /// + public string JobStoreDriverDelegateTypeKey { get; set; } + + /// + /// 鏁版嵁搴撻┍鍔ㄧ被鍨-杩欓噷鏄痬ysql:鍊 + /// + public string JobStoreDriverDelegateTypeValue { get; set; } + + /// + /// 鏁版嵁搴撹〃鍚嶅墠缂:閿 + /// + public string JobStoreTablePrefixKey { get; set; } + + /// + /// 鏁版嵁搴撹〃鍚嶅墠缂:鍊 + /// + public string JobStoreTablePrefixValue { get; set; } + + /// + /// 鏁版嵁婧愮殑鍚嶇О:閿 + /// + public string JobStoreDataSourceKey { get; set; } + + /// + /// 鏁版嵁婧愮殑鍚嶇О:鍊 + /// + public string JobStoreDataSourceValue { get; set; } + + /// + /// 杩炴帴瀛楃涓:閿 + /// + public string JobStoreConnectionStringKey { get; set; } + + /// + /// 杩炴帴瀛楃涓:鍊 + /// + public string JobStoreConnectionStringValue { get; set; } + + /// + /// mysql鎻愪緵鍣:閿 + /// + public string JobStoreProviderKey { get; set; } + + /// + /// mysql鎻愪緵鍣:鍊 + /// + public string JobStoreProviderValue { get; set; } + + + /// + /// 鍑犵偣鍚庡紑濮嬫墽琛 + /// + public List JobStartHour { get; set; } + + /// + /// 鍑犲垎閽熷悗寮濮嬫墽琛 + /// + public List JobStartMinute { get; set; } + + /// + /// 鎵цCron琛ㄨ揪寮忥細鍙互鏄嚑灏忔椂or鍑犲垎閽無r鍑犵閽無r鍑犲ぉor鍑犲懆 + /// + public string JobStartExpre { get; set; } + + /// + /// + /// + public string JobStartExpreAmount { get; set; } + + /// + /// 鍙戦侀氱煡鎵цcron琛ㄨ揪寮忥細姣忓ぉ12锛16锛20鏁寸偣鍙戦 + /// + public string JobStartExpreSend { get; set; } + + /// + /// 鍚屾鏂扮墿鏂欐墽琛宑ron琛ㄨ揪寮忥細姣忓ぉ23锛30鏁寸偣鍚屾 + /// + public string JobStartExpreMaterial { get; set; } + + /// + /// 鍚屾鏂扮墿鏂欐墽琛宑ron琛ㄨ揪寮忥細姣忓ぉ0锛01鎵ц + /// + public string JobStartExpreCenerateData { get; set; } + + /// + /// 鏄惁鍚敤闆嗙兢锛氶敭 + /// + public string JobStoreClusteredKey { get; set; } + + /// + /// 鏄惁鍚敤闆嗙兢锛氬 + /// + public string JobStoreClusteredValue { get; set; } + + /// + /// 鑺傜偣閮藉繀椤绘湁涓涓敮涓ID锛氶敭 + /// + public string JobStoreInstanceIdKey { get; set; } + + /// + /// 鑺傜偣閮藉繀椤绘湁涓涓敮涓ID锛氬 + /// + public string JobStoreInstanceIdValue { get; set; } + + + /// + /// 宸ヤ綔鍚嶇О锛氶敭 + /// + public string QuartzJobKey { get; set; } + + /// + /// 宸ヤ綔鍚嶇О锛氬 + /// + public string QuartzJobValue { get; set; } + + /// + /// 宸ヤ綔鎻忚堪 + /// + public string QuartzJobDescription { get; set; } + + /// + /// 瑙﹀彂鍣ㄨ韩浠借璇佷俊鎭 + /// + public string QuartzTriggerIdentity { get; set; } + + /// + /// 瑙﹀彂鍣ㄦ弿杩 + /// + public string QuartzTriggerDescription { get; set; } + + } +} diff --git a/src/BarCode.Web.Domain/Options/SmsOptions.cs b/src/BarCode.Web.Domain/Options/SmsOptions.cs new file mode 100644 index 0000000..a1d48ec --- /dev/null +++ b/src/BarCode.Web.Domain/Options/SmsOptions.cs @@ -0,0 +1,32 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; + +namespace BarCode.Web.Domain.Options +{ + /// + /// 鐭俊閰嶇疆椤 + /// + public class SmsOptions + { + /// + /// 璁块棶鍑瘉ID + /// + public string AccessKeyId { get; set; } + + /// + /// 璁块棶绉橀挜 + /// + public string AccessKeySecret { get; set; } + + /// + /// 鐭俊绛惧悕 + /// + public string SignName { get; set; } + + /// + /// 鐭俊妯℃澘缂栧彿 + /// + public string TemplateCode { get; set; } + } +} diff --git a/src/BarCode.Web.Domain/Options/SoaOptions.cs b/src/BarCode.Web.Domain/Options/SoaOptions.cs new file mode 100644 index 0000000..f19e5cb --- /dev/null +++ b/src/BarCode.Web.Domain/Options/SoaOptions.cs @@ -0,0 +1,47 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; + +namespace BarCode.Web.Domain.Options +{ + public class SoaOptions + { + /// + /// 鍗曠偣绯荤粺鍦板潃 + /// + public string Url { get; set; } + + /// + /// 鍗曠偣绯荤粺鍦板潃 + /// + public string Url_V3 { get; set; } + /// + /// admin璐﹀彿鐨処d + /// + public List AdminUser { get; set; } = new List(); + /// + /// 搴旂敤id + /// + public int ModuleID { get; set; } + + /// + /// AppId + /// + public string AppId { get; set; } + + /// + /// AppSecret + /// + public string AppSecret { get; set; } + + /// + /// 鍏挜 + /// + public string PublicKey { get; set; } + + /// + /// 绉侀挜 + /// + public string PrivateKey { get; set; } + } +} diff --git a/src/BarCode.Web.Domain/Options/WmsOptions.cs b/src/BarCode.Web.Domain/Options/WmsOptions.cs new file mode 100644 index 0000000..96e4244 --- /dev/null +++ b/src/BarCode.Web.Domain/Options/WmsOptions.cs @@ -0,0 +1,14 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; + +namespace BarCode.Web.Domain.Options +{ + /// + /// 鑰乷ps瀵规帴 + /// + public class WmsOptions + { + public string Url { get; set; } + } +} diff --git a/src/BarCode.Web.Domain/QuartzJob/CenerateDataQuartzJob.cs b/src/BarCode.Web.Domain/QuartzJob/CenerateDataQuartzJob.cs new file mode 100644 index 0000000..75c2271 --- /dev/null +++ b/src/BarCode.Web.Domain/QuartzJob/CenerateDataQuartzJob.cs @@ -0,0 +1,48 @@ +锘縰sing BarCode.Web.Domain.Infrastructure; +using BarCode.Web.Domain.IService; +using BarCode.Web.Domain.Values; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Logging; +using Quartz; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BarCode.Web.Domain.QuartzJob +{ + /// + /// 鑷姩鐢熸垚鏁版嵁缁存姢 鍑屾櫒娓呯┖ + /// + public class CenerateDataQuartzJob : IJob + { + private readonly ILogger _logger; + private readonly IServiceScopeFactory _serviceScopeFactory; + private readonly ICenerateDataRepositories _cenerateDataRepositories; + + public CenerateDataQuartzJob(ILogger logger, + IServiceScopeFactory serviceScopeFactory, + IMaterialService materialService, + ICenerateDataRepositories cenerateDataRepositories) + { + this._logger = logger; + _serviceScopeFactory = serviceScopeFactory; + _cenerateDataRepositories = cenerateDataRepositories; + } + + /// + /// 鎵ц鏂规硶 + /// + /// + /// + public async Task Execute(IJobExecutionContext context) + { + _logger.LogInformation("瀹氭椂缁存姢鑷姩鐢熸垚鏁版嵁"); + //姣忓ぉ鍑屾櫒瀵规暟鎹繘琛屾竻绌 + var entity = await _cenerateDataRepositories.Get(CenerateDataType.Serial); + entity.Number = 1; + await _cenerateDataRepositories.Edit(entity); + } + } +} diff --git a/src/BarCode.Web.Domain/QuartzJob/MaterialsBarQuartzJob.cs b/src/BarCode.Web.Domain/QuartzJob/MaterialsBarQuartzJob.cs new file mode 100644 index 0000000..35141a9 --- /dev/null +++ b/src/BarCode.Web.Domain/QuartzJob/MaterialsBarQuartzJob.cs @@ -0,0 +1,39 @@ +锘縰sing BarCode.Web.Domain.IService; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Logging; +using Quartz; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BarCode.Web.Domain.QuartzJob +{ + public class MaterialsBarQuartzJob:IJob + { + private readonly ILogger _logger; + private readonly IServiceScopeFactory _serviceScopeFactory; + private readonly IMaterialService _materialService; + + public MaterialsBarQuartzJob(ILogger logger, + IServiceScopeFactory serviceScopeFactory, + IMaterialService materialService) + { + this._logger = logger; + _serviceScopeFactory = serviceScopeFactory; + _materialService = materialService; + } + + /// + /// 鎵ц鏂规硶 + /// + /// + /// + public async Task Execute(IJobExecutionContext context) + { + _logger.LogInformation("瀹氭椂缁存姢鐗╂枡id32杩涘埗"); + await _materialService.SyncBar(); + } + } +} diff --git a/src/BarCode.Web.Domain/QuartzJob/MaterialsQuartzJob.cs b/src/BarCode.Web.Domain/QuartzJob/MaterialsQuartzJob.cs new file mode 100644 index 0000000..bcccab0 --- /dev/null +++ b/src/BarCode.Web.Domain/QuartzJob/MaterialsQuartzJob.cs @@ -0,0 +1,42 @@ +锘縰sing Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Logging; +using Quartz; +using System; +using System.Collections.Generic; +using System.Text; +using System.Threading.Tasks; +using BarCode.Web.Domain.IService; +using Quartz.Logging; + +namespace BarCode.Web.Domain.QuartzJob +{ + /// + /// 鐗╂枡鍚屾鎵ц瀹氭椂浠诲姟 + /// + public class MaterialsQuartzJob : IJob + { + private readonly ILogger _logger; + private readonly IServiceScopeFactory _serviceScopeFactory; + private readonly IMaterialService _materialService; + + public MaterialsQuartzJob(ILogger logger, + IServiceScopeFactory serviceScopeFactory, + IMaterialService materialService) + { + this._logger = logger; + _serviceScopeFactory = serviceScopeFactory; + _materialService = materialService; + } + + /// + /// 鎵ц鏂规硶 + /// + /// + /// + public async Task Execute(IJobExecutionContext context) + { + _logger.LogInformation("瀹氭椂缁存姢鐗╂枡鏁版嵁"); + await _materialService.SyncNewMaterials(); + } + } +} diff --git a/src/BarCode.Web.Domain/Services/BoxMarkService.cs b/src/BarCode.Web.Domain/Services/BoxMarkService.cs new file mode 100644 index 0000000..acc66d5 --- /dev/null +++ b/src/BarCode.Web.Domain/Services/BoxMarkService.cs @@ -0,0 +1,131 @@ +锘縰sing AutoMapper; +using Microsoft.Extensions.Logging; +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using BarCode.Web.Core.Dto; +using BarCode.Web.Core.Dto.Login; +using BarCode.Web.Core.Internal.Results; +using BarCode.Web.Domain.Entitys; +using BarCode.Web.Domain.Infrastructure; +using BarCode.Web.Domain.IService; +using BarCode.Web.Domain.IService.Public; +using BarCode.Web.Domain.Values; + +namespace BarCode.Web.Domain.Services +{ + /// + /// 绠卞敍-鏈嶅姟 + /// + public class BoxMarkService : IBoxMarkService + { + private readonly IMapper _mapper; + public readonly IBasicsRepositories _transactionRepositories; + private readonly IBoxMarkRepositories _boxMarkRepositories; + private readonly ILogger _logger; + public BoxMarkService(IMapper mapper, ILogger logger, + IBasicsRepositories transactionRepositories, + IBoxMarkRepositories boxMarkRepositories) + { + _mapper = mapper; + _logger = logger; + _transactionRepositories = transactionRepositories; + _boxMarkRepositories = boxMarkRepositories; + } + + /// + /// 鐢熸垚 + /// + /// + /// + /// + public async Task> Generate(GenerateBoxMarkDto dto, LoginInDto loginInfo) + { + _logger.LogInformation($"绠卞敍鐢熸垚:{JsonConvert.SerializeObject(dto)} 鎿嶄綔浜:{loginInfo.UserInfo.UcId + loginInfo.UserInfo.Nickname}"); + string supplierCode = ""; + string orgCode = ""; + if (dto.OrgCode.Substring(0, 1).Equals("s")) + supplierCode = dto.OrgCode.Substring(2, dto.OrgCode.Length - 2); + else + orgCode = dto.OrgCode.Substring(2, dto.OrgCode.Length - 2); + //1.鑾峰彇鏈鏂扮殑绠卞敍淇℃伅 + var billNo_new = await _boxMarkRepositories.GetLastBillNo(); + + //2.dto鏄犲皠瀹炰綋 + var entity = new BoxMark(); + entity= _mapper.Map(dto, entity); + entity.Create(loginInfo.UserInfo.UcId); + entity.SupplierCode = supplierCode; + entity.OrgCode = orgCode; + int new_firstBillNo = billNo_new == null ? 0 : billNo_new.FirstBillNo; + int new_lastBillNo = billNo_new == null ? 0 : billNo_new.LastBillNo; + entity.GenerateBillNo(new_firstBillNo, new_lastBillNo); + + //娣诲姞 + var model = await _boxMarkRepositories.Add(entity); + if (model==null) + return ResultList.ReFailure(ResultCodes.DateWriteError); + + //杩斿洖鍒楄〃-瀵瑰簲鍒氬垰鐢熸垚鐨勬暟鎹拰缂栧彿闆嗗悎 + var list= await _boxMarkRepositories.GetListInfoBy(model.Id, loginInfo.UserInfo.CompanyId); + + if (list != null && list.Count != 0) + { + //澶勭悊-鎬绘暟閲 + list.ForEach(x => + { + x.BoxSortCount = this.GetSortCount(x.ProductQty, x.CratingQty); + + }); + } + + return ResultList.ReSuccess(list); + } + + /// + /// 鍒楄〃鍒嗛〉 + /// + /// + /// + /// + public async Task<(List list, int total)> GetPagedList(BoxMarkQueryRequest dto, LoginInDto loginInfo) + { + var (list, count) = await _boxMarkRepositories.GetPagedList(dto, loginInfo); + + if (list != null && list.Count != 0) + { + list.ForEach(x => + { + x.BoxSortCount = this.GetSortCount(x.ProductQty, x.CratingQty); + }); + } + + return (list, count); + } + + /// + /// 瑁呯鎬绘暟 + /// + /// + /// + /// + private int GetSortCount(decimal productQty, decimal cratingQty) + { + //璁$畻瑕佽鐨勭鏁伴噺 + var boxCount_tag = productQty / cratingQty; + var boxCount = Convert.ToInt32(boxCount_tag); + //鍒ゆ柇鏄惁瀛樺湪灏忔暟鐐癸紱true琛ㄦ槑鏈夊熬绠辨暟,false娌℃湁灏剧鏁 + var hasPart = Math.Floor(boxCount_tag) != boxCount_tag; + + //鏈夊皬鏁扮偣鍚戜笂鍙栨暣 + if (hasPart) + boxCount = Convert.ToInt32(Math.Ceiling(boxCount_tag)); + return boxCount; + } + + + } +} diff --git a/src/BarCode.Web.Domain/Services/BoxService.cs b/src/BarCode.Web.Domain/Services/BoxService.cs new file mode 100644 index 0000000..1a5a0ff --- /dev/null +++ b/src/BarCode.Web.Domain/Services/BoxService.cs @@ -0,0 +1,459 @@ +锘縰sing BarCode.Web.Core.Dto; +using BarCode.Web.Core.Dto.Box; +using BarCode.Web.Core.Dto.Erp.Org; +using BarCode.Web.Core.Dto.Erp.Supplier; +using BarCode.Web.Core.Dto.Login; +using BarCode.Web.Core.Dto.SingleData; +using BarCode.Web.Core.Internal.Results; +using BarCode.Web.Domain.Entitys; +using BarCode.Web.Domain.Infrastructure; +using BarCode.Web.Domain.IService; +using BarCode.Web.Domain.IService.Public; +using BarCode.Web.Domain.Services.Public; +using BarCode.Web.Domain.Values; +using BarCode.Web.Domain.Values.Single; +using Microsoft.EntityFrameworkCore.Storage; +using Microsoft.Extensions.Logging; +using Newtonsoft.Json; +using Npoi.Mapper; +using NPOI.SS.Formula.Functions; +using System; +using System.Collections.Generic; +using System.ComponentModel.Design; +using System.Diagnostics; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BarCode.Web.Domain.Services +{ + /// + /// 绠变俊鎭 + /// + public class BoxService : IBoxService + { + private readonly ILogger _logger; + private IBasicsRepositories _transactionRepositories; + private readonly IBoxRepositories _boxRepositories; + private readonly ISingleDataService _singleDataService; + private readonly ISerialNumbersRepositories _serialNumbersRepositories; + private readonly IErpService _erpService; + private readonly IWmsService _wmsService; + private readonly ISerialNumberService _serialNumberService; + public BoxService(ILogger logger, IBasicsRepositories transactionRepositories, + IBoxRepositories boxRepositories, ISingleDataService singleDataService, ISerialNumbersRepositories serialNumbersRepositories, + IErpService erpService, IWmsService wmsService, ISerialNumberService serialNumberService) + { + _logger = logger; + _transactionRepositories = transactionRepositories; + _boxRepositories = boxRepositories; + _singleDataService = singleDataService; + _serialNumbersRepositories = serialNumbersRepositories; + _erpService = erpService; + _wmsService = wmsService; + _serialNumberService = serialNumberService; + } + /// + /// 鐢熸垚绠辩爜 + /// + /// + /// + /// + /// + public async Task Generate(GenerateBoxRequest dto, LoginInDto loginInfo) + { + _logger.LogInformation($"鐢熸垚绠辩爜:{JsonConvert.SerializeObject(dto)},鐢ㄦ埛:{loginInfo.UserInfo.Nickname}"); + string supplierCode = ""; + string orgCode = ""; + if (dto.OrgCode.Substring(0, 1).Equals("s")) + supplierCode = dto.OrgCode.Substring(2, dto.OrgCode.Length - 2); + else + orgCode = dto.OrgCode.Substring(2, dto.OrgCode.Length - 2); + + List boxs = new List(); + for (int i = 1; i <= dto.Number; i++) + { + Box b = new Box() + { + CreatorId = loginInfo.UserInfo.UcId, + OrgCode = orgCode, + SupplierCode = supplierCode, + CompanyId = loginInfo.UserInfo.CompanyId + }; + boxs.Add(b); + } + var res = await _boxRepositories.AddRange(boxs); + if (!res) return Result.ReFailure(ResultCodes.DateWriteError); + return Result.ReSuccess(); + } + /// + /// 瑁呯 + /// + /// + /// + /// + /// + public async Task Save(SaveBoxRequest dto, LoginInDto loginInfo) + { + _logger.LogInformation($"瑁呯:{JsonConvert.SerializeObject(dto)},鐢ㄦ埛:{loginInfo.UserInfo.Nickname}"); + var box = await _boxRepositories.Get(dto.BoxId); + if (box == null) + return Result.ReFailure(ResultCodes.NoDateError); + if (box.Status == BoxStatus.Complete) + return Result.ReFailure(ResultCodes.CartonCompleteError); + //鍘婚噸 + dto.Details = dto.Details.Distinct().ToList(); + var sAll = dto.Details.Select(s => s.SerialNumber).ToList(); + var serialNumberList = await _serialNumbersRepositories.GetEntityListContainNumber(sAll); + List serialList; + if (serialNumberList.Count() != sAll.Count()) + return Result.ReFailure(ResultCodes.SerialNumberNoDateError); + if (serialNumberList.Where(w => w.BoxId != 0 || w.IsUse == true).Any()) + return Result.ReFailure(ResultCodes.SerialNumberBindBox); + //鏂扮殑搴忓垪鍙蜂互瀛樺湪浜庣涓 + var bs = box.Details.SelectMany(s => s.SerialNumbers).ToList(); + var jj = sAll.Intersect(bs); + if (jj.Count() > 0) + return Result.ReFailure(ResultCodes.SerialNumberBindBox); + //瑁呯鐘舵 + var resCarton = box.Carton(dto.IsCarton, loginInfo.UserInfo.UcId); + if (!resCarton.IsSuccess) return resCarton; + + var materialNumbers = dto.Details.GroupBy(g => g.MaterialNumber).Select(s => s.Key).ToList(); + foreach (var m in materialNumbers) + { + var detail = box.Details.FirstOrDefault(f => f.MaterialNumber.Equals(m)); + var serialNumbers = dto.Details.Where(w => w.MaterialNumber.Equals(m)).Select(s => s.SerialNumber).ToList(); + if (detail == null) + { + detail = new BoxDetails() + { + MaterialNumber = m, + Qty = serialNumbers.Count(), + SerialNumbers = serialNumbers + }; + box.Details.Add(detail); + } + else + { + detail.Qty += serialNumbers.Count(); + detail.SerialNumbers.AddRange(serialNumbers); + } + } + IDbContextTransaction _transaction = _transactionRepositories.GetTransaction(); + bool res_Rollback = false; + bool isSuccess = true; + //瑁呯 + foreach (var d in dto.Details.Select(s => s.SerialNumber).Reverse()) + { + ////鍘熸潵鐨 + //var serial = serialNumberList.FirstOrDefault(f => f.SerialNumber.Equals(d) + //|| f.NumberCode.Equals(d)); + //if (serial == null) return Result.ReFailure(ResultCodes.SerialNumberNoDateError); + //serial.CompleteBox(box.Id, d); + ////鍘熸潵鐨勫埌姝 + + + serialList = await _serialNumbersRepositories.GetEntityListBySuitNumber(d); + + + if (serialList == null) return Result.ReFailure(ResultCodes.SerialNumberNoDateError); + if (serialList.Count == 0) return Result.ReFailure(ResultCodes.SerialNumberNoDateError); + + + + for (int i = 0; i < serialList.Count; i++) + { + if(serialList[i].SerialNumber.ToString() == d) + { + serialList[i].CompleteBox(box.Id, d); + } + else + { + serialList[i].CompleteBox(0, d); + } + + } + if (!res_Rollback) + { + isSuccess = await _serialNumbersRepositories.EditEntityList(serialList, false); + if (!isSuccess) res_Rollback = true; + } + + + } + + + var res = await _boxRepositories.Edit(box, false); + if (res == null) res_Rollback = true; + //if (!res_Rollback) + //{ + // isSuccess = await _serialNumbersRepositories.EditEntityList(serialNumberList, false); + // if (!isSuccess) res_Rollback = true; + //} + + + if (!res_Rollback) + { + var ids = serialNumberList.Select(s => s.GenerateRecordId).ToList(); + var resUse = await _serialNumberService.Use(ids); + if (!resUse.IsSuccess) res_Rollback = true; + } + //鎻愪氦浜嬪姟 + isSuccess = _transactionRepositories.CommitTransaction(res_Rollback, _transaction); + + if (res_Rollback || !isSuccess) + return Result.ReFailure(ResultCodes.DateWriteError); + return Result.ReSuccess(); + } + /// + /// 鎵撳嵃 + /// + /// + /// + /// + public async Task Print(OperateRequest dto) + { + var boxs = await _boxRepositories.GetEntityList(dto.Ids); + boxs.ForEach(f => f.Print()); + var res = await _boxRepositories.EditEntityList(boxs); + if (!res) return Result.ReFailure(ResultCodes.DateWriteError); + return Result.ReSuccess(); + } + /// + /// 鍒犻櫎 + /// + /// + /// + /// + public async Task Delete(DeleteBoxSerialNumberRequest dto, LoginInDto loginInfo) + { + _logger.LogInformation($"鍒犻櫎绠辩墿鏂:{JsonConvert.SerializeObject(dto)},鐢ㄦ埛:{loginInfo.UserInfo.Nickname}"); + var box = await _boxRepositories.Get(dto.BoxId); + if (box == null) + return Result.ReFailure(ResultCodes.BoxNoDataError); + if (box.Status == BoxStatus.Complete) + return Result.ReFailure(ResultCodes.CartonCompleteError); + + var sList = await _serialNumbersRepositories.GetEntityList(new List() { dto.SerialNumber }); + var s = sList.FirstOrDefault(f => f.SerialNumber.Equals(dto.SerialNumber)); + if (s == null) + return Result.ReFailure(ResultCodes.SerialNumberNoDateError); + //鍒ゆ柇浣跨敤鐨勬槸鏁板瓧搴忓垪鐮佽繕鏄簭鍒楃爜 + var sStr = s.IsUseNumber == true ? s.NumberCode : s.SerialNumber; + + var resUn = box.UnSerialNumber(sStr, dto.MaterialNumber); + if (!resUn.IsSuccess) return resUn; + + //var sList = await _serialNumbersRepositories.GetEntityListContainNumber(new List() { dto.SerialNumber }); + //sList.ForEach(f => f.UnBox()); + s.UnBox();//瑙g粦 + + IDbContextTransaction _transaction = _transactionRepositories.GetTransaction(); + bool res_Rollback = false; + bool isSuccess = true; + var res = await _boxRepositories.Edit(box, false); + if (res == null) res_Rollback = true; + if (!res_Rollback) + { + isSuccess = await _serialNumbersRepositories.EditEntityList(sList, false); + if (!isSuccess) res_Rollback = true; + } + if (!res_Rollback) + { + var ids = sList.Select(s => s.GenerateRecordId).ToList(); + var resUse = await _serialNumberService.Use(ids); + if (!resUse.IsSuccess) res_Rollback = true; + } + //鎻愪氦浜嬪姟 + isSuccess = _transactionRepositories.CommitTransaction(res_Rollback, _transaction); + + if (res_Rollback || !isSuccess) + return Result.ReFailure(ResultCodes.DateWriteError); + return Result.ReSuccess(); + } + /// + /// 娓呯┖瑁呯淇℃伅 + /// + /// + /// + /// + public async Task Clear(int boxId, LoginInDto loginInfo) + { + _logger.LogInformation($"娓呯┖瑁呯淇℃伅:{boxId},鐢ㄦ埛:{loginInfo.UserInfo.Nickname}"); + var box = await _boxRepositories.Get(boxId); + if (box == null) + return Result.ReFailure(ResultCodes.BoxNoDataError); + + var s = box.Details.SelectMany(s => s.SerialNumbers).ToList(); + box.Details.Clear(); + + IDbContextTransaction _transaction = _transactionRepositories.GetTransaction(); + bool res_Rollback = false; + bool isSuccess = true; + var sList = await _serialNumbersRepositories.GetEntityListByBoxIds(new List() { boxId }); + foreach (var f in sList) + { + if( f.IsTwo>1) + { + //璇存槑鏄袱浠惰鐨勪骇鍝侊紝閭d箞瑕佸垎鍒竻闄 + var sList2 = await _serialNumbersRepositories.GetEntityListBySuitNumber(f.SerialNumber); + for(int i=0;i f.UnBox()); + + + var res = await _boxRepositories.Edit(box, false); + if (res == null) res_Rollback = true; + if (!res_Rollback) + { + isSuccess = await _serialNumbersRepositories.EditEntityList(sList, false); + if (!isSuccess) res_Rollback = true; + } + if (!res_Rollback) + { + var ids = sList.Select(s => s.GenerateRecordId).ToList(); + var resUse = await _serialNumberService.Use(ids); + if (!resUse.IsSuccess) res_Rollback = true; + } + //鎻愪氦浜嬪姟 + isSuccess = _transactionRepositories.CommitTransaction(res_Rollback, _transaction); + + if (res_Rollback || !isSuccess) + return Result.ReFailure(ResultCodes.DateWriteError); + return Result.ReSuccess(); + } + /// + /// wms绯荤粺璋冪敤 鑾峰彇瀹屾垚瑁呯绠变俊鎭 + /// + /// + /// + /// + public async Task<(List list, int total)> GetCartonListAsync(WmsBoxRequest dto) + { + var org_result = await _erpService.BillQueryForOrg(); + List orgs = new List(); + if (org_result.IsSuccess) + orgs = org_result.Data.ToList(); + + var supplier_result = await _erpService.BillQueryForSupplier(); + List suppliers = new List(); + if (supplier_result.IsSuccess) + suppliers = supplier_result.Data.ToList(); + + var (list, count) = await _boxRepositories.GetEntityByWmsList(dto); + var ids = list.Select(s => s.Id).ToList(); + var serialList = await _serialNumbersRepositories.GetEntityListByBoxIds(ids); + List response = new List(); + foreach (var box in list) + { + WmsBoxResponse res = new WmsBoxResponse() + { + BoxBillNo = box.BoxBillNo, + OpsBoxId = box.Id, + CompleteCartonTime = box.CartonEndTime ?? DateTime.Now, + CompleteCartonUser = _singleDataService.GetSingleData(SingleAction.Users, box.CompanyId, box.CartonUserId), + CreateTime = box.CreateTime, + OrgId = orgs.FirstOrDefault(f => f.Number.Equals(box.OrgCode))?.Id ?? 0, + SupplierId = suppliers.FirstOrDefault(f => f.Number.Equals(box.SupplierCode))?.Id ?? 0, + CreateUser = _singleDataService.GetSingleData(SingleAction.Users, box.CompanyId, box.CreatorId), + }; + + foreach (var bd in box.Details) + { + //var bdsList = serialList.Where(w => w.BoxId == box.Id && w.MaterialNumber.Equals(bd.MaterialNumber)).ToList(); + var bdsList = bd.SerialNumbers; + List sList = new List(); + foreach (var s in bdsList) + { + var sentity = serialList.FirstOrDefault(f => f.SerialNumber.Equals(s) || f.NumberCode.Equals(s)); + sList.Add(new Core.Dto.Box.OpsSerialNumbersResponse() + { + SerialNumber = s, + BarCereateUser = _singleDataService.GetSingleData(SingleAction.Users, box.CompanyId, sentity == null ? 0 : sentity.CreatorId), + BarCreateTime = sentity == null ? null : sentity.CreateTime + }); + } + Core.Dto.Box.OpsBoxDetailsResponse Detail = new Core.Dto.Box.OpsBoxDetailsResponse() + { + MaterialNumber = bd.MaterialNumber, + Qty = bd.Qty, + SerialNumbers = sList + }; + res.Details.Add(Detail); + } + + response.Add(res); + } + return (response, count); + } + /// + /// 閲嶆柊瑁呯 + /// + /// + /// + /// + public async Task Restart(OperateRequest dto, LoginInDto loginInfo) + { + _logger.LogInformation($"閲嶆柊瑁呯鐨勭:{JsonConvert.SerializeObject(dto.Ids)} 鎿嶄綔浜:{loginInfo.UserInfo.Nickname}"); + var boxList = await _boxRepositories.GetEntityList(dto.Ids); + if (boxList.Where(w => w.Status != BoxStatus.Complete).Any()) + return Result.ReFailure(ResultCodes.BoxNoComplete); + var nos = boxList.Select(s => s.BoxBillNo).ToList(); + + List failBox = new List(); + var res = await _wmsService.Restart(nos); + if (!res.IsSuccess) + return res; + //宸叉敹璐х殑绠辫繑鍥炲湪鏁版嵁閲屽甫杩囨潵 + failBox = res.Data; + //鎶婂凡鏀惰揣鐨勭鎺掗櫎鍑哄幓 鐒跺悗閲嶇疆 + boxList.Where(w => !failBox.Contains(w.BoxBillNo)).ForEach(f => f.Restart()); + var isSuccess = await _boxRepositories.EditEntityList(boxList); + if (!isSuccess) return Result.ReFailure(ResultCodes.DateWriteError); + if (failBox.Count() > 0) + { + return Result.ReFailure($"绠卞彿:{string.Join(",", failBox)} 宸叉敹璐,涓嶅厑璁搁噸鏂拌绠,璇峰拰浠撳簱浜哄憳娌熼", 3433535); + } + + return Result.ReSuccess(); + } + /// + /// 寮濮嬭绠 + /// + /// + /// + /// + public async Task BeginCarton(int boxId, LoginInDto loginInfo) + { + _logger.LogInformation($"寮濮嬭绠:{boxId},鐢ㄦ埛:{loginInfo.UserInfo.Nickname}"); + var box = await _boxRepositories.Get(boxId); + if (box == null) + return Result.ReFailure(ResultCodes.BoxNoDataError); + if (box.Status == BoxStatus.Complete) + return Result.ReFailure(ResultCodes.CartonCompleteError); + var res = box.BeginCarton(loginInfo.UserInfo.UcId); + if (!res.IsSuccess) + return res; + var res_box = await _boxRepositories.Edit(box, true); + if (res_box == null) return Result.ReFailure(ResultCodes.DateWriteError); + return Result.ReSuccess(); + } + } +} diff --git a/src/BarCode.Web.Domain/Services/ExportExcelService.cs b/src/BarCode.Web.Domain/Services/ExportExcelService.cs new file mode 100644 index 0000000..4424253 --- /dev/null +++ b/src/BarCode.Web.Domain/Services/ExportExcelService.cs @@ -0,0 +1,229 @@ +锘 +using System; +using System.Collections.Generic; +using System.Text; +using System.Threading.Tasks; +using Npoi.Mapper; +using System.IO; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Logging; +using Microsoft.Extensions.Options; +using BarCode.Web.Domain.IService; +using BarCode.Web.Domain.Options; +using BarCode.Web.Domain.Entitys; +using BarCode.Web.Domain.Values; +using BarCode.Web.Domain.Infrastructure; +using BarCode.Web.Core.Dto; +using BarCode.Web.Core.Dto.Login; + +namespace BarCode.Web.Domain.Services +{ + public class ExportExcelService : IExportExcelService + { + private readonly IQiniuUploadService _qiniuUploadService; + private readonly IServiceScopeFactory _serviceScopeFactory; + private readonly ILogger _logger; + private readonly QiniuOptions _option; + public ExportExcelService(IQiniuUploadService qiniuUploadService, IServiceScopeFactory serviceScopeFactory, + ILogger logger, IOptions option) + { + _qiniuUploadService = qiniuUploadService; + _serviceScopeFactory = serviceScopeFactory; + _logger = logger; + _option = option?.Value; + } + /// + /// 鍒楄〃椤靛鍑 + /// + /// + /// + /// + /// + /// + /// + /// + /// + public async Task Export(List dataList, string fileName, int userId, LoginInDto loginInfo, FileDownLoadOrderType type, string orgCode, Mapper mapper = null, int? supplierId = null) + { + FileDownManager entity = new FileDownManager(userId, loginInfo.UserInfo.CompanyId, type,orgCode, _option.Url + fileName, loginInfo.UserInfo.SupplierCode); + using (var scope = _serviceScopeFactory.CreateScope()) + { + var _fileDownManagerService = scope.ServiceProvider.GetRequiredService(); + entity = await _fileDownManagerService.Add(entity); + List> listz = new List>(); + listz.Add(dataList); + + string msg = await Upload(listz, fileName, userId, type); + + entity.Finish(string.IsNullOrEmpty(msg) == true ? true : false, msg); + await _fileDownManagerService.Edit(entity); + return; + } + } + /// + /// 鍏ㄥ瓧娈靛鍑 + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + public Task ExportAll(Request request, string fileName, int userId, LoginInDto loginInfo, FileDownLoadOrderType type, string orgCode, Mapper mapper = null, int? supplierId = null) where Request : PaginationBaseRequestDto + { + return Task.CompletedTask; + //FileDownManager entity = new FileDownManager(userId, companyId, type, _option.Url + fileName, supplierId); + + //request.PageNo = 1; + //request.PageSize = _option.PageSize; + //List> listz = new List>(); + //string msg = ""; + //using (var scope = _serviceScopeFactory.CreateScope()) + //{ + // var _fileDownManagerService = scope.ServiceProvider.GetRequiredService(); + // entity = await _fileDownManagerService.Add(entity); + // try + // { + // var _service = scope.ServiceProvider.GetRequiredService>(); + // _logger.LogInformation($"{DateTime.Now}--寮濮嬭闂暟鎹"); + // var (obj, total) = await _service.GetListAllField(request, companyId); + // var list = (List)obj; + // var page = Math.Ceiling(Convert.ToDecimal(total) / _option.PageSize); + + // listz.Add(list); + // for (int i = 1; i < page; i++) + // { + // request.PageNo++; + // var (obj_f, total_f) = await _service.GetListAllField(request, companyId); + // var list_f = (List)obj_f; + // listz.Add(list_f); + // } + // _logger.LogInformation($"{DateTime.Now}--璁块棶鏁版嵁鎴愬姛 鎬绘暟:{total}"); + // } + // catch (Exception ex) + // { + // msg = $"鏈壘鍒版暟鎹 {ex.ToString()}"; + // _logger.LogError($"瀵煎嚭寮傚父:{ex.ToString()}"); + // } + + // if (!string.IsNullOrEmpty(msg)) + // { + // entity.Finish(false, msg); + // await _fileDownManagerService.Edit(entity); + // return; + // } + + // msg = await Upload(listz, fileName, userId, type); + + // entity.Finish(string.IsNullOrEmpty(msg) == true ? true : false, msg); + // await _fileDownManagerService.Edit(entity); + // return; + //} + } + + public async Task ExportList(Request request, string fileName, int userId, LoginInDto loginInfo, FileDownLoadOrderType type, string orgCode, Mapper mapper = null, int? supplierId = null) where Request : PaginationBaseRequestDto + { + FileDownManager entity = new FileDownManager(userId, loginInfo.UserInfo.CompanyId, type,orgCode, _option.Url + fileName, loginInfo.UserInfo.SupplierCode); + + request.PageNo = 1; + request.PageSize = _option.PageSize; + List> listz = new List>(); + string msg = ""; + using (var scope = _serviceScopeFactory.CreateScope()) + { + var _fileDownManagerService = scope.ServiceProvider.GetRequiredService(); + entity = await _fileDownManagerService.Add(entity); + try + { + var _service = scope.ServiceProvider.GetRequiredService>(); + _logger.LogInformation($"{DateTime.Now}--寮濮嬭闂暟鎹"); + var (obj, total) = await _service.GetListField(request, loginInfo); + var list = (List)obj; + var page = Math.Ceiling(Convert.ToDecimal(total) / _option.PageSize); + + listz.Add(list); + for (int i = 1; i < page; i++) + { + request.PageNo++; + var (obj_f, total_f) = await _service.GetListField(request, loginInfo); + var list_f = (List)obj_f; + listz.Add(list_f); + } + _logger.LogInformation($"{DateTime.Now}--璁块棶鏁版嵁鎴愬姛 鎬绘暟:{total}"); + } + catch (Exception ex) + { + msg = "鏈壘鍒版暟鎹"; + _logger.LogError($"瀵煎嚭鏁版嵁鏌ヨ寮傚父 {ex.ToString()}"); + } + + if (listz.Count <= 0) + { + entity.Finish(false, msg); + await _fileDownManagerService.Edit(entity); + return; + } + + msg = await Upload(listz, fileName, userId, type); + + entity.Finish(string.IsNullOrEmpty(msg) == true ? true : false, msg); + await _fileDownManagerService.Edit(entity); + return; + } + } + + private async Task Upload(List> dataList, string fileName, int userId, FileDownLoadOrderType type, Mapper mapper = null) + { + if (mapper == null) + mapper = new Mapper(); + + //绗竴涓弬鏁颁负瀵煎嚭Excel鍚嶇О + //绗簩涓弬鏁颁负Excel鏁版嵁鏉ユ簮 + //绗笁涓弬鏁颁负瀵煎嚭鐨凷heet鍚嶇О + //overwrite鍙傛暟濡傛灉鏄瑕嗙洊宸插瓨鍦ㄧ殑Excel鎴栬呮柊寤篍xcel鍒欎负true锛屽鏋滃湪鍘熸湁Excel涓婅拷鍔犳暟鎹垯涓篺alse + //xlsx鍙傛暟鏄敤浜庡尯鍒嗗鍑虹殑鏁版嵁鏍煎紡涓簒lsx杩樻槸xls + MemoryStream stream = new MemoryStream(); + try + { + for (int i = 0; i < dataList.Count; i++) + { + mapper.Put(dataList[i], "sheet" + (i + 1), true); + } + mapper.Save(stream); + } + catch (Exception) + { + return "鏁版嵁瀵煎叆Execl寮傚父"; + } + + + //mapper.Save(stream, dataList, "sheet1", overwrite: true, xlsx: true); + //锛屼絾鏄繖閲屼篃韪╁埌浜嗕竴涓潙锛屼笉杩囪繖涓槸 Npoi 鐨勫潙骞朵笉鏄 Npoi.Mapper 鐨勫潙锛 + // 閭e氨鏄 Workbook.Write(stream)鐨勬椂鍊欎細灏 stream 鍏抽棴锛屽鏋滅户缁搷浣滆繖涓 Stream 浼氭姤娴佸凡鍏抽棴鐨勯敊璇 + //鎵浠ヨ繖閲 鏄妸娴佸厛杞垚byte[] 鍐嶈浆鍥炰娇鐢ㄧ殑娴 + try + { + var middleByte = stream.ToArray(); + using (MemoryStream streamUpload = new MemoryStream(middleByte)) + { + var res = await _qiniuUploadService.Upload(fileName, streamUpload, true); + if (!res.Success) + { + _logger.LogError($"{DateTime.Now}--涓婁紶鍗冪墰浜戝け璐 鍘熷洜:{res.Message}"); + return res.Message; + } + } + } + catch (Exception) + { + return "鏁版嵁涓婁紶浜戠寮傚父"; + } + + _logger.LogInformation($"{DateTime.Now}--瀵煎嚭鎴愬姛"); + return ""; + } + } +} diff --git a/src/BarCode.Web.Domain/Services/Public/ErpBaseDataSync.cs b/src/BarCode.Web.Domain/Services/Public/ErpBaseDataSync.cs new file mode 100644 index 0000000..0f6a55b --- /dev/null +++ b/src/BarCode.Web.Domain/Services/Public/ErpBaseDataSync.cs @@ -0,0 +1,83 @@ +锘縰sing Microsoft.Extensions.DependencyInjection; +using System; +using System.Collections.Generic; +using System.Text; +using System.Threading.Tasks; +using BarCode.Web.Domain.IService.Public; + +namespace BarCode.Web.Domain.Services.Public +{ + /// + /// 鍚屾erp鍩虹鏁版嵁 + /// + public static class ErpBaseDataSync + { + public static Task Sync(IServiceProvider serviceProvider) + { + var sercice = serviceProvider.GetRequiredService(); + //Task.Run(() => + //{ + // //寮傛-鍚屾涓嬬墿鏂欐暟鎹 + // sercice.BillQueryForMaterial().GetAwaiter().GetResult(); + //}); + + Task.Run(() => + { + //寮傛-鍚屾涓嬬粍缁囨暟鎹 + sercice.BillQueryForOrg().GetAwaiter().GetResult(); + }); + + Task.Run(() => + { + //寮傛-鍚屾涓嬪鎴锋暟鎹 + sercice.BillQueryForCustomer().GetAwaiter().GetResult(); + }); + + Task.Run(() => + { + //寮傛-鍚屾涓嬩緵搴斿晢鏁版嵁 + sercice.BillQueryForSupplier().GetAwaiter().GetResult(); + + }); + return Task.CompletedTask; + } + + public static Task SyncMaterial(IErpService sercice) + { + Task.Run(() => + { + //寮傛-鍚屾涓嬬墿鏂欐暟鎹 + sercice.BillQueryForMaterial().GetAwaiter().GetResult(); + }); + return Task.CompletedTask; + } + public static Task SyncOrg(IErpService sercice) + { + Task.Run(() => + { + //寮傛-鍚屾涓嬬粍缁囨暟鎹 + sercice.BillQueryForOrg().GetAwaiter().GetResult(); + }); + return Task.CompletedTask; + } + public static Task SyncCustomer(IErpService sercice) + { + Task.Run(() => + { + //寮傛-鍚屾涓嬪鎴锋暟鎹 + sercice.BillQueryForCustomer().GetAwaiter().GetResult(); + }); + return Task.CompletedTask; + } + public static Task SyncSupplier(IErpService sercice) + { + Task.Run(() => + { + //寮傛-鍚屾涓嬩緵搴斿晢鏁版嵁 + sercice.BillQueryForSupplier().GetAwaiter().GetResult(); + + }); + return Task.CompletedTask; + } + } +} diff --git a/src/BarCode.Web.Domain/Services/Public/ErpBasicDataExtendService.cs b/src/BarCode.Web.Domain/Services/Public/ErpBasicDataExtendService.cs new file mode 100644 index 0000000..d587a18 --- /dev/null +++ b/src/BarCode.Web.Domain/Services/Public/ErpBasicDataExtendService.cs @@ -0,0 +1,442 @@ +锘縰sing AutoMapper; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using BarCode.Web.Core.Dto.Erp; +using BarCode.Web.Core.Dto.Erp.Customer; +using BarCode.Web.Core.Dto.Erp.Org; +using BarCode.Web.Core.Dto.Erp.Supplier; +using BarCode.Web.Domain.Infrastructure; +using BarCode.Web.Domain.IService.Public; +using BarCode.Web.Core.Dto.SingleData; + +namespace BarCode.Web.Domain.Services.Public +{ + /// + /// erp鍩虹鏁版嵁锛氭墿灞曟湇鍔 + /// + public class ErpBasicDataExtendService: IErpBasicDataExtendService + { + private readonly IMapper _mapper; + private readonly IErpService _erpService; + private readonly ILoginService _loginService; + private readonly IBasicsRepositories _basicsRepositories; + + public ErpBasicDataExtendService(IMapper mapper, ILoginService loginService, IErpService erpService, + IBasicsRepositories basicsRepositories) + { + _mapper = mapper; + _erpService = erpService; + _loginService = loginService; + _basicsRepositories = basicsRepositories; + + } + + /// + /// 鑾峰彇鐗╂枡鍚嶇О + /// + /// + /// + /// + public string GetMaterialName(List erpMaterials,int materialId) + { + if (erpMaterials == null || erpMaterials.Count == 0) + return ""; + + var mat= erpMaterials.Where(x => x.MaterialId == materialId).FirstOrDefault(); + if (mat == null) + { + var result= _erpService.BillQueryForMaterial(materialId).GetAwaiter().GetResult(); + + if (!result.IsSuccess) + return ""; + return result.Data == null ? "" : result.Data.MaterialName; + } + return mat.MaterialName; + } + + /// + /// 鑾峰彇鐗╂枡缂栫爜 + /// + /// + /// + /// + public string GetMaterialNumber(List erpMaterials, int materialId) + { + if (erpMaterials == null || erpMaterials.Count == 0) + return ""; + var mat = erpMaterials.Where(x => x.MaterialId == materialId).FirstOrDefault(); + if (mat == null) + { + var result = _erpService.BillQueryForMaterial(materialId).GetAwaiter().GetResult(); + if (!result.IsSuccess) + return ""; + return result.Data == null ? "" : result.Data.MaterialNumber; + } + return mat.MaterialNumber; + } + + /// + /// 鑾峰彇鐗╂枡瑙勬牸鍨嬪彿 + /// + /// + /// + /// + public string GetMaterialSpecifications(List erpMaterials, int materialId) + { + if (erpMaterials == null || erpMaterials.Count == 0) + return ""; + var mat = erpMaterials.Where(x => x.MaterialId == materialId).FirstOrDefault(); + if (mat == null) + { + var result = _erpService.BillQueryForMaterial(materialId).GetAwaiter().GetResult(); + if (!result.IsSuccess) + return ""; + return result.Data == null ? "" : result.Data.Specifications; + } + return mat.Specifications; + } + + /// + /// 鑾峰彇鐗╂枡鍚嶇О + /// + /// + /// + /// + public string GetMaterialName(List erpMaterials, string materialNumber) + { + if (string.IsNullOrEmpty(materialNumber)) return ""; + if (erpMaterials == null || erpMaterials.Count == 0) + return ""; + + var mat = erpMaterials.Where(x => x.MaterialNumber == materialNumber).FirstOrDefault(); + if (mat == null) + { + var result = _erpService.BillQueryForMaterial(materialNumber).GetAwaiter().GetResult(); + + if (!result.IsSuccess) + return ""; + return result.Data == null ? "" : result.Data.MaterialName; + } + return mat.MaterialName; + } + /// + /// 鑾峰彇鐗╂枡缂栫爜 + /// + /// + /// + /// + public string GetMaterialSpecifications(List erpMaterials, string materialNumber) + { + if (string.IsNullOrEmpty(materialNumber)) return ""; + if (erpMaterials == null || erpMaterials.Count == 0) + return ""; + var mat = erpMaterials.Where(x => x.MaterialNumber == materialNumber).FirstOrDefault(); + if (mat == null) + { + var result = _erpService.BillQueryForMaterial(materialNumber).GetAwaiter().GetResult(); + if (!result.IsSuccess) + return ""; + return result.Data == null ? "" : result.Data.Specifications; + } + return mat.Specifications; + } + + + /// + /// 鑾峰彇鐗╂枡鍩烘湰鍗曚綅鍚嶇О + /// + /// + /// + /// + public string GetMaterialUnitName(List erpMaterials, int materialId) + { + if (erpMaterials == null || erpMaterials.Count == 0) + return ""; + var mat = erpMaterials.Where(x => x.MaterialId == materialId).FirstOrDefault(); + if (mat == null) + { + var result = _erpService.BillQueryForMaterial(materialId).GetAwaiter().GetResult(); + if (!result.IsSuccess) + return ""; + return result.Data == null ? "" : result.Data.BaseUnitName; + } + return mat.BaseUnitName; + } + /// + /// 鑾峰彇鐗╂枡鍩烘湰鍗曚綅鍚嶇О + /// + /// + /// + /// + public string GetMaterialUnitName(List erpMaterials, string materialNumber) + { + if (erpMaterials == null || erpMaterials.Count == 0) + return ""; + var mat = erpMaterials.Where(x => x.MaterialNumber == materialNumber).FirstOrDefault(); + if (mat == null) + { + var result = _erpService.BillQueryForMaterial(materialNumber).GetAwaiter().GetResult(); + if (!result.IsSuccess) + return ""; + return result.Data == null ? "" : result.Data.BaseUnitName; + } + return mat.BaseUnitName; + } + + /// + /// 鑾峰彇鐗╂枡鐨勬潯鐮 + /// + /// + /// + /// + public string GetMaterialBarCode(List erpMaterials, int materialId) + { + if (erpMaterials == null || erpMaterials.Count == 0) + return ""; + var mat = erpMaterials.Where(x => x.MaterialId == materialId).FirstOrDefault(); + if (mat == null) + { + var result = _erpService.BillQueryForMaterial(materialId).GetAwaiter().GetResult(); + if (!result.IsSuccess) + return ""; + return result.Data == null ? "" : result.Data.BarCode; + } + return mat.BarCode; + } + + /// + /// 鑾峰彇鐗╂枡鐨勬潯鐮 + /// + /// + /// + /// + public string GetMaterialBarCode(List erpMaterials, string materialNumber) + { + if (string.IsNullOrEmpty(materialNumber)) return ""; + if (erpMaterials == null || erpMaterials.Count == 0) + return ""; + var mat = erpMaterials.Where(x => x.MaterialNumber == materialNumber).FirstOrDefault(); + if (mat == null) + { + var result = _erpService.BillQueryForMaterial(materialNumber).GetAwaiter().GetResult(); + if (!result.IsSuccess) + return ""; + return result.Data == null ? "" : result.Data.BarCode; + } + return mat.BarCode; + } + + /// + /// 鑾峰彇鐗╂枡鍩烘湰鍗曚綅Id + /// + /// + /// + /// + public int GetMaterialUnitId(List erpMaterials, int materialId) + { + if (erpMaterials == null || erpMaterials.Count == 0) + return 0; + var mat = erpMaterials.Where(x => x.MaterialId == materialId).FirstOrDefault(); + if (mat == null) + { + var result = _erpService.BillQueryForMaterial(materialId).GetAwaiter().GetResult(); + if (!result.IsSuccess) + return 0; + return result.Data == null ? 0 : result.Data.BaseUnitId; + } + return mat.BaseUnitId; + } + /// + /// 鑾峰彇鐗╂枡鍩烘湰鍗曚綅缂栫爜 + /// + /// + /// + /// + public string GetMaterialUnitNumber(List erpMaterials, int materialId) + { + if (erpMaterials == null || erpMaterials.Count == 0) + return ""; + var mat = erpMaterials.Where(x => x.MaterialId == materialId).FirstOrDefault(); + if (mat == null) + { + var result = _erpService.BillQueryForMaterial(materialId).GetAwaiter().GetResult(); + if (!result.IsSuccess) + return ""; + return result.Data == null ? "" : result.Data.BaseUnitNumber; + } + return mat.BaseUnitNumber; + } + /// + /// 鑾峰彇鐗╂枡鍩烘湰鍗曚綅缂栫爜 + /// + /// + /// + /// + public string GetMaterialUnitNumber(List erpMaterials, string materialNumber) + { + if (erpMaterials == null || erpMaterials.Count == 0) + return ""; + var mat = erpMaterials.Where(x => x.MaterialNumber == materialNumber).FirstOrDefault(); + if (mat == null) + { + var result = _erpService.BillQueryForMaterial(materialNumber).GetAwaiter().GetResult(); + if (!result.IsSuccess) + return ""; + return result.Data == null ? "" : result.Data.BaseUnitNumber; + } + return mat.BaseUnitNumber; + } + /// + /// 鑾峰彇缁勭粐鍚嶇О + /// + /// + /// + /// + public string GetOrgName(List erpOrgs, int orgId) + { + if (erpOrgs == null || erpOrgs.Count == 0) + return ""; + var org = erpOrgs.Where(x => x.Id == orgId).FirstOrDefault(); + return org == null ? "" : org.Name; + } + + /// + /// 鑾峰彇缁勭粐鍚嶇О + /// + /// + /// + /// + public string GetOrgName(List erpOrgs, string orgCode) + { + if (erpOrgs == null || erpOrgs.Count == 0) + return ""; + var org = erpOrgs.Where(x => x.Number == orgCode).FirstOrDefault(); + return org == null ? "" : org.Name; + } + + /// + /// 鑾峰彇缁勭粐id + /// + /// + /// + /// + public int GetOrgId(List erpOrgs, string orgCode) + { + if (erpOrgs == null || erpOrgs.Count == 0) + return 0; + var org = erpOrgs.Where(x => x.Number == orgCode).FirstOrDefault(); + return org == null ? 0 : org.Id; + } + + /// + /// 鑾峰彇渚涘簲鍟嗗悕绉 + /// + /// + /// + /// + public string GetSupplierName(List erpSuppliers, int supplierId) + { + if (erpSuppliers == null || erpSuppliers.Count == 0) + return ""; + var supplier = erpSuppliers.Where(x => x.Id == supplierId).FirstOrDefault(); + return supplier == null ? "" : supplier.Name; + } + /// + /// 鑾峰彇渚涘簲鍟嗗悕绉 + /// + /// + /// + /// + public string GetSupplierName(List erpSuppliers, string supplierCode) + { + if (erpSuppliers == null || erpSuppliers.Count == 0) + return ""; + var supplier = erpSuppliers.Where(x => x.Number.Equals(supplierCode)).FirstOrDefault(); + return supplier == null ? "" : supplier.Name; + } + /// + /// 鑾峰彇瀹㈡埛鍚嶇О + /// + /// + /// + /// + public string GetCustomerName(List erpCustomers, int customerId) + { + if (erpCustomers == null || erpCustomers.Count == 0) + return ""; + var supplier = erpCustomers.Where(x => x.Id == customerId).FirstOrDefault(); + return supplier == null ? "" : supplier.Name; + } + + /// + /// 鑾峰彇浠撳簱鍚嶇О + /// + /// + /// + /// + public string GetStockName(List erpStocks, int stockId) + { + if (erpStocks == null || erpStocks.Count == 0) + return ""; + var stock = erpStocks.Where(x => x.Id == stockId).FirstOrDefault(); + return stock == null ? "" : stock.Name; + } + + /// + /// 鑾峰彇浠撳簱鍚嶇О + /// + /// + /// + /// + public string GetStockName(List erpStocks, string code) + { + if (erpStocks == null || erpStocks.Count == 0) + return ""; + var stock = erpStocks.Where(x => x.Code == code).FirstOrDefault(); + return stock == null ? "" : stock.Name; + } + + /// + /// 鑾峰彇浠撳簱缂栫爜 + /// + /// + /// + /// + public string GetStockCode(List erpStocks, int stockId) + { + if (erpStocks == null || erpStocks.Count == 0) + return ""; + var stock = erpStocks.Where(x => x.Id == stockId).FirstOrDefault(); + return stock == null ? "" : stock.Code; + } + /// + /// 瀛愪粨搴 + /// + /// + /// + /// + public string GetSubStockName(List erpStocks, string code) + { + if (erpStocks == null || erpStocks.Count == 0) + return ""; + var stock = erpStocks.Where(x => x.Code == code).FirstOrDefault(); + return stock == null ? "" : stock.Name; + } + /// + /// 鑾峰彇鍗曠偣缁勭粐鍚嶅瓧 + /// + /// + /// + /// + /// + public string GetSingleOrgName(List orgs, string code) + { + if (orgs == null || orgs.Count == 0) + return ""; + var org = orgs.Where(x => x.ErpOrgCode == code).FirstOrDefault(); + return org == null ? "" : org.Name; + } + } +} diff --git a/src/BarCode.Web.Domain/Services/Public/ErpService.cs b/src/BarCode.Web.Domain/Services/Public/ErpService.cs new file mode 100644 index 0000000..18f33bb --- /dev/null +++ b/src/BarCode.Web.Domain/Services/Public/ErpService.cs @@ -0,0 +1,1207 @@ +锘縰sing AutoMapper; +using ERP; +using Microsoft.EntityFrameworkCore.Storage; +using Microsoft.Extensions.Caching.Memory; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Logging; +using Microsoft.Extensions.Options; +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; +using System; +using System.Collections.Generic; +using System.Linq; +using System.ServiceModel; +using System.Text; +using System.Threading.Tasks; +using BarCode.Web.Core.Dto.Erp; +using BarCode.Web.Core.Dto.Erp.Customer; +using BarCode.Web.Core.Dto.Erp.Org; +using BarCode.Web.Core.Dto.Erp.OutStock; +using BarCode.Web.Core.Dto.Erp.Supplier; +using BarCode.Web.Core.Dto.Erp.TakeStock; +using BarCode.Web.Core.Help; +using BarCode.Web.Core.Internal.Results; +using BarCode.Web.Domain.Entitys; +using BarCode.Web.Domain.Infrastructure; +using BarCode.Web.Domain.IService.Public; +using BarCode.Web.Domain.Options; +using BarCode.Web.Domain.Values; +using BarCode.Web.Domain.Values.Erp; +using BarCode.Web.Domain.Values.Single; +using System.Text.Json.Nodes; +using Quartz.Logging; +using NPOI.SS.UserModel; + +namespace BarCode.Web.Domain.Services.Public +{ + /// + /// erp鏁版嵁浜や簰鏈嶅姟 + /// + public class ErpService : IErpService + { + private IMapper _mapper; + private AppOptions _appOptions; + private ErpOptions _erpOptions; + private ILogger _logger; + private ERPGWSoapClient _client; + private readonly IMemoryCache _memoryCache; + private readonly IBasicsRepositories _basicsRepositories; + private readonly IMaterialsRepositories _materialsRepositories; + private readonly IServiceProvider _serviceProvider; + public ErpService( + IMapper mapper, + IOptions erpOptions, + IOptions appOptions, IServiceProvider serviceProvider, + ILogger logger, IMaterialsRepositories materialsRepositories, + IMemoryCache memoryCache, IBasicsRepositories basicsRepositories) + { + _serviceProvider = serviceProvider; + this._materialsRepositories = materialsRepositories; + this._basicsRepositories = basicsRepositories; + this._erpOptions = erpOptions?.Value; + this._appOptions = appOptions?.Value; + this._mapper = mapper; + this._logger = logger; + this._memoryCache = memoryCache; + } + + /// + /// 鍒濆鍖朎RP锛氱櫥褰曞埌ERP + /// + /// + public async Task> Init() + { + BasicHttpBinding binding = new BasicHttpBinding(); + binding.MaxReceivedMessageSize = int.MaxValue; + binding.SendTimeout = new TimeSpan(int.MaxValue); + EndpointAddress address = new EndpointAddress(this._erpOptions.EndpointAddress); + this._client = new ERPGWSoapClient(binding, address); + try + { + var result = await this._client.ValidateSystemAsync(this._erpOptions.UserName, this._erpOptions.Password, this._erpOptions.ErpId, ""); + if (result == null || result.AccessToken == null) + { + _logger.LogError($"閲戣澏Token鑾峰彇澶辫触: {result?.Message}"); + return Result.ReFailure(ResultCodes.Erp_Login_Error); + } + return Result.ReSuccess(result.AccessToken); + } + catch (Exception ex) + { + _logger.LogError($"閲戣澏Token鑾峰彇寮傚父: {ex.Message}"); + return Result.ReFailure(ResultCodes.Erp_Login_Error); + } + } + + public async Task> Init1() + { + BasicHttpBinding binding = new BasicHttpBinding(); + binding.MaxReceivedMessageSize = int.MaxValue; + binding.SendTimeout = new TimeSpan(int.MaxValue); + EndpointAddress address = new EndpointAddress(this._erpOptions.EndpointAddress); + this._client = new ERPGWSoapClient(binding, address); + try + { + var result = await this._client.ValidateSystemAsync(this._erpOptions.UserName, this._erpOptions.Password, "Orico", ""); + if (result == null) + return Result.ReFailure(ResultCodes.Erp_Login_Error); + return Result.ReSuccess(result.AccessToken); + } + catch (Exception ex) + { + return Result.ReFailure(ResultCodes.Erp_Login_Error); + } + } + + /// + /// 鏌ュ崟鎹被鍨嬬殑鍊 + /// + /// + public async Task> BillQueryForBillType() + { + try + { + //1.鍏堢櫥褰曢噾铦-鎷垮埌token + var token_result = await this.Init1(); + if (!token_result.IsSuccess) + return ResultList.ReFailure(token_result); + + //2.鏃堕棿鏉′欢锛氬彲鑳借繕鏈夊叾瀹冩潯浠 + var beginTime = DateTime.Now.AddDays(-2).ToString("yyyy-MM-dd 00:00:00"); + var endTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); + //3.鑾峰彇閲戣澏閲囪喘璁㈠崟锛氭嫾鎺ュ弬鏁板拰鏉′欢 + var query = new ErpBillQueryDto(token_result.Data); + var param = new ErpBillQueryParamDto("BOS_BillType"); + param.FieldKeys = "FBILLTYPEID,FNumber,FName"; + param.Limit = 10000; + param.FilterString = ""; + query.Data = JsonConvert.SerializeObject(param); + var json = JsonConvert.SerializeObject(query); + + //4.璇锋眰鏌ヨ鎺ュ彛 + var result_json = await _client.ExecuteBillQueryAsync(json); + var result = JsonConvert.DeserializeObject>>(result_json); + + //5.杩斿洖鏁版嵁鐨勭粍瑁 + var erp_list = new List(); + foreach (var item in result) + { + var lis = new ErpBaseDto(); + lis.Id = item[0]; + lis.Number = item[1]; + lis.Name = item[2]; + + erp_list.Add(lis); + } + return ResultList.ReSuccess(erp_list); + } + catch (Exception ex) + { + return ResultList.ReFailure(ResultCodes.Erp_BillQuery_Error); + } + } + + /// + /// erp:鍗曟嵁鏌ヨ-鐗╂枡闆嗗悎 + /// + /// + public async Task> BillQueryForMaterial(bool isCache = true) + { + try + { + if (isCache) + { + //1.鑾峰彇缂撳瓨涓殑鐗╂枡鏁版嵁锛 + var materials = _memoryCache.Get>(_erpOptions.cache_materail_key); + if (materials == null || materials.Count == 0) + { + var mats = await _materialsRepositories.GetEntityList(); + if (mats == null || mats.Count == 0) + return await this.BillQueryForMaterialPagedList(); + else + { + var beginTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"); + _logger.LogInformation($"鐗╂枡鎷夊彇-寮濮嬫椂闂达細{beginTime}"); + //缁勮dto + var erp_materials_list = mats.Select(x => _mapper.Map(x)).ToList(); + _memoryCache.Set(_erpOptions.cache_materail_key, erp_materials_list, new MemoryCacheEntryOptions().SetAbsoluteExpiration(TimeSpan.FromMinutes(DateTimeUtil.GetTotalMinutesTimeSpan()))); + var endTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"); + _logger.LogInformation($"鐗╂枡鎷夊彇-缁撴潫鏃堕棿锛歿endTime}"); + return ResultList.ReSuccess(erp_materials_list); + } + + } + else + return ResultList.ReSuccess(materials); + } + else + return await this.BillQueryForMaterialPagedList(); + } + catch (Exception ex) + { + _logger.LogInformation($"鐗╂枡鎷夊彇-> 閿欒淇℃伅:" + ex.Message); + return ResultList.ReFailure(ResultCodes.ErpMaterialError); + } + + + } + /// + /// 鑾峰彇鐗╂枡id32杩涘埗 + /// + /// + /// + /// + public async Task> BillQueryForMaterialByNumbers(List materialNumbers) + { + //2.鍏堢櫥褰曢噾铦-鎷垮埌token + var token_result = await this.Init(); + if (!token_result.IsSuccess) + return ResultList.ReFailure(token_result); + + + //3.鑾峰彇閲戣澏鐗╂枡锛氭嫾鎺ュ弬鏁板拰鏉′欢 + var query = new ErpBillQueryDto(token_result.Data); + var param = new ErpBillQueryParamDto(FormIdParam.BD_MATERIAL.ToString()); + param.FieldKeys = "FMATERIALID,FName,FNumber,FSpecification,FBaseUnitId,FBaseUnitId.FName,FBaseUnitId.FNumber,FBARCODE,FUseOrgId,FUseOrgId.FNumber,FIsBatchManage,FProductIDS"; + param.Limit = 10000; + + //鏌ヨ鏉′欢锛氬娉ㄥ叾涓殑鏉′欢鍊间互閲戣澏鐨勫间负鍑嗭紒锛侊紒 + //1.瀹℃牳鐘舵侊細宸插鏍 + //2.绂佺敤鐘舵侊細A鍚︼紝B鏄 + //3.浣跨敤缁勭粐锛氬彧鏌ヨ鈥滄繁鍦冲競鍏冨垱鏃朵唬绉戞妧鏈夐檺鍏徃鈥濊繖涓粍缁囷紱缁勭粐ID=100008--鍥哄畾鍊兼煡璇紙娴嬭瘯绔拰姝e紡鏄竴鏍风殑锛 + //param.FilterString = "FDocumentStatus='C' and FForbidStatus='A' and (FUseOrgId=19162897 or FUseOrgId=100008)"; + + + param.OrderString = "FCreateDate ASC"; + + //4.寰幆鎷块噾铦舵暟鎹 + var erp_materials_list = new List(); + var error_josn = ""; + decimal d_count = Convert.ToDecimal(materialNumbers.Count()) / Convert.ToDecimal(100); + int count = (int)Math.Ceiling(d_count); + try + { + for(int i=1;i<= count;i++) + { + param.FilterString = "FDocumentStatus='C' and FForbidStatus='A' and FUseOrgId=100008"; + + var list = materialNumbers.Skip((i - 1) * 100).Take(100); + string numbers = JsonConvert.SerializeObject(list); + numbers = numbers.Replace("[", "").Replace("]", "").Replace("\"", "'"); + param.FilterString += $" and FNumber in ({numbers}) and (FProductIDS<>'' or FProductIDS<>' ')"; + + + //4.2.鍙傛暟json鍖 + query.Data = JsonConvert.SerializeObject(param); + var json = JsonConvert.SerializeObject(query); + + //4.3.璇锋眰鏌ヨ鎺ュ彛骞惰繑鍥炴暟鎹 + var result_json = await _client.ExecuteBillQueryAsync(json); + error_josn = result_json; + var result = JsonConvert.DeserializeObject>>(result_json); + //4.4.鍒ゆ柇鏁版嵁鏄惁鍏ㄩ儴鎷夊彇瀹屾垚锛氬苟鍋滄寰幆鐨勬潯浠 + if (result == null || result.Count == 0) + break; + //4.5.鎷艰 + foreach (var item in result) + { + var lis = new ErpMaterialDto(); + lis.MaterialId = Convert.ToInt32(item[0]); + lis.MaterialName = item[1]; + lis.MaterialNumber = item[2]; + lis.Specifications = item[3]; + lis.BaseUnitId = Convert.ToInt32(item[4]); + lis.BaseUnitName = item[5]; + lis.BaseUnitNumber = item[6]; + lis.BarCode = item[7]; + lis.OrgId = Convert.ToInt32(item[8]); + lis.OrgCode = item[9]; + lis.IsBatchManage = Convert.ToBoolean(item[10]); + lis.IdConvertBar = item[11].Trim(); + erp_materials_list.Add(lis); + } + } + return ResultList.ReSuccess(erp_materials_list); + } + catch (Exception ex) + { + _logger.LogInformation("鐗╂枡鎷夊彇->澶辫触锛" + ex.Message + " " + error_josn); + return ResultList.ReFailure(ResultCodes.ErpSynsError); + } + } + /// + /// erp:鍩虹鏁版嵁-鐗╂枡淇℃伅 + /// + /// + /// + public async Task> BillQueryForMaterial(int id) + { + //1.鑾峰彇缂撳瓨涓殑鐗╂枡鏁版嵁 + var materials = _memoryCache.Get>(_erpOptions.cache_materail_key); + if (materials == null || materials.Count == 0) + return Result.ReSuccess(null); + //2.閫氳繃ID鍙栧綋鍓嶇墿鏂欏垪琛ㄤ腑鐨 + var mater = materials.Where(x => x.MaterialId == id).FirstOrDefault(); + if (mater == null) + { + //2.1娌℃湁鐨勮瘽锛氬幓閲戣澏鍙 + mater = await this.BillQueryForMaterialById(id); + if (mater != null) + { + //鎶婂彇鍒扮殑鏁版嵁鏀鹃泦鍚堜腑骞堕噸鏂扮粰缂撳瓨 + materials.Add(mater); + _memoryCache.Set(_erpOptions.cache_materail_key, materials, new MemoryCacheEntryOptions().SetAbsoluteExpiration(TimeSpan.FromMinutes(DateTimeUtil.GetTotalMinutesTimeSpan()))); + return Result.ReSuccess(mater); + + } + else + return Result.ReSuccess(null); + } + return Result.ReSuccess(mater); + + } + /// + /// erp:鍩虹鏁版嵁-鐗╂枡淇℃伅 + /// + /// + /// + public async Task> BillQueryForMaterial(string number) + { + //1.鑾峰彇缂撳瓨涓殑鐗╂枡鏁版嵁 + var materials = _memoryCache.Get>(_erpOptions.cache_materail_key); + if (materials == null || materials.Count == 0) + return Result.ReSuccess(null); + //2.閫氳繃ID鍙栧綋鍓嶇墿鏂欏垪琛ㄤ腑鐨 + var mater = materials.Where(x => x.MaterialNumber == number).FirstOrDefault(); + if (mater == null) + { + //2.1娌℃湁鐨勮瘽锛氬幓閲戣澏鍙 + mater = await this.BillQueryForMaterialByNumber(number); + if (mater != null) + { + //鎶婂彇鍒扮殑鏁版嵁鏀鹃泦鍚堜腑骞堕噸鏂扮粰缂撳瓨 + materials.Add(mater); + _memoryCache.Set(_erpOptions.cache_materail_key, materials, new MemoryCacheEntryOptions().SetAbsoluteExpiration(TimeSpan.FromMinutes(DateTimeUtil.GetTotalMinutesTimeSpan()))); + return Result.ReSuccess(mater); + + } + else + return Result.ReSuccess(null); + } + return Result.ReSuccess(mater); + } + /// + /// erp:鍩虹鏁版嵁-鐗╂枡-鍒嗛〉鏌ヨ + /// + /// + private async Task> BillQueryForMaterialPagedList() + { + //2.鍏堢櫥褰曢噾铦-鎷垮埌token + var token_result = await this.Init(); + if (!token_result.IsSuccess) + return ResultList.ReFailure(token_result); + + //3.鑾峰彇閲戣澏鐗╂枡锛氭嫾鎺ュ弬鏁板拰鏉′欢 + var query = new ErpBillQueryDto(token_result.Data); + var param = new ErpBillQueryParamDto(FormIdParam.BD_MATERIAL.ToString()); + param.FieldKeys = "FMATERIALID,FName,FNumber,FSpecification,FBaseUnitId,FBaseUnitId.FName,FBaseUnitId.FNumber,FBARCODE,FUseOrgId,FUseOrgId.FNumber,FIsBatchManage,FProductIDS"; + param.Limit = 10000; + + //鏌ヨ鏉′欢锛氬娉ㄥ叾涓殑鏉′欢鍊间互閲戣澏鐨勫间负鍑嗭紒锛侊紒 + //1.瀹℃牳鐘舵侊細宸插鏍 + //2.绂佺敤鐘舵侊細A鍚︼紝B鏄 + //3.浣跨敤缁勭粐锛氬彧鏌ヨ鈥滄繁鍦冲競鍏冨垱鏃朵唬绉戞妧鏈夐檺鍏徃鈥濊繖涓粍缁囷紱缁勭粐ID=100008--鍥哄畾鍊兼煡璇紙娴嬭瘯绔拰姝e紡鏄竴鏍风殑锛 + //param.FilterString = "FDocumentStatus='C' and FForbidStatus='A' and (FUseOrgId=19162897 or FUseOrgId=100008)"; + param.FilterString = "FDocumentStatus='C' and FForbidStatus='A' and FUseOrgId=100008"; + param.OrderString = "FCreateDate ASC"; + + //4.寰幆鎷块噾铦舵暟鎹 + bool isHave = true; + var erp_materials_list = new List(); + int skip = 0; + var beginTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"); + _logger.LogInformation($"鐗╂枡鎷夊彇-寮濮嬫椂闂达細{beginTime}"); + var error_josn = ""; + try + { + while (isHave) + { + //4.1.椤电爜锛氶〉鐮佹寜鐓ч噾铦剁殑瑕佹眰浠0寮濮 + param.StartRow = (Convert.ToInt32(skip) * param.Limit); + //4.2.鍙傛暟json鍖 + query.Data = JsonConvert.SerializeObject(param); + var json = JsonConvert.SerializeObject(query); + + //4.3.璇锋眰鏌ヨ鎺ュ彛骞惰繑鍥炴暟鎹 + var result_json = await _client.ExecuteBillQueryAsync(json); + error_josn = result_json; + var result = JsonConvert.DeserializeObject>>(result_json); + //4.4.鍒ゆ柇鏁版嵁鏄惁鍏ㄩ儴鎷夊彇瀹屾垚锛氬苟鍋滄寰幆鐨勬潯浠 + if (result == null || result.Count == 0) + isHave = false; + //4.5.鎷艰 + foreach (var item in result) + { + var lis = new ErpMaterialDto(); + lis.MaterialId = Convert.ToInt32(item[0]); + lis.MaterialName = item[1]; + lis.MaterialNumber = item[2]; + lis.Specifications = item[3]; + lis.BaseUnitId = Convert.ToInt32(item[4]); + lis.BaseUnitName = item[5]; + lis.BaseUnitNumber = item[6]; + lis.BarCode = item[7]; + lis.OrgId = Convert.ToInt32(item[8]); + lis.OrgCode = item[9]; + lis.IsBatchManage = Convert.ToBoolean(item[10]); + lis.IdConvertBar = item[11].Trim(); + erp_materials_list.Add(lis); + } + //4.6椤甸潰鐨勫彔鍔 + skip++; + } + var endTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"); + _logger.LogInformation($"鐗╂枡鎷夊彇-缁撴潫鏃堕棿锛歿endTime}"); + //5.鐗╂枡闆嗗悎杩涜缂撳瓨-褰撳墠缂撳瓨鏃堕棿鍒板綋澶╂櫄涓婄殑0鐐癸紝鍚庨潰瀹氭椂浠诲姟鎵ц閲嶆柊鏀惧叆缂撳瓨 + _memoryCache.Set(_erpOptions.cache_materail_key, erp_materials_list, new MemoryCacheEntryOptions().SetAbsoluteExpiration(TimeSpan.FromMinutes(DateTimeUtil.GetTotalMinutesTimeSpan()))); + _logger.LogInformation($"鐗╂枡鎷夊彇-鎬绘潯鏁帮細{erp_materials_list.Count}"); + return ResultList.ReSuccess(erp_materials_list); + } + catch (Exception ex) + { + _logger.LogInformation("鐗╂枡鎷夊彇->澶辫触锛" + ex.Message + " " + error_josn); + return ResultList.ReFailure(ResultCodes.ErpSynsError); + } + + + } + + /// + /// erp:鍩虹鏁版嵁-鐗╂枡-ids鏌ヨ + /// + /// + /// + private async Task BillQueryForMaterialById(int id) + { + //2.鍏堢櫥褰曢噾铦-鎷垮埌token + var token_result = await this.Init(); + if (!token_result.IsSuccess) + return null; + + //3.鑾峰彇閲戣澏鐗╂枡锛氭嫾鎺ュ弬鏁板拰鏉′欢 + var query = new ErpBillQueryDto(token_result.Data); + var param = new ErpBillQueryParamDto(FormIdParam.BD_MATERIAL.ToString()); + param.FieldKeys = "FMATERIALID,FName,FNumber,FSpecification,FBaseUnitId,FBaseUnitId.FName,FBaseUnitId.FNumber,FBARCODE,FUseOrgId,FUseOrgId.FNumber,FIsBatchManage,FProductIDS"; + param.Limit = 10000; + + //鏌ヨ鏉′欢锛氬娉ㄥ叾涓殑鏉′欢鍊间互閲戣澏鐨勫间负鍑嗭紒锛侊紒 + //1.瀹℃牳鐘舵侊細宸插鏍 + //2.绂佺敤鐘舵侊細A鍚︼紝B鏄 + //3.浣跨敤缁勭粐锛氬彧鏌ヨ鈥滄繁鍦冲競鍏冨垱鏃朵唬绉戞妧鏈夐檺鍏徃鈥濊繖涓粍缁囷紱缁勭粐ID=100008--鍥哄畾鍊兼煡璇紙娴嬭瘯绔拰姝e紡鏄竴鏍风殑锛---鎸塈D鏌ヨ灏变笉闇瑕佸浐瀹氱粍缁囨潯浠朵簡 + param.FilterString = "FDocumentStatus='C' and FForbidStatus='A'"; + param.OrderString = "FCreateDate ASC"; + + //鏍规嵁鐗╂枡ID鏌ヨ + param.FilterString = param.FilterString + $" and FMATERIALID={id}"; + + //4.寰幆鎷块噾铦舵暟鎹 + var erp_materials_list = new List(); + + //4.2.鍙傛暟json鍖 + query.Data = JsonConvert.SerializeObject(param); + var json = JsonConvert.SerializeObject(query); + + var error_josn = ""; + try + { + //4.3.璇锋眰鏌ヨ鎺ュ彛骞惰繑鍥炴暟鎹 + var result_json = await _client.ExecuteBillQueryAsync(json); + error_josn = result_json; + var result = JsonConvert.DeserializeObject>>(result_json); + //4.5.鎷艰 + foreach (var item in result) + { + var lis = new ErpMaterialDto(); + lis.MaterialId = Convert.ToInt32(item[0]); + lis.MaterialName = item[1]; + lis.MaterialNumber = item[2]; + lis.Specifications = item[3]; + lis.BaseUnitId = Convert.ToInt32(item[4]); + lis.BaseUnitName = item[5]; + lis.BaseUnitNumber = item[6]; + lis.BarCode = item[7]; + lis.OrgId = Convert.ToInt32(item[8]); + lis.OrgCode = item[9]; + lis.IsBatchManage = Convert.ToBoolean(item[10]); + lis.IdConvertBar = item[11].Trim(); + erp_materials_list.Add(lis); + } + if (erp_materials_list.Count == 0) + return null; + else + return erp_materials_list.FirstOrDefault(); + } + catch (Exception) + { + _logger.LogInformation("鐗╂枡鎷夊彇鎸塈D->閿欒鐨凧son锛" + error_josn); + return null; + } + + } + /// + /// erp:鍩虹鏁版嵁-鐗╂枡-number鏌ヨ + /// + /// + /// + public async Task BillQueryForMaterialByNumber(string number) + { + if (string.IsNullOrEmpty(number)) return null; + //2.鍏堢櫥褰曢噾铦-鎷垮埌token + var token_result = await this.Init(); + if (!token_result.IsSuccess) + return null; + + //3.鑾峰彇閲戣澏鐗╂枡锛氭嫾鎺ュ弬鏁板拰鏉′欢 + var query = new ErpBillQueryDto(token_result.Data); + var param = new ErpBillQueryParamDto(FormIdParam.BD_MATERIAL.ToString()); + param.FieldKeys = "FMATERIALID,FName,FNumber,FSpecification,FBaseUnitId,FBaseUnitId.FName,FBaseUnitId.FNumber,FBARCODE,FUseOrgId,FUseOrgId.FNumber,FIsBatchManage,FProductIDS"; + param.Limit = 10000; + + //鏌ヨ鏉′欢锛氬娉ㄥ叾涓殑鏉′欢鍊间互閲戣澏鐨勫间负鍑嗭紒锛侊紒 + //1.瀹℃牳鐘舵侊細宸插鏍 + //2.绂佺敤鐘舵侊細A鍚︼紝B鏄 + //3.浣跨敤缁勭粐锛氬彧鏌ヨ鈥滄繁鍦冲競鍏冨垱鏃朵唬绉戞妧鏈夐檺鍏徃鈥濊繖涓粍缁囷紱缁勭粐ID=100008--鍥哄畾鍊兼煡璇紙娴嬭瘯绔拰姝e紡鏄竴鏍风殑锛---鎸塈D鏌ヨ灏变笉闇瑕佸浐瀹氱粍缁囨潯浠朵簡 + param.FilterString = "FDocumentStatus='C' and FForbidStatus='A'"; + param.OrderString = "FCreateDate ASC"; + + //鏍规嵁鐗╂枡ID鏌ヨ + param.FilterString = param.FilterString + $" and FNumber='{number}'"; + + //4.寰幆鎷块噾铦舵暟鎹 + var erp_materials_list = new List(); + + //4.2.鍙傛暟json鍖 + query.Data = JsonConvert.SerializeObject(param); + var json = JsonConvert.SerializeObject(query); + + var error_josn = ""; + try + { + //4.3.璇锋眰鏌ヨ鎺ュ彛骞惰繑鍥炴暟鎹 + var result_json = await _client.ExecuteBillQueryAsync(json); + error_josn = result_json; + var result = JsonConvert.DeserializeObject>>(result_json); + //4.5.鎷艰 + foreach (var item in result) + { + var lis = new ErpMaterialDto(); + lis.MaterialId = Convert.ToInt32(item[0]); + lis.MaterialName = item[1]; + lis.MaterialNumber = item[2]; + lis.Specifications = item[3]; + lis.BaseUnitId = Convert.ToInt32(item[4]); + lis.BaseUnitName = item[5]; + lis.BaseUnitNumber = item[6]; + lis.BarCode = item[7]; + lis.OrgId = Convert.ToInt32(item[8]); + lis.OrgCode = item[9]; + lis.IsBatchManage = Convert.ToBoolean(item[10]); + lis.IdConvertBar = item[11].Trim(); + erp_materials_list.Add(lis); + } + if (erp_materials_list.Count == 0) + return null; + else + return erp_materials_list.FirstOrDefault(); + } + catch (Exception) + { + _logger.LogInformation("鐗╂枡鎷夊彇鎸塏umber->閿欒鐨凧son锛" + error_josn + "锛涘弬鏁帮細" + json); + return null; + } + + } + + public async Task BillQueryForMaterialByNumber(string number, string orgCode) + { + if (string.IsNullOrEmpty(number)) return null; + //2.鍏堢櫥褰曢噾铦-鎷垮埌token + var token_result = await this.Init(); + if (!token_result.IsSuccess) + return null; + + //3.鑾峰彇閲戣澏鐗╂枡锛氭嫾鎺ュ弬鏁板拰鏉′欢 + var query = new ErpBillQueryDto(token_result.Data); + var param = new ErpBillQueryParamDto(FormIdParam.BD_MATERIAL.ToString()); + param.FieldKeys = "FMATERIALID,FName,FNumber,FSpecification,FBaseUnitId,FBaseUnitId.FName,FBaseUnitId.FNumber,FBARCODE,FUseOrgId,FUseOrgId.FNumber,FIsBatchManage,FProductIDS"; + param.Limit = 10000; + + //鏌ヨ鏉′欢锛氬娉ㄥ叾涓殑鏉′欢鍊间互閲戣澏鐨勫间负鍑嗭紒锛侊紒 + //1.瀹℃牳鐘舵侊細宸插鏍 + //2.绂佺敤鐘舵侊細A鍚︼紝B鏄 + //3.浣跨敤缁勭粐锛氬彧鏌ヨ鈥滄繁鍦冲競鍏冨垱鏃朵唬绉戞妧鏈夐檺鍏徃鈥濊繖涓粍缁囷紱缁勭粐ID=100008--鍥哄畾鍊兼煡璇紙娴嬭瘯绔拰姝e紡鏄竴鏍风殑锛---鎸塈D鏌ヨ灏变笉闇瑕佸浐瀹氱粍缁囨潯浠朵簡 + param.FilterString = "FDocumentStatus='C' and FForbidStatus='A'"; + param.OrderString = "FCreateDate ASC"; + + //鏍规嵁鐗╂枡ID鏌ヨ + param.FilterString = param.FilterString + $" and FNumber='{number}' and FUseOrgId.FNumber='{orgCode}'"; + + //4.寰幆鎷块噾铦舵暟鎹 + var erp_materials_list = new List(); + + //4.2.鍙傛暟json鍖 + query.Data = JsonConvert.SerializeObject(param); + var json = JsonConvert.SerializeObject(query); + + var error_josn = ""; + try + { + //4.3.璇锋眰鏌ヨ鎺ュ彛骞惰繑鍥炴暟鎹 + var result_json = await _client.ExecuteBillQueryAsync(json); + error_josn = result_json; + var result = JsonConvert.DeserializeObject>>(result_json); + //4.5.鎷艰 + foreach (var item in result) + { + var lis = new ErpMaterialDto(); + lis.MaterialId = Convert.ToInt32(item[0]); + lis.MaterialName = item[1]; + lis.MaterialNumber = item[2]; + lis.Specifications = item[3]; + lis.BaseUnitId = Convert.ToInt32(item[4]); + lis.BaseUnitName = item[5]; + lis.BaseUnitNumber = item[6]; + lis.BarCode = item[7]; + lis.OrgId = Convert.ToInt32(item[8]); + lis.OrgCode = item[9]; + lis.IsBatchManage = Convert.ToBoolean(item[10]); + lis.IdConvertBar = item[11].Trim(); + erp_materials_list.Add(lis); + } + if (erp_materials_list.Count == 0) + return null; + else + return erp_materials_list.FirstOrDefault(); + } + catch (Exception ex) + { + _logger.LogInformation($"鐗╂枡鎷夊彇鎸塏umber->閿欒鐨凧son锛" + error_josn + "锛涘弬鏁帮細" + json + " 閿欒淇℃伅:" + ex.Message); + return null; + } + + } + + /// + /// erp:鍗曟嵁鏌ヨ-缁勭粐鏁版嵁 + /// + /// + public async Task> BillQueryForOrg() + { + string result_json = ""; + try + { + //1.鑾峰彇缂撳瓨涓殑缁勭粐鏁版嵁锛 + var orgs = _memoryCache.Get>(_erpOptions.cache_org_key); + if (orgs == null || orgs.Count == 0) + { + + //2.鍏堢櫥褰曢噾铦-鎷垮埌token + var token_result = await this.Init(); + if (!token_result.IsSuccess) + return ResultList.ReFailure(token_result); + + //3.鑾峰彇閲戣澏缁勭粐锛氭嫾鎺ュ弬鏁板拰鏉′欢 + var query = new ErpBillQueryDto(token_result.Data); + var param = new ErpBillQueryParamDto(FormIdParam.ORG_Organizations.ToString()); + param.FieldKeys = "FOrgID,FNumber,FName"; + param.Limit = 10000; + //鏌ヨ鏉′欢锛氬娉ㄥ叾涓殑鏉′欢鍊间互閲戣澏鐨勫间负鍑嗭紒锛侊紒 + param.FilterString = ""; + + //澶囨敞锛氬洜涓虹粍缁囨暟鎹笉鏄緢澶氾紝灏变笉鑳藉拰鑾峰彇鐗╂枡涓鏍峰惊鐜幏鍙栵紱缁勭粐杩欓噷灏辫幏鍙10000鏉℃暟鎹氨琛屼簡 + var beginTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"); + _logger.LogInformation($"缁勭粐鎷夊彇-寮濮嬫椂闂磞zh锛歿beginTime}"); + //4.鍙傛暟json鍖 + query.Data = JsonConvert.SerializeObject(param); + var json = JsonConvert.SerializeObject(query); + + //5.璇锋眰鏌ヨ鎺ュ彛骞惰繑鍥炴暟鎹 + result_json = await _client.ExecuteBillQueryAsync(json); + var result = JsonConvert.DeserializeObject>>(result_json); + + var endTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"); + _logger.LogInformation($"缁勭粐鎷夊彇-缁撴潫鏃堕棿yzh20250418(2)锛歿endTime}"); + //6.鎷艰 + var list = new List(); + foreach (var item in result) + { + var lis = new ErpOrgDto(); + lis.Id = int.Parse(item[0]); + lis.Number = item[1]; + lis.Name = item[2]; + list.Add(lis); + + } + //5.缁勭粐闆嗗悎杩涜缂撳瓨 + _memoryCache.Set(_erpOptions.cache_org_key, list, new MemoryCacheEntryOptions().SetAbsoluteExpiration(TimeSpan.FromMinutes(DateTimeUtil.GetTotalMinutesTimeSpan()))); + + return ResultList.ReSuccess(list); + + } + else + { + return ResultList.ReSuccess(orgs); + } + + } + catch (Exception ex) + { + _logger.LogError($"閲戣澏缁勭粐鎷夊彇寮傚父yzh{ex.Message}{result_json}"); + return ResultList.ReFailure(ResultCodes.ErpOrgError); + } + } + + /// + /// erp:渚涘簲鍟 + /// + /// + public async Task> BillQueryForSupplier() + { + string result_json = ""; + try + { + //1.鑾峰彇缂撳瓨涓殑渚涘簲鍟嗘暟鎹紱 + var suppliers = _memoryCache.Get>(_erpOptions.cache_supplier_key); + if (suppliers == null || suppliers.Count == 0) + { + + //2.鍏堢櫥褰曢噾铦-鎷垮埌token + var token_result = await this.Init(); + if (!token_result.IsSuccess) + return ResultList.ReFailure(token_result); + + //3.鑾峰彇閲戣澏渚涘簲鍟嗭細鎷兼帴鍙傛暟鍜屾潯浠 + var query = new ErpBillQueryDto(token_result.Data); + var param = new ErpBillQueryParamDto(FormIdParam.BD_Supplier.ToString()); + param.FieldKeys = "FSupplierId,FNumber,FName,FUseOrgId.FNumber"; + + int skip = 1; + param.Limit = 10000; + var list = new List(); + while (true) + { + param.StartRow = (Convert.ToInt32(skip) * param.Limit); + //鏌ヨ鏉′欢锛氬娉ㄥ叾涓殑鏉′欢鍊间互閲戣澏鐨勫间负鍑嗭紒锛侊紒 + //param.FilterString = "FUseOrgId=100008"; + //param.FilterString = "(FUseOrgId = 100008 or FUseOrgId = 19162897)"; + + //澶囨敞锛氬洜涓轰緵搴斿晢鏁版嵁涓嶆槸寰堝锛屽氨涓嶈兘鍜岃幏鍙栫墿鏂欎竴鏍峰惊鐜幏鍙栵紱缁勭粐杩欓噷灏辫幏鍙10000鏉℃暟鎹氨琛屼簡 + var beginTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"); + _logger.LogInformation($"渚涘簲鍟嗘媺鍙-寮濮嬫椂闂磞zh锛歿beginTime}"); + //4.鍙傛暟json鍖 + query.Data = JsonConvert.SerializeObject(param); + var json = JsonConvert.SerializeObject(query); + + //5.璇锋眰鏌ヨ鎺ュ彛骞惰繑鍥炴暟鎹 + result_json = await _client.ExecuteBillQueryAsync(json); + var result = JsonConvert.DeserializeObject>>(result_json); + //4.4.鍒ゆ柇鏁版嵁鏄惁鍏ㄩ儴鎷夊彇瀹屾垚锛氬苟鍋滄寰幆鐨勬潯浠 + if (result == null || result.Count == 0) + break; + var endTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"); + _logger.LogInformation($"渚涘簲鍟嗘媺鍙-缁撴潫鏃堕棿yzh锛歿endTime}"); + + foreach (var item in result) + { + var lis = new ErpSupplierDto(); + lis.Id = int.Parse(item[0]); + lis.Number = item[1]; + lis.Name = item[2]; + lis.OrgCode = item[3]; + list.Add(lis); + + } + skip++; + } + //5.渚涘簲鍟嗛泦鍚堣繘琛岀紦瀛 + _memoryCache.Set(_erpOptions.cache_supplier_key, list, new MemoryCacheEntryOptions().SetAbsoluteExpiration(TimeSpan.FromMinutes(DateTimeUtil.GetTotalMinutesTimeSpan()))); + + return ResultList.ReSuccess(list); + + } + else + { + return ResultList.ReSuccess(suppliers); + } + + } + catch (Exception ex) + { + _logger.LogError($"閲戣澏渚涘簲鍟嗘媺鍙栧紓甯竰ex.Message} {result_json}"); + return ResultList.ReFailure(ResultCodes.ErpSupplierError); + } + } + /// + /// 瀹㈡埛 + /// + /// + public async Task> BillQueryForCustomer() + { + try + { + //1.鑾峰彇缂撳瓨涓殑渚涘簲鍟嗘暟鎹紱 + var customers = _memoryCache.Get>(_erpOptions.cache_customer_key); + if (customers == null || customers.Count == 0) + { + + //2.鍏堢櫥褰曢噾铦-鎷垮埌token + var token_result = await this.Init(); + if (!token_result.IsSuccess) + return ResultList.ReFailure(token_result); + + //3.鑾峰彇閲戣澏渚涘簲鍟嗭細鎷兼帴鍙傛暟鍜屾潯浠 + var query = new ErpBillQueryDto(token_result.Data); + var param = new ErpBillQueryParamDto(FormIdParam.BD_Customer.ToString()); + param.FieldKeys = "FCUSTID,FNumber,FName"; + param.Limit = 10000; + //鏌ヨ鏉′欢锛氬娉ㄥ叾涓殑鏉′欢鍊间互閲戣澏鐨勫间负鍑嗭紒锛侊紒 + param.FilterString = ""; + var list = new List(); + //澶囨敞锛氬洜涓轰緵搴斿晢鏁版嵁涓嶆槸寰堝锛屽氨涓嶈兘鍜岃幏鍙栫墿鏂欎竴鏍峰惊鐜幏鍙栵紱缁勭粐杩欓噷灏辫幏鍙10000鏉℃暟鎹氨琛屼簡 + var beginTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"); + _logger.LogInformation($"瀹㈡埛鎷夊彇-寮濮嬫椂闂磞zh锛歿beginTime}"); + int skip = 0; + //4.鍙傛暟json鍖 + while (true) + { + //4.1.椤电爜锛氶〉鐮佹寜鐓ч噾铦剁殑瑕佹眰浠0寮濮 + param.StartRow = (Convert.ToInt32(skip) * param.Limit); + + query.Data = JsonConvert.SerializeObject(param); + var json = JsonConvert.SerializeObject(query); + + //5.璇锋眰鏌ヨ鎺ュ彛骞惰繑鍥炴暟鎹 + var result_json = await _client.ExecuteBillQueryAsync(json); + var result = JsonConvert.DeserializeObject>>(result_json); + + if (result == null || result.Count == 0) + break; + + //6.鎷艰 + foreach (var item in result) + { + var lis = new ErpCustomerDto(); + lis.Id = int.Parse(item[0]); + lis.Number = item[1]; + lis.Name = item[2]; + list.Add(lis); + + } + //4.6椤甸潰鐨勫彔鍔 + skip++; + } + var endTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"); + _logger.LogInformation($"瀹㈡埛鎷夊彇-缁撴潫鏃堕棿yzh锛歿endTime}"); + //5.渚涘簲鍟嗛泦鍚堣繘琛岀紦瀛 + _memoryCache.Set(_erpOptions.cache_customer_key, list, new MemoryCacheEntryOptions().SetAbsoluteExpiration(TimeSpan.FromMinutes(DateTimeUtil.GetTotalMinutesTimeSpan()))); + _logger.LogInformation($"瀹㈡埛鎷夊彇-鎬绘潯鏁皔zh锛歿list.Count}"); + return ResultList.ReSuccess(list); + + } + else + { + return ResultList.ReSuccess(customers); + } + + } + catch (Exception) + { + return ResultList.ReFailure(ResultCodes.ErpSupplierError); + } + } + /// + /// erp:浠撳簱 + /// + /// + public async Task> BillQueryForStock() + { + try + { + //1.鑾峰彇缂撳瓨涓殑浠撳簱鏁版嵁锛 + var stocks = _memoryCache.Get>(_erpOptions.cache_stock_key); + if (stocks == null || stocks.Count == 0) + { + //2.鍏堢櫥褰曢噾铦-鎷垮埌token + var token_result = await this.Init(); + if (!token_result.IsSuccess) + return ResultList.ReFailure(token_result); + //3.鑾峰彇閲戣澏浠撳簱锛氭嫾鎺ュ弬鏁板拰鏉′欢 + var query = new ErpBillQueryDto(token_result.Data); + var param = new ErpBillQueryParamDto(FormIdParam.BD_STOCK.ToString()); + param.FieldKeys = "FStockId,FName,FNumber,FUseOrgId,FUseOrgId.FNumber"; + param.Limit = 10000; + //鏌ヨ鏉′欢锛氬娉ㄥ叾涓殑鏉′欢鍊间互閲戣澏鐨勫间负鍑嗭紒锛侊紒 + param.FilterString = ""; + //澶囨敞锛氬洜涓轰緵搴斿晢鏁版嵁涓嶆槸寰堝锛屽氨涓嶈兘鍜岃幏鍙栫墿鏂欎竴鏍峰惊鐜幏鍙栵紱缁勭粐杩欓噷灏辫幏鍙10000鏉℃暟鎹氨琛屼簡 + var beginTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"); + _logger.LogInformation($"浠撳簱鎷夊彇-寮濮嬫椂闂磞zh锛歿beginTime}"); + //4.鍙傛暟json鍖 + query.Data = JsonConvert.SerializeObject(param); + var json = JsonConvert.SerializeObject(query); + //5.璇锋眰鏌ヨ鎺ュ彛骞惰繑鍥炴暟鎹 + var result_json = await _client.ExecuteBillQueryAsync(json); + var result = JsonConvert.DeserializeObject>>(result_json); + //6.鎷艰 + var list = new List(); + foreach (var item in result) + { + var lis = new ErpStockDto(); + lis.Id = int.Parse(item[0]); + lis.Name = item[1]; + lis.Code = item[2]; + lis.OrgId = Convert.ToInt32(item[3]); + lis.OrgCode = item[4]; + list.Add(lis); + + } + //5.渚涘簲鍟嗛泦鍚堣繘琛岀紦瀛 + _memoryCache.Set(_erpOptions.cache_stock_key, list, new MemoryCacheEntryOptions().SetAbsoluteExpiration(TimeSpan.FromDays(3))); + _logger.LogInformation($"浠撳簱鎷夊彇-鎬绘潯鏁皔zh锛歿list.Count}"); + return ResultList.ReSuccess(list); + } + else + { + return ResultList.ReSuccess(stocks); + } + + } + catch (Exception) + { + return ResultList.ReFailure(ResultCodes.ErpStockError); + } + } + /// + /// 鏍规嵁浠撳簱缂栫爜鑾峰彇浠撲綅 + /// + /// + /// + public async Task> BillQueryForSubStock() + { + try + { + //1.鑾峰彇缂撳瓨涓殑浠撳簱鏁版嵁锛 + var stocks = _memoryCache.Get>(_erpOptions.cache_substock_key); + if (stocks == null || stocks.Count == 0) + { + var token_result = await this.Init(); + if (!token_result.IsSuccess) + return ResultList.ReFailure(token_result); + var query = new ErpBillQueryDto(token_result.Data); + var param = new ErpBillQueryParamDto(FormIdParam.BD_STOCK.ToString()); + param.FieldKeys = "FStockFlexDetail_FDetailID,FFlexEntryName,FFlexEntryId.FNumber,FUseOrgId.FNumber,FNumber"; + param.Limit = 100000; + param.FilterString = $"FNumber='HD' or FNumber='GD'";//FNumber='C' + query.Data = JsonConvert.SerializeObject(param); + var json = JsonConvert.SerializeObject(query); + + var result_json = await _client.ExecuteBillQueryAsync(json); + var result = JsonConvert.DeserializeObject>>(result_json); + + var list = new List(); + foreach (var item in result) + { + var lis = new Erp_SubStockDto(); + if (item[0] == "0") continue; + lis.Id = int.Parse(item[0]); + lis.Name = item[1]; + lis.Code = item[2]; + lis.OrgCode = item[3]; + lis.StockCode = item[4]; + list.Add(lis); + + } + //5.渚涘簲鍟嗛泦鍚堣繘琛岀紦瀛 鍙湁鏌ヨ鍏ㄩ儴鐨勬椂鍊欐墠缂撳瓨 + _memoryCache.Set(_erpOptions.cache_substock_key, list, new MemoryCacheEntryOptions().SetAbsoluteExpiration(TimeSpan.FromDays(3))); + _logger.LogInformation($"瀛愪粨搴撴媺鍙-鎬绘潯鏁帮細{list.Count}"); + return ResultList.ReSuccess(list); + } + else + { + return ResultList.ReSuccess(stocks); + } + } + catch (Exception) + { + return ResultList.ReFailure(ResultCodes.ErpSubStockError); + } + } + + #region 閲戣澏鎿嶄綔浜や簰 + /// + /// 鍚屾鏁版嵁(淇濆瓨鎻愪氦瀹℃牳) + /// + /// + /// + /// + public async Task> Save(T dto, string formId) + { + try + { + var token_result = await this.Init(); + if (!token_result.IsSuccess) + return Result.ReFailure(token_result.Message, token_result.Status); + var query = new ErpBillQueryDto(token_result.Data, formId); + var param = new ErpSave(formId, dto); + query.Data = JsonConvert.SerializeObject(param); + + //淇濆瓨 + var result_json = await _client.SaveAsync(JsonConvert.SerializeObject(query)); + + _logger.LogInformation("鍏ュ簱鍗->寮濮嬪悓姝ラ噾铦讹細淇濆瓨鍙傛暟" + JsonConvert.SerializeObject(query) + " 缁撴灉->" + result_json); + + JObject jobject = (JObject)JsonConvert.DeserializeObject(result_json); + + if (jobject["Result"]["ResponseStatus"]["IsSuccess"].ToString().ToLower() == "true") + { + //淇濆瓨鎴愬姛鍚庤繑鍥瀗umber 鍚庣画鎿嶄綔鏍规嵁Id鎿嶄綔 + string number = jobject["Result"]["ResponseStatus"]["SuccessEntitys"][0]["Number"].ToString(); + return Result.ReSuccess(number); + } + + var msg = jobject["Result"]["ResponseStatus"]["Errors"][0]["Message"].ToString(); + return Result.ReFailure(msg, 10002); + } + catch (Exception ex) + { + return Result.ReFailure(ex.ToString(), 10002); + } + } + /// + /// 鎻愪氦 + /// + /// + /// + /// + public async Task Submit(ErpOperateDto dto, string formId) + { + try + { + var token_result = await this.Init(); + if (!token_result.IsSuccess) + return token_result; + var query = new ErpBillQueryDto(token_result.Data, formId); + + //鎻愪氦 + query.Data = JsonConvert.SerializeObject(dto); + var result_json = await _client.SubmitAsync(JsonConvert.SerializeObject(query)); + _logger.LogInformation("鍏ュ簱鍗->寮濮嬪悓姝ラ噾铦讹細鎻愪氦鍙傛暟" + JsonConvert.SerializeObject(query) + " 缁撴灉->" + result_json); + JObject jobject = (JObject)JsonConvert.DeserializeObject(result_json); + + if (jobject["Result"]["ResponseStatus"]["IsSuccess"].ToString().ToLower() == "true") + return Result.ReSuccess(); + + var msg = jobject["Result"]["ResponseStatus"]["Errors"][0]["Message"].ToString(); + return Result.ReFailure(msg, 10002); + } + catch (Exception ex) + { + return Result.ReFailure(ex.ToString(), 10002); + } + } + /// + /// 瀹℃牳 + /// + /// + /// + /// + public async Task Audit(ErpOperateDto dto, string formId) + { + try + { + var token_result = await this.Init(); + if (!token_result.IsSuccess) + return token_result; + var query = new ErpBillQueryDto(token_result.Data, formId); + + //鎻愪氦 + query.Data = JsonConvert.SerializeObject(dto); + var result_json = await _client.AuditAsync(JsonConvert.SerializeObject(query)); + _logger.LogInformation("鍏ュ簱鍗->寮濮嬪悓姝ラ噾铦讹細瀹℃牳鍙傛暟" + JsonConvert.SerializeObject(query) + " 缁撴灉->" + result_json); + JObject jobject = (JObject)JsonConvert.DeserializeObject(result_json); + + if (jobject["Result"]["ResponseStatus"]["IsSuccess"].ToString().ToLower() == "true") + return Result.ReSuccess(); + + var msg = jobject["Result"]["ResponseStatus"]["Errors"][0]["Message"].ToString(); + return Result.ReFailure(msg, 10002); + } + catch (Exception ex) + { + return Result.ReFailure(ex.ToString(), 10002); + } + } + /// + /// 鍙嶅鏍 + /// + /// + /// + /// + public async Task NoAudit(ErpOperateDto dto, string formId) + { + try + { + var token_result = await this.Init(); + if (!token_result.IsSuccess) + return token_result; + var query = new ErpBillQueryDto(token_result.Data); + + //鎻愪氦 + query.Data = JsonConvert.SerializeObject(dto); + var result_json = await _client.UnAuditAsync(JsonConvert.SerializeObject(query)); + JObject jobject = (JObject)JsonConvert.DeserializeObject(result_json); + var isSuccess = jobject["Result"]["ResponseStatus"]["IsSuccess"].ToString().ToLower(); + + if (jobject["Result"]["ResponseStatus"]["IsSuccess"].ToString().ToLower() == "true") + return Result.ReSuccess(); + + var msg = jobject["Result"]["ResponseStatus"]["Errors"][0]["Message"].ToString(); + return Result.ReFailure(msg, 10002); + } + catch (Exception ex) + { + return Result.ReFailure(ex.ToString(), 10002); + } + } + /// + /// 鍒犻櫎 + /// + /// + /// + /// + public async Task Delete(ErpOperateDto dto, string formId) + { + try + { + var token_result = await this.Init(); + if (!token_result.IsSuccess) + return token_result; + var query = new ErpBillQueryDto(token_result.Data); + + //鎻愪氦 + query.Data = JsonConvert.SerializeObject(dto); + var result_json = await _client.DeleteAsync(JsonConvert.SerializeObject(query)); + JObject jobject = (JObject)JsonConvert.DeserializeObject(result_json); + var isSuccess = jobject["Result"]["ResponseStatus"]["IsSuccess"].ToString().ToLower(); + + if (jobject["Result"]["ResponseStatus"]["IsSuccess"].ToString().ToLower() == "true") + return Result.ReSuccess(); + + var msg = jobject["Result"]["ResponseStatus"]["Errors"][0]["Message"].ToString(); + return Result.ReFailure(msg, 10002); + } + catch (Exception ex) + { + return Result.ReFailure(ex.ToString(), 10002); + } + } + /// + /// 涓嬫帹 + /// + /// + /// + public async Task> Push(ErpPushDto dto) + { + try + { + var token_result = await this.Init(); + if (!token_result.IsSuccess) + return token_result; + var query = new ErpBillQueryDto(token_result.Data, dto.FormId); + query.Data = JsonConvert.SerializeObject(dto); + //涓嬫帹 + string json = JsonConvert.SerializeObject(query); + var result_json = await _client.PushAsync(json); + _logger.LogInformation("鍏ュ簱鍗->寮濮嬪悓姝ラ噾铦讹細涓嬫帹鍙傛暟" + json + " 缁撴灉->" + result_json); + JObject jobject = (JObject)JsonConvert.DeserializeObject(result_json); + var isSuccess = jobject["Result"]["ResponseStatus"]["IsSuccess"].ToString().ToLower(); + + if (jobject["Result"]["ResponseStatus"]["IsSuccess"].ToString().ToLower() == "true") + { + //淇濆瓨鎴愬姛鍚庤繑鍥濱d 鍚庣画鎿嶄綔鏍规嵁Id鎿嶄綔 + string id = jobject["Result"]["ResponseStatus"]["SuccessEntitys"][0]["Id"].ToString(); + return Result.ReSuccess(id); + } + + var msg = jobject["Result"]["ResponseStatus"]["Errors"][0]["Message"].ToString(); + return Result.ReFailure(msg, 10002); + } + catch (Exception ex) + { + return Result.ReFailure(ex.ToString(), 10002); + } + } + #endregion + + + } +} diff --git a/src/BarCode.Web.Domain/Services/Public/HostedService.cs b/src/BarCode.Web.Domain/Services/Public/HostedService.cs new file mode 100644 index 0000000..d97b8a5 --- /dev/null +++ b/src/BarCode.Web.Domain/Services/Public/HostedService.cs @@ -0,0 +1,55 @@ +锘縰sing BarCode.Web.Domain.IService.Public; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Hosting; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BarCode.Web.Domain.Services.Public +{ + public class HostedService : IHostedService + { + private readonly IServiceProvider _serviceProvider; + private readonly IErpService _erpService; + private readonly IServiceScopeFactory _serviceScopeFactory; + public HostedService(IServiceProvider serviceProvider, IServiceScopeFactory serviceScopeFactory) + { + _serviceProvider = serviceProvider; + _serviceScopeFactory = serviceScopeFactory; + } + public Task StartAsync(CancellationToken cancellationToken) + { + var scope = _serviceScopeFactory.CreateScope(); + var sercice = scope.ServiceProvider.GetRequiredService(); + Console.WriteLine("寮濮嬪姞杞藉垵濮嬫暟鎹..."); + Task.Run(() => + { + //寮傛-鍚屾涓嬬墿鏂欐暟鎹 + sercice.BillQueryForMaterial().GetAwaiter().GetResult(); + Console.WriteLine("鐗╂枡鍔犺浇瀹屾垚"); + }); + + Task.Run(() => + { + //寮傛-鍚屾涓嬬粍缁囨暟鎹 + sercice.BillQueryForOrg().GetAwaiter().GetResult(); + Console.WriteLine("缁勭粐鍔犺浇瀹屾垚"); + }); + + Task.Run(() => + { + //寮傛-鍚屾涓嬩緵搴斿晢鏁版嵁 + sercice.BillQueryForSupplier().GetAwaiter().GetResult(); + Console.WriteLine("渚涘簲鍟嗗姞杞藉畬鎴"); + }); + return Task.CompletedTask; + } + + public Task StopAsync(CancellationToken cancellationToken) + { + throw new NotImplementedException(); + } + } +} diff --git a/src/BarCode.Web.Domain/Services/Public/HttpClientService.cs b/src/BarCode.Web.Domain/Services/Public/HttpClientService.cs new file mode 100644 index 0000000..b90d533 --- /dev/null +++ b/src/BarCode.Web.Domain/Services/Public/HttpClientService.cs @@ -0,0 +1,230 @@ +锘縰sing Microsoft.Extensions.Logging; +using System; +using System.Collections.Generic; +using System.Net.Http; +using System.Net.Http.Headers; +using System.Text; +using System.Text.Json; +using System.Threading.Tasks; +using BarCode.Web.Core.Exceptions; +using BarCode.Web.Domain.IService.Public; + +namespace BarCode.Web.Domain.Services.Public +{ + public class HttpClientService : IHttpClientService + { + private readonly IHttpClientFactory _clientFactory; + private readonly ILogger _logger; + private Dictionary headers; + private Dictionary contentHeaders; + public HttpClientService(IHttpClientFactory clientFactory, ILogger logger) + { + _clientFactory = clientFactory; + _logger = logger; + headers = new Dictionary(); + headers.Add("Accept", "application/json"); + headers.Add("User-Agent", "HttpClientFactory-Sample"); + + contentHeaders = new Dictionary(); + contentHeaders.Add("Content-Type", "application/json; charset=utf-8"); + + } + + /// + /// Get鏂规硶 + /// + /// + /// + /// + /// + /// + public async Task GetAsync(string url, int timeoutSecond = 180) + { + try + { + var client = BuildHttpClient(headers, timeoutSecond); + var response = await client.GetAsync(url); + //var responseContent = await response.Content.ReadAsStreamAsync();//1.鐩告瘮ReadAsString杩欎釜鏂规硶杩斿洖瑕佸揩鐐癸紝鏁堢巼楂 + var responseContent = await response.Content.ReadAsStringAsync(); //2.褰撳墠浣跨敤杩欓噷鏄负浜嗚繋鍚堥敊璇俊鎭鐪 + if (response.IsSuccessStatusCode) + { + var t = JsonSerializer.Deserialize(responseContent, new JsonSerializerOptions { PropertyNameCaseInsensitive = true }); + //var t = await JsonSerializer.DeserializeAsync(responseContent, new JsonSerializerOptions { PropertyNameCaseInsensitive = true });//3.閰嶅悎1鐨凴eadAsStream浣跨敤 + return t; + } + + throw new WebHttpException(response.StatusCode.ToString(), "璇锋眰鍑洪敊"); + } + catch (Exception ex) + { + _logger.LogError($"HttpGet:{url} Error:{ex.Message}"); + throw new Exception($"HttpGet:{url} Error", ex); + } + } + + /// + /// Get鏂规硶 + /// + /// + /// + /// + /// + /// + public async Task GetAsync(string url, Dictionary dicHeaders, int timeoutSecond = 180) + { + try + { + var client = BuildHttpClient(dicHeaders, timeoutSecond); + var response = await client.GetAsync(url); + //var responseContent = await response.Content.ReadAsStreamAsync();//1.鐩告瘮ReadAsString杩欎釜鏂规硶杩斿洖瑕佸揩鐐癸紝鏁堢巼楂 + var responseContent = await response.Content.ReadAsStringAsync(); //2.褰撳墠浣跨敤杩欓噷鏄负浜嗚繋鍚堥敊璇俊鎭鐪 + if (response.IsSuccessStatusCode) + { + var t = JsonSerializer.Deserialize(responseContent, new JsonSerializerOptions { PropertyNameCaseInsensitive = true }); + //var t = await JsonSerializer.DeserializeAsync(responseContent, new JsonSerializerOptions { PropertyNameCaseInsensitive = true });//3.閰嶅悎1鐨凴eadAsStream浣跨敤 + return t; + } + + throw new WebHttpException(response.StatusCode.ToString(), "璇锋眰鍑洪敊"); + } + catch (Exception ex) + { + _logger.LogError($"HttpGet:{url} Error:{ex.Message}"); + throw new Exception($"HttpGet:{url} Error", ex); + } + } + + /// + /// Post鏂规硶 + /// + /// + /// + /// + /// + /// + /// + public async Task PostAsync(string url, string requestBody, Dictionary dicHeaders, int timeoutSecond = 180) + { + var client = BuildHttpClient(dicHeaders, timeoutSecond); + var requestContent = GenerateStringContent(requestBody, contentHeaders); + var response = await client.PostAsync(url, requestContent); + var responseContent = await response.Content.ReadAsStringAsync(); + if (response.IsSuccessStatusCode) + { + var t = JsonSerializer.Deserialize(responseContent, new JsonSerializerOptions { PropertyNameCaseInsensitive = true }); + return t; + } + + _logger.LogError($"HttpGet:{url} Error:{responseContent}"); + throw new WebHttpException(response.StatusCode.ToString(), responseContent); + } + + /// + /// Post鏂规硶 + /// + /// + /// + /// + /// + /// + public async Task PostAsync(string url, string requestBody, int timeoutSecond = 180) + { + var client = BuildHttpClient(null, timeoutSecond); + var requestContent = GenerateStringContent(requestBody, contentHeaders); + var response = await client.PostAsync(url, requestContent); + var responseContent = await response.Content.ReadAsStringAsync(); + if (response.IsSuccessStatusCode) + { + var t = JsonSerializer.Deserialize(responseContent, new JsonSerializerOptions { PropertyNameCaseInsensitive = true }); + if (t == null) + _logger.LogInformation($"鑾峰彇鍗曠偣鏁版嵁涓虹┖---{responseContent}"); + return t; + } + + _logger.LogError($"HttpGet:{url} Error:{responseContent}"); + throw new WebHttpException(response.StatusCode.ToString(), responseContent); + } + + /// + /// 鍏叡http璇锋眰 + /// + /// + /// + /// + /// + /// + /// + /// + public async Task ExecuteAsync(string url, HttpMethod method, string requestBody, Dictionary dicHeaders, int timeoutSecond = 180) + { + var client = BuildHttpClient(null, timeoutSecond); + var request = GenerateHttpRequestMessage(url, requestBody, method, dicHeaders); + var response = await client.SendAsync(request); + var responseContent = await response.Content.ReadAsStringAsync(); + if (response.IsSuccessStatusCode) + { + var t = JsonSerializer.Deserialize(responseContent, new JsonSerializerOptions { PropertyNameCaseInsensitive = true }); + + return t; + } + + throw new WebHttpException(response.StatusCode.ToString(), responseContent); + } + + + /// + /// 璁剧疆HttpRequestMessage + /// + /// + /// + /// + /// + /// + private HttpRequestMessage GenerateHttpRequestMessage(string url, string requestBody, HttpMethod method, Dictionary dicHeaders) + { + var request = new HttpRequestMessage(method, url); + if (!string.IsNullOrEmpty(requestBody)) request.Content = new StringContent(requestBody); + if (dicHeaders != null) + foreach (var headerItme in dicHeaders) + request.Headers.Add(headerItme.Key, headerItme.Value); + return request; + } + + /// + /// 璁剧疆璇锋眰鍐呭 + /// + /// + /// + /// + private StringContent GenerateStringContent(string requestBody, Dictionary dicHeaders) + { + var content = new StringContent(requestBody); + if (dicHeaders != null) + content.Headers.Remove("content-type"); + foreach (var headerItme in dicHeaders) + content.Headers.Add(headerItme.Key, headerItme.Value); + return content; + } + + + /// + /// 璁剧疆璇锋眰澶村拰瓒呮椂鏃堕棿锛氳繑鍥瀋lient + /// + /// + /// + /// + public HttpClient BuildHttpClient(Dictionary dicDefaultHeaders, int? timeoutSecond=180) + { + var httpClient = _clientFactory.CreateClient("ops_client"); + httpClient.DefaultRequestHeaders.Clear(); //涓轰簡浣垮鎴风涓嶅彈鏈鍚庝竴涓姹傜殑褰卞搷锛屽畠闇瑕佹竻闄efaultRequestHeaders + httpClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); + if (dicDefaultHeaders != null) + foreach (var headItem in dicDefaultHeaders) + if (!httpClient.DefaultRequestHeaders.Contains(headItem.Key)) + httpClient.DefaultRequestHeaders.Add(headItem.Key, headItem.Value); + + if (timeoutSecond != null) httpClient.Timeout = TimeSpan.FromSeconds(timeoutSecond.Value); + return httpClient; + } + } +} diff --git a/src/BarCode.Web.Domain/Services/Public/LoginService.cs b/src/BarCode.Web.Domain/Services/Public/LoginService.cs new file mode 100644 index 0000000..ef6acff --- /dev/null +++ b/src/BarCode.Web.Domain/Services/Public/LoginService.cs @@ -0,0 +1,567 @@ +锘縰sing AutoMapper; +using Microsoft.Extensions.Logging; +using Microsoft.Extensions.Options; +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Json; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using BarCode.Web.Core.Dto.Login; +using BarCode.Web.Core.Dto.Login.Temp; +using BarCode.Web.Core.Dto.Login.Temp.v3; +using BarCode.Web.Core.Dto.SingleData; +using BarCode.Web.Core.Help; +using BarCode.Web.Core.Internal.Results; +using BarCode.Web.Core.Internal.Security; +using BarCode.Web.Domain.IService.Public; +using BarCode.Web.Domain.Options; +using BarCode.Web.Domain.Values.Single; +using BarCode.Web.Core.Dto.Erp; + +namespace BarCode.Web.Domain.Services.Public +{ + public class LoginService : ILoginService + { + private IMapper _mapper; + private SoaOptions _soaOptions; + private ILogger _logger; + private HttpClientHelp _httpClientHelp; + private readonly ISingleDataService _singleDataService; + private readonly RedisClientService _redisClientService; + public LoginService( + IMapper mapper, + IOptions soaOptions, + ILogger logger, + HttpClientHelp httpClientHelp, + ISingleDataService singleDataService, + RedisClientService redisClientService) + { + this._redisClientService = redisClientService; + this._singleDataService = singleDataService; + this._soaOptions = soaOptions?.Value; + this._mapper = mapper; + this._logger = logger; + this._httpClientHelp = httpClientHelp; + } + + /// + /// 鍒涘缓token + /// + /// + /// + /// + /// + public async Task CreateToken(UserInfoDto data, LoginTempDto tempDto, string NewToken) + { + return await Task.Run(() => + { + + DateTime expires_time = TimeZone.CurrentTimeZone.ToLocalTime(new System.DateTime(1970, 1, 1)).AddSeconds(tempDto.expires_in); + AccessTokenDto accessToken = new AccessTokenDto() + { + Token = NewToken, + PhpToken = tempDto.access_token, + RefreshToken = tempDto.refresh_token, + Expired = expires_time + }; + return accessToken; + }); + } + + /// + /// 鍒涘缓token + /// + /// + /// + /// + /// + private async Task CreateToken(UserInfoDto data, LoginTempV2Dto tempDto, string NewToken) + { + return await Task.Run(() => + { + + DateTime expires_time = TimeZone.CurrentTimeZone.ToLocalTime(new System.DateTime(1970, 1, 1)).AddSeconds(tempDto.access_expired_at); + AccessTokenDto accessToken = new AccessTokenDto() + { + Token = NewToken, + PhpToken = tempDto.access_token, + RefreshToken = tempDto.refresh_token, + Expired = expires_time + }; + return accessToken; + }); + } + + /// + /// 鑾峰彇鍗曠偣鐧诲綍淇℃伅 + /// + /// + /// + public async Task> GetUserInfoByCode(string code) + { + var reqData = new LoginAuthorizeCodeRequest(); + reqData.ClientId = _soaOptions.AppId; + reqData.ClientSecret = _soaOptions.AppSecret; + reqData.GrantType = "authorization_code"; + reqData.Code = code; + reqData.Scope = "credentials"; + + //杩欎釜鏄櫥褰曠殑鏃跺欑粰鍓嶇楠岃瘉鐨則oken,浠ュ強浼犵粰php鍗曠偣閭h竟鐨勪竴涓猻ession鍊硷紝鐢ㄤ簬鍗曠偣閫鍑烘椂锛岄氱煡ops閫鍑 + string NewToken = Guid.NewGuid().ToString("N"); + try + { + string result = _httpClientHelp.PostHttp(_soaOptions.Url_V3 + "/uc/authorize", reqData); + var jObject = JsonObject.Parse(result); + LoginInDto r = new LoginInDto(); + r.UserInfo = new UserInfoDto(); + r.TokenInfo = new AccessTokenDto(); + var login_result = jObject["code"] == 0 ? "鎴愬姛" : "澶辫触"; + + if (jObject["code"] == 0) + { + string datajson = jObject["data"].ToString(); + var _loginDto = JsonConvert.DeserializeObject(datajson); + + #region 瑙g爜 + string enptStr = _loginDto.encrypted_data; + List enptlist = enptStr.Trim().Split(',').ToList(); + string str = RSA.DecryptSection(_soaOptions.PrivateKey, enptlist); + var entity = JsonConvert.DeserializeObject(str); + #endregion + + //鏄犲皠鐧诲綍淇℃伅 + var userInfo_v3 = _mapper.Map(entity); + _logger.LogInformation($"鐧诲綍淇℃伅锛氱敤鎴稩D->{entity.id}"); + _logger.LogInformation($"鐧诲綍淇℃伅->{str}"); + //HTTP璇锋眰鑾峰彇鐧诲綍淇℃伅锛氫汉鍛橈紝瀹㈡埛锛屼緵搴斿晢锛屽叕鍙 + var loginRequest = new LoginSingleRequest() + { + UserId = entity.id, + + }; + var loginResponse_result = await _singleDataService.GetSingleDataNoCache, LoginSingleRequest, SingleLoginAction> + (loginRequest, SingleLoginAction.Staff, type: SingleControllerType.Login); + + //缁戝畾杩斿洖瀵硅薄鐨勭櫥褰曚俊鎭 + var staffName = "Null"; + var token = await CreateToken(r.UserInfo, _loginDto, NewToken); + r.TokenInfo = token; + if (loginResponse_result.Success && loginResponse_result.Data != null) + { + var loginResponse = loginResponse_result.Data; + if (loginResponse != null) + { + r.UserInfo.StaffId = loginResponse.Id; + staffName = loginResponse.Name; + } + } + r.UserInfo.CompanyId = userInfo_v3.Company.Id; + r.UserInfo.CompanyName = userInfo_v3.Company.Name; + r.UserInfo.UcId = userInfo_v3.Id; + r.UserInfo.SeesionId = "";//app鍜岀▼搴忕被鍨嬬櫥褰曟巿鏉冩病鏈夎繖涓瓧娈 + r.UserInfo.Nickname = userInfo_v3.Nickname; + r.UserInfo.Mobile = userInfo_v3.Mobile; + r.UserInfo.Identity = userInfo_v3.Identity;//1.缁勭粐 2.渚涘簲鍟 3.瀹㈡埛 + r.UserInfo.CustomerId = null; + r.UserInfo.SupplierId = null; + r.SignedIn = true; + if (entity != null && entity.orgs != null) + r.UserInfo.OrgId = entity.orgs.FirstOrDefault()?.org_id; + + if (userInfo_v3.Identity == 2) + {//渚涘簲鍟嗚幏鍙栦緵搴斿晢淇℃伅 + var result_supplier = await _singleDataService.GetSingleDataNoCache, UserRequest, SysConfigAction>( + new UserRequest(loginRequest.UserId), SysConfigAction.GetSupplierByUser, SingleControllerType.SysConfig); + if (!result_supplier.IsSuccess) + return Result.ReFailure("鎺堟潈澶辫触锛岃閲嶆柊鐧诲綍", 401); + if (result_supplier.Data.Count() <= 0) + return Result.ReFailure("鎺堟潈澶辫触锛岀敤鎴锋病鏈夊搴斾緵搴斿晢", 401); + SupplierInfoResponse supplier = result_supplier.Data.First(); + + r.UserInfo.SupplierId = supplier.Id; + r.UserInfo.SupplierName = supplier.Name; + r.UserInfo.SupplierCode = supplier.Code; + } + //鍒ゆ柇鏄惁鏄鐞嗗憳璐﹀彿 + var isAdmin = _soaOptions.AdminUser.Exists(f => f == r.UserInfo.UcId); + if (isAdmin) + r.UserInfo.IsAdmin = true; + + + //鐧诲綍鍚庣紦瀛樼櫥褰曠殑鐢ㄦ埛淇℃伅鍜宼oken淇℃伅 + var loginInfo = new LoginInDto(); + loginInfo.UserInfo = r.UserInfo; + loginInfo.TokenInfo = token; + loginInfo.TokenInfo.ClientName = "PC"; + + var ops_login_time = token.Expired.AddDays(1) - DateTime.Now;//鐢ㄤ簬姝e紡 + //var ops_login_time = token.Expired - DateTime.Now;//鐢ㄤ簬姝e紡 + _redisClientService.SetStringKey($"wms_login_{token.Token}", loginInfo, ops_login_time); + + _logger.LogInformation($"鐧诲綍淇℃伅锛氱敤鎴蜂汉鍛樹俊鎭->{staffName}锛坽r.UserInfo.StaffId}锛夛紝鍏徃鍚嶇О->{r.UserInfo.CompanyName}" + "锛岃繃鏈熸椂闂达細" + token.Expired.ToString("yyyy-MM-dd HH:mm:ss")); + + //鐧诲綍鎴愬姛绉诲嚭瀵瑰簲鐨勭敤鎴穞oken榛戝悕鍗曪細搴斾负鏂扮殑token浜х敓,绉婚櫎鐧诲綍鐨勪俊鎭 + string blacktoken = _redisClientService.GetStringKey($"wms_black_token_{r.UserInfo.UcId}"); + if (!string.IsNullOrEmpty(blacktoken)) + { + this.RemoveLoginInfo(blacktoken); + _redisClientService.RemoveStringKey($"wms_black_token_{r.UserInfo.UcId}"); + } + if (r == null || r.UserInfo == null || r.TokenInfo == null) + return Result.ReFailure("鎺堟潈澶辫触锛岃閲嶆柊鐧诲綍", 401); + return Result.ReSuccess(r); + } + else + { + var errno_text = "鐧诲綍澶辫触:" + jObject["message"]; + _logger.LogInformation("鐧婚檰澶辫触锛" + errno_text); + return Result.ReFailure(errno_text, 401); + } + } + catch (Exception ex) + { + _logger.LogInformation("鐧诲綍閿欒淇℃伅锛" + ex.Message); + return Result.ReFailure("鎺堟潈澶辫触锛岃閲嶆柊鐧诲綍", 401); + } + } + + /// + /// 鑾峰彇鍗曠偣鐢ㄦ埛淇℃伅 + /// + /// + /// + /// + public async Task> GetUserInfo(string username, string password) + { + var reqData = new LoginAuthorizeRequest(); + reqData.ClientId = _soaOptions.AppId; + reqData.ClientSecret = _soaOptions.AppSecret; + reqData.GrantType = "password"; + reqData.UserName = username; + reqData.Scope = "credentials"; + _logger.LogInformation($"username锛" + username + ";password:" + password); + var md5 = System.Security.Cryptography.MD5.Create(); + var md5Pwd = BitConverter.ToString(md5.ComputeHash(Encoding.Default.GetBytes(password))); + md5Pwd = md5Pwd.Replace("-", string.Empty); + reqData.Password = md5Pwd.ToLower(); + + //杩欎釜鏄櫥褰曠殑鏃跺欑粰鍓嶇楠岃瘉鐨則oken,浠ュ強浼犵粰php鍗曠偣閭h竟鐨勪竴涓猻ession鍊硷紝鐢ㄤ簬鍗曠偣閫鍑烘椂锛岄氱煡ops閫鍑 + string NewToken = Guid.NewGuid().ToString("N"); + try + { + string result = _httpClientHelp.PostHttp(_soaOptions.Url_V3 + "/uc/authorize", reqData); + var jObject = JsonObject.Parse(result); + LoginInDto r = new LoginInDto(); + r.UserInfo = new UserInfoDto(); + r.TokenInfo = new AccessTokenDto(); + var login_result = jObject["code"] == 0 ? "鎴愬姛" : "澶辫触"; + + if (jObject["code"] == 0) + { + string datajson = jObject["data"].ToString(); + var _loginDto = JsonConvert.DeserializeObject(datajson); + + #region 瑙g爜 + string enptStr = _loginDto.encrypted_data; + List enptlist = enptStr.Trim().Split(',').ToList(); + string str = RSA.DecryptSection(_soaOptions.PrivateKey, enptlist); + var entity = JsonConvert.DeserializeObject(str); + #endregion + + //鏄犲皠鐧诲綍淇℃伅 + var userInfo_v3 = _mapper.Map(entity); + _logger.LogInformation($"鐧诲綍淇℃伅锛氱敤鎴稩D->{entity.id}"); + //HTTP璇锋眰鑾峰彇鐧诲綍淇℃伅锛氫汉鍛橈紝瀹㈡埛锛屼緵搴斿晢锛屽叕鍙 + var loginRequest = new LoginSingleRequest() + { + UserId = entity.id, + + }; + var loginResponse_result = await _singleDataService.GetSingleDataNoCache, LoginSingleRequest, SingleLoginAction> + (loginRequest, SingleLoginAction.Staff, type: SingleControllerType.Login); + + //缁戝畾杩斿洖瀵硅薄鐨勭櫥褰曚俊鎭 + var staffName = "Null"; + var token = await CreateToken(r.UserInfo, _loginDto, NewToken); + r.TokenInfo = token; + if (loginResponse_result.Success && loginResponse_result.Data != null) + { + var loginResponse = loginResponse_result.Data; + if (loginResponse != null) + { + r.UserInfo.StaffId = loginResponse.Id; + staffName = loginResponse.Name; + } + } + r.UserInfo.CompanyId = userInfo_v3.Company.Id; + r.UserInfo.CompanyName = userInfo_v3.Company.Name; + r.UserInfo.UcId = userInfo_v3.Id; + r.UserInfo.SeesionId = "";//app鍜岀▼搴忕被鍨嬬櫥褰曟巿鏉冩病鏈夎繖涓瓧娈 + r.UserInfo.Nickname = userInfo_v3.Nickname; + r.UserInfo.Mobile = userInfo_v3.Mobile; + r.UserInfo.Identity = userInfo_v3.Identity; + r.UserInfo.OrgId = entity.orgs.FirstOrDefault()?.org_id; + r.UserInfo.CustomerId = null; + r.UserInfo.SupplierId = null; + r.SignedIn = true; + _logger.LogInformation($"鐧诲綍淇℃伅锛氱敤鎴蜂汉鍛樹俊鎭->{staffName}锛坽r.UserInfo.StaffId}锛夛紝鍏徃鍚嶇О->{r.UserInfo.CompanyName}"); + + //鐧诲綍鍚庣紦瀛樼櫥褰曠殑鐢ㄦ埛淇℃伅鍜宼oken淇℃伅 + var loginInfo = new LoginInDto(); + loginInfo.UserInfo = r.UserInfo; + loginInfo.TokenInfo = token; + loginInfo.TokenInfo.ClientName = "PDA"; + + var ops_login_time = token.Expired.AddDays(1) - DateTime.Now;//鐢ㄤ簬姝e紡 + //var ops_login_time = token.Expired - DateTime.Now;//鐢ㄤ簬姝e紡 + _redisClientService.SetStringKey($"wms_login_{token.Token}", loginInfo, ops_login_time); + + //鐧诲綍鎴愬姛绉诲嚭瀵瑰簲鐨勭敤鎴穞oken榛戝悕鍗曪細搴斾负鏂扮殑token浜х敓,绉婚櫎鐧诲綍鐨勪俊鎭 + string blacktoken = _redisClientService.GetStringKey($"wms_black_token_{r.UserInfo.UcId}"); + if (!string.IsNullOrEmpty(blacktoken)) + { + this.RemoveLoginInfo(blacktoken); + _redisClientService.RemoveStringKey($"wms_black_token_{r.UserInfo.UcId}"); + } + if (r == null || r.UserInfo == null || r.TokenInfo == null) + return Result.ReFailure("鎺堟潈澶辫触锛岃閲嶆柊鐧诲綍", 401); + return Result.ReSuccess(r); + } + else + { + var errno_text = "鐧诲綍澶辫触:" + jObject["message"]; + _logger.LogInformation("鐧婚檰澶辫触锛" + errno_text); + return Result.ReFailure(errno_text, 4001); + //r.SignedIn = false; + //string datajson_sessid = jObject["data"]["uc_sessid"]; + ////璋冪敤鍗曠偣鐨勯鍑烘帴鍙 + //result = _httpClientHelp.GetHttp(_soaOptions.Url + "/uc/authorize/signin_out", true, cookieValue: datajson_sessid); + //jObject = JsonObject.Parse(result); + //if (jObject["errno"] == 0) + //{ + // return Result.ReFailure("鎷掔粷鐢ㄦ埛璇佷功璇曞浘璁块棶姝eb绔欑偣锛岃涓庣珯鐐圭鐞嗗憳鑱旂郴浠ュ缓绔嬬敤鎴疯瘉涔︽潈闄", 403); + //} + //else + //{ + // return Result.ReFailure(jObject["errmsg"], jObject["errno"]); + //} + } + } + catch (Exception ex) + { + _logger.LogInformation("鐧诲綍閿欒淇℃伅锛" + ex.Message); + return Result.ReFailure("鎺堟潈澶辫触锛岃閲嶆柊鐧诲綍", 401); + } + } + + /// + /// 鐧诲綍閫鍑 + /// + /// + /// + public async Task LoginOut(LoginOutDto dto) + { + //2.璇锋眰PHP鍗曠偣鐧诲嚭鎺ュ彛 + var reqData = new LoginOutAuthorizeRequest(); + reqData.AccessToken = dto.AccessToken; + reqData.RefreshToken = dto.RefreshToken; + string result = _httpClientHelp.GetHttpOut(_soaOptions.Url_V3 + "/uc/logout", reqData); + _logger.LogInformation($"閫鍑哄弬鏁帮細{JsonConvert.SerializeObject(dto)}->閫鍑虹櫥褰曞崟鐐硅繑鍥:" + result); + var jObject = JsonObject.Parse(result); + if (jObject["code"] == 0) + { + //璁剧疆鏈湴token鐨勭紦瀛橈細涓洪粦鍚嶅崟鐨則oken鍋氬瓨鍌 + await CacheOutToken(dto); + return Result.ReSuccess(); + } + else + { + return Result.ReFailure(BaseResultCodes.UnAuthorized); + } + } + + /// + /// 鍒锋柊token + /// + /// + /// + /// + public async Task> RefreshTokenNew(string oldToken, string RefreshToken) + { + + //1.鏍规嵁鏃oken 鎵惧埌鐧诲綍瀵硅薄 + var loginInfo = _redisClientService.GetStringKey($"wms_login_{oldToken}"); + var reqData = new LoginAuthorizeRefreshTokenRequest(); + reqData.ClientId = _soaOptions.AppId; + reqData.ClientSecret = _soaOptions.AppSecret; + reqData.GrantType = "refresh_token"; + reqData.RefreshToken = RefreshToken; + reqData.Scope = "credentials"; + + var clientName = loginInfo?.TokenInfo?.ClientName; + var oldExpired = loginInfo?.TokenInfo?.Expired.ToString("yyyy-MM-dd HH:mm:ss"); + try + { + string result = _httpClientHelp.PostHttp(_soaOptions.Url_V3 + "/uc/authorize", reqData); + var jObject = JsonObject.Parse(result); + + LoginInDto r = new LoginInDto(); + r.UserInfo = new UserInfoDto(); + r.TokenInfo = new AccessTokenDto(); + + if (jObject["code"] == 0) + { + string datajson = jObject["data"].ToString(); + var _loginDto = JsonConvert.DeserializeObject(datajson); + + r.UserInfo = loginInfo.UserInfo; + r.SignedIn = true; + //string NewToken = Guid.NewGuid().ToString("N"); + var token = await CreateToken(loginInfo.UserInfo, _loginDto, oldToken); + r.TokenInfo = token; + loginInfo.TokenInfo = token; + loginInfo.TokenInfo.ClientName = clientName; + //_logger.LogInformation("RefreshToken:鎴戝湪鍒锋柊鐧诲綍锛氬埛鏂板悗鐨勮繃鏈熸椂闂-1>" + token.Expired.ToString()); + var ops_login_time = token.Expired.AddDays(1) - DateTime.Now;//鐢ㄤ簬姝e紡 + //var ops_login_time = token.Expired - DateTime.Now;//鐢ㄤ簬姝e紡 + _redisClientService.SetStringKey($"wms_login_{token.Token}", loginInfo, ops_login_time); + _logger.LogInformation($"鍒锋柊Token->鐢ㄦ埛淇℃伅锛歿JsonConvert.SerializeObject(loginInfo)}->鑰佹椂闂->" + $"{oldExpired}" + "锛屾柊鏃堕棿->" + $"wms_login_{token.Token}->杩囨湡鏃堕棿锛歿token.Expired.ToString("yyyy-MM-dd HH:mm:ss")}"); + //绉婚櫎鑰佺殑redis缂撳瓨 + //_redisClientService.RemoveStringKey($"wms_login_{oldToken}"); + //_logger.LogInformation("RefreshToken:鎴戝湪鍒锋柊鐧诲綍锛氬埛鏂板悗鐨勮繃鏈熸椂闂-灏忔椂->" + ops_login_time.Hours); + return Result.ReSuccess(r); + } + else + { + //澶辫触浜1锛氬氨鎶婄櫥褰曠殑token娓呴櫎 2锛 ucid娣诲姞鍒伴粦鍚嶅崟 + var time = new TimeSpan(r.TokenInfo.Expired.Day, r.TokenInfo.Expired.Hour, r.TokenInfo.Expired.Minute, r.TokenInfo.Expired.Second, r.TokenInfo.Expired.Millisecond); + _redisClientService.SetStringKey($"wms_black_token_{r.UserInfo.UcId}", r.TokenInfo.Token, time); + this.RemoveLoginInfo(r.TokenInfo.Token); + r.SignedIn = false; + return Result.ReFailure(jObject["message"], jObject["code"]); + } + } + catch (Exception ex) + { + _logger.LogInformation("RefreshTokenNew锛" + _soaOptions.Url_V3 + "/uc/authorize" + "锛欴ata锛" + JsonConvert.SerializeObject(reqData)); + _logger.LogInformation("RefreshTokenNew锛欵rror" + ex.Message); + return Result.ReFailure(ex.Message, 50001); + } + } + + /// + /// 鍗曠偣閫鍑洪氱煡token澶辨晥 + /// + /// 杩欎釜鏄崟鐐逛紶杩囨潵鐨凷eesionId + /// + public async Task LoginOutSingleAsync(string SeesionId) + { + var logininfo = _redisClientService.GetStringKey($"wms_login_{SeesionId}"); + await Task.Run(() => + { + if (logininfo != null) + { + var cache_token = _redisClientService.GetStringKey($"wms_black_token_{logininfo.UserInfo.UcId}"); + if (string.IsNullOrEmpty(cache_token)) + { + DateTime expires_time = logininfo.TokenInfo.Expired; + var time = new TimeSpan(expires_time.Day, expires_time.Hour, expires_time.Minute, expires_time.Second, expires_time.Millisecond); + _redisClientService.SetStringKey($"wms_black_token_{logininfo.UserInfo.UcId}", logininfo.TokenInfo.Token, time); + this.RemoveLoginInfo(logininfo.TokenInfo.Token); + } + } + }); + } + + /// + /// 缂撳瓨閫鍑虹殑token + /// + /// + /// + private async Task CacheOutToken(LoginOutDto dto) + { + await Task.Run(() => + { + if (!string.IsNullOrEmpty(dto.AccessToken)) + { + var time = new TimeSpan(dto.ExpiresIn.Day, dto.ExpiresIn.Hour, dto.ExpiresIn.Minute, dto.ExpiresIn.Second, dto.ExpiresIn.Millisecond); + _redisClientService.SetStringKey($"wms_black_token_{dto.UcId}", dto.AccessToken, time); + this.RemoveLoginInfo(dto.Token); + + } + }); + } + + /// + /// 鑾峰彇鐧诲綍鍚庣殑淇℃伅 + /// + /// + /// + public LoginInDto GetLoginInfo(string authorization) + { + string token = string.Empty; + if (authorization.StartsWith("Bearer ", StringComparison.OrdinalIgnoreCase)) + { + token = authorization.Substring("Bearer ".Length).Trim(); + } + var logininfo = _redisClientService.GetStringKey($"wms_login_{token}"); + return logininfo; + } + + /// + /// 绉婚櫎鐧诲綍鍚庣殑鐢ㄦ埛淇℃伅 + /// + /// + private void RemoveLoginInfo(string token) + { + if (!string.IsNullOrEmpty(token)) + { + var info = _redisClientService.GetStringKey($"wms_login_{token}"); + if (info != null) + { + _redisClientService.RemoveStringKey($"wms_login_{token}"); + } + } + } + + /// + /// 鑾峰彇鑿滃崟鏁版嵁 + /// + /// + public async Task> GetMenuList(int userId) + { + int module = _soaOptions.ModuleID; + var result = await _singleDataService.GetSingleDataNoCache, MenuRequest, SingleLoginAction> + (new MenuRequest(userId, module), SingleLoginAction.Menus, type: SingleControllerType.Login); + if (result.Success) + return result.Data.ToList(); + return null; + } + + /// + /// + /// + /// + /// + /// + public async Task Online(string accessToken, string refreshToken) + { + string result = await _httpClientHelp.PostHttp(_soaOptions.Url_V3 + "/uc/online", accessToken, refreshToken); + return Result.ReSuccess(); + } + + /// + /// + /// + /// + /// + /// + public async Task Offline(string accessToken, string refreshToken) + { + string result = await _httpClientHelp.PostHttp(_soaOptions.Url_V3 + "/uc/offline", accessToken, refreshToken); + return Result.ReSuccess(); + } + } +} diff --git a/src/BarCode.Web.Domain/Services/Public/MaterialService.cs b/src/BarCode.Web.Domain/Services/Public/MaterialService.cs new file mode 100644 index 0000000..77e8aa4 --- /dev/null +++ b/src/BarCode.Web.Domain/Services/Public/MaterialService.cs @@ -0,0 +1,150 @@ +锘縰sing AutoMapper; +using Microsoft.Extensions.Logging; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using BarCode.Web.Core.Dto.Erp; +using BarCode.Web.Core.Internal.Results; +using BarCode.Web.Domain.Entitys; +using BarCode.Web.Domain.Infrastructure; +using BarCode.Web.Domain.IService; +using BarCode.Web.Domain.IService.Public; +using BarCode.Web.Domain.Values; +using NPOI.OpenXmlFormats.Spreadsheet; +using Newtonsoft.Json; +using BarCode.Web.Domain.Options; +using Microsoft.Extensions.Caching.Memory; +using BarCode.Web.Domain.Services.Public; +using ERP; +using Microsoft.AspNetCore.Builder.Extensions; +using Microsoft.Extensions.Options; +using BarCode.Web.Core.Help; + +namespace BarCode.Web.Domain.Services +{ + /// + /// 鐗╂枡鏈嶅姟 + /// + public class MaterialService : IMaterialService + { + private IMapper _mapper; + private ILogger _logger; + private IErpService _erpService; + private IMaterialsRepositories _materialsRepositories; + private ErpOptions _erpOptions; + private readonly IMemoryCache _memoryCache; + public MaterialService(IMapper mapper, ILogger logger, IErpService erpService, + IMaterialsRepositories materialsRepositories, IOptions erpOptions, IMemoryCache memoryCache) + { + _mapper = mapper; + _logger = logger; + _erpService = erpService; + _materialsRepositories = materialsRepositories; + this._erpOptions = erpOptions.Value; + this._memoryCache = memoryCache; + } + /// + /// 鍚屾鐗╂枡32杩涘埗 + /// + /// + /// + public async Task SyncBar() + { + var list = await _materialsRepositories.GetEntityListByNoBar(); + if (list.Count() <= 0) return Result.ReSuccess(); + var numbers = list.Select(s => s.MaterialNumber).ToList(); + var mDtos = await _erpService.BillQueryForMaterialByNumbers(numbers); + if (!mDtos.IsSuccess) return Result.ReFailure(mDtos.Message, mDtos.Status); + if (mDtos.Data.Count() <= 0) return Result.ReSuccess(); + _logger.LogInformation($"鐗╂枡鏇存柊id32杩涘埗:{JsonConvert.SerializeObject(mDtos.Data)}"); + + var materials = _memoryCache.Get>(_erpOptions.cache_materail_key); + + + List update_list = new List(); + foreach (var m in mDtos.Data) + { + var entity = list.FirstOrDefault(f => f.MaterialNumber.Equals(m.MaterialNumber)); + if (entity == null) continue; + entity.IdConvertBar = m.IdConvertBar.Trim(); + update_list.Add(entity); + + //淇敼缂撳瓨 + if (materials == null) continue; + var entity_cache = materials.FirstOrDefault(f => f.MaterialNumber.Equals(m.MaterialNumber)); + if (entity_cache == null) continue; + entity_cache.IdConvertBar = m.IdConvertBar.Trim(); + } + //淇敼缂撳瓨 + if (materials != null && materials.Count() > 0) + { + _logger.LogInformation($"鐗╂枡缂撳瓨鎬绘暟:{materials.Count()}"); + _memoryCache.Set(_erpOptions.cache_materail_key, materials, new MemoryCacheEntryOptions().SetAbsoluteExpiration(TimeSpan.FromMinutes(DateTimeUtil.GetTotalMinutesTimeSpan()))); + } + await _materialsRepositories.UpdateRange(update_list); + return Result.ReSuccess(); + } + + /// + /// 鍚屾閲戣澏鏂扮殑鐗╂枡 + /// + /// + public async Task SyncNewMaterials() + { + try + { + _logger.LogInformation("鍚屾閲戣澏鏂扮墿鏂欙細寮濮->" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")); + //1.鑾峰彇鍏ㄩ儴鐗╂枡缂栫爜 + var materialNumbers = await _materialsRepositories.GetAllNumbers(); + //1.1閫氳繃hash澶勭悊 + var materialNumberSet = new HashSet(materialNumbers); + + //2.鑾峰彇閲戣澏鐗╂枡:涓嶅彇缂撳瓨鐨 + var mats_result = await _erpService.BillQueryForMaterial(false); + var mats = new List(); + if (mats_result.IsSuccess) + mats = mats_result.Data.ToList(); + + //3.閫氳繃hash,鏇村揩鐨勬椂闂村唴鍒ゆ柇鍏冪礌鏄惁瀛樺湪浜庨泦鍚堜腑,鎻愰珮鎬ц兘锛10W鏁版嵁鍗佸嚑姣绾у埆锛 + var entitys = mats + .Where(item => !materialNumberSet.Contains(item.MaterialNumber)) + .Select(item => _mapper.Map(item)) + .ToList(); + + //4.娣诲姞鏁版嵁搴 + if (entitys.Count != 0) + { + var isSuccess = await _materialsRepositories.AddRange(entitys); + if (!isSuccess) + return Result.ReFailure(ResultCodes.DateWriteError); + } + //5.淇敼鐗╂枡鏁版嵁 + if (mats.Count != 0) + { + var isBatchManageMatNumbs = mats.Where(x => x.IsBatchManage == true).Select(x => x.MaterialNumber).ToList(); + //鍙栵細閲戣澏鎷夊彇鐨勫凡鍚敤鎵瑰彿绠$悊鐨勭墿鏂欏苟涓旀湰鍦版暟鎹簱涓殑鏈惎鐢ㄦ壒鍙风鐞嗙殑鐗╂枡锛涙潵鏇存柊鎵瑰彿绠$悊淇敼涓簍rue + var updateList = await _materialsRepositories.GetEntityList(isBatchManageMatNumbs, false); + if (updateList.Count != 0) + { + updateList.ForEach(x => { x.IsBatchManage = true; }); + var isSuccess = await _materialsRepositories.UpdateRange(updateList); + if (!isSuccess) + _logger.LogInformation("鍚屾閲戣澏鏂扮墿鏂-淇敼鐗╂枡锛氬け璐"); + else + _logger.LogInformation("鍚屾閲戣澏鏂扮墿鏂-淇敼鐗╂枡锛氭垚鍔->" + updateList.Count + "鏉"); + } + } + + _logger.LogInformation("鍚屾閲戣澏鏂扮墿鏂欙細缁撴潫->" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "->娣诲姞鏁伴噺锛" + entitys.Count); + return Result.ReSuccess(); + } + catch (Exception ex) + { + _logger.LogInformation("鍚屾閲戣澏鏂扮墿鏂欙細澶辫触->" + ex.Message); + return Result.ReFailure(ex.Message, ex.HResult); + } + } + } +} diff --git a/src/BarCode.Web.Domain/Services/Public/Radix.cs b/src/BarCode.Web.Domain/Services/Public/Radix.cs new file mode 100644 index 0000000..fec4746 --- /dev/null +++ b/src/BarCode.Web.Domain/Services/Public/Radix.cs @@ -0,0 +1,344 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BarCode.Web.Domain.Services.Public +{ + // string exclude = "ISOZ";//ISOZ + // streamNo = Radix.ConvertRadix36((ulong)decstreamNo, exclude.ToCharArray()).PadLeft(FLength ?? 0, '0'); + public static class Radix + { + //36杩涘埗 + static string[] radixs = { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F", "G", "H", + + "I", "J", "K","L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z" }; + + /// + /// 杩涘埗杞崲 + /// + /// 鏁村舰鏁板瓧 + /// 鎺掗櫎鐨勫瓧绗"0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", + /// "C", "D", "E", "F", "G", "H", "I", "J", "K","L", "M", "N", "O", "P", "Q", "R", "S", + /// "T", "U", "V", "W", "X", "Y", "Z" + /// + public static string ConvertRadix(ulong lg, string[] excepts) + + { + + var data = new List(); + + foreach (var rd in radixs) + + { + + var isexists = false; + + foreach (var ex in excepts) + + { + + if (rd.Equals(ex.ToUpper())) + + { + + isexists = true; + + break; + + } + + } + + if (isexists) + + { + + data.Add(rd); + + } + + } + + + + var rds = data.ToArray(); + + + + //杩涘埗 + + uint radix = (uint)rds.Length; + + //long lg = 800000000853; + + + + var s1 = lg / radix; + + var s2 = lg % radix; + + var rt = rds[radix]; + + while (s1 > 0) + + { + + var temp = s1; + + s1 = temp / radix; + + s2 = temp % radix; + + rt = rds[s2] + rt; + + } + + //Q91VEGTN + + //Console.WriteLine(rt); + + return rt; + + } + + public static string ConvertRadix36(ulong val, char[] excepts) + + { + + string BaseChar = "0123456789ABCDEFGHIJKLMNPQRSTUVWXYZ"; + + foreach (var v in excepts) + + { + + BaseChar = BaseChar.Replace(v.ToString().ToUpper(), ""); + + } + + List r = new List(); + + do + + { + + ulong y = val % (ulong)BaseChar.Length; + + r.Add(BaseChar[Convert.ToInt32(y)].ToString()); + + val = Convert.ToUInt64(Math.Floor(val / (decimal)BaseChar.Length)); + + } while (val > 0); + + r.Reverse(); + + return string.Join("", r.ToArray()); + + } + + public static string Main(long lg) + + { + + string[] data = new string[] { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", + + "A", "B", "C", "D", "E", "F","G", "H", "J", "K", "L", "M", "N", "Q", "R", "T", "U", "V", "W", "X", "Y" }; + + var s1 = lg / 32; + + var s2 = lg % 32; + + var rt = data[s2]; + + while (s1 > 0) + + { + + var temp = s1; + + s1 = temp / 32; + + s2 = temp % 32; + + rt = data[s2] + rt; + + } + + //Q91VEGTN + + return rt; + + } + + public static string IntToi32(long xx) + + { + + string a = ""; + + while (xx >= 1) + + { + + int index = Convert.ToInt16(xx - (xx / 32) * 32); + + a = Base64Code[index] + a; + + xx = xx / 32; + + } + + return a; + + } + + public static long i32ToInt(string xx) + + { + + long a = 0; + + int power = xx.Length - 1; + + + + for (int i = 0; i <= power; i++) + + { + + a += _Base64Code[xx[power - i].ToString()] * Convert.ToInt64(Math.Pow(32, i)); + + } + + + + return a; + + } + + public static string IntToi64(long xx) + + { + + string a = ""; + + while (xx >= 1) + + { + + int index = Convert.ToInt16(xx - (xx / 64) * 64); + + a = Base64Code[index] + a; + + xx = xx / 64; + + } + + return a; + + } + + public static long i64ToInt(string xx) + + { + + long a = 0; + + int power = xx.Length - 1; + + + + for (int i = 0; i <= power; i++) + + { + + a += _Base64Code[xx[power - i].ToString()] * Convert.ToInt64(Math.Pow(64, i)); + + } + + + + return a; + + } + + public static Dictionary Base64Code = new Dictionary() { + + { 0 ,"z"}, { 1 ,"1"}, { 2 ,"2"}, { 3 ,"3"}, { 4 ,"4"}, { 5 ,"5"}, { 6 ,"6"}, { 7 ,"7"}, { 8 ,"8"}, { 9 ,"9"}, + + { 10 ,"a"}, { 11 ,"b"}, { 12 ,"c"}, { 13 ,"d"}, { 14 ,"e"}, { 15 ,"f"}, { 16 ,"g"}, { 17 ,"h"}, { 18 ,"i"}, { 19 ,"j"}, + + { 20 ,"k"}, { 21 ,"x"}, { 22 ,"m"}, { 23 ,"n"}, { 24 ,"y"}, { 25 ,"p"}, { 26 ,"q"}, { 27 ,"r"}, { 28 ,"s"}, { 29 ,"t"}, + + { 30 ,"u"}, { 31 ,"v"}, { 32 ,"w"}, { 33 ,"x"}, { 34 ,"y"}, { 35 ,"z"}, { 36 ,"A"}, { 37 ,"B"}, { 38 ,"C"}, { 39 ,"D"}, + + { 40 ,"E"}, { 41 ,"F"}, { 42 ,"G"}, { 43 ,"H"}, { 44 ,"I"}, { 45 ,"J"}, { 46 ,"K"}, { 47 ,"L"}, { 48 ,"M"}, { 49 ,"N"}, + + { 50 ,"O"}, { 51 ,"P"}, { 52 ,"Q"}, { 53 ,"R"}, { 54 ,"S"}, { 55 ,"T"}, { 56 ,"U"}, { 57 ,"V"}, { 58 ,"W"}, { 59 ,"X"}, + + { 60 ,"Y"}, { 61 ,"Z"}, { 62 ,"-"}, { 63 ,"_"}, + + }; + + public static Dictionary _Base64Code + + { + + get + + { + + return Enumerable.Range(0, Base64Code.Count()).ToDictionary(i => Base64Code[i], i => i); + + } + + } + + //36杩涘埗杞10杩涘埗 + public static int int32Convert10(string str) + + { + + int d = 0; + + int b; + + char[] ch = str.ToCharArray(); + + int j = 0; + + for (int i = ch.Length - 1; i >= 0; i--) + + { + + char c = ch[i]; + + b = 1; + + for (int t = 0; t < j; t++) + + b = b * 32; + + j++; + + int cc; + + if (c >= '0' && c <= '9') + + cc = Convert.ToInt32(c) - 48; + + else + + cc = Convert.ToInt32(c) - 65 + 10; + + d += cc * b; + + } + + return d; + + } + + } +} diff --git a/src/BarCode.Web.Domain/Services/Public/RedisClientService.cs b/src/BarCode.Web.Domain/Services/Public/RedisClientService.cs new file mode 100644 index 0000000..46fcafb --- /dev/null +++ b/src/BarCode.Web.Domain/Services/Public/RedisClientService.cs @@ -0,0 +1,93 @@ +锘縰sing Microsoft.Extensions.Options; +using Newtonsoft.Json; +using StackExchange.Redis; +using System; +using System.Collections.Generic; +using System.Text; +using BarCode.Web.Domain.Options; + +namespace BarCode.Web.Domain.Services.Public +{ + public class RedisClientService + { + private static readonly object Locker = new object(); + + private ConnectionMultiplexer redisMultiplexer; + IDatabase db = null; + private readonly AppOptions _options; + public RedisClientService(IOptions options) + { + _options = options?.Value; + redisMultiplexer = ConnectionMultiplexer.Connect(_options.RedisConnectionString); + db = redisMultiplexer.GetDatabase(); + } + + #region String + /// + /// 淇濆瓨鍗曚釜key value + /// + /// + /// + /// + /// + public bool SetStringKey(string key, string value, TimeSpan? expiry = default(TimeSpan?)) + { + var lastKey = _options.RedisDirectory + ":" + key; + return db.StringSet(lastKey, value, expiry); + } + + /// + /// 鑾峰彇鍗曚釜key鐨勫 + /// + public RedisValue GetStringKey(string key) + { + var lastKey = _options.RedisDirectory + ":" + key; + return db.StringGet(lastKey); + } + + /// + /// 绉婚櫎redis + /// + /// + /// + public bool RemoveStringKey(string key) + { + var lastKey = _options.RedisDirectory + ":" + key; + return db.KeyDelete(lastKey); + } + /// + /// 鑾峰彇涓涓猭ey鐨勫璞 + /// + public T GetStringKey(string key) + { + if (db == null) + { + return default; + } + var lastKey = _options.RedisDirectory + ":" + key; + var value = db.StringGet(lastKey); + if (value.IsNullOrEmpty) + { + return default; + } + return JsonConvert.DeserializeObject(value); + } + + /// + /// 淇濆瓨涓涓璞 + /// + /// + public bool SetStringKey(string key, T obj, TimeSpan? expiry = default(TimeSpan?)) + { + if (db == null) + { + return false; + } + var lastKey = _options.RedisDirectory + ":" + key; + string json = JsonConvert.SerializeObject(obj); + return db.StringSet(lastKey, json, expiry); + } + + #endregion + } +} diff --git a/src/BarCode.Web.Domain/Services/Public/RedisConcurrentProcessService.cs b/src/BarCode.Web.Domain/Services/Public/RedisConcurrentProcessService.cs new file mode 100644 index 0000000..ccd2461 --- /dev/null +++ b/src/BarCode.Web.Domain/Services/Public/RedisConcurrentProcessService.cs @@ -0,0 +1,37 @@ +锘縰sing StackExchange.Redis; +using System; +using System.Collections.Generic; +using System.Text; +using BarCode.Web.Domain.IService.Public; + +namespace BarCode.Web.Domain.Services.Public +{ + public class RedisConcurrentProcessService: IRedisConcurrentProcessService + { + private readonly RedisClientService _redisClientService; + public RedisConcurrentProcessService(RedisClientService redisClientService) + { + this._redisClientService = redisClientService; + } + + public bool CanAccessMethod(string cacheKey) + { + // 浣跨敤 Redis 鏉ュ瓨鍌ㄥ苟鍙戞帶鍒舵爣璁 + return _redisClientService.SetStringKey(cacheKey, true, TimeSpan.FromMinutes(1)); + } + + + public bool GetRedisKeyValue(string cacheKey) + { + // 浣跨敤 Redis 鏉ュ瓨鍌ㄥ苟鍙戞帶鍒舵爣璁 + var isSuccess= _redisClientService.GetStringKey(cacheKey); + return isSuccess; + } + + public void UpdateAccessStatus(string cacheKey, bool canAccess) + { + // 鏇存柊 Redis 缂撳瓨椤圭殑鍊 + _redisClientService.SetStringKey(cacheKey, canAccess, TimeSpan.FromMinutes(1)); + } + } +} diff --git a/src/BarCode.Web.Domain/Services/Public/SingleDataService.cs b/src/BarCode.Web.Domain/Services/Public/SingleDataService.cs new file mode 100644 index 0000000..99dc4cc --- /dev/null +++ b/src/BarCode.Web.Domain/Services/Public/SingleDataService.cs @@ -0,0 +1,476 @@ +锘縰sing Microsoft.Extensions.Caching.Memory; +using Microsoft.Extensions.Logging; +using Microsoft.Extensions.Options; +using System; +using System.Collections.Generic; +using System.IdentityModel.Tokens.Jwt; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using BarCode.Web.Core.Dto.SingleData; +using BarCode.Web.Core.Internal.Results; +using BarCode.Web.Domain.IService.Public; +using BarCode.Web.Domain.Options; +using BarCode.Web.Domain.Values.Single; +using Newtonsoft.Json; + +namespace BarCode.Web.Domain.Services.Public +{ + /// + /// 鍗曠偣鏁版嵁杩斿洖鏈嶅姟 + /// + public class SingleDataService : ISingleDataService + { + private readonly AppOptions _options; + private readonly IHttpClientService _httpClientService; + private readonly ILogger _logger; + private readonly IMemoryCache _memoryCache; + private int hours = 10;//杩囨湡鏃堕棿 榛樿10灏忔椂 + + public SingleDataService(IOptions options, IHttpClientService httpClientService, ILogger logger, IMemoryCache memoryCache) + { + this._memoryCache = memoryCache; + this._options = options?.Value; + this._httpClientService = httpClientService; + this._logger = logger; + } + + /// + /// 鑾峰彇鍗曠偣鏁版嵁锛氭牴鎹帴鍙f柟娉曞悕鍜屽叕鍙窱D + /// 鍚庣鍒楄〃鏌ヨ缁熶竴浣跨敤 + /// + /// + /// + /// + public string GetSingleData(SingleAction action, int companyId, int id) + { + try + { + if (id == 0) + return ""; + + var cache_key = action + "_" + companyId + "_IdGetName"; + var dic = _memoryCache.Get>(cache_key); + if (dic == null || dic.Count <= 0 || !dic.ContainsKey(id)) + { + if (dic != null) + { + + string no_data_key = cache_key + "_NoData"; + var cache_id = _memoryCache.Get(no_data_key); + if (cache_id == true) return ""; + //鏈壘鍒版暟鎹姹 + if (!dic.ContainsKey(id)) + { + _memoryCache.Set(no_data_key, true, new MemoryCacheEntryOptions().SetAbsoluteExpiration(TimeSpan.FromMinutes(30))); + } + } + var list = SingleDataPost(action, companyId, cache_key); + if (list.Count() <= 0) return ""; + dic = list.ToDictionary(s => s.Id, s => s.Name); + _memoryCache.Set(cache_key, dic, new MemoryCacheEntryOptions().SetAbsoluteExpiration(TimeSpan.FromHours(hours))); + } + if (!dic.ContainsKey(id)) return ""; + return dic[id]; + } + catch (Exception ex) + { + _logger.LogError($"璇锋眰鍗曠偣鏁版嵁閿欒锛欰ction->{action.ToString()}锛孋ompanyeId->{companyId},Id->{id}锛(閿欒鍘熷洜)=>{ex.Message}"); + return ""; + } + } + + /// + /// 鑾峰彇鍗曠偣鏁版嵁锛氭牴鎹帴鍙f柟娉曞悕鍜屽叕鍙窱D + /// 鍚庣鍒楄〃鏌ヨ缁熶竴浣跨敤 + /// + /// + /// + /// + public decimal GetSingleDataNumber(SingleAction action, int companyId, int id) + { + try + { + if (id == 0) + return 0; + + var cache_key = action + "_" + companyId + "_IdGetNumber"; + var dic = _memoryCache.Get>(cache_key); + if (dic == null || dic.Count <= 0 || !dic.ContainsKey(id)) + { + if (dic != null) + { + string no_data_key = cache_key + "_NoData"; + var cache_id = _memoryCache.Get(no_data_key); + if (cache_id == true) return 0; + //鏈壘鍒版暟鎹姹 + if (!dic.ContainsKey(id)) + { + _memoryCache.Set(no_data_key, true, new MemoryCacheEntryOptions().SetAbsoluteExpiration(TimeSpan.FromMinutes(30))); + } + } + + var list = SingleDataPost(action, companyId, cache_key); + if (list.Count() <= 0) return 0; + + dic = list.ToDictionary(s => s.Id, s => s.Number); + _memoryCache.Set(cache_key, dic, new MemoryCacheEntryOptions().SetAbsoluteExpiration(TimeSpan.FromHours(hours))); + } + + if (!dic.ContainsKey(id)) return 0; + return dic[id]; + } + catch (Exception ex) + { + _logger.LogError($"璇锋眰鍗曠偣鏁版嵁閿欒锛歿action.ToString()}=>{ex.Message}"); + return 0; + } + } + + /// + /// 鑾峰彇鍗曠偣鏁版嵁锛氭牴鎹帴鍙f柟娉曞悕鍜屽叕鍙窱D + /// 鍚庣鍒楄〃鏌ヨ缁熶竴浣跨敤 + /// + /// + /// + /// + public string GetSingleDataCode(SingleAction action, int companyId, int id) + { + try + { + if (id == 0) + return ""; + + var cache_key = action + "_" + companyId + "_IdGetCode"; + var dic = _memoryCache.Get>(cache_key); + if (dic == null || dic.Count <= 0 || !dic.ContainsKey(id)) + { + if (dic != null) + { + string no_data_key = cache_key + "_NoData"; + var cache_id = _memoryCache.Get(no_data_key); + if (cache_id == true) return ""; + //鏈壘鍒版暟鎹姹 + if (!dic.ContainsKey(id)) + { + _memoryCache.Set(no_data_key, true, new MemoryCacheEntryOptions().SetAbsoluteExpiration(TimeSpan.FromMinutes(30))); + } + } + + var list = SingleDataPost(action, companyId, cache_key); + if (list.Count() <= 0) return ""; + + dic = list.ToDictionary(s => s.Id, s => s.Code); + _memoryCache.Set(cache_key, dic, new MemoryCacheEntryOptions().SetAbsoluteExpiration(TimeSpan.FromHours(hours))); + } + + if (!dic.ContainsKey(id)) return ""; + return dic[id]; + } + catch (Exception ex) + { + _logger.LogError($"璇锋眰鍗曠偣鏁版嵁閿欒锛歿action.ToString()}=>{ex.Message}"); + return ""; + } + } + + /// + /// 鏍规嵁鍚嶅瓧妯$硦鍖归厤 + /// + /// + /// + /// + /// + public List GetIdsBySingleName(SingleAction action, int companyId, string name) + { + try + { + var cache_key = action + "_" + companyId + "_NameGetIds"; + var dic = _memoryCache.Get>(cache_key); + if (dic == null || dic.Count <= 0) + { + var list = SingleDataPost(action, companyId, cache_key); + if (list.Count() <= 0) return new List(); + + dic = list.ToDictionary(s => s.Id, s => s.Name); + _memoryCache.Set(cache_key, dic, new MemoryCacheEntryOptions().SetAbsoluteExpiration(TimeSpan.FromHours(hours))); + } + var res = from d in dic where d.Value.Contains(name) select d; + return res.Select(s => s.Key).ToList(); + } + catch (Exception ex) + { + _logger.LogError($"璇锋眰鍗曠偣鏁版嵁閿欒锛歿action.ToString()}=>{ex.Message}"); + return new List(); + } + } + + /// + /// 鑾峰彇鍗曠偣鏁版嵁锛氭牴鎹帴鍙f柟娉曞悕鍜屽叕鍙窱D + /// 鍚庣鍒楄〃鏌ヨ缁熶竴浣跨敤 + /// + /// + /// + /// + public string GetSingleData(SingleAction action, int companyId, string code) + { + try + { + if (string.IsNullOrEmpty(code)) + return ""; + + var cache_key = action + "_" + companyId + "_CodeGetName"; + var dic = _memoryCache.Get>(cache_key); + //浠撳簱鍜屽鎴蜂粨搴 涓嶈兘涓虹┖浜嗗氨閲嶆柊璇锋眰 搴斾负 杩欓噷鏄粠浠撳簱鍜屽鎴蜂粨搴撳彇鍊 鏈変竴涓繀鐒跺彇涓嶅埌 + if (dic == null || dic.Count <= 0) + { + if (dic != null) + { + string no_data_key = cache_key + "_NoData"; + var cache_id = _memoryCache.Get(no_data_key); + if (cache_id == true) return ""; + //鏈壘鍒版暟鎹姹 + if (!dic.ContainsKey(code)) + { + _memoryCache.Set(no_data_key, true, new MemoryCacheEntryOptions().SetAbsoluteExpiration(TimeSpan.FromMinutes(30))); + } + } + + var list = SingleDataPost(action, companyId, cache_key); + + var json = JsonConvert.SerializeObject(list); + if (list.Count() <= 0) return ""; + + dic = list.ToDictionary(s => s.Code, s => s.Name); + _memoryCache.Set(cache_key, dic, new MemoryCacheEntryOptions().SetAbsoluteExpiration(TimeSpan.FromHours(hours))); + } + + if (!dic.ContainsKey(code)) return ""; + var name = dic[code]; + return dic[code]; + } + catch (Exception ex) + { + _logger.LogError($"璇锋眰鍗曠偣鏁版嵁閿欒锛歿action.ToString()}=>{ex.Message}"); + return ""; + } + } + + /// + /// 鑾峰彇鍗曠偣鏁版嵁闆嗗悎锛氭硾鍨-鍚屾 + /// + /// + /// + /// + /// + public List GetSingleData(SingleAction action, int companyId) where T : class + { + try + { + var cache_key = action + "_list_" + companyId; + var list = _memoryCache.Get>(cache_key); + if (list == null || list.Count <= 0) + list = SingleDataPost(action, companyId, cache_key); + + return list; + } + catch (Exception ex) + { + _logger.LogError($"璇锋眰鍗曠偣鏁版嵁閿欒锛歿action.ToString()}=>{ex.Message}"); + return null; + } + } + + /// + /// 鑾峰彇鍗曠偣鏁版嵁闆嗗悎锛氭硾鍨-寮傛 + /// + /// + /// + /// + /// + public async Task> GetSingleDataAsync(SingleAction action, int companyId) where T : class + { + try + { + var cache_key = action + "_list_" + companyId; + var list = _memoryCache.Get>(cache_key); + if (list == null || list.Count <= 0) + list = await SingleDataPostAsync(action, companyId, cache_key); + + return list; + } + catch (Exception ex) + { + _logger.LogError($"璇锋眰鍗曠偣鏁版嵁閿欒锛歿action.ToString()}=>{ex.Message}"); + return null; + } + } + + /// + /// 鑾峰彇鍗曠偣鏁版嵁闆嗗悎锛氭硾鍨-寮傛-鏃犵紦瀛 + /// + /// + /// + /// + /// + public async Task> GetSingleDataNoCacheAsync(SingleAction action, int companyId) where T : class + { + try + { + var list = await SingleDataPostAsync(action, companyId, ""); + return list; + } + catch (Exception ex) + { + _logger.LogError($"璇锋眰鍗曠偣鏁版嵁閿欒锛歿action.ToString()}=>{ex.Message}"); + return null; + } + } + + /// + /// 鍗曠偣鏁版嵁锛氬彲瀵规帴鍏ㄩ儴鎺ュ彛 + /// + /// 杩斿洖瀵硅薄 + /// 璇锋眰瀵硅薄 + /// 鏂规硶鍚嶇О + /// 璇锋眰瀵硅薄 + /// 鏂规硶鍚嶇О + /// 鎺у埗鍣ㄥ悕绉 + /// + public async Task GetSingleData(X dto, Y action, SingleControllerType type = SingleControllerType.Single) where T : class + { + try + { + var para = JsonConvert.SerializeObject(dto); + var cache_key = action + "_list_" + type + "_" + para; + var list = _memoryCache.Get(cache_key); + if (list == null) + { + var url = _options.SingleBaseUrl + "/" + type.ToString() + "/" + action.ToString(); + var result = await _httpClientService.PostAsync(url, para); + _memoryCache.Set(cache_key, result, new MemoryCacheEntryOptions().SetAbsoluteExpiration(TimeSpan.FromHours(hours))); + } + return _memoryCache.Get(cache_key); + } + catch (Exception ex) + { + _logger.LogError($"璇锋眰鍗曠偣鏁版嵁閿欒锛歿action.ToString()}=>{ex.Message}"); + return default(T); + } + } + + /// + /// 鍗曠偣鏁版嵁锛氬彲瀵规帴鍏ㄩ儴鎺ュ彛 + /// + /// 杩斿洖瀵硅薄 + /// 璇锋眰瀵硅薄 + /// 鏂规硶鍚嶇О + /// 璇锋眰瀵硅薄 + /// 鏂规硶鍚嶇О + /// 鎺у埗鍣ㄥ悕绉 + /// + public async Task GetSingleDataNoCache(X dto, Y action, SingleControllerType type = SingleControllerType.Single) where T : class + { + try + { + var para = JsonConvert.SerializeObject(dto); + var url = _options.SingleBaseUrl + "/" + type.ToString() + "/" + action.ToString(); + var result = await _httpClientService.PostAsync(url, para); + return result; + } + catch (Exception ex) + { + _logger.LogError($"璇锋眰鍗曠偣鏁版嵁閿欒锛歿action.ToString()}=>{ex.Message}"); + return default(T); + } + } + + /// + /// 鑾峰彇鍗曠偣鏁版嵁锛氶厤缃」鎺ュ彛 + /// + /// + /// + /// + /// + /// + public async Task GetSysConfigData(X dto, SysConfigAction action) + { + try + { + var para = JsonConvert.SerializeObject(dto); + var url = _options.SingleBaseUrl + "/" + SingleControllerType.SysConfig.ToString() + "/" + action.ToString(); + var result = await _httpClientService.PostAsync(url, para); + return result; + } + catch (Exception ex) + { + _logger.LogError($"璇锋眰鍗曠偣鏁版嵁閿欒锛歿action.ToString()}=>{ex.Message}"); + return default(T); + } + } + + + #region 绉佹湁鏂规硶 + + /// + /// 璇锋眰鍗曠偣鏈嶅姟鎺ュ彛锛氬悓姝 + /// + /// + /// + /// + /// + private List SingleDataPost(SingleAction action, int companyId, string cache_key) + { + var dto = new SingleDataRequest(companyId); + //var para = JsonExtensions.SerializeToJson(dto); + var para = JsonConvert.SerializeObject(dto); + var url = _options.SingleBaseUrl + "/" + SingleControllerType.Single.ToString() + "/" + action.ToString(); + var result = _httpClientService.PostAsync>(url, para).GetAwaiter().GetResult(); + if (!result.Success) + return new List(); + return result.Data.ToList(); + } + + /// + /// 璇锋眰鍗曠偣鏈嶅姟鎺ュ彛锛氬紓姝 + /// + /// + /// + /// + /// + private async Task> SingleDataPostAsync(SingleAction action, int companyId, string cache_key) + { + var dto = new SingleDataRequest(companyId); + var para = JsonConvert.SerializeObject(dto); + var url = _options.SingleBaseUrl + "/" + SingleControllerType.Single.ToString() + "/" + action.ToString(); + var result = await _httpClientService.PostAsync>(url, para); + if (result.Success) + { + if (!string.IsNullOrEmpty(cache_key)) + { + _memoryCache.Set(cache_key, result.Data.ToList(), new MemoryCacheEntryOptions().SetAbsoluteExpiration(TimeSpan.FromHours(hours))); + return _memoryCache.Get>(cache_key); + } + return result.Data.ToList(); + } + return null; + } + + + + #endregion + /// + /// 鑾峰彇瀹㈡埛浠撳簱 + /// + /// + /// + /// + public string GetCustomerStock(int companyId, string customerStockCode) + { + return string.IsNullOrEmpty(this.GetSingleData(SingleAction.CustomerStocks, companyId, customerStockCode)) ? + this.GetSingleData(SingleAction.Stocks, companyId, customerStockCode) : + this.GetSingleData(SingleAction.CustomerStocks, companyId, customerStockCode); + } + + } +} diff --git a/src/BarCode.Web.Domain/Services/Public/WmsService.cs b/src/BarCode.Web.Domain/Services/Public/WmsService.cs new file mode 100644 index 0000000..735b851 --- /dev/null +++ b/src/BarCode.Web.Domain/Services/Public/WmsService.cs @@ -0,0 +1,57 @@ +锘縰sing Microsoft.Extensions.Caching.Memory; +using Microsoft.Extensions.Logging; +using Microsoft.Extensions.Options; +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Text; +using System.Threading.Tasks; +using BarCode.Web.Core.Dto; +using BarCode.Web.Domain.IService.Public; +using BarCode.Web.Domain.Options; +using BarCode.Web.Core.Internal.Results; +using BarCode.Web.Core.Dto.Box; +using Org.BouncyCastle.Asn1.Ocsp; +using BarCode.Web.Domain.Values; + +namespace BarCode.Web.Domain.Services.Public +{ + /// + /// ops鏈嶅姟 + /// + public class WmsService : IWmsService + { + private readonly IHttpClientService _httpClientService; + private readonly ILogger _logger; + private readonly IMemoryCache _memoryCache; + private int hours = 10;//杩囨湡鏃堕棿 榛樿10灏忔椂 + private readonly WmsOptions _option; + + public WmsService(IHttpClientService httpClientService, ILogger logger, + IMemoryCache memoryCache, IOptions option) + { + this._memoryCache = memoryCache; + this._httpClientService = httpClientService; + this._logger = logger; + _option = option.Value; + } + /// + /// 閲嶇疆绠变俊鎭 + /// + /// + /// + /// + public async Task>> Restart(List boxBillNos) + { + OperateStrRequest request = new OperateStrRequest() + { + Ids = boxBillNos + }; + + _logger.LogInformation($"閲嶇疆绠 璇锋眰鍙傛暟:{JsonConvert.SerializeObject(request)}"); + var res = await _httpClientService.PostAsync>>(_option.Url + "api/BarCode/Restart", JsonConvert.SerializeObject(request)); + _logger.LogInformation($"閲嶇疆绠 杩斿洖鍙傛暟:{JsonConvert.SerializeObject(res)}"); + return res; + } + } +} diff --git a/src/BarCode.Web.Domain/Services/QiniuUploadService.cs b/src/BarCode.Web.Domain/Services/QiniuUploadService.cs new file mode 100644 index 0000000..236967a --- /dev/null +++ b/src/BarCode.Web.Domain/Services/QiniuUploadService.cs @@ -0,0 +1,73 @@ +锘縰sing Microsoft.Extensions.Options; +using Newtonsoft.Json; +using Qiniu.Http; +using Qiniu.Storage; +using Qiniu.Util; +using System; +using System.Collections.Generic; +using System.IO; +using System.Text; +using System.Threading.Tasks; +using BarCode.Web.Core.Internal.Results; +using BarCode.Web.Domain.IService; +using BarCode.Web.Domain.Options; + +namespace BarCode.Web.Domain.Services +{ + public class QiniuUploadService : IQiniuUploadService + { + private readonly QiniuOptions _option; + public QiniuUploadService(IOptions option) + { + _option = option?.Value; + } + /// + /// 涓婁紶鏂囦欢 + /// + /// + /// + /// + /// + public Task> Upload(string fileName, Stream stream, bool isAutoDelte = false) + { + // 鐢熸垚(涓婁紶)鍑瘉鏃堕渶瑕佷娇鐢ㄦMac + // 杩欎釜绀轰緥鍗曠嫭浣跨敤浜嗕竴涓猄ettings绫伙紝鍏朵腑鍖呭惈AccessKey鍜孲ecretKey + // 瀹為檯搴旂敤涓紝璇疯嚜琛岃缃偍鐨凙ccessKey鍜孲ecretKey + Mac mac = new Mac(_option.AccessKey, _option.SecretKey); + + PutPolicy putPolicy = new PutPolicy(); + // 濡傛灉闇瑕佽缃负"瑕嗙洊"涓婁紶(濡傛灉浜戠宸叉湁鍚屽悕鏂囦欢鍒欒鐩)锛岃浣跨敤 SCOPE = "BUCKET:KEY" + putPolicy.Scope = _option.Bucket + ":" + fileName; + // putPolicy.Scope = bucket; + // 涓婁紶绛栫暐鏈夋晥鏈(瀵瑰簲浜庣敓鎴愮殑鍑瘉鐨勬湁鏁堟湡) + putPolicy.SetExpires(3600); + // 涓婁紶鍒颁簯绔灏戝ぉ鍚庤嚜鍔ㄥ垹闄よ鏂囦欢锛屽鏋滀笉璁剧疆锛堝嵆淇濇寔榛樿榛樿锛夊垯涓嶅垹闄 + if (isAutoDelte) + putPolicy.DeleteAfterDays = 7; + string jstr = putPolicy.ToJsonString(); + string token = Auth.CreateUploadToken(mac, jstr); + + Config config = new Config(); + // 绌洪棿瀵瑰簲鐨勬満鎴 鍗 涓 ZONE_CN_East 鍗 鍖 ZONE_CN_North 鍗 鍗 ZONE_CN_Sout 鍖 缇 ZONE_US_North 涓滃崡浜 ZONE_AS_Singapore + config.Zone = Zone.ZONE_CN_South; + // 鏄惁浣跨敤https鍩熷悕 + config.UseHttps = true; + // 涓婁紶鏄惁浣跨敤cdn鍔犻 + config.UseCdnDomains = true; + HttpResult result = null; + try + { + FormUploader fu = new FormUploader(config); + result = fu.UploadStream(stream, fileName, token, null); + if (result.Code == 200) + return Task.FromResult(Result.ReSuccess(_option.Url + fileName)); + } + catch (Exception ex) + { + Console.WriteLine(ex); + return Task.FromResult(Result.ReFailure("涓婁紶鏂囦欢澶辫触" + ex.ToString(), 0)); + } + return Task.FromResult(Result.ReFailure("涓婁紶鏂囦欢澶辫触" + JsonConvert.SerializeObject(result), 0)); + } + } +} diff --git a/src/BarCode.Web.Domain/Services/SecurityNumberService.cs b/src/BarCode.Web.Domain/Services/SecurityNumberService.cs new file mode 100644 index 0000000..57b2122 --- /dev/null +++ b/src/BarCode.Web.Domain/Services/SecurityNumberService.cs @@ -0,0 +1,234 @@ +锘縰sing BarCode.Web.Core.Dto.Login; +using BarCode.Web.Core.Dto.SecurityNumbers; +using BarCode.Web.Core.Internal.Results; +using BarCode.Web.Domain.Entitys; +using BarCode.Web.Domain.Infrastructure; +using BarCode.Web.Domain.IService; +using BarCode.Web.Domain.IService.Public; +using BarCode.Web.Domain.Services.Public; +using BarCode.Web.Domain.Values; +using BarCode.Web.Domain.Values.Single; +using Microsoft.EntityFrameworkCore.Storage; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Logging; +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BarCode.Web.Domain.Services +{ + /// + /// 闃蹭吉鐮 + /// + public class SecurityNumberService : ISecurityNumberService + { + private readonly ISecurityNumbersRepositories _securityNumbersRepositories; + private readonly ISecurityGenerateRecordRepositories _sGenerateRecordRepositories; + private readonly RedisClientService _redisClientService; + private readonly IServiceScopeFactory _serviceScopeFactory; + private readonly ILogger _logger; + private IBasicsRepositories _transactionRepositories; + private readonly ISingleDataService _singleDataService; + /// + /// 搴忓垪鍙锋湇鍔 + /// + /// + /// + /// + /// + /// + /// + public SecurityNumberService(ISecurityNumbersRepositories securityNumbersRepositories, + ISecurityGenerateRecordRepositories sGenerateRecordRepositories, + RedisClientService redisClientService, + IServiceScopeFactory serviceScopeFactory, + ILogger logger, IBasicsRepositories transactionRepositories, + ISingleDataService singleDataService) + { + _securityNumbersRepositories = securityNumbersRepositories; + _sGenerateRecordRepositories = sGenerateRecordRepositories; + _redisClientService = redisClientService; + _serviceScopeFactory = serviceScopeFactory; + _logger = logger; + _transactionRepositories = transactionRepositories; + _singleDataService = singleDataService; + } + /// + /// 涓嬭浇 + /// + /// + /// + /// + public async Task DownLoad(OperateSecurityNumberRequest dto) + { + //鍙栧嚭鎵鏈夌殑鐢熸垚璁板綍 + var generateRecords = await _sGenerateRecordRepositories.GetEntityList(dto.GenerateRecordIds); + if (generateRecords.Count() != dto.GenerateRecordIds.Count()) + return Result.ReFailure(ResultCodes.NoDateError); + var snGRList = await _securityNumbersRepositories.GetEntityListByGRIds(dto.GenerateRecordIds); + //淇敼搴忓垪鍙蜂笅杞芥暟 + List olist = new List(); + if (dto.IsAll) + olist = snGRList; + else + { + olist = snGRList.Where(w => dto.SecurityNumbers.Contains(w.SecurityNumber)).ToList(); + } + olist.ForEach(f => f.DownLoad()); + + + foreach (var g in generateRecords) + { + int downLoad = snGRList.Where(w => w.GenerateRecordId == g.Id && w.DownLoadNumber > 0).Count(); + g.DownLoad(downLoad); + } + + IDbContextTransaction _transaction = _transactionRepositories.GetTransaction(); + bool res_Rollback = false; + bool isSuccess = true; + if (dto.IsAll) + { + //涓轰簡澧炲姞閫熷害 鎵ц鎵鏈夋椂鐩存帴鎵цsql璇彞 + isSuccess = await _securityNumbersRepositories.DownLoad(dto.GenerateRecordIds, false); + if (!isSuccess) res_Rollback = true; + } + else + { + isSuccess = await _securityNumbersRepositories.EditEntityList(olist, false); + if (!isSuccess) res_Rollback = true; + } + if (!res_Rollback) + { + var res = await _sGenerateRecordRepositories.EditEntityList(generateRecords, false); + if (!res) res_Rollback = true; + } + isSuccess = _transactionRepositories.CommitTransaction(res_Rollback, _transaction); + if (!isSuccess) return Result.ReFailure(ResultCodes.DateWriteError); + return Result.ReSuccess(); + } + /// + /// 鐢熸垚闃蹭吉鐮 + /// + /// + /// + /// + /// + public Task Generate(GenerateSecurityNumberRequest dto, LoginInDto loginInfo) + { + _logger.LogInformation($"鐢熸垚闃蹭吉鐮:{JsonConvert.SerializeObject(dto)},鐢ㄦ埛:{loginInfo.UserInfo.Nickname}"); + var info = _redisClientService.GetStringKey($"barcode_cenerate_security"); + if (info == true) return Task.FromResult(Result.ReFailure(ResultCodes.SecurityNumberG)); + _redisClientService.SetStringKey($"barcode_cenerate_security", true, TimeSpan.FromMinutes(5)); + + string supplierCode = ""; + string orgCode = ""; + if (dto.OrgCode.Substring(0, 1).Equals("s")) + supplierCode = dto.OrgCode.Substring(2, dto.OrgCode.Length - 2); + else + orgCode = dto.OrgCode.Substring(2, dto.OrgCode.Length - 2); + + var number = _sGenerateRecordRepositories.GetGenerateRecordDayCount().GetAwaiter().GetResult(); + number = number + 1;//浠1寮濮 + SecurityNumberGenerateRecord sg = new SecurityNumberGenerateRecord() + { + CompanyId = loginInfo.UserInfo.CompanyId, + CreateTime = DateTime.Now, + CreatorId = loginInfo.UserInfo.UcId, + OrgCode = orgCode, + SupplierCode = supplierCode, + MaterialNumber = dto.MaterialNumber, + Number = dto.Number + }; + sg.GenerateLotNumber(number); + var isRes = _sGenerateRecordRepositories.Add(sg).GetAwaiter().GetResult(); + if (isRes == null) Task.FromResult(Result.ReFailure(ResultCodes.DateWriteError)); + + Task.Run(async () => + { + await GenerateSecurityNumber(new List() { sg }); + }); + + _redisClientService.SetStringKey($"barcode_cenerate_security", false, TimeSpan.FromMinutes(5)); + return Task.FromResult(Result.ReSuccess()); + } + + /// + /// 寰幆鐢熸垚搴忓垪鐮 + /// + /// + private async Task GenerateSecurityNumber(List sgList) + { + try + { + var info = _redisClientService.GetStringKey($"cenerate_security_exec"); + if (info == true) + { + //濡傛灉褰撳墠鏈夊湪鐢熸垚鐨勮鍒 鍒欐寕璧 绛夌敓鎴愬畬鎴 + while (true) + { + Thread.Sleep(5000); + info = _redisClientService.GetStringKey($"cenerate_security_exec"); + if (info != true) + break; + } + } + _redisClientService.SetStringKey($"cenerate_security_exec", true, TimeSpan.FromMinutes(30)); + _logger.LogInformation($"鐢熸垚闃蹭吉鐮佸紑濮:{DateTime.Now}-{JsonConvert.SerializeObject(sgList)}"); + using (var scope = _serviceScopeFactory.CreateScope()) + { + bool isSuccess = true; + bool res_Rollback = false; + var _snRepositories = scope.ServiceProvider.GetRequiredService(); + var _sgRepositories = scope.ServiceProvider.GetRequiredService(); + _transactionRepositories = scope.ServiceProvider.GetRequiredService(); + + foreach (var sg in sgList) + { + List sList = new List(); + for (int i = 1; i <= sg.Number; i++) + { + SecurityNumbers s = new SecurityNumbers() + { + CreateTime = DateTime.Now, + CreatorId = sg.CreatorId, + OrgCode = sg.OrgCode, + SupplierCode = sg.SupplierCode, + MaterialNumber = sg.MaterialNumber, + GenerateRecordId = sg.Id + }; + sList.Add(s); + } + + //涓涓敓鎴愯褰曚竴涓簨鐗,杩欐牱鑳戒竴鏉℃潯璁板綍瀵瑰簲鐨勭敓鎴愪笅鍘 鎴愬姛涓涓槸涓涓 + IDbContextTransaction _transaction = _transactionRepositories.GetTransaction(); + var isRes = await _snRepositories.AddRange(sList, false); + if (!isRes) + res_Rollback = true; + + if (!res_Rollback) + { + sg.Complete();//鐢熸垚瀹屾垚 + var sg_entity = await _sgRepositories.Edit(sg, false); + if (sg_entity == null) + res_Rollback = true; + } + //鎻愪氦浜嬪姟 + isSuccess = _transactionRepositories.CommitTransaction(res_Rollback, _transaction); + + if (res_Rollback || !isSuccess) + _logger.LogError("鐢熸垚闃蹭吉鐮佹暟鎹搷浣滃け璐"); + } + } + _redisClientService.SetStringKey($"cenerate_security_exec", false, TimeSpan.FromMinutes(30)); + _logger.LogInformation($"鐢熸垚闃蹭吉鐮佺粨鏉 {DateTime.Now}"); + } + catch (Exception ex) + { + _logger.LogError($" 鐢熸垚闃蹭吉鐮佸紓甯:{ex.ToString} {JsonConvert.SerializeObject(sgList)}"); + } + } + } +} diff --git a/src/BarCode.Web.Domain/Services/SerialNumberService.cs b/src/BarCode.Web.Domain/Services/SerialNumberService.cs new file mode 100644 index 0000000..ddbc339 --- /dev/null +++ b/src/BarCode.Web.Domain/Services/SerialNumberService.cs @@ -0,0 +1,423 @@ +锘縰sing BarCode.Web.Core.Dto; +using BarCode.Web.Core.Dto.Erp; +using BarCode.Web.Core.Dto.Login; +using BarCode.Web.Core.Dto.SerialNumbers; +using BarCode.Web.Core.Internal.Results; +using BarCode.Web.Domain.Entitys; +using BarCode.Web.Domain.Infrastructure; +using BarCode.Web.Domain.IService; +using BarCode.Web.Domain.IService.Public; +using BarCode.Web.Domain.Services.Public; +using BarCode.Web.Domain.Values; +using BarCode.Web.Domain.Values.Single; +using Microsoft.EntityFrameworkCore.Storage; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Logging; +using Newtonsoft.Json; +using NPOI.HPSF; +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BarCode.Web.Domain.Services +{ + /// + /// 搴忓垪鍙锋湇鍔 + /// + public class SerialNumberService : ISerialNumberService + { + private readonly ISerialNumbersRepositories _serialNumbersRepositories; + private readonly ISGenerateRecordRepositories _sGenerateRecordRepositories; + private readonly RedisClientService _redisClientService; + private readonly IServiceScopeFactory _serviceScopeFactory; + private readonly ILogger _logger; + private IBasicsRepositories _transactionRepositories; + private ICenerateDataRepositories _cenerateDataRepositories; + private readonly ISingleDataService _singleDataService; + private readonly IErpService _erpService; + /// + /// 搴忓垪鍙锋湇鍔 + /// + /// + /// + /// + /// + /// + /// + /// + public SerialNumberService(ISerialNumbersRepositories serialNumbersRepositories, + ISGenerateRecordRepositories sGenerateRecordRepositories, + RedisClientService redisClientService, + IServiceScopeFactory serviceScopeFactory, + ILogger logger, IBasicsRepositories transactionRepositories, + ICenerateDataRepositories cenerateDataRepositories, ISingleDataService singleDataService, IErpService erpService) + { + _serialNumbersRepositories = serialNumbersRepositories; + _sGenerateRecordRepositories = sGenerateRecordRepositories; + _redisClientService = redisClientService; + _serviceScopeFactory = serviceScopeFactory; + _logger = logger; + _transactionRepositories = transactionRepositories; + _cenerateDataRepositories = cenerateDataRepositories; + _singleDataService = singleDataService; + _erpService = erpService; + } + + /// + /// 鐢熸垚搴忓垪鍙 + /// + /// + /// + /// + /// + public Task Generate(GenerateSerialNumberRequest dto, LoginInDto loginInfo) + { + if (dto.Details.Count() == 0) return Task.FromResult(Result.ReSuccess()); + //if (dto.Details.Count() > 1000) return Task.FromResult(Result.ReFailure(ResultCodes.SerialGenerateBigNumber)); + + _logger.LogInformation($"鐢熸垚搴忓垪鍙:{JsonConvert.SerializeObject(dto)},鐢ㄦ埛:{loginInfo.UserInfo.Nickname}"); + var info = _redisClientService.GetStringKey($"barcode_cenerate_serial"); + if (info == true) return Task.FromResult(Result.ReFailure(ResultCodes.SerialNumberG)); + _redisClientService.SetStringKey($"barcode_cenerate_serial", true, TimeSpan.FromMinutes(5)); + + var materials_result = _erpService.BillQueryForMaterial().GetAwaiter().GetResult(); + List materials = new List(); + if (materials_result.IsSuccess) + materials = materials_result.Data.ToList(); + + + + var cList = dto.Details.GroupBy(g => g.Specifications).Select(s => s.Key).ToList(); + foreach (var s in cList) + { + var m = materials.FirstOrDefault(w => w.Specifications.Equals(s)); + var details = dto.Details.Where(w => w.Specifications.Equals(s)).ToList(); + if (m == null) + { + details.ForEach(f => dto.Details.Remove(f)); + } + else + { + foreach (var de in details) + { + de.MaterialNumber = m.MaterialNumber; + de.IdConvertBar = m.IdConvertBar; + + } + } + } + + string supplierCode = ""; + string orgCode = ""; + if (dto.OrgCode.Substring(0, 1).Equals("s")) + supplierCode = dto.OrgCode.Substring(2, dto.OrgCode.Length - 2); + else + orgCode = dto.OrgCode.Substring(2, dto.OrgCode.Length - 2); + + + + var dataEntity = _cenerateDataRepositories.Get(CenerateDataType.Serial).GetAwaiter().GetResult(); + int beginNumber = dataEntity.Number; + if (beginNumber == 0) + dataEntity.Number = dto.Details.Sum(s => s.Number); + else + dataEntity.Number += dto.Details.Sum(s => s.Number); + + + List sgList = new List(); + foreach (var d in dto.Details) + { + if (d.isTwo == 0)//濡傛灉濂楄鏁颁负0锛岄偅涔堣嚜鍔ㄥ彉鎴1 + { + d.isTwo = 1; + } + else if(d.isTwo==2) + { + int result = d.Number % d.isTwo; + + if (result !=0)// + { + return Task.FromResult(Result.ReFailure(ResultCodes.IsTwoError)); + } + } + else if(d.isTwo>2) + { + return Task.FromResult(Result.ReFailure(ResultCodes.IsTwoError)); + } + + SerialNumberGenerateRecord sg = new SerialNumberGenerateRecord() + { + CompanyId = loginInfo.UserInfo.CompanyId, + CreateTime = DateTime.Now, + CreatorId = loginInfo.UserInfo.UcId, + OrgCode = orgCode, + IdConvertBar = d.IdConvertBar, + MaterialNumber = d.MaterialNumber, + Number = d.Number, + BeginNumber = beginNumber, + PurchaseBillNo = d.PurchaseBillNo, + SupplierCode = supplierCode, + IsTwo=d.isTwo//alter by yzh + + }; + //涓嬩竴涓墿鏂欏紑濮嬫暟閲忚閲嶆柊璧嬪 + beginNumber = beginNumber + d.Number; + sgList.Add(sg); + } + IDbContextTransaction _transaction = _transactionRepositories.GetTransaction(); + bool res_Rollback = false; + + var isSuccess = _sGenerateRecordRepositories.AddRange(sgList, false).GetAwaiter().GetResult(); + if (!isSuccess) res_Rollback = true; + + if (!res_Rollback) + { + var entity = _cenerateDataRepositories.Edit(dataEntity, false).GetAwaiter().GetResult(); + if (entity == null) res_Rollback = true; + } + isSuccess = _transactionRepositories.CommitTransaction(res_Rollback, _transaction); + if (!isSuccess) return Task.FromResult(Result.ReFailure(ResultCodes.DateWriteError)); + + Task.Run(async () => + { + await GenerateSerialNumber(sgList); + }); + + _redisClientService.SetStringKey($"barcode_cenerate_serial", false, TimeSpan.FromMinutes(5)); + return Task.FromResult(Result.ReSuccess()); + } + + /// + /// 寰幆鐢熸垚搴忓垪鐮 + /// + /// + /// + private async Task GenerateSerialNumber(List sgList) + { + try + { + var info = _redisClientService.GetStringKey($"cenerate_serial_exec"); + if (info == true) + { + //濡傛灉褰撳墠鏈夊湪鐢熸垚鐨勮鍒 鍒欐寕璧 绛夌敓鎴愬畬鎴 + while (true) + { + Thread.Sleep(5000); + info = _redisClientService.GetStringKey($"cenerate_serial_exec"); + if (info != true) + break; + } + } + _redisClientService.SetStringKey($"cenerate_serial_exec", true, TimeSpan.FromMinutes(30)); + + _logger.LogInformation($"鐢熸垚搴忓垪鐮佸紑濮:{DateTime.Now}-{JsonConvert.SerializeObject(sgList)}"); + using (var scope = _serviceScopeFactory.CreateScope()) + { + bool isSuccess = true; + bool res_Rollback = false; + var _snRepositories = scope.ServiceProvider.GetRequiredService(); + var _sgRepositories = scope.ServiceProvider.GetRequiredService(); + _transactionRepositories = scope.ServiceProvider.GetRequiredService(); + + foreach (var sg in sgList) + { + List sList = new List(); + for (int i = 0; i < sg.Number; i++) + { + SerialNumbers s = new SerialNumbers() + { + CreateTime = DateTime.Now, + CreatorId = sg.CreatorId, + OrgCode = sg.OrgCode, + SupplierCode = sg.SupplierCode, + SerialNumber = sg.IdConvertBar, + MaterialNumber = sg.MaterialNumber, + Number = sg.BeginNumber + i, + IsTwo = sg.IsTwo, + thisNumber = i+1,//alter by yzh + GenerateRecordId = sg.Id + }; + sList.Add(s); + } + + //涓涓敓鎴愯褰曚竴涓簨鐗,杩欐牱鑳戒竴鏉℃潯璁板綍瀵瑰簲鐨勭敓鎴愪笅鍘 鎴愬姛涓涓槸涓涓 + IDbContextTransaction _transaction = _transactionRepositories.GetTransaction(); + var isRes = await _snRepositories.AddRange(sList, false); + if (!isRes) + res_Rollback = true; + + if (!res_Rollback) + { + sg.Complete();//鐢熸垚瀹屾垚 + var sg_entity = await _sgRepositories.Edit(sg, false); + if (sg_entity == null) + res_Rollback = true; + } + //鎻愪氦浜嬪姟 + isSuccess = _transactionRepositories.CommitTransaction(res_Rollback, _transaction); + + if (res_Rollback || !isSuccess) + _logger.LogError("鐢熸垚搴忓垪鐮佹暟鎹搷浣滃け璐"); + } + } + _redisClientService.SetStringKey($"cenerate_serial_exec", false, TimeSpan.FromMinutes(30)); + _logger.LogInformation($"鐢熸垚搴忓垪鐮佺粨鏉焮DateTime.Now}"); + } + catch (Exception ex) + { + _logger.LogError($"鐢熸垚搴忓垪鐮佸紓甯:{ex.ToString}"); + } + } + /// + /// 涓嬭浇 + /// + /// + /// + /// + public async Task DownLoad(OperateSerialNumberRequest dto) + { + //鍙栧嚭鎵鏈夌殑鐢熸垚璁板綍 + var generateRecords = await _sGenerateRecordRepositories.GetEntityList(dto.GenerateRecordIds); + if (generateRecords.Count() != dto.GenerateRecordIds.Count()) + return Result.ReFailure(ResultCodes.NoDateError); + var snGRList = await _serialNumbersRepositories.GetEntityListByGRIds(dto.GenerateRecordIds); + //淇敼搴忓垪鍙蜂笅杞芥暟 + List olist = new List(); + if (dto.IsAll) + olist = snGRList; + else + { + olist = snGRList.Where(w => dto.SerialNumbers.Contains(w.SerialNumber)).ToList(); + } + olist.ForEach(f => f.DownLoad()); + + + foreach (var g in generateRecords) + { + int downLoad = snGRList.Where(w => w.GenerateRecordId == g.Id && w.DownLoadNumber > 0).Count(); + g.DownLoad(downLoad); + } + + IDbContextTransaction _transaction = _transactionRepositories.GetTransaction(); + bool res_Rollback = false; + + var isSuccess = await _serialNumbersRepositories.EditEntityList(olist, false); + if (!isSuccess) res_Rollback = true; + if (!res_Rollback) + { + var res = await _sGenerateRecordRepositories.EditEntityList(generateRecords, false); + if (!res) res_Rollback = true; + } + isSuccess = _transactionRepositories.CommitTransaction(res_Rollback, _transaction); + if (!isSuccess) return Result.ReFailure(ResultCodes.DateWriteError); + return Result.ReSuccess(); + } + /// + /// 鎵撳嵃 + /// + /// + /// + /// + public async Task Print(OperateSerialNumberRequest dto) + { + //鍙栧嚭鎵鏈夌殑鐢熸垚璁板綍 + var generateRecords = await _sGenerateRecordRepositories.GetEntityList(dto.GenerateRecordIds); + if (generateRecords.Count() != dto.GenerateRecordIds.Count()) + return Result.ReFailure(ResultCodes.NoDateError); + var snGRList = await _serialNumbersRepositories.GetEntityListByGRIds(dto.GenerateRecordIds); + //淇敼搴忓垪鍙蜂笅杞芥暟 + List olist = new List(); + if (dto.IsAll) + olist = snGRList; + else + { + olist = snGRList.Where(w => dto.SerialNumbers.Contains(w.SerialNumber)).ToList(); + } + olist.ForEach(f => f.Print()); + + foreach (var g in generateRecords) + { + int printNumber = snGRList.Where(w => w.GenerateRecordId == g.Id && w.PrintNumber > 0).Count(); + g.Print(printNumber); + + } + + IDbContextTransaction _transaction = _transactionRepositories.GetTransaction(); + bool res_Rollback = false; + + var isSuccess = await _serialNumbersRepositories.EditEntityList(olist, false); + if (!isSuccess) res_Rollback = true; + if (!res_Rollback) + { + var res = await _sGenerateRecordRepositories.EditEntityList(generateRecords, false); + if (!res) res_Rollback = true; + } + isSuccess = _transactionRepositories.CommitTransaction(res_Rollback, _transaction); + if (!isSuccess) return Result.ReFailure(ResultCodes.DateWriteError); + return Result.ReSuccess(); + } + /// + /// 鍙嶅啓浣跨敤鏁 + /// + /// + /// + public async Task Use(List sGIds) + { + var sGList = await _sGenerateRecordRepositories.GetEntityList(sGIds); + var sGSNumberList = await _serialNumbersRepositories.GetEntityListByGRIds(sGIds); + + foreach (var sg in sGList) + { + int number = sGSNumberList.Where(w => w.GenerateRecordId == sg.Id && w.BoxId > 0).Count(); + sg.Use(number); + } + + var isSuccess = await _sGenerateRecordRepositories.EditEntityList(sGList, false); + if (!isSuccess) return Result.ReFailure(ResultCodes.DateWriteError); + return Result.ReSuccess(); + } + /// + /// 淇敼搴忓垪鐮佺墿鏂 + /// + /// + /// + /// + public async Task UpdateMaterial(UpdateMaterialRequest dto) + { + //鍙栧嚭鎵鏈夌殑鐢熸垚璁板綍 + var generateRecord = await _sGenerateRecordRepositories.GetEntity(dto.GenerateRecordId); + if (generateRecord == null) + return Result.ReFailure(ResultCodes.NoDateError); + var serialNumbers = await _serialNumbersRepositories.GetEntityList(dto.SerialNumbers); + + var exec_m = serialNumbers.Where(w => w.MaterialNumber == dto.MaterialNumber).Select(s => s.MaterialNumber).ToList(); + if (exec_m.Count() > 0) + return Result.ReFailure($"搴忓垪鍙穥string.Join(",", exec_m)}瀵瑰簲鐗╂枡璺熼渶瑕佷慨鏀圭殑鐗╂枡涓鑷", 611007); + + //淇敼鐗╂枡 + foreach (var s in serialNumbers) + { + var res = s.UpdateMaterial(dto.MaterialNumber); + if (!res.IsSuccess) return res; + } + generateRecord.UpdateMaterial(); + + IDbContextTransaction _transaction = _transactionRepositories.GetTransaction(); + bool res_Rollback = false; + + var isSuccess = await _serialNumbersRepositories.EditEntityList(serialNumbers, false); + if (!isSuccess) res_Rollback = true; + if (!res_Rollback) + { + var res = await _sGenerateRecordRepositories.Edit(generateRecord, false); + if (res == null) res_Rollback = true; + } + isSuccess = _transactionRepositories.CommitTransaction(res_Rollback, _transaction); + if (!isSuccess) return Result.ReFailure(ResultCodes.DateWriteError); + return Result.ReSuccess(); + } + } +} diff --git a/src/BarCode.Web.Domain/TimedJob/ErpBaseDataSyncJob.cs b/src/BarCode.Web.Domain/TimedJob/ErpBaseDataSyncJob.cs new file mode 100644 index 0000000..007e774 --- /dev/null +++ b/src/BarCode.Web.Domain/TimedJob/ErpBaseDataSyncJob.cs @@ -0,0 +1,76 @@ +锘縰sing BarCode.Web.Core.Dto.Erp; +using Microsoft.Extensions.Caching.Memory; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Logging; +using Microsoft.Extensions.Options; +using Pomelo.AspNetCore.TimedJob; +using System; +using System.Collections.Generic; +using System.Text; +using BarCode.Web.Core.Dto.Erp; +using BarCode.Web.Core.Dto.Erp.Customer; +using BarCode.Web.Core.Dto.Erp.Org; +using BarCode.Web.Core.Dto.Erp.Supplier; +using BarCode.Web.Domain.IService.Public; +using BarCode.Web.Domain.Options; +using BarCode.Web.Domain.Services.Public; + +namespace BarCode.Web.Domain.TimedJob +{ + /// + /// erp鍩虹鏁版嵁-鍚屾瀹氭椂浠诲姟 + /// + public class ErpBaseDataSyncJob : Job + { + private readonly IMemoryCache _memoryCache; + private readonly ErpOptions _erpOptions; + private ILogger _logger; + private readonly IServiceProvider _serviceProvider; + public ErpBaseDataSyncJob(IServiceProvider serviceProvider,IMemoryCache memoryCache, IOptions erpOptions, ILogger logger) + { + _serviceProvider = serviceProvider; + _memoryCache = memoryCache; + this._erpOptions = erpOptions?.Value; + this._logger = logger; + } + + //[Invoke(Begin = "2022-03-02 01:01", Interval = 1000 * 60 * 60 * 24, SkipWhileExecuting = true)] + //30鍒嗛挓鎵ц涓娆 + [Invoke(Begin = "2024-01-15 17:43", Interval = 1000 * 60 * 30, SkipWhileExecuting = true)] + public void Run() + { + //this.SyscErpBaseData(); + } + + public void SyscErpBaseData() + { + string tip = ""; + _logger.LogInformation($"----------寮傛锛氬畾鏃朵换鍔℃媺鍙---------"); + var sercice = _serviceProvider.GetRequiredService(); + var materials = _memoryCache.Get>(_erpOptions.cache_materail_key); + if (materials == null || materials.Count == 0) + ErpBaseDataSync.SyncMaterial(sercice); + else + tip = tip + "鐗╂枡缂撳瓨鏈け鏁堬紱"; + + var orgs = _memoryCache.Get>(_erpOptions.cache_org_key); + if (orgs == null || orgs.Count == 0) + ErpBaseDataSync.SyncOrg(sercice); + else + tip = tip + "缁勭粐缂撳瓨鏈け鏁堬紱"; + var suppliers = _memoryCache.Get>(_erpOptions.cache_supplier_key); + if (suppliers == null || suppliers.Count == 0) + ErpBaseDataSync.SyncSupplier(sercice); + else + tip = tip + "渚涘簲鍟嗙紦瀛樻湭澶辨晥锛"; + var customers = _memoryCache.Get>(_erpOptions.cache_customer_key); + if (customers == null || customers.Count == 0) + ErpBaseDataSync.SyncCustomer(sercice); + else + tip = tip + "瀹㈡埛缂撳瓨鏈け鏁堬紱"; + + if (!string.IsNullOrEmpty(tip)) + _logger.LogInformation($"寮傛锛氬畾鏃朵换鍔℃媺鍙-->" + tip); + } + } +} diff --git a/src/BarCode.Web.Domain/Values/BoxStatus.cs b/src/BarCode.Web.Domain/Values/BoxStatus.cs new file mode 100644 index 0000000..f19be58 --- /dev/null +++ b/src/BarCode.Web.Domain/Values/BoxStatus.cs @@ -0,0 +1,32 @@ +锘縰sing BarCode.Web.Core; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BarCode.Web.Domain.Values +{ + /// + /// 绠辩姸鎬 + /// + public enum BoxStatus + { + /// + /// 鏈娇鐢 + /// + [EnumRemark("鏈娇鐢")] + NoUse = 0, + /// + /// 鏈畬鎴 + /// + [EnumRemark("鏈畬鎴")] + NoComplete = 1, + /// + /// 宸插畬鎴 + /// + [EnumRemark("宸插畬鎴")] + Complete = 2, + + } +} diff --git a/src/BarCode.Web.Domain/Values/CenerateDataType.cs b/src/BarCode.Web.Domain/Values/CenerateDataType.cs new file mode 100644 index 0000000..8540c41 --- /dev/null +++ b/src/BarCode.Web.Domain/Values/CenerateDataType.cs @@ -0,0 +1,19 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; +using BarCode.Web.Core; + +namespace BarCode.Web.Domain.Values +{ + /// + /// 鑷姩鐢熸垚鏁版嵁 搴忓垪鐮佸拰闃蹭吉鐮 + /// + public enum CenerateDataType + { + /// + /// 搴忓垪鐮佺敓鎴 + /// + [EnumRemark("搴忓垪鐮佺敓鎴")] + Serial = 1 + } +} diff --git a/src/BarCode.Web.Domain/Values/Erp/FormIdParam.cs b/src/BarCode.Web.Domain/Values/Erp/FormIdParam.cs new file mode 100644 index 0000000..38c7ba2 --- /dev/null +++ b/src/BarCode.Web.Domain/Values/Erp/FormIdParam.cs @@ -0,0 +1,85 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; + +namespace BarCode.Web.Domain.Values.Erp +{ + /// + /// 涓氬姟瀵硅薄琛ㄥ崟Id锛氬搴攅rp鐨勫崟鎹〃鐨勫悕绉 + /// + public enum FormIdParam + { + /// + /// 閲囪喘璁㈠崟 + /// + PUR_PurchaseOrder = 1, + /// + /// 閲囪喘鍏ュ簱鍗 + /// + STK_InStock = 2, + /// + /// 鍏朵粬鍏ュ簱鍗 + /// + STK_MISCELLANEOUS = 3, + /// + /// 鐩存帴璋冩嫧鍗-閲岄潰鍖呭惈鍑哄拰鍏 + /// + STK_TransferDirect = 4, + /// + /// 鍒嗘寮忚皟鍏ュ崟 + /// + STK_TRANSFERIN = 5, + /// + /// 缁勮鎷嗗嵏鍗曪細閲岄潰鍖呭惈鍑哄拰鍏 + /// + STK_AssembledApp = 6, + /// + /// 缁勭粐 + /// + ORG_Organizations = 7, + /// + /// 渚涘簲鍟 + /// + BD_Supplier = 8, + /// + /// 浠撳簱 + /// + BD_STOCK = 9, + /// + /// 鐩樼泩鍗 + /// + STK_StockCountGain = 10, + /// + /// 鐩樹簭鍗 + /// + STK_StockCountLoss = 11, + /// + /// 鐗╂枡 + /// + BD_MATERIAL = 12, + /// + /// 閿鍞彂璐ч氱煡鍗 + /// + SAL_DELIVERYNOTICE = 13, + /// + /// 鍏朵粬鍑哄簱鍗 + /// + STK_MisDelivery = 14, + /// + /// 鍒嗗竷寮忚皟鍑哄崟 + /// + STK_TRANSFEROUT = 15, + /// + /// 瀹㈡埛 + /// + BD_Customer = 16, + /// + /// 閿鍞嚭搴撳崟 + /// + SAL_OUTSTOCK = 17, + /// + /// 鍗虫椂搴撳瓨 + /// + STK_Inventory = 18 + } +} diff --git a/src/BarCode.Web.Domain/Values/ExportStatus.cs b/src/BarCode.Web.Domain/Values/ExportStatus.cs new file mode 100644 index 0000000..ae884f0 --- /dev/null +++ b/src/BarCode.Web.Domain/Values/ExportStatus.cs @@ -0,0 +1,30 @@ +锘 +using System; +using System.Collections.Generic; +using System.Text; +using BarCode.Web.Core; + +namespace BarCode.Web.Domain.Values +{ + /// + /// 鏂囦欢瀵煎嚭鐘舵 + /// + public enum ExportStatus + { + /// + /// 姝e湪瀵煎嚭 + /// + [EnumRemark("姝e湪瀵煎嚭")] + Ing = 0, + /// + /// 瀵煎嚭鎴愬姛 + /// + [EnumRemark("瀵煎嚭鎴愬姛")] + Success = 1, + /// + /// 瀵煎嚭澶辫触 + /// + [EnumRemark("瀵煎嚭澶辫触")] + Fail = 2 + } +} diff --git a/src/BarCode.Web.Domain/Values/FileDownLoadOrderType.cs b/src/BarCode.Web.Domain/Values/FileDownLoadOrderType.cs new file mode 100644 index 0000000..4315804 --- /dev/null +++ b/src/BarCode.Web.Domain/Values/FileDownLoadOrderType.cs @@ -0,0 +1,34 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; +using BarCode.Web.Core; + +namespace BarCode.Web.Domain.Values +{ + /// + /// 瀵煎嚭鍗曟嵁绫诲瀷 + /// + public enum FileDownLoadOrderType + { + /// + /// 鏉$爜涓嬭浇 + /// + [EnumRemark("鏉$爜涓嬭浇")] + SerialNumbers = 1, + /// + /// 鏉$爜璇︽儏涓嬭浇 + /// + [EnumRemark("鏉$爜璇︽儏涓嬭浇")] + SerialNumberInfo = 2, + /// + /// 闃蹭吉鐮佷笅杞 + /// + [EnumRemark("闃蹭吉鐮佷笅杞")] + SecurityNumbers = 3, + /// + /// 闃蹭吉鐮佽鎯呬笅杞 + /// + [EnumRemark("闃蹭吉鐮佽鎯呬笅杞")] + SecurityNumberInfo = 4 + } +} diff --git a/src/BarCode.Web.Domain/Values/ResultCodes.cs b/src/BarCode.Web.Domain/Values/ResultCodes.cs new file mode 100644 index 0000000..0333a6b --- /dev/null +++ b/src/BarCode.Web.Domain/Values/ResultCodes.cs @@ -0,0 +1,64 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; + +namespace BarCode.Web.Domain.Values +{ + /// + /// 閿欒鎻愮ず淇℃伅 + /// + public partial class ResultCodes + { + public static ValueTuple Erp_Login_Error = (1001, "鍚屾閲戣澏鐧诲綍閿欒锛岃绋嶅欏啀璇"); + + public static ValueTuple Erp_BillQuery_Error = (1002, "鍚屾閲戣澏鏁版嵁鍑洪敊锛岃绋嶇瓑鍐嶈瘯"); + public static ValueTuple Erp_Inventory_Error = (1003, "鑾峰彇閲戣澏鍗虫椂搴撳瓨鏁版嵁鍑洪敊锛岃绋嶇瓑鍐嶈瘯"); + /// + /// 鏃犳晥 + /// + public static ValueTuple Token_Invalid_Error = (401, "楠岃瘉Token鏃犳晥锛岃閲嶆柊鐧诲綍"); + /// + /// 鏁版嵁鎿嶄綔澶辫触 + /// + public static ValueTuple DateWriteError = (40004, "鏁版嵁鎿嶄綔澶辫触"); + public static ValueTuple NoDateError = (40005, "鏁版嵁涓嶅瓨鍦"); + public static ValueTuple NoOrgError = (40006, "缁勭粐淇℃伅涓嶅瓨鍦"); + public static ValueTuple IsTwoError = (70001, "涓や欢瑁呬骇鍝,鏁伴噺闇濉弻鏁"); + + /// + /// 娌℃湁鑿滃崟鏉冮檺锛屾棤娉曠櫥褰 + /// + public static ValueTuple NoRoot = (40005, "娌℃湁鑿滃崟鏉冮檺锛屾棤娉曠櫥褰"); + public static ValueTuple ErpSyns = (40006, "姝e湪鍚屾閲戣澏鏁版嵁锛岃绋嶅欏啀璇曪紒"); + public static ValueTuple ErpSynsError = (40006, "鍚屾閲戣澏鏁版嵁澶辫触锛"); + public static ValueTuple ErpOrgError = (80004, "鑾峰彇Erp鐩稿叧缁勭粐鏁版嵁澶辫触锛岃绋嶅欏啀璇曪紒"); + public static ValueTuple ErpSupplierError = (80005, "鑾峰彇Erp鐩稿叧渚涘簲鍟嗘暟鎹け璐ワ紝璇风◢鍊欏啀璇曪紒"); + public static ValueTuple ErpStockError = (80006, "鑾峰彇Erp鐩稿叧浠撳簱鏁版嵁澶辫触锛岃绋嶅欏啀璇曪紒"); + public static ValueTuple ErpSubStockError = (80006, "鑾峰彇Erp鐩稿叧瀛愪粨搴撴暟鎹け璐ワ紝璇风◢鍊欏啀璇曪紒"); + public static ValueTuple ErpMaterialError = (80007, "鑾峰彇Erp鐩稿叧鐗╂枡鏁版嵁澶辫触锛岃绋嶅欏啀璇曪紒"); + public static ValueTuple BoxHaveError = (80008, "绠卞彿宸叉敹璐"); + public static ValueTuple AdjustError = (80009, "涓庨噾铦舵牎鍑嗗彂鐢熼敊璇紝璇风◢鍊欏啀璇曪紒"); + public static ValueTuple MateriaNoData = (800011, "浜у搧淇℃伅涓嶅瓨鍦"); + public static ValueTuple SerialNumberNoDateError = (500001, "搴忓垪鍙锋暟鎹笉瀛樺湪"); + public static ValueTuple SerialNumberG = (400007, "褰撳墠鏈夊簭鍒楀彿姝e湪鐢熸垚,璇风◢鍚庡啀璇"); + public static ValueTuple SecurityNumberG = (400008, "褰撳墠鏈夐槻浼爜姝e湪鐢熸垚,璇风◢鍚庡啀璇"); + public static ValueTuple SerialGenerateBigNumber = (400009, "鐢熸垚鏉$爜涓娆℃渶澶氫笉鑳借秴杩1000涓墿鏂"); + public static ValueTuple CartonCompleteError = (600001, "璇ョ宸插畬鎴愯绠, 闇鍐嶆瑁呯璇锋搷浣滈噸鏂拌绠"); + public static ValueTuple SerialNumberBindBox = (600002, "搴忓垪鍙峰凡瑁呰繃绠"); + public static ValueTuple SerialNumberIsUse = (600002, "搴忓垪鍙峰凡琚壂鎻忎娇鐢"); + public static ValueTuple BoxNoDataError = (600003, "璇锋壂鎻忕郴缁熷瓨鍦ㄧ殑绠卞彿"); + public static ValueTuple BoxMaterialNoDataError = (600004, "绠变俊鎭笉鍖呭惈璇ョ墿鏂"); + public static ValueTuple BoxSerialNumberNoDataError = (600005, "绠变俊鎭笉鍖呭惈璇ュ簭鍒楀彿"); + public static ValueTuple SerialNumberNoData = (600006, "璇锋壂鎻忕郴缁熷瓨鍦ㄧ殑搴忓垪鍙"); + /// + /// 绠卞彿涓嶇鍚堣鍒 + /// + public static ValueTuple BoxNO_Invalid_Error = (600006, "绠卞彿鍙兘鍖呭惈CTN鍜屾暟瀛"); + public static ValueTuple BoxNoComplete = (600007, "绠辨病鏈夊畬鎴愯绠,涓嶈兘閲嶆柊瑁呯"); + public static ValueTuple SerialNumbersNoData = (610000, "搴忓垪鍙蜂笉瀛樺湪"); + public static ValueTuple NumberCode_Invalid_Error = (600008, "鏁板瓧搴忓垪鍙峰繀椤绘槸澶т簬11浣嶇殑绾暟瀛"); + + + + } +} diff --git a/src/BarCode.Web.Domain/Values/Single/SingleAction.cs b/src/BarCode.Web.Domain/Values/Single/SingleAction.cs new file mode 100644 index 0000000..03c7c37 --- /dev/null +++ b/src/BarCode.Web.Domain/Values/Single/SingleAction.cs @@ -0,0 +1,122 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; +using BarCode.Web.Core; + +namespace BarCode.Web.Domain.Values.Single +{ + /// + /// 瀵规帴鍗曠偣鐨勬帴鍙f柟娉-鏋氫妇 + /// + public enum SingleAction + { + /// + /// 缁勭粐闆嗗悎 + /// + [EnumRemark("缁勭粐")] + Orgs = 1, + /// + /// 鐢ㄦ埛闆嗗悎 + /// + [EnumRemark("鐢ㄦ埛")] + Users = 2, + /// + /// 浜哄憳闆嗗悎 + /// + [EnumRemark("浜哄憳")] + Staffs = 3, + /// + /// 渚涘簲鍟嗛泦鍚 + /// + [EnumRemark("渚涘簲鍟")] + Suppliers = 4, + /// + /// 瀹㈡埛闆嗗悎 + /// + [EnumRemark("瀹㈡埛")] + Customers = 5, + /// + /// 鏀舵鏉′欢闆嗗悎 + /// + [EnumRemark("鏀舵鏉′欢")] + CollectionTerms = 6, + /// + /// 浠樻鏉′欢闆嗗悎 + /// + [EnumRemark("浠樻鏉′欢")] + PaymentTerms = 7, + /// + /// 缁撶畻鏂瑰紡闆嗗悎 + /// + [EnumRemark("缁撶畻鏂瑰紡")] + SettlementMethods = 8, + /// + /// 缁撶畻甯佸埆闆嗗悎 + /// + [EnumRemark("缁撶畻甯佸埆")] + SettlementCurrencys = 9, + /// + /// 绋庣巼闆嗗悎 + /// + [EnumRemark("绋庣巼")] + TaxRates = 10, + /// + /// 姹囩巼闆嗗悎 + /// + [EnumRemark("姹囩巼")] + ExchangeRates = 11, + /// + /// 浠撳簱闆嗗悎 + /// + [EnumRemark("浠撳簱")] + Stocks = 12, + /// + /// 鍗曚綅闆嗗悎 + /// + [EnumRemark("鍗曚綅")] + Units = 13, + /// + /// 瀹㈡埛浠撳簱闆嗗悎 + /// + [EnumRemark("瀹㈡埛浠撳簱")] + CustomerStocks = 14, + /// + /// 閮ㄩ棬闆嗗悎 + /// + [EnumRemark("閮ㄩ棬")] + Depts = 15, + /// + /// 浠撳簱211闆嗗悎 + /// + [EnumRemark("浠撳簱211")] + StocksWith211 = 16, + /// + /// 渚涘簲鍟嗛粯璁よ仈绯讳汉闆嗗悎 + /// + [EnumRemark("渚涘簲鍟嗛粯璁よ仈绯讳汉")] + SuppliersContacts = 17, + /// + /// 鑿滃崟闆嗗悎 + /// + [EnumRemark("鑿滃崟")] + Menus = 18, + /// + /// 浠撲綅闆嗗悎 + /// + [EnumRemark("浠撲綅")] + SubStocks = 19, + + /// + /// 浠撳簱锛氱紪鐮佷笌缁勭粐缂栫爜缁撳悎 + /// + [EnumRemark("浠撳簱")] + StocksJoinOrgCode=20, + + /// + /// 浠撳簱锛氱紪鐮佷笌缁勭粐缂栫爜缁撳悎 + /// + [EnumRemark("浠撲綅涓庝粨搴撲笌缁勭粐")] + SubStocksJoinOrgCode + + } +} diff --git a/src/BarCode.Web.Domain/Values/Single/SingleControllerType.cs b/src/BarCode.Web.Domain/Values/Single/SingleControllerType.cs new file mode 100644 index 0000000..69f9f1f --- /dev/null +++ b/src/BarCode.Web.Domain/Values/Single/SingleControllerType.cs @@ -0,0 +1,29 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; + +namespace BarCode.Web.Domain.Values.Single +{ + /// + /// 鍗曠偣-鎺у埗鍣ㄦ灇涓 + /// + public enum SingleControllerType + { + /// + /// 鍗曠偣OPS鍒楄〃鏁版嵁-鎺у埗鍣 + /// + Single = 1, + /// + /// 鍗曠偣閰嶇疆椤规暟鎹-鎺у埗鍣 + /// + SysConfig = 2, + /// + /// 鍗曠偣鐧诲綍椤规暟鎹-鎺у埗鍣 + /// + Login = 3, + /// + /// 鍗曠偣鍏叡鎺ュ彛鏁版嵁-鎺у埗鍣 + /// + Public = 4 + } +} diff --git a/src/BarCode.Web.Domain/Values/Single/SingleLoginAction.cs b/src/BarCode.Web.Domain/Values/Single/SingleLoginAction.cs new file mode 100644 index 0000000..2a0f14e --- /dev/null +++ b/src/BarCode.Web.Domain/Values/Single/SingleLoginAction.cs @@ -0,0 +1,42 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; + +namespace BarCode.Web.Domain.Values.Single +{ + /// + /// 鍗曠偣鏁版嵁鎺ュ彛-鐧诲綍瑕佷娇鐢ㄧ殑鏁版嵁鎺ュ彛-鏂规硶鏋氫妇 + /// + public enum SingleLoginAction + { + /// + /// 鑿滃崟 + /// + Menus = 1, + /// + /// 浜哄憳 + /// + Staff = 2, + /// + /// 鍏徃 + /// + Company = 3, + /// + /// 渚涘簲鍟 + /// + Supplier = 4, + /// + /// 瀹㈡埛 + /// + Customer = 5, + /// + /// 鍏ㄩ儴淇℃伅 + /// + All = 6, + /// + /// 鍏徃淇℃伅 + /// + CompanyInfo = 7, + + } +} diff --git a/src/BarCode.Web.Domain/Values/Single/SysConfigAction.cs b/src/BarCode.Web.Domain/Values/Single/SysConfigAction.cs new file mode 100644 index 0000000..17e6369 --- /dev/null +++ b/src/BarCode.Web.Domain/Values/Single/SysConfigAction.cs @@ -0,0 +1,223 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; + +namespace BarCode.Web.Domain.Values.Single +{ + /// + /// 鍗曠偣鏁版嵁锛氶厤缃」鍜屽叕鍏辨帴鍙g殑鏂规硶鏋氫妇鍊 + /// + public enum SysConfigAction + { + /// + /// 渚涘簲鍟-鏍规嵁鍚嶇О鍜屽叕鍙 + /// + GetSupplierByNameAndCompany = 1, + /// + /// 缁勭粐-鏍规嵁鍏徃 + /// + GetOrgByCompany = 2, + /// + /// 閮ㄩ棬-鏍规嵁缁勭粐鍜屽叕鍙 + /// + GetDeptByOrgAndCompany = 3, + /// + /// 浜哄憳-鏍规嵁鍏徃 + /// + GetStaffByCompany = 4, + /// + /// 浜哄憳-鏍规嵁閮ㄩ棬鍜屽叕鍙 + /// + GetStaffByDeptAndCompany = 5, + /// + /// 浜哄憳-鏍规嵁缁勭粐鍜屽叕鍙 + /// + GetStaffByOrgAndCompany = 6, + /// + /// 瀹㈡埛-鏍规嵁鍏徃 + /// + GetCustomerByCompany = 7, + /// + /// 瀹㈡埛-鏍规嵁瀹㈡埛鍜岀粍缁囧拰鍏徃 + /// + GetCustomerByCustomerAndOrgAndCompany = 8, + /// + /// 瀹㈡埛淇℃伅-鏍规嵁瀹㈡埛鍜岀粍缁囧拰鍏徃 + /// + GetCustomerInfoByCustomerAndOrgAndCompany = 9, + /// + /// 鏀舵鏉′欢-鏍规嵁鍏徃 + /// + GetCollectionTermsByCompany = 10, + /// + /// 浠樻鏉′欢-鏍规嵁鍏徃 + /// + GetPaymentTermByCompany = 11, + /// + /// 缁撶畻鏂瑰紡-鏍规嵁鍏徃 + /// + GetSettlementMethodByCompany = 12, + /// + /// 缁撶畻甯佸埆-鏍规嵁鍏徃 + /// + GetSettlementCurrencyByCompany = 13, + /// + /// 鍗曚綅-鏍规嵁鍏徃 + /// + GetUnitByCompany = 14, + /// + /// 鍗曚綅锛堥儴鍒嗗睘鎬э級-鏍规嵁鍏徃 + /// + GetUnitPropertyByCompany = 15, + /// + /// 绋庣巼-鏍规嵁鍏徃 + /// + GetTaxRateByCompany = 16, + /// + /// 浠撳簱-鏍规嵁鍚嶇О鍜屽叕鍙 + /// + GetWarehouseByNameAndCompany = 17, + /// + /// 浠撳簱-鏍规嵁缁勭粐鍜屽叕鍙 + /// + GetWarehouseByOrgAndCompany = 18, + /// + /// 浠撳簱锛堜笉鏄皟鎷ㄤ腑杞粨锛-鏍规嵁缁勭粐鍜屽叕鍙 + /// + GetWarehouseByOrgAndCompanyForNotTransfer = 19, + /// + /// 浠撳簱锛211锛-鏍规嵁缁勭粐鍜屽叕鍙 + /// + GetWarehouseByOrgAndCompanyFor211 = 20, + /// + /// 浠撳簱-鏍规嵁瀹㈡埛鍜屽叕鍙 + /// + GetWareouseByCustomerAndCompany = 21, + + /// + /// 浠撲綅-鏍规嵁浠撳簱 + /// + GetChildWarehouseByPid = 22, + /// + /// 浠撲綅-鏍规嵁- + /// + GetChildWarehouse = 23, + /// + /// 姹囩巼淇℃伅-鏍规嵁鍘熷竵銆佺洰鏍囧竵鍜屽叕鍙 + /// + GetRateInfoByFromToAndCompany = 24, + /// + /// 瀹㈡埛浠撳簱-鏍规嵁瀹㈡埛鍜岀粍缁囧拰鍏徃 + /// + GetCustomerStockByCustomerAndOrgAndCompany = 25, + /// + /// 浠樻鏉′欢锛岀粨绠楀竵鍒紝缁撶畻鏂瑰紡,閲囪喘鍛橈紝閲囪喘閮ㄩ棬-鏍规嵁渚涘簲鍟嗗拰缁勭粐 + /// + GetPtAndScAndSmAndBuyerAndDeptBySupplierAndOrg = 26, + /// + /// 鑾峰彇浠撳簱锛氭牴鎹粨搴搃d + /// + GetWarehouseByIds = 27, + /// + /// 鑾峰彇搴撳瓨锛氭牴鎹粍缁囧拰鍏徃 + /// + GetCustomerByOrgAndCompany = 28, + + /// + /// 鑾峰彇瀹㈡埛浠撳簱锛氭牴鎹鎴稩DS鍜岀粍缁囧拰鍏徃 + /// + GetCustomerStockByCustomerListAndOrgAndCompany = 29, + /// + /// 姹囩巼(鎵鏈) + /// + GetRateListByFromToAndCompany = 30, + + /// + /// 渚涘簲鍟嗛夋嫨鍚庤幏鍙栵細浠樻鏉′欢锛岀粨绠楀竵鍒紝缁撶畻鏂瑰紡,閲囪喘鍛橈紝閲囪喘閮ㄩ棬,鏍规嵁缁勭粐IDS + /// + GetPtAndScAndSmAndBuyerAndDeptByOrgs = 31, + /// + /// 鑾峰彇瀹㈡埛浠撳簱锛氭牴鎹甤ode闆嗗悎 + /// + GetCustomerStockListByCodes = 32, + /// + /// 渚涘簲鍟:鏍规嵁ids + /// + GetSupperByIds = 33, + /// + /// 鏍规嵁鍏徃鎼滅储鎵鏈変粨搴(璁$畻琛ヨ揣棰戞) + /// + GetWarehouseReplenDatebyCompany = 34, + /// + /// 鑾峰彇浠撳簱锛氭牴鎹甤odes + /// + GetWarehouseByCodes = 35, + /// + /// 鑾峰彇瀹㈡埛浠撳簱锛氭牴鎹甤odes + /// + GetCustomerStockByCodes = 36, + + /// + /// 鑾峰彇璋冩嫧涓浆浠撳簱锛氭牴鎹叕鍙 + /// + GetWarehouseTransferByCompany = 37, + /// + /// 鑾峰彇渚涘簲鍟嗘暟鎹牴鎹甶ds + /// + GetSupperAbout1ByIds = 38, + /// + /// 鑾峰彇浠撳簱:鏍规嵁榛樿琛ヨ揣瀹㈡埛 + /// + GetWarehouseByDefaultReplenishCustomer = 39, + /// + /// 鑾峰彇鐢ㄦ埛锛圛D鍜孨ame锛夛細鏍规嵁鍏徃 + /// + GetUsersByCompany = 40, + /// + /// 鍏ㄩ儴閮ㄩ棬-鏍规嵁缁勭粐鍜屽叕鍙革細涓嶅鐞嗗瓙绾 + /// + GetDeptAllByOrgAndCompany = 41, + + /// + /// 鑾峰彇鍏ㄩ儴鍛樺伐锛氭牴鎹叕鍙稿拰缁勭粐 + /// + GetStaffAllByOrgAndCompany = 42, + + /// + /// 鑾峰彇浠撳簱:锛氭牴鎹鐞嗙郴缁焎ode鍜屼粨搴撳悕绉板拰鍏徃ID锛屽娉ㄧ郴缁焎ode鍜屽叕鍙窱D鏄繀濉 + /// + GetWmsWarehouseBySystemCodeAndNameAndCompany = 43, + + /// + /// 鑾峰彇浠撳簱:锛氭牴鎹鐞嗙郴缁焎ode鍜屼粨浣嶅悕绉板拰鍏徃ID锛屽娉ㄧ郴缁焎ode鍜屽叕鍙窱D鏄繀濉 + /// + GetWmsSubWarehouseBySystemCodeAndNameAndCompany = 44, + + /// + /// 鑾峰彇浠撲綅璇︽儏锛氭牴鎹粨浣岻D鍜屽叕鍙窱D + /// + GetWmsSubWarehouseByIdAndCompany = 45, + /// + /// 鑾峰彇浠撲綅璇︽儏锛氭牴鎹粨浣岻D闆嗗悎鍜屽叕鍙窱D + /// + GetWmsSubWarehouseByIdsAndCompany = 46, + + /// + /// 鑾峰彇浠撲綅璇︽儏锛氭牴鎹粨浣岰ode鍜屽叕鍙窱D + /// + GetWmsSubWarehouseByCodeAndCompany = 47, + + /// + /// 鑾峰彇浠撲綅璇︽儏锛氭牴鎹粨浣岰odes闆嗗悎鍜屽叕鍙窱D + /// + GetWmsSubWarehouseByCodesAndCompany = 48, + /// + /// 鏍规嵁鐢ㄦ埛鑾峰彇缁勭粐 + /// + GetOrgByUser = 49, + /// + /// 鏍规嵁鐢ㄦ埛鑾峰彇渚涘簲鍟 + /// + GetSupplierByUser = 50 + } +} diff --git a/src/BarCode.Web.Repositories/BarCode.Web.Repositories.csproj b/src/BarCode.Web.Repositories/BarCode.Web.Repositories.csproj new file mode 100644 index 0000000..6dc3500 --- /dev/null +++ b/src/BarCode.Web.Repositories/BarCode.Web.Repositories.csproj @@ -0,0 +1,30 @@ +锘 + + + net8.0 + enable + enable + true + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/BarCode.Web.Repositories/BasicsRepositories.cs b/src/BarCode.Web.Repositories/BasicsRepositories.cs new file mode 100644 index 0000000..9928314 --- /dev/null +++ b/src/BarCode.Web.Repositories/BasicsRepositories.cs @@ -0,0 +1,197 @@ +锘縰sing AutoMapper; +using Microsoft.EntityFrameworkCore.Storage; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using BarCode.Web.Core.Dto.SingleData; +using BarCode.Web.Core.Internal.Results; +using BarCode.Web.Domain.Infrastructure; +using BarCode.Web.Domain.IService.Public; +using BarCode.Web.Domain.Values; +using BarCode.Web.Domain.Values.Single; +using BarCode.Web.Repositories.Configuration; +using System.ComponentModel.Design; +using Microsoft.Extensions.Caching.Memory; + +namespace BarCode.Web.Repositories +{ + /// + /// 鍩虹鏁版嵁 + /// + public class BasicsRepositories : IBasicsRepositories + { + private readonly IMapper _mapper; + private readonly IServiceProvider _serviceProvider; + private RepositoryDbContext _context; + private readonly ILoginRepositories _loginService; + private readonly ISingleDataService _singleDataService; + private readonly IMemoryCache _memoryCache; + + public BasicsRepositories(RepositoryDbContext context, IMapper mapper, IServiceProvider serviceProvider, + ILoginRepositories loginService, ISingleDataService singleDataService, + IMemoryCache memoryCache) + { + _context = context; + _mapper = mapper; + _serviceProvider = serviceProvider; + _loginService = loginService; + _singleDataService = singleDataService; + _memoryCache = memoryCache; + } + /// + /// 鑾峰彇鎵鏈変汉鍛 + /// + /// + /// + public async Task> GetStaffListAsync(int CompanyId) + { + var result = await _singleDataService.GetSysConfigData, SingleDataRequest> + (new SingleDataRequest(CompanyId), + SysConfigAction.GetStaffByCompany); + if (!result.Success) + return null; + return result.Data.ToList(); + } + + public async Task> GetSubUcStockAsync(int stockId) + { + var result = await _singleDataService.GetSysConfigData, SubStockRequest> + (new SubStockRequest(stockId), + SysConfigAction.GetChildWarehouseByPid); + if (!result.Success) + return null; + return result.Data.ToList(); + } + + public async Task> GetSubUcStockAsync(string systemCode, string name, int companyId) + { + var result = await _singleDataService.GetSysConfigData, SystemCodeRequest> + (new SystemCodeRequest(systemCode, name, companyId), + SysConfigAction.GetWmsSubWarehouseBySystemCodeAndNameAndCompany); + if (!result.Success) + return null; + return result.Data.ToList(); + } + + /// + /// 鑾峰彇浠撲綅璇︽儏锛氭牴鎹粨浣岻D鍜屽叕鍙窱D + /// + /// + /// + /// + public async Task GetSubUcStockAsync(int id, int companyId) + { + var result = await _singleDataService.GetSysConfigData, IdRequest> + (new IdRequest(id, companyId), + SysConfigAction.GetWmsSubWarehouseByIdAndCompany); + if (!result.Success) + return null; + return result.Data; + } + + /// + /// 鑾峰彇浠撲綅闆嗗悎锛氭牴鎹粨浣岻D闆嗗悎鍜屽叕鍙窱D + /// + /// + /// + /// + public async Task> GetSubUcStockAsync(List ids, int companyId) + { + var result = await _singleDataService.GetSysConfigData, IdsRequest> + (new IdsRequest(ids, companyId), + SysConfigAction.GetWmsSubWarehouseByIdsAndCompany); + if (!result.Success) + return null; + return result.Data.ToList(); + } + /// + /// 鑾峰彇浠撲綅璇︽儏锛氭牴鎹粨浣嶇紪鐮佸拰鍏徃ID + /// + /// + /// + /// + public async Task GetSubUcStockAsync(string code, int companyId) + { + var result = await _singleDataService.GetSysConfigData, CodeRequest> + (new CodeRequest(code, companyId), + SysConfigAction.GetWmsSubWarehouseByCodeAndCompany); + if (!result.Success) + return null; + return result.Data; + } + /// + /// 鑾峰彇浠撲綅闆嗗悎锛氭牴鎹粨浣嶇紪鐮侀泦鍚堝拰鍏徃ID + /// + /// + /// + /// + public async Task> GetSubUcStockAsync(List codes, int companyId) + { + var result = await _singleDataService.GetSysConfigData, CodesRequest> + (new CodesRequest(codes, companyId), + SysConfigAction.GetWmsSubWarehouseByCodesAndCompany); + if (!result.Success) + return null; + return result.Data.ToList(); + } + public async Task> GetUcStockAsync(string systemCode, string name, int companyId) + { + var result = await _singleDataService.GetSysConfigData, SystemCodeRequest> + (new SystemCodeRequest(systemCode, name, companyId), + SysConfigAction.GetWmsWarehouseBySystemCodeAndNameAndCompany); + if (!result.Success) + return null; + return result.Data.ToList(); + } + + public IDbContextTransaction GetTransaction() + { + return _context.Database.BeginTransaction(); + } + + public bool CommitTransaction(bool isRollback, IDbContextTransaction transaction) + { + try + { + if (transaction == null) + return true; + + if (isRollback) + { + transaction.Rollback(); + return false; + } + transaction.Commit(); + } + catch (Exception ex) + { + transaction.Rollback(); + return false; + } + return true; + } + /// + /// 鏍规嵁鐢ㄦ埛鍚嶇簿纭尮閰嶇敤鎴 + /// + /// + /// + /// + public Task> GetUserIdsAsync(string name, int companyId) + { + var cache_key = SingleAction.Users + "_" + companyId + "_IdGetName"; + var dic = _memoryCache.Get>(cache_key); + if (dic == null) + { + var str = _singleDataService.GetSingleData(SingleAction.Users, companyId, 0); + dic = _memoryCache.Get>(cache_key); + if (dic == null) + return Task.FromResult(new List()); + } + + var v = from d in dic where d.Value.Equals(name) select d; + return Task.FromResult(v.Select(s => s.Key).ToList()); + } + } +} diff --git a/src/BarCode.Web.Repositories/BoxMarkRepositories.cs b/src/BarCode.Web.Repositories/BoxMarkRepositories.cs new file mode 100644 index 0000000..388c9ce --- /dev/null +++ b/src/BarCode.Web.Repositories/BoxMarkRepositories.cs @@ -0,0 +1,312 @@ +锘縰sing AutoMapper; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Storage; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using BarCode.Web.Core.Dto; +using BarCode.Web.Core.Dto.Erp; +using BarCode.Web.Domain.Entitys; +using BarCode.Web.Domain.Infrastructure; +using BarCode.Web.Domain.IService.Public; +using BarCode.Web.Domain.Values.Single; +using BarCode.Web.Repositories.Configuration; +using BarCode.Web.Core.Dto.Login; + +namespace BarCode.Web.Repositories +{ + /// + /// 绠卞敍-浠撳偍 + /// + public class BoxMarkRepositories : IBoxMarkRepositories + { + private readonly ILoginRepositories _loginRepositories; + private readonly RepositoryDbContext _context; + private readonly ISingleDataService _singleDataService; + private readonly IErpService _erpService; + private readonly IErpBasicDataExtendService _erpBasicDataExtendService; + private readonly IBasicsRepositories _basicsRepositories; + + + public BoxMarkRepositories(RepositoryDbContext context, + IErpService erpService, + ILoginRepositories loginRepositories, + ISingleDataService singleDataService, + IBasicsRepositories basicsRepositories, + IErpBasicDataExtendService erpBasicDataExtendService) + { + _context = context; + _erpService = erpService; + _basicsRepositories = basicsRepositories; + _loginRepositories = loginRepositories; + _singleDataService = singleDataService; + _erpBasicDataExtendService = erpBasicDataExtendService; + } + + /// + /// 鍒楄〃-鍒嗛〉 + /// + /// + /// + public async Task<(List list, int total)> GetPagedList(BoxMarkQueryRequest dto, LoginInDto loginInfo) + { + //1.鑾峰彇鐗╂枡闆嗗悎鍜岀粍缁囬泦鍚堝拰渚涘簲鍟嗙殑闆嗗悎 + var materials = new List(); + var materials_result = await _erpService.BillQueryForMaterial(); + if (materials_result.IsSuccess) + materials = materials_result.Data.ToList(); + + List materialNumbs = new List(); + + //鐗╂枡闆嗗悎锛涙ā绯婃煡璇㈠悗鐨勭墿鏂欓泦鍚 + if (!string.IsNullOrEmpty(dto.Material)) + materialNumbs = materials.Where(w => w.MaterialNumber.Contains(dto.Material) || w.MaterialName.Contains(dto.Material) || w.Specifications.Contains(dto.Material)).Select(x => x.MaterialNumber).ToList(); + + List cr_ids = new List(); + if (!string.IsNullOrEmpty(dto.Creator)) + { + cr_ids = await _basicsRepositories.GetUserIdsAsync(dto.Creator, loginInfo.UserInfo.CompanyId); + } + var query = _context.BoxMarkBillNo + .GroupJoin(_context.BoxMark, detail => detail.Fid, order => order.Id, (detail, orders) => new { detail, orders }) + .SelectMany(x => x.orders.DefaultIfEmpty(), (p, order) => new { p.detail, order }) + .OrderByDescending(x => x.order.Id).ThenByDescending(x => x.detail.FirstBillNo).ThenByDescending(x => x.detail.LastBillNo) + .Where(adv => 1 == 1); + + if (loginInfo.UserInfo.IsAdmin != true && !string.IsNullOrEmpty(dto.OrgCode)) + { + var rec_type = dto.OrgCode.Substring(0, 1); + var rec_code = dto.OrgCode.Substring(2, dto.OrgCode.Length - 2); + + if (rec_type.Equals("s"))//渚涘簲鍟 + query = query.Where(w => rec_code == w.order.SupplierCode); + else//鏌ュ叾浠栧崟鎹(缁勭粐) + query = query.Where(w => rec_code == w.order.OrgCode); + } + ////缂栧彿鏌ヨ + //if (!string.IsNullOrEmpty(dto.BeginBillNo) && + // !string.IsNullOrEmpty(dto.EndBillNo)) + //{ + // if (dto.BeginBillNo.ToString().Length >= 13 && dto.EndBillNo.ToString().Length >= 13) + // { + // var begYMD = Convert.ToInt32(dto.BeginBillNo.Substring(2, 6)); + // var endYMD = Convert.ToInt32(dto.EndBillNo.Substring(2, 6)); + + // var begNo = Convert.ToInt32(dto.BeginBillNo.Substring(8)); + // var endNo = Convert.ToInt32(dto.EndBillNo.Substring(8)); + // query = query.Where(w => w.detail.FirstBillNo >= begYMD && w.detail.FirstBillNo <= endYMD && w.detail.LastBillNo >= begNo && w.detail.LastBillNo <= endNo); + // } + // else + // query = query.Where(w => w.detail.BillNo == dto.BeginBillNo || w.detail.BillNo == dto.EndBillNo); + //} + //else if (!string.IsNullOrEmpty(dto.BeginBillNo)) + // query = query.Where(w => w.detail.BillNo == dto.BeginBillNo); + //else if (!string.IsNullOrEmpty(dto.EndBillNo)) + // query = query.Where(w => w.detail.BillNo == dto.EndBillNo); + if (!string.IsNullOrEmpty(dto.BeginBillNo) && dto.BeginBillNo.ToString().Length >= 13) + { + var begYMD = Convert.ToInt32(dto.BeginBillNo.Substring(2, 6)); + + var begNo = Convert.ToInt32(dto.BeginBillNo.Substring(8)); + + query = query.Where(w => w.detail.FirstBillNo >= begYMD + && w.detail.LastBillNo >= begNo); + } + if (!string.IsNullOrEmpty(dto.EndBillNo) && dto.EndBillNo.ToString().Length >= 13) + { + var endYMD = Convert.ToInt32(dto.EndBillNo.Substring(2, 6)); + var endNo = Convert.ToInt32(dto.EndBillNo.Substring(8)); + + query = query.Where(w => w.detail.FirstBillNo <= endYMD + && w.detail.LastBillNo <= endNo); + } + + + //璁㈠崟鍙锋煡璇 + if (!string.IsNullOrEmpty(dto.OrderBillNos)) + { + var orderBNS = dto.OrderBillNos.Replace("锛", ","); + var orderBillNoList = orderBNS.Split(",").Where(x => !string.IsNullOrEmpty(x)).ToList(); + if (orderBillNoList != null && orderBillNoList.Count != 0) + { + query = query.Where(w => orderBillNoList.Contains(w.order.OrderBillNo)); + } + } + + //鐗╂枡ID鍦ㄦā绯婂悗鐨勭墿鏂 + if (!string.IsNullOrEmpty(dto.Material)) + { + query = query.Where(w => materialNumbs.Contains(w.order.MaterialNumber)); + } + + if (!string.IsNullOrEmpty(dto.Creator)) + query = query.Where(w => cr_ids.Contains(w.order.CreatorId)); + if (dto.CreateBeginDate != null) + query = query.Where(w => w.order.CreateTime.Date >= dto.CreateBeginDate.Value); + if (dto.CreateEndDate != null) + query = query.Where(w => w.order.CreateTime.Date <= dto.CreateEndDate.Value); + + int total = await query.CountAsync(); + var list = await query.Select(s => new BoxMarkQueryResponse() + { + Id = s.order.Id, + DetailId=s.detail.Id, + BillNo = s.detail.BillNo, + OrderBillNo = s.order.OrderBillNo, + MaterialName = _erpBasicDataExtendService.GetMaterialName(materials, s.order.MaterialNumber), + MaterialNumber = s.order.MaterialNumber, + Specifications = _erpBasicDataExtendService.GetMaterialSpecifications(materials, s.order.MaterialNumber), + BarCode = _erpBasicDataExtendService.GetMaterialBarCode(materials, s.order.MaterialNumber), + + CratingQty = s.order.CratingQty, + CratingNetWeightQty = s.order.CratingNetWeightQty, + CratingGrossWeightQty = s.order.CratingGrossWeightQty, + + TailboxQty = s.order.TailboxQty, + TailboxNetWeightQty = s.order.TailboxNetWeightQty, + TailboxGrossWeightQty = s.order.TailboxGrossWeightQty, + IsTail=s.detail.IsTail, + Sort = s.detail.Sort, + Creator = _singleDataService.GetSingleData(SingleAction.Users, loginInfo.UserInfo.CompanyId, s.order.CreatorId), + CreateTime = s.order.CreateTime.ToString("yyyy-MM-dd HH:mm:ss"), + Remark = s.order.Remark, + ProductQty=s.order.ProductQty, + BeginNumber=s.detail.BeginNumber, + EndNumber=s.detail.EndNumber + + }).Skip((dto.PageNo - 1) * dto.PageSize).Take(dto.PageSize).ToListAsync(); + + return (list, total); + } + + /// + /// 鏂板 + /// + /// + /// + /// + public async Task Add(BoxMark entity, bool isTransaction = true) + { + IDbContextTransaction _transaction = null; + if (isTransaction) + _transaction = _context.Database.BeginTransaction(); + try + { + await _context.BoxMark.AddAsync(entity); + await _context.SaveChangesAsync(); + if (_transaction != null) + _transaction.Commit(); + return entity; + } + catch (Exception ex) + { + if (_transaction != null) + _transaction.Rollback(); + return null; + } + + } + + /// + /// 璇︽儏-鏍规嵁鏈鏂扮殑ID + /// + /// + /// + public async Task GetBy() + { + var entity = await _context.BoxMark.OrderByDescending(x => x.Id).FirstOrDefaultAsync(); + return entity; + } + + /// + /// 鍒楄〃-璇︽儏淇℃伅鍒楄〃 + /// + /// + /// + /// + public async Task> GetListInfoBy(int id, int companyId) + { + //1.鑾峰彇鐗╂枡闆嗗悎鍜岀粍缁囬泦鍚堝拰渚涘簲鍟嗙殑闆嗗悎 + var materials = new List(); + var materials_result = await _erpService.BillQueryForMaterial(); + if (materials_result.IsSuccess) + materials = materials_result.Data.ToList(); + + var query = _context.BoxMarkBillNo + .GroupJoin(_context.BoxMark, detail => detail.Fid, order => order.Id, (detail, orders) => new { detail, orders }) + .SelectMany(x => x.orders.DefaultIfEmpty(), (p, order) => new { p.detail, order }) + .OrderByDescending(x => x.order.Id).ThenByDescending(x => x.detail.FirstBillNo).ThenByDescending(x => x.detail.LastBillNo) + .Where(adv => adv.order.Id == id); + var list = await query.Select(s => new BoxMarkQueryResponse() + { + Id = s.order.Id, + DetailId = s.detail.Id, + BillNo = s.detail.BillNo, + OrderBillNo = s.order.OrderBillNo, + MaterialName = _erpBasicDataExtendService.GetMaterialName(materials, s.order.MaterialNumber), + MaterialNumber = s.order.MaterialNumber, + Specifications = _erpBasicDataExtendService.GetMaterialSpecifications(materials, s.order.MaterialNumber), + BarCode = _erpBasicDataExtendService.GetMaterialBarCode(materials, s.order.MaterialNumber), + + CratingQty = s.order.CratingQty, + CratingNetWeightQty = s.order.CratingNetWeightQty, + CratingGrossWeightQty = s.order.CratingGrossWeightQty, + + TailboxQty = s.order.TailboxQty, + TailboxNetWeightQty = s.order.TailboxNetWeightQty, + TailboxGrossWeightQty = s.order.TailboxGrossWeightQty, + IsTail = s.detail.IsTail, + Sort=s.detail.Sort, + Creator = _singleDataService.GetSingleData(SingleAction.Users, companyId, s.order.CreatorId), + CreateTime = s.order.CreateTime.ToString("yyyy-MM-dd HH:mm:ss"), + Remark = s.order.Remark, + ProductQty = s.order.ProductQty, + BeginNumber = s.detail.BeginNumber, + EndNumber = s.detail.EndNumber + }).ToListAsync(); + + return list; + } + + /// + /// 璇︽儏-鏍规嵁鏈鏂扮殑ID + /// + /// + /// + public async Task GetLastBillNo() + { + var entity = await _context.BoxMarkBillNo.OrderByDescending(x => x.Id).FirstOrDefaultAsync(); + return entity; + } + + /// + /// 鎵归噺鍒犻櫎 + /// + /// + /// + public async Task DeleteRange(List ids, bool isTransaction = true) + { + IDbContextTransaction _transaction = null; + if (isTransaction) + _transaction = _context.Database.BeginTransaction(); + try + { + var list = await _context.BoxMark.Include(x=>x.BillNos).Where(f => ids.Contains(f.Id)).ToListAsync(); + _context.BoxMark.RemoveRange(list); + await _context.SaveChangesAsync(); + + if (_transaction != null) + _transaction.Commit(); + } + catch (Exception ex) + { + if (_transaction != null) + _transaction.Rollback(); + return false; + } + return true; + } + } +} diff --git a/src/BarCode.Web.Repositories/BoxRepositories.cs b/src/BarCode.Web.Repositories/BoxRepositories.cs new file mode 100644 index 0000000..b3025f4 --- /dev/null +++ b/src/BarCode.Web.Repositories/BoxRepositories.cs @@ -0,0 +1,381 @@ +锘縰sing AutoMapper; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Storage; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using BarCode.Web.Core.Dto; +using BarCode.Web.Core.Help; +using BarCode.Web.Domain.Entitys; +using BarCode.Web.Domain.Infrastructure; +using BarCode.Web.Domain.IService.Public; +using BarCode.Web.Domain.Mappers; +using BarCode.Web.Repositories.Configuration; +using BarCode.Web.Core.Dto.Box; +using BarCode.Web.Core.Dto.Erp; +using BarCode.Web.Core.Dto.Erp.Supplier; +using BarCode.Web.Core.Dto.Erp.Org; +using BarCode.Web.Core.Dto.SerialNumbers; +using BarCode.Web.Domain.Values.Single; +using BarCode.Web.Core; +using BarCode.Web.Domain.Values; +using NPOI.OpenXmlFormats.Wordprocessing; +using System.Runtime.CompilerServices; +using System.ComponentModel.Design; +using BarCode.Web.Core.Dto.Login; +using BarCode.Web.Core.Dto.SingleData; +using BarCode.Web.Core.Internal.Results; + +namespace BarCode.Web.Repositories +{ + /// + /// 鑰乷ps绠变俊鎭 + /// + public class BoxRepositories : IBoxRepositories + { + private readonly IMapper _mapper; + private readonly IServiceProvider _serviceProvider; + private readonly RepositoryDbContext _context; + private readonly ISingleDataService _singleDataService; + private readonly ILoginRepositories _loginRepositories; + private readonly IBasicsRepositories _basicsRepositories; + private readonly IErpBasicDataExtendService _erpBasicDataExtendService; + private readonly IErpService _erpService; + public BoxRepositories(RepositoryDbContext context, IMapper mapper, IServiceProvider serviceProvider, + ISingleDataService singleDataService, ILoginRepositories loginRepositories, + IBasicsRepositories basicsRepositories, IErpBasicDataExtendService erpBasicDataExtendService, + IErpService erpServic) + { + _context = context; + _mapper = mapper; + _serviceProvider = serviceProvider; + _singleDataService = singleDataService; + _loginRepositories = loginRepositories; + _basicsRepositories = basicsRepositories; + _erpBasicDataExtendService = erpBasicDataExtendService; + _erpService = erpServic; + } + public async Task Get(int id) + { + return await _context.Box.AsNoTracking() + .Include(x => x.Details) + .FirstOrDefaultAsync(f => f.Id.Equals(id)); + } + + /// + /// 鎵归噺淇敼 + /// + /// + /// + /// + public async Task EditEntityList(List entitys, bool isTransaction = true) + { + IDbContextTransaction _transaction = null; + if (isTransaction) + _transaction = _context.Database.BeginTransaction(); + try + { + List list = entitys.Select(s => s.Id).ToList(); + + var res = await _context.Box + .Include(s => s.Details) + .Where(f => list.Contains(f.Id)).ToListAsync(); + + _mapper.ToMapList(entitys, res); + //_mapper.ToMapList(entitys.SelectMany(s => s.Details).ToList(), res.SelectMany(s => s.Details).ToList()); + + await _context.SaveChangesAsync(); + if (_transaction != null) + _transaction.Commit(); + } + catch (Exception ex) + { + if (_transaction != null) + _transaction.Rollback(); + return false; + } + return true; + + } + + public async Task GetByNo(string billNo) + { + return await _context.Box.AsNoTracking() + .Include(x => x.Details) + .FirstOrDefaultAsync(f => f.BoxBillNo.Equals(billNo)); + } + public async Task> GetEntityListByNos(List billNos) + { + return await _context.Box.AsNoTracking() + .Include(x => x.Details) + .Where(f => billNos.Contains(f.BoxBillNo)).ToListAsync(); + } + //鏍规嵁绠卞彿鎼滅储 鐢ㄦ潵姣斿纭畾鏄惁绠卞彿淇℃伅鏄惁瀛樺湪 + public async Task> GetByNos(List billNos) + { + return await _context.Box.AsNoTracking() + .Where(w => billNos.Contains(w.BoxBillNo)).Select(s => s.BoxBillNo).ToListAsync(); + } + + public async Task AddRange(List entitys, bool isTransaction = true) + { + IDbContextTransaction _transaction = null; + if (isTransaction) + _transaction = _context.Database.BeginTransaction(); + try + { + if (entitys != null && entitys.Count != 0) + { + await _context.Box.AddRangeAsync(entitys); + await _context.SaveChangesAsync(); + + foreach (var e in entitys) + { + e.GenerateNo(); + } + await _context.SaveChangesAsync(); + } + if (_transaction != null) + _transaction.Commit(); + return true; + } + catch + { + if (_transaction != null) + _transaction.Rollback(); + return false; + } + } + /// + /// 鑾峰彇绠遍泦鍚 + /// + /// + /// + public async Task> GetEntityList(List ids) + { + return await _context.Box.AsNoTracking() + .Include(s => s.Details) + .Where(f => ids.Contains(f.Id)) + .ToListAsync(); + } + /// + /// 鍒楄〃 + /// + /// + /// + /// + /// + public async Task<(List list, int total)> GetListAsync(BoxQueryRequest dto, LoginInDto loginInfo) + { + int companyId = loginInfo.UserInfo.CompanyId; + List mNumber = new List(); + var materials_result = await _erpService.BillQueryForMaterial(); + List materials = new List(); + if (materials_result.IsSuccess) + materials = materials_result.Data.ToList(); + //鐗╂枡闆嗗悎锛涙ā绯婃煡璇㈠悗鐨勭墿鏂欓泦鍚 + if (!string.IsNullOrEmpty(dto.MaterialNumber)) + { + if (materials != null) + mNumber = materials.Where(w => w.MaterialNumber.Contains(dto.MaterialNumber) + || w.MaterialName.Contains(dto.MaterialNumber) + || w.Specifications.Contains(dto.MaterialNumber) + ).Select(s => s.MaterialNumber).ToList(); + } + + ////渚涘簲鍟 + //var supplier_result = await _erpService.BillQueryForSupplier(); + //List suppliers = new List(); + //if (supplier_result.IsSuccess) + // suppliers = supplier_result.Data.ToList(); + ////鍙栫粍缁 + //var org_result = await _erpService.BillQueryForOrg(); + //List orgs = new List(); + //if (org_result.IsSuccess) + // orgs = org_result.Data.ToList(); + var result = await _singleDataService.GetSingleData, SingleDataRequest, SysConfigAction>( + new SingleDataRequest(loginInfo.UserInfo.CompanyId), SysConfigAction.GetOrgByCompany, SingleControllerType.SysConfig); + List orgs = new List(); + if (result.IsSuccess) + orgs = result.Data.ToList(); + + List cr_ids = new List(); + if (!string.IsNullOrEmpty(dto.CreateUser)) + { + cr_ids = await _basicsRepositories.GetUserIdsAsync(dto.CreateUser, loginInfo.UserInfo.CompanyId); + } + List s_ids = new List(); + if (dto.SerialNumbers != null && dto.SerialNumbers.Count() > 0) + { + var details = await GetDetailIdBySerialNumbers(dto.SerialNumbers); + s_ids = details.Select(s => s.Id).ToList(); + } + var query = _context.Box + .GroupJoin(_context.BoxDetails, box => box.Id, detail => detail.Fid, (box, detail) => new { box, detail }) + .SelectMany(x => x.detail.DefaultIfEmpty(), (p, detail) => new { p.box, detail }) + .OrderByDescending(o => o.box.Id) + .Where(f => 1 == 1); + + if (loginInfo.UserInfo.IsAdmin != true && !string.IsNullOrEmpty(dto.OrgCode)) + { + var rec_type = dto.OrgCode.Substring(0, 1); + var rec_code = dto.OrgCode.Substring(2, dto.OrgCode.Length - 2); + + if (rec_type.Equals("s"))//渚涘簲鍟 + query = query.Where(w => rec_code == w.box.SupplierCode); + else//鏌ュ叾浠栧崟鎹(缁勭粐) + query = query.Where(w => rec_code == w.box.OrgCode); + } + + if (!string.IsNullOrEmpty(dto.SupplierOrOrg)) + { + var rec_type = dto.SupplierOrOrg.Substring(0, 1); + var rec_code = dto.SupplierOrOrg.Substring(2, dto.SupplierOrOrg.Length - 2); + + if (rec_type.Equals("s"))//渚涘簲鍟 + query = query.Where(w => rec_code == w.box.SupplierCode); + else//鏌ュ叾浠栧崟鎹(缁勭粐) + query = query.Where(w => rec_code == w.box.OrgCode); + } + if (!string.IsNullOrEmpty(dto.MaterialNumber)) + query = query.Where(w => mNumber.Contains(w.detail.MaterialNumber)); + if (!string.IsNullOrEmpty(dto.BoxBeginNo)) + { + //V01.05.00: 鍙緭鍏ヤ竴涓鍒欏彧鏌ヨ緭鍏ュ,涓嶅仛鍖洪棿鏌ヨ + var id = Convert.ToInt32(dto.BoxBeginNo.ToUpper().Replace("CTN", "")); + if (!string.IsNullOrEmpty(dto.BoxEndNo)) + query = query.Where(w => w.box.Id >= id); + else + query = query.Where(w => w.box.Id == id); + } + if (!string.IsNullOrEmpty(dto.BoxEndNo)) + { + //V01.05.00: 鍙緭鍏ヤ竴涓鍒欏彧鏌ヨ緭鍏ュ,涓嶅仛鍖洪棿鏌ヨ + var id = Convert.ToInt32(dto.BoxEndNo.ToUpper().Replace("CTN", "")); + if (!string.IsNullOrEmpty(dto.BoxBeginNo)) + query = query.Where(w => w.box.Id <= id); + else + query = query.Where(w => w.box.Id == id); + } + if (dto.Status != null) + query = query.Where(w => w.box.Status == (BoxStatus)dto.Status); + if (dto.CreateBeginDate != null) + query = query.Where(w => w.box.CreateTime >= dto.CreateBeginDate); + if (dto.CreateEndDate != null) + { + DateTime dt_end = ((DateTime)dto.CreateEndDate).AddDays(1); + query = query.Where(w => w.box.CreateTime <= dt_end); + } + if (dto.CartonBeginDate != null) + query = query.Where(w => w.box.CartonEndTime >= dto.CartonBeginDate); + if (dto.CartonEndDate != null) + { + DateTime dt_end = ((DateTime)dto.CartonEndDate).AddDays(1); + query = query.Where(w => w.box.CartonEndTime <= dt_end); + } + + if (dto.SerialNumbers != null && dto.SerialNumbers.Count() > 0) + query = query.Where(w => s_ids.Contains(w.detail.Id)); + if (dto.BoxPrintStatus != null) + query = query.Where(w => dto.BoxPrintStatus == true ? w.box.PrintNumber > 0 : w.box.PrintNumber <= 0); + if (!string.IsNullOrEmpty(dto.CreateUser)) + query = query.Where(w => cr_ids.Contains(w.box.CreatorId)); + + int total = await query.CountAsync(); + var list = await query.Select(s => new BoxInfoResponse() + { + Id = s.box.Id, + DetailId = s.detail == null ? 0 : s.detail.Id, + BoxBillNo = s.box.BoxBillNo, + Specifications = _erpBasicDataExtendService.GetMaterialSpecifications(materials, s.detail == null ? "" : s.detail.MaterialNumber), + MaterialNumber = s.detail == null ? "" : s.detail.MaterialNumber, + MaterialName = _erpBasicDataExtendService.GetMaterialName(materials, s.detail == null ? "" : s.detail.MaterialNumber), + BarCode = _erpBasicDataExtendService.GetMaterialBarCode(materials, s.detail == null ? "" : s.detail.MaterialNumber), + SerialNumbers = s.detail == null ? "" : string.Join(",", s.detail.SerialNumbers), + Qty = s.detail == null ? 0 : s.detail.Qty, + Status = s.box.Status.GetRemark(), + CartonBeginTime = s.box.CartonBeginTime.DateToStringSeconds(), + CartonEndTime = s.box.CartonEndTime.DateToStringSeconds(), + CartonUser = _singleDataService.GetSingleData(SingleAction.Users, companyId, s.box.CartonUserId), + Creator = _singleDataService.GetSingleData(SingleAction.Users, companyId, s.box.CreatorId), + CreateTime = s.box.CreateTime.DateToStringSeconds(), + PrintNumber = s.box.PrintNumber, + SupplierOrOrg = string.IsNullOrEmpty(s.box.SupplierCode) ? _erpBasicDataExtendService.GetSingleOrgName(orgs, s.box.OrgCode) + : _singleDataService.GetSingleData(SingleAction.Suppliers, companyId, s.box.SupplierCode)//渚涘簲鍟嗗彇鍗曠偣鐨 + }).Skip((dto.PageNo - 1) * dto.PageSize).Take(dto.PageSize).ToListAsync(); + return (list, total); + } + + /// + /// 鏍规嵁搴忓垪鍙疯幏鍙栨槑缁 + /// + /// + /// + private Task> GetDetailIdBySerialNumbers(List serialNumbers) + { + if (serialNumbers.Count() == 0) Task.FromResult(new List()); + string str = $"select * from t_barcode_box_details where "; + for (int i = 0; i < serialNumbers.Count(); i++) + { + if (i == 0) + str += $"SerialNumbers like '%\"{serialNumbers[i]}\"%'"; + else + str += $" or SerialNumbers like '%\"{serialNumbers[i]}\"%'"; + } + var fs = FormattableStringFactory.Create(str); + var list = _context.Set().FromSqlInterpolated(fs).ToList(); + return Task.FromResult(list); + } + /// + /// 缂栬緫 + /// + /// + /// + /// + public async Task Edit(Box entity, bool isTransaction = true) + { + IDbContextTransaction _transaction = null; + if (isTransaction) + _transaction = _context.Database.BeginTransaction(); + + var res = await _context.Box + .Include(s => s.Details) + .FirstOrDefaultAsync(f => f.Id == entity.Id); + if (res == null) return null; + + _mapper.Map(entity, res); + await _context.SaveChangesAsync(); + + if (_transaction != null) + _transaction.Commit(); + + return res; + + } + /// + /// 鑾峰彇瑁呯瀹屾垚鐨勭淇℃伅 + /// + /// + /// + /// + public async Task<(List, int tota)> GetEntityByWmsList(WmsBoxRequest dto) + { + var query = _context.Box.Include(x => x.Details) + .Where(w => w.Status == BoxStatus.Complete); + + if (!string.IsNullOrEmpty(dto.BoxBillNo)) + query = query.Where(w => w.BoxBillNo.Equals(dto.BoxBillNo)); + if (dto.StrartTime != null) + query = query.Where(w => w.CartonEndTime >= dto.StrartTime); + if (dto.EndTime != null) + query = query.Where(w => w.CartonEndTime <= dto.EndTime); + + + int total = await query.CountAsync(); + var list = await query.Skip((dto.Page - 1) * dto.Limit).Take(dto.Limit).ToListAsync(); + return (list, total); + } + } +} diff --git a/src/BarCode.Web.Repositories/CenerateDataRepositories.cs b/src/BarCode.Web.Repositories/CenerateDataRepositories.cs new file mode 100644 index 0000000..f4829e4 --- /dev/null +++ b/src/BarCode.Web.Repositories/CenerateDataRepositories.cs @@ -0,0 +1,87 @@ +锘縰sing AutoMapper; +using BarCode.Web.Domain.Entitys; +using BarCode.Web.Domain.Infrastructure; +using BarCode.Web.Domain.Values; +using BarCode.Web.Repositories.Configuration; +using Microsoft.EntityFrameworkCore.Storage; +using Microsoft.EntityFrameworkCore; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BarCode.Web.Repositories +{ + /// + /// + /// + public class CenerateDataRepositories : ICenerateDataRepositories + { + private readonly IMapper _mapper; + private readonly IServiceProvider _serviceProvider; + private readonly RepositoryDbContext _context; + + public CenerateDataRepositories(RepositoryDbContext context, IMapper mapper, IServiceProvider serviceProvider) + { + _context = context; + _mapper = mapper; + _serviceProvider = serviceProvider; + } + /// + /// 娣诲姞 + /// + /// + /// + /// + public async Task Add(CenerateData entity, bool isTransaction = true) + { + IDbContextTransaction _transaction = null; + if (isTransaction) + _transaction = _context.Database.BeginTransaction(); + + await _context.CenerateData.AddAsync(entity); + await _context.SaveChangesAsync(); + + if (_transaction != null) + _transaction.Commit(); + return entity; + } + /// + /// 淇敼 + /// + /// + /// + /// + public async Task Edit(CenerateData entity, bool isTransaction = true) + { + IDbContextTransaction _transaction = null; + if (isTransaction) + _transaction = _context.Database.BeginTransaction(); + + var res = await _context.CenerateData + .FirstOrDefaultAsync(f => f.Id == entity.Id); + if (res == null) return null; + + _mapper.Map(entity, res); + await _context.SaveChangesAsync(); + + if (_transaction != null) + _transaction.Commit(); + + return res; + } + + public async Task Get(CenerateDataType type) + { + var entity = await _context.CenerateData + .FirstOrDefaultAsync(f => f.Type == type); + if (entity == null) + { + entity = await this.Add(new CenerateData(type)); + return entity; + } + return entity; + } + } +} diff --git a/src/BarCode.Web.Repositories/Configuration/DbContextExtensions.cs b/src/BarCode.Web.Repositories/Configuration/DbContextExtensions.cs new file mode 100644 index 0000000..bd32531 --- /dev/null +++ b/src/BarCode.Web.Repositories/Configuration/DbContextExtensions.cs @@ -0,0 +1,225 @@ +锘縰sing Microsoft.Data.SqlClient; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using System; +using System.Collections.Generic; +using System.Data; +using System.Data.Common; +using System.Linq; +using System.Linq.Expressions; +using System.Text; +using System.Threading.Tasks; + +namespace BarCode.Web.Repositories.Configuration +{ + /// + /// db涓婁笅鏂囨墿灞曠被 + /// + public static class DbContextExtensions + { + public static IEnumerable SqlQuery(this DatabaseFacade facade, string sql, bool isAlias = false, params object[] parameters) where T : class, new() + { + var dt = SqlQuery(facade, sql, parameters); + if (isAlias) + return dt.ToEnumerableAlias(); + return dt.ToEnumerable(); + } + + public static async Task> SqlQueryAsync(this DatabaseFacade facade, string sql, bool isAlias = false, params object[] parameters) where T : class, new() + { + return await Task.Run(() => + { + var dt = SqlQuery(facade, sql, parameters); + if (isAlias) + return dt.ToEnumerableAlias(); + return dt.ToEnumerable(); + }); + } + + public static IEnumerable ToEnumerable(this DataTable dt) where T : class, new() + { + var propertyInfos = typeof(T).GetProperties(); + var ts = new T[dt.Rows.Count]; + var i = 0; + foreach (DataRow row in dt.Rows) + { + + try + { + var t = new T(); + foreach (var p in propertyInfos) + if (dt.Columns.IndexOf(p.Name) != -1 && row[p.Name] != DBNull.Value) + p.SetValue(t, row[p.Name], null); + + ts[i] = t; + i++; + } + catch (Exception ex) + { + + throw ex; + } + + + } + + return ts; + } + + /// + /// 瀵硅薄灞炴у埆鍚嶇殑鏄犲皠鍏崇郴 + /// + /// + /// + /// + public static IEnumerable ToEnumerableAlias(this DataTable dt) where T : class, new() + { + var propertyInfos = typeof(T).GetProperties(); + var ts = new T[dt.Rows.Count]; + var i = 0; + foreach (DataRow row in dt.Rows) + { + var t = new T(); + foreach (var p in propertyInfos) + { + var attrs = p.GetCustomAttributes(typeof(System.ComponentModel.DataAnnotations.Schema.ColumnAttribute), true); + if (attrs.Length > 0) + { + try + { + var name = ((System.ComponentModel.DataAnnotations.Schema.ColumnAttribute)attrs[0]).Name; + if (dt.Columns.IndexOf(name) != -1 && row[name] != DBNull.Value) + p.SetValue(t, row[name], null); + } + catch (Exception ex) + { + throw ex; + } + + + } + + } + + ts[i] = t; + i++; + } + + return ts; + } + + public static DataTable SqlQuery(this DatabaseFacade facade, string sql, params object[] parameters) + { + var cmd = CreateCommand(facade, sql, out var conn, parameters); + var reader = cmd.ExecuteReader(); + var dt = new DataTable(); + dt.Load(reader); + reader.Close(); + conn.Close(); + return dt; + } + + private static DbCommand CreateCommand(DatabaseFacade facade, string sql, out DbConnection dbConn, params object[] parameters) + { + var conn = facade.GetDbConnection(); + dbConn = conn; + conn.Open(); + var cmd = conn.CreateCommand(); + if (facade.IsMySql()) + { + cmd.CommandText = sql; + CombineParamsMySql(ref cmd, parameters); + } + if (facade.IsSqlServer()) + { + cmd.CommandText = sql; + CombineParams(ref cmd, parameters); + } + + return cmd; + } + + private static void CombineParams(ref DbCommand command, params object[] parameters) + { + if (parameters != null) + foreach (SqlParameter parameter in parameters) + { + if (!parameter.ParameterName.Contains("@")) + parameter.ParameterName = $"@{parameter.ParameterName}"; + command.Parameters.Add(parameter); + } + } + + private static void CombineParamsMySql(ref DbCommand command, params object[] parameters) + { + if (parameters != null) + foreach (MySqlConnector.MySqlParameter parameter in parameters) + { + if (!parameter.ParameterName.Contains("@")) + parameter.ParameterName = $"@{parameter.ParameterName}"; + command.Parameters.Add(parameter); + } + } + + public static bool ExecuteSqlCommand(this DatabaseFacade facade, string sql, params object[] parameters) + { + var cmd = CreateCommand(facade, sql, out var conn, parameters); + try + { + cmd.ExecuteNonQuery(); + return true; + } + catch (Exception ex) + { + var msg = ex.Message; + return false; + } + finally + { + conn.Close(); + } + } + + + public static IQueryable SortBy(this IQueryable source, string sortExpression) + { + if (source == null) + { + throw new ArgumentNullException("source"); + } + + string sortDirection = String.Empty; + string propertyName = String.Empty; + + sortExpression = sortExpression.Trim(); + int spaceIndex = sortExpression.Trim().IndexOf(" "); + if (spaceIndex < 0) + { + propertyName = sortExpression; + sortDirection = "ASC"; + } + else + { + propertyName = sortExpression.Substring(0, spaceIndex); + sortDirection = sortExpression.Substring(spaceIndex + 1).Trim(); + } + + if (String.IsNullOrEmpty(propertyName)) + { + return source; + } + + ParameterExpression parameter = Expression.Parameter(source.ElementType, String.Empty); + MemberExpression property = Expression.Property(parameter, propertyName); + LambdaExpression lambda = Expression.Lambda(property, parameter); + + string methodName = (sortDirection == "ASC") ? "OrderBy" : "OrderByDescending"; + + Expression methodCallExpression = Expression.Call(typeof(Queryable), methodName, + new Type[] { source.ElementType, property.Type }, + source.Expression, Expression.Quote(lambda)); + + return source.Provider.CreateQuery(methodCallExpression); + } + } +} diff --git a/src/BarCode.Web.Repositories/Configuration/EFLog/EFCoreLogger.cs b/src/BarCode.Web.Repositories/Configuration/EFLog/EFCoreLogger.cs new file mode 100644 index 0000000..033306a --- /dev/null +++ b/src/BarCode.Web.Repositories/Configuration/EFLog/EFCoreLogger.cs @@ -0,0 +1,39 @@ +锘縰sing Microsoft.Extensions.Logging; +using System; +using System.Collections.Generic; +using System.IO; +using System.Text; + +namespace BarCode.Web.Repositories.Configuration.EFLog +{ + public class EFCoreLogger : ILogger + { + private readonly string categoryName; + + public EFCoreLogger(string categoryName) => this.categoryName = categoryName; + + public bool IsEnabled(LogLevel logLevel) => true; + + public void Log(LogLevel logLevel, EventId eventId, TState state, Exception exception, Func formatter) + { + if (categoryName == "Microsoft.EntityFrameworkCore.Database.Command" && logLevel == LogLevel.Information) + { + var logContent = formatter(state, exception); + var str = logContent.ToLower(); + if ((str.Contains("update") || str.Contains("delete") || str.Contains("insert")) && + (str.Contains("t_sub_ppbom") || str.Contains("t_sub_ppbomentry") || str.Contains("t_sub_ppbomentry_l") + || str.Contains("t_prd_ppbom") || str.Contains("t_prd_ppbomentry") || str.Contains("t_prd_ppbomentry_l") + || str.Contains("t_eng_bom") || str.Contains("t_eng_bomchild"))) + { + if (!Directory.Exists("D:/Logs")) + Directory.CreateDirectory("D:/Logs"); + + logContent = "\r\n\r\n" + DateTime.Now + "--" + logContent; + //娌℃湁鏂囦欢浼氳嚜鍔ㄥ垱寤猴紝鏈夊氨杩藉姞 + System.IO.File.AppendAllText("D:/Logs/澧炲垹鏀硅褰.txt", logContent); + } + } + } + public IDisposable BeginScope(TState state) => null; + } +} diff --git a/src/BarCode.Web.Repositories/Configuration/EFLog/EFCoreLoggerProvider.cs b/src/BarCode.Web.Repositories/Configuration/EFLog/EFCoreLoggerProvider.cs new file mode 100644 index 0000000..201cdb1 --- /dev/null +++ b/src/BarCode.Web.Repositories/Configuration/EFLog/EFCoreLoggerProvider.cs @@ -0,0 +1,13 @@ +锘縰sing Microsoft.Extensions.Logging; +using System; +using System.Collections.Generic; +using System.Text; + +namespace BarCode.Web.Repositories.Configuration.EFLog +{ + public class EFCoreLoggerProvider : ILoggerProvider + { + public ILogger CreateLogger(string categoryName) => new EFCoreLogger(categoryName); + public void Dispose() { } + } +} diff --git a/src/BarCode.Web.Repositories/Configuration/RepositoryDbContext.cs b/src/BarCode.Web.Repositories/Configuration/RepositoryDbContext.cs new file mode 100644 index 0000000..3ff5fdc --- /dev/null +++ b/src/BarCode.Web.Repositories/Configuration/RepositoryDbContext.cs @@ -0,0 +1,135 @@ +锘縰sing Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.ChangeTracking; +using Microsoft.Extensions.Logging; +using Microsoft.Extensions.Logging.Debug; +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Text.Json; +using BarCode.Web.Domain.Entitys; +using BarCode.Web.Repositories.Configuration.EFLog; + +namespace BarCode.Web.Repositories.Configuration +{ + /// + /// db涓婁笅鏂 + /// + public class RepositoryDbContext : DbContext + { + [Obsolete] + public readonly LoggerFactory LoggerFactory = new LoggerFactory(new[] { new DebugLoggerProvider() }); + public RepositoryDbContext(DbContextOptions options) : base(options) + { + } + + protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) + { + LoggerFactory.AddProvider(new EFCoreLoggerProvider()); + base.OnConfiguring(optionsBuilder); + optionsBuilder.UseLoggerFactory(LoggerFactory).EnableSensitiveDataLogging(); + } + + protected override void OnModelCreating(ModelBuilder builder) + { + builder.Entity(ent => + { + ent.ToTable("t_barcode_file_down_manager"); + ent.HasKey(x => x.Id); + }); + + + //绠卞敍琛 + builder.Entity(ent => + { + ent.ToTable("t_barcode_box_mark"); + ent.HasKey(x => x.Id); + + ent.HasMany(p => p.BillNos) + .WithOne() + .HasForeignKey(p => p.Fid) + .OnDelete(DeleteBehavior.Cascade); + }); + + //绠卞敍琛-缂栧彿琛 + builder.Entity(ent => + { + ent.ToTable("t_barcode_box_mark_billno"); + ent.HasKey(x => x.Id); + }); + //鐗╂枡 + builder.Entity(ent => + { + ent.ToTable("t_barcode_materials"); + ent.HasKey(x => x.Id); + }); + + //搴忓垪鍙风敓鎴愯褰 + builder.Entity(ent => + { + ent.ToTable("t_barcode_serialnumbergeneraterecord"); + ent.HasKey(x => x.Id); + }); + + //搴忓垪鍙 + builder.Entity(ent => + { + ent.ToTable("t_barcode_serialnumbers"); + ent.HasKey(x => x.Id); + }); + + //闃蹭吉鐮佺敓鎴愯褰 + builder.Entity(ent => + { + ent.ToTable("t_barcode_securitynumbergeneraterecord"); + ent.HasKey(x => x.Id); + }); + + //闃蹭吉鐮 + builder.Entity(ent => + { + ent.ToTable("t_barcode_securitynumbers"); + ent.HasKey(x => x.Id); + }); + + #region 绠变俊鎭 + builder.Entity(ent => + { + ent.ToTable("t_barcode_box"); + ent.HasKey(x => x.Id); + + ent.HasMany(p => p.Details) + .WithOne() + .HasForeignKey(p => p.Fid) + .OnDelete(DeleteBehavior.Cascade); + }); + builder.Entity(ent => + { + ent.ToTable("t_barcode_box_details"); + ent.HasKey(x => x.Id); + }); + #endregion + + //鐢熸垚鏁版嵁绠$悊 + builder.Entity(ent => + { + ent.ToTable("t_wms_cenerate_date"); + ent.HasKey(x => x.Id); + }); + + base.OnModelCreating(builder); + } + public DbSet Materials { get; set; } + public DbSet BoxMarkBillNo { get; set; } + public DbSet BoxMark { get; set; } + public DbSet FileDownManager { get; set; } + public DbSet SerialNumberGenerateRecord { get; set; } + public DbSet SerialNumbers { get; set; } + public DbSet Box { get; set; } + public DbSet BoxDetails { get; set; } + public DbSet SecurityNumberGenerateRecord { get; set; } + public DbSet SecurityNumbers { get; set; } + public DbSet CenerateData { get; set; } + } +} diff --git a/src/BarCode.Web.Repositories/DependencyInjection/AppBuilder.cs b/src/BarCode.Web.Repositories/DependencyInjection/AppBuilder.cs new file mode 100644 index 0000000..d0f7ba7 --- /dev/null +++ b/src/BarCode.Web.Repositories/DependencyInjection/AppBuilder.cs @@ -0,0 +1,300 @@ +锘縰sing Microsoft.AspNetCore.Hosting; +using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Hosting; +using Microsoft.OpenApi.Models; +using Newtonsoft.Json.Serialization; +using Quartz; +using System; +using System.Collections.Generic; +using System.IO; +using System.Text; +using BarCode.Web.Core.Help; +using BarCode.Web.Domain.IService; +using BarCode.Web.Domain.IService.Public; +using BarCode.Web.Domain.Mappers; +using BarCode.Web.Domain.Options; +using BarCode.Web.Domain.QuartzJob; +using BarCode.Web.Domain.Services; +using BarCode.Web.Domain.Services.Public; +using Quartz.AspNetCore; + +namespace BarCode.Web.Repositories.DependencyInjection +{ + /// + /// App鏈嶅姟 + /// + public class AppBuilder + { + /// + /// 鏈嶅姟闆嗗悎 + /// + public IServiceCollection Services { get; } + + public IConfiguration Configuration { get; } + + public bool _IsDevelopment { get; } + + /// + /// asf 鏈嶅姟 + /// + /// + public AppBuilder(IServiceCollection services, IConfiguration configuration, bool IsDevelopment) + { + Services = services; + Configuration = configuration; + _IsDevelopment = IsDevelopment; + } + + /// + /// 缂栬瘧鏈嶅姟 + /// + public void Build() + { + this.AddCors(); + this.InitRedis(); + this.AddSwagger(); + this.AddOther(); + this.AddConfigOptions(); + this.AddServiceRepositories(); + this.AddQuartzService(); + } + /// + /// 鍏跺畠鍔熻兘娉ㄥ叆锛欰utoMapper绛夊叾瀹 + /// + private void AddOther() + { + Services.AddMvc().AddNewtonsoftJson(opt => + { + //// 蹇界暐寰幆寮曠敤 + //opt.SerializerSettings.ReferenceLoopHandling = ReferenceLoopHandling.Ignore; + opt.SerializerSettings.ContractResolver = new CamelCasePropertyNamesContractResolver(); + //// 涓嶄娇鐢ㄩ┘宄 + //opt.SerializerSettings.ContractResolver = new DefaultContractResolver(); + }); + + //AutoMapper鏄犲皠鍏崇郴 + Services.AddAutoMapper(typeof(AppMapper).Assembly); + } + + /// + /// 璺ㄥ煙娉ㄥ叆 + /// + private void AddCors() + { + // 鍏ㄥ眬璺ㄥ煙娉ㄥ叆 + Services.AddCors(opt => + { + string[] urls = Configuration.GetSection("AllowedCores").Value.Split(','); + opt.AddPolicy("AllowAllOrigin", builder => + { + + builder.AllowAnyMethod() + .AllowAnyHeader() + .AllowCredentials() + .WithOrigins(urls); + + }); + }); + } + + /// + /// 鍒濆鍖杛edis + /// + private void InitRedis() + { + var option = Configuration.GetSection("AppOptions").Get(); + var option_soa = Configuration.GetSection("SoaOptions").Get(); + //鍒濆鍖杛edis + RedisClient.redisClient.InitConnect(option.RedisConnectionString); + Services.AddHttpClient("ops_client", c => + { + c.BaseAddress = new Uri(option_soa.Url); + }); + } + + /// + /// 娉ㄥ唽swagger + /// + private void AddSwagger() + { + if (_IsDevelopment) + { + // 娉ㄥ唽Swagger鏈嶅姟 + Services.AddSwaggerGen(c => + { + // 娣诲姞鏂囨。淇℃伅 + c.SwaggerDoc("v1", new Microsoft.OpenApi.Models.OpenApiInfo + { + Title = "BarCode", + Version = "v1", + Description = "BarCode-Api" + }); + #region 璇诲彇xml淇℃伅 + // 浣跨敤鍙嶅皠鑾峰彇xml鏂囦欢銆傚苟鏋勯犲嚭鏂囦欢鐨勮矾寰 + //// 鍚敤xml娉ㄩ噴. 璇ユ柟娉曠浜屼釜鍙傛暟鍚敤鎺у埗鍣ㄧ殑娉ㄩ噴锛岄粯璁や负false. + foreach (var file in Directory.GetFiles(AppContext.BaseDirectory, "BarCode.*.xml")) c.IncludeXmlComments(file, true); + #endregion + + #region 鍚敤swagger楠岃瘉鍔熻兘 + //娣诲姞涓涓繀椤荤殑鍏ㄥ眬瀹夊叏淇℃伅锛屽拰AddSecurityDefinition鏂规硶鎸囧畾鐨勬柟妗堝悕绉颁竴鑷村嵆鍙紝CoreAPI銆 + var securit = new OpenApiSecurityRequirement() + { + { + new OpenApiSecurityScheme + { + Reference=new OpenApiReference { Type=ReferenceType.SecurityScheme,Id= "WMSAPI" } + }, + new string[] { } + } + }; + c.AddSecurityRequirement(securit); + c.AddSecurityDefinition("WMSAPI", new OpenApiSecurityScheme + { + Description = "JWT鎺堟潈(鏁版嵁灏嗗湪璇锋眰澶翠腑杩涜浼犺緭) 鍦ㄤ笅鏂硅緭鍏earer {token} 鍗冲彲", + Name = "Authorization",//jwt榛樿鐨勫弬鏁板悕绉 + In = ParameterLocation.Header,//jwt榛樿瀛樻斁Authorization淇℃伅鐨勪綅缃(璇锋眰澶翠腑) + Type = SecuritySchemeType.ApiKey + }); + #endregion + + }); + } + } + + /// + /// 绯荤粺閰嶇疆 + /// + private void AddConfigOptions() + { + //绯荤粺閰嶇疆娉ㄥ唽 + Services.AddOptions(); + Services.Configure(Configuration.GetSection("AppOptions")); + Services.AddOptions(); + Services.Configure(Configuration.GetSection("SoaOptions")); + Services.AddOptions(); + Services.Configure(Configuration.GetSection("ErpOptions")); + Services.AddOptions(); + Services.Configure(Configuration.GetSection("WmsOptions")); + Services.AddOptions(); + Services.Configure(Configuration.GetSection("Qiniu")); + //Services.AddOptions(); + //Services.Configure(Configuration.GetSection("EmailOptions")); + //Services.AddOptions(); + //Services.Configure(Configuration.GetSection("SmsOptions")); + + + + } + + /// + /// Quartz瀹氭椂浠诲姟-鍙垎甯冨紡闆嗙兢 + /// + private void AddQuartzService() + { + var options = Configuration.GetSection("QuartzJobOptions").Get(); + + Services.AddTransient();//娣诲姞娉ㄥ叆瀹氭椂鏈嶅姟 + Services.AddTransient();//娣诲姞娉ㄥ叆瀹氭椂鏈嶅姟 + Services.AddTransient();//娣诲姞娉ㄥ叆瀹氭椂鏈嶅姟 + Services.AddQuartz(q => + { + q.UsePersistentStore(x => + { + //瀛樺偍绫诲瀷 + x.Properties[options.JobStoreTypeKey] = options.JobStoreTypeValue; + //鏁版嵁搴撻┍鍔ㄧ被鍨-杩欓噷鏄痬ysql + x.Properties[options.JobStoreDriverDelegateTypeKey] = options.JobStoreDriverDelegateTypeValue; + //琛ㄥ悕鍓嶇紑 + x.Properties[options.JobStoreTablePrefixKey] = options.JobStoreTablePrefixValue; + //鏁版嵁婧愬悕绉 + x.Properties[options.JobStoreDataSourceKey] = options.JobStoreDataSourceValue; + //杩炴帴瀛楃涓 + x.Properties[options.JobStoreConnectionStringKey] = options.JobStoreConnectionStringValue; + //sqlserver鐗堟湰 + x.Properties[options.JobStoreProviderKey] = options.JobStoreProviderValue; + //鏄惁鍚敤闆嗙兢:鏄 + x.Properties[options.JobStoreClusteredKey] = options.JobStoreClusteredValue; + //闆嗙兢鑺傜偣閮藉繀椤绘湁涓涓敮涓ID + x.Properties[options.JobStoreInstanceIdKey] = options.JobStoreInstanceIdValue; + x.UseProperties = true; + x.UseClustering(); + x.UseJsonSerializer(); + }); + //鐢ㄤ簬娉ㄥ叆 + q.UseMicrosoftDependencyInjectionJobFactory(); + + #region 鍚屾鏂扮墿鏂檌d32杩涘埗淇℃伅 + var jobKey_materialbar = new JobKey("MaterialsBarQuartzJob", options.QuartzJobValue); + q.AddJob(jobKey_materialbar, j => j.WithDescription("MaterialsBarQuartzJob")); + q.AddTrigger(t => t + .WithIdentity("MaterialsBarQuartzJobTrigger") + .ForJob(jobKey_materialbar) + .StartNow() + .WithCronSchedule(options.JobStartExpre) + //.WithCronSchedule(CronScheduleBuilder.DailyAtHourAndMinute(options.JobStartHour[5], options.JobStartMinute[5])) + .WithDescription("MaterialsBarQuartzJobTriggerDecs")); + #endregion + + #region 鍚屾鏂扮墿鏂欎俊鎭 + var jobKey_material = new JobKey("MaterialsQuartzJob", options.QuartzJobValue); + q.AddJob(jobKey_material, j => j.WithDescription("MaterialsQuartzJob")); + q.AddTrigger(t => t + .WithIdentity("MaterialsQuartzJobTrigger") + .ForJob(jobKey_material) + .StartNow() + .WithCronSchedule(options.JobStartExpreMaterial) + //.WithCronSchedule(CronScheduleBuilder.DailyAtHourAndMinute(options.JobStartHour[5], options.JobStartMinute[5])) + .WithDescription("MaterialsQuartzJobTriggerDecs")); + #endregion + + #region 缁存姢鑷姩鐢熸垚鏁版嵁绠$悊 + var jobKey_cenerate = new JobKey("CenerateQuartzJob", options.QuartzJobValue); + q.AddJob(jobKey_cenerate, j => j.WithDescription("CenerateQuartzJob")); + q.AddTrigger(t => t + .WithIdentity("CenerateQuartzJobTrigger") + .ForJob(jobKey_cenerate) + .StartNow() + .WithCronSchedule(options.JobStartExpreCenerateData) + .WithDescription("CenerateQuartzJobTriggerDecs")); + #endregion + }); + //.net core鏍稿績鎵樼-娣诲姞Quartz鏈嶅姟鍣 + Services.AddQuartzServer(options => + { + //鍏抽棴鏃讹紝鎴戜滑甯屾湜浣滀笟姝e父瀹屾垚 + options.WaitForJobsToComplete = false; + }); + + } + + /// + /// 娉ㄥ叆鏈嶅姟灞 + /// + /// + private void AddServiceRepositories() + { + Services.AddSingleton(); + Services.AddTransient(); + Services.AddHostedService(); + //娉ㄥ叆鏈嶅姟 + Services.AddTransient(); + Services.AddTransient(); + Services.AddTransient(); + Services.AddTransient(); + Services.AddTransient(); + + Services.AddTransient(); + Services.AddTransient(); + Services.AddTransient(); + Services.AddTransient(); + Services.AddTransient(); + Services.AddTransient(); + + Services.AddTransient(); + Services.AddTransient(); + Services.AddTransient(); + + } + } +} diff --git a/src/BarCode.Web.Repositories/DependencyInjection/AppBuilderExtensions.cs b/src/BarCode.Web.Repositories/DependencyInjection/AppBuilderExtensions.cs new file mode 100644 index 0000000..6de44a4 --- /dev/null +++ b/src/BarCode.Web.Repositories/DependencyInjection/AppBuilderExtensions.cs @@ -0,0 +1,63 @@ +锘縰sing Microsoft.EntityFrameworkCore; +using System; +using System.Collections.Generic; +using System.Text; +using BarCode.Web.Core.Dto; +using BarCode.Web.Domain.Infrastructure; +using BarCode.Web.Repositories; +using BarCode.Web.Repositories.Configuration; +using BarCode.Web.Repositories.DependencyInjection; +using BarCode.Web.Core.Dto.SerialNumbers; +using BarCode.Web.Core.Dto.SecurityNumbers; + +namespace Microsoft.Extensions.DependencyInjection +{ + public static class AppBuilderExtensions + { + /// + /// 閰嶇疆鏁版嵁搴 + /// + /// + /// + /// + public static AppBuilder AddDbContext(this AppBuilder builder, Action configureDbContext) + { + builder.Services.AddDbContext(configureDbContext); + builder.Services.AddRepositories(); + return builder; + } + + /// + /// 娉ㄥ叆浠撳偍灞 + /// + /// + private static void AddRepositories(this IServiceCollection services) + { + services.AddHttpContextAccessor(); + services.AddScoped(); + services.AddTransient(); + services.AddTransient(); + + #region 瀵煎嚭 + services.AddTransient, SerialNumbersRepositories>(); + services.AddTransient, SerialNumbersRepositories>(); + services.AddTransient, SecurityNumbersRepositories>(); + services.AddTransient, SecurityNumbersRepositories>(); + #endregion + + + + services.AddTransient(); + + + services.AddTransient(); + services.AddTransient(); + services.AddTransient(); + services.AddTransient(); + services.AddTransient(); + services.AddTransient(); + services.AddTransient(); + services.AddTransient(); + } + } +} diff --git a/src/BarCode.Web.Repositories/DependencyInjection/AuthorizationTokenSecurityPolicy.cs b/src/BarCode.Web.Repositories/DependencyInjection/AuthorizationTokenSecurityPolicy.cs new file mode 100644 index 0000000..3c462e2 --- /dev/null +++ b/src/BarCode.Web.Repositories/DependencyInjection/AuthorizationTokenSecurityPolicy.cs @@ -0,0 +1,198 @@ +锘縰sing Microsoft.AspNetCore.Http; +using Microsoft.Extensions.Caching.Memory; +using Microsoft.Extensions.Logging; +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using BarCode.Web.Core.Dto.Login; +using BarCode.Web.Domain.IService.Public; +using BarCode.Web.Domain.Services.Public; +using crypto; + +namespace BarCode.Web.Repositories.DependencyInjection +{ + /// + /// token 榛戝悕鍗曚腑闂翠欢 + /// + public class AuthorizationTokenSecurityPolicy + { + private readonly RequestDelegate _next; + private readonly IMemoryCache _cache; + private ILogger _logger; + private DateTime _refreshTime = DateTime.Now.AddYears(-5); + private readonly RedisClientService _redisClientService; + + /// + /// token榛戝悕鍗曚腑闂翠欢 + /// + /// + /// + public AuthorizationTokenSecurityPolicy(RequestDelegate next, ILogger logger, IMemoryCache cache, RedisClientService redisClientService) + { + _next = next; + _cache = cache; + this._logger = logger; + _redisClientService = redisClientService; + } + + /// + /// 浜嬩欢 + /// + /// + /// + public async Task Invoke(HttpContext context, ILoginService loginService) + { + string authorization = context.Request.Headers["Authorization"]; + string path = context.Request.Path.Value.ToLower(); + string[] pathlist = path.Split('/'); + bool isLogin = pathlist.Where(x => x == "login" || x.ToLower() == "heart" + || x.ToLower() == "test" || x.ToLower() == "swagger" || x.ToLower() == "wmsbox" || x.ToLower() == "security" + || x.ToLower() == "material"||x.ToLower()== "filedownmanager").Any(); + if (isLogin) + { + context.Response.StatusCode = 200; + await _next(context); + return; + } + + if (string.IsNullOrEmpty(authorization)) + { + context.Response.StatusCode = 401; + var result = JsonConvert.SerializeObject(new { status = 401, data = string.Empty, message = "鎺堟潈澶辫触锛岃閲嶆柊鐧诲綍" }); + context.Response.ContentType = "application/json;charset=utf-8"; + await context.Response.WriteAsync(result); + return; + } + else + { + string token = string.Empty; + if (authorization.StartsWith("Bearer ", StringComparison.OrdinalIgnoreCase)) + { + token = authorization.Substring("Bearer ".Length).Trim(); + } + + //鍒ゆ柇鍓嶇杩囨潵鐨則oken + if (string.IsNullOrEmpty(token)) + { + context.Response.StatusCode = 401; + var result = JsonConvert.SerializeObject(new { status = 401, data = string.Empty, message = "鎺堟潈澶辫触锛岃閲嶆柊鐧诲綍" }); + context.Response.ContentType = "application/json;charset=utf-8"; + await context.Response.WriteAsync(result); + return; + } + + //1.楠岃瘉鏄惁鏈夌櫥褰曟暟鎹紦瀛 + var logininfo = _redisClientService.GetStringKey($"wms_login_{token}"); + if (logininfo == null) + { + context.Response.StatusCode = 401; + var result = JsonConvert.SerializeObject(new { status = 401, data = string.Empty, message = "鎺堟潈澶辫触锛岃閲嶆柊鐧诲綍" }); + context.Response.ContentType = "application/json;charset=utf-8"; + await context.Response.WriteAsync(result); + return; + + } + else + { + //楠岃瘉鍝嶅簲鐘舵佷负401鐨勫氨璋冪敤鍗曠偣閫鍑烘帴鍙 + if (context.Response.StatusCode == 401 || context.Response.StatusCode == 403) + { + if (logininfo.UserInfo != null && logininfo.TokenInfo != null) + { + //璋冪敤鍗曠偣鐨勯鍑烘帴鍙 + var dto = new LoginOutDto() + { + UcId = logininfo.UserInfo.UcId.ToString(), + SessionId = logininfo.UserInfo.SeesionId, + Token = logininfo.TokenInfo.Token, + RefreshToken = logininfo.TokenInfo.RefreshToken, + AccessToken = logininfo.TokenInfo.PhpToken, + ExpiresIn = logininfo.TokenInfo.Expired + + }; + var res = await loginService.LoginOut(dto); + return; + } + } + + DateTime now = DateTime.Now; + TimeSpan jiange_timespan = TimeSpan.Zero; + if (logininfo.TokenInfo.Expired < now) + { + jiange_timespan = now - logininfo.TokenInfo.Expired; + var info = _redisClientService.GetStringKey($"wms_login_{token}"); + + if (info != null) + { + //瓒呰繃16涓皬鏃剁殑锛屽氨瑕佺Щ闄ょ紦瀛 + if (jiange_timespan.TotalHours >= 16) + _redisClientService.RemoveStringKey($"wms_login_{token}"); + //瓒呰繃1涓皬鏃剁殑锛屽氨瑕佸埛鏂皌oken + else if (!string.IsNullOrEmpty(logininfo.TokenInfo.Token) && jiange_timespan.TotalHours >= 1) + this.RefreshToken(logininfo.TokenInfo.Token, logininfo.TokenInfo.RefreshToken, loginService); + + } + } + //else + //{ + // //鍒锋柊token:璺濈杩囨湡鏃堕棿杩樻湁10鍒嗛挓灏辫繘琛屽埛鏂皌oken + // jiange_timespan = logininfo.TokenInfo.Expired - now; + // if (!string.IsNullOrEmpty(logininfo.TokenInfo.Token) && jiange_timespan.TotalMinutes<=10) + // this.RefreshToken(logininfo.TokenInfo.Token, logininfo.TokenInfo.RefreshToken, loginService); + //} + + //3.楠岃瘉妫鏌ユ槸鍚︽湁榛戝悕鍗曠殑token缂撳瓨 + string blacktoken = _redisClientService.GetStringKey($"wms_black_token_{logininfo.UserInfo.UcId}"); + if (string.IsNullOrEmpty(blacktoken)) + { + context.Response.StatusCode = 200; + await _next(context); + } + else + { + RemoveRedisLoginInfo(token); + context.Response.StatusCode = 403; + var result = JsonConvert.SerializeObject(new { status = 403, data = string.Empty, message = "鎷掔粷鐢ㄦ埛璇佷功璇曞浘璁块棶姝eb绔欑偣锛岃涓庣珯鐐圭鐞嗗憳鑱旂郴浠ュ缓绔嬬敤鎴疯瘉涔︽潈闄" }); + context.Response.ContentType = "application/json;charset=utf-8"; + await context.Response.WriteAsync(result); + } + } + + } + } + + /// + /// 杩囨湡锛屾垨鑰呭け鏁堬紝绉诲嚭token + /// + /// + private void RemoveRedisLoginInfo(string token) + { + if (!string.IsNullOrEmpty(token)) + { + var info = _redisClientService.GetStringKey($"wms_login_{token}"); + if (info != null) + { + _redisClientService.RemoveStringKey($"wms_login_{token}"); + } + } + } + + + /// + /// 鍒锋柊token + /// + /// + /// + private bool RefreshToken(string OldToken, string RefreshToken, ILoginService _loginService) + { + var res = _loginService.RefreshTokenNew(OldToken, RefreshToken); + if (!res.Result.Success) + return false; + else + return true; + } + } +} diff --git a/src/BarCode.Web.Repositories/DependencyInjection/ErrorHandlingMiddleware.cs b/src/BarCode.Web.Repositories/DependencyInjection/ErrorHandlingMiddleware.cs new file mode 100644 index 0000000..f79d5aa --- /dev/null +++ b/src/BarCode.Web.Repositories/DependencyInjection/ErrorHandlingMiddleware.cs @@ -0,0 +1,85 @@ +锘縰sing Microsoft.AspNetCore.Http; +using Microsoft.Extensions.Logging; +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.IO; +using System.Text; +using System.Threading.Tasks; + +namespace BarCode.Web.Repositories.DependencyInjection +{ + /// + /// 缁熶竴鍏ㄥ眬閿欒鎷︽埅 + /// + public class ErrorHandlingMiddleware + { + private readonly RequestDelegate next; + private readonly ILogger _logger; + + /// + /// 缁熶竴閿欒澶勭悊涓棿浠 + /// + public ErrorHandlingMiddleware(RequestDelegate next, ILogger logger) + { + this.next = next; + _logger = logger; + } + private string bodyStr = ""; + /// + /// 婵娲 + /// + /// + /// + public async Task Invoke(HttpContext context) + { + try + { + //榛樿 璇锋眰body鍙兘璇诲彇涓娆 鎵浠ュ湪杩欓噷闇瑕佹墜鍔ㄦ妸浠栬缃垚璇诲彇澶氭 骞朵笖 涓嶈兘浣跨敤using 閲婃斁 + context.Request.EnableBuffering(); + StreamReader requestReader = new StreamReader(context.Request.Body, Encoding.UTF8); + bodyStr = await requestReader.ReadToEndAsync(); + context.Request.Body.Seek(0, SeekOrigin.Begin); + + await next(context); + } + catch (Exception ex) + { + // var statusCode = context.Response.StatusCode; + var statusCode = 500; + if (ex is ArgumentException) statusCode = 200; + + _logger.LogError($"缁熶竴鎷︽埅寮傚父澶勭悊: {ex.Message}, StackTrace:{ex.StackTrace},Path:{context.Request.Path},Parame:{bodyStr}"); + + await HandleExceptionAsync(context, statusCode, "鏈嶅姟鍣ㄩ敊璇紝涓嶈兘鎵ц姝よ姹傦紝璇风◢鍚庨噸璇曪紝鑻ラ棶棰樹竴鐩村瓨鍦紝璇蜂笌绔欑偣绠$悊鍛樿仈绯"); + // await HandleExceptionAsync(context, statusCode, "鏈嶅姟鍣ㄩ敊璇"); + } + finally + { + var statusCode = context.Response.StatusCode; + var msg = ""; + // if (statusCode == 401) + // { + // msg = "鏈巿鏉"; + // } + if (statusCode == 404) + msg = "鏈嶅姟鍣ㄦ殏鏃犲搷搴旓紝璇风◢鍚庨噸璇曪紝鑻ラ棶棰樹竴鐩村瓨鍦紝璇蜂笌绔欑偣绠$悊鍛樿仈绯"; + else if (statusCode == 502) msg = "缃戝叧鍑洪敊锛岃涓庣珯鐐圭鐞嗗憳鑱旂郴"; + // else if (statusCode != 200) + // { + // msg = "鏈煡閿欒"; + // } + if (!string.IsNullOrWhiteSpace(msg)) await HandleExceptionAsync(context, statusCode, msg); + } + } + + private static Task HandleExceptionAsync(HttpContext context, int statusCode, string msg) + { + string data = null; + var result = JsonConvert.SerializeObject(new { status = statusCode, result = data, message = msg }); + context.Response.StatusCode = statusCode; + context.Response.ContentType = "application/json;charset=utf-8"; + return context.Response.WriteAsync(result); + } + } +} diff --git a/src/BarCode.Web.Repositories/DependencyInjection/PlatformActionMiddleware.cs b/src/BarCode.Web.Repositories/DependencyInjection/PlatformActionMiddleware.cs new file mode 100644 index 0000000..72f02d6 --- /dev/null +++ b/src/BarCode.Web.Repositories/DependencyInjection/PlatformActionMiddleware.cs @@ -0,0 +1,85 @@ +锘縰sing Microsoft.AspNetCore.Mvc; +using Microsoft.AspNetCore.Mvc.Filters; +using Microsoft.Extensions.Caching.Memory; +using Microsoft.Extensions.Logging; +using System; +using System.Collections.Generic; +using System.Net; +using System.Text; +using BarCode.Web.Core.Internal.Results; +using BarCode.Web.Domain.Services.Public; +using Microsoft.AspNetCore.Http; +using Newtonsoft.Json; +using System.IO; +using System.Threading.Tasks; + +namespace BarCode.Web.Repositories.DependencyInjection +{ + /// + /// 闃查噸澶嶆彁浜 + /// + public class PlatformActionMiddleware + { + private readonly RequestDelegate next; + private readonly ILogger _logger; + private readonly RedisClientService _redisClientService; + /// + /// 缁熶竴閿欒澶勭悊涓棿浠 + /// + public PlatformActionMiddleware(RequestDelegate next, ILogger logger, RedisClientService redisClientService) + { + this.next = next; + _logger = logger; + _redisClientService = redisClientService; + } + private string bodyStr = ""; + + /// + /// 婵娲 + /// + /// + /// + public async Task Invoke(HttpContext context) + { + //榛樿 璇锋眰body鍙兘璇诲彇涓娆 鎵浠ュ湪杩欓噷闇瑕佹墜鍔ㄦ妸浠栬缃垚璇诲彇澶氭 骞朵笖 涓嶈兘浣跨敤using 閲婃斁 + context.Request.EnableBuffering(); + StreamReader requestReader = new StreamReader(context.Request.Body, Encoding.UTF8); + bodyStr = await requestReader.ReadToEndAsync(); + context.Request.Body.Seek(0, SeekOrigin.Begin); + + string httpMethod = WebUtility.HtmlEncode(context.Request.Method); + if (httpMethod == "POST") + { + //浣跨敤璇锋眰璺緞浣滀负鍞竴key + string path = context.Request.Path; + string authorization = context.Request.Headers["Authorization"]; + string cacheToken = $"{authorization}_{path}"; + string keyValue = string.IsNullOrEmpty(bodyStr) ? "yc" : bodyStr; + + if (path != null) + { + //var cache = iZen.Utils.Core.iCache.CacheManager.GetCacheValue(cacheToken); + string cv = _redisClientService.GetStringKey(cacheToken); + if (cv == null && bodyStr != cv) + { + //iZen.Utils.Core.iCache.CacheManager.SetChacheValueSeconds(cacheToken, keyValue, 1); + //璁剧疆缂撳瓨10绉掕繃鏈 + _redisClientService.SetStringKey(cacheToken, keyValue, TimeSpan.FromSeconds(10)); + + } + else + { + context.Response.StatusCode = 200; + var result = JsonConvert.SerializeObject(new { status = 888888, data = string.Empty, message = "閲嶅鎻愪氦" }); + context.Response.ContentType = "application/json;charset=utf-8"; + await context.Response.WriteAsync(result); + return; + } + + } + } + await next(context); + + } + } +} diff --git a/src/BarCode.Web.Repositories/DependencyInjection/ServiceCollectionExtensions.cs b/src/BarCode.Web.Repositories/DependencyInjection/ServiceCollectionExtensions.cs new file mode 100644 index 0000000..6405f29 --- /dev/null +++ b/src/BarCode.Web.Repositories/DependencyInjection/ServiceCollectionExtensions.cs @@ -0,0 +1,40 @@ +锘縰sing Microsoft.AspNetCore.Hosting; +using Microsoft.Extensions.Configuration; +using System; +using System.Collections.Generic; +using System.Text; +using BarCode.Web.Repositories.DependencyInjection; + +namespace Microsoft.Extensions.DependencyInjection +{ + public static class ServiceCollectionExtensions + { + /// + /// 娣诲姞app妗嗘灦 + /// + /// + /// + /// + public static IServiceCollection AddApp(this IServiceCollection services, IConfiguration configuration, bool IsDevelopment, Action startupAction) + { + services.AddAppCore(configuration, IsDevelopment, startupAction); + return services; + } + + + /// + /// 娣诲姞app鏍稿績鏈嶅姟 + /// + /// + /// ASF鍚姩閰嶇疆鍑芥暟 + /// + internal static IServiceCollection AddAppCore(this IServiceCollection services, IConfiguration configuration, bool IsDevelopment, Action startupAction) + { + var builder = new AppBuilder(services, configuration, IsDevelopment); + startupAction?.Invoke(builder); + builder.Build(); + return services; + } + + } +} diff --git a/src/BarCode.Web.Repositories/FileDownManagerRepositories.cs b/src/BarCode.Web.Repositories/FileDownManagerRepositories.cs new file mode 100644 index 0000000..3514654 --- /dev/null +++ b/src/BarCode.Web.Repositories/FileDownManagerRepositories.cs @@ -0,0 +1,110 @@ +锘縰sing AutoMapper; +using Microsoft.EntityFrameworkCore; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using BarCode.Web.Core; +using BarCode.Web.Core.Dto; +using BarCode.Web.Domain.Entitys; +using BarCode.Web.Domain.Infrastructure; +using BarCode.Web.Domain.IService.Public; +using BarCode.Web.Domain.Values; +using BarCode.Web.Domain.Values.Single; +using BarCode.Web.Repositories.Configuration; +using static Microsoft.EntityFrameworkCore.DbLoggerCategory; +using BarCode.Web.Core.Dto.Login; + +namespace BarCode.Web.Repositories +{ + public class FileDownManagerRepositories : IFileDownManagerRepositories + { + private readonly IMapper _mapper; + private readonly RepositoryDbContext _context; + private readonly ISingleDataService _singleDataService; + public FileDownManagerRepositories(RepositoryDbContext context, IMapper mapper, ISingleDataService singleDataService) + { + _mapper = mapper; + _context = context; + _singleDataService = singleDataService; + } + + public async Task Add(FileDownManager entity) + { + await _context.FileDownManager.AddAsync(entity); + await _context.SaveChangesAsync(); + + return entity; + } + + public async Task Edit(FileDownManager entity) + { + var res = await _context.FileDownManager + .FirstOrDefaultAsync(f => f.Id == entity.Id); + if (res == null) return null; + + _mapper.Map(entity, res); + + await _context.SaveChangesAsync(); + return res; + } + + public async Task GetList(FileDownManagerRequest dto, LoginInDto loginInfo) + { + List userIds = new List(); + if (!string.IsNullOrEmpty(dto.User)) + userIds = _singleDataService.GetIdsBySingleName(SingleAction.Users, loginInfo.UserInfo.CompanyId, dto.User); + + var res = _context.FileDownManager + //.GroupJoin(_context.UcStaff, manager => manager.UserId, user => user.Id, (manager, user) => new { manager, user }) + // .SelectMany(x => x.user.DefaultIfEmpty(), (d, user) => new { d.manager, user }) + .OrderByDescending(o => o.Date) + .Where(w => w.CompanyId == loginInfo.UserInfo.CompanyId); + + + #region 鏉′欢 + if (loginInfo.UserInfo.IsAdmin != true && !string.IsNullOrEmpty(dto.OrgCode)) + { + var rec_type = dto.OrgCode.Substring(0, 1); + var rec_code = dto.OrgCode.Substring(2, dto.OrgCode.Length - 2); + + if (rec_type.Equals("s"))//渚涘簲鍟 + res = res.Where(w => rec_code == w.SupplierCode); + else//鏌ュ叾浠栧崟鎹(缁勭粐) + res = res.Where(w => rec_code == w.OrgCode); + } + if (!string.IsNullOrEmpty(dto.User)) + res = res.Where(w => userIds.Contains(w.UserId)); + if (dto.BeginDate != null) + res = res.Where(w => w.Date >= dto.BeginDate); + if (dto.EndDate != null) + res = res.Where(w => w.Date <= (dto.EndDate ?? DateTime.Now).AddHours(23).AddMinutes(59).AddSeconds(59)); + if (dto.Type != null) + res = res.Where(w => w.Type == (FileDownLoadOrderType)dto.Type); + + if (dto.Status != null) + { + if ((ExportStatus)dto.Status == ExportStatus.Ing) + res = res.Where(w => w.Status == ExportStatus.Ing && w.Date >= DateTime.Now.AddHours(-1)); + else if ((ExportStatus)dto.Status == ExportStatus.Fail) + res = res.Where(w => (w.Status == ExportStatus.Fail) || (w.Status == ExportStatus.Ing && w.Date < DateTime.Now.AddHours(-1))); + else + res = res.Where(w => w.Status == (ExportStatus)dto.Status); + } + #endregion + + int total = await res.CountAsync(); + var list = await res.Select(s => new FileDownInfoManagerResponse(_mapper.Map(s)) + { + StatusKey = (s.Status == ExportStatus.Ing && s.Date < DateTime.Now.AddHours(-1)) ? (int)ExportStatus.Fail : (int)s.Status, + Status = (s.Status == ExportStatus.Ing && s.Date < DateTime.Now.AddHours(-1)) ? ExportStatus.Fail.GetRemark() : s.Status.GetRemark(), + UserName = _singleDataService.GetSingleData(SingleAction.Users, loginInfo.UserInfo.CompanyId, s.UserId) + }) + .Skip((dto.PageNo - 1) * dto.PageSize).Take(dto.PageSize) + .ToListAsync(); + + return new FileDownManagerResponse(list, total); + } + } +} diff --git a/src/BarCode.Web.Repositories/LoginRepositories.cs b/src/BarCode.Web.Repositories/LoginRepositories.cs new file mode 100644 index 0000000..471b24e --- /dev/null +++ b/src/BarCode.Web.Repositories/LoginRepositories.cs @@ -0,0 +1,49 @@ +锘縰sing Microsoft.AspNetCore.Http; +using Microsoft.Extensions.Logging; +using System; +using System.Collections.Generic; +using System.Text; +using BarCode.Web.Core.Dto.Login; +using BarCode.Web.Domain.Infrastructure; +using BarCode.Web.Domain.Services.Public; + +namespace BarCode.Web.Repositories +{ + /// + /// 鐧诲綍浠撳偍 + /// + public class LoginRepositories:ILoginRepositories + { + public int CompanyId { get; set; } = 0; + public int StaffId { get; set; } = 0; + public LoginInDto loginInfo { get; set; } + private readonly RedisClientService _redisClientService; + public LoginRepositories(ILogger logger, IHttpContextAccessor httpContextAccessor, RedisClientService redisClientService) + { + try + { + string authorization = httpContextAccessor?.HttpContext?.Request?.Headers["Authorization"] ?? ""; + if (string.IsNullOrEmpty(authorization)) return; + + string token = string.Empty; + if (authorization.StartsWith("Bearer ", StringComparison.OrdinalIgnoreCase)) + token = authorization.Substring("Bearer ".Length).Trim(); + if (string.IsNullOrEmpty(token)) + { + this.CompanyId = 0; + this.StaffId = 0; + return; + } + + _redisClientService = redisClientService; + var logininfo = _redisClientService.GetStringKey($"wms_login_{token}"); + this.loginInfo = loginInfo; + this.CompanyId = logininfo == null ? 0 : logininfo.UserInfo.CompanyId; + this.StaffId = logininfo == null ? 0 : logininfo.UserInfo.StaffId; + } + catch (Exception) + { + } + } + } +} diff --git a/src/BarCode.Web.Repositories/MaterialsRepositories.cs b/src/BarCode.Web.Repositories/MaterialsRepositories.cs new file mode 100644 index 0000000..516b417 --- /dev/null +++ b/src/BarCode.Web.Repositories/MaterialsRepositories.cs @@ -0,0 +1,177 @@ +锘縰sing AutoMapper; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Storage; +using Microsoft.Extensions.DependencyInjection; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using BarCode.Web.Core.Help; +using BarCode.Web.Domain.Entitys; +using BarCode.Web.Domain.Infrastructure; +using BarCode.Web.Domain.IService.Public; +using BarCode.Web.Domain.Mappers; +using BarCode.Web.Repositories.Configuration; + +namespace BarCode.Web.Repositories +{ + /// + /// 鐗╂枡浠撳偍 + /// + public class MaterialsRepositories : IMaterialsRepositories + { + private readonly IMapper _mapper; + private readonly RepositoryDbContext _context; + private readonly IServiceProvider _serviceProvider; + + public MaterialsRepositories(RepositoryDbContext context, IServiceProvider serviceProvider, + IMapper mapper) + { + _serviceProvider = serviceProvider; + _context = context; + _mapper = mapper; + } + + /// + /// 鎵归噺娣诲姞 + /// + /// + /// + /// + public async Task AddRange(List entitys, bool isTransaction = true) + { + IDbContextTransaction _transaction = null; + if (isTransaction) + _transaction = _context.Database.BeginTransaction(); + try + { + if (entitys != null && entitys.Count != 0) + { + await _context.Materials.AddRangeAsync(entitys); + await _context.SaveChangesAsync(); + } + if (_transaction != null) + _transaction.Commit(); + return true; + } + catch + { + if (_transaction != null) + _transaction.Rollback(); + return false; + } + } + + /// + /// 鑾峰彇闆嗗悎 + /// + /// + /// + public async Task> GetEntityList(int? orgId = null) + { + var query = _context.Materials.AsNoTracking() + .Where(x => 1 == 1); + if (orgId.HasValue) + query = query.Where(x => x.OrgId == orgId.Value); + + return await query.ToListAsync(); + } + + /// + /// 鑾峰彇 + /// + /// + /// + public async Task Get(int mid) + { + var query = _context.Materials.AsNoTracking().Where(x => 1 == 1); + + query = query.Where(x => x.MaterialId == mid); + + return await query.FirstOrDefaultAsync(); + } + + /// + /// 鑾峰彇 + /// + /// + /// + public async Task Get(string code, int orgId) + { + var query = _context.Materials.AsNoTracking().Where(x => x.MaterialNumber == code && x.OrgId == orgId); + + return await query.FirstOrDefaultAsync(); + } + + /// + /// 鑾峰彇鍏ㄩ儴鐨勭墿鏂欑紪鐮 + /// + /// + public async Task> GetAllNumbers() + { + var numbers = await _context.Materials.AsNoTracking() + .Select(x => x.MaterialNumber).ToListAsync(); + if (numbers.Count() <= 0) return numbers; + + return numbers.Distinct().ToList(); + + } + + /// + /// 鑾峰彇鍏ㄩ儴鐨勭墿鏂欑紪鐮 + /// + /// + public async Task> GetEntityList(List materNumbers, bool isBatchManage) + { + var entitys = await _context.Materials.Where(x => materNumbers.Contains(x.MaterialNumber) && x.IsBatchManage == isBatchManage).ToListAsync(); + return entitys; + } + + /// + /// 淇敼鐗╂枡 + /// + /// + /// + /// + public async Task UpdateRange(List entitys, bool isTransaction = true) + { + IDbContextTransaction _transaction = null; + if (isTransaction) + _transaction = _context.Database.BeginTransaction(); + { + try + { + List list = entitys.Select(s => s.Id).ToList(); + var res = await _context.Materials.Where(f => list.Contains(f.Id)).ToListAsync(); + _mapper.ToMapList(entitys, res); + await _context.SaveChangesAsync(); + if (_transaction != null) + _transaction.Commit(); + } + catch (Exception ex) + { + if (_transaction != null) + _transaction.Rollback(); + return false; + } + return true; + } + } + /// + /// 鑾峰彇鎵鏈夋病鏈塱d32杩涘埗鐨勭墿鏂 + /// + /// + public async Task> GetEntityListByNoBar() + { + var entitys = await _context.Materials.AsNoTracking().Where(x =>string.IsNullOrEmpty(x.IdConvertBar.Trim())).ToListAsync(); + return entitys; + } + + public async Task> GetEntityList(List materNumbers) + { + var entitys = await _context.Materials.Where(x => materNumbers.Contains(x.MaterialNumber)).ToListAsync(); + return entitys; + } + } +} diff --git a/src/BarCode.Web.Repositories/MySqlDataAccess.cs b/src/BarCode.Web.Repositories/MySqlDataAccess.cs new file mode 100644 index 0000000..3d7a823 --- /dev/null +++ b/src/BarCode.Web.Repositories/MySqlDataAccess.cs @@ -0,0 +1,68 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Data; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using MySqlConnector; +namespace BarCode.Web.Repositories +{ + public class MySqlDataAccess + { + private readonly string _connectionString; + + public MySqlDataAccess(string connectionString) + { + _connectionString = connectionString; + } + + /// + /// 鎵ц鏌ヨ骞惰繑鍥 DataTable + /// + /// SQL 鏌ヨ璇彞 + /// 鏌ヨ缁撴灉鐨 DataTable + public DataTable ExecuteQuery(string query) + { + using (MySqlConnection connection = new MySqlConnection(_connectionString)) + { + try + { + connection.Open(); + MySqlCommand command = new MySqlCommand(query, connection); + MySqlDataAdapter adapter = new MySqlDataAdapter(command); + DataTable dataTable = new DataTable(); + adapter.Fill(dataTable); + return dataTable; + } + catch (Exception ex) + { + Console.WriteLine($"鏌ヨ鍑洪敊: {ex.Message}"); + return null; + } + } + } + + /// + /// 鎵ц闈炴煡璇㈡搷浣滐紙濡 INSERT銆乁PDATE銆丏ELETE锛 + /// + /// SQL 闈炴煡璇㈣鍙 + /// 鍙楀奖鍝嶇殑琛屾暟 + public int ExecuteNonQuery(string query) + { + using (MySqlConnection connection = new MySqlConnection(_connectionString)) + { + try + { + connection.Open(); + MySqlCommand command = new MySqlCommand(query, connection); + return command.ExecuteNonQuery(); + } + catch (Exception ex) + { + Console.WriteLine($"鎵ц闈炴煡璇㈡搷浣滃嚭閿: {ex.Message}"); + return -1; + } + } + } + } +} diff --git a/src/BarCode.Web.Repositories/SGenerateRecordRepositories.cs b/src/BarCode.Web.Repositories/SGenerateRecordRepositories.cs new file mode 100644 index 0000000..84a417d --- /dev/null +++ b/src/BarCode.Web.Repositories/SGenerateRecordRepositories.cs @@ -0,0 +1,339 @@ +锘縰sing AutoMapper; +using BarCode.Web.Core.Dto.Erp.Org; +using BarCode.Web.Core.Dto.Erp.Supplier; +using BarCode.Web.Core.Dto.Erp; +using BarCode.Web.Core.Dto.SerialNumbers; +using BarCode.Web.Domain.Entitys; +using BarCode.Web.Domain.Infrastructure; +using BarCode.Web.Domain.Mappers; +using BarCode.Web.Repositories.Configuration; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Storage; +using Newtonsoft.Json; +using Org.BouncyCastle.Crypto; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using static Microsoft.EntityFrameworkCore.DbLoggerCategory; +using BarCode.Web.Domain.IService.Public; +using BarCode.Web.Core.Dto.Box; +using BarCode.Web.Domain.Services.Public; +using BarCode.Web.Domain.Values.Single; +using System.ComponentModel.Design; +using BarCode.Web.Core.Help; +using NPOI.SS.Formula.Functions; +using Microsoft.AspNetCore.Http.HttpResults; +using BarCode.Web.Core.Dto.Login; +using BarCode.Web.Core.Dto.SingleData; +using BarCode.Web.Core.Internal.Results; + +namespace BarCode.Web.Repositories +{ + /// + /// 搴忓垪鍙风敓鎴愯褰 + /// + public class SGenerateRecordRepositories : ISGenerateRecordRepositories + { + private readonly ILoginRepositories _loginRepositories; + private readonly RepositoryDbContext _context; + private readonly IBasicsRepositories _basicsRepositories; + private readonly IMapper _mapper; + private readonly IErpService _erpService; + private readonly IErpBasicDataExtendService _erpBasicDataExtendService; + private readonly ISingleDataService _singleDataService; + + public SGenerateRecordRepositories(RepositoryDbContext context, + ILoginRepositories loginRepositories, + IBasicsRepositories basicsRepositories, IMapper mapper, IErpService erpService, + IErpBasicDataExtendService erpBasicDataExtendService, ISingleDataService singleDataService) + { + _context = context; + _basicsRepositories = basicsRepositories; + _loginRepositories = loginRepositories; + _mapper = mapper; + _erpService = erpService; + _erpBasicDataExtendService = erpBasicDataExtendService; + _singleDataService = singleDataService; + } + /// + /// 鏂板 + /// + /// + /// + /// + public async Task Add(SerialNumberGenerateRecord entity, bool isTransaction = true) + { + IDbContextTransaction _transaction = null; + if (isTransaction) + _transaction = _context.Database.BeginTransaction(); + + await _context.SerialNumberGenerateRecord.AddAsync(entity); + await _context.SaveChangesAsync(); + + if (_transaction != null) + _transaction.Commit(); + return entity; + } + /// + /// 鎵归噺娣诲姞 + /// + /// + /// + /// + public async Task AddRange(List entitys, bool isTransaction = true) + { + IDbContextTransaction _transaction = null; + if (isTransaction) + _transaction = _context.Database.BeginTransaction(); + + if (entitys != null && entitys.Count != 0) + { + await _context.SerialNumberGenerateRecord.AddRangeAsync(entitys); + await _context.SaveChangesAsync(); + } + if (_transaction != null) + _transaction.Commit(); + return true; + } + /// + /// 淇敼 + /// + /// + /// + /// + public async Task Edit(SerialNumberGenerateRecord entity, bool isTransaction = true) + { + + IDbContextTransaction _transaction = null; + if (isTransaction) + _transaction = _context.Database.BeginTransaction(); + + var res = await _context.SerialNumberGenerateRecord + .FirstOrDefaultAsync(f => f.Id == entity.Id); + if (res == null) return null; + + _mapper.Map(entity, res); + var result = await _context.SaveChangesAsync(); + + if (_transaction != null) + _transaction.Commit(); + + return res; + } + /// + /// 鎵归噺淇敼 + /// + /// + /// + /// + public async Task EditEntityList(List entitys, bool isTransaction = true) + { + IDbContextTransaction _transaction = null; + if (isTransaction) + _transaction = _context.Database.BeginTransaction(); + + List list = entitys.Select(s => s.Id).ToList(); + var res = await _context.SerialNumberGenerateRecord + .Where(f => list.Contains(f.Id)).ToListAsync(); + + _mapper.ToMapList(entitys, res); + await _context.SaveChangesAsync(); + + if (_transaction != null) + _transaction.Commit(); + + return true; + } + /// + /// 鏌ヨ瀹炰綋 + /// + /// + /// + public async Task GetEntity(int id) + { + return await _context.SerialNumberGenerateRecord.AsNoTracking() + .FirstOrDefaultAsync(f => f.Id == id); + } + + /// + /// 鑾峰彇闆嗗悎 + /// + /// + /// + /// + public async Task> GetEntityList(List ids) + { + return await _context.SerialNumberGenerateRecord.AsNoTracking() + .Where(f => ids.Contains(f.Id)) + .ToListAsync(); + } + + /// + /// 鍒楄〃 + /// + /// + /// + /// + public async Task<(List list, int total)> GetListAsync(SGenerateRecordQueryRequest dto, LoginInDto loginInfo) + { + int companyId = loginInfo.UserInfo.CompanyId; + + List mNumber = new List(); + var materials_result = await _erpService.BillQueryForMaterial(); + List materials = new List(); + if (materials_result.IsSuccess) + materials = materials_result.Data.ToList(); + //鐗╂枡闆嗗悎锛涙ā绯婃煡璇㈠悗鐨勭墿鏂欓泦鍚 + if (!string.IsNullOrEmpty(dto.MaterialNumber)) + { + if (materials != null) + mNumber = materials.Where(w => w.MaterialNumber.Contains(dto.MaterialNumber) + || w.MaterialName.Contains(dto.MaterialNumber) + || w.Specifications.Contains(dto.MaterialNumber) + ).Select(s => s.MaterialNumber).ToList(); + } + List cr_ids = new List(); + if (!string.IsNullOrEmpty(dto.CreateUser)) + { + cr_ids = await _basicsRepositories.GetUserIdsAsync(dto.CreateUser, loginInfo.UserInfo.CompanyId); + } + List sIds = new List(); + if (dto.SerialNumbers != null && dto.SerialNumbers.Count() > 0) + { + sIds = await _context.SerialNumbers.Where(w => dto.SerialNumbers.Contains(w.SerialNumber)) + .GroupBy(g => g.GenerateRecordId).Select(s => s.Key).ToListAsync(); + } + + List nIds = new List(); + if (dto.NumberCodes != null && dto.NumberCodes.Count() > 0) + { + nIds = await _context.SerialNumbers.Where(w => dto.NumberCodes.Contains(w.NumberCode)) + .GroupBy(g => g.GenerateRecordId).Select(s => s.Key).ToListAsync(); + } + + List bIds = new List(); + if (dto.BoxBillNos != null && dto.BoxBillNos.Count() > 0) + { + bIds = await _context.SerialNumbers + .GroupJoin(_context.Box, serial => serial.BoxId, box => box.Id, (serial, box) => new { serial, box }) + .SelectMany(x => x.box.DefaultIfEmpty(), (p, box) => new { p.serial, box }) + .Where(w => dto.BoxBillNos.Contains(w.box.BoxBillNo)) + .Select(s => s.serial.GenerateRecordId) + .ToListAsync(); + } + + + //渚涘簲鍟 + //var supplier_result = await _erpService.BillQueryForSupplier(); + //List suppliers = new List(); + //if (supplier_result.IsSuccess) + // suppliers = supplier_result.Data.ToList(); + //鍙栫粍缁 + //var org_result = await _erpService.BillQueryForOrg(); + //List orgs = new List(); + //if (org_result.IsSuccess) + // orgs = org_result.Data.ToList(); + var result = await _singleDataService.GetSingleData, SingleDataRequest, SysConfigAction>( + new SingleDataRequest(loginInfo.UserInfo.CompanyId), SysConfigAction.GetOrgByCompany, SingleControllerType.SysConfig); + List orgs = new List(); + if (result.IsSuccess) + orgs = result.Data.ToList(); + + var query = _context.SerialNumberGenerateRecord + .OrderByDescending(o => o.Id) + .Where(f => 1 == 1); + if (loginInfo.UserInfo.IsAdmin != true && !string.IsNullOrEmpty(dto.OrgCode)) + { + var rec_type = dto.OrgCode.Substring(0, 1); + var rec_code = dto.OrgCode.Substring(2, dto.OrgCode.Length - 2); + + if (rec_type.Equals("s"))//渚涘簲鍟 + query = query.Where(w => rec_code == w.SupplierCode); + else//鏌ュ叾浠栧崟鎹(缁勭粐) + query = query.Where(w => rec_code == w.OrgCode); + } + if (!string.IsNullOrEmpty(dto.SupplierOrOrg)) + { + var rec_type = dto.SupplierOrOrg.Substring(0, 1); + var rec_code = dto.SupplierOrOrg.Substring(2, dto.SupplierOrOrg.Length - 2); + + if (rec_type.Equals("s"))//渚涘簲鍟 + query = query.Where(w => rec_code == w.SupplierCode); + else//鏌ュ叾浠栧崟鎹(缁勭粐) + query = query.Where(w => rec_code == w.OrgCode); + } + if (!string.IsNullOrEmpty(dto.MaterialNumber)) + query = query.Where(w => mNumber.Contains(w.MaterialNumber)); + if (dto.CreateBeginDate != null) + query = query.Where(w => w.GenerateCompleteTime >= dto.CreateBeginDate); + if (dto.CreateEndDate != null) + { + DateTime dt_end = ((DateTime)dto.CreateEndDate).AddDays(1); + query = query.Where(w => w.GenerateCompleteTime <= dt_end); + } + if (dto.SerialNumbers != null && dto.SerialNumbers.Count() > 0) + query = query.Where(w => sIds.Contains(w.Id)); + if (dto.NumberCodes != null && dto.NumberCodes.Count() > 0) + query = query.Where(w => nIds.Contains(w.Id)); + if (dto.BoxBillNos != null && dto.BoxBillNos.Count() > 0) + query = query.Where(w => bIds.Contains(w.Id)); + if (dto.PurchaseBillNos != null && dto.PurchaseBillNos.Count() > 0) + query = query.Where(w => dto.PurchaseBillNos.Contains(w.PurchaseBillNo)); + if (dto.GenerateComplete != null) + query = query.Where(w => dto.GenerateComplete == w.IsGenerateComplete); + if (!string.IsNullOrEmpty(dto.CreateUser)) + query = query.Where(w => cr_ids.Contains(w.CreatorId)); + if (dto.IsUpdateMaterial != null) + { + if (dto.IsUpdateMaterial == true) + query = query.Where(w => w.IsUpdateMaterial == true); + else + query = query.Where(w => w.IsUpdateMaterial == false || w.IsUpdateMaterial == null); + } + + if (dto.IsTwo > 1) + { + query = query.Where(w => w.IsTwo > 1); + } + else if (dto.IsTwo == 1) + { + query = query.Where(w => w.IsTwo == 1); + } + else if (dto.IsTwo == 0) + { + } + else + { + //query = query.Where(w => w.IsTwo == 1); + } + + + + int total = await query.CountAsync(); + var list = await query.Select(s => new SGenerateRecordInfoResponse() + { + Id = s.Id, + Specifications = _erpBasicDataExtendService.GetMaterialSpecifications(materials, s.MaterialNumber), + MaterialNumber = s.MaterialNumber, + MaterialName = _erpBasicDataExtendService.GetMaterialName(materials, s.MaterialNumber), + BarCode = _erpBasicDataExtendService.GetMaterialBarCode(materials, s.MaterialNumber), + PurchaseBillNo = s.PurchaseBillNo, + GenerateComplete = s.IsGenerateComplete == true ? "宸插畬鎴" : "鐢熸垚涓", + Number = s.Number, + DownLoadNumber = s.DownLoadNumber, + UseNumber = s.UseNumber, + IsUpdateMaterial = s.IsUpdateMaterial, + Creator = _singleDataService.GetSingleData(SingleAction.Users, companyId, s.CreatorId), + CreateTime = s.CreateTime.DateToStringSeconds(), + GenerateCompleteTime = s.GenerateCompleteTime.DateToStringSeconds(), + PrintNumber = s.PrintNumber, + IsTwo= s.IsTwo,//add by yzh + SupplierOrOrg = string.IsNullOrEmpty(s.SupplierCode) ? _erpBasicDataExtendService.GetSingleOrgName(orgs, s.OrgCode) + : _singleDataService.GetSingleData(SingleAction.Suppliers, companyId, s.SupplierCode)//渚涘簲鍟嗗彇鍗曠偣鐨 + }).Skip((dto.PageNo - 1) * dto.PageSize).Take(dto.PageSize).ToListAsync(); + return (list, total); + } + } +} diff --git a/src/BarCode.Web.Repositories/SecurityGenerateRecordRepositories.cs b/src/BarCode.Web.Repositories/SecurityGenerateRecordRepositories.cs new file mode 100644 index 0000000..d16f00d --- /dev/null +++ b/src/BarCode.Web.Repositories/SecurityGenerateRecordRepositories.cs @@ -0,0 +1,275 @@ +锘縰sing AutoMapper; +using BarCode.Web.Core.Dto.Erp.Org; +using BarCode.Web.Core.Dto.Erp.Supplier; +using BarCode.Web.Core.Dto.Erp; +using BarCode.Web.Core.Dto.SerialNumbers; +using BarCode.Web.Domain.Entitys; +using BarCode.Web.Domain.Infrastructure; +using BarCode.Web.Domain.Mappers; +using BarCode.Web.Repositories.Configuration; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Storage; +using Newtonsoft.Json; +using Org.BouncyCastle.Crypto; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using static Microsoft.EntityFrameworkCore.DbLoggerCategory; +using BarCode.Web.Domain.IService.Public; +using BarCode.Web.Core.Dto.Box; +using BarCode.Web.Domain.Services.Public; +using BarCode.Web.Domain.Values.Single; +using System.ComponentModel.Design; +using BarCode.Web.Core.Help; +using NPOI.SS.Formula.Functions; +using Microsoft.AspNetCore.Http.HttpResults; +using BarCode.Web.Core.Dto.SecurityNumbers; +using NPOI.OpenXmlFormats.Wordprocessing; +using BarCode.Web.Core.Dto.Login; + +namespace BarCode.Web.Repositories +{ + /// + /// 闃蹭吉鐮佺敓鎴愯褰 + /// + public class SecurityGenerateRecordRepositories : ISecurityGenerateRecordRepositories + { + private readonly ILoginRepositories _loginRepositories; + private readonly RepositoryDbContext _context; + private readonly IBasicsRepositories _basicsRepositories; + private readonly IMapper _mapper; + private readonly IErpService _erpService; + private readonly IErpBasicDataExtendService _erpBasicDataExtendService; + private readonly ISingleDataService _singleDataService; + public SecurityGenerateRecordRepositories(RepositoryDbContext context, + ILoginRepositories loginRepositories, + IBasicsRepositories basicsRepositories, IMapper mapper, IErpService erpService, + IErpBasicDataExtendService erpBasicDataExtendService, ISingleDataService singleDataService) + { + _context = context; + _basicsRepositories = basicsRepositories; + _loginRepositories = loginRepositories; + _mapper = mapper; + _erpService = erpService; + _erpBasicDataExtendService = erpBasicDataExtendService; + _singleDataService = singleDataService; + } + /// + /// 鏂板 + /// + /// + /// + /// + public async Task Add(SecurityNumberGenerateRecord entity, bool isTransaction = true) + { + IDbContextTransaction _transaction = null; + if (isTransaction) + _transaction = _context.Database.BeginTransaction(); + + await _context.SecurityNumberGenerateRecord.AddAsync(entity); + await _context.SaveChangesAsync(); + + if (_transaction != null) + _transaction.Commit(); + return entity; + } + /// + /// 鎵归噺娣诲姞 + /// + /// + /// + /// + public async Task AddRange(List entitys, bool isTransaction = true) + { + IDbContextTransaction _transaction = null; + if (isTransaction) + _transaction = _context.Database.BeginTransaction(); + + if (entitys != null && entitys.Count != 0) + { + await _context.SecurityNumberGenerateRecord.AddRangeAsync(entitys); + await _context.SaveChangesAsync(); + } + if (_transaction != null) + _transaction.Commit(); + return true; + } + /// + /// 淇敼 + /// + /// + /// + /// + public async Task Edit(SecurityNumberGenerateRecord entity, bool isTransaction = true) + { + + IDbContextTransaction _transaction = null; + if (isTransaction) + _transaction = _context.Database.BeginTransaction(); + + var res = await _context.SecurityNumberGenerateRecord + .FirstOrDefaultAsync(f => f.Id == entity.Id); + if (res == null) return null; + + _mapper.Map(entity, res); + var result = await _context.SaveChangesAsync(); + + if (_transaction != null) + _transaction.Commit(); + + return res; + } + /// + /// 鎵归噺淇敼 + /// + /// + /// + /// + public async Task EditEntityList(List entitys, bool isTransaction = true) + { + IDbContextTransaction _transaction = null; + if (isTransaction) + _transaction = _context.Database.BeginTransaction(); + + List list = entitys.Select(s => s.Id).ToList(); + var res = await _context.SecurityNumberGenerateRecord + .Where(f => list.Contains(f.Id)).ToListAsync(); + + _mapper.ToMapList(entitys, res); + await _context.SaveChangesAsync(); + + if (_transaction != null) + _transaction.Commit(); + + return true; + } + /// + /// 鏌ヨ瀹炰綋 + /// + /// + /// + public async Task GetEntity(int id) + { + return await _context.SecurityNumberGenerateRecord.AsNoTracking() + .FirstOrDefaultAsync(f => f.Id == id); + } + + /// + /// 鑾峰彇闆嗗悎 + /// + /// + /// + /// + public async Task> GetEntityList(List ids) + { + return await _context.SecurityNumberGenerateRecord.AsNoTracking() + .Where(f => ids.Contains(f.Id)) + .ToListAsync(); + } + /// + /// 鑾峰彇褰撳ぉ鐢熸垚璁板綍鏉℃暟 + /// + /// + /// + public async Task GetGenerateRecordDayCount() + { + return await _context.SecurityNumberGenerateRecord.AsNoTracking() + .Where(f => f.CreateTime >= DateTime.Now.Date).CountAsync(); + } + + /// + /// 鍒楄〃 + /// + /// + /// + /// + public async Task<(List list, int total)> GetListAsync(SecurityGenerateRecordQueryRequest dto, LoginInDto loginInfo) + { + int companyId = loginInfo.UserInfo.CompanyId; + + List mNumber = new List(); + var materials_result = await _erpService.BillQueryForMaterial(); + List materials = new List(); + if (materials_result.IsSuccess) + materials = materials_result.Data.ToList(); + //鐗╂枡闆嗗悎锛涙ā绯婃煡璇㈠悗鐨勭墿鏂欓泦鍚 + if (!string.IsNullOrEmpty(dto.MaterialNumber)) + { + if (materials != null) + mNumber = materials.Where(w => w.MaterialNumber.Contains(dto.MaterialNumber) + || w.MaterialName.Contains(dto.MaterialNumber) + || w.Specifications.Contains(dto.MaterialNumber) + ).Select(s => s.MaterialNumber).ToList(); + } + List sIds = new List(); + if (dto.SecurityNumbers != null && dto.SecurityNumbers.Count() > 0) + { + sIds = await _context.SecurityNumbers.Where(w => dto.SecurityNumbers.Contains(w.SecurityNumber)) + .GroupBy(g => g.GenerateRecordId).Select(s => s.Key).ToListAsync(); + } + + ////渚涘簲鍟 + //var supplier_result = await _erpService.BillQueryForSupplier(); + //List suppliers = new List(); + //if (supplier_result.IsSuccess) + // suppliers = supplier_result.Data.ToList(); + ////鍙栫粍缁 + //var org_result = await _erpService.BillQueryForOrg(); + //List orgs = new List(); + //if (org_result.IsSuccess) + // orgs = org_result.Data.ToList(); + + var query = _context.SecurityNumberGenerateRecord + .OrderByDescending(o => o.Id) + .Where(f => 1==1); + if (loginInfo.UserInfo.IsAdmin != true && !string.IsNullOrEmpty(dto.OrgCode)) + { + var rec_type = dto.OrgCode.Substring(0, 1); + var rec_code = dto.OrgCode.Substring(2, dto.OrgCode.Length - 2); + + if (rec_type.Equals("s"))//渚涘簲鍟 + query = query.Where(w => rec_code == w.SupplierCode); + else//鏌ュ叾浠栧崟鎹(缁勭粐) + query = query.Where(w => rec_code == w.OrgCode); + } + if (!string.IsNullOrEmpty(dto.MaterialNumber)) + query = query.Where(w => mNumber.Contains(w.MaterialNumber)); + if (dto.CreateBeginDate != null) + query = query.Where(w => w.GenerateCompleteTime >= dto.CreateBeginDate); + if (dto.CreateEndDate != null) + { + DateTime dt_end = ((DateTime)dto.CreateEndDate).AddDays(1); + query = query.Where(w => w.GenerateCompleteTime <= dt_end); + } + if (mNumber.Count() > 0) + query = query.Where(w => mNumber.Contains(w.MaterialNumber)); + if (dto.GenerateComplete != null) + query = query.Where(w => dto.GenerateComplete == w.IsGenerateComplete); + if (dto.LotNumbers != null && dto.LotNumbers.Count() > 0) + query = query.Where(w => dto.LotNumbers.Contains(w.LotNumber)); + if (dto.SecurityNumbers != null && dto.SecurityNumbers.Count() > 0) + query = query.Where(w => sIds.Contains(w.Id)); + + + int total = await query.CountAsync(); + var list = await query.Select(s => new SecurityGenerateRecordInfoResponse() + { + Id = s.Id, + Specifications = _erpBasicDataExtendService.GetMaterialSpecifications(materials, s.MaterialNumber), + MaterialNumber = s.MaterialNumber, + MaterialName = _erpBasicDataExtendService.GetMaterialName(materials, s.MaterialNumber), + BarCode = _erpBasicDataExtendService.GetMaterialBarCode(materials, s.MaterialNumber), + LotNumber = s.LotNumber, + GenerateComplete = s.IsGenerateComplete == true ? "宸插畬鎴" : "鐢熸垚涓", + Number = s.Number, + DownLoadNumber = s.DownLoadNumber, + Creator = _singleDataService.GetSingleData(SingleAction.Users, companyId, s.CreatorId), + CreateTime = s.CreateTime.DateToStringSeconds(), + GenerateCompleteTime = s.GenerateCompleteTime.DateToStringSeconds() + }).Skip((dto.PageNo - 1) * dto.PageSize).Take(dto.PageSize).ToListAsync(); + return (list, total); + } + } +} diff --git a/src/BarCode.Web.Repositories/SecurityNumbersRepositories.cs b/src/BarCode.Web.Repositories/SecurityNumbersRepositories.cs new file mode 100644 index 0000000..d2c87d1 --- /dev/null +++ b/src/BarCode.Web.Repositories/SecurityNumbersRepositories.cs @@ -0,0 +1,315 @@ +锘縰sing AutoMapper; +using BarCode.Web.Core.Dto.Erp; +using BarCode.Web.Core.Dto.Erp.Org; +using BarCode.Web.Core.Dto.Erp.Supplier; +using BarCode.Web.Core.Dto.Login; +using BarCode.Web.Core.Dto.SecurityNumbers; +using BarCode.Web.Core.Dto.SerialNumbers; +using BarCode.Web.Core.Help; +using BarCode.Web.Domain.Entitys; +using BarCode.Web.Domain.Infrastructure; +using BarCode.Web.Domain.IService.Public; +using BarCode.Web.Domain.Mappers; +using BarCode.Web.Domain.Services.Public; +using BarCode.Web.Domain.Values.Single; +using BarCode.Web.Repositories.Configuration; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Storage; +using System; +using System.Collections.Generic; +using System.ComponentModel.Design; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using static Microsoft.EntityFrameworkCore.DbLoggerCategory; + +namespace BarCode.Web.Repositories +{ + public class SecurityNumbersRepositories : IAllFielRepositories, IAllFielRepositories, ISecurityNumbersRepositories + { + + private readonly ILoginRepositories _loginRepositories; + private readonly RepositoryDbContext _context; + private readonly IBasicsRepositories _basicsRepositories; + private readonly IMapper _mapper; + private readonly IErpService _erpService; + private readonly ISingleDataService _singleDataService; + private readonly IErpBasicDataExtendService _erpBasicDataExtendService; + + public SecurityNumbersRepositories(RepositoryDbContext context, + ILoginRepositories loginRepositories, + IBasicsRepositories basicsRepositories, IMapper mapper, IErpService erpService, + ISingleDataService singleDataService, IErpBasicDataExtendService erpBasicDataExtendService) + { + _context = context; + _basicsRepositories = basicsRepositories; + _loginRepositories = loginRepositories; + _mapper = mapper; + _erpService = erpService; + _singleDataService = singleDataService; + _erpBasicDataExtendService = erpBasicDataExtendService; + } + /// + /// 鎵归噺娣诲姞 + /// + /// + /// + /// + /// + public async Task AddRange(List entitys, bool isTransaction = true) + { + IDbContextTransaction _transaction = null; + if (isTransaction) + _transaction = _context.Database.BeginTransaction(); + + if (entitys != null && entitys.Count != 0) + { + await _context.SecurityNumbers.AddRangeAsync(entitys); + await _context.SaveChangesAsync(); + foreach (var item in entitys) + { + if (string.IsNullOrEmpty(item.SecurityNumber)) + { + //鑷姩鐢熸垚搴忓垪鐮 + item.GenerateSecurityNumber(); + //item.GenerateNumberCode(); + } + } + await _context.SaveChangesAsync(); + } + if (_transaction != null) + _transaction.Commit(); + return true; + } + /// + /// 鎵归噺淇敼 + /// + /// + /// + /// + /// + public async Task EditEntityList(List entitys, bool isTransaction = true) + { + IDbContextTransaction _transaction = null; + if (isTransaction) + _transaction = _context.Database.BeginTransaction(); + + List list = entitys.Select(s => s.Id).ToList(); + var res = await _context.SecurityNumbers + .Where(f => list.Contains(f.Id)).ToListAsync(); + + _mapper.ToMapLongList(entitys, res); + await _context.SaveChangesAsync(); + + if (_transaction != null) + _transaction.Commit(); + + return true; + } + /// + /// 鑾峰彇闆嗗悎 + /// + /// + /// + /// + public async Task> GetEntityList(List SecurityNumbers) + { + return await _context.SecurityNumbers.AsNoTracking() + .Where(f => SecurityNumbers.Contains(f.SecurityNumber)) + .ToListAsync(); + } + /// + /// 鏍规嵁鐢熸垚璁板綍Id鏌ヨ搴忓垪鍙 + /// + /// + /// + public async Task> GetEntityListByGRIds(List gRIds) + { + return await _context.SecurityNumbers.AsNoTracking() + .Where(f => gRIds.Contains(f.GenerateRecordId)) + .ToListAsync(); + } + /// + /// 鏍规嵁鐢熸垚璁板綍Id鏌ヨ搴忓垪鍙 + /// + /// + /// + public async Task> GetEntityListByGRId(int gRId) + { + return await _context.SecurityNumbers.AsNoTracking() + .Where(f => gRId == f.GenerateRecordId) + .ToListAsync(); + } + + /// + /// 鍒楄〃 + /// + /// + /// + /// + public async Task<(List list, int total)> GetListAsync(SecurityNumberQueryRequest dto, LoginInDto loginInfo) + { + int companyId = loginInfo.UserInfo.CompanyId; + List mNumber = new List(); + var materials_result = await _erpService.BillQueryForMaterial(); + List materials = new List(); + if (materials_result.IsSuccess) + materials = materials_result.Data.ToList(); + + var query = _context.SecurityNumbers.AsNoTracking() + .GroupJoin(_context.SecurityNumberGenerateRecord, serial => serial.GenerateRecordId, sg => sg.Id, (serial, sg) => new { serial, sg }) + .SelectMany(x => x.sg.DefaultIfEmpty(), (p, sg) => new { p.serial, sg }) + .OrderByDescending(o => o.serial.Id) + .Where(f => dto.GenerateRecordId == f.serial.GenerateRecordId); + if (loginInfo.UserInfo.IsAdmin != true && !string.IsNullOrEmpty(dto.OrgCode)) + { + var rec_type = dto.OrgCode.Substring(0, 1); + var rec_code = dto.OrgCode.Substring(2, dto.OrgCode.Length - 2); + + if (rec_type.Equals("s"))//渚涘簲鍟 + query = query.Where(w => rec_code == w.serial.SupplierCode); + else//鏌ュ叾浠栧崟鎹(缁勭粐) + query = query.Where(w => rec_code == w.serial.OrgCode); + } + if (dto.IsDownLoad != null) + query = query.Where(w => dto.IsDownLoad == true ? w.serial.DownLoadNumber > 0 : w.serial.DownLoadNumber <= 0); + if (dto.SecurityNumbers != null && dto.SecurityNumbers.Count() > 0) + query = query.Where(w => dto.SecurityNumbers.Contains(w.serial.SecurityNumber)); + if (dto.IdBegin != null && dto.IdBegin != 0) + query = query.Where(w => w.serial.Id >= dto.IdBegin); + if (dto.IdEnd != null && dto.IdEnd != 0) + query = query.Where(w => w.serial.Id <= dto.IdEnd); + if (dto.DownLoadBeginDate != null) + query = query.Where(w => w.serial.DownLoadTime >= dto.DownLoadBeginDate); + if (dto.DownLoadEndDate != null) + { + DateTime dt_end = ((DateTime)dto.DownLoadEndDate).AddDays(1); + query = query.Where(w => w.serial.DownLoadTime <= dt_end); + } + + int total = await query.CountAsync(); + var list = await query.Select(s => new SecurityNumberInfoResponse() + { + Id = s.serial.Id, + GenerateRecordId = s.serial.GenerateRecordId, + SecurityNumber = s.serial.SecurityNumber, + Specifications = _erpBasicDataExtendService.GetMaterialSpecifications(materials, s.serial.MaterialNumber), + Number = s.sg == null ? 0 : s.sg.Number, + Creator = _singleDataService.GetSingleData(SingleAction.Users, companyId, s.serial.CreatorId), + CreateTime = s.serial.CreateTime.DateToStringSeconds(), + DownLoadNumber = s.serial.DownLoadNumber, + DownLoadTime = s.serial.DownLoadTime.DateToStringSeconds() + }).Skip((dto.PageNo - 1) * dto.PageSize).Take(dto.PageSize).ToListAsync(); + return (list, total); + } + + /// + /// 瀵煎嚭鍒楄〃 + /// + /// + /// + /// + public async Task<(object obj, int total)> GetListField(SecurityNumbersExportRequest dto, LoginInDto loginInfo) + { + List mNumber = new List(); + var materials_result = await _erpService.BillQueryForMaterial(); + List materials = new List(); + if (materials_result.IsSuccess) + materials = materials_result.Data.ToList(); + + //渚涘簲鍟 + var supplier_result = await _erpService.BillQueryForSupplier(); + List suppliers = new List(); + if (supplier_result.IsSuccess) + suppliers = supplier_result.Data.ToList(); + //鍙栫粍缁 + var org_result = await _erpService.BillQueryForOrg(); + List orgs = new List(); + if (org_result.IsSuccess) + orgs = org_result.Data.ToList(); + + var query = _context.SecurityNumbers.AsNoTracking() + .GroupJoin(_context.SecurityNumberGenerateRecord, serial => serial.GenerateRecordId, sg => sg.Id, (serial, sg) => new { serial, sg }) + .SelectMany(x => x.sg.DefaultIfEmpty(), (p, sg) => new { p.serial, sg }) + .OrderByDescending(o => o.serial.Id) + .Where(f => dto.Ids.Contains(f.serial.GenerateRecordId)); + + int total = await query.CountAsync(); + var list = await query.Select(s => new SecurityNumbersExportReponse() + { + SecurityNumber = s.serial.SecurityNumber, + Specifications = _erpBasicDataExtendService.GetMaterialSpecifications(materials, s.serial.MaterialNumber), + Number = s.sg == null ? 0 : s.sg.Number, + DownLoadNumber = s.serial.DownLoadNumber, + DownLoadTime = s.serial.DownLoadTime.DateToStringSeconds() + }).Skip((dto.PageNo - 1) * dto.PageSize).Take(dto.PageSize).ToListAsync(); + return (list, total); + } + + /// + /// 鏉$爜鍒楄〃瀵煎嚭 + /// + /// + /// + /// + public async Task<(object obj, int total)> GetListField(SecurityNumberQueryRequest dto, LoginInDto loginInfo) + { + return await GetListAsync(dto, loginInfo); + } + /// + /// 鑾峰彇闃蹭吉鐮 + /// + /// + /// + /// + public async Task GetEntity(string securityNumbers) + { + var entity = await _context.SecurityNumbers.AsNoTracking() + .FirstOrDefaultAsync(f => f.SecurityNumber.Equals(securityNumbers)); + return entity; + } + /// + /// 淇敼闃蹭吉鐮 + /// + /// + /// + /// + public async Task Edit(SecurityNumbers entity, bool isTransaction = true) + { + IDbContextTransaction _transaction = null; + if (isTransaction) + _transaction = _context.Database.BeginTransaction(); + + var res = await _context.SecurityNumbers + .FirstOrDefaultAsync(f => f.Id == entity.Id); + if (res == null) return null; + + _mapper.Map(entity, res); + var result = await _context.SaveChangesAsync(); + + if (_transaction != null) + _transaction.Commit(); + + return res; + } + + public async Task DownLoad(List ids, bool isTransaction = true) + { + IDbContextTransaction _transaction = null; + if (isTransaction) + _transaction = _context.Database.BeginTransaction(); + + string dt = DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss"); + foreach (var id in ids) + { + FormattableString fs = @$"update t_barcode_securitynumbers set DownLoadNumber=DownLoadNumber+1,DownLoadTime={dt} where GenerateRecordId = {id};"; + var result = _context.Database.ExecuteSqlInterpolated(fs); + } + + if (_transaction != null) + _transaction.Commit(); + + return true; + } + } +} diff --git a/src/BarCode.Web.Repositories/SerialNumbersRepositories.cs b/src/BarCode.Web.Repositories/SerialNumbersRepositories.cs new file mode 100644 index 0000000..2c5cc2d --- /dev/null +++ b/src/BarCode.Web.Repositories/SerialNumbersRepositories.cs @@ -0,0 +1,723 @@ +锘縰sing AutoMapper; +using BarCode.Web.Core.Dto.Erp; +using BarCode.Web.Core.Dto.Erp.Org; +using BarCode.Web.Core.Dto.Erp.Supplier; +using BarCode.Web.Core.Dto.Login; +using BarCode.Web.Core.Dto.SerialNumbers; +using BarCode.Web.Core.Help; +using BarCode.Web.Domain.Entitys; +using BarCode.Web.Domain.Infrastructure; +using BarCode.Web.Domain.IService.Public; +using BarCode.Web.Domain.Mappers; +using BarCode.Web.Domain.Services.Public; +using BarCode.Web.Domain.Values.Single; +using BarCode.Web.Repositories.Configuration; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Storage; +using Microsoft.Extensions.Logging; +using Npoi.Mapper; +using NPOI.POIFS.FileSystem; +using Quartz.Logging; +using System; +using System.Collections.Generic; +using System.ComponentModel.Design; +using System.Diagnostics.Eventing.Reader; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using static Microsoft.EntityFrameworkCore.DbLoggerCategory; + +namespace BarCode.Web.Repositories +{ + /// + /// 搴忓垪鐮 + /// + public class SerialNumbersRepositories : IAllFielRepositories, IAllFielRepositories, ISerialNumbersRepositories + { + private readonly ILoginRepositories _loginRepositories; + private readonly RepositoryDbContext _context; + private readonly IBasicsRepositories _basicsRepositories; + private readonly IMapper _mapper; + private readonly IErpService _erpService; + private readonly ISingleDataService _singleDataService; + private readonly IErpBasicDataExtendService _erpBasicDataExtendService; + + public SerialNumbersRepositories(RepositoryDbContext context, + ILoginRepositories loginRepositories, + IBasicsRepositories basicsRepositories, IMapper mapper, IErpService erpService, + ISingleDataService singleDataService, IErpBasicDataExtendService erpBasicDataExtendService) + { + _context = context; + _basicsRepositories = basicsRepositories; + _loginRepositories = loginRepositories; + _mapper = mapper; + _erpService = erpService; + _singleDataService = singleDataService; + _erpBasicDataExtendService = erpBasicDataExtendService; + } + /// + /// 鎵归噺娣诲姞 + /// + /// + /// + /// + /// + public async Task AddRange(List entitys, bool isTransaction = true) + { + IDbContextTransaction _transaction = null; + if (isTransaction) + _transaction = _context.Database.BeginTransaction(); + + if (entitys != null && entitys.Count != 0) + { + await _context.SerialNumbers.AddRangeAsync(entitys); + await _context.SaveChangesAsync(); + string newSuitNumber = ""; + string oldSuitNumber = ""; + foreach (var item in entitys) + { + //鑷姩鐢熸垚搴忓垪鐮 + string sn= item.GenerateSerialNumber();//alter by yzh + item.GenerateNumberCode(); + + + if(item.IsTwo>1)//澶т簬1璇存槑鏄瑁 + { + if (item.thisNumber % item.IsTwo == 0) + { + newSuitNumber = oldSuitNumber; + } + else + { + oldSuitNumber = sn; + newSuitNumber = sn; + } + } + else + { + newSuitNumber = sn; + newSuitNumber = sn; + } + item.GenerateSuitNumber(newSuitNumber); + item.GenerateTwoSerialNumber(newSuitNumber); + } + foreach (var item in entitys) + { + + string s = GetTwoSerialNumber(entitys, item.SuitNumber); + item.GenerateTwoSerialNumber(s); + } + + await _context.SaveChangesAsync(); + + + } + if (_transaction != null) + _transaction.Commit(); + return true; + } + /// + /// 浜х敓濂楄鏉$爜 + /// + /// + /// + public string GetTwoSerialNumber(List entitys, string SuitNumber) + { + string strReturn = ""; + foreach (var item in entitys) + { + + if (item.SuitNumber == SuitNumber) + { + if (strReturn == "") + { + strReturn = item.SerialNumber; + } + else + { + strReturn = strReturn + "," + item.SerialNumber; + } + + } + } + return strReturn; + } + /// + /// 鎵归噺淇敼 + /// + /// + /// + /// + /// + public async Task EditEntityList(List entitys, bool isTransaction = true) + { + IDbContextTransaction _transaction = null; + if (isTransaction) + _transaction = _context.Database.BeginTransaction(); + + List list = entitys.Select(s => s.Id).ToList(); + var res = await _context.SerialNumbers + .Where(f => list.Contains(f.Id)).ToListAsync(); + + _mapper.ToMapLongList(entitys, res); + await _context.SaveChangesAsync(); + + if (_transaction != null) + _transaction.Commit(); + + return true; + } + /// + /// 鑾峰彇闆嗗悎 + /// + /// + /// + /// + public async Task> GetEntityList(List serialNumbers) + { + return await _context.SerialNumbers.AsNoTracking() + .Where(f => serialNumbers.Contains(f.SerialNumber)) + .ToListAsync(); + } + /// + /// 鏍规嵁鐢熸垚璁板綍Id鏌ヨ搴忓垪鍙 + /// + /// + /// + public async Task> GetEntityListByGRIds(List gRIds) + { + return await _context.SerialNumbers.AsNoTracking() + .Where(f => gRIds.Contains(f.GenerateRecordId)) + .ToListAsync(); + } + /// + /// 鏍规嵁鐢熸垚璁板綍Id鏌ヨ搴忓垪鍙 + /// + /// + /// + public async Task> GetEntityListByGRId(int gRId) + { + return await _context.SerialNumbers.AsNoTracking() + .Where(f => gRId == f.GenerateRecordId) + .ToListAsync(); + } + + /// + /// 鍒楄〃 + /// + /// + /// + /// + public async Task<(List list, int total)> GetListAsync(SerialNumberQueryRequest dto, LoginInDto loginInfo) + { + int companyId = loginInfo.UserInfo.CompanyId; + List mNumber = new List(); + var materials_result = await _erpService.BillQueryForMaterial(); + List materials = new List(); + if (materials_result.IsSuccess) + materials = materials_result.Data.ToList(); + + var query = _context.SerialNumbers.AsNoTracking() + .GroupJoin(_context.Box, serial => serial.BoxId, box => box.Id, (serial, box) => new { serial, box }) + .SelectMany(x => x.box.DefaultIfEmpty(), (p, box) => new { p.serial, box }) + .GroupJoin(_context.SerialNumberGenerateRecord, s => s.serial.GenerateRecordId, sg => sg.Id, (serial, sg) => new { serial.serial, serial.box, sg }) + .SelectMany(x => x.sg.DefaultIfEmpty(), (p, sg) => new { p.serial, p.box, sg }) + .OrderByDescending(o => o.serial.Id) + .Where(f => dto.GenerateRecordId == f.serial.GenerateRecordId); + if (loginInfo.UserInfo.IsAdmin != true && !string.IsNullOrEmpty(dto.OrgCode)) + { + var rec_type = dto.OrgCode.Substring(0, 1); + var rec_code = dto.OrgCode.Substring(2, dto.OrgCode.Length - 2); + + if (rec_type.Equals("s"))//渚涘簲鍟 + query = query.Where(w => rec_code == w.serial.SupplierCode); + else//鏌ュ叾浠栧崟鎹(缁勭粐) + query = query.Where(w => rec_code == w.serial.OrgCode); + } + if (dto.IsPrint != null) + query = query.Where(w => dto.IsPrint == true ? w.serial.PrintNumber > 0 : w.serial.PrintNumber <= 0); + if (dto.IsUse != null) + query = query.Where(w => w.serial.IsUse == dto.IsUse); + if (dto.SerialNumbers != null && dto.SerialNumbers.Count() > 0) + query = query.Where(w => dto.SerialNumbers.Contains(w.serial.SerialNumber)); + if (dto.NumberCodes != null && dto.NumberCodes.Count() > 0) + query = query.Where(w => dto.NumberCodes.Contains(w.serial.NumberCode)); + if (!string.IsNullOrEmpty(dto.BoxBillNo)) + query = query.Where(w => w.box.BoxBillNo.Equals(dto.BoxBillNo)); + if (dto.SerialNumberBegin != null && dto.SerialNumberBegin != 0) + { + if (dto.SerialNumberEnd != null && dto.SerialNumberEnd != 0) + query = query.Where(w => w.serial.Id >= dto.SerialNumberBegin); + else + query = query.Where(w => w.serial.Id == dto.SerialNumberBegin); + } + if (dto.SerialNumberEnd != null && dto.SerialNumberEnd != 0) + { + if (dto.SerialNumberBegin != null && dto.SerialNumberBegin != 0) + query = query.Where(w => w.serial.Id <= dto.SerialNumberEnd); + else + query = query.Where(w => w.serial.Id == dto.SerialNumberEnd); + } + //V01.05.00: 鏁板瓧搴忓垪鍙峰尯闂存煡璇 + if (!string.IsNullOrEmpty(dto.NumberCodeBegin)) + { + int number = Convert.ToInt32(dto.NumberCodeBegin.Substring(6, dto.NumberCodeBegin.Length - 6)); + if (!string.IsNullOrEmpty(dto.NumberCodeEnd)) + query = query.Where(w => w.serial.Number >= number); + else + query = query.Where(w => w.serial.Number == number); + } + if (!string.IsNullOrEmpty(dto.NumberCodeEnd)) + { + int number = Convert.ToInt32(dto.NumberCodeEnd.Substring(6, dto.NumberCodeEnd.Length - 6)); + if (!string.IsNullOrEmpty(dto.NumberCodeBegin)) + query = query.Where(w => w.serial.Number <= number); + else + query = query.Where(w => w.serial.Number == number); + } + + + if (dto.DownLoadBeginDate != null) + query = query.Where(w => w.serial.DownLoadTime >= dto.DownLoadBeginDate); + if (dto.DownLoadEndDate != null) + { + DateTime dt_end = ((DateTime)dto.DownLoadEndDate).AddDays(1); + query = query.Where(w => w.serial.DownLoadTime <= dt_end); + } + if (dto.PrintBeginDate != null) + query = query.Where(w => w.serial.PrintTime >= dto.PrintBeginDate); + if (dto.PrintEndDate != null) + { + DateTime dt_end = ((DateTime)dto.PrintEndDate).AddDays(1); + query = query.Where(w => w.serial.PrintTime <= dt_end); + } + if (dto.IsUpdateMaterial != null) + { + if (dto.IsUpdateMaterial == true) + query = query.Where(w => !string.IsNullOrEmpty(w.serial.Old_MaterialNumber)); + else + query = query.Where(w => string.IsNullOrEmpty(w.serial.Old_MaterialNumber)); + } + + + if(dto.isTwo>1)//鏄惁涓轰袱浠惰锛屽鏋滃ぇ浜1璇存槑涓轰袱浠惰 + { + query = query.Where(w => w.serial.IsTwo>1); + } + + + int total = await query.CountAsync(); + var list = await query.Select(s => new SerialNumberInfoResponse() + { + Specifications = _erpBasicDataExtendService.GetMaterialSpecifications(materials, s.serial.MaterialNumber), + Old_Specifications = _erpBasicDataExtendService.GetMaterialSpecifications(materials, s.serial.Old_MaterialNumber == null ? "" : s.serial.Old_MaterialNumber), + MaterialNumber = s.serial.MaterialNumber, + MaterialName = _erpBasicDataExtendService.GetMaterialName(materials, s.serial.MaterialNumber), + BarCode = _erpBasicDataExtendService.GetMaterialBarCode(materials, s.serial.MaterialNumber), + SerialNumber = s.serial.SerialNumber, + NumberCode = s.serial.NumberCode, + Number = s.sg == null ? 0 : s.sg.Number, + Id = s.serial.Id, + IsUse = s.serial.IsUse, + IsUseStr = s.serial.IsUse == true ? "鏄" : "鍚", + //搴忓垪鐮佸凡缁忚浣跨敤 浣嗘病鏈夌鍙,閭d箞灏辨槸琚玾ms绯荤粺鎷夊幓浣跨敤浜,涓嶈兘鍐嶈鎵撳嵃 + IsEnablePrint = (s.serial.BoxId <= 0 && s.serial.IsUse == true) ? false : true, + Box = s.box == null ? "" : s.box.BoxBillNo, + Creator = _singleDataService.GetSingleData(SingleAction.Users, companyId, s.serial.CreatorId), + CreateTime = s.serial.CreateTime.DateToStringSeconds(), + PrintNumber = s.serial.PrintNumber, + DownLoadNumber = s.serial.DownLoadNumber, + DownLoadTime = s.serial.DownLoadTime.DateToStringSeconds(), + PrintTime = s.serial.PrintTime.DateToStringSeconds(), + IsTwo=s.serial.IsTwo, + TwoSerialNumber = s.serial.TwoSerialNumber.Replace(s.serial.SerialNumber,"").Replace(",","") + }).Skip((dto.PageNo - 1) * dto.PageSize).Take(dto.PageSize).ToListAsync(); + return (list, total); + } + + /// + /// 瀵煎嚭鍒楄〃 + /// + /// + /// + /// + public async Task<(object obj, int total)> GetListField(SerialNumbersExportRequest dto, LoginInDto loginInfo) + { + List mNumber = new List(); + var materials_result = await _erpService.BillQueryForMaterial(); + List materials = new List(); + if (materials_result.IsSuccess) + materials = materials_result.Data.ToList(); + + //渚涘簲鍟 + var supplier_result = await _erpService.BillQueryForSupplier(); + List suppliers = new List(); + if (supplier_result.IsSuccess) + suppliers = supplier_result.Data.ToList(); + //鍙栫粍缁 + var org_result = await _erpService.BillQueryForOrg(); + List orgs = new List(); + if (org_result.IsSuccess) + orgs = org_result.Data.ToList(); + + var query = _context.SerialNumbers.AsNoTracking() + .GroupJoin(_context.SerialNumberGenerateRecord, serial => serial.GenerateRecordId, sg => sg.Id, (serial, sg) => new { serial, sg }) + .SelectMany(x => x.sg.DefaultIfEmpty(), (p, sg) => new { p.serial, sg }) + .OrderByDescending(o => o.serial.Id) + .Where(f => dto.Ids.Contains(f.serial.GenerateRecordId)); + + int total = await query.CountAsync(); + var list = await query.Select(s => new SerialNumbersExportReponse() + { + Specifications = _erpBasicDataExtendService.GetMaterialSpecifications(materials, s.serial.MaterialNumber), + MaterialNumber = s.serial.MaterialNumber, + MaterialName = _erpBasicDataExtendService.GetMaterialName(materials, s.serial.MaterialNumber), + BarCode = _erpBasicDataExtendService.GetMaterialBarCode(materials, s.serial.MaterialNumber), + SerialNumber = s.serial.SerialNumber, + NumberCode = s.serial.NumberCode, + Number = s.sg == null ? 0 : s.sg.Number, + SupplierOrOrg = string.IsNullOrEmpty(s.sg.SupplierCode) ? _erpBasicDataExtendService.GetOrgName(orgs, s.sg.OrgCode) + : _erpBasicDataExtendService.GetSupplierName(suppliers, s.sg.SupplierCode) + }).Skip((dto.PageNo - 1) * dto.PageSize).Take(dto.PageSize).ToListAsync(); + return (list, total); + } + /// + /// 鏍规嵁绠盜d鏉ユ悳绱㈠簭鍒楀彿 + /// + /// + /// + /// + public async Task<(List list, int total)> GetEntityListByBoxId(SerialNumberByBoxIdQueryRequest dto) + { + var materials_result = await _erpService.BillQueryForMaterial(); + List materials = new List(); + if (materials_result.IsSuccess) + materials = materials_result.Data.ToList(); + + var query = _context.SerialNumbers.AsNoTracking() + .OrderByDescending(o => o.CompleteCartonTime)//浠ヨ绠辨椂闂村厛鍚庢帓搴 + .Where(f => f.BoxId == dto.BoxId); + + int total = await query.CountAsync(); + var list = await query.Select(s => new SerialNumbersResponse() + { + BoxId = s.BoxId, + IsCarton = (s.BoxId > 0 || s.IsUse == true) ? true : false, + IsOldData = true,//鎵鍙疯幏鍙 榛樿灏辨槸鑰佹暟鎹 + Specifications = _erpBasicDataExtendService.GetMaterialSpecifications(materials, s.MaterialNumber), + MaterialNumber = s.MaterialNumber, + MaterialName = _erpBasicDataExtendService.GetMaterialName(materials, s.MaterialNumber), + BarCode = _erpBasicDataExtendService.GetMaterialBarCode(materials, s.MaterialNumber), + SerialNumber = s.SerialNumber, + IsUseNumber = s.IsUseNumber, + NumberCode = s.NumberCode, + TwoSerialNumber=s.TwoSerialNumber.Replace(s.SerialNumber,"").Replace(",","") + }).Skip((dto.PageNo - 1) * dto.PageSize).Take(dto.PageSize).ToListAsync(); + return (list, total); + } + + public async Task?> GetEntityList(string serialNumber, string orgCode, LoginInDto loginInfo) + { + var materials_result = await _erpService.BillQueryForMaterial(); + List materials = new List(); + if (materials_result.IsSuccess) + materials = materials_result.Data.ToList(); + + var query = _context.SerialNumbers.AsNoTracking().Where(w => 1 == 1); + + //if (loginInfo.UserInfo.IsAdmin != true && !string.IsNullOrEmpty(orgCode)) + //{ + // var rec_type = orgCode.Substring(0, 1); + // var rec_code = orgCode.Substring(2, orgCode.Length - 2); + + // if (rec_type.Equals("s"))//渚涘簲鍟 + // query = query.Where(w => rec_code == w.SupplierCode); + // else//鏌ュ叾浠栧崟鎹(缁勭粐) + // query = query.Where(w => rec_code == w.OrgCode); + //} + + + query = query.Where(f => f.SerialNumber.Equals(serialNumber) + || f.NumberCode.Equals(serialNumber)); + + var entity = await query.FirstOrDefaultAsync(); + if (entity == null) return null; + + ////濡傛灉涓哄崟濂椾骇鍝侊紝閭e氨鐩存帴鍙栧氨琛屼簡銆 + if (entity.IsTwo < 2) + { + List list = new List(); + SerialNumbersResponse s=new SerialNumbersResponse(); + s.BoxId = entity.BoxId; + s.IsCarton = (entity.BoxId > 0 || entity.IsUse == true) ? true : false; + s.IsOldData = false;//鏍规嵁搴忓垪鍙疯幏鍙 榛樿鏄痜alse + s.Specifications = _erpBasicDataExtendService.GetMaterialSpecifications(materials, entity.MaterialNumber); + s.MaterialNumber = entity.MaterialNumber; + s.MaterialName = _erpBasicDataExtendService.GetMaterialName(materials, entity.MaterialNumber); + s.BarCode = _erpBasicDataExtendService.GetMaterialBarCode(materials, entity.MaterialNumber); + s.SerialNumber = entity.SerialNumber; + s.IsUseNumber = entity.IsUseNumber; + s.NumberCode = entity.NumberCode; + s.IsTwo = entity.IsTwo; + s.SuitNumber = entity.SuitNumber; + list.Add(s); + return list; + + //return new SerialNumbersResponse() + //{ + // BoxId = entity.BoxId, + // IsCarton = (entity.BoxId > 0 || entity.IsUse == true) ? true : false, + // IsOldData = false,//鏍规嵁搴忓垪鍙疯幏鍙 榛樿鏄痜alse + // Specifications = _erpBasicDataExtendService.GetMaterialSpecifications(materials, entity.MaterialNumber), + // MaterialNumber = entity.MaterialNumber, + // MaterialName = _erpBasicDataExtendService.GetMaterialName(materials, entity.MaterialNumber), + // BarCode = _erpBasicDataExtendService.GetMaterialBarCode(materials, entity.MaterialNumber), + // SerialNumber = entity.SerialNumber, + // IsUseNumber = entity.IsUseNumber, + // NumberCode = entity.NumberCode, + // IsTwo = entity.IsTwo, + // SuitNumber = entity.SuitNumber + //}; + } + else//璺熸嵁濂楄鍘绘煡瀵瑰簲鐨 + { + string suitNumber = entity.SuitNumber; + + + + var query2 = _context.SerialNumbers.AsNoTracking() + //.OrderByDescending(o => o.CompleteCartonTime)//浠ヨ绠辨椂闂村厛鍚庢帓搴 + .Where(f => f.SuitNumber == suitNumber); + + int total = await query.CountAsync(); + var list = await query2.Select(s => new SerialNumbersResponse() + { + BoxId = s.BoxId, + IsCarton = (s.BoxId > 0 || s.IsUse == true) ? true : false, + IsOldData = false,//鎵鍙疯幏鍙 榛樿灏辨槸鑰佹暟鎹 + Specifications = _erpBasicDataExtendService.GetMaterialSpecifications(materials, s.MaterialNumber), + MaterialNumber = s.MaterialNumber, + MaterialName = _erpBasicDataExtendService.GetMaterialName(materials, s.MaterialNumber), + BarCode = _erpBasicDataExtendService.GetMaterialBarCode(materials, s.MaterialNumber), + SerialNumber = s.SerialNumber, + IsUseNumber = s.IsUseNumber, + NumberCode = s.NumberCode, + IsTwo = s.IsTwo, + SuitNumber = s.SuitNumber + }).ToListAsync(); + + + return list; + + + // //var query2 = _context.SerialNumbers.AsNoTracking().Where(w => 1 == 1); + // //query2 = query2.Where(f => f.SuitNumber.Equals(suitNumber) + // //); + // //var entity2 = await query2.FirstOrDefaultAsync(); + // //if (entity2 == null) return null; + + // //return new SerialNumbersResponse() + // //{ + // // BoxId = entity2.BoxId, + // // IsCarton = (entity2.BoxId > 0 || entity2.IsUse == true) ? true : false, + // // IsOldData = false,//鏍规嵁搴忓垪鍙疯幏鍙 榛樿鏄痜alse + // // Specifications = _erpBasicDataExtendService.GetMaterialSpecifications(materials, entity2.MaterialNumber), + // // MaterialNumber = entity2.MaterialNumber, + // // MaterialName = _erpBasicDataExtendService.GetMaterialName(materials, entity2.MaterialNumber), + // // BarCode = _erpBasicDataExtendService.GetMaterialBarCode(materials, entity2.MaterialNumber), + // // SerialNumber = entity2.SerialNumber, + // // IsUseNumber = entity2.IsUseNumber, + // // NumberCode = entity2.NumberCode, + // // IsTwo = entity2.IsTwo, + // // SuitNumber = entity2.SuitNumber + // //}; + + + } + } + + public async Task GetEntity(string serialNumber, string orgCode, LoginInDto loginInfo) + { + var materials_result = await _erpService.BillQueryForMaterial(); + List materials = new List(); + if (materials_result.IsSuccess) + materials = materials_result.Data.ToList(); + + var query = _context.SerialNumbers.AsNoTracking().Where(w => 1 == 1); + + //if (loginInfo.UserInfo.IsAdmin != true && !string.IsNullOrEmpty(orgCode)) + //{ + // var rec_type = orgCode.Substring(0, 1); + // var rec_code = orgCode.Substring(2, orgCode.Length - 2); + + // if (rec_type.Equals("s"))//渚涘簲鍟 + // query = query.Where(w => rec_code == w.SupplierCode); + // else//鏌ュ叾浠栧崟鎹(缁勭粐) + // query = query.Where(w => rec_code == w.OrgCode); + //} + + + query = query.Where(f => f.SerialNumber.Equals(serialNumber) + || f.NumberCode.Equals(serialNumber)); + + var entity = await query.FirstOrDefaultAsync(); + if (entity == null) return null; + + ////濡傛灉涓哄崟濂椾骇鍝侊紝閭e氨鐩存帴鍙栧氨琛屼簡銆 + //if (entity.IsTwo < 2) + //{ + return new SerialNumbersResponse() + { + BoxId = entity.BoxId, + IsCarton = (entity.BoxId > 0 || entity.IsUse == true) ? true : false, + IsOldData = false,//鏍规嵁搴忓垪鍙疯幏鍙 榛樿鏄痜alse + Specifications = _erpBasicDataExtendService.GetMaterialSpecifications(materials, entity.MaterialNumber), + MaterialNumber = entity.MaterialNumber, + MaterialName = _erpBasicDataExtendService.GetMaterialName(materials, entity.MaterialNumber), + BarCode = _erpBasicDataExtendService.GetMaterialBarCode(materials, entity.MaterialNumber), + SerialNumber = entity.SerialNumber, + IsUseNumber = entity.IsUseNumber, + NumberCode = entity.NumberCode, + IsTwo = entity.IsTwo, + SuitNumber = entity.SuitNumber, + TwoSerialNumber= entity.TwoSerialNumber.Replace(entity.SerialNumber,"").Replace(",","") + }; + //} + // else//璺熸嵁濂楄鍘绘煡瀵瑰簲鐨 + // { + // string suitNumber=entity.SuitNumber; + + + + // var query2 = _context.SerialNumbers.AsNoTracking() + // //.OrderByDescending(o => o.CompleteCartonTime)//浠ヨ绠辨椂闂村厛鍚庢帓搴 + //.Where(f => f.SuitNumber == suitNumber); + + // int total = await query.CountAsync(); + // var list = await query2.Select(s => new SerialNumbersResponse() + // { + // BoxId = s.BoxId, + // IsCarton = (s.BoxId > 0 || s.IsUse == true) ? true : false, + // IsOldData = false,//鎵鍙疯幏鍙 榛樿灏辨槸鑰佹暟鎹 + // Specifications = _erpBasicDataExtendService.GetMaterialSpecifications(materials, s.MaterialNumber), + // MaterialNumber = s.MaterialNumber, + // MaterialName = _erpBasicDataExtendService.GetMaterialName(materials, s.MaterialNumber), + // BarCode = _erpBasicDataExtendService.GetMaterialBarCode(materials, s.MaterialNumber), + // SerialNumber = s.SerialNumber, + // IsUseNumber = s.IsUseNumber, + // NumberCode = s.NumberCode + // }).ToListAsync(); + + + + + + // //var query2 = _context.SerialNumbers.AsNoTracking().Where(w => 1 == 1); + // //query2 = query2.Where(f => f.SuitNumber.Equals(suitNumber) + // //); + // //var entity2 = await query2.FirstOrDefaultAsync(); + // //if (entity2 == null) return null; + + // //return new SerialNumbersResponse() + // //{ + // // BoxId = entity2.BoxId, + // // IsCarton = (entity2.BoxId > 0 || entity2.IsUse == true) ? true : false, + // // IsOldData = false,//鏍规嵁搴忓垪鍙疯幏鍙 榛樿鏄痜alse + // // Specifications = _erpBasicDataExtendService.GetMaterialSpecifications(materials, entity2.MaterialNumber), + // // MaterialNumber = entity2.MaterialNumber, + // // MaterialName = _erpBasicDataExtendService.GetMaterialName(materials, entity2.MaterialNumber), + // // BarCode = _erpBasicDataExtendService.GetMaterialBarCode(materials, entity2.MaterialNumber), + // // SerialNumber = entity2.SerialNumber, + // // IsUseNumber = entity2.IsUseNumber, + // // NumberCode = entity2.NumberCode, + // // IsTwo = entity2.IsTwo, + // // SuitNumber = entity2.SuitNumber + // //}; + + + // } + } + /// + /// 鏉$爜鍒楄〃瀵煎嚭 + /// + /// + /// + /// + public async Task<(object obj, int total)> GetListField(SerialNumberQueryRequest dto, LoginInDto loginInfo) + { + return await GetListAsync(dto, loginInfo); + } + /// + /// 鏍规嵁绠盜d鑾峰彇搴忓垪鐮 + /// + /// + /// + public async Task> GetEntityListByBoxIds(List boxIds) + { + return await _context.SerialNumbers.AsNoTracking() + .Where(f => boxIds.Contains(f.BoxId)) + .ToListAsync(); + } + + /// + /// 鏍规嵁濂楄鐮佽幏鍙栧簭鍒楃爜 + /// + /// + /// + public async Task> GetEntityListBySuitNumber(string suitNumber) + { + return await _context.SerialNumbers.AsNoTracking() + .Where(f => f.TwoSerialNumber.Contains(suitNumber)) + .ToListAsync(); + } + + /// + /// wms绯荤粺鏌ヨ搴忓垪鐮 鏀寔鏁板瓧搴忓垪鐮 + /// + /// + /// + public async Task GetEntityWms(string serialNumbers) + { + var entity = await _context.SerialNumbers.AsNoTracking() + .FirstOrDefaultAsync(f => serialNumbers.Equals(f.SerialNumber) || serialNumbers.Equals(f.NumberCode)); + return entity; + } + + public async Task> GetEntityListContainNumber(List serialNumbers) + { + return await _context.SerialNumbers.AsNoTracking() + // .Where(f => serialNumbers.Contains(f.SerialNumber) || serialNumbers.Contains(f.NumberCode) || serialNumbers.Contains(f.TwoSerialNumber))//alter by yzh + .Where(f => serialNumbers.Contains(f.SerialNumber) || serialNumbers.Contains(f.NumberCode)) + .ToListAsync(); + } + + public async Task GetExternal(string serialNumber) + { + List mNumber = new List(); + var materials_result = await _erpService.BillQueryForMaterial(); + List materials = new List(); + if (materials_result.IsSuccess) + materials = materials_result.Data.ToList(); + + var query = _context.SerialNumbers.AsNoTracking() + .GroupJoin(_context.SerialNumberGenerateRecord, serial => serial.GenerateRecordId, sg => sg.Id, (serial, sg) => new { serial, sg }) + .SelectMany(x => x.sg.DefaultIfEmpty(), (p, sg) => new { p.serial, sg }) + .OrderByDescending(o => o.serial.Id) + .Where(f => serialNumber.Equals(f.serial.SerialNumber) || serialNumber.Equals(f.serial.NumberCode)); + + var res = await query.Select(s => new SerialNumbersExternalResponse() + { + Specifications = _erpBasicDataExtendService.GetMaterialSpecifications(materials, s.serial.MaterialNumber), + MaterialNumber = s.serial.MaterialNumber, + MaterialName = _erpBasicDataExtendService.GetMaterialName(materials, s.serial.MaterialNumber), + CreateTime = s.serial.CreateTime.DateToStringSeconds(), + PurchaseBillNo = s.sg.PurchaseBillNo, + SerialNumber = serialNumber, + Supplier = _singleDataService.GetSingleData(SingleAction.Suppliers, s.sg.CompanyId, s.serial.SupplierCode) + }).FirstOrDefaultAsync(); + + return res; + + } + } +} diff --git a/src/BarCode.Web.Repositories/TransactionRepositories.cs b/src/BarCode.Web.Repositories/TransactionRepositories.cs new file mode 100644 index 0000000..1b003a3 --- /dev/null +++ b/src/BarCode.Web.Repositories/TransactionRepositories.cs @@ -0,0 +1,47 @@ +锘縰sing Microsoft.EntityFrameworkCore.Storage; +using System; +using System.Collections.Generic; +using System.Text; +using BarCode.Web.Domain.Infrastructure; +using BarCode.Web.Repositories.Configuration; + +namespace BarCode.Web.Repositories +{ + public class TransactionRepositories: ITransactionRepositories + { + private RepositoryDbContext _context; + + + public TransactionRepositories(RepositoryDbContext context) + { + _context = context; + } + public IDbContextTransaction GetTransaction() + { + return _context.Database.BeginTransaction(); + } + + public bool CommitTransaction(bool isRollback, IDbContextTransaction transaction) + { + try + { + if (transaction == null) + return true; + + if (isRollback) + { + transaction.Rollback(); + return false; + } + transaction.Commit(); + } + catch (Exception ex) + { + transaction.Rollback(); + return false; + } + return true; + } + + } +}