- Chỉnh update users
- Đưa phần gọi lệnh đếm vào Task
This commit is contained in:
+32
-22
@@ -659,7 +659,19 @@ namespace SafeBagDE70
|
||||
//TempNote[1] ++;
|
||||
noteVal = cCmdRsp.recv_dat.dat[17];
|
||||
Log.Information($"Serial Value: {noteVal}");
|
||||
UpdateCountSession(countSession, noteVal);
|
||||
switch (noteVal)
|
||||
{
|
||||
case 0x00: countSession.QuantityDenomi[0]++; break;
|
||||
case 0x01: countSession.QuantityDenomi[1]++; break;
|
||||
case 0x02: countSession.QuantityDenomi[2]++; break;
|
||||
case 0x03: countSession.QuantityDenomi[3]++; break;
|
||||
case 0x04: countSession.QuantityDenomi[4]++; break;
|
||||
case 0x05: countSession.QuantityDenomi[5]++; break;
|
||||
case 0x06: countSession.QuantityDenomi[6]++; break;
|
||||
case 0x07: countSession.QuantityDenomi[7]++; break;
|
||||
case 0x08: countSession.QuantityDenomi[8]++; break;
|
||||
case 0x09: countSession.QuantityDenomi[9]++; break;
|
||||
}
|
||||
break;
|
||||
case 0x03: countSession.TempNotes[2]++; break;
|
||||
case 0x0b: countSession.TempNotes[3]++; break;
|
||||
@@ -750,27 +762,27 @@ namespace SafeBagDE70
|
||||
string currentMethod = MethodBase.GetCurrentMethod().Name;
|
||||
try
|
||||
{
|
||||
if(bOpenPort)
|
||||
{
|
||||
serialPortDE70.DiscardInBuffer();
|
||||
serialPortDE70.DiscardOutBuffer();
|
||||
|
||||
cCmdRsp.SendXXCmd((byte)Command.CMD_DE_CNTSTART);
|
||||
//if (cCmdRsp.recv_dat != null && cCmdRsp.recv_dat.dat[2] != 43) {
|
||||
//}
|
||||
|
||||
//do
|
||||
//{
|
||||
// serialPortDE70.DiscardInBuffer();
|
||||
// serialPortDE70.DiscardOutBuffer();
|
||||
// cCmdRsp.SendXXCmd((byte)Command.CMD_SENSE);
|
||||
//}
|
||||
//while (cCmdRsp.recv_dat != null && cCmdRsp.recv_dat.dat[1] == 0x09); //SR2 = 0x09 : Counting Status
|
||||
}
|
||||
|
||||
|
||||
taskCounting = Task.Run(() =>
|
||||
{
|
||||
if (bOpenPort)
|
||||
{
|
||||
serialPortDE70.DiscardInBuffer();
|
||||
serialPortDE70.DiscardOutBuffer();
|
||||
|
||||
cCmdRsp.SendXXCmd((byte)Command.CMD_DE_CNTSTART);
|
||||
if (cCmdRsp.recv_dat != null && cCmdRsp.recv_dat.dat[2] != 43)
|
||||
{
|
||||
}
|
||||
|
||||
do
|
||||
{
|
||||
serialPortDE70.DiscardInBuffer();
|
||||
serialPortDE70.DiscardOutBuffer();
|
||||
cCmdRsp.SendXXCmd((byte)Command.CMD_SENSE);
|
||||
}
|
||||
while (cCmdRsp.recv_dat != null && cCmdRsp.recv_dat.dat[1] == 0x09); //SR2 = 0x09 : Counting Status
|
||||
}
|
||||
|
||||
var str = "BEFORE COUNT";
|
||||
str+="\r\nSTORED: "+ GetQuantityFromSessions(sessions,true);
|
||||
str += "\r\nSTACKER: " + GetQuantityFromSessions(sessions, false);
|
||||
@@ -790,8 +802,6 @@ namespace SafeBagDE70
|
||||
APIModels.SendEvent(AppData.DeviceStatus);
|
||||
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user