This commit is contained in:
kong 2023-05-27 22:13:57 +07:00
parent 7c48ba4f4b
commit 074b805898
19 changed files with 14265 additions and 461 deletions

View file

@ -1,9 +1,9 @@
if "v2" in param:
def GenMenuBlock( idx_hot_product_code, idx_cold_product_code, idx_blend_product_code):
def GenMenuProductCodeBlock( str_hot_product_code, str_cold_product_code, str_blend_product_code):
print(" size " + str( len(spl)) + " img=" + spl[ idx_img][1] )
out_xml( '\t; ==================> Len = ' + str(len(spl)) + '\r\n')
menu_img = spl[ idx_img][1]
out_xml( '\t; '+ spl[ idx_name][ idx_hot_product_code] + ' ' + spl[ idx_name][ idx_cold_product_code] + ' ' + spl[ idx_name][ idx_blend_product_code]+ ' \r\n')
out_xml( '\t; '+ str_hot_product_code + ' ' + str_cold_product_code + ' ' + str_blend_product_code+ ' \r\n')
out_xml( '<Block>\r\n')
out_xml('\t<MarginLeft> 33 </MarginLeft>\r\n')
out_xml('\t<MarginTop> 22 </MarginTop>\r\n')
@ -14,23 +14,23 @@
#print("#########################################################################################################################")
#print( str( spl))
#print("#########################################################################################################################")
if spl[ idx_name][ idx_hot_product_code] != '-':
str_con += spl[ idx_name][ idx_hot_product_code] + '.Button,'
if str_hot_product_code != '-':
str_con += str_hot_product_code + '.Button,'
if spl[ idx_name][ idx_cold_product_code] != '-':
str_con += spl[ idx_name][ idx_cold_product_code] + '.Button,'
if str_cold_product_code != '-':
str_con += str_cold_product_code + '.Button,'
if spl[ idx_name][ idx_blend_product_code] != '-':
str_con += spl[ idx_name][ idx_blend_product_code] + '.Button,'
if str_blend_product_code != '-':
str_con += str_blend_product_code + '.Button,'
if spl[ idx_name][ idx_hot_product_code] != '-':
str_con_var += spl[ idx_name][ idx_hot_product_code] + '-'
if str_hot_product_code != '-':
str_con_var += str_hot_product_code + '-'
if spl[ idx_name][ idx_cold_product_code] != '-':
str_con_var += spl[ idx_name][ idx_cold_product_code] + '-'
if str_cold_product_code != '-':
str_con_var += str_cold_product_code + '-'
if spl[ idx_name][ idx_blend_product_code] != '-':
str_con_var += spl[ idx_name][ idx_blend_product_code] + '-'
if str_blend_product_code != '-':
str_con_var += str_blend_product_code + '-'
str_con_var = str_con_var.replace("-", "")
if touch_less_gen == True:
@ -40,21 +40,21 @@
out_xml( '\t<State> Flag( '+ str_con + ') </State> \r\n')
pd_code_1 = spl[ idx_name][ idx_hot_product_code]
pd_stage1 = '$' + spl[ idx_name][ idx_hot_product_code] + '.Button'
if spl[ idx_name][ idx_hot_product_code] == "-" or len(spl[ idx_name][ idx_hot_product_code]) == 0 :
pd_code_1 = str_hot_product_code
pd_stage1 = '$' + str_hot_product_code + '.Button'
if str_hot_product_code == "-" or len(str_hot_product_code) == 0 :
pd_code_1 = pd_code_available
pd_stage1 = '"Disable2"'
pd_code_2 = spl[ idx_name][ idx_cold_product_code]
pd_stage2 = '$' + spl[ idx_name][ idx_cold_product_code] + '.Button'
if spl[ idx_name][ idx_cold_product_code] == "-" or len(spl[ idx_name][ idx_cold_product_code]) == 0:
pd_code_2 = str_cold_product_code
pd_stage2 = '$' + str_cold_product_code + '.Button'
if str_cold_product_code == "-" or len(str_cold_product_code) == 0:
pd_code_2 = pd_code_available
pd_stage2 = '"Disable2"'
pd_code_3 = spl[ idx_name][ idx_blend_product_code]
pd_stage3 = '$' + spl[ idx_name][ idx_blend_product_code] + '.Button'
if spl[ idx_name][ idx_blend_product_code] == "-" or len(spl[ idx_name][ idx_blend_product_code]) == 0:
pd_code_3 = str_blend_product_code
pd_stage3 = '$' + str_blend_product_code + '.Button'
if str_blend_product_code == "-" or len(str_blend_product_code) == 0:
pd_code_3 = pd_code_available
pd_stage3 = '"Disable2"'
@ -79,9 +79,9 @@
out_xml( '\t\tVar OpenFromXML = CurrentXMLFileName2\r\n')
out_xml( '\t\tVar PriceD1 = $' + spl[ idx_name][ idx_hot_product_code] + '.Price\r\n')
out_xml( '\t\tVar PriceD2 = $' + spl[ idx_name][ idx_cold_product_code] + '.Price\r\n')
out_xml( '\t\tVar PriceD3 = $' + spl[ idx_name][ idx_blend_product_code] + '.Price\r\n')
out_xml( '\t\tVar PriceD1 = $' + str_hot_product_code + '.Price\r\n')
out_xml( '\t\tVar PriceD2 = $' + str_cold_product_code + '.Price\r\n')
out_xml( '\t\tVar PriceD3 = $' + str_blend_product_code + '.Price\r\n')
out_xml( '\t\tVar PD_CODE1 = "' + pd_code_1 + '"\r\n')
out_xml( '\t\tVar PD_CODE2 = "' + pd_code_2 + '"\r\n')
@ -143,14 +143,14 @@
out_xml( '\t\tIf PD_STAGE_2 = "Enable" Then\r\n')
#out_xml( '\t\t\tVar PD_STAGE_2 = "Enable"\r\n')
out_xml( '\t\t\tTopping "Load" "'+ spl[ idx_name][ idx_cold_product_code] +'"\r\n')
out_xml( '\t\t\tTopping "Load" "'+ str_cold_product_code +'"\r\n')
out_xml( '\t\tElse\r\n')
out_xml( '\t\t\tIf PD_STAGE_1 = "Enable" Then\r\n')
#out_xml( '\t\t\t\tVar PD_STAGE_1 = "Enable"\r\n')
out_xml( '\t\t\tTopping "Load" "'+ spl[ idx_name][ idx_hot_product_code] +'"\r\n')
out_xml( '\t\t\tTopping "Load" "'+ str_hot_product_code +'"\r\n')
out_xml( '\t\t\tElse\r\n')
#out_xml( '\t\t\t\tVar PD_STAGE_3 = "Enable"\r\n')
out_xml( '\t\t\tTopping "Load" "'+ spl[ idx_name][ idx_blend_product_code] +'"\r\n')
out_xml( '\t\t\tTopping "Load" "'+ str_blend_product_code +'"\r\n')
out_xml( '\t\t\tEndIf\r\n')
out_xml( '\t\tEndIf\r\n')
@ -241,12 +241,12 @@
out_xml( '\t</Image>\r\n')
ice_tab_hot_show = True
shw = "$" + spl[ idx_name][ idx_hot_product_code] + ".Button"
if spl[ idx_name][ idx_hot_product_code] == "-" :
shw = "$" + str_hot_product_code + ".Button"
if str_hot_product_code == "-" :
shw = '"Invisible"'
ice_tab_hot_show = False
if len(spl[ idx_name][ idx_hot_product_code]) == 0 :
if len(str_hot_product_code) == 0 :
shw = '"Invisible"'
ice_tab_hot_show = False
@ -276,19 +276,19 @@
if "free" in param:
out_xml( '\t<Value> "Free" </Value>\r\n')
else:
out_xml( '\t<Value> StringFmt( $' + spl[ idx_name][ idx_hot_product_code] + '.Price , DisplayFormat, PreScaleConvertShow) </Value>; test\r\n')
out_xml( '\t<Value> StringFmt( $' + str_hot_product_code + '.Price , DisplayFormat, PreScaleConvertShow) </Value>; test\r\n')
else:
out_xml( '\t<Value> Var( "฿" + $' + spl[ idx_name][ idx_hot_product_code] + '.Price ) </Value>\r\n')
out_xml( '\t<Value> Var( "฿" + $' + str_hot_product_code + '.Price ) </Value>\r\n')
out_xml( '\t</Text>\r\n')
ice_tab_ice_show = True
shw = "$" + spl[ idx_name][ idx_cold_product_code] + ".Button"
if spl[ idx_name][ idx_cold_product_code] == "-" :
shw = "$" + str_cold_product_code + ".Button"
if str_cold_product_code == "-" :
shw = '"Invisible"'
ice_tab_ice_show = False
if len(spl[ idx_name][ idx_cold_product_code]) == 0 :
if len(str_cold_product_code) == 0 :
shw = '"Invisible"'
ice_tab_ice_show = False
@ -313,19 +313,19 @@
if "free" in param:
out_xml( '\t<Value> "Free" </Value>\r\n')
else:
out_xml( '\t<Value> StringFmt( $' + spl[ idx_name][ idx_cold_product_code] + '.Price , DisplayFormat, PreScaleConvertShow) </Value>; test\r\n')
out_xml( '\t<Value> StringFmt( $' + str_cold_product_code + '.Price , DisplayFormat, PreScaleConvertShow) </Value>; test\r\n')
else:
out_xml( '\t<Value> Var( "฿" + $' + spl[ idx_name][ idx_cold_product_code] + '.Price ) </Value>\r\n')
out_xml( '\t<Value> Var( "฿" + $' + str_cold_product_code + '.Price ) </Value>\r\n')
out_xml( '\t</Text>\r\n')
ice_tab_blend_show = True
shw = "$" + spl[ idx_name][ idx_blend_product_code] + ".Button"
if spl[ idx_name][ idx_blend_product_code] == "-" :
shw = "$" + str_blend_product_code + ".Button"
if str_blend_product_code == "-" :
shw = '"Invisible"'
ice_tab_blend_show = False
if len(spl[ idx_name][ idx_blend_product_code]) == 0 :
if len(str_blend_product_code) == 0 :
shw = '"Invisible"'
ice_tab_blend_show = False
@ -352,9 +352,9 @@
if "free" in param:
out_xml( '\t<Value> "Free" </Value>\r\n')
else:
out_xml( '\t<Value> StringFmt( $' + spl[ idx_name][ idx_blend_product_code] + '.Price , DisplayFormat, PreScaleConvertShow) </Value>; test\r\n')
out_xml( '\t<Value> StringFmt( $' + str_blend_product_code + '.Price , DisplayFormat, PreScaleConvertShow) </Value>; test\r\n')
else:
out_xml( '\t<Value> Var( "฿" + $' + spl[ idx_name][ idx_blend_product_code] + '.Price ) </Value>\r\n')
out_xml( '\t<Value> Var( "฿" + $' + str_blend_product_code + '.Price ) </Value>\r\n')
out_xml( '\t</Text>\r\n')
out_xml( '\t<Image>\r\n')
@ -447,6 +447,10 @@
out_xml( '</Block>\r\n')
def GenMenuBlock( idx_hot_product_code, idx_cold_product_code, idx_blend_product_code):
GenMenuProductCodeBlock( spl[ idx_name][ idx_hot_product_code], spl[ idx_name][ idx_cold_product_code] , spl[ idx_name][ idx_blend_product_code] )
idx_lang_malay = 5
idx_lang_japan = 4
idx_lang_china = 3
@ -555,16 +559,33 @@
#product_code = s
#if spl[ idx_of_eng] == "IGNORE":
# continue
GenMenuBlock( idx_hot_product_code, idx_cold_product_code, idx_blend_product_code)
#out_xml( '\t; parallel '+ spl[ idx_name][ idx_hot_product_code2] + ' ' + spl[ idx_name][ idx_cold_product_code2] + ' ' + spl[ idx_name][ idx_blend_product_code2] + ' \r\n')
#print("++++++++++++++++++++++++++++++ " + str( count_test) )
#count_test = count_test + 1
#if count_test > 5 :
# break
if spl[ idx_name][ idx_hot_product_code2] != "-" or spl[ idx_name][ idx_cold_product_code2] != "-" or spl[ idx_name][ idx_blend_product_code2] != "-":
GenMenuBlock( idx_hot_product_code2, idx_cold_product_code2, idx_blend_product_code2)
out_xml( '; hurr\r\n')
print( '\t; '+ spl[ idx_name][ idx_hot_product_code] + ' ' + spl[ idx_name][ idx_cold_product_code] + ' ' + spl[ idx_name][ idx_blend_product_code] + ' \r\n')
if "," in spl[ idx_name][ idx_hot_product_code] and "," in spl[ idx_name][ idx_cold_product_code] and "," in spl[ idx_name][ idx_blend_product_code]:
#print(" hot = " + spl[ idx_name][ idx_hot_product_code])
hot_pd = spl[ idx_name][ idx_hot_product_code].split(',')
cold_pd = spl[ idx_name][ idx_cold_product_code].split(',')
blend_pd = spl[ idx_name][ idx_blend_product_code].split(',')
#print(' size = ' + str( len( hot_pd)) + ' size = ' + str( len( cold_pd)) + ' size = ' + str( len( blend_pd)) + '\r\n')
list_size = len( hot_pd)
for idx in range( list_size):
print(' hot = ' + hot_pd[ idx] + ' cold = ' + cold_pd[ idx]+ ' blend_pd = ' + blend_pd[ idx] + '\r\n')
if hot_pd[ idx] == '-' and cold_pd[ idx] == '-' and blend_pd[ idx] == '-':
print("\t\t==> ignore ")
else:
print("\t\t==> gen ")
GenMenuProductCodeBlock( hot_pd[ idx], cold_pd[ idx], blend_pd[ idx] )
else:
GenMenuBlock( idx_hot_product_code, idx_cold_product_code, idx_blend_product_code)
#out_xml( '\t; parallel '+ spl[ idx_name][ idx_hot_product_code2] + ' ' + spl[ idx_name][ idx_cold_product_code2] + ' ' + spl[ idx_name][ idx_blend_product_code2] + ' \r\n')
#print("++++++++++++++++++++++++++++++ " + str( count_test) )
#count_test = count_test + 1
#if count_test > 5 :
# break
if len( spl[idx_name] ) >= 11:
if spl[ idx_name][ idx_hot_product_code2] != "-" or spl[ idx_name][ idx_cold_product_code2] != "-" or spl[ idx_name][ idx_blend_product_code2] != "-":
GenMenuBlock( idx_hot_product_code2, idx_cold_product_code2, idx_blend_product_code2)
out_xml('</FrameScroll>\r\n')