Version 1.0
This commit is contained in:
parent
3603c9460e
commit
98b5efba0a
@ -1,4 +1,4 @@
|
|||||||
<?xml version="1.0" encoding="utf-8" ?>
|
<?xml version="1.0"?>
|
||||||
<configuration>
|
<configuration>
|
||||||
<appSettings>
|
<appSettings>
|
||||||
<add key="com_display" value="COM1"/>
|
<add key="com_display" value="COM1"/>
|
||||||
@ -12,4 +12,4 @@
|
|||||||
<add key="debug" value="false"/>
|
<add key="debug" value="false"/>
|
||||||
<add key="sell" value="true"/>
|
<add key="sell" value="true"/>
|
||||||
</appSettings>
|
</appSettings>
|
||||||
</configuration>
|
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0,Profile=Client"/></startup></configuration>
|
||||||
|
@ -35,7 +35,18 @@ namespace Matomat.Database
|
|||||||
|
|
||||||
if (db.getError() != null)
|
if (db.getError() != null)
|
||||||
{
|
{
|
||||||
throw new Exception("db Fehler:" + db.getError());
|
Exception e = db.getError();
|
||||||
|
if (e.GetType() == typeof(MySql.Data.MySqlClient.MySqlException))
|
||||||
|
{
|
||||||
|
String mesg = e.Message;
|
||||||
|
if (mesg.Length > 38)
|
||||||
|
{
|
||||||
|
mesg = mesg.Substring(0, 38) + "\n" + mesg.Substring(38);
|
||||||
|
}
|
||||||
|
Matomat.Helper.Factory.getLCD().print(mesg, 10, Matomat.Output.LCDDisplay.Status.Error);
|
||||||
|
System.Threading.Thread.Sleep(10000);
|
||||||
|
throw new Exception("ENDE");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
instances.Add(signature,db);
|
instances.Add(signature,db);
|
||||||
|
@ -21,7 +21,8 @@ namespace Matomat.Model
|
|||||||
query.where(Factory.getDBO().quoteName("p.iscommand") + " = " + Factory.getDBO().quote(0.ToString()));
|
query.where(Factory.getDBO().quoteName("p.iscommand") + " = " + Factory.getDBO().quote(0.ToString()));
|
||||||
query.where(Factory.getDBO().quoteName("h.time") + " >= DATE_SUB(NOW(),INTERVAL 7 DAY)");
|
query.where(Factory.getDBO().quoteName("h.time") + " >= DATE_SUB(NOW(),INTERVAL 7 DAY)");
|
||||||
query.group(Factory.getDBO().quoteName("h.user"));
|
query.group(Factory.getDBO().quoteName("h.user"));
|
||||||
query.order(Factory.getDBO().quoteName("num"));
|
query.order(Factory.getDBO().quoteName("num")+" DESC");
|
||||||
|
query.order(Factory.getDBO().quoteName("name"));
|
||||||
query.limit(0, limit);
|
query.limit(0, limit);
|
||||||
|
|
||||||
Factory.getDBO().setQuery(query);
|
Factory.getDBO().setQuery(query);
|
||||||
@ -54,6 +55,10 @@ namespace Matomat.Model
|
|||||||
Console.WriteLine(Factory.getDBO().getError());
|
Console.WriteLine(Factory.getDBO().getError());
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
if (row[0].GetType() == System.DBNull.Value.GetType())
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
return (int)(double)row[0];
|
return (int)(double)row[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -65,19 +70,38 @@ namespace Matomat.Model
|
|||||||
query.from(Factory.getDBO().quoteName("history", "h"));
|
query.from(Factory.getDBO().quoteName("history", "h"));
|
||||||
query.leftJoin(Factory.getDBO().quoteName("product", "p") + " ON " + Factory.getDBO().quoteName("p.id") + " = " + Factory.getDBO().quoteName("h.prod"));
|
query.leftJoin(Factory.getDBO().quoteName("product", "p") + " ON " + Factory.getDBO().quoteName("p.id") + " = " + Factory.getDBO().quoteName("h.prod"));
|
||||||
query.where(Factory.getDBO().quoteName("h.time") + " >= DATE_SUB(NOW(),INTERVAL 7 DAY)");
|
query.where(Factory.getDBO().quoteName("h.time") + " >= DATE_SUB(NOW(),INTERVAL 7 DAY)");
|
||||||
|
query.group(Factory.getDBO().quoteName("h.user"));
|
||||||
Factory.getDBO().setQuery(query);
|
Factory.getDBO().setQuery(query);
|
||||||
|
|
||||||
object[] row = Factory.getDBO().getResult();
|
List<object[]> rows = Factory.getDBO().getResultList();
|
||||||
if (row == null)
|
if (rows == null)
|
||||||
{
|
{
|
||||||
Console.WriteLine(Factory.getDBO().getError());
|
Console.WriteLine(Factory.getDBO().getError());
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if ((double)row[0] == 0.0)
|
if (rows.Count == 0)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return (int)((double)row[0]/ double.Parse(((decimal)row[1]).ToString()));
|
if (rows[0][0].GetType() == System.DBNull.Value.GetType())
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
if ((double)rows[0][0] == 0.0)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
double num = 0;
|
||||||
|
double meng = 0;
|
||||||
|
foreach (var row in rows)
|
||||||
|
{
|
||||||
|
if (int.Parse(row[1].ToString()) != 0)
|
||||||
|
{
|
||||||
|
meng += double.Parse(row[0].ToString());
|
||||||
|
num++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return (int)(meng/num);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void Add(int product_id, int user_id)
|
public static void Add(int product_id, int user_id)
|
||||||
|
@ -17,7 +17,6 @@ namespace Matomat
|
|||||||
|
|
||||||
public static void Main(string[] args)
|
public static void Main(string[] args)
|
||||||
{
|
{
|
||||||
//test();
|
|
||||||
InitMainThread();
|
InitMainThread();
|
||||||
Thread t = new Thread(MainThread);
|
Thread t = new Thread(MainThread);
|
||||||
t.Start();
|
t.Start();
|
||||||
@ -42,6 +41,8 @@ namespace Matomat
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static void MainThread()
|
private static void MainThread()
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
while (!_shouldStop)
|
while (!_shouldStop)
|
||||||
{
|
{
|
||||||
@ -58,6 +59,17 @@ namespace Matomat
|
|||||||
Factory.rmDBO();
|
Factory.rmDBO();
|
||||||
Factory.rmConfig();
|
Factory.rmConfig();
|
||||||
}
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
Factory.getLCD().print("Der Matomat wurde kritisch beendet.\n" + e.Message);
|
||||||
|
Console.WriteLine(e.ToString());
|
||||||
|
Factory.rmLCD();
|
||||||
|
Factory.rmInput();
|
||||||
|
Factory.rmDBO();
|
||||||
|
Factory.rmConfig();
|
||||||
|
Thread.Sleep(10000);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private static void RequestStop(bool stop)
|
private static void RequestStop(bool stop)
|
||||||
{
|
{
|
||||||
|
@ -1,16 +1,17 @@
|
|||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Runtime.CompilerServices;
|
using System.Runtime.CompilerServices;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
using System.Resources;
|
||||||
|
|
||||||
// Allgemeine Informationen über eine Assembly werden über die folgenden
|
// Allgemeine Informationen über eine Assembly werden über die folgenden
|
||||||
// Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern,
|
// Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern,
|
||||||
// die mit einer Assembly verknüpft sind.
|
// die mit einer Assembly verknüpft sind.
|
||||||
[assembly: AssemblyTitle("Matomat")]
|
[assembly: AssemblyTitle("Matomat")]
|
||||||
[assembly: AssemblyDescription("")]
|
[assembly: AssemblyDescription("Der Matomat")]
|
||||||
[assembly: AssemblyConfiguration("")]
|
[assembly: AssemblyConfiguration("")]
|
||||||
[assembly: AssemblyCompany("Microsoft")]
|
[assembly: AssemblyCompany("BlubbFish")]
|
||||||
[assembly: AssemblyProduct("Matomat")]
|
[assembly: AssemblyProduct("Matomat")]
|
||||||
[assembly: AssemblyCopyright("Copyright © Microsoft 2011")]
|
[assembly: AssemblyCopyright("Copyright © BlubbFish 2013")]
|
||||||
[assembly: AssemblyTrademark("")]
|
[assembly: AssemblyTrademark("")]
|
||||||
[assembly: AssemblyCulture("")]
|
[assembly: AssemblyCulture("")]
|
||||||
|
|
||||||
@ -34,3 +35,4 @@ using System.Runtime.InteropServices;
|
|||||||
// [assembly: AssemblyVersion("1.0.*")]
|
// [assembly: AssemblyVersion("1.0.*")]
|
||||||
[assembly: AssemblyVersion("1.0.0.0")]
|
[assembly: AssemblyVersion("1.0.0.0")]
|
||||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||||
|
[assembly: NeutralResourcesLanguageAttribute("de-DE")]
|
||||||
|
BIN
Working/Matomat.exe
Normal file
BIN
Working/Matomat.exe
Normal file
Binary file not shown.
15
Working/Matomat.exe.config_MODIFY_ME
Normal file
15
Working/Matomat.exe.config_MODIFY_ME
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
<?xml version="1.0"?>
|
||||||
|
<configuration>
|
||||||
|
<appSettings>
|
||||||
|
<add key="com_display" value="COM1"/>
|
||||||
|
<add key="com_rfid" value="COM11"/>
|
||||||
|
<add key="mysql_server" value="127.0.0.1"/>
|
||||||
|
<add key="mysql_user" value="root"/>
|
||||||
|
<add key="mysql_db" value="matomat"/>
|
||||||
|
<add key="mysql_port" value="3306"/>
|
||||||
|
<add key="mysql_pw" value="mafia"/>
|
||||||
|
<add key="mysql_driver" value="mysqli"/>
|
||||||
|
<add key="debug" value="false"/>
|
||||||
|
<add key="sell" value="true"/>
|
||||||
|
</appSettings>
|
||||||
|
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0,Profile=Client"/></startup></configuration>
|
BIN
Working/RfidClass.dll
Normal file
BIN
Working/RfidClass.dll
Normal file
Binary file not shown.
BIN
Working/librfid-tool.exe
Normal file
BIN
Working/librfid-tool.exe
Normal file
Binary file not shown.
BIN
Working/mysql.data.dll
Normal file
BIN
Working/mysql.data.dll
Normal file
Binary file not shown.
BIN
Working/mysql.data.entity.dll
Normal file
BIN
Working/mysql.data.entity.dll
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user