From f87250fd6e232f69b030792570c324db9b3ccc35 Mon Sep 17 00:00:00 2001 From: wjh Date: Thu, 29 Aug 2024 15:35:52 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E6=94=B9=E8=AE=B0=E5=BD=95?= =?UTF-8?q?=E5=8D=95=E5=85=B3=E8=81=94=E9=A1=B9=E7=9B=AE=E6=B2=A1=E6=9C=89?= =?UTF-8?q?=E7=AC=A6=E5=90=88=E9=A2=84=E6=9C=9F=20(#1490)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed-on: https://git.daoyoucloud.com/daoyoucloud/tachybase/pulls/1490 Co-authored-by: wjh Co-committed-by: wjh --- .../src/server/services/record-service.ts | 16 ++++++++++++++-- .../@hera/plugin-rental/src/utils/constants.ts | 15 +++++++++++++++ 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/packages/plugins/@hera/plugin-rental/src/server/services/record-service.ts b/packages/plugins/@hera/plugin-rental/src/server/services/record-service.ts index 11cf4ad3a..3bda5ac09 100644 --- a/packages/plugins/@hera/plugin-rental/src/server/services/record-service.ts +++ b/packages/plugins/@hera/plugin-rental/src/server/services/record-service.ts @@ -1,7 +1,14 @@ import Database, { CreateOptions, MagicAttributeModel, Transaction } from '@tachybase/database'; import { Db, Service } from '@tachybase/utils'; -import { ConversionLogics, Movement, RecordCategory, RecordTypes, settlementStatus } from '../../utils/constants'; +import { + ConversionLogics, + Movement, + ProjectCategory, + RecordCategory, + RecordTypes, + settlementStatus, +} from '../../utils/constants'; import validateLicensePlate from '../../utils/validateLIcensePlate'; @Service() @@ -160,7 +167,12 @@ export class RecordService { const associatedCompanyProject = await this.db .getRepository('project') .findOne({ where: { company_id: out_stock.company_id } }); - in_stock = associatedCompanyProject; + // + if (out_stock.category !== ProjectCategory.companyWarehouse) { + in_stock = associatedCompanyProject; + } else { + in_stock = values.in_stock; + } } else if (values.category === RecordCategory.staging) { in_stock = values.in_stock; out_stock = values.out_stock; diff --git a/packages/plugins/@hera/plugin-rental/src/utils/constants.ts b/packages/plugins/@hera/plugin-rental/src/utils/constants.ts index 8f4a4201a..ce51faa25 100644 --- a/packages/plugins/@hera/plugin-rental/src/utils/constants.ts +++ b/packages/plugins/@hera/plugin-rental/src/utils/constants.ts @@ -234,4 +234,19 @@ export enum RecordTypes { rentOutStock = '5', } +export enum ProjectCategory { + /**1:公司仓库 */ + companyWarehouse = '1', + /** + * 2:项目仓库 + */ + projectWarehouse = '2', + /**3:租赁客户 */ + rentalCustomers = '3', + /**4:同行客户 */ + peerCustomers = '4', + /**5:供应商 */ + supplier = '5', +} + export const RulesNumber = 99999;