add: New Gen Price & Gen PriceSlot
This commit is contained in:
parent
c6b528d5eb
commit
be0dfb7f63
5 changed files with 361 additions and 11 deletions
|
|
@ -325,7 +325,7 @@ export async function requestGenLayout(country: string): Promise<boolean> {
|
|||
};
|
||||
}
|
||||
|
||||
setGenLayoutGenerating();
|
||||
setGenLayoutGenerating('gen-layout');
|
||||
|
||||
logger.info('[sheetService] Sending gen-layout request for country:', country);
|
||||
|
||||
|
|
@ -344,6 +344,79 @@ export async function requestGenLayout(country: string): Promise<boolean> {
|
|||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Trigger gen-service to (re)generate the machine price profile from Grist.
|
||||
* Backend: taobin_admin app.py `gen-price` branch -> gen_price_supra.gen_price.
|
||||
* Produces profile_<C>_master.json, commits to recipe-repo, streams files back
|
||||
* (ref='gen-price') for the frontend to push to the machine.
|
||||
*/
|
||||
export async function requestGenPrice(country: string): Promise<boolean> {
|
||||
const curr_user = get(auth);
|
||||
|
||||
let user_info: any = {};
|
||||
if (curr_user) {
|
||||
user_info = {
|
||||
displayName: curr_user.displayName,
|
||||
email: curr_user.email,
|
||||
uid: curr_user.uid
|
||||
};
|
||||
}
|
||||
|
||||
setGenLayoutGenerating('gen-price');
|
||||
|
||||
logger.info('[sheetService] Sending gen-price request for country:', country);
|
||||
|
||||
return await sendMessage({
|
||||
type: 'command',
|
||||
payload: {
|
||||
user_info,
|
||||
srv_name: 'gen-service',
|
||||
values: {
|
||||
file_layout: 'sheet',
|
||||
file_desc: 'sheet',
|
||||
country: country,
|
||||
param: 'gen-price-supra_app'
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Trigger gen-service to (re)generate the per-slot price profiles from Grist.
|
||||
* Backend: taobin_admin app.py `gen-priceslot` branch -> gen_price_supra.gen_priceslot.
|
||||
* Produces profile_<C>_slot_<N>.json (ref='gen-priceslot').
|
||||
*/
|
||||
export async function requestGenPriceSlot(country: string): Promise<boolean> {
|
||||
const curr_user = get(auth);
|
||||
|
||||
let user_info: any = {};
|
||||
if (curr_user) {
|
||||
user_info = {
|
||||
displayName: curr_user.displayName,
|
||||
email: curr_user.email,
|
||||
uid: curr_user.uid
|
||||
};
|
||||
}
|
||||
|
||||
setGenLayoutGenerating('gen-priceslot');
|
||||
|
||||
logger.info('[sheetService] Sending gen-priceslot request for country:', country);
|
||||
|
||||
return await sendMessage({
|
||||
type: 'command',
|
||||
payload: {
|
||||
user_info,
|
||||
srv_name: 'gen-service',
|
||||
values: {
|
||||
file_layout: 'sheet',
|
||||
file_desc: 'sheet',
|
||||
country: country,
|
||||
param: 'gen-priceslot-supra_app'
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Request price data from sheet for specific product codes
|
||||
* NOTE: Can only send once per type (price). Use hasSheetPriceBeenSent to check.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue