fix: replace it.warehouseFk by userConfig.warehouseFk
gitea/salix/pipeline/head This commit is unstable
Details
gitea/salix/pipeline/head This commit is unstable
Details
This commit is contained in:
parent
7bf9a8c100
commit
605da52286
|
@ -148,6 +148,8 @@ module.exports = Self => {
|
|||
stmt = new ParameterizedSQL(`CALL cache.visible_refresh(@calc_id, FALSE, ?)`, [warehouse.id]);
|
||||
stmts.push(stmt);
|
||||
|
||||
const userConfig = await models.UserConfig.getUserConfig(ctx, myOptions);
|
||||
|
||||
const date = new Date();
|
||||
date.setHours(0, 0, 0, 0);
|
||||
stmt = new ParameterizedSQL(`
|
||||
|
@ -201,7 +203,7 @@ module.exports = Self => {
|
|||
LEFT JOIN cache.visible v ON v.item_id = lb.item_id
|
||||
AND v.calc_id = @calc_id
|
||||
JOIN item i ON i.id = lb.item_id
|
||||
JOIN itemType it ON it.id = i.typeFk
|
||||
JOIN itemType it ON it.id = i.typeFk AND lb.warehouse_id = ${userConfig.warehouseFk}
|
||||
JOIN buy b ON b.id = lb.buy_id
|
||||
LEFT JOIN itemCategory ic ON ic.id = it.categoryFk
|
||||
LEFT JOIN itemType t ON t.id = i.typeFk
|
||||
|
|
|
@ -86,6 +86,7 @@ module.exports = Self => {
|
|||
|
||||
Self.filter = async(ctx, filter, options) => {
|
||||
const conn = Self.dataSource.connector;
|
||||
const models = Self.app.models;
|
||||
const myOptions = {};
|
||||
|
||||
if (typeof options == 'object')
|
||||
|
@ -140,6 +141,8 @@ module.exports = Self => {
|
|||
|
||||
filter = mergeFilters(filter, {where});
|
||||
|
||||
const userConfig = await models.UserConfig.getUserConfig(ctx, myOptions);
|
||||
|
||||
const stmts = [];
|
||||
const stmt = new ParameterizedSQL(
|
||||
`SELECT
|
||||
|
@ -179,7 +182,7 @@ module.exports = Self => {
|
|||
LEFT JOIN intrastat intr ON intr.id = i.intrastatFk
|
||||
LEFT JOIN producer pr ON pr.id = i.producerFk
|
||||
LEFT JOIN origin ori ON ori.id = i.originFk
|
||||
LEFT JOIN cache.last_buy lb ON lb.item_id = i.id
|
||||
LEFT JOIN cache.last_buy lb ON lb.item_id = i.id AND lb.warehouse_id = ${userConfig.warehouseFk}
|
||||
LEFT JOIN buy b ON b.id = lb.buy_id
|
||||
LEFT JOIN entry e ON e.id = b.entryFk
|
||||
LEFT JOIN supplier s ON s.id = e.supplierFk`
|
||||
|
|
Loading…
Reference in New Issue