add string param support
This commit is contained in:
parent
98341d2d80
commit
636a700a79
8 changed files with 294 additions and 35 deletions
|
|
@ -129,7 +129,7 @@ export interface ToppingList {
|
||||||
id: string;
|
id: string;
|
||||||
isUse: string;
|
isUse: string;
|
||||||
isShow: string;
|
isShow: string;
|
||||||
stringParam: string;
|
StringParam: string;
|
||||||
name: string;
|
name: string;
|
||||||
nonCashPrice: string;
|
nonCashPrice: string;
|
||||||
otherName: string;
|
otherName: string;
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,11 @@
|
||||||
<td class="m-2 px-4 py-4 font-medium text-gray-900 whitespace-nowrap">
|
<td class="m-2 px-4 py-4 font-medium text-gray-900 whitespace-nowrap">
|
||||||
<div class="flex items-center">
|
<div class="flex items-center">
|
||||||
<p>Volume= </p>
|
<p>Volume= </p>
|
||||||
<input type="text" class="input w-16" formControlName="powderGram" />
|
<input
|
||||||
|
type="text"
|
||||||
|
class="input w-16"
|
||||||
|
formControlName="powderGram"
|
||||||
|
/>
|
||||||
<p> gram</p>
|
<p> gram</p>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
|
|
@ -56,36 +60,64 @@
|
||||||
<td class="px-6 py-4 font-medium text-gray-900 whitespace-nowrap">
|
<td class="px-6 py-4 font-medium text-gray-900 whitespace-nowrap">
|
||||||
<input type="text" class="input" formControlName="name" />
|
<input type="text" class="input" formControlName="name" />
|
||||||
</td>
|
</td>
|
||||||
<td class="m-2 px-4 py-4 font-medium text-gray-900 whitespace-nowrap">
|
<td class="m-2 px-4 py-4 space-y-2 font-medium text-gray-900 whitespace-nowrap">
|
||||||
<div class="flex items-center">
|
<div class="flex items-center space-x-4">
|
||||||
|
<div
|
||||||
|
class="flex items-center rounded-md p-2"
|
||||||
|
*ngIf="isStringParamExist(i)"
|
||||||
|
|
||||||
<p>StringParam=</p>
|
>
|
||||||
<input type="text" class="input w-16" formControlName="StringParam" />
|
<div class="flex items-center bg-orange-400 rounded-md p-2" *ngFor="let param of getStringParamOfIndex(i)">
|
||||||
|
<p> </p>
|
||||||
|
<input
|
||||||
|
type="text"
|
||||||
|
class="input w-16"
|
||||||
|
placeholder="{{param.pvalue}}"
|
||||||
|
(click)="openStringParamEditor(i)"
|
||||||
|
/>
|
||||||
|
<p *ngIf="param.pkey == 'esp-v2-press-value'"> mA</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<p> </p>
|
<div class="flex items-center bg-violet-400 rounded-md p-2">
|
||||||
|
<p>Volume= </p>
|
||||||
<p>Volume= </p>
|
<input
|
||||||
<input type="text" class="input w-16" formControlName="powderGram" />
|
type="text"
|
||||||
|
class="input w-16"
|
||||||
|
formControlName="powderGram"
|
||||||
|
/>
|
||||||
<p> gram</p>
|
<p> gram</p>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex items-center" *ngIf="getTypeForRecipeListAtIndex(i)['id'] == 1002">
|
<div
|
||||||
|
class="flex items-center"
|
||||||
|
*ngIf="getTypeForRecipeListAtIndex(i)['id'] == 1002"
|
||||||
|
>
|
||||||
<p>Hot= </p>
|
<p>Hot= </p>
|
||||||
<input type="text" class="input w-16" formControlName="waterYield" />
|
<input
|
||||||
|
type="text"
|
||||||
|
class="input w-16"
|
||||||
|
formControlName="waterYield"
|
||||||
|
/>
|
||||||
<p> ml </p>
|
<p> ml </p>
|
||||||
<p>Grinder= </p><input type="text" class="input w-16" formControlName="stirTime" /><p> sec</p>
|
<p>Grinder= </p>
|
||||||
|
<input type="text" class="input w-16" formControlName="stirTime" />
|
||||||
|
<p> sec</p>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<!-- others -->
|
<!-- others -->
|
||||||
<div *ngIf="(isNotExistbyCatagories(getTypeForRecipeListAtIndex(i)['id']) || isEquipment(getTypeForRecipeListAtIndex(i)['id']))">
|
<div
|
||||||
|
*ngIf="
|
||||||
|
isNotExistbyCatagories(getTypeForRecipeListAtIndex(i)['id']) ||
|
||||||
|
isEquipment(getTypeForRecipeListAtIndex(i)['id'])
|
||||||
|
"
|
||||||
|
>
|
||||||
<td class="px-6 py-4 font-medium text-gray-900 whitespace-nowrap">
|
<td class="px-6 py-4 font-medium text-gray-900 whitespace-nowrap">
|
||||||
<input type="text" class="input" formControlName="name" />
|
<input type="text" class="input" formControlName="name" />
|
||||||
</td>
|
</td>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|
@ -124,3 +156,33 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
|
<!-- show string param modal -->
|
||||||
|
|
||||||
|
<input
|
||||||
|
type="checkbox"
|
||||||
|
id="string_param_selector"
|
||||||
|
class="modal-toggle"
|
||||||
|
#checkBox="ngModel"
|
||||||
|
[(ngModel)]="showStringParamSelector"
|
||||||
|
/>
|
||||||
|
<label for="string_param_selector" class="modal">
|
||||||
|
<div class="modal-box max-h-[400px] overflow-scroll" [formGroup]="stringParamForm">
|
||||||
|
<div formArrayName="stringParamData" *ngFor="let paramAtIdx of stringParamData.controls; let isdx = index">
|
||||||
|
<div *ngIf="isdx == currentSelectStringParam" formGroupName="{{ isdx }}">
|
||||||
|
<!-- show input -->
|
||||||
|
<p class="flex top-0 right-0 justify-end font-bold text-xs m-2">isdx={{isdx}}</p>
|
||||||
|
<div *ngFor="let param of stringParamControlAtIdx.controls; let idx = index">
|
||||||
|
<!-- <p>idx={{idx}}</p> -->
|
||||||
|
<div formGroupName="{{ idx }}" class="flex items-center p-2 space-x-4">
|
||||||
|
<!-- <input type="text" class="input input-disabled" formControlName="pkey" [disabled]="true"/> -->
|
||||||
|
<p>{{alterStringParamDisplayName(param.value.pkey)}}</p>
|
||||||
|
<input type="text" class="input bg-slate-400" formControlName="pvalue" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</label>
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ import { UserService } from 'src/app/core/services/user.service';
|
||||||
import { Action, ActionRecord } from 'src/app/shared/actionRecord/actionRecord';
|
import { Action, ActionRecord } from 'src/app/shared/actionRecord/actionRecord';
|
||||||
import { FormsModule } from '@angular/forms';
|
import { FormsModule } from '@angular/forms';
|
||||||
import { NgSelectModule } from '@ng-select/ng-select';
|
import { NgSelectModule } from '@ng-select/ng-select';
|
||||||
import { getMaterialType, getCategories, isNonMaterial } from 'src/app/shared/helpers/mat_type';
|
import { getMaterialType, getCategories, isNonMaterial, StringParam, stringParamsDefinition } from 'src/app/shared/helpers/recipe';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-recipe-list',
|
selector: 'app-recipe-list',
|
||||||
|
|
@ -47,6 +47,24 @@ export class RecipeListComponent implements OnInit {
|
||||||
|
|
||||||
categoriedMaterial: { [key: string]: { id: number; name: string }[] } = {};
|
categoriedMaterial: { [key: string]: { id: number; name: string }[] } = {};
|
||||||
|
|
||||||
|
// ------------------------------------------------------------------------
|
||||||
|
// string params
|
||||||
|
stringParams: {
|
||||||
|
[key: number]: {
|
||||||
|
pkey: string;
|
||||||
|
pvalue: any;
|
||||||
|
}[];
|
||||||
|
} = {};
|
||||||
|
showStringParamSelector: boolean = false;
|
||||||
|
currentSelectStringParam: number | null = null;
|
||||||
|
|
||||||
|
stringParamForm = this._formBuilder.group({
|
||||||
|
stringParamData: this._formBuilder.array<{
|
||||||
|
pkey: string;
|
||||||
|
pvalue: any;
|
||||||
|
}[]>([]),
|
||||||
|
}, { updateOn: 'blur' });
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private _recipeService: RecipeService,
|
private _recipeService: RecipeService,
|
||||||
private _materialService: MaterialService,
|
private _materialService: MaterialService,
|
||||||
|
|
@ -70,6 +88,31 @@ export class RecipeListComponent implements OnInit {
|
||||||
.subscribe(({ result }) => {
|
.subscribe(({ result }) => {
|
||||||
this._recipeListOriginalArray = result;
|
this._recipeListOriginalArray = result;
|
||||||
result.forEach((recipeDetailMat: RecipeDetailMat) => {
|
result.forEach((recipeDetailMat: RecipeDetailMat) => {
|
||||||
|
|
||||||
|
// StringParam
|
||||||
|
if(recipeDetailMat.StringParam != "" || recipeDetailMat.StringParam != null) {
|
||||||
|
let currStringParam = new StringParam(recipeDetailMat.StringParam);
|
||||||
|
let stringParamList = currStringParam.extract().as_list();
|
||||||
|
|
||||||
|
let stringParamListTransform = [];
|
||||||
|
for(let param of stringParamList) {
|
||||||
|
stringParamListTransform.push(this._formBuilder.group({
|
||||||
|
pkey: [
|
||||||
|
{ value: param.pkey, disabled: !this.isEditable() },
|
||||||
|
],
|
||||||
|
pvalue: [
|
||||||
|
{ value: param.pvalue, disabled: !this.isEditable() },
|
||||||
|
]
|
||||||
|
}))
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
this.stringParamData.push(this._formBuilder.array(stringParamListTransform));
|
||||||
|
|
||||||
|
// console.log("string param", this.stringParamData.at(6));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
this.recipeListData.push(
|
this.recipeListData.push(
|
||||||
this._formBuilder.group({
|
this._formBuilder.group({
|
||||||
StringParam: [
|
StringParam: [
|
||||||
|
|
@ -142,6 +185,8 @@ export class RecipeListComponent implements OnInit {
|
||||||
this.isMatLoaded = true;
|
this.isMatLoaded = true;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
console.log("string param form",this.stringParamForm);
|
||||||
|
|
||||||
this.recipeListForm.valueChanges.subscribe((value) => {
|
this.recipeListForm.valueChanges.subscribe((value) => {
|
||||||
// console.log(value.recipeListData);
|
// console.log(value.recipeListData);
|
||||||
// console.log("original recipe detail",this._recipeListOriginalArray);
|
// console.log("original recipe detail",this._recipeListOriginalArray);
|
||||||
|
|
@ -167,7 +212,7 @@ export class RecipeListComponent implements OnInit {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// TODO: make this
|
// TODO: embed this to recipelist
|
||||||
this._materialService.getMaterialCodes().subscribe((materials) => {
|
this._materialService.getMaterialCodes().subscribe((materials) => {
|
||||||
this.materialList = materials;
|
this.materialList = materials;
|
||||||
});
|
});
|
||||||
|
|
@ -183,6 +228,14 @@ export class RecipeListComponent implements OnInit {
|
||||||
return this.recipeListForm.get('recipeListData') as FormArray;
|
return this.recipeListForm.get('recipeListData') as FormArray;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get stringParamData(): FormArray {
|
||||||
|
return this.stringParamForm.get('stringParamData') as FormArray;
|
||||||
|
}
|
||||||
|
|
||||||
|
get stringParamControlAtIdx() {
|
||||||
|
return (this.stringParamData.at(this.currentSelectStringParam!) as FormArray);
|
||||||
|
}
|
||||||
|
|
||||||
isEditable() {
|
isEditable() {
|
||||||
return this._userService
|
return this._userService
|
||||||
.getCurrentUser()!
|
.getCurrentUser()!
|
||||||
|
|
@ -265,4 +318,68 @@ export class RecipeListComponent implements OnInit {
|
||||||
// exposed from mat_type.ts
|
// exposed from mat_type.ts
|
||||||
isEquipment = (materialId: number) => isNonMaterial(materialId);
|
isEquipment = (materialId: number) => isNonMaterial(materialId);
|
||||||
isNotExistbyCatagories = (materialId : number) => getMaterialType(materialId) == 'others';
|
isNotExistbyCatagories = (materialId : number) => getMaterialType(materialId) == 'others';
|
||||||
|
|
||||||
|
isStringParamExist = (i: number) => {
|
||||||
|
let rawStringParam = this.recipeListData.at(i).get('StringParam')?.value;
|
||||||
|
if(rawStringParam){
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
getStringParamOfIndex = (i: number | null) => {
|
||||||
|
let idx = i || -1;
|
||||||
|
|
||||||
|
if(idx == -1){
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
let rawStringParam = new StringParam(this.recipeListData.at(idx).get('StringParam')?.value);
|
||||||
|
let params = rawStringParam.extract().as_list();
|
||||||
|
|
||||||
|
this.stringParams[idx] = params;
|
||||||
|
// console.log("string param", this.stringParams)
|
||||||
|
|
||||||
|
return params;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
getStringParam = (i: number, key: string) => {
|
||||||
|
|
||||||
|
// get param at index
|
||||||
|
let param = this.stringParams[i].find(param => {
|
||||||
|
if(param.pkey == key){
|
||||||
|
return param;
|
||||||
|
} else {
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
return param;
|
||||||
|
}
|
||||||
|
|
||||||
|
setStringParam = (i: number, key: string,event: any) => {
|
||||||
|
console.log("check on string param", this.stringParams);
|
||||||
|
|
||||||
|
let value = event.target.value;
|
||||||
|
|
||||||
|
if(value != ""){
|
||||||
|
// get param at index
|
||||||
|
this.stringParams[i].find(param => {
|
||||||
|
if(param.pkey == key){
|
||||||
|
param.pvalue = value;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
openStringParamEditor(i: any) {
|
||||||
|
console.log('open param list for ', i);
|
||||||
|
this.showStringParamSelector = true;
|
||||||
|
this.currentSelectStringParam = i;
|
||||||
|
}
|
||||||
|
|
||||||
|
alterStringParamDisplayName = (name: string) => stringParamsDefinition[name];
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -40,6 +40,52 @@ export function isNonMaterial(materialId: number) {
|
||||||
return (
|
return (
|
||||||
rangeMaterialMapping['cup'](materialId) ||
|
rangeMaterialMapping['cup'](materialId) ||
|
||||||
rangeMaterialMapping['lid'](materialId) ||
|
rangeMaterialMapping['lid'](materialId) ||
|
||||||
rangeMaterialMapping['straw'](materialId) || rangeMaterialMapping['whipper'](materialId)
|
rangeMaterialMapping['straw'](materialId) ||
|
||||||
|
rangeMaterialMapping['whipper'](materialId) ||
|
||||||
|
rangeMaterialMapping['ice'](materialId)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// StringParam
|
||||||
|
|
||||||
|
export class StringParam {
|
||||||
|
StringParam: string;
|
||||||
|
extractedParams: { [key: string]: any } = {};
|
||||||
|
|
||||||
|
|
||||||
|
constructor(StringParam: string) {
|
||||||
|
this.StringParam = StringParam;
|
||||||
|
}
|
||||||
|
|
||||||
|
extract(){
|
||||||
|
|
||||||
|
// split by ,
|
||||||
|
const params = this.StringParam.split(',');
|
||||||
|
|
||||||
|
for (const param of params) {
|
||||||
|
const [key, value] = param.split('=');
|
||||||
|
if(key != ''){
|
||||||
|
this.extractedParams[key] = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
as_list(){
|
||||||
|
let res: {pkey: string; pvalue:any}[] = [];
|
||||||
|
// iter through param
|
||||||
|
for(let p of Object.keys(this.extractedParams)){
|
||||||
|
res.push({
|
||||||
|
"pkey": p,
|
||||||
|
"pvalue": this.extractedParams[p]
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
return res
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export var stringParamsDefinition: { [key: string]: string } = {
|
||||||
|
'esp-v2-press-value': 'Current 100 x mA ( 10 - 24 )'
|
||||||
|
}
|
||||||
|
|
@ -55,6 +55,7 @@ type RecipeDetailResponse struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
type RecipeDetailMat struct {
|
type RecipeDetailMat struct {
|
||||||
|
StringParam string `json:"StringParam"`
|
||||||
IsUse bool `json:"isUse"`
|
IsUse bool `json:"isUse"`
|
||||||
MaterialID uint64 `json:"materialID"`
|
MaterialID uint64 `json:"materialID"`
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@ import (
|
||||||
"recipe-manager/helpers"
|
"recipe-manager/helpers"
|
||||||
"recipe-manager/models"
|
"recipe-manager/models"
|
||||||
"recipe-manager/services/logger"
|
"recipe-manager/services/logger"
|
||||||
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
|
@ -49,6 +50,34 @@ func NewData(taoLogger *logger.TaoLogger) *Data {
|
||||||
|
|
||||||
defaultFile := "coffeethai02_600.json"
|
defaultFile := "coffeethai02_600.json"
|
||||||
defaultCountry := "tha"
|
defaultCountry := "tha"
|
||||||
|
|
||||||
|
// read latest version
|
||||||
|
// set latest to default version
|
||||||
|
latest_version, err := strconv.Atoi(strings.Split(strings.Split(defaultFile, "_")[1], ".")[0])
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
taoLogger.Log.Debug("Error when retrieved current version", zap.Error(err))
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, v := range allRecipeFiles[defaultCountry] {
|
||||||
|
|
||||||
|
// extract filename as version
|
||||||
|
current_version_iter, err := strconv.Atoi(strings.Split(strings.Split(v.Name, "_")[1], ".")[0])
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
if current_version_iter > latest_version {
|
||||||
|
// taoLogger.Log.Debug("current_version_iter", zap.Any("current_version_iter", current_version_iter))
|
||||||
|
// set latest
|
||||||
|
latest_version = current_version_iter
|
||||||
|
defaultFile = v.Name
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
taoLogger.Log.Debug("defaultFile", zap.Any("defaultFile", defaultFile), zap.Any("latest_version", latest_version))
|
||||||
|
|
||||||
defaultRecipe, err := helpers.ReadRecipeFile(defaultCountry, defaultFile)
|
defaultRecipe, err := helpers.ReadRecipeFile(defaultCountry, defaultFile)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
@ -172,6 +201,8 @@ func (d *Data) GetRecipe01ByProductCode(filename, countryID, productCode string)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
d.taoLogger.Log.Debug("GetRecipe01ByProductCode", zap.Any("productCode", productCode), zap.Any("version", recipe.MachineSetting.ConfigNumber))
|
||||||
|
|
||||||
d.currentRecipe = recipe
|
d.currentRecipe = recipe
|
||||||
|
|
||||||
// save to map
|
// save to map
|
||||||
|
|
|
||||||
|
|
@ -63,7 +63,6 @@ type Recipe01 struct {
|
||||||
OnTOP bool `json:"OnTOP"`
|
OnTOP bool `json:"OnTOP"`
|
||||||
LastChange string `json:"LastChange"`
|
LastChange string `json:"LastChange"`
|
||||||
MenuStatus int `json:"MenuStatus"`
|
MenuStatus int `json:"MenuStatus"`
|
||||||
RemainingCups json.Number `json:"RemainingCups"`
|
|
||||||
StringParam string `json:"StringParam"`
|
StringParam string `json:"StringParam"`
|
||||||
TextForWarningBeforePay []string `json:"TextForWarningBeforePay"`
|
TextForWarningBeforePay []string `json:"TextForWarningBeforePay"`
|
||||||
CashPrice int `json:"cashPrice"`
|
CashPrice int `json:"cashPrice"`
|
||||||
|
|
@ -104,18 +103,19 @@ func (r *Recipe01) FromMap(m map[string]interface{}) Recipe01 {
|
||||||
}
|
}
|
||||||
|
|
||||||
type MatRecipe struct {
|
type MatRecipe struct {
|
||||||
MixOrder int `json:"MixOrder"`
|
StringParam string `json:"StringParam"`
|
||||||
FeedParameter int `json:"FeedParameter"`
|
MixOrder int `json:"MixOrder"`
|
||||||
FeedPattern int `json:"FeedPattern"`
|
FeedParameter int `json:"FeedParameter"`
|
||||||
IsUse bool `json:"isUse"`
|
FeedPattern int `json:"FeedPattern"`
|
||||||
MaterialPathId int `json:"materialPathId"`
|
IsUse bool `json:"isUse"`
|
||||||
PowderGram int `json:"powderGram"`
|
MaterialPathId int `json:"materialPathId"`
|
||||||
PowderTime int `json:"powderTime"`
|
PowderGram int `json:"powderGram"`
|
||||||
StirTime int `json:"stirTime"`
|
PowderTime int `json:"powderTime"`
|
||||||
SyrupGram int `json:"syrupGram"`
|
StirTime int `json:"stirTime"`
|
||||||
SyrupTime int `json:"syrupTime"`
|
SyrupGram int `json:"syrupGram"`
|
||||||
WaterCold int `json:"waterCold"`
|
SyrupTime int `json:"syrupTime"`
|
||||||
WaterYield int `json:"waterYield"`
|
WaterCold int `json:"waterCold"`
|
||||||
|
WaterYield int `json:"waterYield"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type ToppingSet struct {
|
type ToppingSet struct {
|
||||||
|
|
@ -152,7 +152,7 @@ type ToppingList struct {
|
||||||
ID int `json:"id"`
|
ID int `json:"id"`
|
||||||
IsUse bool `json:"isUse"`
|
IsUse bool `json:"isUse"`
|
||||||
IsShow bool `json:"isShow"`
|
IsShow bool `json:"isShow"`
|
||||||
StringParam string `json:"stringParam"`
|
StringParam string `json:"StringParam"`
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
NonCashPrice int `json:"nonCashPrice"`
|
NonCashPrice int `json:"nonCashPrice"`
|
||||||
OtherName string `json:"otherName"`
|
OtherName string `json:"otherName"`
|
||||||
|
|
|
||||||
|
|
@ -117,12 +117,13 @@ func (rs *recipeService) GetRecipeDetailMat(request *contracts.RecipeDetailReque
|
||||||
break
|
break
|
||||||
} else if mat.MaterialName != "" {
|
} else if mat.MaterialName != "" {
|
||||||
mat_name = mat.MaterialName
|
mat_name = mat.MaterialName
|
||||||
fmt.Println("SetMat", mat_name)
|
// fmt.Println("SetMat", mat_name)
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
result.Result = append(result.Result, contracts.RecipeDetailMat{
|
result.Result = append(result.Result, contracts.RecipeDetailMat{
|
||||||
|
StringParam: v.StringParam,
|
||||||
IsUse: v.IsUse,
|
IsUse: v.IsUse,
|
||||||
MaterialID: mat.ID,
|
MaterialID: mat.ID,
|
||||||
Name: mat_name,
|
Name: mat_name,
|
||||||
|
|
@ -147,6 +148,7 @@ func (rs *recipeService) GetRecipeDetailMat(request *contracts.RecipeDetailReque
|
||||||
if len(result.Result) < 30 {
|
if len(result.Result) < 30 {
|
||||||
for i := len(result.Result); i < 30; i++ {
|
for i := len(result.Result); i < 30; i++ {
|
||||||
result.Result = append(result.Result, contracts.RecipeDetailMat{
|
result.Result = append(result.Result, contracts.RecipeDetailMat{
|
||||||
|
StringParam: "",
|
||||||
IsUse: false,
|
IsUse: false,
|
||||||
MaterialID: 0,
|
MaterialID: 0,
|
||||||
Name: "",
|
Name: "",
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue