Compare commits
No commits in common. "e45d43e96e5ab5fc3de701fab61536378cf6fc22" and "1a1f7c8515cbdb040847a9fd95ab9760f3632fa2" have entirely different histories.
e45d43e96e
...
1a1f7c8515
|
|
@ -83,10 +83,6 @@ export class QueryOrderDTO {
|
||||||
@ApiProperty({ type: 'enum', enum: ErpOrderStatus })
|
@ApiProperty({ type: 'enum', enum: ErpOrderStatus })
|
||||||
@Rule(RuleType.string().valid(...Object.values(ErpOrderStatus)))
|
@Rule(RuleType.string().valid(...Object.values(ErpOrderStatus)))
|
||||||
status: ErpOrderStatus;
|
status: ErpOrderStatus;
|
||||||
|
|
||||||
@ApiProperty()
|
|
||||||
@Rule(RuleType.string())
|
|
||||||
payment_method: string;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export class QueryOrderSalesDTO {
|
export class QueryOrderSalesDTO {
|
||||||
|
|
|
||||||
|
|
@ -51,18 +51,6 @@ export class QueryStockRecordDTO {
|
||||||
@ApiProperty()
|
@ApiProperty()
|
||||||
@Rule(RuleType.string())
|
@Rule(RuleType.string())
|
||||||
productName: string;
|
productName: string;
|
||||||
|
|
||||||
@ApiProperty()
|
|
||||||
@Rule(RuleType.string())
|
|
||||||
operationType: string;
|
|
||||||
|
|
||||||
@ApiProperty()
|
|
||||||
@Rule(RuleType.date())
|
|
||||||
startDate: Date;
|
|
||||||
|
|
||||||
@ApiProperty()
|
|
||||||
@Rule(RuleType.date())
|
|
||||||
endDate: Date;
|
|
||||||
}
|
}
|
||||||
export class QueryPurchaseOrderDTO {
|
export class QueryPurchaseOrderDTO {
|
||||||
@ApiProperty({ example: '1', description: '页码' })
|
@ApiProperty({ example: '1', description: '页码' })
|
||||||
|
|
|
||||||
|
|
@ -549,7 +549,6 @@ export class OrderService {
|
||||||
current,
|
current,
|
||||||
pageSize,
|
pageSize,
|
||||||
customer_email,
|
customer_email,
|
||||||
payment_method,
|
|
||||||
}, userId = undefined) {
|
}, userId = undefined) {
|
||||||
const parameters: any[] = [];
|
const parameters: any[] = [];
|
||||||
|
|
||||||
|
|
@ -572,7 +571,6 @@ export class OrderService {
|
||||||
o.customer_note as customer_note,
|
o.customer_note as customer_note,
|
||||||
o.shipping as shipping,
|
o.shipping as shipping,
|
||||||
o.billing as billing,
|
o.billing as billing,
|
||||||
o.payment_method as payment_method,
|
|
||||||
cs.order_count as order_count,
|
cs.order_count as order_count,
|
||||||
cs.total_spent as total_spent,
|
cs.total_spent as total_spent,
|
||||||
COALESCE(
|
COALESCE(
|
||||||
|
|
@ -634,10 +632,6 @@ export class OrderService {
|
||||||
totalQuery += ` AND o.date_created <= ?`;
|
totalQuery += ` AND o.date_created <= ?`;
|
||||||
parameters.push(endDate);
|
parameters.push(endDate);
|
||||||
}
|
}
|
||||||
if (payment_method) {
|
|
||||||
sqlQuery += ` AND o.payment_method like "%${payment_method}%" `;
|
|
||||||
totalQuery += ` AND o.payment_method like "%${payment_method}%" `;
|
|
||||||
}
|
|
||||||
const user = await this.userModel.findOneBy({id: userId});
|
const user = await this.userModel.findOneBy({id: userId});
|
||||||
if (user?.permissions?.includes('order-10-days')) {
|
if (user?.permissions?.includes('order-10-days')) {
|
||||||
sqlQuery += ` AND o.date_created >= ?`;
|
sqlQuery += ` AND o.date_created >= ?`;
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
import { Provide } from '@midwayjs/core';
|
import { Provide } from '@midwayjs/core';
|
||||||
import { Between, Like, Repository, LessThan, MoreThan } from 'typeorm';
|
import { Between, Like, Repository } from 'typeorm';
|
||||||
import { Stock } from '../entity/stock.entity';
|
import { Stock } from '../entity/stock.entity';
|
||||||
import { StockRecord } from '../entity/stock_record.entity';
|
import { StockRecord } from '../entity/stock_record.entity';
|
||||||
import { paginate } from '../utils/paginate.util';
|
import { paginate } from '../utils/paginate.util';
|
||||||
|
|
@ -350,18 +350,11 @@ export class StockService {
|
||||||
stockPointId,
|
stockPointId,
|
||||||
productSku,
|
productSku,
|
||||||
productName,
|
productName,
|
||||||
operationType,
|
|
||||||
startDate,
|
|
||||||
endDate,
|
|
||||||
} = query;
|
} = query;
|
||||||
|
|
||||||
const where: any = {};
|
const where: any = {};
|
||||||
if (stockPointId) where.stockPointId = stockPointId;
|
if (stockPointId) where.stockPointId = stockPointId;
|
||||||
if (productSku) where.productSku = productSku;
|
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
|
const queryBuilder = this.stockRecordModel
|
||||||
.createQueryBuilder('stock_record')
|
.createQueryBuilder('stock_record')
|
||||||
.leftJoin(Product, 'product', 'product.sku = stock_record.productSku')
|
.leftJoin(Product, 'product', 'product.sku = stock_record.productSku')
|
||||||
|
|
|
||||||
|
|
@ -240,6 +240,7 @@ export class WPService {
|
||||||
manage_stock: false, // 为true的时候,用quantity控制库存,为false时,直接用stock_status控制
|
manage_stock: false, // 为true的时候,用quantity控制库存,为false时,直接用stock_status控制
|
||||||
stock_status,
|
stock_status,
|
||||||
});
|
});
|
||||||
|
console.log('res', res);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue