MYS: add support for cold menu slots (change to paper cup -22-), SGP: move cashless reset & add delay to cashless cancel btn & WIP full screen video

This commit is contained in:
Pakin 2025-03-20 10:59:15 +07:00
parent b141606ecf
commit ddcb4273c5
26 changed files with 10029 additions and 6780 deletions

View file

@ -1,4 +1,13 @@
if "v2" in param:
def find_templatable_product_codes(str_pd):
# find sep `|`
str_pd_spl = str_pd.split('|')
t_pd = [pd for pd in str_pd_spl if pd != '-']
if len(t_pd) >= 1:
#
return t_pd[0]
return ""
def GenMenuProductCodeBlock(spl, 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')
@ -12,14 +21,26 @@
out_xml('\t<Height> 296 </Height>\r\n')
str_con = ""
str_con_var = ""
#print("#########################################################################################################################")
#print( str( spl))
#print("#########################################################################################################################")
# print("#########################################################################################################################")
# print( str( spl), str_hot_product_code, str_cold_product_code, str_blend_product_code)
# print("#########################################################################################################################")
#
print("check param[gcpm]:","gcpm" in param, '|' in str_cold_product_code, "gen_cold_paper_menus" in param or "gcpm" in param)
enable_gcpm = "gen_cold_paper_menus" in param or "gcpm" in param
if str_hot_product_code != '-':
str_con += str_hot_product_code + '.Button,'
if str_cold_product_code != '-':
str_con += str_cold_product_code + '.Button,'
# @Slot 12-05-02-0074.Button or 12-05-22-0074.Button,
if '|' in str_cold_product_code and enable_gcpm:
str_con += "@Slot "
genpdc = [ f"{pdc}.Button" for pdc in str_cold_product_code.split("|") if pdc != '-']
str_con += ' or '.join(genpdc) + ","
print("str_con", str_con)
else:
str_con += str_cold_product_code + '.Button,'
if str_blend_product_code != '-':
str_con += str_blend_product_code + '.Button,'
@ -27,8 +48,19 @@
if str_hot_product_code != '-':
str_con_var += str_hot_product_code + '-'
if str_cold_product_code != '-':
str_con_var += str_cold_product_code + '-'
if str_cold_product_code != '-' :
auto_var_arrs = find_templatable_product_codes(str_cold_product_code).split('-')
if '|' in str_cold_product_code:
print(find_templatable_product_codes(str_cold_product_code).split('-'), '|' not in str_cold_product_code and "gen_cold_paper_menus" not in param and "gcpm" not in param and len(find_templatable_product_codes(str_cold_product_code).split('-')) == 4)
if '|' in str_cold_product_code and len(find_templatable_product_codes(str_cold_product_code).split('-')) == 4:
auto_var_arrs[2] = "X2"
if '|' not in str_cold_product_code and "gen_cold_paper_menus" not in param and "gcpm" not in param and len(find_templatable_product_codes(str_cold_product_code).split('-')) == 4:
str_con_var += str_cold_product_code + '-'
else:
str_con_var += '-'.join(auto_var_arrs) + '-'
if str_blend_product_code != '-':
str_con_var += str_blend_product_code + '-'
@ -39,6 +71,8 @@
str_con += "$Sum" + str_con_var
print(str_con)
out_xml( '\t<State> Flag( '+ str_con + ') </State> \r\n')
pd_code_1 = str_hot_product_code
@ -53,6 +87,20 @@
pd_code_2 = pd_code_available
pd_stage2 = '"Disable2"'
if '|' in str_cold_product_code:
# always use cold pd 1
#
str_c_pd = str_cold_product_code.split('|')
first_ok_pd = ""
for c_pd in str_c_pd:
if c_pd != "-":
first_ok_pd = c_pd
break
pd_code_2 = first_ok_pd if first_ok_pd != '' else pd_code_available
pd_stage2 = '"Disable2"' if first_ok_pd == "" else ''
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:
@ -81,11 +129,29 @@
out_xml( '\t\tVar OpenFromXML = CurrentXMLFileName2\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')
if '|' in str_cold_product_code and ( "gen_cold_paper_menus" in param or "gcpm" in param) and len(find_templatable_product_codes(str_cold_product_code).split('-')) == 4:
auto_var_arrs = find_templatable_product_codes(str_cold_product_code).split('-')
# print("auto_var_arrs:PriceD2 \t", auto_var_arrs, "["+str_cold_product_code+"]")
auto_var_arrs[2] = "{XSlotPrefix}2"
out_xml( f'\t\tVar PriceD2 !assigned @AutoVar ${'-'.join(auto_var_arrs)}.Price' + '\r\n')
else:
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')
if '|' in str_cold_product_code and ("gen_cold_paper_menus" in param or "gcpm" in param) and len(find_templatable_product_codes(str_cold_product_code).split('-')) == 4:
auto_var_arrs = find_templatable_product_codes(str_cold_product_code).split('-')
# print("auto_var_arrs:PriceD2 \t", auto_var_arrs, "["+str_cold_product_code+"]")
auto_var_arrs[2] = "{XSlotPrefix}2"
out_xml( f'\t\tVar PD_CODE2 !assigned @AutoVar "{'-'.join(auto_var_arrs)}"' + '\r\n')
else:
out_xml( '\t\tVar PD_CODE2 = "' + pd_code_2 + '"\r\n')
out_xml( '\t\tVar PD_CODE3 = "' + pd_code_3 + '"\r\n')
out_xml( '\t\t; begin lang \r\n')
@ -116,7 +182,15 @@
out_xml( '\t\t; end lang \r\n')
out_xml( '\t\tVar PD_STAGE_1 = ' + pd_stage1 + '\r\n')
out_xml( '\t\tVar PD_STAGE_2 = ' + pd_stage2 + '\r\n')
if '|' in str_cold_product_code and ("gen_cold_paper_menus" in param or "gcpm" in param) and len(find_templatable_product_codes(str_cold_product_code).split('-')) == 4:
auto_var_arrs = find_templatable_product_codes(str_cold_product_code).split('-')
auto_var_arrs[2] = "{XSlotPrefix}2"
out_xml( f'\t\tVar PD_STAGE_2 !assigned @AutoVar ${'-'.join(auto_var_arrs)}.Button' + '\r\n')
else:
out_xml( '\t\tVar PD_STAGE_2 = ' + pd_stage2 + '\r\n')
out_xml( '\t\tVar PD_STAGE_3 = ' + pd_stage3 + '\r\n')
@ -144,7 +218,24 @@
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" "'+ str_cold_product_code +'"\r\n')
# spl[ idx_name][ idx_cold_product_code]
if '|' in str_cold_product_code and ( "gen_cold_paper_menus" in param or "gcpm" in param) and len(find_templatable_product_codes(str_cold_product_code).split('-')) == 4:
cold_paper_options = str_cold_product_code.split("|")
slot_t = 1
for cpo in cold_paper_options:
if cpo == "-":
continue
out_xml( f'\t\t\tIf XSlot = {slot_t} Then\r\n')
out_xml( '\t\t\t\tTopping "Load" "'+ cpo +'"\r\n')
out_xml( '\t\t\tEndIf'+'\r\n')
slot_t += 1
else:
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')
@ -310,6 +401,11 @@
shw = '"Invisible"'
ice_tab_ice_show = False
if '|' in str_cold_product_code and ice_tab_ice_show and ("gen_cold_paper_menus" in param or "gcpm" in param) and len(find_templatable_product_codes(str_cold_product_code).split('-')) == 4:
auto_var_arrs = find_templatable_product_codes(str_cold_product_code).split('-')
auto_var_arrs[2] = "{XSlotPrefix}2"
shw = f"@AutoVar ${'-'.join(auto_var_arrs)}.Button"
out_xml( '\t<Image>\r\n')
out_xml( '\t<X> 81 </X>\r\n')
out_xml( '\t<Y> 264 </Y>\r\n')
@ -335,7 +431,12 @@
if "free" in param:
out_xml( '\t<Value> "Free" </Value>\r\n')
else:
out_xml( '\t<Value> StringFmt( $' + str_cold_product_code + '.Price , DisplayFormat, PreScaleConvertShow) </Value>; test\r\n')
if '|' in str_cold_product_code and ("gen_cold_paper_menus" in param or "gcpm" in param) and len(find_templatable_product_codes(str_cold_product_code).split('-')) == 4:
auto_var_arrs = find_templatable_product_codes(str_cold_product_code).split('-')
auto_var_arrs[2] = "{XSlotPrefix}2"
out_xml( '\t<Value> @AutoVar StringFmt( $' + '-'.join(auto_var_arrs) + '.Price , DisplayFormat, PreScaleConvertShow) </Value>; test\r\n')
else:
out_xml( '\t<Value> StringFmt( $' + str_cold_product_code + '.Price , DisplayFormat, PreScaleConvertShow) </Value>; test\r\n')
else:
out_xml( '\t<Value> Var( "฿" + $' + str_cold_product_code + '.Price ) </Value>\r\n')
out_xml( '\t</Text>\r\n')
@ -416,7 +517,12 @@
out_xml( '\t\teval( \r\n')
out_xml( '\t\t\tIf $Sum' + str_con_var +' = "Disable" Then\r\n')
out_xml( '\t\t\t\tSTRCONTAIN "ERR" $' + pd_code_1 + '.TAG tag1_is_disable\r\n')
out_xml( '\t\t\t\tSTRCONTAIN "ERR" $' + pd_code_2 + '.TAG tag2_is_disable\r\n')
if '|' in str_cold_product_code and ("gen_cold_paper_menus" in param or "gcpm" in param) and len(find_templatable_product_codes(str_cold_product_code).split('-')) == 4:
auto_var_arrs = find_templatable_product_codes(str_cold_product_code).split('-')
auto_var_arrs[2] = "{XSlotPrefix}2"
out_xml( '\t\t\t\tSTRCONTAIN "ERR" $' + '-'.join(auto_var_arrs) + '.TAG tag2_is_disable\r\n')
else:
out_xml( '\t\t\t\tSTRCONTAIN "ERR" $' + pd_code_2 + '.TAG tag2_is_disable\r\n')
out_xml( '\t\t\t\tSTRCONTAIN "ERR" $' + pd_code_3 + '.TAG tag3_is_disable\r\n')
#out_xml( '\t\t\t\tDEBUGVAR $' + pd_code_1 + '.TAG\r\n')
#out_xml( '\t\t\t\tDEBUGVAR $' + pd_code_2 + '.TAG\r\n')
@ -611,13 +717,34 @@
#print(' size = ' + str( len( hot_pd)) + ' size = ' + str( len( cold_pd)) + ' size = ' + str( len( blend_pd)) + '\r\n')
list_size = len( hot_pd)
# if "gen_cold_paper_menus" in param or "gcpm" in param:
# # inject auto -22-
# has_already_paper_cup_cold = "-22-" in spl[ idx_name][ idx_cold_product_code]
# if not has_already_paper_cup_cold:
# # copy format
# copied_pd = cold_pd[0] if cold_pd[0] != '-' else cold_pd[1] if cold_pd[1] != '-' else ''
# for cpd in cold_pd:
# if cpd != '-':
# c_pd_spl = cpd.split('-')
# c_pd_spl[2] = '22'
# spl[ idx_name][ idx_cold_product_code] += ","+'-'.join(c_pd_spl)
# print("append auto -22-: ", spl[ idx_name][ idx_cold_product_code])
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(spl, hot_pd[ idx], cold_pd[ idx], blend_pd[ idx] )
print("\t\t==> gen "+"gen_cold_paper_menus" not in param +","+ "gcpm" not in param)
# if "gen_cold_paper_menus" not in param and "gcpm" not in param else spl[ idx_name][ idx_cold_product_code].replace(",", "|")
GenMenuProductCodeBlock(
spl,
hot_pd[ idx],
cold_pd[ idx] ,
blend_pd[ idx] )
else:
GenMenuBlock(spl, 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')