Processing Screens
This commit is contained in:
parent
c9d6696600
commit
9f628c93bc
@ -32,6 +32,13 @@ namespace Matomat
|
||||
prod = this.findProd(prodid.id);
|
||||
if(!prod.vaild())
|
||||
return;
|
||||
this.showProdInfo(prod);
|
||||
if (prod.GetProdType() == Prod.ProdType.product)
|
||||
{
|
||||
this.sell(prod, user);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
else if (input.type == InputData.types.Prod)
|
||||
{
|
||||
@ -42,22 +49,51 @@ namespace Matomat
|
||||
}
|
||||
}
|
||||
|
||||
private void showProdInfo(Prod prod)
|
||||
private void sell(Prod prod, User user)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
private Prod findProd(int p)
|
||||
private void showProdInfo(Prod prod)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
if (prod.GetProdType() == Prod.ProdType.product)
|
||||
{
|
||||
long id = prod.GetProdId();
|
||||
double price = prod.GetProdPrice();
|
||||
string name = prod.GetProdName();
|
||||
this.lcd.print("²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²" +
|
||||
"² Produkt: " + name.PadRight(27, ' ') + " ²" +
|
||||
"² Preis: " + price.ToString(2).PadLeft(6, ' ') + "€ EAN13: " + id.ToString().PadRight(14, ' ') + " ²" +
|
||||
"²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²", 5);
|
||||
}
|
||||
if (prod.GetProdType() == Prod.ProdType.instruction)
|
||||
{
|
||||
string name = prod.GetFunctName();
|
||||
this.lcd.print("²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²" +
|
||||
"² Instruktion: " + name.PadRight(23, ' ') + " ²" +
|
||||
"² AdminCard + Instruction + TargetCard ²" +
|
||||
"²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²", 5);
|
||||
}
|
||||
}
|
||||
|
||||
private Prod findProd(long prodid)
|
||||
{
|
||||
return new Prod(prodid);
|
||||
}
|
||||
|
||||
private void showUserInfo(User user)
|
||||
{
|
||||
lcd.print("User x",5);
|
||||
string name = user.GetUserName();
|
||||
int konto = user.GetUserKonto();
|
||||
long id = user.GetUserId();
|
||||
int all = user.GetUserAll();
|
||||
lcd.print("²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²" +
|
||||
"² User: " + name.PadRight(8, ' ') + " Betrag: " + (konto.ToString() + " €").PadRight(7, ' ') + " ²" +
|
||||
"² UserID: " + id.ToString().PadRight(12, ' ') + " Gesamt: " + (all.ToString() + " €").PadRight(7, ' ') + " ²" +
|
||||
"²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²", 5);
|
||||
}
|
||||
|
||||
private User findUser(int userId)
|
||||
private User findUser(long userId)
|
||||
{
|
||||
return new User(userId);
|
||||
}
|
||||
|
@ -9,8 +9,7 @@ namespace Matomat
|
||||
{
|
||||
internal long getCodeID()
|
||||
{
|
||||
Console.ReadKey();
|
||||
return 1234567890123;
|
||||
return 4029764001807;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -51,5 +51,12 @@ namespace Matomat
|
||||
return b.Substring(start, b.Length);
|
||||
}
|
||||
}
|
||||
public static class Double
|
||||
{
|
||||
public static string ToString(this double d, int f)
|
||||
{
|
||||
return "1.00";
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -20,7 +20,7 @@ namespace Matomat
|
||||
None
|
||||
}
|
||||
public types type { get; set; }
|
||||
public int id { get; set; }
|
||||
public long id { get; set; }
|
||||
}
|
||||
class Input
|
||||
{
|
||||
@ -40,18 +40,24 @@ namespace Matomat
|
||||
static List<instance> instances;
|
||||
private InputData data;
|
||||
private RFIDReader rfid;
|
||||
private BarcodeReader code;
|
||||
public Input()
|
||||
{
|
||||
rfid = new RFIDReader();
|
||||
code = new BarcodeReader();
|
||||
}
|
||||
private void doWorkCard()
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
Thread.Sleep(1);
|
||||
char k = 'r';
|
||||
if (k == 'r')
|
||||
{
|
||||
data.id = rfid.getCardID();
|
||||
data.type = InputData.types.Card;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
private void doWorkCode()
|
||||
@ -59,6 +65,13 @@ namespace Matomat
|
||||
while (true)
|
||||
{
|
||||
Thread.Sleep(1);
|
||||
char k = Console.ReadKey(false).KeyChar;
|
||||
Console.WriteLine();
|
||||
if (k == 'b')
|
||||
{
|
||||
data.id = code.getCodeID();
|
||||
data.type = InputData.types.Prod;
|
||||
}
|
||||
}
|
||||
}
|
||||
internal InputData getAnyInput(int timeout)
|
||||
|
@ -55,11 +55,19 @@ namespace Matomat
|
||||
private Queue<Message> messages;
|
||||
private volatile bool _shouldStop;
|
||||
private SerialPort serialPort;
|
||||
private bool disable = false;
|
||||
|
||||
public LCDDisplay(Comport port)
|
||||
{
|
||||
this.serialPort = new SerialPort(port.port, port.bautrate, port.parity, port.databits, port.stopbits);
|
||||
try
|
||||
{
|
||||
this.serialPort.Open();
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
this.disable = true;
|
||||
}
|
||||
messages = new Queue<Message>();
|
||||
Thread workerThread = new Thread(this.DoWork);
|
||||
workerThread.Start();
|
||||
@ -87,9 +95,18 @@ namespace Matomat
|
||||
|
||||
private void display(string text, Status status)
|
||||
{
|
||||
if (status == Status.Warn)
|
||||
{
|
||||
Console.Beep();
|
||||
}
|
||||
if (status == Status.Error)
|
||||
{
|
||||
Console.Beep();
|
||||
Console.Beep();
|
||||
}
|
||||
Console.WriteLine(text);
|
||||
this.displayClear();
|
||||
byte[] btext = text.ToCharArray("ÄÖÜäöüß²", new byte[] { 0xE1, 0xEF, 0xF5, 0xE1, 0xEF, 0xF5, 0xE2, 0xFF });
|
||||
byte[] btext = text.ToCharArray("ÄÖÜäöüß²€", new byte[] { 0xE1, 0xEF, 0xF5, 0xE1, 0xEF, 0xF5, 0xE2, 0xFF, 0xFF});
|
||||
byte[] upper;
|
||||
byte[] lower;
|
||||
if (text.Length > 80)
|
||||
@ -118,14 +135,20 @@ namespace Matomat
|
||||
}
|
||||
|
||||
private void displayCode(byte[] p)
|
||||
{
|
||||
if (!disable)
|
||||
{
|
||||
this.serialPort.Write(p, 0, p.Length);
|
||||
}
|
||||
}
|
||||
|
||||
private void displayEscCode(string code)
|
||||
{
|
||||
this.displayCode(new byte[] { 0x1b });
|
||||
if (!disable)
|
||||
{
|
||||
this.serialPort.Write(code);
|
||||
}
|
||||
this.displayCode(new byte[] { 0x0d });
|
||||
}
|
||||
public enum Status
|
||||
|
@ -7,9 +7,65 @@ namespace Matomat
|
||||
{
|
||||
class Prod
|
||||
{
|
||||
private long prodId;
|
||||
private bool found;
|
||||
private ProdType type;
|
||||
public enum ProdType
|
||||
{
|
||||
product,
|
||||
instruction
|
||||
}
|
||||
|
||||
public Prod(long prodId)
|
||||
{
|
||||
this.prodId = prodId;
|
||||
this.load();
|
||||
}
|
||||
|
||||
private void load()
|
||||
{
|
||||
if (true)
|
||||
this.found = true;
|
||||
this.type = ProdType.instruction;
|
||||
}
|
||||
|
||||
internal bool vaild()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
LCDDisplay lcd = Factory.getLCDDisplay();
|
||||
if (!found)
|
||||
{
|
||||
lcd.print("²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²"+
|
||||
"² Produkt wurde nich gefunden ²"+
|
||||
"² EAN13: "+(this.GetProdId().ToString()+" unbekannt").PadRight(29,' ')+" ²"+
|
||||
"²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²", LCDDisplay.Status.Error, 5);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
internal ProdType GetProdType()
|
||||
{
|
||||
return this.type;
|
||||
}
|
||||
|
||||
internal long GetProdId()
|
||||
{
|
||||
return this.prodId;
|
||||
}
|
||||
|
||||
internal double GetProdPrice()
|
||||
{
|
||||
return 1.0;
|
||||
}
|
||||
|
||||
internal string GetProdName()
|
||||
{
|
||||
return "Mate-Cola";
|
||||
}
|
||||
|
||||
internal string GetFunctName()
|
||||
{
|
||||
return "aufladen(10);";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -7,10 +7,9 @@ namespace Matomat
|
||||
{
|
||||
class RFIDReader
|
||||
{
|
||||
internal int getCardID()
|
||||
internal long getCardID()
|
||||
{
|
||||
Console.ReadKey();
|
||||
return 0x1234;
|
||||
return 0xFFFFFFFF;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -7,10 +7,10 @@ namespace Matomat
|
||||
{
|
||||
class User
|
||||
{
|
||||
private int userId;
|
||||
private long userId;
|
||||
private bool found;
|
||||
|
||||
public User(int userId)
|
||||
public User(long userId)
|
||||
{
|
||||
// TODO: Complete member initialization
|
||||
this.userId = userId;
|
||||
@ -34,5 +34,25 @@ namespace Matomat
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
internal string GetUserName()
|
||||
{
|
||||
return "pschel2s";
|
||||
}
|
||||
|
||||
internal int GetUserKonto()
|
||||
{
|
||||
return 15;
|
||||
}
|
||||
|
||||
internal long GetUserId()
|
||||
{
|
||||
return this.userId;
|
||||
}
|
||||
|
||||
internal int GetUserAll()
|
||||
{
|
||||
return 35;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user