fix: 修改记录单关联项目没有符合预期 (#1490)

Reviewed-on: daoyoucloud/tachybase#1490
Co-authored-by: wjh <wwwjh0710@163.com>
Co-committed-by: wjh <wwwjh0710@163.com>
This commit is contained in:
wjh 2024-08-29 15:35:52 +08:00 committed by bai.zixv
parent b283363da3
commit f87250fd6e
2 changed files with 29 additions and 2 deletions

View File

@ -1,7 +1,14 @@
import Database, { CreateOptions, MagicAttributeModel, Transaction } from '@tachybase/database'; import Database, { CreateOptions, MagicAttributeModel, Transaction } from '@tachybase/database';
import { Db, Service } from '@tachybase/utils'; 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'; import validateLicensePlate from '../../utils/validateLIcensePlate';
@Service() @Service()
@ -160,7 +167,12 @@ export class RecordService {
const associatedCompanyProject = await this.db const associatedCompanyProject = await this.db
.getRepository('project') .getRepository('project')
.findOne({ where: { company_id: out_stock.company_id } }); .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) { } else if (values.category === RecordCategory.staging) {
in_stock = values.in_stock; in_stock = values.in_stock;
out_stock = values.out_stock; out_stock = values.out_stock;

View File

@ -234,4 +234,19 @@ export enum RecordTypes {
rentOutStock = '5', rentOutStock = '5',
} }
export enum ProjectCategory {
/**1:公司仓库 */
companyWarehouse = '1',
/**
* 2:项目仓库
*/
projectWarehouse = '2',
/**3:租赁客户 */
rentalCustomers = '3',
/**4:同行客户 */
peerCustomers = '4',
/**5:供应商 */
supplier = '5',
}
export const RulesNumber = 99999; export const RulesNumber = 99999;