-
Notifications
You must be signed in to change notification settings - Fork 9
/
ScanItems.mxml
169 lines (132 loc) · 5.68 KB
/
ScanItems.mxml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
<!--
Movilizer Scan screen used in Windows CE devices
-->
<MovilizerRequest
systemId="${#Project#SystemID}"
systemPassword="${#Project#Password}"
numResponses="0"
synchronousResponse="true"
useAutoAcknowledge="false"
xmlns="http://movilitas.com/movilizer/v14">
<moveletDelete moveletKey="scanItems" ignoreExtensionKey="true" />
<moveletSet>
<movelet
moveletKey="scanItems"
initialQuestionKey="q1"
moveletType="MULTI"
icon="1"
visible="true">
<!-- Complex Screen 1. Show the information about the scan item -->
<question key="q1" type="5">
<answer key="q1.a1" clientKey="ck.status" nextQuestionKey="q2" attributeType="8" columnSizeType="ROWS" position="1">
<text>%INFO%</text>
</answer>
<onEnterAssignment>
setPlaceholder("%TITLE%", $local:literals["title"]);
setPlaceholder("%INFO%", $local:literals["info"]);
$local:literals["info"] = ""; // Restart the info message after showing it
</onEnterAssignment>
<complex linearGroupId="cx.scan" linearPos="0" linearHeight="15" groupTitle="%TITLE%" />
</question>
<!-- Complex Screen 2. Scanner screen -->
<question key="q2" type="14">
<answer key="q2.a1" nextQuestionKey="q3" attributeType="14" dummyAnswer="true" />
<text>%SCAN_TEXT%</text>
<onEnterAssignment>
setPlaceholder("%SCAN_TEXT%", $local:literals["scan"]);
// External event that use a private C# scanner
call($global:handleSocketServiceEvent)("STARTSCANNER");
if (count($local:scannedItems) ?eq 0)
{
addAnswer($answer:'q2.a1', 'CK_EMPTY', $local:literals["no_items"]);
}
else
{
addAnswers($answer:'q2.a1', $local:scannedItems);
}
$local:tmp["stayInThisScreen"] = false;
</onEnterAssignment>
<onLeaveOkPrepareAssignment>
$local:tmp["item"] = getQuestionClientKey();
</onLeaveOkPrepareAssignment>
<onLeaveOkPersistAssignment>
call($global:handleSocketServiceEvent)("STOPSCANNER"); // Stop the external event scanner
</onLeaveOkPersistAssignment>
<onLeaveBackAssignment>
call($global:handleSocketServiceEvent)("STOPSCANNER"); // Stop the external event scanner
$local:tmp["item"] = null;
</onLeaveBackAssignment>
<onExternalEvent>
function($ref:evtSrc, $ref:data)
{
// External event is the private scanner event
if (evtSrc ?eq $local:literals["scanEventId"])
{
scannedItem = data["barcodeData"]; // Data is the reference of the barcode. Is an array defined on my scan driver
if (count($local:scannedItems) ?eq 0)
{
removeAnswerByClientKey($answer:'q2.a1', 'CK_EMPTY');
}
addAnswer($answer:'q2.a1', scannedItem, scannedItem);
$local:literals["info"] = concat("Scanned item: ", scannedItem);
$local:tmp["stayInThisScreen"] = true;
call($global:handleSocketServiceEvent)("TRIGGEROK"); // Private event that force an Enter in movilizer. On 2.5 there is a MEL method that allows to press enter by code
}
}
</onExternalEvent>
<complex linearGroupId="cx.scan" linearPos="1" linearHeight="15" groupTitle="%TITLE%" />
</question>
<!-- Remove item button screen -->
<question key="q3" type="6">
<answer key="q3.a1" clientKey="ck.remove" nextQuestionKey="q3" attributeType="14" columnSizeType="ROWS" position="0" valueFontStyle="BOLD" labelFontStyle="BOLD" icon="6">
<text>%REMOVE%</text>
</answer>
<answer key="q3.a2" clientKey="ck.predefined" nextQuestionKey="END" attributeType="72">
<text>0¤0¤0¤</text>
<predefinedValue>X</predefinedValue>
</answer>
<restriction nextQuestionKey="q3">
<condition>$local:tmp["stayInThisScreen"]</condition>
</restriction>
<validation position="1" type="WARNING">
<condition>strEquals(getQuestionClientKey(), "ck.remove") ?and !isBlank($local:tmp["item"])</condition>
<text>%VAL%</text>
</validation>
<onEnterAssignment>
setPlaceholder("%REMOVE%", $local:literals["remove"]);
</onEnterAssignment>
<onLeaveOkPrepareAssignment>
setPlaceholder("%VAL%", $local:literals["val"]);
</onLeaveOkPrepareAssignment>
<onLeaveOkPersistAssignment>
if (strEquals(getQuestionClientKey(), "ck.remove") ?and !isBlank($local:tmp["item"]))
{
$local:scannedItems[$local:tmp["item"]] = null;
}
$local:tmp["item"] = null;
</onLeaveOkPersistAssignment>
<complex linearGroupId="cx.scan" linearPos="2" linearHeight="15" groupTitle="%TITLE%" />
</question>
<moveletStartAssignment>
$local:literals =
{
"title" : "Scan items";
"info" : "";
"remove" : "Remove item";
"scan" : "Scan items";
"val" : "Do you want to delete the following item?";
"no_items" : "No items scanned yet";
"scanEventId" : 331;
};
$local:scannedItems = {};
$local:tmp =
{
"stayInThisScreen" : true;
"item" : null;
};
</moveletStartAssignment>
<name>Scan items</name>
</movelet>
<participant participantKey="${#DEV#ParticipantId}" name="${#DEV#ParticipantName}" deviceAddress="${#DEV#DevideAddress}" />
</moveletSet>
</MovilizerRequest>