add recipe viewer

This commit is contained in:
Kenta420 2024-02-21 15:17:54 +07:00
parent 92b11f7b9d
commit f7f1535695
31 changed files with 1532 additions and 151 deletions

View file

@ -9,3 +9,203 @@ export const recipeDashboardSchema = z.object({
image: z.string().nullable()
})
export type RecipeDashboard = z.infer<typeof recipeDashboardSchema>
export const matRecipeSchema = z.object({
StringParam: z.string().nullable().or(z.undefined()),
MixOrder: z.number(),
FeedParameter: z.number(),
FeedPattern: z.number(),
isUse: z.boolean(),
materialPathId: z.number(),
powderGram: z.number(),
powderTime: z.number(),
stirTime: z.number(),
syrupGram: z.number(),
syrupTime: z.number(),
waterCold: z.number(),
waterYield: z.number()
})
export type MatRecipe = z.infer<typeof matRecipeSchema>
export const toppingSetSchema = z.object({
ListGroupID: z.array(z.number()).or(z.undefined()),
defaultIDSelect: z.number(),
groupID: z.string().or(z.undefined()),
isUse: z.boolean()
})
export type ToppingSet = z.infer<typeof toppingSetSchema>
const recipe01WithoutSubSchema = z.object({
Description: z.string().or(z.undefined()),
ExtendID: z.number(),
OnTOP: z.boolean(),
LastChange: z.string().pipe(z.coerce.date()).or(z.undefined()),
MenuStatus: z.number(),
StringParam: z.string().nullable().or(z.undefined()),
TextForWarningBeforePay: z.array(z.string()).or(z.undefined()),
cashPrice: z.number(),
changerecipe: z.string().or(z.undefined()),
disable: z.boolean(),
disable_by_cup: z.boolean(),
disable_by_ice: z.boolean(),
EncoderCount: z.number(),
id: z.number(),
isUse: z.boolean(),
isShow: z.boolean(),
name: z.string().or(z.undefined()),
nonCashPrice: z.number(),
otherDescription: z.string().or(z.undefined()),
otherName: z.string().or(z.undefined()),
productCode: z.string(),
recipes: z.array(matRecipeSchema),
ToppingSet: z.array(toppingSetSchema),
total_time: z.number(),
total_weight: z.number(),
uriData: z.string().or(z.undefined()),
useGram: z.boolean(),
weight_float: z.number()
})
export const recipe01Schema = z.object({
Description: z.string().or(z.undefined()),
ExtendID: z.number(),
OnTOP: z.boolean(),
LastChange: z.string().pipe(z.coerce.date()).or(z.undefined()),
MenuStatus: z.number(),
StringParam: z.string().nullable().or(z.undefined()),
TextForWarningBeforePay: z.array(z.string()).or(z.undefined()),
cashPrice: z.number(),
changerecipe: z.string().or(z.undefined()),
disable: z.boolean(),
disable_by_cup: z.boolean(),
disable_by_ice: z.boolean(),
EncoderCount: z.number(),
id: z.number(),
isUse: z.boolean(),
isShow: z.boolean(),
name: z.string().or(z.undefined()),
nonCashPrice: z.number(),
otherDescription: z.string().or(z.undefined()),
otherName: z.string().or(z.undefined()),
productCode: z.string(),
recipes: z.array(matRecipeSchema),
SubMenu: z.array(recipe01WithoutSubSchema),
ToppingSet: z.array(toppingSetSchema),
total_time: z.number(),
total_weight: z.number(),
uriData: z.string().or(z.undefined()),
useGram: z.boolean(),
weight_float: z.number()
})
export type Recipe01 = z.infer<typeof recipe01Schema>
export const materialSettingSchema = z.object({
materialName: z.string(),
materialId: z.number().or(z.undefined()),
materialOtherName: z.string(),
RawMaterialUnit: z.string().or(z.undefined()),
IceScreamBingsuChannel: z.boolean(),
StringParam: z.string().nullable().or(z.undefined()),
AlarmIDWhenOffline: z.number(),
BeanChannel: z.boolean(),
CanisterType: z.string().or(z.undefined()),
DrainTimer: z.number(),
IsEquipment: z.boolean(),
LeavesChannel: z.boolean(),
LowToOffline: z.number(),
MaterialStatus: z.number(),
PowderChannel: z.boolean(),
RefillUnitGram: z.boolean(),
RefillUnitMilliliters: z.boolean(),
RefillUnitPCS: z.boolean(),
ScheduleDrainType: z.number(),
SodaChannel: z.boolean(),
StockAdjust: z.string().or(z.undefined()),
SyrupChannel: z.boolean(),
id: z.number(),
idAlternate: z.number(),
isUse: z.boolean(),
pay_rettry_max_count: z.number(),
feed_mode: z.string().or(z.undefined()),
MaterialParameter: z.string().or(z.undefined())
})
export type MaterialSetting = z.infer<typeof materialSettingSchema>
export const machineSettingSchema = z.object({
RecipeTag: z.string(),
StrTextShowError: z.array(z.string().nullable()),
configNumber: z.number(),
temperatureMax: z.number(),
temperatureMin: z.number()
})
export type MachineSetting = z.infer<typeof machineSettingSchema>
export const toppingGroupSchema = z.object({
Desc: z.string().or(z.undefined()),
groupID: z.number(),
idDefault: z.number(),
idInGroup: z.string(),
inUse: z.boolean(),
name: z.string(),
otherName: z.string()
})
export type ToppingGroup = z.infer<typeof toppingGroupSchema>
export const toppingListSchema = z.object({
Extends: z.string().or(z.undefined()),
OnTOP: z.boolean(),
MenuStatus: z.number(),
cashPrice: z.number(),
disable: z.boolean(),
disable_by_cup: z.boolean(),
disable_by_ice: z.boolean(),
EncoderCount: z.number(),
id: z.number(),
isUse: z.boolean(),
isShow: z.boolean(),
StringParam: z.string().nullable().or(z.undefined()),
name: z.string().or(z.undefined()),
nonCashPrice: z.number(),
otherName: z.string().or(z.undefined()),
productCode: z.string().or(z.undefined()),
recipes: z.array(matRecipeSchema),
total_time: z.number(),
total_weight: z.number(),
useGram: z.boolean(),
weight_float: z.number()
})
export type ToppingList = z.infer<typeof toppingListSchema>
export const toppingSchema = z.object({
ToppingGroup: z.array(toppingGroupSchema),
ToppingList: z.array(toppingListSchema)
})
export type Topping = z.infer<typeof toppingSchema>
export const materialCodeSchema = z.object({
PackageDescription: z.string().or(z.undefined()),
RefillValuePerStep: z.number(),
materialID: z.number(),
materialCode: z.string().or(z.undefined())
})
export type MaterialCode = z.infer<typeof materialCodeSchema>
export const recipesSchema = z.object({
Timestamp: z.string(),
Recipe01: z.array(recipe01Schema),
MachineSetting: machineSettingSchema,
Topping: toppingSchema,
MaterialCode: z.array(materialCodeSchema),
MaterialSetting: z.array(materialSettingSchema)
})
export type Recipes = z.infer<typeof recipesSchema>