Improvement: 库存记录增加筛选 #18
|
|
@ -51,6 +51,18 @@ export class QueryStockRecordDTO {
|
|||
@ApiProperty()
|
||||
@Rule(RuleType.string())
|
||||
productName: string;
|
||||
|
||||
@ApiProperty()
|
||||
@Rule(RuleType.string())
|
||||
operationType: string;
|
||||
|
||||
@ApiProperty()
|
||||
@Rule(RuleType.date())
|
||||
startDate: Date;
|
||||
|
||||
@ApiProperty()
|
||||
@Rule(RuleType.date())
|
||||
endDate: Date;
|
||||
}
|
||||
export class QueryPurchaseOrderDTO {
|
||||
@ApiProperty({ example: '1', description: '页码' })
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { Provide } from '@midwayjs/core';
|
||||
import { Between, Like, Repository } from 'typeorm';
|
||||
import { Between, Like, Repository, LessThan, MoreThan } from 'typeorm';
|
||||
import { Stock } from '../entity/stock.entity';
|
||||
import { StockRecord } from '../entity/stock_record.entity';
|
||||
import { paginate } from '../utils/paginate.util';
|
||||
|
|
@ -350,11 +350,18 @@ export class StockService {
|
|||
stockPointId,
|
||||
productSku,
|
||||
productName,
|
||||
operationType,
|
||||
startDate,
|
||||
endDate,
|
||||
} = query;
|
||||
|
||||
const where: any = {};
|
||||
if (stockPointId) where.stockPointId = stockPointId;
|
||||
if (productSku) where.productSku = productSku;
|
||||
if (operationType) where.operationType = operationType;
|
||||
if (startDate) where.createdAt = MoreThan(startDate);
|
||||
if (endDate) where.createdAt = LessThan(endDate);
|
||||
if (startDate && endDate) where.createdAt = Between(startDate, endDate);
|
||||
const queryBuilder = this.stockRecordModel
|
||||
.createQueryBuilder('stock_record')
|
||||
.leftJoin(Product, 'product', 'product.sku = stock_record.productSku')
|
||||
|
|
|
|||
|
|
@ -240,7 +240,6 @@ export class WPService {
|
|||
manage_stock: false, // 为true的时候,用quantity控制库存,为false时,直接用stock_status控制
|
||||
stock_status,
|
||||
});
|
||||
console.log('res', res);
|
||||
return res;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue